Harryxun/stf_run huggingface dataset:
d = {i: 1 for i in p}
idx = X
while True:
    if d.get(idx) is None:
        ans_plus = idx
        break
    else:
        idx += 1

idx = X
while True:
    if d.get(idx) is None:
        ans_minus = idx
        break
    else:
        idx -= 1

if abs(X - ans_plus) < abs(X - ans_minus):
    print(ans_plus)
elif abs(X - ans_plus) > abs(X - ans_minus):
    print(ans_minus)
else:
    print(ans_minus)

### FIXED CODE ###

X, N = map(int, input().split())
p = list(map(int, input().split()))

d = {i: 1 for i in p}
idx = X
while True:
    if d.get(idx) is None:
        ans_plus = idx
        break
    else:
        idx += 1

idx = X
while True:
    if d.get(idx) is None:
        ans_minus = idx
        break
    else:
        idx -= 1

if abs(X - ans_plus) < abs(X - ans_minus):
    print(ans_plus)
else:
    print(ans_minus)
S = [*input()] # これで文字列を一文字にできる
T = input()

for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if word == T:
        print('Yes')
        break
    elif i == j:
        print('No')
        break


### FIXED CODE ###

S = tuple(input()) # これで文字列を一文字にできる
T = input()

for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if word == T:
        print('Yes')
        break
    elif i == j:
        print('No')
        break
n,k=map(int,raw_input().split())
arr=map(int,raw_input().split())
na=[]
for i in range(k+1):
    na.append(abs(arr[0]-arr[i]))
for i in range(k+1,n):
    m=9999999
    for j in range(i-k,i):
        m=min(na[j]+abs(arr[i]-arr[j]),m)
    na.append(m)
print na[-1]
        


### FIXED CODE ###

n,k=map(int,raw_input().split())
arr=map(int,raw_input().split())
na=[0 for i in range(n)]
for i in range(1,n):
    m=999999999
    for j in range(max(i-k,0),i):
        m=min(m,na[j]+abs(arr[i]-arr[j]))
    na[i]=m
print na[-1]
a, b, t = map(int, input().split())

count = 0
for i range(1, t+1, a):
  count += i * b
print(count)
  

### FIXED CODE ###

a, b, t = map(int, input().split())
 
count = 0
for i in range(0, t+1, a):
    count += b
print(count - b)
N = int(input())

p=0
q=0

for _ in range(N):
    a=int(input())
    if a>=p:
        q=p
        p=a

if p==1:
    print('first')
elif (p-q)%2==0:
    print('second')
else:
    print('first')



### FIXED CODE ###

from math import sqrt

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

if N==1:
    print(P)
else:
    dic={}
    p=2
    while p<=sqrt(P):
        cnt=0
        while P%p==0:
            P=int(P/p)
            cnt+=1
        if cnt>0:
            dic[p]=cnt
        p+=1

    ans=1
    for p in dic.keys():
        ans *= p**int(dic[p]/N)
    print(ans)
x = int(input())
y = int(input())
z = int(input())
temp = x
x = z
z = y
y = temp

print(x,y,z)


### FIXED CODE ###

X, Y, Z = input().split()
A = X
B = Y
C = Z
temp = A
A = B
B = temp
temp = A
A = C
C = temp

print(A, B, C);
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x) -> int:
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y) -> None:
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x) -> int:
        return -self.parents[self.find(x)]

    def same(self, x, y) -> bool:
        return self.find(x) == self.find(y)

    def members(self, x) -> list:
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self) -> list:
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self) -> int:
        return len(self.roots())

    def all_group_members(self) -> dict:
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m=map(int,input().split())
a=UnionFind(n)
for i in range(m):
    b,c=map(int,input().split())
    a.union(b,c)
print(a.group_count()-1)

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x) -> int:
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y) -> None:
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x) -> int:
        return -self.parents[self.find(x)]

    def same(self, x, y) -> bool:
        return self.find(x) == self.find(y)

    def members(self, x) -> list:
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self) -> list:
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self) -> int:
        return len(self.roots())

    def all_group_members(self) -> dict:
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m=map(int,input().split())
a=UnionFind(n)
for i in range(m):
    b,c=map(int,input().split())
    a.union(b-1,c-1)
print(a.group_count()-1)
a,b,c,d=map(int,input().split())
n=1
while c-b*n>0 and a-d*n>0
    n+=1
if c-b*(n+1)<=a-d*(n+1):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a,b,c,d=map(int,input().split())
n=1
while c-b*n>0 and a-d*n>0:
    n+=1
if c-b*n<=0:
    print('Yes')
else:
    print('No')
import copy
N,K = list(map(int, input().split()))
 
A = list(map(int, input().split()))
 
count = [0]
Check = [0] * N
for i in range(K):
    count.append(A[count[-1]]-1)
    if(Check[count[-1] - 1] == 1):
        break
 
    Check[count[-1] -1] = 1
    i += 1
 
 
saisyo = count.index(count[-1]) + 1
 
loop_kazu = len(count) - saisyo
K_loop = K - saisyo
 
ans_index = K_loop % loop_kazu
ans = count[saisyo + ans_index] + 1
 
print(ans)
 

### FIXED CODE ###

import copy
N,K = list(map(int, input().split()))
 
A = list(map(int, input().split()))
 
count = [0]
Check = [0] * N
for i in range(K):
    count.append(A[count[-1]]-1)
#    print(count)
    if(Check[count[-1]-1] == 1):
        break
 
    Check[count[-1]-1] = 1
    i += 1
 
saisyo = count.index(count[-1]) + 1
#print(count,saisyo)
 
if(saisyo == len(count)):
    saisyo = 0
 
loop_kazu = len(count) - saisyo
 
if(K > loop_kazu):
    K_loop = K - saisyo
 
    ans_index = K_loop % loop_kazu
    ans = count[saisyo + ans_index] + 1
 
    print(ans)
 
else:
    print(count[K]+1)
S = str(input())
l = len(S)
a = int(0)
b= int(0)
ans = [0]*l
ansc=int(0)
ansv=int(0)
ansi=int(0)

newS = S.split('LR')

k = len(newS)

for i in range(k):
    if i ==0:
        a = newS[i].count('R')
        b = len(newS[i])-a
        ansc = (a+1)//2 + b//2 +1
        ansv = a//2 + (b+1)//2
        ansi += newS[i].index('RL')
        ans[ansi]=ansc
        ans[ansi+1]=ansv
        ansi = len(newS[i])

    elif i < k-1:
        a = newS[i].count('R')
        b = len(newS[i])-a
        ansc = (a)//2 + (b+1)//2 + 1
        ansv = (a+1)//2 + (b)//2 + 1
        if 'RL' in newS[i]:
            ansi += newS[i].index('RL')+1
        else:
            ansi +=1
        ans[ansi]=ansc
        ans[ansi+1]=ansv
        ansi += (len(newS[i])+1)
    else:
        a = newS[i].count('R')
        b = len(newS[i]) - a
        ansc = (a) // 2 + (b+1) // 2
        ansv = (a+1) // 2 + (b) // 2 + 1
        if 'RL' in newS[i]:
            ansi += newS[i].index('RL')+2
        else:
            ansi += 2
        ans[ansi] = ansc
        ans[ansi + 1] = ansv


print(' '.join(map(str, ans)))


### FIXED CODE ###

#from collections import deque
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7

S = str(input())
N = len(S)
ans = [0]*N
k = int(1)
R = []
L = []
rcount = int(1)
lcount = int(0)
lLocate = []
for i in range(1,N):
    if S[i]==S[i-1]:
        if k == 1:
            rcount +=1
        else:
            lcount +=1
    else:
        if k==1:
            R.append(rcount)
            lLocate.append(i-1)
            lcount = int(1)
        else:
            L.append(lcount)
            rcount = int(1)

        k *= (-1)


L.append(lcount)

#print(R)
#print(L)
#print(lLocate)
j = int(0)
#for i in range(N):
#    if i in lLocate:
for i in lLocate:
    r = R[j]
    l = L[j]
    ans[i] = (r+1)//2 + l//2
    ans[i+1] = r//2 + (l+1)//2
    j +=1

print(' '.join(map(str, ans)))
N, M, K =map(int().input().aplit())
bases = list(map(int,input()))
ans=0

for i in range(M):
  A = list(map(int,input().split()))
  tmp=0
  for j in range(3):
    tmp+= bases[j]*A[j]
  if tmp>0:
    ans+=1
    
print(ans)

### FIXED CODE ###

N, M, K =map(int,input().split())
bases = list(map(int,input().split()))
ans=0

for i in range(N):
  a= list(map(int,input().split()))
  tmp=0
  for j in range(M):
    tmp+= bases[j]*a[j]
  
  if tmp+K>0:
    ans+=1
    
print(ans)
import itertools
N,M = map(int,input().split())
A = []
X = [[0]]*M

for m in range(M):
  a,b = map(int,input().split())
  A.append([a,b])
  X[m] = X[m] + [a] + [b]


ans = []
XX = []
for _ in range(N-1):
  for x,v in itertools.product(X,A):   
    if x[-1] == v[0]:
      if v[1] in x:
        ans.append(x+[v[1]])
      else:
        XX.append(x + [v[1]])
    X = XX

if ans == []:
  print(-1)
else:
  n = m+2
  for a in ans:
    if n > len(a):
      n = len(a)
      ans_min = a[:-1]
  ans_min[0] = len(ans_min)-1
  print(*ans_min)


### FIXED CODE ###

def main():
  from collections import deque
  n,m,*t=map(int,open(0).read().split())
  i=[0]*n
  o=[[]for _ in range(n)]
  for a,b in zip(*[iter(t)]*2):
    o[a-1]+=b-1,
    i[b-1]+=1
  q=deque(v for v,f in enumerate(i)if f<1)
  r=[]
  while q:
    v=q.popleft()
    r+=v,
    for w in o[v]:
      i[w]-=1
      if i[w]==0:q+=w,
  print(-(len(r)==n))
main()
import collections
n = input()
a = list(map(int, input().split()))
a = Counter(a)
for i in range(n):
  print(a[i])


### FIXED CODE ###

import collections
n = int(input())
A = list(map(int, input().split()))
cnt = collections.Counter(A)
for i in range(1,n+1):
  print(cnt[i])
a=str(input())
b=str(input())
c=str(input())
d=str(input())
e=str(input())

#menu=[int(a[-1]),int(b[-1]),int(c[-1]),int(d[-1]),int(e[-1])]
menu=[a[-1],b[-1],c[-1],d[-1],e[-1]]
menu.sort()
while menu[0]=="0":
    menu.remove("0")
iti=int(menu[0])

marume=10 * (len(menu)-1)


time=0
kuso=[a,b,c,d,e]

for temp in kuso:
    if len(temp)==2:
        time+=int(temp[-2])*10
    elif len(temp)==3:
        time+=100 + 10*int(temp[-2])
    else:
        time+=0
        
print(iti + marume +time)

### FIXED CODE ###

a=str(input())
b=str(input())
c=str(input())
d=str(input())
e=str(input())

#menu=[int(a[-1]),int(b[-1]),int(c[-1]),int(d[-1]),int(e[-1])]
menu=[a[-1],b[-1],c[-1],d[-1],e[-1]]
menu.sort()

if int(menu[4])==0:
    iti=0
    marume=0
else:
    while menu[0]=="0":
        menu.remove("0")
    iti=int(menu[0])
    marume=10 * (len(menu)-1)


time=0
kuso=[a,b,c,d,e]

for temp in kuso:
    if len(temp)==2:
        time+=int(temp[-2])*10
    elif len(temp)==3:
        time+=100 + 10*int(temp[-2])
    else:
        time+=0
                
print(iti + marume +time)
a1,bi = map(int, input().split())
a2,b2 = map(int, input().split())
a3,b3 = map(int, input().split())
 
ne = [1,1,2,3,4]
 
ne[max(a1,b1)] = min(a1,b1)
ne[max(a2,b2)] = ne[min(a2,b2)]
ne[max(a3,b3)] = ne[min(a3,b3)]
 
ne = set(ne)
ne = list(ne)
 
if len(ne) == 1:
  print('YES')
else:
  print('NO')

### FIXED CODE ###


def find(x):
    while table[x] >= 0:
        x = table[x]
    return x

def union(x, y):
    s1 = find(x)
    s2 = find(x)
    if s1 != s2:
        if table[s1] != table[s2]:
            if table[s1] < table[s2]:
                table[s2] = s1
            else:
                table[s1] = s2
        else:
            table[s1] -= 1
            table[s2] = s1
    return
    


a1, b1 = map(int, input().split())
a2, b2 = map(int, input().split())
a3, b3 = map(int, input().split())

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

ans[a1-1] += 1 
ans[a2-1] += 1 
ans[a3-1] += 1 
ans[b1-1] += 1 
ans[b2-1] += 1 
ans[b3-1] += 1 

if 0 in ans or 3 in ans:
    print("NO")
else:
    print("YES")
n=int(input())
a=[input() for i in range(n)]
bu=0
end=-1
for i in range(n):
   if bu==1:
    end=i-1
    break
  bu=a[bu]-1
print(end)

### FIXED CODE ###

n=int(input())
a=[int(input()) for i in range(n)]
bu=0
end=-1
for i in range(n):
  if bu==1:
    end=i
    break
  bu=a[bu]-1
print(end)
h1, m1, h2, m2, k = map(int,input().split())
 
h=h2 - h1
if h < 0:
    h = 24+h
    m=m2 - m1
    du=h*60+m-k
elif h == 0:
    if m1 < m2:
        du = m2-m1-k
else:
    du = h*60+m-k
        
print(du)

### FIXED CODE ###

h1, m1, h2, m2, k = map(int,input().split())
 
h=h2 - h1
if h < 0:
    h = 24+h
    m=m2 - m1
    du=h*60+m-k
elif h == 0:
    if m1 < m2:
        du = m2-m1-k
    else:
        du = 24*60 +(m2-m1)-k
else:
    du = h*60+(m2-m1)-k
        
print(du)
import collections
N = map(int, input().split())
A = list(map(int, input().split()))
Q = map(int, input().split())
 
base = 0
cnt = collections.Counter(A)    
Ans = []
 
for i in range(N):
    base += A[i]

for i in range(Q):
  b,c = map(int, input().split())
  ans = base + (c-b) * cnt[b]
  Ans.append(ans)
  cnt[c] += cnt[b]
  cnt[b] = 0
  base = ans

print(Ans)

### FIXED CODE ###

import collections

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

CNT = collections.Counter(A)
ANS = []
ans = sum(A)

for i in range(q):
    b, c = map(int, input().split())
    t = CNT[b]
    ans +=(c - b) * t
    ANS.append(ans)
    CNT[c] += t
    CNT[b] = 0

for i in ANS:
    print(i)
r = int(input("r--->"))
g = int(input("g--->"))
b = int(input("b--->"))

s = r+b+g

if r%4 == 0:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

r, g, b = (int(x) for x in input().split())


s = 100*r+10*g+b

if s%4 == 0:
    print("YES")
else:
    print("NO")
# your code goes here
S = input()
T = input()

ans = False
for i in range(len(T)):
	if S[0] == T[i]:
		flag = True
		for j in range(len(S)):
			if S[j] != T[(i+j)%len(T)]:
				flag = False
				break
	if flag:
		ans = True
		break
		
if ans:
	print('Yes')
else:
	print('No')

### FIXED CODE ###

# your code goes here
S = list(input())
T = list(input())

ans = False
for i in range(len(S)):
	if S == T:
		ans = True
		break
	S.insert(0,S[-1])
	del S[-1]
		
if ans:
	print('Yes')
else:
	print('No')
n, m = map(int, input().split())
a = list(map(int, input().split()))
a = [i//2 for i in a]

def f(x):
  cnt = 0
  while x%2 == 0:
    x /= 2
    cnt += 1
  return cnt

def lcm(x, y):
  z = x * y
  if x < y:
    x, y = y, x
  while x%y != 0:
    x, y = y, x%y
  return z // y

t = f(a[0])
for i in range(1, t):
  if f(a[i]) != t:
    print(0)
    break
  a[i] >>= t
m >>= t

L = a[0]
for i in range(1, n):
  L = lcm(L, a[i])
  if L > m:
    print(0)
    break

m //= L
ans = (m+1) // 2
print(ans)

### FIXED CODE ###

import sys

def f(x):
  cnt = 0
  while x%2 == 0:
    x /= 2
    cnt += 1
  return cnt

def gcd(x, y):
  if y:
    return gcd(y, x%y)
  else:
    return x

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


n, m = map(int, input().split())
a = list(map(int, input().split()))
a = [i//2 for i in a]

t = f(a[0])
for i in range(n):
  if f(a[i]) != t:
    print(0)
    sys.exit()
  a[i] >>= t
m >>= t

l = 1
for i in range(n):
  l = lcm(l, a[i])
  if l > m:
    print(0)
    sys.exit()

m //= l
ans = (m+1) // 2
print(ans)
N = int(input())
X = list(map(int,input().rstrip().split(" ")))
ans = 0
ansb = 0
for i in range(100):
  ansb = 0
  for i2 in range(N):
    ansb += (X[i2] - i)**2
  if i == 0 or ans > ansb:
    ans = ansb
print(ans)


### FIXED CODE ###

N,R = map(int,input().rstrip().split(" "))
if N >= 10:
  print(R)
else:
  print(R + (10-N)*100)
X,Y = map(int,input().split())
# 何回移動するか
r = (X+Y)//3
# 移動の可能性 rC(x-r)
from functools import reduce
mod = 10**9+7
if (X+Y)%3==0:
    r = (X+Y)//3
    if r != X and r != Y:
        if r != X*0.5 and r != Y*0.5:
            num = reduce(lambda x,y:x*y%mod,[k+1 for k in range(r)])
            p = reduce(lambda x,y:x*y%mod,[k+1 for k in range(X-r)])
            q = reduce(lambda x,y:x*y%mod,[k+1 for k in range(2*r-X)])
            ans = num*pow(p,mod-2,mod)*pow(q,mod-2,mod)%mod
            print(ans%mod)  
        else:
            num = reduce(lambda x,y:x*y%mod,[k+1 for k in range(r)])
            p = reduce(lambda x,y:x*y%mod,[k+1 for k in range(X-r)])
            ans = num*pow(p,mod-2,mod)%mod
            print(ans%mod)  
    else:
        print(1)
else:
    print(0)

### FIXED CODE ###

X,Y = map(int,input().split())
# 何回移動するか
r = (X+Y)//3
# 移動の可能性 rC(x-r)
from functools import reduce
mod = 10**9+7

if (X+Y)%3==0 and X<= 2*Y and Y<= 2*X :
    r = (X+Y)//3
    l = min
    if r != X and r != Y:
        num = reduce(lambda x,y:x*y%mod,[k+1 for k in range(r)])
        p = reduce(lambda x,y:x*y%mod,[k+1 for k in range(X-r)])
        q = reduce(lambda x,y:x*y%mod,[k+1 for k in range(2*r-X)])
        ans = num*pow(p,mod-2,mod)*pow(q,mod-2,mod)%mod
        print(ans%mod)   
    else:
        print(1)
else:
    print(0)
n = int(input())
s = input()
if(n&1):
  print("No")
else:
  for i in range(n/2):
    if s[i]!=s[n+i]:
      print("No")
      break
  else:
    print("Yes")

### FIXED CODE ###

n = int(input())
s = input()
if(n&1):
  print("No")
else:
  if(s[:n//2]==s[n//2:]):
    print("Yes")
  else:
    print("No")
n=int(input())
mod=10**9+7
memo=[[] for _ in range(n+1)]
def ok(last4):
    for i in range(4):
        t=list(last4)
        if i>=1:
            t[i-1],t[i]=t[i],t[i-1]
        if "".join(t).count("AGC")>=1:
            return False
    return True

def dfs(cur,last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur==n:
        return 1
    ret=0
    for c in "ACGT":
        ret=(ret+dfs(cur+1,last3[1:]+c))%mod
    memo[cur][last3]=ret
    return ret
print(dfs(0,"TTT"))


### FIXED CODE ###

n=int(input())
mod=10**9+7
memo=[{} for _ in range(n+1)]
def ok(last4):
    for i in range(4):
        t=list(last4)
        if i>=1:
            t[i-1],t[i]=t[i],t[i-1]
        if "".join(t).count("AGC")>=1:
            return False
    return True

def dfs(cur,last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur==n:
        return 1
    ret=0
    for c in "ACGT":
        if ok(last3+c):
            ret=(ret+dfs(cur+1,last3[1:]+c))%mod
    memo[cur][last3]=ret
    return ret
dfs(0,"TTT")
print(memo[0]["TTT"])
a=input()
b=input()
c=input()
if a[-1]==b[0] and b[-1]==c[0]:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

a,b,c=input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')
n,m=map(int,input().split(" ")) 
S=set(range(1,m+1))
for i in range(n):
    K, *A = map(int, input().split(" "))　
    S &=set(A) 
print(len(S))

### FIXED CODE ###

n,m=map(int,input().split(" "))
S=set(range(1,m+1))
for i in range(n):
    K, *A = map(int, input().split(" "))
    S &=set(A)
print(len(S))
S=input()split()
if S=="ABC":
    print("ARC")
else:
    print("ABC")

### FIXED CODE ###

S=input()
if S=="ABC":
    print("ARC")
else:
    print("ABC")
r = input()
r = int( r )
print( 3.141592653589 * r ** 2, 2 * 3.141592653589 * r)



### FIXED CODE ###

r = input()
r = float( r )
print( 3.141592653589 * r ** 2, 2 * 3.141592653589 * r)
print(x * len(input()))

### FIXED CODE ###

print('x' * len(input()))
nlist = list(map(int,input()))
rev_n = reversed(nlist)
sn = sum(nlist)
n = 0

for i in range(len(nlist)):
    n += rev_n[i]*(10**i) 
if n%sn == 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

nlist = list(map(int,input()))
rev_n = list(reversed(nlist))
sn = sum(nlist)
n = 0

for i in range(len(nlist)):
    n += rev_n[i]*(10**i) 
if n%sn == 0:
    print("Yes")
else:
    print("No")
n=int(input())
x=input()
t=int(x,2)
c=x.count('1')
import sys
sys.setrecursionlimit(10**6)
from functools import *
@lru_cache(None)
def popcount(x):
  if x==0: return 0
  return popcount(x%bin(x).count('1'))+1
for i in range(n):
  if int(x[i]):
    d=c-1
    if c<1: print(0)
    print(popcount((t-pow(2,n-i-1,d))%d)+1)
  else:
    d=c+1
    print(popcount((t+pow(2,n-i-1,d))%d)+1)

### FIXED CODE ###

n=int(input())
x=input()
t=int(x,2)
c=x.count('1')
a=t%-~c
b=0 if c<2 else t%~-c
for i in range(n):
  if int(x[i]):
    if c<2: print(0); continue
    else: t=(b-pow(2,n-i-1,c-1))%~-c
  else: t=(a+pow(2,n-i-1,c+1))%-~c
  z=1
  while t:
    d=bin(t).count('1')
    t%=d
    z+=1
  print(z)
N = int(input())
M = int(input())

A = 0

for i in range(M):
  A += int(input())

if M < A:
  print(N-A)

else:
  print(-1)

### FIXED CODE ###

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

A = [int(i) for i in input().split()]

B = sum(A)

if N >= B:
  print(N-B)

else:
  print('-1')
#Collecting.py
N,K=input(),input()
x = (int(_) for _ in raw_input().split()) 

for i in range(N):
	if abs(x[i]) < abs(K-x[i]):
		sum += abs(x[i])
	else:
		sum += abs(K-x[i]) 
print(sum)

### FIXED CODE ###

import math
N,K=input(),input()
x = [int(_) for _ in raw_input().split()]
sum = 0

for i in range(N):
	if K < x[i]:
		sum += (x[i]-K)*2
	elif K/2 < x[i]:
		sum += (K-x[i])*2
	else:
		sum += x[i]*2
print(sum)
import math
import time
from collections import defaultdict,deque
from sys import stdin,stdout
from bisect import bisect_left,bisect_right
n,k=map(int,stdin.readline().split())
ans=n
done=defaultdict(lambda:False)
for _ in range(k):
    d=int(input())
    a=list(map(int,stdin.readline().split()))
    for i in d:
        if(i not in done):
            ans-=1
            done[i]=True
print(ans)


### FIXED CODE ###

import math
import time
from collections import defaultdict,deque
from sys import stdin,stdout
from bisect import bisect_left,bisect_right
n,k=map(int,stdin.readline().split())
ans=n
done=defaultdict(lambda:False)
for _ in range(k):
    d=int(input())
    a=list(map(int,stdin.readline().split()))
    for i in a:
        if(i not in done):
            ans-=1
            done[i]=True
print(ans)
a,b = int(input())
c = a*b
if c % 2==0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

a,b = map(int,input().split())
c = a*b
if c % 2==0:
    print("Even")
else:
    print("Odd")
N,K=map(int,input().split())
S=input()
A=[]
a=S[0]
count=1
for i in range(1,N):
  if S[i]==a:
    count+=1
  else:
    A.append([a,count])
    count=1
    a=S[i]
A.append([a,count])
B=[]
C=[]
for i in range(len(A)):
  if A[i][0]=='0':
    B.append(A[i][1])
  else:
    C.append(A[i][1])
if K>=len(B):
  print(sum(B)+sum(C))
else:
  D=[]
  if S[0]=='0':
    D.append(sum(B[:K])+sum(C[:K]))
    if len(B)<=len(C):
      for i in range(1,len(B)-K+1):
        D.append(sum(B[i:K+i])+sum(C[i-1:K+i]))
        prin(max(D))
    else:
      for i in range(len(B)-K):
        D.append(sum(B[i:K+i])+sum(C[i-1:K+i]))
      D.append(sum(B[len(B)-K+1:len(B)-K+1])+sum(C[len(B)-K:len(B)-K]))
      print(max(D))
  else:
    D.append(sum(B[:K])+sum(C[:K+1]))
    if len(C)>len(B):
      for i in range(1,len(B)-K+1):
        D.append(sum(B[i:K+i])+sum(C[i:K+i+1]))
      print(max(D))
    else:
      for i in range(1,len(B)-K):
        D.append(sum(B[i:K+i])+sum(C[i:K+i+1]))
      D.append(sum(B[len(B)-K+1:len(B)+1])+sum(C[len(B)-K+1:len(B)+1]))
      print(max(D))
print(D)

### FIXED CODE ###

from itertools import accumulate

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

count=[0]
if S[0]=="0":
    count.append(0)

s=S[0]
cnt=0
for i in range(N):
    if s==S[i]:
        cnt+=1
    else:
        count.append(cnt)
        cnt=1
        s=S[i]
count.append(cnt)
if S[N-1]=="0":
    count.append(0)

l=len(count)
count=list(accumulate(count))
ans=0
for i in range(0,l,2):
    ans=max(ans,count[min(l-1,i+2*K+1)]-count[i])
print(ans)
A = int(input())
B = int(input())
print(A * B)

### FIXED CODE ###

A, B = list(map(int, input().split()))
print(A * B)