I was solving XMAX question of Spoj using Gaussian elimination method to find the max subset xor of an array.

But it’s giving me WRONG answer after passing through few testcases,don’t to why? Most surprisingly XORSUB question of Codechef(which is nearly same as XMAX, just have difference of initializing ans=0 and ans=k) is giving me Right answer on codechef.

Here are links:

XMAX question: http://www.spoj.com/problems/XMAX/.

My XMAX solution: http://ideone.com/UbRCH9

XORSUB question: https://www.codechef.com/problems/XORSUB.

My XORSUB solution: https://www.codechef.com/viewsolution/14208798