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:
import fractions

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

for i in range(n):
  for j in range(i+1, n):
    if t[i] == 1:
      break
    t[i] //= gcd(t[i], t[j])

ans = 1
for x in t:
    ans *= x
print(ans)

Submission status: Wrong Answer

Solution code:
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y)
def lcm(x, y):
    return (x * y) // gcd(x, y)
n=int(input())
ans=1
tmp1=int(input())
for i in range(n-1):
    tmp2=int(input())
    ans=lcm(tmp1,tmp2)
    tmp1=ans
print(ans)

Submission status: Wrong Answer

Solution code:
from functools import reduce
from fractions import gcd
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
x = reduce(gcd,T)
sum=1
if x ==1:
    for i in set(T):
        sum*=i
    print(sum)
else:
    print(max(T))

Submission status: Wrong Answer

Solution code:
from functools import reduce
from fractions import gcd
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
x = reduce(gcd,T)
sum=x
for i in set(T):
    sum*=(i//x)
print(sum)

Submission status: Wrong Answer

Solution code:
from functools import reduce
from fractions import gcd
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
x = reduce(gcd,T)
sum=x
for i in T:
    sum*=(i//x)
print(sum)

Submission status: Wrong Answer

Solution code:
from functools import reduce
from fractions import gcd
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
x = reduce(gcd,T)
sum=1
for i in T:
    sum*=(x*i)
print(sum)

Submission status: Wrong Answer

Solution code:
from functools import reduce
from fractions import gcd
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
x = reduce(gcd,T)
sum=0
for i in T:
    sum*=(x*i)
print(sum)

Submission status: Wrong Answer

Solution code:
from functools import reduce
from fractions import gcd
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
x = reduce(gcd,T)
sum=0
for i in T:
    sum+=x*i
print(sum)

Submission status: Wrong Answer

Solution code:
def gcd(n,m):
    if n < m:
        t = n
        n = m
        m = t
    r = n % m
    while r > 0:
        n, m = m, r
        r = n % m
    return m
from itertools import accumulate
def GCD(args):
    return list(accumulate(args,gcd))[-1]
N = int(input())
T = [int(input()) for _ in range(N)]
g = GCD(T)
ans = g
for t in T:
    ans *= t//g
print(ans)

Submission status: Wrong Answer

Solution code:
from fractions import gcd


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


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

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

Submission status: Wrong Answer

Solution code:
nu = int(input())

lis = []
ans = 0

for i in range(nu):
    t = int(input())
    lis.append(t)

lis.sort()

for i in range(10*18):
    tes = lis[-1] * (i+1)
    for f in lis:
        if tes % f == 0:
            ans = 1
        else:
            ans = -1
            break
    if ans == 1:
        break

print(tes)

Submission status: Wrong Answer

Solution code:
nu = int(input())

lis = []
ans = 0

for i in range(nu):
    t = int(input())
    lis.append(t)

lis.sort()
print(lis)

for i in range(10*18):
    tes = lis[-1] * (i+1)
    for f in lis:
        if tes % f == 0:
            ans = 1
        else:
            ans = -1
            break
    if ans == 1:
        break

print(tes)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
def saiki(n , t , maxi):

    saikimaxi = 0
    for i in range(n):
        if maxi % t[i] != 0:
            saikimaxi = max(saikimaxi , t[i])

    if saikimaxi != 0:
        return saiki(n , t , (maxi * saikimaxi))
    else:
        return maxi

def multiclocks(n , t):

    maxi = max(t)
    return saiki(n , t , maxi)

def main():
    n = int(input())
    t = [int(input()) for i in range(n)]
    print(multiclocks(n , t))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
1000000000000000000

Submission status: Wrong Answer

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

n = int(input())
t = []
for i in range(n):
  t.append(int(input()))
  
answer = 0
for index, tt in enumerate(sorted(t)):
  if index + 1 == len(t):
    continue
  lc = lcm(tt, t[index+1])
  if lc > answer:
    answer = lc
print(answer)

Submission status: Wrong Answer

Solution code:
import fractions

def a(A, B):
    C = fractions.gcd(A, B)
    return (A * B)/C

N = int(input())

T = []

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

T = sorted(T)
C = T[0]

if N > 1:
    for i in range(1, N):
        C = a(C, T[i])
print(C)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from functools import reduce

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

def lcm_list(l):
    return reduce(lcm, l)


def solve():
    N = int(input())
    T = [int(input()) for _ in range(N)]
    print(lcm_list(T))

Submission status: Wrong Answer

Solution code:
import fractions

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

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

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

print(int(a))

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=1
a=[0]*3
for i in range(n):
    a[0]=ans
    a[1]=temp=int(input())
    while 1:
        a[2]=a[0]%a[1]
        a[0]=a[1]
        a[1]=a[2]
        if a[2]==0:break
    ans=ans*temp/a[0]
print(int(ans))

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
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 I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# GCD -- START --
def gcd(x,y):
  while y:
    x,y=y,x%y
  return x
# GCD --- END ---

# LCM -- START --
def lcm(x,y):
  return x*y/gcd(x,y)
# LCM --- END ---

def main():
  n=I()
  ans=I()

  for _ in range(n-1):
    ans=lcm(ans,I())

  return int(ans)

# main()
print(main())

Submission status: Wrong Answer

Solution code:
#import math as mm
import fractions as mm #atcoder用

def LCM(a,b):
	lcm = a / mm.gcd(a,b) * b
	return int(lcm)

def LCM_LST(l):
	lst = l[:]
	new_lst = []
	if len(lst) == 1:
		ans = lst[0]
	else:
		if len(lst) % 2 == 1:
			t1 = lst.pop()
			t2 = lst.pop()
			lst.append(LCM(t1,t2))
		for i in range(0,int(len(lst)/2)):
			new_lst.append(LCM(lst[2*i], lst[2*i+1]))

		ans = LCM_LST(new_lst)

	return ans
		


if __name__ == '__main__':

	#入力
	N = int(input())
	time_lst = []
	for i in range(0,N):
		t = int(input())
		time_lst.append(t)

	print(int(LCM_LST(time_lst)))

Submission status: Wrong Answer

Solution code:
import fractions as mm #atcoder用

def LCM(a,b):
	lcm = a * b / mm.gcd(a,b)
	return int(lcm)

def LCM_LST(lst):
	new_lst = []
	if len(lst) == 1:
		ans = lst[0]
	else:
		if len(lst) % 2 == 1:
			t1 = lst.pop()
			t2 = lst.pop()
			lst.append(LCM(t1,t2))
		for i in range(0,int(len(lst)/2)):
			new_lst.append(LCM(lst[2*i], lst[2*i+1]))

		ans = LCM_LST(new_lst)

	return ans
		


if __name__ == '__main__':

	#入力
	N = int(input())
	time_lst = []
	for i in range(0,N):
		t = int(input())
		time_lst.append(t)

	print(int(LCM_LST(time_lst)))

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[int(input()) for i in range(n)]
import fractions
maxi=0
for i in range(n-1):
    x=fractions.gcd(a[i],a[i+1])
    lcm=a[i]*a[i+1]/x
    maxi=max(maxi,lcm)
print(int(maxi))

Submission status: Wrong Answer

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

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

ans = 1
for i in range(n):
    ans = gcd(ans,li[i])
print(ans)

Submission status: Wrong Answer

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

n = int(input())
ans = 1
for _ in range(n):
    t = int(input())
    ans = ans*n//gcd(ans, n)
print(ans)

Submission status: Wrong Answer

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

n = int(input())
ans = 1
for _ in range(n):
    t = int(input())
    ans *= int(t/gcd(ans, t))
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    n=int(input())
    T=sorted(set(list(int(input()) for _ in  range(n))))
    k=T[-1]
    while 1:
        for t in T:
            if k%t>0:
                k += T[-1]
                break
        print(k)
        break
main()

Submission status: Wrong Answer

Solution code:
def main():
    n=int(input())
    T=sorted(set(list(int(input()) for _ in  range(n))))
    print(T)
    k=T[-1]
    while 1:
        for t in T:
            if k%t>0:
                k += T[-1]
                break
        print(k)
        break
main()

Submission status: Wrong Answer

Solution code:
def main():
    n=int(input())
    T=sorted(set(list(int(input()) for _ in  range(n))))
    k=T[-1]
    while 1:
        for t in T:
            if k%t>0:
                k += k
                break
        print(k)
        break
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from fractions import gcd
n=int(input())
t=[int(input()) for i in range(n)]
t.sort()
ans=t[n-1]
for i in range(n-1):
  if gcd(t[n-1],t[i])==1:
    ans*=t[i]
print(ans)

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
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 I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# GCD -- START --
def gcd(x,y):
  while y:
    x,y=y,x%y
  return x
# GCD --- END ---

# LCM -- START --
def lcm(x,y):
  return x*y/gcd(x,y)
# LCM --- END ---

def main():
  n=I()
  ans=I()

  for _ in range(n-1):
    a=I()
    ans=(ans*a)/gcd(ans,a)
  return int(ans)

# main()
print(main())

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())
T = sorted([int(input()) for i in range(N)])[::-1]
if len(T)==1:
    print(T[0])
    sys.exit()
def gcd(x,y):
    a = max(x,y)
    b = min(x,y)
    while b!=0:
        a,b = b,a%b
    return a

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string,fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
mod = 10**9+7
ans = 0 ;count = 0 ;pro = 1

n=int(input())
T=[int(input()) for i in range(n)]
g=1
for ti in T:
    pro*=ti
    g=fractions.gcd(g,ti)
def lcm(m,n):
    return (m*n)//fractions.gcd(m,n)
print(lcm(pro,g))

Submission status: Wrong Answer

Solution code:
import fractions

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import fractions

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import fractions

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

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import fractions

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

def main():
    n = int(input())
    t = [ int(input()) for _ in range(n)]
    ans = t[0]
    for i in range(n-1):
        ans = lcm(ans, t[i+1])
    print(int(ans))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import fractions

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

def main():
    n = int(input())
    t = [ int(input()) for _ in range(n)]
    ans = t[0]
    for i in range(n-1):
        ans = lcm(ans, t[i+1])
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
def lcm(x, y):
    return (x * y) // gcd(x, y)

N = int(input())
T = [int(input()) for _ in range(N)]
if N == 1:
    print(T)
    exit()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

t = sorted([int(input()) for _ in range(n)])
lcm = t[0]
for i in range(n-1):
    if t[i+1] % lcm == 0:
        lcm = t[i+1]
    else:
        lcm *= t[i+1]
        
print(lcm)

Submission status: Wrong Answer

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

t = [int(input()) for _ in range(n)]
lcm = t[0]
for i in range(n-1):
    if t[i+1] % lcm == 0:
        lcm = t[i+1]
    else:
        lcm *= t[i+1]
        
print(lcm)

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
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 I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# GCD -- START --
def gcd(x,y):
  while y:
    x,y=y,x%y
  return x
# GCD --- END ---

# LCM -- START --
def lcm(x,y):
  return x*y/gcd(x,y)
# LCM --- END ---

def main():
  n=I()
  l=[I() for _ in range(n)]
  l.sort()
  a=l[0]

  for x in l[1:]:
    b=[a,x]
    b.sort()

    if b[1]%b[0]==0:
      a=b[1]
    else:
      a=lcm(b[0],b[1])

  return int(a)

# main()
print(main())

Submission status: Wrong Answer

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

n = int(input())
t = []
for i in range(n):
  t.append(int(input()))
  
answer = 0
for index, tt in enumerate(sorted(t)):
  if index + 1 == len(t):
    continue
  lc = lcm(tt, t[index+1])
  if lc > answer:
    answer = lc
print(answer)

Submission status: Wrong Answer

Solution code:
import fractions as fr
N = int(input())
T = [int(input()) for i in range(N)]
gcd = T[0]
lcm = T[0]
for i in range(N-1):
    gcd = fr.gcd(lcm,T[i+1])
    lcm = lcm*T[i+1]/gcd
print(int(lcm))

Submission status: Wrong Answer

Solution code:
from sys import stdin
from itertools import groupby

n = int(stdin.readline().rstrip())
li = [int(stdin.readline().rstrip()) for _ in range(n)]

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


point = 1
for i in range(n-1):
    point *= lcm(li[i],li[i+1])

print(point)

Submission status: Wrong Answer

Solution code:
import fractions as f
n=int(input())
t=int(input())
ans=0
for i in range(n-1):
    s=int(input())
    t=s*t//f.gcd(t,s)
    if ans<t:
        ans=t
    #print(ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from functools import reduce
from fractions import gcd
from operator import mul

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

print(reduce(mul, T)//reduce(gcd, T))

Submission status: Wrong Answer

Solution code:
def gcd(a,b):
    if a>b :
        while b!=0:
            a,b = b,a%b
        return a
    elif a==b:
        return a
    else :
        while a!=0:
            a,b = b%a,a
        return b
def lcm(n,A):
    gcdn = [0]*n
    lcmn = [0]*n
    gcdn[0]=A[0]
    lcmn[0]=A[0]
    for i in range(n-1):
        gcdn[i+1] = gcd(lcmn[i],A[i+1])
        lcmn[i + 1] = (lcmn[i]/gcdn[i+1])*A[i+1]
    return lcmn[n-1]

def examC():
    N = I()
    T = [I() for _ in range(N)]
    ans = lcm(N,T)
    print(ans)

import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()

Submission status: Wrong Answer

Solution code:
import fractions
from functools import reduce
N=int(input())
L = [int(input()) for i in range(N)]
a=reduce(lambda x,y:x*y/fractions.gcd(x,y),L,1)
print(int(a))

Submission status: Wrong Answer

Solution code:
from fractions import gcd  #python 3.5より前
n = int(input())
t = sorted([int(input()) for _ in range(n)])
if n==1:
    ans = t[0]
else:
    ans = t[0]*t[1]/gcd(t[0],t[1])
    for i in range(1,n-1):
        ans = ans*t[i+1]/gcd(ans,t[i+1])
print(int(ans))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7)
N = int(input())
ts = [int(input()) for _ in range(N)]

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

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

l = 1
for t in ts:
    l = lcm(l, t)

print(l)

Submission status: Wrong Answer

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:
        continue
    else:
        prod *= prime

print(prod * t_max)

Submission status: Wrong Answer

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 * t_max)

Submission status: Wrong Answer

Solution code:
import math

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

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
        
if len(primes) == 0:
    print(t_max)
else:
    print(prod*t_max)

Submission status: Wrong Answer

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

N=int(input())

a=int(input())
for _ in range(N-1):
    b=int(input())
    M=max(a,b)
    m=min(a,b)
    while True:
        M,m=m,M%m
        if m==0:
            break
    a=a/M*b

print(int(a))

Submission status: Wrong Answer

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

N=int(input())

a=int(input())
for _ in range(N-1):
    b=int(input())
    f=fractions.gcd(a,b)
    a=a/f*b

print(int(a))

Submission status: Wrong Answer

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

N=int(input())

a=int(input())
for _ in range(N-1):
    b=int(input())
    f=fractions.gcd(a,b)
    a=a*b/f

print(int(a))

Submission status: Wrong Answer

Solution code:
N=int(input())
T=[int(input()) for i in range(N)]
T.sort()
ans=T[0]
for i in range(N-1):
  if(ans!=T[i+1]):
    TT=T[i+1]
    ans=ans*TT
    while(T[i]):
      TT%=T[i]
      T[i],TT=TT,T[i]
    ans=ans//TT
print(ans)

Submission status: Wrong Answer

Solution code:
def gcd(x,y):
    if x<y:
        x,y = y,x
    while y>0:
        x,y = y,x%y
    return x
N = int(input())
T = list(set([int(input()) for _ in range(N)]))
a = T[0]
for i in range(1,len(T)):
    a = gcd(T[i],a)
t = a
for i in range(len(T)):
    t *= T[i]//a
print(t)

Submission status: Wrong Answer

Solution code:
def lcm(a,b):
    if a%b !=0:
        return lcm(b,a%b)
    else:
        return b
def gcm(a,b):
    l=lcm(a,b)
    return a*b//l

def main():
    n=int(input())
    t=[int(input()) for i in range(n)]
    ans = t[0]
    if n==1:
        print(n)
        exit()
    for i in t[1:]:
        ans=gcm(ans,i)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())

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

a=int(input())
for _ in range(N-1):
    b=int(input())
    f=gcd(a,b)
    a=a*b/f

print(int(a))

Submission status: Wrong Answer

Solution code:
import fractions

N=int(input())

a=int(input())
for _ in range(N-1):
    b=int(input())
    f=fractions.gcd(a,b)
    a=a*b/f

print(int(a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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,t[i+1])
print(a)

Submission status: Wrong Answer

Solution code:
#ABC070 C - Multiple Clocks
from fractions import gcd

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

N = int(input())
T = []
ans = 0

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
#ABC070 C - Multiple Clocks
from fractions import gcd

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

N = int(input())
T = []
ans = 0

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

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

print(ans)

Submission status: Wrong Answer

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 = 1
for i in range(2,len(li)):
    num = lcm1(num,li[i])
print(num)

Submission status: Wrong Answer

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
for i in range(len(li)-1):
    num = lcm1(li[i],li[i+1])
print(num)

Submission status: Wrong Answer

Solution code:
def gcd(x, y):
    while y > 0:
        x, y = y, x%y
    return x
def lcm(x, y):
    return (x*y)/gcd(x, y)
 
n = int(input())
val = int(input())
for i in range(n-1):
    tmp = int(input())
    val = lcm(val, tmp)
 
print(str(val))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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(reduce(lcm, li))

Submission status: Wrong Answer

Solution code:
from functools import reduce
from fractions import gcd
n = int(input())
T = [int(input()) for i in range(n)]
lcd = reduce(lambda x, y: x * y, T) // reduce(gcd, T)
print(lcd)

Submission status: Wrong Answer

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

least_common = t[0]

for i in range(1, n):
    a = least_common
    b = t[i]
    while a % b != 0:
        temp = b
        b = a % b
        a = temp
    least_common = t[i-1] * t[i] // b

print(least_common)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = sorted(list(set([int(input()) for _ in range(N)])), reverse=True)
ret = []
while len(T) > 1:
  C = int(max(T) ** 0.5)
  f = False
  for c in range(2, C + 1):
    T_ =  T[:]
    for i, t in enumerate(T):
      if t % c == 0:
        T_[i] = t // c
        f = True
    if f:
      ret.append(c)
      T = sorted(list(set(T_[:])), reverse=True)
      break
    if T[-1] < c ** 2:
      ret.append(T[-1])
      T = T[:-1]
  else:
    break

ret += T
ans = 1
for r in ret:
  ans *= r
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
T = sorted(list(set([int(input()) for _ in range(N)])), reverse=True)
ret = []
while len(T) > 1:
  C = int(max(T) ** 0.5)
  f = False
  for c in range(2, C + 1):
    if T[-1] < c ** 2:
      ret.append(T[-1])
      T = T[:-1]
    T_ =  T[:]
    for i, t in enumerate(T):
      if t % c == 0:
        T_[i] = t // c
        f = True
    if f:
      ret.append(c)
      T = sorted(list(set(T_[:])), reverse=True)
      break
  else:
    break

ret += T
ans = 1
for r in ret:
  ans *= r
print(ans)

Submission status: Wrong Answer

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]

T= set(T)

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

Submission status: Wrong Answer

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]

T.sort()

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

Submission status: Wrong Answer

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 = ans/gcd(ans, i)* i
print(int(ans))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
N = int(input())

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

ans = T[0]

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

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
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 I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# GCD
def gcd(x,y):
  while y:
    x,y=y,x%y
  return x

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

def main():
  n=I()
  l=[I() for _ in range(n)]
  l.sort()

  ans=1
  while True:
    if len(l)<=0:
      return int(ans) 

    a=l.pop()
    if ans%a!=0:
      ans=lcm(ans,a)

# main()
print(main())

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

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])
print(int(ans))

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

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