Why my code is giving wrong answers?

I was solving the gray similar code problem on CodeChef.

Why my code is giving the wrong answers?

codechef Problem link: https://www.codechef.com/problems/GRAYSC

My solution: https://ide.codingblocks.com/s/240434

@siddharth_1_3277
Range of input is 2^64
For that use unsigned long long instead of long long

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.