5. Nikita has a magic jar. If you put $n$ candies in the jar and close it for an hour, the number of candies inside will increase by the sum of the digits of $n$. For example, if there were 137 candies, it would become $137+1+3+7=148$. What is the maximum number of candies Nikita can get in 20 hours and 16 minutes, if he starts with one candy?
Solution. We need to strive to have as many candies as possible at the end of each hour. However, this does not mean that we should always put all the candies in the jar. The greatest sum of digits (i.e., the greatest increase in the number of candies) is achieved with a number where all digits (except the first) are nines.

1 hour: $1+1=2$

2 hour: $2+2=4$

3 hour: $4+4=8$

4 hour: $8+8=16$

5 hour: (put 9 candies) $16+9=25$

6 hour: (put 19 candies) $25+10=35$

7 hour: (put 29 candies) $35+11=46$

8 hour: (put 39 candies) $46+12=58$

9 hour: (put 49 candies) $58+13=71$

10 hour: (put 69 candies) $71+15=86$

11 hour: (put 79 candies) $86+16=102$

12 hour: (put 99 candies) $102+18=120$

13-17 hours: put 99 candies each hour, the number of candies increases by 18 each hour, resulting in $138,156,174,192,210$ candies.

18-20 hours: put 199 candies each hour, the number of candies increases by 19 each hour, resulting in $229,248,267$ candies.

In the remaining 16 minutes, it is impossible to gain anything.

Answer: 267 candies.