peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
score = {}
for _ in range(n):
    blue = input()
    if blue in score:
        score[blue] += 1
    else:
        score[blue] = 1
m = int(input())
for _ in range(m):
    red = input()
    if red in score:
        score[red] -= 1
    else:
        score[red] = -1
dict_max = max(score.values())
print(max(dict_max,0))
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(n-1):
    if p[i] == i+1:
        tmp = p[i]
        p[i] = p[i+1]
        p[i+1] = tmp
        count += 1
if p[-1] == n:
    count += 1
print(count)
# Judge status: Accepted
N=int(input())
A=sorted(list(map(int,input().split())))[::-1]

i=1
t=1
score=A[0]
while i<=N-1:
    if i+2<=N-1:
        score+=2*A[t]
        i+=2
        t+=1
    elif i+1<=N-1:
        score+=A[t]
        break
    else:
        break
    #print(i,t,score)
print(score)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
print(c if a//b>=c else a//b)
# Judge status: Wrong Answer
s = list(input())
if s[4] == s[5]:
	if s[2]==s[3]:
		print("Yes")
	else:
		print("No")
else:
	print("NO")
# Judge status: Accepted
n,m = map(int,input().split())
l = [list(map(int,input().split())) for i in range(m)]

left = [i[0] for i in l]
right = [i[1] for i in l]

max_left = max(left)
min_right = min(right)

ans = min_right - max_left

if ans < 0:
    print(0)

else:
    print(ans+1)
# Judge status: Accepted
n,k=map(int,input().split())
s,p,r=map(int,input().split()) #筐体の手に対する勝利ポイント
t=list(input())
ans=0
for i in range(n):
    if t[i]=="s":
        tmp=s
    elif t[i]=="p":
        tmp=p
    else:
        tmp=r
    if i>=k:
        if t[i]==t[i-k]:
            tmp=0
            t[i]=None
    ans+=tmp
print(ans)
# Judge status: Accepted
s = str(input())
if s == 'ABC':
    print('ARC')
else:
    print('ABC')
# Judge status: Wrong Answer
def main():
  import itertools
  s=itertools.groupby(str(input()))
  
  ans=0 
  for k,v in s:
    l=len(list(v))
    if l<=2:
      ans+=1
    else:
      ans+=l//2+1
  
  print(ans)
  
if __name__=="__main__":
  main()
# Judge status: Accepted
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))

a, b, k = map(int, input().split())

if (a > 0):
    if (a >= k):
        a -= k
        print (a,b)
        exit()
    else:
        k -= a
        a = 0

if (b > 0):
    if (b >= k):
        b -= k
        print(a,b)
        exit()
    else:
        b = 0


print(a,b)
# Judge status: Wrong Answer
import sys
N = int(input())

sum_N = sum(map(int,str(N)))

for i in range(1,9):
    comp = 3*(i)
    if sum_N <= comp:
        print(str(i)*3)
        sys.exit()
# Judge status: Accepted
#!/usr/bin/env python3
import sys


def solve(N: int, M: int):
    for d in reversed(range(1, M // N + 1)):
        if M % d == 0:
            print(d)
            return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]
print(txy[0])

for i in range(n):
  if txy[i][1] + txy[i][2] >txy[i][0]:
    status = "No"
    break
  elif (txy[i][1]+txy[i][2])%2 != txy[i][0]%2:
    status = "No"
    break
  else:
    status = "Yes"
    
print(status)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = [0 for i in range(n+1)]

for i in range(n-1):
    ans[a[i]] += 1

for i in ans[1:]:
    print(i)
# Judge status: Accepted
x, k, d = map(int, input().split())

if abs(x) - k * d > 0:
    print(abs(x) - k * d)
else:
    kk = abs(x) // d
    l = (k - kk) % 2
    print(abs(abs(x) - (kk + l) * d))
# Judge status: Accepted
n, k = map(int, input().split())
*x, = map(int, input().split())

ans = float("inf")
for i in range(n-k+1):
    l, r = x[i], x[i+k-1]
    ans = min(ans, min(abs(l), abs(r)) + r - l)

print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

A_even =list()

for i in range(len(A)):
    if A[i] % 2 == 0:
        A_even.append(A[i])

miss = True


for i in range(len(A_even)):
    if A_even[i]%3 == 0 or A_even[i]%5 == 0:
        pass
    else:
        miss = False
        break
if miss:
    print("DENIED")
else:
    print("APPROVED")
# Judge status: Wrong Answer
X = int(input())
j = 1
for i in range(1,X//2+2):
  if X%i == 0:
    if i != 1:
      j = i
      break


a_b=j
tmp = X//i
for k in range(-100000,100000):
  b = -k
  a = a_b + b
  if a**5 - b**5 == X:
    print(a,b)
    exit()
  elif -a**5 + b**5 == X:
    print(a,b)
    exit()
for k in range(-100000,100000):
  b = -k
  a = tmp + b
  if a**5 - b**5 == X:
    print(a,b)
    exit()
  elif -a**5 + b**5 == X:
    print(a,b)
    exit()
# Judge status: Wrong Answer
N = int(input())
sum = (1+ N)*N/2
print(sum)
# Judge status: Wrong Answer
import math
H,N=map(int,input().split())
A=[]
B=[]
eff=[]
mp=0

for i in range(N):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
    eff.append(math.ceil(H/a)*b)

while H>0:
    eff_min_index=eff.index(min(eff))
    tmp=math.floor(H/A[eff_min_index])
    H-=A[eff_min_index]
    mp+=B[eff_min_index]
    for i in range(N):
        eff[i]=math.ceil(H/A[i])*B[i]
print(mp)
# Judge status: Accepted
s = int(input())
print((s//500)*1000 +  ((s%500)//5)*5 )
# Judge status: Accepted
A = [list(map(int, input().split(' '))) for i in range(3)]
N = int(input())
B = set([int(input()) for i in range(N)])

X = []
X += [set(A[i]) for i in range(3)]
X += [set([A[j][i] for j in range(3)]) for i in range(3)]
X += [set([A[0][2], A[1][1], A[2][0]]), set([A[2][2], A[1][1], A[0][0]])]

for x in X:
    if x <= B: #setの場合は、順不同で比較する。　<=は部分重合
        print('Yes')
        break
else:
    print('No')
# Judge status: Wrong Answer
N, K = map(int, input().split())
S = input()

happy = 0
for i in range(N-1):
    if S[i] == S[i+1]:
        happy += 1

m = 0
for i in range(1, N-1):
    if S[i] == 'R' and S[i+1] == 'L':
        m += 1

if K <= m:
    happy += 2*K
else:
    happy += 2*m
    if S[0] != S[N-1]:
        happy += 1
print(happy)
# Judge status: Wrong Answer
n = int(input())
b = list(map(int, input().split()))

a = [b[0]]
for num, i in enumerate(b[:]):
  if num == 0:
    a.append(i)
  elif num == n-2:
    a.append(i)
  elif i <= b[num + 1]:
    a.append(i)
  elif i > b[num + 1]:
    a.append(b[num + 1])
print(sum(a))
print(a)
# Judge status: Wrong Answer
N = int(input())

if N % 2 == 0:
    p = 10
    ret = 0

    while p < N:
        ret += N // p
        p *= 5
    
    print(ret)
else:
    print(0)
# Judge status: Wrong Answer
import itertools
n,m,x=list(map(int,input().split()))
ans=10**5
A=[list(map(int,input().split())) for i in range(n)]
B=sorted(A, key=lambda x: x[0])
#print(B)
D=[0]*(m+1)
for i, _ in enumerate(B, 1):
  for j in itertools.combinations(B,r=i):
    C=list(zip(*j))
#    print(C)
    for m in range(m+1):
      D[m]=sum(C[m])
#    print(D)
    E=[i for i in D[1:] if i>=x ]
    if len(E)==m:
      ans=min(ans,D[0])
print(ans) if ans!=10**5 else print(-1)
# Judge status: Accepted
from fractions import gcd
n, X = map(int, input().split())
x = list(map(int, input().split()))
ans = abs(x[0]-X)
for el in x[1:]:
    ans = gcd(ans, abs(el - X))
print(ans)
# Judge status: Accepted
n, x = map(int,input().split())
cList = list(map(int,input().split()))

count = 0
if cList[0] > x:
  count += cList[0]- x
  cList[0] = x
for i in range(1,n):
  tmp = cList[i-1]+cList[i]-x
  if tmp > 0:
    cList[i] -= tmp
    count += tmp

print(count)
# Judge status: Accepted
n = int(input())
x = []
for i in range(n):
    a = list(map(int,input().split()))
    x.append(a)
#print(x)
path_length = 0
cnt = 0
import itertools
for p in itertools.permutations(x):
    #print(p, p[1:])
    cnt += 1
    for (x1,y1), (x2,y2) in zip(p, p[1:]):
        path_length += ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** .5
#print(cnt)
print(path_length/(cnt))
# Judge status: Accepted
n = int(input())
MOD = 1000000007

print((pow(10,n)- 2*(pow(9,n)) + pow(8,n))%MOD)
# Judge status: Accepted
N = int(input())
l = list(map(int, input().split()))
cal = []
for i in range(-100,101):
    a = 0
    for j in l:
        a += (i - j)**2
    cal.append(a)

ans = min(cal)
print(ans)
# Judge status: Accepted
n,k = [int(x) for x in input().split()]
s = input()
count = 1
for i in range(n-1):
    if s[i]!=s[i+1]:
        count += 1
print(n-max(1,count-2*k))
# Judge status: Wrong Answer
# TLEkuraisou 

n=int(input())
s=input()

cnt=0
for i in range(n):
    a=s.count(".#")
    if a==0:
        break
    cnt+=a
    s=s.replace(".#","..")
    
print(s,cnt)
# Judge status: Accepted
import sys
a=[0]*5
a[0]=int(input())
a[1]=int(input())
a[2]=int(input())
a[3]=int(input())
a[4]=int(input())
k=int(input())
for i in range(5):
  for j in range(i+1,5):
    if a[j]-a[i]>k :
      print(":(")
      sys.exit()
print("Yay!")
# Judge status: Wrong Answer
A, B = map(int, raw_input() .split())
if A and B < 10:
    print A * B
else:
    print -1
# Judge status: Accepted
#https://atcoder.jp/contests/abc164/tasks/abc164_a
S,W= map(int,input().split())
if S > W:
    print("safe")
else:
    print("unsafe")
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
S = input().rstrip()

while S:
    if S[-5:] == "dream":
        S = S[:-5]
    elif S[-5] == "erase":
        S = S[:-5]
    elif S[-6:] == "eraser":
        S = S[:-6]
    elif S[-7:] == "dreamer":
        S = S[:-7]
    else:
        print("NO")
        sys.exit()
print("YES")
# Judge status: Accepted
N,A,B = map(int, input().split())
if B < A:
  print(0)
else:
  print(max(0, 1+(N-2)*(B-A)))
# Judge status: Wrong Answer
S = input()
for i in range(3):
    if S[i] == S[i+1]:
        print('Bad')
    else:
        print('Good')
# Judge status: Wrong Answer
x, a, b = map(int, input().split())
i = a-x
j = b-x
if i < 0:
    if i > j:
        print('A')
    if i < j:
        print('B')
elif j < 0:
    if i > j:
        print('A')
    if i < j:
        print('B')
else:
    if i < j:
        print('A')
    if i > j:
        print('B')
# Judge status: Accepted
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
a = [0]
b = [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])
  
ans = 0
j = M
for i in range(N+1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans,i+j)
print(ans)
# Judge status: Accepted
if __name__ == '__main__':
    N = int(input())

    if N == 0:
        print(0)
        exit()

    ans = []
    cnt = 0
    while abs(N) >= 1:
        mod_val = N % ((-2) ** (cnt + 1))
        if mod_val == 0:
            ans.append(0)
        else:
            ans.append(1)
            N -= (-2) ** cnt
        cnt += 1

    print(''.join([str(val) for val in ans[::-1]]))
# Judge status: Accepted
A,B = map(int,input().split())
print([str(x) == str(x)[::-1] for x in range(A,B+1)].count(True))
# Judge status: Accepted
K=int(input())
import math
ans=0
for a in range(1,K+1):
  for b in range(1,K+1):
    g=math.gcd(a,b)
    if g==1:
      ans += K
      continue
    for c in range(1,K+1):
      ans += math.gcd(g,c)
print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())
py = sorted([list(map(int,input().split()))+[i] for i in range(m)])
cnt = 1
ans_list = [['0'*(6 - len(str(m)))+str(py[0][0])+'000001',py[0][2]]]
for i in range(1,m):
  ans = '0'*(6 - len(str(m)))
  ans += str(py[i][0])
  if py[i-1][0] == py[i][0]:
    cnt += 1
  else:
    cnt = 1
  ans += '0'*(6 - len(str(cnt)))
  ans += str(cnt)
  ans_list.append([ans,py[i][2]])
ans_list = sorted(ans_list,key=lambda x:x[1])
for i in ans_list:
  print(i[0])
# Judge status: Accepted
from itertools import accumulate
n = int(input())
s = list(input())
for i in range(n):
    if s[i] == "#":
        s[i] = 1
    else:
        s[i] = 0
cs = [0] + list(accumulate(s))
m = n
for i in range(n+1):
    num = cs[i] + (n-i)-(cs[n]-cs[i])
    m = min(m,num)
print(m)
# Judge status: Accepted
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    a = int(input())
    b = int(input())

    print(6-a-b)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
X=int(input())

ans=0
yokin=100
for i in range(1,X+1):
  yokin=int(yokin*i/100)
  if yokin <= X:
    ans+=1
  else:
    break
print(ans)
# Judge status: Accepted
A,B = map(int,input().split())

if A > 12:
    print(B)
elif A > 5:
    print(B//2)
    
else:
    print(0)
# Judge status: Wrong Answer
li = [0]*(10**5+10)
n,k = map(int, input().split())
for i in range(n):
    a,b = map(int, input().split())
    li[a] += b
cnt = 0
ans = 0
for i in range(10**5):
    cnt += li[i]
    ans = i
    if cnt >= k:
        break
print(ans)
# Judge status: Accepted
from sys import stdin, setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    s = input()
    if s[-1] != 's':
        print(s + "s")
    else:
        print(s + "es")

if __name__ == '__main__':
    main()
# Judge status: Accepted
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
ans = 0
for k, v in counter.items():
    if 2 <= v:
        ans += v * (v - 1) // 2
for a in A:
    if a in counter and 2 <= counter[a]:
        v = counter[a]
        diff = v * (v - 1) // 2 - ((v- 1) * (v - 2) // 2)
        print(ans - diff)
    else:
        print(ans)
# Judge status: Accepted
K, X = [int(i) for i in input().split()]
print('Yes' if 500 * K >= X else 'No')
# Judge status: Wrong Answer
X = list(map(int,list(input())))

for i in range(2**4+1):
  ans =[]
  for j in range(4):
    d = X[j]*(-1)**((i >>j)&1)
    ans.append(d)
  if sum(ans) == 7:
    for i,a in enumerate(ans):
      if a>=0 and i>0:
        print("+",end="")
      print(a,end="")
    print("=7")
    exit()
# Judge status: Accepted
import sys
from io import StringIO
import unittest

sys.setrecursionlimit(10**6)

def rec(n, a, seen):
	if seen[n-1]:
		return -1
	if a[n-1] == 2:
		return seen.count(True) + 1
	seen[n-1] = True
	return rec(a[n-1], a, seen)

def resolve():
	n = int(input())
	a = []
	seen = [False]*n
	for _ in range(n):
		a.append(int(input()))
	print(rec(1, a, seen))
resolve()
# Judge status: Wrong Answer
def main():
    N, K = map(int,input().split())
    S = []
    for _ in range(N):
        a,b = map(int,input().split())
        S += [a]*b
    print(S[K-1])
    
            

if __name__ == '__main__':
    main()
# Judge status: Accepted
k, x = map(int, input().split())

z = x - k
for i in range(k*2-1):
    z += 1
    print(z, end=" ")
# Judge status: Wrong Answer
N,A,B=map(int,input().split())
if (B-A)%2==0:
    print(int((B-A)/2))
else:
    print(min(B-1,N-A))
# Judge status: Wrong Answer
K = int(input())
S = input()

if len(S) <= K:
    print(S)
else:
    print(S[:7] + "...")
# Judge status: Wrong Answer
n = int(input())
a = 1
ans = 0
 
# while a < n/2:
#     b = 2
#     while a * b < n:
#         ans += 1
#         b += 1
#     a += 1
 
# print(ans+2*(n-2)+1)

while a < n:
    if n % a == 0:
        ans += 1
    a += 1

print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

def main():
    X, Y = map(int, input().split())
    tmp = X * 4 - Y
    if tmp%2 != 0:
        print("No")
        return
    turu = tmp // 2
    kame = X - turu
    if turu >= 0 and kame >= 0:
        print("Yes")
        return
    print("No")


if __name__ == "__main__":
    main()
# Judge status: Accepted
first = input()
second = input()
third = input()

d = {}
d["a"]=first
d["b"]=second
d["c"]=third


flag = False
run = "a"
while flag != True:
 
  if d[run] == "":
    flag = True
    print(run.upper())
  else:
    l = len(d[run])
    temp = d[run][0]
    
    d[run] = d[run][1:l]
    
    run = temp
# Judge status: Wrong Answer
A,B,C,K = map(int,input().split())

if K % 2 == 0:
    m = A-B
else:
    m = B-A

if abs(m)<=10^18:
    print(m)
else:
    print('Unfair')
# Judge status: Accepted
import math
a, b, x = map(int, input().split())
if ((a ** 2) * b) / 2 <= x:
    print(math.degrees(math.atan((a ** 2 * b - x) / (a ** 2) / a * 2)))
else:
    print(90 - math.degrees(math.atan(x / (a * b) / b * 2)))
# Judge status: Accepted
A, B = map(int, input().split())
if A <= 9 and B <= 9 : print(A*B)
else : print(-1)
# Judge status: Accepted
n = int(input())
power = 1
for i in range(1,n+1):
  power = power*i
  power = power%(10**9+7)
print(power%(10**9+7))
# Judge status: Accepted
X, A, B = map(int, input().split())
S = B - A
if S <= 0:
  print("delicious")
elif S <= X:
  print("safe")
else:
  print("dangerous")
# Judge status: Accepted
n = int(input())
csf=[]
for _ in range(n-1):
    c,s,f=map(int,input().split())
    csf.append((c,s,f))
ans=[0]*n
for i,(c,s,f) in enumerate(csf):
    for j in range(0,i+1):
        if ans[j]<=s:
            ans[j]=s+c
        else:
            ans[j]=(ans[j]+f-1)//f*f+c
for x in ans:
    print(x)
# Judge status: Wrong Answer
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
ans=''
l='abcdefghijklmnopqrstuvwxyz'
for i in range(len(l)):
  c=10**9
  for j in range(n):
    c=min(c,s.count(l[i]))
  for j in range(c):
    ans+=l[i]
print(ans)
# Judge status: Wrong Answer
K,X = map(int, input().split())
a, b = 0,0
A = []
if X - K+1 < -1000000:
  a = -1000000
else:
  a = X - K+1

if X + K-1 > 1000000:
  b = 1000000
else:
  b = X + K-1

for _ in range(a,b+1):
  A.append(_)
  
print(A)
# Judge status: Accepted
#editorial
x,y=map(int, input().split())
ans=10**12
#00
if y-x>0:
    ans=min(ans,y-x)
#10
if y+x>=0:
    ans=min(ans,y+x+1)
#01
if -y-x>=0:
    ans=min(ans,-y-x+1)

if x-y>0:
    ans=min(ans,x-y+2)

print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
if a == b:
    print('Draw')
elif a == 1 or (b != 1 and a > b):
    print('Alice')
else:
    print('Bob')
# Judge status: Accepted
def INT():
    return int(input())

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

def MI():
    return map(int, input().split())

N, M = MI()
X = LI()
X.sort()

if N >= M:
    print(0)
    exit()

dist = []
for i in range(M - 1):
    d = X[i + 1] - X[i]
    dist.append(d)

dist.sort()
print(sum(dist[ : M - N]))
# Judge status: Wrong Answer
S = input()
S_l = len(S)
MOD = 2019
l = [0]*200000
ans = 0

for k in range(0,4):
  for start,end in zip(range(0,S_l-3-k), range(3+k,S_l)):
    s = S[start:end+1]
    if int(s)%MOD==0:
      ans+=1
      l[end]+=1
      if start>=4:
        ans+=l[start-1]
        l[end]+=l[start-1]
        
print(ans)
# Judge status: Accepted

n,m = map(int,input().split())
data = [[0,0,0] for i in range(m)]
ans = ['']*m
city = [0]*n
for i in range(m):
    data[i] = list(map(int,input().split()))+[i]
    data[i][0] -= 1
for d in sorted(data,key=lambda x:x[1]):
    city[d[0]] += 1
    ans[d[2]] = str(d[0]+1).zfill(6)+str(city[d[0]]).zfill(6)
for i in ans:
    print(i)
# Judge status: Accepted
a,b,c = map(int,input().split())

if 2*b == a + c:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
N = int(input())
A = [int(i)-1 for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

v = 0


for i in range(N):
    v += B[A[i]]
    if i >= 1:
        if A[i]-A[i-1]==1:
            v += C[A[i]-1]
print(v)
# Judge status: Accepted
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

n = I()
c = list(input())
r = c.count('R')
print(c[:r].count("W"))
# Judge status: Accepted
s,w=map(int,input().split())
if w>=s:
    print("unsafe")
else:
    print("safe")
# Judge status: Wrong Answer
a,b = map(int, input().split())

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

def factorization(n):
  arr = {1}
  tmp = n
  for i in range(2,int(10**0.5)+1):
    while tmp % i == 0:
      tmp //= i
      arr.add(i)
  if tmp != 1:
    arr.add(tmp)
  return arr

g = gcd(a,b)
arr = factorization(g)
print(len(arr))
# Judge status: Accepted
S = input()
s_list = [s for s in S]
s_set = set(s_list)
if len(s_list)==len(s_set):
    print('yes')
else:
    print('no')
# Judge status: Accepted
def resolve():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    a = sorted(a, reverse=True)
    all = sum(a)
    c = a[m-1]
    if c >= all / (4*m):
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    resolve()
# Judge status: Accepted
import queue
k = int(input())

q = queue.Queue()
for i in range(1,10):
    q.put(i)

for i in range(k):
    x = q.get()
    if i == k-1:
        break
    else:
        if not x % 10 == 0:
            q.put(10*x + (x % 10) -1)
        q.put(10*x + (x % 10))
        if not x % 10 == 9:
            q.put(10*x + (x % 10) +1)

print(x)
# Judge status: Accepted
from itertools import accumulate


N, *A = map(int, open(0).read().split())
A_acc = list(accumulate(A, initial=0))
min_diff = float("inf")
for i in range(1, N):
    left, right = A_acc[i], A_acc[N] - A_acc[i]
    min_diff = min(min_diff, abs(right - left))
print(min_diff)
# Judge status: Accepted
N=input()
N=int(N)
print(sum(range(1,N+1)))
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))
from bisect import bisect_left

def main():
    N = int(input())
    L = sorted(input_nums())
    count = 0
    for i in range(N-2):
        a = L[i]
        for j in range(i+1, N-1):
            count += bisect_left(L, a+L[j]) - j - 1
    print(count)

if __name__ == '__main__':
    main()
# Judge status: Accepted
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N,K=map(int,input().split())
    A=list(map(int,input().split()))

    if N==K:
        print(1)
    else:
        N=N-K
        print(1+-(-N//(K-1)))


resolve()
# Judge status: Accepted
import math
N, X = map(int, input().split())
arr = list(map(int, input().split()))

kyori = []

for i in arr:
    kyori.append(abs(X-i))

c =math.gcd(kyori[0],kyori[0])
for i in kyori:
    c =math.gcd(c,i)

print(c)
# Judge status: Accepted
x, a, b = map(int,input().split())
if a + x >= b and a >= b:
    print('delicious')
elif a + x >= b:
    print('safe')
else:
    print('dangerous')
# Judge status: Accepted
a,b=map(int,input().split())
if a<=b:
    a=str(a)
    print(b*a)
else:
    b=str(b)
    print(b*a)
# Judge status: Wrong Answer
a,b,c=input().split()
if(abs(int(b)-int(a)) == abs(int(c)-int(b))):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N = int(input())
restaurants = []

for i in range(N):
    name, score = map(str, input().split())
    restaurants.append([name, int(score), i+1])

sorted_restaurants = restaurants.copy()
sorted_restaurants = sorted(sorted_restaurants, key=lambda x: (x[0], -x[1]))

for i in range(N):
    print(sorted_restaurants[i][2])
# Judge status: Wrong Answer
#a>=3200　のとき　出力s
#a<3200　のとき　出力’red'
#標準入力

#aは数字でユーザーが入力する
a = int (input())
s = input()

if a >= 3200:
    print('s')
else:
    print('red')
# Judge status: Accepted
n = int(input())
ls1 = list(map(int, input().split()))
ls2 = list(map(int, input().split()))

ans = 0

for i in range(n):
	wa = sum(ls1[:i+1]) + sum(ls2[i:])
	if wa > ans:
		ans = wa

print(ans)
# Judge status: Wrong Answer
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

x,y = map(int,readline().split())

if x >= 0 and y >= 0:
    if x > y:
        print(x-y+2)
    else:
        print(y-x)
elif x >= 0 and y < 0:
    print(abs(abs(x)-abs(y))+1)
elif x < 0 and y >= 0:
    print(abs(abs(x)-abs(y))+1)
else:
    if x > y:
        print(x-y+2)
    else:
        print(y-x)