Problem:


Score : 300 points

Problem Statement

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

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

Now, Dolphin starts all the clocks simultaneously.

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

Constraints

1≤N≤100 

1≤T_i≤10^{18} 

All input values are integers.  

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

Input

Input is given from Standard Input in the following format:  

N
T_1
:  
T_N

Output

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

Sample Input 1

2
2
3

Sample Output 1

6

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

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

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

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

Sample Input 2

5
2
5
10
1000000000000000000
1000000000000000000

Sample Output 2

1000000000000000000



Sample input:
2
2
3


Sample output:
6

Submission status: Runtime Error

Solution code:
import math
N = int(input())
T = [0]*N
for i in range(N):
    T[i] = int(input())
lcd = 1

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

Submission status: Runtime Error

Solution code:
n = int(input())
time = []

for i in range(n):
    time.append(int(input()))

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

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

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

Submission status: Runtime Error

Solution code:
n=int(input())
t=[0]*n
for i in range(n):
  t[i]=int(input())
max_t=max(t)
count=0
n=1
while count==0:
  for i in range(n):
    if n*max_t%t[i]!=0:
      n+=1
      break
  else:
    count+=1
print(n*max_t)

Submission status: Runtime Error

Solution code:
import fractions

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


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

for n in range(N):
    l = lcm(int(l),int(input()))

print(int(l))

Submission status: Runtime Error

Solution code:
import math

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


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

for n in range(N):
    l = lcm(int(l),int(input()))

print(int(l))

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

print(lcm(ns))

Submission status: Runtime Error

Solution code:
N=int(input())
para = [int(input()) for i in range(N)]
para.sort(reverse=True)

"""
全ての最小公倍数を求めたら良い
lcm(a,b,c...) = lcm(a,lcm(b,c.......))
gcd(a,b,c...) = gcd(a,gcd(b,c,d....))
"""

"""
最大公倍数の実装
ユークリッドの互除法
a = b*c + d
c = d*e + f
"""
def gcd(a,b):
    if b == 0 : 
        return a  
    return gcd(b,a%b)

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

for i in range(N-1,0,-1):
    if i == N-1:
        p = lcm(para[i-1],para[i])
    else :
        a = max(para[i],p)
        b = min(para[i],p)
        p = lcm(a,b)
print(p)

Submission status: Runtime Error

Solution code:
N=int(input())
para = [int(input()) for i in range(N)]
para.sort(reverse=True)
import sys
sys.setrecursionlimit(100000)

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

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

for i in range(N-1,0,-1):
    if i == N-1:
        p = lcm(para[i-1],para[i])
    else :
        p = lcm(para[i],p)
print(p)

Submission status: Runtime Error

Solution code:
N=int(input())
para = [int(input()) for i in range(N)]
para.sort(reverse=True)

"""
全ての最小公倍数を求めたら良い
lcm(a,b,c...) = lcm(a,lcm(b,c.......))
gcd(a,b,c...) = gcd(a,gcd(b,c,d....))
"""

"""
最大公倍数の実装
ユークリッドの互除法
a = b*c + d
c = d*e + f
"""
def gcd(a,b):
    if b == 0 : 
        return a  
    return gcd(b,a%b)

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

for i in range(N-1,0,-1):
    if i == N-1:
        p = lcm(para[i-1],para[i])
    else :
        p = lcm(para[i],p)
print(p)

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 _ in range(N)]

print(lcm_list(T))

Submission status: Runtime Error

Solution code:
n = int(input())
ans = int(input())
 
def gcd(a,b):
    while b:
        a,b = b,a%b
    return a
 
def lcm(x,y):
    return (x*y//gcd(x,y))
 
for i in range(N-1):
    t = int(input())
    ans = lcm(ans,t)
print(ans)

Submission status: Runtime Error

Solution code:
def gcd(num1,num2):
    if num2 == 0:
        return num1
    return gcd(num2,num1%num2)

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

time = 1

for i in t:
    time = time * i / gcd(time,i)

print(int(time))

Submission status: Runtime Error

Solution code:
def gcd(num1,num2):
    if num2 == 0:
        return num1
    return gcd(num2,num1%num2)

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

time = 1

for i in t:
    time = time * i / gcd(time,i)

print(time)

Submission status: Runtime Error

Solution code:
def gcd(num1,num2):#ユークリッド互除法を関数化
    if num2 == 0:
        return num1
    return gcd(num2,num1%num2)

n = int(input())
t = [int(x) for x in input()]
time = 1

for i in t:#最大公約数を求める。　積を最小公倍数で割ればよい
    time = time * t // gcd(time,i)

Submission status: Runtime Error

Solution code:
import fractions

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

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

Submission status: Runtime Error

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


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

while len(T) != 1:
	if len(T)%2 == 1:
		T.append(1)
	new_T = []
	for i in range(0,len(T),2):
		t1,t2 = T[i],T[i+1]
		a = max(t1,t2)
		b = min(t1,t2)
		res = gcd(a,b,a)
		new_T.append(res)
	T = new_T
	# print(T)
print(*T)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
def gcd (num1,num2):
    tmp = max(num1,num2) % min(num1,num2)
    if tmp == 0:
        return min(num1,num2)
    return gcd(min(num1,num2),tmp)

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

for i in range(len(t)-1):
    stock.append(int(t[i+1] / gcd(stock[i],t[i])*t[i]))

print(stock[-1])

Submission status: Runtime Error

Solution code:
def gcd (num1,num2):
    tmp = max(num1,num2) % min(num1,num2)
    if tmp == 0:
        return min(num1,num2)
    return gcd(min(num1,num2),tmp)

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

for i in range(len(t)-1):
    stock.append(t[i] * t[i+1] / gcd(stock[i],t[i]))

print(stock[-1])

Submission status: Runtime Error

Solution code:
def gcd (num1,num2):#ユークリッド互除法
    tmp = max(num1,num2) % min(num1,num2)
    if tmp == 0:
        return min(num1,num2)
    return gcd(min(num1,num2),tmp)


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

for i in range(len(t)-1):#各秒数の最大公倍数を求める
    stock.append(t[i] * t[i+1] / gcd(stock[i],t[i]))

print(stock[-1])

Submission status: Runtime Error

Solution code:
import math
n = int(input())
t = [int(input()) for i in range(n)]
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
l = t[0]
for x in range(n):
    l = lcm(l,t[x])
print(l)

Submission status: Runtime Error

Solution code:
N=int(input())
T=1
for i in range(N):
    T1=int(input())
    t=gcd(T,T1)
    T=(T1//t)*(T//t)*t
print(T)

Submission status: Runtime Error

Solution code:
N = int(input())
ans = int(input())

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

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

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

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
ans = 1

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

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

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

print(ans)

Submission status: Runtime Error

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

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

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

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

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

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

Submission status: Runtime Error

Solution code:
N = int(input())

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

g = 0
for x in (map(int, input()) for _ in range(N)):
  g = gcd(g, x)
print(g)

Submission status: Runtime Error

Solution code:
import math

n = int(input())
li_t = list()

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

# a * b = 最小公倍数 * 最大公約数


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

work = 1

for t in li_t:
    work = lcm(work, t)

print(work)

Submission status: Runtime Error

Solution code:
import math

n = int(input())
li_t = list()

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

# a * b = 最小公倍数 * 最大公約数


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


work = li_t.pop(0)

for t in li_t:
    work = lcm(work, t)

print(work)

Submission status: Runtime Error

Solution code:
import math

n = int(input())
li_t = list()

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

# a * b = 最小公倍数 * 最大公約数

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

work = li_t.pop(0)

for t in li_t:
    work = lcm(work, t)

print(work)

Submission status: Runtime Error

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

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

a = 1

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

for i in range(N):
    d = gcd(a, T[i])
    a = int(a * T[i] / d)

print(a)

Submission status: Runtime Error

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

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

T.sort
a = T[0]

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

for i in range(N-1):
    d = gcd(a, T[i+1])
    a = int(a * T[i+1] / d)

print(a)

Submission status: Runtime Error

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

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

T.sort
a = T[0]

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

for i in range(N-1):
    d = gcd(a, T[i+1])
    a = int(a * T[i+1] / d)

print(int(a))

Submission status: Runtime Error

Solution code:
import fractions

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

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

T.sort
a = T[0]

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

print(int(a))

Submission status: Runtime Error

Solution code:
import math
import fractions

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

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

T.sort
a = T[0]

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

print(int(a))

Submission status: Runtime Error

Solution code:
import math

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

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

T.sort
a = T[0]

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

print(int(a))

Submission status: Runtime Error

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


n = int(input())
ans = 1
l = [int(input()) for i in range(n)]

for i in l:
    ans = ans*i/gcd(ans,i)
print(int(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
t=[0]*n
allmultiple=1
for i in range(n):
    t[i]=int(input())
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:
n=int(input())
x=[]
for i in range(n):
    t=int(input())
    x.append(t)


ans=x[0]
for j in range(1,len(x)):
    ans=ans*x[j]//fractions.gcd(ans,x[j])

print(ans)

Submission status: Runtime Error

Solution code:


def read_input():
    n = int(input())
    tlist = []
    for i in range(n):
        tlist.append(int(input()))

    return n, tlist

gcdmemo = {}

def mygcd(a, b):
    if b == 0:
        return a

    if not (a, b) in gcdmemo.keys():
        gcdmemo[(a, b)] = mygcd(b, a % b)

    return gcdmemo[(a, b)]


def mylcm(a, b):
    g = mygcd(a, b)
    if g != 0:
        return int(a * b / g)
    return a * b


def submit():
    n, tlist = read_input()

    acc = 1
    for t in tlist:
        acc = mylcm(acc, t)

    print(acc)

if __name__ == '__main__':
    submit()

Submission status: Runtime Error

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

    return n, tlist


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


def mylcm(a, b):
    g = mygcd(a, b)
    return int(a * b / g)


def submit():
    n, tlist = read_input()

    acc = 1
    for t in tlist:
        acc = mylcm(acc, t)

    print(acc)

if __name__ == '__main__':
    submit()

Submission status: Runtime Error

Solution code:
N = int(input())
T_before =int(input())

for i in range(1,N):
    T =int(input())
    f=fractions.gcd(T,T_before)
    T_before=T*T_before//f
    
print(T_before)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    x=int(max(a,b))
    y=int(min(a,b))
    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z
        
def lcm(a,b):
    return int(a*b/gcd(a,b))

N=int(input())

a=int(input())

for n in range(1,N):
    b=int(input())
    a=lcm(a,b)
print(a)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    x=max(a,b)
    y=min(a,b)
    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z
        
def lcm(a,b):
    return int(a*b/gcd(a,b))

N=int(input())

a=int(input())

for n in range(1,N):
    b=int(input())
    a=lcm(a,b)
print(a)

Submission status: Runtime Error

Solution code:
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;
int n;
long long a[N];


long long gcd(long long a, long long b){
    return b ? gcd(b, a % b) : a;
}



int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>n;
    
    for (int i = 1; i <= n; i++)cin>>a[i];
    
    long long  lcm = 1;
    
    for (int i = 1; i <= n; i++){
        lcm = lcm/gcd(a[i], lcm)*a[i];
    }
    cout<<lcm<<endl;
    
    
    return 0;
}

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if a % b == 0:
        return b
    else:
        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:
from functools import reduce
import math

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input().rstrip())
    T = []
    for i in range(N):
        T.append(int(input().rstrip()))    
    print(lcm_list(T))
    
if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

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

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

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

print(int(ans))

Submission status: Runtime Error

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import math

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


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

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

print(ans)

Submission status: Runtime Error

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import math

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

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

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

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

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

  
#最小公倍数を求める関数
def lcm(x, y):
  #return x*y // math.gcd(x, y) #gcdは最大公約数を求める
  return math.floor(x*y / math.gcd(x, y))


n = int(input())

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

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

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

  
#最小公倍数を求める関数
def lcm_base(x, y):
  #return x*y // math.gcd(x, y) #gcdは最大公約数を求める
  return math.floor(x*y / math.gcd(x, y))

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


n = int(input())

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

ans = lcm_list(nums)
print(ans)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

  
#最小公倍数を求める関数
def lcm_base(x, y):
  #return x*y // math.gcd(x, y) #gcdは最大公約数を求める
  return math.floor(x*y / math.gcd(x, y))

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


n = int(input())

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


print(lcm_list(nums))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

  
#最小公倍数を求める関数
def lcm_base(x, y):
  #return x*y // math.gcd(x, y) #gcdは最大公約数を求める
  return math.floor(x*y / math.gcd(x, y))

def lcm_list(numbers):
  return functools.reduce(lcm_base, numbers)


n = int(input())

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


print(lcm_list(nums))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

  
#最小公倍数を求める関数
def lcm_base(x, y):
  #return x*y // math.gcd(x, y) #gcdは最大公約数を求める
  return math.floor(x*y / math.gcd(x, y))

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


n = int(input())

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


print(lcm_list(nums))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

  

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

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


n = int(input())

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


print(lcm_list(nums))

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

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


print(lcm_list(nums))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

  
#採用公倍数を求める関数
def lcm_base(x, y):
  return x*y // math.gcd(x, y) #gcdは最大公約数を求める

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


n = int(input())

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


print(lcm_list(nums))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

n = int(input())

nums = []
for i in range(n):
  nums.append(int(input()))
  
  
#採用公倍数を求める関数
def lcm_base(x, y):
  return x*y // math.gcd(x, y) #gcdは最大公約数を求める

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


print(lcm_list(nums))

Submission status: Runtime Error

Solution code:
import fractions
N = int(input())
T = list(map(int, input().split()))
ans = T[0]
for i in range(1, N):
    ans = ans * T[i] // fractions.grid(ans, T[i])
print(ans)

Submission status: Runtime Error

Solution code:
import math
n=int(input())
a=[]
for i in range(n):a.append(int(input()))
while len(a)>1:
    j=a.pop()
    k=a.pop()
    a.append(j*k//math.gcd(j,k))
print(a[0])

Submission status: Runtime Error

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

def GCD(a,b):
    x1 = max(a,b)
    x2 = min(a,b)
    x3 = x1 % x2
    if x3 == 0:
        return x2
    N = GCD(x2,x3)
    return N
        
ans = T[0]
tmp = ans
for i in range(1,N):
    ans = tmp * T[i] / GCD(tmp,T[i])
    tmp = ans

print(int(ans))

Submission status: Runtime Error

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

def GCD(a,b):
    x1 = max(a,b)
    x2 = min(a,b)
    x3 = x1 % x2
    if x3 == 0:
        return x2
    else:
        return GCD(x2,x3)
        
ans = T[0]
tmp = ans
for i in range(1,N):
    ans = tmp * T[i] / GCD(tmp,T[i])
    tmp = ans

print(int(ans))

Submission status: Runtime Error

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

def GCD(a,b):
    x1 = max(a,b)
    x2 = min(a,b)
    x3 = x1 % x2
    if x3 == 0:
        return x2
    else:
        return GCD(x2,x3)
        
ans = T[0]
for i in range(1,N):
    ans = ans * T[i] / GCD(ans,T[i])

print(int(ans))

Submission status: Runtime Error

Solution code:
a=int(input())
li = [int(input()) for i in range(a)]
li.sort()

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


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

ans=li[0]
for i in range(a-1):
  if ans<=li[i+1]:
    ans=lcm(ans,li[i+1])
  else:
    ans=lcm(li[i+1],ans)

print(int(ans))

Submission status: Runtime Error

Solution code:
a=int(input())
li = [int(input()) for i in range(a)]
li.sort()

def gcm(x,y):
  #x<=y
  if x==y:
    return x
  else:
    if y%x==0:
      return x
    else:
      return gcm(y%x,x)


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

ans=li[0]
for i in range(a-1):
  ans=lcm(ans,li[i+1])

print(int(ans))

Submission status: Runtime Error

Solution code:
import math
def lcm(x, y):
    return math.gcd(x, y)
 
n = int(input())
ans = int(input())
for i in range(n-1):
  tmp = int(input())
  ans = lcm(ans,tmp)
  
print(ans)

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!

import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
 
n = int(input())
ans = int(input())
for i in range(n-1):
  tmp = int(input())
  ans = lcm(ans,tmp)
  
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
from math import gcd
def lcm(a,b):
    return(a*b//gcd(a,b))
N=int(input())
curlcm=1
for _ in range(N):
    curlcm=lcm(curlcm,int(input()))
print(curlcm)

Submission status: Runtime Error

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


# 最小公倍数を求めたい
# aとbの最小公倍数 = a*b / aとbの最大公約数
# 最大公約数 (Greatest Common Divisor)
def GCD( a, b ):
    if b == 0: return a
    return GCD(b, a%b)

# 最小公倍数 (Least Common Multiple)
def LCM( a, b ):
    return a*b // GCD(a,b)


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

Submission status: Runtime Error

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


# 最小公倍数を求めたい
# aとbの最小公倍数 = a*b / aとbの最大公約数
# 最大公約数 (Greatest Common Divisor)
def GCD( a, b ):
    if b == 0: return a
    return GCD(b, a%b)

# 最小公倍数 (Least Common Multiple)
def LCM( a, b ):
    return a*b // GCD(a,b)


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

Submission status: Runtime Error

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


# 最小公倍数を求めたい
# aとbの最小公倍数 = a*b / aとbの最大公約数
# 最大公約数 (Greatest Common Divisor)
def GCD( a, b ):
    if b == 0: return a
    return GCD(b, a%b)

# 最小公倍数 (Least Common Multiple)
def LCM( a, b ):
    return a*b / GCD(a,b)


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

Submission status: Runtime Error

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


# 最小公倍数を求めたい
# aとbの最小公倍数 = a*b / aとbの最大公約数
# 最大公約数 (Greatest Common Divisor)
def GCD( a, b ):
    if b == 0: return a
    return GCD(b, a%b)

# 最小公倍数 (Least Common Multiple)
def LCM( a, b ):
    return a*b / GCD(a,b)


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

Submission status: Runtime Error

Solution code:
import 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())
ts = [0]*n
for i in range(n):
  ts[i] = int(input())

print(lcm_list(ts))

Submission status: Runtime Error

Solution code:
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#import math
#n=int(input())
#li=input().split()
#S=input()
#lis=list(map(int,input().split()))
import fractions
l=[]
n=int(input())
for i in range(n):
    l.append(int(input()))
ans=l[0]
for i in range(n-1):
    a=int((ans*l[i+1])/fractions.gcd(ans,l[i+1]))
    ans=a
print(ans)

Submission status: Runtime Error

Solution code:
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
import math
#n=int(input())
#li=input().split()
#S=input()
#lis=list(map(int,input().split()))

l=[]
n=int(input())
for i in range(n):
    l.append(int(input()))
ans=l[0]
for i in range(n-1):
    ans=int((ans*l[i+1])/math.gcd(ans,l[i+1]))

print(ans)

Submission status: Runtime Error

Solution code:
import sys
import math
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

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

n = ni()
t = ni()
if n == 1:
    print(t)
else:
    for i in range(n - 1):
        tmp = ni()
        t = lcm(t, tmp)
    print(t)

Submission status: Runtime Error

Solution code:
from math import gcd
from functools import reduce

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

n = int(input())
nums = [int(input()) for _ in range(n)]
print(reduce(lcm, nums))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

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

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

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

print(lcm(T))

Submission status: Runtime Error

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

x=gcd(8,12)

n=int(input())
li = [int(input()) for i in range(n)]
li.sort()

a=gcd(li[0],li[1])
b=li[0]*li[1]/a

for i in range(n-2):
  a=gcd(li[i+2],b)
  b=li[i+2]*b/a

b=int(b)

print(b)

Submission status: Runtime Error

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

x=gcd(8,12)

n=int(input())
li = [int(input()) for i in range(n)]
li.sort()

a=gcd(li[0],li[1])
b=li[0]*li[1]/a
c=a

for i in range(n-2):
  a=gcd(li[i+2],a)
  b=li[i+2]*c/a
  c=a

b=int(b)

print(b)

Submission status: Runtime Error

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

a=math.gcd(li[0],li[1])
b=li[0]*li[1]/a
c=a

for i in range(n-2):
  a=math.gcd(li[i+2],a)
  b=li[i+2]*c/a
  c=a

b=int(b)

print(b)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

if N==1:
    print(T[0])
else:
    a=lcm(T[0],T[1])
    for i in range(N):
        a=lcm(a,T[i])
print(a)

Submission status: Runtime Error

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

n=int(input())

a=int(input())
b=int(input())
x=a*b//gcd(a,b)
for i in range(n-2):
    c=int(input())
    x=c*x//gcd(c,x)
print(x)

Submission status: Runtime Error

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

n=int(input())

a=int(input())
b=int(input())
x=a*b//gcd(a,b)
for i in range(n-2):
    c=int(input())
    x=c*x//gcd(c,x)
print(x)

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)

import sys
input = sys.stdin.readline
N = int(input())
T = [int(input()) for _ in range(N)]
if N == 1:
    ans = T[0]
else:
    ans = lcm(T[0], T[1])
    for i in range(2, N):
    ans = lcm(ans, T[i])
print(ans)

Submission status: Runtime Error

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

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

import sys
input = sys.stdin.readline
N = int(input())
T = [int(input()) for _ in range(N)]
ans = lcm(T[0], T[1])
for i in range(2, N):
    ans = lcm(ans, T[i])
print(ans)

Submission status: Runtime Error

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

import sys
input = sys.stdin.readline
N = int(input())
T = [int(input()) for _ in range(N)]
ans = T[0] * T[1] // gcd(T[0], T[1])
for i in range(2, N):
    ans = ans * T[i] // gcd(ans, T[i])
print(ans)