Let's fix those unnecessary TLEs for real

I personally had a hard time fixing those unnecessary time limit exceeded errors in Competitive Programming when I was starting out. Now, I know most of the time what happens is that the algorithm that we are using is totally fine for the constraints but still we do get those TLEs every now and then. One main reason for this is the slow manner in which we output. This is very common on Codechef as the time limits are very tight here and if your code is not super optimized you will likely get that annoying TLE in spite of your algorithm being the optimal one.

So, I thought why not just make a video where I explain why this type of TLEs occur and how you can fix them without making a lot of changes in your code.
You can check out the video here:

2 Likes