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:
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


inf = 10 ** 18
mod = 10 ** 9 + 7

n = ir()
t = [ir() for i in range(n)]
import fractions
ans = 1
for num in t:
    f=fractions.gcd(ans,num)           #最大公約数
    ans=(ans*num//f)                   #最小公倍数
print(ans)

Submission status: Accepted

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

N = int(input())
T = int(input())
for i in range(1,N):
    S = int(input())
    T = lcm(S,T)
print(T)

Submission status: Accepted

Solution code:
import math
n=int(input())
t=[int(input()) for _ in range(n)]
#print(t)
if n==1:
    print(t[0])
    exit()

for i in range(n-1):
    if i==0:
        lcm=(t[i]*t[i+1])//math.gcd(t[i],t[i+1])
    else:
        lcm=(lcm*t[i+1])//math.gcd(lcm,t[i+1])
print(lcm)

Submission status: Accepted

Solution code:
import math
def lcm(l: list):
    n=len(l)
    lcm=(l[0]*l[1])//math.gcd(l[0],l[1])
    for i in range(2,n):
        lcm=(l[i]*lcm)//math.gcd(l[i],lcm)

    return lcm

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

if n==1:
    print(t[0])
else:
    print(lcm(t))

Submission status: Accepted

Solution code:
"""
すべての秒数の最小公倍数を求める
Gを最大公約数として持つX,Yの最小公倍数はG*X/G*Y/G
"""
def gcd(a,b):
    return a if b==0 else gcd(b,a%b)
N = int(input())
T = [int(input()) for _ in range(N)]
tmp = T[0]
for i in range(1,N):
    t = T[i]
    g = gcd(tmp,t)
    tmp = g*(tmp//g)*(t//g)
print(tmp)

Submission status: Accepted

Solution code:
import math
n,*t = map(int,open(0).read().split())
def lcm(a,b):
  return a*b//math.gcd(a,b)
if n == 1:
  print(t[0])
else:
  ans = lcm(t[0],t[1])
  for i in range(2,n):
    ans = lcm(ans,t[i])
  print(ans)

Submission status: Accepted

Solution code:
N=int(input())
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)
ans=1
for _ in range(N):
  T=int(input())
  ans=lcm(ans,T)
print(ans)

Submission status: Accepted

Solution code:
import math

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

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

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 math import gcd

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc070/tasks/abc070_c
n = int(input())
nums = []
for _ in range(n):
    nums.append(int(input()))


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

ans = nums[0]
for num in nums:
    ans = ans * num // gcd(ans, num)
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9) 
input = sys.stdin.readline
def gdc(a, b):
    if b == 0:
        return a
    return gdc(b, a%b)
def lcm(a,b):
    return a*b//gdc(a,b)

def main():
    N = int(input())
    T = [int(input()) for i in range(N)]
    if N == 1:
        return print(T[0])
    ans = lcm(max(T[0], T[1]), min(T[0], T[1]))
    if N == 2:
        print(ans)
        return
    for i in range(2,N):
        ans = lcm(max(ans, T[i]), min(ans, T[i]))
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
from functools import reduce
numbers = [int(input()) for i in range(int(input()))]
x = reduce(lambda x,y:(x * y) // math.gcd(x, y), numbers, 1)
print(x)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 22 22:26:22 2020

@author: NEC-PCuser
"""
import math

N = int(input())

li = []
ans = 1
for i in range(N):
    t = int(input())
    ans = (ans * t) // math.gcd(ans, t)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

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 = lcm(ans, t[i])

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

Submission status: Accepted

Solution code:
import math
N = int(input())
P = [int(input()) for _ in range(N)]

a = 1
for p in P:
  g = math.gcd(a,p)
  a = a * p // g

print(a)

Submission status: Accepted

Solution code:
import math
from functools import reduce

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

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

N = int(input())
time = []

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

print(lcm(*time))

Submission status: Accepted

Solution code:
from functools import reduce
import math
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
t = IR(n)


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


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


ans = lcm_list(t)
print(ans)

Submission status: Accepted

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

print(np.lcm.reduce(T))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

n=int(input())
a=[]
temp=int(input())
a.append(temp)
g=temp

for _ in range(n-1): #O(nlogt)
    temp=int(input())
    a.append(temp)
    gc=gcd(max(g,temp),min(g,temp))
    g=g*(temp//gc)

print(g)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = [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)

if len(a) ==0:
  print(a[0])
  exit()
else:
  a1 = a[0]
  for i in a:
    a2 = lcm(a1,i)
    a1 = a2
print(a2)

Submission status: Accepted

Solution code:
#from math import gcd
from fractions import gcd

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

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

print(ans)

Submission status: Accepted

Solution code:
import fractions
N = int(input())
ans = int(input())

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

Submission status: Accepted

Solution code:
import fractions

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


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

ans=1

if N==1:
    print(S[0])
    exit()
elif N==2:
    ans=koubaisu(S[0],S[1])
    print(ans)
    exit()
elif N>2:
    ans=koubaisu(S[0],S[1])
    for i in range(N-2):
        ans=koubaisu(ans,S[i+2])

print(ans)

Submission status: Accepted

Solution code:
import fractions

n = int(input())
lcm = 1

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

print(lcm)

Submission status: Accepted

Solution code:
from fractions import gcd
a = 1

for n in range(int(input())):
  T = int(input())
  a = a*T//gcd(a,T)

print(a)

Submission status: Accepted

Solution code:
def main():
    import fractions
    n = int(input())
    inlis = []
    for _ in range(n):
        a = int(input())
        inlis.append(a)
    
    ans = inlis[0]
    for i in range(1, n):
        ans = ans * inlis[i] // fractions.gcd(ans, inlis[i])

    print(ans)

    
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from fractions import gcd

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


for i in range(n):
    num = t[i]
    result = result * num // gcd(result, num)

print(result)

Submission status: Accepted

Solution code:
import fractions

N = int(input())
a = int(input())

for _ in range(N-1):
  b = int(input())
  c = fractions.gcd(a,b)
  d = a // c
  e = b // c
  a = d*e*c
  
print(a)

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
#from collections import deque,defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
g = 1
lcm = 1
A = [I() for _ in range(n)]
for a in A:
    g = gcd(lcm,a)
    #print(g)
    lcm = lcm * a // g
    #print(lcm)
print(lcm)

Submission status: Accepted

Solution code:
import sys
import fractions

def input(): return sys.stdin.readline().strip()
def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

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

    return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from functools import reduce
n = int(input())
ts = [int(input())for _ in range(n)]


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


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


print(reduce(lcm, ts))

Submission status: Accepted

Solution code:
import fractions


def main():
    N = int(input())
    gcd = int(input())
    lcm = gcd
    for _ in range(N-1):
        curr_t = int(input())
        gcd = fractions.gcd(lcm, curr_t)
        lcm = (lcm*curr_t)//gcd
    print(lcm)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def lcm(a, b): #lcm(int, int)
    if a<b:
        a,b = b,a
    x = a*b
    r = a%b
    while r != 0:
        a = b
        b = r
        r = a % b
    return x//b
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 = lcm(ans,t[i])
print(ans)

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline().rstrip())

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

from fractions import gcd

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p = 1
#a,bの最大公約数
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

#a,bの最小公倍数
def lcm(a, b):
	return a * b // gcd (a, b)
for i in range(n):
    a = int(input())
    p = lcm(a, p)
print(p)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce


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:
import sys
from fractions import gcd

read = sys.stdin.buffer.read

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

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

print(lcm(t))

Submission status: Accepted

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

import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list(T))

Submission status: Accepted

Solution code:
import fractions

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

gcdd = 1

for i in range(N):
    num = times[i]
    gcdd = gcdd * num // (fractions.gcd(gcdd, num))


print(gcdd)

Submission status: Accepted

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

ans = lst[0]
for i in range(1, N):
    ans = ans * lst[i] // fractions.gcd(ans, lst[i])
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())
ans = 1
for i in range(n):
    ans = lcm(ans,int(input()))
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(*numbers):
    return reduce(lcm_base, numbers, 1)

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

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

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce


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


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

print(reduce(lcm, T))

Submission status: Accepted

Solution code:
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]
# @lru_cache(None)

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
n=l()[0]
LCM=1
for i  in range(n):
    t=int(input())
    g=gcd(LCM,t)
    LCM=(LCM*t)//g
print(LCM)

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

def lcm_for_lst(lst):
  return reduce(lcm, lst)

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
import sys
from fractions import gcd

input = sys.stdin.readline


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


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 = lcm(ans, T[i])

    print(ans)


if __name__ == "__main__":
    main()

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)

#2数の積/最大公約数=最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)

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

Submission status: Accepted

Solution code:
import math
import fractions


import sys
import itertools
input = sys.stdin.readline
 
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n = I()
def main():
    for i in range(n):
        temp = I()
        try:
            past = temp * past // fractions.gcd(temp, past)
        except:
            past = temp
    print(past)
    
main()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

import fractions
n = t[0]
for a,b in zip(t, t[1:]):
    g = fractions.gcd(n, b)
    n = n*b//g
print(n)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
import fractions
from functools import reduce

rr = lambda: sys.stdin.buffer.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

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

Submission status: Accepted

Solution code:
n=int(input())

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

t=1

for _ in range(n):
    t_i = int(input())

    t = lcm(t,t_i)

print(t)

Submission status: Accepted

Solution code:
import fractions
n = int(input())

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

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


N, *T = map(int, open(0).read().split())
print(reduce(lambda x, y: x * y // gcd(x, y), T))

Submission status: Accepted

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

Submission status: Accepted

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

def resolve():
    n=int(input())
    S=[int(input()) for i in range(n)]

    from functools import reduce
    from fractions import gcd

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


    print(reduce(lcm, S))
resolve()

Submission status: Accepted

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

from fractions import gcd
from functools import reduce
def lcm(x,y):return x*y//gcd(x,y)
ans=reduce(lcm,t)
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
N=int(input())
def lcm(a,b):
    return a//gcd(a,b)*b
T=[]
for i in range(N):
    t=int(input())
    T.append(t)
a=1
for i in range(N):
    a=lcm(a,T[i])

print(a)

Submission status: Accepted

Solution code:
from fractions import gcd


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


N = int(input())

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

Submission status: Accepted

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

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

now = 1
for i in t:
    now = lcm(now,i)

print(now)

Submission status: Accepted

Solution code:
from fractions import gcd
n = int(input())
t = list(int(input()) for _ in range(n))


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:
def main():
    from functools import reduce

    N = int(input())

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

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

    ret = reduce(lcm, (int(input()) for _ in range(N)))
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions


def readints():
    return list(map(int, input().split()))


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


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
# n=int(input())
# a=readints()
n = int(input())
t = []
for _ in range(n):
    t.append(int(input()))
# print(t)
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:
from fractions import gcd
from functools import reduce

n = int(input())
t = list(int(input()) for _ 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(t))

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N = int(input())
T = [int(input()) for _ in range(N)]
ans = T[0]
for i in range(1,N):
    a = gcd(ans,T[i])
    ans = (ans//a)*T[i]
print(ans)

Submission status: Accepted

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

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



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

  print(ans)
  return

if __name__ == "__main__":
  resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

from fractions import gcd

N = int(input())

T = int(input())

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

print (T)

Submission status: Accepted

Solution code:
import fractions
def lcm(a):
    LCM = a[0]
    for i in range(1, n):
        LCM = LCM * a[i] // fractions.gcd(LCM, a[i])
    return LCM

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

print(lcm(t))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7

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


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


def resolve():
    n = int(input())
    T = list(int(input()) for _ in range(n))

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

    print(res)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

def resolve():
    n=int(input())
    S=[]
    for i in range(n):
        S.append(int(input()))
    from functools import reduce
    from fractions import gcd

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


    print(reduce(lcm, S))
resolve()

Submission status: Accepted

Solution code:
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

Submission status: Accepted

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

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

N = int(input())
L = 1

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

print(L)

Submission status: Accepted

Solution code:
from sys import stdin
from fractions import gcd
def lcm(a,b):
    return a*b//gcd(a,b)

def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    t=[int(readline()) for _ in range(n)]

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

    print(ans)

if __name__=="__main__":
    main()

Submission status: Accepted

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

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)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
from fractions import gcd
from functools import reduce
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

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

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

def main():
    N = int(readline())
    T = []
    for _ in range(N):
        T.append(int(readline()))
    ans = lcm_list(T)
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import fractions

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd

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

lcm = lambda x,y:x//gcd(x,y)*y

ans=reduce(lcm,t)

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Fri May 29 21:29:28 2020

@author: naoki
"""
import fractions

N = int(input()) # 時計の個数
T = [int(input()) for i in range(N)] # 時計の針が一周する時間
T.sort() # 小さい順番にソートする
lcm = T[0] 

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

Submission status: Accepted

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

T = [int(input()) for _ in range(N)]
ans = T[0]
for e in T:
    ans = lcm(e,ans)
print(ans)