peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
S=sorted(set(list(str(input()))))
alf='abcdefghijklmnopqrstuvwxyz'
if len(S)==26:
  print('None')
else:
  for i in range(26):
    if alf[i] not in S:
      print(alf[i])
      break
# Judge status: Wrong Answer
import numpy as np
a, b ,x = map(float, input().split())
n = x/a
s = np.degrees([np.arctan(np.power(b, 2.0)/(2*n)), np.arctan(2*n*np.power(a, -2.0))])
print(s[0] if np.arctan(a/b)<s[0] else s[1])
# Judge status: Wrong Answer
H,W=list(map(int,input().split()))
if H==1 or W==1:
   print(H*W-2)
   exit()
futi=(H+W)*2-4
print(H*W-futi)
# Judge status: Accepted
a, b = map(int, input().split())

if a > 0:
    print('Positive')
elif a <= 0 and 0 <= b:
    print('Zero')
else:
    if (b - a + 1) % 2 == 0:
        print('Positive')
    else:
        print('Negative')
# Judge status: Accepted
N=int(input())
r=[0]*10000
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            v = i*i + j*j + k*k + i*j + i*k + k*j
            if v <= 10000:
                r[v-1] += 1
for i in range(N):
    print(r[i])
# Judge status: Accepted
n,m=map(int,input().split())
if n==1 and m==1:print(1)
elif n==1:print(m-2)
elif m==1:print(n-2)
else:print((n-2)*(m-2))
# Judge status: Accepted
n,x = map(int,input().split())
li = list(map(int,input().split()))

dist = 0

for i,d in enumerate(li,2):
  dist += d
  if dist > x:
    i -= 1
    break

print(i)
# Judge status: Accepted
def is_ans(n:int) -> int:
    count = 0
    for i in range(1,n+1):
        if n%i == 0:
            count += 1
    return count

def main():
    tmp = 0
    ans = 0
    n = int(input())
    for i in range(1,n+1):
        if i%2 == 1:
            tmp = is_ans(i)
        if tmp == 8:
            ans += 1
        tmp = 0
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
A,B,C = input().split()
print(A[0]+B[0]+C[0])
# Judge status: Accepted
k, x = map(int, input().split())

if 500 * k >= x:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
l = int(input())
x = [[0,0,0] for i in range(l)]
x[0] = list(map(int,input().split()))

for i in range(1,l):
    z = list(map(int,input().split()))
    x[i][0] = max(z[0]+x[i-1][1],z[0]+x[i-1][2])
    x[i][1] = max(z[1]+x[i-1][0],z[1]+x[i-1][2])
    x[i][2] = max(z[2]+x[i-1][0],z[0]+x[i-1][1])

print(max(x[-1]))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

left_gcd = [0]*(n+1)
right_gcd = [0]*(n+1)
left_gcd[1] = a[0]
right_gcd[1] = a[-1]


for i in range(1,n):
    left_gcd[i+1] = gcd(left_gcd[i],a[i])
    right_gcd[i+1] = gcd(right_gcd[i],a[-1-i])

ans = right_gcd[n-1]
for i in range(n):
    ans = max(ans,gcd(left_gcd[i],right_gcd[n-1-i]))

print(ans)
# Judge status: Accepted
X,Y=map(int,input().split())
l=[]
for i in range(X+1):
    l.append(2*i+4*(X-i))
if Y in l:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def main():
    def f(n):
        return 3 * n + 1 if n % 2 else n // 2
    s = int(input())
    a = [s]
    for i in range(1, 11**6):
        x = f(a[i-1])
        if x in a:
            return len(a) + 1; exit()
        a.append(x)


print(main())
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
tmp=A[0]
ans=1000
kabu=0
for i in range(1,N):
    if tmp < A[i]:
        if kabu==0:
            kabu=ans//tmp
            ans=ans%tmp
            tmp=A[i]
    elif tmp > A[i]:
        ans+=kabu*tmp
        kabu=0
        tmp=A[i]
if kabu > 0:
    ans+=kabu*A[-1]
print(ans)
# Judge status: Wrong Answer
S = input()
K = int(input())

if len(S) == 1:
    print(S)
    exit()

if K == 1:
    print(S[0])
    exit()

for i in S:
    if i != '1' and K != 1:
        print(i)
        exit()
# Judge status: Wrong Answer
N=int(input())
B=list(map(int,input().split()))
A=[0]*N
if N==2:
  print(sum(B)*2)
  exit()

for i in range(1,N-1):
  A[i]=min(B[i-1],B[i])
A[0]=A[1]
a=sum(A)+B[N-2]
print(a)
# Judge status: Accepted
x, y = map(int, input().split())
print(-1 if x % y == 0 else x)
# Judge status: Accepted
X = int(input())

if X >= 400 and X <= 599:
  print('8')
elif X >= 600 and X <= 799:
  print('7')
elif X >= 800 and X <= 999:
  print('6')
elif X >= 1000 and X <= 1199:
  print('5')
elif X >= 1200 and X <= 1399:
  print('4')
elif X >= 1400 and X <= 1599:
  print('3')
elif X >= 1600 and X <= 1799:
  print('2')
else:
  print('1')
# Judge status: Accepted
icase=47    
if icase==47:
    a,b,c=map(int,input().split())
    if a+b==c or a+c==b or b+c==a:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
a,b,h=map(int,open(0))
print((a+b)*h//2)
# Judge status: Wrong Answer
w,h,n = map(int, input().split())
xya = [list(map(int, input().split())) for i in range(n)]
x2 = w
x1 = 0
y2 = h
y1 = 0
for a,b,c in xya:
    print(x1,x2,y1,y2)
    if c == 1:
        x1 = a
    elif c == 2:
        x2 = a
    elif c == 3:
        y1 = b
    else:
        y2 = b
if x2 <= x1 or y2 <= y1:
    print(0)
else:
    print((x2-x1)*(y2-y1))
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
sort_A=sorted(A)
max_A=sort_A[-1]
answer=[]
half_A=max_A//2
number=pow(10,9)
answer=0
for n in range(N-1):
    if number>=abs(sort_A[n]-half_A):
        answer=n
        number=abs(sort_A[n]-half_A)
print(max_A,sort_A[answer])
# Judge status: Wrong Answer
S=list(input())
N=len(S)
def main():
  ans=0
  i=0
  while len(S)>0 and i<N-1:
    if (S[i]==0 and S[i+1]==1) or (S[i]==1 and S[i+1]==0):
      S.remove(S[i:i+2])
      ans+=1
    else:
      ans=ans
      i+=1
  print(ans)
main()
# Judge status: Accepted
s = input()

print(s.replace("2017", "2018"))
# Judge status: Accepted
import sys

N = int(sys.stdin.readline())
ABC = [[None]*3 for i in range(N)]

for i in range(N):
    ABC[i][0], ABC[i][1], ABC[i][2] = map(int, sys.stdin.readline().split())

happiness = [[0] *3 for i in range(N+1)]

for i in range(N):
    for j in range(3):
        happiness[i+1][j] = max(happiness[i][j-1] + ABC[i][j], happiness[i][j-2] + ABC[i][j])

print(max(happiness[N]))
# Judge status: Wrong Answer
H, W = map(int, input().split())
res = H * W
if H == 1 or W == 1:
    ans = 1
if res % 2 == 0:
    ans = res // 2
else:
    ans = res//2+1
print(ans)
# Judge status: Accepted
N, Q = map(int, input().split())
S = list(input())

# cum[i]: S[0]~S[i]におけるACの数
cum = [0]
cnt = 0
for i in range(1, N):
    if S[i-1]+S[i] == 'AC':
        cnt+=1
    cum.append(cnt)

ans = []
for i in range(Q):
    l, r = map(int, input().split())
    ans.append(cum[r-1] - cum[l-1])

for i in ans:
    print(i)
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
ans = 0
for i in range(n):
    mi = a[i] - b[i]
    ans += min(b[i], a[i]+a[i+1])
    if mi < 0:
        a[i+1] += mi
        if a[i+1] < 0:
            a[i+1] = 0
print(ans)
# Judge status: Accepted
from collections import deque
import re
s = input()
t = input()

d = deque()
for i, ch in enumerate(s[::-1]):
    d.appendleft('.' if ch == '?' else ch)
    if len(d) < len(t):
        continue
    if re.match(''.join(list(d)[:len(t)]), t):
        ans = s[:len(s) - i - 1] + t + s[len(s) - i - 1 + len(t):]
        print(ans.replace('?', 'a'))
        exit()
print('UNRESTORABLE')
# Judge status: Wrong Answer
B,C = map(int,input().split())
aGroup = {1,3,5,7,8,10,12}
bGroup = {4,6,9,11}
if B in aGroup and C in aGroup:
    print("YES")
elif B in bGroup and C in bGroup:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
s,w = map(int,input().split())

if w>=s:
  print('unsafe')
else:
  print('safe')
# Judge status: Accepted
import heapq
import sys

input = sys.stdin.readline


def main():
    N, M = map(int, input().split())
    A = list(map(lambda x: int(x) * (-1), input().split()))
    heapq.heapify(A)

    for _ in range(M):
        tmp = heapq.heappop(A)
        tmp *= -1
        tmp = tmp // 2
        heapq.heappush(A, tmp * (-1))
    print(sum(A) * (-1))


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
s = [input() for _ in range(n)]
ans = set(s[0])
for i in range(1,n): ans = ans & set(s[i])
cnt = [0] * len(ans)
ans = sorted(list(ans))
for i in range(n):
    for j in range(len(ans)):
        if cnt[j] == 0: cnt[j] = s[i].count(ans[j])
        else:cnt[j] = min(cnt[j], s[i].count(ans[j]))

A = ""
for x,y in zip(ans,cnt):
    A += x*y
print(A)
# Judge status: Accepted
n=int(input())
l=[x for x in range (1,10)]
ans="No"
for i in range(1,10):
    if n % i == 0 and n//i in l:
        ans="Yes"
print(ans)
# Judge status: Accepted
N = int(input())
B = list(map(int, input().split()))

A_sum = B[0]
for i in range(N-1):
    if i != N-2:
        A_sum += min(B[i], B[i+1])
    else:
        A_sum += B[i]

print(A_sum)
# Judge status: Accepted
ant = []
for i in range(5):
    ant.append(int(input()))

k = int(input())
per = True
for i in range(len(ant)):
    for j in range(i, len(ant)):
        if abs(ant[i] - ant[j]) > k:
            per = False
            break

if per == True:
    print('Yay!')
else:
    print(':(')
# Judge status: Wrong Answer
X,Y=3,20

ans=0
seki=X

while seki <= Y:
    seki*=2
    ans+=1
print(ans)
# Judge status: Wrong Answer
n=int(input())
a=input().split(' ')
b=[]
for x in a:
    b.append(int(x))
su=0
for t in b:
    su+=t
    
su=su**2
pas=0
for t in b:
    pas+=t*t
er=su-pas
er/=2
print(int(er%1000000007))
# Judge status: Accepted
n = input()
ans = 0
for i in range(len(n)):
    tmp = [9]*len(n)
    for j in range(9, -1, -1):
        tmp[i] = j
        s = int(''.join(map(str, tmp)))
        if s <= int(n):
            ans = max(ans, sum(map(int, str(s))))
            break
print(ans)
# Judge status: Accepted
n = int(input())
flag = False
for i in range(10**8):
    for j in range(-10**4,10**4):
        if i**5 - j **5 == n :
            print(i,j)
            flag = True
            break
    if flag == True :
        break
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=[a[0]]
f=-1
for i in a:
  if b[-1]<i:
    if f==1:b[-1]=i
    else:
      b.append(i)
      f=1
  if b[-1]>i:
    if f==-1:b[-1]=i
    else:
      b.append(i)
      f=-1
if f==-1:del b[-1]
if len(b)==0:exit(print(1000))
now=1000
for i in range(0,len(b),2):
  bb=now//b[i]
  now-=bb*b[i]
  now+=bb*b[i+1]
print(now)
# Judge status: Wrong Answer
N,X,Y = map(int,input().split())

print(N)

#base
for k in range(1,N):
    if k <= Y-X:
        ans= N-k
        ans += Y-X-k

    elif k > Y-X:
        ans= N-k
        ans += Y-X-k

    if N-k == Y-X:
        ans = 1
    if N-k < Y-X:
        ans = 0

    print(ans)
# Judge status: Accepted
S=list(input())
A=S.count('1')
B=S.count('0')
print(min(2*A,2*B))
# Judge status: Wrong Answer
n=int(input())
dp=[0]*2001
dp[0]=1
sdp=[0]*2001
sdp[0]=1
for i in range(2000):
  dp[i+1]=sdp[i-2]
  sdp[i+1]=dp[i+1]+sdp[i]
print(dp[n])
# Judge status: Accepted
import math
a , b , x = map(int,input().split())
if x >= a*a*b/2:
  t = 2*b - (2*x/(a*a))
  print(math.degrees(math.atan(t/a)))
else:
  t = 2*x/(a*b)
  print(math.degrees(math.atan(b/t)))
# Judge status: Wrong Answer
s = list(input())
a = ""
ans = 0
for c in s:
    if c in ("A", "C", "G", "T"):
        ans += 1
        a += c
    else:
        ans = max(ans, len(a))
        a = ""
print(ans)
# Judge status: Accepted
def gcd(a,b):
  while b:a,b=b,a%b
  return a
def divisor(n):
  ass=[]
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      ass.append(i)
      if i!=n//i:ass.append(n//i)
  return ass
def is_prime(n):
  if n==1:return True;return False
  for i in range(2,int(n**0.5)+1):
    if n%i==0:return False
  return True
ans=0
a,b=map(int,input().split())
for i in divisor(gcd(a,b)):
  if is_prime(i):ans+=1
print(ans)
# Judge status: Accepted
def solver():
    N = int(input())
    ans = []
    for i in range(1, N+1):
        s, p = [n for n in input().split()]
        ans.append({'id': i, 'city': s , 'point': int(p)})
    ans_s = sorted(ans, key=lambda x: (x['city'], -x['point']))
    for j in ans_s:
        print(j['id'])

if __name__=='__main__':
    solver()
# Judge status: Accepted
# ABC 119: A – Still TBD
s = input()
print('Heisei' if s <= '2019/04/30' else 'TBD')
# Judge status: Wrong Answer
def main():
    N = int(input())
    a = list(map(int,input().split()))
    a.sort(reverse=True)
    ans = sum(a[N:N+N])
    print(ans)
main()
# Judge status: Accepted
N = int(input())
cnt = [[0]*10 for _ in range(10)]
for i in range(1, N+1):
  head = int(str(i)[0])
  tail = int(str(i)[-1])
  cnt[head][tail] += 1
ans = 0
for i in range(1, 10):
  for j in range(1, 10):
    ans += cnt[i][j]*cnt[j][i]
print(ans)
# Judge status: Accepted
k = int(input())
s = input()

if len(s) <= k:
  print(s)
else:
  print(s[0:k]+"...")
# Judge status: Wrong Answer
X = int(input())
if X % 3 == 0 or X % 3 == 5 or X % 7 == 0:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
import numpy as np
n = int(input())
L = list(map(int,input().split()))
L = np.array(L)
cnt = 0
while all((x%2 == 0 for x in L)):
    L //=2
    cnt +=1
print(cnt)
# Judge status: Accepted
from math import gcd
A, B, C = map(int, input().split())
x = gcd(A, B)
if C % x == 0:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
s=list(input())
t=list(input())
flag=0
if s==t:
    flag=1
for i in range(len(s)):
    s.insert(0,s[-1])
    s.pop(-1)
    if s==t:
        flag=1
if flag==1:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N = int(input())

ans = 0
for i in range(1,N+1):
    y = N//i
    ans += y*(y+1)*i//2
    
print(ans)
# Judge status: Accepted

S = input()
T = input()

if (S == T[:-1]) and (len(S)+1 == len(T)):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from collections import Counter
ans = 0
N = int(input())
Alist = list(map(int, input().split()))
A0 = Alist[0]
add = A0
res_ = []
for i in range(N):
    res_.append(Alist[i]+A0-i)
res = Counter(res_)
ans += res[0]
sbn = 0
for i in range(1, N):
    res[res_[i-1]] -= 1
    sbn += Alist[i] - Alist[i-1] + 1
    ans += res[-sbn]
print(ans)
# Judge status: Accepted
x=int(input())

n=x//100
if (n*100<=x<=n*105):
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
import math
a,b=map(int,input().split())
for i in range(1,101):
  if(math.floor(i*0.08)==a and math.floor(i*0.1)==b):
    print(i)
    exit()
print(-1)
# Judge status: Accepted
N = int(input())
student = list(map(int,input().split()))
A = [0] * N
for i in range(N):
    A[student[i]-1] = i+1
A = list(map(str,A))
print(" ".join(A))
# Judge status: Accepted
N = int(input())
s_list = []
for i in range(N):
    s_list.append(input())

M = int(input())
t_list = []
for i in range(M):
    t_list.append(input())

X_list = []
for str in s_list:
    x = s_list.count(str) - t_list.count(str)
    X_list.append(x)

if max(X_list) < 0:
    print(0)
else:
    print(max(X_list))
# Judge status: Wrong Answer
a, b = map(int, input().split())
# intは入力に対しての関数、出力ではない

if (a+b) >= 3:
    print("Possible")
else:
    print("Impossible")
# Judge status: Wrong Answer
H=int(input())

print(2*H-1)
# Judge status: Wrong Answer
n = int(input())
s = list(map(str, input()))
a = []
cnt = s.count("E")
s.insert(0, 0)
s.append(0)
for i in range(1, n + 1):
    if s[i - 1] == "W":
        cnt += 1
    if s[i + 1] == "E":
        cnt -= 1
    a.append(cnt)
print(min(a))
# Judge status: Accepted
n,k = map(int, input().split())
s = input()
ans = [s[:k-1],s[k-1].lower(),s[k:]]
print(''.join(ans))
# Judge status: Accepted
N, M, X = map(int, input().split())
CA = [list(map(int, input().split())) for _ in range(N)]

ans = 10 ** 18
for i in range(2 ** N):
    cost = 0
    each_alg = [0 for _ in range(M)]
    for j in range(N):
        if (i >> j) & 1:
            cost += CA[j][0]
            for k in range(M):
                each_alg[k] += CA[j][k+1]
    if min(each_alg) >= X:
        ans = min(ans, cost)

if ans == 10**18:
    print('-1')
else:
    print(ans)
# Judge status: Accepted
x,a,b = map(int,input().split())

if abs(x-a) <= abs(x-b):
    print('A')
    
else:
    print('B')
# Judge status: Accepted
S = list(input())
T = list(input())

S.sort()
T.sort(reverse=True)

s = ''.join(map(str,S))
t = ''.join(map(str,T))

if t > s:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
# solution
import io
import math

data=int(input())

array=list(map(int, input().split()))
array.sort()
tmp=[]
i=data-1
while i>0:
  if array[i]==array[i-1]:
    tmp.append(array[i])
    i-=2
  else:
    i-=1
if len(tmp)>=2:
  print(tmp[0]*tmp[1])
else:
  print(0)
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
from collections import deque

B = deque()

if len(A) %2 ==0:
    for idx, a in enumerate(A):

        if idx % 2 == 0:
            B.append(a)
        else:
            B.appendleft(a)

else:
    for idx, a in enumerate(A):

        if idx % 2 == 0:
            B.appendleft(a)
        else:
            B.append(a)
print(*B)
# Judge status: Accepted
S=input()
i=0
ans="YES"
while i<len(S) or ans=="Yes":
    if S[i:i+7]=="dreamer" and S[i+5:i+10]!="erase":
        i+=7
    elif S[i:i+6]=="eraser":
        i+=6
    elif S[i:i+5] == "dream" or S[i:i+5] == "erase":
        i+=5
    else:
        ans="NO"
        break
if i<len(S)-1:
    ans="NO"
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
ab=[]
for i in range(n):
    a_,b_=map(int,input().split())
    ab.append([a_,b_])
ab.sort(key=lambda x:x[0] )
i=-1
t=0
ans=0
while t < m:
    i+=1
    t+=ab[i][1]
    ans+=ab[i][0]*ab[i][1]
ans -= (t-m) * ab[i][0]
print(ans)
# Judge status: Wrong Answer
A, B = map(int, input().split())
count=0

for i in range(A, B, 1):
  s = str(i)
  a = int(s[4])
  b = int(s[3])
  c = int(s[1])
  d = int(s[0])
  
  if a==d and b==c:
    count+=1
print(count)
# Judge status: Accepted
A=input()
if A.isupper():
    print('A')
else:
    print('a')
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
x = a[0]
y = sum(a)-a[0]
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: Wrong Answer
l=[]
for i in range(5):
  a=int(input())
  l.append(a)
l.sort()
k=int(input())
if k>l[4]-l[0]:
  print("Yay!")
else:
  print(":(")
# Judge status: Accepted
n = input()
count = 0
for i in n:
  if i == '9':
    count = 1
if count == 1:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
s=list(input())
t=list(input())
a = ord("a")
alph = ["0"]*26
for i in range(len(s)):
    s_al = ord(s[i])-a #s[i]の文字
    t_al = ord(t[i])-a #t[i]の文字
    if alph[s_al] == "0" or (alph[s_al] == t[i] and alph[t_al]== s[i]):
        alph[s_al] = t[i]
        alph[t_al] = s[i]
        
    else:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
N,Y = map(int,input().split())

for x in range(N+1):
  for y in range(N-x+1):
    z = N-x-y
    if 10000*x+5000*y+1000*z==Y:
      print(x,y,z)
      exit()

print(-1,-1,-1)
# Judge status: Accepted
a,b,c,d = map(int, input().split(" "))
maxi = max([a*c, a*d, b*c, b*d])
print(maxi)
# Judge status: Accepted
n,m = map(int,input().split())
dum = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    dum[a-1].append(b-1)
for i in dum[0]:
    if dum[i].count(n-1) >= 1:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")
# Judge status: Accepted
(a,b)=[int(x) for x in input().split()]
if a==1 or b==1:
  print(1)
else:
  print((a*b+1)//2)
# Judge status: Accepted
import sys
n, m = map(int, input().split())
a = []
for i in range(n):
  a.append(list(input()))
b = []
for i in range(m):
  b.append(list(input()))
for i in range(n - m + 1):
  for j in range(n - m + 1):
    if [c[j:j+m] for c in a[i:i+m]] == b:
      print('Yes')
      sys.exit()
print('No')
# Judge status: Accepted
a,b,c = map(int,input().split())

S = a*b/2
print(int(S))
# Judge status: Accepted
k = int(input())
a, b = map(int, input().split())

for i in range(a, b + 1):
    if i % k == 0:
        print('OK')
        break
else:
    print('NG')
# Judge status: Wrong Answer
x = list(map(int,input().split()))

n = x[0]
a = x[1]
b = x[2]

s = input()
c = a + b
k = b
j = 0
for i in range(0,n):
  #print(c)
  if(s[i] == "c"):
    print("No")
  elif(s[i] == "a"):
    if(c > 0):
      print("yes")
      c = c - 1
    else:
      print("No")
  else:
    if(c > 0 and k > 0):
      print("Yes")
      c = c - 1
      k = k - 1
    else:
      print("No")
# Judge status: Accepted
n, k = map(int, input().split())
ls = []
for i in range(n):
    ls.append(1)
for i in range(k):
    input()
    ts = map(int, input().split(' '))
    for t in ts:
        ls[t-1] = 0
print(sum(ls))
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
ans = 1
if 0 in a:
  ans = 0
else:
  for i in range(N):
    ans *= a[i]
    if ans > 10**18:
      ans = -1
      break
print(ans)
# Judge status: Wrong Answer
from itertools import product
[N, M, X] = [int(i) for i in input().split()]
bk = [[int(i) for i in input().split()] for _ in range(N)]

ans = 12*10**5
for seq in product(range(2), repeat=N):
    S = [0]*(M+1)
    for i in range(N):
       for j in range(M+1):
           S[j] += seq[i]*bk[i][j]     
    if min(S[1:M+1]) >= X:
        ans = min(ans, S[0]) 

print(ans)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
Mod=10**9+7
two_inverse=pow(2,Mod-2,Mod)

X=sum(A)%Mod

Y=0
for a in A:
    Y+=a*a
    Y%=Mod

print(((X*X-Y)*two_inverse)%Mod)
# Judge status: Accepted
from sys import stdin
input = stdin.readline

def main():
    X, K, D = map(int, input().rstrip().split())
    X = abs(X)
    c = X // D
    if c < K:   
        X = X % D
        K = K - c
        K = K % 2
    ans = X - (D * K)
    print(abs(ans))
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n,k=map(int,input().split())
p,r,s=map(int,input().split())
mc=input()
ans=0
for i in range(len(mc)):
  if i>=k and mc[i-k]!=mc[i]:
    if mc[i]=='r':
      ans+=r
    elif mc[i]=='p':
      ans+=p
    else:
      ans+=s
# Judge status: Accepted
n,k,q = map(int,input().split())
a = [int(input()) for i in range(q)]
point = [0]*n
for i in range(len(a)):
   point[a[i] - 1] += 1
ans = []
for i in range(n):
    point[i] = len(a) - point[i]
    if point[i] < k:
        ans.append("Yes")
    else:
        ans.append("No")
for i in ans:
    print(i)
# Judge status: Accepted
A,B,T = map(int,input().split())
print((T//A)*B)
# Judge status: Accepted
def dfs(i, f, sum):
  if i == 3:
    if sum == 7:
      print(f + "=7")
      exit()
  else:
    dfs(i+1, f+"-"+s[i+1], sum-int(s[i+1]))
    dfs(i+1, f+"+"+s[i+1], sum+int(s[i+1]))
    
s = input()
dfs(0, s[0], int(s[0]))
# Judge status: Accepted
A,B,C=map(int,input().split())
S=B//A
if S>C:
  print(C)
else:
  print(S)
# Judge status: Accepted
import sys
input = sys.stdin.readline
li = [int(i) for i in input().split()]
N = li[0]
M = li[1]
X = li[2]
Y = li[3]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
maxx = -1000
for i in range(N) :
    maxx = max(maxx,x[i])
miny = 1000
a = "War"
for i in range(M) :
    miny = min(miny,y[i])
maxx = max(X,maxx)
miny = min(Y,miny)
if maxx < miny :
    a = "No War"
print(a)
# Judge status: Accepted
import sys
from collections import Counter

S = sys.stdin.readline().strip()
counter = Counter(S)

ls = len(S)
if ls == 1:
    print("YES")
elif ls == 2:
    if len(counter) == 2:
        print("YES")
    else:
        print("NO")
else:
    if len(counter) < 3:
        print("NO")
    else:
        counter = sorted(counter.items(), key=lambda x: x[1])
        if counter[2][1] - counter[0][1] < 2:
            print("YES")
        else:
            print("NO")
# Judge status: Accepted
SX, SY, TX, TY = [int(n) for n in input().split()]

def main():
    xd = TX - SX
    yd = TY - SY
    first = ['R' * xd, 'U' * yd, 'L' * xd, 'D' * yd]
    second = ['D', 'R' * (xd + 1), 'U' * (yd + 1), 'L', 'U', 'L' * (xd + 1), 'D' * (yd + 1), 'R']

    ans = first + second
    print(''.join(ans))

if __name__ == '__main__':
    main()
# Judge status: Accepted
# A - Candy Distribution Again

N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
ans = 0

for i in range(N):
    x -= a[i]
    if x<0 or (i==N-1 and x!=0):
        break
    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")