SPOJ Problem Set (classical)  3407. Candy  Problem code: SAMER08C