Harryxun/stf_run huggingface dataset:
'''
問題：
    アライグマはモンスターと戦っています。

    モンスターの体力は H です。
    アライグマは N 種類の必殺技を使うことができ、
    i 番目の必殺技を使うとモンスターの体力を Ai 減らすことができます。
    必殺技を使う以外の方法でモンスターの体力を減らすことはできません。

    モンスターの体力を 0 以下にすればアライグマの勝ちです。

    アライグマが同じ必殺技を
    2 度以上使うことなくモンスターに勝つことができるなら Yes を、
    できないなら No を出力してください。
'''

'''
制約：
    1 ≦ H ≦ 1000000000
    1 ≦ N ≦ 100000
    1 ≦ Ai ≦ 10000
    入力中のすべての値は整数である。
'''

# 標準入力から H, N, Ai を取得する
h, m = map(int, input().split())
a = list(map(int, input().split()))

# 必殺技を1回ずつ使った場合、モンスターの体力をどれだけ削れるか計算する
# hissatsu_hp = 0
# for i in range(0, m):
#     hissatsu_hp += a[i]
hissatu_hp = sum(a)

# 同じ必殺技を使わずアライグマを倒せるか判定して結果を出力する
result = ""
if hissatsu_hp >= h:
    result = "Yes"
else:
    result = "No"

print(result)


### FIXED CODE ###

'''
問題：
    アライグマはモンスターと戦っています。

    モンスターの体力は H です。
    アライグマは N 種類の必殺技を使うことができ、
    i 番目の必殺技を使うとモンスターの体力を Ai 減らすことができます。
    必殺技を使う以外の方法でモンスターの体力を減らすことはできません。

    モンスターの体力を 0 以下にすればアライグマの勝ちです。

    アライグマが同じ必殺技を
    2 度以上使うことなくモンスターに勝つことができるなら Yes を、
    できないなら No を出力してください。
'''

'''
制約：
    1 ≦ H ≦ 1000000000
    1 ≦ N ≦ 100000
    1 ≦ Ai ≦ 10000
    入力中のすべての値は整数である。
'''

# 標準入力から H, N, Ai を取得する
h, m = map(int, input().split())
a = list(map(int, input().split()))

# 必殺技を1回ずつ使った場合、モンスターの体力をどれだけ削れるか計算する
hissatsu_hp = 0
for i in range(0, m):
    hissatsu_hp += a[i]

# 同じ必殺技を使わずアライグマを倒せるか判定して結果を出力する
result = ""
if hissatsu_hp >= h:
    result = "Yes"
else:
    result = "No"

print(result)
kalanbaba = 1
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))

n , = I()
c = n
from math import log
count = 0
m = int(log(n,9))
n -= 9**m
count += m>0
l9 = int(log(n,9))
l6 = int(log(n,6))
while l9 > 0 or l6 > 0:
	count += 1
	if 6**l6 > 9**l9:
		n -= 6**l6
	else:
		n -= 9**l9
	l9 = int(log(n,9))
	l6 = int(log(n,6)) 
print(count + n)



### FIXED CODE ###


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

maxn = 100000
s = [1]
n = int(input())
for i in range(20):
	if 6**i<=maxn:
		s.append(6**i)
	if 9**i<=maxn:
		s.append(9**i)
dp = [10**10]*(maxn+4)
dp[0] = 0
m = len(s)
for i in range(1,maxn+1):
	for j in range(m):
		if s[j]<=i:
			subres = dp[i-s[j]]
		if subres!=10**10 and subres+1<dp[i]:
			dp[i] = subres+1
print (dp[n])
s=input()
print(s[0]+str(len(s)-2)+s[len(s)])

### FIXED CODE ###

s=input()
print(s[0]+str(len(s)-2)+s[len(s)-1])
from collections import Counter
mod = 1000000007
N = int(input())
A = list(map(int, input().split()))
A.sort()

if N % 2 != 0:  # 奇数の場合
    count = Counter(A)
    now_key = 2
    for k, v in count.items():
        if k == 0:
            if v != 1:
                print(0)
                exit()
        else:
            if k != now_key or v != 2:
                print(0)
                exit()
            now_key += 2
    print(2**(N//2) % mod)
else:  # 偶数の場合
    count = Counter(A)
    now_key = 1
    for k, v in count.items():
        if k != now_key or v != 2:
            print(0)
            exit()
        now_key += 2
    print(2**(N//2) % mod)


### FIXED CODE ###

from collections import Counter
mod = 1000000007
N = int(input())
A = list(map(int, input().split()))
A.sort()

if N % 2 != 0:  # 奇数の場合
    count = Counter(A)
    now_key = 2
    for k, v in count.items():
        if k == 0:
            if v != 1:
                print(0)
                exit()
        else:
            if k != now_key or v != 2:
                print(0)
                exit()
            now_key += 2
    print(2**(N//2) % mod)
else:  # 偶数の場合
    count = Counter(A)
    now_key = 1
    for k, v in count.items():
        if k != now_key or v != 2:
            print(0)
            exit()
        now_key += 2
    print(2**(N//2) % mod)
n, m = map(int, input().split())
A = [[0 for i in range(m)] for j in range(n)]

for i in range(n):
    A[i][0], A[i][1], A[i][2], A[i][3] = map(int, input().split())

b = [0 for i in range(m)]
for i in range(m):
    b[i] = int(input())

for i in range(n):
    c = 0
    for j in range(m):
        c += A[i][j] * b[j]
    print(c)

### FIXED CODE ###

n, m = map(int, input().split())
a = [[int(num) for num in input().split()] for i in range(n)]
b = [int(input()) for i in range(m)]
for i in range(n):
    c = 0
    for j in range(m):
        c += a[i][j] * b[j]
    print(c)
a,b=list(int,input().split())
if (a*b)%2==0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a,b=map(int, input().split())
w=a*b
if w%2==0:
  print ("Even")
else:
  print("Odd")
n = int(input())
a = list(map(int,input().split()))
a = a.sort()
for i in range(1,n+1):
    print(a.count(i))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
cnt = [0] * n
for i in a:
    cnt[i-1] += 1
for j in cnt:
    print(j)
import copy
N = int(input())
numList = list(map(int, input().split()))
medIndex = int(N/2)

for i in range(0,N):
	numListCopy = copy.deepcopy(numList)
	numListCopy.pop(i)
	numListCopy.sort()
	print(numListCopy[medIndex])

### FIXED CODE ###

import copy
N = int(input())
numList = list(map(int, input().split()))
numListCopy = copy.deepcopy(numList)
numList = sorted(numList)
medIndex = int((N)/2)
med1 = numList[medIndex-1]
med2 = numList[medIndex]


for i in range(0,N):
	if numListCopy[i] <= med1:
		print(med2)
	elif med2 <= numListCopy[i]:
		print(med1)
import sys
sys.setrecursionlimit(10000)
n, q = list(map(int, input().split()))
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b= list(map(int, input().split()))
    tree[a-1].append(b-1)
s = [0] * n
for i in range(q):
    p, x = list(map(int, input().split()))
    s[p-1] += x


def f(n):
    global s
    for i in range(len(tree[n])):
        s[tree[n][i]] += s[n]
        f(tree[n][i])



f(0)

print(" ".join(list(map(str, s))))


### FIXED CODE ###

n, q = list(map(int, input().split()))
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b= list(map(int, input().split()))
    tree[a-1].append(b-1)
s = [0] * n
for i in range(q):
    p, x = list(map(int, input().split()))
    s[p-1] += x

queue = [0]

while(len(queue) != 0):
    n = queue.pop()
    for i in range(len(tree[n])):
        s[tree[n][i]] += s[n]
        queue.append(tree[n][i])
# def f(n):
#     global s
#     for i in range(len(tree[n])):
#         s[tree[n][i]] += s[n]
#         f(tree[n][i])
#
# f(0)

print(" ".join(list(map(str, s))))
def main():
    n, q = map(int, input().split())
    s = list(input())
    lr = [list(map(int, input().split())) for i in range(q)]
    ruiseki = [0 for i in range(n)]

    for i in range(n - 1):
        if s[i] == "A" and s[i + 1] == "C":
            ruiseki[i + 1] = ruiseki[i] + 1
        else:
            ruiseki[i + 1] = ruiseki[i]

    for l, r in lr:
        print((ruiseki[r] - ruiseki[l]))


if __name__ == '__main__':
    main()


### FIXED CODE ###

N,Q = map(int,input().split())
S = input()
ACnum = [0]
for i in range(1,N):
    if "AC" == S[i-1:i+1]:
        ACnum.append(ACnum[i-1] + 1)
    else:
        ACnum.append(ACnum[i-1])
lr = []
for i in range(Q):
    lr.append(list(map(int,input().split())))

for i in range(Q):
    print(ACnum[lr[i][1]-1] - ACnum[lr[i][0]-1])
N = int(input())

ryuka = [0]*86
ryuka[0] = 2
ryuka[1] = 1

def culc_ryuka(N, ryuka):
    for i in range(2, N+1):
        ryuka[i] = ryuka[i-1]+ryuka[i-2]
        
    return ryuka

ryuka = culc_ryuka(N, ryuka)
print(ryuka[N])
    

### FIXED CODE ###

N = int(input())

ryuka = [0]*87
ryuka[0] = 2
ryuka[1] = 1

def culc_ryuka(N, ryuka):
    for i in range(2, N+1):
        ryuka[i] = ryuka[i-1]+ryuka[i-2]
        
    return ryuka

ryuka = culc_ryuka(N, ryuka)
print(ryuka[N])
n = str(input())
if n = "a" or "i" or "u" or "e" or "o":
  print("vowe")
else:
  print("consonant")

### FIXED CODE ###

n = str(input())
if n == "a" or n =="i" or n =="u" or n =="e" or n =="o":
  print("vowel")
else:
  print("consonant")
N,i=map(int,input(),split())
print(N-i+1)

### FIXED CODE ###

N,i=map(int,input().split())
print(N-i+1)
n,m=map(int,input().split())
row=m
number=[]
judgment=[]
for i in range(row):
    a,b=input().split()
    number.append(int(a))
    judgment.append(b)
 
z = 0
seitou,sippai = 0,0
kuria = [0] * m
for i in range(0,len(judgment)):
    if kuria[number[i]] == 0 and judgment[i] == 'AC':
        seitou += 1
        kuria[number[i]] = 1
    elif kuria[number[i]] == 0 and judgment[i] == 'WA':
        sippai += 1
print(seitou,sippai)

### FIXED CODE ###

n,m=map(int,input().split())
row=m
number=[]
judgment=[]
for p in range(row):
    a,b=input().split()
    number.append(int(a))
    judgment.append(b)

penalist = [0]*n
aclist = [0]*n
anscount=0
penacount=0

for i in range(0,m):
    if judgment[i] == 'WA':
        penalist[number[i]-1] += 1
    else:
        if aclist[number[i]-1] >= 1:
            pass
        else:
            aclist[number[i]-1] += 1
            anscount += 1
            penacount += penalist[number[i]-1]

print(anscount,penacount)
from math import floor


def main():
    N = int(input())
    v = list(map(int, input().split(" ")))
    while len(v) > 1:
        v.sort()
        w = []
        if len(v) % 2 == 1:
            w.append(v[-1])
            N -= 1
        for i in range(floor(N / 2)):
            w.append((v[i * 2] + v[i * 2 + 1]) / 2)
        v = w
    print(v[0])


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    N = int(input())
    v = list(map(int, input().split(" ")))
    while len(v) > 1:
        v.sort(reverse=True)
        a = v[-1]
        b = v[-2]
        v = v[:-2]
        v.append((a + b) / 2)
    print(v[0])


if __name__ == '__main__':
    main()
n = int(input())
a = [int(input()) for _ in range(n)]

max_1st = max(a)
max_2nd = sorted(a)[-2]
for i in range(n):
    if a[i] == max_1st:
        print(max_2nd)
    else:
        print(max_1st)


### FIXED CODE ###

r = int(input())
print(3 * r ** 2)
import heapq
x,y,z,k=map(int,input().split())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

li=[]
push=heapq.heappush
pop=heapq.heappop

push(li,(-a[0]-b[0]-c[0],0,0,0))
ans=[]
used=set()

for _ in range(k):
    value,i,j,l=pop(li)
    ans.append(-value)
    if i<x-1 and (i+1,j,l) not in used:
        push(li,(-a[i+1]-b[j]-c[l],i+1,j,l))
        used.add((i+1,j,l))
    if j<y-1 and (i,j+1,l) not in used:
        push(li,(-a[i]-b[j+1]-c[l],i,j+1,l))
        used.add((i,j+1,l))
    if k<z-1 and (i,j,l+1) not in used:
        push(li,(-a[i]-b[j]-c[l+1],i,j,l+1))
        used.add((i,j,l+1))
for i in ans:
    print(i)

### FIXED CODE ###

import heapq
x,y,z,k=map(int,input().split())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

li=[]
push=heapq.heappush
pop=heapq.heappop

push(li,(-a[0]-b[0]-c[0],0,0,0))
ans=[]
used=set()

for _ in range(k):
    value,i,j,l=pop(li)
    ans.append(-value)
    if i<x-1 and (i+1,j,l) not in used:
        push(li,(-a[i+1]-b[j]-c[l],i+1,j,l))
        used.add((i+1,j,l))
    if j<y-1 and (i,j+1,l) not in used:
        push(li,(-a[i]-b[j+1]-c[l],i,j+1,l))
        used.add((i,j+1,l))
    if l<z-1 and (i,j,l+1) not in used:
        push(li,(-a[i]-b[j]-c[l+1],i,j,l+1))
        used.add((i,j,l+1))
for i in ans:
    print(i)
import sys

n, x, t = sys.stdin.readlines()[0].split()
n, x, t = int(n), int(x), int(t)
return math.ceil(n/x) * t

### FIXED CODE ###

import sys
import math

n, x, t = sys.stdin.readlines()[0].split()
n,x,t = float(n),int(x),int(t)

print(int(math.ceil(n/x) * t))
N = int(input())
li = list(map(int,input().split()))
li2 = []
key =[0] #key ０でおｋ　１で1下げ
cnt = 0
flg = True
while flg :
    cur1 = li[cnt]
    cur2 = li[cnt+1]
    sa = cur2 - cur1
    if key[cnt] == 0:
        if sa < -1:
            ans = "No"
            flg = False
        elif sa == -1:
            key.append(1)
        else:
            key.append(0)
    else:
        if sa < 0:
            ans = "No"
            flg = False
        else:
            key.append(0)
    cnt += 1
    if cnt == len(li)-1:
        ans = "Yes"
        flg = False
print(ans)

### FIXED CODE ###

N = int(input())
li = list(map(int,input().split()))
li2 = []
key =[0] #key ０でおｋ　１で1下げ
cnt = 0
flg = True
if N == 1:
    ans ="Yes"
    flg = False
while flg :
    cur1 = li[cnt]
    cur2 = li[cnt+1]
    sa = cur2 - cur1
    if key[cnt] == 0:
        if sa < -1:
            ans = "No"
            flg = False
        elif sa == -1:
            key.append(1)
            cnt += 1
        else:
            key.append(0)
            cnt += 1
    else:
        if sa < 0:
            ans = "No"
            flg = False
        elif sa == 0:
            key.append(1)
            cnt += 1
        else:
            key.append(0)
            cnt += 1
    if cnt == len(li)-1:
        ans = "Yes"
        flg = False
print(ans)
Input = input().split()
Input[0] = int(Input[0])
Input[1] + int(Input[1])

if Input[0] >= Input[1]:
  print(str(Input[1])*Input[0])

else:
  print(str(Input[0])*Input[1])

### FIXED CODE ###

Input = input().split()
Input[0] = int(Input[0])
Input[1] = int(Input[1])
 
if Input[0] >= Input[1]:
  print(str(Input[1])*Input[0])
  
else:
  print(str(Input[0])*Input[1])
N = input()

if N % 2 == 0:
    print((N / 2) / N)

else:
    print(((N + 1) / 2) / N)


### FIXED CODE ###

N = int(input())

if N % 2 == 0:
    print((N / 2) / N)

else:
    print(((N + 1) / 2) / N)
n = int(input())
x = input()

f = [-1] * (n+10)
f[0] = 0

for i in range(1, n+10):
    # python bitcount で見つけたこれを参考に https://ameblo.jp/316228/entry-10518720149.html
    f[i] = f[i % bin(i).count('1')] + 1

init_bitcount = x.count('1')
# Xを init_bitcount+1とinit_bitcount-1で割った余り

x_mod_01 = 0
x_mod_10 = 0
for digit in x:
    x_mod_01 *= 2
    x_mod_10 *= 2
    if digit == '1':
        x_mod_01 += 1
        x_mod_10 += 1
    x_mod_01 %= (init_bitcount+1)
    x_mod_10 %= (init_bitcount-1)

# print(x_mod_01, x_mod_10, init_bitcount)

power_mod_01 = [-1] * (n+10)
power_mod_01[0] = 1
for i in range(1, n+10):
    power_mod_01[i] = power_mod_01[i-1] * 2 % (init_bitcount + 1)


power_mod_10 = [-1] * (n+10)
power_mod_10[0] = 1
for i in range(1, n+10):
    power_mod_10[i] = power_mod_10[i-1] * 2 % (init_bitcount - 1)


for i in range(n):
    if x[i] == '0':
        # 0→1
        first_residue = (x_mod_01 + power_mod_01[n - i - 1]) % (init_bitcount+1)
        print(f[first_residue] + 1)
    else:
        # 1→0
        first_residue = (x_mod_10 - power_mod_10[n - i - 1]) % (init_bitcount-1)
        print(f[first_residue] + 1)


### FIXED CODE ###

n = int(input())
x = input()

f = [-1] * (n+10)
f[0] = 0

for i in range(1, n+10):
    # python bitcount で見つけたこれを参考に https://ameblo.jp/316228/entry-10518720149.html
    f[i] = f[i % bin(i).count('1')] + 1

init_bitcount = x.count('1')
# Xを init_bitcount+1とinit_bitcount-1で割った余り

x_mod_01 = 0
x_mod_10 = 0
for digit in x:
    x_mod_01 *= 2
    x_mod_10 *= 2
    if digit == '1':
        x_mod_01 += 1
        x_mod_10 += 1
    x_mod_01 %= (init_bitcount+1)
    if init_bitcount != 1:
        x_mod_10 %= (init_bitcount-1)

# print(x_mod_01, x_mod_10, init_bitcount)

power_mod_01 = [-1] * (n+10)
power_mod_01[0] = 1
for i in range(1, n+10):
    power_mod_01[i] = power_mod_01[i-1] * 2 % (init_bitcount + 1)

if init_bitcount != 1:
    power_mod_10 = [-1] * (n+10)
    power_mod_10[0] = 1
    for i in range(1, n+10):
        power_mod_10[i] = power_mod_10[i-1] * 2 % (init_bitcount - 1)


for i in range(n):
    if x[i] == '0':
        # 0→1
        first_residue = (x_mod_01 + power_mod_01[n - i - 1]) % (init_bitcount+1)
        print(f[first_residue] + 1)
    else:
        if init_bitcount == 1:
            print(0)
            continue
        # 1→0
        first_residue = (x_mod_10 - power_mod_10[n - i - 1]) % (init_bitcount-1)
        print(f[first_residue] + 1)
x1,y1,x2,y2=map(int,input().split())
print(x2+y1-y2,y2+x2-x1,x3+y2-y3,y3+x3-x2)

### FIXED CODE ###

x1,y1,x2,y2=map(int,input().split())
x3=x2+y1-y2
y3=y2+x2-x1
x4=x3+y2-y3
y4=y3+x3-x2
print(x3,y3,x4,y4)
a,b,c,d,e=map(int,input().split())
list=[a,b,c,d,e]
for i in list():
    if i==0:
        print(list.index(i)+1) 


### FIXED CODE ###

a=list(map(int,input().split()))
print(a.index(0)+1)
for i in range(2):
	n.append([int(x) for x in input().split()])
print(1 if n[0][0]!=n[1][0] else 0)

### FIXED CODE ###

n=[]
for i in range(2):
	n.append([int(x) for x in input().split()])
print(1 if n[0][0]!=n[1][0] else 0)
# Square869120Contest #4 B - Buildings are Colorful!　
 
import sys
 
N, K = map(int, sys.stdin.readline().strip().split())
a = list(map(int, sys.stdin.readline().strip().split()))

if K == 0:
  break
 
 
def dfs(height=a[0], cost=0, target=K, can_see=1, i=1):
    if can_see >= target:
        # print('height', height)
        # print('can_see', can_see)
        # print('cost', cost)
        return cost
 
    # 端まで探索したとき
    if i == len(a):
        return float('inf')
 
    # 建物 i を選ばない場合
    if height >= a[i]:
        cost1 = dfs(height=height, cost=cost, target=K, can_see=can_see, i=i+1)
    else:
        cost1 = dfs(height=a[i], cost=cost, target=K, can_see=can_see+1, i=i+1)
    # print('cost1', cost1, 'can_see', can_see, 'i', i)
 
    # 建物　i を選んだ場合
    cost += max(0, height + 1 - a[i])
    height = max(a[i], height + 1)
    cost2 = dfs(height=height, cost=cost, target=K, can_see=can_see+1, i=i+1)
    # print('cost2', cost2)
 
    return min(cost1, cost2)
 
 
print(dfs(a[0], cost=0, target=K, can_see=1, i=1))

### FIXED CODE ###

# Square869120Contest #4 B - Buildings are Colorful!　

import sys

N, K = map(int, sys.stdin.readline().strip().split())
a = list(map(int, sys.stdin.readline().strip().split()))


def dfs(height=a[0], cost=0, target=K, can_see=1, i=1):
    if can_see >= target:
        # print('height', height)
        # print('can_see', can_see)
        # print('cost', cost)
        return cost

    # 端まで探索したとき
    if i == len(a):
        return float('inf')

    # 建物 i を選ばない場合
    if height >= a[i]:
        cost1 = dfs(height=height, cost=cost, target=K, can_see=can_see, i=i+1)
    else:
        cost1 = dfs(height=a[i], cost=cost, target=K, can_see=can_see+1, i=i+1)
    # print('cost1', cost1, 'can_see', can_see, 'i', i)

    # 建物　i を選んだ場合
    cost += max(0, height + 1 - a[i])
    height = max(a[i], height + 1)
    cost2 = dfs(height=height, cost=cost, target=K, can_see=can_see+1, i=i+1)
    # print('cost2', cost2)

    return min(cost1, cost2)


print(dfs(a[0], cost=0, target=K, can_see=1, i=1))
import math
N, D = map(int,input().split())
print(N, D)
cnt = math.floor(N/(2*D+1))
if N%(2*D+1) != 0:
  cnt += 1
print(cnt)

### FIXED CODE ###

r = int(input())
print(3*r*r)
Time = []
Time_Zero = []

for i in range(5):
    A = int(input())
    ra = A%10
    qa = A//10
    if ra == 0:
      Time_Zero.append([ra,qa,A])
    else:
      Time.append([ra,qa,A])

Time.sort(reverse=True)

ans = 0
for r,q,A in Time_Zero:
  ans += 10*q

for r,q,A in Time:
  ans += 10*(q+1)

ans += Time[-1][2] - 10*(Time[-1][1]+1)

print(ans)

### FIXED CODE ###

Time = []
Time_Zero = []

for i in range(5):
    A = int(input())
    ra = A%10
    qa = A//10
    if ra == 0:
      Time_Zero.append([ra,qa,A])
    else:
      Time.append([ra,qa,A])

Time.sort(reverse=True)

ans = 0
for r,q,A in Time_Zero:
  ans += 10*q

for r,q,A in Time:
  ans += 10*(q+1)

if len(Time) > 0:
  ans += Time[-1][2] - 10*(Time[-1][1]+1)

print(ans)
n = input()
x = sum(map(int,n))
print('Yes' if n%x == 0 else 'No')


### FIXED CODE ###

n = input()
x = sum(map(int,n))
print('Yes' if int(n)%x == 0 else 'No')
n = int(raw_input())
A = map(int, raw_input().strip().split(' '))
q = int(raw_input())
M = map(int, raw_input().strip().split(' '))

def ans(i, M):
    if M == 0:
        return 1
    if i  >= n or m > sum(A):
        return 0
    res = ans(i + 1, M) or ans(i + 1, M - A[i])
    return res
           
for j in range(0, q):
    if ans(0, M[j]):
        print "yes"
    else:
        print"no"

### FIXED CODE ###

n = int(raw_input())
A = map(int, raw_input().strip().split(' '))
q = int(raw_input())
M = map(int, raw_input().strip().split(' '))

def ans(i, m):
    if m == 0:
        return 1
    if i  >= n or m > sum(A):
        return 0
    res = ans(i + 1, m) or ans(i + 1, m - A[i])
    return res
           
for j in range(0, q):
    if ans(0, M[j]):
        print "yes"
    else:
        print"no"
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()


N=int(input())
X=input()
C=X.count("1")

lst=[]
for x in [C-1,C+1]:

    if C<=0:
        lst.append(-1)
    else:
        Z=0
        p=1
        for i in range(N):
            if X[-i-1]=="1":
                Z+=p
            p*=2
            Z%=x
        lst.append(Z)

#print(lst)
fac1=[1]
fac2=[1]
C1=C-1
C2=C+1
for i in range(N):
    fac1.append(fac1[-1]*2%C1)
    fac2.append(fac2[-1]*2%C2)

for i in range(N):

    _C=C+(1 if X[i]=="0"  else -1 )
    if  X[i]=="0":
        lstidx=1
    else:
        lstidx=0

    idx=(N-1-i)

    value=lst[lstidx]+(fac2[idx] if  X[i]=="0" else fac1[idx])
    #print(lst[lstidx],value)
    count=0
    while value:
        count+=1
        value%=_C
        _C=0
        bit=value
        while bit:
            _C+=bit&1
            bit>>=1
    print(max(count,1))


### FIXED CODE ###

from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()


N=int(input())
X=input()
C=X.count("1")

lst=[]
lstcount=[]
for x in [C-1,C+1]:
    flg=0
    if x<=0:
        lst.append(0)
        lstcount.append(0)
    else:
        Z=0
        p=1
        for i in range(N):
            if X[-i-1]=="1":
                Z+=p
            p*=2
            if Z>=x:
                Z%=x
                flg=1
            if flg:
                p%=x
        lst.append(Z)
        lstcount.append(flg)
#print(lst)
fac1=[1]
fac2=[1]
C1=max(C-1,1)
C2=max(C+1,1)
for i in range(N):
    fac1.append(fac1[-1]*2%C1)
    fac2.append(fac2[-1]*2%C2)

for i in range(N):

    _C=C+(1 if X[i]=="0"  else -1 )
    if _C==0:
        print(0)
        continue
    if  X[i]=="0":
        lstidx=1
    else:
        lstidx=0

    idx=(N-1-i)

    value=lst[lstidx]+(fac2[idx] if  X[i]=="0" else -fac1[idx])
    #print(value,X[i]=="0",lst,C-1,C+1)
    bit=value
    count=0
    while value and _C:
        count+=1
        value%=_C
        _C=0
        bit=value
        while bit:
            _C+=bit&1
            bit>>=1
    print(max(count,1))
a = int(input())
b = int(input())

print("Even" if a*b % 2 == 0 else "Odd")


### FIXED CODE ###

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

print("Even" if a*b % 2 == 0 else "Odd")
n = int(input())
x = input()
a = x.count('1')
b = int(x,2)
# print (b)

ary = [None for i in range(200010)]
ary[0] = 0

def f(n):
  if ary[n] is not None:
    return ary[n]
  b = bin(n).count('1')
  r = 1 + f(n%b)
  ary[n] = r
  return ary[n]


for i in range(200010):
  f(i)

a1 = a + 1
a0 = a - 1

ans = [0 for i in range(n)]
for i, j in enumerate(reversed(list(x))):
  if j == '0':
    x = b + pow(2,i,a1)
    # y = x %a1
    x %= a1
    ans[i] = ary[x]+1
  else:
    x = b - pow(2,i,a0)
    # y = x %a0
    x %= a0
    ans[i] = ary[x]+1
ans.reverse()
for i in ans:
  print (i)

### FIXED CODE ###

n = int(input())
x = input()
a = x.count('1')
b = int(x,2)
# print (b)

ary = [None for i in range(200010)]
ary[0] = 0

def f(n):
  if ary[n] is not None:
    return ary[n]
  b = bin(n).count('1')
  r = 1 + f(n%b)
  ary[n] = r
  return ary[n]


a1 = a + 1
a0 = a - 1
for i in range(200010):
  f(i)


one = [1] * 200010
zero = [1] * 200010
for i in range(1, 200010):
    if a0 != 0:
        one[i] = one[i-1] * 2 % a0
    zero[i] = zero[i-1] * 2 % a1


ans = [0 for i in range(n)]
c1 = b%a1
if a0 != 0:
  c0 = b%a0
for i in range(n-1, -1, -1):
  if x[n-1-i] == '0':
    y = c1 + zero[i]
    # y = x %a1
    y %= a1
    print (ary[y]+1)
  else:
    if a0 != 0:
      y = c0 - one[i]
      y %= a0
      print (ary[y]+1)
    else:
      print (0)
# ans.reverse()
# for i in ans:
#   print (i)