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

T=list(set(T))
cnt=0
x=1
while True:
    x=lcm(x,T[cnt])
    cnt+=1
    if cnt==len(T):
        break

print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fractions
def lcm(a,b):
  return a*b//fractions.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:
def gcd(a: int, b: int) -> int:
    if a < b:
        a, b = b, a
    return a if b == 0 else gcd(b, a % b)


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


def multiple_clocks(N: int, T: list) -> int:
    ans = 1
    for t in T:
        ans = lcm(ans, t)
    return ans


if __name__ == "__main__":
    N = int(input())
    T = [int(input()) for _ in range(N)]
    ans = multiple_clocks(N, T)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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:
def gcd(x,y):
  r=x%y
  return gcd(y,r) if r else y
#最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

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

#リスト内最小公倍数
k=A[0]
for i in A[1:]:
  k=lcm(k,i)
print(k)

Submission status: Accepted

Solution code:
from functools import reduce
N = int(input())
T = [int(input()) for i in range(N)]
def lcm(a, b): # 最小公倍数
    def gcd(a, b): # 最大公約数
        while b:
            a, b = b, a % b
        return a
    return a * b // gcd(a, b)
print(reduce(lcm,T))

Submission status: Accepted

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

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)
ans = reduce(lcm, T)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
    
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
      
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

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

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

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

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


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


def lcm_multi(nums):
    return reduce(lcm, nums)


print(lcm_multi(T))

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

Submission status: Accepted

Solution code:
# coding: UTF-8
from fractions import gcd
N=int(input())
a=int(input())
for i in range(N-1):
    b=int(input())
    a=a*b//gcd(a, b)
print(int(a))

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)


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

print(l)

Submission status: Accepted

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

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

# リストに対してgcd, lcm求める
import functools
result_lcm = functools.reduce(lcm, a)

print(result_lcm)

Submission status: Accepted

Solution code:
N = int(input())
T1 = int(input())
if N == 1:
    print(T1)
else:
    ans = T1
    T = T1
    for i in range(N - 1):
        T2 = int(input())
        a = ans
        b = T2
        a, b = sorted([a, b])
        while True:
            if b % a == 0:
                break
            else:
                a, b = b % a, a
        ans = int(ans * T2 // abs(a))

    print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

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

def lcm(i,j):
    return i*j // gcd(i,j)

print(reduce(lcm,T))

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

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

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

Submission status: Accepted

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

def gcd(m, n):
  while n:
    m, n = n, m%n
  return m

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

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

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)


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


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def gcd(a,b):
  a = int(a)
  b = int(b)
  r = (int)(a%b)
  while(r!=0):
    a=(int)(b)
    b=(int)(r)
    r=(int)(a%b)
  return b
def lcm(a,b):
    return int((a*b)//gcd(a,b))
n = int(input())
ans = int(input())
for i in range(n-1):
  num = int(input())
  ans = lcm(max(ans,num),min(ans,num))
print(int(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_list(numbers):
    return reduce(lcm_base, numbers)
  
n = int(input())
t = [int(input()) for i in range(n)]
print(lcm_list(t))

Submission status: Accepted

Solution code:
def GCD(x: int, y: int):
    if x < y:
        x, y = y, x

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


def LCM(x: int, y: int):
    return x * y // GCD(x, y)


N = int(input())
Tlist = [int(input()) for i in range(N)]
ans = 1
for num in Tlist:
    ans = LCM(ans, num)
print(ans)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def gcd(a,b):
    if a == 0:
        return b
    return gcd(b%a,a)
n = I()
a = IR(n)
l = a[0]
for i in range(1,n):
    g = gcd(l,a[i])
    l *= a[i]//g
print(l)
#B

#C

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Accepted

Solution code:
import fractions
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
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())

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

print(lcm_list(a))

Submission status: Accepted

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

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

if N==1:
  print(time[0])
else:
  tmp = time[0]*time[1]//gcd(time[0],time[1])
  for i in time:
    if tmp%i!=0:
      tmp = tmp*i//gcd(tmp,i)

  print(tmp)

Submission status: Accepted

Solution code:
from functools import reduce

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

def solve(t):
    return reduce(lcm, t, 1)

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

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

main()

Submission status: Accepted

Solution code:
def gcd( a , b ):
    if a == 0 :
        return b 
    return gcd( b % a , a )
n = int(input())
l = []
for i in range(n):
    l.append(int(input()))
ans = 1
for i in range(n):
    cur = gcd( ans , l[i] )
    ans *= l[i] // gcd(ans,cur)
print(ans)

Submission status: Accepted

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

#最大公約数
def gcd(x,y):
  r=x%y
  return gcd(y,r) if r else y
#最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

k=T[0]
#リスト内最小公倍数
for i in T:
  k=lcm(k,i)
print(k)

Submission status: Accepted

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

def GCD(a,b): #Greatest Common Diverser
	x = max(a,b)
	y = min(a,b)
	if x % y == 0:
		return y
	else:
		while x % y != 0:
			z = x % y
			x = y
			y = z
		else:
			return y
def LCM(a,b): #Least Common Multiple
	return a * b // GCD(a,b)
x=T[0]
for t in T:
	x=LCM(x,t)
print(x)

Submission status: Accepted

Solution code:
import fractions
import functools

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

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

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

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

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce
n=int(input())
l=[int(input()) for i in range(n)]

def lcm(x,y):
    return (x*y)//gcd(x,y)
def lcm_list(numbers):
    return reduce(lcm,numbers,1)
if n==1:
    print(l[0])
else:
    print(lcm_list(l))

Submission status: Accepted

Solution code:
from fractions import gcd
n=int(input())
l=[int(input()) for i in range(n)]
if n==1:
    print(l[0])
elif n==2:
    x=gcd(l[0],l[1])
    print(l[0]*l[1]//x)
else:
    g=gcd(l[0],l[1])
    lcm=l[0]*l[1]//g
    for i in range(2,n):
        g=gcd(lcm,l[i])
        lcm=lcm*l[i]//g
    print(lcm)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy

def main():
	num = int(input())
	
	clocks = []
	for _ in range(num):
		clock = int(input())
		clocks.append(clock)
		
	ans = 1
	for clock in clocks:
		ans = lcm(ans, clock)
	print(ans)
			
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):
	g = gcd(a, b)
	return a // g * b
	
if __name__ == "__main__":
	main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10000)

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

def lcm(A, n):
    if n == 2:
        return A[0]* (A[1] // gcd(A[0], A[1]))
    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
    rec = lcm(A, n-1)
    return rec * (A[n-1] // gcd(rec, A[n-1]))

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
if n >= 2:
    ans = lcm(a, n)
else:
    ans = a[0]
print(str(ans))

Submission status: Accepted

Solution code:
def gcd(a, b):
    if b == 1:
        return 1
    # a > b　を仮定
    r = a % b
    if r == 0:
        return b
    else:
        return gcd(b, r)

#def lcm(A, n):
#    if n == 2:
#        return A[0]*A[1] // gcd(A[0], A[1])
#    #lcm(A, n)はA[0]-A[n-1]までの最小公倍数を求める
#    a = lcm(A, n-1)
#    return a* A[n-1] // gcd(a, A[n-1])

n = int(input())
#a = []
T1 = int(input())
for i in range(n-1):
    T2 = int(input())
    T1 = T1*T2 // gcd(T1, T2)
    #a.append(int(input()))
#a.sort(reverse = True)
#ans = lcm(a, n)
print(str(T1))

Submission status: Accepted

Solution code:
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a
def lcm(a,b):
	return a*b//gcd(a,b)
N=int(input())
T1=int(input())
for i in range(N-1):
    T2=int(input())
    T1=lcm(T1,T2)
print(T1)

Submission status: Accepted

Solution code:
import fractions as math
from functools import reduce
def b(x,y):
    return x*y//math.gcd(x,y)
def a(l):
    return reduce(b, l)
n=int(input())
t=[int(input()) for i in range(n)]
print(a(t))

Submission status: Accepted

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

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

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

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

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

for i in range(n-1):
    if i == 0:
        b = lcm(a[i],a[i+1])
    else:
        b = lcm(b,a[i+1])
print(b)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from fractions import gcd
from functools import reduce
n = int(input())
num = [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(num))

Submission status: Accepted

Solution code:
from functools import reduce
import fractions
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

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

Submission status: Accepted

Solution code:
# n,m = map(int ,input().split())
N = int(input())
T = [int( input() ) for _ in range(N)]
T = set(T)
from functools import reduce
def gcd(x, y):
    while y != 0:
        (x, y) = (y, x % y)
    return x
    
# print(reduce(lambda a,b : a * b , T) // reduce(gcd, T))
def gcp (x,y):
    return x*y //gcd(x,y)
print(reduce(gcp, T))

Submission status: Accepted

Solution code:
# https://abc070.contest.atcoder.jp/tasks/abc070_c

import itertools
import collections
from bisect import bisect


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)


def main():
    N = int(input())

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from functools import reduce

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

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

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

def lcm_ans(LIST):
    return reduce(lambda a, b: (a*b)//gcd(a, b), t)

print(lcm_ans(t))

Submission status: Accepted

Solution code:
def c_multiple_clocks(N, T):
    from fractions import gcd
    from functools import reduce
    return reduce(lambda a, b: (a * b) // gcd(a, b), T)

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

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

ans = 1

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

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)
# 最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)
res = 1
for i in range(n):
    res = lcm(res, t[i])
print(res)

Submission status: Accepted

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

t = list(set(t))

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

if len(t)==1:
  print(t[0])
  exit()
  
koubai = t[0]
for i in range(1,len(t)):
  kouyakusuu = gcd(koubai,t[i])   
  koubai = koubai*t[i]//kouyakusuu
print(koubai)

Submission status: Accepted

Solution code:
import fractions as math

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

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

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 LCM(a, b):
    return a * b // GCD(a, b)

n = int(input())
t = [int(input()) for i in range(n)]
ans = t[0]
for i in range(1,n):
    ans = LCM(ans, t[i])
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())
T = []
for i in range(N):
  T.append(int(input()))
ans = T[0]
for i in range(1,N):
  ans = ans*T[i]//gcd(ans,T[i])
print(ans)

Submission status: Accepted

Solution code:
#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

N = input()
lcm_num = 1
for _ in range(N):
  t = input()
  lcm_num = lcm(lcm_num, t)

print lcm_num

Submission status: Accepted

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

def g(a, b):
    while b != 0:
        a, b = b, a%b
    return a

def l(a, b):
    return a * b // g(a, b)

for i in range(n-1):
    t[i+1]=l(t[i+1], t[i])
print(t[n-1])

Submission status: Accepted

Solution code:
from fractions import gcd

n = int(input())
t = sorted([int(input()) for _ in range(n)])
 
result = t.pop(0)

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

for timer in t:
	result = lcm(result, timer)
    
print(result)

Submission status: Accepted

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

def gcd(m, n):
  while n:
    m, n = n, m%n
  return m

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

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
def lcm_list(lst): return reduce(lambda x,y:(x*y)//fractions.gcd(x,y), lst, 1)
n = int(input()) 
t = [int(input()) for i in range(n)]
print(lcm_list(t))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(input()) for i in range(n)]
def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
ans = 1
for i in a:
	ans = ans * i // gcd(ans, i)
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import lru_cache

@lru_cache(maxsize=None)
def lcm(a, b):
    return a*b//gcd(a, b)

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

print(t)

Submission status: Accepted

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]


from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

# a, bの最大公約数
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

# a, bの最小公倍数
def lcm(a, b):
    return int(a * b) // gcd(a,b)

# リストnumbers最小公倍数
def lcmlist(numbers):
    a = numbers[0]
    for i in range(1, len(numbers)):
        a = lcm(a, numbers[i])
    return int(a)

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

print(lcmlist(t))

Submission status: Accepted

Solution code:
from fractions import gcd

res = 0
n = int(input())
for i in range(n):
    if i == 0:
        res = int(input())
    else:
        tmp = int(input())
        res = res*tmp//gcd(res, tmp)
print(res)

Submission status: Accepted

Solution code:
N = int(input())
L = []
for _ in range(N):
    L.append(int(input()))
def lcm(x, y):
    if x > y:
        x,y = y,x
    if x == 0:
        return y
    r = y % x
    return lcm(r,x)
def gcd(x,y):   
    return   x*y // lcm(x,y)

ans = L[0]
for x in L:
    ans = gcd(ans,x)
print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
n=int(input())
data=[]
for i in range(n):
    data.append(int(input()))
def gcd(a, b):
    while a != 0:
        a, b = b%a, a
    return b
def lcm(x, y):
    return (x * y) // gcd(x, y)
print(reduce(lcm,data))

Submission status: Accepted

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

from functools import reduce

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
    
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:
from fractions import gcd
N = int(input())
A = set()
for i in range(N):
    A.add(int(input()))
A = sorted(list(A), reverse=True)
while len(A) != 1:
    a = A.pop()
    b = A.pop()
    A.append(a//gcd(a,b)*b)

print(A[0])

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=1
for i in T:
    ans = lcm(ans,i)

print(ans)

Submission status: Accepted

Solution code:
#ユークリッドの互除法を用いる
N=int(input())
T=[]
for i in range(0,N):
    T.append(int(input()))
def gcd(a,b):
    while b>0 :
        a0=a
        b0=b
        a=b0
        b=a0%b0
    return a
def lcm_base(x,y):
    return (x*y)//gcd(x,y)
def lcm_reduce(T):
    result=T[0]
    for i in range(1,len(T)):
        result=lcm_base(result,T[i])
    return result
print(lcm_reduce(T))

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

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 LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


# 整数(x, y)最大公約数を求める
def gcd(x, y):
    if x % y == 0:
        return y
    else:
        x, y = y, x % y
        return gcd(x, y)


# 整数(x, y)の最小公倍数を求める
def lcm(x, y):
    return (x // gcd(x, y)) * y


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

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

print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

def gcd(m,n):
    if n == 0:
        return m
    return gcd(n,m%n)
    
def lcm(m,n):
    return m * n//gcd(m,n)

print(reduce(lcm,T))

Submission status: Accepted

Solution code:
from functools import reduce


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

Submission status: Accepted

Solution code:
#ABC070-C TLE
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()

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

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

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

Submission status: Accepted

Solution code:
from fractions import gcd
n = int(input())
t = [int(input()) for i in range(n)]
cm = t[0]

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

Submission status: Accepted

Solution code:
n=int(input())
t=list(map(int,[input() for i in range(n)]))

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

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

Submission status: Accepted

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


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


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

t = T[0]
for i in range(N - 1):
    t = lcm(t,T[i+1])
print(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 // gcd(a, b) * b

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

Submission status: Accepted

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

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

from functools import reduce
ans = reduce(lcm, li, 1)

print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
N = int(input())
cnt = 0
tmp = 1
for _ in range(N):
    t = int(input())
    tmp = tmp * t // gcd(tmp, t)
print(tmp)

Submission status: Accepted

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

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

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

for i in range(n-1):
    A[i+1] = lcm(A[i], A[i+1])
    
print(A[-1])

Submission status: Accepted

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

def main():
    n = int(input())
    tn = [int(input()) for i in range(n)]
    print(lcm(tn))

def lcm(li):
    res = 1
    for x in li:
        res *= (x // gcd(res, x))
    return res

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

main()

Submission status: Accepted

Solution code:
n = int(input())
re = 1

def calc(re, t):
    if t == 0:
        return re
    else:
        return calc(t, re%t)

for _ in range(n):
    t = int(input())
    re = re*t//calc(re, t)
    
print(re)

Submission status: Accepted

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


def lcm(a, b):
    mul = a*b
    if a < b:
        a, b = b, a
    while b:
        r = a % b
        a = b
        b = r
    return mul//a


print(reduce(lcm, T))

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

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


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


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


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

Submission status: Accepted

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

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

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

temp = T[0]
for i in range(n-1):
    temp = lcm(temp,T[i+1])
print(temp)

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

Submission status: Accepted

Solution code:
def get_gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

def get_lcm(a, b, gcd=0):
    if gcd == 0:
        return a * b // get_gcd(a, b)
    else:
        return a * b // gcd


N = int(input())

T = []

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

R = T[0]

for n in range(1, N):
    R = get_lcm(R, T[n])

print(R)

Submission status: Accepted

Solution code:
# ABC 070
import math
# gcdはエラーになる
def getInt(): return int(input())
def getIntFromRows(n): return [int(input()) for i in range(n)]
def gcd(x, y):
    m = max(x,y)
    n = min(x,y)
    while m%n != 0:
        w = m%n
        m = n
        n = w
    return n
def lcm(x, y): return x*y//gcd(x,y)

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