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:
#! -*- coding:utf-8 -*-
def gcd(a, b):
    if b == 0:
        return int(a)
    else:
        return int(gcd(int(b), int(a % b)))
 
def lcm(c, d):
    return int(int(c * d) / int(gcd(c, d)))

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

if n == 1:
    print(k[0])
else:
    p = lcm(k[0],k[1])
    for i in range(n):
        p = lcm(p,k[i])
    print(int(p))

Submission status: Runtime Error

Solution code:
# coding: utf-8

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

def gcd(a, b):
  while b:
    a, b = b, a % b
  return a
	
def lcm(a, b):
  return a * b // gcd(a, b)
	
def nlcm(list):
  lcm_num = lcm(list[0], list[1])
  if len(list) > 2:
    for i in range(2, len(list)):
      lcm_num = lcm(lcm_num, list[i])
  print(lcm_num)

nlcm(t)

Submission status: Runtime Error

Solution code:
def main():
    N = int(input().strip())
    res = int(input().strip())
    if N == 1:
        return res
    for _ in range(1, N):
        t = int(input().strip())
        res = f(res, t)
    print(res)


def f(a, b):
    _gcd = gcd(a, b)
    return int(a / _gcd * b)


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

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#! -*- coding:utf-8 -*-
def gcd(a, b):
    if b == 0:
        return int(a)
    else:
        return int(gcd(int(b), int(a % b)))
 
def lcm(c, d):
    return int(int(c * d) / int(gcd(c, d)))

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

p = lcm(k[0],k[1])
for i in range(n):
    p = lcm(p,k[i])
print(int(p))

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(2000000000)


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


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


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


def solve(listT):
    listlen = len(listT)
    ans = -1
    while True:
        ans = lcm(listT[listlen - 2], listT[listlen - 1])
        listT.pop(listlen - 1)
        listT.pop(listlen - 2)
        listT.append(ans)
        listlen = len(listT)
        if(listlen == 1):
            break
    return ans

ans = solve(T)
print(ans)

Submission status: Runtime Error

Solution code:
def spaceinput():
    return list(map(int,input().split(" ")))


def gcd(m,n):
    if m<n:
        return gcd(n, m)
    r=m%n
    if r == 0:
        return n
    return gcd(n,r)

def lcm(m,n):
    if m<n:
        return lcm(n,m)

    #print(m,n)
    if m==n:
        return m
    if m%n==0:
        return m
    g=gcd(m,n)
    if g==1:
        return m*n
    return (m/g)*n


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

l=x[0]
for k in range(1,len(x)):
    #print(l,x[k])
    l=lcm(l,x[k])
    #print(l)



print(int(l))

Submission status: Runtime Error

Solution code:
def spaceinput():
    return list(map(int,input().split(" ")))


def gcd(m,n):
    if m<n:
        return gcd(n, m)
    r=m%n
    if r == 0:
        return n
    return gcd(n,r)

def lcm(m,n):
    if m<n:
        return lcm(n,m)

    #print(m,n)
    if m==n:
        return m
    if m%n==0:
        return m
    g=gcd(m,n)
    if g==1:
        return m*n
    return (m/g)*n


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

l=x[0]
for k in range(1,len(x)):
    #print(l,x[k])
    l=lcm(l,x[k])

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(2000000000)

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


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


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


def solve(listT):
    listlen = len(listT)
    ans = -1
    while True:
        ans = lcm(listT[listlen-2], listT[listlen-1])
        listT.pop(listlen-1)
        listT.pop(listlen-2)
        listT.append(ans)
        listlen = len(listT)
        if(listlen == 1):
            break

    return ans

print(solve(T))

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
    T = tuple(int(input()) for _ in range(N))

    lcm_ = T[0]
    for i in T:
        lcm_ = lcm(i, lcm_)

    print(int(lcm_))

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

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

main()

Submission status: Runtime Error

Solution code:
#! -*- coding:utf-8 -*-
def gcd(a, b):
    if b == 0: return int(a)
    return int(gcd(int(b), int(a % b)))
 
def lcm(c, d):
    return int(int(c * d) / int(gcd(c, d)))

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

p = lcm(k[0],k[1])
for i in range(n):
    p = lcm(p,k[i])
print(int(p))

Submission status: Runtime Error

Solution code:
#! -*- coding:utf-8 -*-
def gcd(a, b):
    if b == 0: return int(a)
    return int(gcd(b, int(a % b)))
 
def lcm(c, d):
    return int(c * d / gcd(c, d))

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

p = lcm(k[0],k[1])
for i in range(n):
    p = lcm(p,k[i])
print(int(p))

Submission status: Runtime Error

Solution code:
# coding: utf-8

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

def gcd(a, b):
  while b:
    a, b = b, a % b
  return a
	
def lcm(a, b):
  return a * b // gcd(a, b)
	
def nlcm(list):
  lcm_num = lcm(list[0], list[1])
  for i in range(2,len(list)):
    lcm_num = lcm(lcm_num, list[i])
  print(lcm_num)

nlcm(t)

Submission status: Runtime Error

Solution code:
#! -*- coding:utf-8 -*-
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)
 
def lcm(c, d):
    return c * d / gcd(c, d)

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

p = lcm(k[0],k[1])
for i in range(n):
    p = lcm(p,k[i])
print(int(p))

Submission status: Runtime Error

Solution code:
#! -*- coding:utf-8 -*-
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)
 
def lcm(a, b):
    return a * b / gcd(a, b)

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

p = lcm(k[0],k[1])
for i in range(n):
    p = lcm(p,k[i])
print(int(p))

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(999999999)

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


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


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


def solve(listT):
    listlen = len(listT)
    ans = -1
    while True:
        ans = lcm(listT[listlen-2], listT[listlen-1])
        listT.pop(listlen-1)
        listT.pop(listlen-2)
        listT.append(ans)
        listlen = len(listT)
        if(listlen == 1):
            break

    return ans

print(solve(T))

Submission status: Runtime Error

Solution code:
import urllib.request
from bs4 import BeautifulSoup
import re
import sys
import os
import time
import subprocess
import datetime


def gcd(a, b):
    if a < b:
        c = a
        a = b
        b = c

    r = a % b

    while r > 0:
        a = b
        b = r
        r = a % b

    return b

    # ll gcd(ll a, ll b) {
    #   if (a < b)
    #     swap(a, b);
    #   ll r = a % b;
    #
    #   while (r) {
    #     a = b;
    #     b = r;
    #     r = a % b;
    #   }
    #
    #   return b;
    # }


N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
# a = list(map(int, input().split()))

ans = a[0]

for i in range(N):
    if i == 0:
        continue

    g = gcd(ans, a[i])
    ans = ans * a[i] // g

print(ans)

Submission status: Runtime Error

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


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


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


def solve(listT):
    listlen = len(listT)
    ans = -1
    while True:
        ans = lcm(listT[listlen-2], listT[listlen-1])
        listT.pop(listlen-1)
        listT.pop(listlen-2)
        listT.append(ans)
        listlen = len(listT)
        if(listlen == 1):
            break

    return ans

print(solve(T))

Submission status: Runtime Error

Solution code:
#! -*- coding:utf-8 -*-
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)
 
def lcm(a, b):
    return a * b / gcd(a, b)

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

p = lcm(a[0],a[1])
for i in range(n):
    p = lcm(p,a[i])
print(int(p))

Submission status: Runtime Error

Solution code:
import math

def main():
    N = int(input())
    T = tuple(int(input()) for _ in range(N))

    gcd_ = math.gcd(max(T), min(T))
    ans = max(T) * min(T) // gcd_
    print(ans)

main()

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if b>a:
        t=b
        b=a
        a=t
    while b>0:
        r=a%b
        a=b
        b=r
    return a
N=int(input())
T=[int(input()) for i in range(N)]
g=gcd(T[0],T[1])
i=2
while i <N:
    g=gcd(T[i],g)
    i+=1
M=g
for i in range(N):
    M*=T[i]//g
print(M)

Submission status: Runtime Error

Solution code:
GCD = 1 ###最大公約数
LCM = 1 ###最小公倍数
N = int(input())
def gcd(a, b):
	if a < b:
		a, b = b, a
	while(b != 0):
		a = a % b
		a, b = b, a
	return a

for i in range(N):
	d = int(input())
	GCD = gcd(GCD, d) 
	LCM = LCM * d / GCD

print(int(LCM))

Submission status: Runtime Error

Solution code:
import math

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

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

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

print(int(ans))

Submission status: Runtime Error

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

n=int(input())
arr=[]
for i in range(0,n):
    x=int(input())
    arr.append(x)

ans=int(0)
if n>1:
    ans=arr[0]*arr[1]/gcd(arr[0],arr[1])
    for i in range(2,n):
        ans=ans*arr[i]/gcd(ans,arr[i])

print(int(ans))

Submission status: Runtime Error

Solution code:
from sympy import reduce


def gcd(*numbers):
    """Return the greatest common divisor of the given integers"""
    from fractions import gcd
    return reduce(gcd, numbers)

# Least common multiple is not in standard libraries? It's in gmpy, but this is simple enough:

def lcm(*numbers):
    """Return lowest common multiple."""
    def lcm(a, b):
        return (a * b) // gcd(a, b)
    return reduce(lcm, numbers, 1)

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

Submission status: Runtime Error

Solution code:
# your code goes here
def gcd(a,b):
    if b>a:
        t=b
        b=a
        a=t
    while b>0:
        r=a%b
        a=b
        b=r
    return a
N=int(input())
T=[int(input()) for i in range(N)]
g=gcd(T[0],T[1])
i=2
while i <N:
    g=gcd(T[i],g)
M=g
for i in range(N):
    M*=T[i]//g
print(M)

Submission status: Runtime Error

Solution code:
N=int(input())
T=[]
for i in range(N):
    T.append(int(input()))
import math
def lcm(a,b):
    return a*b//math.gcd(a,b)
if N==1:
    print(T[0])
elif N==2:
    print(lcm(T[0],T[1]))
else:
    l=[T[0]]
    for i in range(N-1):
      l.append(lcm(l[i],T[i+1]))
    print(l[-1])

Submission status: Runtime Error

Solution code:
def spaceinput():
    return list(map(int,input().split(" ")))


def gcd(m,n):
    if m<n:
        return gcd(n, m)
    r=m%n
    if r == 0:
        return n
    return gcd(n,r)

def glm(m,n):
    g=gcd(m,n)
    if g==1:
        return m*n
    return (max(m,n)/g)*min(m,n)


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

l=x[0]
for k in range(1,len(x)):
    l=glm(l,x[k])
    #print(l)


print(int(l))

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(int,[input() for i in range(N)]))

def lcm(x, y):
   """This function takes two
   integers and returns the L.C.M."""

   # choose the greater number
   if x > y:
       greater = x
   else:
       greater = y

   while(True):
       if((greater % x == 0) and (greater % y == 0)):
           lcm = greater
           break
       greater += 1

   return lcm


lp=lcm(a[0],a[1])
for i in range(N-2):
	lp=lcm(lp,a[i+2])

print(lp)

Submission status: Runtime Error

Solution code:
#accepted

def prime_dec(num):
	i = 2
	table = []
	while i*i <= num:
		while num%i == 0:
			num /= i
			#print(num)
			table.append(int(i))
		i += 1
	if num > 1:
		table.append(int(num))
	return table


N = int(input())
t = []
mat = []
gmax = 0

for i in range(N):
	new_n= int(input())
	t.append(new_n)
	#print(new_n)
	table = prime_dec(new_n) 
	mat.append(table)
	#print(table)
	localmax = table[-1]
	if localmax > gmax:
		gmax = localmax
	#print(localmax)

maxlist = [0 for i in range(gmax)]
templist = [0 for i in range(gmax)]

for i in range(N):
	for item in mat[i]:
		templist[item-1] += 1
	for num in range(gmax):
		if maxlist[num] < templist[num]:
			maxlist[num] = templist[num]
	templist = [0 for i in range(gmax)]

#print(maxlist)

baisu = 1
for i in range(gmax):
	for j in range(maxlist[i]):
		baisu *= (i+1)

print(baisu)

Submission status: Runtime Error

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

N = int(input())
T = sorted(set([int(input()) for x in range(N)]))
a = 1
for i in T[:-1] : a *= i
print((a * T[-1]) // math.gcd(a, T[-1]))

Submission status: Runtime Error

Solution code:
from fractions import gcd

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

N = int(input())
T = list(int(input()) for i in range(N))
T = list(set(T))
T.sort()
a = lcm(T[0], T[1])
for i in T[2:]:
    a = lcm(a, i)
print(int(a))

Submission status: Runtime Error

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

N = int(input())
T = sorted(set([int(input()) for x in range(N)]))
s = set()
for i in T : s = s.union(set(primefactor(i)))
a = 1
for i in T[:-1] : a *= i

print((a * T[-1]) // math.gcd(a, T[-1]))

Submission status: Runtime Error

Solution code:
def spaceinput():
    return list(map(int,input().split(" ")))


def gcd(m,n):
    if m<n:
        return gcd(n, m)
    r=m%n
    if r == 0:
        return n
    return gcd(n,r)

def glm(m,n):
    g=gcd(m,n)
    if g==1:
        return max(m,n)
    return (max(m,n)/g)*min(m,n)


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

l=x[0]
for k in range(1,len(x)):
    l=glm(l,x[k])


print(int(l))

Submission status: Runtime Error

Solution code:
# your code goes here
def gcd(a,b):
    if b>a:
        t=b
        b=a
        a=t
    while b>0:
        r=a%b
        a=b
        b=r
    return a
N=int(input())
T=[int(input()) for i in range(N)]
g=gcd(T[0],T[1])
for i in range(1,N-1):
    g=gcd(T[i],g)
M=g
for i in range(N):
    M*=T[i]//g
print(M)

Submission status: Runtime Error

Solution code:

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


def gcd(m,n):
    if m<n:
        return gcd(n, m)
    r=m%n
    if r == 0:
        return n
    return gcd(n,r)

def glm(m,n):
    g=gcd(m,n)
    return (max(m,n)/g)*min(m,n)


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

l=x[0]
for k in range(1,len(x)):
    l=glm(l,x[k])


print(int(l))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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


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


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


def solve(listT):
    listlen = len(listT)
    ans = -1
    while True:
        ans = lcm(listT[listlen-2], listT[listlen-1])
        listT.pop(listlen-1)
        listT.pop(listlen-2)
        listT.append(ans)
        listlen = len(listT)
        if(listlen == 1):
            break

    print(ans)

solve(T)

Submission status: Runtime Error

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

n = int(input())

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

print(int(ans))

Submission status: Runtime Error

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

n = int(input())

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

print(ans)

Submission status: Runtime Error

Solution code:
from math import gcd

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

if __name__ == '__main__':
	n = int(input())
	arr = []
	for _ in range(n):
		arr.append(int(input()))
	
	gc = arr[0]
    
	for i in range(1, len(arr)):
		gc = lcm(arr[i], gc)
		
	print(gc)

Submission status: Runtime Error

Solution code:
from fractions import gcd

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

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

Submission status: Runtime Error

Solution code:

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


def gcd(m,n):
    if m<n:
        return gcd(n, m)
    r=m%n
    if r == 0:
        return n
    return gcd(n,r)

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


x=[]
N=int(input())
for i in range(N):
    try:
        x.append(int(input()))
    except:
        pass

l=x[0]
for k in range(1,len(x)):
    try:
        l=glm(l,x[k])
    except:
        pass


print(int(l))

Submission status: Runtime Error

Solution code:
def spaceinput():
    return list(map(int,input().split(" ")))


def gcd(m,n):
    if m<n:
        return gcd(n, m)
    r=m%n
    if r == 0:
        return n
    return gcd(n,r)

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


N=int(input())
for i in range(N):
    try:
        x.append(int(input()))
    except:
        pass

l=x[0]
for k in range(1,len(x)):
    try:
        l=glm(l,x[k])
    except:
        pass


print(int(l))

Submission status: Runtime Error

Solution code:
#! -*- coding:utf-8 -*-
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)
def lcm(a, b):
    return a * b / gcd(a, b)

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

x = [0]*n
x[0] = arr[0]
for i in range(n-1):
    x[i+1] = lcm(x[i],arr[i+1])
print(int(x[-1]))

Submission status: Runtime Error

Solution code:

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


def gcd(m,n):
    if m<n:
        return gcd(n, m)
    r=m%n
    if r == 0:
        return n
    return gcd(n,r)

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


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

l=x[0]
for k in range(1,len(x)):
    try:
        l=glm(l,x[k])
    except:
        pass


print(int(l))

Submission status: Runtime Error

Solution code:
from math import gcd


def lcm(a, b):
    """Return lowest common multiple."""
    return a * b // gcd(a, b)

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

for _ in range(n):
	x = int(input())
	arr.append(x)
gc = arr[0]
for i in range(1, len(arr)):
	gc = lcm(arr[i], gc)
	
print(gc)

Submission status: Runtime Error

Solution code:
import math 
def lcm(a, b):
    return a * b / math.gcd(a, b)

n = int(input())

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

print(ans)

Submission status: Runtime Error

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

temp = 1
for num in T:
    temp = int(lcm(num, temp))

print(temp)

Submission status: Runtime Error

Solution code:
def spaceinput():
    return list(map(int,input().split(" ")))


def gcd(m,n):
    if m<n:
        return gcd(n, m)
    r=m%n
    if r == 0:
        return n
    return gcd(n,r)

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


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

l=x[0]
for k in range(1,len(x)):
    l=glm(l,x[k])


print(int(l))

Submission status: Runtime Error

Solution code:
import math 

n = int(input())
t = [ int(input()) for i in range(n)]
def lc(a,b):
    return a // math.gcd(a,b) * b

def lcm(b):
    ans = b[0]
    for i in b:
        ans = lc(ans,i)
    return ans
print(lcm(t))

Submission status: Runtime Error

Solution code:
from math import gcd

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

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

Submission status: Runtime Error

Solution code:
import math as m
from functools import reduce

n=int(input())
l=set([])
def gcd(a,b):
    while a != 0:
        c = a
        a = b % a
        b = c
    return b
def f(a,b):
    return int(a*b/gcd(a,b))
for i in range(n):
    l.add(int(input()))
print(reduce(f,l))

Submission status: Runtime Error

Solution code:

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


def gcd(m,n):
    if m<n:
        return gcd(n, m)
    r=m%n
    if r == 0:
        return n
    return gcd(n,r)

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


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

l=x[0]
for k in range(1,len(x)):
    l=glm(l,x[k])


print(int(l))

Submission status: Runtime Error

Solution code:
import math

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

n = int(input())

if n == 1:
    print(input())
else:
    v = [int(input()) for i in range(n)]

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

    print(ans)

Submission status: Runtime Error

Solution code:
import math
GCD = 1 ###最大公約数
LCM = 1 ###最小公倍数
N = int(input())
for i in range(N):
	a = int(input())
	if a / GCD == 0:
		continue
	GCD = math.gcd(GCD, a) 
	LCM = LCM * a / GCD

print(int(LCM))

Submission status: Runtime Error

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 = [0 for i in range(n)]
for i in range(n):
    T[i] = int(input())

temp = 1
for num in T:
    temp = int(lcm(num, temp))

print(temp)

Submission status: Runtime Error

Solution code:
import math 
def lcm(a, b):
    return a * b // math.gcd(a, b)

n = int(input())

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

print(ans)

Submission status: Runtime Error

Solution code:
import math
GCD = 1 ###最大公約数
LCM = 1 ###最小公倍数
N = int(input())
for i in range(N):
	a = int(input())
	GCD = math.gcd(GCD, a) 
	LCM = LCM * a / GCD

print(int(LCM))

Submission status: Runtime Error

Solution code:
import math
def lcm(a, b):
	return a*b // math.gcd(a, b)
n = int(input())
ls = []
for i in range(n):
    ls.append(int(input()))
result = ls[0]
for i in ls[1:]:
    result = lcm(i,result)
print(result)

Submission status: Runtime Error

Solution code:
import math
import functools


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


N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
res = functools.reduce(lcm, T)
print(res)

Submission status: Runtime Error

Solution code:
N = int(input())

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

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

res = 1
for i in range(N):
    d = gcd(res, a_list[i])
    res = res // d
    res = res * a_list[i]

print(res)

Submission status: Runtime Error

Solution code:
import math as m
from functools import reduce

n=int(input())
l=set([])
def f(a,b):
    return int(a*b/m.gcd(a,b))
for i in range(n):
    l.add(int(input()))
print(reduce(f,l))

Submission status: Runtime Error

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

N = int(input())
ret = 1
for i in range(N):
    hoge = int(input())
    ret = int((ret * hoge)/gcd(ret, hoge))
print(ret)

Submission status: Runtime Error

Solution code:
from fractions import gcd
n = int(raw_input())
a = []
for i in range(n):
    a.append(int(raw_input()))
result = a[0]
for i in range(1, n):
    result = result * a[i] / gcd(result, a[i])
print result / g

Submission status: Runtime Error

Solution code:
from math import gcd

N = int(input())
ret = 1
for i in range(N):
    hoge = int(input())
    ret = int((ret * hoge)/gcd(ret, hoge))
print(ret)

Submission status: Runtime Error

Solution code:
import math
N=int(input())
A = [ int(input()) for _ in range(N) ]
ans = A[0]
for x in A[1:]:
  ans = ans * x // math.gcd(ans, x)
print(ans)

Submission status: Runtime Error

Solution code:
import math

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

x = a[0]
for i in a[1:]:
    x = (x * i) // math.gcd(x,i)

print(x)

Submission status: Runtime Error

Solution code:
import math

n=int(input())

res=1
for _ in range(n):
    x=int(input())
    res=res//math.gcd(res,x)*x
print(res)