Hey buddy!!
I have also done this problem with essentially same logic in Python 3 only.
I think you should try to define a function which does the same work as your code after reading input. I got right answer with that approach.
@fallmount Instead of p=p/2 , use p=p//2
In p = p/2 python automatically converts it to floating point and in case when Chef dies p will keep on decreasing but will never become zero.
eg. testcase
1
1 10
In this p=p/2 will give
p=1
p=0.5
p=0.25
…
…
…
@zacros you are right. That is the only difference between my and @fallmount code.
This is the reason why my code works fine but not his.
Thanks for pointing that out.
I really need to work on my skills to point out these things.
I tried that but it gives wrong answer @zacros, if you don’t believe you can copy my code and change normal division to floor division and submit also you can see my submission with same changes here CodeChef: Practical coding for everyone. I have also tried @anon60151173 tip and it worked just submit the same code under pypy3 and it worked here is that submission CodeChef: Practical coding for everyone. At last thanks to all