problem: https://codeforces.me/contest/1070/problem/D
my python solution said it had a runtime error on #5, and compared to my previous solution which gave wrong answer at #6, i really don't see a way how it could give a runtime error.
python: https://pastebin.com/GXnGg7wA
the piece of code that gives "runtime error" for #5:
if remain != 0 and bagsRn != 0: bags+=1
like what? don't understand how that could possibly give a runtime error, it's logically sound and if it gave wrong answer or exceeded time limit it would just say that... not to mention it went through 5 test cases + numerous of my own test cases to try and break it, so at the WORST it should give "wrong answer" not a runtime error
you have defined
remain
bagsRn
andbags
inside the loop and you are accessing it outside the loop in the end. That's why it is giving that error.