Unexpected error

Here is the link to the question PRIMES2.

And, here is my solution which runs for 0.58 sec and then gives wrong answer.
http://www.codechef.com/viewsolution/4925265

I am checked most of the probable cases.Still , i am getting wrong answer.
Plz suggest me the reason behind this error.

//