Homeo's blog

By Homeo, history, 2 years ago, In English

I'm troubling with the idea that sometimes Python3 is faster than PyPy and i couldn't find why..

Its is actually frustrating in contests when i submit the same code with PyPy and it doesn't get accepted but with Python3 it gets accepted and i get penalty Deducted.

like this code here : The submission with Python3:

163955071 --> 716ms

The submission with PyPy:

163955090 --> 2152ms

I searched along the codeforces blogs to find a clear answer and i didn't find any.

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

| Write comment?
»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

https://codeforces.net/blog/entry/62431

pypy performs well with a large number of arithmetic operations

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Input and output is generally slow in python. You can use the pyrival template to improve your code execution speed. You can read this blog to improve python performance

Here is 372ms submission of your code using pyrival pypy3 template.