Problem p02793 (python)

Fixed submission:
def lcm(X,Y):
    x=X
    y=Y
    if y>x:
        x,y=y,x
    while x%y!=0:
        x,y=y,x%y
    return X*Y//y

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))

LCM = A[0]
for i in range(0,N-1,1):
    LCM = lcm(LCM,A[i+1])
B = [0 for i in range(0,N,1)]
for i in range(0,N,1):
    B[i]= (LCM%MOD)*pow(A[i],MOD-2,MOD)%MOD

ans = 0
for i in range(0,N,1):
    ans = (B[i] + ans)%MOD

print(ans)

Buggy submission (verdict: Runtime Error):
import math

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))

LCM = A[0]
for i in range(0,N-1,1):
    LCM = LCM*A[i+1]//math.gcd(A[i+1],LCM)
B = [0 for i in range(0,N,1)]
for i in range(0,N,1):
    B[i]= (LCM%MOD)*pow(A[i],MOD-2,MOD)%MOD

ans = 0
for i in range(0,N,1):
    ans = (B[i] + ans)%MOD

print(ans)

Buggy submission (verdict: Runtime Error):
import math

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))
print(math.gcd(5,4))

Buggy submission (verdict: Runtime Error):
import math

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))
print(math.gcd(5,4))

Buggy submission (verdict: Runtime Error):
import math

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))
math.gcd(5,4)

Buggy submission (verdict: Runtime Error):
import math

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))

LCM = A[0]
for i in range(0,N-1,1):
    LCM = LCM*A[i+1]//math.gcd(A[i+1],LCM)

Buggy submission (verdict: Runtime Error):
import math

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))

LCM = A[0]
for i in range(0,N-1,1):
    LCM = LCM*A[i+1]//math.gcd(A[i+1],LCM)

Buggy submission (verdict: Runtime Error):
import math

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))

LCM = A[0]
for i in range(0,N-1,1):
    LCM = LCM*A[i+1]//gcd(A[i+1],LCM)

Buggy submission (verdict: Runtime Error):
from math import gcd

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))

Buggy submission (verdict: Runtime Error):
A = list(map(int,input().split()))

LCM = A[0]
for i in range(0,N-1,1):
    LCM = LCM*A[i+1]//math.gcd(A[i+1],LCM)
B = [0 for i in range(0,N,1)]
for i in range(0,N,1):
    B[i]=LCM//A[i]

ans = 0
for i in range(0,N,1):
    ans = B[i] + ans

print(ans)

Buggy submission (verdict: Runtime Error):
A = list(map(int,input().split()))

LCM = A[0]
for i in range(0,N-1,1):
    #LCM = LCM*A[i+1]/math.gcd(A[i+1],LCM)
B = [0 for i in range(0,N,1)]
for i in range(0,N,1):
    B[i]=(LCM*pow(A[i],MOD-2,MOD))%MOD

ans = 0
for i in range(0,N,1):
    ans = (B[i]%MOD + ans%MOD)%MOD

print(ans)

Buggy submission (verdict: Runtime Error):
import math

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))

LCM = A[0]
for i in range(0,N-1,1):
    LCM = LCM*A[i+1]/math.gcd(A[i+1],LCM)
B = [0 for i in range(0,N,1)]
for i in range(0,N,1):
    B[i]=(LCM*pow(A[i],MOD-2,MOD))%MOD

ans = 0
for i in range(0,N,1):
    ans = (B[i]%MOD + ans%MOD)%MOD

print(ans)

Buggy submission (verdict: Runtime Error):
import math

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))

LCM = A[0]
for i in range(0,N-1,1):
    LCM = LCM*A[i+1]//math.gcd(A[i+1],LCM)
B = [0 for i in range(0,N,1)]
for i in range(0,N,1):
    B[i]=(LCM*pow(A[i],MOD-2,MOD))%MOD

ans = 0
for i in range(0,N,1):
    ans = (B[i]%MOD + ans%MOD)%MOD

print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))

LCM = A[0]
for i in range(0,N-1,1):
    LCM = LCM*A[i+1]//gcd(A[i+1],LCM)
B = [0 for i in range(0,N,1)]
for i in range(0,N,1):
    B[i]=(LCM*pow(A[i],MOD-2,MOD))%MOD

ans = 0
for i in range(0,N,1):
    ans = (B[i]%MOD + ans%MOD)%MOD

print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))

LCM = A[0]
for i in range(0,N-1,1):#O(nlogA)
    LCM = LCM*A[i+1]//gcd(A[i+1],LCM)
B = [0 for i in range(0,N,1)]
for i in range(0,N,1):#O(n)
    B[i]=(LCM*pow(A[i],MOD-2,MOD))%MOD

ans = 0
for i in range(0,N,1):
    ans = (B[i]%MOD + ans%MOD)%MOD

print(ans)

Buggy submission (verdict: Runtime Error):
MOD = 1000000007

from math import gcd

N = int(input())
A = list(map(int,input().split()))

LCM = A[0]
for i in range(0,N-1,1):#O(nlogA)
    LCM = LCM*A[i+1]//gcd(A[i+1],LCM)
B = [0 for i in range(0,N,1)]
for i in range(0,N,1):#O(n)
    B[i]=(LCM*pow(A[i],MOD-2,MOD))%MOD

ans = 0
for i in range(0,N,1):
    ans = (B[i]%MOD + ans%MOD)%MOD

print(ans)