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:
n_in = int(input()) 
l = [int(input()) for i in range(n_in)] 
# l = [3, 5, 10, 11]

p = l[0]
for i in range(1, len(l)):
    q = l[i]

    if p >= q:
        m, n = p, q
    else:
        m, n = q, p

    while True:
        mod_value = m % n
        if mod_value  == 0:
            break

        m = n
        n = mod_value

    p = int(p*q/n)

print(p)

Submission status: Runtime Error

Solution code:
n_in = int(input()) 
l = [int(input()) for i in range(n_in)] 

p = l[0]
for i in range(1, len(l)):
    q = l[i]

    if p >= q:
        m = p
        n = q
    else:
        m = q
        n = p

    while True:
        mod_value = m % n

        if mod_value  == 0:
            n = mod_value
            break

        m = n
        n = mod_value

    p = int(p*q/n)

print(p)

Submission status: Runtime Error

Solution code:
n_in = int(input()) 
l = [int(input()) for i in range(n_in)] 

p = l[0]
for i in range(1, len(l)):
    q = l[i]

    if p >= q:
        m = p
        n = q
    else:
        m = q
        n = p

    while True:
        mod_value = m % n

        if mod_value  == 0:
            break

        m = n
        n = mod_value

    p = int(p*q/n)

print(p)

Submission status: Runtime Error

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


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


N = int(input())
T = [int(input()) for _ in range(N)]
LCM = lcm(T[0], T[1])

for i in range(1, N-1):
    LCM = lcm(LCM, T[i+1])

print(LCM)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**9)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**18)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(100000000)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10000000)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(200000)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(100000)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(5000)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Submission status: Runtime Error

Solution code:
import sys
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

Submission status: Runtime Error

Solution code:
def GCD(A, B):
	if B > A:
		A, B = B, A
	if A%B == 0:
		return B
	else:
		return GCD(B, A%B)
def LCM(A, B):
	ans = A/GCD(A,B)*B
	return ans
N = int(input())
a_list = [int(input()) for i in range(N)]
f = 1
if N == 1:
	print(f)
else:
	for i in range(N):
		f= int(LCM(f, a_list[i]))
	print(f)

Submission status: Runtime Error

Solution code:
def GCD(A, B):
	if B > A:
		A, B = B, A
	if A%B == 0:
		return B
	else:
		return GCD(B, A%B)
def LCM(A, B):
	ans = A/GCD(A,B)*B
	return ans
N = int(input())
a_list = [int(input()) for i in range(N)]
f = a_list[0]
if N == 1:
	print(f)
else:
	for i in range(1,N):
		f= int(LCM(f, a_list[i]))
	print(f)

Submission status: Runtime Error

Solution code:
def GCD(A, B):
	if B > A:
		A, B = B, A
	if A%B == 0:
		return B
	else:
		return GCD(B, A%B)
def LCM(A, B):
	ans = A/GCD(A,B)*B
	return ans
N = int(input())
a_list = [int(input()) for i in range(N)]
f = a_list[0]
if N == 1:
	print(f)
else:
	for i in range(1,N):
		f= LCM(f, a_list[i])
	print(f)

Submission status: Runtime Error

Solution code:
def GCD(A, B, C, D):
	if A%B != 0:
		GCD(B, A%B, C, D)
	else:
		LCM(C, D, B)
def LCM(A, B, C):
	ans = A*B/C
	return ans
N = int(input())
a_list = [int(input()) for i in range(N)]
if N == 1:
	print(a_list[0])
else:
	for i in range(N-1):
		e = GCD(a_list[0], a_list[1], a_list[0], a_list[1])
		a_list.append(e)
		a_list.pop(0)
		a_list.pop(0)
	print(a_list[0])

Submission status: Runtime Error

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

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

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

answer = t[0] * t[1] / gcd(t[0],t[1])

for i in range(2,n):
    answer = answer * t[i] / gcd(int(answer),t[i])

print(int(answer))

Submission status: Runtime Error

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

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

answer = t[0] * t[1] / gcd(t[0],t[1])

for i in range(2,n):
    answer = answer * t[i] / gcd(int(answer),t[i])

print(int(answer))

Submission status: Runtime Error

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

import math

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

answer = t[0] * t[1] / math.gcd(t[0],t[1])

for i in range(2,n):
    answer = answer * t[i] / math.gcd(int(answer),t[i])

print(int(answer))

Submission status: Runtime Error

Solution code:
import sys
from math import gcd

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


def main():
    input = sys.stdin.readline
    N = int(input())
    T = [int(input()) for _ in range(N)]
    T = sorted(T)

    t = T[0]
    for i in range(N):
        if T[i] % t == 0:
            t = T[i]
        else:
            t = lcm(t, T[i])

    return t


if __name__ == '__main__':
    print(main())

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 int(a * b / gcd(max(a, b), min(a, b)))


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

A = T[0]
for i in range(N):
    A = lcm(A, T[i])
print(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 int(a * b / gcd(max(a, b), min(a, b)))


N = int(input())
T = [int(input()) for i in range(N)]
if N == 1:
    print(T[0])
    exit()
A = T[0]
for i in range(1, N):
    A = lcm(A, T[i])
print(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 int(a * b / gcd(max(a, b), min(a, b)))


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

Submission status: Runtime Error

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

temp_LCM = T[0]	
	
for i in range(N-1):
	temp_GCD = math.gcd(temp_LCM,T[i+1])
	temp_LCM = (temp_LCM * T[i+1]) // temp_GCD
	
print(temp_LCM)

Submission status: Runtime Error

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

temp_LCM = T[0]	
	
for i in range(N-1):
	temp_GCD = math.gcd(temp_LCM,T[i+1])
	temp_LCM = temp_LCM * T[i+1] // temp_GCD
	
print(temp_LCM)

Submission status: Runtime Error

Solution code:
n = int(input())
a = [1]
for _ in range(n):
    a.append(int(input()))
for i in range(1, n+1):
    a[i] = lcm(a[i-1], a[i])
print(a[-1])

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

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

N = int(input())
ans = 1
for i in range(N):
    t = float(input())
    ans = lcm(t,ans)

print(ans)

Submission status: Runtime Error

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

N = int(input())
ans = 1
for i in range(N):
    t = float(input())
    ans = lcm(t,ans)

print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
 if a < b:
    a, b = b, a
 if b == 0:
    return a
 c = a % b
 return gcd(b, c)
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:
#標準入力の読み込み
n=int(input())
x=[int(input()) for i in range(n)]
x.sort(reverse=True)
n=len(x)

#ユークリッド互除法の関数の定義
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)


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

Submission status: Runtime Error

Solution code:
n=int(input())
t=[int(input()) for i in range(n)]
#print(n,t)
t.sort(reverse=True)

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
        
if n==1:
  ans=t
elif n==2:
  ans=t[0]/gcd(t[0],t[1])*t[1]
else:
  tmp=t[0]/gcd(t[0],t[1])*t[1]
  n=2
  while n < len(t):
    tmp=tmp/gcd(tmp,t[n])*t[n]
    n+=1  
  ans=tmp
  
print(int(ans))

Submission status: Runtime Error

Solution code:
#標準入力の読み込み
n=int(input())
x=[int(input()) for i in range(n)]
x.sort(reverse=True)
n=len(x)

#ユークリッド互除法の関数の定義
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)


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

Submission status: Runtime Error

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

dvs = []
dvs_all = []

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

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

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

print(ans)

Submission status: Runtime Error

Solution code:
#標準入力の読み込み
n=int(input())
x=[int(input()) for i in range(n)]
n=len(x)

#ユークリッド互除法の関数の定義
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)


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

Submission status: Runtime Error

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

dvs = []
dvs_all = []

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

if N == 1:
  ans = T[0]
else:
  for i in range(N - 1):
    T[i+1] = lcm(T[i], T[i+1])
    ans = T[i+1]

print(ans)

Submission status: Runtime Error

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

dvs = []
dvs_all = []

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

if N = 1:
  ans = T[0]
else:
  for i in range(N - 1):
    ans = lcm(T[i], T[i+1])
    T[i+1] = ans

print(ans)

Submission status: Runtime Error

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

dvs = []
dvs_all = []

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

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

for i in range(N - 1):
  ans = lcm(T[i], T[i+1])
  T[i+1] = ans

print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
t=[int(input()) for i in range(n)]
#print(n,t)
t.sort(reverse=True)

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
        
if n==1:
  ans=t[0]
elif n==2:
  ans=t[0]*t[1]/gcd(t[0],t[1])
else:
  tmp=t[0]*t[1]/gcd(t[0],t[1])
  n=2
  while n < len(t):
    tmp=tmp*t[n]/gcd(tmp,t[n])
    n+=1  
  ans=tmp
  
print(int(ans))

Submission status: Runtime Error

Solution code:
n=int(input())
t=[int(input()) for i in range(n)]
#print(n,t)
t.sort(reverse=True)

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
        
if n==1:
  ans=t
elif n==2:
  ans=t[0]*t[1]/gcd(t[0],t[1])
else:
  tmp=t[0]*t[1]/gcd(t[0],t[1])
  n=2
  while n < len(t):
    tmp=tmp*t[n]/gcd(tmp,t[n])
    n+=1  
  ans=tmp
  
print(int(ans))

Submission status: Runtime Error

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

from functools import reduce
from fraction import gcd

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

print(reduce(lcm, T))

Submission status: Runtime Error

Solution code:
def gcm(a, b) :
  while(b) :
    a, b = b, a%b
  return a
def lcm(a, b) :
  return int(a*b/gcm(a, b))

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from fractions import gcd
def lcm(a,b):
    return a*b//gcd(a,b)
n=int(input())
s=1
for i in range(n):
    t=int(input())
    s=lcm(a,t)
print(s)

Submission status: Runtime Error

Solution code:
from fractions import gcd
def lcm(a,b):
    return a*b//gcd(a,b)
n=int(input())
s=1
for i in range(n):
    t=int(input())
    s=lcm(a,t)

Submission status: Runtime Error

Solution code:
import math

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

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

print(ans)

Submission status: Runtime Error

Solution code:
import math

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

for i in T:
    lcm = lcm*i//math.gcd(lcm, i)

print(lcm)

Submission status: Runtime Error

Solution code:
import math

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

for i in T:
    LCM = LCM*i//math.gcd(LCM, i)

print(LCM)

Submission status: Runtime Error

Solution code:
from math import gcd
from functools import reduce

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


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


def lcm_multi(nums):
    return reduce(lcm, nums)


print(lcm_multi(T))

Submission status: Runtime Error

Solution code:
# coding: UTF-8
import math
N=int(input())
a=int(input())
for i in range(N-1):
    b=int(input())
    a=a*b//math.gcd(a, b)
print(int(a))

Submission status: Runtime Error

Solution code:
# coding: UTF-8
import math
N=int(input())
a=int(input())
for i in range(N-1):
    b=int(input())
    c=math.gcd(a, b)
    a=a*b/c
print(int(a))

Submission status: Runtime Error

Solution code:
def gcd(a,b):
  a = int(a)
  b = int(b)
  r = (int)(a%b)
  while(r!=0):
    a=(int)(b)
    b=(int)(r)
    r=(int)(a%b)
  return b
def lcm(a,b):
    return int((a*b)/gcd(a,b))
n = int(input())
ans = int(input())
for i in range(n-1):
  num = int(input())
  ans = lcm(max(ans,num),min(ans,num))
print(int(ans))

Submission status: Runtime Error

Solution code:
def gcd(a,b):
  a = int(a)
  b = int(b)
  r = (int)(a%b)
  while(r!=0):
    a=(int)(b)
    b=(int)(r)
    r=(int)(a%b)
  return b
def lcm(a,b):
    return (a*b)/gcd(a,b)
n = int(input())
ans = int(input())
for i in range(n-1):
  num = int(input())
  ans = lcm(max(ans,num),min(ans,num))
print(int(ans))

Submission status: Runtime Error

Solution code:
def gcd(a,b):
  r = (int)(a%b)
  while(r!=0):
    a=(int)(b)
    b=(int)(r)
    r=(int)(a%b)
  return b
def lcm(a,b):
    return (a*b)/gcd(a,b)
n = int(input())
ans = int(input())
for i in range(n-1):
  num = int(input())
  ans = lcm(max(ans,num),min(ans,num))
print(int(ans))

Submission status: Runtime Error

Solution code:
def gcd(a,b):
  r = (int)(a%b)
  while(r!=0):
    a=(int)b
    b=(int)r
    r=(int)a%b
  return b
def lcm(a,b):
    return (a*b)/gcd(a,b)
n = int(input())
ans = int(input())
for i in range(n-1):
  num = int(input())
  ans = lcm(max(ans,num),min(ans,num))
print(int(ans))

Submission status: Runtime Error

Solution code:
def gcd(a,b):
  r = a%b
  while(r==0):
    a=b
    b=r
    r=a%b
  return b
n = int(input())
ans = int(input())
for i in range(n-1):
  num = int(input())
  ans = gcd(max(ans,num),min(ans,num))
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()) 
time = [int(input()) for i in range(N)]

tmp = time[0]*time[1]//gcd(time[0],time[1])
for i in time:
  if tmp%i!=0:
    tmp = tmp*i//gcd(tmp,i)
    
print(tmp)

Submission status: Runtime Error

Solution code:
from functools import reduce
from math import gcd

def main():
    n = int(input())
    t = [int(input()) for _ in range(n)]
    print(solve(t))

def solve(t):
    return reduce(lcm, t, 1)

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

main()

Submission status: Runtime Error

Solution code:
import math
import functools

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

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

def lcm_list( numbers ):
    return functools.reduce( lcm, numbers, 1 )

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy

def main():
	num = int(input())
	
	clocks = []
	for _ in range(num):
		clock = int(input())
		clocks.append(clock)
		
	ans = 1
	for clock in clocks:
		ans = lcm(ans, clock)
	print(int(ans))
			
def gcd(a, b):
	if a > b:
		a, b = b, a
		
	while a > 0:
		a, b = b % a, a
	return b
	
def lcm(a, b):
	g = gcd(a, b)
	return a / g * b
	
if __name__ == "__main__":
	main()

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy

def main():
	num = int(input())
	
	clocks = []
	for _ in range(num):
		clock = int(input())
		clocks.append(clock)
		
	ans = clocks[0]
	for clock in clocks:
		if clock == ans: continue
		ans = lcm(ans, clock)
	print(int(ans))
			
def gcd(a, b):
	if a > b:
		a, b = b, a
		
	while a > 0:
		a, b = b % a, a
	return b
	
def lcm(a, b):
	g = gcd(a, b)
	return a / g * b
	
if __name__ == "__main__":
	main()

Submission status: Runtime Error

Solution code:
n=int(input())
arr_Ti = [int(input()) for _ in range(n)]
n=int(input())
arr_Ti = [int(input()) for _ in range(n)]
keep = [max(arr_Ti)]
def prod(arr):
  val=1
  for n in arr:
    val*=n
  return val
for num in arr_Ti[::-1]:
  if max(arr_Ti)%num!=0:
    keep.append(num)
print(prod(keep))

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10000)

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

def lcm(A, n):
    if n == 2:
        return A[0]* (A[1] // gcd(A[0], A[1]))
    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
    rec = lcm(A, n-1)
    return rec * (A[n-1] // gcd(rec, A[n-1]))

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
ans = lcm(a, n)
print(str(ans))

#通るコード
#n = int(input())
#T1 = int(input())
#for i in range(n-1):
#    T2 = int(input())
#    T1 = T1*T2 // gcd(T1, T2)
#print(str(T1))

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10000)

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

def lcm(A, n):
    if n == 2:
        return A[0]* (A[1] // gcd(A[0], A[1]))
    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
    temp = lcm(A, n-1)
    return temp * (A[n-1] // gcd(temp, A[n-1]))

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
ans = lcm(a, n)
print(str(ans))

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10000)

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

def lcm(A, n):
    if n == 2:
        return A[0]* (A[1] // gcd(A[0], A[1]))
    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
    a = lcm(A, n-1)
    return a * (A[n-1] // gcd(a, A[n-1]))

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
ans = lcm(a, n)
print(str(ans))

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10000)

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

def lcm(A, n):
    if n == 2:
        return A[0]*A[1] // gcd(A[0], A[1])
    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
    a = lcm(A, n-1)
    return a* A[n-1] // gcd(a, A[n-1])

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
#a.sort(reverse = True)
ans = lcm(a, n)
print(str(ans))

Submission status: Runtime Error

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

def lcm(A, n):
    if n == 2:
        return A[0]*A[1] // gcd(A[0], A[1])
    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
    a = lcm(A, n-1)
    return a* A[n-1] // gcd(a, A[n-1])

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
#a.sort(reverse = True)
ans = lcm(a, n)
print(str(ans))

Submission status: Runtime Error

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

def lcm(A, n):
    if n == 2:
        return A[0]*A[1] // gcd(A[0], A[1])
    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
    a = lcm(A, n-1)
    return a* A[n-1] // gcd(a, A[n-1])

n = int(input())
a = []
for i in range(n-1):
    a.append(int(input()))
#a.sort(reverse = True)
ans = lcm(a, n)
print(str(ans))

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    if b == 1:
        return 1
    # a > b　を仮定
    r = a % b
    if r == 0:
        return b
    else:
        return gcd(b, r)

def lcm(A, n):
    if n == 2:
        return A[0]* (A[1] // gcd(A[0], A[1]))
    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
    a = lcm(A, n-1)
    return a* (A[n-1] // gcd(a, A[n-1]))

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a.sort(reverse = True)
ans = lcm(a, n)
print(str(ans))

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    if b == 1:
        return 1
    # a > b　を仮定
    r = a % b
    if r == 0:
        return b
    else:
        return gcd(b, r)

def lcm(A, n):
    if n == 2:
        return A[0]*A[1] // gcd(A[0], A[1])
    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
    a = lcm(A, n-1)
    return a*A[n-1] // gcd(a, A[n-1])

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a.sort(reverse = True)
ans = lcm(a, n)
print(str(ans))

Submission status: Runtime Error

Solution code:
def gcd(a, b):
    if b == 1:
        return 1
    # a > b　を仮定
    r = a // b
    mod = a % b
    if mod == 0:
        return b
    else:
        return gcd(b, r)

def lcm(A, n):
    if n == 2:
        return A[0]*A[1] // gcd(A[0], A[1])
    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
    a = lcm(A, n-1)
    return a*A[n-1] // gcd(a, A[n-1])

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a.sort(reverse = True)
ans = lcm(a, n)
print(str(ans))

Submission status: Runtime Error

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

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

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

b = lcm(a[0],a[1])
for i in range(2,n):
    b = lcm(b,a[i])
print(int(b))

Submission status: Runtime Error

Solution code:
def c_multiple_clocks(N, T):
    from fractions import gcd
    from functools import reduce
    return reduce(lambda a, b: (a * b) // gcd(a, b), T)

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

Submission status: Runtime Error

Solution code:
import math

N=int(input())
x=1
for i in range(N):
    t=int(input())
    x=(x*t)//math.gcd(x,t)
print(x)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(200000000)
n = int(input())

if n == 1:
    print(t[0])
    exit()
# 最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)
# 最小公倍数
def lcm(a, b):
    return a * b / gcd(a, b)
res = 1
for i in range(n):
    t = int(input())
    res = int(lcm(res, t))
print(res)

Submission status: Runtime Error

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

if n == 1:
    print(t[0])
    exit()
# 最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)
# 最小公倍数
def lcm(a, b):
    return a * b / gcd(a, b)
res = int(lcm(t[0], t[1]))
for i in range(2, n):
    res = int(lcm(res, t[i]))
print(res)

Submission status: Runtime Error

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

if n == 1:
    print(t[0])
    exit()
# 最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)
# 最小公倍数
def lcm(a, b):
    return a * b / gcd(a, b)
res = lcm(t[0], t[1])
for i in range(2, n):
    res = lcm(res, t[i])
print(int(res))

Submission status: Runtime Error

Solution code:
import math

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

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

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

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())
t = [int(input()) for i in range(n)]
ans = t[0]
for i in range(1,n):
    ans = LCM(ans, t[i])
print(int(ans))

Submission status: Runtime Error

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]


from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

# a, bの最大公約数
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

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

# リストnumbers最小公倍数
def lcmlist(numbers):
    a = numbers[0]
    for i in range(1, len(numbers)):
        a = lcm(a, numbers[i])
    return a

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

print(lcmlist(t))

Submission status: Runtime Error

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]


from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

# a, bの最大公約数
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

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

# リストnumbers最小公倍数
def lcmlist(numbers):
    a = numbers[0]
    for i in range(1, len(numbers)):
        a = lcm(a, numbers[i])
    return int(a)

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

print(lcmlist(t))

Submission status: Runtime Error

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]


from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

# a, bの最大公約数
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

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

# リストnumbers最小公倍数
def lcmlist(numbers):
    a = numbers[0]
    for i in range(len(numbers)):
        a = lcm(a, numbers[i])
    return int(a)

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

print(lcmlist(t))

Submission status: Runtime Error

Solution code:
N = int(input())
L = []
for _ in range(N):
    L.append(int(input()))
def lcm(x, y):
    if x > y:
        x,y = y,x
    if x == 0:
        return y
    r = y % x
    return lcm(r,x)
def gcd(x,y):   
    return   x*y // lcm(x,y)

ans = gcd(L[1],L[0])
for x in L:
    ans = gcd(ans,x)
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
L = []
for _ in range(N):
    L.append(int(input()))
def lcm(x, y):
    if x > y:
        x,y = y,x
    if x == 0:
        return y
    r = y % x
    return lcm(r,x)
def gcd(x,y):   
    return   x*y // lcm(x,y)

ans = gcd(L[1],L[2])
for x in L:
    ans = gcd(ans,x)
print(ans)