HackerEarth Candy Distribution Solved