Write a polite but firm email to a landlord who has not fixed the heating for three weeks. I want the repair, not a fight.
DeepSeek V4.1 Flash 1017
Subject: Urgent: Heating repair outstanding for three weeks — [Property Address]
Dear [Landlord’s Name],
I’m writing about the heating at [Property Address], which has not been working since [date]. I first reported the issue on [date] and followed up on [dates]. It has now been three weeks, and the property is becoming difficult to live in.
I’d be grateful if you could arrange for a qualified heating engineer to inspect and repair the system as soon as possible. I can provide access at [times/dates] and will cooperate fully with any appointment.
Please confirm in writing:
the date the repair will be carried out; or
if there is a delay due to parts or engineer availability, what interim heating arrangements you will provide.
Given how long this has been outstanding, I’d ask for a confirmed appointment within the next [48 hours/two working days], with the repair carried out within [five working days] or as soon as reasonably practicable. I’m not looking to escalate this—I would much prefer to resolve it directly—but I do need the heating fixed.
Please let me know by [date/time] how you intend to proceed.
Kind regards, [Your Name] [Phone Number] [Email Address]
Asked Nov 1, 2026. Unedited.
Write a React hook that debounces a value and cancels on unmount. Include the TypeScript types.
DeepSeek V4.1 Flash 1017
import { useEffect, useState } from "react";
/**
* Returns `value`, but only after it has stopped changing for `delay` ms.
* The pending timer is cleared on unmount and whenever `value`/`delay` change.
*/
export function useDebouncedValue<T>(value: T, delay = 300): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value);
useEffect(() => {
const timerId = setTimeout(() => {
setDebouncedValue(value);
}, delay);
// Runs on unmount *and* before the next effect run.
// Clearing the timer is what prevents a setState-after-unmount.
return () => {
clearTimeout(timerId);
};
}, [value, delay]);
return debouncedValue;
}Usage:
function Search() {
const [query, setQuery] = useState("");
const debouncedQuery = useDebouncedValue(query, 400);
useEffect(() => {
if (!debouncedQuery) return;
const controller = new AbortController();
fetch(`/api/search?q=${encodeURIComponent(debouncedQuery)}`, {
signal: controller.signal,
});
return () => controller.abort();
}, [debouncedQuery]);
return <input value={query} onChange={(e) => setQuery(e.target.value)} />;
}Why this is safe on unmount
clearTimeout in the cleanup is sufficient — no isMounted ref needed:
Unmount → React runs the cleanup → the timer is cancelled, so
setDebouncedValuenever fires.valuechanges → the old timer is cancelled before a new one starts, which is exactly the debounce behavior.
An isMounted flag would only mask the problem and adds a render-time ref read; skipping it is the idiomatic approach.
Behavior notes
The first render is not debounced.
useState(value)seeds with the current value, sodebouncedValue === valueuntil the first change. If you need a different initial value, add a parameter:useDebouncedValue<T>(value: T, delay = 300, initialValue: T = value).delayis reactive. Changing it mid-flight restarts the timer. That's usually desired; if not, stash it in a ref.StrictMode-safe. The dev-only double-invoke of effects just clears and re-sets one timer.
delay: 0is valid (defers by a macrotask), useful for coalescing rapid updates.
Optional: leading edge
If you want the first change to apply immediately and only subsequent ones to be debounced, track the previous value:
export function useDebouncedValue<T>(value: T, delay = 300, leading = false): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value);
useEffect(() => {
if (leading && debouncedValue === value) return; // hmm — see note
...
}, [value, delay]);
...
}Honestly, leading-edge debouncing is cleaner as a separate useDebouncedCallback hook — mixing it into a value hook forces you to reason about which render "owns" the leading edge, and the extra state usually isn't worth it.
Asked Nov 1, 2026. Unedited.
A drug test is 99% accurate, and 0.5% of people use the drug. Someone tests positive. What is the probability they use it, and why does the answer surprise people?
DeepSeek V4.1 Flash 1017
Assuming “99% accurate” means:
A drug user tests positive 99% of the time: (P(+|D)=0.99)
A non-user tests negative 99% of the time, so a non-user falsely tests positive 1% of the time: (P(+|\neg D)=0.01)
Prevalence: (P(D)=0.005)
Using Bayes’ theorem:
[ P(D|+) = \frac{P(+|D)P(D)} {P(+|D)P(D)+P(+|\neg D)P(\neg D)} ]
[ = \frac{0.99 \times 0.005} {0.99 \times 0.005 + 0.01 \times 0.995} = \frac{0.00495}{0.00495+0.00995} \approx 0.332 ]
So the probability the person uses the drug, given a positive test, is about 33%, not 99%.
Why it surprises people: this is base-rate neglect. Because drug use is rare (0.5%), there are many more non-users than users. Even a small false-positive rate creates more false positives than the true positives from the rare group.
In a group of 1,000 people:
About 5 use the drug; ~4.95 test positive.
About 995 do not use it; ~9.95 falsely test positive.
So among roughly 14.9 positive tests, only about 4.95 are true positives:
[ \frac{4.95}{14.9} \approx 33\% ]
The key intuition: a positive result from an accurate test is still weak evidence when the condition is very rare.
Asked Nov 1, 2026. Unedited.
What it’s good at
Ranked against 42 models, from public leaderboards and our own blind tests where we have them. How we rank
- #13of 42 for research
- #14of 42 for writing
- #15of 42 for coding
The facts
DeepSeek V4.1 Flash 1017 is the October update of DeepSeek’s fast V4.1 model, with open weights. It reads images as well as text.
Scores from artificialanalysis.ai and lmarena.ai.
- Made by
- DeepSeek
- API price, per 1M tokens
- $0.30 in, $1.20 out
- Speed
- 169 tokens a second
- Artificial Analysis Index
- 45.1
- LMArena text
- No public score
- LMArena coding
- No public score
- Updated
- Oct 26, 2026