TLE IN FUNC

PLZZ SUGGEST ANY WAYS TO REMOVE TLE IN FUNC…

SOLN LINK… :-- CodeChef: Practical coding for everyone

THNX IN ADVANCE

I think its may be because you are calling pow or power function (minimum) 2-3 times for one query…

Your code gives WA for every test case in which ‘x’ > 10^9 because you have taken input in int variable. Have a look at this.

the input is
1
3 1
4 5 6
10000000000000000