Harryxun/stf_run huggingface dataset:
# coding: utf-8
# Your code here!
# coding: utf-8
from fractions import gcd 
from functools import reduce
import sys
sys.setrecursionlimit(200000000)
from inspect import currentframe


# my functions here!
#標準エラー出力
def printargs2err(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' : '+repr(arg) for arg in args),file=sys.stderr)
def debug(x):
    print(x,file=sys.stderr)
def printglobals():
    for (symbol, value) in globals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
def printlocals():
    for (symbol, value) in locals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())

"""
"""

#solution:

#input
x,y=pin()
t=abs(y)-abs(x)
if x*y<0:
    t=abs(t)+1
elif t*(y-x)<0:
    t=abs(t)+2
print(t)
#print(["No","Yes"][cond])
#print([["NA","YYMM"],["MMYY","AMBIGUOUS"]][cMMYY][cYYMM])
"""
#printデバッグ消した？
#前の問題の結果見てないのに次の問題に行くの？
"""
"""
お前カッコ閉じるの忘れてるだろ
"""

### FIXED CODE ###

# coding: utf-8
# Your code here!
# coding: utf-8
from fractions import gcd 
from functools import reduce
import sys
sys.setrecursionlimit(200000000)
from inspect import currentframe


# my functions here!
#標準エラー出力
def printargs2err(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' : '+repr(arg) for arg in args),file=sys.stderr)
def debug(x):
    print(x,file=sys.stderr)
def printglobals():
    for (symbol, value) in globals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
def printlocals():
    for (symbol, value) in locals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())

#繰り返し自乗法だよ
#これはnのp乗をmで割ったあまりをだすよ
def modular_w_binary_method (n,m,p):
    ans=1 if n>0 else 0
    while(p>0):
        if p%2==1:
            ans=(ans*n)%m
        n=(n**2)%m
        p//=2
    return ans
#mod上でのaの逆元を出すよ
"""
    フェルマーの小定理より a**(p)%p==a isTrue
    これを利用すれば a**(p-2)%p==a**(-1) isTrue
    元と逆元とをかけてpで割れば1が余るよ！
"""
def modular_inverse(a,prime):
    return(modular_w_binary_method(a,prime,prime-2))
#逆元を使うと容易に頑張れるｃ
def conbination(n,a,mod=10**9+7):
    #cはイラない
    res=1 
    for s in range(a):
        res=(res*(n-s)*(modular_inverse(s+1,mod)))%mod

        
    return res
#操作から作れるものの組み合わせは何個かー＞同じものでも違う方法で構成できるかから考える方法もある
"""
"""

#solution:

#input
N,=pin()
ans=0
A,B=[],[]
for _ in range(N):
    a,b=pin()
    A.append(a)
    B.append(b)
for i in range(N-1,-1,-1):
    #print("b-a=",(B[i]-A[i])%B[i])
    temp=(B[i]-A[i]-ans)%B[i]
    #print(temp)
    ans+=temp
print(ans)
#print(h)
#print(m)
#print(["No","Yes"][cond])
#print([["NA","YYMM"],["MMYY","AMBIGUOUS"]][cMMYY][cYYMM])
"""
#printデバッグ消した？
#前の問題の結果見てないのに次の問題に行くの？
"""
"""
お前カッコ閉じるの忘れてるだろ
"""
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

suma = sumb = num = 0
for i in range(N):
    suma += A[i]
    sumb += B[i]
    if A[i] < B[i]:
        num += ceil((B[i] - A[i]) / 2)

if A == B:
    print("Yes")
else:
    if suma >= sumb:
        print("No")
    else:
        if num > sumb - suma:
            print("No")
        else:
            print("Yes")


### FIXED CODE ###

from math import ceil

N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

suma = sumb = num = 0
for i in range(N):
    suma += A[i]
    sumb += B[i]
    if A[i] < B[i]:
        num += ceil((B[i] - A[i]) / 2)

if A == B:
    print("Yes")
else:
    if suma >= sumb:
        print("No")
    else:
        if num > sumb - suma:
            print("No")
        else:
            print("Yes")
def calculate_max(Ans, value):
    temp = Ans
    if (Ans + value) > Ans:
        temp += value
    if tmep < 0 :
        temp = 0
    return temp
# input processing 
N = int(input())
Value = map(int, input().split())
Cost = map(int, input().split())
# profit calculation
Profit = [Value[i] - Cost[i] for i in range(N)]
Answer = 0
# process
for i in range(N):
    Answer = calculate_max(Answer, Profit[i])
# Output
print(Answer)


### FIXED CODE ###

def calculate_max(Ans, value):
    temp = Ans
    if (Ans + value) > Ans:
        temp += value
    if temp < 0 :
        temp = 0
    return temp
# input processing 
N = int(input())
Value = list(map(int, input().split()))
Cost = list(map(int, input().split()))
# profit calculation
Profit = [Value[i] - Cost[i] for i in range(N)]
Answer = 0
# process
for i in range(N):
    Answer = calculate_max(Answer, Profit[i])
# Output
print(Answer)
n = int(input())
l = list(map(int, input().split()))
l = list(set(l))
n = len(l)

from itertools import combinations
a = list(combinations(l, n-1))
#print(a)

from fractions import gcd
from functools import reduce

def gcd_list(numbers):
    return reduce(gcd, numbers)

g = []
for i in range(len(a)):
    g.append(gcd_list(a[i]))
#print(g)
print(max(g))

### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
#print(l)
l2 = list(reversed(l))
#print(l2)
#from itertools import combinations
#a = list(combinations(l, n-1))
#print(a)
from fractions import gcd
L, R = [0], [0]
for i in range(n):
    L.append(gcd(L[i],l[i]))
    R.append(gcd(R[i],l2[i]))
#print(L)
R = list(reversed(R))
#print(R)
g = []
for j in range(n):
    g.append(gcd(L[j],R[j+1]))
print(max(g))


#from functools import reduce

#def gcd_list(numbers):
#    return reduce(gcd, numbers)
import sys
import math

a,b,k = list(map(int, input().split()))
lis = range(a,a+k)
lis.append(range(b-k+1, b+1))
for i in range(len(lis)):
    print(lis[i])

### FIXED CODE ###

import sys
import math

a,b,k = list(map(int, input().split()))
if b-a+1 <= k:
    for i in range(a,b+1):
        print(i)
else:
    lis = list(range(a,a+k))
    lis.extend(list(range(b-k+1, b+1)))
    lis = list(set(lis))
    lis.sort()
    for i in range(len(lis)):
        print(lis[i])
n = input()
def f(s):
  if int(s) > n:
    return 0 #再帰終了
  if s.count("3") > 0 and s.count("5") > 0 and s.count("7") > 0:
    cnt += 1
  else:
    cnt += f(s + "3")
    cnt += f(s + "5")
    cnt += f(s + "7")
    
print(cnt)
    
    

### FIXED CODE ###

n = int(input())
def f(s):
  if int(s) > n:
    return 0 #再帰終了
  if s.count("3") > 0 and s.count("5") > 0 and s.count("7") > 0:
  	cnt = 1
  else:
  	cnt = 0
  cnt += f(s + "3")
  cnt += f(s + "5")
  cnt += f(s + "7")
  return cnt
  
result = f("0")
print(result)
N,M = map(int, input().split())
if M==1 and N==1:
    return 1
elif M==1:
    return N-2
elif N==1:
    return M-2
else:
    return (N-2)*(M-2)


### FIXED CODE ###

N,M = map(int, input().split())
if M==1 and N==1:
    print(1)
elif M==1:
    print(N-2)
elif N==1:
    print(M-2)
else:
    print((N-2)*(M-2))
s = input()
t = input()
n = len(s)
m = len(t)
ans = []
for i in range(n-m+1):
    flag = True
    for j in range(m):
        if s[i+j]!="?" and s[i+j]!=t[j]:
            flag = False
            break
    if flag:
        tmp = (s[:i]+t+s[(i+m):]).raplace("?","a")
        ans.append(tmp)
ans.sort()

if ans:
    print(ans[0])
else:
    print("UNRESTORABLE")

### FIXED CODE ###

s = input()
t = input()
n = len(s)
m = len(t)
ans = []
for i in range(n-m+1):
    flag = True
    for j in range(m):
        if s[i+j]!="?" and s[i+j]!=t[j]:
            flag = False
            break
    if flag:
        tmp = (s[:i] + t + s[(i+m):])
        a = []
        for j in range(n):
            if tmp[j]=="?":
                a.append("a")
            else:
                a.append(tmp[j])
        tmp = "".join(a)
        ans.append(tmp)

ans.sort()

if len(ans)>0:
    print(ans[0])
else:
    print("UNRESTORABLE")
import sys
sys.setrecursionlimit(100000)
n,m = map(int,input().split())
graph = [list(input().split(" ")) for i in range(n)]

result=0

def dfs(a, list, graph,  result):
  if len(list) == n:
    result = result + 1

  for g in graph:
    if g[0] == a and g[1] not in list:
      list.append(g[1])
      result = dfs(g[1], list, graph, result)
    if g[1] == a and g[0] not in list:
      list.append(g[0])
      result = dfs(g[0], list, graph, result)

  return result

for g in graph:
  list = []
  if g[0] == "1":
    list.append(1)
    result += dfs("1", list, graph, 0)

print(result)


### FIXED CODE ###

N, M = map(int, input().split())
adj_matrix = [[0]* N for _ in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    adj_matrix[a-1][b-1] = 1
    adj_matrix[b-1][a-1] = 1

def dfs(v, used):
    if not False in used:
        return 1
    
    ans = 0
    for i in range(N):
        if not adj_matrix[v][i]:
            continue
        if used[i]:
            continue
        
        used[i] = True
        ans += dfs(i, used)
        used[i] = False
    
    return ans

used = [False] * N
used[0] = True

print(dfs(0, used))
date=str(input()).reverse()
print(date)

### FIXED CODE ###

print(input()[::-1])
import functools
import math

import os

INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def debug(fn):
    if not os.getenv('LOCAL'):
        return fn

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        print('DEBUG: {}({}) -> '.format(
            fn.__name__,
            ', '.join(
                list(map(str, args)) +
                ['{}={}'.format(k, str(v)) for k, v in kwargs.items()]
            )
        ), end='')
        ret = fn(*args, **kwargs)
        print(ret)
        return ret

    return wrapper


print(inp() + inp() // 2)

### FIXED CODE ###

import functools
import math

import os

INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def debug(fn):
    if not os.getenv('LOCAL'):
        return fn

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        print('DEBUG: {}({}) -> '.format(
            fn.__name__,
            ', '.join(
                list(map(str, args)) +
                ['{}={}'.format(k, str(v)) for k, v in kwargs.items()]
            )
        ), end='')
        ret = fn(*args, **kwargs)
        print(ret)
        return ret

    return wrapper


x, y = inl()
print(x+y // 2)
n  = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

ans = 0

for i in range(n):
      #print(i)
      ans += b[a[i]-1]
      #print("ans",ans)
  #print("aaa",a[i])
      if i != 0:
        hantei = a[i-1] + 1
        if a[i] == hantei:
            ans += c[i]
    
print(ans)

### FIXED CODE ###

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

ans = 0

for i in range(n):
      #print(i)
      ans += b[a[i]-1]
      #print("ans",ans)
  #print("aaa",a[i])
      if i != 0:
        hantei = a[i-1] + 1
        if a[i] == hantei:
          ans += c[a[i]-2]
    
print(ans)
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = []
A.append(list([int(input()) for _ in range(N)]))

print(A)

### FIXED CODE ###

N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = []
A.append([list(map(int, input().split())) for _ in range(N)])
ans = 0  
temp = 0

for i in range(N):
  for j in range(M):
    temp += B[j] * A[0][i][j]
  if temp + C > 0:
    ans += 1
  temp = 0

print(ans)
N,M = map(int,input().split())
ans = []
for i in range(N):
    KA = list(map(int,input().split()))
    for j in range(1,len(KA)):
        ans[[KA[j]-1]] += 1
print(ans.count(N))

### FIXED CODE ###

N,M = map(int,input().split())
ans = [0]*M
for i in range(N):
    KA = list(map(int,input().split()))
    for j in range(1,len(KA)):
        ans[KA[j]-1] += 1
print(ans.count(N))
from bisect import bisect_left

A,B,Q=map(int,input().split())
S=[int(input()) for i in range(A)]
T=[int(input()) for i in range(B)]
for i in range(Q):
    x=int(input())
    si=bisect_left(S,x)
    ti=bisect_left(T,x)
    if 0<si<A and 0<ti<B:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sr,tr),max(sl,tl),sl+tr+min(sl,tr),sr+tl+min(sr,tl)))
    elif si==0 and ti==0:
        sr=abs(x-S[si])
        tr=abs(x-T[ti])
        print(sr,tr)
    elif si==A and ti==B:
        sl=abs(x-S[si-1]),abs(x-S[si])
        tl=abs(x-T[ti-1]),abs(x-T[ti])
        print(max(sl,tl))
    elif si==0 and ti==B:
        sr=abs(x-S[si])
        tl=abs(x-T[ti-1])
        print(sr+tl+min(sr,tl))
    elif si==A and ti==0:
        sl=abs(x-S[si-1])
        tr=abs(x-T[ti])
        print(sl+tr+min(sl,tr))
    elif si==0:
        sr=abs(x-S[si])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sr,tr),sr+tl+min(sr,tl)))
    elif si==A:
        sl=abs(x-S[si-1])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sl,tl),sl+tr+min(sl,tr)))
    elif ti==0:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tr=abs(x-T[ti])
        print(min(max(sr,tr),sl+tr+min(sl,tr)))
    elif ti==B:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tl=abs(x-T[ti-1])
        print(min(max(sl,tl),sr+tl+min(sr,tl)))

### FIXED CODE ###

from bisect import bisect_left

A,B,Q=map(int,input().split())
S=[int(input()) for i in range(A)]
T=[int(input()) for i in range(B)]
for i in range(Q):
    x=int(input())
    si=bisect_left(S,x)
    ti=bisect_left(T,x)
    if 0<si<A and 0<ti<B:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sr,tr),max(sl,tl),sl+tr+min(sl,tr),sr+tl+min(sr,tl)))
    elif si==0 and ti==0:
        sr=abs(x-S[si])
        tr=abs(x-T[ti])
        print(max(sr,tr))
    elif si==A and ti==B:
        sl=abs(x-S[si-1])
        tl=abs(x-T[ti-1])
        print(max(sl,tl))
    elif si==0 and ti==B:
        sr=abs(x-S[si])
        tl=abs(x-T[ti-1])
        print(sr+tl+min(sr,tl))
    elif si==A and ti==0:
        sl=abs(x-S[si-1])
        tr=abs(x-T[ti])
        print(sl+tr+min(sl,tr))
    elif si==0:
        sr=abs(x-S[si])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sr,tr),sr+tl+min(sr,tl)))
    elif si==A:
        sl=abs(x-S[si-1])
        tl,tr=abs(x-T[ti-1]),abs(x-T[ti])
        print(min(max(sl,tl),sl+tr+min(sl,tr)))
    elif ti==0:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tr=abs(x-T[ti])
        print(min(max(sr,tr),sl+tr+min(sl,tr)))
    elif ti==B:
        sl,sr=abs(x-S[si-1]),abs(x-S[si])
        tl=abs(x-T[ti-1])
        print(min(max(sl,tl),sr+tl+min(sr,tl)))
import numpy as np
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=[0]*M
C=[0]*M
for i in range(M):
    B[i],C[i]=map(int,input().split())

for i in range(M):
    A = np.sort(A)
    for j in range(B[i]):
        if A[j] < C[i]:
            A[j]=C[i]
            print(i,j)
        else:
            break
        if j==N-1:
            break
print(sum(A))      




### FIXED CODE ###

#!/usr/bin/env python3
import bisect
import numpy as np

N, M = list(map(int, input().split()))
a_list = list(map(int, input().split()))
bc_list = []

for i in range(M):
    b, c = list(map(int, input().split()))
    bc_list.append((b, c))

bc_list = sorted(bc_list, key=lambda x: x[1], reverse=True)
a_list = sorted(a_list)

fix_list = []
s = 0
b, c = bc_list[0]
bc_index = 0
count_b = 0

for a in a_list:
    if count_b >= b:
        bc_index += 1
        if bc_index >= len(bc_list):
            s += a
            continue
        count_b = 0
        b, c = bc_list[bc_index]

    if a < c:
        s += c
    else:
        s += a
    count_b += 1

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

a = [int(input()) for i in range(M)]

#初期化
dp=[-1]*N
dp[0]=1

for i in a:
    dp[i-1] = 0

dp[1]=dp[0]+1
for i in range(2,N):
    if dp[i]==0:
        continue
    else:
        dp[i]=dp[i-1]+dp[i-2]

print(dp[N-1]%1000000007)

### FIXED CODE ###

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

a = [int(input()) for i in range(M)]

#初期化
dp=[-1]*N
dp[0]=1

for i in a:
    dp[i-1] = 0

for i in range(1,N):
    if dp[i]==0:
        continue
    elif i==1:
        dp[i]=dp[i-1] + 1
    else:
        dp[i]=dp[i-1]+dp[i-2]

print(dp[N-1]%1000000007)
def abc166_d():
  x = int(input())
  for k in range(1, 33):
    cand = (x + k**5) ** 0.2
    if cand.is_integer():
      print(int(cand), k)
      return
    cand = (x - k**5) ** 0.2
    if cand.is_integer():
      print(int(cand), -k)
      return

abc166_d()

### FIXED CODE ###

def abc166_d():
  x = int(input())
  for i in range(-126, 127):
    for j in range(-126, 127):
      if i**5 - j**5 == x:
        print('{} {}'.format(i, j))
        return

abc166_d()
n=input(int())

print(int(n*(n+1)/2))

### FIXED CODE ###

n=int(input())
     
sum=n*(n+1)/2
     
print(int(sum))
H, W = map(int, raw_input().split())
 
while H > 0 or W > 0 :
    for y in xrange(H) :
        for x in xrange(W) :
            if (x + y) % 2 == 0 :
                sys.stdout.write("#")
            else :
                sys.stdout.write(".")
 
        print
    print
 
    H, W = map(int, raw_input().split())




### FIXED CODE ###

while 1:
 H, W = map(int,raw_input().split())
 if H + W == 0:break
 for h in range(H):
  if h % 2 == 0:
   if W % 2 == 0:
    print ('#.'*(W//2))
   else:
    print ('#.'*(W//2)+'#')
  else:
   if W % 2 == 0:
    print ('.#'*(W//2))
   else:
    print ('.#'*(W//2)+'.')
 print ''
import math
import numpy as np
from operator import mul

# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]

# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
#    if x not in li_uniq:
#        li_uniq.append(x)

# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - dictionary版
# key = a, value = b
#for i in range(N):
#    a, b = map(int, input().split())
#    dict[a] = b


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

D = [list(map(int, input().split())) for i in range(N)]
B = [D[i][1] for i in range(N)] # bのリスト

a_max = 0 # 最大のa

for i in range(N):
    if D[i][0] >= a_max:
        a_max = D[i][0]

B_larger = [] # a_maxより大きいbのリスト

for i in range(N):
    if B[i] > a_max:
        B_larger.append(B[i])

B_larger.sort(reverse=True)

n = 0

while H > 0:
    H = H - B_larger[i]
    n += 1    

if H <= 0:
    print(n)
else:
    n = math.ceil(H/a_max)
    print(n)


### FIXED CODE ###

import math
import numpy as np
from operator import mul

# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]

# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
#    if x not in li_uniq:
#        li_uniq.append(x)

# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - dictionary版
# key = a, value = b
#for i in range(N):
#    a, b = map(int, input().split())
#    dict[a] = b


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

D = [list(map(int, input().split())) for i in range(N)]
B = [D[i][1] for i in range(N)] # bのリスト

a_max = 0 # 最大のa

for i in range(N):
    if D[i][0] >= a_max:
        a_max = D[i][0]

B_larger = [] # a_maxより大きいbのリスト

for i in range(N):
    if B[i] > a_max:
        B_larger.append(B[i])

B_larger.sort(reverse=True)

n = 0

for i in range(len(B_larger)):
    H = H - B_larger[i]
    n += 1    
    if H <= 0:
        print(n)
        break
    

if H > 0:
    n += math.ceil(H/a_max)
    print(n)
n = int(input())
A = list(map(int, input().split()))

A.sort()

x = A[0]
flag = True
for a in A:
    if a % x != 0:
        flag = False
if flag:
    print(0)
    exit()

used = [False] * A[-1]
ans = 0
for idx, a in enumerate(A):
    if used[a - 1]:
        continue
    if idx < n and a != A[idx + 1]:
        ans += 1
    for j in range(a, len(used) + 1, a):
        used[j - 1] = True
print(ans)


### FIXED CODE ###

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

A.sort()
A.append(-1)

x = A[0]
if x != 1:
    flag = True
    for a in A:
        if a % x != 0:
            flag = False
    if flag:
        print(0)
        exit()

used = [False] * A[-2]
ans = 0
for idx, a in enumerate(A[:-1]):
    if used[a - 1]:
        continue
    if a != A[idx + 1]:
        ans += 1
    for j in range(a, len(used) + 1, a):
        used[j - 1] = True
print(ans)
import sys
from collections import Counter

N = int(input())
points = []
for i, line in enumerate(sys.stdin):
    x, y = map(int, line.split())
    points.append([x, y])
    if i == N - 1:
        break

counts = []
for i in range(N - 1):
    p = points[i][0] - points[i+1][0]
    q = points[i][1] - points[i+1][1]
    counts.append((p, q))

pq = Counter(counts).most_common()[0][1]
cost = N - pq
print(cost)

### FIXED CODE ###

import sys
from collections import Counter

N = int(input())
points = []
for i, line in enumerate(sys.stdin):
    x, y = map(int, line.split())
    points.append([x, y])
    if i == N - 1:
        break
if len(points) == 1:
    print(1)
    sys.exit(0)

counts = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        p = points[j][0] - points[i][0]
        q = points[j][1] - points[i][1]
        counts.append((p, q))

pq = Counter(counts).most_common()[0][1]
cost = N - pq
print(cost)
def power(x, y, p) : 
    if y==0: return 1%p
    res = 1     # Initialize result 
  
    # Update x if it is more 
    # than or equal to p 
    x = x % p  
      
    if (x == 0) : 
        return 0
  
    while (y > 0) : 
          
        # If y is odd, multiply 
        # x with result 
        if ((y & 1) == 1) : 
            res = (res * x) % p 
  
        # y must be even now 
        y = y >> 1      # y = y/2 
        x = (x * x) % p 
    return res  

F = [0,1,1]
for i in range(3,100001):
	F += [ 1 + F[i%(bin(i).count('1'))]]
	

n=int(input())
s=input()
ones = s.count('1')
a = ones -1
b = ones
c = ones+1
moda = modb = modc = 0
for i in range(n-1,-1,-1):
	pos = n-1-i
	if s[i]=='1':
		if a>0 : moda = (moda + power(2, pos, a) ) %a
		if b>0 : modb = (modb + power(2, pos, b) ) %b
		modc = (modc + power(2, pos, c) ) %c

for i in range(n):
	if s[i] == '0': #ajout
		add = power(2, n-1-i, c)
		ans = (modc + add) % c
		# ~ print("i",i, "add",add,"ans",ans)
		print(F[ans]+1)
	else: # retrait
		if a<=0: print(0)
		else:
			sub = power(2, n-1-i, a)
			ans = (moda - sub) % a
			print(F[ans]+1)


### FIXED CODE ###

def power(x, y, p) : 
    if y==0: return 1%p
    res = 1     # Initialize result 
  
    # Update x if it is more 
    # than or equal to p 
    x = x % p  
      
    if (x == 0) : 
        return 0
  
    while (y > 0) : 
          
        # If y is odd, multiply 
        # x with result 
        if ((y & 1) == 1) : 
            res = (res * x) % p 
  
        # y must be even now 
        y = y >> 1      # y = y/2 
        x = (x * x) % p 
    return res  

F = [0,1,1]
for i in range(3,200001):
	F += [ 1 + F[i%(bin(i).count('1'))]]
	

n=int(input())
s=input()
ones = s.count('1')
a = ones -1
b = ones
c = ones+1
moda = modb = modc = 0
for i in range(n-1,-1,-1):
	pos = n-1-i
	if s[i]=='1':
		if a>0 : moda = (moda + power(2, pos, a) ) %a
		modc = (modc + power(2, pos, c) ) %c

for i in range(n):
	if s[i] == '0': #ajout
		add = power(2, n-1-i, c)
		ans = (modc + add) % c
		# ~ print("i",i, "add",add,"ans",ans)
		print(F[ans]+1)
	else: # retrait
		if a<=0: print(0)
		else:
			sub = power(2, n-1-i, a)
			ans = (moda - sub) % a
			print(F[ans]+1)