Problem:


Score : 300 points

Problem Statement

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

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

Now, Dolphin starts all the clocks simultaneously.

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

Constraints

1≤N≤100 

1≤T_i≤10^{18} 

All input values are integers.  

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

Input

Input is given from Standard Input in the following format:  

N
T_1
:  
T_N

Output

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

Sample Input 1

2
2
3

Sample Output 1

6

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

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

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

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

Sample Input 2

5
2
5
10
1000000000000000000
1000000000000000000

Sample Output 2

1000000000000000000



Sample input:
2
2
3


Sample output:
6

Submission status: Accepted

Solution code:
import numpy as np


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

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

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

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

Submission status: Accepted

Solution code:
import numpy as np


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

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

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

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

Submission status: Accepted

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

for i in range(1, N):
    ans = (ans * T[i]) // (fractions.gcd(ans, T[i]))
    
print(ans)
#https://mathtrain.jp/abequalgl

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)
res = [1]
for t in T:
    res.append(lcm(t, res[-1]))
print(res[-1])

Submission status: Accepted

Solution code:
import fractions
def lcm(a, b):
    return (a * b) // fractions.gcd(a, b)
N = int(input())
t = []
for i in range(N):
    t.append(int(input()))
ans = 1
for i in t:
    ans = lcm(i, ans)
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 = int(input())
for i in range(n-1):
    ans = lcm(ans,int(input()))
print(ans)

Submission status: Accepted

Solution code:
import math
def gcd(a, b):
    #aとbの最大公約数を求める
    #math.gcdもしくはnp.gcdを使えばいいのだが、AtCoder上のpythonでは使えない
    if a < b:
        return gcd(b, a)
    if b == 0:
        return a
    else:
        c = a % b
        return gcd(b, c)

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

def gcd_list(l):
    #リストlに対して、lの要素の最大公約数を返す
    d = l[0]
    for i in range(len(l) - 1):
        d = gcd(d, l[i + 1])
    return d

def lcm_list(l):
    #リストlに対して、lの要素の最大公倍数を返す
    m = l[0]
    for i in range(len(l) - 1):
        m = lcm(m, l[i + 1])
    return m

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

Submission status: Accepted

Solution code:
#ABC070C
import math
from functools import reduce
N=int(input())
T=[int(input()) for i in range(N)]
#def lcm_base(x, y):
#    interium=x//math.gcd(x, y)
#    return (interium*y)
#print(reduce(lcm_base, T))
ans=1
def grcode(x, y):
    if y==0:
        return (x)
    else:
        return grcode(y, x%y)
for i in range(N-1):
    T[i]=T[i]//grcode(T[i],T[i+1])
    T[i+1]=T[i]*T[i+1]
print(T[N-1])

Submission status: Accepted

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

N = int(input())
a = 1
for i in range(N):
    b = int(input())
    a = a * b // gcd(a,b)

print(a)

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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


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


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
le = [int(input()) for i in range(N)]
le.sort()#昇順
#３数以上の最小公倍数を求める問題
#a,b2数の最小公倍数とcの最小公倍数で求められる
#２数の最小公倍数はユークリッドの互除法を利用して再帰関数で求められる。

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


def LCM(a,b):
    return int(a*b//GCD(a,b))

def multi_LCM(le):
    # print(le)
    if len(le)==1:
        return
    mxle=le[-1]
    del(le[-1])
    le[-1]=LCM(le[-1],mxle)
    multi_LCM(le)

if(len(le)==2):
    le[0]=LCM(le[0],le[1])
if(len(le)>=2):
    multi_LCM(le)

print(le[0])

Submission status: Accepted

Solution code:
from functools import reduce


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


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


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


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

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

print(lcm(*T))

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

Submission status: Accepted

Solution code:
def gcd(a,b):
	while b:
		a, b = b, a % b
	return a
n = input()
t = input()
list = []
for i in range(0,n-1):
	list.append(input())
list.sort()
for i in range(0,n-1):
	t = list[i] * t // gcd(list[i], t)
print t

Submission status: Accepted

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

def scm(a, b):
    x, y = max(a, b), min(a, b)
    while x%y > 0:
        tmp = x%y
        x = y
        y = tmp
    return a*b//y

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

def LCM(a,b):
  return a*b // GCD(a,b)

lcm = A[0]
for i in range(1,N):
  lcm = LCM(lcm, A[i])

print(lcm)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
t=list(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)
ans=t[0]
for i in range(n):
    ans=lcm(ans,t[i])
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

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

def lcm_list(num):
    return reduce(lcm_base, num)

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

t = list(set(t))
print(lcm_list(t))

Submission status: Accepted

Solution code:
import math
N = int(input())
LCM = 1
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
for i in range(N):
    T = int(input())
    LCM = LCM * T // gcd(LCM, T)
print(LCM)

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


# --------------------------------------------

dp = None


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


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


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

    ans = 1

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

    print(ans)


main()

Submission status: Accepted

Solution code:
from functools import reduce
N = int(input())
A = [int(input()) for i in range(N)]
def gcd(x, y):
    return y if x % y == 0 else gcd(y, x%y)
print (reduce(lambda x, y:x * y // gcd(x,y), A, 1))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from functools import reduce

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

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

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

print(reduce(lcm, T))

Submission status: Accepted

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

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

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

print(lcm(T))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def gcd(n, m):
    if min(n, m) == 0:
        return max(n,m)
    else:
        return gcd(min(n,m), max(n,m) % min(n,m))

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


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

time = 0
for i in range(0, n):
    if i == 0:
        time = t_sorted[0]
    else:
        time = lcm(time, t_sorted[i])

print(int(time))

Submission status: Accepted

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

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)
  
def lcm(x, y):
    return (x * y) // gcd(x, y)
  
initial_num = 1
for i in input_list:
    t = lcm(initial_num, i)
    if  t > initial_num:
        initial_num = t
        
print(initial_num)

Submission status: Accepted

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

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

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

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

print(ans)

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
from functools import reduce

#最大公約数を返す
#ユークリッドの互除法
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

#リストに対して最小公倍数を返す
def lcm_list(numbers):
    return reduce(lcm, numbers)

def main():
    n = int(input())
    t_list = []
    for _ in range(n):
        t_list.append(int(input()))
    print(lcm_list(t_list))    

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd
l = [int(raw_input()) for _ in range(int(raw_input()))]
o = reduce(lambda x, y: int(x * y / gcd(x, y)), l)
print o

Submission status: Accepted

Solution code:
import fractions
import math
from functools import reduce
def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

            else:

                flg = 0
    finally:

        return array_result

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

arr_data = getinputdata()

n = int(arr_data[0][0])

arr=[int(arr_data[i][0]) for i in range(1,1+n)]

print(lcm(*tuple(arr)))

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)

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

solve()

Submission status: Accepted

Solution code:
'''
lを求めたい
a * b // gで求める

a = a' * g
b = b' * g
l = a' * b' * g
a * b = l * g
'''
#a >= b
def gcd(a, b):
    r = (a % b)
    if r == 0:
        return b
    else:
        return gcd(b, r)

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

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

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

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

t = []

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

print(lcm_list(t))

Submission status: Accepted

Solution code:
N = int(input())

'''
def mcd(a, b) :
    if (a, b) in memo.keys() :
        return memo[(a, b)]
    else :
        if max(a, b) % min(a, b) == 0 :
            return min(a, b)
        else :
            memo[(a, b)] = mcd(min(a, b), max(a, b) % min(a, b))
            return memo[(a, b)]

def lcm(a, b) :
    return int((a * b) / mcd(a, b))
'''

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

h = 1

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

Submission status: Accepted

Solution code:
import sys
from fractions import gcd
n = input()
arr = [input() for i in range(n)]
if n == 1:
	print arr[0]
	sys.exit(0)
gc = (arr[0]*arr[1])/gcd(arr[0],arr[1])
for i in range(2,n):
	gc = gc*arr[i]/gcd(gc,arr[i])
print gc

Submission status: Accepted

Solution code:
def gcd(x,y):
	if y==0:return x
	return gcd(y,x%y)
a=1	
for i in range(int(input())):
	h=int(input())
	a = a*h // gcd(a,h)	
print(a)

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(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(*numbers):
    return reduce(lcm, numbers)


print(lcm_list(*T))

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
  if b==0:
    return a
  return gcd(b, a%b)

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

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

Submission status: Accepted

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

def gcd(A, B):
    A, B = sorted([A, B], reverse=True)
    prev_r = B
    r = A % B
    while r > 0:
        prev_r = B
        r = A % B
        A, B = B, r
    return prev_r

if N > 1:
    tmp = (T[0] * T[1]) // gcd(T[0], T[1])
    for t in T[2:]:
        tmp = (tmp * t) // gcd(tmp, t)
else:
    tmp = T[0]

print(tmp)

Submission status: Accepted

Solution code:
l=1
for _ in[0]*int(input()):
    t=int(input())
    a,b=l,t
    while b:
        a,b=b,a%b
    l*=t//a
print(l)

Submission status: Accepted

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

Submission status: Accepted

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

from functools import reduce

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

# ようは最小公倍数を出せればいいと思う
def gcd(a, b):
    while b > 0:
        a, b = b, a%b
    return a
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list(TN))

Submission status: Accepted

Solution code:
N=int(input())#入力回数を決める
import fractions
from functools import reduce
li=[]
for i in range(N):
  li.append(int(input()))
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

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

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

Submission status: Accepted

Solution code:
from functools import reduce

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

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

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

n = [int(input()) for _ in range(int(input()))]
print(lcm(*n))

Submission status: Accepted

Solution code:
from functools import reduce

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

def findGCM(a,b):
    while 1:
        if a%b == 0:
            return b
        else:
            a = a%b
        
        if b%a == 0:
            return a
        else:
            b = b%a


def findLCM(a,b):
    gcm = findGCM(a,b)
    return a*b//gcm

ans = reduce(findLCM,T)
print(ans)

Submission status: Accepted

Solution code:
def gcd(a,b): return a if b==0 else 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:
import fractions
import functools
lcm=lambda x,y:x*y//fractions.gcd(x,y)
print(functools.reduce(lcm,[int(input())for _ in[0]*int(input())]))

Submission status: Accepted

Solution code:

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


N=int(input())

a=int(input())

for i in range(N-1):
    b=int(input())
    a=get_lcm(a,b,get_gcd(a,b))

print(a)

Submission status: Accepted

Solution code:
import sys
import heapq
sys.setrecursionlimit(10**8)


#最大公約数
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())

a = int(input())

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

Submission status: Accepted

Solution code:
from functools import reduce
def gcd (a, b):
    if a < b:
        a, b = b, a
    
    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):
    t.append(int(input()))

print(reduce(lcm, t))

Submission status: Accepted

Solution code:
def gcd (a, b):
    if a < b:
        a, b = b, a
    
    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):
    t.append(int(input()))

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

print(b)

Submission status: Accepted

Solution code:
from fractions import gcd

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

Submission status: Accepted

Solution code:
def gcd(a, b):
  m = max(a, b)
  n = min(a, b)
  if n==0:
    return m
  else:
    return gcd(n, m%n)
 
N = int(input())
l = 1
for i in range(N):
  t = int(input())
  g = gcd(l, t)
  l *= t//g
print(l)

Submission status: Accepted

Solution code:
import functools
N = int(input())
T = []
for i in range(N):
  T.append(int(input()))
 
def gcd(a, b):
  if a < b:
    a, b = b, a
  if b == 0:
    return a
  return gcd(b, a % b)
 
def lcm(A, B):
  return (A // gcd(A, B)) * B
 
print(functools.reduce(lcm, T))

Submission status: Accepted

Solution code:
import functools
N = int(input())
T = []
for i in range(N):
  T.append(int(input()))
def gcd(A, B):
  while(True):
    if A and B:
      if A > B:
        A = A % B
      else:
        B = B % A
    else:
      return max(A, B)
 
def lcm(A, B):
  return (A // gcd(A, B)) * B
 
print(functools.reduce(lcm, sorted(T, reverse=True)))

Submission status: Accepted

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

def gcd(a, b):
  if a < b:
    a, b = b, a
  if b == 0:
    return a
  return gcd(b, a % b)
 
def lcm(A, B):
  return A * B // gcd(A, B)
 
print(functools.reduce(lcm, T))

Submission status: Accepted

Solution code:
import math
import functools
N = int(input())
T = []
for i in range(N):
  T.append(int(input()))
def gcd(A, B):
  while(True):
    if A and B:
      if A > B:
        A = A % B
      else:
        B = B % A
    else:
      return max(A, B)

def lcm(A, B):
  return (A // gcd(A, B)) * B

print(functools.reduce(lcm, sorted(T, reverse=True)))

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
N = int(input())
T = []
for i in range(N):
    Ti = input()
    if Ti == '':
        break
    else:
        T.append(int(Ti))

# def base(x, y):
#     return (x * y) // gcd(x, y)

# def lcm(*T):
#     return reduce(base, T, 1)

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

# print(lcm(*T))

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
N = int(input())
T = []
for i in range(N):
    Ti = input()
    if Ti == '':
        break
    else:
        T.append(int(Ti))

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

def lcm(*T):
    return reduce(base, T, 1)

print(lcm(*T))

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
N = int(input())
T = []
for i in range(N):
    Ti = input()
    if Ti == '':
        break
    else:
        T.append(int(Ti))

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

Submission status: Accepted

Solution code:
import fractions


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


N = int(input())
if N == 1:
    print(input())
else:
    t1 = int(input())
    t2 = int(input())
    t = lcm(t1, t2)
    for _ in range(2, N):
        t = lcm(t, int(input()))
    print(t)

Submission status: Accepted

Solution code:
from fractions import gcd
n=int(input())
shuuki=1
for i in range(n):
  t=int(input())
  if shuuki%t != 0:
    shuuki = shuuki*t//gcd(shuuki,t)
print(shuuki)

Submission status: Accepted

Solution code:
from fractions import gcd
n = int(input())
def lcm(l, t):
    return l * t // gcd(l, t)
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
N = int(input())
ts = [int(input()) for i in range(N)]

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

Submission status: Accepted

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


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


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


x = reduce(lcm, T)
print(x)

Submission status: Accepted

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


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


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


x = reduce(lcm, T)
print(x)

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 b:
        a, b = b, a % b
    return a

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

from functools import reduce

r = reduce(lcm, t)

print(r)

Submission status: Accepted

Solution code:
from functools import reduce

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

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_list):
    return reduce(lcm_base, numbers_list, 1)

print(lcm_list(T))

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

Submission status: Accepted

Solution code:
from fractions import gcd

N = int(input())
T = [int(input()) for i in range(N)]
_lcm = 1
for T_i in T:
    _lcm = _lcm * T_i // gcd(_lcm, T_i)

print(_lcm)

Submission status: Accepted

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

from fractions import gcd

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

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())
arr = []
for i in range(n):
 
	arr.append(int(input()))
 
 
def mlcm():
 	if n == 1:
 		return arr[0]

	ans = lcm(arr[0],arr[1])
 
	i = 2
	while i<n:
		ans = lcm(ans,arr[i])
		i+=1
 
	return ans
 
print mlcm()

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

n = int(input())
array = [int(input()) for x in range(n)]


res = array[0]
for i in array:
    res = (res * i) // fractions.gcd(res, i)

print(res)

Submission status: Accepted

Solution code:
from functools import reduce

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

# ユークリッドの互除法
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

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

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

print(lcm(*input_list))

Submission status: Accepted

Solution code:
N = int(input())

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

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

print(lcm)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

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


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

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

print(lcm(nums))

Submission status: Accepted

Solution code:
from fractions import gcd

n = int(input())
ans = 1

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

print(ans)

Submission status: Accepted

Solution code:
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_list(numbers):
    ans = lcm_base(numbers[0], numbers[1])
    for x in numbers:
        ans = lcm_base(ans, x)
    return ans

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

result = lcm_list(t) if len(t) != 1 else t[0]
print(result)

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

Submission status: Accepted

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

n = int(input())

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from fractions import gcd
def inpl(): return map(int, input().split())


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:
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 m():
    N = int(input())
    T = [int(input()) for _ in range(N)]
    ans = T[0]
    for i in range(1,N):
        ans = lcm(ans,T[i])
    return ans

print(m())

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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


num = int(input())
for i in range(n - 1):
    a = int(input())
    num = lcm(num, a)


print(num)

Submission status: Accepted

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

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


n = int(input())

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

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

Submission status: Accepted

Solution code:
def smaller(x, y):
	if x < y: return x
	else: return y

def larger(x, y):
	if x > y: return x
	else: return y

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def f(a,b):
    while b:a,b=b,a%b
    return a
def g(a,b):
    return a*b//f(a,b)
n,a=int(input()),int(input())
for _ in[0]*(n-1):a=g(a,int(input()))
print(a)