getting tle in GSS1 of spoj

can anyone help me by telling why my code 4Y97gD - Online C++ Compiler & Debugging Tool - Ideone.com for gss1 is giving tle.

just made a few optimistations,using shift operators for multiplication,division and fast io.
Your solution: Online Compiler and IDE - GeeksforGeeks

thanks @vivek_1998299 but is there any other way to get ac without using these optimizations.

I dont think so,as ur logic is absolutely right.Even if u remove shift operators it’ll still get accepted.Majority of time is consumed due to I/O.U could try coding the iterative version.

when i removed shift operators i got tle.

Your solution without shift operator: Online Compiler and IDE - GeeksforGeeks

Ac in 0.15

U could remove the fast io,it’ll still get accepted (just use ‘\n’ instead of endl)

thanks didn’t knew that endl could make program that slow.

Plz help @vivek_1998299. I am getting TLE even after using fast IO.

Sir Can we solve the same spoj GSS series problems using fenwick trees