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 sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

    ans = 1
    for elem in t:
        ans = (ans * elem) // gcd(ans, elem)

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import fractions

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

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

print(ans)

Submission status: Accepted

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
    
ans = functools.reduce(lcm, t)
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd

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

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

ans = 1
for num in rows:
    ans = lcm(ans,num)

print(ans)

Submission status: Accepted

Solution code:
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy

# import heapq
# from collections import deque
# import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    n = ni()
    t=[]
    for _ in range(n):
        t.append(ni())


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

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

    print(lcm_list(t))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import fractions #昔はfractions

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

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

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce
def lcm(a, b):
    return a * b // gcd(a, b)
N = int(input())
print(reduce(lcm, tuple(int(input()) for _ in range(N))))

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

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

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

print(lcm(T))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
N=int(input())
T=[int(input()) for i in range(N)]
def lcm(a,b):
    return a*b//gcd(a,b)
ans=1
for i in T:
    ans=lcm(ans,i)
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 # (string,3) 3回
from collections import deque
from collections import defaultdict
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

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

def main():
    n = int(input())
    T = [int(input()) for _ in range(n)]
    g = 0
    lcm = 1
    for i in range(n):
        g = gcd(lcm,T[i])
        #print(g)
        lcm = lcm // g * T[i]
    #print(g)
    print(lcm)
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
def gcd(x,y):
  while y:
    x,y=y,x%y
  return x
def lcm(x,y):
  return x*y//gcd(x,y)

from functools import reduce

n,*a=map(int,open(0).read().split())

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

Submission status: Accepted

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

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

print(l)

Submission status: Accepted

Solution code:
n = int(input())
lcmn = 1
def gcd(a, b):
    while b!=0:
        a, b = b, a%b
    return a
def lcm(a, b):
    return a*b//gcd(a, b)
for _ in range(n):
    t = int(input())
    lcmn = lcm(lcmn, t)
print(lcmn)

Submission status: Accepted

Solution code:
from fractions import gcd

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

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import fractions
import functools

N = int(sys.stdin.readline().rstrip())
T = []
for _ in range(N):
    T.append(int(sys.stdin.readline().rstrip()))

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

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

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

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

Submission status: Accepted

Solution code:
import fractions
def main():
    N = int(input())
    CLK = [int(input()) for i in range(N)]
    gcd = CLK[0]
    lcm = CLK[0]

    for i in range(1, N):
        gcd = fractions.gcd(gcd, CLK[i])
        lcm = (lcm * CLK[i])//gcd
        gcd = lcm

    print(int(lcm))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

N = int(input())
# S = input()
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
mod = 10 ** 9
from functools import reduce
from fractions import gcd

def main():
    T = sorted(list(set([int(input()) for _ in range(N)])))
    if len(T) == 1:
        print(T[0])
        exit()
    ans = (T[0] * T[1]) // gcd(T[0], T[1])
    for i in range(len(T) - 2):
        ans = (ans * T[i + 2]) // (gcd(ans, T[i + 2]))
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N = INT()
T = [INT() for _ in range(N)]

ans = 1

for i in T:
	ans = ans*i//gcd(i, ans)

print(ans)

Submission status: Accepted

Solution code:
import fractions

from sys import stdin


def main():
    n = int(stdin.readline())
    t = [int(stdin.readline()) for _ in range(n)]
    dp = [0 for _ in range(n)]
    dp[0] = t[0]
    for i in range(1, n):
        dp[i] = t[i] * dp[i-1] // fractions.gcd(t[i], dp[i-1])
    print(dp[-1])


if __name__ == "__main__":
    main()

Submission status: Accepted

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


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


ans = t[0]
for x in t[1:]:
  ans = ans * x // gcd(ans, x)
print(ans)

Submission status: Accepted

Solution code:
def gcd(a, b):
	"""Compute the greatest common divisor of a and b"""
	while b > 0:
		a, b = b, a % b
	return a

def lcm(a, b):
	"""Compute the lowest common multiple of a and b"""
	return a * b // gcd(a, b)

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

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

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

def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
n = int(input())
T = [int(input()) for i in range(n)]
a = T[0]
for i in range(1,n):
    a = lcm(a,T[i])
print(a)

Submission status: Accepted

Solution code:
def gcd(a, b):
	"""Compute the greatest common divisor of a and b"""
	while b > 0:
		a, b = b, a % b
	return a

def lcm(a, b):
	"""Compute the lowest common multiple of a and b"""
	return a * b // gcd(a, b)

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    N = int(readline())
    ans = 1
    for _ in range(N):
        t = int(readline())
        ans = (ans * t) // gcd(ans, t)
    
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

def main():
    N = int(readline())
    ans = 1
    for _ in range(N):
        t = int(readline())
        ans = lcm_base(ans, t)
    
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def gcd(a, b):
	"""Compute the greatest common divisor of a and b"""
	while b > 0:
		a, b = b, a % b
	return a

def lcm(a, b):
	"""Compute the lowest common multiple of a and b"""
	return a * b // gcd(a, b)

def resolve():
	n = int(input())
	T = []
	for _ in range(n):
		T.append(int(input()))
	ans = 1
	for i in range(n):
		ans = lcm(ans, T[i])
	print(int(ans))
resolve()

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd


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


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N = int(input())
l = []
for i in range(N):
    t = int(input())
    l.append(t)

# 最大公約数と最小公倍数
def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)

def multiple(a, b):
    return a*b // euclid(a, b)

import functools

# N個の最小公倍数
# euclidとmultipleが必要

def lcm(nums):
        return functools.reduce(multiple, nums)

print(lcm(l))

Submission status: Accepted

Solution code:
import fractions

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

Submission status: Accepted

Solution code:
import fractions

N = int(input())

res = int(input())
for _ in range(N - 1):
    t = int(input())
    g = fractions.gcd(res, t)
    if t >= res:
        res = res * (t // g)
    else:
        res = (res // g) * t

print(res)

Submission status: Accepted

Solution code:
def gcd(a,b):
    r=1
    while r!=0:
        r=a%b
        a=b
        b=r
    return a
def lcm(a,b):
    ans = a*b//gcd(a,b)
    return ans
ans=1
n = int(input())
t = [int(input()) for i in range(n)]
t1 = list(set(t))
n1 = len(t1)
for i in range(n1):
    ans = lcm(ans,t1[i])
print(ans)

Submission status: Accepted

Solution code:
def gcd(a, b):
    big = max(a, b)
    small = min(a, b)
    
    r = small
    while small != 0:
        r = big % small
        big = small
        small = r
    
    return big

def main():
    n, *t = map(int, open(0).read().split())
    
    r = t[0]
    for i in range(1, n):
        num = gcd(r, t[i])
        r = num * (r // num) * (t[i] // num)
        
    print(r)

if __name__ == '__main__':
    main()

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 = [int(input()) for _ in range(N)]

print(lcm(T))

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 = [int(input()) for i in range(N)]

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

print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd

def main():
    N=int(input())
    T=[int(input()) for i in range(N)]
    
    a=1
    for i in T:
        a=a*i//gcd(a,i)
    
    print(a)

if __name__=="__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from fractions import gcd

def nlcm(t):
    res = 1
    for a in t:
        res *= a // gcd(a,res)
    return res

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

print(nlcm(T))

Submission status: Accepted

Solution code:
def gcd(a, b):
    a, b = max([a, b]), min([a, b])
    if b == 0:
        return a
    return gcd(b, a % b)
N = int(input())
current_lcm = None
for _ in range(N):
    t = int(input())
    if current_lcm is None:
        current_lcm = t
        continue
    current_lcm = current_lcm * t // gcd(current_lcm, t)
print(current_lcm)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())
ans = 1

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

print(ans)

Submission status: Accepted

Solution code:
import fractions
A = int(input())
ans = int(input())
for i in range(A-1):
    B = int(input())
    ans = B * ans // fractions.gcd(ans,B)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
List = [int(input()) for i in range(n)]
#print(List)

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

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce


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


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


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

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce
import sys

lcm = lambda x, y : x*y // gcd(x, y)
N, *T = map(int, sys.stdin.read().split())
ans = reduce(lcm, T)
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd

n = int(input())


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


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

print(ans)

Submission status: Accepted

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

N = int(input())
ans = 1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from fractions import gcd

n = int(readline())
t = [int(readline()) for _ in range(n)]
ans = t[0]
for tt in t:
    ans = ans * tt // gcd(ans, tt)
print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
N = int(input())
tn = [int(input()) for _ in range(N)]


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


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


print(lcm_list(tn))

Submission status: Accepted

Solution code:
def euclid(m, n):
    m0 = m = abs(m)
    n0 = n = abs(n)
    while n != 0:
        m, n = n, m % n
    qm = m0 // m
    lcm = qm * n0
    return lcm

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

Submission status: Accepted

Solution code:
def euclid(m, n):
    m0 = m = abs(m)
    n0 = n = abs(n)
    while n != 0:
        m, n = n, m % n
    qm = m0 // m
    lcm = qm * n0
    return lcm

# ABC070C
n = int(input())
t = [0] * n
for i in range(n):
    t[i] = int(input())
ans = 1
for i in t:
    ans = euclid(ans, i)
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import fractions

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 = ans * t[i] // fractions.gcd(ans,t[i])
print(ans)

Submission status: Accepted

Solution code:
import sys
import functools
import fractions
def slove(n, t):
    t.sort()
    ans = functools.reduce(lambda x,y:(x*y)//fractions.gcd(x,y), t)
    return ans

if __name__ == "__main__":
    input = sys.stdin.readline
    n = int(input())
    t = [int(input()) for i in range(n)]
    print(slove(n, t))

Submission status: Accepted

Solution code:
def resolve():
    def lcms(*numbers):
        from fractions import gcd
        from functools import reduce
        def lcm_base(x, y):
            return (x * y) // gcd(x, y)
        return reduce(lcm_base, numbers)
    
    N = int(input())
    T = [int(input()) for i in range(N)]
    print(lcms(*T))




if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

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

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

print(lcm_list(T))

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce
from collections import deque
# from math import factorial
import sys
sys.setrecursionlimit(2000000)
# import math
# import itertools
# import statistics
# import numpy as np
# import collections
n = int(input())
# = list(map(int, input().split()))
t = []
for i in range(n):
    t.append(int(input()))


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


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


print(lcm_list(t))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def ABC162C(a,b):#ユークリッドの互除法#最大公倍数
    p=a*b
    while b != 0:
        a %= b
        if a == 0:break
        b %= a
    return p//max(a,b)

n=int(input())
a=list()
for i in range(n):
    a.append(int(input()))
p=a[-1]
for i in a[:-1]:
    p=ABC162C(p,i)
print(p)

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
T = [INT() for i in range(N)]

def many_lcm(l):
    tmp = l[0]
    for i in range(1, len(l)):
        tmp = tmp * l[i]//gcd(tmp, l[i])
    return tmp

m = many_lcm(T)
print(m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
T = [int(input()) for k in range(N)]
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

# aとbの最小公倍数
# a*b = lcm(a,b)*gcd(a,b) より
def lcm(a,b):
    return a*b//gcd(a,b)
ans = 1
for e in T:
    ans = lcm(e,ans)
print(ans)

Submission status: Accepted

Solution code:
def resolve():
    nclo=range(int(input()))
    from fractions import gcd
    def lcm(a,b):
        return (a*b)//gcd(a,b)
    next=0
    temp=1
    for i in nclo:
        next=int(input())
        temp=lcm(temp,next)
    print(temp)
        
#%%submit!
resolve()

Submission status: Accepted

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

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

N = int(input())

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

print (ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from fractions import gcd

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

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

Submission status: Accepted

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

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

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

for _ in range(N):
    T.append(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)

cur = 1

for t in T:
    cur = lcm(t, cur)

print(cur)

Submission status: Accepted

Solution code:
import fractions
n = int(input())
t = [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:
# from math import gcd
# *ただし現時点(2019/12/06)でのatcoderはver.ひとつ前のpythonなので
from fractions import gcd
n = int(input())
ans = 1
for i in range(n):
    a = int(input())
    ans = a * ans // gcd(a, ans)
print(ans)

Submission status: Accepted

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

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*(b//c)
print(a)

Submission status: Accepted

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    from fractions import gcd
    N=I()
    ans=1
    for i in range(N):
        T=I()
        ans=(ans*T)//(gcd(ans,T))
        
        
    print(ans)

main()

Submission status: Accepted

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

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

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

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

print(ans)

Submission status: Accepted

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


N = int(input())
ans = 1
for _ in range(N):
    T = int(input())
    ans = ans // GCD(ans, T) * T
print(ans)

Submission status: Accepted

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

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

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

N = int(readline())
ans = 1
for _ in range(N):
    ans = lcm(ans, int(readline()))
print(ans)

Submission status: Accepted

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

n = int(input())
ans = 0
for i in range(n):
    t = int(input())
    if ans==0:
        ans=t
    else:
        ans = (ans*t)//gcd(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(*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))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd


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


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


if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
from fractions import gcd
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    T=[int(input()) for i in range(N)]
    lcm=1
    for x in T:
        lcm*=x//gcd(lcm,x)
    print(lcm)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fractions
import sys
#import numpy as np

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

def main():
    N = int(input())
    for i in range(N):
        if i == 0:
            tmp = int(input())
        else:
            a = int(input())
            b = lcm_base(a, tmp)
            tmp = b
    if N == 1:
        print(tmp)
    else:
        print(b)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions 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:
import fractions
N = int(input())

a = []
for _ in range(N):
    t = int(input())
    a.append(t)
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])

print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
import io

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