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: Accepted

Solution code:
from fractions import gcd

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

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

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

print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce


def lcm(num1, num2):
  return num1 * num2 // gcd(num1, num2)


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

print(reduce(lcm, a))

Submission status: Accepted

Solution code:
N = int(input())
T = [int(input()) for _ in range(N)]
def gcd(x,y):
    return x if y == 0 else gcd(y,x%y)
ans = T[0]
for t in T:
    ans = ans * t // gcd(ans,t)
print(ans)

Submission status: Accepted

Solution code:
def lcm(n,m):
  while m!=0:
    n,m=m,n%m
  return n
def gcd(n,m):
  return n*m//lcm(n,m)
n=int(input())
c=int(input())
for i in range(n-1):
  c1=int(input())
  c=gcd(c,c1)
print(c)

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
#n = ip()                                     #入力整数1つ
#n,k= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
n = ip()                      #入力セット(整数改行あり)(1/2)
a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
s = a[0]
for i in range(1,n):
    s = lcm(s,a[i])
print(s)

Submission status: Accepted

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

from fractions import gcd
from functools import reduce

print(reduce(lambda a, b : a * b // gcd(a, b), T))

Submission status: Accepted

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

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

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

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

print(x)

Submission status: Accepted

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

def gcd(n,m):
    while n > 0:
        a = n
        n = m % n
        m = a
    return m

a = 1

for t in T:
    a = a * t // gcd(a,t)

print(a)

Submission status: Accepted

Solution code:
# 入力
input_int = lambda:int(input())
input_ints = lambda:map(int,input().split())
input_str = lambda:input()
input_strs = lambda:input().split()
input_lines = lambda n,f:[f() for _ in range(n)]

import functools,fractions
import numpy as np
gcd = lambda a:functools.reduce(fractions.gcd,a) # 最大公約数（リスト）
lcm_base = lambda a,b:(a*b)//fractions.gcd(a,b) # 最小公倍数(2値)
lcm = lambda a:functools.reduce(lcm_base,a,1) # 最小公倍数(リスト)

def solution():
    N = input_int()
    Ts = input_lines(N,input_int)

    ans = lcm(Ts)
    print(ans)

if __name__ == '__main__':
    solution()

Submission status: Accepted

Solution code:
import fractions

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: Accepted

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 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: Accepted

Solution code:
from collections import Counter
from functools import reduce
# import statistics
import bisect
import copy
import fractions
import math
import pprint
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))
def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]
def dfs(v):
    # ノードに訪れた
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  # そもそもvとv2が辺でつながっていない
            continue
        if visited[v2] == True:  # もう見た
            continue
        dfs(v2)

n = II()
t = [II() for _ in range(n)]
print(LCM_LIST(t))

Submission status: Accepted

Solution code:
import fractions

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

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

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

print(X)

Submission status: Accepted

Solution code:
import fractions
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: Accepted

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)

def lcm_list(A):
	ans = A[0]
	for i in range(1, len(A)):
		ans = lcm(ans, A[i])
	return ans


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

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

Submission status: Accepted

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

def gcd_l(A):
    if len(A) == 1:
        return A[0]
    x = gcd(A[0], A[1])
    if len(A) == 2:
        return x
    for i in range(2, len(A)):
        x = gcd(x, A[i])
    return x

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

def lcm_l(A):
    A.sort()
    if len(A) == 1:
        return A[0]
    x = lcm(A[0], A[1])
    if len(A) == 2:
        return x
    for i in range(2, len(A)):
        x = lcm(x, A[i])
    return x


N = int(input())
T = [int(input()) for _ in range(N)]
T = list(set(T))
T.sort()
N = len(T)
L = []
'''
for i in range(N):
    flag = 1
    for j in range(N-1, i, -1):
        if T[j] % T[i] == 0:
            flag = 0
            break
    if flag:
        L.append(T[i])

GCD = gcd_l(L)
ans = 1
for i in range(len(L)):
    ans *= L[i] // GCD
ans *= GCD
if len(L) == 1:
    ans = L[0]
'''
ans = lcm_l(T)
print(ans)

Submission status: Accepted

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

def gcd_l(A):
    if len(A) == 1:
        return A[0]
    x = gcd(A[0], A[1])
    if len(A) == 2:
        return x
    for i in range(2, len(A)):
        x = gcd(x, A[i])
    return x

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

def lcm_l(A):
    if len(A) == 1:
        return A[0]
    x = lcm(A[0], A[1])
    if len(A) == 2:
        return x
    for i in range(2, len(A)):
        x = lcm(x, A[i])
    return x


N = int(input())
T = [int(input()) for _ in range(N)]
T = list(set(T))
T.sort()
N = len(T)
L = []
'''
for i in range(N):
    flag = 1
    for j in range(N-1, i, -1):
        if T[j] % T[i] == 0:
            flag = 0
            break
    if flag:
        L.append(T[i])

GCD = gcd_l(L)
ans = 1
for i in range(len(L)):
    ans *= L[i] // GCD
ans *= GCD
if len(L) == 1:
    ans = L[0]
'''
ans = lcm_l(T)
print(ans)

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def gcd(a, b):
    return gcd(b, a % b) if b else a


def solve():
    n = f()[0]
    a = []
    for i in range(n):
        a.append(f()[0])

    lcm = a[0]

    for i in range(1,n):
        lcm = lcm*a[i]//gcd(lcm, a[i])

    print(lcm)


solve()

Submission status: Accepted

Solution code:
from fractions import gcd

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

cd = T[0]
cm = T[0]
for t in T:
    cd = gcd(cm, t)
    cm = t * cm // cd
print(cm)

Submission status: Accepted

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)]
ans=1
for i in T:
    ans=lcm(i,ans)
print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
import fractions

def lcm_base(x, y):
    return (x * y) // fractions.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: Accepted

Solution code:
def gcd(a, b):
  v0 = a
  v1 = b
  v2 = a % b
  while v2 > 0:
    v0 = v1
    v1 = v2
    v2 = v0 %v1
  return v1

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

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

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

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

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

Submission status: Accepted

Solution code:
N = int(input())


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

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


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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())


def gcd(a, b):
    tmp_a, tmp_b = a, b
    a = max(tmp_a, tmp_b)
    b = min(tmp_a, tmp_b)
    r = a % b
    while r > 0:
        a = b
        b = r
        r = a % b
    return b
    

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


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

print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd

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

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

Submission status: Accepted

Solution code:
from functools import reduce

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


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


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

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

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

print(lcm(*l))

Submission status: Accepted

Solution code:
from functools import reduce

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

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


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

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

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

print(lcm(*l))

Submission status: Accepted

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

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


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

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

print(ans)

Submission status: Accepted

Solution code:
import fractions


def lcm(a, b):
    n = fractions.gcd(a, b)
    return a * b // n if n > 0 else 0


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: Accepted

Solution code:
from functools import reduce
from fractions import gcd
n = int(input())
t = []
for i in range(n):
    t.append(int(input()))
print(reduce(lambda x, y: x * y // gcd(x, y), t))

Submission status: Accepted

Solution code:
from fractions import gcd

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

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

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

ans = f(T[0], T[1])

for i in range(2, N):
    ans = f(ans, T[i])

print(ans)

Submission status: Accepted

Solution code:
from functools import*
from fractions import*
n,*t=map(int,open(0).read().split())
def ggcd(a,b):
    return a*b//gcd(a,b)
print(reduce(ggcd,t))

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
import functools

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

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

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

def lcm_list(*x):
  return functools.reduce(lcm, x)

print(lcm_list(*t))

Submission status: Accepted

Solution code:
import fractions
from functools import reduce
n=int(input())
t=[int(input()) for i in range(n)]
def lcm_base(x,y):
    return (x*y)//fractions.gcd(x,y)

def lcm_list(num):
    return reduce(lcm_base,num,1)
print(lcm_list(t))

Submission status: Accepted

Solution code:
n=int(input())
def gcd(m,n):
  if m<n:
    return gcd(n,m)
  if m%n==0:
    return n
  else:
    return gcd(n,m%n)
ans=int(input())
for i in range(n-1):
  t=int(input())
  d=gcd(ans,t)
  ans*=t//d
print(ans)

Submission status: Accepted

Solution code:
import fractions
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//fractions.gcd(j,k))
print(a[0])

Submission status: Accepted

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

Submission status: Accepted

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

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

def lcm(a,b):
    return a*b // GCD(a,b)
        
ans = T[0]
for i in range(1,N):
    ans = lcm(ans,T[i]) 

print(int(ans))

Submission status: Accepted

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: Accepted

Solution code:
def gcd(a,b):
    if b<a:
        x=b 
        y=a
    else:
        x=a
        y=b
    #x>y
    while x%y!=0:
        newy=x%y
        x=y
        y=newy
    return y
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: Accepted

Solution code:
import functools

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 = functools.reduce( LCM, T ) 
print( ans )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

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

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

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

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

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

result_lcm = reduce(lcm_base, t)
print(result_lcm)

Submission status: Accepted

Solution code:
import fractions
from functools import reduce
 
def lcm_base(x, y):
  return (x*y)//fractions.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: Accepted

Solution code:
import sys
import fractions
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) // fractions.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: Accepted

Solution code:
from functools import reduce

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

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

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

Submission status: Accepted

Solution code:
def gcd(x,y):
    if y==0:
        return x
    return gcd(y,x%y)
n = int(input())
res = 1
for _ in range(n):
    curr = int(input())
    res = (res*curr)//gcd(res,curr)
print(res)

Submission status: Accepted

Solution code:
# import math
from fractions import gcd
from functools import reduce

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

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

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

print(lcm(T))

Submission status: Accepted

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)


def list_lcm(number_list):
    lcm_number = 1
    for j in range(len(number_list)):
        lcm_number = lcm(lcm_number, number_list[j])

    return lcm_number


if __name__ == '__main__':
    number_count = int(input())
    numbers = []
    for i in range(number_count):
        numbers.append(int(input()))
    print(int(list_lcm(numbers)))

Submission status: Accepted

Solution code:
import fractions


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


def list_lcm(number_list):
    lcm_number = 1
    for j in range(len(number_list)):
        lcm_number = lcm(lcm_number, number_list[j])

    return lcm_number


if __name__ == '__main__':
    number_count = int(input())
    numbers = []
    for i in range(number_count):
        numbers.append(int(input()))
    print(int(list_lcm(numbers)))

Submission status: Accepted

Solution code:
import fractions
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] // fractions.gcd(ans, t[i])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
t=[int(input()) for _ in range(n)]
from fractions import gcd
from functools import reduce
def lcm_base(x,y):
    return ((x*y)//gcd(x,y))

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

print( lcm(t))

Submission status: Accepted

Solution code:
N = int(input())
def gcd(a,b):
  while(b>0):
    a,b = b,a%b
  return a

def lcm(a,b):
  G = gcd(a,b)
  L = (a*b)//G #ab = GL
  return L

for i in range(N): 
  t = int(input())
  if(i == 0): ans = t
  else: ans= lcm(ans,t)
print(ans)

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

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

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

from functools import reduce
print(reduce(lcm, Tn, 1))

Submission status: Accepted

Solution code:
import fractions
from functools import reduce
n = int(input())
t = [int(input()) for _ in range(n)]

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

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

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

print(lcm(t))

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce
n=int(input())
l=[int(input()) for i in range(n)]
def lcm(x,y):
  return x*y//gcd(x,y)
def lcm_list(numbers):
  return reduce(lcm,numbers,1)
ans=lcm_list(l)
print(ans)

Submission status: Accepted

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

n=int(input())

x=1
for i in range(n):
    c=int(input())
    x=c*x//gcd(c,x)
print(x)

Submission status: Accepted

Solution code:
N = int(input())
R = list(int(input())for _ in range(N))
def gcd(a,b):
        if a < b:
            c = b
            b = a
            a = c
        while b != 0:
            c = a % b
            a = b
            b = c
        return a
def lcm(a,b):
    c = a*b//gcd(a,b)
    return c
p = R[0]
for i in range(N):
    p = lcm(p,R[i])
print(p)

Submission status: Accepted

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())
if N == 1:
    print(input())
else:
    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: Accepted

Solution code:
n = int(input())
t = [int(input()) for _ in range(n)]
def f(a,b):
    if b==0:
        return a
    else:
        return f(b,a%b)
t = sorted(t)[::-1]
l = t[0]
for i in range(1,len(t)):
    gcd = f(l,t[i])
    l = l*t[i]//gcd
print(l)

Submission status: Accepted

Solution code:
N = int(input())
T = []
for n in range(N):
    T.append(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)


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

print(ans)

Submission status: Accepted

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

p = t[0]
for i in range(1, len(t)):
    q = t[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 = p//n * q

print(p)

Submission status: Accepted

Solution code:
from fractions import gcd

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

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

Submission status: Accepted

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


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

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
n=int(input())
t=[int(i) for i in sys.stdin]
if n==1:
  print(t[0])
  exit()
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: Accepted

Solution code:
import sys

def gcd(a, b):
    """Euclidean Algorithm"""
    while b != 0:
        a, b = b, a % b
    return a

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: Accepted

Solution code:
N = int(input())
tlist = [int(input()) for _ in range(N)]
def _gcd(x, y):
    x = abs(x)
    y = abs(y)
    while y:
        x, y =  y, x % y
    return x
def _lcm(x, y):
    x = abs(x)
    y = abs(y)
    return x * y // _gcd(x, y)
ans = 1
for t in tlist:
    ans = _lcm(ans , t)
print(ans)

Submission status: Accepted

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(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: Accepted

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

Solution code:
N = int(input())


def gcd(a, b):
    result = a
    k = 0
    n = b

    while True:
        k = result % n
        result = n
        n = k
        if k == 0:
            break

    return result


def lcm(a, b):
    g = gcd(a, b)

    return a * (b // g)


def main():
    ans = 1

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

    print(ans)
    return


main()

Submission status: Accepted

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

ans=1
for i in range(n):
  x=int(input())
  ans=ans//fractions.gcd(ans,x)*x

print(int(ans))

Submission status: Accepted

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


def gcd(a, b):
    result = a
    k = 0
    n = b

    while True:
        k = result % n
        result = n
        n = k
        if k == 0:
            break

    return result


def gcd_n(numbers):
    l = numbers[0]

    for i in range(len(numbers)):
        l = gcd(l, numbers[i])

    return l


def lcm(a, b):
    g = gcd(a, b)

    return a * (b // g)


def lcm_n(numbers):
    l = numbers[0]

    for i in range(len(numbers)):
        l = lcm(l, numbers[i])

    return l


def main():
    print(lcm_n(Tn))
    return


main()

Submission status: Accepted

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

from functools import reduce
from fractions import gcd

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

print(reduce(lcm,T))

Submission status: Accepted

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

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: Accepted

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

from functools import reduce
from fractions import gcd

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

print(reduce(lcm, T))

Submission status: Accepted

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

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

#n,m=map(int,input().split())
#print(gcd(n,m))
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
#a=list(map(int,input().split()))
m=a[0]
for i in range(1,len(a)):
    m=lcm(m,a[i])

print(m)

Submission status: Accepted

Solution code:
from fractions import gcd
n = int(input())
T = [int(input()) for i in range(n)]
G,L = T[0],T[0]
for t in T:
	G = gcd(L,t)
	L = L*t//G
print(L)

Submission status: Accepted

Solution code:
def gojoho(a,b):
    a,b=max(a,b),min(a,b)
    while a%b!=0:
        a,b=b,a%b
    return b
def main(a,b):
    return (a*b)//gojoho(a,b)
N=int(input())
T=[int(input()) for i in range(N)]
T.sort(reverse=True)
ans=T[0]
for i in range(1,N):
    ans=main(ans,T[i])
print(ans)

Submission status: Accepted

Solution code:
import fractions


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


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

print(ans)