Harryxun/stf_run huggingface dataset:
n=int(input())

for a in range(1,n**0.5+1):
    if n%a==0:
        b=n//a
        sa=str(a)
        sb=str(b)
        if a<=b:
             ans=len(sb)
        else:
            break

print(ans)

### FIXED CODE ###

n=int(input())

for a in range(1,int(n**0.5+1)):
    if n%a==0:
        b=n//a
        sa=str(a)
        sb=str(b)
        if a<=b:
             ans=len(sb)
        else:
            break

print(ans)
import math
n = int(input())

al = [chr(ord('a') + i) for i in range(26)]

print(al[n % 26 - 1])

ans = []
mod = 1
cnt = 0
while cnt >= 1:
    k = math.floor(n/26)
    ans.append(al[k % 26 - 1])

print(int(''.join(ans[::-1])))

### FIXED CODE ###

N = int(input())
ans = ''

while N > 0:
    N -= 1
    ans += chr(ord('a') + N % 26)
    N //= 26

print(ans[::-1])
def main():
  A,B = map(int,input.split())
  
  B*=100
  res = (A*B)/100
  print(res)
  return
 
main()

### FIXED CODE ###

A,B = input().split()
A = int(A)
B = round(float(B)*100)

res = (A*B)//100
print(res)
a = input()
b = input()
print(a * b+ +(a + b) * 2)


### FIXED CODE ###


a,b =(int(x) for x in input().split())
print(a * b, (a+b) * 2)
n,a=(int(input() for i in range(2))
print(n**2-a)

### FIXED CODE ###

n,a=(int(input()) for i in range(2))
print(n**2-a)
n = int(input())
print("Yes" if "7" in n else "No")

### FIXED CODE ###

n = input()
print("Yes" if "7" in n else "No")
N, A, B, C, D = map(int,input().split())
S = input()

flag = 0

if D > C:
    for i in range(D-B-2):
        if S[B+i] == '#' and S[B+i+1] == '#':
            print('No')
            flag = 1
            break
    if flag == 0:
        for j in range(C-A-2):
            if S[A+j] == '#' and S[A+j+1] == '#':
                print('No')
                flag = 1
                break        
        if flag == 0:
            print('Yes')
else:
    count = 0
    for i in range(D-B+3):
        if S[B-2+j] == '.':
            count += 1
        else:
            count = 0
        if count == 3:
            flag = 1
            break
    if flag == 0:
        print('No')
    else:
        for j in range(C-A-2):
            if S[A+j] == '#' and S[A+j+1] == '#':
                print('No')
                flag = 0
                break        
        if flag == 1:
            print('Yes')
        
        

### FIXED CODE ###

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

flag = 0

if D > C:
    for i in range(D-B-2):
        if S[B+i] == '#' and S[B+i+1] == '#':
            print('No')
            flag = 1
            break
    if flag == 0:
        for j in range(C-A-2):
            if S[A+j] == '#' and S[A+j+1] == '#':
                print('No')
                flag = 1
                break        
        if flag == 0:
            print('Yes')
else:
    count = 0
    for i in range(D-B+3):
        if S[B-2+i] == '.':
            count += 1
        else:
            count = 0
        if count == 3:
            flag = 1
            break
    if flag == 0:
        print('No')
    else:
        for j in range(C-A-2):
            if S[A+j] == '#' and S[A+j+1] == '#':
                print('No')
                flag = 0
                break        
        if flag == 1:
            print('Yes')
a,b,c,d = map(int,input().split())

print(min(a,b)+min(c,d))

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min(a,b)+min(c,d))
n,k=map(int,input().split())
s=input()
s[k-1] = chr(ord(s[k-1]) - ord('A') + ord('a'))
for c in s:
	print(c, end="")

### FIXED CODE ###

n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
print("".join(s))
N = int(input())

if N == 1:
    print(1)
else:
    for a in reversed(range(1, (N//2)+1)):
        if N % a == 0:
            b = N/a
            ans=max(len(str(int(a))), len(str(int(b))))
            break
print(ans)



### FIXED CODE ###

N = int(input())
import math
if N == 1:
    print(1)
else:
    for a in reversed(range(1, (int(math.sqrt(N)))+1)):
        if N % a == 0:
            b = N/a
            ans=max(len(str(int(a))), len(str(int(b))))
            break
    print(ans)
#include <iostream>
#include <vector>
#include <map>
#include <cstdlib>
#include <algorithm>
using namespace std;
 
int main() {
  int n,m;
  int cnt=0;
  cin >> n >> m;
  
  vector<int> v,x;

  int a,b;
  for(int i = 0; i < n; ++i) {
    cin >> a;
    v.push_back(a);
  }
  x = v;
  
  for(int i = 0; i < m; ++i) {
    cin >> a >> b;
    a--;
    b--;
    if(v[a] < v[b]) x[a] = -1;
    else if(v[a] == v[b]) {
      x[a] = -1;
      x[b] = -1;
    }else x[b] = -1;
  }

  cout << v.size() - count(x.begin(), x.end(), -1) << "\n";
  return 0;
}

### FIXED CODE ###

N, M =map(int, input().split())
H_tree = [0] + [int(n) for n in input().split()]
GOOD_Tree = [0] + [1 for n in range(N)]
 
for i in range(M):
  A, B = map(int, input().split())
  if H_tree[A]<=H_tree[B]:GOOD_Tree[A] = 0
  if H_tree[A]>=H_tree[B]:GOOD_Tree[B] = 0
print(sum(GOOD_Tree))
a = str(input())
b = str(input())

rev_a = a[::-1]

if rev_a == b:
  print('YES)
else:
  print('NO')

### FIXED CODE ###

a = str(input())
b = str(input())
 
rev_a = a[::-1]
 
if rev_a == b:
  print('YES')
else:
  print('NO')
import math
import copy
from copy import deepcopy
import sys
import fractions
from functools import reduce
import statistics
import heapq
 
# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)
 
# ===FUNCTION===
 
def getInputInt():
    inputNum = int(input())
    return inputNum
 
 
def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]
 
    return outputData
 
 
def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)
 
    return outputDataList
 
 
def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)
 
    return outputDataList
 
 
# ===CODE===
 
n = getInputInt()
data = getInputListInt()
l = len(data)
 
ans = []
 
for i in range(l-1, -1, -1):
    cnt = 0
    for j in ans:
        if j % (i+1) == 0:
            cnt += 1
    if data[i] != cnt % 2:
        ans.append(i+1)
 
if len(ans) == 0:
    print(0)
else:
    print(len(ans))
    print(*ans, sep=" ")
 

### FIXED CODE ###

import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    a = na()

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

    for i in range(n // 2, n):
        if a[i] == 1:
            b[i] = a[i]
            ans.append(i + 1)

    for i in range(n // 2 - 1, -1, -1):
        cnt = 0
        for j in range(i * 2 + 1, n, i + 1):
            cnt ^= b[j]
        if cnt != a[i]:
            b[i] = 1
            ans.append(i + 1)

    tmp = len(ans)
    print(tmp)
    if tmp > 0:
        print(*ans, sep=" ")


if __name__ == '__main__':
    main()
ｈｈｈ

### FIXED CODE ###

x = list(map(lambda y: int(y),input().split(" ")))

if x[0]<9 and x[1]<9:
	print("Yay!")
else:
	print(":(")
N, A, B = map(int, input().split())
count = 0

for i in range(N + 1):
    if A <= i <= B:
        count += sum(list(str(i)))

print(count)

### FIXED CODE ###

N, A, B = map(int, input().split())
count = 0

for i in range(N + 1):
    if A <= sum(map(int, list(str(i)))) <= B:
        count  += i

print(count)
import sys
def input():
	return sys.stdin.readline().strip()

N = int(input())
ans = 0
d = defaultdict(int)
for i in range(N):
	di = int(input())
	if d[di] == 0:
		ans += 1
		d[di] += 1
print(ans)

### FIXED CODE ###


import sys
from collections import deque, defaultdict
import copy
import bisect
#sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import combinations, permutations

import sys
def input():
	return sys.stdin.readline().strip()

N = int(input())
ans = 0
d = defaultdict(int)
for i in range(N):
	di = int(input())
	if d[di] == 0:
		ans += 1
		d[di] += 1
print(ans)
# -*- coding : utf-8 -*-

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

L = map(int, [input() for i in range(n)])
L.sort()
word = ""

for i in len(L):
  word = word + L[i]

print(word)


### FIXED CODE ###

# -*- coding : utf-8 -*-

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

L = list([input() for i in range(n)])
L.sort()
word = ""

for i in range(len(L)):
  word = word + L[i]

print(word)
import math
N = int(input())
v = list(map(int,input().split()))
v_new = 0
#新しい具材の価値をv_newとした
a = 0
k = []
#kで
p = N
for i in range(N-1):
    #全ての要素が同じ場合は終了する
    if v.count(v[0]) == p:
        break
    else:
       x = v[(math.ceil(len(v)/2))]
       v.remove(x)
       #xをvのリストから除外
       for j in range(len(v)):
           k.append(v[j])
       for j in range(len(k)):
           k[j] = abs(k[j]-x)
       a = k.index(min(k))
       y = v[a]
       k.clear()
       #kのリストを初期化
       v_new = (x+y)/2
       #価値を(x+y)/2とした
       v.append(v_new)
       #v_newをvのリストに挿入
       v.remove(y)
       #yをvのリストから除外
       v_new = 0
       #v_newを初期化
       p = p-1
       a = 0
       x = 0
       y = 0
print(v[0])

### FIXED CODE ###

import math
N = int(input())
v = list(map(int,input().split()))
v_new = 0
#新しい具材の価値をv_newとした
a = 0
k = []
#kで
p = N
for i in range(N-1):
    #全ての要素が同じ場合は終了する
    if v.count(v[0]) == p:
        break
    else:
       x = min(v)
       v.remove(x)
       #xをvのリストから除外
       y = min(v)
       v_new = (x+y)/2
       #価値を(x+y)/2とした
       v.append(v_new)
       #v_newをvのリストに挿入
       v.remove(y)
       #yをvのリストから除外
       v_new = 0
       #v_newを初期化
       p = p-1
       a = 0
       x = 0
       y = 0
print(v[0])
N, W = [int(i) for i in input().split()]
Things = [[int(i) for i in input().split()] for j in range(N)]

dp = defaultdict(lambda: float('inf'))
dp[0] = 0
for w, v in Things:
    for nv, nw in list(dp.items()):
        if nw + w <= W:
            dp[nv + v] = min(dp[nv + v], nw + w)
ans = 0
for v, w in dp.items():
    if w <= W and v >= ans:
        ans = v
print(ans)

### FIXED CODE ###

from collections import defaultdict
N, W = [int(i) for i in input().split()]
Things = [[int(i) for i in input().split()] for j in range(N)]

dp = defaultdict(lambda: float('inf'))
dp[0] = 0
for w, v in Things:
    for nv, nw in list(dp.items()):
        if nw + w <= W:
            dp[nv + v] = min(dp[nv + v], nw + w)
ans = 0
for v, w in dp.items():
    if w <= W and v >= ans:
        ans = v
print(ans)
n,k = list(map(int, input().split()))
hoge = [1] * n

for i in range(k * 2):
  if i % 2 != 0:
    a = list(map(int, input().split()))
  	for j in a:
      hoge[j - 1] = 0
      
print(sum(hoge))


### FIXED CODE ###

n,k = list(map(int, input().split()))
hoge = [1] * n

for i in range(k * 2):
  a = list(map(int, input().split()))
  if i % 2 != 0:
    for j in a:
      hoge[j - 1] = 0
      
print(sum(hoge))
N = int(input())
job = []
for i in range(N):
    A,B = map(int,input().split())
    job.append([B,A])
job = sorted(job)time = 0
flag = 0
for i in job:
    time += i[1]
    if i[0] < time:
        print('No')
        flag = 1
        break
        
if flag == 0:
    print('Yes')

### FIXED CODE ###

N = int(input())
job = []
for i in range(N):
    A,B = map(int,input().split())
    job.append([B,A])
job = sorted(job)
time = 0
flag = 0
for i in job:
    time += i[1]
    if i[0] < time:
        print('No')
        flag = 1
        break
        
if flag == 0:
    print('Yes')
import sqrt from math
a, b, c = map(int, input().split())
if a + b + sqrt(a * b) < c:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

from decimal import Decimal
a, b, c = map(int, input().split())
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
    print("Yes")
else:
    print("No")
n,m = map(int,input().split())
x = sorted(map(int,input().split()))
l = sorted([x[i+1]-x[i]for i in range(m-1)])
if n >=m:
    print(0)
else:
    print(sum(l)-sum([-i-1]for i in range(n-1)))

### FIXED CODE ###

n, m = map(int, input().split())
x = sorted(set(map(int, input().split())))
t = []
for i, j in zip(x, x[1:]):
    t += [abs(i - j)]
t = sorted(t, reverse=True)
print(sum(t[n-1:]))
dummy = input()
print(' '.join(input().split().reverse()))

### FIXED CODE ###

dummy = input()
print(' '.join(input().split()[::-1]))
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
alis = li()
import numpy as np
alis = np.array(alis,dtype=np.int64)
b = [0] * 61
count = 0
while True:
    if np.all(alis== 0):
        break
    c = (alis % 2 == 0)
    b[count] = sum(c)
    count += 1
    alis //= 2
mod = 10 ** 9 + 7
ans = 0
for i in range(61):
    tmp = (1<<i) % mod
    k = (b[i] * (n-b[i]))  % mod
    k = k*tmp % mod
    ans += k
    ans %= mod
print(ans)


### FIXED CODE ###

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
alis = li()
import numpy as np
A = np.array(alis,dtype=np.int64)
b = [0] * 61
count = 0
ans = 0
MOD = 10**9 + 7
while A.any():
    one = np.count_nonzero(A & 1)
    k = (1<<count) % MOD
    #ans += (one * (n - one) * pow(2, count, MOD)) % MOD
    ans += (one * (n - one)) * k % MOD
    ans %= MOD
    A >>= 1
    count += 1
 
print(ans)
a = int(input())

b=0#約数の個数

for i in range(1,a+1, 2):#i:1~inputまで,奇数だけ
  #ある数Niについて約数を数える
	yakusuu_array = []

	for i in range(1,num):
	    if num % i == 0:
    	    yakusuu_array.append(i)
            
  	if len(yakusuu_array) == 8:
  		b += 1
print(b)

### FIXED CODE ###

a = int(input())
 
b=0#約数の個数
 
for num in range(1,a+1):#i:1~inputまで,奇数だけ
  if num % 2 == 1:
  #ある数Niについて約数を数える
    yakusuu = 0
    for i in range(1,num):
      if num % i == 0:
        yakusuu += 1
    if yakusuu == 7:
      b += 1
print(b)
S = input()

partial = ""

conditions = ["A","T","G","C"]

conlist = []

con = 0

for i in range(0,len(S)):
	if S[i] in conditions:
		for j in range(0,i+1):
			if S[j] in conditions:
				con +=1
			if (S[j] not in conditions) or j == i:
				conlist.append(con)
				con = 0
				

print(max(conlist))

### FIXED CODE ###

S = input()

partial = ""

conditions = ["A","T","G","C"]

conlist = []

con = 0

for i in range(0,len(S)):
	if S[i] in conditions:
		for j in range(0,i+1):
			if S[j] in conditions:
				con +=1
			if (S[j] not in conditions) or j == i:
				conlist.append(con)
				con = 0
				

if len(conlist) > 0:
	print(max(conlist))
else:print(0)
n, k = map(int, input().split(" "))
if n%k=0:
    print("0")
else:
    print("1")


### FIXED CODE ###

n, k = map(int, input().split(" "))
if n%k==0:
    print("0")
else:
    print("1")
T = []
X = []

print(T / X)

### FIXED CODE ###

T,X =map(int, input().split())
print(float(T)/float(X))
import sympy
n=int(input())
a=sympy.divisors(n)
b=sorted(a,reverse=True)

c=[]
for i in range(len(a)//2):
    d=a[i]-1+b[i]-1
    c.append(d)

print(min(c))

### FIXED CODE ###

n=int(input())

def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

a=divisor(n)
a.sort()

b=sorted(a,reverse=True)

c=[]
for i in range(len(a)//2+1):
    d=a[i]-1+b[i]-1
    c.append(d)

print(min(c))
import math
def main():
  N=int(input())
  X=list(map(int,input().split()))
  x_mean=math.ceil(sum(X)/len(X))
  sumX=0
  for i in range(len(X)):
    sumX=sumX+(X[i]-x_mean)**2
  print(sumX)

if __name__ == '__main__':
	main()

### FIXED CODE ###



def main():
  N,R=map(int,input().split())
  if(N<10):
    inner=R+100*(10-N)
  else:
    inner=R
  
  print(inner)

if __name__ == '__main__':
	main()
s = str(input())
odd =[]

n = int(len(s)/2)

for i in range(n+1):
    odd.append(s[2*i])

print(''.join(odd))

### FIXED CODE ###

s = str(input())
s = s[::2]
print(s)
x = input()
for i in range(100):
  for j in range(100):
	if(i**5-j**5 == x):
      print(str(i)+" "+str(j))

### FIXED CODE ###

def main(x):
  for i in range(-120,120):
    for j in range(-120,120):
      if(i**5-j**5 == int(x)):
        print(str(i)+" "+str(j))
        return
 
if __name__ == '__main__':
  main(input())
# -*- coding: utf-8 -*-

def main(N,A):
    zenbu = sum(A)
    part_sum = [A[0]]
    ans = float("INF")
    for i in range(1,N): 
        print(part_sum,zenbu-part_sum[-1])
        ans = min(ans, abs(zenbu-2*part_sum[-1]))
        part_sum.append(part_sum[-1]+A[i])

    print(ans)
    
if __name__ == '__main__':
    N = int(input())
    A = [int(a) for a in input().split()]
    main(N,A)

### FIXED CODE ###

# -*- coding: utf-8 -*-

def main(N,A):
    zenbu = sum(A)
    part_sum = [A[0]]
    ans = float("INF")
    for i in range(1,N): 
        ans = min(ans, abs(zenbu-2*part_sum[-1]))
        part_sum.append(part_sum[-1]+A[i])

    print(ans)
    
if __name__ == '__main__':
    N = int(input())
    A = [int(a) for a in input().split()]
    main(N,A)
a=input()
sum=0
for i in a:
  if i=='R'
  sum=sum+1
print (sum)

### FIXED CODE ###

a=input()
sum=0
if a[0]=='R':
    sum=1
    if a[0]==a[1]:
        sum=2
        if a[1]==a[2]:
            sum=3
else :
    if a[1]=='R':
        sum=1
        if a[2]==a[1]:
            sum =2
    elif a[2]=='R':
        sum=1
print (sum)
N, C = map(int, input().split())

A = [[] for i in range(C + 1)]
for i in range(N):
    s, t, c = map(int, input().split())
    A[c].extend(list(range(s - 1, t + 1)))
    
dp = [0] * (10 ** 5 + 1)
for a in A:
    if a == []:
        continue
    a.sort()
    dp[a[0]] += 1
    dp[a[-1] + 1] -= 1
    
for i in range(1, 10 ** 5 + 1):
    dp[i] += dp[i - 1]
    
print(max(dp))

### FIXED CODE ###

N, C = map(int, input().split())
STC = [[int(i) for i in input().split()] for i in range(N)]
STC.sort()

R = [[STC[0][1], STC[0][2]]]
for s, t, c in STC[1:]:
    for i in range(len(R)):
        t_r, c_r = R[i][0], R[i][1]
        if c == c_r and t_r <= s:
            R[i] = [t, c]
            break
        if c != c_r and t_r < s:
            R[i] = [t, c]
            break
    else:
        R.append([t, c])
        
print(len(R))
lst = [int(x) for x in input().split()]
lst.sort(reverse=True, key = lambda x : (x - 1) % 10)
s = 0
for i in lst:
    s += i
    if i != lst[4]:
        s += 10 - s % 10

print(s)

### FIXED CODE ###

lst = []
for i in range(5):
    lst.append(int(input()))
lst.sort(reverse=True, key = lambda x : (x - 1) % 10)
s = 0
for i in range(5):
    s += lst[i]
    if s % 10 != 0 and i != 4:
        s += 10 - s % 10

print(s)
import math
A,B=map(int,input().split())
C=(A*B)/(math.gcd(A,B))
print(C)


  


### FIXED CODE ###

import fractions
A,B=map(int,input().split())
C=(A*B)//(fractions.gcd(A,B))
print(C)
N,A,B=map(int,input().split())
c=N//(A+B)
ball=('b'*A+'a'*B)*(c+1)
print(ball.count('b',0,N))


### FIXED CODE ###

N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))
a, b, c = input().split()
a = int(a)
b = int(b)
c = int(c)

k = input()
k = int(k)

print(max(a * 2 * k + b + c, a + b * 2 * k + c, a + b + c * 2 * k))


### FIXED CODE ###

a, b = input().split()
a = int(a)
b = int(b)
if a <= b:
  print(a)
else:
  print(a-1)
n, m = map(int, input().split())
num = [0] * m
for i in range(m):
    s, c = map(int, input().split())
    if num[s-1] != 0 and num[s-1] != c:
        print(-1)
        exit()
    num[s-1] = c

if 1 < n and num[0] == 0:
    print(-1)
    exit()

for i in range(1000):
    ok = True
    string = str(i)
    if len(string) == n:
        for j in range(n):
            if len(string) <= j or len(num) <= j:
                continue
            if num[j] == 0:
                continue
            elif string[j] != str(num[j]):
                ok = False
                break
        if ok:
            print(i)
            exit()
print(-1)

### FIXED CODE ###

n, m = map(int,input().split())
sc = []
for i in range(m):
    sc.append(list(map(int,input().split())))

# 条件の整理
cnt = [0]*4
for i in range(m):
    cnt[sc[i][0]] += 1
    # 最上位桁が0
    # if sc[i][0] == 1 and sc[i][0] == 0 and n > 1:
    #     print(-1)
    #     exit()
    # 同じ桁に違う数字指定
    if cnt[sc[i][0]] > 1:
        
        val = []
        
        for j in range(m):
            if sc[j][0] == sc[i][0]:
                val.append(sc[j][1])
        
        if len(list(set(val))) > 1:
            print(-1)
            exit()


# 全探索
ans = []
for i in range(1000):
    if len(str(i)) == n:
        flg = True
        for j in range(m):
            digit = sc[j][0]
            val = sc[j][1]
            if int(str(i)[digit-1]) != val:
                flg = False
                break
        if flg == True:
            ans.append(i)

if len(ans) == 0:
    print(-1)
    exit()
print(min(ans))
N = int(input())
num = input()
X = int(num,2)
c = num.count('1')
def A(s):
    if s == 0:
        return 1
    return A(s%(bin(s).count('1'))) + 1
if c==1:
  for i in range(N):
    if num[i] == '1':
      print(0)
    elif i == N-1:
      print(2)
    else:
      print(1)
  exit()
amari1 = X%(c+1)
amari2 = X%(c-1)
for i in range(N):
    if num[i] == '1':
        print(A((amari2-pow(2,N-1-i,c-1))%(C-1)))
    else:
        print(A((amari1+pow(2,N-1-i,c+1))%(C-1)))

### FIXED CODE ###

N=int(input())
X=input()
Y=int(X,2)
Z=Y
C=X.count('1')
if C==1:
  for i in range(N):
    if X[i]=='1':
      print(0)
    elif i==N-1:
      print(2)
    else:
      print(1)
  exit()
Y,Z=Y%(C+1),Z%(C-1)
def f(x):
  if x==0:
    return 0
  return 1+f(x%bin(x).count('1'))
 
for i in range(N):
  if X[i]=='1':
    print(1+f((Z-pow(2,N-i-1,C-1))%(C-1)))
  else:
    print(1+f((Y+pow(2,N-i-1,C+1))%(C+1)))
from copy import deepcopy
# 多次元配列を作成する
def make_multi_list(initial, degree):
    ans = [initial for _ in range(degree[-1])]
    for d in reversed(degree[:-1]):
        ans = [deepcopy(ans) for _ in range(d)]
    return ans


N, T = map(int, input().split())
AB = []
for i in range(N):
    a, b = map(int, input().split())
    AB.append((a, b))
AB.sort()

ans = 0
dp = make_multi_list(0, [3000, 3000])
for i in range(N):
    a, b = AB[i]
    for j in range(T):
        # iを使わないパターン
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        # iを使うパターン
        nj = j+a
        if nj < T:
            dp[i+1][nj] = max(dp[i + 1][nj], dp[i][j]+b)
    now = dp[i][T-1]+AB[i][1]
    ans = max(ans, now)

print(ans)

### FIXED CODE ###

from copy import deepcopy

# 多次元配列を作成する
def make_multi_list(initial, degree):
    ans = [initial for _ in range(degree[-1])]
    for d in reversed(degree[:-1]):
        ans = [deepcopy(ans) for _ in range(d)]
    return ans


N, T = map(int, input().split())
AB = []
for i in range(N):
    a, b = map(int, input().split())
    AB.append((a, b))
AB.sort()

ans = 0
dp = make_multi_list(0, [3005, 3005])
for i in range(N):
    a, b = AB[i]
    for j in range(T):
        # iを使わないパターン
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
        # iを使うパターン
        nj = j + a
        if nj < T:
            dp[i + 1][nj] = max(dp[i + 1][nj], dp[i][j] + b)
    now = dp[i][T - 1] + b
    ans = max(ans, now)

print(ans)
x, y = map(int, input().split())
X = abs(x)
Y = abs(y)
if x * y < 0:
    print(max(Y - X, X - Y) + 1)
else:
    print(max(x - y, y - x) + 2 * (y < x))x, y = map(int, input().split())
X = abs(x)
Y = abs(y)
if x * y < 0:
    print(max(Y - X, X - Y) + 1)
elif x * y > 0:
    print(max(x - y, y - x) + (y < x) + (X > 0))

### FIXED CODE ###

x, y = map(int, input().split())
print(min(a for a in [y - x, y + x + 1, -y - x + 1, -y + x + 2] if a >= 0))
n,d=map(int,input().split())
x = [0]*n
y = [0]*n

count=0

for i in range(n):
  x[i],y[i] = map(int, input().split())
  if x**2+y**2<=d**2:
   count=+1
print(count)

### FIXED CODE ###

import math
 
n,d=map(int,input().split())
count=0
for i in range(n):
  x,y = map(int, input().split())
  if math.sqrt((x**2)+(y**2))<=d:
   count+=1
print(count)