Im getting TLE on this code

Im getting TLE on this code but when I coded the same algorithm using python instead of cpp it got accepted

for python code: https://ide.codingblocks.com/s/221781
for cpp code: https://ide.codingblocks.com/s/221784
This problem is from codeforces’s Div 2 #637 Nastya and door

I used long long to store the values bro and I can’t understand hindi pls reply in English

Hi @vishal23rfx

One of the possible scenario for your python solution getting accepted can be that in general the time constraint for python is approx 5*(time constraints for C++), reason being python is much slower than c++ and java.

So, thats why your python solution is not exceeding the time limit.

No my python code took max 389 ms for the test cases but cpp took 1000 ms and got TLE

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.