Problem p02793 (python)

Fixed submission:
import fractions
 
N = int(input())

def LI():
  return [int(s) for s in input().split()]

A_s = LI()
mod = 10**9 + 7

#l = lcm_list(A_s)
l = 1
for num in A_s:
    l = l * num // fractions.gcd(l,num)

count = 0
for a in A_s:
  count+=l//a
  
print(count % mod)

Buggy submission (verdict: Runtime Error):
import sys
 
input = sys.stdin.readline
 
ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]
 
import sys
import numpy as np
import fractions
 
from functools import reduce
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
 
def lcm_list(numbers):
    ans = 1
    for num in numbers:
        ans = ans * num // fractions.gcd(ans,num)
    return ans
 
def LI():
  return [int(s) for s in input().split()]
 
 
input = sys.stdin.readline
ri = lambda: int(input())
ril = lambda: list(map(int, input().split()))
 
N = ri()
A_s = ril()
mod = 10**9 + 7
 
#l = lcm_list(A_s)
l = 1
for num in numbers:
    l = l * num // fractions.gcd(l,num)
 
print(sum(map(lambda x : l//x, A_s)) % mod)

Buggy submission (verdict: Runtime Error):
import sys
 
input = sys.stdin.readline
 
ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

import sys
import numpy as np
import fractions
 
from functools import reduce
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
 
def lcm_list(numbers):
    ans = 1
    for num in numbers:
        ans = ans * num // fractions.gcd(ans,num)
    return ans
 
def LI():
  return [int(s) for s in input().split()]
 
 
input = sys.stdin.readline
ri = lambda: int(input())
ril = lambda: list(map(int, input().split()))
 
N = ri()
A_s = ril()
mod = 10**9 + 7
 
#l = lcm_list(A_s)
l = 1
for num in numbers:
    ans = ans * num // fractions.gcd(ans,num)
return ans
 
print(sum(map(lambda x : l//x, A_s)) % mod)

Buggy submission (verdict: Runtime Error):
import numpy as np
import fractions
 
from functools import reduce
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def LI():
  return [int(s) for s in input().split()]


input = sys.stdin.readline
ri = lambda: int(input())
ril = lambda: list(map(int, input().split()))

N = ri()
A_s = ril()
mod = 10**9 + 7
 
l = lcm_list(A_s)
 
print(sum(map(lambda x : l//x, A_s)) % mod)

Buggy submission (verdict: Runtime Error):
import numpy as np
import fractions

from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def LI():
  return [int(s) for s in input().split()]

N = int(input())
A_s = LI()

mod = 10**9 + 7

l = lcm_list(A_s)

print(sum(map(lambda x : l//x, A_s)) % mod)