Unable to pass any test case in Hostel Visit Problem

I am unable to pass any test case (and 1 test case gives a TLE) for the problem Hostel visit. I am not sure why that is hapening becuase my the given examples works fine as well. Please help.

Here is my code : https://ide.codingblocks.com/s/392914

As test cases are very big so use long long int instead of int also to avoid TLE i would suggest you to use STL priority queue. As it will save alot of time might be the reason why you are getting TLE in this test case
Also your priority queue isn’t showing output format properly cause for test case:
9 3
1 10 10
1 12 18
1 -90 -18
2
1 19 19
2
1 3 0
1 2 20
2

Expected Order is:
8424
722
404

Yours is giving in this order:
468
8424
404

If there’s any more issue, you can ask it here.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.