i made a code for hostel visit problem it works on ideone but gives error on your compiler
#include
#include
using namespace std;
#define pb(x) push_back(x)
#define scl1(a) scanf("%lld", &a)
#define scl2(a, b) scanf("%lld %lld", &a, &b)
#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define ex exit(0)
#define all(a) (a).begin(),(a).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t,i,x,j,y,z,k,n,cs=0;
cin>>t>>k;
priority_queue q;
while(t–){
cin>>z;
if(z==1){
cin>>x>>y;
if(cs<k){
q.push(xx+yy);
cs++;
}
else{
z=q.top();
if((xx+yy)<z){
q.pop();
q.push(xx+yy);
}
}
}
else{
cout<<q.top()<<endl;
}
}
}