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
sys.setrecursionlimit(10**6)
n = int(input().rstrip())
seconds = [int(input().rstrip()) for _ in range(n)]
#seconds = list(set(seconds))

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

ans = 1
for num in seconds:
    ans = int(lcm(ans,num))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
def gcd(a,b):
    while b != 0:
        a, b = b, a % b
    return a
# 最小公倍数
def lcm(a,b):
    return a // gcd(a,b) * b

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

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

Submission status: Accepted

Solution code:
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

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

def lcm(a, b):
    return a // gcd(a, b) * b
n=I()
lis=[I() for i in range(n)]
u=1
for i in range(n):
    u=lcm(u,lis[i])
print(u)

Submission status: Accepted

Solution code:
import fractions
N = int(input())
T = [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:
import fractions
def main():
    n = int(input())
    lcm = 1
    for _ in range(n):
        t = int(input())
        lcm = lcm * t //  fractions.gcd(lcm, t)
    print(lcm)


if __name__ == '__main__':
    main()

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

for i in range(n):
    t = int(input())
    if i != 0:
        ans = lcm(ans,t)
    else:
        ans = t
    #print(ans)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ab = [int(input()) for _ in range(n)] #数字1*複数列入力

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

Submission status: Accepted

Solution code:
import fractions as math

n = int(input())

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

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

print(tmp)

Submission status: Accepted

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

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

n = int(input())

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

Submission status: Accepted

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

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

n = int(input())

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

Submission status: Accepted

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

n = int(input())

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

Submission status: Accepted

Solution code:
import fractions

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fractions

n=int(input())

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

print(lcm)

Submission status: Accepted

Solution code:
import sys
import fractions


def input():
    return sys.stdin.readline()[:-1]


N = int(input())
ans = 0
for _ in range(N):
    if ans == 0:
        ans = int(input())
    else:
        t = int(input())
        ans = (ans * t) // fractions.gcd(ans, t)
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
import re
import math
from collections import defaultdict
from collections import deque
import collections
from fractions import Fraction
import fractions
import itertools
from copy import deepcopy
import random
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
#@lru_cache(maxsize=None)
readline=sys.stdin.readline
sys.setrecursionlimit(2000000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class unionfind():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(n)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):
            self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def ispow(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def getbin(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def getfacs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def nextcomb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:return num
def getprimes(n,type="int"):
    if n==0:
        if type=="int":return []
        else:return [False]
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def isprime(num):
    if(num<=1):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=""):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def pm(x):
    return x//abs(x)
def inputintlist(): 
    return list(map(int,input().split()))
def istanchouzouka(A):
    f=True
    prev=min(A)-1
    for a in A:
        if prev>=a:
            f=False
        prev=a
    return f
def istanchouhigensyou(A):
    f=True
    prev=min(A)-1
    for a in A:
        if prev>a:
            f=False
        prev=a
    return f
def getallsum(A):
    s=sum(A)
    dp=defaultdict(int)
    dp[0]=1
    for a in range(0,len(A)):
        for b in range(s,-1,-1):
            if b-A[a]>=0:
                dp[b]+=dp[b-A[a]]
    return dp
def lcm(a,b):
    return a*b//fractions.gcd(a,b)


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

n=int(input())
T=[0]*n
for a in range(n):
    T[a]=int(input())
g=T[0]
for a in T:
    g=lcm(a,g)
print(g)

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(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b
def lcm(a, b):
    return a * b // gcd(a, b)

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

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

from fractions import gcd

n = ii()
l = []
for _ in range(n):
    l.append(ii())

commul = l[0]
for i in l:
    commul = (commul*i)//gcd(commul,i)
print(commul)

Submission status: Accepted

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

import fractions

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

Submission status: Accepted

Solution code:
from fractions import gcd
N = int(input())
if N >=2:
    A = [int(input()) for _ in range(N)]
    B = [0]*(N-1)
    B[0] = (A[0]*A[1])//gcd(A[0], A[1])
    for i in range(N-2):
        B[i+1] = (A[i+2]*B[i])//gcd(A[i+2], B[i])
    ans = B[N-2]
else:
    ans = int(input())
print(ans)

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:
N = int(input())

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

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)  
  
print(lcm_list(arr))

Submission status: Accepted

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

n = int(input())
T = set()
ans = 1
for i in range(n):
    T.add(int(input()))
print(lcm(list(T)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd

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

curr = t[0]
for i in t[1:]:
    curr = curr * i // gcd(curr, i)

print(curr)

Submission status: Accepted

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

Submission status: Accepted

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

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    def lcm(a,b):return a*b // gcd(a,b)
    
    
    n = ii()
    L = [ii() for _ in range(n)]
    l = L[0]
    for i in range(1, n):
        l = lcm(l, L[i])
    print(l)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

N = int(input())
lst = []
res = None 
for _ in range(N):
  n = int(input())
  if res is None:
    res = n
  else:
    res = lcm(res, n)

print(res)

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
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

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

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

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

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n = n//a
    count += 1
  if a**count == n:
    return count
  else:
    return count+1

#############
# Main Code #
#############

N = I()
T = ILs(N)

ans = T[0]

for t in T:
  ans = lcm(ans,t)
P(ans)

Submission status: Accepted

Solution code:
def gcd(a, b):
    if a % b == 0:
        return b
    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):
    t = int(input())
    ans = lcm(ans, t)

print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(lcm_list(a))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#5問目
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 = []
for i in range(N):
    t = int(input())
    T.append(t)
    
print(lcm_list(T))

Submission status: Accepted

Solution code:
from fractions import gcd
n,*t = map(int,open(0).read().split())

x = t.pop(0)
for i in range(len(t)):
    x = x*t[i]//gcd(x,t[i])
print(x)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

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

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

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

ans = lcm(*T)
print(ans)

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

ans = reduce(lambda x, y: x * y // fractions.gcd(x, y), t)
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd

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

Submission status: Accepted

Solution code:
#最大公約数
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

#最小公倍数
def lcm(x, y):
    return x * y // gcd(x, y)

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

lcm_calc = T[0]

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

print(lcm_calc)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# ABC070 C Multiple Clocks

from functools import reduce
from fractions import gcd #python3.5より前
# from math import gcd      #python3,5以降

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

def multi_lcm(numbers):
    return reduce(lcm_base, numbers)

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

print(multi_lcm(t_list))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

def lcm2(args):
    return reduce(lcm,args)

print(lcm2(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-1):
    t = lcm(t, int(input()))
    
print(t)

Submission status: Accepted

Solution code:
import fractions
from functools import reduce
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

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

def myAnswer(N:int,T:list) -> int:
   return lcm_list(T)

def modelAnswer():
   return
def main():
   N = int(input())
   T = [int(input()) for _ in range(N)]
   print(myAnswer(N,T))
if __name__ == '__main__':
   main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue
import fractions

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

# lcm = lambda x, y: (x * y) // math.gcd(x, y)
lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


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

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

    ret = lcm(T[0], T[1]) if len(T) > 1 else T[0]
    for t in T:
        ret = lcm(ret, t)
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

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

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

Submission status: Accepted

Solution code:
from fractions import gcd
n = int(input())
ans = 1
lcm = lambda x, y: x*y // gcd(x, y)
for i in range(n):
    m = int(input())
    ans = lcm(ans, m)
print(ans)

Submission status: Accepted

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

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

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

print(l_lcm(t))

Submission status: Accepted

Solution code:
import fractions
N = int(input())
D = [int(input()) for j in range(N)]
ANS = D[0]
for i in range(N-1):
    ANS = ANS * D[i+1] // fractions.gcd(ANS, D[i+1])
print(ANS)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
import numpy as np
import functools
 
#  = input()
n  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
t  = [int(input()) for i in range(n)]
#
# c = collections.Counter()

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

def multiple(a, b):
    return a*b // euclid(a, b)

def gcd(nums):
    return functools.reduce(euclid, nums)

def lcm(nums):
        return functools.reduce(multiple, nums)

print(lcm(t))

Submission status: Accepted

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

import fractions

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

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

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

Submission status: Accepted

Solution code:
from fractions import gcd #Python3.4
import functools
#from math import gcd #Python3.8
N = int(input())
T = [int(input()) for i in range(N)]
#最小公倍数を求める
def lcm(a,b):
    return a*b//gcd(a,b)

print(functools.reduce(lcm,T))

Submission status: Accepted

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

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(1, n):
    ans = ans * t[i] // 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)]

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

Submission status: Accepted

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

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(t,ans)
print(ans)

Submission status: Accepted

Solution code:
import fractions


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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 12:02:56 2020

@author: shinba
"""
import math

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

n = int(input())

ans = 1

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

print(ans)

Submission status: Accepted

Solution code:
import math
from functools import reduce


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


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

print(reduce(lcm, clocks))

Submission status: Accepted

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

import math
from functools import reduce

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

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

print(lcm_list(t))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    from fractions import gcd
    from functools import reduce

    def cal(a, b):
        t = a * b // gcd(a, b)
        return t

    n, *t = map(int, open(0).read().split())
    ans = reduce(cal, t)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def resolve():
	n = int(input())
	ans = int(input())
	for i in range(n-1):
		v = int(input())
		a = ans
		b = v
		r = a%b
		while r:
			a = b
			b = r
			r = a % b
		ans = ans * v // b
	print(ans)
resolve()