This is a very strange incident. And I'll not be exaggerating when I say this but, I truly am bewildered by it.
While solving the following question : http://codeforces.net/problemset/problem/614/A
I got a WA on Test case 39. When I decided to run the same code on Ideone, this is what I found:
Case 1 : I run the code as it as : http://ideone.com/MLGW4I
Case 2 : I add an additional printf statement, leaving the entire remaining code unchanged. : http://ideone.com/X9kngM
The change can be seen (addition of an extra printf statement) in line no. 31 of the code.
How can it be possible that a simple printf statement changes the output that follows, when nothing is changed anywhere else? Or is it some pretty big blunder that I'm making and am completely unaware of it?
Any help regarding this will be much appreciated.