Harryxun/stf_run huggingface dataset:
L, N = map(int, input().split())
if N > 2000:
    print(1/0)
X = [0, L]
for i in range(N):
    X.append(int(input()))

X = sorted(X)
dpl = [[0]*(N+1) for i in range(N+1)]
dpr = [[0]*(N+1) for i in range(N+1)]

for k in range(1, N+1):
    for l in range(k + 1):
        r = k - l
        if l > 0:
            dpl[l][r] = max(dpl[l-1][r] + X[l]-X[l-1], dpr[l-1][r] + X[l] + L - X[-r-1])
        if r > 0:
            dpr[l][r] = max(dpr[l][r-1] + X[-r-1]-X[-r], dpl[l][r-1] + X[l] + L - X[-r-1])
        
ma = 0
for l in range(N+1):
    ma = max(ma, dpl[l][N-l], dpr[l][N-l])

print(ma)


### FIXED CODE ###

L, N = map(int, input().split())
X = []
for i in range(N):
    X.append(int(input()))

X = sorted(X)

ma = 0
for k in range(2):
    if k == 1:
        X = [L-X[-i] for i in range(1, N+1)]
    s = X[0]
    for i in range(1, N):
        if i % 2 == 1:
            s += L - X[-(i//2)-1] + X[i//2]
        else:
            s += X[i//2] + (L - X[-(i//2)])

    ma = max(ma, s)
    lt = (N-1) // 2 if N % 2 == 1 else -N//2
    for i in range(1, N):
        if lt > 0:
            if N % 2 == 1:
                s += X[lt] - X[i-1]*2 - (L - X[lt + 1])
            else:
                s += X[lt] - X[i-1] * 2 - (L - X[lt + 1])
            lt = 1 + lt - N
            ma = max(ma, s)
        else:
            if N % 2 == 1:
                s += X[lt] - X[i-1] * 2 - (L - X[lt])
            else:
                s += X[lt]*2 - L - X[i-1] * 2
            lt = N + lt
            ma = max(ma, s)

print(ma)
N, L = map(int, input().split())
L = [input() for i in range(N)]

s = ""
for i in range(N):
  temp = min(L)
  L.remove(temp)
  s += temp
print(s)

### FIXED CODE ###

a, b, c = map(str, input().split())
s = a+b+c

if s.count("5") == 2 and s.count("7") == 1:
  print("YES")
else:
  print("NO")
import numpy as np
H,W = map(int, input().split())
A = []
for _ in range(H):
    v = 0
    for w, x in zip(range(W), input()):
        if x == "#":
            v |= 1 << w
    A += [ v ]

import numpy as np


A = np.array(A)
WK = np.zeros(A.shape)
MASK = pow(2, W) - 1
MASKSUM = MASK * H
i = 0
while True:
    if np.sum(A) == MASKSUM:
        break
    WK = 0+A
    A[:-1] |= WK[1:]
    A[1:] |= WK[:-1]
    A |= ((WK << 1)&MASK) | (WK >> 1)
    i += 1

print(i)


### FIXED CODE ###

from collections import deque
h, w = map(int, input().split())
que = deque()
data = []

for ln in range(h):
    line = list(input().rstrip())
    data.append(line)
    for r, letter in enumerate(line):
        if letter == '#':
            que.append((ln, r))

count = 0
while len(que) > 0:
    count += 1
    next = deque()
    while len(que) > 0:
        row, col = que.popleft()
        for r, c in [(row - 1, col), (row + 1, col), (row, col - 1), (row, col + 1)]:
            if 0 <= r < h and 0 <= c < w and data[r][c] == '.':
                next.append((r, c))
                data[r][c] = '#'
    que = next

print(count - 1)
n = int(input())
xy = [[i, j] for i in range(101) for j in range(101)]

def md(x1, x2):
  return abs(x1[0]-x2[0]) + abs(x1[1]-x2[1])
        
infos = []
for i in range(n):
  info = list(map(int, input().split()))
  infos.append(info)
  
  if i != 0:
    for j in range(i):
      if infos[j][0] != 0:
        dh = infos[i][2] - infos[j][2]
        xy = list(filter(lambda x: md(x, infos[j][:2]) - md(x, infos[i][:2]) == dh, xy))
      
  if len(xy) == 1:    
    break

    
x = xy[0][0]
y = xy[0][1]
k = 0
for i in range(n):
  if infos[i][2] > 0:
    k = i
    break
h = md(infos[k][:2], [x, y]) + infos[k][2]
print('{} {} {}'.format(x, y, h))

### FIXED CODE ###

if input()=='1':
  print('Hello World')
else:
  print(int(input())+int(input()))
# coding: utf-8
# Here your code !
import sys
n = int(input())
output = []
for i in range(n):
    order,data =input().split() 
    if order == "insert":
        output.append(int(data))
    elif order == "deleteFirst":
        output.pop()
    elif order == "deleteLast":
        output.popleft()
    elif order == "delete":
        try:
            output.remove(int(data))
        except:
            pass
output.reverse()
print(" ".join(map(str,output)))

### FIXED CODE ###

import sys
from collections import deque
n = int(sys.stdin.readline())
lines = sys.stdin.readlines()
 
Q = deque()
for i in range(n):
    command = lines[i].split()
    if command[0] == "insert":
        Q.appendleft(command[1])
    elif command[0] == "deleteFirst":
        Q.popleft()
    elif command[0] == "deleteLast":
        Q.pop()
    elif command[0] == "delete":
        try:
            Q.remove(command[1])
        except:
            pass
print(" ".join(Q))
from collections import deque

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
H, W = map(int, input().split())
field = [input() for _ in range(H)]

dist = [[-1] * W for _ in range(W)]
que = deque()
que.append((0, 0))
dist[0][0] = 0

while len(que) > 0:
  y, x = que.popleft()
  if y == H - 1 and x == W - 1:
    break
  for i in range(4):
    ny, nx = y + dy[i], x + dx[i]
    if 0<=nx<W and 0<=ny<H and field[ny][nx]=='.' and dist[ny][nx]==-1:
      dist[ny][nx] = dist[y][x] + 1
      que.append((ny, nx))
    
count = sum([f.count('#') for f in field])
      
if dist[H - 1][W - 1] != -1:
  print(H * W - count - dist[H - 1][W - 1] - 1)
else:
  print(-1)

### FIXED CODE ###

from collections import deque

R,C = list(map(int,input().split()))
Sx,Sy = 0,0
Gx,Gy = R-1,C-1
Mize = [input() for _ in range(R)]
dd = [[1, 0], [-1, 0], [0, 1], [0, -1]]

def bfs():
    d = [[float('inf')] * C for i in range(R)]
    q = deque([])
    d[Sx][Sy] = 0
    q.append((Sx,Sy))
    while(len(q) != 0):
        x,y = q.popleft()
        if x == Gx and y == Gy:
            break
        for dx,dy in dd:
            
            if -1<x+dx<R and -1<y+dy<C and Mize[x+dx][y+dy]=='.' and d[x+dx][y+dy] == float('inf'):
                q.append([x+dx,y+dy])
                d[x+dx][y+dy] = d[x][y] + 1
    return d[Gx][Gy]

white = sum([m.count('#') for m in Mize])
need = bfs()
if need == float('inf'):
    print(-1)
else:
    print(R*C-white-need-1)
n=int(input())
list=[]
for i in range(n):
  list.append(int(input())
a=0
for j in range(n):
  if max(list[:j])<=list[j]:
    a=a+1
  else:
    pass
print(a)

### FIXED CODE ###

n=int(input())
list=list(map(int,input().split()))
a=1
for j in range(n-1):
  if max(list[:j+1])<=list[j+1]:
    a=a+1
  else:
    pass
print(a)
N,K=map(int,input().split())
A=list(map(int,input().split()))
print(math.ceil((N-1)/(K-1)))

### FIXED CODE ###

import math
N,K=map(int,input().split())
A=list(map(int,input().split()))
print(math.ceil((N-1)/(K-1)))
from collections import deque
import math

n,m,p = map(int, input().split())
dist  = []
edge1 = [[] for _ in range(n)]
edge2 = [[] for _ in range(n)] 
for _ in range(m):
    u,v,c = map(int, input().split())
    u -= 1
    v -= 1
    dist.append((u,v,(c-p)*-1))
    edge1[u].append(v)
    edge2[v].append(u)
    
def dfs(edges, s):
    stack = deque([s])
    used  = {s}
    while stack:
        x = stack.pop()
        for y in edges[x]:
            if y not in used:
                used.add(y)
                stack.append(y)
    return used


def bfs(edges, s):
    queue = deque([s])
    used  = {s}
    while queue:
        x = queue.popleft()
        for y in edges[x]:
            if y in used:
                continue
            used.add(y)
            queue.append(y)
    return used
    

def bellman(dist):  
    cost = [math.inf] * n
    cost[0] = 0
    for _ in range(n): 
        updated = False
        for u,v,c in dist:
            if cost[u] + c < cost[v]:
                cost[v] = cost[u] + c
                updated = True                
    if updated==True:
        return -1
    else:
        return max(0, cost[n-1]*-1)    
        

    
    
use = bfs(edge1, 0) & dfs(edge2, n-1)
dist2 = [(a,b,c) for a,b,c in dist if a in use and b in use]
print(bellman(dist2))


### FIXED CODE ###

from collections import deque
import math
    
def dfs(edges, s):
    stack = deque([s])
    used  = {s}
    while stack:
        x = stack.pop()
        for y in edges[x]:
            if y not in used:
                used.add(y)
                stack.append(y)
    return used


def bfs(edges, s):
    queue = deque([s])
    used  = {s}
    while queue:
        x = queue.popleft()
        for y in edges[x]:
            if y in used:
                continue
            used.add(y)
            queue.append(y)
    return used
    

def bellman(dist):  #負辺があるケースでの、スタートからゴールへの最短路を求めるアルゴ。
    cost = [float("inf")] * n
    cost[0] = 0
    for _ in range(n): #頂点の個数の分だけ回る
        updated = False
        for u,v,c in dist: #辺の個数の分だけ回る
            if cost[u] + c < cost[v]:
                cost[v] = cost[u] + c
                updated = True                
    #収束しない場合は負閉路があるため無限に小さくできる。
    if updated==True:
        return -1
    else:
        return max(0, cost[n-1]*-1)    
        

n,m,p = map(int, input().split())
dist  = []
edge1 = [[] for _ in range(n)]
edge2 = [[] for _ in range(n)]  # rev_edge
for _ in range(m):
    u,v,c = map(int, input().split())
    u -= 1
    v -= 1
    dist.append((u,v,(c-p)*-1))
    edge1[u].append(v)
    edge2[v].append(u)    
    
use = dfs(edge1, 0) & dfs(edge2, n-1)
dist2 = [(a,b,c) for a,b,c in dist if a in use and b in use]
print(bellman(dist2))
n = int(input())
t1,x1,y1 = map(int, input().split())
t2,x2,y2 = map(int, input().split())

dt = t2 - t1
d  = abs(x2 - x1) + abs(y2 - y1)

if (d < dt) and (dt%2 == d%2):
    print('Yes')
else:
    print('No')


### FIXED CODE ###

n = int(input())
for i in range(n):
    t, x, y = map(int, input().split())
    if x + y > t or (x + y + t) % 2 == 1:
        print("No")
        exit()
print("Yes")
n, m , d = map(int, input().split())
A = [0]*n
for i in range(1,m):
    B = A
    A = [0]*n
    for j in range(n):
        for k in range(n):
            if k + 1 - d >= 0 and k + 1 + d <= n:
                A[j] = B[j] + 2
            elif k + 1 - d >= 0 or k + 1 + d > n:
                A[j] = B[j] + 1
            elif k + 1 - d < 0 or k + 1 + d <= n:
                A[j] = B[j] + 1
            if k + 1 - d >= 0 and k + 1 + d <= n:
                A[j] += 2
            elif k + 1 - d >= 0 or k + 1 + d > n:
                A[j] += 1
            elif k + 1 - d < 0 or k + 1 + d <= n:
                A[j] += 1
print(sum(A)/(n**m))

### FIXED CODE ###

n, m, d = map(int, input().split())
if d == 0:
    C = n
else:
    C = 2*(n-d)
print(C*(m-1)/n**2)
# -*- Coding: utf-8 -*-
N, X = map(int, input().split())
L = list(map(int,input().split()))

index = 0
Sum = 0
while Sum <= X:
    Sum += L[index]
    index += 1

print(index+1) 


### FIXED CODE ###

# -*- Coding: utf-8 -*-
W,H,x,y = map(int,input().split())


if (W/2 == x) and (H/2 == y):# 中心の場合無限だから1
    print("{:.9f}".format(W*H/2),1)
else:
    print("{:.9f}".format(W*H/2),0)
N = int(input().strip())
A = map(int, input().strip().split())
max_abs_sum = 0
for i in range(len(A) - 1):
  for j in (i+1, range(A)):
    if max_abs_sum < abs(A[i] - A[j]):
      max_abs_sum = abs(A[i] - A[j])
print(max_abs_sum)

### FIXED CODE ###

N = int(input().strip())
A = list(sorted(map(int, input().strip().split())))

print(A[-1] - A[0])
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)

N = getN()
A = getList()
listnum = [0] * 15
for i in A:
    listnum[i] += 1
for i in range(15):
    if listnum[i] >= 3:
        listnum[i] = (listnum[i] % 2) + 1
minus = listnum.count(2)
if minus % 2 == 0:
    print(sum(listnum) - minus)
else:
    print(sum(listnum) - minus - 1)

### FIXED CODE ###

def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)

N = getN()
nums = [int(e) for e in input().split()]
nums.sort()
checker = nums[0]
count = 1
for i in range(1,N):
    if(checker != nums[i]):
        count+=1
        checker = nums[i]
if(N - count)%2==0:
    print(count)
else:
    print(count-1)
S=input()
if len(S)%2 != 0:
  print("No")
  exit()
for i in range(int(len(S)/2)):
  if S[i*2]!="h":
    print("No")
    exit()
  if S[i*2+1]!="i":
    Print("No")
    exit()
print("Yes")

### FIXED CODE ###

S=str(input())
if len(S)%2 != 0:
  print("No")
  exit()
for i in range(int(len(S)/2)):
  if S[i*2]!="h":
    print("No")
    exit()
  if S[i*2+1]!="i":
    print("No")
    exit()
print("Yes")
from IPython.utils.sysinfo import num_cpus
from site import abs_paths
nums = input()
length = len(nums)

num = int(nums[:3])
dif = abs(num - 753)

for i in range(1, length - 2):
   num_ = int(nums[i:i+3])
   dif_ = abs(num_ - 753)
   if dif_ < dif:
       num = num_
       dif = dif_

print(dif)


### FIXED CODE ###

nums = input()
length = len(nums)

num = int(nums[:3])
dif = abs(num - 753)

for i in range(1, length - 2):
   num_ = int(nums[i:i+3])
   dif_ = abs(num_ - 753)
   if dif_ < dif:
       num = num_
       dif = dif_

print(dif)
memo = [0] * 1000000000000
memo[1] = 1

def saiki(n):
    global memo
    tmp = 0
    if n <= 1:
        return memo[1]
    else:
        tmp = int(n/2)
        if memo[tmp] == 0:
            memo[tmp] = saiki(tmp)
        return memo[tmp]+memo[tmp]+1
    
h = int(input())
print(saiki(h))


### FIXED CODE ###

#memo = [0] * 100000000
#memo[1] = 1

def saiki(n):
#    global memo
    tmp = 0
    if n <= 1:
        return 1
#        return memo[1]
    else:
        tmp = int(n/2)
        return saiki(tmp) * 2 + 1
#        if memo[tmp] == 0:
#            memo[tmp] = saiki(tmp)
#        return memo[tmp]+memo[tmp]+1
    
h = int(input())
print(saiki(h))
f=lambda:[*map(int,input().split())]
n,k=f()
a=f()
a=[i*100 for i in a]
# Binary Search
def ok(x):
    c=0
    for i in a:
      c+=0--i//x
    return c<=n+k
l,r=0,10**11+1
while r-l>1:
  m=l+r>>1
  if ok(m): r=m
  else: l=m
t=0--r//100
print(t-ok(t-1))

### FIXED CODE ###

f=lambda:[*map(int,input().split())]
n,k=f()
a=f()
a=[i*100 for i in a]
# Binary Search
def ok(x):
    c=0
    for i in a:
      c+=0--i//x
    return c<=n+k
l,r=0,10**11+1
while r-l>1:
  m=l+r>>1
  if ok(m): r=m
  else: l=m
t=0--r//100
print(t-ok(t-1) if t>1 else t)
N = int(input())
F = []

for _ in range(N):
    F.append(list(map(int, input().split())))

P = []

for _ in range(N):
    P.append(list(map(int, input().split())))

c = [0] * 10
ans = -1000000000
tmp = 0

for i in range(1, 1024):
    ii = format(i, 'b')
    ii = str(ii)
    ii = ii.zfill(10)
    ii = list(ii)
    for j in range(N):
        for k in range(10):
            if str(F[j][k]) == ii[k] == '1':
                c[j] += 1
    for j in range(N):
        tmp += P[j][c[j]]
    if tmp > ans:
        ans = tmp
    tmp = 0
    c = [0] * 10

print(ans)

### FIXED CODE ###

N = int(input())
F = []
P = []
for _ in range(N):
    F.append(list(map(int, input().split())))
for _ in range(N):
    P.append(list(map(int, input().split())))

ans = -1000000000


for i in range(1, 1024):
    tmp = 0
    c = [0] * N
    ii = list(str(format(i, 'b')).zfill(10))
    for j in range(N):
        for k in range(10):
            if str(F[j][k]) == ii[k] and ii[k] == '1':
                c[j] += 1
    for j in range(N):
        tmp += P[j][c[j]]
    if tmp > ans :
        ans = tmp

print(ans)
n=int(input())
arr=list(map(int,input().split()))
c=0
for i in range n:
  if 1%2!=0 and arr[i]%2!=0:
    c+=1
print(c)

### FIXED CODE ###

n=int(input())
arr=list(map(int,input().split()))
c=0
for i in range(n):
  if (i+1)%2!=0 and arr[i]%2!=0:
    c+=1
print(c)
n = int(input())
xyh = [list(map(int,input().split())) for i in range(n)]

for cx in range(101):
    for cy in range(101):
        flg = True
        x, y, h = xyh[0][0], xyh[0][1], xyh[0][2]
        ch0 = max(abs(cx-x) + abs(cy-y) + h, 0)
        for i in range(1,n):
            x, y, h = xyh[i][0], xyh[i][1], xyh[i][2]
            ch = max(abs(cx-x) + abs(cy-y) + h, 0)
            if ch != ch0:
                flg = False
                break
        if flg:
            anscx, anscy = cx, cy
            ansh = ch0
            break
    if flg:
        break

print(anscx, anscy, ch0)

### FIXED CODE ###

n = int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
xyh = sorted(xyh, key=lambda x:(x[2]), reverse=True)

ans = -1, -1, -1
for cx in range(101):
    for cy in range(101):
        flg = True
        x, y, h = xyh[0][0], xyh[0][1], xyh[0][2]
        ch = abs(cx-x) + abs(cy-y) + h
        for i in range(1,n):
            x, y, h = xyh[i][0], xyh[i][1], xyh[i][2]
            tmph = max(ch - abs(cx-x) - abs(cy-y), 0)
            if h != tmph:
                flg = False
                break
        if flg:
            ans = cx, cy, ch
print(*ans)
import itertools as it

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

c = list(it.combinations(a, 2))

ans = 0
for i in range(n):
    ans += int(c[i][0]) * int(c[i][1])

print(ans % (10**9 + 7))

### FIXED CODE ###

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

sum_sq_a = 0
for i in range(n):
    sum_sq_a += a[i]**2

ans = ((sum(a))**2 - sum_sq_a) // 2

print(ans % (10**9 + 7))
n = int(input())

hats = [0, 0, 0]
count = 1
mod = 1000000007

for a in map(int, input().split()):
  count *= hats.count(a)
  count %= mod
  hats[hats.index(a)] += 1
  
print(count)

### FIXED CODE ###

n = int(input())

hats = [0, 0, 0]
count = 1
mod = 1000000007

for a in map(int, input().split()):
  count *= hats.count(a)
  count %= mod
  try:
    hats[hats.index(a)] += 1
  except ValueError:
    count = 0
    break
  
print(count)
n, q = input().split(" ")
n = int(n)
q = int(q)

list_ab = []
for i in range(n - 1):
  pair_ab = [int(num) for num in input().split(" ")]
  list_ab.append(pair_ab)

list_px = []
for i in range(q):
  pair_px = [int(num) for num in input().split(" ")]
  list_px.append(pair_px)

def make_dict(list_ab):
  dict = {}
  for num in range(1, n+1):
    dict[num] = []
  for pair_ab in list_ab:
    dict[int(pair_ab[0])].append(pair_ab[1])
  return dict

ab_dict = make_dict(list_ab)

counter = [0]*(n+1)

def calc(position, num_plus):
  counter[position] += num_plus
  list_plus = ab_dict[position]
  for num in list_plus:
    calc(num, num_plus)

for p, x in list_px:
  calc(p, x)

for i in range(len(counter)):
  counter[i] = str(counter[i])
str = " ".join(counter)
print(str)


### FIXED CODE ###

from collections import defaultdict as dd
n, q = map(int, input().split())
Connections = dd(list)
for i in range(n-1):
    a, b = map(int, input().split())
    Connections[a].append(b)
    Connections[b].append(a)

#Tree[node] -> children(list)
Tree = dd(list)
visited = set()
stack = [1]
while stack != []:
    temp = []
    for taregt_node in stack:
        for next_node in Connections[taregt_node]:
            if next_node not in visited:
                Tree[taregt_node].append(next_node)
                visited.add(taregt_node)
                temp.append(next_node)
    stack = temp
#print(Tree)

#Point[node] -> point
Point = dd(int)
for i in range(q):
    p, x = map(int, input().split())
    Point[p] += x
#print(Point)

Counter = dd(int)
#visited = set()
stack = [1]
Counter[1] = Point[1]
while stack != []:
    temp = []
    for target_node in stack:
        for next_node in Tree[target_node]:
            Counter[next_node] = Counter[target_node] + Point[next_node]
            temp.append(next_node)
    stack = temp
#print(Counter)

for i in range(1, n):
    print(Counter[i], end=" ")
print(Counter[n])
a = [int(input()) for i in range(5)]
r = 10
last = 10000
for i in range(5):
    if a[i] % 10 != 0 and a[i] % 10 < r:
        last = i
        r = int(a[i] % 10)

if last == 10000:
    for i in range(5):
        time = time + a[i]

else:
    b = [int((a[i] + 9) / 10) * 10 for i in range(5)] 
    time = 0
    for i in range(5):
        if i != last:
            time = time + b[i]
    
    time = time + a[last]
    print(time)

### FIXED CODE ###

a = [int(input()) for i in range(5)]
r = 10
last = 0
for i in range(5):
    if a[i] % 10 != 0 and a[i] % 10 < r:
        last = i
        r = int(a[i] % 10)


b = [int((a[i] + 9) / 10) * 10 for i in range(5)] 
time = 0
for i in range(5):
    if i != last:
        time = time + b[i]
    
time = time + a[last]
print(time)
s, w = map(int, input().strip().split(" "))
print(["safe", "unsafe"][s < w])

### FIXED CODE ###

s, w = map(int, input().split(" "))
print(["safe", "unsafe"][s <= w])
a = input()
if (a >= 'a' and a <= 'z')
    print(A)
elif(a >= 'A' and a <= 'Z')
    print(a)


### FIXED CODE ###

a = input()
if a.isupper():
    print('A')
else:
    print('a')
from heapq import heappush, heappop
import sys

N,K = list(map(int, input().split(' ')))
d = {}
for i in range(N):
    S = str(input())[0]
    if S in d:
        d[S] += 1
    else:
        d[S] = 1
p = list(d.values())
if len(p) < K:
    print(0)
    sys.exit(1)

h = []
for i in p:
    heappush(h, i)

while(len(h) > K):
    k = heappop(h) + heappop(h)
    heappush(h, k)
    print(len(h))

print(min(h))


### FIXED CODE ###

import sys
N,K = list(map(int, input().split(' ')))
d = {}
for i in range(N):
    S = str(input())[0]
    if S in d:
        d[S] += 1
    else:
        d[S] = 1
p = list(d.values())
if len(p) < K:
    print(0)
    sys.exit()
c = 0
while(len(p) >= K):
    c += 1
    sq = sorted(p, reverse=True)
    for i in range(K):
        sq[i] = sq[i] - 1
    p = [i for i in sq if i != 0]
print(c)
#!/usr/bin/env python3
import math
# n進数の各位の和
def base_10_n(x,n):
    a = int(math.log(x,n))
    ans = 0
    for i in range(a,-1,-1):
        ans += x // n**i
        x %= n**i
    ans += x
    return ans

def main():
    N = int(input())
    ans = base_10_n(N,6)
    for j in range(1,N//18 + 1):
        c = base_10_n(N-18*j,6)
        d = base_10_n(18*j,9)
        ans = min(ans, c+d)
    print(ans)
    # print(int(math.log(85,9)))
    # print([i for i in range(2,-1,-1)])

if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import math
# n進数の各位の和


def base_10_n(x, n):
    if x == 0:
        return 0
    tmpx = x
    a = int(math.log(x, n))
    ans = 0
    for i in range(a, -1, -1):
        ans += tmpx // n**i
        tmpx %= n**i
    ans += tmpx
    return ans


def s(n, r):
    if n == 0:
        return 0
    return n % r + s(n // r, r)


def main():
    N = int(input())
    ans = 10**12
    for j in range(N+1):
        # c = base_10_n(N-j, 6)
        # d = base_10_n(j, 9)
        c = s(j,6)
        d = s(N-j,9)
        ans = min(ans, c+d)
    print(ans)


if __name__ == "__main__":
    main()
N = int(input())
H = list(map(int, input().split()))

for i in range(N-1):
	if H[i] > H[i+1]:
		H[i] -= 1
	
for i in range(N-1):
	if H[i] > H[i+1]:
		print("No")
		exit(1)

print("Yes")


### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))

for i in range(1, N):
	if H[N-i-1] > H[N-i]:
		H[N-i-1] -= 1
	
for i in range(N-1):
	if H[i] > H[i+1]:
		print("No")
		exit(0)

print("Yes")
"""import sys
input = sys.stdin.readline().strip"""
n=int(input())
T=[int(input()) for _ in range(n)]
from fractions import gcd
ans=T[0]*T[1]//gcd(T[0],T[1])
for t in T:
    ans=ans*t//gcd(ans,t)
print(ans)


### FIXED CODE ###

"""import sys
input = sys.stdin.readline().strip"""
n=int(input())
T=[int(input()) for _ in range(n)]
if n==1:
    print(T[0])
    exit()
from fractions import gcd
ans=T[0]*T[1]//gcd(T[0],T[1])
for t in T:
    ans=ans*t//gcd(ans,t)
print(ans)