do you have a loop with 3141^5 iterations??
Why that many iterations?
That’ll give TLE right!!!?
in line 3: maxK=3141**5.
in line 56: for i in range(2,maxK+1)
Line 61 is having
if power>maxK :
Power iterates from 2 to maxK+1, each time the power gets updated by power**3, and if it is greater than maxK, the above statement breaks the loop.
Oops I think I Missed something over there
I have to check.
But still my Solution is giving WA not TLE
run it locally and see what happens