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:
def gcd(x,y):
	while y != 0:
		temp = x%y
		x = y
		y = temp
	return x

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

N = 5
t = [2,5,10,1000000000000000000,1000000000000000000]

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

Submission status: Wrong Answer

Solution code:
#accepted

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

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

N = 5
t = [2,5,10,1000000000000000000,1000000000000000000]

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

Submission status: Wrong Answer

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


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


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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

if max(T) > 5*10**17:
    print(max(T))
    
else:
    tmp = max(T)
    for i in range(N):
        if tmp % T[i] != 0:
            tmp = T[i]/gcd(tmp, T[i])*tmp

    print(int(tmp))

Submission status: Wrong Answer

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

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

print ts[-1]

Submission status: Wrong Answer

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

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

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

   return lcm

# change the values of num1 and num2 for a different result



n = int(input())
arr = []
for _ in range(n):
	arr.append(int(input()))
	
arr.sort()
mx1 = arr[len(arr)-1]
mx2 = arr[len(arr)-2]
if mx1%2 == 0:
	print(mx1)
else:
	print(mx1*mx2)
	
# lc = arr[0]
# for i in range(n):
# lc = lcm(mx1, mx2)
#
# print(lc)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = int(input())
for i in range(n-1):
	b = int(input())
	ta = max(a,b)
	tb = min(a,b)
	while True:
		if ta % tb == 0:
			g = tb
			break
		else:
			t = ta % tb
			ta = tb
			tb = t
	a = a * b / g
print(int(a))

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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

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

Submission status: Wrong Answer

Solution code:
import sys

MAX = 1000000000000000000

N = int(sys.stdin.readline())

dict = {}
	
for i in range(N):
	val = int(sys.stdin.readline())
	if(val not in dict.values()):
		dict[i] = val

total = 1
for i in dict.values():
	total *= i
	
print min(total, MAX)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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

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

Submission status: Wrong Answer

Solution code:
import sys

N = int(sys.stdin.readline())

dict = {}
	
for i in range(N):
	val = int(sys.stdin.readline())
	if(val not in dict.values()):
		dict[i] = val

total = 1
for i in dict.values():
	total *= i
	
print total

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

while True:
    y = len(lst)
    for i in range(y-1):
        lst2.append(lcm(lst[i], lst[i+1]))
    x = len(lst2)
    if x==1:
        print(lst2[0])
        break
    lst.clear()
    for i in range(x-1):
        lst.append(lcm(lst2[i], lst2[i+1]))
    y = len(lst)
    if y==1:
        print(lst[0])
        break
    lst2.clear()

Submission status: Wrong Answer

Solution code:
def Q3(x):
    def gcd(a, b):
        if b > a:
            a, b = b, a
        while b > 0:
            a, b = b, a % b
        return a

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

    N = x[0]
    lst = x[1:]
    if N == 1:
        return lst
    else:
        l = lcm(lst[0], lst[1])
        for x in lst:
            l = lcm(l, x)
        return l

n = int(input())
t = [int(input()) for i in range(n)]
t.insert(0,n)
print(Q3(t))

Submission status: Wrong Answer

Solution code:
arr=[]

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

n=int(input())
for i in range(0,n):
    x=int(input())
    arr.append(x)
for i in range(0,n):
    for j in range(0,n):
        if i!=j:
            if arr[j]%arr[i]==0:
                arr[i]=1
                break
ans=int(1)
for i in range(0,n):
    ans=ans*arr[i]/gcd(ans,arr[i])
print(int(ans))

Submission status: Wrong Answer

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

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

    N = x[0]
    lst = x[1:]
    if N == 1:
        return lst
    else:
        l = lcm(lst[0], lst[1])
        for x in lst:
            l = lcm(l, x)
        return l

n = int(input())
t = [int(input()) for i in range(n)]
t.insert(0,n)
print(Q3(t))

Submission status: Wrong Answer

Solution code:
arr=[]

n=int(input())
for i in range(0,n):
    x=int(input())
    arr.append(x)
for i in range(0,n):
    for j in range(0,n):
        if i!=j:
            if arr[j]%arr[i]==0:
                arr[i]=1
                break
ans=int(1)
for i in range(0,n):
    ans=ans*arr[i]
print(ans)

Submission status: Wrong Answer

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

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

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

main()

Submission status: Wrong Answer

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

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

if max(T) > 5*10**17:
    print(max(T))
    
else:
    tmp = max(T)
    for i in range(N):
        if tmp % T[i] != 0:
            tmp = tmp/gcd(tmp, T[i])*T[i]

    print(int(tmp))

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [int(input()) for i in range(N)]
count = 0
for i in range(N):
    if T[i] == 10 ** 18:
        count += 1
        print(10 ** 18)
        break

x = 1
if count == 0:
    for i in range(N):
        x *= T[i]
if count == 0:
    print(x)

Submission status: Wrong Answer

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

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

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

   return lcm

# change the values of num1 and num2 for a different result



n = int(input())
arr = []
for _ in range(n):
	arr.append(int(input()))
	
arr.sort()
mx1 = arr[len(arr)-1]
mx2 = arr[len(arr)-2]

	
# lc = arr[0]
# for i in range(n):
lc = lcm(mx1, mx2)
	
print(lc)

Submission status: Wrong Answer

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

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

print(int(LCM))

Submission status: Wrong Answer

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

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

if max(T) > 5*10**17:
    print(max(T))
    
else:
    flag = False
    for t in T:
        if max(T) % t != 0:
            flag = True
            break
    else:
        print(max(T))
    
    if flag == True:
        tmp = T[0]
        for i in range(1, N):
            tmp = tmp/gcd(tmp, T[i])*T[i]

        print(int(tmp))

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

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

if max(T) > 5*10**17:
    print(max(T))
else:
    tmp = T[0]
    for i in range(1, N):
        tmp = tmp/gcd(tmp, T[i])*T[i]

    print(int(tmp))

Submission status: Wrong Answer

Solution code:
from fractions import gcd

def ngcd(nums):
    d = 0
    for num in nums:
        d = gcd(d,num)
    return d
 
def nlcm(nums):
    prod = 1
    for num in nums:
        prod = prod * num
    return prod // ngcd(nums)

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

    print(nlcm(nums))

Submission status: Wrong Answer

Solution code:
def findDivisor(num):
    # 2,3 are the most common divisor for many numbers hence I go by divisor of 2,3
    # if not then by the same number as divisor
    if num%2 == 0:
        return 2
    elif num%3==0:
        return 3
    return num

def findLCM(lcmArray):
    lcm = 1
    while len(lcmArray) > 0:
        minOfLCMArray = min(lcmArray)
        divisor = findDivisor(minOfLCMArray)

        for x in range(0, len(lcmArray)):
            Quotient = lcmArray[x]//divisor
            Reminder = lcmArray[x]%divisor
            if Reminder == 0:
                lcmArray[x] = Quotient

        lcm*=divisor
        minOfLCMArray = min(lcmArray)
        if minOfLCMArray == 1:
            lcmArray.remove(minOfLCMArray)
    return lcm




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


print (findLCM(arr))

Submission status: Wrong Answer

Solution code:
def gcd(a,b):
    x=min(a,b)
    y=max(a,b)
    if x==0:
        return y
    else:
        return gcd(y,y%x)
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
#print(l)
ans=1
for i in range(n):
    ans=gcd(l[i],ans)
print(ans)

Submission status: Wrong Answer

Solution code:
def findDivisor(num):
    # 2,3 are the most common divisor for many numbers hence I go by divisor of 2,3
    # if not then by the same number as divisor
    if num%2 == 0:
        return 2
    elif num%3==0:
        return 3
    return num

def findLCM(lcmArray):
    lcm = 1
    while len(lcmArray) > 0:
        minOfLCMArray = min(lcmArray)
        divisor = findDivisor(minOfLCMArray)

        for x in range(0, len(lcmArray)):
            Quotient = lcmArray[x]/divisor
            Reminder = lcmArray[x]%divisor
            if Reminder == 0:
                lcmArray[x] = Quotient

        lcm*=divisor
        minOfLCMArray = min(lcmArray)
        if minOfLCMArray == 1:
            lcmArray.remove(minOfLCMArray)
    return lcm




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


print (findLCM(arr))

Submission status: Wrong Answer

Solution code:
import math as m
from functools import reduce

n=int(input())
l=set([])
def gcd(a,b):
    a1=a
    b1=b
    if b%a==0 :
        return b
    if a%b==0:
        return a
    while a != 0:
        c = a
        a = b % a
        b = c
    return a1*b1/b

for i in range(n):
    l.add(int(input()))
print(reduce(gcd,l))

Submission status: Wrong Answer

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

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

if max(T) > 5*10**17:
    print(max(T))
else:
    tmp = T[0]
    for i in range(1, N):
        tmp = tmp/gcd(tmp, T[i])*T[i]

    print(int(tmp))

Submission status: Wrong Answer

Solution code:
N = int(input())
T = []
for _ in range(N):
    T.append(int(input()))
T = sorted(T, reverse=True)

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

if max(T) > 5*10**17:
    print(max(T))
else:
    tmp = T[0]
    for i in range(1, N):
        tmp = tmp/gcd(tmp, T[i])*T[i]

    print(int(tmp))

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
T = sorted(T, reverse=True)
for i in range(1, 10**18//T[0]):
    f = True
    for n in T[1:]:
        if i*T[0] % n != 0:
            f = False
            break
    if f:
        print(i*T[0])
        sys.exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
T = []
for _ in range(N):
    T.append(int(input()))
T = sorted(T, reverse=True)

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

if max(T) > 5*10**17:
    print(max(T))
else:
    tmp = T[0]
    for i in range(1, N):
        tmp = T[i]/gcd(tmp, T[i])*tmp

    print(int(tmp))

Submission status: Wrong Answer

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

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

if max(T) > 5*10**17:
    print(max(T))
else:
    tmp = T[0]
    for i in range(1, N):
        tmp = tmp/gcd(T[i], tmp)*T[i]

    print(int(tmp))

Submission status: Wrong Answer

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

def primefactor(n):
    r = []
    a, b = 0, 2
    while b * b <= n:
        if n % b == 0:
            n //= b
            r += [b]
        else:
            b += 1 + a
            a = 1
    if n > 1 : r += [n]
    return r

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

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 = input()
T = [input() for i in range(N)]
print T # [a1, a2, a3, ..., aN]

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

print T[N-1]

Submission status: Wrong Answer

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

def primefactor(n):
    r = []
    a, b = 0, 2
    while b * b <= n:
        if n % b == 0:
            n //= b
            r += [b]
        else:
            b += 1 + a
            a = 1
    if n > 1 : r += [n]
    return r

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

Submission status: Wrong Answer

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

N = int(input())
res = 1
for i in range(N):
    j = int(input())
    tmp = res * j
    res = tmp / gcd(res, j)

print(int(res))

Submission status: Wrong Answer

Solution code:
N = int(input())
T = []
for _ in range(N):
    T.append(int(input()))
T = sorted(T)
    
def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

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

Submission status: Wrong Answer

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

# 最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

# 最大公倍数
def lcm(a, b):
    return a * b // gcd (a, b)

def solve(Ts):
    if len(Ts) == 1:
        print(Ts[0])
    
    else:
        for i in range(len(Ts)-1):
            Ts_temp = []
            Ts_temp.append(lcm(Ts[i], Ts[i+1]))
        solve(Ts_temp)

solve(Ts)

Submission status: Wrong Answer

Solution code:
N = int(input())
import fractions
import functools

def lcm(a, b): 
    return abs(a * b) / fractions.gcd(a,b) if a and b else 0
I = [int(input()) for n in range(N)]
print(int(functools.reduce(lambda x, y :lcm(x,y), I)))

Submission status: Wrong Answer

Solution code:
N = int(input())
T = []
for _ in range(N):
    T.append(int(input()))
    
def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

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

Submission status: Wrong Answer

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

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

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

print(int(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Time Limit Exceeded

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

maxti = max(ti)

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

i = 1

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

print(i * maxti)

Submission status: Time Limit Exceeded

Solution code:
N = int (input ())
T = []
for i in range (N):
  t = int (input ())
  T.append (t)
M = max(T)
T.remove (M)
while True:
  x = 0
  for i in range (N-1):
    if M%T[i] != 0:
      x = 1
      break
  if x == 0:
    print (M)
    break
  M += M

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
times = sorted([int(input()) for _ in range(n)], reverse=True)

m = times[0]
rest = times[1:]

c = 1

while True:
  t = m * c
  flg = all(map(lambda x : t % x == 0, rest))
  
  if flg:
    print(t)
    exit()
    
  c += 1

Submission status: Time Limit Exceeded

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

mt=t[0]
mx=t[0]
for i in t:
  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: Time Limit Exceeded

Solution code:
n=int(input())
t=[int(input()) for _ in range(n)]  
mt=max(t)
for i in range(mt,10**18+1):
  for j in t:
    if i%j:
      break
  else:
    print(i)
    break

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter
from functools import reduce
from operator import or_


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


N = int(input())
lcm = Counter()
for _ in range(N):
    factors = Counter(prime_factorize(int(input())))
    for key, value in factors.items():
        if lcm[key] < value:
            lcm[key] = value
ans = 1
for key, value in lcm.items():
    ans *= key ** value
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter
from functools import reduce
from operator import or_


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


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

factors = reduce(or_, (c.keys() for c in T))
ans = 1
for factor in factors:
    ans *= factor ** max(c[factor] for c in T)
print(ans)

Submission status: Time Limit Exceeded

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

lcm = t[0]  
  
for i in range(1,N):
  j = 1
  while(lcm % t[i] != 0):
    lcm = lcm* (j+ 1)// j
    j+= 1
    
print(lcm)

Submission status: Time Limit Exceeded

Solution code:
def p(n):
	ans = 0
	v = n
	while True:
		if n % 10:
			v = n
			break
		ans += 1
		n /= 10
	return ans

def vp(n):
	v = n
	while True:
		if n % 10:
			v = n
			break
		n //= 10
	return v

def lcm(x, y):
	if x > y:
		d = p(x)
		z = vp(x)
	else:
		d = p(y)
		z = vp(x)
	x = vp(x)
	y = vp(y)
	ans = 0
	while True:
		if z % x == 0 and z % y == 0:
			ans = z
			break
		z += 1
	return ans * 10**d

def resolve():
	n = int(input())
	T = []
	for _ in range(n):
		T.append(int(input()))
	ans = 1
	for i in range(n):
		ans = lcm(ans, T[i])
	print(ans)
resolve()

Submission status: Time Limit Exceeded

Solution code:
def lcm(x, y):
	if x > y:
		z = x
	else:
		z = y
	ans = 0
	while True:
		if z % x == 0 and z % y == 0:
			ans = z
			break
		z += 1
	return ans

def resolve():
	n = int(input())
	T = []
	for _ in range(n):
		T.append(int(input()))
	ans = 1
	for i in range(n):
		ans = lcm(ans, T[i])
	print(ans)
resolve()

Submission status: Time Limit Exceeded

Solution code:
import sys
import functools
def func(a,b):
    y = max(a,b)
    x = min(a,b)
    i = 1
    while True:
        tmp = y * i
        if tmp % x == 0:
            break
        else:
            i += 1
    return tmp

def slove(n, t):
    t.sort()
    ans = functools.reduce(func, t)
    return ans

if __name__ == "__main__":
    input = sys.stdin.readline
    n = int(input())
    t = [int(input()) for i in range(n)]
    print(slove(n, t))

Submission status: Time Limit Exceeded

Solution code:
import sys
def slove(n, t):
    t.sort()
    max_num = t.pop()
    i = 1
    while True:
        ans = max_num * i
        tmp = all([True if ans % j == 0 else False for j in t])
        if tmp:
            break
        else:
            i += 1

    return ans

if __name__ == "__main__":
    input = sys.stdin.readline
    n = int(input())
    t = [int(input()) for i in range(n)]
    print(slove(n, t))

Submission status: Time Limit Exceeded

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

ma = max(t)
flag = True
while flag:
    for i in range(n):
        if ma % t[i] != 0:
            ma *= 2
            break
        if i == n - 1:
            flag = False

print(ma)

Submission status: Time Limit Exceeded

Solution code:
def gcd(a, b):
    while a != b:
        if (a != 1 and b != 1):
            if a < b:
                b = b % a
            elif a > b:
                a = a % b
            else:
                break
    if (a == 1 or b == 1):
        return 1
    else:
        return a

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


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

Submission status: Time Limit Exceeded

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

f, ans, x = 0, 1, 2

while x<=max(t):
    for i in range(n):
        if t[i]%x==0:
            t[i] //= x
            f = 1
    if f:
        ans *= x
        f = 0
    else:
        x += 1
for i in t:
    ans *= i
print(ans)

Submission status: Time Limit Exceeded

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

f, ans, x = 0, 1, 2

while x<=max(t):
    for i in range(n):
        if t[i]%x==0:
            t[i] //= x
            f = 1
    if f:
        ans *= x
        f = 0
    else:
        x += 1
for i in t:
    ans *= i
print(ans)

Submission status: Time Limit Exceeded

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

m = max(T)
ans = m
while(1):
    flag = True
    for i in range(N):
        if ans % T[i] != 0:
            flag = False
            break
    if flag:
        print(ans)
        exit()
    else:
        ans += m

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

nList.sort(reverse= True)

ans = 0
tmp = 0
if n == 1:
  print(nList[0])
  exit(0)

while True:
  tmp += nList[0]
  succ = 0
  for i in range(1,n):
    if tmp % nList[i] == 0:
      pass
    else:
      succ = 1
      break
  if succ == 0:
    ans = tmp
    break

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

nList.sort(reverse= True)

mI = 1
ans = 0

if n == 1:
  print(nList[0])
  exit(0)

while True:
  tmp =mI * nList[0]
  succ = 0
  for i in range(1,n):
    if tmp % nList[i] == 0:
      pass
    else:
      succ = 1
      break
  if succ == 0:
    ans = tmp
    break
  mI += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

nList.sort(reverse= True)

mI = 1
ans = 0
while True:
  tmp =mI * nList[0]
  succ = 0
  for i in range(1,n):
    if tmp % nList[i] == 0:
      pass
    else:
      succ = 1
      break
  if succ == 0:
    ans = tmp
    break
  mI += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=[int(input()) for i in range(n)]
a=sorted(a)
i=1
while True:
    flag=True
    x=a[-1]*i
    for aa in range(n-1):
        if x%a[aa]!=0:
            flag=False
            break
    if flag==True:
        print(x)
        exit()
    i+=1

Submission status: Time Limit Exceeded

Solution code:
def main():
    n=int(input())
    T=sorted(set(list(int(input()) for _ in  range(n))))[::-1]
    k=T[0]
    while 1:
        for t in T:
            if k%t>0:
                k += T[0]
                break
        else: #for文がbreakしなければここを読む.
            print(k)
            break
main()

Submission status: Time Limit Exceeded

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
        else: #for文がbreakしなければここを読む.
            print(k)
            break
main()

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


N=int(input())
T=[int(input()) for i in range(N)]
lst1={}
for t in T:
    Z=Counter(prime_factorize(t))
    #print(Z)
    for z in Z:

        if str(z) not in lst1:
            lst1.update({str(z):Z[z]})
        else:
            lst1[str(z)]=max(lst1[str(z)],Z[z])
#print(lst1)
count=1
for l in lst1:
    count*=int(l)**lst1[l]
print(count)

Submission status: Time Limit Exceeded

Solution code:
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    clocks = inputs
    clocks.sort()

    max_c = clocks.pop()
    clocks = set(clocks)

    pops = []
    for c in clocks:
        if max_c % c == 0:
            pops.append(c)
    for p in pops:
        clocks.remove(p)

    count = max_c
    while count <= 10 ** 18:
        fin = count
        for c in clocks:
            if count % c != 0:
                fin = None
                break
        if fin is not None:
            return count
        count += max_c


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    N = int(input())
    ret = solve(int_inputs(N))
    print(ret)