Let's call an array bitwise XOR operation.
For example, array 1+2+1+3=7≠2⋅1=2⋅(1⊕2⊕1⊕3).
You are given an array of length you don't have to minimize the number of added elements!. So, if an array is good already you are allowed to not append elements.
Each test contains multiple test cases. The first line contains the number of test cases 1≤t≤10000). The description of the test cases follows.
The first line of each test case contains a single integer (1≤n≤105) — the size of the array.
The second line of each test case contains 0≤ai≤109) — the elements of the array.
It is guaranteed that the sum of 105.
For each test case, output two lines.
In the first line, output a single integer 0≤s≤3) — the number of elements you want to append.
In the second line, output 0≤bi≤1018) — the elements you want to append to the array.
If there are different solutions, you are allowed to output any of them.
3 4 1 2 3 6 1 8 2 1 1
0 2 4 4 3 2 6 2
In the first test case of the example, the sum of all numbers is 6, so the condition is already satisfied.
In the second test case of the example, after adding ⊕ of numbers in it is
#include<iostream> #include<cstdio> using namespace std; int n; long long ans[5]; int main(){ int t; scanf("%d",&t); while(t--){ scanf("%d",&n); long long sum=0,a=0; int cnt=0,x; for(int i=1;i<=n;i++){ scanf("%d",&x); sum+=x; a^=x; } ans[++cnt]=(1LL<<50)+(sum%2); sum+=ans[cnt]; a^=ans[cnt]; ans[++cnt]=(2LL*a-sum)/2; ans[++cnt]=(2LL*a-sum)/2; printf("%d\n",cnt); for(int i=1;i<=cnt;i++)printf("%lld ",ans[i]); puts(""); } return 0; }