In today's contest(Problem C), I did a pretty silly mistake where I redeclared a variable inside a loop due to which the global variable was not getting updated. Hence I was trying to find the fault in my logic and Spent exactly 1 hour and 40 minutes regretting my life. While going through my solution now I discovered this and now I want to kill myself.
Now in all seriousness how do I stop repeating these silly errors in the heat of the contest? I have been doing these a lot lately.