peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
from collections import defaultdict
n,k=map(int,input().split())
ab=[input() for i in range(n)]
d = defaultdict(list)
[d[i.split()[0]].append(int(i.split()[1])) for i in ab]
sd=sorted(d.items(), key=lambda x:x[0])
c=0
for i,l in sd:
  c+=sum(l)
  if c>=k:
    print(i)
    exit()
# Judge status: Accepted
s = input()
for i in range(len(s)+1):
    for j in range(len(s)-i+1):
        if [k for k in s[j:j+i]] == [k for k in s[j:j+i] if k=='A' or k=='G' or k=='C' or k=='T']:
            a=i
print(a)
# Judge status: Accepted
from collections import deque
def main():
  d=deque(list(input()))
  Q=int(input())
  rev=0
  for i in range(Q):
    q=list(map(str, input().split()))
    if q[0]=='1':
      rev+=1
    else:
      if (int(q[1])+rev)%2==1:
        d.appendleft(q[2])
      else:
        d.append(q[2])
  if rev%2==0:
    print(''.join(list(d)))
  else:
    d.reverse()
    print(''.join(list(d)))
main()
# Judge status: Accepted
a,b,c = map (int, input ().split ('/'))
if a > 2019:
  print ('TBD')
else:
  if b*100+c > 430:
    print ('TBD')
  else:
    print ('Heisei')
# Judge status: Accepted
def main():
    N,K = [int(x) for x in input().split()]
    prob = 0
    for i in range(N):
        dice=i+1
        coin = 0
        while dice < K:
            dice *= 2
            coin += 1
        prob += float(1/N) * 0.5**coin
    print(prob)

if __name__ == '__main__':
    main()
# Judge status: Accepted
A,B,C = map(int,input().split())
if (A < C and C < B) or (A > C and C > B):
	print('Yes')
else:
	print('No')
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())

cost = 0
if 1 <= n <= 10000 and 1 <= k <= 10000 and 1 <= y < x <= 10000:
  if n > k:
    cost += x * k
    cost += y * (n - k)
  elif n <= k:
    cost += n * x
  
print(cost)
# Judge status: Wrong Answer
A = list(map(int,input().split()))
print(A.index(0))
# Judge status: Accepted
N,A,B=map(int,input().split())
K=N//(A+B)
print(K*A+min(A,N%(A+B)))
# Judge status: Wrong Answer
n,m,k = map(int,input().split())
a = [int(i) for i in input().split()][::-1]
b = [int(i) for i in input().split()][::-1]
ans = 0
cnt = 0
while True:
    if a and b:
        if a[-1] < b[-1]: nxt = a.pop()
        else: nxt = b.pop()
    elif a: nxt = a.pop()
    elif b: nxt = b.pop()
    else: break
    if cnt + nxt > k: break
    else:
        cnt += nxt
        ans += 1
print(ans)
# Judge status: Accepted
#<ABC.145>
#<A>
import math
r = int(input())
print(r*r)
# Judge status: Accepted
s=list(input())
print(s.count("1"))
# Judge status: Wrong Answer
n = int(input())
# 100000
# 1-9 9 100-999 900 10000-99999 90000
if n <= 9:
    print(n)
    exit()
if n > 9 and n <= 999:
    print(9 + n-99)
    exit()
if n > 999 and n <= 99999:
    print(9 + 900 + n-9999)
    exit()
if n > 99999 :
    print(9 + 900 + 90000)
    exit()
# Judge status: Wrong Answer
def is_same(si, sj):
    for i in range(M):
        for j in range(M):
            if gridsA[sj + j][si + i] != gridsB[j][i]:
                return False
    return True


N, M = map(int, input().split())
gridsA = [input() for _ in range(N)]
gridsB = [input() for _ in range(M)]

for i in range(N - M):
    for j in range(N - M):
        if is_same(i, j):
            print('Yes')
            exit()
print('No')
# Judge status: Wrong Answer
S = input()
l = len(S)-1
if (l % 2 == 0):
    ls = l/2
else: 
    ls = l//2 + 1

n = 0

for x in range(int(ls)):
    if (S[x] != S[l-x]):
        S = S.replace(S[x],S[l-x])
        n +=1

print(n)
# Judge status: Wrong Answer
import itertools
n = int(input())
li = list(itertools.product([0,1], repeat=n))
alp = list('abcdefghijklmnopqrstuvwxyz')

ans_li = ['0']
for _ in range(n-1):
    tmp = []
    for a in ans_li:
        last = int(a[-1])+1
        for i in range(last+1):
            tmp.append(a+str(i))
    ans_li = tmp
for bb in ans_li:
    ans = ''
    for b in bb:
        ans += alp[int(b)]
    print(ans)
# Judge status: Accepted
a, b, x = map(int, input().split())

c=b//x
if a%x==0:
  d=a//x-1
else:
  d=a//x
print(c-d)
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a == b:
  print(a+a-1)
elif b > a:
  print(b+b-1)
else:
  print(a+a-1)
# Judge status: Accepted
x = list(map(int, input().split()))

for i in range(5):
    if x[i]==0:
        print(i+1)
        exit()
# Judge status: Accepted
#!/usr/bin/env python3
from functools import reduce
from math import gcd

n, *a = map(int, open(0).read().split())
print(reduce(gcd, a))
# Judge status: Accepted
N = int(input())

lst = []
for i in range(N):
  N, K = map(int, input().split())
  lst.append((N, K))

lst.sort(key=lambda tup: tup[1])
time = 0
for x in lst:
  time += x[0]
  if time > x[1]:
    print("No")
    exit()

print("Yes")
# Judge status: Accepted
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N = int(input())
S = [list(input()) for _ in range(N)]

minimum = [100] * 26
for i in range(N):
    tmp = [0] * 26
    for s in S[i]:
        tmp[ord(s) - ord('a')] += 1

    for j in range(26):
        minimum[j] = min(minimum[j], tmp[j])

ans = []

for i in range(26):
    for j in range(minimum[i]):
        ans.append(chr(i + ord('a')))

print("".join(ans))
# Judge status: Accepted
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n,k,q = map(int,input().split())
correct_member = [int(input())-1 for _ in range(q)]

ans = [k-q for _ in range(n)]

cormem_count = Counter(correct_member)

for k,v in cormem_count.items():
    ans[k] += v

for i in ans:
    YorN = "Yes" if i > 0 else "No"
    print(YorN)
# Judge status: Wrong Answer
A, B = map(int, input().split())
S = list(input().split('-'))
try:
    if len(S[0]) == A and len(S2[1]) == B:
        print('Yes')
    else:
        print('No')
except:
    print('No')
# Judge status: Accepted
a = list(map(int, list(input())))
f = lambda x: '+' if x==1 else '-'
for i in range(-1, 2, 2):
    for j in range(-1, 2, 2):
        for k in range(-1, 2, 2):
            if a[0]+i*a[1]+j*a[2]+k*a[3]==7:
                print(str(a[0])+f(i)+str(a[1])+f(j)+str(a[2])+f(k)+str(a[3])+'=7')
                exit()
# Judge status: Wrong Answer
n = int(input())
word = input()
ans = ""
if len(word) <= n:
  print(word)
else:
  for i in range(n):
    ans += word[i]
    ans +=("...")
  print(ans)
# Judge status: Wrong Answer
n,a,b=map(int,input().split())
cnt=0
for i in range(1,n+1):
  x=i//1000+(i%1000)//100+(i%100)//10+i%10
  if a<=x and b>=x:
    cnt+=1
print(cnt)
# Judge status: Accepted
a,b = map(int,input().split())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

A = set(prime_factorize(a))
B = set(prime_factorize(b))

cnt = 0
for i in A:
    if i in B:
        cnt += 1
print(cnt+1)
# Judge status: Wrong Answer
s = int(input())
while s >0:
  s = s-4
  if s%7 == 0:
    print('Yes')
    break
    
if s<0:
  print('No')
# Judge status: Wrong Answer
import sys
import math
N = int(input())
for i in range(int(math.sqrt(N)),2,-1):
    if N % i ==0:
        print(N//i+i-2)
        sys.exit()
print(N-1)
# Judge status: Accepted
import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
a = set([I() for _ in range(M)])
dp = [0]*(N+1) #1_indexed
dp[0] = 1
dp[1] = 0 if 1 in a else 1
for i,j in itertools.product(range(2,N+1),[1,2]):
    if i in a:
        dp[i] = 0
        continue
    dp[i] += dp[i-j]
    dp[i] %= 10**9+7
print(dp[-1])
# Judge status: Wrong Answer
import sys

n=int(input())
s=str(input())
list=[]
for i in range(1,n):
	a=s[0:i]
	b=s[i:]
	print(a)
	print(b)
	count=0
	for j in range(97,97+26):
		if (chr(j) in a)and(chr(j) in b):
			count+=1
	list.append(count)
print(max(list))
# Judge status: Accepted
n, k = map(int, input().split())
x = list(map(int, input().split()))
ans = 10 ** 9
for i in range(n-k+1):
    t = min(abs(x[i]), abs(x[i+k-1]))
    ans = min(ans, t + abs(x[i]-x[i+k-1]))
print(ans)
# Judge status: Accepted
import sys

N = int(input())
S = set()
for i in range(N):
    S.add(str(input()))


print(len(S))
# Judge status: Accepted
s = input()
l = len(s)
while len(s)>0:
    l=len(s)
    if s[l-5:]=='dream' or s[l-5:]=='erase':
        s=s[:l-5]
    elif s[l-6:]=='eraser':
        s=s[:l-6]
    elif s[l-7:]=='dreamer':
        s=s[:l-7]
    else:
        print('NO')
        exit()
print('YES')
# Judge status: Accepted
def q1():
    S,T = (s for s in input().split())
    A,B = (int(i) for i in input().split())
    U = input()

    if U == S:
        A -= 1
    elif U == T:
        B -= 1
    print('{} {}'.format(A,B))


if __name__ == '__main__':
    q1()
# Judge status: Accepted
from collections import Counter
n = int(input())
s = input()
mod = 10**9 + 7
ans = 1
scnt = Counter(s)
for cnt in scnt.values():
    ans = ans*(cnt+1) % mod

print(ans-1)
# Judge status: Wrong Answer
import math
x=int(input())
if x==60:
  print(3)
else:
  print(360//math.gcd(x,180))
# Judge status: Accepted
a,b = map(int, input().split())
if a==1:
    a+=13
if b==1:
    b+=13
if a==b:
    print("Draw")
else:
    print("Alice" if a>b else "Bob")
# Judge status: Wrong Answer
k = int(input())
a, b = map(int, input().split())

print('OK' if b - a >= k else 'NG')
# Judge status: Wrong Answer


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

if a < c < b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

ans = 99

for i in a:
    j = i
    split_count = 0
    while j % 2 == 0:
        j = j / 2
        split_count += 1
    ans = min(ans, split_count)
print(ans)
# Judge status: Accepted
# python 3.4.3
import sys
input = sys.stdin.readline
# import numpy as np
from collections import Counter

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
W = input().rstrip()

C = Counter(W).most_common()

ans = "Yes"
for _,cnt in C:
    if cnt%2 == 1:
        ans = "No"
        break

print(ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())
MOD = 10**9 + 7

if abs(n - m) > 1:
    print(0)
if n == m:
    ans = 1
    for i in range(2, n + 1):
        ans *= i
        ans %= MOD
    # xoxoxo... とoxoxox... 、どっちを先にするかで2種類
    print(2 * ans * ans % MOD)
else:
    ans = 1
    for i in range(2, n + 1):
        ans *= i
        ans %= MOD
    for i in range(2, m + 1):
        ans *= i
        ans %= MOD
    print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
W, a, b = map(int, input().split())

a_l = a
a_r = a + W
b_l = b
b_r = b + W

if b_r < a_l:
    print(abs(b_r - a_l))
elif a_r < b_l:
    print(abs(a_r - b_l))
else:
    print(0)
# Judge status: Accepted
s = input()

words = [w for w in s]

cnt = 0
for r in range(len(words) - 1):
    if words[r+1] == words[r]:
        if words[r+1] == '0':
            words[r+1] = '1'
        else:
            words[r+1] = '0'
        cnt += 1

print(cnt)
# Judge status: Accepted
n=int(input())
a=[int(i)for i in input().split()]
d=lambda x:x/2

def devide(x,lst):
    global d
    for i in lst:
        if i%2 ==1:
            return x
    return devide(x+1,list(map(d,lst)))

print(devide(0,a))
# Judge status: Accepted
n=int(input())
s=input()

tyo=0
tmax=0
for i in range(n):
  if s[i]==")":
    tyo+=1
    tmax=max(tmax,tyo)
  else:  # "("
    tyo-=1

lastkcnt=tmax+s.count("(")-s.count(")")
ans="("*tmax+s+")"*lastkcnt
print(ans)
# Judge status: Accepted
N = int(input())
dp = [i for i in range(N + 1)]

for i in range(N + 1):
    index = 1
    while 6 ** index <= i:
        dp[i] = min(dp[i], dp[i - (6 ** index)] + 1)
        index += 1

    index = 1
    while 9 ** index <= i:
        dp[i] = min(dp[i], dp[i - (9 ** index)] + 1)
        index += 1

print(dp[N])
# Judge status: Accepted
a,b,k=map(int,input().split())
wari=[]
for i in range(1,101):
    if a%i==0 and b%i==0:
        wari.append(i)

print(wari[-k])
# Judge status: Accepted
import numpy as np

D = int(input())
c = np.array(list(map(int, input().split())))
S = np.array([list(map(int, input().split())) for i in range(D)])

last_day = np.zeros(26, dtype=int)
score = 0

def calc(d, i, last_day):
    decrease = c * (d - last_day)
    decrease[i] = 0
    return S[d, i] + decrease.sum()

ans = []
for d in range(1, D+1):
    diff = [calc(d-1, i, last_day) for i in range(26)]
    choice = np.argmax(diff)
    ans.append(choice+1)
    last_day[choice] = d

print(*ans, sep='\n')
# Judge status: Accepted
from collections import deque
from bisect import bisect_left
N = int(input())
A = [int(input()) for _ in range(N)]
que = deque()
for i in range(N):
    k = bisect_left(que, A[i])
    if k == 0:
        que.appendleft(A[i])
    else:
        que[k - 1] = A[i]

print(len(que))
# Judge status: Wrong Answer
import math
N=int(input())
x=[0]*N
y=[0]*N
for i in range(N):
    x[i],y[i]=map(int,input().split())
ans_sum=0
for i in range(N):
    for j in range(N):
        ans_sum+=math.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)
print(ans_sum/math.factorial(N))
# Judge status: Accepted
from sys import stdin,stdout
# n=int(stdin.readline())
a,b,c,d=list(map(int,stdin.readline().split()))
ans=max(a*c,a*d,b*c,b*d)
print(ans)
# Judge status: Wrong Answer
n = int(input())
x = n
y = n//15
print(x-y)
# Judge status: Wrong Answer
n = int(input())
l = list(map(int,input().split()))
p1 = n//2
p2 = n//2-1
l.sort()

for i in range(n):
    if i < p1:
        print(l[p1])
    else:
        print(l[p2])
# Judge status: Accepted
from  math import * 
l = [int(input()) for _ in range(5)]

ans = 0
_min = 10
for i in l:
    ans += ceil(i/10) * 10
    if i%10!=0:
        _min = min(_min,i%10)
        
print(ans-10+_min)
# Judge status: Accepted
N, M = map(int, input().split())
max_L, min_R = 1, N
for i in range(M):
    L, R = map(int, input().split())
    if L > max_L:
        max_L = L
    if R < min_R:
        min_R = R
ans = min_R - max_L + 1
if ans < 0:
    ans = 0
print(ans)
# Judge status: Accepted
s = input()
n = len(s)

for bit in range(1 << (n-1)):
    f = s[0]

    for i in range(n - 1):
        if bit & (1 << i):
            f += "+"
        else:
            f += "-"
        f += s[i + 1]

    ans = eval(f)
    if ans == 7:
        res = f + "=7"
        break

print(res)
# Judge status: Accepted
n,a,b = map(int,input().split())
if (b-a)%2==0:
    print((b-a)//2)
else:
    ret1 = a+(b-a-1)//2
    ret2 = n-b+1+(b-a-1)//2
    print(min(ret1, ret2))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
x = a[0]
y = sum(a[i] for i in range(1, n))
ans = abs(x-y)
for i in range(1, n - 1):
    x += a[i]
    y -= a[i]
    ans = min(ans, abs(x - y))
print(ans)
# Judge status: Accepted
N = int(input())
height = [int(i) for i in input().split()]
step = 0
for i, h in enumerate(height):
    if i == 0:
        pre = h
    else:
        if h < pre:
            step += (pre - h)
            pre = pre
        else:
            step += 0
            pre = h
print(step)
# Judge status: Wrong Answer
N, K = map(int, input().split())

print(N%K)
# Judge status: Accepted
n = input()
if n[1:] == '9'*(len(n)-1):
    print(int(n[0]) + (len(n)-1)*9)
else:
    print(int(n[0])-1 + (len(n)-1)*9)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
sub = sum(a) - 2 * a[0]
asub = abs(sub)

for i in range(1, n - 1):
    sub -= 2 * a[i]
    if abs(sub) < asub:
        asub = abs(sub)
print(asub)
# Judge status: Accepted
#解説AC

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

b1, b4 = 0, 0
for a in A:
    if a % 2:
        b1 += 1
    if a % 4 == 0:
        b4 += 1

b2 = min(1, n-(b1+b4))

if b1+b2-1 <= b4:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N,A,B = map(int,input().split())

if A > B or A == B:
  print(0)
else:
  a = (N-2)*(B-A) + 1
  print(a)
# Judge status: Wrong Answer
n = int(input())
A = list(map(int, input().split()))

count = len([a for a in A if a % 4 == 0])
print(count, n // 2)
print("Yes" if count >= n // 2 else "No")
# Judge status: Accepted
h, w = map(int, input().split())
h, w = min(h, w), max(h, w)
if h == 1:
    if w == 1:
        ans = 1
    elif w == 2:
        ans = 0
    else:
        ans = w - 2
elif h == 2:
    ans = 0
else:
    ans = (h - 2) * (w - 2)
print(ans)
# Judge status: Accepted
n = int(input())

for i in range(n // 4 + 1):
  for j in range(n // 7 + 1):
    s = 4*i + 7*j
    if s > n:
      break
    if s == n:
      print("Yes")
      exit()
print("No")
# Judge status: Accepted
n, k = map(int, input().split())
r,s,p = map(int, input().split())
t = input()
z = 0
kachi = dict({"r": "p", "s": "r", "p": "s"})
tt = []
for i in range(n):
    tt.append(kachi[t[i]])
#print(t)
#print(tt)
for i in range(n - k):
    if tt[i] == tt[i + k]:
        tt[i+k] = "z"
kachi = dict({"r": r, "s": s, "p": p, "z": 0})
res = 0
for i in range(n):
    res += kachi[tt[i]]
print(res)
# Judge status: Accepted
S = list(input())
f = True
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "L":
            f = False
    elif i % 2 != 0:
        if S[i] == "R":
            f = False
if f:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
S = list(input())
T = ['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']
t = len(T)
n = len(S)
S2 = []
for i in range(n):
  for j in range(t):
    if S[i] == T[j]:
      a = T[(j+N)%t]
      S2.append(a)
      break
k = S2[0]
for i in range(1,n):
  k += S2[i]
print(k)
# Judge status: Wrong Answer
import sys
import numpy as np
import math
from collections import deque 
from functools import reduce

n = int(input())
az = "abcdefghijklmnopqrstuvwxyz"
cnt = 12
ret = []
ama = n % 26
na = n
for i in range(12, 0, -1):
    if 26**(i-1) > n:
        continue
    sho = na // (26**i)
    if sho > 0:
        ret.append(az[sho-1])
    else:
        ret.append('z')
    na -= sho * (26**i)
if ama > 0:
    ret.append(az[ama-1])
if (ret[0] == 'z'):
    del ret[0]
re = "".join(ret)
print(re)
# Judge status: Wrong Answer
N = int(input())

for i in range(N):
    if i**2 >= N:
        print((i-1)**2)
        exit()
# Judge status: Accepted
from itertools import combinations

N, X, Y = map(int, input().split())
count = [0] * N
for i, j in combinations(range(1, N+1), 2):
    k = min(j - i, abs(X - i) + 1 + abs(Y - j))
    count[k] += 1
print(*count[1:], sep='\n')
# Judge status: Accepted
n, a, b, c, d = map(int, input().split())
a, b, c, d = a-1, b-1, c-1, d-1
s = input()

if c < d:
    if "##" in s[a:d]:
        print("No")
        exit()

    print("Yes")

else:
    for i in range(b, d+1):
        if s[i] != "#" and s[i-1] == "." and s[i+1] == ".":
            print("Yes")
            exit()

    print("No")
# Judge status: Wrong Answer
N,L=map(int,input().split())
taste=0
for i in range(N):
  taste += L + i

diff=10*6
index=-1
for i in range(N):
  if abs(L+i) < diff:
    diff = abs(L+i)
    index = i
print(taste - (L+i))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
 
Alice = 0
Bob = 0
A.sort(reverse=True)
Alice += sum(A[::2])
Bob += sum(A[1::2])
print(Alice - Bob)
# Judge status: Accepted
import math
from decimal import Decimal

if __name__ == "__main__":
    L = int(input())
    hoge = L / 3 
    ret = hoge**3
    print(ret)
# Judge status: Accepted
n,m=map(int,input().split())

if n>=2 and m>=2:
    print((n-2)*(m-2))
elif n==1 and m==1:
    print(1)
else:
    print(max(n,m)-2)
# Judge status: Wrong Answer
A, B, C = map(int,input().split())
C = B//A
print(C)
# Judge status: Accepted
S = input()
result = 0
for i in range(len(S)):
    head = S[i:]
    for j in range(len(head)):
        tail = head[:j + 1]
        if len(list(filter(lambda x: x not in "ACGT", tail))) == 0:
            result = len(tail) if len(tail) > result else result
print(result)
# Judge status: Wrong Answer
from collections import deque

N=int(input())
S=input()
stack= deque([])
ans=""

for i in range(N):
  if S[i]=="(":
    stack.append(S[i])
    #print(ans)
  else:
    if stack:
      ans += stack.pop()+")"
      #print(ans)
    else:
      ans = "(" + ans + ")"
      #print(ans)
nokori=len(stack)
ans += nokori * "(" + nokori * ")"

print(ans)
# Judge status: Accepted
import bisect
s = int(input())
a = list(map(int, input().split()))
aa = sorted(a)
v = 0
m = aa[-1]
x = bisect.bisect_left(aa,m//2)
if abs(aa[x-1]) > abs(m-aa[x]):
	b = aa[x-1]
else:
	b = aa[x]
if aa[x] == m:
	x -= 1
	b = aa[x]
print (m,b)
# Judge status: Wrong Answer
import math
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
 
if w >= v:
    print('No')
else:
    for i in range(1,t+1):
        if abs(a-b) <= (w-v)*i:
            print('Yes')
            break
    print('No')
# Judge status: Accepted
from collections import defaultdict
w=list(input())

dic=defaultdict(int)
for c in w:
  dic[c]+=1
  
for v in dic.values():
  if v%2==1:
    print("No")
    break
else:
  print("Yes")
# Judge status: Accepted
import collections
n,x,y=map(int,input().split())
lst=[]
num=[0]*(n+1)
for i in range(1,n):
  for j in range(i+1,n+1):
    k=min(abs(i-j),abs(i-x)+1+abs(j-y),abs(i-y)+1+abs(j-x))
    if num[k]==0:
      num[k]+=1
    lst.append(k)
    
Lst=list(collections.Counter(lst).items())
key=0
for i in range(1,n):
  if num[i]==0:
    print(0)
  else:
    print(Lst[key][1])
    key+=1
# Judge status: Wrong Answer
A, B = map(int,input().split())

ans = 0
def palindrome(string): return 0 if string==string[::-1] else 1
for i in range(A, B):
    if palindrome(str(i)) == 0 :
        ans += 1

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


def readstr():
    return input().strip()


def readint():
    return int(input())


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


def readstrs():
    return input().split()


N, M = readnums()

'''
N:M = 1:2が理想
N + x: M -2x = 1:2
2N+2x = M-2x
M-2N=4x
'''

if M >= N * 2:
    x = (M - 2 * N) // 4
    print(N + x)
else:
    print(M // 2)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
sw = 0
count = 1
for i in range(n-1):
    if sw == 1:
        if a[i+1]<a[i]:
            sw = 0
            count += 1
    elif sw == -1:
        if a[i+1]>a[i]:
            sw = 0
            count += 1
    else:
        if a[i+1]>a[i]:
            sw = 1
        elif a[i]>a[i+1]:
            sw = -1
print(count)
# Judge status: Accepted
x = list(map(int, input().split()))
k = [list(map(int, input().split())) for i in range(x[0])]
f = 0
for i in k:
  i.pop(0)
  if f == 0:
    tmp = i
    f = 1
    s = i
  else:
    s = set(tmp) & set(i)
    tmp = s
print(len(s))
# Judge status: Accepted
N, K = map(int, input().split())
P = list(map(int, input().split()))

ans = sum([(p+1)/2 for p in P[:K]])
tmp = ans
for i in range(N-K):
    tmp = tmp - (P[i]+1)/2 + (P[K+i]+1)/2
    ans = max(ans, tmp)

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

dic = dict()

for a in A:
    if str(a) in dic:
        dic[str(a)] += 1
    else:
        dic[str(a)] = 1

res = 0
for i, cnt in dic.items():
    ii = int(i)
    if ii < cnt:
        res += cnt - ii
    elif ii > cnt:
        res += cnt

print(res)
# Judge status: Wrong Answer
N=int(input())
count=0
a=list(map(int,input().split()))
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if a[i]!=a[j]&a[j]!=a[k]:
                count+=1
print(count)