https://www.codechef.com/problems/ZUBPALK

I’ve attempted this problem a few times and each time hit a different wall. Today, I finally revisited the problem after taking a break from it for a month or two and was feeling confident. My previous solution was too slow so I made a few optimizations and was able to make it way faster. If you’re interested in the old solutions let me know, but none of the logic changed so my guess is that time-outs take precedence over wrong answers. Anyhow, heres my most recent submission: CodeChef: Practical coding for everyone

I forgot to change the comment on line 106 because that change is one of the few that really sped things up. Any insight would be appreciated as this problem remains unsolved. I would love for all of this to be caused by a simple design flaw but I’m prepared to refactor the entire program if need be.