Hostel Visit- TLE

Why is my code showing TLE?

@priyanshi.agarwal3405 You have used a min heap for this problem. Using a max heap will be more efficient. Just think about it and try using a max heap.
So, maintain a k sized max heap…if size of heap becomes > k pop the top element…the top element at any moment will be the kth nearest distance…

Tried using max heap as well but it is giving wrong answer for 1 test case. The link to my code is: https://ide.codingblocks.com/s/175931

@priyanshi.agarwal3405
at the point of k+1 insertion .
check
if (distance<pq.top())
{
pq.pop();
pq.push(dist);

}
else
{
//DO NOTHING
}

Still 1st test case is showing wrong answer. Could you please tell why?? https://ide.codingblocks.com/s/176003

Check now if it works.

Okay, got it. Thank you sir!