So, I just got hacked on this problem from the recent Div4 contest for problem G1 and I still don't know why. I got TLE but there is nothing in my code that could've caused it. Can someone please help?
Submission Link: https://codeforces.net/contest/1791/submission/192492521 Problem Link: https://codeforces.net/contest/1791/problem/G1