i am trying this question from past few days but it keeps getting TLE.Even the previous solutions are hard to understand.any kind of help is appreciated.Thanks in advanced…

https://www.codechef.com/problems/H4

Pay attention to m.

Solution time complexity is O(min(n, m)).

Use geometric series.

PS: I guess you made a mistake in name of this problem. It’s “Just a simple sum”

I havent solved that question yet dear. Perhaps taran can help you at this one

The constraints of SEQUA are much more loose and so, even strange solutions like CodeChef: Practical coding for everyone can pass… (Scroll down to the bottom of the solution XD)