Why I am getting wrong answer?

#include<bits/stdc++.h>
using namespace std;
int main(){
long long int n,k;
priority_queue pq;
cin>>n>>k;
for(int i=0; i<n; i++){
int no; cin>>no;
if(no == 1){
int a,b;
cin>>a>>b;
int ans = abs(aa) + abs(bb);
pq.push(ans);
}
else if(no == 2){
//cout<<"distance : "<<pq.top()<<endl;
cout<<pq.top()<<endl;
for(int j=0; j<k-1; j++)
pq.pop();
//k–;
}
}
return 0;
}

Hey @Mr_Sidd share your code using ide.codingblocks.com, so that I can help you in debugging it.

I have already shared my code

Have debugged your code here, now it’s giving 100% submission

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.