I wrote the following C++ code while I was trying to solve Google Code Jam 2011 Qualification Round Problem C “Candy Splitting” (the code presented here is slightly modified but essentially the same).
int N;
scanf("%d", &N);
vector<int> candies(N);
for (int i = 0; i < N; ++i)
scanf("%d", &candies[i]);
int xor = 0;
for (int i = 0; i < N; ++i)
xor ^= candies[i];
I met the same problem with the word «link».