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:
import math

n = int(input())
a = []
if n == 1:
  print(a[0])
else:
  
  for i in range(n):
    a.append(int(input()))
  lcm = (a[0] * a[1]) // math.gcd(a[0], a[1])
  for i in range(2, n):
    lcm = (lcm * a[i]) // math.gcd(lcm, a[i])
  print(lcm)

Submission status: Runtime Error

Solution code:
import math

n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
lcm = (a[0] * a[1]) // math.gcd(a[0], a[1])
for i in range(2, n):
  lcm = (lcm * a[i]) // math.gcd(lcm, a[i])
print(lcm)

Submission status: Runtime Error

Solution code:
import math

def lcm(a,b):
    mul = a*b
    gc = math.gcd(a,b)
    lc = int(mul/gc)
    return lc

n = int(input())
if n == 1:
    print(int(input()))
    exit()
t = [0]*n
for i in range(n):
    t[i] = int(input())
a = t[0]
for j in range(n-1):
    b = t[j+1]
    lc = lcm(a,b)
    a = lc

print(lc)

Submission status: Runtime Error

Solution code:
import math

def lcm(x):
    mul = x[0] * x[1]
    gc = math.gcd(x[0],x[1])
    lc =int( mul/gc)
    if len(x) > 2:
        for i in range(2,len(x)):
            
            mul = lc * x[i]
            gc = math.gcd(lc,x[i])
            lc = int(mul/gc)




    return int(lc)

n = int(input())
if n == 1:
    print(int(input()))
    exit()
t = [0]*n

for j in range(n):
    
    t[j] = int(input())

print(lcm(t))

Submission status: Runtime Error

Solution code:
import math

def lcm(x):
    mul = x[0] * x[1]
    gc = math.gcd(x[0],x[1])
    lc =int( mul/gc)
    for i in range(2,len(x)):
        
        mul = lc * x[i]
        gc = math.gcd(lc,x[i])
        lc = int(mul/gc)

    return int(lc)

n = int(input())
t = [0]*n

for j in range(n):
    
    t[j] = int(input())

print(lcm(t))

Submission status: Runtime Error

Solution code:
import math

def lcm(x):
    for i in range(len(x)-1):
        mul = x[i] * x[i+1]
        gc = math.gcd(x[i],x[i+1])

        lc = mul / gc
    return int(lc)

n = int(input())
t = [0]*n

for j in range(n):
    
    t[j] = int(input())

print(lcm(t))

Submission status: Runtime Error

Solution code:
import math
def lcm(l):
    r=l.pop(0)
    for i in l:
        r=r*i//math.gcd(r,i)
    return r*i//math.gcd(r,i)

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

Submission status: Runtime Error

Solution code:
import math
import sys

sys.setrecursionlimit(10**6)

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

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

LCM=lcm(t[0],t[1])
for i in range(2,n):
    LCM=lcm(LCM,t[i])

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=[int(input()) for i in range(n)]

LCM=lcm(t[0],t[1])
for i in range(2,n):
    LCM=lcm(LCM,t[i])

print(LCM)

Submission status: Runtime Error

Solution code:
import math
n = int(input())
t1 = int(input())
for _ in range(n-1):
    t2 = int(input())
    ans = t1*t2 // math.gcd(t1, t2)
    t1 = ans
print(ans)

Submission status: Runtime Error

Solution code:
import math
n = int(input())
t1 = int(input())
for _ in range(n-1):
    t2 = int(input())
    ans = t1*t2 // math.gcd(t1, t2)
print(ans)

Submission status: Runtime Error

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

N=int(input())
T=[]
for i in range(N):
  t = int(input())
  T.append(t)
  if i == 0:continue
  elif i == 1:
    lcm = T[-2]*T[-1]//gcd(T[-2],T[-1])
  else:
    lcm = lcm * T[-1]//gcd(lcm,T[-1])

print(lcm)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
  if b == 0:return 1
  return gcd(b,a%b)

N=int(input())
T=[]
for i in range(N):
  t = int(input())
  T.append(t)
  if i == 0:continue
  elif i == 1:
    lcm = T[-2]*T[-1]//gcd(T[-2],T[-1])
  else:
    lcm = lcm * T[-1]//gcd(lcm,T[-1])

print(lcm)

Submission status: Runtime Error

Solution code:
s = input()
n = int(s)

# 最大公約数を求める関数gcd
def gcd(a, b):
    if b == 0:
        return a
    return int(gcd(b, a % b))

def lcm(a, b):
    g = gcd(a, b)
    return int(a / g * b)
    
answer = 1
for i in range(n):
   v = input()
   w = int(v)
   answer = int(lcm(answer,w))

print(answer)

Submission status: Runtime Error

Solution code:
s = input()
n = int(s)

# 最大公約数を求める関数gcd
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    g = gcd(a, b)
    return a / g * b
    
answer = 1
for i in range(n):
   v = input()
   w = int(v)
   answer = int(lcm(answer,w))

print(answer)

Submission status: Runtime Error

Solution code:
s = input()
n = int(s)

arrays = []
for i in range(n):
    v = input()
    w = int(v)
    arrays.append(w)

# 最大公約数を求める関数gcd
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

q = arrays[0]
for i in range(len(arrays) - 1):
    p = gcd(q, arrays[i + 1])
    q = int((q * arrays[i + 1]) / p)

print(q)

Submission status: Runtime Error

Solution code:
import math

n=int(input())
ans=int(input())

if n>1:
  
  for x in range(n-1):
    s=int(input())
    ans=int(ans*s/(math.gcd(ans,s)))
    
  
print(ans)

Submission status: Runtime Error

Solution code:
from functools import reduce
from math import gcd
n=int(input())
t=[int(input()) for i in range(n)]
lcm=t[0]*t[1]//gcd(t[0],t[1])
for i in range(2,n):
  lcm=lcm*t[i]//gcd(lcm,t[i])
print(lcm)

Submission status: Runtime Error

Solution code:
from functools import reduce
from math import gcd
n=int(input())
t=[int(input()) for i in range(n)]
x=reduce(gcd,t)
lcm=t[0]*t[1]//x
for i in range(2,n):
  lcm=lcm*t[i]//gcd(lcm,t[i])
print(lcm)

Submission status: Runtime Error

Solution code:
#import
#import math
#import numpy as np
N = int(input())
#= input()
#= map(int, input().split())
#= list(map(int, input().split()))
#= [input(), input()]
#= [list(map(int, input().split())) for _ in range(N)]
#= {i:[] for i in range(N)}
T = [int(input()) for _ in range(N)]


def gcd(x, y):
    if x < y:
        t = x
        x = y
        y = t

    if y == 0:
        return x

    else:
        return gcd(y, x % y)


if N == 1:
    print(T[0])

res = T[0] * T[1] // gcd(T[0], T[1])

if N > 2:
    for i in range(2, N):
        r = res * T[i] // gcd(res, T[i])
        res = max(r, res)

print(res)

Submission status: Runtime Error

Solution code:
#import
#import math
#import numpy as np
N = int(input())
#= input()
#= map(int, input().split())
#= list(map(int, input().split()))
#= [input(), input()]
#= [list(map(int, input().split())) for _ in range(N)]
#= {i:[] for i in range(N)}
T = [int(input()) for _ in range(N)]


def gcd(x, y):
    if x < y:
        t = x
        x = y
        y = t

    if y == 0:
        return x

    else:
        return gcd(y, x % y)


res = T[0] * T[1] // gcd(T[0], T[1])

for i in range(2, N):
    r = res * T[i] // gcd(res, T[i])
    res = max(r, res)

print(res)

Submission status: Runtime Error

Solution code:

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

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

def f(tmp):
    tmp.sort(reverse=True)
    result=[]
    for i in tmp[1:]:
        if tmp[0]%i == 0:
            tmp.remove(i)
    for i in range(1,len(tmp)):
        result.append(lcm(tmp[0],tmp[i]))
    else:
        if result:
            return result
        else:
            return tmp
if __name__ == "__main__":
    n=int(input())
    t=[]
    for _ in range(n):
        t.append(int(input()))
    t.sort(reverse=True)
    tmp=[]
    for i in range(1,n):
        tmp.append(lcm(t[0],t[i]))
    while len(tmp) > 1:
        tmp=f(tmp)
    if tmp[0] >1000000000000000000:
        print(1000000000000000000)
    else:
        print(tmp[0])

Submission status: Runtime Error

Solution code:

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

if N==1:
    f2 = T[0]

elif N==2:
    import math
    a,b = T[0], T[1]
    f=math.gcd(a,b)
    f2=a*b//f

else:
    for i in range(2,N):
        a,b=f2, T[i]
        f=math.gcd(a,b)
        f2=a*b//f

print(f2)

Submission status: Runtime Error

Solution code:

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

import fractions
a,b = T[0], T[1]
f=fractions.gcd(a,b)
f2=a*b//f

if N>=3:
    for i in range(2,N):
        a,b=f2, T[i]
        f=fractions.gcd(a,b)
        f2=a*b//f

print(f2)

Submission status: Runtime Error

Solution code:

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

import fractions
a,b = T[0], T[1]
f=fractions.gcd(a,b)
f2=a*b//f

for i in range(2,N):
    a,b=f2, T[i]
    f=fractions.gcd(a,b)
    f2=a*b//f

print(f2)

Submission status: Runtime Error

Solution code:
import math


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


N = int(input())
t_li = []
for _ in range(N):
    t_li.append(int(input()))
ans = lcm(t_li[0], t_li[1])
for i in range(2, N):
    ans = lcm(ans, t_li[i])
print(ans)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
T = []

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

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

    

if len(T) > 2:
    g = lcm(T[0],T[1])
    for i in range(3,N-1):
        g = lcm(g,T[i+1])
    print(g)
elif len(T) == 2:
    print(g)
else:
    print(T[0])

Submission status: Runtime Error

Solution code:
import math
N = int(input())
T = []

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

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

    
g = lcm(T[0],T[1])
if len(T) > 2:
    for i in range(3,N-1):
        g = lcm(g,T[i+1])
    print(g)
else:
    print(g)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
def lcm(x, y):
    ans = (x * y)//math.gcd(x, y)
    return ans
g = lcm(T[0],T[1])
if len(T) > 2:
    for i in range(3,N-1):
        g = lcm(g,T[i+1])
    print(g)
else:
    print(g)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
def lcm(x, y):
    ans = (x * y)//math.gcd(x, y)
    return ans
g = lcm(T[0],T[1])
if len(T) > 2:
    for i in range(N-1):
        g = lcm(g,T[i+1])
print(g)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
g = lcm(T[0],T[1])
if len(T) > 2:
    for i in range(N-1):
        g = lcm(g,T[i+1])
print(g)

Submission status: Runtime Error

Solution code:
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
g = lcm(T[0],T[1])
if len(T) > 2:
    for i in range(N-1):
        g = lcm(g,T[i+1])
print(g)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    if(a == 0):
        return b
    return gcd(b % a, a)
def lcm(a, b):
    return (a / gcd(a, b)) * b 
t = int(input())
ans = 1
while(t != 0):
    t -= 1
    n = int(input())
    ans = lcm(ans, n)
print(int(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 a * b / gcd(a, b)

n = int(input())
s = 1
for i in range(n):
    x = int(input())
    s = lcm(s, x)
print(int(s))

Submission status: Runtime Error

Solution code:
def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
n = (input())
res = (input())
while n > 1:
	x = (input())
	res = (res * x) // gcd(res, x);
	n -= 1
print(res)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
n = (input())
res = (input())
while n > 1:
	x = (input())
	res = (res * x) / gcd(res, x);
	n -= 1
print(res)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
n = int(input())
res = int(input())
while n > 1:
	x = int(input())
	res = (res * x) / gcd(res, x);
	n -= 1
print(res)

Submission status: Runtime Error

Solution code:
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


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)


N = int(input())

LCM = 1
for i in range(N):
    tmp = int(input())
    LCM = lcm(LCM,tmp)

print(LCM)

Submission status: Runtime Error

Solution code:
import math
n=int(input())
t=[int(input()) for _ in range(n)]
#print(t)
for i in range(n-1):
    if i==0:
        lcm=(t[i]*t[i+1])//math.gcd(t[i],t[i+1])
    else:
        lcm=(lcm*t[i+1])//math.gcd(lcm,t[i+1])
print(lcm)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**9) 
input = sys.stdin.readline
def gdc(a, b):
    if b == 0:
        return a
    return gdc(b, a%b)
def lcm(a,b):
    return a*b//gdc(a,b)

def main():
    N = int(input())
    T = [int(input()) for i in range(N)]
    ans = lcm(max(T[0], T[1]), min(T[0], T[1]))
    if N == 2:
        print(ans)
        return
    for i in range(2,N):
        ans = lcm(max(ans, T[i]), min(ans, T[i]))
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
def gdc(a, b):
    if b == 0:
        return a
    return gdc(b, a%b)
def lcm(a,b):
    return a*b//gdc(a,b)

def main():
    N = int(input())
    T = [int(input()) for i in range(N)]
    ans = lcm(max(T[0], T[1]), min(T[0], T[1]))
    if N == 2:
        print(ans)
        return
    for i in range(2,N):
        ans = lcm(max(ans, T[i]), min(ans, T[i]))
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import decimal
import math
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
t = IR(n)
t.sort()
ans = t[0]


for i in t[1:]:
    gcd = math.gcd(ans, i)
    ans = int((decimal.Decimal(ans) * decimal.Decimal(i)) //
              decimal.Decimal(gcd))
print(ans)

Submission status: Runtime Error

Solution code:
import decimal
import math
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
t = IR(n)

ans = t[0]

for i in t[1:]:
    gcd = math.gcd(ans, i)
    ans = int(decimal.Decimal((decimal.Decimal(ans) *
                               decimal.Decimal(i))) // decimal.Decimal(gcd))
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a = [int(input()) for i in range(n)]

def minkou(a1,a2):
  mod = a1 % a2
  if mod == 0:
    return a2
  else:
    return(minkou(a2,mod))

a1 = a[0]
if len(a) == 1:
  print(a[0])
  exit()
else:
  for i in a[1:]:
    maxkou = a1*i / minkou(a1,i)
    a1 = maxkou
print(int(maxkou))

Submission status: Runtime Error

Solution code:
n = int(input())
a = [int(input()) for i in range(n)]

def minkou(a1,a2):
  mod = a1 % a2
  if mod == 0:
    return a2
  else:
    return(minkou(a2,mod))

a1 = a[0]
for i in a[1:]:
  maxkou = a1*i / minkou(a1,i)
  a1 = maxkou
print(int(maxkou))

Submission status: Runtime Error

Solution code:
import fractions

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


def koubaisu(a,b):
    return a*b//fractions.gcd(a,b)
ans=koubaisu(S[0],S[1])

if N>2:
    for i in range(N-2):
        ans=koubaisu(ans,S[i+2])
else:
    pass
print(ans)

Submission status: Runtime Error

Solution code:
def main():
    import math
    n = int(input())
    inlis = []
    for _ in range(n):
        a = int(input())
        inlis.append(a)

    ans = inlis[0]
    for i in range(1, n):
        ans = ans * inlis[i] // math.gcd(ans, inlis[i])

    print(ans)

    



    
    
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
from fractions import gcd

n = int(input())
t = [int(input()) for _ in range(n)]
cm = []
t.sort()

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

for i in range(n-1):
    cm.append(lcm(t[i], t[i+1]))

print(max(cm))

Submission status: Runtime Error

Solution code:
import math
n = int(input())
t = [int(input()) for _ in range(n)]
cm = []
t.sort()

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

for i in range(n-1):
    cm.append(lcm(t[i], t[i+1]))

print(max(cm))

Submission status: Runtime Error

Solution code:
def lcm(a, b): #lcm(int, int)
    if a<b:
        a,b = b,a
    x = a*b
    r = a%b
    while r != 0:
        a = b
        b = r
        r = a % b
    return x//b
n = int(input())
t = [0]*n
for i in range(n):
    t[i] = int(input())
ans = lcm(t[0],t[1])
for i in range(2,n):
    ans = lcm(ans,t[i])
print(ans)

Submission status: Runtime Error

Solution code:
import sys

def I(): return int(sys.stdin.readline().rstrip())

N = I()
T = [I() for _ in range(N)]

from math import gcd

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

print(ans)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

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

n = int(input())
base = [0]*n
for i in range(n):
  base[i] = int(input())
base = list(set(base))
print(lcm_list(base))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

import fractions
from functools import reduce

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(T))

Submission status: Runtime Error

Solution code:
import math

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

gcdd = 1

for i in range(N):
    num = times[i]
    gcdd = gcdd * num // (math.gcd(gcdd, num))


print(gcdd)

Submission status: Runtime Error

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

ans = lst[0]
for i in range(1, N):
    ans = ans * lst[i] // math.gcd(ans, lst[i])
print(ans)

Submission status: Runtime Error

Solution code:
from math import gcd
from functools import reduce


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


N = int(input())
T = list(int(input()) for _ in range(N))

print(reduce(lcm, T))

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
T = [int(input()) for i in range(n)]

T_list = np.array(T)
print(np.lcm.reduce(T_list))

Submission status: Runtime Error

Solution code:
n = int(input())
t = [int(input()) for _ in range(n)]

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

#2数の積/最大公約数=最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)

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

Submission status: Runtime Error

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

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

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

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

print(lcm_list(T))

Submission status: Runtime Error

Solution code:
import math
n = int(input())
T = []
ans = 1
for i in range(n):
    t = int(input())
    T.append(t)
    ans = ans * t // math.gcd(ans, t)
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
t = [int(input()) for _ in range(n)]

import math
n = t[0]
for a,b in zip(t, t[1:]):
    g = math.gcd(n, b)
    n = a*b//g
print(n)

Submission status: Runtime Error

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
import fractions
from functools import reduce

rr = lambda: sys.stdin.buffer.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

n = ri()
li = rl()
ans = 1
for i in range(n):
  lii = li[i]
  a = fractions.gcd(lii, ans)
  ans = ans * lii // a
print(ans)

Submission status: Runtime Error

Solution code:
n =int(input())
import fraction
ans = 1
for _ in range(n):
    t = int(input())
    ans = ans * t // fraction.gcd(ans, t)
print(ans)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
T = list(int(input()) for _ in range(N))
ans = T[0]
for i in range(1, N):
    ans = ans * T[i] // math.gcd(ans, T[i])
print(ans)

Submission status: Runtime Error

Solution code:
n =int(input())
import math
ans = 1
for _ in range(n):
    t = int(input())
    ans = ans * t // math.gcd(ans, t)
print(ans)

Submission status: Runtime Error

Solution code:
n =int(input())
import math
ans = 1
for _ in range(n):
    t = int(input())
    ans = ans * t // math.gcd(ans, t)
print(ans)

Submission status: Runtime Error

Solution code:
from collections import gcd
N=int(input())
def lcm(a,b):
    return a//gcd(a,b)*b
T=[]
for i in range(N):
    t=int(input())
    T.append(t)
a=1
for i in range(N):
    a=lcm(a,T[i])

print(a)

Submission status: Runtime Error

Solution code:
from math import gcd
N=int(input())
def lcm(a,b):
    return a//gcd(a,b)*b
T=[]
for i in range(N):
    t=int(input())
    T.append(t)
a=1
for i in range(N):
    a=lcm(a,T[i])

print(a)

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
t = list(int(input()) for _ in range(n))

print(np.lcm.reduce(t))

Submission status: Runtime Error

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    S=[]
    for i in range(n):
        S.append(int(input()))
    from functools import reduce
    from math import gcd

    def lcm(A, B):
        return A * B // gcd(A, B)


    print(reduce(lcm, S))
resolve()

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Fri May 29 21:29:28 2020

@author: naoki
"""
import math

N = int(input()) # 時計の個数
T = [int(input()) for i in range(N)] # 時計の針が一周する時間
T.sort() # 小さい順番にソートする
lcm = T[0] 

for i in range(1,N):
    lcm = lcm*T[i]// math.gcd(lcm,T[i])
print(lcm)

Submission status: Runtime Error

Solution code:
from math import gcd
from math import reduce
from fractions import gcd
from functools import reduce
def Gcd(list):
    gcd = 1
    G = reduce(gcd, list)
    return G

A = [2,6,8]
print(Gcd(A))

Submission status: Runtime Error

Solution code:
n = int(input().rstrip())
seconds = [int(input().rstrip()) for _ in range(n)]
seconds = set(seconds)

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)
def lcm(a,b):
    g = gcd(a,b)
    if a > b:
        return int(a/g*b)
    else:
        return int(a*b/g)
ans = 1
for num in seconds:
    ans = lcm(ans,num)
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
import functools
from functools import reduce

def gcd(numbers):
    return reduce(functools.gcd, numbers)

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

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


num = []
for i in range(n):
    num.append(int(input()))
print(lcm(num))

Submission status: Runtime Error

Solution code:
n = int(input())
import math
from functools import reduce

def gcd(numbers):
    return reduce(math.gcd, numbers)

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

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


num = []
for i in range(n):
    num.append(int(input()))
print(lcm(num))

Submission status: Runtime Error

Solution code:
import math
N = int(input())
T = [int(input()) for _ in range(N)]
ans = T[0]
for i in range(1, N):
    ans = (ans * T[i]) // math.gcd(ans, T[i])

print(ans)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
T = [int(input()) for _ in range(N)]
ans = T[0]
for i in range(1, N):
    ans = ans * T[i] // math.gcd(ans, T[i])

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [int(input()) for _ in range(N)]
def gcd(a,b):
    if b:
        return gcd(b,a%b)
    else:
        return a

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

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

print(l)

Submission status: Runtime Error

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

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

n = int(input())

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

Submission status: Runtime Error

Solution code:
from fractions import gcd
# def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

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

Submission status: Runtime Error

Solution code:
from fractions import gcd
# def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

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

Submission status: Runtime Error

Solution code:
from fractions import gcd
# def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

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

Submission status: Runtime Error

Solution code:
from fractions import gcd
# def lcm(a,b): return a*b//gcd(a,b)

def _lcm(a, b):
    _gcd = gcd(a, b)
    return int((a * b) / _gcd)

n = int(input())

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

Submission status: Runtime Error

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

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

n = int(input())

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

Submission status: Runtime Error

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

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

n = int(input())

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

Submission status: Runtime Error

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

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

n = int(input())

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

Submission status: Runtime Error

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

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

n = int(input())

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

Submission status: Runtime Error

Solution code:
from fractions import gcd

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

n = int(input())

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

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    md = a % b
    if md == 0:
        return b
    return gcd(b, md)

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

n = int(input())

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

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    md = a % b
    if md == 0:
        return b
    return gcd(b, md)

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

n = int(input())

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

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    md = a % b
    if md == 0:
        return b
    return gcd(b, md)

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

def lcm_mlt(a, num_list):
    if len(num_list) == 0:
        return a
    n = num_list.pop()
    a = max(a, n)
    b = min(a, n)
    return lcm_mlt(lcm(a, b), num_list)

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

print(lcm_mlt(1, nl))

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    md = a % b
    if md == 0:
        return b
    return gcd(b, md)

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

def lcm_mlt(a, num_list):
    if len(num_list) == 0:
        return a
    n = num_list.pop()
    a = max(a, n)
    b = min(a, n)
    return lcm_mlt(lcm(a, b), num_list)

n = int(input())
nl = list(set([int(input()) for _ in range(n)]))

print(lcm_mlt(1, nl))

Submission status: Runtime Error

Solution code:
import math

N=int(input())
T=[int(input()) for _ in range(N)]
ans=1
for i in range(N):
    ans=ans*T[i]//(math.gcd(ans,T[i]))
print(ans)

Submission status: Runtime Error

Solution code:
import math

N=int(input())
T=[int(input()) for _ in range(N)]
ans=T[0]
for i in range(N):
    ans=ans*T[i]//(math.gcd(ans,T[i]))
print(ans)

Submission status: Runtime Error

Solution code:
import sys
import fractions


def input():
    return sys.stdin.readline()[:-1]


N = int(input())
ans = 0
for _ in range(N):
    if ans == 0:
        ans = int(input())
    else:
        t = int(input())
        ans = (ans * t) // math.gcd(ans, t)
print(ans)