Please help me out solving the hostel visit question as i have tried but not able to pass test cases

#include < iostream>
#include< queue >
#include< vector>
#include < algorithm>

using namespace std;

class roomno
{
public:
int x;
int y;

roomno(int x,int y)
{
    this->x=x;
    this->y=y;
}
void print()
{
    cout<<"location"<<"("<<x<<","<<y<<")"<<endl;
}

int distance ()
{
return (xx+yy);
}

};
class roomcompare
{
public:
bool operator() (roomno r1,roomno r2)
{
return r1.distance()>r2.distance();
}
};

int main()
{
int x[1000]},y[1000];
int l,k=0;

priority_queue<roomno,vector,roomcompare> pq;
int n,i,j;
cin>>n>>l;
//cin>>n;
cin.ignore();
for( i=0;i<n;i++)
{
cin>>x[i];
}
cin.ignore();
for( j=0;j<n;j++)
{
cin>>y[j];
}
cin.ignore();

for(i=0;i<n;i++ )
{
    roomno r1(x[i],y[i]);
    pq.push(r1);
}
while(!pq.empty()&&k!=l)
{   k++;
    roomno r2=pq.top();
    r2.print();
    pq.pop();

}
return 0;

}

what is wrong with my code why the test cases are not running , gone through the hint video but didn’t get it , please help me out.

@gupta.ritik2002
Hello ritik,
please save your code on coding blocks ide and share the link here.

coding blocks ide is not creating the short url

hostel visit question link

@gupta.ritik2002
Hello ritik,
You are not reading input as specified in input format.

Please check input format and modify your code

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.

sir in the solution given for hostel visit problem i am not able to understand pq.pop() statement is written first

actually please help me understand the question sir

sir is this possible that i can contact you via phone and clear my doubt ,please

@gupta.ritik2002
Hello ritik,
dont worry its easy problem . i will make u solve this problem easily.

basically i am not able to understand the full if(rocketdistance(x,y)<pq.top()) block

@gupta.ritik2002
ok lets discuss another problem first

@gupta.ritik2002
ritik i will talk to u in evening .actually my laptop is down and no electricty here.
till then try to solve this problem.
you are given n numbers and k. you are reading it from left to right. and everytime u need to print kth smallest number .

@gupta.ritik2002
hello ritik,
have u tried the problem i gave to solve

@gupta.ritik2002
hello ritik are u there

@gupta.ritik2002
Hello ritik,
i m marking ur doubt as resolved .u can dm me for issue related to this problem. my user name is aman212yadav

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.

Hey sir the problem you gave may be solve using heap datastructure

Yeah… … …

Sir but please discuss hostel visit problem