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: Runtime Error

Solution code:
import math

n = int(input())
t = [int(input()) for _ in range(n)]
t_max = max(t)
i = 1


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


primes = []
for ti in t:
    if is_prime(ti):
        primes.append(ti)

prod = 1
for prime in primes:
    if t_max % prime == 0:
        primes.remove(prime)
    else:
        prod *= prime

print(prod * tmax)

Submission status: Runtime Error

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
	
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: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(100000)

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

Submission status: Runtime Error

Solution code:
sys.setrecursionlimit(100000)
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)]
ans = lcm(T[0],T[1])
for i in range(2,N):
    ans = lcm(ans,T[i])
print(ans)

Submission status: Runtime Error

Solution code:
from math import gcd
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: Runtime Error

Solution code:
# Python Program to find LCM of n elements 

def find_lcm(num1, num2): 
	if(num1>num2): 
		num = num1 
		den = num2 
	else: 
		num = num2 
		den = num1 
	rem = num % den 
	while(rem != 0): 
		num = den 
		den = rem 
		rem = num % den 
	gcd = den 
	lcm = int(int(num1 * num2)/int(gcd)) 
	return lcm 
n=int(input())
if n==1:
    print(int(input()))
    exit()
l=[int(input()) for i in range(n)]
num1 = l[0] 
num2 = l[1] 
lcm = find_lcm(num1, num2) 
for i in range(2, len(l)): 
	lcm = find_lcm(lcm, l[i]) 
print(lcm) 

# Code contributed by Mohit Gupta_OMG

Submission status: Runtime Error

Solution code:
# Python Program to find LCM of n elements 

def find_lcm(num1, num2): 
	if(num1>num2): 
		num = num1 
		den = num2 
	else: 
		num = num2 
		den = num1 
	rem = num % den 
	while(rem != 0): 
		num = den 
		den = rem 
		rem = num % den 
	gcd = den 
	lcm = int(int(num1 * num2)/int(gcd)) 
	return lcm 
n=int(input())
l=[int(input()) for i in range(n)]

num1 = l[0] 
num2 = l[1] 
lcm = find_lcm(num1, num2) 

for i in range(2, len(l)): 
	lcm = find_lcm(lcm, l[i]) 
	
print(lcm) 

# Code contributed by Mohit Gupta_OMG

Submission status: Runtime Error

Solution code:
import fractions

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

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

ans = T[0]

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

print(ans)

Submission status: Runtime Error

Solution code:
import math
a = int(input())
s = 1
for i in range(a):
    t= int(input())
    s = (t*s)//math.gcd(t,s)
print(s)

Submission status: Runtime Error

Solution code:
import math


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


N = int(input())
ans = 0
for i in range(N):
    T = int(input())

    if i == 0:
        ans = T

    else:
        ans = lcm(ans, T)

print(ans)

Submission status: Runtime Error

Solution code:
from math import gcd


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


N = int(input())
ans = 0
for i in range(N):
    T = int(input())

    if i == 0:
        ans = T

    else:
        ans = lcm(ans, T)

print(ans)

Submission status: Runtime Error

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=fractions.gcd(a,a[i+1])
print(a)

Submission status: Runtime Error

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

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


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

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

Submission status: Runtime Error

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

def lcm(a,b):
    return int(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: Runtime Error

Solution code:
import math
from functools import reduce

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

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: Runtime Error

Solution code:
from fractions import gcd

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

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

Submission status: Runtime Error

Solution code:
from fractions import gcd

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

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

Submission status: Runtime Error

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)

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

print(num)

Submission status: Runtime Error

Solution code:
import math

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

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

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

print(num)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(res)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from functools import reduce
def gcd(a, b):
    return gcd(b, a%b) if b!=0 else a

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

N = int(input())
T = [int(input()) for _ in range(N)]
l = reduce(lcd, T)
print(l)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
# C - Multiple Clocks
# import math mathはatcoderでは使えない
from fractions import gcd
N = int(input())
T = [int(input()) for i in range(N)]
# 最小公倍数を求める
DP = [0]*(N-1)
DP[0] = (T[0]*T[1])//gcd(T[0],T[1])
for i in range(1,N-1):
    DP[i] = (DP[i-1]*T[i+1]) // gcd(DP[i-1],T[i+1])

print(DP[-1])

Submission status: Runtime Error

Solution code:
# C - Multiple Clocks
import math
N = int(input())
T = [int(input()) for i in range(N)]
# 最小公倍数を求める
DP = [0]*(N-1)
DP[0] = (T[0]*T[1])//math.gcd(T[0],T[1])
for i in range(1,N-1):
    DP[i] = (DP[i-1]*T[i+1]) // math.gcd(DP[i-1],T[i+1])

print(DP[-1])

Submission status: Runtime Error

Solution code:
import math
n=int(input())
def lcm(a, b):
  return (a * b) // math.gcd(a, b)
num = 1
for i in range(n):
  num = lcm(num, int(input()))

print(num)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce
n=int(input())
T=[int(input())for _ in range(n)]
def lcm(a, b):
  return (a * b) // math.gcd(a, b)

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

print(lcm_list(T))

Submission status: Runtime Error

Solution code:
n = int(input())

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

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

def lcm1(a,b):
  return a*b//gcd1(a,b)
num = li[0]
num = lcm1(li[0],li[1])
for i in range(2,len(li)):
    num = lcm1(num,li[i])
print(num)

Submission status: Runtime Error

Solution code:
n = int(input())

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

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

def lcm1(a,b):
  return a*b//gcd1(a,b)
num = 0
num = lcm1(li[0],li[1])
for i in range(2,len(li)):
    num = lcm1(num,li[i])
print(num)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

n=int(input())

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

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

num_list=[]
for _ in range(n):
    num_list.append(int(input()))
print(lcm(*num_list))

Submission status: Runtime Error

Solution code:
n=int(input())

# 最上公倍数を考える
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

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

num_list=[]
for _ in range(n):
    num_list.append(int(input()))
print(lcm(*num_list))

Submission status: Runtime Error

Solution code:
def gcd(x, y):
    while y > 0:
        x, y = y, x%y
    return x
def lcm(x, y):
    return x/gcd(x, y)*y

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

print(val)

Submission status: Runtime Error

Solution code:
def gcd(x, y):
    while y > 0:
        x, y = y, x%y
    return x
def lcm(x, y):
    return x/gcd(x, y)*y

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

print('{:d}'.format(val))

Submission status: Runtime Error

Solution code:
def gcd(x, y):
    while y > 0:
        x, y = y, x%y
    return x
def lcm(x, y):
    return x/gcd(x, y)*y
from functools import reduce

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

print(str(int(reduce(lcm, li))))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

print(a)

Submission status: Runtime Error

Solution code:
import math

n = int(input())
a = 1

for b in range(n):
    b = int(input())
    a = a*b//math.gcd(a, b)

print(a)

Submission status: Runtime Error

Solution code:
import fractions
n=int(input())
lists=[]
glmlists=[]
for s in range(n):
    s=int(input())
    lists.append(s)
lists.append(1)
glm=lists[0]
cnt=0
while cnt<n:
    gcd=fractions.gcd(glm,lists[cnt+1])
    glm=int(glm*lists[cnt+1]/gcd)
    glmlists.append(glm)
    cnt+=1    
print(glmlists[-1])

Submission status: Runtime Error

Solution code:
import fractions
n=int(input())
lists=[]
for s in range(n):
    s=int(input())
    lists.append(s)
    
lists.append(1)

glm=lists[0]

cnt=0

while cnt<n:
	gcd=fractions.gcd(glm,lists[cnt+1])
    glm=int(glm*lists[cnt+1]/gcd)
    cnt+=1
    
print(glm)

Submission status: Runtime Error

Solution code:
import fractions
n=int(input())
lists=[]
for s in range(n):
    s=int(input())
    lists.append(s)
lists.append(1)
glm=lists[0]
cnt=0
while cnt<n:
    gcd=fractions.gcd(glm,lists[cnt+1])
    glm=int(glm*lists[cnt+1]/gcd)
    cnt+=1    
print(glm)

Submission status: Runtime Error

Solution code:
import fractions
n=int(input())
lists=[]
for s in range(n):
    s=int(input())
    lists.append(s)
lists.append(1)
print(lists)
glm=lists[0]
cnt=0
while cnt<n:
    gcd=fractions.gcd(glm,lists[cnt+1])
    glm=int(glm*lists[cnt+1]/gcd)
    cnt+=1    
print(glm)

Submission status: Runtime Error

Solution code:
import math
n=int(input())
lists=[]
for s in range(n):
    s=int(input())
    lists.append(s)
lists.append(1)
glm=lists[0]
cnt=0
while cnt<n:
    gcd=math.gcd(glm,lists[cnt+1])
    glm=int(glm*lists[cnt+1]/gcd)
    cnt+=1    
print(glm)

Submission status: Runtime Error

Solution code:
import math
n=int(input())
lists=[]
for s in range(n):
    s=int(input())
    lists.append(s)
lists.append(1)
print(lists)
glm=lists[0]
cnt=0
while cnt<n:
    gcd=math.gcd(glm,lists[cnt+1])
    glm=int(glm*lists[cnt+1]/gcd)
    cnt+=1    
print(glm)

Submission status: Runtime Error

Solution code:
import sys
from collections import defaultdict, deque
from functools import reduce
import math

input = sys.stdin.readline

def chmax(a, b):
    if a > b:
        return a
    else:
        return b

def lcm_base(x, y):
    return (x * y) // math.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(input())
    T = [int(input()) for _ in range(N)]
    print(lcm(*T))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(set([int(input()) for d in range(n)]))  
a=l[0]
sd=0
for i in l[1:]:
  for h in range(min(i,a)+1)[:0:-1]:
    if (a%h,i%h)==(0,0):sd=h,break
  a=a*i//sd
print(a)

Submission status: Runtime Error

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

ans=T[0]
for i in range(1,len(T)):
	ans=ans*T[i]//math.gcd(int(ans),T[i])


print(int(ans))

Submission status: Runtime Error

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

ans=T[0]
for i in range(1,len(T)):
	ans=ans*T[i]/math.gcd(int(ans),T[i])


print(int(ans))

Submission status: Runtime Error

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

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

N = int(input())
Data = []
for _ in range(N):
    Data.append(int(input()))
ans = Data[0]
for i in range(1,N):
    ans = lcm(ans,Data[i])
print(ans)
def gcm(a,b):
    if a < b:
        a,b = b,a
    while True:
        if a % b == 0:
            return b
        else:
            a,b = b,a % b

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

N = int(input())
Data = []
for _ in range(N):
    Data.append(int(input()))
ans = Data[0]
for i in range(1,N):
    ans = lcm(ans,Data[i])
print(ans)

Submission status: Runtime Error

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

from numpy import lcm


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

ans = 1
for ele in t:
    ans = lcm(ans, ele)

print(ans)

Submission status: Runtime Error

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

from math import gcd


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


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

ans = 1
for ele in t:
    ans = lcm(ans, ele)

print(ans)

Submission status: Runtime Error

Solution code:
import sys
from collections import deque, defaultdict
import copy
import bisect
#sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations


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

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

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
from math import gcd
from functools import reduce


def resolve():
    n = int(input())
    t = list(int(input()) for _ in range(n))
    res = 1
    for ti in t:
        res = lcm_base(res, ti)
    print(res)


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


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


if __name__ == "__main__":
    resolve()

Submission status: Runtime Error

Solution code:
from math import gcd
from functools import reduce


def resolve():
    n = int(input())
    t = list(int(input()) for _ in range(n))
    print(lcm(t))


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


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


if __name__ == "__main__":
    resolve()

Submission status: Runtime Error

Solution code:
from math import gcd
from functools import reduce


def resolve():
    n = int(input())
    t = list(int(input()) for _ in range(n))
    ans = lcm(t)
    print(ans)


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


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


if __name__ == "__main__":
    resolve()

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys
# from fractions import gcd
from math import gcd
from functools import reduce

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


def solve(N: int, T: "List[int]"):
    print(reduce(lcm, T))
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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: Runtime Error

Solution code:
from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue,fractions
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))
def inpl_str(): return list(sys.stdin.readline().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

n = inp()
t = inpln(n)
tmp = t[0]
for i in range(n-1):
    tmp = lcm(tmp, t[i+1])
print(tmp)

Submission status: Runtime Error

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

N = int(input())

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

ans = T[0]

for i in T:
    ans = int(ans/gcd(ans, i))* i
print(ans)

Submission status: Runtime Error

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

N = int(input())

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

ans = T[0]

for i in T:
    ans = int(ans* i/gcd(ans, i))
print(ans)

Submission status: Runtime Error

Solution code:
import math
n = int(input())
s = int(input())
def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)
for i in range(1,n):
    t = int(input())
    s = (s*t)//math.gcd_core(s,t)

print(s)

Submission status: Runtime Error

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

print(s)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce


def gcd(*numbers):
    return reduce(math.gcd, numbers)


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


def lcm_base(x, y):
    return (x * y) // math.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 = list(set([int(input()) for _ in range(n)]))

print(lcm(*t))

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

n = int(input())

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

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

Submission status: Runtime Error

Solution code:
import math
from functools import reduce

n = int(input())

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

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

Submission status: Runtime Error

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

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


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

Submission status: Runtime Error

Solution code:
from fractions import gcd

N=int(input())
T0=int(input())
for i in range(1,N):
    T=int(input())
    g=gcd(T0,T)
    ans=T0*(T)//g
    T0=ans
print(ans)

Submission status: Runtime Error

Solution code:
import fractions

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

Submission status: Runtime Error

Solution code:
def gcd(a,b):
  for i in range(1000):
    a,b=b,a%b
    if b==0:
      break
  return a
length = int(input())
trues = 1
ans = int(input())
for i in range(length-1):
  input_val = int(input())
  trues = trues*input_val
  if ans>input_val:
  	ans = gcd(ans,input_val)
  else:
    ans = gcd(input_val,ans)
print(trues/ans)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
  for i in range(100000000):
    a,b=b,a%b
    if b==0:
      break
  return a
length = int(input())
trues = 1
ans = int(input())
for i in range(length-1):
  input_val = int(input())
  trues = trues*input_val
  if ans>input_val:
  	ans = gcd(ans,input_val)
  else:
    ans = gcd(input_val,ans)
print(trues/ans)

Submission status: Runtime Error

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

F=[]
for i in range(len(T)):
    for i in range(1,n**0.5+1):
        if n%i == 0:
            F.append(i)
        if i != n//i:
            F.append(n//i)
m=set(F)
S=1
for i in range(len(T)):
    S=S*(T[i]/m)

print(S)

Submission status: Runtime Error

Solution code:
import fractions

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

Submission status: Runtime Error

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

    return gcd(b, a%b)

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

lcm = max(t)

for i in range(N):
    if lcm % t[i] != 0:
        lcm = lcm * t[i] / gcd(lcm, lcm%t[i])

print(int(lcm))

Submission status: Runtime Error

Solution code:
import fractions

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

Submission status: Runtime Error

Solution code:
import fractions

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

Submission status: Runtime Error

Solution code:
import fractions

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

Submission status: Runtime Error

Solution code:
import fractions
n=int(input())
t=[int(input()) for i in range(n)]
t.sort()
check=t[0]
for i in range(n-1):
    f1=fractions.gcd(t[i],t[i+1])
    f2=check*t[i+1]//f1
    check=f2
print(f2)

Submission status: Runtime Error

Solution code:
import fractions
n=int(input())
t=[int(input()) for i in range(n)]
t.sort()
check=t[0]
for i in range(n-1):
    f1=fractions.gcd(t[i],t[i+1])
    f2=t[i]*t[i+1]//f1
    check=f2
print(f2)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
n=int(input())
t=[int(input()) for i in range(n)]
t.sort()
for i in range(n-1):
    f1=math.gcd(t[i],t[i+1])
    f2=t[i]*t[i+1]//f1
print(f2)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce
n=int(input())
a=[int(input()) for i in range(n)]
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(a))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from decimal import *

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

for i in range(n):
    T[i] = Decimal(T[i])

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

ans = Decimal(1)
for i in range(n):
    ans = ans * T[i] / gcd(ans, T[i])
    #ans = int(ans + 0.1)
print(int(ans))

Submission status: Runtime Error

Solution code:
from decimal import *

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

for i in range(n):
    T[i] = Decimal(T[i])

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

ans = Decimal(1)
for i in range(n):
    ans = ans * T[i] / gcd(ans, T[i])
    #ans = int(ans + 0.1)
print(ans)

Submission status: Runtime Error

Solution code:
from decimal import *

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

for i in range(n):
    T[i] = Decimal(T[i])

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

ans = Decimal(1)
for i in range(n):
    ans = Decimal(ans * T[i] / Decimal(gcd(ans, T[i])))
    #ans = int(ans + 0.1)
print(Decimal(ans))

Submission status: Runtime Error

Solution code:
from decimal import *

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

for i in range(n):
    T[i] = Decimal(T[i])

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

ans = Decimal(1)
for i in range(n):
    ans = Decimal(ans * T[i] / gcd(ans, T[i]))
    #ans = int(ans + 0.1)
print(Decimal(ans))

Submission status: Runtime Error

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

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

ans = 1
for i in range(n):
    ans = ans * T[i] / gcd(ans, T[i])
    ans = int(ans + 0.1)
print(int(ans))

Submission status: Runtime Error

Solution code:
import fractions

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

if n == 1:
    ans=1

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

Submission status: Runtime Error

Solution code:
import math

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

if n == 1:
    ans=1

if n > 1:
    ans=t[0]
    for j in range(1,n):
        ans=int(ans*t[j]/math.gcd(ans,t[j]))

Submission status: Runtime Error

Solution code:
import math

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

if n == 1:
    ans=1
else:
    ans=math.gcd(t[0],t[1])

if n > 2:
    for j in range(2,n):
        ans=math.gcd(ans,t[j])

seki=1
for i in t:
    seki=seki*i
    
print(int(seki/ans))

Submission status: Runtime Error

Solution code:
import math

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

if n == 1:
    ans=1
else:
    ans=math.gcd(t[0],t[1])

if n > 2:
    for j in range(2,n):
        ans=gcd(ans,t[j])

seki=1
for i in t:
    seki=seki*i
    
print(int(seki/ans))

Submission status: Runtime Error

Solution code:

import math
n=int(input())
ar=[]
for i in range(0,n):
	k=int(input())
	ar.append(k)

an=ar[0]
for x in range(1,n):
	an=(an*ar[x])/math.gcd(an,ar[x]);
print(an)

Submission status: Runtime Error

Solution code:
import math
n=int(input())
ar=list(map(int,input().split()))

an=ar[0]
for x in range(1,n):
	an=(an*ar[x])/math.gcd(an,ar[x]);
print(an)