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


N = int(input())
T = [int(input()) for _ in range(N)]
print(lcm_list(T))
# print(lcm(*T))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
from math import gcd

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

print(ans)

Submission status: Accepted

Solution code:
from math import gcd
n=int(input())
a=1
for _ in range(n):
    t=int(input())
    a=a*t//gcd(a,t)
print(a)

Submission status: Accepted

Solution code:
N = int(input())
T = [int(input()) for _ in range(N)]
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)
print(lcm(*T))

Submission status: Accepted

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

from functools import reduce
from fractions import gcd
def lcm(x,y):return x*y//gcd(x,y)
def lcmm(l):return reduce(lcm,l)
print(lcmm(T_list))

Submission status: Accepted

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

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 fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
T = [I() for _ in range(n)]
def lcm(a,b):
    g = gcd(a,b)
    return a // g * b
ans = 1
for i in range(n):
    ans = lcm(ans,T[i])
print(ans)

Submission status: Accepted

Solution code:
import sys
import math

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

n = ini()
T = [ini() for _ in range(n)]


def solve():
    a = T[0]
    for t in T[1:]:
        g = math.gcd(a, t)
        a = g * (a // g) * (t // g)
    return a


print(solve())

Submission status: Accepted

Solution code:
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N = int(input())
T = [int(input()) for _ in range(N)]
a = T[0]
for i in range(1,N):
    b = T[i]
    c = gcd(a,b)
    a = (a//c)*b
print(a)

Submission status: Accepted

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

def lcm_base(x,y):
    return (x*y)//math.gcd(x,y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list(t))

Submission status: Accepted

Solution code:
from math import gcd
import sys

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])
    sys.exit()

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

print(l)

Submission status: Accepted

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


def gcd(x, y):
    if x < y:
        t = x
        x = y
        y = t

    if y == 0:
        return x

    else:
        return gcd(y, x % y)


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

res = T[0] * T[1] // gcd(T[0], T[1])

if N > 2:
    for i in range(2, N):
        r = res * T[i] // gcd(res, T[i])
        res = max(r, res)

print(res)

Submission status: Accepted

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

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

ans = 1
n = readInt()
for j in [readInt() for i in range(n)]:
  ans = f(ans,j)

print(ans)

Submission status: Accepted

Solution code:
#最大公約数
def gcd(m,n):
    from math import gcd as g
    return g(m,n)
        
def GCD(*X):
    from functools import reduce
    return reduce(gcd,X)

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

def LCM(*X):
    from functools import reduce
    return reduce(lcm,X)


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def LCM(X,Y):
    return (X*Y)//math.gcd(X,Y)
  
N = int(input())
A = [int(input()) for T in range(0,N)]
TLCM = 1
for T in range(0,N):
    TLCM = LCM(TLCM,A[T])
print(TLCM)

Submission status: Accepted

Solution code:
from math import gcd

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

Submission status: Accepted

Solution code:
def gcd(a,b):
  x=max(a,b)
  y=min(a,b)
  while y>0:
    x=x%y
    x,y=y,x
  return x

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

Submission status: Accepted

Solution code:
import sys
from math import gcd

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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


def main():
    N, *T = map(int, read().split())

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

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys,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=list(map(int,sys.stdin.read().split()))
print(lcm_list(t))

Submission status: Accepted

Solution code:
from math import gcd
n=int(input())
lc=int(input())
for i in range(n-1):
    t=int(input())
    gc=gcd(lc,t)
    lc=(t*lc)//gc
print(lc)

Submission status: Accepted

Solution code:
def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

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

def gcd(l):
    ans = l[0]
    for i in l:  ans = gcd_(ans, i)
    return ans

def lcm_(x,y):
    return (x * y) // gcd_(x, y)

def lcm(l):
    ans = l[0]
    for i in l:  ans = lcm_(ans, i)
    return ans

N = cin()
a = [cin() for _ in range(N)]
print(lcm(a))

Submission status: Accepted

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

ans = np.lcm.reduce(t)
print(ans)

Submission status: Accepted

Solution code:
from math import gcd
N = int(input())

res = 1
for _ in range(N):
    T = int(input())
    res = res*T//gcd(res, T)

print(res)

Submission status: Accepted

Solution code:
from functools import reduce
from math import gcd
N = int(input())
T = 0
for i in range(N):
    if not T:
        T = int(input())
    else:
        t = int(input())
        T = T*t//gcd(T,t)
print(T)

Submission status: Accepted

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

# In[3]:


import math
from functools import reduce


# In[9]:


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


# In[10]:


def lcm_base(x,y):
    return (x*y)//math.gcd(x,y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


# In[11]:


print(lcm_list(T))


# In[ ]:

Submission status: Accepted

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


N = int(input())
res = int(input())
for _ in range(N - 1):
    t = int(input())
    res = res * t // gcd(res, t)
print(res)

Submission status: Accepted

Solution code:
import math

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

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

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

print(ans)

Submission status: Accepted

Solution code:
from math import gcd
N,*T = map(int, open(0).read().split())
if N == 1:
    print(T[0])
else:
    temp = (T[0]*T[1]) // gcd(T[0],T[1])
    for i in range(2,N):
        temp = (temp*T[i]) // gcd(temp,T[i])
    print(temp)

Submission status: Accepted

Solution code:
from math import gcd

n = int(input())

res = 1
for _ in range(n):
    t = int(input())
    res = res * t // gcd(res, t)

print(res)

Submission status: Accepted

Solution code:
from math import gcd
n=int(input())
l=1
for _ in range(n):
  t=int(input())
  l=l//gcd(l,t)*t
print(l)

Submission status: Accepted

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)

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

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

print(lcm(*c))

Submission status: Accepted

Solution code:
import math
import sys
n = int(input())
t = [int(input()) for _ in range(n)]
if n == 1:
  print(t[0])
  sys.exit()
elif n == 2:
  print((t[0]*t[1])//(math.gcd(t[0],t[1])))
  sys.exit()
t.sort()
ans = (t[0]*t[1])//math.gcd(t[0],t[1])
for i in range(2,n-1):
    #print((ans*t[i])//math.gcd(ans,t[i]))
    ans =((t[i]*ans)//math.gcd(t[i],ans))
print((ans*t[-1])//math.gcd(ans,t[-1]))

Submission status: Accepted

Solution code:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
from fractions  import gcd
#input=sys.stdin.readline
import bisect
n=int(input())
def lcm(a,b):
    g=gcd(a,b)
    res=g*(a//g)*(b//g)
    return res
l=int(input())
for i in range(n-1):
    ti=int(input())
    l=lcm(l,ti)
print(l)

Submission status: Accepted

Solution code:
from numpy import *
print(lcm.reduce([int(input()) for n in range(int(input()))]))

Submission status: Accepted

Solution code:
import math
N = int(input())

t1 = 1
for i in range(N):
    t2 = int(input())
    t1 = (t1 * t2) // math.gcd(t1, t2)

print(t1)

Submission status: Accepted

Solution code:

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

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

def f(tmp):
    tmp.sort(reverse=True)
    result=[]
    for i in tmp[1:]:
        if tmp[0]%i == 0:
            tmp.remove(i)
    for i in range(1,len(tmp)):
        result.append(lcm(tmp[0],tmp[i]))
    else:
        if result:
            return result
        else:
            return tmp
if __name__ == "__main__":
    n=int(input())
    t=[]
    for _ in range(n):
        t.append(int(input()))
    t.sort(reverse=True)
    if len(t)<2:
        print(t[0])
        exit(0)
    tmp=[]
    for i in range(1,n):
        tmp.append(lcm(t[0],t[i]))
    while len(tmp) > 1:
        tmp=f(tmp)
    if tmp[0] >1000000000000000000:
        print(1000000000000000000)
    else:
        print(tmp[0])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

num = 1
for i in range(int(input())):
    a = int(input())
    cnt = math.gcd(a, num)
    num = (a * num) // cnt
print(num)

Submission status: Accepted

Solution code:
import math
from functools import reduce

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

def lcm(nums):
    return reduce(lambda x, y: lcm2(x, y), nums)

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

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

print(lcm(T))

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
  t=int(input())
  l.append(t)
# print(l)

def lcm(a,b):#最小公倍数
  ori_a=a
  ori_b=b
  while b!=0:
      a,b=b,a%b
  return (ori_a*ori_b)//a
  

ans=1
for i in l:
  ans=lcm(ans,i)

print(ans)

Submission status: Accepted

Solution code:
from math import gcd

n = int(input())

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

Submission status: Accepted

Solution code:
import sys
import math

if __name__ == "__main__":
	n = int(input())
	lst = []
	for _ in range(n):
		lst.append(int(input()))
	q = lst[0]
	for x in range(1, n):
		q = (q*lst[x])//math.gcd(lst[x], q)
	print(q)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')

def lcm(x, y):
    return x * y // gcd(x, y)
def solve():
    n = int(input())
    ans = 0
    for i in range(n):
        t = int(input())
        if i:
            ans = lcm(ans, t)
        else:
            ans = t
    print(ans)
    

        
    
t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

7
3 1
4 1
5 9
2 6
5 3
5 8
9 7 5

"""

Submission status: Accepted

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

print(lcm_list(t))

Submission status: Accepted

Solution code:
from math import gcd
answer = 1
for _ in range(int(input())):
  T = int(input())
  answer = answer*T//gcd(answer,T)
print(answer)

Submission status: Accepted

Solution code:
from math import gcd
n = int(input())
ans = 1
for _ in range(n):
    t = int(input())
    ans = ans * t // gcd(ans, t)
print(ans)

Submission status: Accepted

Solution code:

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

if N==1:
    f2 = T[0]

elif N==2:
    import math
    a,b = T[0], T[1]
    f=math.gcd(a,b)
    f2=a*b//f

else:
    import math
    a,b = T[0], T[1]
    f=math.gcd(a,b)
    f2=a*b//f
    for i in range(2,N):
        a,b=f2, T[i]
        f=math.gcd(a,b)
        f2=a*b//f

print(f2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

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

def LCM(T):
    lcm = 1
    for t in T:
        lcm = lcm * t // math.gcd(t, lcm)
    return lcm

print(LCM(T))

Submission status: Accepted

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())
t = [int(input()) for _ in range(n)]
print(lcm(*t))

Submission status: Accepted

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

Solution code:
from functools import reduce
#!/usr/bin/env python3

import math


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)


def main():
    N = int(input())
    T = [int(input()) for i in range(N)]
    ans = lcm_list(T)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math


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


N = int(input())
t_li = []
for _ in range(N):
    t_li.append(int(input()))
if N > 1:
    ans = lcm(t_li[0], t_li[1])
    for i in range(2, N):
        ans = lcm(ans, t_li[i])
else:
    ans = t_li[0]
print(ans)

Submission status: Accepted

Solution code:
import math


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


def main():
    n = int(input())
    ts = [int(input()) for _ in range(n)]
    ans = 1
    for t in ts:
        ans = lcm(ans, t)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = 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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import gcd
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:
import math

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

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

print(res)

Submission status: Accepted

Solution code:
from math import gcd
n = int(input())
t = [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:
import math
N = int(input())
T = [int(input()) for _ in range(N)]

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

g = 1
for i in T:
    g = lcm(g,i)
    
print(g)

Submission status: Accepted

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

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

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

    

if len(T) > 2:
    g = lcm(T[0],T[1])
    for i in range(3,N-1):
        g = lcm(g,T[i+1])
    print(g)
elif len(T) == 2:
    g = lcm(T[0],T[1])
    print(g)
else:
    print(T[0])

Submission status: Accepted

Solution code:
import math

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

t = lis[0]

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

print(t)

Submission status: Accepted

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

Submission status: Accepted

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

def lcm_b(x, y):
    return (x * y) // math.gcd(x, y)
def lcm(L):
    return reduce(lcm_b, L, 1)

print(lcm(T))

Submission status: Accepted

Solution code:
def gcd(a, b):
    if(a == 0):
        return b
    return gcd(b % a, a)
def lcm(a, b):
    return a // gcd(a, b) * b
t = int(input())
ans = 1
while(t != 0):
    t -= 1
    n = int(input())
    ans = lcm(ans, n)
print(int(ans))

Submission status: Accepted

Solution code:
def gcd(a,b):
    while b > 0:
        a, b = b, a % b
    return a
    
n = int(input())
s = 1
for i in range(n):
    x = int(input())
    s = s // gcd(s, x) * x
print(int(s))

Submission status: Accepted

Solution code:
def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
n = int(input())
res = int(input())
while n > 1:
	x = int(input())
	res = (res * x) // gcd(res, x);
	n -= 1
print(res)

Submission status: Accepted

Solution code:
import math
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())
if N == 1:
    print(int(input()))
else:
    ans = int(input())
    for i in range(N-1):
        J = int(input())
        ans = lcm(ans,J)
    print(ans)

Submission status: Accepted

Solution code:
import sys
from fractions import gcd
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

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

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(lcm_list(l))

Submission status: Accepted

Solution code:
import math
n = int(input())
t = [int(input()) for _ in range(n)]
ans = t[0]
for i in range(n-1):
    ch = math.gcd(t[i+1],ans)
    ans = ans*t[i+1]//ch
print(ans)

Submission status: Accepted

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

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

print(a)

Submission status: Accepted

Solution code:

import sys
import numpy as np

n = int(sys.stdin.readline())
t = [int(sys.stdin.readline()) for _ in range(n)]

print(np.lcm.reduce(t))

Submission status: Accepted

Solution code:

import numpy

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

print(numpy.lcm.reduce(t))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from functools import reduce
from math import gcd

n, *t = map(int, open(0).read().split())
t.sort()
print(reduce(lambda a, b: a * b // gcd(a, b), t))

Submission status: Accepted

Solution code:
from math import gcd
N=int(input())
ans=int(input())
for i in range(N-1):
  t=int(input())
  ans=ans*t//gcd(ans, t)
  
print(ans)

Submission status: Accepted

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

lcm = LCM_list(T)
print(lcm)

Submission status: Accepted

Solution code:
import math
N = int(input())

res = int(input())

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

Submission status: Accepted

Solution code:
import bisect,copy,heapq,string
from collections import *
from math import *
from itertools import *
import sys
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
t = [INT() for i in range(n)]
ans = t[0]

for x in t:
        ans = ans*x//gcd(ans, x)
print(ans)

Submission status: Accepted

Solution code:
import math
N,A,*T=map(int,open(0))
for t in T:
    A*=t//math.gcd(A,t)
print(A)

Submission status: Accepted

Solution code:
from math import*
N=int(input())
ans=int(input())
for _ in range(N-1):
    t=int(input())
    ans=ans*t//gcd(ans,t)
print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
from math import gcd
def main():
    n = int(input())
    t = [int(input()) for _ in range(n)]
    if n == 1:
        print(t[0])
        sys.exit()
    r = (t[0] * t[1]) // gcd(t[0], t[1])
    if n == 2:
        print(r)
        sys.exit()
    for i1 in range(2, n):
        r = (r * t[i1]) // gcd(r, t[i1])
    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import math
from functools import reduce


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


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


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

Submission status: Accepted

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)

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

Submission status: Accepted

Solution code:
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=[I() for i in range(n)]
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a // gcd(a, b) * b
x=lis[0]
for i in range(n-1):
    y=lis[i+1]
    x=lcm(x,y)
print(x)

Submission status: Accepted

Solution code:
import numpy

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

ans = 1
for ti in T:
    ans = numpy.lcm(ans, ti)

print(ans)

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 fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
g = 1
lcm = 1
A = [I() for _ in range(n)]
for a in A:
    g = gcd(lcm,a)
    lcm = lcm*a//g
print(lcm)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

ans = t[0]

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

print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
t = [int(input()) for _ in range(n)]
if n == 1:
    print(t[0])
    exit()
a = t[0]*t[1]//math.gcd(t[0],t[1])
for i in range(2, n):
    a = t[i]*a//math.gcd(t[i],a)
print(a)

Submission status: Accepted

Solution code:
import math
def lcm(a, b):
  return abs(a*b) // math.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 math
N = int(input())
T = [int(input()) for _ in range(N)]

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

ans = 1

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

print(ans)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
lst = []
for i in range(n):
  lst.append(int(input()))
res = 1
for i in range(n):
  res = np.lcm(res, lst[i])
print(res)

Submission status: Accepted

Solution code:
from math import gcd

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

def lcm(t):
    x = t[0]
    for i in range(1, len(t)):
        x = (x * t[i]) // gcd(x, t[i])
    return x

print(lcm(t))

Submission status: Accepted

Solution code:
from math import gcd
n = int(input())
t = [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)