BITOBYT code gives partially correct (25%) and a TLE (75%)

My program for BITOBYT gives a partially correct answer (25%) for a subtask and TLE (75%) for another subtask.
Here is my code - BITOBYT code

I have made some changes in your code see it here AC SOL BITOBYTE.