So, I have participated in Codeforces Round #221 (Div.2) and tried to solve problem number 2: I.O.U. Pretests passes, no problem. After that i saw that i have Runtime Error on test 12 and since now I haven't figured out what's the problem.
Code:
Can you please help me a bit with this?








