Obtain the Sum (BS Solution Problem)

Problem Link : Contest Page | CodeChef
Solution Link : Solution: 51108106 | CodeChef

Plz tell me what is wrong with this ?

N is upto 1e9, so TLE. Look at the editorial, you need to do it in O(1)

In your code, you use a lot of cerr’s and loops, which is unnecessary for this task.