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 collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, gcd
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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


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

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


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N = int(input())
T = [0 for i in range(N)]
for i in range(N):
    T[i] = int(input())
T.sort()
def gcd(s, t):
    if t== 0:
        return s
    elif s > t:
        return gcd(t, s%t)
    else:
        return gcd(s, t % s)

def lcm(s, t):
    g = gcd(s, t)
    return((s/g) * t)

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

print(str(int(now)))

Submission status: Runtime Error

Solution code:
N = int(input())
T = [0 for i in range(N)]
for i in range(N):
    T[i] = int(input())
T.sort()
def gcd(s, t):
    if t== 0:
        return s
    elif s > t:
        return gcd(t, s%t)
    else:
        return gcd(s, t % s)

def lcm(s, t):
    g = gcd(s, t)
    return((s/g) * t)

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

print(str(int(now))

Submission status: Runtime Error

Solution code:
N = int(input())
le = [int(input()) for i in range(N)]
le.sort()#昇順
#３数以上の最小公倍数を求める問題
#a,b2数の最小公倍数とcの最小公倍数で求められる
#２数の最小公倍数はユークリッドの互除法を利用して再帰関数で求められる。

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)

def multi_LCM(le):
    if len(le)==1:
        return 
    mxle=le[-1]
    del(le[-1])
    le[-1]=LCM(le[-1],mxle)
    multi_LCM(le)

if(len(le)==2):
    le[0]=LCM(le[0],le[1])
if(len(le)>=2):
    multi_LCM(le)

print(le[0])

Submission status: Runtime Error

Solution code:
N = int(input())
le = [int(input()) for i in range(N)]
le.sort()#昇順
#３数以上の最小公倍数を求める問題
#a,b2数の最小公倍数とcの最小公倍数で求められる
#２数の最小公倍数はユークリッドの互除法を利用して再帰関数で求められる。

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

def multi_LCM(le):
    if len(le)==1:
        return 
    mxle=le[-1]
    del(le[-1])
    le[-1]=LCM(le[-1],mxle)
    multi_LCM(le)

if(len(le)==2):
    le[0]=LCM(le[0],le[1])
if(len(le)>=2):
    multi_LCM(le)

print(le[0])

Submission status: Runtime Error

Solution code:
N = int(input())
le = [int(input()) for i in range(N)]
le.sort()#昇順
#３数以上の最小公倍数を求める問題
#a,b2数の最小公倍数とcの最小公倍数で求められる
#２数の最小公倍数はユークリッドの互除法を利用して再帰関数で求められる。

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

def multi_LCM(le):
    if len(le)==1:
        return 
    mxle=le[-1]
    del(le[-1])
    le[-1]=LCM(le[-1],mxle)
    multi_LCM(le)
multi_LCM(le)
print(le[0])

Submission status: Runtime Error

Solution code:
from math import gcd
from functools import reduce


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


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


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

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

print(lcm(*T))

Submission status: Runtime Error

Solution code:
N = int(input())
T = [0 for i in range(N)]
for i in range(N):
    T[i] = int(input())
T.sort()
def gcd(s, t):
    if t== 0:
        return s
    else:
        return gcd(t, s%t)
def lcm(s, t):
    g = gcd(s, t)
    return((s/g) * t)

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

print(int(now))

Submission status: Runtime Error

Solution code:
N = int(input())

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

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

def LCM(a,b):
  return int(a*b/GCD(a,b))

prev = A[0]
for i in range(1,N):
  lcm = LCM(prev, A[i])
  prev = lcm

print(prev)

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

b = a[0]
for i in range(1, n):
    b = (b * a[i]) // math.gcd(b, a[i])
print(b)

Submission status: Runtime Error

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

def lcm(n, m):
    return int(n * m / gcd(n, m))


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

time = 0
for i in range(0, n):
    if i == 0:
        time = t_sorted[0]
    else:
        time = lcm(int(time), t_sorted[i])

print(int(time))

Submission status: Runtime Error

Solution code:
import fractions

def lcm(n, m):
    return int(n * m / fractions.gcd(n, m))


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

time = 0
for i in range(0, n):
    if i == 0:
        time = t_sorted[0]
    else:
        time = lcm(int(time), t_sorted[i])

print(int(time))

Submission status: Runtime Error

Solution code:
import math

def lcm(n, m):
    return int(n * m / math.gcd(n, m))


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

time = 0
for i in range(0, n):
    if i == 0:
        time = t_sorted[0]
    else:
        time = lcm(int(time), t_sorted[i])

print(int(time))

Submission status: Runtime Error

Solution code:
def gcd(n, m):
    if max(n,m) % min(n,m) == 0:
        return min(n,m)
    else:
        return gcd(max(n,m), max(n,m) - min(n,m) * (max(n,m)//min(n,m)))

def lcm(n, m):
    return n * m / gcd(n, m)


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

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

print(int(time))

Submission status: Runtime Error

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
  
initial_num = 1
for i in input_list:
    t = lcm(initial_num, i)
    if  t > initial_num:
        initial_num = t
        
print(initial_num)

Submission status: Runtime Error

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
  
initial_num = 1
for i in input_list:
    if lcm(initial_num, i) > initial_num:
        initial_num = lcm(initial_num, i)
        
print(initial_num)

Submission status: Runtime Error

Solution code:
import fraction

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

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

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

print(ans)

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 i in range(n)]

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

print(ans)

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 i in range(n)]

t += [1, 1]
a = t.pop()
while t:
	b = t.pop()
	a = lcm(a, b)
print(a)

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 i in range(n)]

t += [1]
a = t.pop()
while t:
	b = t.pop()
	a = lcm(a, b)
print(a)

Submission status: Runtime Error

Solution code:
import fractions
N = int(input())
T0 = 1
for i in range(N):
    T1 = int(input())
    T0 = int(T0*T1/fractions.gcd(T0,T1))
print(T0)

Submission status: Runtime Error

Solution code:
import fraction
N = int(input())
T0 = 1
for i in range(N):
    T1 = int(input())
    T0 = int(T0*T1/fraction.gcd(T0,T1))
print(T0)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
T0 = 1
for i in range(N):
    T1 = int(input())
    T0 = int(T0*T1/math.gcd(T0,T1))
print(T0)

Submission status: Runtime Error

Solution code:
from functools import reduce
from fraction import gcd
l=[int(input()) for _ in range(int(input()))]
o=reduce(lambda x,y:int(x*y/gcd(x,y)),l)
print(o)

Submission status: Runtime Error

Solution code:
from functools import reduce
from math import gcd
l=[int(input()) for _ in range(int(input()))]
o=reduce(lambda x,y:int(x*y/gcd(x,y)),l)
print(o)

Submission status: Runtime Error

Solution code:
import fractions
import math
from functools import reduce
def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

            else:

                flg = 0
    finally:

        return array_result

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

arr_data = getinputdata()

n = int(arr_data[0][0])

arr=[int(arr_data[i][0]) for i in range(1,1+n)]

print(lcm(*tuple(arr)))

Submission status: Runtime Error

Solution code:
N = int(input())
memo = {}

def mcd(a, b) :
    if (a, b) in memo.keys() :
        return memo[(a, b)]
    else :
        if max(a, b) % min(a, b) == 0 :
            return min(a, b)
        else :
            memo[(a, b)] = mcd(min(a, b), max(a, b) % min(a, b))
            return memo[(a, b)]

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

cur_lcm = 1

for i in range(N) :
    n = int(input())
    
    cur_lcm = lcm(cur_lcm, n)
    
print(cur_lcm)

Submission status: Runtime Error

Solution code:
N = int(input())
t = [int(input()) for x in range(N)]

def mcd(a, b) :
    if max(a, b) % min(a, b) == 0 :
        return min(a, b)
    else :
        return mcd(min(a, b), max(a, b) % min(a, b))

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

t_s = sorted(t)

cur_lcm = t_s[0]
for i in range(1, len(t_s)) :
    cur_lcm = lcm(cur_lcm, t_s[i])
    
print(cur_lcm)

Submission status: Runtime Error

Solution code:
N = int(input())
t = [int(input()) for x in range(N)]

def lcm(a, b) :
    if max(a, b) % min(a, b) == 0 :
        return max(a, b)
    else :
        return a*b / gcd(a, b)
    
def gcd(a, b) :
    if max(a, b) % min(a, b) == 0:
        return min(a, b)
    else :
        return gcd(max(a, b) % min(a, b), min(a, b))
    
cur_lcm = t[0]
for i in range(1, N) :
    cur_lcm = lcm(cur_lcm, t[i])

print(int(cur_lcm))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
n=int(input())
ans=int(input())
for i in range(n-1):
    a=int(input())
    if max(a,ans)%min(a,ans)==0:
        ans=max(ans,a)
    else:
        ans=(ans*a)//math.gcd(ans,a)
print(ans)

Submission status: Runtime Error

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

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

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

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

Submission status: Runtime Error

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

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

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

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

def gcd(A, B):
    A, B = sorted([A, B], reverse=True)
    prev_r = B
    r = A % B
    while r > 0:
        prev_r = B
        r = A % B
        A, B = B, r
    return prev_r

tmp = (T[0] * T[1]) // gcd(T[0], T[1])
for t in T[2:]:
    tmp = (tmp * t) // gcd(tmp, t)

print(tmp)

Submission status: Runtime Error

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

def gcd(A, B):
    A, B = sorted([A, B], reverse=True)
    r = A % B
    while r > 0:
        r = A % B
        A, B = B, r
    return max(B, 1)

tmp = (T[0] * T[1]) // gcd(T[0], T[1])
for t in T[2:]:
    tmp = (tmp * t) // gcd(tmp, t)

print(tmp)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

import math
from functools import reduce

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

# ようは最小公倍数を出せればいいと思う
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(TN))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

import fraction
from functools import reduce

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

# ようは最小公倍数を出せればいいと思う
def lcm_base(x, y):
    return (x * y) // fraction.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list(TN))

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(*numbers):
    return reduce(lcm_base, numbers, 1)

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

Submission status: Runtime Error

Solution code:
import math
from operator import mul
from functools import reduce

def lcm(a, b):
    a = int(a)
    b = int(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:
n=int(input())
ans=1
for i in range(n):
    t=int(input())
    print(t)
    ans=lcm(ans,t)
print(ans)

Submission status: Runtime Error

Solution code:
import math
import functools
lcm=lambda x,y:x*y//math.gcd(x,y)
print(functools.reduce(lcm,[int(input())for _ in[0]*int(input())]))

Submission status: Runtime Error

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


    
n = int(input())
t = []
for i in range(n):
    t.append(int(input()))
b = 1
for i in range(1, len(t)):
    
    b = lcm(t[i-1],t[i])

print(b)

Submission status: Runtime Error

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

N = int(input())
l = 1
for i in range(N):
  t = int(input())
  g = gcd(l, t)
  l *= t//g
print(l)

Submission status: Runtime Error

Solution code:
import math
import functools
N = int(input())
T = []
for i in range(N):
  T.append(int(input()))
def gcd(A, B):
  while(True):
    if A and B:
      if A > B:
        A = A % B
      else:
        B = B % A
    else:
      return max(A, B)
 
def lcm(A, B):
  return (A * // gcd(A, B)) * b

print(functools.reduce(lcm, sorted(T, reverse=True)))

Submission status: Runtime Error

Solution code:
import math
import functools
N = int(input())
T = []
for i in range(N):
  T.append(int(input()))
def gcd(A, B):
  while(True):
    if A and B:
      if A > B:
        A = A % B
      else:
        B = B % A
    else:
      return max(A, B)
 
def lcm(A, B):
  return int(A * (B / gcd(A, B)))
 
print(functools.reduce(lcm, sorted(T, reverse=True)))

Submission status: Runtime Error

Solution code:
import math
import functools
N = int(input())
T = []
for i in range(N):
  T.append(int(input()))
def gcd(A, B):
  while(True):
    if A and B:
      if A > B:
        A = A % B
      else:
        B = B % A
    else:
      return max(A, B)

def mcm(A, B):
  return int(A * B / gcd(A, B))

print(functools.reduce(mcm, sorted(T, reverse=True)))

Submission status: Runtime Error

Solution code:
import fractions


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


N = int(input())
t1 = int(input())
t2 = int(input())
t = lcm(t1, t2)
for _ in range(2, N):
    t = lcm(t, int(input()))
print(t)

Submission status: Runtime Error

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

T.sort(reverse = True)

def GCD(a,b):
    if a>=b:
        bigger = a
        smaller = b
    else:
        smaller = a
        bigger = b
        
    if smaller == 0:
        return bigger
    else:
        return GCD(smaller, bigger%smaller)

def GCF(a,b):
    return int((a*b)/GCD(a,b))

if N == 1:
    print(T[0])
elif N == 2:
    print(GCF(T[0],T[1]))
else:
    tmp = GCF(T[0],T[1])
    for i in range(2,N):
        tmp = GCF(tmp,T[i])
    print(tmp)

Submission status: Runtime Error

Solution code:
from functools import reduce
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)


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


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

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)


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


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

print(x)

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)


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


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

print(x)

Submission status: Runtime Error

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


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


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

print(int(x))

Submission status: Runtime Error

Solution code:
import fraction

N = int(input())
T = [int(input()) for i in range(N)]
_lcm = 1
for T_i in T:
    _lcm = _lcm * T_i // fraction.gcd(_lcm, T_i)

print(_lcm)

Submission status: Runtime Error

Solution code:
import math

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

print(_lcm)

Submission status: Runtime Error

Solution code:
N = int(input())
a = []
import fractions
for i in range(N):
    a.append(int(input()))
def lcd(m,n):
  c = fractions.gcd(m,n)
  return m*n/c
def ans(li):
  if len(li)=1:
    return li[0]
  else:
    li[0]=lcd(li[0],li[1])
    del li[1]
    return ans(li)
print(ans(a))

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):
	return a*b/gcd(a,b)
 
n = int(input())
arr = []
for i in range(n):
 
	arr.append(int(input()))
 
 
def mlcm():
 	if n = 1:
 		return arr[0]
 		
	ans = lcm(arr[0],arr[1])
 
	i = 2
	while i<n:
		ans = lcm(ans,arr[i])
		i+=1
 
	return ans
 
print mlcm()

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

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

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 math
from functools import reduce

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


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

print(lcm_list(L))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

N = int(input())
input_list = sorted([int(input()) for i 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(*input_list))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

N = int(input())
input_list = [int(input()) for i 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(*input_list))

Submission status: Runtime Error

Solution code:
N = int(input())
T = list((int(input()) for i in range(N)))
    
    
def gcd2(a, b):
    if b == 0: return a
    return gcd2(b, a%b)

def lcm2(a, b):
    return int(a*b/gcd2(a, b))

def lcm(l):
    while len(l) > 1:
        tmp = lcm2(l.pop(), l.pop())
        l.append(tmp)
        
    return l[0]

print(lcm(T))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

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


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

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

print(lcm(nums))

Submission status: Runtime Error

Solution code:
from fractions import gcd

n = int(input())
ans = 1

for _ in range(n):
	i = int(input())
	ans = int((ans / gcd(ans, i)) * i)

print(ans)

Submission status: Runtime Error

Solution code:
from fractions import gcd

n = int(input())
ans = 1

for _ in range(n):
	i = int(input())
	ans = int(ans / gcd(ans, i) * i)

print(ans)

Submission status: Runtime Error

Solution code:
from fratcions import gcd

n = int(input())
ans = 1

for _ in range(n):
	i = int(input())
	ans = int(ans / gcd(ans, i) * i)

print(ans)

Submission status: Runtime Error

Solution code:
from math import gcd

n = int(input())
ans = 1

for _ in range(n):
	i = int(input())
	ans = int(ans * i / gcd(ans, i))

print(ans)

Submission status: Runtime Error

Solution code:
from fractions import gcd

n = int(input())
ans = 1

for _ in range(n):
	i = int(input())
	ans = int(ans * i / gcd(ans, i))

print(ans)

Submission status: Runtime Error

Solution code:
import sys

stdin = sys.stdin

n = int(stdin.readline())
t = [0]*n
for i in range(n):
    t[i] = int(stdin.readline())

max = max(t)
ok = 0
while max <= 10**18:
    for i in t:
        if max % i == 0:
            ok += 1
        else:
            break
    if ok == n:
        t_max = max
        break
    max *= 2
    ok = 0

print(t_max)

Submission status: Runtime Error

Solution code:
import sys

stdin = sys.stdin

n = int(stdin.readline())
t = [0]*n
for i in range(n):
    t[i] = int(stdin.readline())

max = max(t)
ok = 0
while max < 10**18:
    for i in t:
        if max % i == 0:
            ok += 1
        else:
            break
    if ok == n:
        t_max = max
        break
    max *= 2
    ok = 0

print(t_max)

Submission status: Runtime Error

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

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

def lcm_list(numbers):
    ans = lcm_base(numbers[0], numbers[1])
    for x in numbers:
        ans = lcm_base(ans, x)
    return ans

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

result = lcm_list(t)
print(result)

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)]

result = lcm_list(t)
print(result)

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):
	return a*b/gcd(a,b)

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

	arr.append(int(input()))


def mlcm():

	ans = lcm(arr[0],arr[1])

	i = 2
	while i<n:
		ans = lcm(ans,arr[i])
		i+=1

	return ans

print mlcm()

Submission status: Runtime Error

Solution code:
import fractions
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / fractions.gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ti = int(input())
    ans = int(lcm(ti, ans))
while True:
    try:
        input()
    except EOFError:
        break
print(ans)

Submission status: Runtime Error

Solution code:
import fractions
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / fractions.gcd(a, b)

n = int(input())

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

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    if b > a:
        a, b = b, a
    while b > 0:
        a, b = b, a % b
    return a
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / gcd(a, b)

n = int(input())

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

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / gcd(a, b)

n = int(input())

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

Submission status: Runtime Error

Solution code:
import math

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


ans = 1
for t in T:
    ans = ans * t // math.gcd(ans,t)

print(ans)

Submission status: Runtime Error

Solution code:
def gcd(x,y):
	while y != 0:
		x , y = y , x % y
	return x

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


n = int(input())

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

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

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python

from functools import reduce
import math

# GCD and LCM are not in math module.  They are in gmpy, but these are simple enough:

# def gcd(a,b):
#     """Compute the greatest common divisor of a and b"""
#     while b > 0:
#         a, b = b, a % b
#     return a
    
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b // math.gcd(a, b)

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

# print(reduce(lcm, ts))
ans = 1
for i in range(N):
  ans = lcm(ans, ts[i])
print(ans)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python

from functools import reduce
import math

# GCD and LCM are not in math module.  They are in gmpy, but these are simple enough:

# def gcd(a,b):
#     """Compute the greatest common divisor of a and b"""
#     while b > 0:
#         a, b = b, a % b
#     return a
    
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b // math.gcd(a, b)

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

print(reduce(lcm, ts))

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python

from functools import reduce
import math

# GCD and LCM are not in math module.  They are in gmpy, but these are simple enough:

# def gcd(a,b):
#     """Compute the greatest common divisor of a and b"""
#     while b > 0:
#         a, b = b, a % b
#     return a
    
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / math.gcd(a, b)

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

print(int(reduce(lcm, ts)))

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python

from functools import reduce

# GCD and LCM are not in math module.  They are in gmpy, but these are simple enough:

def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a
    
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / gcd(a, b)

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

print(int(reduce(lcm, ts)))

Submission status: Runtime Error

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

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

N = int(input())
ans = int(input())
for k in range(N-1):
    ans = int(lcm(ans, int(input())))

print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

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 _ in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

n = int(input())

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

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

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

print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

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

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

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

def lcmary(x, t):
    if len(t)==0:
        return x
    elif len(t)==1:
        return lcm(x,t[0])
    else:
        xx = lcm(x, t.pop(0))
        return lcmary(xx, t)

print(lcmary(t[0], t[1:]))

Submission status: Runtime Error

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

for i in tt:
    p = []
    p.append(int(ss))
    p.append(int(i))
    q = list(sorted(p))
    while q[1] % q[0] != 0:
        r = [q[1] % q[0] , q[0]]
        s = list(sorted(r))
        q[0] = int(s[0])
        q[1] = int(s[1])

        
    ss = int(ss * i / q[0])

print(ss)