I don't know why but whenever I try to perform some BFS or DFS on a graph I usually get a Runtime Error and the problem doesn't end there, the main problem is that I am not able to correct my mistake and end up writing the code again. This routine is good for practice but in a contest when I encounter a Runtime Error it is pretty difficult to correct it and sometimes I cannot even find the error after the contest. So in this blog, I just wanted to ask if there is anything that would make it easier to get ahold of where the Runtime Error occurred.
Any suggestions or tips would be appreciated.
Now you might be thinking why I have written Graph Algorithms in the heading. It's because my motivation for writing this blog was a question which I ( was doing 10 minutes ago of writing this blog ) think can be done using graph algorithms and because I think some people do get frustrated while correcting a Runtime Error ( I am sure that I am one of those people ).
English isn't my first language so excuse me for any mistakes.
Submission Link for the code I was talking about: https://codeforces.com/contest/377/submission/85782081
UPD: This was an easy runtime error (exceeded array length).