Harryxun/stf_run huggingface dataset:
k,*t=[map(int,t.split())for t in open(0)]
A,F=map(sorted,t)
o=10**12
g=-1
while~g+o:
 m,l=o+g>>1,k[1]
 for a,f in zip(A,F[::-1]):l-=max(0,a-m//f)
 if l<0:g=m
 else:o=m
print(o)

### FIXED CODE ###

def main():
    n,k,*a=map(int,open(0).read().split())
    a,f=sorted(a[:n])[::-1],sorted(a[n:])
    ok=10**12
    ng=-1
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
        l=k
        for b,g in zip(a,f):
            if b*g>mid:
                l-=b-mid//g
        if l<0:ng=mid
        else:ok=mid
    print(ok)
main()
N, M = map(int, input().split())
edge = [[] for _ in range(N)]
for i in range(M):
    a,b = map(int, input().split())
    edge[a-1].append(b-1)

def dp(v,dpv,e):
    if dpv[v] != -1:
        return dpv[v]
    if len(edge[v])==0:
        dpv[v]=0
        return 0
    res = 0
    for w in e[v]:
        res = max(dp(w,dpv,e),res)
    res += 1
    dpv[v] = res
    return res

def solve(edge):
    dpv = [-1]*N
    for i in range(N):
        dp(i,dpv,edge)
    ans = max(dpv)
    return ans
print(solve(edge))

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
N, M = map(int, input().split())
edge = [[] for _ in range(N)]
for i in range(M):
    a,b = map(int, input().split())
    edge[a-1].append(b-1)

def dp(v,dpv,e):
    if dpv[v] != -1:
        return dpv[v]
    if len(e[v])==0:
        dpv[v]=0
        return 0
    res = 0
    for w in e[v]:
        res = max(dp(w,dpv,e),res)
    res += 1
    dpv[v] = res
    return res

def solve(edge):
    dpv = [-1]*N
    for i in range(N):
        dp(i,dpv,edge)
    ans = max(dpv)
    # print(dpv)
    return ans
print(solve(edge))
W, H, N = map(int,input().split())
p = 0
q = W
r = 0
s = H
for i in range(N):
    x, y, a = map(int,input().split())
    if a == 1:
        if x > p:
            p = x
    if a == 2:
        if x < q:
            q = x
    if a == 3:
        if y > r:
            r = y
    if a == 4:
        if y < s:
            s = y
ans = (q-p)*(s-r)
if ans < 0
    ans = 0
print(ans)

### FIXED CODE ###

W, H, N = map(int,input().split())
p = 0
q = W
r = 0
s = H
for i in range(N):
    x, y, a = map(int,input().split())
    if a == 1:
        if x > p:
            p = x
    if a == 2:
        if x < q:
            q = x
    if a == 3:
        if y > r:
            r = y
    if a == 4:
        if y < s:
            s = y
ans = (q-p)*(s-r)
if q < p or s < r:
    ans = 0
print(ans)
n, m = map(int, input().split())

def solve(n):
    if n == 0:
        return 1
    return n * solve(n - 1)

if n == 1:
    n_ans = 0
else:
    n_ans = solve(n) // (solve(n - 2) * 2)
if m == 1:
    m_ans = 0
else:
    m_ans = solve(m) // (solve(m - 2) * 2)
ans = n_ans + m_ans
print(ans)

### FIXED CODE ###

n, m = map(int, input().split())

def solve(n):
    if n == 0:
        return 1
    return n * solve(n - 1)

if n <= 1:
    n_ans = 0
else:
    n_ans = solve(n) // (solve(n - 2) * 2)
if m <= 1:
    m_ans = 0
else:
    m_ans = solve(m) // (solve(m - 2) * 2)
ans = n_ans + m_ans
print(ans)
from collections import Counter

n = int(input())
a_li = list(map(int, input().split()))

ans_sum = 0

counter = Counter(a_li)
print(counter)

for i in counter:
    ans_sum += i*(i - 1)//2

for a in a_li:
    count = counter[a]
    if count == 1:
        print(ans_sum)
    else:
        print(ans_sum - count*(count - 1) // 2 + (count - 1)*(count - 2) // 2)

### FIXED CODE ###

from collections import Counter

n = int(input())
a_li = list(map(int, input().split()))

ans_sum = 0

counter = Counter(a_li)

for i in counter.values():
    ans_sum += i*(i - 1) // 2

for a in a_li:
    count = counter[a]
    if count == 1:
        print(ans_sum)
    else:
        print(ans_sum - count*(count - 1) // 2 + (count - 1)*(count - 2) // 2)
n,m=map(int,input().split())
mx =[0 for i in range(0,n)]
for z in range(0,m):
  a,b=map(int,input().split())
  mx[b-1]=max(mx[b-1],a-1)
cut=0
cn=0
for z in range(0,n):
  if cut<mx[z]:
   	cut=z
    cn=cn+1
print(cn)

### FIXED CODE ###

n,m=map(int,input().split())
mx =[-1 for i in range(0,n)]
for z in range(0,m):
  a,b=map(int,input().split())
  mx[b-1]=max(mx[b-1],a-1)
cut=-1
cn=0
for z in range(0,n):
	if cut<mx[z]:
		cut=z-1
		cn=cn+1
print(cn)
import sys
input = sys.stdin.readline

N, MOD = map(int, input().split())

#計算量 log(m)くらい
def modinv(a, m): #mod. m でのaの逆元 a^{-1}を計算する
    b = m
    u = 1
    v = 0
    while b:
        t = a//b
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    
    u %= m
    if u < 0:
        u += m
    return u

G = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    x, y = map(int, input().split())
    G[x].append(y)
    G[y].append(x)

DP1 = [-1] * (N + 1)
DP1[0] = 1
parent = [-1] * (N + 1)
parent[1] = 0

def dfs(x, p):
    tmp = 1
    for next_ in G[x]:
        if next_ == p:
            continue
        parent[next_] = x
        tmp *= (dfs(next_, x) + 1)
        # tmp %= MOD
    DP1[x] = tmp
    return tmp

dfs(1, 0)
# print (DP1)

DP2 = [-1] * (N + 1)
DP2[0] = 1
DP2[1] = 1
stack = [1]

while stack:
    x = stack.pop()
    for next_ in G[x]:
        if DP2[next_] != -1:
            continue
        tmp = DP1[x]
        tmp //= (DP1[next_] + 1)
        tmp *= DP2[parent[next_]]
        tmp += 1 #白色の分
        DP2[next_] = tmp
        stack.append(next_)

# print (DP2)

for i in range(1, N + 1):
    print (DP1[i] * DP2[i] % MOD)

### FIXED CODE ###

import sys
input = sys.stdin.readline

sys.setrecursionlimit(10 ** 7)

N, MOD = map(int, input().split())


G = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    x, y = map(int, input().split())
    G[x].append(y)
    G[y].append(x)
G[0].append(1)
G[1].append(0)

DP1 = [0] * (N + 1)

parent = [-1] * (N + 1)
parent[1] = 0

order = []

stack = [1]
while stack:
    x = stack.pop()
    order.append(x)
    for next_ in G[x]:
        if next_ == parent[x]:
            continue
        parent[next_] = x
        stack.append(next_)

for v in order[::-1]:
    tmp = 1
    for next_ in G[v]:
        tmp *= DP1[next_] + 1
        tmp %= MOD
    DP1[v] = tmp
# print (DP1)

DP2 = [1] * (N + 1)

for x in order:
    # 累積積のパート
    #ここが同じ値を返すかチェックする
    n = len(G[x])
    lst1 = [1] * (n + 1)
    lst2 = [1] * (n + 1)
    for i in range(n):
        #親のときだけは違うルールで対処
        if G[x][i] == parent[x]:
            lst1[i + 1] = lst1[i] * DP2[x] % MOD
        else:
            lst1[i + 1] = lst1[i] * (DP1[G[x][i]] + 1) % MOD

        if G[x][n - 1 - i] == parent[x]:
            lst2[n - i - 1] = lst2[n - i] * DP2[x] % MOD
        else:
            lst2[n - i - 1] = lst2[n - i] * (DP1[G[x][n - 1 - i]] + 1) % MOD
    
    for i in range(n):
        if G[x][i] == parent[x]:
            continue
        tmp = lst1[i] * lst2[i + 1] % MOD
        tmp += 1 #白色の分
        DP2[G[x][i]] = tmp % MOD
        stack.append(G[x][i])

# print (DP2)

for i in range(1, N + 1):
    print ((DP1[i] * DP2[i]) % MOD)

# print (DP1)
# print (DP2)
n = int(input())
cards = {} #からの辞書
for i in range(n):
    card = input()
    cards[card] = 1
    
#print(d)

for c in ['S', 'H', 'C', 'D']:
    for n in rarge(1, 13):
        key = c + ' ' + str(n)
    if not key in cards:
        print(key)


### FIXED CODE ###

n = int(input())
cards = {}
for i in range(n):
    card = input()
    cards[card] = 1
     
#print(cards)
 
for c in ['S', 'H', 'C', 'D']:
    for n in range(1, 14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)
from collections import deque
s = deque(input())
n = int(input())
qs = [list(input().split()) for i in range(n)]
pre = deque()
suf = deque()
frag = True
for q in qs:
    if len(q) == 1:
        frag = not frag
    else:
        if (frag, q[1]) == (True, "1") or (frag, q[1]) == (False, "2"):
            pre.appendleft(q[2])
        else:
            suf.append(q[2])
if frag is True:
    print("".join(pre+s+suf))
else:
    suf.reverse()
    s.reverse()
    pre.reverse()
    print("".join(suf+s+pre))

### FIXED CODE ###

from collections import deque
s = deque(input())
n = int(input())
qs = [list(input().split()) for i in range(n)]
pre = deque()
suf = deque()
frag = True
for q in qs:
    if len(q) == 1:
        frag = not frag
    else:
        if (frag, q[1]) == (True, "1") or (frag, q[1]) == (False, "2"):
            pre.appendleft(q[2])
        else:
            suf.append(q[2])
if frag is True:
    print("".join(list(pre)+list(s)+list(suf)))
else:
    suf.reverse()
    s.reverse()
    pre.reverse()
    print("".join(list(suf)+list(s)+list(pre)))
S=input()
T=input()
if S==t[:-1] and S.islower()==True:
  print("Yes")
else:
  print("NO")

### FIXED CODE ###

S=input("")
T=input("")
l=len(S)
if 1<=l and l<=10 and S.islower()==True and len(T)==l+1:
    if T.startswith(S)==True and T.islower()==True:
        print("Yes")
    else:
        print("No")
else:
    print("No")
A,B,C,D = map( int,input().split() )
while A > 0 and c > 0:
    C -= B
    if C <= 0 :
        print( 'Yes' )
        exit()

    A -= D 
    if A <= 0 :
        print( 'No' )
        exit()

### FIXED CODE ###

A,B,C,D = map(int, input().split())

while A > 0 and C > 0:
    C -= B
    if C <= 0:
        print("Yes")
        exit()
    A -= D
    if A <= 0:
        print("No")
        exit()
n = int(input())
A = [a,b = map(int,input().split()) for _ in range(n)]
A.sort(key=lambda x: x[0])
most = A[0][0]
mos = A[0][1]
worst = A[-1][0]
wors = A[-1][1]
print((most-1)+(most-worst+1)+(wors+1))

### FIXED CODE ###

n=int(input())
l=[]
for i in range(n):
    a,b=map(int,input().split())
    l.append([a,b])
l.sort(reverse=True)

print(l[0][0]+l[0][1])
n=input()
a=map(int,raw_input().split())
for i in a:
  if a[i]%2==0:
    if a[i]%3==0 or a[i]%5==0:
      print "APPROVED"
  else:
    print "DENIED"
  


### FIXED CODE ###

n=input()
a=map(int,raw_input().split())
ans="APPROVED"
for i in range(n):
  if a[i]%2==0:
    if a[i]%3!=0 and a[i]%5!=0:
      ans="DENIED"
print ans
def inv(a, mod):
    r = [1, 0, a]
    w = [0, 1, mod]
    while w[2] != 1:
        q = r[2]//w[2]
        r_new = [r[0]-q*w[0], r[1]-q*w[1], r[2]-q*w[2]]
        r = w
        w = r_new
    x, y = w[0], w[1]    # a*x+y*mod = 1
    return (mod+x % mod) % mod


def gauss_jordan_mod(A, mod):
    EPS = 1e-8
    n = len(A)
    m = len(A[0])
    for i in range(n):
        if len(A[i]) != m:
            return "Error!"

    for i in range(n):
        for j in range(m):
            A[i][j] %= mod

    rank = 0
    for i in range(n):
        pivot = i
        for k in range(i, n):
            if abs(A[k][i]) > abs(A[pivot][i]):
                pivot = k
        A[i], A[pivot] = A[pivot], A[i]
        if abs(A[i][i]) < EPS:
            continue
        rank += 1
        s = inv(A[i][i], mod)
        for j in range(i, m):
            A[i][j] *= s
            A[i][j] %= mod
        for k in range(n):
            if k != i:
                s = A[k][i]
                for j in range(i, m):
                    A[k][j] -= s * A[i][j]
                    A[k][j] %= mod
    return A, rank


def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    s = input()

    A = []
    rank = 0
    for i in range(n-1, -1, -1):
        cur = []
        for k in range(62):
            cur.append(a[i] >> k & 1)

        if s[i] == '1':
            B, rank_nxt = gauss_jordan_mod(A + [cur], 2)
            if rank_nxt > rank:
                return 1
        else:
            A, rank = gauss_jordan_mod(A + [cur], 2)
    return 0


t = int(input())
for _ in range(t):
    print(solve())


### FIXED CODE ###

def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    s = list(input())
    basis = []
    for i in range(n-1, -1, -1):
        for v in basis:
            if a[i] > (a[i] ^ v):
                a[i] = a[i] ^ v
        if a[i] > 0:
            if s[i] == '0':
                basis.append(a[i])
            else:
                return 1
    return 0


t = int(input())
for _ in range(t):
    print(solve())
x = int(input())

a = 100
i = 0

while a < x:
  i+ = 1
  a+ = i
  
  
print(x/i)
  



### FIXED CODE ###

x = int(input())

a = 100
i = 0

while a < x:
  i += 1
  a += a // 100
  
  
print(i)
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
D = min(y) - max(x)
if D >= 0 and max(x)+D <= min(y) 
	print("No War")
else:
	print("War")


### FIXED CODE ###

N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
if max(x) < min(y) and X < min(y) <= Y:
	print("No War")
else:
	print("War")
from collections import deque
H, W = map(int,input().split())
S = [list(map(str,input().split())) for _ in range(H)]
dhw = [[0,1],[0,-1],[1,0],[-1,0]]

ans = 0
for h in range(H):
  for w in range(W):
    d = deque([h,w])
    maze = [[-1] * W for _ in range(H)]
    if S[h][w] == '#':
      continue
    maze[h][w] = 0
    while d:
      ht , hw = d.popleft()
      for dh, dw in dhw:
        nh = ht + dh
        nw = wt + dw
        if 0 <= nh < H and 0 <= nw < W:
          if maze[nh][nw] == -1 and S[nh][nw] == '.':
            d.append([nh,nw])
            maze[nh][nw] = maze[ht][wt] + 1
    ans = max(ans,max(maze))
print(ans)

### FIXED CODE ###

from collections import deque

def main():
    H, W = map(int, input().split())
    maze = [list(input()) for _ in range(H)]
    directions = [[0, 1], [0, -1], [1, 0], [-1, 0]]

    ans = 0
    for h in range(H):
        for w in range(W):
            if maze[h][w] == '#':
                continue

            goal_dists = [[-1] * W for _ in range(H)]
            goal_dists[h][w] = 0
            d = deque([[h, w]])

            while d:
                ht, wt = d.popleft()
                for dh, dw in directions:
                    if not (0 <= ht+dh < H and 0 <= wt+dw < W):
                        continue
                    if maze[ht+dh][wt+dw] == '#':
                        continue
                    if goal_dists[ht+dh][wt+dw] == -1:
                        goal_dists[ht+dh][wt+dw] = goal_dists[ht][wt] + 1
                        d.append([ht+dh, wt+dw])
            
            ans = max(ans, max([max(l) for l in goal_dists]))

    print(ans)

if __name__ == "__main__":
    main()
from functools import reduce
from math import gcd
n=int(input())
a=list(map(int,input().split()))
lc=reduce(lambda a,b: a*b//gcd(a,b),a)
b=[lc//i for i in a]
print(sum(b)%(1000*1000000+7))


### FIXED CODE ###

from functools import reduce
from fractions import gcd
n=int(input())
A=list(map(int,input().split()))
lc=reduce(lambda a,b: a*b//gcd(a,b),A)
b=[lc//i for i in A]
print(sum(b)%(1000*1000000+7))
S,T=input().split()

A,B=int(input().split())

U=input()

if S==U:
    A=A-1

elif T==U:
    B=B-1
else:
    pass

print(A,B)




### FIXED CODE ###

S,T=input().split()
A,B=map(int,input().split())
U=input()
if S==U:
    print(A-1,B)
elif T==U:
    print(A,B-1)
import math
n,k = map(int,input().split())
if n == 0:
	print(0)
elif k == 1:
	print(0)
else:
	print(math.gcd(n,k))



### FIXED CODE ###

from fractions import gcd
n,k = map(int,input().split())

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

	for i in range(100000):
		a = min(a,abs(a-b))
	return a
if n == 0:
	print(0)
elif n ==1:
	if k == 1:
		print(0)
	else:
		print(1)
elif k == 1:
	print(0)
else:
	print(process(n,k))
N, M = map(int, input().split())
H = list(map(int, input().split())) 
A = [0]*M
B = [0]*M
for i in range(M):
    A[i], B[i] = map(int, input().split())
    A[i] -= 1
    B[i] -= 1
lis = []
for i in range(M):
    if H[A[i]] < H[B[i]]:
        min.append(A[i])
    if H[A[i]] == H[B[i]]:
        min.append(A[i])
        min.append(B[i])
    if H[A[i]] > H[B[i]]:
        min.append(B[i])
print(len(set(lis)))

### FIXED CODE ###

N, M = map(int, input().split())
H = list(map(int, input().split())) 
A = [0]*M
B = [0]*M
for i in range(M):
    A[i], B[i] = map(int, input().split())
    A[i] -= 1
    B[i] -= 1
lis = []
for i in range(M):
    if H[A[i]] < H[B[i]]:
        lis.append(A[i])
    if H[A[i]] == H[B[i]]:
        lis.append(A[i])
        lis.append(B[i])
    if H[A[i]] > H[B[i]]:
        lis.append(B[i])
print(len(H)-len(set(lis)))
def divisible_length(n):
	min_length = len(str(n))
  	for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            min_length = min(min_length, len(str(i)))
            if i != n // i:
	            min_length = min(min_length, len(str(n // i)))
    return min_length


n = int(input())
print(divisible_length(n))

### FIXED CODE ###

def divisible_length(n):
    min_length = len(str(n))
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            min_length = min(min_length, max(len(str(i)), len(str(n // i))))
    return min_length

n = int(input())
print(divisible_length(n))
N = input()

if N % 2 == 0:
    print(0.5)
else:
    print((N // 2 + 1)/N)
    

### FIXED CODE ###

N = int(input())

if N % 2 == 0:	
    print((N/2)/N)
else:
    print(((N+1)/2)/N)
A,B = map(int,input().split())
cnt = 0
for i in range(1,B+1):
    if  B == 1:
        cnt = 1
        a = 0
        break
    elif count == 0 and A >= B:
        cnt = 1
        a = 1
        break
    elif (A-1)*(i-1)+A >= B:
        a = i
        break
print(a)

### FIXED CODE ###

A, B = map(int, input().split())
cnt = 1
while A*cnt-(cnt-1) < B:
  cnt +=1
print(cnt if B > 1 else 0)
xn = input().split()
data = input().split()

data_2 = []

x = int(xn[0]) #これに近い値
data.sort() #小さい順

#dataにない値が出るまでxから１引き続ける　１引き続けた値をaとする

a = x-1
while True:
    #check
    for i in range(len(data)):
        if int(data[i]) == a:
            a = a - 1
            break
        else:
            data_2.append(a)
            break
    if a == int(data_2[0]):
        break

#dataにない値が出るまでxから１足し続ける　１足し続けた値をbとする
b = x + 1
while True:
    #check
    for i in range(len(data)):
        if int(data[i]) == b:
            b = b + 1
            break
        else:
            data_2.append(b)
            break
    if b == int(data_2[1]):
        break

#aとbの小さい方をprint
if a < b:
    print(a)
else:
    print(b)

### FIXED CODE ###

list_sunuke = input().split()
list_m = []

for i in range(5):
    list_m.append(i+1)

for i in range(5):
    if int(list_sunuke[i]) != list_m[i]:
        print(list_m[i])
class Burg:
    def __init__(self):
        self.lv = [None] * 51
        self.lv[0] = 1
        # self.string = ''

    def make_burg(self, n):
        if n == 0:
            return 'P'
        else:
            if self.lv[n] is None:
                tmp = self.make_burg(n - 1)
                self.lv[n] = 'B' + tmp + 'P' + tmp + 'B'
            return self.lv[n]


n, x = map(int, input().split())

gen = Burg()
string = gen.make_burg(n)
div = string[:x]
print(div.count('P'))

### FIXED CODE ###

class Burg:
    def __init__(self):
        self.lv = [2**(i+1) - 1 for i in range(51)]

    def make_burg(self, n, m):
        if n == 0:
            return 1, m - 1
        num = 4 * 2**n - 3
        if num <= m:
            return self.lv[n], m - num
        if m <= 1:
            return 0, 0
        a, b = self.make_burg(n - 1, m - 1)
        if b <= 1:
            return a + b, 0
        c, d = self.make_burg(n - 1, b - 1)
        return a + c + 1, max(0, d - 1)

n, x = map(int, input().split())

gen = Burg()
print(gen.make_burg(n, x)[0])
z,y,x=(int(x) for x in input().split())
if z == y:
  if y ==x:
    return "No"
  else:
    return "Yes"
else:
  if z ==x:
    return "Yes"
  else:
    if y == x:
      return "Yes"
    else:
      return "No"


### FIXED CODE ###

x,y,z=(input().split(" "))
if z == y:
  if y ==x:
    print("No")
  else:
    print("Yes")
else:
  if z ==x:
    print("Yes")
  else:
    if y == x:
      print("Yes")
    else:
      
      print("No")
A,B = map(int(input().split()))
if A>=13:
  print(B)
elif A>=6
  print(B/2)
else
  print(0)

### FIXED CODE ###

A,B = map(int,input().split())
if A>=13:
  print(B)
elif A>=6:
  print(int(B/2))
else:
  print(0)
def main():
  n, m = input_list()
  if n >= m:
    print(0)
    exit(0)
  x = list(set(input_list()))
  sx = list(sorted(x))
  diffs = []
  for i, xv in enumerate(range(len(x)-1)):
    diff = abs(sx[i+1]-sx[i])
    diffs.append((i, diff))
  sd = list(sorted(diffs, key=lambda x: x[1], reverse=True))
  
  points = []
  for i in range(n-1):
    if i > len(sd)-1:
      break
    points.append(sd[i][0])
  r = chunk_list(points, sx)
  ans = 0
  for v in r:
    ans += max(v) - min(v)
  print(ans)
    

def chunk_list(index_list, data):
  result = []
  start = 0
  for i in index_list:
    result.append(data[start:i+1])
    start = i+1
  result.append(data[start:len(data)])
  return result
  
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count
  
def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return map(str, input().split())

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

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

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
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

import math
import fractions
import collections
from functools import reduce
main()

### FIXED CODE ###

N, M = map(int, input().split())
X = list(map(int, input().split()))

if M <= N:
  print(0)
  exit(0)
  
X.sort()
intervals = []
for i in range(M-1):
  intervals.append(X[i+1] - X[i])
  
intervals.sort()
R = max(X) - min(X)
for _ in range(N-1):
  R -= intervals.pop()
  
print(R)
N = int(input())
K = int(input())
now = 1
for i in range(N):
  if now <= K:
    now += 2
  else:
    now += K
print(ans)

### FIXED CODE ###

N = int(input())
K = int(input())
now = 1
for i in range(N):
  if now <= K:
    now *= 2
  else:
    now += K
print(now)
n = int(input())
h = list(map(lambda x: int(x), input().split(" ")))

ans = []

for i in range(0,n):
	kari = 0
	j = i
	while h[j] >= j[j+1] and j<n-1:
		kari += 1
		j += 1
	ans.append(kari)

print(max(ans))

### FIXED CODE ###

n = int(input())
h = list(map(lambda x: int(x), input().split(" ")))

ans = 0

kari = 0
i = 0
for m in range(0,n-1):
	if h[m] >= h[m+1]:
		kari += 1
	else:
		kari = 0
	if ans < kari:
		ans = kari



print(ans)
from math import gcd
from functools import reduce


def resolve():
    n = int(input())
    t = list(int(input()) for _ in range(n))
    res = 1
    for ti in t:
        res = lcm_base(res, ti)
    print(res)


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


def lcm(numbers):
    return reduce(lcm_base, numbers, 1)


if __name__ == "__main__":
    resolve()


### FIXED CODE ###

from fractions import gcd
from functools import reduce


def resolve():
    n = int(input())
    t = list(int(input()) for _ in range(n))
    res = 1
    for ti in t:
        res = lcm_base(res, ti)
    print(res)


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


def lcm(numbers):
    return reduce(lcm_base, numbers, 1)


if __name__ == "__main__":
    resolve()