Can anyone look into this code Python Code and tell why I am getting Runtime Error. Same code when written in C is passing. C Code
Can anyone look into this code Python Code and tell why I am getting Runtime Error. Same code when written in C is passing. C Code
# | User | Rating |
---|---|---|
1 | tourist | 3757 |
2 | jiangly | 3647 |
3 | Benq | 3581 |
4 | orzdevinwang | 3570 |
5 | Geothermal | 3569 |
5 | cnnfls_csy | 3569 |
7 | Radewoosh | 3509 |
8 | ecnerwala | 3486 |
9 | jqdai0815 | 3474 |
10 | gyh20 | 3447 |
# | User | Contrib. |
---|---|---|
1 | maomao90 | 171 |
2 | adamant | 164 |
3 | awoo | 163 |
4 | TheScrasse | 159 |
5 | nor | 155 |
6 | maroonrk | 154 |
7 | -is-this-fft- | 152 |
8 | Petr | 147 |
9 | orz | 146 |
10 | pajenegod | 145 |
Name |
---|
Run your code in the custom test with the test case it fails. The error it throws is that in your for loop, i needs to be a long, but Python considers it an int. Therefore, you have an overflow.
@Saat, I tried running the same code on my personal machine and on ideone.com on the same test case it was failing. It is running fine there.
There are differences in the interpreters. You can see that Codeforces is full of people complaining about RTE in cpp due to undefined behavior. I guess that there is the same problem in Python.