Codeforces Beta Round #79 Problem E Candies and Stones