I read the Editorial. It's basically the same thing. Still getting WA. I'm very confident that the code is correct :( Please please review. My life is at a standstill :(
Problem: http://www.codechef.com/problems/GRANAMA
My submission: http://www.codechef.com/viewsolution/3105197