WA IN STATUES,even though everything seems to be right

What is wrong with this code?

http://www.codechef.com/viewsolution/4567062

its hard to understand why codechef is giving wrong answer for this?

The question can be found at