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:
# ==================================================-
# 最大公約数n個
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


# ------メイン関数-------
# numsは整数のリスト
def lcm(nums):
    return functools.reduce(multiple, nums)

a=[]

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

print(lcm(a))

Submission status: Accepted

Solution code:
def gcd(m, n):
    if m < n:
        m, n = n, m

    while True:
        r = m % n
        if r == 0:
            return n
        else:
            m, n = n, r

def lcm(m, n):
    return m*n // gcd(m, n)

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

ans = 1

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

l = []

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

print(lcm_list(l))

Submission status: Accepted

Solution code:
import math
n = int(input())
t = []
for i in range(n):
    t.append(int(input()))
if n == 1:
    print(t[0])
else:
    tmp = t[0]
    for i in range(1,n):
        div = math.gcd(tmp,t[i])
        tmp = (t[i] * tmp)//div
    print(tmp)

Submission status: Accepted

Solution code:
import math

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

if n == 1:
    print(tl[0])
else:
    g = tl[0] // math.gcd(tl[0], tl[1]) * tl[1]
    for i in range(1, n):
        g = g // math.gcd(g, tl[i]) * tl[i]
    print(g)

Submission status: Accepted

Solution code:
n=int(input())
A=[]
for i in range(n):
    A.append(int(input()))

import numpy as np
print(np.lcm.reduce(A))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
from math import gcd

def input():
    return stdin.readline().strip()

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

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

print(now)

Submission status: Accepted

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

T = []
for _ in range(N):
    T.append(int(input()))  # S += [input()] とも書ける

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:
def lcm(a):
    import math
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // math.gcd(x, a[i])
    return x


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


resolve()

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd

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

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

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

print(lcm(T))

Submission status: Accepted

Solution code:
import math

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


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


ans = tL[0]
for t in tL[1:]:
    ans = lcm(t, ans)

print(ans)

Submission status: Accepted

Solution code:
from math import gcd
from functools import reduce


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:
from math import gcd
from functools import reduce


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 math
N = int(input())
lsT = []
for i in range(N):
    lsT.append(int(input()))
a = lsT[0]
for b in range(1,N):
    a = a*lsT[b] // math.gcd(a,lsT[b])
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#70
from math import gcd
n=int(input())
t=[int(input()) for i in range(n)]

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

Submission status: Accepted

Solution code:
from math import gcd
n = int(input())
t = [int(input()) for i 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:
# https://atcoder.jp/contests/abc070/tasks/abc070_c

import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def gcd(x: int, y: int) -> int:
    if x < y:
        x, y = y, x
    while y > 0:
        r = x % y
        x, y = y, r
    return x


def main():
    n = input_int()
    T = list(set([input_int() for _ in range(n)]))
    ans = T[0]
    for t in T[1:]:
        ans = ans * t // gcd(ans, t)
    print(ans)

    return


if __name__ == "__main__":
    main()

Submission status: Accepted

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

import math
from functools import reduce

print(reduce(lambda x,y : (x * y) // math.gcd(x, y), T,1))

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

Submission status: Accepted

Solution code:
from math 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:
n=int(input())
import math
ans=1
for i in range(n):
    t=int(input())
    ans=(ans//math.gcd(ans,t))*t
    
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)
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import math


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


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

Submission status: Accepted

Solution code:
import math

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

if N == 1:
    print(T[0])
elif N == 2:
    print(T[0]*T[1]//math.gcd(T[0], T[1]))
else:
    L = T[0]
    for i in range(1, N):
        L = L*T[i]//math.gcd(L, T[i])
    print(L)

Submission status: Accepted

Solution code:
import math
N=int(input())
a = [int(input()) for _ in range(N)]
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // math.gcd(ans, a[i])
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(*numbers):
	return reduce(lcm_base, numbers, 1)

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

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

Submission status: Accepted

Solution code:
n= int(input())
a=int(input())

import math
if n==1:
	print(a)
	exit()

b=int(input())
c=(a*b)//math.gcd(a,b)
for i in range(n-2):
	b=int(input())
	c=(c*b)//math.gcd(c,b)

print(c)

Submission status: Accepted

Solution code:
import math

N = int(input())

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

ans = 1

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

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(a,b):
    return a*b//math.gcd(a,b)

print(reduce(lcm, t))

Submission status: Accepted

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

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:
def delete_head_zeros(n):
	n = str(n)
	l = len(n)
	if "." in n:
		l = n.find(".")
	head_zeros = 0
	for i in range(l - 1):
		if n[i] == "0":
			head_zeros += 1
		else:
			break

	return n[head_zeros:]

# compare a, b
# a, b: int or string
def bigint_compare(a, b):
	a = delete_head_zeros(a)
	b = delete_head_zeros(b)
	if len(a) > len(b):
		return 1
	elif len(a) < len(b):
		return -1
	else:
		if a > b:
			return 1
		elif a < b:
			return -1
		else:
			return 0

# calculate a + b
# a, b: int or string
def bigint_plus(a, b):
	a = str(a)
	b = str(b)

	d = max([len(a), len(b)])
	a = '0' * (d - len(a)) + a
	b = '0' * (d - len(b)) + b

	ans = ""
	carry = 0
	for i in range(d):
		s = int(a[-i-1]) + int(b[-i-1]) + carry
		carry = s // 10
		ans = str(s % 10) + ans
	else:
		if carry:
			ans = str(carry) + ans

	return ans

# calculate a - b
# a, b: int or string
def bigint_minus(a, b): 
	a = str(a)
	b = str(b)
	M = []
	m = []
	sign = ""

	if len(a) > len(b) or (len(a) == len(b) and a >= b):
		[M, m] = [a, b]
	else:
		[M, m] = [b, a]
		sign = "-"
	m = '0' * (len(M) - len(m)) + m

	ans = ""
	borrow = 0
	for i in range(len(M)):
		s = int(M[-i-1]) - int(m[-i-1]) - borrow
		if s < 0:
			borrow = 1
			s += 10
		else:
			borrow = 0
		ans = str(s) + ans

	return sign + delete_head_zeros(ans)

# calculate a * b
# a, b: int or string
def bigint_multiply(a, b):
	a = str(a)
	b = str(b)

	md = []
	for j in range(len(b)):
		carry = 0
		mj = ""
		for i in range(len(a)):
			m = int(a[-i-1]) * int(b[-j-1]) + carry
			carry = m // 10
			mj = str(m % 10) + mj
		else:
			if carry:
				mj = str(carry) + mj
		md.append(mj)

	ans = 0
	for k in range(len(md)):
		ans = bigint_plus(md[k] + "0" * k, ans)

	return ans

# calculate a / b to d digits after decimal point
# a, b, d: int or string
def bigint_divide(a, b, d = 0):
	a = str(a)
	b = str(b)
	d = int(d)
	if d < 0:
		d = 0

	ans = ""
	r = ""
	for i in range(len(a) + d):
		q = 0
		if i < len(a):
			r += a[i]
		elif i == len(a):
			ans += "."
			r += "0"
		else:
			r += "0"

		if bigint_compare(r, b) == -1:
			ans += str(q)
		else:
			while bigint_compare(r, b) >= 0:
				r = bigint_minus(r, b)
				q += 1
			ans += str(q)

	return delete_head_zeros(ans)

def gcd(a, b):
	if bigint_compare(a, b) >= 0:
		M = a
		m = b
	else:
		M = b
		m = a
	if m == "0":
		return M
	else:
		q = bigint_divide(M, m)
		r = bigint_minus(M, bigint_multiply(m, q))
		return gcd(m, r)

def lcm(a, b):
	return bigint_divide(bigint_multiply(a, b), gcd(a, b))

def main():
	N = int(input())
	T = [input() for i in range(N)]
	ans = 1
	for i in range(len(T)):
		ans = lcm(T[i], ans)

	print(ans)

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def lcm(m, n):
    return m//gcd(m, n)*n


def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n


n = int(input())
arr = [int(input()) for _ in range(n)]
ans = 1
for i in arr:
    ans = lcm(ans, i)

print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
a = []  
for i in range(n):
  a.append(int(input()))
if n == 1:
  print(a[0])
else:
  lcm = (a[0] * a[1]) // math.gcd(a[0], a[1])
  for i in range(2, n):
    lcm = (lcm * a[i]) // math.gcd(lcm, a[i])
  print(lcm)

Submission status: Accepted

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

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


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


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

Submission status: Accepted

Solution code:
from math import gcd

n = int(input())
g = int(input())

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

print(g)

Submission status: Accepted

Solution code:
import math
N = int(input())
lcm = int(input()) #T0
for i in range(N-1):
    x = int(input())
    lcm = lcm * x // math.gcd(lcm,x)
print(lcm)

Submission status: Accepted

Solution code:
import math

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

N,*T = map(int,open(0).read().split())

lcm = 1

for i in T:
  lcm = calc_lcm(lcm,i)
print(lcm)

Submission status: Accepted

Solution code:
import math
n=int(input());a=[int(input()) for _ in range(n)];r=a[0]
for i in a:
  r=r*i//math.gcd(r,i)
print(r)

Submission status: Accepted

Solution code:
import math
n=int(input());a=[int(input()) for _ in range(n)];r=a[0]
for i in a: r=r*i//math.gcd(r,i)
print(r)

Submission status: Accepted

Solution code:
import math

a=[int(input()) for _ in range(int(input()))]
r=a[0]
for i in range(len(a)):
  r=r*a[i]//math.gcd(r,a[i])
print(r)

Submission status: Accepted

Solution code:
import math

n=int(input())
a=[int(input()) for _ in range(n)]
r=a[0]
for i in a:
  r=r*i//math.gcd(r,i)
print(r)

Submission status: Accepted

Solution code:
import math

n=int(input())
a=[int(input()) for _ in range(n)]
if n==1:
  print(a[0])
elif n==2:
  print(a[0]*a[1]//math.gcd(a[0],a[1]))
else:
  r=a[0]*a[1]//math.gcd(a[0],a[1])
  for i in a:
    r=r*i//math.gcd(r,i)
  print(r)

Submission status: Accepted

Solution code:
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

tmp = T[0]
for i in range(1, len(T)):
    tmp = (tmp * T[i]) // gcd(tmp, T[i])
print(tmp)

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
from bisect import bisect, bisect_left, bisect_right

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

print(many_lcm(T))

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, gcd
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 functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


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

    lcm_base = lambda x, y: (x * y) // gcd(x, y)
    lcm = lambda *numbers: reduce(lcm_base, numbers, 1)
    print(lcm(*T))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import functools


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

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

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

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

print(lcm(l))

Submission status: Accepted

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


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


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

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

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 math
n = int(input())
t = list(int(input()) for i in range(n))
s = t[0]
for i in range(1,n):
    s = s * t[i] // math.gcd(s,t[i])
print(s)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import math
from functools import reduce

n = int(input())
t = list(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
n = int(input())
t = int(input())
ans = t
for i in range(n - 1):
    t = int(input())
    g = gcd(ans, t)
    ans *= t//g

print(ans)

Submission status: Accepted

Solution code:
import math
def lcm(l):
    r=l.pop(0)
    for i in l:
        r=r*i//math.gcd(r,i)
    return r

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
import math

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

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 i in range(n)]
lcm = t[0]
for h in range(1,n):
    lcm = (lcm*t[h])//math.gcd(lcm,t[h])
print(lcm)

Submission status: Accepted

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


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


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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import gcd

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

Submission status: Accepted

Solution code:
n = int(input())
ans = int(input())

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

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

print(ans)

Submission status: Accepted

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

def lcm(a,b):
    return (a*b)//gcd(a,b)
n=int(input())
t=[]
for i in range(n):
    tmp=int(input())
    if tmp in t:
        continue
    t.append(tmp)

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

Submission status: Accepted

Solution code:
import math
def lcm(x, y):
    return (x * y) // math.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:
import math

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

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

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

print(LCM)

Submission status: Accepted

Solution code:
from math import gcd

def lcm(X, Y):
    return (X * Y) // gcd(X, Y)

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:
from math import gcd
n=int(input())
a=int(input())
for _ in range(n-1):
  i=int(input())
  a=a*i//gcd(a,i)
print(a)

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

Submission status: Accepted

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

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

ans = time[0]

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

print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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


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


n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
ans = a[0]
for x in range(1, n):
    ans = lcm(ans, a[x])

print(ans)

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

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

    gcd = T[0]
    ans = T[0]
    for i in T:
        gcd = math.gcd(i, ans)
        ans = ans * i // gcd

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import fractions

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

if n==1:
    print(t[0])
else:
    g=fractions.gcd(t[0],t[1])
    l=t[0]*t[1]//g

    for i in range(2,n):
        l=t[i]*l//fractions.gcd(l,t[i])
        g=fractions.gcd(l,t[i])

    print(l)

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def ppp(a,b):
	while b >= 1:
		a,b = b, a % b
	return a

def main():
	n = int(input())
	#b , c = tin()
	#s = input()
	ret = 1
	for _ in range(n):
		v = int(input())
		ret = (ret*v) //ppp(ret, v)
	print(ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:
import fractions

n = int(input())
a = []
for i 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:
n=int(input())
def sai(a,b):
  import math
  v=math.gcd(a,b)
  return a*b//v
ans=int(input())
for i in range(n-1):
  b=int(input())
  ans=sai(ans,b)
print(ans)

Submission status: Accepted

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


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

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

Submission status: Accepted

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

N=int(input())
T=[]
if N==1:
  print(input())
  exit()
for i in range(N):
  t = int(input())
  T.append(t)
  if i == 0:continue
  elif i == 1:
    lcm = T[-2]*T[-1]//gcd(T[-2],T[-1])
  else:
    lcm = lcm * T[-1]//gcd(lcm,T[-1])

print(lcm)

Submission status: Accepted

Solution code:
def gcd(a,b):
	if b == 0:
		return a
	return gcd(b, a % b)
def lcm(a,b):
	return a * b / gcd(a,b)
print reduce(lcm, [int(raw_input()) for oo in range(int(raw_input()))])

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

print(lcm_list([int(input()) for i in range(N)]))

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:
import math
from functools import reduce

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

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)

print(lcm_list(S))

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

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

lcm = 1
for t in T:
    lcm *= t // gcd(t, lcm)
print(lcm)

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

Solution code:
from math import gcd

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

Submission status: Accepted

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

def solve(n,ts):
    a = ts[0]
    for i in range(n):
        b = ts[i]
        c = gcd(a,b)
        a = a*b//c
    return a

if __name__ == '__main__':
    n = int(input())
    ts = [int(input()) for i in range(n)]
    print(solve(n,ts))

Submission status: Accepted

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

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


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
from math import gcd
def input(): return sys.stdin.readline().strip()


def main():
    n = int(input())
    ans = int(input())
    for _ in range(n - 1):
        val = int(input())
        ans = ans * val // gcd(ans, val)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from math import gcd

n=int(input())

lcm=0
for i in range(n):
  t=int(input())
  if lcm==0:
    lcm=t
  else:
    lcm=(t*lcm)//gcd(t,lcm)

print(lcm)

Submission status: Accepted

Solution code:
import math

n=int(input())
ans=int(input())

if n>1:
  
  for x in range(n-1):
    s=int(input())
    ans=ans*s//(math.gcd(ans,s))
    
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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