Obtain the Sum (BS Solution Problem)

Problem Link : CodeChef: Practical coding for everyone
Solution Link : CodeChef: Practical coding for everyone

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.