peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
a=b=0
for i in range(len(s:=input())-len(t:=input())):
  for j,c in enumerate(t):b+=(s[i+j]==c)
  a=max(a,b);b=0
print(len(t)-a)
# Judge status: Wrong Answer
S = input()
idx = 1
count = 0
S_b = S[0]

while True:
    if idx == len(S)-1:
        break
    S_a = S[idx]
    if S_a == S_b:
        count += 1
        S_b = S[idx:idx+2]
    else:
        S_b = S_a
    idx += 1
print(len(S)-count)
# Judge status: Wrong Answer
sx,sy,tx,ty=map(int,input().split())
dx,dy=tx-sx,ty-sy
print("U"*dy+"R"*dx+"D"*dx+"L"*dy+"L"+"U"*(dy+1)+"R"*(dx+1)+"D"+"R"+"D"*(dy+1)+"L"*(dx+1)+"U")
# Judge status: Wrong Answer
n = int(input())
count = 0
flag = False
c = [0]*n
while count < n:
  a, b = map(int, input().split())
  count += 1
  if a == b and count < n:
    a, b = map(int, input().split())
    count += 1
    if a == b and count < n:
      a, b = map(int, input().split())
      count += 1
      if a == b and count < n:
        flag = True
        print("Yes")
        break

if flag == False:
  print("No")
# Judge status: Wrong Answer
#!/usr/bin/env python3
x = int(input())
print((x // 11) * 2 + (2 if x % 11 > 6 else 1))
# Judge status: Accepted
import sys
read = sys.stdin.read
#readlines = sys.stdin.readlines
from bisect import bisect_left
def main():
    n, *l = map(int, read().split())
    l.sort()
    r = n * (n - 1) * (n - 2) // 6
    for i1 in range(n - 2):
        for i2 in range(i1 + 1, n - 1):
            r -= (n - bisect_left(l, l[i1] + l[i2]))
    print(r)

if __name__ == '__main__':
    main()
# Judge status: Accepted
def main():
    A, B, C, D = input()
    for i in range(2**3):
        op = ['+', '+', '+']
        for j in range(len(op)):
            if (i >> j) & 1:
                op[j] = '-'
        if eval(A + op[0] + B + op[1] + C + op[2] + D) == 7:
            print(A + op[0] + B + op[1] + C + op[2] + D + '=7')
            break
if __name__  == '__main__':
    main()
# Judge status: Accepted
n = int(input())
#dp[j] = j￥を引き出すために必要な操作の最小回数
dp = [float('inf')]*(10**5+1)
dp[0] = 0
import math

for i in range(1,10**5+1):
    for j in range(int(math.log(i,9)+0.00001)+1):
        dp[i] = min(dp[i], dp[i-9**j]+1)

    for k in range(int(math.log(i,6))+1):
        dp[i] = min(dp[i],dp[i-6**k]+1)
 
print(dp[n])
#print(dp[n-3:n+1])
# Judge status: Wrong Answer
n = int(input().strip())
ab = [tuple(map(int, input().split())) for _ in range(n)]

mid_min = 0
mid_max = 0

ab.sort(key=lambda x: x[0])
if n & 1:
    mid_min = ab[n // 2][0]
else:
    mid_min = (ab[(n - 1) // 2][0] + ab[n // 2][0]) / 2

ab.sort(key=lambda x: x[1])
if n & 1:
    mid_max = ab[n // 2][1]
else:
    mid_max = (ab[(n - 1) // 2][1] + ab[n // 2][1]) / 2

if n & 1:
    print(mid_max - mid_min + 1)
else:
    print(int(mid_max - mid_min) * 2 + 1)
# Judge status: Wrong Answer
n,m = map(int,input().split())
drink = dict()
cost = []
ans = 0
for i in range(n):
    ab = [int(i) for i in input().split()]
    cost.append(ab[0])
    if ab[0] in drink:
        drink[ab[0]] += ab[1]
    else:
        drink[ab[0]] = ab[1]
#ここまで入力
cost.sort()
for i in cost:
    if m <= drink[i]:
        ans += m*i
        break
    else:
        m -= drink[i]
        ans += i * drink[i] 
    
print(ans)
# Judge status: Accepted
def D():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    next = a[0]
    path = [1]
    visited = [True] + [False]*(n-1)
    while not visited[next-1]:
        k -= 1
        if k==0:
            print(next)    
            break
        path.append(next)
        visited[next-1] = True 
        next = a[next-1]
    if k!=0:
        cyclic = path[path.index(next):]
        print(cyclic[k%(len(cyclic))-1])

D()
# Judge status: Accepted
A, B, C = map(int, input().split())
import fractions
c = fractions.gcd(A,B)
ans = 'NO'
if C % c == 0:
  ans = 'YES'
print(ans)
# Judge status: Accepted
from collections import deque
n = int(input())
a = list(input().split())
q = deque()
for i in range(n):
    if n&1:
        if i&1:
            q.append(a[i])
        else:
            q.appendleft(a[i])
    else:
        if i&1:
            q.appendleft(a[i])
        else:
            q.append(a[i])

for i in q:
    print(i,end=" ")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

ans = [0]*(N+1)

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

for i in range(1,N+1):
    print(ans[i])
# Judge status: Accepted
n,m = map(int, input().split())
x = sorted(list(map(int, input().split())))
d = []

for i in range(len(x)-1):
  d.append(x[i+1] - x[i])
  
d.sort()

ans = 0
for i in range(m-n):
  ans += d[i]
    
    
print(ans)
# Judge status: Accepted
from bisect import bisect_left,bisect_right
def main():
    N = int(input())
    A = sorted(list(map(int,input().split())))
    B = sorted(list(map(int,input().split())))
    C = sorted(list(map(int,input().split())))
    ans = 0
    for b in B:
        a = bisect_left(A,b)
        c = bisect_right(C,b)
        ans += a*(N-c)
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
a, b, c, d = map(int, input().split())

if abs(a-c) <= d or (abs(a-b) <= d  and abs(b-c) <= d):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
H1,M1,H2,M2,K = map(int,input().split())
print((H2-H1)*60 + (M1 - M2) - K)
# Judge status: Accepted
a = list(input())
b = list(input())
t=0

for i in range(len(a)):
  if a[i] != b[i]:
    t+=1

print(t)
# Judge status: Accepted
def lcm(x, y):
    return x / gcd(x, y) * y

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

a, b = [int(i) for i in input().split()]
print(int(lcm(a, b)))
# Judge status: Accepted
a, b = map(int, input().split())
if 0 < a < 10 and 0 < b < 10: 
    print(a * b)
else:
    print(-1)
# Judge status: Wrong Answer
from math import ceil
N, K = map(int, input().split())
n = 1
while K > 2**n:
  n += 1
ans = 0.5**n
pre = 1
for i in range(n - 1, -1, -1):
  k = ceil(K / (2**i))
  if N >= k:
    ans += (k - pre) * (0.5 ** i)
    if N == k:
      break
  else:
    ans += (N - pre) * (0.5 ** i)
    break
  pre = k
if N > K:
  ans += N - K
print(ans / N)
# Judge status: Wrong Answer
x=int(input())
for i in range(1,1000000):
  if 100*i<=x<105*i:
    print(1)
    exit()
print(0)
# Judge status: Accepted
from itertools import zip_longest
s = input()
j = input()

for x,y in zip_longest(s,j):
  if x != None and x != y:
    print("No")
    break
  if x == None:
    print("Yes")
# Judge status: Accepted
s = int(input())
apple = []
count = 0

def func_1(a):
    a = int(a)
    if a % 2 == 0:
        return int(a / 2)
    else:
        return int(3 * a + 1)

while s not in apple:
    apple.append(s)
    s = func_1(s)
    count += 1
else:
    print(count + 1)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a4 = []
a2 = []
a1 = []
for i in range(n):
    if a[i] % 4 == 0:
        a4.append(a[i])
    elif a[i] % 2 == 0:
        a2.append(a[i])
    else:
        a1.append(a[i])
if len(a4) >= n//2:
    print("Yes")
elif len(a4) + len(a2)//2 >= n//2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s1, s2, s3 = (i for i in input().split())
print(s1[0]+s2[0]+s3[0])
# Judge status: Accepted
S = input()
z = S.count("0")
o = S.count("1")

print(len(S)-abs(z-o))
# Judge status: Accepted
l = [int(input()) for _ in [0] * 6]
#print(l)
k=l.pop()
##print
if l[4] - l[0] > k:
    print(':(')
else:
    print('Yay!')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [0]*n

t = list(map(int, input().split()))
for i in range(n-1):
  c[i] = t[i]
  

x = 0
y = 0
for i in range(n):
  y += b[a[i] - 1] + x
  x = c[a[i] - 1]
print(y)
# Judge status: Wrong Answer
import numpy as  np
mod = 1000000007
n = int(input())
a = list(map(int,input().split()))
ans = 0
s = np.zeros(n)
s[0] = a[0]
for i in range(1,n):
    s[i] = s[i-1]+a[i]

for i in range(n-1):
    ans += (s[n-1]-s[i])*a[i]
    ans  = ans%mod
print(ans)
# Judge status: Accepted
N = int(input())
A = [int(input()) for _ in range(N)]
 
M = max(A)
M_index = A.index(M)
sub_M = 0
for i in range(N):
  if i != M_index: sub_M = max(sub_M, A[i])

for i in range(N):
  if i == M_index: print(sub_M)
  else: print(M)
# Judge status: Wrong Answer
def solve(n, d):
    n -= 2
    for i in range(n):
        for j in range(i + 1, n):
            if all(d[i + k][0] == d[i + k][1] for k in range(3)):
                return True
    return False


def main():
    n = int(input())
    d = [list(map(int, input().split())) for _ in range(n)]
    print("Yes" if solve(n, d) else "No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
restrante = [input().split() for i in range(N)]

for i in range(N):
    restrante[i].append(i+1)
    restrante[i][1] = int(restrante[i][1])

sorted_res= sorted(restrante, key = lambda x:(x[1]), reverse=True)
sorted_ans = sorted(sorted_res, key = lambda x:(x[0]))

for i in range(N):
    print(sorted_ans[i][2])
# Judge status: Accepted
A,B,C,D=map(int,input().split())
start=max(A,C)
end=min(B,D)
print(max(0,end-start))
# Judge status: Accepted
S=list(input())
T=list(input())
ans=0
L=len(S)
for i in range(L):
  if S[i]!=T[i]:
    ans+=1
print(ans)
# Judge status: Wrong Answer
a,b = map(int, input().split())

l= [1]
x = 0
for i in range(1,100):
    x = l[i-1] + i+1
    l.append(x)

for j in range(len(l)-1):
    if l[j+1] - l[j] == b-a:
        print(l[j] - a)
        break
# Judge status: Wrong Answer
O=input()
E=input()
for o,e in zip(O,E):
    print(o+e,end="")
# Judge status: Accepted
n,k,q = map(int, input().split())
x = [k] * (n)
for i in range(q):
    a = int(input())
    x[a-1] += 1
for i in range(n):
    if x[i] - q > 0:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
r, g, b = map(int,input().split())


RGB =  100*r + 10*g + b 

if RGB %4 ==0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
l, r = map(int, input().split())
if r - l - 1 >= 2019:
    print(0)
else:
    ans = 2019
    for i in range(r - l):
        for j in range(i + 1, r - l + 1):
            if ans > ((i + l) * (j + l)) % 2019:
                ans = ((i + l) * (j + l)) % 2019
    print(ans)
# Judge status: Wrong Answer
from fractions import gcd

A, B, C, D = map(int, input().split())
A -= 1
lcm = int(C / gcd(C, D) * D)
nA = A - (int(A/C) + int(A/D) - int(A/lcm))  
nB = B - (int(B/C) + int(B/D) - int(B/lcm))
print(nB - nA)
# Judge status: Wrong Answer
n = int(input())
l = list(map(int,input().split()))
if max(l)>= sum(l)-2*max(l):
  print("No")
else:
  print("Yes")
# Judge status: Accepted
n = input()

for i in n:
    if i=="7":
        print("Yes")
        exit()
print("No")
# Judge status: Accepted
a = int(input())
if a==0:
    print(1)
else:
    print(0)
# Judge status: Accepted
N,M  = map(int, input().split())
X  = list(sorted(map(int, input().split())))

if N >= M:
  print(0)

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

  diff.sort()
  print(sum(diff[:(M-N)]))
# Judge status: Wrong Answer
import math
import itertools
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
def distance(x1, y1, x2, y2):
    return math.sqrt((x1 - x2)**2 + (y1 - y2)**2)

dist = 0
cnt = 0
for p in itertools.permutations(range(8)):
    for i in range(n-1):
        dist += distance(xy[i][0], xy[i][1], xy[i+1][0], xy[i+1][1])
    cnt += 1
ans = dist / cnt
print(ans)
# Judge status: Accepted
# https://atcoder.jp/contests/abc086/tasks/abc086_b

def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

a, b = input().split()

i = int(a+b)

if (i ** 0.5) % 1 == 0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

s = input()
a = int(s[0] + s[1])
b = int(s[2] + s[3])
if a <= 12 and b <= 12:
    print("AMBIGUOUS")
elif a <= 12:
    print("MMYY")
elif b <= 12:
    print("YYMM")
else:
    print("NA")
# Judge status: Wrong Answer
def main():
    a, b = map(int, input().split(" "))
    a1 = a*100/8
    a2 = (a+1)*100/8
    b1 = b*10
    b2 = (b+1)*10
    if a2<b1:
        print(-1)
    else:
        print(int(max(a1,b1)))
        
    

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
ans = set()
for i in range(n,0,-1):
    count = 0
    for j in range(1,n//i+1):
        if j in ans:
            count += 1
    if count % 2 != a[i-1] :
        ans.add(i)
ans = list(ans)
ans.sort()
print(len(ans))
print(" ".join(map(str,ans)))
# Judge status: Wrong Answer
A, B, K = map(int, input().split())
candidate = [i+1 for i in range(B) if i+1 >= A and i+1 <= B]

for i in range(len(candidate)):
    if candidate[i] <= A+K or candidate[i] >= B-K:
        print(candidate[i])
# Judge status: Accepted
ABCD = list(input())

import itertools

for i in itertools.product(['+', '-'], repeat=3):
    ans = int(ABCD[0])
    # print(i)
    for idx, ii in enumerate(i):
        if ii == '+':
            ans += int(ABCD[idx+1])
        else:
            ans -= int(ABCD[idx+1])
    # print(ABCD[0]+i[0]+ABCD[1]+i[1]+ABCD[2]+i[2]+ABCD[3], ans)
    if ans == 7:
        break
print(ABCD[0]+i[0]+ABCD[1]+i[1]+ABCD[2]+i[2]+ABCD[3]+'=7')
# Judge status: Accepted
N, M = map(int, input().split())
colors = ['R'] + ['W'] * (N-1)
counts = [1]*N

def receive(color, id):
    counts[id] += 1
    if colors[id] == 'E':
        colors[id] = color
    elif color != colors[id]:
        colors[id] = 'M'

def send(id):
    color = colors[id]
    counts[id] -= 1
    if counts[id] == 0:
        colors[id] = 'E'
    return color

for i in range(M):
    x, y = map(int, input().split())
    c = send(x-1)
    receive(c, y-1)

print(sum([1 for c in colors if c == 'R' or c == 'M']))
# Judge status: Wrong Answer
import math
import operator as op
from functools import reduce
 
def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom
"""
int(input())
map(int,input().split())
list(map(int,input().split()))
"""
# Judge status: Wrong Answer
n,a,b=(int(i) for i in input().split())
p = 10 ** 9 + 7
def comb(n,k):
    nCk = 1
    MOD = 10**9+7
 
    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= MOD
 
    for i in range(1,k+1):
        nCk *= pow(i,MOD-2,MOD)
        nCk %= MOD
    return nCk
r=pow(2,n,p)-comb(n,a)-comb(n,b)-1
if r<0:
  r+=p
print(r)
# Judge status: Accepted
w = ['Sunny','Cloudy','Rainy']
i = w.index(input())
print(w[(i+1)%3])
# Judge status: Accepted
import sys

n = int(input())

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

a.sort()

max_sum = 0
for i in range(n):
    max_sum += a[3*n - 2*(i+1)]

print("{}".format(max_sum))
# Judge status: Accepted
a,v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())

distance = b - a
speed_remainder = v - w

if speed_remainder < 0:
    print("NO")
elif abs(distance) <= t * speed_remainder:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
x = int(input())

if x == 7 or x == 5 or x == 3:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
# coding=utf-8
# Date: 2020-01-08
# Author: lee215

get = lambda: int(raw_input().strip())
getl = lambda: raw_input().strip()
gets = lambda: list(map(int, raw_input().strip().split()))
getss = lambda n: [gets() for _ in range(n)]

# fi = open('sample3.in', 'r')
# raw_input = fi.readline

h, N = gets()
AB = getss(N)

dp = [0] + [float('inf')] * 100000
for a, b in AB:
    for i in range(h + 1):
        j = min(i + a, 1000000)
        dp[j] = min(dp[j], dp[i] + b)
print(dp[h])


# PyPy2 Accepted
# PyPy3 Accepted
# Python2 TLE
# Python3 TLE
# Judge status: Accepted
a=int(input())
b=a%100
c=a//100
if b<=c*11:
  print(c*111)
else:
  print((c+1)*111)
# Judge status: Accepted
n,k=map(int,input().split())
x=list(map(int,input().split()))
ans=10**25
for i in range(n-k+1):
    if x[i+k-1]<=0:
        num=x[i]*-1
    elif x[i]>=0:
        num=x[i+k-1]
    else:
        num1=abs(x[i])
        num=min(num1,x[i+k-1])*2+max(num1,x[i+k-1])
    ans=min(ans,num)
print(ans)
# Judge status: Accepted
from math import gcd
n,x = map(int, input().split())
l = sorted([x]+list(map(int, input().split())))

nums = [0]*n
for i in range(n): nums[i] = l[i+1] - l[i]

ans = nums[0]
for i in range(1,n):
  ans = gcd(ans,nums[i])
print(ans)
# Judge status: Accepted
N,K=map(int, input().split())
S=input()
comp=[]
tmp=""

for i in range(N):
  if tmp=="":
    tmp=S[i]
    cnt=1
  else:
    if S[i]==tmp:
      cnt +=1
      
  if S[i]!=tmp:
    comp.append([tmp,cnt])
    tmp=S[i]
    cnt=1
  if i==N-1:
    comp.append([tmp,cnt])
  
ans=0  
for run in comp:
  ans += run[1]-1
ans += K*2
ans = min(ans,N-1)
print(ans)
# Judge status: Accepted
a,b,c = list(map(int,input().split()))

if a>c or a+b<c:
    print("NO")
else:
    print("YES")
# Judge status: Accepted
import string
N = int(input())
C = list(input())
L = list(string.ascii_uppercase)
count = 0
for i in C:
    for j in L:
        if i == j:
            break
        count += 1
    if count + N <= 25:
        print(L[count+N], end='')
    else:
        print(L[count+N-26], end='')
    count = 0
# Judge status: Accepted
n = int(input())
s = input()
S = list(s)
r = S.count('R')
g = S.count('G')
b = S.count('B')
ans = r * g * b
for k in range(n):
        for j in range(k):
            i = 2*j - k
            if i >= 0 and i < j and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -= 1
print(ans)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
N = int(input())
if N < 105 :
    print(0)
elif N >= 105 and N<135 :
    print(1)
elif N>= 135 and N<189 :
    print(2)
else :
    print(3)
# Judge status: Accepted
# coding: utf-8
N=int(input())
X=list(map(int,input().split()))
X_=sorted(X)
M=X_[(len(X)-1)//2]
for x in X:
    if x<=M:
        print(X_[(len(X)-1)//2+1])
    else:
        print(M)
# Judge status: Accepted
n, k = map(int, input().split())
A = [None]*k
for i in range(k):
    d = int(input())
    A[i] = list(map(int, input().split()))

snuke = [0] * n
for i in range(k):
    for j in A[i]:
        snuke[j - 1] += 1

ans = 0
for i in snuke:
    if i == 0:
        ans += 1
print(ans)
# Judge status: Accepted
A, B, C = map(int, input().split())
if A < C < B or B < C < A:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip()
n = int(input())
a = list(map(int, input().split()))
ans = 0
R = {}
L = {}
for i in range(n):
    r = i + a[i]
    l = max(i - a[i], 0)
    if r in R:
        R[r] += 1
    else:
        R[r] = 1
    if l in L:
        L[l] += 1
    else:
        L[l] = 1

for k, v in R.items():
    if k in L:
        ans += v * L[k]

print(ans)
# Judge status: Accepted
n = int(input())
print(n**3/27)
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    AB = [0] * N
    for i in range(N):
        AB[i] = map(int, input().split())

    n_press = 0
    for A, B in reversed(AB):
        _, r, = divmod(A + n_press, B)
        n_press += B - r if r > 0 else 0

    ans = n_press
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
a, b = map(int, input().split())

tap = 0
outlet = 1
while(outlet < b):
    outlet -= 1
    outlet += a
    tap += 1

print(tap)
# Judge status: Accepted
N = int(input())

y = 10**N - 2*(9**N) + 8**N

y_d = y % ( 10**9 + 7 )

print(y_d)
# Judge status: Accepted
# coding:utf-8
n = int(input())
name = ''
count = 0

while n > 0:
    n -= 1
    mod = n % 26
    name += chr(97 + mod)
    n = n // 26


print(name[::-1])
# Judge status: Accepted
N = int(input())
P = list(map(int,input().split()))

ls = [""] * N
cnt = 0

for i in range(N):
  if P[i] == i + 1:
    ls[i] = "#"
  else:
    ls[i] = "."
    
if ls[-1] == "#":
  if ls[-2] == "#":
    ls[-1], ls[-2] = ".", "."
  else:
    ls[-1] = "."
  cnt += 1

for j in range(N-1):
  if ls[j] == "#":
    if ls[j+1] == "#":
      ls[j+1] = "."
    cnt += 1
    
print(cnt)
# Judge status: Wrong Answer
n, k = list(map(int, input().split()))

while(True):
    x = abs(n-k)
    print(n,k,x)
    if n < x:
        print(n)
        break
    n = x
# Judge status: Accepted
# 入力 : 数字3つ
x, a, b = map(int, input().split())

# 出力　a, b のうちxに近い方
if abs(x-a) < abs(x-b) :
    print("A")
else :
    print("B")
# Judge status: Wrong Answer
N = int(input())
a = sorted(list(map(int,input().split())),reverse=True)
print(sum(a[::2])-sum(a[1::2]))
# Judge status: Accepted
N=int(input())
c=[[0]*10 for _ in range(10)]

for A in range(1,N+1):
    Astr=str(A)
    pre=int(Astr[0])
    suf=int(Astr[-1])
    c[pre][suf]+=1
cnt=0
for i in range(10):
    for j in range(10):
        cnt+=c[i][j]*c[j][i]

print(cnt)
# Judge status: Wrong Answer
n,m = map(int,input().split())
a = 1
while a<=m:
    print(a,n)
    a+=1
    n-=1
# Judge status: Accepted
n=int(input())
a=list(map(int, input().split()))
ans = 0
l = [0]*(10**5+2)
for i in range(n):
    l[a[i]] +=1
for i in range(10**5):
    x = l[i] +l[i+1]+l[i-1]
    ans = max(ans,x)
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
leng = 0
count = 0
for ai in a:
    ans[ai-1] += 1

for i in ans:
    print(i)
# Judge status: Wrong Answer
n=input()
l=list(map(int, input().split()))
if max(l)<(sum(l)-max(l)):
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
n = int(input())
a = n//500
b = a//5
print(1000*a+b)
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
o=0
m=0
u=[0]*8
for i in a:
    if 3199<i:
        o+=1
    else:
        if u[i//400]==0:
            u[i//400]+=1
            m+=1
print(m,m+o)
# Judge status: Accepted
Time = [int(input()) for X in range(0,5)]
Loss = [(10-X%10)%10 for X in Time]
print(sum(Time)+sum(sorted(Loss)[:4]))
# Judge status: Accepted
X, Y = map(int, input().split())
n = (2 * X - Y) / 3
m = (2 * Y - X) / 3

if n < 0 or m < 0 or not n.is_integer() or not m.is_integer():
    print(0)
    exit()

n, m = map(int, [n, m])
mod = 10**9 + 7
fact = [1]
inv = [1]
for i in range(1, X + Y + 1):
    fact.append((fact[i-1] * i) % mod)
    inv.append(pow(fact[-1], mod-2, mod))

def cmb(n, r):
    return fact[n] * inv[n-r] * inv[r]

print(cmb(n+m, min(n, m)) % mod)
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Sat Apr  4 20:49:19 2020

@author: naoki
"""

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

criteria = sum(A) / (4*M)
count = 0
for i in range(N):
    if A[i] >= criteria:
        count+=1

if count >= M:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
ans_count=0
number_count=1

for i in range(len(A)):
    if A[i]==number_count:
        number_count+=1
    else:
        ans_count+=1
        
if number_count!=1:print(ans_count)
else:print("-1")
# Judge status: Accepted
l, r = map(int, input().split())
if r-l+1 >= 2019:
    print(0)
else:
    l %= 2019
    r %= 2019
    if l <= r:
        ans = float('inf')
        for i in range(l, r):
            for j in range(i+1, r+1):
                ans = min(ans, (i*j)%2019)
    else:
        ans = 0
    print(ans)
# Judge status: Accepted
n, m = map(int, input().split())

listans = [0] * n
ans = 0

for i in range(m):
    s, c = map(int, input().split())
    s -= 1
    if listans[s] == 0:
        listans[s] = c
    elif listans[s] != c:
        ans = -1
    if n > 1 and s == 0 and c == 0:
        ans = -1

if n > 1 and listans[0] == 0:
    listans[0] = 1

if ans == 0:
    ans = "".join([str(li) for li in listans])

print(ans)
# Judge status: Accepted
print(int(int(input())**0.5)**2)
# Judge status: Accepted
N = int(input())

cnt = 0
for i in range(1, N+1):
    if int(len(str(i))) % 2 == 1:
        cnt += 1
print(cnt)
# Judge status: Accepted
import fractions
a,b = map(int, input().split())
print((a * b) // fractions.gcd(a,b))
# Judge status: Wrong Answer
S = input()
T = input()
S_T_ = set(S)^set(T)
print(len(S_T_))
# Judge status: Accepted
K, X = map(int, input().split())

li = []

for i in range (2*K-1):
	li.append (X-K+i+1)

print (*li)