alive_ak4c's blog

By alive_ak4c, history, 19 months ago, In English

Recently I was solving this question in python. I had thought of a solution and I tried submitting it in python 3, although most of my solutions were accepted via python 3 interpreter. This problem held me by TLEs, a bunch of them.

I was so confused that I started breaking the logic in further if else's only to find that they don't help. I started to search for reasons on the internet and stumbled upon this article just by luck.

It is a TLE saviour. I skimmed through the article and submitted my code in pypy 3 instead of python 3 and to my surprise, it got Accepted. My amusement didn't end here. The execution time was very much comparable to the c++ code and almost 5 times faster than python 3.

So I am switching to this interpreter now. And if you too are getting TLEs it is would be worthy to try submitting your code with pypy 3.

Happy Coding!!!

Edit1:

Looks like pajenegod has a valid point here, this is not always true.

My apologies!!!

Edit 2:

Codeforces submission page also recommends using PyPy. Proof

So, it's a recommendation rather than a guarantee.

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it