Help in vector of pairs c++

I am getting an error please pair<int,int> has no member named yy(second) in bool comp()

I’ve tried everythong i could think of

// approach-

#include<bits/stdc++.h>

#define fastScan ios::sync_with_stdio(false),cin.tie(NULL)

#define int long long

#define pb push_back
#define mp make_pair
#define first xx
#define second yy
#define all(x) x.begin(),x.end()

#define endl ‘\n’

using namespace std;

const int MOD = 1e9+7;
const int MAXN = 1e5+5;

bool comp(pair<int,int> x,pair<int,int> y){ return x.yy < y.yy; }

auto main(void) -> signed
{
fastScan;

int t=1,tt=1;
cin>>t;

while(t--)
{
    int n,p,res=0;
    cin>>n>>p;
    vector<pair<int,int> > a(n);
    for(int i=0;i<n;i++)
        cin>>a[i].xx;
    sort(all(a));
    for(int i=1;i<n;i++)
        a[i].yy = a[i].xx - a[i-1].xx ;
    sort(all(a));
    for(int i=0;i<p-1;i++)
        res+=a[p-1].xx-a[i].xx;
    printf("Case #%lld: %lld\n",tt++,res);
}

return 0;

}

/*

3
4 3
3 1 9 100
6 2
5 5 1 2 3 4
5 5
7 7 1 7 7

*/

The declaration of these macros are wrong

#define first xx
#define second yy

It should be

#define xx first
#define yy second
1 Like

oh my god

you are really smart thesmartguy

thanks a lot

:rofl::rofl: