Sponsored
Use these hints if you're stuck. Try solving on your own first.
Give candy to everyone each "turn" first [until you can't], then give candy to one person per turn.
Solve with full IDE support and test cases