Cannot understand source for run time error

code is working perfectly fine for all cases but still it is showing runtime error for 1 case. could you please help me rectify this.

@Priyansh,
Please provide a Coding Blocks IDE link of your code.

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.

link for code-https://ide.codingblocks.com/s/203051

What is your question here?

Dean of MAIT is going to visit Hostels of MAIT. As you know that he is a very busy person so he decided to visit only first “K” nearest Hostels. Hostels are situated in 2D plane. You are given the coordinates of hostels and you have to answer the Rocket distance of Kth nearest hostel from origin ( Dean’s place ) .

What problem are you facing? Is your code giving wrong answer?

yes i have tried many test cases and it gives the correct answer everytime but 1 test case is not working and im not able to identify it

Ok please provide the link to your code in coding blocks IDE.

i have mentioned it above

Use a priority queue for this question.
Push elements in the pq till its size is less than k.
When its size is k and a new element comes, check if it is smaller than pq.top(). If it is, then pop from queue and push the current value.
Else if first value is not equal to 1 in the queries, simply display the top element of the queue.

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.