peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
S = list(input())
T = list(input())

ans = "z" * 100
for i in range(len(S) - len(T) +1)[::-1]:
  ok = True

  for j in range(len(T)):
    if S[i+j] != "?" and S[i+j] != T[j]:
      ok = False
    if ok:
      s = S[:i] + T + S[i+len(T):]
      s = "".join(s)
      ans = min(ans, s.replace("?", "a"))
      break
if ans == "z" * 100:
  print("UNRESTORABLE")
else:
  print(ans)
# Judge status: Accepted
def gap(a,b):
    x = b-a
    if x<0:
        x = 10**18
    return x

a,b = [int(i) for i in input().split()]
print(min(gap(a,b), 1+gap(a,-b), 1+gap(-a,b), 2+gap(-a,-b)))
# Judge status: Accepted
mozi=input()

if mozi.isupper() is True:
  print('A')
else:
  print('a')
# Judge status: Accepted
from math import gcd
n=int(input())
a=list(map(int,input().split()))
l=[0 for i in range(n)]
r=[0 for i in range(n)]
l[0]=a[0]
r[0]=a[-1]
for i in range(n-1):
    l[i+1]=gcd(l[i],a[i+1])
for i in range(n-1):
    r[i+1]=gcd(r[i],a[-2-i])

ans=[0 for i in range(n)]

for i in range(1,n-1):
    ans[i]=gcd(l[i-1],r[-i+n-2])
ans[0]=r[n-2]
ans[n-1]=l[n-2]

print(max(ans))
# Judge status: Accepted
a,b,c,k = map(int, input().split())

if a >= k:
    print(k)
else:
    print(a-(k-a-b))
# Judge status: Wrong Answer
n = int(input())
s = input()
x = 0
for i in range(n):
    if s[i] == "I":
        x += 1
    elif s[i] == "D":
        x -= 1
print(x)
# Judge status: Wrong Answer
k=int(input())
ans=-1
s="7"
cnt=1
if k%2!=0 and k%5!=0:
  if k%3!=0:
    ans=k-1
  else:
    while int(s)%k!=0:
      s+="7"
      cnt+=1
    ans=cnt
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
x = [0 for _ in range(n)]
for i in range(1, n + 1):
    tmp = 1
    m = i
    while (m < k):
        tmp /= 2
        m *= 2
    x[i - 1] = tmp
print(sum(x) / n)
# Judge status: Wrong Answer
A=str(input())
B=str(input())
if A[0]==B[2] and A[1]==B[1] and A[2]==B[2]:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
import numpy as np

N, K = map(int, input().split())
H = np.array(list(map(int, input().split())) + [0] * (K + 2), dtype = np.int64) 

INF = 10 ** 9
cost = np.array([INF] * (N + K + 2), dtype = np.int64)
cost[0] = 0
for i in range(N):
    cost[i + 1: i + K + 1] = np.minimum(cost[i + 1: i + K + 1], cost[i] + abs(H[i + 1: i + K + 1] - H[i]))


# print (cost)
print (cost[N - 1])
# Judge status: Accepted
n, h = map(int, input().split())
A = []
B = []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)        
    B.append(b)        

maxa = max(A)
B = [b for b in B if b > maxa]
B.sort(reverse=True)

c = 0
for b in B:
    h -= b
    c += 1
    if h <= 0:
        break

if h > 0:
    c += h//maxa + (h%maxa > 0)
print(c)
# Judge status: Wrong Answer
S = input()

a="RR"
b="RRR"
c="SSS"

if a in S:
    print(2)

elif b == S:
    print(3)
    
elif c == S:
    print(0)

else:
    print(1)
# Judge status: Accepted
n = int(input())
oddCount = len(list(filter(lambda x: x % 2 == 1, range(1,n + 1))))
print(oddCount / n)
# Judge status: Accepted
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N,X = map(int,input().split())
A = list(map(int,input().split()))
B = [0 for _ in range(N)]
for i in range(N):
    if X>A[i]:
        B[i] = X-A[i]
    else:
        B[i] = A[i]-X
D = B[0]
for i in range(1,N):
    D = gcd(D,B[i])
print(D)
# Judge status: Wrong Answer
n, m = map(int, input().split())
road = ""

for _ in range(m):
    a, b = map(str, input().split())
    road += a + b
for i in range(n):
    print(road.count(str(i+1)))
# Judge status: Accepted
X, K, D = map(int, input().split())

now = abs(X)
rest = K

step1 = min(now//D, K)
rest -= step1
now -= step1 * D

if rest <= 0:
    print(abs(now))
else:
    if rest % 2 == 1:
        now = abs(now - D)
        print(now)
    else:
        print(now)
# Judge status: Accepted
import math

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

print(a//math.gcd(a,b)*b)
# Judge status: Accepted

import math
N, K = map(int, input().split())

ans=0
for i in range(1,N+1,1):
    point = i
    count = 0
    if i>=K:
        ans +=1
    else:
        while point < K:
            point *= 2
            count += 1
        ans += 1/(2**count)

print(ans/N)
# Judge status: Accepted
s = input()
dic = {}
for i in s:
  if i in dic:
    dic[i] += 1
  else:
    dic[i] = 1
for j in dic.values():
  if j != 2:
    print('No')
    exit()
print('Yes')
# Judge status: Accepted
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

k,s = nm()
res = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            res += 1

print(res)
# Judge status: Wrong Answer
A, B, C = map(int, input().split())

if A == B == C or A != B != C:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
n,m=map(int,input().split())
lst=[]
for i in range(m):
  a,b=map(int,input().split())
  lst.append([a, b])
lst.sort()
for j in range(m):
  ans=""
  ans+="0"*(6-len(str(lst[j][0])))+str(lst[j][0])+"0"*(6-len(str(j+1)))+str(j+1)
  print(ans)
# Judge status: Wrong Answer
N, D = list(map(int, input().split()))
xy_list = list()
ans = 0
for i in range(N):
	x, y = map(int, input().split())
	if ((x, y) in xy_list):
		continue
	xy_list.append((x, y))
	if (x*x + y*y <= D*D):
		ans += 1
print(ans)
# Judge status: Accepted
input()
a = list(map(int, input().split()))
b = 0
while all(i%2==0 for i in a):
    a = [i/2 for i in a]
    b+=1
print(b)
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0

if N == 1:
  print(a[0]+b[0])
else:
  for i in range(N):
    ans_candidate =sum(a[:i])+sum(b[(i-1):])
    if ans < ans_candidate:
      ans = ans_candidate
  print(ans)
# Judge status: Wrong Answer
lst = list(map(int,input().split()))
if len(set(lst)) == 1:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
N = str(input())
k = len(N) - 1
ans = 0
for i in range (k):
 n = int (N[i])
 ans = ans + n
if ans % 9 == 0:
 print ("Yes")
else:
 print ("No")
# Judge status: Wrong Answer
N=int(input())
S=list(map(int,input().split()))
S.sort()
S.reverse()

dic={}
for i in range(N):
    tmp=S[i]
    if tmp in dic:
        dic[tmp]+=1
    else:    
        dic[tmp]=1
kouho1=0
keys = [k for k, v in dic.items() if v >= 4]
keys.sort()
keys.reverse()
for i in keys:
    kouho1=i*2

kouho2=0
keys = [k for k, v in dic.items() if v >= 2]
keys.sort()
keys.reverse()
if len(keys)>=2:
    kouho2=keys[0]*keys[1]

print(max(kouho1,kouho2))
# Judge status: Accepted
x, y = map(int, input().split())
ans = 0
if x % y == 0:
    ans = -1
else:
    ans = x
print(ans)
# Judge status: Accepted
N=int(input())
A=list(input().split())
if N%2==0:
  B=A[::-1]
  print(' '.join(B[::2])+' ' + ' '.join(A[::2]))
else:
  B=A[::-1]
  A=A[1::2]
  print(' '.join(B[::2])+' ' + ' '.join(A[:]))
# Judge status: Accepted
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
a.reverse()

if x > sum(a):
  print(n - 1)
else:
  c = 0
  while x >= a[-1]:
    x -= a.pop()
    c += 1
    if c == n:
      break
  print(c)
# Judge status: Accepted
x = int(input())
 
if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
elif 1800 <= x <= 1999:
    print(1)
# Judge status: Accepted
import sys

N=int(input())
for i in range(100//4+1):
  for j in range(100//7+1):
    if 4*i+7*j==N:
      print("Yes")
      sys.exit(0)
else:
  print("No")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
A.sort()
B = A[0::2]
b = sum(B)
C = A[1::2]
c = sum(C)
if b >= c:
  print(b-c)
else:
  print(c-b)
# Judge status: Accepted
import re

print ('AC' if re.match(r'\AA[a-z](?:[a-z]*C[a-z]*)[a-z]\Z', input()) else 'WA')
# Judge status: Accepted
s = list(input())
i = 0
for s_ in s:
    i += 1
    if i % 2 == 1:
        if not (s_ == "R" or s_ == "U" or s_ == "D"):
            print("No")
            exit()
    else:
        if not(s_ == "L" or s_ == "U" or s_ == "D"):
            print("No")
            exit()
print("Yes")
# Judge status: Wrong Answer
# from pprint import pprint
# import math
# import collections

# n = int(input())
s = input()
# n, k = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

K = 'keyence'

for i in range(len(s) + 1):
    for j in range(7 + 1):
        s1 = s[0:i]
        s2 = s[i:i + j]
        s3 = s[i + j:]

        print(s1, s2, s3)
        if s1 == K or s2 == K or s3 == K or s1 + s2 == K or s1 + s3 == K or s2 + s3 == K:
            print('YES')
            exit()

print('NO')
# Judge status: Accepted
N = int(input())
lr = []
for i in range(N):
    x,l = map(int,input().split())
    LR = [x-l,x+l]
    lr.append(LR)
lr.sort(key=lambda x:x[1])
ans = 1
rb = lr[0][1]
for i in range(1,N):
    if lr[i][0] >= rb:
        rb = lr[i][1]
        ans += 1
print(ans)
# Judge status: Wrong Answer
import sys

N,M=list(map(int,input().split()))
num = [None] * N
for i in range(M):
    s,c=list(input().split())
    if num[int(s)-1] is not None and num[int(s)-1] != c:
        print('-1')
        sys.exit()
    else:
        num[int(s)-1] = c
if N > 1 and num[0] == '0':
    print('-1')
    sys.exit()
else:
    for i in range(N):
        if num[i] == None:
            num[i] = '0' if i > 0 else '1'
print(''.join(num))
# Judge status: Accepted
from collections import Counter
n = int(input())
c = Counter(map(int, input().split()))
for i in range(1, n+1):
    print(c[i])
# Judge status: Wrong Answer
def calc(c, cnt):
    if sum(c) % 2 == 1:
        print(cnt)
        return 1
    else:
        for k, num in enumerate(c):
            c[k] = num / 2
        cnt += 1
        if calc(c, cnt) == 1:
            return 1
        

N = int(input())
c = [int(i) for i in input().rstrip().split(' ')]
calc(c, 0)
# Judge status: Accepted
N = int(input())
P = list(map(int,input().split()))
def has_duplicates(seq):
    return str(len(seq) != len(set(seq)))
if has_duplicates(P) == 'False':
  print('YES')
elif has_duplicates(P) == 'True':
  print('NO')
# Judge status: Accepted
import collections

N=int(input())
A=[]
for _ in range(N):
	A.append(input())
M=int(input())
B=[]
for _ in range(M):
	B.append(input())
A=sorted(A)
B=sorted(B)
ans=0
X=collections.Counter(A)
Y=collections.Counter(B)
for i,j in X.items():
	tmp=j
	for p,q in Y.items():
		if i==p:
			tmp=j-q
	ans=max(ans,tmp)
print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a <= 0 <= b:
    print("Zero")
elif a < 0 and b < 0:
    subs = b - a + 1
    print(subs)
    if subs % 2 == 1:
        print("Negative")
else:
    print("Positive")
# Judge status: Accepted
x=list(map(int,input().split()))
for i in range(5):
    if x[i]==0:
        print(i+1)
# Judge status: Accepted
s = input().split()

a = int(s[0])
b = int(s[1])
x = int(s[2])

def bet_ween(p, q):
    if p < 0:
        return 0
    else:
        return (p // q) + 1


fa = bet_ween(a-1, x)
fb = bet_ween(b, x)
answer = fb - fa
print(int(answer))
# Judge status: Accepted
import fractions 

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

N = int(input())
t = int(input())

for i in range(N-1):
    t = lcm(t, int(input()))
    
print(t)
# Judge status: Accepted
color = [int(i) for i in input()]
n = len(color)
ans = 0

if n%2==1:
    arfa = [1,0]*(n//2) + [1]
    beta = [0,1]*(n//2) + [0]
else:
    arfa = [1,0]*(n//2)
    beta = [0,1]*(n//2)

ansa=0;ansb=0
for i in range(n):
    if color[i]!=arfa[i]:
        ansa += 1
    if color[i]!=beta[i]:
        ansb += 1
print(min([ansa,ansb]))
# Judge status: Accepted
s = input()
k = int(input())
d = {}
dd = {}
for i, ss in enumerate('abcdefghijklmnopqrstuvwxyz'):
    d[ss] = i
    dd[i] = ss
ans = ''

for ss in s[:-1]:
    if k >= 26 - d[ss] and ss != 'a':
        k -= 26 - d[ss]
        ans += 'a'
    else:
        ans += ss
k = (d[s[-1]] + k) % 26
ans += dd[k]
print(*ans, sep='')
# Judge status: Wrong Answer
s = str(input())
 
length = len(s)
 
n = length//2
 
m = 0
 
for i in range(n):
  x = (i+1)*(-1)
  if s[i]!=s[x]:
    m += 1
print(m)
# Judge status: Accepted
N, K = map(int,input().split())
arr = list(map(int,input().split()))
ans = float('inf')
for i in range(N-K+1):
  if (arr[i+K-1]<=0)&(arr[i]<=0):
    path = abs(arr[i])
  elif (arr[i+K-1]>0)&(arr[i]<=0):
    path  = arr[i+K-1]-arr[i] + min(abs(arr[i+K-1]),abs(arr[i]))
  else:
    path  = abs(arr[i+K-1])
  
  ans = min(path,ans)

print(ans)
# Judge status: Accepted
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N, M = map(int, readline().split())
x = M * (M - 1) // 2
x += N * (N - 1) // 2
print(x)
# Judge status: Accepted
N = int(input())
S = 0
 
for i in range(1, N+1):
    if i % 3 == 0 and i % 5 == 0:
        i = "FizzBuzz"
    elif i % 3 == 0:
        i = "Fizz"
    elif i % 5 == 0:
        i = "Buzz"
    else:
        S += i
 
print(S)
# Judge status: Accepted
N, M, Q = map(int, input().split())
ABCD = [tuple(map(int, input().split())) for _ in range(Q)]
ans, A = 0, [1] * (N - 1) + [0]
while A != [M] * N:
    if A[N - 1] < M:
        A[N - 1] += 1
    else:
        c = N - 2
        while A[c] == M:
            c -= 1
        A[c] += 1
        for i in range(c + 1, N):
            A[i] = A[c]
    ans = max(ans, sum([d for a, b, c, d in ABCD if A[b - 1] - A[a - 1] == c]))
print(ans)
# Judge status: Wrong Answer
N = int(input())

A=[int(input()) for i in range(N)]

now=1-1
c=0

while c<N:
    now=A[now]-1
    c+=1
    if(now==2):
        print(now)
        break
else:
    print("-1")
# Judge status: Accepted
s = open(0).read()

a = [0]
streak = 0
# mx = 0
for c in s:
    if c == '<':
        streak += 1
#         mx = max(mx, streak)
    else:
        streak = 0
    a.append(streak)
#     a.append(mx)

b = [0]
streak = 0
# mx = 0
for c in s[::-1]:
    if c == '>':
        streak += 1
#         mx = max(mx, streak)
    else:
        streak = 0
#     b.append(mx)
    b.append(streak)
b = b[::-1]

print(sum([max(x, y)for x, y in zip(a, b)]))
# Judge status: Wrong Answer
a,b,c,d=map(int,input().split(' '))
if a>=0:
  x=b
  y=d
  ans=b*d
elif a<=0 and b>=0:
  if c>=0:
    x=b
    y=d
    ans=b*d
  elif c<=0 and d>=0:
      ans=max(a*c,b*d)
  else:
    ans=a*c
else:
  if c>=0:
    ans=b*c
  else:
    ans=a*c
print(ans)
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(100000000)

N, K = map(int, input().split())
prices = list(map(int, input().split()))
INF = 10000000000

memo = {}

def minPrice(n, k):
    if (n, k) in memo:
        return memo[(n, k)]
    if n < k:
        return INF
    if k == 0:
        return 0
    if k == 1:
        return min(prices)
    take = prices[n-1] + minPrice(n-1, k-1)
    skip = minPrice(n-1, k)
    ans = min(INF, take, skip)
    memo[(n, k)] = ans
    return ans

print(minPrice(N, K))
# Judge status: Accepted
n, k = map(int, input().split())
arr = list(map(int, input().split()))

l = 0
r = max(arr)

while l + 1 < r:
    m = (l + r) // 2

    cut = 0
    for x in arr:
        cut += (x - 1) // m

    if cut > k:
        l = m
    else:
        r = m

print(r)
# Judge status: Accepted
n=int(input(''))
a= [int(s) for s in input().split(" ")]
t=[0]*(n+1)
for i in range(0,len(a)):
        t[a[i]]+=1
for i in range(1,n+1):
    print(t[i])
# Judge status: Wrong Answer
stack = []
for s in '01B0':
    if s == '0' or s == '1':
        stack.append(s)
    if s == 'B':
        stack.pop()
print(''.join(stack))
# 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
K,A,B=map(int,input().split())
bis=1
if A>=B-1:
  bis=K+1
else:
  if (K-(A-1))%2==0:
    bis=A+(B-A)*(K-(A-1))/2
  else:
    bis=A+(B-A)*((K-(A-1))//2)+1
print(bis)
# Judge status: Accepted
z=ord('z')
a=ord('a')
ss=input()
s=list(ss)
k=int(input())
l=len(s)

for i in range(l):
    if (z-ord(s[i])+1<=k)and(s[i]!='a'):
        k-=z-ord(s[i])+1
        s[i]='a'

if k>0:
    last=(ord(s[-1])+k-a)%26+a
    s[-1]=chr(last)

ans=''.join(s)
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
if n==1 and m==1:
  ans = 1
elif min(n,m)==1:
  ans = (n*m)-2
else:
  ans = n*m-(n+m)*2+4
print(ans)
# Judge status: Accepted
x,y=map(int,input().split())
cnt=0
while x<=y:
  x*=2
  cnt+=1
print(cnt)
# Judge status: Wrong Answer
s = input()
y, m, d = map(int, s.split('/'))
if y >= 2019 and m >= 4 and d >= 30:
    print('Heisei')
else:
    print('TBD')
# Judge status: Accepted
s=input()
t=input()
sum=0
for i in range(len(s)):
  if s[i]==t[i]: 
    sum+=1
  
if sum==len(s):
  print('Yes')
else :
  print('No')
# Judge status: Wrong Answer
L=int(input())

i=1
list=[]
r=1

if(L==1):
 print("1")
else:
  while(i<L):
    j=0.1
    while(j<L):
      if(r<j*i*(L-i-j)):
        r=j*i*(L-i-j)
      j+=0.1
    i+=1
  print(r)
# Judge status: Wrong Answer
c = [list(map(int,input().split())) for _ in range(3)]
a1 = sum(c[0])
a2 = sum(c[1])
a3 = sum(c[2])
ans = "No"
for i in range(10**5):
    if (a1-i)%3 == 0 and (a2-i)%3 == 0 and (a3-i)%3 == 0:
        ans = "Yes"
        break
print(ans)
# Judge status: Accepted
A, B, C, K = map(int,input().split())

sum = 0

if A >= K:
  sum = K
elif (A + B) >= K:
  sum = A
else:
  sum = A - (K - A - B)

print(sum)
# Judge status: Wrong Answer
N = int(input())
A = int(input())

a = N % 500
if a <= A:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
from collections import deque
N, M = map(int,input().split())
graph = [[] for i in range(N + 1)]
for _ in range(M):
    A, B = map(int,input().split())
    graph[A].append(B)
    graph[B].append(A)

queue = deque([1]) 
flag = [-1] * (N + 1)

while queue: 
    node = queue.popleft()
    children = graph[node] 
    for child in children:
        if flag[child] == -1:
            flag[child] = node
            queue.append(child)

if -1 in flag[2:]:
    print('No')
else:
    print('Yes')
    print(*flag[2:], sep='\n')
# Judge status: Accepted
n = input()
ans = 0
for i in n:
    ans += int(i)
if ans%9 == 0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n,k = map(int,input().split())
s = input()

s = s.replace(s[k-1],s[k-1].lower())
print(s)
# Judge status: Wrong Answer
n = int(input())
P = list(map(int,input().split()))
ans=0

for i in range(n-1):
    if P[i-1] < P[i] < P[i+1] or P[i-1] > P[i] > P[i+1]:
        ans +=1
print(ans)
# Judge status: Accepted
n=input()
if n.count('9'):
  print('Yes')
else:
  print('No')
# Judge status: Accepted

n,a,b = map(int,input().split())
ans = pow(2,n,10**9+7)-1

inf = 10**9+7
def comb2(n,k): #素数でわるかつ数字が大きいとき 0(klogN) 10**9まで
    x,y = 1,1
    if n-k < k:
        k = n-k
    for i in range(k):
        x *= n-i
        x = x%inf
        y *= i+1
        y = y%inf
    ans = x* pow(y,inf-2,inf) %inf
    return ans

ans -= comb2(n,a) + comb2(n,b)
ans = ans%inf
print(ans)
# Judge status: Accepted
n = int(input())
ans = 'No'
for i in range(1, 10):
    for j in range(1, 10):
        if i * j == n:
            ans = 'Yes'
print(ans)
# Judge status: Wrong Answer
X=list(map(int,input().split()))
X.sort(reverse=False)
if X==[5,5,7]:
  print("YES")
else:
  print("NO")
print(X)
# Judge status: Accepted
N = int(input())

a = [int(input()) for i in range(N)]

b = a[0]
li = [0]
c = 1

while b != 2:
    li += [b-1]
    b = a[b-1]
    c += 1
    if c > N:
        print(-1)
        break
else:
    print(c)
# Judge status: Accepted
N,K=map(int,input().split())

t=N%K
ans=min(t,K-t)
print(ans)
# Judge status: Wrong Answer
import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=list(map(lambda x: x*(-1), a))
for i in range(m):
    heapq.heappush(a, heapq.heappop(a)//2)
print(sum(a)*-1)
# Judge status: Accepted
import numpy as np
H, A =map(int, input().split())
print(int(np.ceil(H / A)))
# Judge status: Wrong Answer
L,R,d = (int(x) for x in input().split())

if(d == 1):
    print(R-L+1)
else:
    a = int(R/d)
    b = int(L/d)
    print(a-b)
# Judge status: Accepted
n=int(input())
s=input()
lCurrent=rCurrent=0
l=[0]*n
r=[0]*n
ans=[0]*n

for i in range(n-1):
    if s[i]=="W":
        lCurrent+=1
    l[i+1]=lCurrent

for i in reversed(range(1,n)):
    if s[i]=="E":
        rCurrent+=1
    r[i-1]=rCurrent

ans=[x+y for x,y in zip(l,r)]
print(min(ans))
# Judge status: Accepted
import heapq
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
A = map(int, input().split())
A = list(map(lambda x: x*(-1), A))
heapq.heapify(A)

for _ in range(m):
    max_price = -heapq.heappop(A) // 2
    heapq.heappush(A, -max_price)

total = -sum(A)
print(total)
# Judge status: Accepted
a, b, k = map(int, input().split())
if k<=a:
  print(a-k, b)
elif a<=k<=a+b:
  print(0, b-(k-a))
else:
  print(0,0)
# Judge status: Wrong Answer
a, b, k = map(int, input().split())

if a != 0 and a >= k:
    a -= k
elif a != 0 and a < k:
    k -= a
    a = 0
    if b != 0 and b >= k:
        b -= k
    elif b != 0 and b < k:
        b = 0

print(a, b)
# Judge status: Accepted
s = int(input())
l = [0,0,10**9,1,10**9-(s%(10**9)),s//(10**9)+1]
if s == 10**18:
  l = [0,0,10**9,0,0,10**9]
print(*l)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
c = 0
for i in range(n):
  if a[i] != i:
    c+=1
    
if c == 0 or c == 2:
  print('YES')
  
else:
  print('NO')
# Judge status: Accepted
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

for i in range(n-m+1):
    for j in range(n-m+1):
        tmp = []
        for k in a[i:i+m]:
            tmp.append(k[j:j+m])
        if tmp == b:
            print("Yes")
            exit()
print("No")
# Judge status: Wrong Answer
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
ans,l,r = 0,0,0
for _ in range(N):
  b = int(input())
  for i in range(3):
    for j in range(3):
      if A[i][j] == b:
        A[i][j] = 1/3
        
for i in range(3):
  if sum(A[i]):
    ans = 1
  if sum([A[j][i] for j in range(3)]):
    ans = 1
  l += A[i][i]
  for j in range(3):
    if i+j == 2:
      r += A[i][j]

print('Yes' if ans or l or r else 'No')
# Judge status: Accepted
s=input()
t=input()
for i in range(len(s)):
    s=s[-1]+s[:len(s)-1]
    if s==t:
        print('Yes')
        exit()
print('No')
# Judge status: Wrong Answer
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import product, combinations, permutations
from copy import deepcopy
import sys
import numpy as np
sys.setrecursionlimit(4100000)



if __name__ == '__main__':
    print("hello")
# Judge status: Wrong Answer
n, h = map(int, input().split())
a = [0]*n
b = [0]*n
maxa = 0
for i in range(n):
    a[i], b[i] = map(int, input().split())
    maxa = max(maxa, a[i]) 
b.sort()
bsum = sum(b)
count = n

if bsum >= h:
    i = 0
    while bsum - b[i] > h:
        bsum -= b[i]
        i += 1
        count -= 1
else:
    if (h - bsum) % maxa == 0:
        count += (h - bsum) // maxa
    else:
        count += (h - bsum + 1)//maxa



print(count)
# Judge status: Accepted
w,h,n = map(int, input().split())
min_x = 0
min_y = 0
max_x = w
max_y = h
for i in range(n):
  x,y,a = map(int,input().split())
  if a == 1:
    min_x = max(min_x, x)
  elif a == 2:
    max_x = min(max_x, x)
  elif a == 3:
    min_y = max(min_y, y)
  elif a == 4:
    max_y = min(max_y, y)
print(max(0, max_x - min_x) * max(0, max_y-min_y))
# Judge status: Wrong Answer
N,M=map(int, input().split())
N_str = []
M_str = []
for i in range(N):
  n=str(input())
  N_str.append(n)
for i in range(M):
  m=str(input())
  M_str.append(m)

equal = False
  
for i in range(N-M):
  for k in range(N-M):
    each_equal = True
    for l in range(M):
      each_equal = each_equal and (N_str[i+l][k:k+M] == M_str[l])
    equal = each_equal

print(["No","Yes"][equal])