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

Solution (Python):
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)

Solution (Python):
from functools import reduce


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

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

Solution (Python):
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)

Solution (Python):
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()

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

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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))

Solution (Python):
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))

Solution (Python):
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))

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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()

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):

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

Solution (Python):

import numpy

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

print(numpy.lcm.reduce(t))

Solution (Python):

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

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

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

Solution (Python):
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)

Solution (Python):
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()

Solution (Python):
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)

Solution (Python):

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

Solution (Python):
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))

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

Solution (Python):
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)

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate 

from collections import deque,defaultdict,Counter
import decimal
import re











import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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))

Solution (Python):
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)

Solution (Python):





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    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 power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod



def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


inf = 10 ** 18
mod = 10 ** 9 + 7

n = ir()
t = [ir() for i in range(n)]
import fractions
ans = 1
for num in t:
    f=fractions.gcd(ans,num)           
    ans=(ans*num//f)                   
print(ans)

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

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

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

if n==1:
    print(t[0])
    exit()

for i in range(n-1):
    if i==0:
        lcm=(t[i]*t[i+1])//math.gcd(t[i],t[i+1])
    else:
        lcm=(lcm*t[i+1])//math.gcd(lcm,t[i+1])
print(lcm)

Solution (Python):
import math
def lcm(l: list):
    n=len(l)
    lcm=(l[0]*l[1])//math.gcd(l[0],l[1])
    for i in range(2,n):
        lcm=(l[i]*lcm)//math.gcd(l[i],lcm)

    return lcm

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

if n==1:
    print(t[0])
else:
    print(lcm(t))

Solution (Python):
"""
すべての秒数の最小公倍数を求める
Gを最大公約数として持つX,Yの最小公倍数はG*X/G*Y/G
"""
def gcd(a,b):
    return a if b==0 else gcd(b,a%b)
N = int(input())
T = [int(input()) for _ in range(N)]
tmp = T[0]
for i in range(1,N):
    t = T[i]
    g = gcd(tmp,t)
    tmp = g*(tmp//g)*(t//g)
print(tmp)

Solution (Python):
import math
n,*t = map(int,open(0).read().split())
def lcm(a,b):
  return a*b//math.gcd(a,b)
if n == 1:
  print(t[0])
else:
  ans = lcm(t[0],t[1])
  for i in range(2,n):
    ans = lcm(ans,t[i])
  print(ans)

Solution (Python):
N=int(input())
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)
ans=1
for _ in range(N):
  T=int(input())
  ans=lcm(ans,T)
print(ans)

Solution (Python):
import math

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

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

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

ans = t[0]

for i in t:
    ans = lcm(ans, i)

print(ans)

Solution (Python):
from math import gcd

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

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

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

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

Solution (Python):

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


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

ans = nums[0]
for num in nums:
    ans = ans * num // gcd(ans, num)
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**9) 
input = sys.stdin.readline
def gdc(a, b):
    if b == 0:
        return a
    return gdc(b, a%b)
def lcm(a,b):
    return a*b//gdc(a,b)

def main():
    N = int(input())
    T = [int(input()) for i in range(N)]
    if N == 1:
        return print(T[0])
    ans = lcm(max(T[0], T[1]), min(T[0], T[1]))
    if N == 2:
        print(ans)
        return
    for i in range(2,N):
        ans = lcm(max(ans, T[i]), min(ans, T[i]))
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import math
from functools import reduce
numbers = [int(input()) for i in range(int(input()))]
x = reduce(lambda x,y:(x * y) // math.gcd(x, y), numbers, 1)
print(x)

Solution (Python):

"""
Created on Mon Jun 22 22:26:22 2020

@author: NEC-PCuser
"""
import math

N = int(input())

li = []
ans = 1
for i in range(N):
    t = int(input())
    ans = (ans * t) // math.gcd(ans, t)

print(ans)

Solution (Python):
import math
N=int(input())
g=int(input())
for _ in range(N-1):
  T=int(input())
  g=g*T//math.gcd(g,T)
print(g)

Solution (Python):
import math

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

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

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

print(ans)

Solution (Python):
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())
ans = 1
for i in range(N):
    t = int(input())
    ans = lcm(ans, t)
print(ans)

Solution (Python):
import math
N = int(input())
P = [int(input()) for _ in range(N)]

a = 1
for p in P:
  g = math.gcd(a,p)
  a = a * p // g

print(a)

Solution (Python):
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())
time = []

for i in range(N):
    a = int(input())
    time.append(a)

print(lcm(*time))

Solution (Python):
from functools import reduce
import math
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
t = IR(n)


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


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


ans = lcm_list(t)
print(ans)

Solution (Python):
import numpy as np
n = int(input())
T = [int(input()) for i in range(n)]

print(np.lcm.reduce(T))

Solution (Python):
from fractions import gcd
from functools import reduce
n=int(input())
g=1
for i in range(n):
  t=int(input())
  g=g*t//gcd(g,t)
print(g)

Solution (Python):
def gcd(a,b):
	a,b=max(a,b),min(a,b)
	return a if b==0 else gcd(b,a%b)
def lcm(a,b):
	g=gcd(a,b)
	return a*b//g
n=int(input())
t=[int(input()) for _ in range(n)]
t=list(set(t))
l=t[0]
for i in t[1:]:
	l=lcm(l,i)
print(l)

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

n=int(input())
a=[]
temp=int(input())
a.append(temp)
g=temp

for _ in range(n-1): 
    temp=int(input())
    a.append(temp)
    gc=gcd(max(g,temp),min(g,temp))
    g=g*(temp//gc)

print(g)

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

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

print(ans)

Solution (Python):
n = int(input())
a = [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)

if len(a) ==0:
  print(a[0])
  exit()
else:
  a1 = a[0]
  for i in a:
    a2 = lcm(a1,i)
    a1 = a2
print(a2)

Solution (Python):

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)

Solution (Python):
import fractions
N = int(input())
ans = int(input())

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

Solution (Python):
import fractions

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


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

ans=1

if N==1:
    print(S[0])
    exit()
elif N==2:
    ans=koubaisu(S[0],S[1])
    print(ans)
    exit()
elif N>2:
    ans=koubaisu(S[0],S[1])
    for i in range(N-2):
        ans=koubaisu(ans,S[i+2])

print(ans)

Solution (Python):
import fractions

n = int(input())
lcm = 1

for i in range(n):
    t = int(input())
    lcm = lcm*t//fractions.gcd(lcm, t)

print(lcm)

Solution (Python):
from fractions import gcd
a = 1

for n in range(int(input())):
  T = int(input())
  a = a*T//gcd(a,T)

print(a)

Solution (Python):
def main():
    import fractions
    n = int(input())
    inlis = []
    for _ in range(n):
        a = int(input())
        inlis.append(a)
    
    ans = inlis[0]
    for i in range(1, n):
        ans = ans * inlis[i] // fractions.gcd(ans, inlis[i])

    print(ans)

    
    
if __name__ == "__main__":
    main()

Solution (Python):
from fractions import gcd

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


for i in range(n):
    num = t[i]
    result = result * num // gcd(result, num)

print(result)

Solution (Python):
import fractions

N = int(input())
a = int(input())

for _ in range(N-1):
  b = int(input())
  c = fractions.gcd(a,b)
  d = a // c
  e = b // c
  a = d*e*c
  
print(a)

Solution (Python):



from fractions import gcd














import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

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)

Solution (Python):
import sys
import fractions

def input(): return sys.stdin.readline().strip()
def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N = Z()
    T = [Z() for _ in range(N)]
    ans = T[0]
    for i in range(1, N):
        g = fractions.gcd(ans, T[i])
        ans *= T[i]
        ans //= g
    print(ans)

    return

if __name__ == '__main__':
    main()

Solution (Python):
from functools import reduce
n = int(input())
ts = [int(input())for _ in range(n)]


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


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


print(reduce(lcm, ts))

Solution (Python):
import fractions


def main():
    N = int(input())
    gcd = int(input())
    lcm = gcd
    for _ in range(N-1):
        curr_t = int(input())
        gcd = fractions.gcd(lcm, curr_t)
        lcm = (lcm*curr_t)//gcd
    print(lcm)


if __name__ == "__main__":
    main()

Solution (Python):
def lcm(a, b): 
    if a<b:
        a,b = b,a
    x = a*b
    r = a%b
    while r != 0:
        a = b
        b = r
        r = a % b
    return x//b
n = int(input())
t = [0]*n
for i in range(n):
    t[i] = int(input())
ans = t[0]
for i in range(1,n):
    ans = lcm(ans,t[i])
print(ans)

Solution (Python):
import sys

def I(): return int(sys.stdin.readline().rstrip())

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

from fractions import gcd

ans = T[0]
for i in range(N-1):
    ans = (ans*T[i+1])//gcd(ans,T[i+1])

print(ans)

Solution (Python):
n = int(input())
p = 1

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


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

Solution (Python):
from fractions import gcd
from functools import reduce


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


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

print(reduce(lcm, T))

Solution (Python):
import sys
from fractions import gcd

read = sys.stdin.buffer.read

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

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

Solution (Python):
N = int(input())
T = [int(input()) for _ 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))

Solution (Python):
import fractions

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

gcdd = 1

for i in range(N):
    num = times[i]
    gcdd = gcdd * num // (fractions.gcd(gcdd, num))


print(gcdd)

Solution (Python):
import fractions
N = int(input())
lst = []
for _ in range(N):
    lst.append(int(input()))

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

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

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

Solution (Python):
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())
print(lcm_list([int(input()) for _ in range(n)]))

Solution (Python):
from fractions import gcd
from functools import reduce


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


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

print(reduce(lcm, T))

Solution (Python):
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction



mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
n=l()[0]
LCM=1
for i  in range(n):
    t=int(input())
    g=gcd(LCM,t)
    LCM=(LCM*t)//g
print(LCM)

Solution (Python):
import fractions
from functools import reduce

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

def lcm_for_lst(lst):
  return reduce(lcm, lst)

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

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

Solution (Python):
import sys
from fractions import gcd

input = sys.stdin.readline


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


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

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

    print(ans)


if __name__ == "__main__":
    main()

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

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


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

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

Solution (Python):
import math
import fractions


import sys
import itertools
input = sys.stdin.readline
 
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n = I()
def main():
    for i in range(n):
        temp = I()
        try:
            past = temp * past // fractions.gcd(temp, past)
        except:
            past = temp
    print(past)
    
main()

Solution (Python):
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)
n=int(input())
t=[int(input()) for _  in range(n)]
print(lcmm(t))

Solution (Python):
import fractions
n=int(input())
lcm=1
for i in range(n):
    p=int(input())
    lcm=(p*lcm//fractions.gcd(p,lcm))
print(lcm)

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

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

print(lcm_list(T))

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

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

import fractions
n = t[0]
for a,b in zip(t, t[1:]):
    g = fractions.gcd(n, b)
    n = n*b//g
print(n)

Solution (Python):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
import fractions
from functools import reduce

rr = lambda: sys.stdin.buffer.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

n = ri()
li = [ri() for _ in range(n)]
ans = 1
for i in li:
  a = fractions.gcd(i, ans)
  ans = ans * i // a
print(ans)

Solution (Python):
n=int(input())

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

t=1

for _ in range(n):
    t_i = int(input())

    t = lcm(t,t_i)

print(t)

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

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

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

print(ans)

Solution (Python):
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))