Harryxun/stf_run huggingface dataset:
A,B = map(int, input().split())
print("EQUAL" if A==B else "GREATER" if A>B else "LESS")

### FIXED CODE ###

A = int(input())
B = int(input())
print("EQUAL" if A == B else "GREATER" if A > B else "LESS")
from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
import copy
import numpy as np
import sys
INF = float('inf')
mod = 10**9+7


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

# 1 2 3
# a, b, c = LI()


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))

# a = I()


def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS()


def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S()


def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2]


def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]]


def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def]


def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]]


def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]]


def SRL(n): return [list(S()) for i in range(n)]


def dfs(n):
    visited[n-1] = True
    for node in graph[n-1]:
        if visited[node-1]:
            continue
        point[node-1] += point[n-1]
        dfs(node)


n, q = LI()
point = [0]*n
graph = [[] for i in range(n)]

for i in range(n - 1):
    a, b = LI()
    graph[a - 1].append(b)
    graph[b - 1].append(a)


for i in range(q):
    p, x = LI()
    point[p - 1] += x

visited = [False]*n

dfs(1)

print(*point)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
 
N, Q = map(int, input().split())
root = [[] for _ in range(N)]
ans = [0]*N
 
for _ in range(N-1):
  a,b=map(int, input().split())
  a,b=a-1,b-1
  root[a].append(b)
  root[b].append(a)

for _ in range(Q):
  p,x=map(int, input().split())
  ans[p-1]+=x
  
visited=[False]*N
def dfs(v):
  visited[v] = True
  for go in root[v]:
    if visited[go]:
      continue
    ans[go] += ans[v]
    dfs(go)

dfs(0)
print(*ans)
import itertools
N,A,B = map(int,input().split())
data = range(A,B+1)
if N-2>=0:
  tmp = list(itertools.combinations_with_replacement(data,N-2))
  ans = []
  for i in range(len(tmp)):
    ans.append(sum(tmp[i]))
  print(len(set(ans)))
elif N == 1:
  print('1')
else:
  print('0')

### FIXED CODE ###

N,A,B = map(int,input().split())
if A>B:
  print('0')
elif N == 1:
  if A!=B:
    print('0')
  else:
    print('1')
else:
  print((B-A)*(N-2)+1)
def get_caps(a):
  dic = dict()

  for ai in a:
    dic.setdefault(ai, 0)
    dic[ai] += 1

  return dic


def is_match(caps):
  global N

  if 0 in caps.keys():
    if caps[0] == N:
      return True
  
  if N % 3 == 0:
    if 0 in caps.keys() and len(caps) == 2:
      if caps[0] == M//3:
        return True
    elif len(caps) == 3:
      x, y, z = caps.keys()
    
      if x ^ y ^ z == 0:
        return True


# A - XOR Circle
N = int(input())
a = list(map(int, input().split()))

# 帽子の情報をdictに入れる
caps = get_caps(a)

if is_match(caps):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

def get_caps(a):
  dic = dict()

  for ai in a:
    dic.setdefault(ai, 0)
    dic[ai] += 1

  return dic


def is_match(caps):
  global N

  if 0 in caps.keys():
    if caps[0] == N:
      return True
  
  if N % 3 == 0:
    if 0 in caps.keys() and len(caps) == 2:
      if caps[0] == N//3:
        return True
    elif len(caps) == 3:
      x, y, z = caps.keys()
    
      if x ^ y ^ z == 0:
        if caps[x] == caps[y] == caps[z] == N//3:
          return True


# A - XOR Circle
N = int(input())
a = list(map(int, input().split()))

# 帽子の情報をdictに入れる
caps = get_caps(a)

if is_match(caps):
  print('Yes')
else:
  print('No')
S = str(input())
T = str(input())
length =len(S)
listS=list(S)
listT=list(T)
num = len(T)
res = 0
for i in range(length):
    if (listS[num-1] != listT[num-1]):
        res +=1
    num -=1
print(res)

### FIXED CODE ###

a= int(input())
print(a+a**2+a**3)
s=str(input())
n=a.split(" " 1)
a=int(n[0])
b=int(n[1])
if a < b:
 print(a<b)
elif a > b:
 print(a>b)
else:
 print(a == b)

### FIXED CODE ###

x=input().split()
y=list(map(int,x))
a=y[0]
b=y[1]
if a < b:
 print('a < b')
elif a > b:
 print('a > b')
else:
 print('a == b')
S = input()

h = S/360
rest = S % 360
m = rest/60
s = rest % 60

print(str(h) + ":" + str(m) + ":" + str(s))

### FIXED CODE ###

S = int(input())
h = S // 3600
m = (S % 3600) // 60
s = S % 60
print(h,m,s,sep = ":")
from collections import deque


h, w = map(int, input().split())
a = []
d = deque([])
memo = [[-1] * w for j in range(h)]
for i in range(h):
    a.append(list(input()))
    for j, s in enumerate(a[i]):
        if s == '#':
            d.append([i, j])
            memo[i][j] = 0


def d_list_update(d, hmax, wmax):
    counter[0] += 1
    move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
    dh, dw = d.popleft()
    for i, j in move:
        if (0 <= dh + i < hmax) and (0 <= dw + j < wmax):
            if memo[dh + i][dw + j] == -1:
                memo[dh + i][dw + j] = memo[dh][dw] + 1
                d.append([dh + i, dw + j])
    return d


while(d):
    d = d_list_update(d, h, w)
ans = max([max(e) for e in memo])
print(ans)

### FIXED CODE ###

from collections import deque
 
 
h, w = map(int, input().split())
hs, ws = set(range(h)), set(range(w))
d = deque()
memo = [[-1] * w for j in hs]
move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
a = tuple(input() for _ in hs)
b = [[i, j] for i in hs for j in ws if a[i][j] == '#']
for i, j in b:
    d.append((i, j))
    memo[i][j] = 0
while d:
    dh, dw = d.popleft()
    for i, j in move:
        dhn, dwn = dh + i, dw + j
        if (0 <= dhn < h) and (0 <= dwn < w) and (memo[dhn][dwn] < 0):
            d.append((dhn, dwn))
            memo[dhn][dwn] = memo[dh][dw] + 1
ans = max([max(e) for e in memo])
print(ans)
from collections import deque
H,W = list(map(int, input().split()))
s = [input().split() for i in range(H)]
for i in range(H):
    s[i] = list(s[i][0])
black = 0
for i in range(H):
    for j in range(W):
        if s[i][j] == "#":
            black += 1
queue = deque([])
dist = [[-1 for i in range(W)] for j in range(H)]
dist[0][0] = 0
queue.append([0,0])
place_w = [0, 1, 0, -1]
place_h = [1, 0, -1, 0]
Flag = False
while True:
    vh,vw = queue.popleft()
    for m in range(4):
        nvh = vh+place_h[m]
        nvw = vw+place_w[m]
        if 0<=nvh<H and 0<=nvw<W and dist[nvh][nvw] == -1 and s[nvh][nvw] == ".":
            queue.append([nvh,nvw])
            dist[nvh][nvw] = dist[vh][vw]+1
            if nvh == H-1 and nvw == W-1:
                Flag = True
                break
    if Flag:
        break
print(W*H-dist[H-1][W-1]-black-1)

### FIXED CODE ###

from collections import deque
H,W = list(map(int, input().split()))
s = [input().split() for i in range(H)]
for i in range(H):
    s[i] = list(s[i][0])
black = 0
for i in range(H):
    for j in range(W):
        if s[i][j] == "#":
            black += 1
queue = deque([])
dist = [[-1 for i in range(W)] for j in range(H)]
dist[0][0] = 0
queue.append([0,0])
place_w = [0, 1, 0, -1]
place_h = [1, 0, -1, 0]
Flag = False
while len(queue) > 0:
    vh,vw = queue.popleft()
    for m in range(4):
        nvh = vh+place_h[m]
        nvw = vw+place_w[m]
        if 0<=nvh<H and 0<=nvw<W and dist[nvh][nvw] == -1 and s[nvh][nvw] == ".":
            queue.append([nvh,nvw])
            dist[nvh][nvw] = dist[vh][vw]+1
if dist[H-1][W-1] == -1:
    print(-1)
else:
    print(W*H-dist[H-1][W-1]-black-1)
from fractions import gcd

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

N = int(input())
T = list(int(input()) for i in range(N))
T = list(set(T))
T.sort()
a = lcm(T[0], T[1])
for i in T[2:]:
    a = lcm(a, i)
print(int(a))

### FIXED CODE ###

N = list(map(int, (input())))
if N == N[::-1]:
    print("Yes")
else:
    print("No")
ary = map(int, input().split())
if ary[0] == ary[1]:
    print(ary[2])
elif ary[0] == ary[2]:
    print(ary[1])
else:
    print(ary[0])

### FIXED CODE ###

ary =list( map(int, input().split()))
if ary[0] == ary[1]:
    print(ary[2])
elif ary[0] == ary[2]:
    print(ary[1])
else:
    print(ary[0])
a, b = map(int, input())
if a*b %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')
import sys
input = sys.stdin.readline
n,k = map(int,input().split())
edge = [[] for i in range(n)]
alledge = []
for i in range(n-1):
    a,b = map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
    alledge.append((a-1,b-1))
if n==2:
    print(0)
    exit()


def f(x,y,c):
    c += 1
    for e in edge[x]:
        if e == y:
            continue
        if c > d:
            used[e] = 1
        f(e,x,c)



if k % 2 == 0:
    d = k//2
    res = []
    for i in range(n):
        used = [0]*n
        f(i,-1,0)
        res.append(sum(used))
    print(min(res))
else:
    if k == 1:
        print(n-2)
        exit()
    d = (k-1)//2
    res = []
    for e1 in alledge:
        used = [0]*n
        f(e1[0],e1[1],0)
        f(e1[1],e1[0],0)
        res.append(sum(used))
    print(min(res))


### FIXED CODE ###

import sys
#input = sys.stdin.readline
n,k = map(int,input().split())
edge = [[] for i in range(n)]
alledge = []
for i in range(n-1):
    a,b = map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
    alledge.append((a-1,b-1))

def f(x,y,c):
    global tmp
    c += 1
    for e in edge[x]:
        if e == y:
            continue
        if c > d:
            tmp +=1
        f(e,x,c)

sys.setrecursionlimit(4100000)

if k % 2 == 0:
    d = k//2
    ass = 2001
    for i in range(n):
        tmp = 0
        f(i,-1,0)
        ass = min(ass,tmp)
    print(ass)
else:
    d = (k-1)//2
    ass = 2001
    for e1 in alledge:
        tmp = 0
        f(e1[0],e1[1],0)
        f(e1[1],e1[0],0)
        ass = min(ass,tmp)
    print(ass)
N = int(input())
a = [input() for i in range(N)]

while i > 0:
    print(a[i], end=" ")
    i -= 1
else:
    print(a[i])

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
i = int(len(a)) - 1
while i > 0:
    print(a[i], end=" ")
    i -= 1
else:
    print(a[0])
import math

def main():
    N = int(input())
    ans = [0]*(N+1)

    end = math.ceil(math.sqrt(N))

    for i in range(3,end+1):
        sn = i
        x = 1
        y = 1
        z = sn - 2
        zt = z
        if(cal(x,y,z) < N):
            ans[cal(x,y,z)] += func(x,y,z)
        while True:
            x = 1
            z = zt
            y += 1
            z -= 1
            zt = z
            if x > z or y > z:
                break
            if(cal(x,y,z) < N):
                ans[cal(x,y,z)] += func(x,y,z)
            for j in range(y - 1):
                if y < x + 1:
                    break
                x += 1
                z -= 1
                if x > z or y > z:
                    break
                if(cal(x,y,z) < N):
                    ans[cal(x,y,z)] += func(x,y,z)
    
    for i in range(1,N+1):
        print(ans[i])
        

def func(x,y,z):
    # print(x,y,z)
    if x == y and y == z and z == x:
        return 1
    elif x != y and y != z and z != x:
        return 6
    else:
        return 3

def cal(x,y,z):
    return x**2+y**2+z**2+x*y+y*z+z*x

main()

### FIXED CODE ###

import math

L, R, d = map(int,input().split())

ans = 0

for i in range(L,R+1):
    if i % d == 0:
        ans += 1

print(ans)
N,A,B,C,D=map(int,input().split())
S=list(input())
a=0
E=N-D
if C>D:
    for i in range(N-3):
        if S[i]=="#":
            for j in range(1,4):
                if S[i]==S[i+j]:
                    a=1
    if E==0:
        for i in range(B-1,D-1):
            if S[i]==".":
                if S[i]==S[i+1] and S[i+1]==S[i+2]:
                    a=0
                    break
    if E>=1:
        for i in range(B-1,D):
            if S[i]==".":
                if S[i]==S[i+1] and S[i+1]==S[i+2]:
                    a=0
                    break
for i in range(N-1):
    if S[i]=="#":
        if S[i+1]=="#":
            a=1
if a==0:
    print("Yes")
if a==1:
    print("No")

### FIXED CODE ###

N,A,B,C,D=map(int,input().split())
S=list(input())
a=0
E=N-D
if C>D:
    for i in range(N-3):
        if S[i]=="#":
            for j in range(1,4):
                if S[i]==S[i+j]:
                    a=1
    if E==0:
        for i in range(B-2,D-2):
            if S[i]==".":
                if S[i]==S[i+1] and S[i+1]==S[i+2]:
                    a=0
                    break
    if E>=1:
        for i in range(B-2,D-1):
            if S[i]==".":
                if S[i]==S[i+1] and S[i+1]==S[i+2]:
                    a=0
                    break
for i in range(A,D):
    if S[i]=="#":
        if S[i+1]=="#":
            a=1
if a==0:
    print("Yes")
if a==1:
    print("No")
import queue
H,W = map(int,input().split())
maze = list()
q = queue.Queue()
for i in range(H):
   maze.append( [x for x in input()])

maxim = 1
for i in range(H):
    for j in range(W):
        if maze[i][j] == "." :
            maze_score = [[0]*W for k in range(W)]
            maze_score[i][j] = 1
            q.put([i,j])
            
        else :
            continue
        
        while(True):
            if q.empty() :
                break
            [x,y] = q.get()
            
            if maze_score[x][y] > maxim:
                maxim = maze_score[x][y]
            
            ##top
            if x != 0:
                if maze_score[x-1][y] ==0 and maze[x-1][y] == ".":
                    maze_score[x-1][y] = maze_score[x][y] +1
                    q.put([x-1,y])
            ##right
            if y != W-1:
                if maze_score[x][y+1] ==0 and maze[x][y+1] == ".":
                    maze_score[x][y+1] = maze_score[x][y] +1
                    q.put([x,y+1])
            ##bottom
            if x != H-1:
                if maze_score[x+1][y] ==0 and maze[x+1][y] == ".":
                    maze_score[x+1][y] = maze_score[x][y] +1
                    q.put([x+1,y])
            ##left
            if y != 0:
                if maze_score[x][y-1] ==0 and maze[x][y-1] == ".":
                    maze_score[x][y-1] = maze_score[x][y] +1
                    q.put([x,y-1])
        
print(maxim-1)

### FIXED CODE ###

import queue
H,W = map(int,input().split())
maze = list()
q = queue.Queue()
for i in range(H):
   maze.append( [x for x in input()])

maxim = 1
for i in range(H):
    for j in range(W):
        if maze[i][j] == "." :
            maze_score = [[0]*W for k in range(H)]
            maze_score[i][j] = 1
            q.put([i,j])
            
        else :
            continue
        
        while(True):
            if q.empty() :
                if maze_score[x][y] > maxim:
                    maxim = maze_score[x][y]
                break
            [x,y] = q.get()
            
            
            
            
            ##top
            if x != 0:
                if maze_score[x-1][y] ==0 and maze[x-1][y] == ".":
                    maze_score[x-1][y] = maze_score[x][y] +1
                    q.put([x-1,y])
            ##right
            if y+1 != W:
                if maze_score[x][y+1] ==0 and maze[x][y+1] == ".":
                    maze_score[x][y+1] = maze_score[x][y] +1
                    q.put([x,y+1])
            ##bottom
            if x != H-1:
                if maze_score[x+1][y] ==0 and maze[x+1][y] == ".":
                    maze_score[x+1][y] = maze_score[x][y] +1
                    q.put([x+1,y])
            ##left
            if y != 0:
                if maze_score[x][y-1] ==0 and maze[x][y-1] == ".":
                    maze_score[x][y-1] = maze_score[x][y] +1
                    q.put([x,y-1])
        
print(maxim-1)
def f(s, i, d):
  if len(s) == i:
    d.sort()
    return d[0]
  if len(d) == 0:
    return "_"
  d.remove(s[i])
  r = f(s, i+1, d)
  if r == "_":
    d.sort()
    for i in d:
      if s[i] < i:
        return i
    d.append(s[i])
    return "_"
  return "".join([s[i], r])

def main():
  d = list("abcdefghijklmnopqrstuvwxyz")
  t = input()
  r = f(t, 0, d)
  print(r)
  
main()


### FIXED CODE ###

def f(s, i, d):
  if len(d) == 0:
    return "-1"
  if len(s) == i:
    d.sort()
    return d[0]
  d.remove(s[i])
  r = f(s, i+1, d)
  if r == "-1":
    d.sort()
    for j in d:
      if s[i] < j:
        return j
    d.append(s[i])
    return "-1"
  return "".join([s[i], r])

def main():
  d = list("abcdefghijklmnopqrstuvwxyz")
  t = input()
  r = f(t, 0, d)
  print(r)

main()
from sys import stdin
from math import factorial

def permutations_count(n, r):
  return factorial(n) // factorial(r) // factorial(n - r)

N,K = map(int,stdin.readline().split())
mod = pow(10,9)+7

if N == K:
  print("1")
  exit()

frame = N-K+1
for i in range(1,K+1):
  select=permutations_count(frame, i) % mod
  pattern=permutations_count(K-1, i-1) % mod
  print((select * pattern) % mod )

### FIXED CODE ###

from sys import stdin
from math import factorial

def permutations_count(n, r):
  return factorial(n) // factorial(r) // factorial(n - r)

N,K = map(int,stdin.readline().split())
mod = pow(10,9)+7

frame = N-K+1
for i in range(1,K+1):
  if K == N:
    if i == 1:
      print("1")
    else:
      print("0")
  else:
    if i > frame:
      print("0")
    else:
      select=permutations_count(frame, i) % mod
      pattern=permutations_count(K-1, i-1) % mod
      print((select * pattern) % mod )
N, M, X = map(int,input().split())

CAM = list([list(map(int,input().split())) for i in range(N)])
# print(CAM)
minn = 10**18
b = False

for i in range(2 ** N):
  s = 0
  x = 0
  y =0
  z=0
  for j in range(N):  # このループが一番のポイント
      if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
        s += CAM[j][0]
        x += CAM[j][1]
        y += CAM[j][2]
        z += CAM[j][3]

  if x >= X and y >= X and z >= X:
    minn = min(s,minn)
    b = True

print(minn if b == True else -1)

### FIXED CODE ###

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

CAM = list([list(map(int,input().split())) for i in range(N)])
# print(CAM)
minn = 10**18
b = False

for i in range(2 ** N):
  s = 0
  am = []

  for j in range(N):  # このループが一番のポイント
      if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
        am.append(CAM[j])

  j = False
  sss = [0] * (M+1)
  for kk in range(len(am)):
    s += am[kk][0]
    for m in range(0, M):
      sss[m+1] += am[kk][m+1]
  
  if len([i for i in sss[1:] if i >= X] ) == len(sss[1:]):
    b = True
    minn = min(s,minn)
  
  # print(sss)
  # if x >= X and y >= X and z >= X:
  #   minn = min(s,minn)
  #   b = True

print(minn if b == True else -1)
N = int(input()) 
A = list(map(int,input().split()))

if 0 in A:
  print(0)
elif:
  result = 1
  for n in range(N):
    result = result*A[n]
  if result>1000000000000000000:
    print(-1)
  else:
    print(result)
    

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
finish = 0
result = 1

if 0 in A:
    print(0)
    finish = 1
else:
    for n in range(N):
        result = result*A[n]
        if result > 10**18:
            print(-1)
            finish = 1
            break

    if finish == 0:
        print(result)
N, M = map(int,input().split())
X = list(map(int,input().split()))
X.sort()

X_dif = []

excep = 0

if M == 1:
    excep = M1
    
if not excep = M1:
    for i in range(M-1):
        X_dif.append(X[i+1]-X[i])
    
    X_dif.sort()
    X_dif.reverse()

    if len(X_dif) == 1:
        excep == X_dif1
    
    if not X_dif1:
        for N in range(N-1):
            X_dif.pop(0)

if excep == M1:
    print(1)
elif excep == X_dif1:
    print(2)
else:
    print(sum(X_dif))

### FIXED CODE ###

# print('input >>')
N, M = map(int,(input().split()))
X = list(map(int,(input().split())))
X.sort()
Xdiff = [X[i + 1] - X[i] for i in range(len(X) - 1)]
Xdiff.sort(reverse=True)
ans = (X[-1]-X[0]) - sum(Xdiff[:N-1])

# print('----------output----------')
print(ans)
x, y = list(map(int, input().split()))
if y - x >= 0:
    ans = y - x
if y + x >= 0:
    ans = min(ans, y + x + 1)
if -1 * y - x >= 0:
    ans = min(ans, -1 * y - x + 1)
if -1 * y + x >= 0:
    ans = min(ans, -1 * y + x + 2)
print(ans)


### FIXED CODE ###

x, y = list(map(int, input().split()))
ans = []
if y - x >= 0:
    ans.append(y - x)
if y + x >= 0:
    ans.append(y + x + 1)
if -1 * y - x >= 0:
    ans.append(-1 * y - x + 1)
if -1 * y + x >= 0:
    ans.append(-1 * y + x + 2)
print(min(ans))
from math import factorial as fac

def comb(n,r):
    if ( r<0 or r>n ):
        return 0
    return fac(n)/(fac(r)*fac(n-r))


n=int(input())
k=int(input())

nn=str(n)
keta=len(nn)

ans=0


for i in range(k):
    ans+=comb(keta-i-1,k-i)*9**(k-i)
    if int(nn[i])-1>=0:
        ans+=(int(nn[i])-1)*comb(keta-i-1,k-i-1)*9**(k-i-1)



print(int(ans)+1)

### FIXED CODE ###

from math import factorial as fac

def comb(n,r):
    if ( r<0 or r>n ):
        return 0
    return fac(n)/(fac(r)*fac(n-r))


n=int(input())
k=int(input())

nn=str(n)
keta=len(nn)

ans=0

if keta<k:
    print(0)
    exit()

zero=0

# for i in range(keta):
#     if int(nn[i])==0:zero+=1
#     ans+=comb(keta-i-1,k-i+zero)*9**(k-i)
#     if int(nn[i])-1>=0:
#         ans+=(int(nn[i])-1)*comb(keta-i-1,k-i-1+zero)*9**(k-i-1+zero)
#
# if keta-zero==k:ans+=1

def search(n,k):
    if k<=0:return
    global ans
    nn = str(n)
    keta = len(nn)
    ans += comb(keta - 1, k ) * 9 ** k
    if int(nn[0])-1>0:
        ans+=(int(nn[0])-1)*comb(keta-1,k-1)*9**(k-1)
    ne=n-int(nn[0])*10**(keta-1)
    search(ne,k-1)


search(n,k)
for i in range(keta):
    if nn[i]=="0":zero+=1
if keta-zero>=k:ans+=1
print(int(ans))
s = map(str,input())
counter = 700
if s[0] == 'o':
  counter +=100
if s[1] == 'o':
  counter +=100
if s[2] == 'o':
  counter +=100

print('counter')


### FIXED CODE ###

s = str(input())
counter = 700
if s[0] == 'o':
  counter +=100
  
if s[1] == 'o':
  counter +=100
if s[2] == 'o':
  counter +=100
  
print(counter)
print('YES' if sorted(input()) == [*'  557'] else 'No')

### FIXED CODE ###

print('YES' if sorted(input()[::2]) == ['5','5','7'] else 'NO')
def solve():
  N = int(input())
  X = input()
  bl = X.count('1')
  bitp = 0
  for i in range(N):
    bitp += int(X[i])*pow(2,N-1-i,bl+1)
    bitp %= bl+1
  bitm = 0
  if bl>1:
    for i in range(N):
      bitm += int(X[i])*pow(2,N-1-i,bl-1)
      bitm %= bl-1
  
  ans = [0]*N
  dp = [0]*(N+1)
  for i in range(1,N+1):
    dp[i] = dp[i%(bin(i).count('1'))]+1
  for i in range(N):
    if X[i]=='1':
      bit1 = bitm - pow(2,N-1-i,bl-1)
      bl1 = bl-1
      if bl1==0:
        ans[i] = 0
        continue
    else:
      bit1 = bitp + pow(2,N-1-i,bl+1)
      bl1 = bl+1
    ans[i] = dp[bit1%bl1]+1
  return ans
print(*solve(),sep='\n')

### FIXED CODE ###

def solve():
  N = int(input())
  X = input()
  x = sum(map(int,list(X)))
  dp = [0]*N
  for i in range(1,N):
    dp[i] = dp[i%sum(map(int,list(bin(i)[2:])))]+1
  cnt1 = 0
  if x>1:
    for i in range(N):
      cnt1 += int(X[-i-1])*pow(2,i,x-1)
      cnt1 %= x-1
  cnt2 = 0
  for i in range(N):
    cnt2 += int(X[-i-1])*pow(2,i,x+1)
    cnt2 %= x+1
  
  ans = [0]*N
  for i in range(N):
    if X[i]=='1':
      if x==1:
        ans[i] = 0
      else:
        num = (cnt1-pow(2,N-i-1,x-1))%(x-1)
        ans[i] = dp[num]+1
    else:
      num = (cnt2+pow(2,N-i-1,x+1))%(x+1)
      ans[i] = dp[num]+1
  return ans
print(*solve(),sep='\n')