p275.ans1
======================
14

=================
p275.cpp
======================
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

int n;
vector<int64_t> a;
int64_t basis[64];

void read() {
    cin >> n;
    a.resize(n);
    cin >> a;
}

void add(int64_t x) {
    for(int l = 60; l >= 0; l--) {
        if(!(x & (1ll << l))) {
            continue;
        }
        if(basis[l] == 0) {
            basis[l] = x;
            return;
        }
        x ^= basis[l];
    }
}

void solve() {
    // Maximum XOR of a subsequence via a linear basis over GF(2).
    //
    // - basis[l] holds a reduced vector whose highest set bit is l. Inserting a
    //   number repeatedly clears its top bit using existing basis vectors; if a
    //   bit position is still free, the reduced number becomes the new basis
    //   vector there.
    //
    // - To maximise the XOR, scan bit positions from high to low and XOR in
    //   basis[l] whenever it would turn the current result's bit l from 0 to 1.

    for(int64_t x: a) {
        add(x);
    }

    int64_t res = 0;
    for(int l = 60; l >= 0; l--) {
        if(!(res & (1ll << l))) {
            res ^= basis[l];
        }
    }

    cout << res << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        // cout << "Case #" << test << ": ";
        solve();
    }

    return 0;
}

=================
p275.in1
======================
3
11 9 5

=================
statement.txt
======================
275. To xor or not to xor
time limit per test: 0.25 sec.
memory limit per test: 65536 KB
input: standard
output: standard



The sequence of non-negative integers A1, A2, ..., AN is given. You are to find some subsequence Ai1, Ai2, ..., Aik (1 <= i1 < i2 < ... < ik <= N) such, that Ai1 XOR Ai2 XOR ... XOR Aik has a maximum value.

Input
The first line of the input file contains the integer number N (1 <= N <= 100). The second line contains the sequence A1, A2, ..., AN (0 <= Ai <= 10^18).

Output
Write to the output file a single integer number -- the maximum possible value of Ai1 XOR Ai2 XOR ... XOR Aik.

Sample test(s)

Input
3
11 9 5

Output
14
Author:	Michael R. Mirzayanov
Resource:	ACM ICPC 2004-2005, NEERC, Southern Subregional Contest
Date:	Saratov, October 7, 2004






=================
