I got this problem from Rustan Leino, who slightly reworded it from a problem he got from Phil Wadler, who said he read the problem on xkcd.
I solved it and wrote up my solution.
A patient has a medical condition that requires them to take two kinds of pills, call them A and B. They must take exactly one A pill and exactly one B pill each day, or they will die. The pills are taken by first dissolving them in water.
The patient has a jar of A pills and a jar of B pills. One day, as they're about to take their pills, they take out one A pill from the A jar and put it in a glass of water. Then they accidentally take out two B pills from the B jar and put them in the water. Now, they're in the situation of having a glass of water with three dissolved pills, one A pill and two B pills. Unfortunately, the pills are very expensive, so the thought of throwing out the water with the three pills and starting over is out of the question. How should they proceed to get the right quantity of A and B while not wasting any pills?
The patient should pour the glass of water into a container large enough to hold at least two glasses' worth of water. Then, they should dissolve another A pill from the A jar into another glass of water and pour that into the container as well. They now have a container with two glasses' worth of water, two A pills, and two B pills.
They should pour one glass's worth from the container into a glass, and drink it. The next day, they should pour the remaining glass's worth into a glass, and drink that.