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:
def gcd(a, b):
    a = int(a)
    b = int(b)
    m = int(0)
    while(b > 0):
        m = a 
        a = b
        b = m % a
    return a
    

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

n = int(input())
t = []
for i in range(0, n):
    t.append(int(input()))
cur = t[0]
for i in range(1, n):
    cur = lcm(cur, t[i])
print(int(cur))

Submission status: Runtime Error

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

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

n = int(input())
t = []
for i in range(0, n):
    t.append(int(input()))
cur = t[0]
for i in range(1, n):
    cur = lcm(cur, t[i])
print(int(cur))

Submission status: Runtime Error

Solution code:
from math import gcd

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

Submission status: Runtime Error

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


def lcm(a, b):
    g = euclid(a, b)
    return int(a * b / g)


if __name__ == '__main__':
    N = int(input())
    ans = 1
    for i in range(N):
        T = int(input())
        ans = lcm(ans, T)

    print(ans)

Submission status: Runtime Error

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


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

    if N == 1:
        print(T[0])
    else:
        gcd = (T[0] * T[1] / euclid(T[0], T[1]))
        for i in range(2, N):
            gcd = (gcd * T[i] / euclid(gcd, T[i]))

        print(int(gcd))

Submission status: Runtime Error

Solution code:
def euclid(a, b):
    if b < a:
        tmp = a
        a = b
        b = tmp

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


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

    if N == 1:
        print(T[0])
    else:
        gcd = (T[0] * T[1] / euclid(T[0], T[1]))
        for i in range(2, N):
            gcd = (gcd * T[i] / euclid(gcd, T[i]))

        print(int(gcd))

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

T.sort()
print(int(lcm(T[-1], T[-2])))

Submission status: Runtime Error

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

n = int(input())

res = 1
for i in range(n):
    a = int(input())
    g = gcd(res, a)
    res = int(res / g) * a

print(res)

Submission status: Runtime Error

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

n = int(input())

res = 1
for i in range(n):
    a = int(input())
    g = gcd(res, a)
    res = int(res * a / g)

print(res)

Submission status: Runtime Error

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

n = int(input())

res = 1
for i in range(n):
    a = int(input())
    g = gcd(res, a)
    res = int(res * a / g)

print(str(res))

Submission status: Runtime Error

Solution code:
import fractions
import functools

n=int(input())
t=[]
for i in range(n):
	t.append(int(input()))
ans=functools.reduce(a*b//fractions.gcd(a,b),t)
print(ans)

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
    
N = int(input())
Ts = [None for i in range(N)]

a = input()
b = 0
for i in range(N-1):
    b = int(input())
    a = (a*b) // gcd(a,b)
    
print(a)

Submission status: Runtime Error

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

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

n = int(input())

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

print(int(ans))

Submission status: Runtime Error

Solution code:
# -*- coding:utf-8 -*-
def euc(a,b):
    if b == 0:
        return a
    else:
        return euc(b, a%b)

N = int(input())
T = [ int(input()) for tmp in range(N) ]
if len(T) > 1:
    a = T.pop()
    b = T.pop()
    lcm = a*b/euc(a,b)
    for tmp in T:
        lcm = tmp*lcm/euc(tmp,lcm)
    print(int(lcm))
else:
    print(T.pop())

Submission status: Runtime Error

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)

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

print(int(ans))

Submission status: Runtime Error

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

    c=a%b

    if c==0:
     return b
    else:
     return gcd(b,c)
'''

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

def lcm(e,f):
    c=gcd(e,f)
    return e/c*f



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

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

ans=t[0]

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

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if a<b:
     c=a
     a=b
     b=c
     
    c=a%b
    
    if c==0:
     return b
    else:
     return gcd(b,c)
 
def lcm(a,b):
    c=gcd(a,b)
    return a/c*b
 
 
 
n=int(input())
t=[0]*n
 
for lop2 in range(n):
    t[lop2]=int(input())
 
ans=t[0]
 
for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

Submission status: Runtime Error

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

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

ans=t[0]

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


def gcd(a,b):
    if a<b:
     c=a
     a=b
     b=c
     
    c=a%b
    return b
 
def lcm(a,b):
    c=gcd(a,b)
    return a/c*b
 
 
 
n=int(input())
t=[0]*n
 
for lop2 in range(n):
    t[lop2]=int(input())
 
ans=t[0]
 
for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

Submission status: Runtime Error

Solution code:


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



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

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

ans=t[0]

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

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if a<b:
     d=a
     a=b
     b=d


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



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

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

ans=t[0]

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

Submission status: Runtime Error

Solution code:

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

    if b==0:
     b=1
    if a==0:
     a=1

    c=a%b

    if c==0:
     return b
    else:
     return 5

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



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

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

ans=t[0]

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

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if a<b:
     d=a
     a=b
     b=d

    if b==0:
     b=1
    if a==0:
     a=1

    c=a%b

    if c==0:
     return b
    else:
     return gcd(b,c)

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



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

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

ans=t[0]

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

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if a<b:
     d=a
     a=b
     b=d

    if b==0:
     b=1

    c=a%b

    if c==0:
     return b
    else:
     return 2

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



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

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

ans=t[0]

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

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if a<b:
     d=a
     a=b
     b=d

    if b==0:
     b=1

    c=a%b

    if c==0:
     return b
    else:
     return gcd(b,c)

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



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

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

ans=t[0]

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

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if a<b:
     c=a
     a=b
     b=c
     
    c=a%b
    
    if c==0:
     a=b
     b=c
     return gcd(a,b)
    else:
     return b
 
def lcm(a,b):
    c=gcd(a,b)
    return a/c*b
 
 
 
n=int(input())
t=[0]*n
 
for lop2 in range(n):
    t[lop2]=int(input())
 
ans=t[0]
 
for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if a<b:
     c=a
     a=b
     b=c
     
    c=a%b
    
    if c==0:
     return gcd(b,c)
    else:
     return b
 
def lcm(a,b):
    c=gcd(a,b)
    return a/c*b
 
 
 
n=int(input())
t=[0]*n
 
for lop2 in range(n):
    t[lop2]=int(input())
 
ans=t[0]
 
for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if a<b:
     c=a
     a=b
     b=c
     
    c=a%b
    
    if c==0:
     return gcd(b,cs)
    else:
     return b
 
def lcm(a,b):
    c=gcd(a,b)
    return a/c*b
 
 
 
n=int(input())
t=[0]*n
 
for lop2 in range(n):
    t[lop2]=int(input())
 
ans=t[0]
 
for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

Submission status: Runtime Error

Solution code:

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

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

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

ans=t[0]

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

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if a<b:
        c=a;
        a=b;
        b=c;
    c=a%b

    if c==0:
        return b
    else:
        return gcd(b,c)

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



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

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

ans=t[0]

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

Submission status: Runtime Error

Solution code:
import gcc

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

    if c==0:
        return b
    else:
        return gcc.gcd(b,c)

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


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

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

ans=t[0]

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

Submission status: Runtime Error

Solution code:
import gcc

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

    if c==0:
        return b
    else:
        return gcc.gcd(b,c)

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


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

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

ans=t[0]

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

Submission status: Runtime Error

Solution code:
import gcc

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

    if c==0:
        return b
    else:
        return gcc.gcd(b,c)

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


n=int(input())
t=[int(input()) for lop in range(n)]
ans=t[0]

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

Submission status: Runtime Error

Solution code:
import gcc

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

    if c==0:
        return b
    else:
        return gcc.gcd(b,c)

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


n=int(input())
t=[int(input()) for lop in range(n)]
ans=t[0]

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

Submission status: Runtime Error

Solution code:
def gcd(a,b):
      return b





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



N=input()

n=int(N)

ANS=input()
ans=int(ANS)

for lop in range(n):
    T=input()
    t=int(T)
    ans=lcm(ans,t)
print(int(ans))
print('\n')
quit()

Submission status: Runtime Error

Solution code:
def gcd(a,b):
    if a<b:
        c=a;
        a=b;
        b=c;
    c=a%b

    if c==0:
        return b
    else:
        return gcd(b,c)




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



N=input()

n=int(N)

ANS=input()
ans=int(ANS)

for lop in range(n-1):
    T=input()
    t=int(T)
    ans=lcm(ans,t)
print(int(ans))
print('\n')
quit()

Submission status: Runtime Error

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


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):
    if b == 0:
        return a
    else :
        return gcd(b,a%b)

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


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

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

print(int(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def gsd(a,b):
  if b==0:
    return a
  else:
      return gsd(b,a%b)
n=int(input())
a=[0]*100
for x in range(0,n):
  a[x]=int(input())
if n==1:
  print(a[0])
else:
    k=gsd(a[0],a[1])
   
    k=a[0]*a[1]/k
    for x in range(2,n):
      f=k
      k=gsd(k,a[x])
      k=a[x]*f/k
    k=round(k)    
    print(k)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [int(input()) for i in range(N)]
ans = T[0]
for i in T:
  k = 1
  if ans // i < 1:
    k = i // ans
  for j in range(k, i+1, l):
    if ans * j % i == 0:
      ans = ans * j
      break
print(ans)

Submission status: Runtime Error

Solution code:
 from functools import reduce

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

 c = 1
 for T in Ts:
     c = lcm(c, T)

 print(int(c))

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=[int(input()) for i in range(n)]
if n==1:
    print(t[0])
else:
    anser=1
    for i in t:
        anser=lcm(anser,i)
    print(anser)

Submission status: Runtime Error

Solution code:
import math
import functools

def lcm(a,b):
    return  int(a*b/math.gcd(a,b))
    
n=int(input())
t=[int(input()) for i in range(n)]
if n==1:
    print(t[0])
else:
    anser=1
    for i in t:
        anser=lcm(anser,i)
    print(anser)

Submission status: Runtime Error

Solution code:
import math
import functools

def lcm(a,b):
    return  int(a*b/math.gcd(a,b))
    
n=int(input())
t=[int(input()) for i in range(n)]
if n==1:
    print(t[0])
else:
    print(functools.reduce(lcm,t))

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

ans = solve(T)
print(ans)

Submission status: Runtime Error

Solution code:
import math
import functools

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

print(functools.reduce(lcm,t))

Submission status: Runtime Error

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

def f(diu, n):
    r = []
    try:
        while n != 1:
            r = [diu[n][0]] + r
            n = diu[n][1]
    except:
        pass
    return r

memo = {}
def d(p, a, b, k):
    if k in memo : return memo[k]
    c = 0
    for i, j in zip(a, b):
        if i == j:
            c += 1
        else:
            break
    memo[k] = sum(p[x][2] for x in a[c:]) + sum(p[x][2] for x in b[c:])
    return memo[k]

def main():
    N = int(input())
    P = [tuple(map(int, input().split())) for x in range(N-1)]
    diu = {max(v[0], v[1]) : (i, min(v[0], v[1]))  for i, v in enumerate(P)}
    Q, K = map(int, input().split())
    k = f(diu, K)
    for i in range(Q):
        x, y = map(int, input().split())
        print(d(P, f(diu, x), k, (K, x)) + d(P, f(diu, y), k, (K, y)))

if __name__ == '__main__':
    main()

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

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

Submission status: Runtime Error

Solution code:
    def gcd(a, b):
        if a < b:
            a, b = b, a
        if b == 0:
            return a
        else:
            return int(gcd(b, a%b))
     
    def lcm(a, b):
        return int(a // gcd(a, b) * b)
     
    N = input()
    V = 1
    for i in range(int(N)):
        T = input()
        V = lcm(V, int(T))
     
    print("%d" % V)

Submission status: Runtime Error

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

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

N = input()
V = 1
for i in range(int(N)):
    T = input()
    V = lcm(V, int(T))

print("%d" % V)

Submission status: Runtime Error

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

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

N = input()
V = 1
for i in range(int(N)):
    T = input()
    V = lcm(V, int(T))

print("%d" % V)

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

N = input()
V = 1
for i in range(int(N)):
    T = input()
    V = lcm(V, int(T));
print(int(V))

Submission status: Runtime Error

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

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

N = input()
V = 1
for i in range(int(N)):
    T = input()
    V = lcm(V, int(T));
print(V)

Submission status: Runtime Error

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

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

N = input()
V = 1
for i in range(int(N)):
    T = input()
    V = lcm(V, int(T));
print(V)

Submission status: Runtime Error

Solution code:
def uq(a,c):
    return c if a%c==0 else uq(c,a%c)

n=(int)(input())

result = 1

for j in range(0,n):
    f=(int)(input())
    result=((result/uq(result,f)))*f
    
print((int)(result))

Submission status: Runtime Error

Solution code:
def uq(a,c):
    return c if a%c==0 else uq(c,a%c)

n=(int)(input())

result = 1

for j in range(0,n):
    f=(int)(input())
    result=((result*f/uq(result,f)))
    
print((int)(result))

Submission status: Runtime Error

Solution code:
def uq(a,c):
    return c if a%c==0 else uq(c,a%c)

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

for i in range(0,n):
    T.append((int)(input()))

result = 1

for j in T:
    result=(int)((result*j)/uq(result,j))
    
print(result)

Submission status: Runtime Error

Solution code:
n = int(input())
t_list = []
max = 0
for i in range(n):
	t = int(input())
	if t > max:
		max = t
 	else:
		t_list.append(t)
 
times = 0
is_not_divisible = True
while is_not_divisible:
	times += 1
	for t in t_list:
		if (max*times)%t != 0:
			is_not_divisible = True
			break
		else:
			is_not_divisible = False
 
print(max*times)

Submission status: Runtime Error

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

t_max = max(t_list)
times = 0
is_not_divisible = True
while is_not_divisible:
	times += 1
	for t in t_list:
		if (t_max*times)%t != 0:
			is_not_divisible = True
			break
		else:
			is_not_divisible = False

print(t_max*times)

Submission status: Runtime Error

Solution code:
from fractions import gcd

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

for i in range(n):
	t = int(input())
	l.append(t)
	
g = reduce(gcd, l)
c = g.copy

for x in l:
	c = c * (x/g)
	
print(c)

Submission status: Runtime Error

Solution code:
import math

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

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

Submission status: Runtime Error

Solution code:
import math

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

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

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

print (ans)

Submission status: Runtime Error

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


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

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

n = int(input())
print(functools.reduce(lcm, [int(input()) for i in range(n)]))

Submission status: Runtime Error

Solution code:
#accepted

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

def lcmiter(array):
	if len(array) == 2:
		x = array[1]
		y = array[0]
		return x*y/gcd(x,y)
	else:
		x = lcmiter(array[1:])
		y = array[0]
		return x*y/gcd(x,y)

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


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

lcm = lcmiter(t)
print("%.0f" %lcm)

Submission status: Runtime Error

Solution code:
from math import gcd
from functools import reduce

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

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

Submission status: Runtime Error

Solution code:
import math as m
from functools import reduce
n,T= int(input()),[]
def f(a, b):
    return int(a * b // m.gcd(a, b))
for i in range(n):
    T.append(int(input()))
tmp = max(T)
for i in range(n):
    if tmp % T[i] != 0:
        tmp = T[i]//m.gcd(tmp, T[i])*tmp

print(tmp)

Submission status: Runtime Error

Solution code:
import math as m
from functools import reduce
n,l= int(input()),[]
def f(a, b):
    return int(a * b // m.gcd(a, b))
for i in range(n):
    l.append(int(input()))
print(reduce( lambda x,y: y//m.gcd(x,y)*x, l))

Submission status: Runtime Error

Solution code:
import math as m
from functools import reduce

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


def f(a, b):
    return int(a * b // m.gcd(a, b))


for i in range(n):
    l.append(int(input()))
print(reduce(f, l))

Submission status: Runtime Error

Solution code:
import math

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

print(int(ans))

Submission status: Runtime Error

Solution code:
import math as m
from functools import reduce

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


def f(a, b):
    return int(a * b / m.gcd(a, b))


for i in range(n):
    l.append(int(input()))
print(reduce(f, l))

Submission status: Runtime Error

Solution code:
import math

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

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

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

print(int(ans))

Submission status: Runtime Error

Solution code:
import math

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

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

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

print(int(ans))

Submission status: Runtime Error

Solution code:
import math

def lcm(x, y):
    return 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 spaceinput():
    return list(map(int,input().split(" ")))


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

def lcm(m,n):
    g=gcd(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(0,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 n==0:
        return m
    r=m%n
    if r == 0:
        return n
    return gcd(n,r)

def lcm(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(0,len(x)):
    #print(l,x[k])
    l=lcm(l,x[k])
    #print(l)



print(int(l))

Submission status: Runtime Error

Solution code:
def lcm(a, b):
    ax = a
    bx = b
    c = 0
    if a<b:
        ax, bx = (bx, ax)
    while True:
        if ax%bx == 0:
            gcd = bx
            break
        else:
            c = bx
            bx = ax%bx
            ax = c
    return a*b // gcd

n = int(input())
lst = []
lst2 = []
for i in range(n):
    a = int(input())
    lst.append(a)
    
while True:
    lst2.append(lcm(lst[0], lst[1]))
    lst.pop(0)
    lst.pop(0)
    lst2.extend(lst)
    if len(lst2)==1:
        print(lst2[0])
        break
    lst.clear()
        
    lst.append(lcm(lst2[0], lst2[1]))
    lst2.pop(0)
    lst2.pop(0)
    lst.extend(lst2)
    if len(lst)==1:
        print(lst[0])
        break
    lst2.clear()

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)

    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(0,len(x)):
    #print(l,x[k])
    l=lcm(l,x[k])
    #print(l)



print(int(l))

Submission status: Runtime Error

Solution code:
N = int(raw_input())
ts = []
for n in xrange(N):
  ts.append(int(raw_input()))

ts.sort(reverse=True)
for i in xrange(len(ts)-1):
  a = ts[i] * ts[i+1]
  b = ts[i] - ts[i+1]
  while a % b != 0:
    r = a % b
    a = b
    b = r
  ts[i+1] = ts[i] * ts[i+1] / b

print ts[-1]

Submission status: Runtime Error

Solution code:
def lcm(a, b):
    ax = a
    bx = b
    c = 0
    if a<b:
        ax, bx = (bx, ax)
    while True:
        if ax%bx == 0:
            gcd = bx
            break
        else:
            c = bx
            bx = ax%bx
            ax = c
    return a*b // gcd

n = int(input())
Mx = int(input())
lst = [Mx]
lst2 = []
for i in range(n-1):
    a = int(input())
    if Mx%a != 0:
        lst.append(a)
        lst.sort()
        if Mx<a:
            Mx = a

while True:
    lst2.append(lcm(lst[0], lst[1]))
    lst.pop(0)
    lst.pop(0)
    lst2.extend(lst)
    if len(lst2)==1:
        print(lst2[0])
        break
    lst.clear()
        
    lst.append(lcm(lst2[0], lst2[1]))
    lst2.pop(0)
    lst2.pop(0)
    lst.extend(lst2)
    if len(lst)==1:
        print(lst[0])
        break
    lst2.clear()

Submission status: Runtime Error

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

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):
  if len(list) > 2:
  	lcm_num = lcm(list[0], list[1])
    for i in range(2, len(list)):
      lcm_num = lcm(lcm_num, list[i])
    print(lcm_num)
  elif len(list) == 2:
    print(lcm(list[0], list[1]))
  else:
  	print(list[-1])

nlcm(t)

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):
  if len(list) > 2:
  	lcm_num = lcm(list[0], list[1])
    for i in range(2, len(list)):
      lcm_num = lcm(lcm_num, list[i])
    print(lcm_num)
  elif len(list) == 2:
    print(lcm(list[0], list[1]))
  else:
  	print(len[-1])


nlcm(t)

Submission status: Runtime Error

Solution code:
def lcm(a, b):
    ax = a
    bx = b
    c = 0
    if a<b:
        ax, bx = (bx, ax)
    while True:
        if ax%bx == 0:
            gcd = bx
            break
        else:
            c = bx
            bx = ax%bx
            ax = c
    return a*b // gcd

n = int(input())
Mx = int(input())
lst = [Mx]
lst2 = []
for i in range(n-1):
    a = int(input())
    if Mx%a != 0:
        lst.append(a)
        lst.sort()
        if Mx<a:
            Mx = a

while True:
    lst2.append(lcm(lst[0], lst[1]))
    lst.pop(0)
    lst.pop(0)
    lst2.extend(lst)
    x = len(lst2)
    if x==1:
        print(lst2[0])
        break
    lst.clear()
        
    lst.append(lcm(lst2[0], lst2[1]))
    lst2.pop(0)
    lst2.pop(0)
    lst.extend(lst2)
    y = len(lst)
    if y==1:
        print(lst[0])
        break
    lst2.clear()