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: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def gcd(*args):
  return reduce(fractions.gcd, args)

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

Submission status: Wrong Answer

Solution code:
from functools import reduce
from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)
n=int(input())
X=[int(input()) for _ in range(n)]
a=1
for x in X: a=lcm(1,x)
print(a)

Submission status: Wrong Answer

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

    if N == 1: return 0

    g = T[0]
    ans = T[0]
    for t in T[1:]:
        gc = gcd(t, g)
        g = g*t//gc
    return g

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


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

Submission status: Wrong Answer

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

    if N == 1: return 0

    g = T[0]
    ans = T[0]
    for t in T[1:]:
        gc = gcd(t, g)
        g = g*t//gc
    return g

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

Submission status: Wrong Answer

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

    if N == 1: return T[0]

    g = T[0]
    for t in T[1:]:
        g = gcd(t, g)
    ans = g
    for t in T:
        ans *= t//g
    return ans



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




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

Submission status: Wrong Answer

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)

N = _I()
T = set([_I() for _ in range(N)])

times = 1
max_v = max(T)
while True:
    max_t = max_v * times
    new_T = []
    for t in T:
        if max_t % t != 0:
            times += 1
            new_T.append(t)
    else:
        print(max_t)
        break
    T = new_T

Submission status: Wrong Answer

Solution code:
# ABC070C - Multiple Clocks
from fractions import gcd


def main():
    N = int(input())
    T = tuple(map(int, [input() for _ in range(N)]))
    ans = 1
    for i in T:
        ans //= gcd(ans, i) * i
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit = 10000000

def get_gcd(A, B):
    r = A%B
    if r == 0:
        return B
    else:
        return get_gcd(B, r)
           
if __name__ == '__main__':
    N = int(input())
    T = [int(input()) for _ in range(N)]
    
    ans = 1
    for t in T:
        gcd = get_gcd(ans, t)
        ans = int(t/gcd)*ans
        
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit = 10000000

def get_gcd(A, B):
    r = A%B
    if r == 0:
        return B
    else:
        return get_gcd(B, r)
           
if __name__ == '__main__':
    N = int(input())
    T = [int(input()) for _ in range(N)]
    
    ans = 1
    for n in range(N):
        gcd = get_gcd(ans, T[n])
        ans = int(T[n]/gcd)*T[n]
        
    print(ans)

Submission status: Wrong Answer

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())
t=[0]*n
for i in range(n):
  t[i]=int(input())
if n==1:
  print(t[0])
  exit()
elif n==2:
  print(LCM(t[0],t[1]))
  exit()
ans=LCM(t[n-1],t[n-2])
for j in reversed(range(n-3)):
  ans=LCM(ans,t[j])
print(ans)

Submission status: Wrong Answer

Solution code:
# 最小公倍数
if __name__ == '__main__':
    N = int(input())
    T = [int(input()) for _ in range(N)]
    for n1 in range(N-1):
        for n2 in range(n1+1, N):
            if T[n2]%T[n1] == 0:
                T[n1] = T[n2]
            elif T[n1]%T[n2] == 0:
                T[n2] = T[n1]
    T = list(set(T))
    result = 1
    for t in T:
        result *= t
    print(result)

Submission status: Wrong Answer

Solution code:
import fractions

n = int(input())
c = 1
for i in range(n):
    l = int(input())
    gcd = fractions.gcd(c, l)
    c = l * c / gcd
print(int(c))

Submission status: Wrong Answer

Solution code:
import fractions

n = int(input())
t = [int(input()) for _ in range(n)]
c = t[0]
for i in range(1, n):
    tmp = c
    c = fractions.gcd(t[i], tmp)
    c = tmp * t[i] / c
print(int(c))

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
src = [int(input()) for _ in range(n)]
if n == 1:
    print(src[0])
    sys.exit()

def check(a, b):
    result = 0
    if a == 0:
        return b
    elif b == 0:
        return a
    else:
        amari = max(a,b) % min(a,b)
        result = check(min(a,b), amari)
    return result
tmp = src[0]
for i in range(n-1):
    tmp = check(tmp, src[i+1])
print(src[-1]//tmp*src[-2])

Submission status: Wrong Answer

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

t = sorted(t)[::-1]
biggest = t[0]
for i in range(biggest, 10**18+1, biggest):
    print(i)
    ok = True
    for j in t[1:]:
        if i%j != 0:
            ok = False
            break
    if ok == True:
        break
    
print(i)

Submission status: Wrong Answer

Solution code:
import fractions

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

Submission status: Wrong Answer

Solution code:
n=int(input())
t=[]
for i in range(n):
  t.append(int(input()))
m=max(t)
for i in range(1,10**9):
  for j in range(n):
    if (m*i)%t[j]!=0:
      break
    print(m*i)
    exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def lcm(a,b):
    return a*b/fractions.gcd(a,b)
ans = 1
for i in range(N):
    ans = lcm(ans,T[i])
print(int(ans))

Submission status: Wrong Answer

Solution code:
import fractions


def main():
    N = int(input())
    ans = 1
    for i in range(N):
        ans = fractions.gcd(ans, int(input()))

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
# 時計の数を入力する
N = int(input())
# 時計の周回時間を入力する
arr_T = np.empty(N)
for i in range(N):
    arr_T[i] = int(input())

# 全ての周回時間の最小公倍数を探索する
# 最大周回時間を候補とする
max_T = np.max(arr_T)
lcm = max_T
# 繰り返し
while True:
    # 最小公倍数の候補が適切かを確認する
    bools = lcm % arr_T == 0
    if bools.all():
        break
    else:
        lcm += max_T

# 結果を出力する
print(int(lcm))

Submission status: Wrong Answer

Solution code:
import numpy as np
# 時計の数を入力する
N = int(input())
# 時計の周回時間を入力する
arr_T = np.empty(N)
for i in range(N):
    arr_T[i] = int(input())

# 全ての周回時間の最小公倍数を探索する
# 最大周回時間を候補とする
max_T = np.max(arr_T)
lcm = max_T
# 繰り返し
while True:
    # 最小公倍数の候補が適切かを確認する
    bools = lcm % arr_T == 0
    if bools.all():
        break
    else:
        lcm += max_T

# 結果を出力する
print(lcm)

Submission status: Wrong Answer

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

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

N = int(input())
T_li = sorted([int(input()) for i in range(N)])
crr_lcm = 0

for i in range(N - 1):
    crr_lcm = lcm(T_li[i], T_li[i + 1])
print(crr_lcm)

Submission status: Wrong Answer

Solution code:
import fractions

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

N = int(input())
T_li = [int(input()) for i in range(N)]
crr_lcm = 0

for i in range(N - 1):
    crr_lcm = lcm(T_li[i], T_li[i + 1])
print(crr_lcm)

Submission status: Wrong Answer

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

print(int(ans))

Submission status: Wrong Answer

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

print(int(ans))

Submission status: Wrong Answer

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

print(int(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#import math
N = int(input())
T = []
for i in range(N):
  T.append(int(input()))
# output LCM(T1,T2... Tn)=LCM(Tn,LCM(Tn-1,LCM(...)))
def gcd(a,b):
  mi = min(a,b)
  ma = max(a,b)
  ans = 1
  '''for i in range(2,mi+1):
    if (mi%i)+(ma%i) == 0:
      mi /= i
      ma /= i
      ans *= i
      i -= 1'''
  while True:
    #print(ma,mi)
    if (ma % mi) == 0:
      ans = mi
      break
    else:
      mi = ma%mi
      ma = mi
      
  return ans



def lcm(a,b):
  #g = math.gcd(a,b)
  g = gcd(a,b)
  #print(g)
  return int(a*b/g)
ans = T[0]
for i in range(1,len(T)):
  ans = lcm(ans,T[i])
print(ans)

Submission status: Wrong Answer

Solution code:
#import math
N = int(input())
T = []
for i in range(N):
  T.append(int(input()))
# output LCM(T1,T2... Tn)=LCM(Tn,LCM(Tn-1,LCM(...)))
def gcd(a,b):
  mi = min(a,b)
  ma = max(a,b)
  ans = 1
  '''for i in range(2,mi+1):
    if (mi%i)+(ma%i) == 0:
      mi /= i
      ma /= i
      ans *= i
      i -= 1'''
  while True:
    print(ma,mi)
    if (ma % mi) == 0:
      ans = mi
      break
    else:
      mi = ma%mi
      ma = mi
      
  return ans



def lcm(a,b):
  #g = math.gcd(a,b)
  g = gcd(a,b)
  print(g)
  return int(a*b/g)
ans = T[0]
for i in range(1,len(T)):
  ans = lcm(ans,T[i])
print(ans)

Submission status: Wrong Answer

Solution code:
#import math
N = int(input())
T = []
for i in range(N):
  T.append(int(input()))
# output LCM(T1,T2... Tn)=LCM(Tn,LCM(Tn-1,LCM(...)))
def gcd(a,b):
  mi = min(a,b)
  ma = max(a,b)
  ans = 1
  for i in range(2,mi+1):
    if (mi%i)+(ma%i) == 0:
      mi /= i
      ma /= i
      ans *= i
      i -= 1
  return ans



def lcm(a,b):
  #g = math.gcd(a,b)
  g = gcd(a,b)
  #print(g)
  return int(a*b/g)
ans = T[0]
for i in range(1,len(T)):
  ans = lcm(ans,T[i])
print(ans)

Submission status: Wrong Answer

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

from fractions import gcd

pre = T
while True:
    temp = []
    if len(pre) == 1:
        break
    for i in range(0,len(pre),2):
        a = pre[i]
        b = pre[min(i+1,len(pre)-1)]
        g = gcd(a,b)
        temp.append(int(a*b/g))
    pre = temp
ans = int(pre[0])
print(ans)

Submission status: Wrong Answer

Solution code:
# まあ最小公倍数lcmでしょう lcmのアルゴリズムはしらんけどたしかgcdを求めてからなんかするやつ

n = int(input())
x = int(input())


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


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


for _ in range(n - 1):
    y = int(input())
    x = lcm(x, y)

print(int(x))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

answer = 0
for _ in range(N):
  x = int(input())
  answer *= x//gcd(answer, x)
               
print(answer)

Submission status: Wrong Answer

Solution code:
import fractions as frac
n=int(input())
t=[int(input()) for _ in range(n)]
t=sorted(set(t))
t1=t[0]
if len(t)==1:
    print(t1)
    exit()
for i in range(1,len(t)):
    t2=t[i]
    ans=t1*t2/frac.gcd(t1,t2)
    t1=ans
print(int(ans))

Submission status: Wrong Answer

Solution code:
import fractions as frac
n = int(input())
t = []
for i in range(n):
  t.append(int(input()))
tmp = t[0]
for i in range(1,n):
  if tmp % t[i] != 0:
    tmp = tmp * t[i] /frac.gcd(tmp,t[i]) 
print(int(tmp))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
#n, m = [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for j in range(n)]
#table = [list(input()) for n in range(h)]
#list = [int(i) for i in input().split()]
#num = [int(i) for i in range(n)]
#s = input()
#list = list(s)

s = [int(input()) for i in range(n)] #m行1列入力

TIME = 1000000000000000000

s.sort(reverse=True)

num = TIME // s[0]
temp = 0

for i in range(1,num+1) :
    temp = s[0] * i
    for j in range(1,n) :
        if (temp % s[j] == 0) :
            break
    else :
        continue
    break

print(temp)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

ans = 1
T1 = int(input())
for i in range(N-1):
    T2 = int(input())
    ans = T1 * T2 //gcd(T1, T2)
    T1 = ans

print (ans)

# print (gcd(12, 8))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

ans = 1
T1 = int(input())
for i in range(N-1):
    T2 = int(input())
    ans = T1 * T2 //gcd(T1, T2)
    T1 = T2

print (ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import fractions

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

Submission status: Wrong Answer

Solution code:
def gcd (num1,num2):
    tmp = max(num1,num2) % min(num1,num2)
    if tmp == 0:
        return min(num1,num2)
    return gcd(min(num1,num2),tmp)

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

for i in range(len(t)-1):
    stock.append(int(t[i] / gcd(stock[i],t[i]) * t[i+1]))

print(stock[-1])

Submission status: Wrong Answer

Solution code:
def gcd (num1,num2):
    tmp = max(num1,num2) % min(num1,num2)
    if tmp == 0:
        return min(num1,num2)
    return gcd(min(num1,num2),tmp)

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

for i in range(len(t)-1):
    stock.append(int(t[i] * t[i+1] / gcd(stock[i],t[i])))

print(stock[-1])

Submission status: Wrong Answer

Solution code:
import functools
import fractions
N=int(input())
T=list(int(input()) for _ in range(N))
T=list(set(T))
X=T[0]#T[i-1]までの最小公倍数
for i in range(1,len(T)):
    C=fractions.gcd(X,T[i])#T[i]までの最大公約数
    X=X*T[i]/C#XをT[i]までの最小公倍数に更新
print(int(X))

Submission status: Wrong Answer

Solution code:
import functools
import fractions
from operator import mul
N=int(input())
T=list(int(input()) for _ in range(N))
X=T[0]
for i in range(1,N):
    C=fractions.gcd(X,T[i])
    X=X*T[i]/C
print(int(X))

Submission status: Wrong Answer

Solution code:
import fractions
n=int(input())
t=[int(input()) for _ in range(n)]
t=sorted(t)[::-1]
x=t.pop()
while(t):
     y=t.pop()
     x=x*y/fractions.gcd(x,y)
print(int(x))

Submission status: Wrong Answer

Solution code:
import fractions
n=int(input())
t=[int(input()) for _ in range(n)]
t=sorted(t)[::-1]
x=t.pop()
while(t):
     y=t.pop()
     x=x*y/fractions.gcd(x,y)
     if x>5*10**17:
          break
print(int(x))

Submission status: Wrong Answer

Solution code:
import fractions
n=int(input())
t=[int(input()) for _ in range(n)]
l=[]
while(len(t)>=2):
     while(len(t)>=2):
          x1=t.pop()
          x2=t.pop()
          x=x1*x2/fractions.gcd(x1,x2)
          l.append(x)
     t=l
print(int(t[0]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from functools import reduce

_, *t = map(int, open(0).read().split())

# Least Common Multiple
def lcm(x, y):
    return x * y / gcd(x, y)

print(int(reduce(lcm, t)))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

g = 0
for x in (int(input()) for _ in range(N)):
  g = gcd(g, x)
print(g)

Submission status: Wrong Answer

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


N = int(input())
lst_T = list(set([int(input()) for _ in range(N)]))
t0 = lst_T[0]
g = t0
mul = 1


for t in lst_T:
    mul *= t
    g = gcd(g, t)
ans = mul // g


print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
"""解説

(例)
T0 = 2
T1 = 3

直感的に、最小公倍数が答え。
よって6。
"""
from fractions import gcd
from functools import reduce


def lcm(a, b):
    """ aとbの最小公倍数を返す """
    return a*b/gcd(a, b)

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


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def gcd(m,n):
    x = max(m,n)
    y = min(m,n)
    tmp = x%y
    while not tmp == 0:
        x = y
        y = tmp
        tmp = x%y
    return y
N = int(input())
T = list(int(input())for i in range(N))
tmp = T[0]
for i in T:
    tmp = (tmp*i)/gcd(tmp,i)
print(int(tmp))

Submission status: Wrong Answer

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

s = {}
def func(a):
	global s
	for i in range(2, a + 1):
		while not a % i:
			if i not in s:
				s[i] = 1
			else:
				s[i] += 1
			a //= i
		if 1 == a:
			break

for t in T:
	func(t)

r = 1
for t in s:
	r *= t ** s[t]

print(r)

Submission status: Wrong Answer

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

def gcd_l(A):
    if len(A) == 1:
        return A[0]
    x = gcd(A[0], A[1])
    if len(A) == 2:
        return x
    for i in range(2, len(A)):
        x = gcd(x, A[i])
    return x


N = int(input())
T = [int(input()) for _ in range(N)]
T = list(set(T))
T.sort()
N = len(T)
L = []

for i in range(N):
    flag = 1
    for j in range(N-1, i, -1):
        if T[j] % T[i] == 0:
            flag = 0
            break
    if flag:
        L.append(T[i])

GCD = gcd_l(L)
ans = 1
for i in range(len(L)):
    ans *= L[i] // GCD
ans *= GCD
if len(L) == 1:
    ans = L[0]
print(ans)

Submission status: Wrong Answer

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

def gcd_l(A):
    if len(A) == 1:
        return A[0]
    x = gcd(A[0], A[1])
    if len(A) == 2:
        return x
    for i in range(2, len(A)):
        x = gcd(x, A[i])
    return x


N = int(input())
T = [int(input()) for _ in range(N)]
T = list(set(T))
T.sort()
N = len(T)
L = []

for i in range(N):
    flag = 1
    for j in range(N-1, i, -1):
        if T[j] % T[i] == 0:
            flag = 0
            break
    if flag:
        L.append(T[i])

GCD = gcd_l(L)
ans = 1
for i in range(len(L)):
    ans *= L[i] // GCD
if len(L) == 1:
    ans = L[0]
print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

for i in range(N):
  if ans % T[i] != 0:
    ans = lcm(ans, T[i])

print(int(ans))

Submission status: Wrong Answer

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

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

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

for i in range(N):
  if ans % T[i] != 0:
    ans = lcm(ans, T[i])

print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())


def gcd(a, b):
    tmp_a, tmp_b = a, b
    a = max(tmp_a, tmp_b)
    b = min(tmp_a, tmp_b)
    r = a % b
    while r > 0:
        a = b
        b = r
        r = a % b
    return b
    

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


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

print(ans)

Submission status: Wrong Answer

Solution code:
import fractions
n = int(input())
l = int(input())

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

print(int(l))

Submission status: Wrong Answer

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

import math
def lcm(x, y):
    return (x * y) 
 
n = int(input())
ans = int(input())
for i in range(n-1):
  tmp = int(input())
  ans = lcm(ans,tmp)
  
print(ans)

Submission status: Wrong Answer

Solution code:
import fractions


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


def list_lcm(number_list):
    lcm_number = 1
    for j in range(len(number_list)):
        lcm_number = lcm(lcm_number, number_list[j])

    return lcm_number


if __name__ == '__main__':
    number_count = int(input())
    numbers = []
    for i in range(number_count):
        numbers.append(int(input()))
    print(int(list_lcm(numbers)))

Submission status: Wrong Answer

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


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


def list_gcd(number_list):
    while len(number_list) > 1:
        a = number_list.pop()
        b = number_list.pop()
        number_list.append(gcd(a, b))
    return number_list[0]


def list_lcm(number_list):
    lcm_number = 1
    for i in range(len(number_list)):
        lcm_number = lcm(lcm_number, number_list[i])

    return lcm_number


if __name__ == '__main__':
    number_count = int(input())
    numbers = []
    for i in range(number_count):
        numbers.append(int(input()))
    print(int(list_lcm(numbers)))

Submission status: Wrong Answer

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


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


def list_gcd(number_list):
    while len(number_list) > 1:
        a = number_list.pop()
        b = number_list.pop()
        number_list.append(gcd(a, b))
    return number_list[0]


def list_lcm(number_list):
    while len(number_list) > 1:
        a = number_list.pop()
        b = number_list.pop()
        number_list.append(lcm(a, b))
    return number_list[0]


if __name__ == '__main__':
    number_count = int(input())
    numbers = []
    for i in range(number_count):
        numbers.append(int(input()))
    print(int(list_lcm(numbers)))

Submission status: Wrong Answer

Solution code:
n_in = int(input()) 
l = [int(input()) for i in range(n_in)] 

p = l[0]
for i in range(1, len(l)):
    q = l[i]

    if p >= q:
        m, n = p, q
    else:
        m, n = q, p

    while True:
        mod_value = m % n
        if mod_value  == 0:
            break

        m = n
        n = mod_value

    p = int(q/n) * p

print(p)

Submission status: Wrong Answer

Solution code:
def GCD(A, B):
	if B > A:
		A, B = B, A
	if A%B == 0:
		return B
	else:
		return GCD(B, A%B)
def LCM(A, B):
	ans = A/GCD(A,B)*B
	return ans
N = int(input())
a_list = [int(input()) for i in range(N)]
if N == 1:
	print(a_list[0])
else:
	for i in range(N-1):
		e = LCM(a_list[2*i], a_list[2*i+1])
		a_list.append(int(e))
	print(a_list[-1])

Submission status: Wrong Answer

Solution code:
def GCD(A, B):
	if B > A:
		A, B = B, A
	if A%B == 0:
		return B
	else:
		return GCD(B, A%B)
def LCM(A, B, C):
	ans = A/C*B
	return ans
N = int(input())
a_list = [int(input()) for i in range(N)]
if N == 1:
	print(a_list[0])
else:
	for i in range(N-1):
		e = LCM(a_list[2*i], a_list[2*i+1], GCD(a_list[2*i], a_list[2*i+1]))
		a_list.append(int(e))
	print(a_list[-1])

Submission status: Wrong Answer

Solution code:
def GCD(A, B):
	if B > A:
		A, B = B, A
	if A%B == 0:
		return B
	else:
		return GCD(B, A%B)
def LCM(A, B, C):
	ans = A*B/C
	return ans
N = int(input())
a_list = [int(input()) for i in range(N)]
if N == 1:
	print(a_list[0])
else:
	for i in range(N-1):
		e = LCM(a_list[2*i], a_list[2*i+1], GCD(a_list[2*i], a_list[2*i+1]))
		a_list.append(int(e))
	print(a_list[-1])

Submission status: Wrong Answer

Solution code:
def GCD(A, B):
	if B > A:
		A, B = B, A
	if A%B == 0:
		return B
	else:
		return GCD(B, A%B)
def LCM(A, B, C):
	ans = A*B/C
	return ans
N = int(input())
a_list = [int(input()) for i in range(N)]
if N == 1:
	print(a_list[0])
else:
	for i in range(N-1):
		e = LCM(a_list[0], a_list[1], GCD(a_list[0], a_list[1]))
		a_list.append(int(e))
		a_list.pop(0)
		a_list.pop(0)
	print(a_list[0])

Submission status: Wrong Answer

Solution code:
import sys

def gcd(a, b):
    """Euclidean Algorithm"""
    while b != 0:
        a, b = b, a % b
    return a

def main():
    input = sys.stdin.readline
    N = int(input())
    T = [int(input()) for _ in range(N)]
    T = sorted(T)

    t = T[0]
    for i in range(N):
        if T[i] % t == 0:
            continue
        else:
            g = gcd(t, T[i])
            t = t * T[i] // g

    return t


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

Submission status: Wrong Answer

Solution code:
import fractions
n=int(input())

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

print(int(ans))

Submission status: Wrong Answer

Solution code:
import fractions
#標準入力の読み込み
n=int(input())
x=[int(input()) for i in range(n)]
#x.sort(reverse=True)
n=len(x)

#ユークリッド互除法の関数の定義
#def gcd(a,b):
#    if b==0:return a
#    return gcd(b,a%b)
ans=1
for i in range(n):
  ans=ans/(fractions.gcd(ans,x[i]))*x[i]

print(int(ans))

Submission status: Wrong Answer

Solution code:
import fractions
#標準入力の読み込み
n=int(input())
x=[int(input()) for i in range(n)]
x.sort(reverse=True)
n=len(x)

if n==1:
    ans=x[0]
else:
    element = x[0]/(fractions.gcd(x[0], x[1]))*x[1]
    if n==2:ans=element
    else:
        for i in range(2,n):
            element=element/(fractions.gcd(element,x[i]))*x[i]
        ans=element
        
print(int(ans))

Submission status: Wrong Answer

Solution code:
import fractions
#標準入力の読み込み
n=int(input())
x=[int(input()) for i in range(n)]
#x.sort(reverse=True)
n=len(x)

if n==1:
    ans=x[0]
else:
    element = x[0]/(fractions.gcd(x[0], x[1]))*x[1]
    if n==2:ans=element
    else:
        for i in range(2,n):
            element=element/(fractions.gcd(element,x[i]))*x[i]
        ans=element
        
print(int(ans))

Submission status: Wrong Answer

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

dvs = []
dvs_all = []

def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

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

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

print(ans)