When the only think that changed is the size of input, which has no effect in python, and when i looked in all submissions a lot of people have partially accepted solution for same problem…and to clarify it say WA not TLE…

what are you trying to say?

By size of input do you mean size of integer??

Oh boii!!

You have your logics incorrect.

There is no restriction of input in any language. Python can handle large numbers well. Cpp can handle them by using `long long`

or if it is `tooooooo loooooong`

, we can handle them by `strings`

.

Taking input has no relation with complexity of the solution. Say if n= 10^{7}, O(n) solution will work and O(n^2) will not work. O(n^2) can work for smaller inputs, say, n=10^4. I recommend you working on basic knowledge of Big-Oh notation and Time Complexity of an Algorithm.

Again, Taking input has no relation with time complexity of the algorithm.

I am facing this problem for the second time for python. Exact logic successfully execute all the test cases with java. If you find what is wrong, please reply.