Candy (Dynamic Programming)