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

def gcd(m, n) :
    if m < n :
        m, n = n, m
        
    while n != 0 :
        m, n = n, m % n
    return m

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit = 10000000

def get_gcd(A, B):
    r = A%B
    if r == 0:
        return B
    else:
        return get_gcd(B, r)
           
if __name__ == '__main__':
    N = int(input())
    T = [int(input()) for _ in range(N)]
    
    ans = 1
    for t in T:
        gcd = get_gcd(ans, t)
        ans = t//gcd*ans
        
    print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd


def least_common_multiple(iter):
    '''
    最小公倍数を返す
    '''
    lcm = lambda x, y: x*y//gcd(x, y)
    return reduce(lcm, iter)


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

Submission status: Accepted

Solution code:
import fractions

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

N=int(input())

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

if N==1:
    print(A[0])
    exit(0)
k=lcm(A[0],A[1])
for i in range(2,N):
    k=lcm(k,A[i])
print(k)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

N=int(input())
T =[int(input()) for i in range(N)]
print(reduce(lambda x,y:x*y//gcd(x,y), T))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

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


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


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

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())
T = {int(input()) for _ in range(N)}

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

Submission status: Accepted

Solution code:
import fractions
from functools import reduce


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


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


if __name__ == '__main__':
    n = int(input())
    t = [int(input()) for i in range(n)]

    print(lcm_list(t))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd

n = int(input())
tn = [int(input()) for _ in range(n)]
answer = tn[0]
for i in range(1,n):
    answer = answer * tn[i] // gcd(answer,tn[i])
print(answer)

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)

print(lcm_list(T))

Submission status: Accepted

Solution code:
import fractions

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

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

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

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

print(lcm(int(input()) for _ in range(int(input()))))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = int(input())

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


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

print(ans)

Submission status: Accepted

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

n = int(input())
for i in range(n):
    t = int(input())
    if i == 0:
        t1 = t
    else:
        t2 = t
        gcdt = gcd(t1,t2)
        lcn = t1*t2//gcdt
        t1 = lcn
print(t1)

Submission status: Accepted

Solution code:
import sys
n = int(input())
src = [int(input()) for _ in range(n)]
if n == 1:
    print(src[0])
    sys.exit()

def check(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b
tmp = src[0]
for i in range(n-1):
    tmp = tmp//check(tmp, src[i+1])*src[i+1]
print(tmp)

Submission status: Accepted

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

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

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

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

print(ans)

Submission status: Accepted

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


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


N = int(input())

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

Submission status: Accepted

Solution code:
from functools import reduce
def GCD(a:int , b: int) -> int:
    return a if b == 0 else GCD(b, a % b)
def LCM(a: int, b: int) -> int:
    return a * b // GCD(a, b)

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

ans = reduce(LCM, t)

print(ans)

Submission status: Accepted

Solution code:
def GCD(a:int , b: int) -> int:
    return a if b == 0 else GCD(b, a % b)
def LCM(a: int, b: int) -> int:
    return a * b // GCD(a, b)

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

ans = t[0]
if n > 1:
    ans = LCM(t[0], t[1])
    for i in range(2, n):
        ans = LCM(ans, t[i])

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
lcm = 1
for i in range(n):
  tmp = int(input())
  big = lcm
  sml = tmp
  while sml > 0:
    big,sml = sml,big%sml
  gcd = big
  lcm = lcm * tmp // gcd
print(lcm)

Submission status: Accepted

Solution code:
N = int(input())
ans = 1

from fractions import gcd

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

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:
#!/usr/bin/env python3
import sys
INF = float("inf")


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


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


def solve(N: int, T: "List[int]"):
    ans = 1
    for i in range(N):
        ans = LCM(ans, T[i])

    print(ans)

    return


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 gcd(x,y):
    if y>x:
        a=y
        y=x
        x=a
    while y:
        a=x%y
        x=y
        y=a
    return x
N=int(input())
T=[int(input()) for i in range(N)]
lcm=d=T[0]
T=T[1:]
for i in T:
    j=i*lcm
    d=gcd(i,lcm)
    lcm=j//d
print(lcm)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fractions

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

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

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

Submission status: Accepted

Solution code:
import fractions

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

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

ans = nums[0]

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

print(ans)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a = int(input())
c = [int(input()) for i in range(a)]

import fractions
#最小公倍数を順次求めていく
def lcm(x,y):
    return x*y//fractions.gcd(x,y)
ret = 1
for i in c:
    ret = lcm(ret,i)
print(ret)

Submission status: Accepted

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

# N < 100
# gcd(a,b) lcd(a,b) = ab

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

l = 1
g = 0
for t in T:
    l = lcd(l, t)
    g = gcd(g, t)
print(l)

Submission status: Accepted

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

N = int(input())

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

print(lcmm(T))

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

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

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

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

print(lcm(*T))

Submission status: Accepted

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


def l_c_m(x, y):
    return x * y // g_c_d(x, y)


a = int(input())
b = 1
for i in range(a):
    c = int(input())
    b = l_c_m(b, c)
print(b)

Submission status: Accepted

Solution code:
import fractions

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

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

Submission status: Accepted

Solution code:
import sys,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:
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
  return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

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

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

Submission status: Accepted

Solution code:
import fractions as fc
from functools import reduce
N=int(input())
T=[int(input()) for _ in range(N)]
def lb(x,y):
    return (x*y)//fc.gcd(x,y)
def lc(*n):
    return reduce(lb,n,1)
print(lc(*T))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import fractions


def main():
    n = int(input())
    t = [None] * n

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def l(a, b):
  if a > b:
    a, b = b, a
  return l(a, b % a) if b % a else a

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

N = int(input())
res = 1
for n in range(N):
  res = g(res, int(input()))

print(res)

Submission status: Accepted

Solution code:
from fractions import gcd

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import fractions


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


n = int(sys.stdin.readline())
t = [int(x) for x in sys.stdin.readlines()]
total_lcm = 1
for i in t:
    total_lcm = lcm(total_lcm, i)
print(total_lcm)

Submission status: Accepted

Solution code:
import fractions

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

Submission status: Accepted

Solution code:
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
Mod = 1000000007



def main(): #startline-------------------------------------------
    N = int(input())
    T = [int(input()) for i in range(N)]
    def LCM(i,j):
        return i*j//gcd(i,j)
    tempans = [T[0]]*(N)
    for i in range(1,N):
        tempans[i] = LCM(tempans[i-1],T[i])
    print(tempans[N-1])
if __name__ == "__main__":
    main() #endline===============================================




def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

Submission status: Accepted

Solution code:
## abc070c: Multiple Clocks

def gcm(q,r): ## 最大公約数
    if q<r: q, r = r, q
    while(r>0): q, r = r, q%r,
    return q

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

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

Submission status: Accepted

Solution code:
## abc070c: Multiple Clocks

def gcm(q,r): ## 最大公約数
    if q<r: q, r = r, q
    while(r>0): q, r = r, q%r,
    return q

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

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

Submission status: Accepted

Solution code:
## abc070c: Multiple Clocks

def gcm(q,r): ## 最大公約数
    if q<r: q, r = r, q
    while(r>0): q, r = r, q%r,
    return q

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

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

Submission status: Accepted

Solution code:
## abc070c: Multiple Clocks

def gcm(q,r): ## 最大公約数
    if q<r: q, r = r, q
    while(r>0):
        q, r = r, q%r,
    return q

def lcm(a,b): ## 最小公倍数
    if a==b: return a
    return a*b//gcm(a,b)

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

Submission status: Accepted

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

def main():
    N = int(input())
    T = [0] * N

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


main()

Submission status: Accepted

Solution code:
from fractions import gcd

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

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

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

print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd                                                                   
                                                                                            
def main():                                                                                 
    N = int(input())                                                                        
    tt = [int(input()) for _ in range(N)]                                                   
    ans = tt[0]                                                                             
    for t in tt[1::]:                                                                       
        ans = ans*t//gcd(ans,t)                                                             
    print(ans)                                                                              
                                                                                            
                                                                                            
if __name__ == '__main__':                                                                  
    main()

Submission status: Accepted

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


def l_c_m(x, y):
    return x * y // g_c_d(x, y)


a = int(input())
b = [int(input()) for _ in range(a)]
c = 1
for i in range(a):
    c = l_c_m(c, b[i])
print(c)

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())
for i in range(n):
    if i==0:
        tmp=int(input())   
    else:
        tmp=lcm(tmp,int(input()))
print(tmp)

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
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    n = S()
    n1 = n[::-1]
    for i in range(len(n)):
        if n1[i] != n[i]:
            print("No")
            return
    print("Yes")
    return

#B
def B():
    a, b, c, d = LI()
    ans = [0 for i in range(101)]
    ans[a] += 1
    ans[b] -= 1
    ans[c] += 1
    ans[d] -= 1
    for i in range(100):
        ans[i+1] += ans[i]
    print(ans.count(2))
#C
def C():
    n = II()
    ans = 1
    def gcd(a, b):
        while b:
            a, b = b, a % b
        return a
    for _ in range(n):
        t = II()
        ans = ans // gcd(ans, t) * t
    print(ans)
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
#ABC070C
import math

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

n = int(input())

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

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

print(ans)

Submission status: Accepted

Solution code:
import fractions
from functools import reduce
n = input()
x=[0]*int(n)
def lcm(a, b):
    return (a * b) // fractions.gcd(a, b)
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)
for i in range(int(n)):
  x[i]=int(input())
  
print(lcm_list(x))

Submission status: Accepted

Solution code:
import fractions


def main():
    N = int(input())
    ans = int(input())
    for i in range(N-1):
        T = int(input())
        ans = (ans * T) // fractions.gcd(ans, T)  # 最小公倍数
        ans = int(ans)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from functools import reduce

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


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


def gcd(numbers):  # "numbers" is list
    return reduce(gcd_base, numbers)


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


def lcm(numbers):  # "numbers" is list
    return reduce(lcm_base, numbers)  # [third argument] return 1 if "numbers" is empty


print(lcm(T))

Submission status: Accepted

Solution code:
from functools import reduce

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


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


def gcd(numbers):  # "numbers" is list
    return reduce(gcd_base, numbers)


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


def lcm(numbers):  # "numbers" is list
    return reduce(lcm_base, numbers,
                  1)  # [third argument] return 1 if "numbers" is empty


print(lcm(T))

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

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

print(tmp)

Submission status: Accepted

Solution code:
import math
from functools import reduce

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

# def gcd(numbers):  # "numbers" is list
#     return reduce(math.gcd, numbers)

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


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


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


def lcm(numbers):  # "numbers" is list
    return reduce(lcm_base, numbers,
                  1)  # [third argument] return 1 if "numbers" is empty


print(lcm(T))

Submission status: Accepted

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

def lcm(a,b):
    return a*b//fractions.gcd(a,b)
ans = 1
for i in range(N):
    ans = lcm(ans,T[i])
print(ans)

Submission status: Accepted

Solution code:
def gcd(S, T):
  if (S % T == 0):
    return T
  else:
    S = S % T
    return gcd(T, S)

def lcm(S, T):
  return S * T // gcd(S,T)

N = int(input())
S = int(input())

for i in range(N-1):
    T = int(input())
    S = lcm(max(S, T), min(S, T));

print(S)

Submission status: Accepted

Solution code:
import sys


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


fin = sys.stdin.readline
N = int(fin())
T_list = tuple(int(fin()) for _ in range(N))
l = T_list[0]
for T in T_list[1:]:
    l = lcm(l, T)
print(l)

Submission status: Accepted

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

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

    print(reduce(lambda x,y: lcm(x,y), T, 1))

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(100000)

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

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

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

print(ans)

Submission status: Accepted

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

# print(dat)

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

res = dat[0]

for i in range(n):
    res = lcm(res, dat[i])

print(res)

Submission status: Accepted

Solution code:
N = int(input())
dict = {}
for _ in range(N):
    t = int(input())
    if t not in dict:
        dict[t] = 1

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

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

ans = 1
for k in dict.keys():
    ans = lcm(ans, k)

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# ABC 70, C - multiple clock
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):
    bigger = max(a, b)
    smaller = min(a, b)
    while smaller:
        bigger, smaller = smaller, bigger % smaller
    return bigger


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


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

Submission status: Accepted

Solution code:
def gcd(x, y):
    if x < y:
        t = x
        x = y
        y = t
    while x % y != 0:
        t = x
        x = y
        y = t % x
    return y
N = int(input())
T = [int(input()) for i in range(N)]
LCM = T[0]
for i in range(N-1): 
    g = gcd(LCM, T[i+1])
    LCM = (LCM*T[i+1])//g
print(LCM)

Submission status: Accepted

Solution code:
# 2019/07/12

from fractions import gcd

n=int(input())
l=1
for _ in range(n):
    tmp=int(input())
    l=(tmp*l)//gcd(tmp,l)
print(l)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def solve(n):
    t = [int(input()) for _ in range(n)]
    t0 = t[0]
    for t1 in t[1:n]:
        t0 = lcm(t0, t1)
    return t0


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


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


if __name__ == '__main__':
    n = int(input())
    print(solve(n))

Submission status: Accepted

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

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)

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