stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

#define f first

#define s second

#define mp make_pair

typedef long long int ll;

const int N=1e5+5;

int n,vis[N];

pair< pair<int,int>, int >  p[N];

priority_queue < pair < int, pair<int,int> > > q;

ll ans;

int par(int x){

    return((vis[x]==-1||vis[x]==x)? x:par(vis[x]));

}

int main(){

    //cin.tie(NULL);

   // cout.tie(NULL);

    //ios_base::sync_with_stdio(false);

    memset(vis,-1,sizeof vis);

    cin>>n;

    for(int i=0;i<n;i++){

        cin>>p[i].f.f>>p[i].f.s;

        p[i].s=i;

    }

    sort(p,p+n);

    for(int i=1;i<n;i++)

        q.push( mp( -(p[i].f.f-p[i-1].f.f),mp(p[i].s,p[i-1].s)));



    for(int i=0;i<n;i++)

        swap(p[i].f.f,p[i].f.s);

    sort(p,p+n);

    for(int i=1;i<n;i++)

        q.push( mp(-(p[i].f.f-p[i-1].f.f),mp(p[i].s,p[i-1].s)));

    while(q.size()){

        pair< int, pair<int,int> > x=q.top();

        q.pop();

        //cout<<x.s.f<<" "<<vis[x.s.f]<<" "<<x.s.s<<" "<<vis[x.s.s]<<" "<<x.f<<'\n';

        vis[x.s.f]=par(x.s.f);

        vis[x.s.s]=par(x.s.s);

        if(vis[x.s.f]==vis[x.s.s])

            continue;

        ans+=-x.f;

        vis[vis[x.s.f]]=vis[x.s.s];

    }

    cout<<ans<<'\n';

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.3836482325287691x):
#include <bits/stdc++.h>

using namespace std;



#define fr(i,n) _back

#define pb	push_back

#define eb	emplace_back

#define mk	make_pair

#define fi	first

#define se	second

#define endl	'\n'



typedef long long ll;

typedef pair<int,int> ii;

typedef vector<ii> vii;

typedef tuple<int,int,int> ti;

typedef vector<ti> vti;

const int INF = 0x3f3f3f3f;

const double PI = acos(-1.0);

const int T = 1e5 + 2;



vii xs;

vii ys;

priority_queue<ti,vti, greater<ti>>pq;

int n;

int pai[T];

int peso[T];



void init() {

    for(int i = 0; i <= n; i++) {

        pai[i] = i;

        peso[i] = 1;

    }

}



int find(int x) {

    return (x == pai[x]? x : pai[x] = find(pai[x]));

}



void join(int x, int y) {

    x = find(x);

    y = find(y);

    if(peso[x] < peso[y]) swap(x,y);

    pai[y] = x;

    peso[x] += peso[y];

}



int main() {

    ios_base::sync_with_stdio(false);

    cin >> n;

    init();



    for(int i = 0; i < n; i++) {

        int a,b; cin >> a >> b;

        xs.eb(a,i);

        ys.eb(b,i);

    }



    sort(xs.begin(), xs.end());

    sort(ys.begin(), ys.end());



    for(int i = 1; i < n; i++) {

        pq.emplace(xs[i].fi - xs[i-1].fi, xs[i-1].se, xs[i].se);

        pq.emplace(ys[i].fi - ys[i-1].fi, ys[i-1].se, ys[i].se);

    }



    ll ans = 0;



    while(!pq.empty()) {

        ti at = pq.top();

        pq.pop();

        ll d,a,b;

        tie(d,a,b) = at;

        if(find(a) != find(b)) {

            ans += d;

            join(a,b);

        }

    }



    cout << ans << endl;



    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int maxn=1e6+10;

const int MAXM=1e6+10;

int F[maxn];

struct node

{

    int x,y,id;

}sp[maxn];

bool cmp2(node a,node b)

{

    return a.x<b.x;

}

bool cmp3(node a,node b)

{

    return a.y<b.y;

}

struct Edge

{

    int u,v,w;

}e[MAXM];

int tol;

void addedge(int u,int v,int w)

{

    e[tol].u=u;

    e[tol].v=v;

    e[tol++].w=w;

}

bool cmp(Edge a,Edge b)

{

    return a.w<b.w;

}

int Find(int x)

{

    if(F[x]==-1)return x;

    else return F[x]=Find(F[x]);

}

int Krustal(int n)

{

    memset(F,-1,sizeof(F));

    sort(e,e+tol,cmp);

    int cnt=0;

    int ans=0;

    for(int i=0;i<tol;++i)

    {

        int u=e[i].u;

        int v=e[i].v;

        int w=e[i].w;

        int t1=Find(u);

        int t2=Find(v);

       // cout<<t1<<' '<<t2<<endl;

        if(t1!=t2)

        {

            ans+=w;

            F[t1]=t2;

            cnt++;

        }

        if(cnt==n-1) break;

    }

   // cout<<cnt<<endl;

    if(cnt<n-1)return -1;

    else return ans;

}

int main()

{

    int n;

    cin>>n;

    tol=0;

    for(int i=1;i<=n;++i)

    {

        cin>>sp[i].x>>sp[i].y;

        sp[i].id=i;

    }

    sort(sp+1,sp+1+n,cmp2);

    for(int i=1;i<n;++i)

    {

        addedge(sp[i].id,sp[i+1].id,sp[i+1].x-sp[i].x);

    }

    sort(sp+1,sp+1+n,cmp3);

    for(int i=1;i<n;++i)

    {

        addedge(sp[i].id,sp[i+1].id,sp[i+1].y-sp[i].y);

    }

    int ans=Krustal(n);

    cout<<ans<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.134299039220321x):
#include<iostream>

#include<stdio.h>

#include<string.h>

#include<vector>

#include<stdlib.h>

#include<math.h>

#include<set>

#include<algorithm>

using namespace std;

typedef long long ll;

const int mod = 1e9+7;

const int maxn = 1e5+5;

int fa[maxn];

struct Node{

  ll x, y, id;

}st[maxn];

 

struct Edge{

  ll cost, p1, p2;

}edge[maxn*2];



int cmp1(Node a,Node b){ 

	return a.x<b.x; 

}

int cmp2(Node a,Node b){ 

	return a.y<b.y; 

}

int cmp3(Edge a,Edge b){ 

	return a.cost<b.cost; 

}

 

int find(int u){

  	if(fa[u]==u) 

  		return fa[u];

  	return fa[u]=find(fa[u]);

}

 

int main(){

    int n;

    scanf("%d",&n);

    for(int i=1;i<=n;i++) {

		scanf("%lld%lld", &st[i].x, &st[i].y); 

		st[i].id=i; 

		fa[i]=i;

	}

    sort(st+1,st+1+n,cmp1);

    int cnt=0;

    for(int i=2;i<=n;i++){

        edge[++cnt].p1=st[i-1].id;

        edge[cnt].p2=st[i].id;

        edge[cnt].cost=st[i].x-st[i-1].x;

    }

    sort(st+1,st+1+n,cmp2);

    for(int i=2;i<=n;i++){

        edge[++cnt].p1=st[i-1].id;

        edge[cnt].p2=st[i].id;

        edge[cnt].cost=st[i].y-st[i-1].y;

    }

    sort(edge+1,edge+1+cnt,cmp3);

    ll ans=0;int num=0;

    for(int i=1;i<=cnt;i++){

        int fa_p1=find(edge[i].p1);

        int fa_p2=find(edge[i].p2);

        if(fa_p1==fa_p2) 

			continue;

        else{

            fa[fa_p1]=fa_p2;

            num++;

            ans+=(edge[i].cost);

        }

        if(num==n-1) break;

    }

    printf("%lld\n",ans);



    return 0;



}
// Slower C++ solution:
#include<bits/stdc++.h>

    using namespace std;

     

    int main()

    {

        int x,a,b;

        while(cin>>x>>a>>b){

            x-=a;

            x%=b;

            cout<<x<<endl;

        }

        return 0;

    }

// Faster C++ solution for the same problem (measured speedup: 5.252572991621932x):
#include<stdio.h>

int main()

{

    int a,b,x;

    scanf("%d%d%d",&x,&a,&b);

    printf("%d\n",((x-a)%b));

}
// Slower C++ solution:
#include<bits/stdc++.h>

     using namespace std;



     int main()

     {

         int y,a,b;

         while(cin>>y>>a>>b){

             y-=a;

             y%=b;

             cout<<y<<endl;

         }

         ;

     }

// Faster C++ solution for the same problem (measured speedup: 5.252572991621932x):
#include<stdio.h>

int main()

{

    int a,b,x;

    scanf("%d%d%d",&x,&a,&b);

    printf("%d\n",((x-a)%b));

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main()

{

        int x,a,b,c=0,d;

        cin>>x>>a>>b;

        c=x-a;

        cout<<c%b<<endl;

        return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.24941815411606x):
#include<stdio.h>

int main()

{

    int a,b,x;

    scanf("%d%d%d",&x,&a,&b);

    printf("%d\n",((x-a)%b));

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define  ll long long int

main()

{

    ll x,a,b;

    cin>>x>>a>>b;

x=x-a;

b=x%b;

cout<<b<<endl;





    }


// Faster C++ solution for the same problem (measured speedup: 5.247373448627134x):
#include<stdio.h>

int main()

{

    int a,b,x;

    scanf("%d%d%d",&x,&a,&b);

    printf("%d\n",((x-a)%b));

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

long long n,a,b;

int main()

{

    cin>>n>>a>>b;

    n-=a;

    n-=n/b*b;

    cout<<n;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.198020646580856x):
#include<cstdio>

using namespace std;

int a,b,x;

int main(){

	scanf("%d%d%d",&x,&a,&b);

	x-=a;

	x-=x/b*b;

	printf("%d",x);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int x,a,b;

int main(){

	cin>>x>>a>>b;

	cout<<(x-a)%b<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.252057438627513x):
#include<cstdio>

using namespace std;

int a,b,x;

int main(){

	scanf("%d%d%d",&x,&a,&b);

	x-=a;

	x-=x/b*b;

	printf("%d",x);

	return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int x,a,b;

	cin>>x>>a>>b;

	x-=a;

	cout<<x-x/b*b<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.2584744094869x):
#include<cstdio>

using namespace std;

int main()

{

    long long n,a,b;

    scanf("%lld%lld%lld",&n,&a,&b);

    printf("%d\n",(n-a)%b);

    return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int x,a,b;

	cin>>x>>a>>b;

	x-=a;

	cout<<x-x/b*b<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.251497732796442x):
#include<cstdio>

using namespace std;

int a,b,x,i;

int main()

{

	scanf("%d%d%d",&x,&a,&b);

	x-=a;

	x%=b;

	printf("%d",x);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <algorithm>

int n,a,b;

using namespace std; 

int main()

{

	cin>>n>>a>>b;

	n-=a;

	n%=b;

	cout<<n;

}

// Faster C++ solution for the same problem (measured speedup: 5.243700076434863x):
#include<cstdio>

using namespace std;

int a,b,x,i;

int main()

{

	scanf("%d%d%d",&x,&a,&b);

	x-=a;

	x%=b;

	printf("%d",x);

	return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main(){

    int x,a,b;

    cin>>x>>a>>b;

    x-=a;

    x%=b;

    cout<<x<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.251497732796442x):
#include<cstdio>

using namespace std;

int a,b,x,i;

int main()

{

	scanf("%d%d%d",&x,&a,&b);

	x-=a;

	x%=b;

	printf("%d",x);

	return 0;

}
// Slower C++ solution:
#include <iostream>



using namespace std;

long long sums,n,x;





int main() {

	sums=0;

	cin>>n;

	for(long long i=0;i<n;i++)

	{

		cin>>x;

		sums+=x%2;

	}

	if(sums%2==0)

		cout<<"YES";

	else cout<<"NO";

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.280326425456795x):
#include<cstdio>

using namespace std;

int main(){

	unsigned int n;

	unsigned long long int a,ev=0,o=0;

	scanf("%u",&n);

	while(n--){

		scanf("%llu",&a);

		if(a&1)

		++ev;

		else

		++o;

	}

	if(ev%2==0)

	printf("YES");

	else

	printf("NO");

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define FOR(i,a,b) for(int i = (a); i < (b); i++)

#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)

#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)

#define FILL(a, value) memset(a, value, sizeof(a))



#define SZ(a) (int) a.size()

#define ALL(a) a.begin(),a.end()

#define PB push_back

#define MP make_pair



typedef long long LL;

typedef vector<int> VI;

typedef pair<int, int> PII;



const double PI = acos(-1.0);

const LL INF = 1000 * 1000 * 1000 + 7;

const LL LINF = INF * (LL)INF;



int main()

{

	//freopen("in.txt", "r", stdin);

	//ios::sync_with_stdio(false); cin.tie(0);



	int n;

	scanf("%d", &n);



	if (n == 1)

	{

		cout<<"YES"<<endl;

		return 0;

	}



	int cnt = 0;

	FOR (i, 0, n)

	{

		int x;

		scanf("%d", &x);

		if (x & 1) cnt ^= 1;

	}



	if (cnt) cout<<"NO"<<endl;

	else cout<<"YES"<<endl;

}


// Faster C++ solution for the same problem (measured speedup: 5.291470405867871x):
#include<cstdio>

using namespace std;

int main(){

	unsigned int n;

	unsigned long long int a,ev=0,o=0;

	scanf("%u",&n);

	while(n--){

		scanf("%llu",&a);

		if(a&1)

		++ev;

		else

		++o;

	}

	if(ev%2==0)

	printf("YES");

	else

	printf("NO");

	return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<iostream>

using namespace std;

const int MAXN=100000;

int a[MAXN+5];

int n,cnt1,cnt2;

int main()

{

	scanf("%d",&n);

	for(int i=1;i<=n;i++)

	{

		scanf("%d",&a[i]);

		if(a[i]%2!=0)

			cnt1++;//奇数个数

		else

			cnt2++;//偶数个数

	}

	if(cnt1%2==0)

		printf("YES\n");

	else

		printf("NO\n");

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.264992440204887x):
#include<cstdio>

using namespace std;

int main(){

	unsigned int n;

	unsigned long long int a,ev=0,o=0;

	scanf("%u",&n);

	while(n--){

		scanf("%llu",&a);

		if(a&1)

		++ev;

		else

		++o;

	}

	if(ev%2==0)

	printf("YES");

	else

	printf("NO");

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>//coded by Nurstan ^_^



#define ll long long

#define pb push_back



#define mp make_pair

#define lb lower_bound

#define ub upper_bound



#define all(x) x.begin(), x.end()

#define F first

#define S second



// fixed << setprecision

// next_permutation(a, a + n)

// set <int> :: iterator it = x.begin(); it != x.end(); it ++



using namespace std;



inline void boost(){

	ios_base::sync_with_stdio(0);

	cin.tie(0);

}



int main(){

	boost();

	//freopen("input.txt", "r", stdin);

	//freopen("output.txt", "w", stdout);

	int n;

	cin >> n;

	int l = 0, r = 0;

	for(int i = 0; i < n; i ++) {

		int k;

		cin >> k;

		if(k % 2 != 0) {

			r ++;

		}

	}

	if(r % 2 == 0) {

		cout << "YES";

		return 0;

	}

	else {

		cout << "NO";

		return 0;

	}

	exit(0);

}




// Faster C++ solution for the same problem (measured speedup: 5.357033933073962x):
#include<cstdio>

using namespace std;

int main(){

	unsigned int n;

	unsigned long long int a,ev=0,o=0;

	scanf("%u",&n);

	while(n--){

		scanf("%llu",&a);

		if(a&1)

		++ev;

		else

		++o;

	}

	if(ev%2==0)

	printf("YES");

	else

	printf("NO");

	return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int n,ans;

int main(){

	cin>>n;

	while(n--){

		int x;

		cin>>x;

		if(x&1) ++ans;

	}

	if(ans&1) printf("NO\n");

	else printf("YES\n");

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.228601643292342x):
#include<cstdio>

using namespace std;

int main(){

	unsigned int n;

	unsigned long long int a,ev=0,o=0;

	scanf("%u",&n);

	while(n--){

		scanf("%llu",&a);

		if(a&1)

		++ev;

		else

		++o;

	}

	if(ev%2==0)

	printf("YES");

	else

	printf("NO");

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int n;

int x,y;

int main(){

	scanf("%d",&n);

	for(int i=1;i<=n;i++){

		int a;

		scanf("%d",&a);

		if(a&1)x++;

		else y++;

	}

	if(x&1)cout<<"NO"<<endl;

	else cout<<"YES"<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.292521734276061x):
#include<cstdio>

using namespace std;

int main(){

	unsigned int n;

	unsigned long long int a,ev=0,o=0;

	scanf("%u",&n);

	while(n--){

		scanf("%llu",&a);

		if(a&1)

		++ev;

		else

		++o;

	}

	if(ev%2==0)

	printf("YES");

	else

	printf("NO");

	return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<iostream>

#include<algorithm>

#include<cmath>

using namespace std;

int n,a[100004],sum=0;

int main()

{

	scanf("%d",&n);

	for(int i=1;i<=n;i++)

	{

		scanf("%d",&a[i]);

		if(a[i]%2!=0) sum++;

	}

	if(sum%2==0) cout<<"YES";

	else cout<<"NO";

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.276736902224228x):
#include<cstdio>

using namespace std;

int main(){

	unsigned int n;

	unsigned long long int a,ev=0,o=0;

	scanf("%u",&n);

	while(n--){

		scanf("%llu",&a);

		if(a&1)

		++ev;

		else

		++o;

	}

	if(ev%2==0)

	printf("YES");

	else

	printf("NO");

	return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int n,sj,so;

	sj=0;

	so=0;

	scanf("%d",&n);

	int a[n];

	for(int i=0;i<n;i++)

	{

		scanf("%d",&a[i]);

		if(a[i]%2==0)

		{

			so=so+a[i];

		}

		else

		{

			sj=sj+a[i];

		}

	}

	if(so%2==sj%2)

	{

		printf("%s","YES");

	}

	else

	{

		printf("%s","NO");

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.2430601458474495x):
#include<cstdio>



int main(){

    int N,Sum=0;

    scanf("%d",&N);

    for(int i=1;i<=N;i++){

        int x;

        scanf("%d",&x);

        Sum+=x%2;

    }

    if(Sum%2) puts("NO");

    else puts("YES");

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int n,sj;

	sj=0;

	scanf("%d",&n);

	int a[n];

	for(int i=0;i<n;i++)

	{

		scanf("%d",&a[i]);

		if(a[i]%2!=0)

		{

			sj=sj+a[i];

		}

	}

	if(sj%2==0)

	{

		printf("%s","YES");

	}

	else

	{

		printf("%s","NO");

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.2447193661131735x):
#include<cstdio>



int main(){

    int N,Sum=0;

    scanf("%d",&N);

    for(int i=1;i<=N;i++){

        int x;

        scanf("%d",&x);

        Sum+=x%2;

    }

    if(Sum%2) puts("NO");

    else puts("YES");

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	ios::sync_with_stdio(false);

	int n;

	cin>>n;

	int sum=0;

	for(int i=1;i<=n;i++)

	{

		int x;

		cin>>x;

		sum+=x;

		sum%=2;

	}

	if(sum)cout<<"NO"<<endl;else cout<<"YES"<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.3770846444832285x):
#include<cstdio>



int main(){

    int N,Sum=0;

    scanf("%d",&N);

    for(int i=1;i<=N;i++){

        int x;

        scanf("%d",&x);

        Sum+=x%2;

    }

    if(Sum%2) puts("NO");

    else puts("YES");

}
// Slower C++ solution:
//fifer a tak luboin

#include <bits/stdc++.h>

#define ll long long

#define pb push_back

#define mb make_pair

#define se second

#define fi first

#define INF 1e18



using namespace std;





int a[100100];

int cnt1=0;

int cnt2=0;

int main()

{



	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    //freopen("arithmetic.in", "r", stdin);

    //freopen("arithmetic.out", "w", stdout);

    int n;

    cin>>n;



    for(int i=1;i<=n;i++)

    {

        cin>>a[i];

        if(a[i]%2==0)

        {

            cnt2++;

        }

        else

        {

            cnt1++;

        }

    }



    if(cnt1%2==0 && cnt2%2==0)

    {

        cout<<"YES";

    }

    else if(cnt1%2!=0 && cnt2%2!=0)

    {

        cout<<"NO";

    }

    else if(cnt1%2==0 && cnt2%2!=0)

    {

        cout<<"YES";

    }

    else if(cnt1%2!=0 && cnt2%2==0)

    {

        cout<<"NO";

    }















































return 0;}


// Faster C++ solution for the same problem (measured speedup: 5.371369568485449x):
#include<cstdio>



int main(){

    int N,Sum=0;

    scanf("%d",&N);

    for(int i=1;i<=N;i++){

        int x;

        scanf("%d",&x);

        Sum+=x%2;

    }

    if(Sum%2) puts("NO");

    else puts("YES");

}
// Slower C++ solution:
#include <functional>

#include <algorithm>

#include <iostream>

#include <cstring>

#include <cstdlib>

#include <cassert>

#include <sstream>

#include <numeric>

#include <string>

#include <vector>

#include <cstdio>

#include <bitset>

#include <cmath>

#include <ctime>

#include <queue>

#include <stack>

#include <map>

#include <set>



using namespace std;



#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)

#define np(v) next_permutation(v.begin(), v.end())

#define pll pair < long long, long long>

#define all(a) a.begin(), a.end()

#define ull unsigned long long

#define pii pair < int, int >

#define sz(a) (int)a.size()

#define sqr(x) ((x) * (x))

#define y1 stupid_cmath

#define vi vector <int>

#define pb push_back

#define mp make_pair

#define ll long long

#define endl "\n"

#define s second

#define f first





const int inf = (int)1e9;

const int mod = (int)1e9 + 7;

const int N = (int)50505;

const double eps = 1e-9;

const double pi = acos(-1.0);



int n, x;



void solve(){

    cin >> n;

    int cnt = 0;

    for(int i = 1; i <= n; ++i){

        cin >> x;

        if(x & 1) cnt++;

    }

    if(n == 1){

        cout << "YES" << endl;

        return ;

    }

    if(cnt & 1){

        cout << "NO" << endl;

        return;

    }

    cout << "YES" << endl;

}



int main(){

    ios_base::sync_with_stdio(0), cin.tie(0);

    int T;

//    cin >> T;

    T = 1;

    for(int i = 1; i <= T; ++i){

        solve();

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.364502582374138x):
#include<cstdio>



int main(){

    int N,Sum=0;

    scanf("%d",&N);

    for(int i=1;i<=N;i++){

        int x;

        scanf("%d",&x);

        Sum+=x%2;

    }

    if(Sum%2) puts("NO");

    else puts("YES");

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int n,sj,so;

	sj=0;

	so=0;

	scanf("%d",&n);

	int a[n];

	for(int i=0;i<n;i++)

	{

		scanf("%d",&a[i]);

		if(a[i]%2==0)

		{

			so=so+a[i];

		}

		else

		{

			sj=sj+a[i];

		}

	}

	if(so%2==sj%2)

	{

		printf("%s","YES");

	}

	else

	{

		printf("%s","NO");

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.230384630367724x):
#include<cstdio>

#include<algorithm>

using namespace std;

#define MAXN 100005

int n,a[MAXN],sum;

int main()

{

	scanf("%d",&n);

	for(int i=1;i<=n;i++)

	{

		scanf("%d",&a[i]);

		sum+=a[i];

	}

	if(sum%2) printf("NO\n");

	else printf("YES\n");

	return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int n,sj;

	sj=0;

	scanf("%d",&n);

	int a[n];

	for(int i=0;i<n;i++)

	{

		scanf("%d",&a[i]);

		if(a[i]%2!=0)

		{

			sj=sj+a[i];

		}

	}

	if(sj%2==0)

	{

		printf("%s","YES");

	}

	else

	{

		printf("%s","NO");

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.232039839336309x):
#include<cstdio>

#include<algorithm>

using namespace std;

#define MAXN 100005

int n,a[MAXN],sum;

int main()

{

	scanf("%d",&n);

	for(int i=1;i<=n;i++)

	{

		scanf("%d",&a[i]);

		sum+=a[i];

	}

	if(sum%2) printf("NO\n");

	else printf("YES\n");

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	ios::sync_with_stdio(false);

	int n;

	cin>>n;

	int sum=0;

	for(int i=1;i<=n;i++)

	{

		int x;

		cin>>x;

		sum+=x;

		sum%=2;

	}

	if(sum)cout<<"NO"<<endl;else cout<<"YES"<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.364085114103833x):
#include<cstdio>

#include<algorithm>

using namespace std;

#define MAXN 100005

int n,a[MAXN],sum;

int main()

{

	scanf("%d",&n);

	for(int i=1;i<=n;i++)

	{

		scanf("%d",&a[i]);

		sum+=a[i];

	}

	if(sum%2) printf("NO\n");

	else printf("YES\n");

	return 0;

}
// Slower C++ solution:
//fifer a tak luboin

#include <bits/stdc++.h>

#define ll long long

#define pb push_back

#define mb make_pair

#define se second

#define fi first

#define INF 1e18



using namespace std;





int a[100100];

int cnt1=0;

int cnt2=0;

int main()

{



	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    //freopen("arithmetic.in", "r", stdin);

    //freopen("arithmetic.out", "w", stdout);

    int n;

    cin>>n;



    for(int i=1;i<=n;i++)

    {

        cin>>a[i];

        if(a[i]%2==0)

        {

            cnt2++;

        }

        else

        {

            cnt1++;

        }

    }



    if(cnt1%2==0 && cnt2%2==0)

    {

        cout<<"YES";

    }

    else if(cnt1%2!=0 && cnt2%2!=0)

    {

        cout<<"NO";

    }

    else if(cnt1%2==0 && cnt2%2!=0)

    {

        cout<<"YES";

    }

    else if(cnt1%2!=0 && cnt2%2==0)

    {

        cout<<"NO";

    }















































return 0;}


// Faster C++ solution for the same problem (measured speedup: 5.35838385475745x):
#include<cstdio>

#include<algorithm>

using namespace std;

#define MAXN 100005

int n,a[MAXN],sum;

int main()

{

	scanf("%d",&n);

	for(int i=1;i<=n;i++)

	{

		scanf("%d",&a[i]);

		sum+=a[i];

	}

	if(sum%2) printf("NO\n");

	else printf("YES\n");

	return 0;

}