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.
Gemini 3.8 Flash
Subject: Urgent: Heating repair follow-up – [Your Unit/Apartment Number]
Dear [Landlord's Name],
I hope you are having a good week.
I am writing to follow up on the heating issue in [Unit/Apartment Number], which was first reported on [Date of first message, e.g., October 12th]. It has now been three weeks since the heat stopped working, and the issue remains unresolved.
With the temperatures dropping, the apartment has become uncomfortably cold and difficult to live in. While I appreciate that coordinating maintenance can sometimes take time, three weeks without heat is a pressing issue that needs immediate attention.
Could you please confirm by [Day of week, e.g., tomorrow at 5:00 PM] when a technician will be arriving to complete the repair?
I am happy to make myself available or provide permission for entry so this can be resolved as quickly as possible.
Thank you for your prompt attention to this matter. I look forward to your update.
Best regards,
[Your Name] [Your Phone Number] [Your Apartment Number]
Asked Nov 1, 2026. Unedited.
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.
Gemini 3.8 Flash
Here is a complete, typed useDebounce hook. It uses a generic type T so it works with any data type (strings, objects, numbers, etc.) and cancels the timer if the value changes or when the component unmounts.
The Hook
import { useState, useEffect } from 'react';
/**
* Custom hook that debounces a value.
* Cancels pending timeouts when the value changes or on component unmount.
*
* @param value The value to be debounced.
* @param delay The debounce delay in milliseconds (default: 500ms).
* @returns The debounced value.
*/
export function useDebounce<T>(value: T, delay: number = 500): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value);
useEffect(() => {
// Set up the timer to update the value after the delay
const timer = setTimeout(() => {
setDebouncedValue(value);
}, delay);
// React runs this cleanup function:
// 1. Before re-running the effect when `value` or `delay` changes.
// 2. When the component unmounts.
return () => {
clearTimeout(timer);
};
}, [value, delay]);
return debouncedValue;
}Example Usage
import React, { useState, useEffect } from 'react';
import { useDebounce } from './useDebounce';
export const SearchComponent: React.FC = () => {
const [searchTerm, setSearchTerm] = useState<string>('');
// Debounce the input by 300ms
const debouncedSearchTerm = useDebounce<string>(searchTerm, 300);
useEffect(() => {
if (debouncedSearchTerm) {
// Trigger API call / search operation here
console.log(`Fetching results for: ${debouncedSearchTerm}`);
}
}, [debouncedSearchTerm]);
return (
<input
type="text"
placeholder="Search..."
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
/>
);
};How cancellation works:
The return () => clearTimeout(timer); inside useEffect is React's native cleanup mechanism. React guarantees this cleanup function runs whenever the component is removed from the DOM (unmounted), preventing state updates on unmounted components and memory leaks.
Asked Nov 1, 2026. Unedited.
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?
Gemini 3.8 Flash
If someone tests positive, the probability that they actually use the drug is approximately 33.2% (or roughly 1 in 3).
Here is the step-by-step breakdown of the math and the psychological reason why this result is so counterintuitive.
The Math (Using a Concrete Example)
The easiest way to understand this is to imagine a population of 10,000 people:
How many people actually use the drug?
0.5% of 10,000 = 50 people are drug users.
99.5% of 10,000 = 9,950 people do not use the drug.
What happens when the 50 drug users take the test (99% accuracy)?
True Positives: $99\% \times 50 = \mathbf{49.5\text{ people}}$ test positive.
False Negatives: 0.5 people test negative.
What happens when the 9,950 non-users take the test (1% error rate)?
False Positives: $1\% \times 9,950 = \mathbf{99.5\text{ people}}$ test positive.
True Negatives: 9,850.5 people test negative.
Calculate the probability:
Total positive tests = $49.5 + 99.5 = \mathbf{149\text{ total positive tests}}$.
Of those 149 positive tests, only 49.5 are actual users.
$$\text{Probability} = \frac{49.5}{149} \approx 0.3322 \text{ (or } \mathbf{33.2\%}\text{)}$$
Even with a positive test, there is roughly a 67% chance the person is clean.
Why Does This Surprise People?
This counterintuitive result is caused by a cognitive bias known as the Base Rate Fallacy (or Base Rate Neglect).
People focus on the test, not the population: Humans naturally anchor on the "99% accurate" figure and assume a positive test means a 99% chance of guilt.
The power of small percentages on large groups: Non-users make up the overwhelming majority of the population (99.5%). Even though the test's error rate is tiny (just 1%), 1% of a huge group (99.5 people) produces more positive results than 99% of a tiny group (49.5 people).
In short, false positives end up outnumbering true positives roughly 2 to 1, which catches most people off guard.
Asked Nov 1, 2026. Unedited.
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.
Head to head
Ranked against 42 models, from public leaderboards and our own blind tests where we have them. How we rank
| Task | Gemini 3.8 Flash | DeepSeek V4.1 Flash 1017 | Leads |
|---|---|---|---|
| Coding | #13 | #15 | Gemini 3.8 Flash |
| Writing | #17 | #14 | DeepSeek V4.1 Flash 1017 |
| Math | #9 | #15 | Gemini 3.8 Flash |
| Research | #11 | #13 | Gemini 3.8 Flash |
| Everyday chat | #6 | #17 | Gemini 3.8 Flash |
The facts
Scores from artificialanalysis.ai and lmarena.ai.
| Fact | Gemini 3.8 Flash | DeepSeek V4.1 Flash 1017 |
|---|---|---|
| Made by | DeepSeek | |
| API price, per 1M tokens | $0.75 in, $3.75 out | $0.30 in, $1.20 out |
| Speed | 132 tokens a second | 169 tokens a second |
| Artificial Analysis Index | 40.9 | 45.1 |
| LMArena text | 1,498 | No public score |
| LMArena coding | 1,508 | No public score |
| Updated | Oct 26, 2026 | |