Problem:


Score : 300 points

Problem Statement

We have N clocks. The hand of the i-th clock (1≤i≤N) rotates through 360° in exactly T_i seconds.

Initially, the hand of every clock stands still, pointing directly upward.

Now, Dolphin starts all the clocks simultaneously.

In how many seconds will the hand of every clock point directly upward again?

Constraints

1≤N≤100 

1≤T_i≤10^{18} 

All input values are integers.  

The correct answer is at most 10^{18} seconds.

Input

Input is given from Standard Input in the following format:  

N
T_1
:  
T_N

Output

Print the number of seconds after which the hand of every clock point directly upward again.

Sample Input 1

2
2
3

Sample Output 1

6

We have two clocks. The time when the hand of each clock points upward is as follows:

Clock 1: 2, 4, 6, ... seconds after the beginning

Clock 2: 3, 6, 9, ... seconds after the beginning

Therefore, it takes 6 seconds until the hands of both clocks point directly upward.

Sample Input 2

5
2
5
10
1000000000000000000
1000000000000000000

Sample Output 2

1000000000000000000



Sample input:
2
2
3


Sample output:
6

Submission status: Runtime Error

Solution code:
from functools import reduce
n=int(input())
data=[]
for i in range(n):
    data.append(int(input()))
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
print(reduce(lcm,data))

Submission status: Runtime Error

Solution code:
N = int(input())
T = [int(input()) for _ in range(N)]
def gcd(a, b):
	while b:
        a, b = b, a % b
	return a
def lcm(a, b):
	return a * b // gcd(a, b)
l = 1
for i in T:
    l = lcm(l, i)
print(l)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [int(input() for _ in range(N))]

def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)

ans=1
for i in range(T):
    ans = lcm(ans,i)

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [int(input() for _ in range(N))]

def gcd(a,b):
    while b:
        a,b=b,a%b
    return b

def lcm(a,b):
    return a*b//gcd(a,b)

ans=1
for i in range(T):
    ans = lcm(ans,i)
    
print(ans)

Submission status: Runtime Error

Solution code:
import math
a = int(input())
s = 1
for i in range(a):
    t= int(input())
    s = (t*s)//gcd(t,s)
print(s)

Submission status: Runtime Error

Solution code:
import math
a = int(input())
s = 1
for i in range(a):
    t= int(input())
    s = (t*s)//math.gcd(t,s)
print(s)

Submission status: Runtime Error

Solution code:
import math 
from functools import reduce
#C問題
#最小公倍数
N=int(input())
T=[]
for i in range(0,N):
    T.append(int(input()))
def lcm_base(x,y):
    return (x*y)//math.gcd(x,y)
print(reduce(lcm_base,T))

Submission status: Runtime Error

Solution code:
from functools import reduce
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
T.sort()

def gcd(m,n):
    if n == 0:
        return m
    return gcd(n,m%n)
    
def lcm(m,n):
    return int(m * n/gcd(m,n))

print(reduce(lcm,T))

Submission status: Runtime Error

Solution code:
from functools import reduce
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
T.sort()
ans = 1
def gcd(m,n):
    x = max(m,n)
    y = min(m,n)
    if y == 0:
        return x
    else:
        return gcd(y,x%y)
    
def lcm(m,n):
    return int(m * n/gcd(m,n))

print(reduce(lcm,T))

Submission status: Runtime Error

Solution code:
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
T.sort()
ans = 1
def gcd(m,n):
    x = max(m,n)
    y = min(m,n)
    if y == 0:
        return x
    else:
        return gcd(y,x%y)
    
def lcm(m,n):
    return int(m * n/gcd(m,n))

for j in range(N):
    ans = lcm(ans,T[j])
        
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
T.sort()
ans = 1
def gcd(m,n):
    x = max(m,n)
    y = min(m,n)
    if x%y == 0:
        return y
    else:
        while x%y!=0:
            z = x%y
            x = y
            y = z
        else:
            return z    
def lcm(m,n):
    return int(m * n/gcd(m,n))

for j in range(N):
    ans = lcm(ans,T[j])
        
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
T.sort()
ans = 1
def gcd(m,n):
    x = max(m,n)
    y = min(m,n)
    if x%y == 0:
        return y
    else:
        while x%y!=0:
            z = x%y
            x = y
            y = z
        else:
            return z    
def lcm(m,n):
    return int((m*n)/gcd(m,n))

for j in range(N):
    ans = lcm(ans,T[j])
        
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
T.sort()
ans = 1

def gcd(m,n):
    x = max(m,n)
    y = min(m,n)
    if x%y == 0:
        return y
    else:
        while x%y!=0:
            z = x%y
            x = y
            y = z
        else:
            return z
    
def lcm(m,n):
    return int((m*n)/gcd(m,n))

ans = 1
for j in range(N):
    ans = lcm(ans,T[j])
        
print(ans)

Submission status: Runtime Error

Solution code:
#ABC070-C TLE
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b):
    g=gcd(a,b)
    return a/g*b

n=I()
t=[]
ans=1
for i in range(n):
    tmp=I()
    ans=lcm(ans,tmp)
print(int(ans))

Submission status: Runtime Error

Solution code:
from math import gcd
n = int(input())
t = [int(input()) for i in range(n)]
cm = t[0]

for i in range(1, n):
    cm = cm*t[i]//gcd(cm, t[i])
print(cm)

Submission status: Runtime Error

Solution code:
n=int(input())
t=list(map(int,[input() for i in range(n)]))

def gcd(x,y):
    if y==0:
        return x
    else:
        return gcd(y,x%y)
def lcm(x,y):
    return x*y//gcd(x,y)

ans=lcm(t[0],t[1])
for i in range(n-1):
    ans=lcm(ans,lcm(t[i],t[i+1]))
print(ans)

Submission status: Runtime Error

Solution code:
import math
def lcm(a, b):
    return a // math.gcd(a, b) * b
n = int(input())
ans = 1
for i in range(n):
    ans = lcm(ans, int(input()))
print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def lcm(a,b):
    return (a*b)/int(gcd(a,b))

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

ans = T[0]
for i in range(1,N):
    ans = int(lcm(ans,T[i]))
print(int(ans))

Submission status: Runtime Error

Solution code:
import math
def lcm(a,b):
    return (a*b)/int(ath.gcd(a,b))

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

ans = T[0]
for i in range(1,N):
    ans = int(lcm(ans,T[i]))
print(int(ans))

Submission status: Runtime Error

Solution code:
import math
def lcm(a,b):
    return (a*b)/math.gcd(a,b)

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

ans = T[0]
for i in range(1,N):
    ans = lcm(int(ans),int(T[i]))
print(int(ans))

Submission status: Runtime Error

Solution code:
import math
def lcm(a,b):
    return a*b/math.gcd(a,b)

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

ans = T[0]
for i in range(1,N):
    ans = lcm(ans,T[i])
print(int(ans))

Submission status: Runtime Error

Solution code:
import math

def lcm(a, b):
    return int(a * b / math.gcd(a, b))

n = int(input())

list = [int(input()) for i in range(n)]

def main():
    if n == 1:
        print(list[0])
        return

    num = list[0]
    for i in range(1, n):
        if num % list[i] == 0:
            continue
        elif list[i] % num == 0:
            num = list[i]
            continue
        else:
            num = lcm(num, list[i])

    print(num)
    return

main()

Submission status: Runtime Error

Solution code:
import math

def lcm(a, b):
    return a * b / math.gcd(a, b)

n = int(input())

list = [int(input()) for i in range(n)]

def main():
    if n == 1:
        print(list[0])
        return

    num = list[0]
    for i in range(1, n):
        if (num % list[i] == 0):
            continue
        elif (list[i] % num == 0):
            num = list[i]
            continue
        else:
            num = lcm(num, list[i])

    print(int(num))
    return

main()

Submission status: Runtime Error

Solution code:
import math

def lcm(a, b):
    return a * b / math.gcd(a, b)

n = int(input())

list = [int(input()) for i in range(n)]

if n == 1:
    print(list[0])
    exit(1)

num = list[0]
for i in range(1, n):
    if (num % list[i] == 0):
        continue
    elif (list[i] % num == 0):
        num = list[i]
        continue
    else:
        num = lcm(num, list[i])

print(int(num))

Submission status: Runtime Error

Solution code:
from fractions import gcd
N = int(input())
a = int(input())
for i in range(N-1):
    b = int(input())
    c = a * b / gcd(a, b)
    a = b
    b = c
print(int(c))

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    A = min([a, b])
    B = max([a, b])
    while b:
        a, b = b, a % b
    return a
N = int(input())
a = int(input())
for i in range(N-1):
    b = int(input())
    c = a * b / gcd(a, b)
    a = b
    b = c
print(int(c))

Submission status: Runtime Error

Solution code:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
N = int(input())
a = int(input())
for i in range(N-1):
    b = int(input())
    c = a * b / gcd(a, b)
    a = b
    b = c
print(int(c))

Submission status: Runtime Error

Solution code:
# ABC 070
import math
def getInt(): return int(input())
def getIntFromRows(n): return [int(input()) for i in range(n)]
N1019 = 10**19
N = getInt()
T = getIntFromRows(N)
a = T[0]
lcm = T[0]
for i in range(1, N):
    gcd = math.gcd(a, T[i])
    lcm = a * T[i] // gcd
    a = gcd
print(lcm)

Submission status: Runtime Error

Solution code:
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)


N = int(input())
T = []

for _ in range(N):
    T.append(int(input()))


ans = T[0]
for t in T:
    ans = lcm(ans, t)

print(ans)

Submission status: Runtime Error

Solution code:
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)


N = int(input())
T = []

for _ in range(N):
    T.append(int(input()))


ans = T[0]
for t in T:
    ans = lcm(ans, t)

print(ans)

Submission status: Runtime Error

Solution code:
from math import gcd

N = int(input())
T = []

for _ in range(N):
    T.append(int(input()))

def lcm(x, y):
    return (x * y) // gcd(x, y)

ans = T[0]
for t in T:
    ans = lcm(ans, t)

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
T = []
for _ in range(N):
    T.append(int(input()))

from math import gcd
from functools import reduce


def lcm(x, y):
    return (x * y) // gcd(x, y)


ans = T[0]
for t in T:
    ans = lcm(ans, t)

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
T = []
for _ in range(N):
    T.append(int(input()))

from math import gcd
from functools import reduce


def lcm(x, y):
    return (x * y) // gcd(x, y)

ans = reduce(lcm, T)
print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return int(a/gcd(a,b)*b)
    
n = int(input())
ans=1
for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(ans)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10000)
def gcd(n1,n2):
    if n1 > n2:
        n1,n2 = n2,n1
    if n2 % n1 == 0:return n1
    else: return gcd(n2%n1,n1)
n = int(input())
t = [int(input()) for i in range(n)]
check = t[0]*t[1]//gcd(t[0],t[1])
for i in range(n-2):
    check = (check*t[i+2])//gcd(check,t[i+2])
print(int(check))

Submission status: Runtime Error

Solution code:
def gcd(n1,n2):
    if n1 > n2:
        n1,n2 = n2,n1
    if n2 % n1 == 0:return n1
    else: return gcd(n2%n1,n1)
n = int(input())
t = [int(input()) for i in range(n)]
check = t[0]*t[1]/gcd(t[0],t[1])
for i in range(n-2):
    check = (check*t[i+2])//gcd(check,t[i+2])
print(int(check))

Submission status: Runtime Error

Solution code:
def gcd(n1,n2):
    if n1 > n2:
        n1,n2 = n2,n1
    if n2 % n1 == 0:return n1
    else: return gcd(n2%n1,n1)
n = int(input())
t = [int(input()) for i in range(n)]
check = t[0]*t[1]/gcd(t[0],t[1])
for i in range(n-2):
    check = check*t[i+2]/gcd(check,t[i+2])
print(int(check))

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return long(a/gcd(a,b)*b)
    
n = int(input())
ans=1
for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return a/gcd(a,b)*b
    
ans=1

for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(int(ans))

Submission status: Runtime Error

Solution code:
n = int(input())
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return long(a/gcd(a,b)*b)
    
ans=1

for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return int(a/gcd(a,b)*b)
    
ans=1

for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return int(a/gcd(a,b)*b)
    

n = int(input())

ans=1

for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
        
def lcm(a,b):
    res = int(a/gcd(a,b)*b)
    return res
    

n = int(input())

ans=1
for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
        
def lcm(a,b):
    res = int(a/gcd(a,b)*b)
    return res
    

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

ans=1
for i in range(n):
    ans = lcm(ans,t[i])
    
print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
        
def lcm(a,b):
    res = int(a/gcd(a,b)*b)
    return res
    

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

ans=1
for i in range(n):
    ans = lcm(ans,t[i])
    
print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
        
def lcm(a,b):
    g = gcd(a,b)
    return a/g*b

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

ans=1
for i in range(n):
    ans = lcm(ans,t[i])
    
print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
        
def lcm(a,b):
    g = gcd(a,b)
    return int(a/g*b)

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

res=1
for i in range(n):
    res = lcm(res,t[i])
    
print(res)

Submission status: Runtime Error

Solution code:

def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    g = gcd(a,b)
    return int(a/g*b)

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

res=1
for i in range(n):
    res = lcm(res,t[i])
    
print(res)

Submission status: Runtime Error

Solution code:

def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return int(a/gcd(a,b)*b)

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

res=1
for i in range(n):
    res = lcm(res,t[i])
    
print(res)

Submission status: Runtime Error

Solution code:

def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return int(a*b/gcd(a,b))

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

res=1
for i in range(n):
    res = lcm(res,t[i])
    
print(res)

Submission status: Runtime Error

Solution code:

def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return a*b/gcd(a,b)

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

res=1
for i in range(n):
    res = lcm(res,t[i])
    
print(res)

Submission status: Runtime Error

Solution code:

def gcd(a,b):
    if b==0:
        return a
        return gcd(b,a%b)
        
def lcm(a,b):
    return a*b/gcd(a,b)

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

res=1
for i in range(n):
    res = lcm(res,t[i])
    
print(res)

Submission status: Runtime Error

Solution code:
n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
def lcm(a,b):
    return int(a*b/gcd(a,b))

res=1
for i in range(n):
    res = lcm(res,t[i])
print(res)

Submission status: Runtime Error

Solution code:
#ABC070
n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
def lcm(a,b):
    return int(a*b/gcd(a,b))

# a,b,cの最小公倍数→lcm(lcm(a,b),c)で表される

# t[i]の最小公倍数を求めればよい。
res=t[0]
for i in range(1,n):
    if res>=t[i]:
        res = lcm(res,t[i])
    else:
        res = lcm(t[i],res)
print(res)

Submission status: Runtime Error

Solution code:
#ABC070
n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
def lcm(a,b):
    return int(a*b/gcd(a,b))

# a,b,cの最小公倍数→lcm(lcm(a,b),c)で表される

# t[i]の最小公倍数を求めればよい。
res=t[0]
for i in range(1,n):
    res = lcm(res,t[i])
print(res)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [int(input()) for i in range(N)]

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b / gcd(a, b)

now = lcm(T[0], T[1])
for i in range(1, N):
    now = lcm(now, T[i])

print(now)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [int(input()) for i in range(N)]

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

now = lcm(T[0], T[1])
for i in range(1, N):
    now = lcm(now, T[i])

print(now)

Submission status: Runtime Error

Solution code:
def abc070_c():
    from fractions import gcd
    n = int(input())
    t = [int(input()) for _ in range(n)]
    ans = 1
    for i in range(n):
        ans = int(ans * t[i] / gcd(ans, t[i]))

    print(ans)


abc070_c()

Submission status: Runtime Error

Solution code:
def abc070_c():
    from math import gcd
    n = int(input())
    t = [int(input()) for _ in range(n)]
    ans = 1
    for i in range(n):
        ans = int(ans * t[i] / gcd(ans, t[i]))

    print(ans)


abc070_c()

Submission status: Runtime Error

Solution code:
N = int(input())
T = [int(input()) for _ in range(N)]

import math
def lcm(x, y):
  return (x*y) // math.gcd(x, y)

result = []
for i in range(N):
  try:
    result.append(lcm(T[i], T[i+1]))
  except:
    break
print(max(result))

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return b

ans = 1
for _ in range(int(input())):
    t = int(input())
    ans = ans * t // gcd(ans, t)
print(ans)

Submission status: Runtime Error

Solution code:
from fraction import gcd
a=int(input())
s=int(input())
k=s
for i in range(a-1):
    d=int(input())
    k=(k*d)//gcd(k,d)
print(k)

Submission status: Runtime Error

Solution code:
from math import gcd


def lcm(a, b):
    return abs(a*b) // gcd(a, b)


def main():
    n = int(input())
    ts = [int(input()) for _ in range(n)]
    res = ts[0]
    for t in ts[1:]:
        res = lcm(res, t)
    print(res)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
from math import gcd
N = int(input())

ans = int(input())
for _ in range(N-1):
    t = int(input())
    g = gcd(t, ans)
    ans = ans*t//g
print(ans)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

n=int(input())
tl=[int(input()) for _ in range(n)]

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
    
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


print(lcm(*tl))

Submission status: Runtime Error

Solution code:
import fractions
def lcm(a,b):
  return (a*b)//fractions.gcd(a,b)
n=int(input())
x=lcm(int(input()),int(input()))
for i in range(n-2):
  x=lcm(x,int(input()))
print(x)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

n = int(input())
a = [int(input()) for _ in range(n)]

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

def lcm(nums):
    #3つ目は初期値
    return reduce(lcm_base, nums, 1)

print(lcm(a))

Submission status: Runtime Error

Solution code:
import fractions
N = int(input())
T = [int(input()) for i in range(N)]
T = list(set(T))
pro = T[0]
for i in range(1,len(T)):
    gcd = fractions.gcd(pro,T[i])
    lcm = (pro * T[i]) // gcd
    pro = lcm
print(lcm)

Submission status: Runtime Error

Solution code:
import fractions
N = int(input())
T = [int(input()) for i in range(N)]
T = list(set(T))
pro = T[0]
for i in range(1,N):
    gcd = fractions.gcd(pro,T[i])
    lcm = (pro * T[i]) // gcd
    pro = lcm
print(lcm)

Submission status: Runtime Error

Solution code:
import fractions
N = int(input())
T = [int(input()) for i in range(N)]
pro = T[0]
for i in range(1,N):
    gcd = fractions.gcd(pro,T[i])
    lcm = (pro * T[i]) // gcd
    pro = lcm
print(lcm)

Submission status: Runtime Error

Solution code:
N=int(input())
l=[]
for i in range(N):
    l.append(int(input()))
import fraction
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(l))

Submission status: Runtime Error

Solution code:
N=int(input())
l=[]
for i in range(N):
    l.append(int(input()))
import fraction
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(l))

Submission status: Runtime Error

Solution code:
N=int(input())
l=[]
for i in range(N):
    l.append(int(input()))
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(l))

Submission status: Runtime Error

Solution code:
import itertools
import math


def gcd(a,b):
    while b:
        a, b = b, a % b
    return a


def lcm(left, right):
    return (int(left) * int(right)) / int(gcd(left, right))


N = int(input().strip())
Ts = []
for i in range(N):
    Ts.append(int(input().strip()))

res = 0
if len(Ts) == 0:
    res = 0
elif len(Ts) == 1:
    res = Ts[0]
else:
    res = int(lcm(Ts[0], Ts[1]))
    for T in Ts[2:]:
        res = int(lcm(res, T))

print(str(int(res)))

Submission status: Runtime Error

Solution code:
import itertools
import math


def gcd(a,b):
    while b:
        a, b = b, a % b
    return a


def lcm(left, right):
    return (int(left) * int(right)) / int(gcd(left, right))


N = int(input().strip())
Ts = []
for i in range(N):
    Ts.append(int(input().strip()))

res = int(lcm(Ts[0], Ts[1]))
for T in Ts[2:]:
    res = int(lcm(res, T))

print(str(int(res)))

Submission status: Runtime Error

Solution code:
import itertools
import math


def lcm(left,right):
    return (int(left) * int(right)) / int(math.gcd(left,right))


N = int(input().strip())
Ts = []
for i in range(N):
    Ts.append(int(input().strip()))

res = int(lcm(Ts[0], Ts[1]))
for T in Ts[2:]:
    res = int(lcm(res, T))

print(int(res))

Submission status: Runtime Error

Solution code:
import itertools
import math


def lcm(left,right):
    return (int(left) * int(right)) / int(math.gcd(left,right))


N = int(input().strip())
Ts = []
for i in range(N):
    Ts.append(int(input()))

res = int(lcm(Ts[0], Ts[1]))
for T in Ts[2:]:
    res = int(lcm(res, T))

print(int(res))

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    if a < b:
        a, b = b ,a
    while b > 0:
        a, b = b, a % b
    return a

def lcm(a, b):
    return int((a * b) / gcd(a, b))

N = int(input())
T = [int(input()) for i in range(N)]

ans = T[0]

for t in T[1:]:
    ans = lcm(ans, t)

print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a

def lcm(a, b):
    return int((a * b) / gcd(a, b))

N = int(input())
T = [int(input()) for i in range(N)]

ans = T[0]

for t in T[1:]:
    ans = lcm(ans, t)

print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a

def lcm(a, b):
    return int((a * b) / gcd(a, b))

N = int(input())
T = [int(input()) for i in range(N)]

ans = T[0]

for t in T[1:]:
    ans = lcm(t, ans)

print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a

def lcm(a, b):
    return int((a * b) / gcd(a, b))

N = int(input())
T = [int(input()) for i in range(N)]

a = T[0]

for b in T[1:]:
    a = lcm(a, b)

print(a)

Submission status: Runtime Error

Solution code:
def kouyaku(a,b):
    aa = max(a,b)
    bb = min(a,b)
    if bb == 0:
        return aa
    else:
        return kouyaku(bb,aa%bb)

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

ans = T[0]
for time in T:
    ans = int( ans / kouyaku(ans, time) * time)
    
print(ans)

Submission status: Runtime Error

Solution code:
def kouyaku(a,b):
    aa = max(a,b)
    bb = min(a,b)
    if bb == 0:
        return aa
    else:
        return kouyaku(bb,aa%bb)

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

ans = 0
for time in T:
    if ans:
        ans = int( ans * time / kouyaku(ans, time) )
    else:
        ans = time
    
print(ans)

Submission status: Runtime Error

Solution code:
def kouyaku(a,b):
    aa = max(a,b)
    bb = min(a,b)
    if bb == 0:
        return aa
    else:
        return kouyaku(bb,aa%bb)

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

T.sort()
T.reverse()

ans = 0
for time in T:
    if ans:
        ans = int( ans * time / kouyaku(ans, time) )
    else:
        ans = time
    
print(ans)

Submission status: Runtime Error

Solution code:
from math import gcd
num_clock = int(input())
times = [int(input()) for i in range(num_clock)]
spent_time = times[0]
for time in times[1:]:
    spent_time = (spent_time * time) // gcd(spent_time, time)
print(spent_time)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    while b > 0:
        tmp = a
        a = b
        b = tmp % b
    return a


def lcm(a, b):
    tmp = gcd(a, b)
    return int((a/tmp) * b)


n = int(input())
t = [0 for i in range(n)]
for i in range(n):
    t[i] = int(input())
t = sorted(t)
sum = t[0]
for i in range(1, n):
    # print("sum:{} t:{} lcm:{}".format(sum, t, lcm(sum, t)))
    sum = lcm(sum, t[i])
    # print(sum)
print(sum)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    while b > 0:
        tmp = a
        a = b
        b = tmp % b
    return a


def lcm(a, b):
    tmp = a / gcd(a, b)
    return int(tmp * b)


n = int(input())
t = [0 for i in range(n)]
for i in range(n):
    t[i] = int(input())
t = sorted(t)
sum = t[0]
for i in range(1, n):
    # print("sum:{} t:{} lcm:{}".format(sum, t, lcm(sum, t)))
    sum = lcm(sum, t[i])
    # print(sum)
print(sum)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    while b > 0:
        tmp = a
        a = b
        b = tmp % b
    return a


def lcm(a, b):
    return int(a * (b / gcd(a, b)))


n = int(input())
t = [0 for i in range(n)]
for i in range(n):
    t[i] = int(input())
t = sorted(t)
sum = t[0]
for i in range(1, n):
    # print("sum:{} t:{} lcm:{}".format(sum, t, lcm(sum, t)))
    sum = lcm(sum, t[i])
    # print(sum)
print(sum)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    while b > 0:
        tmp = a
        a = b
        b = tmp % b
    return a


def lcm(a, b):
    return int((a * b) / gcd(a, b))


n = int(input())
t = [0 for i in range(n)]
for i in range(n):
    t[i] = int(input())
t = sorted(t)
sum = t[0]
for i in range(1, n):
    # print("sum:{} t:{} lcm:{}".format(sum, t, lcm(sum, t)))
    sum = lcm(sum, t[i])
    # print(sum)
print(sum)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    while b > 0:
        tmp = a
        a = b
        b = tmp % b
    return a


def lcm(a, b):
    return int((a * b) / gcd(a, b))


n = int(input())
t = [0 for i in range(n)]
for i in range(n):
    t[i] = int(input())
sum = t[0]
for i in range(1, n):
    # print("sum:{} t:{} lcm:{}".format(sum, t, lcm(sum, t)))
    sum = lcm(sum, t[i])
    # print(sum)
print(sum)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    a, b = min(a, b), max(a, b)
    if a == 0:
        return b
    else:
        return gcd(b % a, a)

def lcm(a, b):
    return int((a * b) / gcd(a, b))


n = int(input())
# つまり全t[i]で割り切れる値を出せということ
# 最小公倍数を出せばよい
t = [0 for i in range(n)]
for i in range(n):
    t[i] = int(input())
sum = t[0]
for i in range(1, n):
    # print("sum:{} t:{} lcm:{}".format(sum, t, lcm(sum, t)))
    sum = lcm(sum, t[i])
    # print(sum)
print(sum)
"""
# 入力 : 自然数     ex) 12
# 出力 : 約数リスト ex) [2, 2, 3]
def factorization(n):
    R = int(n)
    s = 0
    L = []
    div = 2
    first = True
    while s == 0:
        for i in range(div, R + 1):
            if n % i == 0:
                n = n / i
                if i == div and not first:
                    alreadyExist = True
                else:
                    alreadyExist = False
                first = False
                div = i
                if n == 1:
                    s = 1
                if alreadyExist:
                    L[-1][1] += 1
                else:
                    L.append([i, 1])
                break
    return L


n = int(input())
t = [0 for i in range(n)]
fact = []
for i in range(n):
    # print(i)
    t[i] = int(input())
    if i == 0:
        fact = factorization(t[i])
    else:
        tmpFact = factorization(t[i])
        for _tmpFact in tmpFact:
            for _fact in fact:
                if _fact[0] == _tmpFact[0]:
                    _fact[1] = max(_fact[1], _tmpFact[1])
                    break
                elif _fact[0] == fact[-1][0]:
                    fact.append(_tmpFact)
# つまり全t[i]で割り切れる値を出せということ
# 最小公倍数を出せばよい
sum = 1
for _fact in fact:
    sum *= _fact[0]**_fact[1]
print(sum)
"""