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:
def gcd(x,y):
    if y==0: return x
    return gcd(y,x%y)

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

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

Submission status: Accepted

Solution code:
import fractions

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

n=int(input())
ans=0
ans=int(input())
if n==1:
    print(ans)
    exit()

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

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

def lcm(a, b):
	return a*b//gcd(a, b)
	
def lcm_n(num):
	value = num[0]
	for item in num[1:]:
		value = lcm(value, item)
	return value

n = int(input())
t_list = [int(input()) for i in range(n)]
t_list = list(set(t_list))
targets = []
for t in t_list:
	flag = True
	for t2 in t_list:
		if t != t2 and t2 % t == 0:
			flag = False
			break
	if flag:
		targets.append(t)
print(lcm_n(targets))

Submission status: Accepted

Solution code:
import numpy as np
n=int(input())
a = list( int(input()) for _ in range(n))
#print(np.lcm.reduce(a1))
ans = 1
from fractions import gcd
for ai in a:
    ans = ans*ai//gcd(ans,ai)
print(ans)

Submission status: Accepted

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

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)


print(lcm_list(t))

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict(list)
#import bisect
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    from fractions import gcd
    n = int(input())
    ans = 1
    for i in range(n):
        t = int(input())
        ans = ans * t // gcd(ans,t)
    print(ans)
if __name__ == '__main__':
  main()

Submission status: Accepted

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

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

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
t=[]
for _ in range(n):
  t.append(int(input()))
import fractions
# 最小公倍数
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

# n個の数字の最小公倍数
import functools
def lcmn(nums):
        return functools.reduce(lcm, nums)
print(lcmn(t))

Submission status: Accepted

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

import fractions
#最小公倍数
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:
def gcd(x, y):
  while(x % y != 0 and y % x != 0):
    if(x > y):
      x = x % y
    else:
      y = y % x
  if(x > y):
    return y
  else:
    return x
  
N = int(input())
A = list()
for i in range(N):
  A.append(int(input()))

ans = 1
for i in range(N):
  gcd_i = gcd(A[i], ans)
  ans = A[i] * ans // gcd_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, 1)


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

print(lcm(*T))

Submission status: Accepted

Solution code:
import fractions

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

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

Submission status: Accepted

Solution code:
from fractions import gcd
n = int(input())
t = list(int(input()) for _ in range(n))
ans = t[0]
for i in range(1, n):
    ans = ans*t[i] // gcd(ans, t[i])
print(ans)

Submission status: Accepted

Solution code:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
# from math import gcd
from fractions import gcd
from functools import reduce
from pprint import pprint

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

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

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

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

ans = lcm_list(t)
print(ans)

Submission status: Accepted

Solution code:
def gcd(a,b):
    return gcd(b,a % b) if b else abs(a)
def lcm(a,b):
    return (a*b) // gcd(a,b)
n = int(input())
t = []
for i in range(n):
    a = int(input())
    t.append(a)
b = t[0]
for i in range(1,n):
    b = lcm(b,t[i])
print(b)

Submission status: Accepted

Solution code:
# from scipy.sparse import csr_matrix
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    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))


resolve()

Submission status: Accepted

Solution code:
import sys
import fractions

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

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

N = ir()
start = ir()
next = 0
for n in range(1, N):
    next = ir()
    start = lcm(start, next)

print(start)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce
n, *T = map(int, open(0).read().split())
print(reduce(lambda x, y:x*y//gcd(x, y), T))

Submission status: Accepted

Solution code:
n = int(input())
t = [int(input())for _ in range(n)]
def gcd(x,y):
    if x%y == 0:return y
    return gcd(y%x,x)
def lcm(x,y):
    return (x*y)//gcd(x,y)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

ans =1
for i in range(n):
  a = int(input())
  ans = lcm_base(ans,a)
print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

import fractions as math

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

def solve():
    n = II()
    T = [II() for _ in range(n)]

    t1 = T[0]
    l = t1
    for t2 in T[1:]:
        l = lcm(t1, t2)
        t1 = l
    print(l)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
from fractions import gcd


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


if __name__ == "__main__":
    n = int(input())
    t = list()
    for i in range(n):
        t.append(int(input()))

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

    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fractions

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

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

Submission status: Accepted

Solution code:
import sys

def gcd(a, b): return gcd(b, a % b) if b else abs(a)
def lcm(a, b): return abs(a // gcd(a, b) * b)

n, *t = map(int, sys.stdin.read().split())

def main():
    res = 1
    for x in t:
        res = lcm(res, x)
    print(res)

if __name__ ==  '__main__':
    main()

Submission status: Accepted

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

print(S_t)

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

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

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

print(lcm_list(list_T))

Submission status: Accepted

Solution code:
import fractions

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

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

Submission status: Accepted

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

a=T[0]
for i in range(N):
  a=a*T[i]//fractions.gcd(a,T[i])
print(a)

Submission status: Accepted

Solution code:
import fractions
def sks(a,b):
    return (a*b)//fractions.gcd(a,b)
c=int(input())
result=1
for a in range(c):
    result=sks(result,int(input()))
print(result)

Submission status: Accepted

Solution code:
#最大公約数
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


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


n = int(input())
T = list(int(input()) for _ in range(n))

res = T[0]
for i in range(1, n):
    res = lcm(res, T[i])
print(res)

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""


def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7
def gcd(a,b):
  if b == 0:
    return a
  return gcd(b, a % b)
def lcm(a,b):
  g = gcd(a,b)
  return (a * b) // g
def main():
  n = int(input())
  ans = 1
  for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
  print(ans)
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
n = int(input())
tn = [None] * n
for i in range(n):
    tn[i] = (int(input()))

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

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


result = 1
for t in tn:
    result = lcm(result, t)
2

print(result)

Submission status: Accepted

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

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

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

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

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

def main():
  n=I()
  ans=1
  for _ in range(n):
    ans=lcm(ans,I())

  return ans

# main()
print(main())

Submission status: Accepted

Solution code:
import numpy as np
from fractions import gcd

def lcm(x, y):
    return (x*y) // gcd(x, y)
ufunc = np.frompyfunc(lcm,2,1)

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

ans = ufunc.reduce(t)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

#最大公約数
def gcd(a, b):
    while b!=0:
        a,b=b,a%b
    return a

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

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

print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
n,*t=map(int,open(0).read().split())
ans=t[0]
for i in range(1,n):
  ans=ans*t[i]//gcd(ans,t[i])
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t = sorted([int(input()) for _ in range(n)],reverse = True)
def c_mul(x,y):
  d = x
  e = y
  while y%x != 0:
    z = y%x
    y = x
    x = z
  else:
    return d*e//x
for i in range(1,n):
  a = c_mul(t[0],t[i])
  if a != t[0]:
    t[0] = a
print(t[0])

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest
import fractions
import math
from functools import reduce

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


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


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

    print(lcm_list(t))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2
2
3"""
        output = """6"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """5
2
5
10
1000000000000000000
1000000000000000000"""
        output = """1000000000000000000"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

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

def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g

def lcm_core(a,b):
    g = gcd_core(a,b)
    return (a*b)//g

def lcm(arr):
    l = lcm_core(arr[0],arr[1])
    for i in range(2,len(arr)):
        l = lcm_core(l,arr[i])
    return l

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

Submission status: Accepted

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

#　素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

#最小公倍数
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

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

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


# ここから書き始める
n = int(input())
t = [0] * n
for i in range(n):
    t[i] = int(input())
ans = lcm(*t)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T = [int(input()) for i in range(N)]
def gcd(x,y):
    if x<y:x,y = y,x
    if y==0:return x
    return gcd(y,x%y)
S = T[0]
for i in range(1,N):
    S = S*T[i]//gcd(S,T[i])
print(S)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

n = int(input())

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

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

t = set()
for _ in range(n):
    t.add(int(input()))

print(lcm_list(t))

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
N=int(input())
T=[]
for i in range(N):
    Ti=int(input())
    T.append(Ti)
print(lcm_list(T))

Submission status: Accepted

Solution code:
from fractions import gcd


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

Submission status: Accepted

Solution code:
from fractions import gcd
n = int(input())
res = int(input())
for i in range(n-1):
  w = int(input())
  res = res * w // gcd(res, w)
print(res)

Submission status: Accepted

Solution code:
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

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

print(lcm(t))

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
from functools import reduce

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

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(l):
    return reduce(lcm, l, 1)

N = i_i()
T = [i_i() for _ in range(N)]

print(lcm_list(T))

Submission status: Accepted

Solution code:
import fractions
def multi_lcm(a):
    ans = a[0]
    for i in range(1, len(a)):
        ans = ans * a[i] // fractions.gcd(ans, a[i])
    return ans

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

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    import sys
    sys.setrecursionlimit(10000000)
    from decimal import Decimal
    N = int(input())
    T_list = [int(input()) for _ in range(N)]

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

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

    res = 1
    for i in T_list:
        res = lcm(res, i)
        # print(res, i)

    print(res)

if __name__ == "__main__":
    resolve()

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

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

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
def lcm(x,y):return x*y//gcd(x,y)

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

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

Submission status: Accepted

Solution code:
import fractions
from functools import reduce
def lcm_base(x,y):
    return (x*y) // fractions.gcd(x,y)

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

g = reduce(lcm_base,li,1)
print(g)

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

def gcd(a, b):
    while b != 0:
        a, b = b, a % b

    return a

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


ans = 1
for a in A:
    ans = lcm(ans, a)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fractions
# import math


N = int(input())

ARR = []

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

def calculate(arr):
    arr = sorted(arr)
    s = arr[0]
    for i, ar in enumerate(arr):
        if i == 0:
            continue
        else:
            s = zuixiaogongbeishuAtcoder(s,ar)

    print(s)


def zuixiaogongbeishuAtcoder(a, b):
    f = fractions.gcd(a, b)
    res = a * b // f
    return res

#
# def zuixiaogongbeishu(a, b):
#     f = math.gcd(a, b)
#     res = (a * b) // f
#     return res


calculate(ARR)

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

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

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

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

print(lcm_list(lst))

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce
N = int(input())
T = [int(input()) for _ in range(N)]
ans = 0
def lcm_base(x, y):
    return (x * y) // 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: Accepted

Solution code:
from fractions import gcd


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

print(lcm)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(input()) for i in range(n)]
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

print(lcm(a))

Submission status: Accepted

Solution code:
# ==================== gcd   最大公約数
from fractions import gcd

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


n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))
             
if n==1:
    print(t[0])
else:
    tlcm=t[0]
    for i in range(1,n):
        tlcm=lcm(tlcm,t[i])
    print(tlcm)

Submission status: Accepted

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

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

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

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

print(ans)

Submission status: Accepted

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

ans=t[0]

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

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

Submission status: Accepted

Solution code:
n=int(input())
t=[int(input()) for _ in range(n)]
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

print(lcm(t))

Submission status: Accepted

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

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

print(a)

Submission status: Accepted

Solution code:
def gcd(p, q):
    if p < q:
        p, q = q, p
    while q > 0:
        p, q = q, p%q
    return p

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

Submission status: Accepted

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

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)


print(lcm_list(T_arr))

Submission status: Accepted

Solution code:
from fractions import gcd 

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

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

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

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd

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

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

print(reduce(multOverGcd,Tn))

Submission status: Accepted

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

def lcm(a,b):
    return a*b//gcd(a,b)
ans=1
for i in range(n):
    t=int(input())
    ans=lcm(ans,t)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t = [int(input()) for _ 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)

time = t[0]
for i in range(1, n):
    time = lcm(max(time,t[i]),min(time,t[i]))
print(time)

Submission status: Accepted

Solution code:
n=int(input())

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

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

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

Submission status: Accepted

Solution code:
n=int(input())
'''
if n==1:
    print(input())
    quit()
 '''   
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)

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

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

Submission status: Accepted

Solution code:
n=int(input())

if n==1:
    print(input())
    quit()
    
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def gcd(a, b):
    # a,bの最大公約数D
    while b:
        a, b = b, a % b
    return a


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


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

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

    print(result)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd
def main():
    n = int(input())
    m = int(input())
    for _ in range(n-1):
        t = int(input())
        m = m*t//gcd(m,t)

    print(m)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#最大公約数
from functools import reduce

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

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

print(reduce(func, T))

Submission status: Accepted

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