peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N,A,B = list(map(int,input().split()))
total = A+B
outsea = 0
passer = 0
for s in input():
    if s == "c":
        print('No')
        continue
    elif s == "a":
        if passer < total:
            passer += 1
            print('Yes')
        else:
            print('No')
    else:
        outsea += 1
        if passer < total and outsea <= B:
            passer += 1
            print('Yes')
        else:
            print('No')
# Judge status: Accepted
from bisect import bisect

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

Ali.sort()
for i in range(M):
  a = Ali.pop(-1)
  a //= 2
  Ali.insert(bisect(Ali,a), a)

print(sum(Ali))
# Judge status: Accepted
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n, m, x, y = nm()
    X = nl()
    Y = nl()
    xx = max(X)
    yy = min(Y)
    for z in range(-100, 101):
        if x < z <= y and xx < z <= yy:
            print('No War')
            return
    print('War')


if __name__ == '__main__':
    main()
# Judge status: Accepted
X,K,D=map(int,input().split())
if abs(X)>=K*D:
    print(abs(X)-K*D)
else:
    if K%2==abs(X)//D%2:
        print(abs(X)%D)
    else:
        print(D-abs(X)%D)
# Judge status: Wrong Answer
#import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with

#A = int(input())
N,M= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
left=1
right=10**6
for m in range(M):
    l,r = map(int,input().split())
    if left<=l and l<=right:
        left=l
    if left<=r and r<=right:
        right=r

print(right-left+1)
# Judge status: Accepted
a, b = list(map(int, input().split()))
if a <= b:
    print(a)
else:
    print(a - 1)
# Judge status: Accepted
X,Y,Z=map(int, input().split())
print(Z,X,Y)
# Judge status: Accepted
H = int(input())
W = int(input())
N = int(input())
A = max(H,W)
print((N-1)//A+1)
# Judge status: Accepted
n,k=map(int, input().split())
a=list(map(int,input().split()))
ans=0


if (n-1)%(k-1) == 0:
  print((n-1)//(k-1))
else:
  print((n-1)//(k-1)+1)
# Judge status: Accepted
import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
B.sort()
C.sort()
ans=0
for b in range(N):
    a=bisect.bisect_left(A,B[b])
    c=N-bisect.bisect_right(C,B[b])
    ans+=a*c
print(ans)
# Judge status: Accepted
n = input()
a = sorted(list(map(int,input().split())),reverse=True)

print(sum(a[::2])-sum(a[1::2]))
# Judge status: Wrong Answer

def main():
    K = int(input())
    A, B = map(int, input().split())

    if B-A+1 >= K:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
a_list = list(map(int,input().split()))
ma = max(a_list)
hoge = [0]*(ma+1)
for i in range(ma+1):
  hoge[i] = a_list.count(i)
ans = 0
for i in range(1,ma):
  t = hoge[i-1] + hoge[i] + hoge[i+1]
  if t > ans:
    ans = t
print(ans)
# Judge status: Wrong Answer
a=int(input())
if a % 500 == 0:
  print(a * 2)
else:
  if a < 1000:
  	print(int(a/100) * 100 + int((a % 100) / 5) * 5)
  else:
    print(round(a,-2) * 2 + int((a % 500) / 5) * 5)
# Judge status: Accepted
import math
import itertools

n = int(input())
a = list(map(int, input().split()))
pf = [0] + list(itertools.accumulate(a, math.gcd))
pb = [0] + list(itertools.accumulate(reversed(a), math.gcd))
pb.reverse()
ans = [0]*n
for i in range(n):
  ans[i] = math.gcd(pf[i], pb[i+1])
print(max(ans))
# Judge status: Accepted
#coding:utf-8

N = int(input())

ans = [0,0,0,0]

for i in range(N):
    S = str(input())
    if S == 'AC':
        ans[0] += 1
    elif S == 'WA':
        ans[1] += 1
    elif S == 'TLE':
        ans[2] += 1
    elif S == 'RE':
        ans[3] += 1

print("AC x {}".format(ans[0]))
print("WA x {}".format(ans[1]))
print("TLE x {}".format(ans[2]))
print("RE x {}".format(ans[3]))
# Judge status: Wrong Answer
n,k=map(int,input().split())
print(sum(1+i*(n-i+1)for i in range(k,n+2))%(1e9+7))
# Judge status: Wrong Answer
from collections import defaultdict
n,m = map(int,input().split())
ans = []
flag = True
b = defaultdict(list)
for i in range(n):
    ans.append('0')
for i in range(m):
    s,c = map(int,input().split())
    c = str(c)
    b[s].append(c)
for key,value in b.items():
    if len(set(value)) == 1:
        ans[key-1] = value[0]
    else:
        flag = False
tmp = ''
for idx,i in enumerate(ans):
    if idx == 0 and i == '0' and len(ans) != 1:
        flag = False
    tmp += i
print(tmp if len(tmp) == n and flag else -1)
# Judge status: Accepted
x=int(input())
ans = x//11
ans *=2
if x%11>0:
  ans+=1
if x%11>6:
  ans+=1
print(ans)
# Judge status: Accepted
n = int(input()) -2
a = list(map(int, input().split()))

sa = sorted(a,reverse=True)

c = 1
ans = sa[0]


for i in range(1, len(sa)):
    if n <= 0:
        break
    elif n == 1:
        ans += sa[i]
        n -= 1
    else:
        ans += sa[i]*2
        n -= 2
        # print(sa[i])

print(ans)
# Judge status: Accepted
n = int(input())
a = 1
for i in range(1,n+1):
    a = i * a % (10**9+7)

print(a)
# Judge status: Wrong Answer
n, m = map(int, input().split())
l_max = 1
r_min = 10 ** 5
for i in range(m):
    l, r = map(int, input().split())
    l_max = max(l, l_max)
    r_min = min(r, r_min)

print(r_min - l_max + 1)
# Judge status: Accepted
n = int(input())
nums = []
for _ in range(n):
  nums.append(list(map(int, input().split())))

dp = nums[0]

for i in range(1, n):
  dp[0], dp[1], dp[2] = max(dp[1], dp[2]) + nums[i][0], max(dp[0], dp[2]) + nums[i][1], max(dp[0], dp[1]) + nums[i][2]

print(max(dp))
# Judge status: Accepted
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
 
a, b = [0], [0]
for i in range(N):
	a.append(a[i] + A[i])
for i in range(M):
	b.append(b[i] + B[i])
 
ans, j = 0, 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
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

N = int(input())
T = []
ans = int(input())
for _ in range(N-1):
    t = int(input())
    ans = lcm(ans, t)

print(ans)
# Judge status: Accepted
import math
A,B,H,M=map(int,input().split())

theta_hour=math.pi/6*H+math.pi/6*M/60
theta_minute=math.pi/30*M
x=A**2+B**2-2*A*B*math.cos(abs(theta_hour-theta_minute))

print(math.sqrt(x))
# Judge status: Wrong Answer
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7


n = ri()
s = collections.Counter(rr())
print(min(s['0'], s['1']) * 2)
# Judge status: Accepted
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
cnt=0
for i in range(N):
    cnt+=min(A[i],B[i])
    if A[i]>=B[i]:
        continue
    else:
        cnt+=min(B[i]-A[i],A[i+1])
        A[i+1]=max(0,A[i+1]-B[i]+A[i])
print(cnt)
# Judge status: Accepted
s = str(input())

num = [int(s[-1])]
for i in range(1, len(s)):
    tmp = num[-1] + pow(10, i, 2019) * int(s[-i - 1])
    num.append(tmp % 2019)

mod = [1] + [0] * 2018
ans = 0
for i in num:
    ans += mod[i]
    mod[i] += 1
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
ans = 1e+10
list = []
for i in range(N):
  count = 0
  while A[i] > 0:
    if A[i] % 2 == 0:
        A[i] //= 2
        count += 1
    else:
        break
  list.append(count)
print(min(list))
# Judge status: Wrong Answer
X = int(input())
print(361 if 360 % X else 360 // X)
# Judge status: Accepted
s = input()
diff_01, diff_10 = 0, 0
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == '0':
            diff_10 += 1
        else:
            diff_01 += 1
    if i % 2 == 1:
        if s[i] == '0':
            diff_01 += 1
        else:
            diff_10 += 1
print(min(diff_01, diff_10))
# Judge status: Accepted
n = int(input())
a,b=[],[]

for i in range(n):
    x,y = map(int,input().split())
    a.append(x)
    b.append(y)

a=list(reversed(a))
b=list(reversed(b))

OK=0
for i in range(n):
    A=a[i]+OK
    if A==b[i]:
        continue
    else:
        ok=-(-A//b[i])*b[i]-A
    OK+=ok

print(OK)
# Judge status: Accepted
N=str(input())

#print(N[-1])

if int(N[-1])==3:
    print("bon")
elif int(N[-1])==0 or int(N[-1])==1 or int(N[-1])==6 or int(N[-1])==8:
    print("pon")
else:
    print("hon")
# Judge status: Accepted
n,k,s = (int(i) for i in input().split())
ans = ""
if s != 10**9:
    for i in range(k):
        ans += str(s) + " "
    if n > k:
        for j in range(n-k):
            ans += str(10**9) + " "
    print(ans)
else:
    for i in range(k):
        ans += str(s) + " "
    if n > k:
        for j in range(n-k):
            ans += str(1) + " "
    print(ans)
# Judge status: Accepted
N = int(input())
arr = list(map(int, input().split()))
count = sum([ 1 for x in arr[::2] if x % 2 == 1])
print(count)
# Judge status: Wrong Answer
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    S = input()
    ans = 1000
    for i in range(len(S) - 3):
        s = int(S[i:i + 3])
        ans = min(ans, (abs(s - 753)))
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(n-1):
    if (p[i-1]<p[i] and p[i]<p[i+1]) or (p[i+1]<p[i] and p[i]<p[i-1]):
        cnt += 1

print(cnt)
# Judge status: Wrong Answer
N = int(input())
if N % 2 == 0:
    print((N/2)/N)
else:
    print((N//2)/(N+1))
# Judge status: Wrong Answer
N,M=map(int,input().split())
shop={}
for i in range(N):
    A,B=map(int,input().split())
    shop[A]=B


shop1=sorted(shop.items())

count=0
ans=0
for (key,value) in shop1:
    if M-count==value:
        break
    elif M-count<value:
        ans+= (M-count)*key
        break
    else:
        ans+=value*key
        count+=value
    
print(ans)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print('Yes' if 0 < int(int(c) * int(c) + int(b) * int(b) + int(a) * int(a) - int(2) * int(int(c * a) + int(a * b) + int(b * c))) else 'No')
# Judge status: Accepted
MOD = 10**9+7
import sys
sys.setrecursionlimit(100000)


def kaijo(n):
    s = 1
    for i in range(1, n+1):
        s *= i
        s %= MOD
    return s


n,m = map(int,input().split())
if abs(n-m) > 1:
    print(0)
elif abs(n-m) == 1:
    print(kaijo(m) * kaijo(n) % MOD)
else:
    print(pow(kaijo(m), 2, MOD)*2%MOD)
# Judge status: Wrong Answer
# coding: utf-8
from collections import Counter
S = input()
cnts = Counter(S)
cv = cnts.values()
top = max(cv)
others = sum(cv) - top
if top > others:
    print("NO")
else:
    print("YES")
# Judge status: Accepted
N = int(input())
l = [2,1]
for i in range(1,N):
    l.append(l[i]+l[i-1])
print(l[-1])
# Judge status: Accepted
s = input()

if len(set(s)) == 26:
  print("None")
else:
  for c in "abcdefghijklmnopqrstuvwxyz":
    if not c in set(s):
      break
  
  print(c)
# Judge status: Accepted
N, X, T = map(int, input().split())
ans = - (- N // X) * T
print(ans)
# Judge status: Accepted
from collections import deque

def main():
    input()
    A = list(enumerate(input().split()))
    b = deque()
    (append1, append2) = (b.append, b.appendleft) if len(A) % 2 == 0 else (b.appendleft, b.append)
    for i, a in A:
        if i % 2 == 0:
            append1(a) 
        else:
            append2(a)

    print(" ".join(list(b)))

main()
# Judge status: Accepted
N,M=map(int,input().split())
A=[input()for i in range(N)]
B=[input()for i in range(M)]
for i in range(N-M+1):
    for j in range(len(A[0])-len(B[0])+1):
        l=[]
        for k in range(M):
            l.append(A[i+k][j:j+M])
        if l==B:print('Yes');exit()
print('No')
# Judge status: Accepted
a, b, c = map(int, input().split())
d = a-b

if d > c:
    print(0)
else:
    print(c -d)
# Judge status: Wrong Answer
import sys

days, N = map(int, sys.stdin.readline().split())

a = list(map(int, sys.stdin.readline().split()))

print(days - sum(a))
# Judge status: Wrong Answer
N = int(input())
s = [[0,0,0]]
for i in range(N):
    s.append(list(map(int,list(input().split()))))
err = 0
for i in range(N):
    dt = s[i+1][0] - s[i][0]
    dist = abs(s[i+1][1] - s[i][1]) + abs(s[i+1][2] - s[i][2])
    if(dt < dist):
        err = 1
    if(dist % 2 != dt % 2):
        err = 1

if(err == 0):
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
import math
c=input()
b=input()
a=input()
if c>b:
        print(math.ceil(int(a)/int(b)))
elif c<b:
        print(math.ceil(int(a)/int(c)))
# Judge status: Wrong Answer
#071_B
s=input()
c='a'
while c<'z':
    c=chr(ord(c)+1)
    if c not in s:
        print(c)
        exit()
print('None')
# Judge status: Accepted
N = int(input())
H = list(map(int, input().split()))

tmp = 0
ans = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    tmp += 1
    ans = max(ans, tmp)
  else:
    tmp = 0
    
print(ans)
# Judge status: Wrong Answer
komoji = input()
if komoji in "aeiou" == True:
    print("vowel")
else:
    print("consonant")
# Judge status: Accepted
N,K = map(int,input().split())
S = input()+"W"
A = []
a = 0
b = ""
for s in S:
    if b!="" and b!=s:
        A.append(a)
        a=1
    else:a+=1
    b = s
ans = 0
for a in A:ans+=(a-1)
print(min(N-1,ans+2*K))
# Judge status: Accepted
a, b = map(int, input().split())
print(str(a*b))
# Judge status: Accepted
n, x = list(map(int, input().split()))
lista = list(map(int, input().split()))

lista.sort()

snack = 0

for i in range(n):
  if lista[i] + snack <= x:
    snack += lista[i]
  else:
    print(i)
    break
else:
  if snack == x:
    print(n)
  else:
    print(n - 1)
# Judge status: Wrong Answer
text=input()
dic={}
for i in range(len(text)):
    if text[i] not in dic:
        dic[text[i]]=1
    else:
        dic[text[i]]=+1     
for i in dic.values():
    if not i%2==0:
        print('No')
        exit()
        
print('Yes')
# Judge status: Accepted
import sys
input = sys.stdin.buffer.readline
N = int(input())
A = list(map(int, input().split()))
d = 0
ans = 1
for i in range(1, N):
    if A[i - 1] < A[i]:
        if d < 0:
            ans += 1
            d = 0
        elif d == 0:
            d = 1
    elif A[i - 1] > A[i]:
        if d > 0:
            ans += 1
            d = 0
        elif d == 0:
            d = -1
print(ans)
# Judge status: Accepted
w, h, x, y = map(int, input().split())
count = 0
if w/2==x and h/2==y:
    count = 1
    print(w*h/2, count)
else:
    print(w*h/2, count)
# Judge status: Accepted
import sys
q = input()
b = ['a','i','u','e','o']
s = 'consonant'



for u in range(5):
  if q==b[u]:
    s = 'vowel'
    if s == 'vowel':
      print(s)
      sys.exit()
    
    
print(s)
# Judge status: Accepted
# https://atcoder.jp/contests/abc098/tasks/abc098_b
n = int(input())
s = input()

ans = 0
for i in range(n):
    left = set(s[:i])
    right = set(s[i:])
    com = left & right
    ans = max(ans, len(com))
print(ans)
# Judge status: Accepted
import re
print(max(map(len,re.findall("[ACGT]*",input()))))
# Judge status: Accepted
#!/usr/bin/env python3
x = int(input())
p, q = divmod(x, 11)
s = max(q - 6, 0)
print(p*2 + ([1,2][s>0] if q else 0))
# Judge status: Accepted
x = int(input())

if x==0:
    print(1)
elif x==1:
    print(0)
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
Q=[a for a in A if a%4==0]
W=[a for a in A if a%4==2]
if len(Q)>=n//2:
  print("Yes")
else:
  if len(W)>=n-len(Q)*2:
    print("Yes")
  else:
    print("No")
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
ans=a+b+c
if a<b:
    ans+=9*b
else:
    ans+=9*a
print(ans)
# Judge status: Accepted
MOD = 10**9+7
N, M = map(int,input().split())
dp = [0]*(N+1)
dp[0] = 1
for i in range(M):
    dp[int(input())] = None
dp[1] = 1 if dp[1]==0 else 0
for i in range(2,N+1):
    if dp[i] == None:
        dp[i] = 0
    else:
        dp[i] = dp[i-1]+dp[i-2]
print(dp[-1]%MOD)
# Judge status: Accepted
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
dest = list(map(int, input().split()))

index_map = {}

step = 0
next_index = 0
while 0 < k:
  k -= 1  
  next_index = dest[next_index] - 1

  if next_index in index_map:
    period = step - index_map[next_index]
    skip = k % period
    for j in range(0, skip):
      next_index = dest[next_index] - 1
    break

  index_map[next_index] = step
  step += 1

print(next_index + 1)
# Judge status: Accepted
s = input()

prev= [""]
cont = [""]
ans = 0
for i in s:
    cont.append(i)
    if cont != prev:
        prev = cont
        cont = [""]
        ans+=1

print(ans)
# Judge status: Accepted
from itertools import combinations as cmb
n = int(input())
L = list(map(int, input().split()))
#print(L)
counter = 0
for l1, l2, l3 in cmb(L, 3):
    #print(l1, l2, l3)
    if l1 + l2 > l3 and l2 + l3 > l1 and l3 + l1 > l2 and l1 != l2 and l2 != l3 and l3 != l1:
        counter += 1
print(counter)
# Judge status: Wrong Answer
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]

passengers = sorted(T)
print('-', passengers)

def in_k(_passengers):
    in_k_list = [t for t in _passengers if t <= _passengers[0]+K]
    in_k_count = len(in_k_list)
    if in_k_count > C:
        remaining = _passengers[C:]
    else:
        remaining = _passengers[in_k_count:]
    return in_k_list, remaining


count_bus = 0
while len(passengers):
    in_k_list, passengers = in_k(passengers)
    count_bus += 1
    print(passengers)

print(count_bus)
# Judge status: Accepted
N = int(raw_input())
A = map(int, raw_input().split())

A = list(sorted(A, reverse=True))
ans = 1
is_before = False
count = 0
for i in range(N-1):
    if not is_before:
        if A[i] == A[i+1]:
            ans = ans * A[i]
            is_before = True
            count = count + 1
    else:
        is_before = False

    if count>1:
        print ans
        exit()

print 0
# Judge status: Accepted
X=int(input())
if X>=30:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n, m = map(int, input().split())

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

cd = []
for i in range(m):
  c, d = map(int, input().split())
  cd.append([c,d])



for i in range(len(ab)):
  x = [10000000000000000, 1000]
  for j in range(len(cd)):
    if x[0] > abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]):
      x[0] = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
      x[1] = j

  print(x[1] + 1)
# Judge status: Wrong Answer
a = int(input())
s = str(input())
 
if a <= 3200:
  print("red")
else:
  print(s)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
s = 0
ans = 0
for i in range(len(a)):
  s += a[i]
for i in range(len(a)-1):
  s -= a[i]
  ans += s*a[i]
print(int(ans%1e9+7))
# Judge status: Wrong Answer
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

for i in range(X+1,Y+1):
    if max(x) < 16 and min(y) >= 16:
        print('No War')
        break
else:
    print('War')
# Judge status: Accepted
n=int(input())
a=sorted(list(map(int,input().split())))
ans=1
cnt=[0]*(10**5+2)#a[i]+2
for i in range(n):
    cnt[a[i]]+=1
for i in range(n):
    tmp=cnt[a[i]]+cnt[a[i]+1]+cnt[a[i]+2]
    ans=max(tmp,ans)
print(ans)
# Judge status: Wrong Answer
n,d=map(int,input().split())
x = [0]*n
y = [0]*n
 
count=0
 
for i in range(n):
  x[i],y[i] = map(int, input().split())
  if x[i]**2+y[i]**2<=d**2:
   count=+1
print(count)
# Judge status: Wrong Answer
S,T=list(input().split())
A,B=list(map(int,input().split()))
U=input()
D={}
D[S]=A
D[T]=B
D[U]-=1
print(*list(D.values()))
# Judge status: Accepted
#126 b
def change(x):
    if 1<=x<=12:
        return 0
    else:
        return 1
ans=["AMBIGUOUS","NA","MMYY","YYMM"]#[00,11,01,10]
s=input()
a=change(int(s[:2]))
b=change(int(s[2:]))
if a==b:
    print(ans[a])
else:
    print(ans[a+2])
# Judge status: Accepted
from fractions import gcd

from functools import reduce


n = int(input())
a_list = [int(x) for x in input().split()]

temp = reduce(lambda x, y: (x * y) // gcd(x, y), a_list)

mod = 10 ** 9 + 7
ans = sum([temp // a for a in a_list]) % mod
print(ans)
# Judge status: Accepted
N, C, K = map(int, input().split())
Tlist = sorted([int(input()) for _ in range(N)])
ans = 0
count = 0

for i in range(N):
    now = Tlist[i]
    if count == 0:
        rl = now + K
        count += 1
        continue
    else:
        if now <= rl <= now + K and count < C:
            count += 1
        else:
            ans += 1
            rl = now + K
            count = 1
print(ans + 1)
# Judge status: Wrong Answer
import collections
import sys
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    A = list(map(int, readline().rstrip().split()))
    ans = 0
    c = collections.Counter()

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

    print(c)

    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
L = sorted(list(map(int, input().split())))

ans = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        for k in range(j+1, N):
            if L[i] + L[j] > L[k]:
                ans += 1
print(ans)
# Judge status: Accepted

grid = list(list(map(int,input().split())) for _ in range(3))

N = int(input())

S = set(int(input()) for _ in range(N))

def check():
    for i in range(3):
        if all(grid[i][j] in S for j in range(3)):
            return True
        if all(grid[j][i] in S for j in range(3)):
            return True
    return all(grid[i][i] in S for i in range(3)) or all(grid[2-i][i] in S for i in range(3))

print('Yes' if check() else 'No')
# Judge status: Wrong Answer
S = input().strip()
T = input().strip()
ans = []
for i in range(len(S)-len(T), -1, -1):
    ok = True
    for j in range(len(T)):
        if not (S[i+j] == '?' or S[i+j] == T[j]):
            ok = False

    if ok:
        a = S[:i]+T
        a = a.replace("?", "a")
        ans.append(a)

if len(ans):
    ans.sort()
    print(ans[0])
else:
    print("UNRESTORABLE")
# Judge status: Accepted
A,B,C,X=[int(input()) for i in range(4)]
print([500*a+100*b+50*c for c in range(C+1) for b in range(B+1) for a in range(A+1)].count(X))
# Judge status: Accepted
a,b=map(int,input().split())
print(min(max(b-a,-b+a+2),abs(a+b)+1))
# Judge status: Wrong Answer
import sys

N = int(input())
ans = 0
 
for i in range(N):
  if ans >= 3:
    print("Yes")
    sys.exit()
    
  a,b = map(int,input().split())
  if a == b:
    ans +=1
  else:
    ans =0
print("No")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
tmp=a[0]
ans=0
for i in a:
  if tmp>i:
    ans+=tmp-i
  else:
    tmp=i
print(ans)
# Judge status: Wrong Answer
n, x = map(int, input().split())
a = [int(i) for i in input().split()]
c = 0
for i in range(n - 1):
    d = max(a[i + 1] + a[i] - x, 0)
    c += d
    a[i + 1] -= d
print(c)
# Judge status: Wrong Answer
nums = input().split()

S = int(nums[0])
W = int(nums[1])


if (S < W ):
	print("unsafe")
else:
	print("safe")
# Judge status: Accepted
n = int(input())
s = list(input())
for i, char in enumerate(s):
    x = ord(char) + n
    if x > 90:
        x = x - 90 + 64
    s[i] = chr(x)

print("".join(s))
# Judge status: Accepted
def time_to_min(H, M):
  return H * 60 + M


def resolve():
  H1, M1, H2, M2, K= map(int, input().split(" "))
  start = time_to_min(H1, M1)
  end = time_to_min(H2, M2)
  print(end - start - K)

if __name__ == "__main__":
  resolve()
# Judge status: Accepted
x = [int(input()) for _ in range(5)]
k = int(input())
M = max(x)
m = min(x)
if M-m > k:
  print(':(')
else:
  print("Yay!")