Figure out the maximum amount of candy a child can collect
Jelly, 58 bytes

Ø+0r;U$ṗµØ1W;⁸+\Q%“.þ‘)ẎẠ$Ƈµ20Ḋ×©5Ḋ+þ14Ḋ×⁵¤⁺;"Wɼ;ŒBm0⁸œị§Ṁ


Try it online!

Very slow (brute force), TIO can handle up to 8. Test cases in \$[0,8]\$: Try it online!