My last subtask is failing in Java but the same approach is working completely fine in python. Help me in finding out the mistake please!
https://www.codechef.com/viewsolution/18320014
Correction 
Python does not allow overflow till \approx {10}^{7000}. Been there, done that, hence the knowledge xD
I don’t think that’s correct @vijju123. The documentation clearly states “Integers have unlimited precision”
Yes, that 7000 limit holds for float data type I see. If you try to execute-
a=(10.0)**7000
you will get an overflow error. And for some reason I feel float is the favorite data type of python xD. Yes, integers, I agree with you. Integers do have precision limited to your computer’s hardware capacity
(lets not throw unlimited here
). For codechef I think it will be time limit though, instead of memory one.
The thing was, I see this is a general misconception in python where people try to store and manipulate numbers with as long as {10}^{9} digits just because of “unlimited”
CodeChef: Practical coding for everyone - this one. If you try doing brute force with python, thinking that there is no limit, you get NZEC here.
I cant find the question link, but one user tried to do something on lines of \frac{A*{2}^{(N+1)/2}}{B*2^{N/2}} and he got NZEC error. Just search this “twonm” on forum and you will see people using JAVA big integer library to solve it. I call that “Brute Force” since you are doing what the question said xD
so twonm is most solved in june lunchtime and still interesting,nice:)