I wrote a solution to 525E that works... just not on Codeforces. It produces correct output both on my machine and on Ideone, but prints something different on Codeforces.
Here is the submission: http://codeforces.com/contest/525/submission/11007405
And the Ideone test: http://ideone.com/IMONbz
My guess would be out-of-bounds memory access, but I can't find that anywhere... could somebody please help me?
Thank you for the replies! It was indeed caused by
pow. Didn't expect to it to produce floating point numbers even when fed integers. A lesson learned, I guess. Sometimes I wish for Haskell's
^ (yes, I know it's XOR in c++).
The new submission: http://codeforces.com/contest/525/submission/11008141