RANKLIST. Followed editorial still getting WA.

ranklist
wa

#1

Here is my solution. It gives correct answer for the inputs I tried. I made the solution after reading editorial. But I am still getting WA.
http://www.codechef.com/viewsolution/6297947