#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL getRocketDistance(int x, int y){
return (x*x) + (LL)(y*y);
}
int main(){
priority_queue<LL> pq;
priority_queue<LL,vector<LL>,greater<LL>> pendingEntries;
int n,k;
cin >> n >> k;
for(int i = 0; i < n; i++){
int type;
cin >> type;
if(type == 1){
int x,y;
cin >> x >> y;
LL rocketDistance = getRocketDistance(x,y);
if(pq.size() < k){
pq.push(rocketDistance);
}else{
LL currentMax = pq.top();
if(currentMax > rocketDistance){
pq.pop();
pq.push(rocketDistance);
pendingEntries.push(currentMax);
}else{
pendingEntries.push(rocketDistance);
}
}
}else{
cout << pq.top() << endl;
pq.pop();
}
}
return 0;
}
this is the solution to hostelVisit problem and its not getting submitted, can anyone help me find the mistake, i have took 2 priority queue one is max and other is min