Anybody know why this happens? I'm completely thrown off on how to debug this, since the bug disappears when I do cout. (this is only on my local machine, but I will provide the code)
My submission : https://mirror.codeforces.com/contest/1851/submission/221618285
Please provide some tips, because google is not.