P3812 [Template] Linear Basis
Background
This is a template problem.
Description
Given $n$ integers (numbers may repeat), choose any subset of them so that their XOR sum is maximized.
Input Format
The first line contains an integer $n$, the number of elements.
The next line contains $n$ integers.
Output Format
Output a single integer on one line, the answer.
Explanation/Hint
Constraints: $1 \leq n \leq 50$, $0 \leq S_i < 2^{50}$.
Translated by ChatGPT 5