Language: C++

#include<iostream>
#include<string>
using namespace std;
using I=long long;
#define rep(i,n) rep(i,0,n)
#define rep(i,l,u) for(I i=l;i<u;++i)

I get(I x,I k){return x>>k&1;}
int main(){
  I n;
  cin>>n;
  vector<I> a(n);
  rep(i,n)cin>>a[i];
  vector<I> es;
  I ans=0;
  rep(k,60){
    I cnt=0;
    rep(i,n)cnt+=get(a[i],k);
    if(cnt%2)ans+=1LL<<k;
    else if(cnt)es.push_back(k);
  }
  reverse(es.begin(),es.end());
  I cur=0;
  for(I k:es){
    if(n==0)continue;
    rep(i,n){
      if(get(a[i],k))
        swap(a.back(),a[i]);
    }
    I p=a.back();
    if(!get(p,k))
      continue;
    a.pop_back();
    n--;
    rep(i,n){
      if(get(a[i],k))
        a[i]^=p;
    }
    if(!get(cur,k))
      cur^=p;
  }
  cout<<ans+cur*2<<endl;
}
    


Compiler output:
a.cc:6:9: warning: "rep" redefined
    6 | #define rep(i,l,u) for(I i=l;i<u;++i)
      |         ^~~
a.cc:5:9: note: this is the location of the previous definition
    5 | #define rep(i,n) rep(i,0,n)
      |         ^~~
a.cc:13:10: error: macro "rep" requires 3 arguments, but only 2 given
   13 |   rep(i,n)cin>>a[i];
      |          ^
a.cc:6:9: note: macro "rep" defined here
    6 | #define rep(i,l,u) for(I i=l;i<u;++i)
      |         ^~~
a.cc:16:11: error: macro "rep" requires 3 arguments, but only 2 given
   16 |   rep(k,60){
      |           ^
a.cc:6:9: note: macro "rep" defined here
    6 | #define rep(i,l,u) for(I i=l;i<u;++i)
      |         ^~~
a.cc:18:12: error: macro "rep" requires 3 arguments, but only 2 given
   18 |     rep(i,n)cnt+=get(a[i],k);
      |            ^
a.cc:6:9: note: macro "rep" defined here
    6 | #define rep(i,l,u) for(I i=l;i<u;++i)
      |         ^~~
a.cc:26:12: error: macro "rep" requires 3 arguments, but only 2 given
   26 |     rep(i,n){
      |            ^
a.cc:6:9: note: macro "rep" defined here
    6 | #define rep(i,l,u) for(I i=l;i<u;++i)
      |         ^~~
a.cc:35:12: error: macro "rep" requires 3 arguments, but only 2 given
   35 |     rep(i,n){
      |            ^
a.cc:6:9: note: macro "rep" defined here
    6 | #define rep(i,l,u) for(I i=l;i<u;++i)
      |         ^~~
a.cc: In function 'int main()':
a.cc:12:3: error: 'vector' was not declared in this scope
   12 |   vector<I> a(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | #include<string>
a.cc:12:11: error: expected primary-expression before '>' token
   12 |   vector<I> a(n);
      |           ^
a.cc:12:13: error: 'a' was not declared in this scope
   12 |   vector<I> a(n);
      |             ^
a.cc:13:3: error: 'rep' was not declared in this scope
   13 |   rep(i,n)cin>>a[i];
      |   ^~~
a.cc:14:11: error: expected primary-expression before '>' token
   14 |   vector<I> es;
      |           ^
a.cc:14:13: error: 'es' was not declared in this scope
   14 |   vector<I> es;
      |             ^~
a.cc:16:6: error: expected ';' before '{' token
   16 |   rep(k,60){
      |      ^     ~
      |      ;
a.cc:22:3: error: 'reverse' was not declared in this scope
   22 |   reverse(es.begin(),es.end());
      |   ^~~~~~~
a.cc:26:8: error: expected ';' before '{' token
   26 |     rep(i,n){
      |        ^    ~
      |        ;
a.cc:35:8: error: expected ';' before '{' token
   35 |     rep(i,n){
      |        ^    ~
      |        ;