Hostel visit problem - wrong answer

A few wrong answer test cases failing:-

#include <iostream>

#include
#include
using namespace std;

class Coord {
public:
long long int x, y;

Coord(long long int xcoord, long long int ycoord) {
    x=xcoord;
    y=ycoord;
}

};

class CoordCompare {
public:
bool operator()(Coord A, Coord B) {
long long int firstDistance = A.xA.x + A.yA.y;
long long int secondDistance = B.xB.x + B.yB.y;
// max heap
return firstDistance < secondDistance;
}
};

long long int distance(Coord el) {
return el.xel.x+el.yel.y;
}

int main() {
long long int t, k;
priority_queue <Coord, vector, CoordCompare> pq;
cin>>t>>k;
while (t–) {
// for each query -> either its query 1 or 2
// for query one -> insert the distance into the minHeap
// to avoid tle, make sure that your pq is k sized always
long long int query;
cin>>query;
if (query==1) {
long long int x, y;
cin>>x>>y;
Coord c(x, y);
if (pq.size()==0) {
pq.push©;
}
else {
Coord top = pq.top();
if (distance© < distance(top)) {
// only then insert
if (pq.size()==k) {
pq.pop();
}
pq.push©;
}
}
} else if (query==2) {
// query 2 -> get the kth nearest hostel distance
Coord topel = pq.top();
cout<<distance(topel)<<endl;
}
}
return 0;
}