stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#pragma GCC optimize(3)

#include<iostream>

#include<cstdio>

#include<cstdlib>

#include<cmath>

#include<cstring>

#include<string>

#include<algorithm>

#include<vector>

#include<map>

#include<set>

#include<list>

#include<queue>

#include<stack>

#include<bitset>

#include<deque>

using namespace std;

#define ll long long

// #define inf 0x3f3f3f3f

#define ri register int

#define il inline

#define fi first

#define se second

#define mp make_pair

#define pi pair<int,int>

#define mem0(x) memset((x),0,sizeof (x))

#define mem1(x) memset((x),0x3f,sizeof (x))

il char gc()

{

    static const int BS = 1 << 22;

    static unsigned char buf[BS], *st, *ed;

    if (st == ed) ed = buf + fread(st = buf, 1, BS, stdin);

    return st == ed ? EOF : *st++;

}

#define gc getchar

template<class T>void in(T &x)

{

    x = 0;

    bool f = 0;

    char c = gc();

    while (c < '0' || c > '9')

    {

        if (c == '-') f = 1;

        c = gc();

    }

    while ('0' <= c && c <= '9')

    {

        x = (x << 3) + (x << 1) + (c ^ 48);

        c = gc();

    }

    if (f) x = -x;

}

#undef gc

#define pb push_back

#define N 100010

#define M N<<1

int n, m;

int v[M], nx[M];

int cnt, head[N];

il void add(int uu, int vv)

{

    v[++cnt] = vv, nx[cnt] = head[uu];

    head[uu] = cnt;

}

int col[N];

bool ok = 1;

int sz;

void dfs(int x)

{

    if (col[x] == 2) ++sz;

    for (ri i = head[x]; i; i = nx[i])

    {

        if (col[v[i]])

        {

            if (col[v[i]] == col[x])

            {

                ok = 0;

                return;

            }

        }

        else

        {

            col[v[i]] = col[x] ^ 1;

            dfs(v[i]);

        }

    }

}

signed main()

{

#ifndef ONLINE_JUDGE

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

#endif

    in(n), in(m);

    for (ri i = 1, a, b; i <= m; ++i)

    {

        in(a), in(b);

        add(a, b);

        add(b, a);

    }

    col[1] = 2;

    dfs(1);

    if (ok == 0)

    {

        printf("%lld", (ll)n * (n - 1) / 2 - m);

    }

    else

    {

        printf("%lld", (ll)sz * (n - sz) - m);

    }

    return 0;

}

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

#define For(i,a,b) for(register long long i=a;i<=b;i++)

#define Rof(i,a,b) for(register long long i=a;i>=b;i--)

#define int long long

using namespace std;

const int maxn=1e5+10;

int fa[maxn<<1];

inline int findfa(int i){

	return i==fa[i]?i:fa[i]=findfa(fa[i]);

}

inline void uni(int i,int j){

	int a=findfa(i),b=findfa(j);

	if(a!=b) fa[a]=b;

}

inline bool wxp(int i,int j){

	return findfa(i)==findfa(j);

}

int n,m;

signed main(){

	scanf("%lld%lld",&n,&m);

	Rof(i,n<<1,1){

		fa[i]=i;

	}

	For(i,1,m){

		int u,v;

		scanf("%lld%lld",&u,&v);

		uni(u,v+n);

		uni(u+n,v);

	}

	For(i,1,n){

		if(wxp(i,i+n)){

			printf("%lld\n",n*(n-1)/2-m);

			return 0;

		}

	}

	int ls=1,rs=0;

	For(i,2,n){

		if(wxp(i,1)){

			++ls;

		}else{

			++rs;

		}

	}

	printf("%lld\n",ls*rs-m);

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

#include<queue>

#include<cstring>

#include<algorithm>

using namespace std;



namespace io {

#define gc() (iS == iT ? (iT = (iS = ibuff) + fread(ibuff, 1, SIZ, stdin), (iS == iT ? EOF : *iS++)) : *iS++)

	const int SIZ = 1 << 21 | 1;

	char *iS, *iT, ibuff[SIZ], obuff[SIZ], *oS = obuff, *oT = oS + SIZ - 1, fu[110], c;

	int fr;

	inline void out() {

		fwrite(obuff, 1, oS - obuff, stdout);

		oS = obuff;

	}

	template<class Type>

	inline void read(Type &x) {

		x = 0;

		Type y = 1;

		for (c = gc(); (c > '9' || c < '0') && c != '-'; c = gc());

		c == '-' ? y = -1 : x = (c & 15);

		for (c = gc(); c >= '0' && c <= '9'; c = gc())

			x = x * 10 + (c & 15);

		x *= y;

	}

	template<class Type>

	inline void print(Type x, char text = '\n') {

		if (x < 0)

			*oS++ = '-', x *= -1;

		if (x == 0)

			*oS++ = '0';

		while (x)

			fu[++fr] = x % 10 + '0', x /= 10;

		while (fr)

			*oS++ = fu[fr--];

		*oS++ = text;

		out();

	}

}

using namespace io;

#define ll long long

const int maxn = 100010;



int n, m, a, b;

int col[maxn + 5], lnk[maxn + 5], son[maxn << 1], nxt[maxn << 1];

int u;



inline void Add(int x, int y) {

	son[++u] = y;

	nxt[u] = lnk[x];

	lnk[x] = u;

}



void dfs(int x, int now = 0, int fa = 0) {

	col[x] = now; now ^= 1;

	for (int j = lnk[x]; j; j = nxt[j]) {

		if (col[son[j]] == -1)

			dfs(son[j], now, x);

		if (col[son[j]] != now)

			print((ll)n*(n - 1) / 2 - m), exit(0);

	}

}



int main() {

	read(n);

	read(m);

	memset(col, 255, sizeof(col));

	for (int i = 1, x, y; i <= m; i++)

		read(x), read(y), Add(x, y), Add(y, x);

	dfs(1);

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

		col[i] ? ++a : ++b;

	print((ll)a * b - m);

	return 0;

}

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

#define For(i,a,b) for(register long long i=a;i<=b;i++)

#define Rof(i,a,b) for(register long long i=a;i>=b;i--)

#define int long long

using namespace std;

const int maxn=1e5+10;

int fa[maxn<<1];

inline int findfa(int i){

	return i==fa[i]?i:fa[i]=findfa(fa[i]);

}

inline void uni(int i,int j){

	int a=findfa(i),b=findfa(j);

	if(a!=b) fa[a]=b;

}

inline bool wxp(int i,int j){

	return findfa(i)==findfa(j);

}

int n,m;

signed main(){

	scanf("%lld%lld",&n,&m);

	Rof(i,n<<1,1){

		fa[i]=i;

	}

	For(i,1,m){

		int u,v;

		scanf("%lld%lld",&u,&v);

		uni(u,v+n);

		uni(u+n,v);

	}

	For(i,1,n){

		if(wxp(i,i+n)){

			printf("%lld\n",n*(n-1)/2-m);

			return 0;

		}

	}

	int ls=1,rs=0;

	For(i,2,n){

		if(wxp(i,1)){

			++ls;

		}else{

			++rs;

		}

	}

	printf("%lld\n",ls*rs-m);

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

using namespace std;



long long n, m, u, v, visited[100010], a = 0, b = 0;

vector<long long> graph[100010]; bool pos = false;



void dfs(long long u) {

	for(long long i = 0; i < graph[u].size(); i++) {

		long long v = graph[u][i];

		if(visited[v] > -1) {

			pos |= (visited[u] == visited[v]);

			continue;

		}

		visited[v] = not visited[u];

		a += not visited[v], b += visited[v];

		dfs(v);

	}

}



int main() {

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

	scanf("%lld%lld", &n, &m);

	for(long long i = 0; i < m; i++) {

		scanf("%lld%lld", &u, &v);

		graph[u].push_back(v);

		graph[v].push_back(u);

	}

	a = 1, visited[1] = 0; dfs(1);

	if(pos) printf("%lld\n", n*(n-1)/2 - m);

	else printf("%lld\n", a*b - m);

}

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

#define ll long long

using namespace std;

inline int read(){

    int s=0,w=1;

    char ch=getchar();

    while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}

    while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}

    return s*w;

}

const int maxn=1e5+10;

struct edge{

    int to,nxt;

}e[maxn*2];

int head[maxn],tot,col[maxn];

ll c1,c2;

int flag;

void addedge(int u,int v){

    e[++tot].to=v;

    e[tot].nxt=head[u];

    head[u]=tot;

}

void dfs(int u,int color){

    if(flag) return;

    col[u]=color;

    if(color==1) ++c1;

    else ++c2;

    for(int i=head[u];i;i=e[i].nxt)

    {

        int v=e[i].to;

        if(!col[v]) dfs(v,3-color);

        else if(col[v]==color){

            flag=true;

            return;

        }

    }

}

ll n,m;

int main(){

    n=read(),m=read();

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

        int u,v;

        u=read(),v=read();

        addedge(u,v);

        addedge(v,u);

    }

    dfs(1,1);

    if(flag) printf("%lld",1LL*n*(n-1)/2-m);

    else printf("%lld",c1*c2-m);



    return 0;

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

using namespace std;



long long n, m, u, v, visited[100010], a = 0, b = 0;

vector<long long> graph[100010]; bool pos = false;



void dfs(long long u) {

	for(long long i = 0; i < graph[u].size(); i++) {

		long long v = graph[u][i];

		if(visited[v] > -1) {

			pos |= (visited[u] == visited[v]);

			continue;

		}

		visited[v] = not visited[u];

		a += not visited[v], b += visited[v];

		dfs(v);

	}

}



int main() {

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

	scanf("%lld%lld", &n, &m);

	for(long long i = 0; i < m; i++) {

		scanf("%lld%lld", &u, &v);

		graph[u].push_back(v);

		graph[v].push_back(u);

	}

	a = 1, visited[1] = 0; dfs(1);

	if(pos) printf("%lld\n", n*(n-1)/2 - m);

	else printf("%lld\n", a*b - m);

}

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

using namespace std;

using ll = long long;

using PII = pair<int, int>;

using VI = vector<int>;



const int N = 1e5 + 10;

VI adj[N];

int col[N];

bool bip = true;

int f[3];



void dfs(int u, int c) {

  if (col[u] != 0) {

    if (c != col[u]) bip = false;

    return;

  }

  col[u] = c;

  f[c]++;



  for (int v: adj[u]) {

    dfs(v, 3 - c);

  }

}



int main() {

#ifdef LOCAL_EXEC

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

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

#else

  ios_base::sync_with_stdio(false); cin.tie(NULL);

#endif



  int n; cin >> n;

  int m; cin >> m;

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

    int u, v; cin >> u >> v;

    adj[u].push_back(v);

    adj[v].push_back(u);

  }



  dfs(1, 1);

  ll ans = 0;

  if (!bip) {

    ans = (n * 1ll * (n - 1)) / 2 - m;

  } else {

    ans = f[1] * 1ll * f[2] - m;

  }



  cout << ans << endl;



  return 0;

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

#include <string>

#include <vector>

#include <set>

#include <algorithm>

#include <cctype>

#include <cmath>

#include <queue>

#include <map>

#include <numeric>

#include <unordered_map>

#include <iomanip>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)

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

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



template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



typedef long long ll;



using namespace std;



int n,m;

vector<vector<int>> edge;

int cnt1=0,cnt2=0;

vector<int>memo;

bool flag=0;

void dfs(int par,int node,bool oe)

{

  //cout<<par<<" "<<node<<" "<<oe<<endl;

  if(memo[node]!=-1)

  {

    if(oe!=memo[node]){flag=1;return ;}

    else return ;

  }

  if(oe)cnt1++;

  else cnt2++;

  memo[node]=(int)oe;

  for(int nn:edge[node])

  {

    if(nn!=par)

    {

      dfs(node,nn,!oe);

    }

  }

}



int main()

{

  ios::sync_with_stdio(false);

  cin.tie(0);

  //cout<<setprecision(10);

  cin>>n>>m;

  edge.resize(100001);

  memo=vector<int>(100001,-1);

  rep(i,m)

  {

    int a,b;

    cin>>a>>b;

    edge[a].push_back(b);

    edge[b].push_back(a);

  }

  dfs(-1,1,0);

  if(flag==0)

  {

    ll res=(ll)cnt1*cnt2;

    //cout<<cnt1<<" "<<cnt2<<endl;

    res-=m;

    cout<<res<<endl;

  }

  else

  {

    ll res=((ll)n*(n-1))/2;

    res-=m;

    cout<<res<<endl;

  }

  return 0;



}


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

#include <string>

#include <vector>

#include <set>

#include <algorithm>

#include <cctype>

#include <cmath>

#include <queue>

#include <map>

#include <numeric>

#include <unordered_map>

#include <iomanip>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)

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

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



template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



typedef long long ll;



using namespace std;



int n,m;

vector<vector<int>> edge;

int cnt1=0,cnt2=0;

vector<int>memo;

bool flag=0;

void dfs(int par,int node,bool oe)

{

  if(flag)return;

  if(memo[node]!=-1)

  {

    if(oe!=memo[node]){flag=1;return ;}

    else return ;

  }

  if(oe)cnt1++;

  else cnt2++;

  memo[node]=(int)oe;

  for(int nn:edge[node])

  {

    if(nn!=par)

    {

      dfs(node,nn,!oe);

    }

  }

}



int main()

{

  ios::sync_with_stdio(false);

  cin.tie(0);

  cin>>n>>m;

  edge.resize(n+1);

  memo=vector<int>(n+1,-1);

  rep(i,m)

  {

    int a,b;

    cin>>a>>b;

    edge[a].push_back(b);

    edge[b].push_back(a);

  }

  dfs(-1,1,0);

  if(flag==0)

  {

    ll res=(ll)cnt1*cnt2;

    res-=m;

    cout<<res<<endl;

  }

  else

  {

    ll res=((ll)n*(n-1))/2;

    res-=m;

    cout<<res<<endl;

  }

  return 0;



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



using namespace std;

#define pb push_back

#define int long long

int n,m,check=0,c[100005],num[2];

vector<int> graph[100005];

bool vis[100005];

void dfs(int u,int color){

    num[color]++;

    vis[u]=1;

    for(int i=0;i<graph[u].size();i++){

        int v=graph[u][i];

        if(vis[v]==0){

            c[v]=1-color;

            dfs(v,1-color);

        }

    }

}

signed main(){

    cin.tie(0),cout.tie(0),ios::sync_with_stdio(0);

    cin>>n>>m;

    int u,v;

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

        cin>>u>>v;

        graph[u].pb(v);

        graph[v].pb(u);

    }

    c[1]=0;

    dfs(1,0);

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

        for(int j=0;j<graph[i].size();j++){

            int v=graph[i][j];

            if(c[v]==c[i])

                check=1;

        }

    }

    if(check==1)

        cout<<n*(n-1)/2-m;

    else

        cout<<num[0]*num[1]-m;

}


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

#include <cstdio>

#include <cstring>

using namespace std;



const int maxn = 100000 +5;

int n, m, tot, head[maxn], color[maxn];

struct edge {

	int to, nxt;

} G[maxn << 1];



inline void add_edge (int u, int v) {

	tot ++;

	G[tot].to = v;

	G[tot].nxt = head[u];

	head[u] = tot;

}



void dfs(int x, int now = 0, int fa = 0) {

	color[x] = now, now ^= 1;

    for (int j = head[x]; j; j = G[j].nxt) {

        if (color[G[j].to] == -1) dfs(G[j].to, now, x);

        if (color[G[j].to] != now) {

        	printf ("%lld\n", (long long)n * (n - 1) / 2 - m);

        	exit(0);

		}

    }

}



int main() {

	scanf ("%d %d", &n, &m);

	int u, v;

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

		scanf ("%d %d", &u, &v);

		add_edge (u, v); add_edge(v, u);

	}

	memset (color, 255, sizeof (color));

	dfs(1);

	int a = 0, b = 0;

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

		if (color[i]) a++;

		else b++;

	}

	printf ("%lld", (long long)a * b - m);

	return 0;

}
// Slower C++ solution:
//Trial code here

#include<bits/stdc++.h>

using namespace std;

const int N=1e5+5;

bool f=0;

int c[N],cnt[3];

vector<int>G[N];

void dfs(int x,int ff=1)

{

    if(c[x])

    {

        f|=ff!=c[x];

        return;

    }

    c[x]=ff;

    cnt[ff]++;

    for(int u:G[x])

    dfs(u,3-ff);

}

int main()

{

    int n,m;

    scanf("%d%d",&n,&m);

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

    {

        int u,v;

        scanf("%d%d",&u,&v);

        G[u].push_back(v);

        G[v].push_back(u);

    }

    dfs(1);

    printf("%lld\n",f?1LL*n*(n-1)/2-m:1LL*cnt[1]*cnt[2]-m);

    return 0;

}

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

#include <cstdio>

#include <cstring>

using namespace std;



const int maxn = 100000 +5;

int n, m, tot, head[maxn], color[maxn];

struct edge {

	int to, nxt;

} G[maxn << 1];



inline void add_edge (int u, int v) {

	tot ++;

	G[tot].to = v;

	G[tot].nxt = head[u];

	head[u] = tot;

}



void dfs(int x, int now = 0, int fa = 0) {

	color[x] = now, now ^= 1;

    for (int j = head[x]; j; j = G[j].nxt) {

        if (color[G[j].to] == -1) dfs(G[j].to, now, x);

        if (color[G[j].to] != now) {

        	printf ("%lld\n", (long long)n * (n - 1) / 2 - m);

        	exit(0);

		}

    }

}



int main() {

	scanf ("%d %d", &n, &m);

	int u, v;

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

		scanf ("%d %d", &u, &v);

		add_edge (u, v); add_edge(v, u);

	}

	memset (color, 255, sizeof (color));

	dfs(1);

	int a = 0, b = 0;

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

		if (color[i]) a++;

		else b++;

	}

	printf ("%lld", (long long)a * b - m);

	return 0;

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

#include<cstdio>

#include<vector> 

#include<cstring>

using namespace std;

const int maxn = 1e5 + 5;

vector<int> list[maxn];

int vis[maxn];

int lose=0;

void bfs(int ne,int be,int re)

{

    if(!lose)

    {

        if(vis[ne]==-1)

            vis[ne]=re;

        else

            if(vis[ne]!=re)

            {

                lose=1;

                return;

            }

            else

                return;

        for(int i=0;i<list[ne].size();i++)

        {

            if(list[ne][i]!=be)

                bfs(list[ne][i],ne,!re);    

        }



    }



}

int main()

{

    long long m,n;

    scanf("%lld%lld",&m,&n);

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

    {

        int x,y;

        scanf("%d%d",&x,&y);

        list[x].push_back(y);

        list[y].push_back(x);

    }

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

    bfs(1,0,1);

    long long q=0,p=0;

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

    {

        if(vis[i]==1)

            q++;

        else

            p++;

    }

    if(lose)

        printf("%lld\n",m*(m-1)/2-n);

    else

        printf("%lld\n",q*p-n);



    return 0;

}

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

#define maxn 100005

#define ll long long

using namespace std;



int head[maxn],cnt,vis[maxn];ll cnt1,cnt2,n,m;



struct edge{

	int to,nxt;

}e[maxn<<1];



void add(int u,int v){

	e[++cnt]=(edge){v,head[u]};

	head[u]=cnt;

}



void dfs(int u,int fa,int col){

	if(!vis[u]) vis[u]=col;

	else {

		if(vis[u]!=col){

			printf("%lld",(n-1)*n/2-m);

			exit(0);

		}

		return ;

	}

	col&1?cnt1++:cnt2++;

	for(int i=head[u];i;i=e[i].nxt){

		int v=e[i].to;

		if(v==fa) continue;

		dfs(v,u,(col&1)+1);

	}

}



int main(){

	scanf("%lld%lld",&n,&m);

	for(int i=1,u,v;i<=m;i++){

		scanf("%d%d",&u,&v);

		add(u,v);add(v,u);

	}

	dfs(1,0,1);

	printf("%lld",cnt1*cnt2-m);

}
// Slower C++ solution:
//#pragma GCC optimize("Ofast")

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

#include <bits/stdc++.h>



using namespace std;



#define PB push_back

#define MP make_pair

#define EB emplace_back

#define f first

#define s second

#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 FILL(a, b) memset(a, b, sizeof a)

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

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

#define bitc(n) __builtin_popcount(n)

#define MAGIC0 mt19937 rnd(time(0)); //rnd()



typedef long long LL;

typedef unsigned long long ULL;

typedef vector<int> VI;

typedef pair<int, int> PII;

typedef pair<LL, LL> PLL;



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

const LL LINF = 1LL * INF*INF;

const int MAX = 1e6 + 7;

const double PI = acos(-1.);

const double EPS = 1e-7;

const int MAXN = 100005;



mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());



unordered_map<int, int> mep(200007);



int main()

{

	ios_base::sync_with_stdio(0);

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

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

	time_t st = clock();

	int n;

	cin >> n;

	VI a(n);

	FOR(i, 0, n)

	{

		cin >> a[i];

		mep[a[i]]++;

	}

	

	deque<int> res;

	int ind = rnd() % n;

	res.PB(a[ind]);

	mep[a[ind]]--;

	FOR(i, 0, n)

	{

		if (mep[a[i]] == 0 || !mep.count(a[i] ^ a[ind]) || mep[a[i] ^ a[ind]] == 0)

		{

			continue;

		}

		res.PB(a[i]);

		mep[a[i]]--;

		int it = 0;

		while(true)

		{

			if (((double)clock() - st) / CLOCKS_PER_SEC >= 1.9)

			{

				cout << "No\n";

				return 0;

			}

			++it;

			if (it % 2 == 0)

			{

				int sz = SZ(res);

				int el = res[sz-1] ^ res[sz-2];

				if (mep.count(el) && mep[el] > 0)

				{

					res.PB(el);

					mep[el]--;

				}

				else

				{

					break;

				}

			}

			else

			{

				int el = res[0] ^ res[1];

				if (mep.count(el) && mep[el] > 0)

				{

					res.push_front(el);

					mep[el]--;

				}

				else

				{

					break;

				}

			}

		}

		if (SZ(res) == n)

		{

			cout << "Yes\n";

			return 0;

		}

		while(SZ(res) > 1)

		{

			mep[res.back()]++;

			res.pop_back();

		}

	}

	

	cout << "No\n";

	

	return 0;

}
















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



using namespace std;



int main()



{

    long long int n,sum=0,a;

    cin>>n;

    while(n--)

    {

        cin>>a;

        sum=sum^a;

}

    if(sum==0)

    cout<<"Yes"<<endl;

    else

cout<<"No"<<endl;

    

}
// Slower C++ solution:
//#pragma GCC optimize("Ofast")

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

#include <bits/stdc++.h>



using namespace std;



#define PB push_back

#define MP make_pair

#define EB emplace_back

#define f first

#define s second

#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 FILL(a, b) memset(a, b, sizeof a)

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

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

#define bitc(n) __builtin_popcount(n)

#define MAGIC0 mt19937 rnd(time(0)); //rnd()



typedef long long LL;

typedef unsigned long long ULL;

typedef vector<int> VI;

typedef pair<int, int> PII;

typedef pair<LL, LL> PLL;



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

const LL LINF = 1LL * INF*INF;

const int MAX = 1e6 + 7;

const double PI = acos(-1.);

const double EPS = 1e-7;

const int MAXN = 100005;



mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());



unordered_map<int, int> mep(200007);



int main()

{

	ios_base::sync_with_stdio(0);

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

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

	time_t st = clock();

	int n;

	cin >> n;

	VI a(n);

	FOR(i, 0, n)

	{

		cin >> a[i];

		mep[a[i]]++;

	}

	

	deque<int> res;

	int ind = rnd() % n;

	res.PB(a[ind]);

	mep[a[ind]]--;

	FOR(i, 0, n)

	{

		if (mep[a[i]] == 0 || !mep.count(a[i] ^ a[ind]) || mep[a[i] ^ a[ind]] == 0)

		{

			continue;

		}

		res.PB(a[i]);

		mep[a[i]]--;

		int it = 0;

		while(true)

		{

			if (((double)clock() - st) / CLOCKS_PER_SEC >= 1.9)

			{

				cout << "No\n";

				return 0;

			}

			++it;

			if (it % 2 == 0)

			{

				int sz = SZ(res);

				int el = res[sz-1] ^ res[sz-2];

				if (mep.count(el) && mep[el] > 0)

				{

					res.PB(el);

					mep[el]--;

				}

				else

				{

					break;

				}

			}

			else

			{

				int el = res[0] ^ res[1];

				if (mep.count(el) && mep[el] > 0)

				{

					res.push_front(el);

					mep[el]--;

				}

				else

				{

					break;

				}

			}

		}

		if (SZ(res) == n)

		{

			cout << "Yes\n";

			return 0;

		}

		while(SZ(res) > 1)

		{

			mep[res.back()]++;

			res.pop_back();

		}

	}

	

	cout << "No\n";

	

	return 0;

}
















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

#include<algorithm>

using namespace std;



int a[100001];

int main(){

	int n;

	scanf("%d",&n);

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

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

	int ql=1;

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

		if(a[i])ql=0;

	if(ql){

		printf("Yes\n");

		return 0;

	}

	if(n%3){

		printf("No\n");

		return 0;

	}

	sort(a+1,a+n+1);

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

		if(i!=n/3+1&&i!=n/3*2+1&&a[i]!=a[i-1]){

			printf("No\n");

			return 0;

		}

	if(a[1]^a[n/3+1]^a[n/3*2+1]){

		printf("No\n");

		return 0;

	}

	printf("Yes\n");

}