Stuck at a bit manpulation problem

can anybody please tell me what’s wrong with my code , as it is getting “WA” on last test case?
question: XORAND Problem | CodeChef
my code: CodeChef | Competitive Programming | Participate & Learn

Your code is on line 35

ll cnt = (i.second) * (i.second - 1) / 2;

There is a 32-bit int overflow, i.second will be 1e5 when all msb(a[i]) are the same and the calculation will exceed MAX_INT.


ll cnt = (long long)(i.second) * (i.second - 1) / 2;

thanks @a7742525643