Harryxun/stf_run huggingface dataset:
l, r = map(int, input().split())

li=[]
cnt=0
for i in range(l, r+1):
  li.append(i%2019)
  if i%2019==0:
    li.sort()
    print((li[0]*li[1])%2019)
    break
else:
  ans=2019
  for index, i in enumerate(li):
    for j in li[index+1:]:
      ans = min(ans, (i*j)%2019)
  print(ans)

### FIXED CODE ###

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

li=[]
cnt=0
for i in range(l, r+1):
  li.append(i%2019)
  if i%2019==0:
    print(0)
    break
else:
  ans=2019
  for index, i in enumerate(li):
    for j in li[index+1:]:
      ans = min(ans, (i*j)%2019)
  print(ans)
import math

x,y,z = map(int,input())

x = math.sqrt(x)
y = math.sqrt(y)
z = math.sqrt(z)

if x + y < z:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

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

d = c-b-a

if d > 0 and d**2 > 4*a*b:
  print("Yes")
else:
  print("No")
X, Y = map(int, input().split())
print("Yes" if 2*X<=T<=4*X and (4*X-T)%2==0 else "No")

### FIXED CODE ###

X, Y = map(int, input().split())
print("Yes" if 2*X<=Y<=4*X and Y%2==0 else "No")
num_list = input().split(" ")

num_list = map(num_list, int)

sorted_list = num_list.sorted()
 
if sorted_list == [5, 5, 7]:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

haiku = input().split()

haiku = sorted(list(map(int, haiku)))

if [5, 5, 7] == haiku:
    print('YES')
else:
    print('NO')
asdf = int(input( ))

if asdf % 2 == 0:
  k1 = asdf / 2
  Ans = k1 * k1
else:
  k2 = (asdf + 1) / 2
  k3 = k2 - 1
  Ans = K1 * k2
print(Ans)
  

### FIXED CODE ###

asdf = int(input())
if asdf % 2 == 0:
  k1 = asdf / 2
  Ans = k1 * k1
else:
  k2 = (asdf + 1) / 2
  k3 = k2 - 1
  Ans = k2 * k3
print(int(Ans))
n = input()
r = [0 for row in range(100)]
c = [0 for row in range(100)]
m = [[0 for col in range(n)] for row in range(n)]
for i in range(n-1):
  p[i], p[i+1] = map(int, raw_input().split())

for l in range(2, n):
  for i in range(n-1):
    j = i + l - 1
    m[i][j] = 100000000000
    for k in range(j-1):
      if m[i][j]>m[i][k]+m[i][k]+m[k+1][j]+p[i-1]*p[k]*[j]:
        m[i][j] = m[i][k]+m[i][k]+m[k+1][j]+p[i-1]*p[k]*[j]

print m[1][n]

### FIXED CODE ###

n = input()
p = [0 for row in range(101)]
m = [[0 for col in range(n+1)] for row in range(n+1)]
for i in range(1, n+1):
  p[i-1], p[i] = map(int, raw_input().split())

for l in range(2, n+1):
  for i in range(1, n-l+2):
    j = i + l - 1
    m[i][j] = 10000000000000000
    for k in range(i, j):
      if m[i][j]>m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]:
        m[i][j] = m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]

print m[1][n]
a,b=map(int,input().split())
if a+b<=16 and a<=8 and B<8:
    print("Yay!")
else:
    print(":(")

### FIXED CODE ###

a,b=map(int,input().split())
if a+b<=16 and a<=8 and b<=8:
    print("Yay!")
else:
    print(":(")
n = int(input())
A = [int(x) for x in input().split()]
print('YES' if len(A) = len(set(A)) else 'NO')

### FIXED CODE ###

n = int(input())
A = [int(x) for x in input().split()]
print('YES' if len(A) == len(set(A)) else 'NO')
n, k = map(int,input(),split())
s = input()
print(s[k].lower())

### FIXED CODE ###

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

if n%3==0:
    for j in range(3):
        for i in range(j*(n//3),(j+1)*(n//3)-1):
            if a[i]!=a[i+1]:
                print("No")
                exit()
    if x[0]^x[n//3]==x[2*n//3]:
        print("Yes")
    else:
        print("No")
    exit()
for i in range(0,n-1):
    if a[i]!=a[i+1]:
        print("No")
        exit()
print("Yes")

### FIXED CODE ###

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

if n%3==0:
    for j in range(3):
        for i in range(j*(n//3),(j+1)*(n//3)-1):
            if a[i]!=a[i+1]:
                print("No")
                exit()
    if a[0]^a[n//3]==a[2*n//3]:
        print("Yes")
    else:
        print("No")
    exit()
for i in range(0,n-1):
    if a[i]!=a[i+1]:
        print("No")
        exit()
print("Yes")
a = input()
b = input()
a = list(a)
b = list(b)

if (a.sort(reverse=True) < b.sort()):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a = list(input())
b = list(input())
a.sort()
b.sort()
b.reverse()
a=''.join(a)
b=''.join(b)
if a < b:
    print("Yes")
else:
    print("No")
import math
a=int,input()
print(math.ceil(a/2))

### FIXED CODE ###

import math
N=int(input())
a=N/2
print(math.ceil(a))
n, m = map(int, input().split())

breakstep = []

for _ in range(m):
    breakstep.append(int(input()))

sl = [-1 for _ in range(n+1)]
def solve(i):
    if sl[i] == -1:
        if i in breakstep:
            sl[i] = 0
        elif i in [0, 1]:
            sl[i] = 1
        else:
            sl[i] = (solve(i-1) + solve(i-2)) % 1000000007
    return sl[i]

print(solve(n))

### FIXED CODE ###

import math
from collections import deque

memo = deque([1, 2])
floor = 1
def search(x):
    global memo, floor
    while x > floor:
        memo.append(memo[-1] + memo[-2])
        floor += 1
    return memo[x-1]

CONST = 1000000007
n,m = map(int,input().split())
lis = []
prev = -1
for _ in range(m):
    a = int(input())
    if prev + 1 == a:
        print(0)
        exit()
    lis.append(a-prev-2)
    prev = a
lis.append(n-prev-1)


ans = 1
for v in lis:
    if v == 0: continue
    ans = (ans * search(v)) % CONST
print(ans)
n = int(input())
b = list(map(int, input().split()))
ans = [0]*n
for i in range(n):
  ans[i] = max(ans[i], b[i])
  if i >= 1:
    ans[i] = max(ans[i], b[i-1])
print(sum(ans))

### FIXED CODE ###

n = int(input())
b = list(map(int, input().split()))
ans = [0]*n
ans[0] = b[0]
for i in range(1, n-1):
  ans[i] = min(b[i-1], b[i])
ans[n-1] = b[n-2]
print(sum(ans))
s=input()
if (int(s[0])*int(s[-1]))%2 == 1:
  print("Odd")
 else:
  print("Even")

### FIXED CODE ###

s=input().split()
if (int(s[0])*int(s[-1]))%2 == 1:
  print("Odd")
else:
  print("Even")
n = int(input())
a = int(input())
b = int(input())
if n == 1:
    print('Hello World')
else:
    print(a+b)


### FIXED CODE ###

n = int(input())
if n == 1:
    print('Hello World')
else:
    a = int(input())
    b = int(input())
    print(a+b)
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')
x=input().split()
a=int(x[0])
b=int(x[1])
result=float(a/b)
result=round(result,10)
print(result)
x=input().slice()
a=int(x[0])
b=int(x[1])
result=float(a/b)
result=round(result,10)
print(result)


### FIXED CODE ###

x=input().split()
a=int(x[0])
b=int(x[1])
result=float(a/b)
result=round(result,10)
print(result)
N,K=int(input().split())
if K>=K*2-1:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

N,K=map(int,input().split())
if N>=K*2-1:
    print("YES")
else:
    print("NO")
import numpy as np
n = int(input())
A = list(map(int,input().split()))
X = [0]
C = [0] + np.cumsum(A).tolist()
for i in range(n):
    X.append(X[i-1] ^ A[i])
cnt = 0
for l in range(n):
    for r in range(l+1, n):
        if C[r]-C[l] == X[r]^X[l]:
            cnt += 1
print(cnt+n)

### FIXED CODE ###

a,b = map(int,input().split())
x = a+b
y = a-b
z = a*b
print(max(x,y,z))
inn = input()
numS = 0
for c in inn:
    if c == 'R':
        numS += 1
if numR != 2:
    print(numR)
else:
    print(1 if inn[1] == 'S' else 2)

### FIXED CODE ###

inn = input()
numR = 0
for c in inn:
    if c == 'R':
        numR += 1
if numR != 2:
    print(numR)
else:
    print(1 if inn[1] == 'S' else 2)
H,W = map(int,input().split())
h,w = map(int,input().split())

print((H*W + h*w) - (H*w + Wh))

### FIXED CODE ###

H,W = map(int,input().split())
h,w = map(int,input().split())

print((H*W + h*w) - (H*w + W*h))
import heapq
class edge:
    def __init__(self,to,cost):
        self.to=to
        self.cost=cost

N=int(input())
G=[list() for i in range(N)]
P=[False for i in range(N)]
A=[-100 for i in range(N)]
for i in range(N-1):
    a,b,c=map(int,input().split())
    G[a-1].append(edge(b-1,c))
    G[b-1].append(edge(a-1,c)) #無向グラフならこれも


def solve(G,K,P):
    P[K]=True
    for i in G[K]:
        if(P[i.to]):
            continue
        A[i.to]=A[K]+i.cost
        solve(G,i.to,P)

Q,K=map(int,input().split())
A[K-1]=0
solve(G,K-1,P)


for i in range(Q):
    x,y=map(int,input().split())
    print(A[x-1]+A[y-1])



### FIXED CODE ###

from collections import deque
class edge:
    def __init__(self,to,cost):
        self.to=to
        self.cost=cost

N=int(input())
G=[list() for i in range(N)]
P=[False for i in range(N)]
A=[-100 for i in range(N)]
for i in range(N-1):
    a,b,c=map(int,input().split())
    G[a-1].append(edge(b-1,c))
    G[b-1].append(edge(a-1,c)) #無向グラフならこれも



def solve(G,K,P):
    q=deque()
    q.append(K)
    while q:
        s=q.pop()
        for i in G[s]:
            if(P[i.to]):
                continue
            P[i.to]=True
            A[i.to]=A[s]+i.cost
            q.append(i.to)

Q,K=map(int,input().split())
A[K-1]=0
P[K-1]=True
solve(G,K-1,P)


for i in range(Q):
    x,y=map(int,input().split())
    
    print(A[x-1]+A[y-1])
def main():
    import heapq
    inf = 10**16
    n, m, s = map(int, input().split())
    uvab = [list(map(int, input().split())) for _ in [0]*m]
    cd = [list(map(int, input().split())) for _ in [0]*n]
    g = [[] for _ in [0]*n]
    [g[a-1].append([b-1, c, d]) for a, b, c, d in uvab]
    [g[b-1].append([a-1, c, d]) for a, b, c, d in uvab]
    vertex = [[inf]*2501 for _ in [0]*n]
    h = [(0, 0, min(s, 2500))]  # 時刻、位置、所持金
    heapq.heapify(h)
    while h:
        t, p, money = heapq.heappop(h)
        if vertex[p][money] != inf:
            continue
        vertex[p][money] = t
        newmoney = min(money+cd[p][0], 2500)
        if vertex[p][newmoney] == inf:
            heapq.heappush(h, (t+cd[p][1], p, newmoney))
        for a, b, c in g[p]:  # 行き先、運賃、時間
            if money < b:
                continue
            if vertex[a][money-b] != inf:
                continue
            heapq.heappush(h, (t+c, a, money-b))
    for i in vertex[1:]:
        print(min(i))


main()


### FIXED CODE ###

def main():
    s = input()
    d = [0]*2019
    d[0] += 1
    now = 0
    for j, i in enumerate(s[::-1]):
        now = (int(i)*pow(10, j, 2019)+now) % 2019
        d[now] += 1
    print(sum([i*(i-1)//2 for i in d]))


main()
# -*- coding: utf-8 -*-
# 整数の入力
n = int(raw_input())
li = list(map(int, input().split()))

for i in range(N):
    sl.append("".join(sorted(li[i])))

sl.sort()

c = collections.Counter(sl)

print(N - (len(c)-1))

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(raw_input())
cnt = 0
dic = {}

for _ in xrange(N):
	rs = ''.join(sorted(raw_input()))
	
	if rs in dic:
		cnt += dic[rs]
		dic[rs] += 1
	else:
		dic[rs] = 1
print cnt
N, M = (int(i) for i in input().split())
DP = [False]*N
for i in range(M):
  a, b = (int(k) for k in input().split())
  for j in (a, b):
    DP[j-1] = not DP[j-1]
for i in range(N):
  if DP[i]:
    print(NO)
    break
else:
  print(YES)

### FIXED CODE ###

N, M = (int(i) for i in input().split())
DP = [False]*N
for i in range(M):
  a, b = (int(k) for k in input().split())
  for j in (a, b):
    DP[j-1] = not DP[j-1]
for i in range(N):
  if DP[i]:
    print('NO')
    break
else:
  print('YES')
from fractions import gcd
    n = int(input())
    a = list(map(int,input().split()))
    l = [0]
    r = [0]
    ans = 0
    for i in range(n-1):
        l.append(gcd(l[i],a[i]))
    for i in range(n-1):
        r.append(gcd(r[i],a[n-1-i]))
    for i in range(n):
        ans = max(ans,gcd(l[i],r[-i-1]))
    print(ans)

### FIXED CODE ###

from fractions import gcd
n = int(input())
a = list(map(int,input().split()))
l = [0]
r = [0]
ans = 0
for i in range(n-1):
    l.append(gcd(l[i],a[i]))
for i in range(n-1):
    r.append(gcd(r[i],a[n-1-i]))
for i in range(n):
    ans = max(ans,gcd(l[i],r[-i-1]))
print(ans)
n, k = map(int, input().split())

mod = 10 ** 9 + 7
inv = pow(2, mod - 2, mod=mod)

def calc(b, e, c):
    global mod
    global inv
    res = (e + b) % mod
    res = ((res * c) % mod ) * inv
    return res % mod

ans = 0
for i in range(k, n + 2):
    min_val = calc(0, i - 1, i)
    max_val = calc(n - i + 1, n, i)
    ans += (max_val - min_val + 1) % mod
    ans %= mod

print(ans)

### FIXED CODE ###

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

mod = 10 ** 9 + 7
inv = pow(2, mod - 2, mod=mod)

def calc(b, e, c):
    global mod
    global inv
    res = (e + b) % mod
    res = ((res * c) % mod ) * inv
    return res % mod

ans = 0
for i in range(k, n + 2):
    min_val = calc(0, i - 1, i)
    max_val = calc(n - i + 1, n, i)
    ans += (max_val - min_val + 1) % mod
    ans %= mod

print(ans)
N=int(input())
LST=[]
for i in range(N):
    a=input()
    lst=[]
    for j in range(len(a)):
        lst.append(a[j])
    lst=sorted(lst)
    if lst in LST:
        count+=1
        break
    else:
        LST.append(lst)
        

print(count)


### FIXED CODE ###

N=int(input())

count=0
dic=dict()

for i in range(N):
    s="".join(sorted(input()))
#    print(s)

    if s in dic:
        count+=dic[s]
#        print(dic[s])
        dic[s]+=1
    else:
        dic[s]=1
#        print(dic)

print(count)
import sys

args = sys.argv

n = args[1]
m = args[2]

if n == m:
    print("yes")
else:
    print("no")

### FIXED CODE ###

n,m = input().split()
 
if n == m:
  print("Yes")
else:
  print("No")
print(sum(int(input())))

### FIXED CODE ###

print(sum([int(i) for i in input()]))
import math
k = int(input())
ans = 0
for i in range(1, k + 1):
    for j in range(1, j + 1):
        gcd1 = math.gcd(i, j)
        for l in range(1, l + 1):
            gcd2 = math.gcd(gcd1, l)
            ans += gcd2
print(ans)

### FIXED CODE ###

import math
k = int(input())
ans = 0
for i in range(1, k + 1):
    for j in range(1, k + 1):
        gcd1 = math.gcd(i, j)
        for l in range(1, k + 1):
            gcd2 = math.gcd(gcd1, l)
            ans += gcd2
print(ans)
import numpy as np
N, train_max = map(int, input().split())
members = np.sort(list(map(int, input().split())))
members_sum = members.sum()
foods = np.sort(list(map(int, input().split())))[::-1]

inferenced_time_max = int(1e+6 * 1e+6)
inferenced_time_min = -1

while inferenced_time_max > inferenced_time_min + 1:
  inferenced_time = (inferenced_time_max + inferenced_time_min) // 2
  inferenced_members = np.minimum(members, inferenced_time // foods)
  if members_sum - inferenced_members.sum() <= train_max:
    inferenced_time_max = inferenced_time
  else:
    inferenced_time_min = inferenced_time

print(inferenced_time_max)


### FIXED CODE ###

a,b = map(int, input().split())
if a > 9 or b > 9:
  print(-1)
else:
  print(a * b)
def ispossible(list1):
  if list1.count("5") == 2 and list1.count("7") == 1:
    return "YES"
  else:
    return "NO"

list1 = input().split()
print(isposible(list1))


### FIXED CODE ###

def ispossible(list1):
  if list1.count("5") == 2 and list1.count("7") == 1:
    return "YES"
  else:
    return "NO"

list1 = input().split()
print(ispossible(list1))
1500 2000 1600 3 2

### FIXED CODE ###

A,B,C,X,Y = map(int,input().split())

if (A + B) <= 2 * C:
  print( A*X + B*Y)
else:
  if X >= Y:
    if A < 2 * C:
      print(A*(X-Y)+2*C*Y)
    else:
      print(2*C*X)
  else:
    if B < 2 * C:
      print(B*(Y-X)+2*C*X)
    else:
      print(2*C*Y)
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = a; i < b; i ++)
#define FORN(i, a, b) for(int i = a; i <= b; i ++)
#define FORD(i, a, b) for(int i = a-1; i >= b; i --)
#define FORE(i, b) for(auto &i:b)
#define REP(i, b) FOR(i, 0, b)
#define REPN(i, b) FORN(i, 0, b)
#define SQ(i) (i*i)
#define ALL(a) a.begin(), a.end()
#define ALLA(a,n) a, a+n
#define SORT(a) sort(ALL(a))
#define SORTA(a, n) sort(ALLA(a, n))
#define REV(a) reverse(ALL(a))
#define REVA(a, n) reverse(ALLA(a, n))
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define IN(a, b) (a.find(b) != a.end())
#define BACK(a) a.back(); a.RB()
#define QBACK(a) a.top(); a.pop()
#define PRINT(a) FORE(i, a) cout << i << " "; cout << endl

#define PB  push_back
#define RB  pop_back
#define RF  pop_front
#define INS insert
#define F   first
#define S   second
#define UM  unordered_map
#define US  unordered_set
#define PQ  priority_queue

#define IO ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<ll,ll> pll;
typedef queue<int> qi;
typedef queue<double> qd;
typedef queue<ll> qll;
typedef US<int> si;
typedef US<double> sd;
typedef US<ll> sll;
typedef vector<vi> mi;
typedef vector<vd> md;
typedef vector<vll> mll;
typedef vector<pi> vpi;
typedef vector<pd> vpd;
typedef vector<pll> vpll;

int main(){
  IO; ll t; sll V;
  REP(i,3){cin >> t; V.INS(t);}
  cout << (V.size() == 2 ? "Yes":"No");
}


### FIXED CODE ###

v = set(map(int, input().strip().split()))
print("Yes" if len(v) == 2 else "No")
x=int(input())
items = [100,101,102,103,104,105]
list = [1]
if x == 100 or x == 101 or x == 102 or x == 103 or x == 104 or x == 105:
    print(1)
elif x <100:
    print(0)
else:
    for i in range(99):
        list.append(0)
    for i in range(6):
        list.append(1)
    for i in range(95):
        list.append(0)
    for i in range(200,x+1):
        for item in items:
            if list[i-item] == 1:
                list.append(1)
                break
        else:
            list.append(0)

    print(list[x])
print(list[105])


### FIXED CODE ###

x=int(input())
items = [100,101,102,103,104,105]
list = [1]
if x == 100 or x == 101 or x == 102 or x == 103 or x == 104 or x == 105:
    print(1)
elif x <100:
    print(0)
else:
    for i in range(99):
        list.append(0)
    for i in range(6):
        list.append(1)
    for i in range(94):
        list.append(0)
    for i in range(200,x+1):
        for item in items:
            if list[i-item] == 1:
                list.append(1)
                break
        else:
            list.append(0)

    print(list[x])
N = int(input())
A = list(map(int, input().split()))

L = [0 for _ in range(10 ** 5 + 2)]

for a in A:
    L[a] += 1

ans = 0
for i in range(1,100001):
    ans = max(ans,L[i-1]+L[i]+L[i+1])

print(ans)

### FIXED CODE ###

x, t = map(int, input().split())
print(x-t if x-t>0 else 0)
N = int(input())
heights = map(int, input().split(" "))
diffs = [b - a for a, b in zip(heights[:-1], heights[1:])]

max = 0
count = 0
for d in diffs:
  if d >= 0:
    count += 1
  else:
    if max < count:
      max = count
    count = 0
    
  

### FIXED CODE ###

N = int(input())
heights = list(map(int, input().split(" ")))
diffs = [a - b for a, b in zip(heights[:-1], heights[1:])]

max = 0
count = 0
for d in diffs:
  if d >= 0:
    count += 1
  else:
    if max < count:
      max = count
    count = 0
if max < count:
  max = count
print(max)
R=int(input())
if R <1200
 print("ABC")
if R<2800
 print("ARC")
else
 print("AGC")

### FIXED CODE ###

R=int(input())
if R <1200:
 print("ABC")
elif R<2800:
 print("ARC")
else:
 print("AGC")
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
r.sort(reverse=True)
pcount=0
qcount=0
rcount=0
ans=[]
for i in range(x):
  ans.append(p[-1-i])
for i in range(y):
  ans.append(q[-1-i])
ans.sort()
for i in range(c):
  if ans[i]<=r[rcount]:
    ans[i]=r[rcount]
    rcount+=1
print(sum(ans))

### FIXED CODE ###

x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
r.sort(reverse=True)
rcount=0
ans=[]
for i in range(x):
  ans.append(p[-1-i])
for i in range(y):
  ans.append(q[-1-i])
ans.sort()
for i in range(min(len(ans),c)):
  if ans[i]<=r[rcount]:
    ans[i]=r[rcount]
    rcount+=1
print(sum(ans))
import sys
sys.setrecursionlimit(10 ** 9)
n = int(input())
adjacent_list = [[] for i in range(n+1)]
data = []
edgedata = {}
for i in range(n-1):
    a, b = list(map(int, input().split()))
    data.append([a,b])
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)
max_node = 0
finished = set()
for i in range(1,n):
    if len(adjacent_list[i]) > max_node:
        max_node = i
k = len(adjacent_list[max_node])
def dfs(node, num):
    node_list = sorted(adjacent_list[node], key = lambda x:len(adjacent_list[x]))
    color_list = [i for i in range(1,k+1) if i != num]
    c_i = 0
    finished.add(node)
    for i in node_list:
        if i not in finished:
            s = min(node, i)
            t = max(node, i)
            vv = str(s)+str(t)
            edgedata[vv] = color_list[c_i]
            dfs(i, color_list[c_i])
            c_i += 1
dfs(k,-1)
print(k)
for i in data:
    sss = (str(i[0]) + str(i[1]))
    print(edgedata[sss])
#output k

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)
n = int(input())
#隣接リスト
adjacent_list = [[] for i in range(n+1)]
#入力されたデータを保存しておくやつ
data = [None] * (n - 1)
#最終的に色を入れておくやつ。
#edgedata[(1,2)] => 1->2の辺の色を入れておく
edgedata = {}
for i in range(n-1):
    a, b = list(map(int, input().split()))
    data[i] = [a, b]
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)
#つながってるノードが一番多いやつを保存しておく
max_node = 0
#探索が終わったやつを入れる
finished = set()
for i in range(1,n):
    if len(adjacent_list[i]) > len(adjacent_list[max_node]):
        max_node = i
#kには色の種類を入れる
k = len(adjacent_list[max_node])
#print("k => {}".format(k))
def dfs(node, num):
    #隣接リストの中身を、つながってるノード順にソート
    node_list = sorted(adjacent_list[node], key = lambda x:len(adjacent_list[x]))
    #さっきつかったいろは使わないようにする
    color_list = [i for i in range(1,len(node_list) + 2) if i != num]
    c_i = 0
    finished.add(node)
    for i in node_list:
        #まだ見てなかったら、dfsを掛ける
        if i not in finished:
            #小さいほうから大きいほうに文字を並べ、ハッシュに値を保存
            #print("{}".format(color_list))
            #print("c_i =>{}  node =>{}".format(c_i,node))
            edgedata[(min(node, i), max(node, i))] = color_list[c_i]
            #color_list[c_i]は使ったので、使った色として引数で渡す。
            dfs(i, color_list[c_i])
            #この色は使ったから、一個ずらす
            c_i += 1
#一番のノードを根とし、dfsをかける
dfs(k,-1)
print(k)
for i in data:
    print(edgedata[tuple(i)])
#output k
import sympy
N = int(input())
ans = 0
for k in range(1, N+1):
    ans += k*len(sympy.divisors(k))
print(ans)

### FIXED CODE ###

a = int(input())
print(int(a+a**2+a**3))
n = int(input())
x = list(input())
c1 = x.count("1")+1
c2 = c1-2

now1 = 0
now2 = 0

for i in range(n):
    if x[-1-i] == "1":
        now1 += pow(2,i,c1)
        now2 += pow(2,i,c2)
        
    now1 %= c1
    now2 %= c2

for i in range(n):
    if x[i] == "1":
        #print(n-1-i)
        now = (now2-pow(2,n-1-i,c2))%c2
        #print(i,now,c2)
        count = 1
        while now > 0:
            q = bin(now)
            y = q.count("1")
            now %= y
            count += 1
        print(count)
    else:
        #print(n-1-i)
        now = (now1+pow(2,n-1-i,c1))%c1
        #print(i,now,c1)
        count = 1
        while now > 0:
            q = bin(now)
            y = q.count("1")
            now %= y
            count += 1
        print(count)


### FIXED CODE ###

n = int(input())
x = list(input())
c1 = x.count("1")+1
c2 = c1-2

now1 = 0
now2 = 0

for i in range(n):
    if x[-1-i] == "1":
        now1 += pow(2,i,c1)
        if c2 != 0:
            now2 += pow(2,i,c2)
        
    now1 %= c1
    if c2 != 0:
        now2 %= c2

for i in range(n):
    if x[i] == "1":
        #print(n-1-i)
        if c2 == 0:
            print(0)
            continue
        now = (now2-pow(2,n-1-i,c2))%c2
        #print(i,now,c2)
        count = 1
        while now > 0:
            q = bin(now)
            y = q.count("1")
            now %= y
            count += 1
        print(count)
    else:
        #print(n-1-i)
        now = (now1+pow(2,n-1-i,c1))%c1
        #print(i,now,c1)
        count = 1
        while now > 0:
            q = bin(now)
            y = q.count("1")
            now %= y
            count += 1
        print(count)