So, just a few hours ago, we finished a contest on a Thai site, namely Codecube. The round consisted of 6 problems to solve in 3 hours. I was feeling confident at first ACing two problems in 15 minutes. Then came the third problem, which was a typical two pointers + data structures. I was almost certain I could solve the problem, and started to code the solution. Many minutes passed by, and I finally got the solution. I submitted it, and got a WA slapped on my face. So, I simply moved on to the fourth problem and ACed it, because finding bugs is time consuming. I later returned to the third problem, and tried finding the bug for almost an hour with no luck, only to find out that the only line I messed up on was: freopen("data.txt", "r", stdin);
, which I forgot to uncomment. Absolutely disappointing.
As many of us know, the freopen command is used to redirect stdio to file IO. This is particularly useful when testing your program on a local machine because you can avoid copying and pasting the test data everytime you want to debug. However, one of the problems I have experienced when using it is I forget to uncomment it out when submitting. This is a huge problem, especially on CF where many points are deducted for resubmission.