Harryxun/stf_run huggingface dataset:
while 1:
    m,n=map(int,input().split())
    if m==0:break
    a,i,c=[i+1 for i in range(m)],1,0
    while i<=n:
        b,f=input(),0
        if i%15==0:
            if b!='FizzBuzz':
                del a[c]
                f=1
        elif i%5==0:
            if b!='Buzz':
                del a[c]
                f=1
        elif i%3==0:
            if b!='Fizz':
                del a[c]
                f=1
        else:
            if b!=str(i):
                del a[c]
                f=1
        if f:m-=1
        else:c=(c+1)%m

        i+=1
    print(*a)

### FIXED CODE ###

while 1:
    m,n=map(int,input().split())
    if m==0:break
    a,i,c=list(range(1,m+1)),0,0
    while i<n:
        i+=1
        b,f=input(),0
        if m<2:continue
        if i%15==0:
            if b!='FizzBuzz':
                del a[c]
                f=1
        elif i%5==0:
            if b!='Buzz':
                del a[c]
                f=1
        elif i%3==0:
            if b!='Fizz':
                del a[c]
                f=1
        elif b!=str(i):
            del a[c]
            f=1
        if f:m-=1
        else:c+=1
        c%=m
    print(*a)
N = int(input())
S = list(input())
print(S)
if len(set(S)) == 3:
  print("Three")
else:
  print("Four")


### FIXED CODE ###

a = int(input())
print(a//3)
#ライブラリインポート
from collections import defaultdict
import bisect

#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, M = getlist()
	S = list(input())
	nibu = []
	for i in range(N + 1):
		if S[i] == "0":
			nibu.append(i)
	DP = [0] * (N + 1)
	prev = [None] * (N + 1)
	for i in range(1, N + 1):
		if S[i] == "0":
			s = bisect.bisect_left(nibu, i - M)
			x = nibu[s]
			if x != i:
				prev[i] = x
				DP[i] = DP[x] + 1
	# print(nibu)
	# print(DP)
	# print(prev)
	if prev[N] == None:
		print(-1)
	else:
		ans = []
		x = N
		while True:
			ans.append(x - prev[x])
			x = prev[x]
			if x == 0:
				break
		ans = ans[::-1]
		print(" ".join(list(map(str, ans))))

if __name__ == '__main__':
	main()

### FIXED CODE ###

#ライブラリインポート
from collections import defaultdict
import bisect

#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, M = getlist()
	S = list(input())
	nibu = []
	for i in range(N + 1):
		if S[i] == "0":
			nibu.append(i)

	prev = [None] * (N + 1)
	for i in range(1, N + 1):
		if S[i] == "0":
			s = bisect.bisect_left(nibu, i - M)
			x = nibu[s]
			if x != i:
				prev[i] = x
	# print(nibu)
	# print(prev)
	if prev[N] == None:
		print(-1)
	else:
		ans = []
		x = N
		while True:
			ans.append(x - prev[x])
			x = prev[x]
			if prev[x] == None:
				break
		if x == 0:
			ans = ans[::-1]
			print(" ".join(list(map(str, ans))))
		else:
			print(-1)

if __name__ == '__main__':
	main()
N, K = map(int, input().split())

dices = list(map(int, input().split()))

# 期待値は(1+P)/2 https://rikeilabo.com/sum-formula-of-numerical-sequence
# 累積和を求めておく．隣接するK個の和はS_{j+K} - S_j
# 期待値の前計算→累積和の計算→隣接するK項の和の計算 (１乗オーダー)
E_list = []
for dice in dices:
    E_list.append((1 + dice) * 0.5)

S_list = []  # i番目までのサイコロの期待値の累積和
for i in range(len(dices)):
    # S_list.append(sum(E_list[:i + 1]))  # アホ
    S_list.append(E_list[0] if i == 0 else S_list[i - 1] + E_list[i])

print(max(list(S_list[j + K] - S_list[j] for j in range(len(dices) - K))))

### FIXED CODE ###

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

dices = list(map(int, input().split()))

# 期待値は(1+P)/2 https://rikeilabo.com/sum-formula-of-numerical-sequence
# 累積和を求めておく．隣接するK個の和はS_{j+K} - S_j
# 期待値の前計算→累積和の計算→隣接するK項の和の計算 (１乗オーダー)
E_list = []
for dice in dices:
    E_list.append((1 + dice) * 0.5)

S_list = []  # i番目までのサイコロの期待値の累積和
for i in range(len(dices)):
    # S_list.append(sum(E_list[:i + 1]))  # アホ
    S_list.append(E_list[0] if i == 0 else S_list[i - 1] + E_list[i])

print(max(list(S_list[j + K] - S_list[j] for j in range(len(dices) - K))) if len(dices) != K else S_list[-1])
import copy

import numpy as np


def main():
    N = int(inpupt())
    X = np.array(list(map(int, input().split())))
    m = np.median(X)

    XX = copy.deepcopy(X)
    mm = np.argmin(X)
    XX = np.delete(XX, mm)
    m0 = np.median(XX)

    XX = copy.deepcopy(X)
    mm = np.argmax(X)
    XX = np.delete(XX, mm)
    m1 = np.median(XX)

    for x in X:
        if x <= m:
            print(m0)
        else:
            print(m1)


main()


### FIXED CODE ###

import copy

import numpy as np


def main():
    N = int(input())
    X = np.array(list(map(int, input().split())))
    m = np.median(X)

    XX = copy.deepcopy(X)
    mm = np.argmin(X)
    XX = np.delete(XX, mm)
    m0 = int(np.median(XX))

    XX = copy.deepcopy(X)
    mm = np.argmax(X)
    XX = np.delete(XX, mm)
    m1 = int(np.median(XX))

    for x in X:
        if x <= m:
            print(m0)
        else:
            print(m1)


main()
s = input()
 
for i in range(len(s))
	if i%2==0 and s[i]=='R':
    	print('No')
    	exit()
    elif i%2==1 and s[i]=='L':
    	print('No')
    	exit()
 
print('Yes')

### FIXED CODE ###

s = input()
 
for i in range(len(s)):
	if i%2==1 and s[i]=='R':
		print('No')
		exit()
	elif i%2==0 and s[i]=='L':
		print('No')
		exit()
 
print('Yes')
a = input() 
b = input()
print a * b + " " + 2 * a + 2 * b

### FIXED CODE ###

a, b = map(int, raw_input().split())
print a * b, 2 * a + 2 * b
def dfs(X,Y,ch):
	stack.append([X,Y])
	field[X][Y] = '.'
	while len(stack) != 0:
		x,y = stack.pop()
		for i in range(4):
				nx = x+moveY[i]
				ny = y+moveX[i]
				if (nx >= 0 and ny >= 0) and(nx < H and ny < W) and field[nx][ny] == ch:
					if field[nx][ny] == '#' or field[nx][ny] == '*'or field[nx][ny] == '@':
						field[nx][ny] = '.'
						stack.append([nx,ny])
stack = []
moveY = [-1,0,1,0]
moveX = [0,1,0,-1]
H,W = map(int,raw_input().split(' '))
field = ['' for i in range(H)]
h = 0
while True:
	s = raw_input()
	if s == '0 0':
		break
	field[h] = list(s)
	h += 1
correct =0
for i in range(H):
	for j in range(W):
		if field[i][j] == '@' or field[i][j] == '#'or field[i][j] == '*':
			dfs(i,j,field[i][j])
			correct += 1
print correct

### FIXED CODE ###

def dfs(X,Y,ch):
	stack.append([X,Y])
	field[X][Y] = '.'
	while len(stack) > 0:
		x,y = stack.pop()
		for i in range(4):
				nx = x+moveY[i]
				ny = y+moveX[i]
				if nx < 0 or ny < 0 or nx >= H or ny >= W or field[nx][ny] != ch:
					continue
				if field[nx][ny] == '#' or field[nx][ny] == '*'or field[nx][ny] == '@':
					field[nx][ny] = '.'
					stack.append([nx,ny])
stack = []
moveY = [-1,0,1,0]
moveX = [0,1,0,-1]
while True:
	H,W = map(int,raw_input().split(' '))
	if H == 0 and W == 0:
		break
	field = [list(raw_input()) for i in range(H)]
	correct =0
	for i in range(H):
		for j in range(W):
			if field[i][j] == '@' or field[i][j] == '#'or field[i][j] == '*':
				dfs(i,j,field[i][j])
				correct += 1
	print correct
a=input()
res=0
if a[1]=="+":
    res=int(a[0])+int(a[2])
else:
    res=int(a[0])-int(a[2])
print(res)
    

### FIXED CODE ###

# python
my_input = str(input())
print(str(eval(my_input)))
import networkx as nx

n, m = map(int, input().split())
g = nx.Graph()
g.add_nodes_from(range(1, n+1))
for i in range(m):
    x, y, z = map(int, input().split())
    g.add_edge(x, y)
print(nx.number_connected_components(g))

### FIXED CODE ###

from collections import Counter


class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

    def get_size(self, x):
        x = self.find(x)
        return self.size[x]


n, m = map(int, input().split())

uf = UnionFind(n)
for i in range(m):
    x, y, z = map(int, input().split())
    uf.union(x-1, y-1)

c = Counter([uf.find(i) for i in range(n)])
print(len(c))
import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    AB = [NLI() for _ in range(N)]
    
    for n in range(N):
        if AB[n][0] == AB[n][1]:
            if AB[n+1][0] == AB[n+1][1]:
                if AB[n+2][0] == AB[n+2][1]:
                    print("Yes")
                    sys.exit()
    print("No")





if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    AB = [NLI() for _ in range(N)]
    
    for n in range(N-2):
        if AB[n][0] == AB[n][1]:
            if AB[n+1][0] == AB[n+1][1]:
                if AB[n+2][0] == AB[n+2][1]:
                    print("Yes")
                    sys.exit()
    print("No")





if __name__ == '__main__':
    main()
n,m = map(int,input().split())
t='000'
if n==2: t='010'
if n==3: t='100'
f=[0]*len(t)
t=[int(t[0]),int(t[1]),int(t[2])]
for i in range(m):
    ans = -1
    s,c = map(int,input().split())
    s=s-(n-2)
    if c <  t[s]: break
    if c >  t[s]:
        if f[s]==0:
            f[s],t[s]=1,c
        elif f[s]==1:
            break
    ans=t[0]*100+t[1]*10+t[2]
print(ans)
print(f)

### FIXED CODE ###

n,m = map(int,input().split())
t='000'
if n==2: t='010'
if n==3: t='100'
f=[0]*len(t)
t=[int(t[0]),int(t[1]),int(t[2])]
ans = t[0]*100+t[1]*10+t[2] 
for i in range(m):
    ans = -1
    s,c = map(int,input().split())
    s=s-(n-2)
    if c <  t[s]: break
    if c >  t[s]:
        if f[s]==0:
            f[s],t[s]=1,c
        elif f[s]==1:
            break
    ans=t[0]*100+t[1]*10+t[2]
print(ans)
# abc 152 e
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

N = int(readline().rstrip())
al = list(map(int, readline().split()))

# 最大公約数
from fractions import gcd

# 最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)

lcm_ = 0
for a in al:
    if lcm_ == 0:
        lcm_ = a
        continue
    lcm_ = lcm(a, lcm_)

prime = 10 ** 9 + 7
bl = []
for a in al:
    b = int(lcm_ / a)
    bl.append(b)

answer = sum(bl)
print(answer)

### FIXED CODE ###

# abc 152 e
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

MOD = 10 ** 9 + 7

N = int(readline().strip())
A = list(map(int, readline().split()))

from fractions import gcd
def lcm(a, b):
    return (a * b) // gcd(a, b)

lcm_ = 1  # 倍数を出したいので初期値は1
for i in range(N):
    lcm_ = lcm(lcm_, A[i])

ans = 0
for i in range(N):
    ans += lcm_ * pow(A[i], MOD-2, MOD)

print(ans % MOD)
N , M = map(int,input().split())

if N = M:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

x,y = map(int,input().split())
if x == y:
    print('Yes')
else:
    print('No')
hoge = ["FizzBuzz" if i % 3 == 0 and i % 5 == 0 else("Fizz" if i % 3 == 0 else("Buzz" if i % 5 == 0 else str(i))) for i in range(10001)]

while True:
    m, n = map(int, input().split())
    if m == 0:
        break
    man = [str(i) for i in range(1, m+1)]
    a, b = divmod(n, m)
    man = a*man+man[:b]
    idx, k = 0, 1
    while k < n+1:
        x = input()
        if hoge[k] == x:
            idx += 1
        else:
            v = man[idx]
            man = list(filter((v).__ne__, man))
            if len(set(man)) == 1:
                for i in range((n+1)-k):
                    input()
                break
        k += 1
    print(*sorted(list(set(man))))

### FIXED CODE ###

hoge = ["FizzBuzz" if i % 15 == 0 else("Fizz" if i % 3 == 0 else("Buzz" if i % 5 == 0 else str(i))) for i in range(10001)]

while True:
    m, n = map(int, input().split())
    if m == 0:
        break
    man = list(range(1, m+1))
    game = [input() for _ in range(n)]
    idx = 0
    for i in range(n):
        if game[i] != hoge[i+1]:
            del man[idx]
            if len(man) == 1:
                break
        else:
            idx += 1
        idx %= len(man)
    print(*man)
print(int(input()/3)**3)

### FIXED CODE ###

print((int(input())/3)**3)
#include <iostream>
using namespace std;

int main() {
  int A, N;
  cin >> A >> N;
  
  if (0 <= A <=499 && (N - A) % 500 <= A){
    cout << "Yes" << endl;
  }
  else if (0 <= A <= 499 && A < (N - A) % 500){
    cout << "No" << endl;
  }
  else if (500 <= A <= 1000){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

### FIXED CODE ###

n=int(input())
a=int(input())
if n%500<=a:
    print('Yes')
else:
    print('No')
a=input()
if a[0]==a[1] and a[1]==a[2] || a[1]==a[2] and a[2]==a[3]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a=input()
if a[0]==a[1] and a[1]==a[2] or a[1]==a[2] and a[2]==a[3]:
  print("Yes")
else:
  print("No")
import bisect

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""

ans = 10**100

if x[idx] == 0 and idx - k + 1 >= 0:
    ans = min(ans,-x[0])

print(ans)
exit()

for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

print(ans)

### FIXED CODE ###

import bisect

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""
ans = 10**100


for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

if idx == n:
    ans = -x[-k]

print(ans)
import math
n=int(input())
lst=[]
up=math.ceiling(math.sqrt(n))-1
for i in range(1,up+1):
    if i**2>n:
        break
    if n%i==0:
        lst.append(i+n//i)
print(min(lst)-2)


### FIXED CODE ###

n=int(input())
lst=[]
for i in range(1,n):
    if i**2>n:
        break
    if n%i==0:
        lst.append(i+n//i)
print(min(lst)-2)
A,B,C=map(int,input().split())

li=[A,B,C]

max_num=max(li)
max_num2=-10000

for i in li:
    if max_num!=i and max_num2<i:
        max_num2=i
        
num1=int(str(max_num)+str(max_num2))
li.remove(max_num)
li.remove(max_num2)

print(int(num1)+li[0])

### FIXED CODE ###

A,B,C=map(int,input().split())

li=[A,B,C]

max_num=max(li)
max_num2=min(li)

for i in li:
    if max_num!=i and max_num2<i:
        max_num2=i
        
num1=int(str(max_num)+str(max_num2))
li.remove(max_num)
li.remove(max_num2)

print(int(num1)+li[0])
import bisect
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
n0 = 0
np = 0
nn = 0
for i in a:
  if i>0:
    np += 1
  elif i == 0:
    n0 += 1
  else:
    nn += 1
kp = (np**2-np+nn**2-nn)//2
k0 = n0*(n-n0)+(n0**2-n0)//2
kn = nn*np
if kn < k <= kn+k0:
  print(0)
  exit()
nls = []
pls = []
for i in range(n):
  if a[i] < 0:
    nls.append(a[i])
  elif a[i] > 0:
    pls.append(a[i])
ln = len(nls)
lp = len(pls)
if k <= kn:
  l = a[0]*a[-1]
  r = 0
  while l+1 < r:
    m = (l+r)//2
    tmp = 0
    for i in range(ln):
      tmp += bisect.bisect_right(pls,m//nls[i])
    if tmp >= kn-k:
      l = m
    else:
      r = m
  print(l)
else:
  print(2/0)

### FIXED CODE ###

import bisect
import numpy as npy
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
n0,np,nn = 0,0,0
for i in a:
  if i>0:  np += 1
  elif i == 0:  n0 += 1
  else:  nn += 1
kp = (np**2-np+nn**2-nn)//2
k0 = n0*(n-n0)+(n0**2-n0)//2
kn = nn*np
if kn < k <= kn+k0:
  print(0)
  exit()
nls = []
pls = []
for i in range(n):
  if a[i] < 0:
    nls.append(a[i])
  elif a[i] > 0:
    pls.append(a[i])
ln = len(nls)
lp = len(pls)
nls = npy.array(nls,dtype=npy.int64)
pls = npy.array(pls,dtype=npy.int64)
if k <= kn:
  l = a[0]*a[-1]-1
  r = 0
  while l+1 < r:
    m = (l+r)//2
    mls = m//nls
    tmp = npy.searchsorted(pls,mls,side="right").sum()
    if tmp > kn-k:
      l = m
    else:
      r = m
  print(l)
else:
  nls = -nls
  nls = nls[::-1]
  k -= kn+k0
  l = 0
  r = max(a[0]**2,a[-1]**2)+1
  while l+1 < r:
    m = (l+r)//2
    tmp  = npy.searchsorted(nls,m//nls,side="right").sum()
    tmp += npy.searchsorted(pls,m//pls,side="right").sum()
    tmp -= npy.searchsorted(nls**2,m,side="left")
    tmp -= npy.searchsorted(pls**2,m,side="left")
    if tmp >= 2*k:
      r = m
    else:
      l = m
  print(r)
A, B, K = map(int, input().split())

if A => K:
    A -= K
elif A < K < A + B:
    B -= K - A
    A = 0
elif A + B <= K:
    A = B = 0
    
print(A, B)
    

### FIXED CODE ###

A, B, K = map(int, input().split())

if A >= K:
    A -= K
elif A < K < A + B:
    B -= K - A
    A = 0
elif A + B <= K:
    A = B = 0
    
print(A, B)
import math
N = int(input())
A = [int(x) for x in input().split()]

for i in range(N):
    if i == 0:
        tmp = A[i]
    if i == N:
        break
    else:
        tmp = math.gcd(tmp, A[i])

print(tmp)


### FIXED CODE ###

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x%y == 0:
        return y
    else:
        while x%y != 0:
            z = x%y
            x = y
            y = z
        else:
            return z
    
N = int(input())
A = [int(x) for x in input().split()]

for i in range(N):
    if i == 0:
        tmp = A[i]
    if i == N:
        break
    else:
        tmp = gcd(tmp, A[i])

print(tmp)
import math
n = int(input())
print(math.factrial(n) % (10**9 + 7))

### FIXED CODE ###

import math
n = int(input())
print(math.factorial(n) % (10**9 + 7))
a, b, c, d = input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
def m():
    if a>=0:and d<=0:
        max=a*d
        print(max)
    elif a>=0 and c>=0:
        max=b*d
        print(max)
    elif b<=0 and c>=0:
        max=b*c
        print(max)
    elif b<=0 and d<=0:
        max=a*c
        print(max)
        
m()


### FIXED CODE ###

a, b, c, d = input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
def m():
    if -1000000000<=a<=b<=1000000000 and -1000000000<=c<=d<=1000000000:
        if a>=0 and d<=0:
            max=a*d
            print(max)
        elif a>=0 and c>=0:
            max=b*d
            print(max)
        elif b<=0 and c>=0:
            max=b*c
            print(max)
        elif b<=0 and d<=0:
            max=a*c
            print(max)
        elif a<=0 and b>=0 and c<=0 and d>=0:
            if a*c>=b*d:
                max=a*c
                print(max)
            else:
                max=b*d
                print(max)
        elif a>=0 and c<=0 and d>=0:
            max=b*d
            print(max)
        elif b<=0 and c<=0 and d>=0:
            max=a*c
            print(max)
        elif a<=0 and b>=0 and c>=0:
            max=b*d
            print(max)
        elif a<=0 and b>=0 and d<=0:
            max=a*c
            print(max)

m()
import math

A, B = map(int,input().split())

def lcm(A, B):
    return (A * B) // math.gcd(A, B)

print(lcm(A, B))

### FIXED CODE ###

import fractions

A, B = map(int,input().split())

def lcm(A, B):
    return (A * B) // fractions.gcd(A, B)

print(lcm(A, B))
#!python3

# input
N = int(input())
X = input()


def popcount(n):
    return bin(n).count("1")


def solve(n):
    if n == 0:
        return 0
    c = popcount(n)
    return 1 + solve(n % c)


def main():
    c = X.count("1")
    a, b = 0, 0
    for i in range(N):
        if X[-1 - i] == "1":
            a = (a + pow(2, i, c - 1)) % (c - 1)
            b = (b + pow(2, i, c + 1)) % (c + 1)
    for i in range(N):
        if c == 1 and X[i] == "1":
            print(0)
            continue
        if X[i] == "1":
            m = c - 1
            w = (a - pow(2, N - 1 - i, m)) % m
        else:
            m = c + 1
            w = (b + pow(2, N - 1 - i, m)) % m
        ans = solve(w) + 1
        print(ans)
            

if __name__ == "__main__":
    main()


### FIXED CODE ###

#!python3

# input
N = int(input())
X = input()


def popcount(n):
    return bin(n).count("1")


def solve(n):
    if n == 0:
        return 0
    c = popcount(n)
    return 1 + solve(n % c)


def main():
    c = X.count("1")
    if c == 0:
        for _ in range(N):
            print(1)
        return
    a, b = 0, 0
    for i in range(N):
        if c == 1 and X[-1 - i] == "1":
            b = (b + pow(2, i, c + 1)) % (c + 1)
        elif X[-1 - i] == "1":
            a = (a + pow(2, i, c - 1)) % (c - 1)
            b = (b + pow(2, i, c + 1)) % (c + 1)
    for i in range(N):
        if c == 1 and X[i] == "1":
            print(0)
            continue
        if X[i] == "1":
            m = c - 1
            w = (a - pow(2, N - 1 - i, m)) % m
        else:
            m = c + 1
            w = (b + pow(2, N - 1 - i, m)) % m
        ans = solve(w) + 1
        print(ans)
            

if __name__ == "__main__":
    main()
H, N = map(int,input().split())
A = list(map(int, input().split()))

sum = 0

for i in range(A.length()):
    sum += A[i]

if(sum >= H):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

H, N = map(int, input().split())
A = list(map(int,input().split()))

sum = 0

for i in range(len(A)):
    sum += A[i]

if(sum >= H):
    print("Yes")
else:
    print("No")
x,y,a,b,c=map(int,input().split())
p,q,r=[reversed(sorted(list(map(int,input()))) for i in range(3))]
p=p[0:x]
q=q[0:y]
p.append(0)
q.append(0)
r.append(0)

s=0
i,j,k=0,0,0

for _ in range(x+y):
  if p[i]>=q[j] and p[i]>=r[k]:
    s+=p[i]
    i+=1
  elif q[j]>=r[k]:
    s+=q[j]
    j+=1
  else:
    s+=r[k]
    k+=1
    
print(s)

### FIXED CODE ###

x,y,a,b,c=map(int,input().split())
p,q,r=[list(reversed(sorted(list(map(int,input().split()))))) for i in range(3)]
p=p[0:x]
q=q[0:y]
p.append(0)
q.append(0)
r.append(0)

s=0
i,j,k=0,0,0

for _ in range(x+y):
  if p[i]>=q[j] and p[i]>=r[k]:
    s+=p[i]
    i+=1
  elif q[j]>=r[k]:
    s+=q[j]
    j+=1
  else:
    s+=r[k]
    k+=1
    
print(s)