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
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a


#最小公倍数
def lcm(a,b):
  return a * b//gcd(a,b) a


if __name__ == "__main__":
    n = int(input())
    lst = []
    for i in range(n):
        lst.append(int(input()))
    print(reduce(lcm,lst))

Submission status: Runtime Error

Solution code:
N = int(input())
T=[int(input()) for _ in range(N)]
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
def lcm(a, b):
    return a * b // gcd(a, b)
ans = lcm(T[0], T[1])
for i in range(2,N-1):
    ans = lcm(ans, T[i])
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):
    g=gcd(a,b)
    return a/g*b

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

Submission status: Runtime Error

Solution code:
"""import sys
input = sys.stdin.readline().strip"""
n=int(input())
T=[int(input()) for _ in range(n)]
if n==1:
    print(T[0])
from fractions import gcd
ans=T[0]*T[1]//gcd(T[0],T[1])
for t in T:
    ans=ans*t//gcd(ans,t)
print(ans)

Submission status: Runtime Error

Solution code:
"""import sys
input = sys.stdin.readline().strip"""
n=int(input())
T=[int(input()) for _ in range(n)]
from fractions import gcd
ans=T[0]*T[1]//gcd(T[0],T[1])
for t in T:
    ans=ans*t//gcd(ans,t)
print(ans)

Submission status: Runtime Error

Solution code:


import numpy as np
import fractions as fra

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

Submission status: Runtime Error

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

for _ in range(N):
	T.append(int(input()))
	
def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

ans = 1
	
for i in range(N):
	ret = ret * T[i] // gcd(ret, T[i])
	
print(ans)

Submission status: Runtime Error

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

for _ in range(N):
	T.append(int(input()))
	
def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

ans = 1
	
for i in range(N):
	ret = ret * T[i] // gcd(ret, T[i]])
	
print(ans)

Submission status: Runtime Error

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

for _ in range(N):
	T.append(int(input()))
	
def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

ans = 1
	
while T:
	cur = T.pop(0)
	ans = (ans * cur) / gcd(ans, cur)
	
print(int(ans))

Submission status: Runtime Error

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def lcm(a, b):
    gcd = fractions.gcd
    n_gcd = gcd(a, b)
    return a * b // n_gcd

def main():
    N = I()
    T = []
    for _ in range(N):
        T.append(I())
    n_lcm = lcm(T[0], T[1])
    for i in range(2, N):
        n_lcm = lcm(n_lcm, T[i])
    print(n_lcm)
main()

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

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

def lcm_ls(num):
    return reduce(lcm, num, 1)

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

print(lcm_ls(ls))

Submission status: Runtime Error

Solution code:
from fractions import gcd
import sys
input = sys.stdin.readline

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

Submission status: Runtime Error

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

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

if n == 1:
    ans = t[0]
else:
    lcd = t[0]*t[1]/gcd(t[0],t[1])
    for i in range(2,n):
        lcd = lcd*t[i]/gcd(lcd,t[i])
    ans = lcd
    
print(ans)

Submission status: Runtime Error

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

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

lcd = t[0]*t[1]/gcd(t[0],t[1])
for i in range(2,n):
    lcd = lcd*t[i]/gcd(lcd,t[i])

print(lcd)

Submission status: Runtime Error

Solution code:
import fractions
from functools import reduce


def lcm_list(numbers):
    return reduce(fractions.lcm, numbers)

N = int(input())

t = []
for _ in range(N):
  t.append(int(input()))

print(lcm_list(t))

Submission status: Runtime Error

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

from fractions import gcd
lcm=1
for i in range(n):
    lcm=int((lcm*t[i])/gcd(lcm,t[i]))
print(lcm)

Submission status: Runtime Error

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

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

def lcm_base(x, y):
    x_y = x * y
    gcd_xy = gcd(x, y)
    ans = int(x_y / gcd_xy)
    return ans

for i in range(1, N):
    T[i] = lcm_base(T[i-1], T[i])

print(T[N - 1])

Submission status: Runtime Error

Solution code:
# https://atcoder.jp/contests/abc070/tasks/abc070_c

import math

# 最小公倍数を求める問題
# 参考：https://note.nkmk.me/python-gcd-lcm/
# 上記リンク先に最大公約数も載ってた

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


def lcm_base(x, y):
    x_y = x * y
    gcd_xy = math.gcd(x, y)
    ans = int(x_y / gcd_xy)
    return ans

for i in range(1, N):
    T[i] = lcm_base(T[i-1], T[i])

print(T[N - 1])

Submission status: Runtime Error

Solution code:
# https://atcoder.jp/contests/abc070/tasks/abc070_c

from functools import reduce
import math
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

# 最小公倍数を求める問題
# 参考：https://note.nkmk.me/python-gcd-lcm/
# 上記リンク先に最大公約数も載ってた

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


def lcm_base(x, y):
    x_y = x * y
    gcd_xy = math.gcd(x, y)
    ans = int(x_y / gcd_xy)
    return ans

'''
def lcm_list(list):
    ans = reduce(lcm_base, list, 1)
    return ans
lcm = lcm_list(T)
'''


for i in range(1, N):
    T[i] = lcm_base(T[i-1], T[i])

print(T[N - 1])

Submission status: Runtime Error

Solution code:
# https://atcoder.jp/contests/abc070/tasks/abc070_c

from functools import reduce
import math
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

# 最小公倍数を求める問題
# 参考：https://note.nkmk.me/python-gcd-lcm/
# 上記リンク先に最大公約数も載ってた

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

def lcm_base(x, y):
    x_y = x * y
    gcd_xy = math.gcd(x, y)
    ans = int(x_y / gcd_xy)
    return ans

def lcm_list(list):
    ans = reduce(lcm_base, list, 1)
    return ans

lcm = lcm_list(T)

print(lcm)

Submission status: Runtime Error

Solution code:
# https://atcoder.jp/contests/abc070/tasks/abc070_c

from functools import reduce
import math
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

# 最小公倍数を求める問題
# 参考：https://note.nkmk.me/python-gcd-lcm/
# 上記リンク先に最大公約数も載ってた

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

def lcm_base(x, y):
    x_y = x * y
    gcd_xy = math.gcd(x, y)
    ans = int(x_y / gcd_xy)
    return ans

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

lcm = lcm_list(T)

print(lcm)

Submission status: Runtime Error

Solution code:
# https://atcoder.jp/contests/abc070/tasks/abc070_c

from functools import reduce
import math
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

# 最小公倍数を求める問題
# 参考：https://note.nkmk.me/python-gcd-lcm/
# 上記リンク先に最大公約数も載ってた

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

def lcm_base(x, y):
    x_y = x * y
    gcd_xy = math.gcd(x, y)
    ans = x_y // gcd_xy
    return ans

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

lcm = lcm_list(T)

print(lcm)

Submission status: Runtime Error

Solution code:
# https://atcoder.jp/contests/abc070/tasks/abc070_c

from functools import reduce
import math
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

# 最小公倍数を求める問題
# 参考：https://note.nkmk.me/python-gcd-lcm/
# 上記リンク先に最大公約数も載ってた

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

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

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

lcm = lcm_list(T)

print(lcm)

Submission status: Runtime Error

Solution code:
# https://atcoder.jp/contests/abc070/tasks/abc070_c

from functools import reduce
import math
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

# 最小公倍数を求める問題
# 参考：https://note.nkmk.me/python-gcd-lcm/
# 上記リンク先に最大公約数も載ってた

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

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

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

lcm = lcm_list(T)

print(lcm)

Submission status: Runtime Error

Solution code:
from functools import reduce
import math


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

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

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

lcm = lcm_list(T)

print(lcm)

Submission status: Runtime Error

Solution code:
# https://atcoder.jp/contests/abc070/tasks/abc070_c

from functools import reduce
import math

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

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

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

lcm = lcm_list(T)

print(lcm)

Submission status: Runtime Error

Solution code:
# https://atcoder.jp/contests/abc070/tasks/abc070_c

from functools import reduce
import math

# 最小公倍数を求める問題だ！！
# 参考：
# https://note.nkmk.me/python-gcd-lcm/
# 上記リンク先に最大公約数も載ってた

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

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

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

lcm = lcm_list(T)

print(lcm)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
n = int(input())
ans = 1
for _ in range(n):
    x = int(input())
    ans *=  x//math.gcd(ans,x)
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 a*b//gcd(a,b)

N = int(input())

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

Submission status: Runtime Error

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

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

def main():
  n=I()
  
  ans=I()
  for i in range(n-1):
    t=I()
    ans=int(lcm(ans,t))

  return ans

# main()
print(main())

Submission status: Runtime Error

Solution code:
import numpy as np
n=int(input())
a=np.ndarray([int(input()) for i in range(n)])
print(np.lcm.reduce(a))

Submission status: Runtime Error

Solution code:
import math

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

n = int(input())
g = 1
for _ in range(n):
	t = int(input())
	g = lcm(t, g)
print(g)

Submission status: Runtime Error

Solution code:
a, b, c, d = map(int, input().split())
if (b <= c or d <= a): print(0)
if (b < d or c < a): print(max(abs(a - d) - abs(a - c) - abs(b - d), abs(b - c) - abs(a - c) - abs(b - d)))
if((a - d) * (b - c) < 0): print(max(abs(a - b) - abs(a - c) - abs(b - d), abs(c - d) - abs(a - c) - abs(b - d)))

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

print(lcm_list(t))

Submission status: Runtime Error

Solution code:
a, b, c, d = map(int, input().split())
if b <= c or d <= a:
    print(0)
    exit()
elif c <= d or a <= b:
    print(0)
    exit()
elif a <= c and d <= b:
    print(d-c)
    exit()
elif c <= a and b <= d:
    print(b-a)
    exit()
elif a <= c and c <= d:
    print(b-c)
    exit()
elif c <= a and b <= d:
    print(d-a)
    exit()

Submission status: Runtime Error

Solution code:
n=int(input())
T=[int(input()) for i in range(n)]
def gcd(a,b):
    if b==0:
        return(a)
    else:
        return(gcd(b,a%b))
def lgm(a,b):
    return(a*b//(gcd(a,b)))
if n==1:
    print(T[0])
else:
    ans=T[0]
    for i in range(1,n):
        ans=lgm(ans,T[i])
print(ans)

Submission status: Runtime Error

Solution code:
import fractions as f
n=int(input())
ans=int(input())
for i in range(n-1):
   ans=f.lcm(ans,int(input()))
print(ans)

Submission status: Runtime Error

Solution code:
import fractions as f
n=int(input())
ans=int(input())
for i in range(n):
   ans=f.lcm(ans,int(input()))
print(ans)

Submission status: Runtime Error

Solution code:
import sys
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))
n=int(input())
a=[]
if n==1:
    print(int(input()))
    sys.exit()
for i in range(n):
    a.append(int(input()))
b=lcm(a[0],a[1])
for i in range(n-2):
    b=lcm(b,a[i+2])
print(b)

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()))
t.sort()
if(n==1):
    print(t[0])
    exit()
ans=lcm(t[0],t[1])
if(n==2):
    print(ans)
    exit()
for i in range(2,n):
    ans=lcm(ans,t[i])
print(ans)

Submission status: Runtime Error

Solution code:

def gcd(x,y):
  if x>y: x,y = y,x
  while x:
    x,y = y%x, x
  return y

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

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))
t.sort()
if(n==1):
    print(t[0])
    exit()
ans=lcm(t[0],t[1])
if(n==2):
    print(ans)
    exit()
for i in range(2,n):
    ans=lcm(ans,t[i])
print(ans)

Submission status: Runtime Error

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

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))
t.sort()
if(n==1):
    print(t[0])
    exit()
ans=lcm(t[0],t[1])
if(n==2):
    print(ans)
    exit()
for i in range(2,n):
    ans=lcm(ans,t[i])
print(ans)

Submission status: Runtime Error

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

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))
t.sort()
ans=lcm(t[0],t[1])
for i in range(2,n-1):
    ans=lcm(ans,t[i])
print(ans)

Submission status: Runtime Error

Solution code:
import math
import numpy as np


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


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

ans = T[0]
for t in T[1:]:
    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 = [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:
import math
from functools import reduce


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


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:
n = int(input())
t = []
for _ in range(n):
    T = int(input())
    t.append(T)
    
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(*t))

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
def lcm(x, y):
    return (x * y) // gcd(x, y)

N = int(input())
T = [int(input()) for _ in range(N)]
if N == 1:
    print(T)

ans = lcm(T[0] , T[1])
for i in range(2 , N):
    ans = lcm(T[i] , ans)
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 = [int(input()) for _ in range(N)]
if N == 1:
    print(T)

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

Submission status: Runtime Error

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

def gcd(x, y):
	while y:
		x, y = y, x % y
	return x

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

ans = lcm(t[0],t[1])
if n>=3:
  for i in range(2,n):
    ans = lcm(ans,t[i])
    
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
data = [0]*N
for i in range(0,N): data[i] = int(input())

import math

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

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
data = [0]*N
for i in range(0,N): data[i] = int(input())

import math

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

print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
#n, k = map(int,input().split())
#plst = [int(i) for i in input().split()]

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

def a(p, q):
    if p % q == 0:
        return q
    else:
        return a(q, p % q)

f = lst[0] * (lst[1] // a(lst[0], lst[1]))
for i in range(2, n):
    f = f * (lst[i] // a(f, lst[i]))
print(f)

Submission status: Runtime Error

Solution code:
n = int(input())
#n, k = map(int,input().split())
#plst = [int(i) for i in input().split()]

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

def a(p, q):
    if p % q == 0:
        return q
    else:
        return a(q, p % q)


f = (lst[0] * lst[1]) // a(lst[0], lst[1])
for i in range(2, n):
    f = (f * lst[i]) // a(f, lst[i])
print(f)

Submission status: Runtime Error

Solution code:
import fractions
N = int(input())

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

Submission status: Runtime Error

Solution code:
import math

def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = x * a[i] // math.gcd(x, a[i])
    return x

n = int(input())
t = [int(input()) for _ in range(n)]
print(lcm(t))

Submission status: Runtime Error

Solution code:
def gmax(a,b):
  if a<b:
  	a,b=b,a
  while a%b!=0:
    tmp=a
    a=b
    b=tmp%b
  return b
 
n=int(input())
x=[]
for i in range(n):
  x.append(int(input()))
    
g=gmax(x[0],x[1])
l=x[0]*x[1]//g
 
for j in range(2,len(x)):
  g=gmax(x[j],l)
  l=x[j]*l//g
  
print(l)

Submission status: Runtime Error

Solution code:
def gmax(a,b):
  if a<b:
  	a,b=b,a
  while a%b!=0:
    tmp=a
    a=b
    b=tmp%b
  return b

n=int(input())
x=[]
for i in range(n):
  x.append(int(input()))
    
g=gmax(x[0],x[1])
l=x[0]*x[1]//g

for i in range(2,len(x)):
  g=gmax(x[i],l)
  l=x[i]*l//g

ans=l
print(ans)

Submission status: Runtime Error

Solution code:
def gmax(a,b):
  if a<b:
    a,b=b,a
  while a%b!=0:
    tmp=a
    a=b
    b=tmp%b
  return b

n=int(input())
x=[]
for i in range(n):
  x.append(int(input()))
    
g=gmax(x[0],x[1])
l=x[0]*x[1]//g

for i in range(2,len(x)):
  g=gmax(x[i],g)
  l=x[i]*l//g

ans=l
print(ans)

Submission status: Runtime Error

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# GCD -- START --
def gcd(x,y):
  while y:
    x,y=y,x%y
  return x
# GCD --- END ---

# LCM -- START --
def lcm(x,y):
  return x*y/gcd(x,y)
# LCM --- END ---

def main():
  n=I()
  l=[I() for _ in range(n)]
  l.sort()
  a=l[0]

  for x in l[1:]:
    b=[a,x]
    b.sort()

    if b[1]%b[0]==0:
      a=b[1]
    else:
      a=0

  return a

# main()
print(main())

Submission status: Runtime Error

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# GCD -- START --
def gcd(x,y):
  while y:
    x,y=y,x%y
  return x
# GCD --- END ---

# LCM -- START --
def lcm(x,y):
  return x*y/gcd(x,y)
# LCM --- END ---

def main():
  n=I()
  l=[I() for _ in range(n)]
  l.sort()
  a=l[0]

  for x in l[1:]:
    b=[a,x]
    b.sort()

    if b[1]%b[0]==0:
      a=b[1]
    else:
      a=int(lcm(b[0],b[1]))

  return a

# main()
print(main())

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

def main():
    n = int(input())  #nは入力回数
    t = [int(input()) for _ in range(n)]

    if not (1 <= n and n <= 100 and isinstance(n, int)):
        return
    for i in t:
        if not (1 <= i and i <= 10**18 and isinstance(i, int)):
            return

    k = lcm_list(t)
    if k <= 10**18:
        print(k)

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

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

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import fractions
from functools import reduce

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

def lcm_rec(num):
    return reduce(lcm, num, 1)

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

ans = lcm_rec(T)
print(ans)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

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

def lcm_rec(num):
    return reduce(lcm, num, 1)

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

ans = lcm_rec(T)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# ABC070c
from fractions import gcd
from functools import reduce
import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())


def lcm_base(a, b):
    return a * b // fractions.gcd(a, b)


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


t = [int(input()) for _ in range(n)]
print(lcm(*t))

Submission status: Runtime Error

Solution code:
# ABC070c
from functools import reduce
import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())


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


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


t = [int(input()) for _ in range(n)]
print(lcm(*t))

Submission status: Runtime Error

Solution code:
import math
import sys
from functools import reduce

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline


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)


def main():
    N = int(readline())
    T = list(map(int, read().split()))
    print(lcm(*T))


main()

Submission status: Runtime Error

Solution code:
import numpy as np
n=int(input())
s=[]
for i in range(n):
  a=int(input())
  s.append(a)
d=np.array(s)
print(np.lcm.reduce(d))

Submission status: Runtime Error

Solution code:
import fractions
N = int(input())
tokei = [int(input()) for _ in range(N)]
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
ans = lcm(tokei[0],tokei[1])
for i in range(2,N):
    ans = lcm(ans,tokei[i])
print(ans)

Submission status: Runtime Error

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

def lcm(n,A):
    gcdn = [0]*n
    lcmn = [0]*n

    gcdn[0]=A[0]
    lcmn[0]=A[0]
    for i in range(n-1):
        gcdn[i+1] = gcd(lcmn[i],A[i+1])
        M = lcmn[i]*A[i+1]
        lcmn[i+1] =int(M/gcdn[i+1])
    return lcmn[n-1]


def examC():
    N = I()
    T = [I() for _ in range(N)]
    ans = lcm(N,T)
    print(ans)

import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()

Submission status: Runtime Error

Solution code:
#Multiple Clocks
import math
N = int(input())
T = int(input())
for i in range (N-1):
    t = int(input())
    T = t*T // math.gcd(t,T)
print(T)

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)]
temp=T[0]
for i in range(1,N):
    temp=lcm(temp,T[i])

print(temp)

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
import numpy
N=int(input())
L = [int(input()) for i in range(N)]
print(numpy.lcm.reduce(L))

Submission status: Runtime Error

Solution code:
import sys
import math
if N == 1:
	print(T[0])
	sys.exit()
def GCD(a,b):
	if b == 0:
		return a
	return GCD(b,a%b)

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

def SKS(a,b):
	return (a*b)//GCD(a,b)

for i in range(1,N):
	if i == 1:
		temp = SKS(T[0], T[1])
		continue

	temp = SKS(temp, T[i])

print(temp)

Submission status: Runtime Error

Solution code:
import math

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

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

def SKS(a,b):
	return (a*b)//GCD(a,b)

for i in range(1,N):
	if i == 1:
		temp = SKS(T[0], T[1])
		continue

	temp = SKS(temp, T[i])

print(temp)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

n = int(input())

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#70c
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)

N = int(input())

T_set = set()

for _ in range(N):
    t = int(input())
    T_set.add(t)
    
T_list = list(T_set)
print(lcm_list(T_list))

Submission status: Runtime Error

Solution code:
import math

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

n = int(input())
t = [ int(input()) for _ in range(n)]
ans = 1
for i in range(n):
    ans = lcm(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):
    a, b = map(int, [min(a, b), max(a, b)])
    if b % a == 0:
        return a
    else:
        return gcd(a, b - a)


lcm = 1
for ti in t:
    lcm = ti // gcd(lcm, ti) * lcm
print(lcm)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    a, b = map(int, [min(a, b), max(a, b)])
    if b % a == 0:
        return a
    else:
        return gcd(a, b - a)


lcm = 1
for ti in t:
    lcm = ti // gcd(lcm, ti) * lcm
print(lcm)

Submission status: Runtime Error

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


def gcd(a, b):
    a, b = map(int, [min(a, b), max(a, b)])
    if b % a == 0:
        return a
    else:
        return gcd(a, b - a)


if n == 1:
    print(t[-1])
    exit()
lcm = 1
for ti in t:
    lcm = ti // gcd(lcm, ti) * lcm
print(lcm)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
n = int(input())
t = [int(input()) for _ in range(n)]
if n == 1:
    print(t[-1])
    exit()

for i in range(1, n):
    lcm = t[i-1]//math.gcd(t[i-1], t[i])*t[i]
    t[i] = lcm
print(t[-1])

Submission status: Runtime Error

Solution code:
import math
n = int(input())
t = [int(input()) for _ in range(n)]
if n == 1:
    print(t[-1])
    exit()

for i in range(1, n):
    lcm = t[i-1]*t[i]//math.gcd(t[i-1], t[i])
    t[i] = lcm
print(t[-1])

Submission status: Runtime Error

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

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