Language: C++

//From Naruto to Hokage
//#include <RJ>
#include<bits/stdc++.h>
using namespace std;

#define ll          long long
#define pb          push_back
#define eb          emplace_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
mii m;
void solve(){
    ll n;
    cin>>n;
    vi v(n);
    rep(i,0,n-1){
        cin>>v[i];
        m[v[i]]++;
    }
    // sort(all(v));
    // rep(i,0,n-1){
    //     if((v[(i-1+n)%n]^v[(i+1)%n])!=v[i]){
    //         cout<<"No";
    //         return;
    //     }
    // }
    ll a=v[0],b=v[1];
    ll c=v[0],d=v[1];
    ll i=2;
    m[v[0]]--;
    m[v[1]]--;
    while(i<n){
    if(m[c^d]){
        m[c^d]--;
        ll temp=c^d;
        c=d;
        d=temp;
    }
    else{
        cout<<"No";
        return;
    }
    i++;
    }
    rep(i,0,n-1){
        m[v[i]]++;
    }
    // sort(all(v));
    // rep(i,0,n-1){
    //     if((v[(i-1+n)%n]^v[(i+1)%n])!=v[i]){
    //         cout<<"No";
    //         return;
    //     }
    // }
    ll a=v[n-1],b=v[n-2];
    ll c=v[n-1],d=v[n-2];
    ll i=2;
    m[v[n-1]]--;
    m[v[n-2]]--;
    while(i<n){
    if(m[c^d]){
        m[c^d]--;
        ll temp=c^d;
        c=d;
        d=temp;
    }
    else{
        cout<<"No";
        return;
    }
    i++;
    }
    
    cout<<"Yes";
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:72:8: error: redeclaration of 'long long int a'
   72 |     ll a=v[n-1],b=v[n-2];
      |        ^
a.cc:44:8: note: 'long long int a' previously declared here
   44 |     ll a=v[0],b=v[1];
      |        ^
a.cc:72:17: error: redeclaration of 'long long int b'
   72 |     ll a=v[n-1],b=v[n-2];
      |                 ^
a.cc:44:15: note: 'long long int b' previously declared here
   44 |     ll a=v[0],b=v[1];
      |               ^
a.cc:73:8: error: redeclaration of 'long long int c'
   73 |     ll c=v[n-1],d=v[n-2];
      |        ^
a.cc:45:8: note: 'long long int c' previously declared here
   45 |     ll c=v[0],d=v[1];
      |        ^
a.cc:73:17: error: redeclaration of 'long long int d'
   73 |     ll c=v[n-1],d=v[n-2];
      |                 ^
a.cc:45:15: note: 'long long int d' previously declared here
   45 |     ll c=v[0],d=v[1];
      |               ^
a.cc:74:8: error: redeclaration of 'long long int i'
   74 |     ll i=2;
      |        ^
a.cc:46:8: note: 'long long int i' previously declared here
   46 |     ll i=2;
      |        ^