MuhammadSawalhy's blog

By MuhammadSawalhy, history, 2 years ago, In English

This is my first time submitting an answer with python. I tried PyPy 3-64 but got runtime error, I thought it was my fault to submit with PyPy as the language which I don't know anything about it. Then I tried to submit again with Python 3 in no vain.

These are my submissions:

  1. https://codeforces.me/contest/1690/submission/160147330
  2. https://codeforces.me/contest/1690/submission/160147403

Can anyone help?!

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

In general, to debug something like this, run code in "CUSTOM INVOCATION". I run your submission and it show message below:

Message

The reason is function 'math.lcm' is new in Python 3.9 but the Python env on codeforces is 3.8.10.

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

    Thank you, I will try to find a workaround with gcd.

    gcd(a,b) * lcm(a,b) = a*b

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

I think the problem is that math.lcm that I used in my submission is new in Python 3.9 and not available in Python 3.8.

Source: https://docs.python.org/3/library/math.html#math.lcm