https://www.codechef.com/problems/BITOBYT

https://www.codechef.com/problems/BITOBYT

Here is the link to my code : https://pastebin.com/raw/NeXd1rjn

Would be highly grateful if someone can look into it, and point out where I am going wrong. Thanks.

Did you check the editorial ???