Codechef doubt march

https://www.codechef.com/MARCH21C/problems/IRSTXOR

My solution https://ide.codingblocks.com/s/435752
when i am submitting it in contest once its showing runtime error and when i am running it its showing successfully executed and showing right output.Please help.

Look at size of constraints, it will give you TLE only if you will run loop for T*C times as T is 10^5 & C is 10^9, you have to show result in O(1) time for every T test case. Try to use extra space to reduce ypur time complexity.

if I do the same problem in c++ and use long long then will it help??

If you will use same logic then it won’t cause time consumption will be same. Try to think of an approach where you use extra space to reduce it’s time complexity. Though it’s an ongoing challenge so can’t help much. But think it in form like we used to think of prime numbers by making sieve.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.