I think everybody must be having same problem in Problem D having time limit exceeded on Test case 15. The time limit is too strict for the problem. I am tired of optimizing it further now and I have seen exactly same logic being accepted. I am tired and frustrated now. Somebody pls tell how to optimize it from here on.
Here is my Code:
(https://mirror.codeforces.com/contest/1499/submission/110388552)