peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
def main():
    N, X, Y = map(int, input().split())
    ans = [0] * (N - 1)
 
    dist = 0
    
    for i in range(1, N):
        for j in range(i + 1, N + 1):
            dist = min(j - i, abs(i - X) + abs(j - Y) + 1)
            ans[dist - 1] += 1
    
    for i in range(N - 1):
        print(ans[i])

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N, K = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(2 * K)]

treated = (list(range(1, N)))

for i in range(int((K+1)/2)):
  tt = list(set(list(range(1, N))) - set(l[2*i+1]))
  treated = list(set(treated) & set(tt))

print(len(treated))
# Judge status: Accepted
n, m = map(int, input().split())

sc = [list(map(int, input().split())) for _ in range(m)]

def solve():
    global n, m, sc
    for i in range(1000):
        tmp = str(i)
        if len(tmp) != n:
            continue
        check = True
        for s, c in sc:
            if int(tmp[s-1]) != c:
                check = False
        if check:
            return tmp
    return -1
print(solve())
# Judge status: Accepted
# solution

import io
import sys
import math

n,h,*l=map(int,open(0).read().split())

array=max(l[::2])

c=0;f=1

for b in sorted(l[1::2])[::-1]:
	if b>array:
		h-=b
		c+=1
		if h<1:
			f=0
			break
print(c+(~-h//array+1)*f)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

if len(set(A)) == len(A):
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
h=int(input())
w=int(input())
n=int(input())

s=max(h,w)
a=n//s+1
print(a)
# Judge status: Accepted
def main():
    N,K=map(int,input().split())
    h=list(map(int,input().split()))
    ans=[0]*N
    for i in range(1,N):
        ans[i]= min(abs(h[i]-h[j])+ans[j] for j in range(max(0,i-K),i))
    print(ans[-1])
main()
# Judge status: Accepted
# https://atcoder.jp/contests/cf17-final/submissions/12544627
# B - Palindrome-phobia
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = input()

    a = s.count("a")
    b = s.count("b")
    c = s.count("c")

    print("YES" if max(a, b, c) <= min(a, b, c) + 1 else "NO")


if __name__ == '__main__':
    resolve()
# Judge status: Accepted
N,K = map(int,input().split())
A = list(map(int,input().split()))

def check(m):
    n = 0
    for a in A:
        if a%m == 0:
            n += a//m - 1
        else:
            n += a//m
    return n <= K
        

l = 0
r = 10**9+10

while r-l > 1:
    m = (r+l) // 2
    if check(m):
        r = m
    else:
        l = m

print(r)
# Judge status: Accepted
import bisect
n = int(input())
a = [0,111,222,333,444,555,666,777,888,999]
s = bisect.bisect_left(a,n)
print (a[s])
# Judge status: Accepted
a,b=map(int,raw_input().split())
if a < 10 and b < 10:
  print a*b
else:
  print "-1"
# Judge status: Accepted
import math
import collections


def nc2(n):
    if n <= 1:
        return 0
    return math.factorial(n)//(2*math.factorial(n-2))


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

cnt = collections.Counter(a)
each_ans = {}
for key, value in cnt.items():
    t = nc2(value)
    each_ans[key] = (t, t-value+1)
all_sum = sum(value[0] for _, value in each_ans.items())
ans = {}
for key in cnt.keys():
    ans[key] = all_sum - each_ans[key][0] + each_ans[key][1]
for i in a:
    print(ans[i])
# Judge status: Accepted
A,B,K = map(int,input().split())
c = 0
S = []
if B - A <= K:
    for i in range(A,B+1):
        print(i)
    exit()
for i in range(A,B+1):
    if c == K:
        break
    print(i)
    S.append(i)
    c += 1
for i in range(B-K+1,B+1):
    if i not in S:        
        print(i)
# Judge status: Accepted
n = int(input())

cnt = 0
for i in range(1, int(n ** 0.5)+1):
    if n % i == 0:
        cnt = max(cnt, i)

print(cnt + n//cnt - 2)
# Judge status: Wrong Answer
import bisect
n = int(input())
li = list(map(int,input().split()))
li.sort()
#print(li)
count = 0
for i in range(1, max(li)):
    index = bisect.bisect_left(li, i)
    #print(n,index,n//2)
    if index == n//2:
        count += 1
print(count)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, H = mapint()
from heapq import heappop, heappush
Q = []
for _ in range(N):
    a, b = mapint()
    heappush(Q, (-a, 'N'))
    heappush(Q, (-b, 'L'))

ans = 0
while H>0:
    v, ty = heappop(Q)
    v *= -1
    if ty=='N':
        print(ans-(-H//v))
        exit()
    H -= v
    ans += 1
print(ans)
# Judge status: Accepted
s = input()
print('A'+s[8]+'C')
# Judge status: Accepted
A,B,C,D = map(int,input().split())
ans = max(min(B,D) -max(A,C),0)
print(ans)
# Judge status: Accepted
G = {}
l =["a","b","c"]
for i in l:
  G[i] = list(input())
s = l[0]
while(True):
  if len(G[s]) ==0:
    print(s.upper())
    break
  s = G[s].pop(0)
# Judge status: Accepted
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappush, heappop
import itertools

N = int(input())
A = np.array(input().split(), np.int64)

MOD = 10**9 + 7

ans = 0
for i in range(64):
    B = (A >> i) & 1
    x = np.count_nonzero(B)
    y = N - x
    x *= y

    for _ in range(i):
        x *= 2
        x %= MOD

    ans += x
ans %= MOD
print(ans)
# Judge status: Wrong Answer
A,B,C,K = map(int,input().split())

a = "Unfair"

for i in range(K):
    T = B + C
    N = A + C
    H = A + B
    if (T <= 10**18) and (N <= 10**18) and (H <= 10**18):
        A = T
        B = N
        C = H
    else:
        break
else:
    a = A - B

print(a)
# Judge status: Accepted
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do(): 
    s=STR()
    if s[2]==s[3] and s[4]==s[5]:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    do()
# Judge status: Accepted
n,m=map(int,input().split())
p=[list(map(int,input().split())) for _ in range(n)]
q=[list(map(int,input().split())) for _ in range(m)]
for a,b in p:
    l=[]
    for c,d in q:
        l.append(abs(a-c)+abs(b-d))
    print(l.index(min(l))+1)
# Judge status: Accepted
N, M = map(int, input().split())
h_list = list(map(int, input().split()))

# 隣接する展望台より低い時点でbad
bad_set = set()
for _ in range(M):
    src, dst = map(int, input().split())
    src_h = h_list[src - 1]
    dst_h = h_list[dst - 1]
    if src_h < dst_h:
        bad_set.add(src)
    elif dst_h < src_h:
        bad_set.add(dst)
    else:
        bad_set.add(src)
        bad_set.add(dst)

print(N - len(bad_set))
# Judge status: Wrong Answer
s,t = (i for i in input().split())
a,b = (int(i) for i in input().split())
u = input()

c = {s:a, t:b}
c[u] -= 1

for i in c.values(): print(i,end=" ")
print()
# Judge status: Wrong Answer
(A, B, M), aa, bb, *xyc = [list(map(int, s.split())) for s in open(0)]

ans = min(aa)+min(bb)

for x, y, c in xyc:
    ans = min(ans, aa[x-1]+bb[y-1]-c)

ans
# Judge status: Wrong Answer
s=int(input())
G =[]
while all(i!=s for i in G):
  G.append(s)
  if s % 2==0:
    s == int(s/2)
  else:
    s == int(3*s+1)
print(len(G)+1)
# Judge status: Accepted
t = list(input())
for i in range(len(t)-1, -1, -1):
    if t[i] == '?':
        t[i] = 'D'
print(''.join(list(map(str, t))))
# Judge status: Wrong Answer
n = int(input())
p = 'abcdefghijklmnopqrstuvwxyz'

for i in range(n):
  s = ''
  for j in range(i+1):
    s += p[j]
  if n % len(s) == 0:
    a = s*(n//len(s))
    print(a)
  else:
    b = n % len(s)
    #print(b)
    a = s*(n//len(s)) + s[:b]
    print(a)
# Judge status: Accepted
a,b,x = map(int, input().split())
if a <= x <= a+b:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n = int(input())
arr = list(map(int, input().split()))

rem = []
count = 1
for i in range(len(arr)):
    if count == arr[i]:
        rem.append(arr[i])
        count += 1

if len(rem) == 0:
    print(-1)
else:
    print(len(arr) - len(rem))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
st = 0
for i in range(N):
    st += B[A[i] - 1]
    if i >= 1 and A[i] == A[i - 1] + 1:
        st += C[A[i] - 2]
print(st)
# Judge status: Accepted
import itertools
import math
n = int(input())
points = []
for i in range(n):
    point = list(map(int,input().split()))
    points.append(point)
length = 0
for root in itertools.permutations(points):
    # print(root)
    for i in range(n-1):
        lengthi = math.sqrt((root[i][0]-root[i+1][0])**2+(root[i][1]-root[i+1][1])**2)
        # print(lengthi)
        length += lengthi
    # print(length)



print(length/(math.factorial(n)))
# Judge status: Accepted
'''
Created on 2020/08/19

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  N,A,B=map(int,pin().split())
  S=pin()[:-1]
  cnt=0
  cn=0
  for i in range(N):
    if S[i]=="a" and cnt<A+B:
      cnt+=1
      print("Yes")
    elif S[i]=="b" and cnt<A+B and cn<B:
      cnt+=1
      cn+=1
      print("Yes")
    else:
      print("No")
  return 

main()
# Judge status: Wrong Answer
N = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
    if p[i] == i + 1:
        p[i], p[i + 1] = p[i + 1], p[i]
    ans += 1
if p[-1] == N:
    ans += 1
print(ans)
# Judge status: Wrong Answer
N = int(input())
L = [list(map(int, input().split())) for i in range(N)]

l = [[0, 0, 0]]
l.extend(L)

flag = True
for c in range(1, len(L)):
    dt = l[c][0] - l[c-1][0]
    dist = abs(l[c][1] - l[c-1][1]) + abs(l[c][2] - l[c-1][2])

    if dist > dt or dist % 2 != dt % 2:
        flag = False

print("Yes" if flag else "No")
# Judge status: Wrong Answer
from math import log, ceil


def main():
    N, K = map(int, input().split())
    print(ceil(log(N, K)))


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = input()
N = int(N)
print(-N%1000)
# Judge status: Accepted
N = int(input())
A = [int(i) for i in input().split()]

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

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

l = 1
for i in range(N):
    l = lcm(l, A[i])

ans = 0
MOD = int(1e9+7)
for i in range(N):
    ans += l // A[i]

print(ans % MOD)
# Judge status: Accepted
x = int(input())
if x:
    print("0")
else:
    print("1")
# Judge status: Accepted
import string
import collections

N = int(input())
count = 0

s = []

for i in range(0,N):
  s.append(''.join(sorted(input())))

  
c = collections.Counter(s)
go = c.most_common()

for i in range(len(go)):
  k = go[i][1]
  count+=k*(k-1)//2
  
print(count)
# Judge status: Accepted
#import math
#from functools import reduce
from fractions import gcd
#from functools import lru_cache


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

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


def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x


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

t_lcm = lcm(A)
count = 0
for i in A:
    count += t_lcm//i
    
print(count%(10**9+7))
# Judge status: Accepted
n = int(input())
prev_t, prev_x, prev_y = 0, 0, 0
for i in range(n):
    t, x, y = list(map(int, input().split()))
    if abs(prev_x - x) + abs(prev_y - y) > abs(prev_t - t) or (
            abs(prev_x - x) + abs(prev_y - y) + abs(prev_t - t)) % 2:
        print('No')
        exit()
    prev_t, prev_x, prev_y = t, x, y
print('Yes')
# Judge status: Accepted
se = set(map(int,input().split()))
print(len(se))
# Judge status: Accepted
x = int(input())

a = 1
b = 0

def val():
    global a, b
    if pow(a,5) - pow(-b,5) == x:
        b = -b
        return True
    return pow(a,5) - pow(b,5) == x

while not val():
    if a >= b:
        b += 1
    else:
        a += 1
        b = 0
print(a,b)
# Judge status: Accepted
from collections import Counter

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

counter = Counter(A)

cnt = 0
for k, v in counter.items():
    if v < k:
        cnt += v
    elif v > k:
        cnt += v - k


print(cnt)
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))

a_odd = a[0::2]
a_even = a[1::2]

if N %2 == 0:#Nが偶数なら
  print(" ".join(list(map(str,list(reversed(a_even)) + a_odd))))
else:
  print(" ".join(list(map(str,list(reversed(a_odd)) + a_even))))
# Judge status: Wrong Answer
s = input()
q = int(input())

rev = 0
head = []
tail = []

for i in range(q):
    t = input().split()
    if t[0] == "1":
        rev ^= 1
    else:
        if (int(t[1])-1)^rev == 0:
            head.append(t[2])
        else:
            tail.append(t[2])

h = "".join(head)
t = "".join(tail)

if rev == 0:
    print(h[::-1] + s + t)
else:
    print(t[::-1] + s + h)
# Judge status: Wrong Answer
N = (input())
X = (N[-1:])
if X == 2 and X == 4 and X == 5 and X == 7 and X == 9:
  print("hon")
elif X == 0 and X == 1 and X == 6 and X == 8:
  print("pon")
else :
  print("bon")
# Judge status: Wrong Answer
n = int(input())
dl = list(map(int,input().split()))
if dl[0] != 0:
  print(0)
  exit()
d_dic = dict()
for d in dl:
  if d in d_dic:
    d_dic[d] += 1
  else:
    d_dic[d] = 1
l = max(d_dic.keys())
for i in range(l):
  if not i in d_dic:
    print(0)
    exit()
ans = 1
for i in range(l):
  ans *= d_dic[i]**d_dic[i+1]
  ans = ans%998244353
print(ans)
# Judge status: Wrong Answer
S=list(input())
N=len(S)
def main():
  ans=0
  i=0
  while len(S)>0 and i<N-1:
    if (S[i]==0 and S[i+1]==1) or (S[i]==1 and S[i+1]==0):
      S.remove(S[i:i+2])
      ans+=1
      i=0
    else:
      ans=ans
      i+=1
  print(ans)
main()
# Judge status: Accepted
import math
a,b = map(int,input().split())
ans = 0
a_min = math.ceil(12.5 * a)
a_max = 12.5 * (a + 1)
b_min = math.ceil(10 * b)
b_max = 10 * (b + 1)
min = max(a_min,b_min)
if min < a_max and min < b_max:
    ans = min
else:
    ans = -1
print(int(ans))
# Judge status: Accepted
n = int(input())
d = list(map(int,(input().split())))
d.sort()

k = 0 #以上ならARC 未満はABC

x = (n // 2) -1 # 配列のスタート

start = d[x] + 1
end = d[x+1] + 1

result = list(range(start,end))
print(len(result))
# Judge status: Accepted
r = int(input())
print(2*r*3.141592)
# Judge status: Accepted
N,A,B=map(int,input().split())
MIN=A*(N-1)+B
MAX=B*(N-1)+A
ans=MAX-MIN+1
print(ans if ans>=0 else 0)
# Judge status: Accepted
def main():
    S = input()
    abc = 'abcdefghijklmnopqrstuvwxyz'
    for c in abc:
        if c not in S:
            print(c)
            exit()
    print('None')


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
"""
素直に実装するとN**9
"""

import itertools

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


count = 0
for a in L:
    l = L[a:]
    comb = list(itertools.combinations(L, 2))
    for b,c in comb:
        if abs(b-c) < a < b+c:
            count += 1
print(count)
# Judge status: Accepted
import numpy as np
K, X = map(int, input().split())

ans = [str(x) for x in range(X-K+1,X+K)]
ans = " ".join(ans)
print(ans)
# Judge status: Accepted
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
B = [int(x) for x in stdin.readline().rstrip().split()]

cnt1 = 0 
cnt2 = 0

for i in range(N):
    if A[i] > B[i]:
        cnt1 += (A[i] - B[i])
    else:
        cnt2 += ((B[i]-A[i])//2)
        
if cnt1 <= cnt2:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
A, B, C, D = map(int, input().split())
print("Yes" if (A+D)//D >= (C+B)//B else "No")
# Judge status: Accepted
s = str(input())

ans = "2018" + s[4:]

print(ans)
# Judge status: Wrong Answer
def main():
    a,b = map(int, input().split())
    print(min(a,b))

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
# coding: utf-8

str = input()
table = list(str)
print(table)
# Judge status: Accepted
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b, c, d, e = list(map(int, readline().split()))

    x = a * 60 + b
    y = c * 60 + d
    z = y - x

    print(z-e)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
from math import gcd

N = int(input())
T = []

for _ in range(N):
   T.append(int(input()))

res = 0
path = 1

for i in range(N):
   res = gcd(res, T[i])
   path *= T[i]

print(path//res)
# Judge status: Accepted
from math import floor

N, M = map(int, input().split())
if N%2 == 1:
    for p1 in range(1, M+1):
        p2 = M*2+1-p1
        print(p1, p2)
else:
    for p1 in range(1, min(M,floor(N/4))+1):
        p2 = N-p1+1
        print(p1, p2)
    for p1 in range(p1+1, M+1):
        p2 = N-p1
        print(p1, p2)
# Judge status: Accepted
n=int(input())
if n==0:
  print(0)
  exit()
ans=[]
while n!=0:
  n-=1
  ans.append(n%-2)
  n//=(-2)
#print(ans)
tmp=[1*(i==0) for i in ans][::-1]
print("".join(map(str,tmp)))
# Judge status: Accepted
n, a, b = map(int, input().split())
min_ = (n-1)*a+b
max_ = a+(n-1)*b
if max_ < min_:
    print(0)
    exit()
print(max_-min_+1)
# Judge status: Wrong Answer
l = int(input())
a = 0
for i in range(1, l):
    for j in range(1, i + 1):
        k = l - i - j
        a = max(a, i * j * k)
print(a)
# Judge status: Accepted
N, Y = map(int, input().split())
Y /= 1000
x = 10
y = 5
z = 1
for i in range(N+1):
    for j in range(N+1):
        if x*i+y*j+(N-i-j) == Y and i+j <= N:
            print(i, j, N-i-j)
            exit()
print(-1, -1, -1)
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

n = 1
order = [n]
order_set = set([n])

for i in range(1, K + 1):
    n = A[n - 1]
    if n in order_set:
        Li = order.index(n)
        Ri = len(order)
        idx = Li + (K - Li) % (Ri - Li)
        print(order[idx])
        exit()
    else:
        order.append(n)
        order_set.add(n)
        continue
print(n)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
print(min(abs(a-b),abs(a-c)))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
for i in A:
    if (i%3==0 or i%5==0) and i%2==0:
        print('APPROVED')
    else:
        print('DENIED')
# Judge status: Accepted
s = input()

ans = 0
leng = len(s)
half = leng // 2
for i in range(half):
    if s[i] != s[leng-1-i]:
        ans += 1

print(ans)
# Judge status: Wrong Answer
x = int(input())
ans = x//11 * 2
if 0 < x%11 < 5: ans += 1
else: ans += 2
print(ans)
# Judge status: Accepted
x = int(input())
if x == 0:
  print('1')
if x == 1:
  print('0')
# Judge status: Accepted
N, K, S = map(int, input().split())

if S > 1:
	t = S - 1
else:
	t = S + 1

print(*([S] * K + [t] * (N - K)))
# Judge status: Wrong Answer
a = str(input().split())
s = list(a)
print(s)
if s[4] == s[5] and s[7] == s[6]:
      print("Yes")
else :
      print("No")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
dic1 = {}
dic2 = {}
for i in range(N):
  if A[i] in dic1:
    dic1[A[i]] += 1
  else:
    dic1[A[i]] = 1
ans = 0
for v in dic1.values():
  ans += (v*(v-1))//2
for j in range(N):
  w = dic1[A[j]]
  v = w-1
  comb = ans -(w*(w-1))//2 + (v*(v-1))//2
  print(comb)
# Judge status: Accepted
A,B,C = map(int,input().split())

if A == B and A != C:
    print("Yes")
elif A == C and A != B:
    print("Yes")
elif B == C and C != A:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
k = list(map(int,input().split()))
print(int(360/k[0]))
# Judge status: Wrong Answer
X = int(input())
if X == 7 or 5 or 3:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
import math


a, b, z = [int(w) for w in input().split()]

l = math.ceil(a/z)
r = b//z

print(r-l+1)
# Judge status: Accepted
d = input()

if "RRR" in d:
    print("3")
elif "RR" in d:
    print("2")
elif "R" in d:
    print("1")
else:
    print("0")
# Judge status: Wrong Answer
N = int(input())
li = [list(map(int, input().split())) for i in range(N - 1)]

for n in range(N):
  if n == N - 1:
    print(0)
    break
  
  ans = 0
  for index, i in enumerate(li):
    if index < n:
      continue

    if ans < i[1]:
      ans = i[1]
    else:
      if ans % i[1] != 0:
        ans += i[2] - (ans % i[1])

    ans += i[0]
  print(ans)
# Judge status: Accepted
N,X,*A = map(int,open(0).read().split())
A+=[0]
s = 0

for n in range(N):
  d=max(0,A[n]+A[n-1]-X)
  s+=d
  A[n]-=d

print(s)
# Judge status: Accepted
n,k = map(int,input().split())
lst = [[int(i) for i in input().split()] for i in range(n)]
nlst = sorted(lst,key= lambda x:x[0])
cnt = 0
 
for i in range(n):
    cnt += nlst[i][1]
    if cnt >= k:
        ans = nlst[i][0]
        break
    
print(ans)
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())

pattern = 0

for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if i * 500 + j * 100 + k * 50 == x:
                pattern += 1

print(pattern)
# Judge status: Accepted
N = int(input())
A = sorted([int(_) for _ in input().split()])
n = A[-1]

idx = 0
maxv = -1
for i in range(N - 1):
    if A[i] == 0:
        t = 0
    else:
        t = min(n - A[i], A[i])
    if t > maxv:
        maxv = t
        idx = i
print(n, A[idx])
# Judge status: Accepted
N = int(input())
W = []
for i in range(N):
    W.append(input())
if len(W) != len(set(W)):
    print('No')
else:
    for i in range(1, N):
        if W[i][0] != W[i - 1][-1]:
            print('No')
            exit()
    print('Yes')
# Judge status: Wrong Answer
x,y,z = map(int,input().split())

if x%(y+z) ==0:
  print((x//(y+z))-1)
  
  
else:
  print(x//(y+z))
# Judge status: Wrong Answer
d = int(input())
C = list(map(int,input().split()))
S = [list(map(int,input().split())) for i in range(d)]

I = sorted(range(26), key = lambda x:C[x])

last = 0
for i in range(d):
    print(I[last])
    last = (last + 1)%26
# Judge status: Wrong Answer
import sys 
N, M = map(int, input().split())
X = list(map(int, input().split()))

X = sorted(X)

anslis = []
        
    
for i in range(M-1):
    ans = abs(X[i+1] - X[i])
    anslis.append(ans)
    ans = 0

anslis = sorted(anslis)

print(sum(anslis[0:N+1]))
# Judge status: Accepted
x=int(input())
if(x==0):
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
K=int(input())
ans=0
import math
from functools import reduce

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

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            #print(a, b, c)
            ans+=gcd(a, b, c)
ans
# Judge status: Accepted
li = list(input())
liset = set(li)
if len(liset) == len(li):
    print("yes")
else:
    print("no")
# Judge status: Wrong Answer
N = int(input())
lis = sorted(list(map(int, input().split())))
ans = 0

for i in range(N, 0, -1):
    ans += lis[i*2]

print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
if a <= c <= b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
x = int(input())
X = x % 11
N = x // 11

ans = 0
if 1 <= X <= 6:
    ans = N*2 + 1
elif 7 <= X <= 10:
    ans = N*2 + 2
else:
    ans = N*2

print(ans)
# Judge status: Accepted
def main():
    n=int(input())
    p=list(map(int, input().split()))
    c = 0
    for i in range(n):
        if p[i] != i+1:
            c += 1
    print("YES" if c < 3 else "NO")
    
if __name__ == "__main__":
    main()
# Judge status: Accepted
l,r,d = map(int,input().split(' '))
ans=0
for i in range(l,r+1):
    if i%d==0:
        ans+=1

print(ans)
# Judge status: Wrong Answer
s = 0
for c in input():
  x = int(c)
  s += min(x, 10-x+1)
  
print(s)
# Judge status: Accepted
N=int(input())
N_str=set(str(N))
if "7" in N_str :
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, k = (int(x) for x in input().split())
A = list(int(x) for x in input().split())

for i in range(n - k):
    if A[i] >= A[k + i]:
        print("No")
    else:
        print("Yes")
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
print(min(c,a//b))