Harryxun/stf_run huggingface dataset:
import itertools
N, M, Q = map(int, input().split())
a = [0]*Q
b = [0]*Q
c = [0]*Q
d = [0]*Q
for i in range(Q):
     a[i], b[i], c[i], d[i] = map(int, input().split())
ans = 0
for A in combinations_with_replacement(range(1, M+1), N):
    tmp = 0
    for i in range(Q):
        if A[b[i]-1] - A[a[i]-1] == c[i]:
            tmp += d[i]
    ans = max(ans, tmp)
print(ans)

### FIXED CODE ###

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

for i in range(A, B+1):
    if i%K ==0:
        num +=1

print('OK' if num >0 else 'NG')
N = int(input())
a = []
count = [1]
answer = 0
for _ in range(N):
    a.append(int(input()))

def search(A):
    if A in count:  # ループ処理
        print(-1)
        exit()
    count.append(A)
    # print(count)
    if A == 2:
        print(len(count) - 1)
        exit()
        
    search(a[A-1])

search(a[0])

### FIXED CODE ###

N = int(input())
a = [0]
for _ in range(N):
    a.append(int(input()))
x = 1
visited = set([1])
answer = 0

while True:
    x = a[x]
    if x in visited:
        answer = -1
        break
    visited.add(x)
    answer += 1
    if x == 2:
        break

print(answer)
N = int(input())
S = input()
if N % 2 > 0 or S != S[:int(N/2)] + S[:int(N/2)6]:
    exit("No")
exit("Yes")

### FIXED CODE ###

N = int(input())
S = input()
if N % 2 > 0 or S != S[:int(N/2)] + S[:int(N/2)]:
    print("No")
else:
    print("Yes")
N = int(input())
h = [i for i in map(int, input().split())]    

def jump(point):
    if point <= 0:
        return 0
    if memo[point] != inf:
        return memo[point]
    memo[point] = min(jump(point-1)+abs(h[point-1]-h[point]), jump(point-2)+abs(h[point-2]-h[point]))
    return min(jump(point-1)+abs(h[point-1]-h[point]), jump(point-2)+abs(h[point-2]-h[point]))

inf = 10**10
memo = [inf]*(N+1)

print(jump(N-1))

### FIXED CODE ###

N = int(input())
h = [i for i in map(int, input().split())]    
memo = [0] * (N+1)
for i in range(N):
    if i == 0:
        pass
    elif i == 1:
        memo[1] = abs(h[1]-h[0])
    else:
        memo[i] = min(memo[i-1]+abs(h[i]-h[i-1]),  memo[i-2]+abs(h[i]-h[i-2]))
print(memo[N-1])
n=int(input())
li=[int(k) for k in input().split()]
co=[int(k) for k in input().split()]
ans=0
def findans(tot,j,height):
    global ans
    if j==n:
        ans=max(ans,tot)
        return
    if li[j]>height:
        findans(tot+co[j],j+1,li[j])
    findans(tot,j+1,height)
findans(0,0,0)
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
class SegTee:
    
    def __init__(self):
        self.arr=[0]*(4*n)
    def update(self,node,start,end,index,val):
        if index <start or index>end:
            return
        
        if start==end:
            #print(node,val)
            
            self.arr[node]=val
        else:
            mid=(start+end)//2
            self.update(2*node+1,start,mid,index,val)
            self.update(2*node+2,mid+1,end,index,val)
            self.arr[node]=max(self.arr[2*node+1],self.arr[2*node+2])
            
    def query(self,node,tl,tr,l,r):
        if tl>r or tr<l:
            return 0
        elif tl>=l and tr<=r:
            return self.arr[node]
        else:    
            mid=(tr+tl)//2
            p1=self.query(2*node+1,tl,mid,l,r)
            p2=self.query(2*node+2,mid+1,tr,l,r)
            return max(p1,p2)
    

n = int(raw_input())
hi = list(map(int,raw_input().split()))
co= list(map(int,raw_input().split()))
#print(hi)
#print(co)
segTree=SegTee()
dp=[0]*(n)
ans=0
for i in range(n):
  x=hi[i]
  y=segTree.query(0,0,n-1,0,x-1)
  dp[i]=y+co[i]
  ans=max(ans,dp[i])
  #print(dp[i])
  segTree.update(0,0,n-1,x-1,dp[i])
  #print(segTree.arr)
#print(dp)
print(segTree.query(0,0,n-1,0,n-1))
N,K = map(int,input().split())
check = N*[0]

for i in range(N):
	d = int(input())
	a = map(int,input().split())
	for i in a:
		check[i-1] = 1

print(check.count(0))


### FIXED CODE ###

N,K = map(int,input().split())
check = N*[0]

for i in range(K):
	d = int(input())
	a = list(map(int,input().split()))
	for i in a:
		check[i-1] = 1

print(check.count(0))
if d == 0:
        print(n)
    elif d == 1:
        print(n * 100)
    else :
        print(n * 10000)

### FIXED CODE ###

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

if n != 100:
    if d == 0:
        print(n)
    elif d == 1:
        print(n * 100)
    else :
        print(n * 10000)
else:
    if d == 0:
        print(101)
    elif d == 1:
        print(10100)
    else :
        print(1010000)
n, m = map(int, input().split())
s_li = [list(map(int, input().split())) for i in range(m)]

if n != 1:
    ans = ['1']
    ans.extend(['0'] * (n - 1))
else:
    ans = ['0']
    flag = [0] * n

for s, c in s_li:
    if flag[s - 1] == 0:
        ans[s - 1] = '{}'.format(c)
        flag[s - 1] = 1
    elif flag[s - 1] == 1 and int(ans[s - 1]) == c:
        continue
    else:
        ans = ['-1']
        break

ans = int(('').join(ans))

if n != 1 and (ans // 10**(n - 1)) == 0:
    ans = -1

print(ans)

### FIXED CODE ###

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

if n != 1:
    ans = ['1']
    ans.extend(['0'] * (n - 1))
else:
    ans = ['0']
flag = [0] * n

for s, c in s_li:
    if flag[s - 1] == 0:
        ans[s - 1] = '{}'.format(c)
        flag[s - 1] = 1
    elif flag[s - 1] == 1 and int(ans[s - 1]) == c:
        continue
    else:
        ans = ['-1']
        break

ans = int(('').join(ans))

if n != 1 and (ans // 10**(n - 1)) == 0:
    ans = -1

print(ans)
# -*- coding: utf-8 -*-
N = input()
print N/3

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())
print (int(N/3))
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}

	long long ans = 0;
	int MaxNum = 0;
	for (int i = 0; i < N-1; i++)
	{
      if(A[i]>=A[i+1])
		ans += A[i]-A[i+1];
      A[i+1]=A[i]
	}

	cout << ans << endl;
}




### FIXED CODE ###

N=int(input())
A= list(map(int,input().split()))
sum=0
for i in range(N-1):
  if A[i]>=A[i+1]:
    sum+=A[i]-A[i+1]
    A[i+1]=A[i]
    
print(sum)
S = input()
m = re.match('^A[a-z]+C[a-z]+$', S)
if m == None:
    print('WA')
else:
    print('AC')

### FIXED CODE ###

import re

S = input()
m = re.match('^A[a-z]+C[a-z]+$', S)
if m == None:
    print('WA')
else:
    print('AC')
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(1, n+2, 2):
    if a[i-1] % 2 == 1:
        ans += 1
print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(0, n, 2):
    if a[i] % 2 == 1:
        ans += 1
print(ans)
import math

r = eval(input())

s = pi*r*r
l = 2.0*pi*r

print(s,l)

### FIXED CODE ###

import math

r = float(input())

s = math.pi * r**2
l = 2.0*math.pi*r

print(s, l)
n=int(input())
a=[list(map(int,input().split())) for i in range(n)]
if max(a[i].count(".") for i in range(n)) ==0:
  print(-1)
  exit()
minus=0
for i in range(n):
  if a[i].count(".")==0:
    minus=n
    break
  elif a[i][i]=="#":
    minus=max(minus,a[i].count("#"))
b=zip(*a)
for j in range(n):
  if b[j].count(".")==0:
    minus+=1
print(2*n-minus)

### FIXED CODE ###

n=int(input())
a=[list(input()) for i in range(n)]
if max([a[i].count("#") for i in range(n)]) ==0:
  print(-1)
  exit()
minus=0
b=list(zip(*a))
for i in range(n):
  if b[i].count("#")>=1:
    minus=max(minus,a[i].count("#"))
  else:
    minus=max(minus,a[i].count("#")-1)
for j in range(n):
  if b[j].count(".")==0:
    minus+=1
print(2*n-minus)
print(' '.swapcase(1200<))

### FIXED CODE ###

s = input()
print(s.swapcase())
n = int(input())
S = [input() for _ in range(n)]
cnt = 0
fb_cnt = 0
ba_cnt = 0
for s in S:
    idx = len(s) - 1
    for i in range(idx - 1):
        if s[i] == 'A' and s[i + 1] == 'B':
            cnt += 1
    if s[idx] == 'A':
        ba_cnt += 1
    if s[0] == 'B':
        fb_cnt += 1

min_cnt = min(fb_cnt, ba_cnt)
min_cnt = min_cnt - 1 if fb_cnt == ba_cnt else min_cnt
print(cnt + min_cnt)


### FIXED CODE ###

n,k = map(int,input().split())
print(n-(k-1))
N=int(input())
S=list(map(int,input().split()))
L=[0]*100000
for i in range(N-1):
    L[S[i]-1]+=1

for i in range(N):
    print(L[i])


### FIXED CODE ###

N=int(input())
S=list(map(int,input().split()))
Z=[0]*N
for i in range(N-1):
    Z[S[i]-1]+=1
    
for i in range(N):
    print(Z[i])
### 解答


#入力はじめ

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

#入力終わり


#累積和とる

A_wa = [0]
for i in range(N) :
    A_wa.append(A_wa[i]+A[i])

B_wa = [0]
for i in range(M) :
    B_wa.append(B_wa[i]+B[i])

#累積和計算おわり


ans = 0
end = N #二分探索の後に設定しなおしたいので先に設定しておく

for i in range(M+1):#Bを順番に増やしていくよー
    A_use = K-B_wa[i]
    if A_use<0: #Bだけでこえてる
        break
    
    ##Aは最大で何冊よめるかな
    A_MAX = 0
    start = 0
    while  end-start>=1 : #調べるのが2個以上
        now = int((start + end+1)/2) #切り上げ
        if A_wa[now]==A_use :  #A[i]がKと一致
            A_MAX = now #ここが最大
            break
        elif A_wa[now]<A_use : #A[i]がKより小さい
            start = now #目的の値はここ以上のとこにある
            A_MAX = now #現時点での最大値
        else : #A[i]がKより大きい
            end = now-1#目的の値はここより小さい
    ##Aの最大探すの終わり
    
    #これ最大？
    if A_MAX+i>ans :
        ans=A_MAX+i

    end=A_MAX　#endの再設定

#コンソールにだす
print(ans)
    

    






### FIXED CODE ###

### 解答


#入力はじめ

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

#入力終わり


#累積和とる

A_wa = [0]
for i in range(N) :
    A_wa.append(A_wa[i]+A[i])

B_wa = [0]
for i in range(M) :
    B_wa.append(B_wa[i]+B[i])

#累積和計算おわり


ans = 0
for i in range(M+1):#Bを順番に増やしていくよー
    A_use = K-B_wa[i]
    if A_use<0: #Bだけでこえてる
        break
    
    ##Aは最大で何冊よめるかな
    A_MAX = 0
    start = 0
    end = N
    while  end-start>=1 : #調べるのが2個以上
        now = int((start + end+1)/2) #切り上げ
        if A_wa[now]==A_use :  #A[i]がKと一致
            A_MAX = now #ここが最大
            break
        elif A_wa[now]<A_use : #A[i]がKより小さい
            start = now #目的の値はここ以上のとこにある
            A_MAX = now #現時点での最大値
        else : #A[i]がKより大きい
            end = now-1#目的の値はここより小さい
    ##Aの最大探すの終わり
    
    #これ最大？
    if A_MAX+i>ans :
        ans=A_MAX+i

#コンソールにだす
print(ans)
n=int(input())
a=[i for i in input().split()]

print('YES' if len(set(a)==n) else 'NO')

### FIXED CODE ###

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

print('YES' if len(set(a))==n else 'NO')
a = input()
b = input()
print a*b + " " + 2*(a+b)

### FIXED CODE ###

m = map(int,raw_input().split())
print m[0]*m[1],2*(m[0]+m[1])
from sys import stdin, exit

N = int(stdin.readline().rstrip())
s = [int(stdin.readline().rstrip()) for _ in range(N)]
dp = [0] * (100 * N)
dp[0] = 1
for n in range(N):
    for p in range(len(dp), 0, -1):
        if p - s[n] >= 0
            if dp[p - s[n]] == 1:
                dp[p] = 1
for k in range(len(dp)):
    if dp[len(dp) - k - 1] == 1 and (len(dp) - k - 1) % 10 != 0:
        print(len(dp) - k - 1)
        exit()
print('0')


### FIXED CODE ###

from sys import stdin, exit

N = int(stdin.readline().rstrip())
s = [int(stdin.readline().rstrip()) for _ in range(N)]
dp = [0] * (100 * N)
dp[0] = 1
for n in range(N):
    for p in range(len(dp) - 1, 0, -1):
        if p - s[n] >= 0:
            if dp[p - s[n]] == 1 and 0 <= p:
                dp[p] = 1
for k in range(len(dp)):
    if dp[len(dp) - k - 1] == 1 and (len(dp) - k - 1) % 10 != 0:
        print(len(dp) - k - 1)
        exit()
print('0')
def main():
    a, b, k = [int(i) for i in input().split()]

    s = set()
    for i in range(k):
        if a <= a+i and a+i <= b:
            s.add(a+i)
    for i in reversed(range(k)):
        if a <= b-i and b-i <= b:
            s.add(b-i)

    ans = list(s)
    ans.sort()

    for a in ans:
        print(a)
            
if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n = int(input().strip())
    s = [input().strip() for _ in range(n)]
    m = int(input().strip())
    t = [input().strip() for _ in range(m)]


    cand = list(set(s))
    g = [s.count(c) - t.count(c) for c in cand]
    ans = max(g)
    if ans < 0:
        print(0)
    else:
        print(ans)

if __name__ == '__main__':
    main()
a,b=map(int,input().split())
x=0
while True:
  if x*(a-1)+1>=b: break
  else x=+1
print(x)

### FIXED CODE ###

a,b=map(int,input().split())
x=0
while True:
  if x*(a-1)+1>=b: break
  else: x+=1
print(x)
n = input()
d = [int(i) for i in input().split()]
if len(d) % 2 == 1:
  ans = 0
else:
  d.sort()
  if d[len(d)-1] == d[len(d)]:
    ans = 0
  else:
    ans = d[len(d)] - d[len(d)]
    
print(ans)



### FIXED CODE ###

n = input()
d = [int(i) for i in input().split()]
if len(d) % 2 == 1:
  ans = 0
else:
  d.sort()
  if d[len(d)//2-1] == d[len(d)//2]:
    ans = 0
  else:
    ans = d[len(d)//2] - d[len(d)//2-1]
    
print(ans)
# -*- coding: utf-8 -*-
import math
from functools import reduce

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

N = int(input())

As = map(int, input().split())

print(gcd_list(As))


### FIXED CODE ###

# -*- coding: utf-8 -*-
from functools import reduce

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
def gcd_list(numbers):
    return reduce(gcd, numbers)

N = int(input())

As = map(int, input().split())

print(gcd_list(As))
in = int(raw_input())
a = in // 100
b = (in - a * 100) // 10
c = in % 10

cnt = 0
if a == 1:
  cnt += 1
elif b == 1:
  cnt += 1
elif c == 1:
  cnt += 1
  
print cnt

### FIXED CODE ###

in1 = int(raw_input())
a = in1 // 100
b = (in1 - a * 100) // 10
c = in1 % 10

cnt = 0
if a == 1:
    cnt += 1
if b == 1:
    cnt += 1
if c == 1:
    cnt += 1

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

ans = 1
var = pow(10,18)
for i in range(len(A)):
    ans *= A[i]
    if ans > tmp:
        ans = -1
        break

print(ans)

### FIXED CODE ###

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

ans = 1
var = pow(10,18)

if 0 in A:
    ans = 0
else:
    for i in range(len(A)):
        ans *= A[i]
        if ans > var:
            ans = -1
            break

print(ans)
#Bとその前１文字を消せば良い
s =list(input())
lis = []
for i in range(len(s)):
    if s[i] == "B": 
        lis[i-1]=""
        lis.append("")
    else: lis.append(s[i])
print("".join(lis))

### FIXED CODE ###

#Bとその前１文字を消せば良い
s =list(input())
lis = []
for i in range(len(s)):
    if s[i] == "B":
        if len(lis) >0:
            lis.pop()
    else: lis.append(s[i])
print("".join(lis))
a,b,c=map(int,input().split())
if a == b + c or b = c + a or c = b + a:
  print("YES")
else:
  print("NO")
  

### FIXED CODE ###

a,b,c=map(int,input().split())
if a == b + c or b == c + a or c == b + a:
  print("Yes")
else:
  print("No")
if max(int(input()),int(input()))>8:print(":(")
else:print("Yay!")

### FIXED CODE ###

a,b=map(int,input().split())
if max(a,b)>8:print(":(")
else:print("Yay!")
# D
def cmb(n, r):　
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
    return result


N, K =map(int, input().split())
blue = K   
red = N - K   
over = 10**9 + 7

for i in range(K):
    if i == 0:   
        print(red+1)
    elif i < red:    
        print((cmb(red+1, i+1) % over) * (cmb(blue-1, i) % over)
    else:  
        print(0)

### FIXED CODE ###

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

N, K =map(int, input().split())
blue = K
red = N - K
over = 10**9 + 7

for i in range(K):
    if i <= red:
        print((cmb(red+1, i+1)  * (cmb(blue-1, i))) % over)
    else:
        print(0)
if s==t[:-1]:
  print("Yes")
  else:
    print("No")

### FIXED CODE ###

S=input()
T=input()
if S==T[:-1]:
  print("Yes")
else:
  print("No")
# Circle

# Import math.py
from math import pi

radius = int(input())
r = radius

area = r * r * pi
circumference = 2 * r * pi
print(area, end = " ")
print(circumference)



### FIXED CODE ###

# Circle

# Import math.py
from math import pi

radius = float(input())
r = radius

area = r * r * pi
circumference = 2 * r * pi
print(area, end = " ")
print(circumference)
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 16 21:12:07 2019

@author: yff20
"""

l1 = input().split()

ln = [0] * (int(l1[1])-1)

for num in range(0, int(l1[0])):
   l2 = input().split()
   for index in range(1, len(l2)):
       ln[int(l2[int(index)])-1] += 1
    
count = 0

for i in ln:
    if(i==int(l1[0])):
        count += 1

print(count)


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Feb 16 21:12:07 2019

@author: yff20
"""

l1 = input().split()

ln = [0] * (int(l1[1]))

for num in range(0, int(l1[0])):
   l2 = input().split()
   for index in range(1, len(l2)):
       ln[int(l2[int(index)])-1] += 1
    
count = 0

for i in ln:
    if(i==int(l1[0])):
        count += 1

print(count)
a=input()
b=input()
c=input()
avarage=(a+b+c)/2
if a==avarage or b==avarage or c==avarage:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a,b,c=map(int,input().split())
a=int(a)
b=int(b)
c=int(c)
avarage=(a+b+c)/2
if a!=avarage and b!=avarage and c!=avarage:
    print("No")
else:
    print("Yes")
n = int(input())
str = input()

for i in range(len(str)-1):
  if str[i] == str[i+1]:
    del str[i]
    
print(len(str))    

### FIXED CODE ###

n = int(input())
str =list(input())
count = 1
for i in range(n-1):
  if str[i] != str[i + 1]:
    count += 1
    
    
print(count)
N = int(input())
ans_list = [0] * (N+1)
def popcnt(n):
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c
for i in range(N):
    if i == 0:
        continue
    else:
        if i %popcnt(i) == 0 :
            ans_list[i] = 1
        else:
            ans_list[i] = ans_list[i%popcnt(i)] + 1
S = input()
count = 0
for i in range(N):
    if S[i] == "1":
        count += 1
high_total = 0
low_total = 0
for i in range(N):
    if S[i] == "1":
        high_total += pow(2,N-1-i,count+1)
        high_total %= (count+1)
        low_total +=  pow(2,N-1-i,count-1)
        low_total %= (count-1)
for i in range(N):
    if S[i] == "1":
        total = (low_total - pow(2,N-1-i,count-1)) % (count-1)
        print(ans_list[total]+1)
    if S[i] == "0":
        total = (high_total + pow(2,N-1-i,count+1)) % (count+1)
        print(ans_list[total]+1)

### FIXED CODE ###

N = int(input())
ans_list = [0] * (N+1)
def popcnt(n):
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c
for i in range(N):
    if i == 0:
        continue
    else:
        if i %popcnt(i) == 0 :
            ans_list[i] = 1
        else:
            ans_list[i] = ans_list[i%popcnt(i)] + 1
S = input()
count = 0
for i in range(N):
    if S[i] == "1":
        count += 1
if count == 1:
    high_total = 0
    low_total = 0
    for i in range(N):
        if S[i] == "1":
            high_total += pow(2,N-1-i,count+1)
            high_total %= (count+1)
    for i in range(N):
        if S[i] == "1":
            print(0)
        if S[i] == "0":
            total = (high_total + pow(2,N-1-i,count+1)) % (count+1)
            print(ans_list[total]+1)
else:
    high_total = 0
    low_total = 0
    for i in range(N):
        if S[i] == "1":
            high_total += pow(2,N-1-i,count+1)
            high_total %= (count+1)
            low_total +=  pow(2,N-1-i,count-1)
            low_total %= (count-1)
    for i in range(N):
        if S[i] == "1":
            total = (low_total - pow(2,N-1-i,count-1)) % (count-1)
            print(ans_list[total]+1)
        if S[i] == "0":
            total = (high_total + pow(2,N-1-i,count+1)) % (count+1)
            print(ans_list[total]+1)
x = input()
    a = list(x)
    a  = [int(s) for s in x]
    b = 0
    for i in range(3):
        if a[i] == 1:
          b += 1
          
          
          
    print(b)
          

### FIXED CODE ###

x = input()
a = list(x)
a  = [int(s) for s in x]
b = 0
for i in range(3):
    if a[i] == 1:
      b += 1
      
      
      
print(b)
Number= list(map(int, input().split()))
Number.sort()
if Number[0] == Number[1]:
    print(Number.sum())
else:
    print(f'{Number[1]*2 -1}')

### FIXED CODE ###

Number= list(map(int, input().split()))
Number.sort()
if Number[0] == Number[1]:
    print(sum(Number))
else:
    print(Number[1]*2 -1)
N=int(input())
L=[]
M=""
while N!=0:
  M=int((-1)*(N%(-2)))
  if N<0:
    N=int((N-1)/(-2))
  else:
    N=int(N/(-2))
  L.insert(0,str(M))
if N=0:
  print(0)
else:
  print("".join(L))

### FIXED CODE ###

N=int(input())
L=[]
M=""
while N!=0:
  M=int((-1)*(N%(-2)))
  if N<0:
    N=int((N-1)/(-2))
  else:
    N=int(N/(-2))
  L.insert(0,str(M))
if len(L)==0:
  L=["0"]
print("".join(L))
from collections import Counter
c1 = Counter(input())
for c num in c1:
  if c1[c] % 2 != 0:
    print('No')
    break
else:
  print('Yes')


### FIXED CODE ###

w = input()
checked_char = []
r = 'Yes'
for i in range(len(w)):
  if w[i] not in checked_char:
    if (w.count(w[i])) % 2 == 1:
      r = 'No'
    checked_char.append(w[i])
    
print(r)
import sys, math
from sys import stdin, stdout

rem = 10 ** 9 + 7
sys.setrecursionlimit(10 ** 6)
take = lambda: map(int, stdin.readline().split())


a=input()
b=input()
if a<=8 and b<=8:
    print 'Yay!'
    exit()
print ':('

### FIXED CODE ###

import sys, math
from sys import stdin, stdout

rem = 10 ** 9 + 7
sys.setrecursionlimit(10 ** 6)
take = lambda: map(int, stdin.readline().split())


a,b=take()
if a<=8 and b<=8:
    print 'Yay!'
    exit()
print ':('
n=input()
ans=0
def dfs(i,flag):
  if i!=len(n)-1:
    dfs(i+1,flag)
    dfs(i+1,flag|2**i)
  else:
    num=[]
    start=0
    for i in range(len(n)):
      if flag&2**i>0:
        num.append(n[start:i+1])
        start=i+1
    ans+=sum(num)

dfs(0,0)
print(ans)

### FIXED CODE ###

n=input()
ans=0
def dfs(i,flag):
  global ans
  if i!=len(n)-1:
    dfs(i+1,flag)
    dfs(i+1,flag|2**i)
  else:
    num=[]
    start=0
    for i in range(len(n)):
      if flag&2**i>0:
        num.append(int(n[start:i+1]))
        start=i+1
    if start!=n:
      num.append(int(n[start:]))
    ans+=sum(num)
dfs(0,0)
print(ans)
a=input()
b=list(map(input().split()))
if "Y" in b:
  print("Four")
else:
  print("Three")

### FIXED CODE ###

a=input()
b=list(map(str,input().split()))
if "Y" in b:
  print("Four")
else:
  print("Three")