Wrong answer on codeforces but correct answer on Ideone and on my PC!

This is the question ive been doing

QUESTION : http://codeforces.com/contest/460/problem/B

MY SOLUTION : http://ideone.com/i6fiRc

Codeforces says that on testcase 8 which is 5 9998 9998 my code gives the output as 0 but on my PC and on Ideone it gives the required output which is 1
1933785806


How is this possible???

1 Like

here is your AC code

http://codeforces.com/contest/460/submission/7545991

Same thing was happening with me…