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

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

n = int(input())
if n==1:
  print(int(input()))
  sys.exit()

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

Submission status: Accepted

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

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

n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
t = l[0]
for i in range(1, n):
	t = (t*l[i])//gcd(t, l[i])
print(t)

Submission status: Accepted

Solution code:
from sys import stdin
from itertools import groupby

n = int(stdin.readline().rstrip())
li = [int(stdin.readline().rstrip()) for _ in range(n)]

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


point = li[0]
for i in range(n-1):
    point = lcm(point,li[i+1])

print(point)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import fractions as f
n=int(input())
t=int(input())
ans=0
if n==1:
    print(t)
else:
    for i in range(n-1):
        s=int(input())
        t=s*t//f.gcd(t,s)
        if ans<t:
            ans=t
        #print(ans)
    print(ans)

Submission status: Accepted

Solution code:
import fractions
import sys
from functools import reduce

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline


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)


def main():
    N = int(readline())
    T = list(map(int, read().split()))
    print(lcm(*T))


main()

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd

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

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

ans = 1

for t_i in T:
  ans = lcm(ans, t_i)
  
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

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

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

ans = reduce(lcm, l)
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

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

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

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

print(lcm(T))

Submission status: Accepted

Solution code:
import fractions
N = int(input())
tokei = [int(input()) for _ in range(N)]
if N == 1:
    print(tokei[0])
    exit()
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
ans = lcm(tokei[0],tokei[1])
for i in range(2,N):
    ans = lcm(ans,tokei[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 _ in range(N):
    ans = lcm(ans, int(input()))

print(ans)

Submission status: Accepted

Solution code:
import fractions

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:
N=int(input())
T=[]
for i in range(N):
    t=int(input())
    T.append(t)
    
ans=T[0]
def LCM(a,b):
    A=max(a,b)
    B=min(a,b)
    while A%B!=0:
        A,B=B,A%B
    #print(a,b,A,B)
    return a*b//B

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

Submission status: Accepted

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

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


def examC():
    N = I()
    T = [I() for _ in range(N)]
    ans = 1
    for t in T:
        ans = lcm(ans, t)
    print(ans)

import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()

Submission status: Accepted

Solution code:
from fractions import gcd
n=int(input())
T=[]
for i in range(n):
    t=int(input())
    T.append(t)
if n==1:
    print(T[0])
else:
    ts=T[0]*T[1]//gcd(T[0],T[1])
    for i in range(n-2):
        ts=ts*T[i+2]//gcd(ts,T[i+2])
    print(ts)

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

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



print(lcm_list(A))

Submission status: Accepted

Solution code:
#Multiple Clocks
import fractions
N = int(input())
T = int(input())
for i in range (N-1):
    t = int(input())
    T = t*T // fractions.gcd(t,T)
print(T)

Submission status: Accepted

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


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

print(temp)

Submission status: Accepted

Solution code:
import fractions
from functools import reduce
N=int(input())
L = [int(input()) for i in range(N)]
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

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

print(lcm(*L))

Submission status: Accepted

Solution code:
from fractions import gcd  #python 3.5より前
n = int(input())
t = sorted([int(input()) for _ in range(n)])
ans = 1
for i in range(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 range(n)]

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

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

Submission status: Accepted

Solution code:
import sys
import math

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

N = int(input())
T = [int(input()) for _ in range(N)]
if N == 1:
	print(T[0])
	sys.exit()
def SKS(a,b):
	return (a*b)//GCD(a,b)

for i in range(1,N):
	if i == 1:
		temp = SKS(T[0], T[1])
		continue

	temp = SKS(temp, T[i])

print(temp)

Submission status: Accepted

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

num = int(input())
for i in range(num):
  x = int(input())
  if i == 0:
    y = x
  else:
    y = lcm(x, y)
print(y)

Submission status: Accepted

Solution code:
#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt

from sys import exit

from copy import deepcopy
import numpy as np

import bisect
import re
import heapq


ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    n = ii()
    t = []
    for i in range(n):
        t.append(ii())

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

main()

Submission status: Accepted

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


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


print(lcm(Tlist))

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


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


N = int(input())

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

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

n = int(input())

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

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

Submission status: Accepted

Solution code:
def lcm(c):
    from fractions import gcd
    x = c[0]
    for i in range(1,len(c)):
        x = (x * c[i]) // gcd(x,c[i])
    return x
    
N = int(input())
a = [int(input()) for i in range(N)]
print(lcm(a))

Submission status: Accepted

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

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

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

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

def lcm(x, y):
	return (x * y) // gcd(x, y)
a = 1
for i in t:
	a = lcm(a, i)
print (a)

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:
def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    if y==1:
        return 1
    else:
        return gcd(y,x%y)
n=int(input())
t=int(input())
lcm=t
a=t
for i in range(n-1):
    t=int(input())
    a=gcd(lcm,t)
    lcm=lcm*t//a
print(lcm)

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

N = int(input())
times = [int(input()) for _ in range(N)]
print(lcm(times))

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 i in range(n)] 

print(lcm(t))

Submission status: Accepted

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

    r = lcm(T)
    print(r)



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#70c
from functools import reduce
import math
import fractions

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_set = set()

for _ in range(N):
    t = int(input())
    T_set.add(t)
    
T_list = list(T_set)
print(lcm_list(T_list))

Submission status: Accepted

Solution code:
from sys import stdin

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, *t = map(int, stdin.read().split())

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

print(a)

Submission status: Accepted

Solution code:
from fractions import gcd

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:
from functools import reduce
import math
import fractions
N = int(input())
T_list = [ 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_list) )

Submission status: Accepted

Solution code:
import fractions
def lcm_list(List):
    ans=List[0]
    for i in range(1,len(List)):
        ans=ans*List[i] // fractions.gcd(ans,List[i])
    return(ans)

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

print(lcm_list(T))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from functools import reduce

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

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

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

res = reduce(lcm, t)

print(res)

Submission status: Accepted

Solution code:
from fractions import gcd

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

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

print(ans)

Submission status: Accepted

Solution code:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import fractions
from functools import reduce
import bisect
import sys
import logging
import heapq

#logging.basicConfig(level=logging.DEBUG)

input = sys.stdin.readline

setrecursionlimit(1000000)


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

def factorization(n):
	arr = []
	temp = n
	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

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

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

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

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

class PriorityQueue():
	def __init__(self):
		self.queue = []
	def push(self,i):
		heapq.heappush(self.queue,-i)
	def pop(self):
		return -1 * heapq.heappop(self.queue)
	def sum(self):
		return -sum(self.queue)

main()

Submission status: Accepted

Solution code:
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def euqrid(a, b):
    if a > b:
        large = a
        small = b
    else:
        large = b
        small = a

    if small == 0:
        return large
    return euqrid(small, large % small)


def calc_m(numbers):
    if len(numbers) == 1:
        return numbers[0]
    if len(numbers) == 2:
        a = numbers.pop()
        b = numbers.pop()
        e = euqrid(a, b)
        return a * b // e
    a = numbers.pop()
    b = calc_m(numbers)
    e = euqrid(a, b)
    return a * b // e


def solve(inputs):
    clocks = inputs
    return calc_m(clocks)


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    N = int(input())
    ret = solve(int_inputs(N))
    print(ret)

Submission status: Accepted

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

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:
#!/usr/bin/env python3
import sys
import fractions
from functools import reduce

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

def solve(N: int, T: "List[int]"):
    print(reduce(lcm,T))
    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:
n=int(input())
t=[int(input()) for i in range(n)]

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

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

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

Submission status: Accepted

Solution code:
import sys
import os
sys.setrecursionlimit(100000000)

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

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

N = int(input())
T = [int(input()) for _ in range(N)]
if N == 1:
    print(T[0])
    sys.exit()

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import fractions

N=int(input())

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

print(a)

Submission status: Accepted

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

Submission status: Accepted

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

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

N=int(input())
ans=1
for i in range(N):
    ans=LCM(ans,int(input()))

print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

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

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

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

Submission status: Accepted

Solution code:
def gcd(x,y):
    while y!=0:
        x,y=y,x%y
    return x
def lcm(x,y):
    return (x*y)//gcd(x,y)
n=int(input())
t=int(input())
for i in range(n-1):
    t=lcm(t,int(input()))
print(t)

Submission status: Accepted

Solution code:
N=int(input())
T=[int(input()) for i in range(N)]
T.sort()
ans=1
for i in range(N):
  A,B=ans,T[i]
  while(A):
    B%=A
    A,B=B,A
  ans=ans*T[i]//B
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

n,*t = map(int,sys.stdin)
print(lcm(*t))

Submission status: Accepted

Solution code:
import fractions

N = int(input())
T = list(int(input()) for _ 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:
#a,bの最大公約数
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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:
import fractions

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

def lcm(a,b):
    return a * b // fractions.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
from functools import reduce
N = int(input())
T = []
for n in range(N):
    t = int(input())
    T.append(t)

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

print(reduce(get_lcm, T))

Submission status: Accepted

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

Submission status: Accepted

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

n = int(input())
T = [int(input()) for _ in range(n)]
p = 1
for i in T:
  ans = lcm(i,p)
  p = ans
print(ans)

Submission status: Accepted

Solution code:
def lcm(a,b):
    if a%b !=0:
        return lcm(b,a%b)
    else:
        return b
def gcm(a,b):
    l=lcm(a,b)
    return a*b//l

def main():
    n=int(input())
    t=[int(input()) for i in range(n)]
    ans = t[0]
    if n==1:
        print(t[0])
        exit()
    for i in t[1:]:
        ans=gcm(ans,i)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# 最小公倍数

def input():
    import sys
    return sys.stdin.readline().rstrip()


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

def main():
    import math
    import collections
    import itertools
    import functools

    n = int(input())
    ts = [int(input()) for _ in range(n)]
    ans = functools.reduce(lcm, ts)
    print(ans)
        
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import fractions
n=int(input())
t=[]
for i in range(n):
  t.append(int(input()))
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:
N = int(input())
if N == 1:
    T = [int(input())]
else:
    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)

ans = T[0]
for i in range(N):
    ans = lcm(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)]

ans = T[0]

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

print(ans)

Submission status: Accepted

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

def solve():
    n = int(input())
    a = int(input())
    for _ in range(n-1):
        b = int(input())
        a = a*b//gcd(a,b)
    return a

if __name__ == '__main__':
    print(solve())

Submission status: Accepted

Solution code:
#ABC070 C - Multiple Clocks
from fractions import gcd

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

N = int(input())
T = []
ans = 0

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

for i in range(N-1):
    if i == 0:
        ans = lcm(T[0],T[1])    
    t = lcm(ans,T[i+1])
    ans = max(ans,t)

if len(T) == 1:
    print(T[0])
else:
    print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
import fractions
#import math
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(*numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm(*T))

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:
def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    ans = 1
    for i in range(n):
        t = int(input().rstrip('\n'))
        ans = ans * t // fractions.gcd(ans, t)
    print(ans)


if __name__ == '__main__':
    slove()

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(n,m):
  if n<m:
    n,m=m,n
  if n%m:
    return gcd(m,n%m)
  else:
    return m

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

Submission status: Accepted

Solution code:
import fractions as fr
from functools import reduce

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

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

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

print(lcm(*t))

Submission status: Accepted

Solution code:
import fractions
n = int(input())
T = [int(input()) for _ in range(n)]
T.sort()
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

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

print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd

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

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

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

def lcm_base(A, B):
    return (A * B) // fractions.gcd(A, B)

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

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

print(lcm(T))

Submission status: Accepted

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

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)

T=int(input())

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

Submission status: Accepted

Solution code:
from fractions import gcd


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


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

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

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

ans = lcm(l[0], l[1]) if N >= 2 else l[0]
for i in range(2, N):
    ans = lcm(ans, l[i])
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
N = int(input())
p = int(input())
for _ in range(N - 1):
  q = int(input())
  g = gcd(p, q)
  p = p * q // g
print(p)

Submission status: Accepted

Solution code:
import sys
import fractions
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
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()))

n = INT()
t = [0]*n
for i in range(n):
    t[i] = INT()

def lcm(a,b):
    gcd = fractions.gcd(a,b)
    a//=gcd
    b//=gcd
    return a*b*gcd
    
if n == 1:
    print(t[0])
    sys.exit()

res = lcm(t[0],t[1])
for i in range(1,n-1):
    res = lcm(res, t[i+1])

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

for i in t:
    ans=ans*i//fractions.gcd(ans,i)
print(ans)