peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
x, a, b = map(int,input().split())
if abs(x - a) < abs(x - b):
    print("A")
else:
    print("B")
# Judge status: Wrong Answer
a, b = map(int, input().split())
ans = a // (b * 2 + 1) + 1
print(ans)
# Judge status: Accepted
a = int(input())
b = int(input())

arr = [0] * 4
arr[a] = 1
arr[b] = 1
for i in range(1,4):
    if arr[i] == 0:
        print(i)
# Judge status: Accepted
N = int(input())
s = [0] * N

for i in range(N):
    s[i] = input()


d = set()
for v in s:
    d.add(v)

print(len(d))
# Judge status: Accepted
import sys
N = int(input())
S = input()

if not ( 1 <= N <= 100 ): sys.exit()
if not S.islower(): sys.exit()
if not ( len(S) == N ): sys.exit()
if N % 2 == 1: print('No'); sys.exit()
print('Yes') if ( S[:N//2] + S[:N//2] == S ) else print('No')
# Judge status: Accepted
n=int(input())
a=sorted(list(map(int,input().split())))
ans=(a[0]+a[1])/2
for i in range(2,len(a)):
    ans=(ans+a[i])/2
print(ans)
# Judge status: Accepted
import math
n = int(input())

print(math.factorial(n) % (10 ** 9 + 7))
# Judge status: Accepted
a,b,c=map(int,input().split())
if c >=a and c <= b:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n,w=map(int,input().split())
wv=[]
for i in range(n):
    wv.append(tuple(map(int,input().split())))
dp=[[0]*(w+1) for _ in range(n+1)]
for i in range(1,n+1):
    wei,val=wv[i-1]
    for j in range(1,w+1):
        if 0<=j-wei<=w:
            dp[i][j]=max(dp[i-1][j], dp[i-1][j-wei]+val)
        else:
            dp[i][j]=dp[i-1][j]
print(dp[-1][-1])
# Judge status: Accepted
n, m= map(int, input().split())

flag_ac = [0]*n
cnt_wa = [0]*n
cnt_penalty = 0

for _ in range(m):
    p, s = input().split()
    if s == "WA":
        cnt_wa[int(p)-1] += 1
    elif s == "AC" and flag_ac[int(p)-1] == 0:
        flag_ac[int(p)-1] = 1
        cnt_penalty += cnt_wa[int(p)-1]
        
print(sum(flag_ac), cnt_penalty)
# Judge status: Accepted
import math
n = int(input())
a = list(map(int,input().split()))
b = sorted(a,reverse=True)

x = math.ceil(len(b)/2)
y = b[:x]
z = sum(y*2)-y[0]
if len(b)%2==1:
    print(z-y[-1])
else:
    print(z)
# Judge status: Wrong Answer
n = int(input())

pv = []
con = 0

while n > 0:
    n -= 1
    s = str(input())
    d = s.split()
    if d[0] == d[1]:
        con += 1
    else:
        pv += [con]
        con = 0

pv += [con]
ans = max(pv)

if ans >= 3:
    print('Yes')
else:
    print('NO')
# Judge status: Accepted
s = input()
if len(s) == 3:
  print(s)
  exit()
print(s[0:3])
# Judge status: Wrong Answer
A,B = [int(x) for x in input().split()]
 
number1 = int(A*100//8)
number2 = int(B*100//10)
 
if number1//10 == B:
    if number2*8//100 == A:
        if number1 <= number2:
            print(number1)
        else:
            print(number2)
    else:
        print(number1)
else:
    if number2*8//100 == A:
        print(number2)
# Judge status: Wrong Answer
r = int(input("long?"))
a = int(r^2)
print(a)
# Judge status: Accepted
N, K = map(int, input().split())
li = sorted([tuple(map(int, input().split())) for _ in range(N)])
cnt = 0
for a, b in li:
    cnt += b
    if cnt >= K:
        print(a)
        break
# 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
print(ans)
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
c = 0
t = a[0]
for i in a:
  if t>i:
    b=t-i
    c+=b
  else:
    t=i

	
print(c)
# Judge status: Accepted
N=input()

if '7' in N:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import numpy as np

S = str(input())

r = '01'
b = '10'

count=0
i=0
while i < (len(S)-1):
    if r == S[i:i+2]:
        S = S.replace(r,'',1)
        count+=1
        i=0
    if b == S[i:i+2]:
        S = S.replace(b,'',1)
        count+=1
        i=0
    else:
        i+=1
        
print(int(2*count))
# Judge status: Wrong Answer
N = int(input())

for i in range(1, N // 4 + 1):
    for j in range(1, N // 7 + 1):
        if (4 * i) + (7 * j) == N:
            print('Yes')
            exit()
print('No')
# Judge status: Accepted
import heapq
n, h = map(int, input().split())

hq = []
nmax = 0
for i in range(n):
    a, b = map(int,input().split())
    nmax = max(nmax, a)
    heapq.heappush(hq, -b)
heapq.heappush(hq, -nmax)

ans = 0
while h > 0:
    d = -heapq.heappop(hq)
    if d == nmax:
        ans+=max(0, (h+nmax-1)//nmax)
        break
    else:
        h -= d
        ans+=1
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = [list(map(int,input().split())) for _ in range(2)]
ans = []
max = 0
for i in range(1,N):
    s = sum(A[0][0:i])+sum(A[1][i-1:N])
    if s > max:
        max = s
print(max)
# Judge status: Wrong Answer
A,B,C,K=map(int,input().split())
if A+B>=K:
    print(A)
else:
    print(A*2-K+B)
# Judge status: Accepted
n, a, b = map(int, input().split())
if n == 0 or b < a or (n == 1 and a != b):
    print(0)
elif n == 1 and a == b:
    print(1)
else:
    print(1+(b-a)*(n-2))
# Judge status: Accepted
(A, B, M) = (int(x) for x in input().split(' '))

#print(A, B, M)
ai = [int(x) for x in input().split(' ')]
bj = [int(x) for x in input().split(' ')]
ck = []
for k in range(int(M)):
  ck.append([int(x) for x in input().split(' ')])

amin = min(ai)
bmin = min(bj)
abmin = amin + bmin
#print(abmin)

for cupon in ck:
  ac = ai[cupon[0]-1]
  bc = bj[cupon[1]-1]
  cost = ac + bc - cupon[2]
#  print(cost)
  if cost < abmin:
    abmin = cost

print(abmin)
# Judge status: Wrong Answer
s = input()
a = s.find("A")
z = s. find("Z")
print(z - a + 1)
# Judge status: Accepted
MOD = 1000000007
import math

N = int(input())
print(math.factorial(N)%MOD)
# Judge status: Accepted
n, r = list(map(int, input().split()))
print(r if n >= 10 else r + (100 * (10 - n)))
# Judge status: Accepted
S = input().strip()
C = {"N":0,"S":0,"E":0,"W":0}
for i in range(len(S)):
    C[S[i]] += 1
if (C["N"]*C["S"]>0 or (C["N"]==0 and C["S"]==0)) and (C["E"]*C["W"]>0 or (C["E"]==0 and C["W"]==0)):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
x = n * 800
y = n // 15 * 200
print(x - y)
# Judge status: Accepted
a, b, c = map(int, input().split())
if a + b + c == max(a, b, c) * 2:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import re

S = input()

rrr = S.count("RRR")
rr = S.count("RR")
r = S.count("R")

if rrr == 1:
    print(3)
elif rr == 1:
    print(2)
elif r == 1 or r == 2:
    print(1)
else:
    print(0)
# Judge status: Accepted
N,P = map(int, input().split())
A = list(map(int, input().split()))

dp = [[0 for _ in range(2)] for _ in range(N+1)]
dp[0][0] = 1

for i in range(1,N+1):
	if A[i-1]%2 == 0:
		dp[i][0] = 2*dp[i-1][0]
		dp[i][1] = 2*dp[i-1][1]
	else:
		dp[i][0] = dp[i-1][0] + dp[i-1][1]
		dp[i][1] = dp[i-1][0] + dp[i-1][1]

print(dp[N][P])
# Judge status: Accepted
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
  
K = int(input())
A = B = C = [i for i in range(1, K+1)]

L = [gcd(a,b) for a in A for b in B]

cnt = sum([gcd(l,c) for l in L for c in C])   
print(cnt)
# Judge status: Accepted
n,k=map(int,input().split())
d={}
l=[]
num=0
for i in range(n):
    a,b=map(int,input().split())
    try:
        d[a]+=b
    except:
        d[a]=b
        l.append(a)
l.sort()

for i in range(len(l)):
    num+=d[l[i]]
    if num>=k:
        print(l[i])
        break
# Judge status: Wrong Answer
Q, H, S, D = map(int, input().split())
N = int(input())

s = [(Q / 0.25, 0.25), (H / 0.5, 0.5), (S, 1.0), (D / 2, 2.0)]
s.sort()
ans = 0
for i in range(4):
    ans += (N // s[i][1]) * (s[i][0] * s[i][1])
    N %= s[i][1]
print(int(ans))
# Judge status: Accepted
a, b, c, k = map(int, input().split())

if abs(a - b) > 10 ** 18:
	print("Unfair")
else:
	if k % 2 == 0:
		print(a - b)
	else:
		print(b - a)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

ans = (sum(a)%2) * 2

print(ans)
# Judge status: Accepted
w,h,n=map(int,input().split())
p,q,r,s=0,w,0,h
for i in range(n):
  x,y,a=map(int,input().split())
  if a==1:
    p=max(p,x)
  elif a==2:
    q=min(q,x)
  elif a==3:
    r=max(r,y)
  elif a==4:
    s=min(s,y)
print(max(0,q-p)*max(0,s-r))
# Judge status: Wrong Answer
a,b=map(int,input().split())
if (a>b):
  print('Alice')
elif (b>a):
  print('Bob')
else:
  print('draw')
# Judge status: Accepted
s = input()

ans = ''
for c in s:
    if c == '0':
        ans += '0'
    if c == '1':
        ans += '1'
    if c == 'B':
        ans = ans[:-1]

print(ans)
# Judge status: Accepted
A, B, C, X, Y = list(map(int, input().split()))
C *= 2

min_cost = float('inf')
for ab in range(max(X + 1, Y + 1)):
    cost = ab * C
    cost += A * max(0, X - ab)
    cost += B * max(0, Y - ab)
    if min_cost > cost:
        min_cost = cost
print(min_cost)
# Judge status: Wrong Answer
x,k,d=map(int,input().split())
n=max(round(k/2-x/(2*d)),0)
print(min(abs(x+(2*n-k)*d),abs((k-2*n)*d-x)))
# Judge status: Wrong Answer
n,m=map(int,input().split())
gakusei=[]
for i in range(n):
  gakusei.append(list(map(int,input().split())))
check=[]
for j in range(m):
  check.append(list(map(int,input().split())))
for i in range(0,n):
  minkyori=10*100
  keep=0
  for j in range(0,m):
    kyori=abs(gakusei[i][0]-check[j][0])+abs(gakusei[i][1]-check[j][1])
    if kyori<minkyori:
      minkyori=kyori
      keep=j
  print(keep+1)
# Judge status: Wrong Answer
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

r1 = []
for j in range(N):
	if T[j] == 'r':
		r1.append(P)
	elif T[j] == 's':
		r1.append(R)
	else:
		r1.append(S)

for i in range(K,N):
	if r1[i] == r1[i - K]:
		r1[i] = 0
print(sum(r1))
# Judge status: Wrong Answer
n,k=map(int,input().split(" "))
A=list(map(int,input().split(" ")))

B=[0 for i in range(n)]
for i in range(k):
  for j in range(n):
    B[j]=0
    d=A[j]
    mi=j-d
    ma=j+d
    if mi<=0:
      mi=0
    if ma>=n:
      ma=n-1
    while mi<=ma:
      B[mi]=B[mi]+1
      mi=mi+1
  A=B
for i in range(int(len(A))):
  print(A[i],end="")
  if i!=int(len(A)):
    print(" ",end="")
# Judge status: Wrong Answer
A,B,C=map(int,input().split())
if (A+B*2)>=C:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
l=list(map(int,input().split()))
l.sort()
print(l[0]*l[1]//2)
# Judge status: Accepted
N, M = [int(_) for _ in input().split()]
l = 1
r = N
ans = []
for _ in range(M - M // 2):
    ans += [l, r]
    l += 1
    r -= 1
if (r - l) % 2 == (l + N - r) % 2:
    r -= 1
for _ in range(M // 2):
    ans += [l, r]
    l += 1
    r -= 1
ans = ans[:2 * M]
print('\n'.join(f'{a} {b}' for a, b in zip(ans[::2], ans[1::2])))
# Judge status: Accepted
S = input()
if S[0] == "A":
    if (S.count("C") == 1) and (S[2:-1].count("C")==1):
        S = S[1:].replace("C", "")
        if S.islower():
            print("AC")
            exit(0)

print("WA")
# Judge status: Accepted
#ABC-115-A
D = int(input())
add_eve = 25-D

print("Christmas"+" Eve"*add_eve)
# Judge status: Accepted
S = input()
count = len(S)
a = 0
for i in range(count):
    if S[i] in S[i+1:]:
        a = a+1
    else:
        pass
if a>0:
    print("no")
else:
    print("yes")
# Judge status: Wrong Answer
from collections import Counter

n = int(input())
l = [Counter(input()) for _ in range(n)]

ans = ''
c = l[0]

for key, val in c.most_common():
    m = val
    for i in range(1, n):
        m = min(m, l[i][key])
    ans += key * m

print(ans)
# Judge status: Wrong Answer
n=int(input())
p=list(map(int,input().split()))
a=0
for i in range(1,n-1):
  if p[i-1]<p[i]<p[i+1]:
    a+=1
print(a)
# Judge status: Wrong Answer
x = int(input())-1
ans = 2 * (x // 11)
if x % 11 > 5:
  ans += 2
elif 0 < x % 11 and x % 11 < 6:
  ans += 1
  
print(ans)
# Judge status: Wrong Answer
import sys
def input():
    return sys.stdin.readline()[:-1]
H,N=map(int,input().split())
l=[1000000000]*(H+1)
l[0]=0
for i in range(N):
    A,B=map(int,input().split())
    for j in range(H):
        if j+A<=H and l[j]+B<l[j+A]:
            l[j+A]=l[j]+B
    t=1000000000
    for j in range(H,-1,-1):
        if l[j]>t:
            l[j]=t
        else:
            t=l[j]
print(l[-1])
# Judge status: Wrong Answer
s = int(input().replace('/',''))
print('Heisei') if s <= 2019430 else('TBD')
# Judge status: Accepted
from operator import itemgetter
N=int(input())
hako=[]
for i in range(N):
    A,B=input().split()
    hako.append([A,int(B)*-1])
kari=hako.copy()
#print(kari)
hako.sort()
#print(hako)
for i in range(N):
    print(kari.index(hako[i])+1)
# Judge status: Accepted
import math

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

sX = sum(X)
kouho1 = math.ceil(sX / N)
kouho2 = sX // N
kouho3 = math.floor(sX / N)


ans1, ans2, ans3 = 0, 0, 0
for p in X:
    ans1 += (p - kouho1) ** 2
    ans2 += (p - kouho2) ** 2
    ans3 += (p - kouho3) ** 2

print(min(ans1, ans2, ans3))
# Judge status: Accepted
# C - Repsept
def get_mod(prev_mod):
	global K
	
	return (prev_mod * 10 + 7) % K


K = int(input())
mod = 0
count = 0
mods = set()

while True:
	mod = get_mod(mod)
	count += 1
	
	if mod == 0:
		print(count)
		break
	else:
		if mod in mods:
			print(-1)
			break
		else:
			mods.add(mod)
# Judge status: Accepted
N, M = map(int, input().split())
H = list(map(int, input().split()))

adj = [list() for _ in range(N)] # 頂点の個数
for _ in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    adj[A].append(B)
    adj[B].append(A)


def is_higher(i):
    for j in adj[i]:
        if H[i] <= H[j]:
            return False
    return True

cnt = 0
for i in range(N):
    if is_higher(i):
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
n = int(input())

c = ord("a")
l = ""
while not n < 26:
    b = n//26
    a = n-26*b
    n = b
    l = l+chr(c+a-1)
l = l+chr(c+n-1)
print(l[::-1])
# Judge status: Accepted
today = input()
if today == 'Sunny':
    print('Cloudy')
elif today == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
# Judge status: Wrong Answer
n,k = map(int,input().split())
h = list(map(int,input().split()))

# dp[i] = 足場i(0~n-1)に到着するコストの最小値
dp = [10*18]*(n)
dp[0] = 0

for i in range(n) :
    for j in range(1,k+1) :
        if i+j >= n :
            continue
        dp[i+j] = min(dp[i+j],dp[i]+abs(h[i]-h[i+j]))

print(dp[n-1])
# Judge status: Accepted
import numpy as np

n = int(input())
a = input().split()
np_a=np.array(a, dtype=int)

sum=np.int(sum(np_a))
count=np.zeros(100001, dtype='int64')
for i in range(0,n):
  count[np_a[i]]+= 1
  
q = int(input())
for i in range(0,q):
  b, c= map(int, input().split())
  sum=sum+(c-b)*count[b]
  count[c]=count[c]+count[b]
  count[b]=0
  
  print (sum)
# Judge status: Wrong Answer
import sys
stdin = sys.stdin
import itertools

mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

N = ni()
A = list()
for _ in range(N):
    A.append(ni())
cnt = 0
for i in range(N-1):
    ccnt = (A[i] + A[i+1]) //2
    A[i+1] = max(0, A[i+1] - ccnt*2 - A[i])
    A[i] = max(0, A[i] - ccnt*2)
    cnt += ccnt
print(cnt)
# Judge status: Accepted
a,b=map(int,input().split())
n=(a*(a-1))//2
m=(b*(b-1))//2
if b<2 and a<2:
  print(0)
elif b<2:
  print(n)
else:
  print(n+m)
# Judge status: Accepted
def main():
    s = input()
    k = int(input())

    m = 0
    ans = ""

    for i in range(len(s)):
        if s[i] != "1":
            m = i+1
            ans = s[i]
            break
    
    if k < m:
        print(1)
    elif m == 0:
        print(1)
    else:
        print(int(ans))



if __name__ == "__main__":
    main()
# Judge status: Accepted
a=int(input())
for i in range(1,10):
    if a%i==0 and a//i<10:
        print("Yes")
        exit()
print("No")
# Judge status: Wrong Answer
def main():
    a,b = map(int, input().split())
    sum = 0
    
    for height in range(1,999):
        sum += height
        if b-a == height:
            print(sum-b)
            break;
        
if __name__ == "__main__":
    main()
# Judge status: Accepted
N=int(input())
S=0
i=0
while S<N:
    i+=1
    S+=i

T=set()
for a in range(i,0,-1):
    if N>=a:
        T.add(a)
        N-=a

print("\n".join(map(str,T)))
# Judge status: Wrong Answer
n = int(input())
s = set(input())
t = set(input())

print(n + n - len(s & t))
# Judge status: Accepted
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("YES") if fl else print("NO")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil
s = list(input())
co = collections.Counter(s)
ls = []
for w in ["a","b","c"]:
    ls.append(co[w])
mx = max(ls)
f=True
for c in ls:
    if mx > c+1:
        f=False
yn(f)
# Judge status: Accepted
import sys
input = sys.stdin.readline

X,Y,A,B,C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
p = p[A-X:]
q.sort()
q = q[B-Y:]
r.sort()
a = p+q+r
a.sort(reverse=True)
print(sum(a[:X+Y]))
# Judge status: Accepted
A = list()
for i in range(3):
  A.append([int(j) for j in input().split()])

N = int(input())
for i in range(N):
  b = int(input())
  for j in range(3):
    for k in range(3):
      if b == A[j][k]:
        A[j][k] = 0

flg = 0
for i in range(3):
  if sum(A[i]) == 0:
    flg = 1
  if A[0][i]+A[1][i]+A[2][i] == 0:
    flg = 1
  
if A[0][0]+A[1][1]+A[2][2] == 0:
  flg = 1
if A[2][0]+A[1][1]+A[0][2] == 0:
  flg = 1

print("Yes" if flg==1 else "No")
# Judge status: Accepted
ary1 = list(map(int,input().split()))
ary2 = sorted(ary1)
print((ary2[0]*ary2[1])//2)
# Judge status: Accepted
from collections import Counter
MOD = 1000000007
N = int(input())
S = input()

count = Counter(S)
ans = 1
for k, v in count.items():
    ans *= (v+1)
    ans %= MOD
print((ans - 1) % MOD)
# Judge status: Accepted
n,m=map(int,input().split())
m_root=int(m**0.5)
div_l=[]
ans=0

for i in range(1,m_root + 1):
    if m%i == 0:
        div_l.append(i)
        div_l.append(m//i)

if m//n in div_l:
    ans = m//n
else:
    div_l.append(m//n)
    div_l.sort()
    ans = div_l[div_l.index(m//n) - 1]
print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())
P = [list(map(int,input().split())) for _ in range(n)]
C = [list(map(int,input().split())) for _ in range(m)]

for i in range(n):
  d = 9999
  t = 0
  for j in range(m):
    dist = abs(P[i][0]-C[j][0]) + abs(P[i][1]-C[j][1])
    if d > dist:
      t = j
      d = dist
  print(t+1)
# Judge status: Accepted
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input().rstrip())
# if (i)th == (i-K)th: point=0
for i in range(K,N):
  if T[i] == T[i-K]:
    T[i] = 'o'
    
point = 0
for t in T:
  if t == 'r':
    point += P
  elif t == 's':
  	point += R
  elif t == 'p':
    point += S

print(point)
# Judge status: Wrong Answer
N = int(input())
H = list(map(int,input().split()))
max_count = 0
count = 0
for i in range(N-1):
    if H[i+1]-H[i]<=0:
        count+=1
    else:
        if max_count<count:
            max_count = count
            count = 0
if max_count<count:
    max_count = count
print(max_count)
# Judge status: Wrong Answer
K, S = map(int, input().split())

count = 0
for i in range(K+1):
    for j in range(K+1):
        if(K >= S-(i+j) >= 0):
            count += 1
            print(i, j, S-(i+j))
# Judge status: Accepted
S, T = input().split()
A, B = map(int, input().split())
U = input()

if S == U:
    A -= 1
else:
    B -= 1

print(A,B)
# Judge status: Accepted
N = int(input())

DP = [[0, 0, 0] for _ in range(N+1)]

for i in range(1, N+1):
    a, b, c = map(int, input().split())
    DP[i][0] = max(DP[i - 1][1] + a, DP[i - 1][2] + a)
    DP[i][1] = max(DP[i - 1][0] + b, DP[i - 1][2] + b)
    DP[i][2] = max(DP[i - 1][0] + c, DP[i - 1][1] + c)


print(max(DP[N]))
# Judge status: Accepted
s = input()
count = 0

for i in s:
    if i =='1':
        count += 1

print(count)
# Judge status: Wrong Answer
x,y = map(int,input().split())
if x<=y:
  print(y-x)
else:
  if abs(x)<=abs(y):
    if x>=0 and y<0:
      print(abs(y)-x+1)
    elif x<0 and y<0:
      print(abs(y)-abs(x)+2)
  else:
    if x>=0 and y<0:
      print(x+y+1)
    elif x>=0 and y>=0:
      print(x-y+2)
# Judge status: Accepted
a=int(input())
b=list(map(int,input().split()))
c=sum(b)
d=0
e=0
f=0
for i in range(a):
  d=d+b[i]
  if d>=c/2:
    e=i
    break
for i in range(e):
  f=f+b[i]
if abs(d-(c-d))<abs(f-(c-f)):
  print(abs(d-(c-d)))
else:
  print(abs(f-(c-f)))
# Judge status: Accepted
# -*- coding: utf-8 -*-
 
mass=list(input())
count=0
 
for i in mass:
  if i=='1':
    count+=1
    
print(count)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if a<c<b:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
al = ["a","b","c","d","e","f","g","h","i","j","k","l","m", "n","o","p","q","r","s","t","u","v","w","x","y","z"]
N = int(input())
ans = ""
while N > 0:
    r = N%26
    N = int(N/26)
    if r == 0:
        ans = al[25] + ans
    else:
        ans = al[r-1] + ans
print(ans)
# Judge status: Accepted
import sys
def I(): return int(sys.stdin.readline().rstrip())

print('YES' if I() in [3,5,7] else  'NO')
# Judge status: Accepted
import sys
input = sys.stdin.readline

n, m = [int(x) for x in input().split()]
ans = 0

if 2*n <= m:
    ans += n
    m -= 2*n
    ans += m // 4

else:
    ans += m // 2

print(ans)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
OD=0
EV4=0
for i in A:
  if i%2==1:
    OD+=1
  elif i%4==0:
    EV4+=1
EV=N-OD-EV4
ret = 'No'
if EV4>=OD:
  ret='Yes'
elif EV4==OD-1 and EV==0:
  ret='Yes'
print(ret)
# Judge status: Accepted
a, b = map(int, input().split())
cnt = 0

for i in range(a, b+1):
    x = str(i)
    if x == x[::-1]:
        cnt += 1

print(cnt)
# Judge status: Accepted
h1, m1, h2, m2, k = map(int, input().split())
start = h1*60+m1
end = h2*60+m2
print(end-start-k)
# Judge status: Accepted
def main():
    input()
    s = input()
    ans = []
    for i in range(1, len(s)):
        left = set(s[:i])
        right = set(s[i:])
        ans.append(len(left & right))
    print(max(ans))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n,m = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
i = ar.index(1)
count = 0
if i % (m - 1) == 0:
    count += i // (m - 1)
else:
    count += i // (m - 1) + 1
if (n - 1 - i) % (m - 1) == 0:
    count += (n - 1 - i) // (m - 1)
else:
    count += (n - 1 - i) // (m - 1) + 1
print(count)
# Judge status: Accepted
n = int(input())

i = 1

while i*2 <= n:
    i *= 2
    
print(i)
# Judge status: Accepted
N = list(map(int,input()))
ans = sum(N)
ans1 = 0
if N[0] == 1:
  for i in range(len(N)-1):
    ans1 += 9
  print(max(ans,ans1))
else:
  for i in range(len(N)):
    if i == 0:
      ans1 += N[i]-1
    else:
      ans1 += 9
  print(max(ans, ans1))
# Judge status: Accepted
s = list(input())
k = ["k", "e", "y", "e", "n", "c", "e"]
ans = []
i = 0
while s[i] == k[i]:
    ans.append(s[i])
    i += 1
    if i == 7:
        break
for j in range(len(s) - 7 + i, len(s)):
    ans.append(s[j])

jud = True
for j in range(7):
    if ans[j] != k[j]:
        jud = False
if jud:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
import bisect
import collections
import sys

sys.setrecursionlimit(100000)
input = sys.stdin.readline
ACMOD = 1000000007
INF = 1 << 62


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


def llmi(n):
    return [lmi() for _ in range(n)]


N = int(input())
A = lmi()
Ay = [a - i for i, a in enumerate(A)]
Ax = [a + i for i, a in enumerate(A)]
# print(Ax,Ay)

d = collections.defaultdict(int)
ans  =0
for i in range(N):
    # check Ay
    ans += d[Ay[i]]
    # update d
    d[-Ax[i]] += 1
print(ans)
# Judge status: Accepted
from collections import Counter
n = int(input())
A = list(map(int, input().split()))
a = Counter(A)
q = int(input())
BC = [list(map(int, input().split())) for _ in range(q)]
ans = sum(A)
for b,c in BC:
    ans -= b*a[b] - c*a[b]
    if c in a:a[c] += a[b]
    else: a[c] = a[b]
    a[b] = 0
    print(ans)
# Judge status: Accepted
S = input()
n = len(S)
print('x'*n)