Hello guys... Here's my code for the first problem of the Canada Cup. Unfortunately, I got TLE on test case 4. I was really excited after preparing the solution as I've never been able to solve a single problem within the contest time. Is there anyway to optimize my code? Or do I have to change the approach altogether? Thanks in advance and happy coding to all! Problem link My code



