At first have a look on my these two submissions linked below then we will discuss.
Can you see any difference between them? Oh! their verdict are totally different! But have a look on the codes. Does there any difference exist? The correct answer is no! you can check taking these two to any comparator.
The accepted one is dated on Oct 1, 2013 4:00:13 PM and the wrong answer one is dated on today!
But Codeforces changed a lot in the mean time, I think. They are not allowing "r+" or "w+" anymore, I think. The behavior of these two things are suspicious now!
Just open my code and delete two '+' signs from line no 5 and 6 and submit.
Thats it! Again accepted!
But I discovered this in the contest time which held in our institution in hust online judge!
So, be aware of using "w+" and "r+".
Have a nice day!