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:
N = int(input())
T = [int(input()) for i in range(N)]
max_T = max(T)
i = 1
while 1:
    flg = 0
    for t in T:
        if max_T % t:
            flg = 1#割り切れなかったらフラグを立てる
    if not flg:
        print(max_T)
        exit()
    i += 1
    max_T *= i

Submission status: Wrong Answer

Solution code:
from math import gcd

N = int(input())

res = 0
Tb = 1

for i in range(N):
   T = int(input())
   res = gcd(res, T)
   ans = T // res * Tb 
   Tb *= T

print(ans)

Submission status: Wrong Answer

Solution code:
from math import gcd

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

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

res = 0
path = 1

for i in range(N):
   res = gcd(res, T[i])
   path *= T[i]

print(path//res)

Submission status: Wrong Answer

Solution code:
from math import gcd

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

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

res = 0

for i in range(N):
   res = gcd(res, T[i])

print(res)

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)
      
N=int(input())
T=[]
total=1
for i in range(N):
    a=int(input())
    T.append(a)
T_set=sorted(list(set(T)))
M=len(T_set)

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

print(ans)

Submission status: Wrong Answer

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


def euc_alg(val1, val2):

    if val1 == val2:
        return val1

    mod = val2
    divided = val1
    while 1:
        tmp_mod = divided % val2

        if tmp_mod == 0:
            break
        divided = mod
        mod = tmp_mod

    ret = val1 * val2 // mod

    return ret

maxti = max(ti)
least_common_mult = max([euc_alg(maxti, t) for t in ti])

print(least_common_mult)

Submission status: Wrong Answer

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


def euc_alg(val1, val2):
    assert val1 >= val2

    if val1 == val2:
        return val1

    mod = val2
    divided = val1
    while 1:
        tmp_mod = divided % val2

        if tmp_mod == 0:
            break
        divided = mod
        mod = tmp_mod

    ret = val1 // mod * val2

    return ret

maxti = max(ti)
least_common_mult = max([euc_alg(maxti, t) for t in ti])

print(least_common_mult)

Submission status: Wrong Answer

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


def euc_alg(val1, val2):
    assert val1 >= val2

    if val1 == val2:
        return val1

    mod = val2
    divided = val1
    while 1:
        tmp_mod = divided % val2

        if tmp_mod == 0:
            break
        divided = mod
        mod = tmp_mod

    ret = val1 * val2 // mod

    return ret

maxti = max(ti)
least_common_mult = max([euc_alg(maxti, t) for t in ti])

print(least_common_mult)

Submission status: Wrong Answer

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


def euc_alg(val1, val2):
    assert val1 >= val2

    mod = val2
    divided = val1
    while 1:
        tmp_mod = divided % val2

        if tmp_mod == 0:
            break
        divided = mod
        mod = tmp_mod

    ret = val1 * val2 // mod

    return ret

maxti = max(ti)
least_common_mult = -10**24
for t in ti:
    least_common_mult = max(least_common_mult, euc_alg(maxti, t))

print(least_common_mult)


"""
def all_mods(ls, val):
    mods = [val % l for l in ls]
    return max(mods) == 0

maxti = max(ti)

i = 1
while 1:
    valid = all_mods(ti, i * maxti)
    if valid:
        break
    i += 1

print(i * maxti)
"""

Submission status: Wrong Answer

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

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

l=T[0]
for t in T:
	l=l / gcd(l, t) * t
print(l)

Submission status: Wrong Answer

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

ans=1
m_t=max(t)  
for i in range(n):
    if m_t%t[i]!=0:
        for j in range(n):
            ans*=t[j]
        print(ans)
        break
    else:
        if i==n-1:
            print(m_t)

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[0])
    exit()
 
ans = lcm(T[0] , T[1])

Submission status: Wrong Answer

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


n = int(input())
t1 = int(input())
ans = 0
for _ in range(n-1):
    t2 = int(input())
    ans = t1*t2 // gcd(t1, t2)
    t1 = ans
print(ans)

Submission status: Wrong Answer

Solution code:
import math
import sys
n = int(input())
t = [int(input()) for _ in range(n)]
if n == 1:
  print(t[0])
  sys.exit()
elif n == 2:
  print((t[0]*t[1])//(math.gcd(t[0],t[1])))
  sys.exit()
t.sort()
ans = (t[0]*t[1])//math.gcd(t[0],t[1])
for i in range(2,n-3):
    #print((ans*t[i])//math.gcd(ans,t[i]))
    ans =((t[i]*ans)//math.gcd(t[i],ans))
print((ans*t[-1])//math.gcd(ans,t[-1]))

Submission status: Wrong Answer

Solution code:
import math
import sys
n = int(input())
t = [int(input()) for _ in range(n)]
if n == 1:
  print(t[0])
  sys.exit()
elif n == 2:
  print((t[0]*t[1])//(math.gcd(t[0],t[1])))
  sys.exit()
t.sort()  
for i in range(n-2):
   #print((t[i]*t[i+1])//math.gcd(t[i],t[i+1]))
    ans =((t[i]*t[i+1])//math.gcd(t[i],t[i+1]))
print((ans*t[-1])//math.gcd(ans,t[-1]))

Submission status: Wrong Answer

Solution code:
import math
import sys
n = int(input())
t = [int(input()) for _ in range(n)]
if n == 1:
  print(t[0])
  sys.exit()
elif n == 2:
  print((t[0]*t[1])//(math.gcd(t[0],t[1])))
  sys.exit()
t.sort()  
for i in range(n-2):
    ans =(math.gcd(t[i],t[i+1]))
print((ans*t[-1])//math.gcd(ans,t[-1]))

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
T = [int(input()) for i in range(N)]
num = 1
for i in range(N - 1):
    cnt = (T[i] * T[i+1]) // math.gcd(T[i], T[i+1])
    num = (num * cnt) // math.gcd(num, cnt)

print(num)

Submission status: Wrong Answer

Solution code:

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

if N==1:
    f2 = T[0]

elif N==2:
    import math
    a,b = T[0], T[1]
    f=math.gcd(a,b)
    f2=a*b//f

else:
    import math
    a,b = T[0], T[1]
    f=math.gcd(a,b)
    f2=a*b//f
    for i in range(2,N):
        a,b=f2, T[i]
        f=math.gcd(a,b)
        f2=a*b//f

print(f2)

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    if(a == 0):
        return b
    return gcd(b % a, a)
def lcm(a, b):
    return int(a/(gcd(a, b) * b)) 
t = int(input())
ans = 1
while(t != 0):
    t -= 1
    n = int(input())
    ans = lcm(ans, n)
    ans = int(ans)
print(int(ans))

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    if(a == 0):
        return b
    return gcd(b % a, a)
def lcm(a, b):
    if((a * b) / gcd(a, b) > 1000000000000000000):
        return a/(gcd(a, b) * b) 
    return (a * b) / gcd(a, b)
t = int(input())
ans = 1
while(t != 0):
    t -= 1
    n = int(input())
    ans = lcm(ans, n)
print(int(ans))

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    if(a == 0):
        return b
    return gcd(b % a, a)
def lcm(a, b):
    return a / (gcd(a, b) * b) 
t = int(input())
ans = 1
while(t != 0):
    t -= 1
    n = int(input())
    ans = lcm(ans, n)
print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = 1
for i in range(n):
    x = int(input())
    if x % s == 0:
        s = x
    else:
        if s % x != 0:
            s *= x
print(s)

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    if(a == 0):
        return b
    return gcd(b % a, a)
def lcm(a, b):
    return (a * b) / gcd(a, b) 
t = int(input())
ans = 1
while(t != 0):
    t -= 1
    n = int(input())
    if(ans < 1000000000000000000):
        ans = lcm(ans, n)
if(ans > 1000000000000000000):
    ans = 1000000000000000000
print(int(ans))

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    if(a == 0):
        return b
    return gcd(b % a, a)
def lcm(a, b):
    return (a * b) / gcd(a, b) 
t = int(input())
ans = 1
while(t != 0):
    t -= 1
    n = int(input())
    if(ans < 1000000000000000000000):
        ans = lcm(ans, n)
print(int(ans))

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    if(a == 0):
        return b
    return gcd(b % a, a)
def lcm(a, b):
    return (a * b) / gcd(a, b) 
t = int(input())
ans = 1
while(t != 0):
    t -= 1
    n = int(input())
    if(ans < 10000000000000000000):
        ans = lcm(ans, n)
print(int(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
from math import gcd
def main():
    n = int(input())
    t = [int(input()) for _ in range(n)]
    if n == 1:
        print(t[0])
        sys.exit()
    r = (t[0] * t[1]) // gcd(t[0], t[1])
    if n == 2:
        print(r)
        sys.exit()
    for i1 in range(2, n):
        r = (r * t[i1]) // gcd(r, t[1])
    print(r)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
t = [int(input()) for _ in range(n)]
if n == 1:
    print(0)
    exit()
a = t[0]*t[1]//math.gcd(t[0],t[1])
for i in range(2, n):
    a = t[i]*a//math.gcd(t[i],a)
print(a)

Submission status: Wrong Answer

Solution code:
import decimal
import math
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
t = IR(n)

ans = t[0]

for i in t[1:]:
    gcd = math.gcd(ans, i)
    ans = int(decimal.Decimal(decimal.Decimal(
        ans) * decimal.Decimal(i)) / decimal.Decimal(gcd))
print(ans)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

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

if n == 1:
    print(*t)
    exit()

t.sort()

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

for i in range(n-1):
    cm.append(lcm(t[i], t[i+1]))

print(max(cm))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

mt=t[0]
mx=t[0]
for i in t:
  if mt!=1:
    for j in range(min(i,mx),0,-1):
      if i%j==0 and mx%j==0:
        mt=j
        break
  mx=i*mx//mt

print(mx)

Submission status: Wrong Answer

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

import fractions
n = t[0]
for a,b in zip(t, t[1:]):
    g = fractions.gcd(n, b)
    n = a*b//g
print(n)

Submission status: Wrong Answer

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

from itertools import accumulate
N = int(input())
T = [int(input()) for _ in range(N)]
ans = list(accumulate(T, func=gcd))[-1]
print(ans)

Submission status: Wrong Answer

Solution code:
import math

n = int(input().rstrip())
seconds = [int(input().rstrip()) for _ in range(n)]
seconds = set(seconds)
def getPrimeList(num):
    prime_l = {}
    if (num < 1):
        return prime_l

    pos_max = math.floor(math.sqrt(num))
    for i in range(2,pos_max+1):
        if num%i == 0:
            count = 0
            while num%i == 0:
                count += 1
                num = int(num/i)

            prime_l[i] = count
    if num > pos_max:
        prime_l[num] = 1
    
    return prime_l

prime_all = {}
for num in seconds:
    prime = getPrimeList(num)
    for p in prime.keys():
        if (prime_all.get(p) and prime_all[p] <prime[p]) or (prime_all.get(p) != True):
            prime_all[p] = prime[p]
lcm = 1
for p in prime_all.keys():
    lcm *= pow(p,prime_all[p])
print(lcm)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
N = int(input())
if N >2:
    A = [int(input()) for _ in range(N)]
    B = [0]*(N-1)
    B[0] = (A[0]*A[1])//gcd(A[0], A[1])
    for i in range(N-2):
        B[i+1] = (A[i+2]*B[i])//gcd(A[i+2], B[i])
    ans = B[N-2]
else:
    ans = int(input())
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    from fractions import gcd
    from functools import reduce
    from operator import mul
    n, *t = map(int, open(0).read().split())
    g = reduce(gcd, t)
    ans = reduce(mul, t) // g
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

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

def main():
    n = int(input())
    T = [int(input()) for _ in range(n)]
    g = 0
    for i in range(n):
        g = gcd(g,T[i])
    lcm = 1
    for i in range(n):
        lcm = lcm // g * T[i]
    print(lcm)
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

N = int(input())
# S = input()
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
mod = 10 ** 9
from functools import reduce
from fractions import gcd

def main():
    T = sorted(list(set([int(input()) for _ in range(N)])))
    if len(T) == 1:
        print(T[0])
        exit()
    ans = (T[0] * T[1]) // gcd(T[0], T[1])
    for i in range(len(T) - 2):
        ans = ans / gcd(ans, T[i + 2]) * T[i + 2]
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

N = int(input())
# S = input()
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
mod = 10 ** 9
from functools import reduce
from fractions import gcd

def main():
    T = sorted(list(set([int(input()) for _ in range(N)])))
    if len(T) == 1:
        print(T[0])
        exit()
    ans = (T[0] * T[1]) // gcd(T[0], T[1])
    for i in range(len(T) - 2):
        ans = ans / gcd(ans, T[i + 2]) * T[i + 2]
    if isinstance(ans, float):
        print(round(ans))
    else:
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

N = int(input())
# S = input()
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
mod = 10 ** 9
from functools import reduce
from fractions import gcd

def main():
    T = list(set([int(input()) for _ in range(N)]))
    if len(T) == 1:
        print(T[0])
        exit()
    ans = (T[0] * T[1]) // gcd(T[0], T[1])
    for i in range(len(T) - 2):
        ans = ans / (gcd(ans, T[i])) * T[i]
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

N = int(input())
# S = input()
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
mod = 10 ** 9
from functools import reduce
from fractions import gcd

def main():
    T = list(set([int(input()) for _ in range(N)]))
    if len(T) == 1:
        print(T[0])
        exit()
    ans = (T[0] * T[1]) // gcd(T[0], T[1])
    for i in range(len(T) - 2):
        ans = ans // (gcd(ans, T[i])) * T[i]
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

N = int(input())
# S = input()
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
mod = 10 ** 9
from functools import reduce
from fractions import gcd

def main():
    T = list(set([int(input()) for _ in range(N)]))
    if len(T) == 1:
        print(T[0])
        exit()
    ans = (T[0] * T[1]) // gcd(T[0], T[1])
    for i in range(len(T) - 2):
        ans = (ans * T[i]) // (gcd(ans, T[i]))
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

N = int(input())
# S = input()
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
mod = 10 ** 9
import numpy as np
from functools import reduce
from fractions import gcd

def main():
    T = list(set([int(input()) for _ in range(N)]))
    T_max = max(T)
    if T_max > mod:
        print(T_max)
    else:
        print(np.prod(T) // reduce(gcd, T))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def gcd(a,b):
    r=1
    while r!=0:
        r=a%b
        a=b
        b=r
    return a
g=1
n = int(input())
t = [int(input()) for i in range(n)]
t1 = list(set(t))
n1 = len(t1)
for i in range(n1):
    g = gcd(g,t1[i])
ans = g
for i in range(n1):
    ans *= t1[i]//g
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
from fractions import gcd
g = 0
seki = 1
for i in range(n):
    s = int(input())
    g = gcd(g, s)
    seki *= s

print(seki//g)

Submission status: Wrong Answer

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

from fractions import gcd
from functools import reduce

print(reduce(gcd,T))

Submission status: Wrong Answer

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

import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
print(lcm_list(List))

Submission status: Wrong Answer

Solution code:
def resolve():
    nclo=range(int(input()))
    from fractions import gcd
    def lcm(a,b):
        return (a*b)//gcd(a,b)
    next=0
    temp=1
    for i in nclo:
        next=int(input())
        temp=lcm(temp,next)
    print(temp)
        
#%%submit!
#resolve()

Submission status: Wrong Answer

Solution code:
import fractions
 
def lcm(a,b):
  return (a*b)//fractions.gcd(a,b)
 
N=int(input())
T=1
for i in range(T):
  T=lcm(T,int(input()))
print(T)

Submission status: Wrong Answer

Solution code:
import fractions

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

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

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

Submission status: Wrong Answer

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict(list)
#import bisect
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    from fractions import gcd
    n = int(input())
    l = []
    for i in range(n):
        a = int(input())
        l.append(a)
    lcm = 0
    for i in range(1,n):
         g = gcd(l[i-1],l[i])
         lcm = l[i-1] * l[i] // g
    print(lcm)
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
def gcd(x, y):
  while(x % y != 0 and y % x != 0):
    if(x > y):
      x = x % y
    else:
      y = y % x
  if(x > y):
    return y
  else:
    return x
  
N = int(input())
A = list()
for i in range(N):
  A.append(int(input()))

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

Submission status: Wrong Answer

Solution code:
def gcd(x, y):
  while(x % y != 0 and y % x != 0):
    if(x > y):
      x = x % y
    else:
      y = y % x
  if(x > y):
    return y
  else:
    return x
  
N = int(input())
A = list()
for i in range(N):
  A.append(int(input()))
for i in range(N):
  ans = 1
  gcd_i = gcd(A[i], ans)
  ans = A[i] * ans // gcd_i
  
print(ans)

Submission status: Wrong Answer

Solution code:
from fractions import gcd

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

r = T[0]
for i in range(1, N):
    r = gcd(r, T[i])

R = [t // r for t in T]
R.sort(reverse=True)
ans = r
for i in range(N):
    if ans % R[i] != 0:
        ans *= R[i]

print(ans)

Submission status: Wrong Answer

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

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

ans =1
for i in range(n):
  a = int(input())
  ans = lcm_base(ans,a)
print(int(ans))

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
from fractions import gcd
n = int(input())
l = list(int(input()) for _ in range(n))

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

ans =1
for i in l:
  ans = lcm_base(ans,i)
print(int(ans))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from functools import reduce
n = int(input())
l = list(int(input()) for _ in range(n))

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

def lcm_list(t):
  return reduce(lcm_base,t)
  
print(int(lcm_list(l)))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from functools import reduce
n = int(input())
l = list(int(input()) for _ in range(n))

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

def lcm_list(t):
  return reduce(lcm_base,t,1)
  
print(int(lcm_list(l)))

Submission status: Wrong Answer

Solution code:
from fractions import gcd


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

Submission status: Wrong Answer

Solution code:

def gcd(a,b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b
n = int(input())
a = int(input())
for i in range(n-1):
    b = int(input())
    a = a * b/ gcd(a, b)
print(int(a))

Submission status: Wrong Answer

Solution code:
n = int(input())
t=[]
div = [[False for i in range(n)] for j in range(n)]
tcount=[0]*n

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

for i in range(n):
  for j in range(n):
    if t[i]%t[j]==0:
      div[i][j]=True
    
for i in range(n):
  if all(div[i]):
    print(t[i])
    exit()
  else:
    tcount[i]=div[i].count(True)

k = tcount.index(max(tcount))

list_index=[]
for i in range(n):
  if not div[k][i]:
    list_index.append(i)
ans=t[k]

for i in list_index:
  ans*=t[i]
print(ans)

Submission status: Wrong Answer

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

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

def lcm_of_all(vec):
    temp = vec[0]
    for elem in vec:
        temp = lcm(temp,elem)

    return temp

def main():
    N = int(input())
    T = [map(input().split())]
    ans = lcm_of_all(T)
    print(ans)

main

Submission status: Wrong Answer

Solution code:
n = int(input())
t = list(set([int(input()) for i in range(n)]))
def GCD(a, b):
  if b == 0:
    return a
  else:
    return GCD(b, a%b)
gcd = GCD(max(t), min(t))
lcm = (max(t)//(gcd))*min(t)
print(gcd*lcm)

Submission status: Wrong Answer

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

def calc_gcd(a,b):
  if a < b:
    a, b = b, a
  while a % b != 0:
    a, b = b, a % b
  return (b)

ans = s[0]
for i in range(1,N):
  gcd_tmp = calc_gcd(ans,s[i]) 
  ans = ans * s[i] / gcd_tmp
print(int(ans))

Submission status: Wrong Answer

Solution code:
from fractions import gcd
def lcm(x,y):
    return (x*y)//gcd(x,y)

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

if n==1:
    print(t[0])
    exit()
for i in range(n-1):
    tt=lcm(t[i],t[i+1])
    ans=max(ans,tt)
print(ans)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
def lcm(x,y):
    return (x*y)//gcd(x,y)

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

Submission status: Wrong Answer

Solution code:
n=int(input())
ans = 1
for i in range(n):
    inp = int(input())
    tmp = ans * inp
    tmp2 =ans
    while (ans % inp != 0):
        if (inp % ans == 0):
            ans = inp
            break
        ans += tmp2
        print(ans)
        print(ans%inp)
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans = 1
for i in range(n):
    inp = int(input())
    tmp = ans*inp
    while (ans % inp != 0):
        if (ans >= tmp):
            ans = tmp
            break
        ans+=ans
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans = 1
for i in range(n):
    tmp = int(input())
    if (tmp % ans == 0):
        ans=tmp
    elif (ans % tmp != 0):
        ans *= tmp
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans = 1
for i in range(n):
    tmp = int(input())
    if (ans % tmp != 0):
        ans *= tmp
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def main():
    from builtins import int, map, list, print
    from fractions import gcd
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_number = (lambda: int(input()))

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

    print(ans//1)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    from builtins import int, str, map, list, dict, float, print, len, sorted, max, min
    from itertools import accumulate, permutations, combinations
    from collections import deque, defaultdict, Counter
    from operator import itemgetter
    from bisect import bisect_left, bisect_right, bisect
    from heapq import heappop, heappush
    from fractions import gcd
    import sys, re, math, copy
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

def get_prime_factor(n):
    res = defaultdict(int)
    for i in range(2, n):
        if i * i > n:
            break
        while n % i == 0:
            res[i] = res[i] + 1
            n = n / i
    if n != 1:
        res[n] = 1
    return res

def merge_prime_factor(a, b):
    for k, v in b.items():
        a[k] = v if a[k] < v else a[k]
    return a


lcm_prime_factor = defaultdict(int)
for T in Ts:
    lcm_prime_factor = merge_prime_factor(lcm_prime_factor, get_prime_factor(T))

res = 1
for k, v in lcm_prime_factor.items():
    res = res * (k ** v)
print(res)

Submission status: Wrong Answer

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

def get_divider(n):
    divider = set()
    for i in range(1, n):
        if i * i > n:
            break

        if n % i == 0:
            divider.add(i)
            if i != int(n / i):
                divider.add(int(n / i))
    return divider


divider_set = set()
for T in Ts:
    divider_set = divider_set.union(get_divider(T))
divider_set.discard(1)
print(str(min(divider_set)))

Submission status: Wrong Answer

Solution code:
import sys
import fractions
sys.setrecursionlimit(200000000)

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

def gcd(num1, num2):
    if num2 == 0:
        return num1
    else:
        return gcd(num2, num1 % num2)


res = NUMS[0]
for num in NUMS[1:]:
    res = res * num / max(fractions.gcd(res, num), 1)

print(int(res))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(200000000)

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

def gcd(num1, num2):
    if num2 == 0:
        return num1
    else:
        return gcd(num2, num1 % num2)


res = NUMS[0]
for num in NUMS[1:]:
    res = res * num / max(gcd(res, num), 1)

print(int(res))

Submission status: Wrong Answer

Solution code:
import sys
a = []
for l in sys.stdin:
    a.append(int(l))
ans=1
import fractions
for i in range(len(a)):
	ans=a[i]*ans//fractions.gcd(a[i],ans)
print(ans)

Submission status: Wrong Answer

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

for v in t:
    if ans % v != 0:
        if ans < v:
            ans *= (v // ans)
        else:
            ans += v

print(ans)

Submission status: Wrong Answer

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

for v in t:
    if ans < v:
        if v % ans != 0:
            ans *= v
        else:
            ans = v

print(ans)

Submission status: Wrong Answer

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

for v in t:
    if ans % v != 0:
        if ans < v:
            ans = v
        else:
            ans *= v

print(ans)

Submission status: Wrong Answer

Solution code:
N,T1=int(input()),int(input())
for n in range(1,N):
    T2=int(input())
    t,T=sorted((T1,T2))
    while t!=0:
        T,t=t,T%t
    T1*=(T2/T)#TはT1とT2の最大公約数
print(int(T1))

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