WA in PROXYC

here is my link to two of my solutions, one is which gives WA while the other one is accepted.

https://www.codechef.com/viewsolution/26874660 : WA
https://www.codechef.com/viewsolution/26874623 : Accepted

The only difference in both the codes is that a certain section of the code has different positions in the two solutions.

Please explain what effect does the position of that section made?