Hostel visit facing problem in output

not getting corect answer but in codeblocks its showing right

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
class hostel{
public:
int x,y;
hostel(ll x,ll y){
this->x=x;
this->y=y;
}

ll dist(){
return (x*x + y*y);}

};

class mycompare{
public:
bool operator()(hostel a,hostel b){
return a.dist()< b.dist();}
};

int main(){
ll q,k;
cin>>q>>k;
ll a,x,y;
priority_queue<hostel,vector,mycompare > pq;
int cs=0;
while(q–){
cin>>a;

    if(a==1){
            cin>>x>>y;
            if(pq.size()!=k){
        hostel h(x,y);
        pq.push(h);
        cs++;}
        else{
            hostel h(x,y) ,h1=pq.top();
            ll t=h.dist();
            ll r=h1.dist();
            if(t<r){
                    pq.pop();
                pq.push(h);
            }
        }

    }
    else if(a==2){
        hostel h=pq.top();
        cout<<h.dist();

    }
}

}

Hi Shashank, please share the link of the question as well.

https://online.codingblocks.com/player/13195/content/752?s=2168

Hi Shashank, the question link is not accessible. Please paste the question here.

Hey Shashank, as you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.
Please mark your doubts as resolved in your course’s “Ask Doubt” section, when your doubt is resolved.