Hi guys, I am annoyed by constant TLE's in this question. My $O(NLogN)$ solution takes 1.86 on $T=10$ and $N=10^{10^5}$ (i.e. when length of $N$ is of order $10^5$) Any tips on optimizing it further? Link : https://www.codechef.com/viewsolution/22076971 My logic was, iterate through every digit, and calculate its contribution at once using fast exponentiation. Say, we are finding contribution of i'th digit, we know the pattern will be like
Hence, I add $Digit*(Sum$ $of$ $powers$ $of$ $10)$ which can be calculated by formula for sum of the 2 GPs. asked 24 Dec '18, 20:30

The question has been closed for the following reason "The question is answered, right answer was accepted" by vijju123 25 Dec '18, 16:42
I removed the memoization from your code and changed answered 25 Dec '18, 00:19
Thanks a lot!! Well, it seems to me that the TL was poorly set keeping only linear solution in mind :/. Many of the fastExpo ones not preprocessing power of 10 failed because of taking $0.X$ extra seconds. When making it const, compiler $might$ do some random optimizations, which are completely dependent on the machine  that make it pass.
(25 Dec '18, 16:27)

Optimizing tip 
Ctrl+F then %
Ctrl+F then %
I want to remove TLE to get AC, not for another WA :/
Which are the redundant ones which I can remove without getting WA? :)