Hostel visit problem

what is wrong in this code?? it is not giving the correct output.

#include
#include
#include
using namespace std;
int main() {
priority_queuepq;
int q,k,t,x,y;
cin>>q>>k;
while(q–){
cin>>t;
if(t==1){
int res=(xx)+(yy);
pq.push(res);
}
else{
while(pq.size()>k) pq.pop();
cout<<pq.top();
}
}
return 0;
}

uses long long int for all variables, ensuring better handling of large inputs.

You can refer my code as well

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.