Hi,
Have a look at my submission https://mirror.codeforces.com/contest/1096/submission/47671275. It throws weird error, can someone help me understand why the error only occurs on codeforces judge and not on any other.
It works fine on ideone https://ideone.com/ZwFeP2 and on my local machine.
Thanks!
Your program invokes undefined behavior. In this particular problem
heap-buffer-overflow
means out-of-bound array access.See New: Diagnostics of Solutions in C++ — Codeforces
To debug your program, you can try using Catching silly mistakes with GCC — Codeforces