Language: C++

#include <bits/stdc++.h>

using namespace std;

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

using ll = long long;
#define int ll
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

const int MAX_ROW = 510; // to be set appropriately
const int MAX_COL = 510; // to be set appropriately
struct BitMatrix {
    int H, W;
    bitset<MAX_COL> val[MAX_ROW];
    BitMatrix(int m = 1, int n = 1) : H(m), W(n) {}
};

bitset<MAX_COL>& operator [] (int i) {return val[i];}

ostream& operator << (ostream& s, BitMatrix A) {
    s << endl; 
    for (int i = 0; i < A.H; ++i) {
        for (int j = 0; j < A.W; ++j) {
            s << A[i][j] << ", ";
        }
        s << endl;
    }
    return s;
}

inline BitMatrix operator * (BitMatrix A, BitMatrix B) {
    BitMatrix R(A.H, B.W);
    BitMatrix tB(B.W, B.H);
    for (int i = 0; i < tB.H; ++i) for (int j = 0; j < tB.W; ++j) tB[i][j] = B[j][i];
    for (int i = 0; i < R.H; ++i) for (int j = 0; j < R.W; ++j) R[i][j] = ((A[i] & tB[j]).count() & 1);
    return R;
}

inline BitMatrix pow(BitMatrix A, long long n) {
    BitMatrix R(A.H, A.H);
    for (int i = 0; i < A.H; ++i) R[i][i] = 1;
    while (n > 0) {
        if (n & 1) R = R * A;
        A = A * A;
        n >>= 1;
    }
    return R;
}


int GaussJordan(BitMatrix &A, bool is_extended = false) {
    int rank = 0;
    for (int col = 0; col < A.W; ++col) {
        if (is_extended && col == A.W - 1) break;
        int pivot = -1;
        for (int row = rank; row < A.H; ++row) {
            if (A[row][col]) {
                pivot = row;
                break;
            }
        }
        if (pivot == -1) continue;
        swap(A[pivot], A[rank]);
        return 0;
        for (int row = 0; row < A.H; ++row) {
            if (row != rank && A[row][col]) A[row] ^= A[rank];
        }
        ++rank;
    }
    return rank;
}

int linear_equation(BitMatrix A, vector<int> b, vector<int> &res) {
    int m = A.H, n = A.W;
    BitMatrix M(m, n + 1);
    for (int i = 0; i < m; ++i) {
        for (int j = 0; j < n; ++j) M[i][j] = A[i][j];
        M[i][n] = b[i];
    }
    int rank = GaussJordan(M, true);

    // check if it has no solution
    for (int row = rank; row < m; ++row) if (M[row][n]) return -1;

    // answer
    res.assign(n, 0);
    for (int i = 0; i < rank; ++i) res[i] = M[i][n];
    return rank;
}


const int MOD = 998244353;
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  vll a(n);
  ll ans = 0;
  for(int i=0;i<n;++i) {
    cin >> a[i];
    ans ^= a[i];
  }
  //cout << ans << endl;
  //cout << bitset<60>(ans) << endl;

  for(int i=0;i<n;++i) {
    a[i] = a[i] & (((1ll<<60)-1) ^ ans);
  }

  BitMatrix A(n, 60);
  for(int i=0;i<n;++i) {
    string tmp = "";
    for(int j=0;j<60;++j) {
      tmp.push_back((char)((a[i]>>j)&1) + '0');
    }
    //cout << tmp << endl;
    A[i] = bitset<MAX_COL>(tmp);
  }
  //cout << A << endl;
  GaussJordan(A);
  //cout << A << endl;
  return 0;
  ll add = 0;
  for(int i=0;i<n;++i) {
    ll now = 0;
    for(int j=0;j<60;++j) {
      now += ((ll)A[i][j])<<(59-j);
    }
    //cout << now << endl;
    add ^= now;
  }
  //cout << add << endl;

  cout << ans + 2 * add << endl;

}


Compiler output:
a.cc:36:18: error: 'std::bitset<510>& operator[](ll)' must be a member function
   36 | bitset<MAX_COL>& operator [] (int i) {return val[i];}
      |                  ^~~~~~~~
a.cc: In function 'std::ostream& operator<<(std::ostream&, BitMatrix)':
a.cc:42:19: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   42 |             s << A[i][j] << ", ";
      |                   ^
a.cc: In function 'BitMatrix operator*(BitMatrix, BitMatrix)':
a.cc:52:69: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   52 |     for (int i = 0; i < tB.H; ++i) for (int j = 0; j < tB.W; ++j) tB[i][j] = B[j][i];
      |                                                                     ^
a.cc:52:79: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   52 |     for (int i = 0; i < tB.H; ++i) for (int j = 0; j < tB.W; ++j) tB[i][j] = B[j][i];
      |                                                                               ^
a.cc:53:66: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   53 |     for (int i = 0; i < R.H; ++i) for (int j = 0; j < R.W; ++j) R[i][j] = ((A[i] & tB[j]).count() & 1);
      |                                                                  ^
a.cc:53:78: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   53 |     for (int i = 0; i < R.H; ++i) for (int j = 0; j < R.W; ++j) R[i][j] = ((A[i] & tB[j]).count() & 1);
      |                                                                              ^
a.cc:53:86: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   53 |     for (int i = 0; i < R.H; ++i) for (int j = 0; j < R.W; ++j) R[i][j] = ((A[i] & tB[j]).count() & 1);
      |                                                                                      ^
a.cc: In function 'BitMatrix pow(BitMatrix, long long int)':
a.cc:59:36: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   59 |     for (int i = 0; i < A.H; ++i) R[i][i] = 1;
      |                                    ^
a.cc: In function 'll GaussJordan(BitMatrix&, bool)':
a.cc:75:18: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   75 |             if (A[row][col]) {
      |                  ^
a.cc:81:15: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   81 |         swap(A[pivot], A[rank]);
      |               ^
a.cc:81:25: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   81 |         swap(A[pivot], A[rank]);
      |                         ^
a.cc:84:33: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   84 |             if (row != rank && A[row][col]) A[row] ^= A[rank];
      |                                 ^
a.cc:84:46: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   84 |             if (row != rank && A[row][col]) A[row] ^= A[rank];
      |                                              ^
a.cc:84:56: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   84 |             if (row != rank && A[row][col]) A[row] ^= A[rank];
      |                                                        ^
a.cc: In function 'll linear_equation(BitMatrix, std::vector<long long int>, std::vector<long long int>&)':
a.cc:95:38: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   95 |         for (int j = 0; j < n; ++j) M[i][j] = A[i][j];
      |                                      ^
a.cc:95:48: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   95 |         for (int j = 0; j < n; ++j) M[i][j] = A[i][j];
      |                                                ^
a.cc:96:10: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
   96 |         M[i][n] = b[i];
      |          ^
a.cc:101:47: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
  101 |     for (int row = rank; row < m; ++row) if (M[row][n]) return -1;
      |                                               ^
a.cc:105:46: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
  105 |     for (int i = 0; i < rank; ++i) res[i] = M[i][n];
      |                                              ^
a.cc: In function 'int main()':
a.cc:147:6: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
  147 |     A[i] = bitset<MAX_COL>(tmp);
      |      ^
a.cc:157:20: error: no match for 'operator[]' (operand types are 'BitMatrix' and 'll' {aka 'long long int'})
  157 |       now += ((ll)A[i][j])<<(59-j);
      |                    ^