Bowl of sweets problem

Question

Hints

Answer