Prefix & Suffix Maximization

Limits 1s, 256 MB

You are given an array aaa of nnn integers. Now, let’s define two variables PPP and SSS. Where PPP is the bitwise XOR value of all elements for any non-empty prefix. And SSS is the bitwise XOR value of all elements for any non-empty suffix. Now find the maximum value of (P&S)(P \& S)(P&S). Where &\&& denotes the bitwise AND operation.


This is a companion discussion topic for the original entry at https://toph.co/p/prefix-suffix-maximization