Problem:


Score : 300 points

Problem Statement

We have N clocks. The hand of the i-th clock (1≤i≤N) rotates through 360° in exactly T_i seconds.

Initially, the hand of every clock stands still, pointing directly upward.

Now, Dolphin starts all the clocks simultaneously.

In how many seconds will the hand of every clock point directly upward again?

Constraints

1≤N≤100 

1≤T_i≤10^{18} 

All input values are integers.  

The correct answer is at most 10^{18} seconds.

Input

Input is given from Standard Input in the following format:  

N
T_1
:  
T_N

Output

Print the number of seconds after which the hand of every clock point directly upward again.

Sample Input 1

2
2
3

Sample Output 1

6

We have two clocks. The time when the hand of each clock points upward is as follows:

Clock 1: 2, 4, 6, ... seconds after the beginning

Clock 2: 3, 6, 9, ... seconds after the beginning

Therefore, it takes 6 seconds until the hands of both clocks point directly upward.

Sample Input 2

5
2
5
10
1000000000000000000
1000000000000000000

Sample Output 2

1000000000000000000



Sample input:
2
2
3


Sample output:
6

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from functools import reduce
def gcd(a, b):
    return gcd(b, a%b) if b!=0 else a

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

N = int(input())
T = [int(input()) for _ in range(N)]
l = reduce(lcd, T)
print(l)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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


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


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

print(ans)

Submission status: Accepted

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

n=int(input())
t=[int(input()) for i 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)]
a = T[0]

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

print(a)

Submission status: Accepted

Solution code:
import fractions

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

ans = T[0]

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

print(ans)

Submission status: Accepted

Solution code:
# C - Multiple Clocks
# import math mathはatcoderでは使えない
from fractions import gcd
N = int(input())
T = [int(input()) for i in range(N)]
# 最小公倍数を求める
if N == 1:
    print(T[0])
else:
    DP = [0]*(N-1)
    DP[0] = (T[0]*T[1])//gcd(T[0],T[1])
    for i in range(1,N-1):
        DP[i] = (DP[i-1]*T[i+1]) // gcd(DP[i-1],T[i+1])
    print(DP[-1])

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

print(num)

Submission status: Accepted

Solution code:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
from itertools import accumulate
from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


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

print(reduce(lcm, L))

Submission status: Accepted

Solution code:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
from itertools import accumulate
from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


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

x = 1
for l in L:
    x = lcm(x, l)

print(x)

Submission status: Accepted

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

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

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

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

print(ans)

Submission status: Accepted

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

num_list=[]
for _ in range(n):
    num_list.append(int(input()))
print(lcm(*num_list))

Submission status: Accepted

Solution code:
n = int(input())

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

def lcm1(a,b):
  return a*b//gcd1(a,b)
num = 1
for i in range(n):
    num = lcm1(num,int(input()))
print(num)

Submission status: Accepted

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

num_list=[]
for _ in range(n):
    num_list.append(int(input()))
print(lcm(*num_list))

Submission status: Accepted

Solution code:
#早くmathを導入してほしい
from fractions import gcd
n=int(input())
glm=1
for i in range(n):
    nums=int(input())
    glm=int(glm*nums//gcd(nums,glm))
print(glm)

Submission status: Accepted

Solution code:
import fractions

n = int(input())
a = 1

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, deque
from functools import reduce
import math

input = sys.stdin.readline

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

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)

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
l=list(set([int(input()) for d in range(n)]))  
a=l[0]
def gcd(a,s):
  a,s=min(a,s),max(a,s)
  if a==0:return s
  else:return gcd(s%a,a)

for i in l[1:]:
  a=a*i//gcd(a,i)
print(a)

Submission status: Accepted

Solution code:
import fractions as math
n=int(input())
T=[]
for  i in range(n):
	T.append(int(input()))

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


print(int(ans))

Submission status: Accepted

Solution code:
def gcm(a,b):
    if a < b:
        a,b = b,a
    while True:
        if a % b == 0:
            return b
        else:
            a,b = b,a % b

def lcm(a,b):
    g = gcm(a,b)
    return a*b//g;

N = int(input())
Data = []
for _ in range(N):
    Data.append(int(input()))
ans = Data[0]
for i in range(1,N):
    ans = lcm(ans,Data[i])
print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
n = int(input())
T = [int(input()) for i in range(n)]
lcd = reduce(lambda x, y: x * y // gcd(x, y), T)
print(lcd)

Submission status: Accepted

Solution code:
import fractions as f

N = int(input())
ans = int(input())
for i in range(1, N):
    T_i = int(input())
    tmp = ans * T_i // f.gcd(ans, T_i)
    ans = tmp
print(ans)

Submission status: Accepted

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


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


n = int(input())
ls = [int(input()) for _ in range(n)]
res = ls[0]
for x in ls[1:]:
    res = lcm(res, x)
print(res)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


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


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


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

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

print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd

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

def lcm(x, y):
    return x*y // gcd(x,y)
answer = reduce(lcm, T)
print(answer)

Submission status: Accepted

Solution code:
from fractions import*;_,*t=map(int,open(0));l=1
for a in t:l=l*a//gcd(l,a)
print(l)

Submission status: Accepted

Solution code:
from collections import deque
N = int(input())
T = list(set([int(input()) for _ in range(N)]))
ret = T[0]

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

for t in T[1:]:
  ret = ret * t // gcd(ret, t)
  
print(ret)

Submission status: Accepted

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

least_common = t[0]

for i in range(1, n):
    a = least_common
    b = t[i]
    while a % b != 0:
        temp = b
        b = a % b
        a = temp
    least_common = least_common * t[i] // b

print(least_common)

Submission status: Accepted

Solution code:
import fractions

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

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

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

Submission status: Accepted

Solution code:
N=int(input())
T=[int(input()) for _ in range(N)]
T=list(set(T))
N=len(T)
#print(T)

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

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

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 _ in range(N)]
if N == 1:
    print(T[0])
    exit()

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

Submission status: Accepted

Solution code:
N = int(input())
T0 = int(input())
p = T0
G = T0
ans = T0
from fractions import gcd
for i in range(N-1):
    T = int(input())
    p *= T
    G = gcd(ans,T)
    ans = ans*T//G
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce


def resolve():
    n = int(input())
    t = list(int(input()) for _ in range(n))
    res = 1
    for ti in t:
        res = lcm_base(res, ti)
    print(res)


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


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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
from fractions import gcd
N = int(input())
T = [int(input()) for _ in range(N)]
T = list(set(T))
l = T[0]
for i in range(1,len(T)):
  temp = l
  g = gcd(temp,T[i])
  l = l * T[i] // g
  
print(l)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# input=sys.stdin.readline
def resolve():
    n=int(input())
    ans=1
    from fractions import gcd
    for _ in range(n):
        t=int(input())
        ans=ans*t//(gcd(ans,t))
    print(ans)
resolve()

Submission status: Accepted

Solution code:
n = int(input())
t = [int(input()) for i in range(n)]
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

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

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

print(res)

Submission status: Accepted

Solution code:
from fractions import gcd

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

def getN():
    return int(input())
# print(lcm(10, 20))

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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


def solve(N: int, T: "List[int]"):
    print(reduce(lcm, T))
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    T = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, T)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:


def computeGCD(x, y): 
   while(y): 
       x, y = y, x % y 
   return x 
   
   
def min(a, b):
	if a > b:
		return b
	else:
		return a

def max(a, b):
	if a > b:
		return a
	else:
		return b



def main():
	clocks = []
	n = int(input())
	for i in range(n):
		clocks.append(int(input()))
	x = clocks[0]
	for i in range(1, n):
		div = computeGCD(x, clocks[i])
		x = (x * clocks[i]) // div
	print(x)




if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue,fractions
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))
def inpl_str(): return list(sys.stdin.readline().split())
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

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

Submission status: Accepted

Solution code:
from fractions import gcd

n = int(input())
a = [int(input()) for i in range(n)]
tmp = 1
for i in a:
  tmp = (tmp * i) // gcd(tmp, i)
print(tmp)

Submission status: Accepted

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

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


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

print(ans)

Submission status: Accepted

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

N = int(input())

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

ans = T[0]

T= set(T)

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

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())
s = int(input())
def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)
for i in range(1,n):
    t = int(input())
    s = (s*t)//gcd_core(s,t)

print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd

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

N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################
from fractions import gcd

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


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

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

print(ans)

Submission status: Accepted

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

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

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import fractions

N=int(input())
T0=int(input())

if N==1:
  print(T0)
  exit()

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

Submission status: Accepted

Solution code:
import fractions
n=int(input())
t=[int(input()) for i in range(n)]
t.sort()
check=t[0]
if n==1:
    print(check)
else:
    for i in range(n-1):
        f1=fractions.gcd(check,t[i+1])
        f2=check*t[i+1]//f1
        check=f2
    print(f2)

Submission status: Accepted

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

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

print(reduce(lambda a, b: lcm(a,b),T))

Submission status: Accepted

Solution code:
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd
from functools import reduce

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

mod = 1000000007

if __name__ == "__main__":
    n = int(sys.stdin.readline())
    l=[]
    for i in range(n):
        t = int(sys.stdin.readline())
        l.append(t)

    print(reduce(lcm,l))

Submission status: Accepted

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

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

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

if len(T) == 1:
  print(T[0])
elif len(T) == 2:
  print(lcm(*T))
else:
  ans = lcm(T[0], T[1])
  for i in range(2, N):
    ans = lcm(ans, T[i])
  print(ans)

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

Solution code:
import fractions
from functools import reduce
N = int(input())
T = [int(input()) for i 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)

ans = lcm_list(T)

print(ans)

Submission status: Accepted

Solution code:
def f(x,y):
    if x<y: x,y = y,x
    if y==0: return x
    else: return f(y, x%y)
N = int(input())
ans = 1
for _ in range(N):
    T = int(input())
    ans = ans*T//f(ans,T)
print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
n=int(input())
a=[int(input()) for i 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(a))

Submission status: Accepted

Solution code:
import sys
import copy
import  math
import bisect
from collections import *
from operator import itemgetter

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

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

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

Submission status: Accepted

Solution code:
from sys import stdin
import fractions
def lcm(a, b):
  return a * b // fractions.gcd(a, b)
N = int(stdin.readline().rstrip())
ans = 1
for _ in range(N):
    ans = lcm(ans,int(input()))
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

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

N = int(input())
tlist = [int(input()) for _ in range(N)]
print(lcmm(tlist))

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
def lcm(a,b):
  return a*b//gcd(a,b)
def lcmm(l):
  return reduce(lcm,l)
n=int(input())
l=[int(input()) for i in range(n)]
print(lcmm(l))

Submission status: Accepted

Solution code:
def lcm(a, b):
    if a < b:
        a2, b2 = b, a
    else:
        a2, b2 = a, b
    while b2 != 0:
        a2, b2 = b2, a2%b2
    return a*b//a2

N = int(input())
T1 = int(input())
if N == 1:
    ans = T1
else:
    T2 = int(input())

    ans = lcm(T1, T2)

    for i in range(N-2):
        Ti = int(input())
        ans = lcm(ans, Ti)

print(ans)

Submission status: Accepted

Solution code:
from decimal import *

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

for i in range(n):
    T[i] = Decimal(T[i])

def gcd(x, y):
    while x != 0 and y != 0:
        x, y = max(x, y), min(x, y)
        x %= y
    return max(x, y)

ans = Decimal(1)
for i in range(n):
    if ans % T[i] != 0:
        ans = ans * T[i] / gcd(ans, T[i])
    #ans = int(ans + 0.1)
    #print(ans)
print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd


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


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

print(reduce(lcm, t))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd


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


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

ret = 1
for i in range(n):
    ret = lcm(ret, ts[i])
print(ret)

Submission status: Accepted

Solution code:
from fractions import gcd

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

Submission status: Accepted

Solution code:

def computeGCD(x, y): 
   while(y):
   		x, y = y, x % y
   return x 
n=int(raw_input())
ar=[]
for i in range(0,n):
	k=int(raw_input())
	ar.append(k)

an=ar[0]
for x in range(1,n):
	an=(an*ar[x])/computeGCD(an,ar[x]);
print(an)

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

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

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

print(lcm_list(Ts))

Submission status: Accepted

Solution code:
import fractions

n=int(input())
t=list(int(input()) for i in range(n))
ans=t[0]
for i in range(n-1):
    ans=ans*t[i+1]//fractions.gcd(ans,t[i+1])
    
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
n=int(input())
T=np.array([int(input()) for _ in range(n)], dtype=np.int64)

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

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

print(ans)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc070/tasks/abc070_c
# C - Multiple Clocks
import fractions

n = int(input().split()[0])
t_list = []

for _ in range(n):
    t_list.append(int(input().split()[0]))

t_list = list(set(t_list))
a = t_list[0]

for t in t_list[1:]:
    a = a * t // fractions.gcd(a, t)

print(a)

Submission status: Accepted

Solution code:
from functools import reduce
N = int(input())
T = [int(input()) for _ in range(N)]
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
print(reduce(lambda a,b: a*b//gcd(a,b),T))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import fractions

N = int(input())

now = 1

for i in range(N):

    T = int(input())

    now = now * T // fractions.gcd(now , T)

print (now)

Submission status: Accepted

Solution code:
import fractions

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

if len(a) == 1:
    print(a[0])
    exit()

ans = a[0] * a[1] // fractions.gcd(a[0],a[1])

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

Submission status: Accepted

Solution code:
import fractions
def lcm(a, b):
    y = a*b // fractions.gcd(a, b)
    return (y)
N=int(input())
T = [int(input()) for i in range(N)]
if N==1:
    t=T[0]
else:
    t=lcm(T[0],T[1])
    if N>2:
        for i in range(1,N):
            t=lcm(t,T[i])
print(t)

Submission status: Accepted

Solution code:

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


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


def lcm_arr(arr):
    ans = arr[0]
    for i in range(1, n):
        ans = lcm(ans, arr[i])
    return ans


n = int(input())
ans = lcm_arr([int(input()) for _ in range(n)])
print(min(ans, 10 ** 18))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N = int(input())
def calcgcd(a, b):
  if a > b:
    a, b = b, a
  while a > 0:
    a, b = b%a, a
  return b
def calclcm(a, b):
  return a*b//calcgcd(a, b)
r = 1
for i in range(N):
  T = int(input())
  r = calclcm(r, T)
print(r)

Submission status: Accepted

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

Submission status: Accepted

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

    if N == 1: return T[0]

    g = T[0]
    ans = T[0]
    for t in T[1:]:
        gc = gcd(t, g)
        g = g*t//gc
    return g

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




if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
from functools import reduce

try:
    from math import gcd
except:
    from fractions import gcd


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


N = int(input())
T = []
for _ in range(N):
    T.append(int(input()))
ans = reduce(gcm, T, 1)
print(ans)

Submission status: Accepted

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)

N = _I()
T = set([_I() for _ in range(N)])

def lcm(a,b):
    g = fractions.gcd(a,b)
    return a * b // g

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

print(l)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
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):
    g = gcd(a,b)
    return a * b // g

l = 1
for t in ts:
    l = lcm(l,t)
    
print(l)

Submission status: Accepted

Solution code:
# ABC070C - Multiple Clocks
from fractions import gcd


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

T.sort()
ans = T.pop(0)
for t in T:
    ans = lcm(ans,t)
print(ans)

Submission status: Accepted

Solution code:
import fractions
n = int(input())
t = []
for i in range(n):
  t.append(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:
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

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


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



ret = li[0]
if len(li) != 1:
    for i in range(1, n):
        ret = lcm(ret, li[i])
print(ret)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

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

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

if __name__ == '__main__':
    N = int(input())
    T = []
    for i in range(N):
        T.append(int(input()))
    main(N,T)