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 math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

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

def main():
    N = I()
    T = []
    for _ in range(N):
        T.append(I())
    n_lcm = lcm(T[0], T[0])
    for i in range(1, N):
        n_lcm = lcm(n_lcm, T[i])
    print(n_lcm)
main()

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(N-1):
    ans = ans * T[i+1]//fractions.gcd(ans, T[i+1])
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_ls(num):
    return reduce(lcm, num, 1)

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

print(lcm_ls(ls))

Submission status: Accepted

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

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


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

ans = 1
for i in range(n):
    ans = lcm(ans,li[i])
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(N-1):
    ans = ans * T[i+1]//fractions.gcd(ans, T[i+1])
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T = []
for i 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_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(T))

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
N=int(input())
L=[int(input()) for _ in range(N)]
print(lcm_list(L))

Submission status: Accepted

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

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

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

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

print(ans)

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

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

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

print(lcm_list(T))

Submission status: Accepted

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

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

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

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

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

if n == 1:
    ans = t[0]
else:
    lcd = t[0]*t[1]//gcd(t[0],t[1])
    for i in range(2,n):
        lcd = lcd*t[i]//gcd(lcd,t[i])
    ans = lcd

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)
 
N = int(input())
 
t = []
for _ in range(N):
  t.append(int(input()))
 
print(lcm_list(t))

Submission status: Accepted

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

from fractions import gcd
lcm=1
for i in range(n):
    lcm=(lcm*t[i])//gcd(lcm,t[i])
print(lcm)

Submission status: Accepted

Solution code:
from fractions import gcd
#from math import gcd
def lcm(a,b):
    return a*b//gcd(a,b)
def main():
    n=int(input())
    T=set(list(int(input()) for _ in  range(n)))
    ans=1
    for t in T:
        ans = lcm(t,ans)
    print(ans)
main()

Submission status: Accepted

Solution code:
import fractions


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


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

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

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

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

print(lcm(T))

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

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

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

print(lcm(T))

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

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

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

print(ans)

Submission status: Accepted

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

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


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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a
  
ans = 1
for _ in range(n):
    x = int(input())
    ans *=  x//gcd(ans,x)
print(ans)

Submission status: Accepted

Solution code:
import math
import numpy as np
from fractions import gcd
import fractions
import collections

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] // fractions.gcd(ans, T[i])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(lcm_list(T))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
n = int(input())
t = [int(input()) for _ in range(n)]
if n == 1:
    print(t[0])
    exit()
ans = t[0] * t[1] // gcd(t[0], t[1])
for i in range(2, n):
    ans = ans * t[i] // gcd(ans, t[i])
print(ans)

Submission status: Accepted

Solution code:
from functools import reduce

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

def gcd_list(numbers):
    return reduce(gcd, numbers)

def lcm_list(numbers):
    return reduce(lcm, numbers, 1)
    
N = int(input())
times = [int(input()) for i in range (N)]

print(lcm_list(times))

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

if N == 1:
    T = int(input())
    print(T)
    exit()

T = []
for i in range(N):
    T.append(int(input()))
    
lcm_T = lcm(T[0], T[1])
for i in range(2, N):
    lcm_T = lcm(lcm_T, T[i])
    
print(lcm_T)

Submission status: Accepted

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

N=int(input())
A=int(input())
answer=A
for i in range(1,N):
  T=int(input())
  answer=answer*T//gcd(answer,T)
print(answer)

Submission status: Accepted

Solution code:
# coding: utf-8
try:
    from fractions import gcd
except:
    from math import gcd
N = int(input())
T = []
for i in range(N):
    t = int(input())
    T.append(t)
ans = T[0]
for i in range(1, N):
    ans = (ans * T[i]) // gcd(ans, T[i])
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 a>=b:
        if b == 0:
            return a
        else:
            return gcd(b,a%b)
    else:
        if a == 0:
            return b
        else:
            return gcd(a,b%a)
if N == 1:
    print(T[0])
elif N == 2:
    print(int(T[0]//gcd(T[0],T[1])*T[1]))
else:
    T2 = [int(T[0]//gcd(T[0],T[1])*T[1])]
    for i in range(N-2):
        nex = int(T2[i]//gcd(T2[i],T[i+2])*T[i+2])
        T2.append(nex)
    print(T2[-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import fractions
from functools import reduce
input = sys.stdin.readline
N = int(input())
T = []
for _ in range(N):
    T.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(T))

Submission status: Accepted

Solution code:
def lcm(a, b):
  gcd = a
  _ = b
  while _:
    gcd, _ = _, gcd%_
  return a*b // gcd

def run():
  N = int(input())
  T_li = [int(input()) for n in range(N)]
  i = T_li[0]
  for T in T_li[1:]:
    i = lcm(T, i)
  print(i)
  
if __name__ == '__main__':
  run()

Submission status: Accepted

Solution code:
import sys
from functools import reduce

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

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

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

def main():
    return reduce(lcm, t)

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

Submission status: Accepted

Solution code:
import fractions
N = int(input())
tx = int(input())
for _ in range(N-1):
    ty = int(input())
    tx = (tx * ty) // fractions.gcd(tx, ty)
print(tx)

Submission status: Accepted

Solution code:
import sys

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

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

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

N = getInt()

answer = 1

for i in range(N):
	answer = lcm(answer, getInt())

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

def gcd_list(nums):
    return reduce(gcd, nums)

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

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

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

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 i in range(n)]
 
print(reduce(lcm, t))

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:
n=int(input())
T=[int(input()) for i in range(n)]
def gcd(a,b):
    if b==0:
        return(a)
    else:
        return(gcd(b,a%b))
def lgm(a,b):
    return(a*b//(gcd(a,b)))
if n==1:
    print(T[0])
else:
    ans=T[0]
    for i in range(1,n):
        ans=lgm(ans,T[i])
    print(ans)

Submission status: Accepted

Solution code:
import fractions as f
n=int(input())
ans=int(input())
for i in range(n-1):
   x=int(input())
   ans=x*ans//f.gcd(ans,x)
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string,fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
mod = 10**9+7
ans = 0 ;count = 0 ;pro = 1

def lcm(m,n):
    return (m*n)//fractions.gcd(m,n)
n=int(input())
T=[int(input()) for i in range(n)]
g=1
for ti in T:
    pro=lcm(pro,ti)
print(pro)

Submission status: Accepted

Solution code:
import fractions 

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

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

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

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

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

Submission status: Accepted

Solution code:
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

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



import fractions

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

N = one_int()

temp = one_int()
for i in range(N-1):
    temp = lcm(temp, one_int())

print(temp)

Submission status: Accepted

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

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

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

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

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())
A = [int(input()) for a in range(N)]
print(lcmm(A))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

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

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

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

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

print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())


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

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

ans = 1

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

print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))
t.sort()
if(n==1):
    print(t[0])
    exit()
ans=lcm(t[0],t[1])
if(n==2):
    print(ans)
    exit()
for i in range(2,n):
    ans=lcm(ans,t[i])
print(ans)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

def lcm(a, b):
    return 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:
from fractions import gcd


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


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

ans = lcm(T)

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import fractions
import functools

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

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

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

Submission status: Accepted

Solution code:
import fractions

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

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

print(a)

Submission status: Accepted

Solution code:
from functools import reduce

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


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


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


def lcmm(l):
    return reduce(lcm, l)


print(lcmm(t))

Submission status: Accepted

Solution code:
from functools import reduce

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


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


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


def lcmm(l):
    return reduce(lcm, l)


print(lcmm(t))

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

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

def main():
    n=int(input())
    ans=int(input())
    for _ in range(n-1):
        t=int(input())
        ans=t*ans//gcd(t,ans)
    print(ans)
main()

Submission status: Accepted

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

if n==1:
  print(t[0])
  exit()
  
def gcd(x, y):
	while y:
		x, y = y, x % y
	return x

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

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

Submission status: Accepted

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

import fractions

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
#n, k = map(int,input().split())
#plst = [int(i) for i in input().split()]
lst = [int(input()) for _ in range(n)]

def a(p, q):
    if p % q == 0:
        return q
    else:
        return a(q, p % q)

f = lst[0]
for i in range(1, n):
    f = f * (lst[i] // a(f, lst[i]))

print(f)

Submission status: Accepted

Solution code:
n = int(input())
#n, k = map(int,input().split())
#plst = [int(i) for i in input().split()]
if n == 1:
    print(int(input()))
else:
    lst = [int(input()) for _ in range(n)]

    def a(p, q):
        if p % q == 0:
            return q
        else:
            return a(q, p % q)

    f = lst[0] * (lst[1] // a(lst[0], lst[1]))
    for i in range(2, n):
        f = f * (lst[i] // a(f, lst[i]))
    print(f)

Submission status: Accepted

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

Numbers = list(int(input()) for _ in range(N))
ans = Numbers[0]
for i in range(1, N):
    ans = ans * Numbers[i] // fractions.gcd(ans, Numbers[i])
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
#from math import gcd
n = int(input())
a = 1
for _ in range(n):
    b = int(input())
    a = a * b // gcd(a, b)
    
print(a)

Submission status: Accepted

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

n=int(input())
'''
t=[int(input()) for i in range(n)]
t.sort(reverse=1)
ans=t[0]
for x in t:
  if ans%x!=0:
    ans=ans*x//gcd(ans,x)
'''
ans=int(input())
for i in range(n-1):
  u=int(input())
  if ans%u!=0:
    ans=ans*u//gcd(ans,u)



print(ans)

Submission status: Accepted

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

n=int(input())
t=[int(input()) for i in range(n)]
t.sort(reverse=1)
ans=t[0]
for x in t:
  if ans%x!=0:
    ans=ans*x//gcd(ans,x)
'''
for i in range(n-1):
  u=int(input())
  if ans%u!=0:
    ans=ans*u//gcd(ans,u)
'''


print(ans)

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

def lcm_2(x, y):
    return (x * y) // fractions.gcd(x, y)
    
def lcm(l):
    return reduce(lcm_2, l, 1)
    
n = int(input())
t = [int(input()) for _ in range(n)]

print(lcm(t))

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):
    x = a[0]
    for i in range(1, len(a)):
        x = x * a[i] // gcd(x, a[i])
    return x

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def gmax(a,b):
  if a<b:
  	a,b=b,a
  while a%b!=0:
    tmp=a
    a=b
    b=tmp%b
  return b
 
n=int(input())
x=[]
for i in range(n):
  x.append(int(input()))

if len(x)!=1:
  g=gmax(x[0],x[1])
  l=x[0]*x[1]//g

  for i in range(2,len(x)):
    g=gmax(x[i],l)
    l=(x[i]*l)//g
else:
  l=x[0]
print(l)

Submission status: Accepted

Solution code:
import fractions

def lcm(a, b):
    return a * b // fractions.gcd (a, b)
  
n = int(input())
t = sorted([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:

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

Submission status: Accepted

Solution code:
import fractions

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

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

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

print(ans)

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
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect_left
from heapq import heappush, heappop
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall

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

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

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_base(x, y):
    return (x * y) // gcd(x, y)
def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm(t))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

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

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

Submission status: Accepted

Solution code:
import fractions

def main():
    n = int(input())  #nは入力回数
    t = [int(input()) for _ in range(n)]

    if not (1 <= n and n <= 100 and isinstance(n, int)):
        return
    for i in t:
        if not (1 <= i and i <= 10**18 and isinstance(i, int)):
            return

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

    if k <= 10**18:
        print(k)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

def lcm_rec(num):
    return reduce(lcm, num, 1)

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

ans = lcm_rec(T)
print(ans)

Submission status: Accepted

Solution code:
import fractions
n=int(input())
lst=list(int(input()) for _ in range(n))
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:
# ABC070c
from fractions import gcd
from functools import reduce
import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())


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


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


def gcds(*numbers):
    return reduce(gcd, numbers)


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

Submission status: Accepted

Solution code:
N=int(input())
T=[0]*N
for i in range(N):
  T[i]=int(input())
  
def gcd(a,b):
  if b>a:
    a,b=b,a
  while a%b!=0:
    a,b=b,a%b
  return b

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

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

Submission status: Accepted

Solution code:
from fractions import gcd
n = int(input())
for i in range(n):
    t = int(input())
    if i == 0:
        l = t
        k = t
    else:
        l = gcd(k, t)
        k = k * t//l
print(k)

Submission status: Accepted

Solution code:
import fractions

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

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

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

ans = lcm(num)

print(ans)

Submission status: Accepted

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