WA in PROXYC

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

CodeChef: Practical coding for everyone : WA
CodeChef: Practical coding for everyone : 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?