47th ICPC World Finals
Problem authors: Jakub Onufry Wojtaszczyk and Federico Glaudo
Solved by 96 teams.
First solved after 33 minutes.
Shortest team solution: 669 bytes.
Shortest judge solution: 246 bytes.

This problem, which has absolutely no real-world inspirations, can be solved with a greedy approach with a short implementation.
One method to solve this problem is to first ignore the restriction that you cannot sleep while rested. This allows you to sleep during some intervals [ei, bi+1], where e0 = 0. After sleeping during one such interval, we can be awake until ei + 2(bi+1 − ei), so we greedily sleep during these intervals if they allow us to stay up later than we currently can.
After having a list of sleeping intervals from the above process, we need to modify them such that the beginning of one sleep interval is not in the k minutes after the end of the previous one. To do so, say two consecutive sleep intervals are [si, ti] and [si+1, ti+1]. Then we need si+1 ≥ ti + (ti − si) = 2ti − si ⇔ (si+1 + si)/2 ≥ ti. Thus we set ti to the mean of si and si+1 if needed.