Harryxun/stf_run huggingface dataset:
import numpy as np

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

tmp = 0
ans = 2019

i = L
j = R
tmp = (i * j) % 2019
if tmp < ans:
	ans = tmp

i =  L + 2019 - L % 2019
j = i+1
tmp = (i * j) % 2019
	if tmp < ans:
		ans = tmp

i = L
j = i+1
tmp = (i * j) % 2019
if tmp < ans:
	ans = tmp

j = R
i = j-1
tmp = (i * j) % 2019
if tmp < ans:
	ans = tmp

i = L
j = R
tmp = (i * j) % 2019
if tmp < ans:
	ans = tmp

print(ans)


### FIXED CODE ###

l,r = map(int,input().split())
ans = 2019
mod = 2019
 
for i in range(l,r):
  for j in range(i+1,r+1):
    ans = min(ans,(i*j)%mod)
    if ans == 0:
      print(0)
      exit()
print(ans)
LEN = int(input())
mem = []
for i in range(0,LEN):
    mem.append(int(input()))
    LEN-=1
    if LEN == 0:
        break
print(min(mem),max(mem),sum(mem))



### FIXED CODE ###

LEN = int(input())
mem = input().split(" ")
for i in range(0, LEN):
    mem[i] = int(mem[i])
print(min(mem),max(mem),sum(mem))
n = int(input())
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
c = list(map(int, input().split(" ")))

b_sum = sum(b)

c_sum = 0
for i in range(n-1):
    if a[i] != n and a[i] + 1 == a[i+1]:
        c_sum += c[ai-1]

print(b_sum + c_sum)

### FIXED CODE ###

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

b_sum = sum(b)

c_sum = 0
for i in range(n-1):
    if a[i] != n:
        if a[i] + 1 == a[i+1]:
            c_sum += c[a[i]-1]

print(b_sum + c_sum)
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np
 
DIV_NUM = 1000000000 + 7
 
INPUT_NUMS = list(map(int, input().split()))
N=int(INPUT_NUMS[0])
K=int(INPUT_NUMS[1])
 
A = [int(x) for x in input().split()]
AA = np.array(A)
if N==1:
    print(0)
    exit()
 
tree = np.array([0] * (N+1) )
 
# https://atcoder.jp/contests/chokudai_S001/submissions/6789704
def BIT_update(x):
    while x <= N:
        tree[x] += 1
        y = int(x)
        x += y&(-y)
def BIT_sum(x):
    s = 0
    while x:
        s += tree[x]
        y = int(x)
        x -= y&(-y)
    return s
 
answer = N*(N-1)//2
for x in AA:
    answer -= BIT_sum(int(x))
    BIT_update(int(x))
 
B = sorted(A)
 
q=0
p=B[0]
r=0
for i in range(1,N):
    if B[i]>p:
        p=B[i]
        r=i
    q += r
 
# print(answer,K)
answer = answer % DIV_NUM
answer = int(answer)
answer = (answer * K) % DIV_NUM
q = q % DIV_NUM
answer = answer + q * K * (K-1) // 2
answer = answer % DIV_NUM
print(answer)
 

### FIXED CODE ###

# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

DIV_NUM = 1000000000 + 7

INPUT_NUMS = list(map(int, input().split()))
N=int(INPUT_NUMS[0])
K=int(INPUT_NUMS[1])

A = [int(x) for x in input().split()]
AA = np.array(A)
if N==1:
    print(0)
    exit()

# https://kira000.hatenadiary.jp/entry/2019/02/23/053917
def bubble_sort(A):
    cnt = 0
    for i in range(len(A)):
        for j in range(len(A)-1, i, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                cnt += 1
    return cnt

answer = bubble_sort(AA)

B = sorted(A)
q=0
p=B[0]
r=0
for i in range(1,N):
    if B[i]>p:
        p=B[i]
        r=i
    q += r

# print(answer,K)
answer = answer % DIV_NUM
answer = int(answer)
answer = (answer * K) % DIV_NUM
q = q % DIV_NUM
answer = answer + q * K * (K-1) // 2
answer = answer % DIV_NUM
print(answer)
s = input()
if s[:4] < 2019 or s[:4] == 2019 and s[5] == 0 and s[6] <= 4:
  print("Heisei")
else:
  print("TBD")

### FIXED CODE ###

s = input()
 
if s <= '2019/04/30':
    print('Heisei')
else:
    print('TBD')
a=input()
if a=("Sunny"):
  print("Cloudy")
elif a=("Cloudy"):
  print("Rainy")
else:
  print("Sunny")

### FIXED CODE ###

a=input()
if a=="Sunny":
  print("Cloudy")
elif a=="Cloudy":
  print("Rainy")
else:
  print("Sunny")
import sys

def f(x):
    p=0
    cnt=0
    for i in range(n-1,-1,-1):
        while p<n and a[i]+a[p]<x:
            p+=1
        cnt+=n-p
    return cnt

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

l,r=a[0]*2,a[n-1]*2

while r-l>0:
    if r-l<=1:
        if f(r)==m: md=r;break 
        else: md=l;break
    md=(r+l)//2
    k=f(md)
    if k==m: break
    elif k>m: l=md
    else: r=md


p=0
cnt=0
ans=0

for q in range(n-1,-1,-1):
    try:
        while p<n:
            if a[q]+a[p]<=md: p+=1
            else: break
    except:
        p=n

    cnt+=n-p
    ans+=a[q]*(n-p)*2
    if p==n: break


ans+=(m-cnt)*md
print(ans)

### FIXED CODE ###

import sys

def f(x):
    p=0
    cnt=0
    for i in range(n-1,-1,-1):
        while p<n and a[i]+a[p]<x:
            p+=1
        cnt+=n-p
    return cnt

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

l,r=a[0]*2,a[n-1]*2
md=(r+l)//2
while r-l>0:
    if r-l<=1:
        if f(r)==m: md=r;break 
        else: md=l;break
    md=(r+l)//2
    k=f(md)
    if k==m: break
    elif k>m: l=md
    else: r=md

p=0
cnt=0
ans=0

for q in range(n-1,-1,-1):
    try:
        while p<n and a[q]+a[p]<=md:
            p+=1
    except:
        b=1
        while True:
            b+=1

    if p==n: break
    cnt+=n-p
    ans+=a[q]*(n-p)*2


ans+=(m-cnt)*md
print(ans)
S = input()
T = input()
LS = len(S); LT = len(T)

memo = [[-1]*LT for i in range(LS)]
nxt = [[(0, None, None)]*(LT+1) for i in range(LS+1)]
def dfs(i, j):
    if i == LS or j == LT:
        return 0
    if memo[i][j] != -1:
        return memo[i][j]
    r0 = dfs(i+1, j); r1 = dfs(i, j+1)
    r = max(r0, r1)
    x = (0, i, j+1) if r0 < r1 else (0, i+1, j)
    if S[i] == T[j]:
        r2 = dfs(i+1, j+1) + 1
        if r < r2:
            r = r2
            x = (1, i+1, j+1)
    memo[i][j] = r
    nxt[i][j] = x
    return r

dfs(0, 0)
i = j = 0
ans = []
while i is not None:
    m, i0, j = nxt[i][j]
    if m:
        ans.append(S[i])
    i = i0
print(*ans, sep='')

### FIXED CODE ###

*S, = map(ord, input())
*T, = map(ord, input())
LS = len(S); LT = len(T)

dp = [[-1]*(LT+1) for i in range(LS+1)]
for i in range(LS-1, -1, -1):
    for j in range(LT-1, -1, -1):
        if S[i] == T[j]:
            dp[i][j] = max(dp[i+1][j+1] + 1, dp[i+1][j], dp[i][j+1])
        else:
            dp[i][j] = max(dp[i+1][j], dp[i][j+1])
i = j = 0
ans = []
while i < LS and j < LT:
    if S[i] == T[j]:
        if dp[i][j] == dp[i+1][j+1] + 1:
            ans.append(S[i])
            i += 1; j += 1
        elif dp[i][j] == dp[i+1][j]:
            i += 1
        else:
            j += 1
    else:
        if dp[i][j] == dp[i+1][j]:
            i += 1
        else:
            j += 1
print(*map(chr, ans), sep='')
x = input()
y = input()
z = input()
temp = y
y = x
x = z
z = temp
print(x,y,z)

### FIXED CODE ###

x,y,z = map(int, input().split())
temp = y
y = x
x = z
z = temp
print(x,y,z)
A,B,C=map(int,input().split())

if B+C <= A:
print(0)

else B+C > A:
print(C-A+B)

### FIXED CODE ###

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

answer = C-A+B

if answer >= 0:
	print(answer)

else :
	print(0)
from sys import stdin
def input():
    return stdin.readline().strip()

n, weight = map(int, input().split())
w, v = [0]*n, [0]*n
for i in range(n):
    w[i], v[i] = map(int, input().split())

base = w[0]
#q, r = divmod(weight, base)

for i in range(n):
    w[i] -= base

# dp[i][j] = i個選んで重さの余りがjの時の、価値の最大値
dp = [[0] * (3*n) for _ in range(n+1)]

for i in range(n):
    for j in range(i, -1, -1):
        for k in range(3*j+1):
            if dp[j+1][k+w[i]] < dp[j][k] + v[i]:
                dp[j+1][k+w[i]] = dp[j][k] + v[i]

ans = 0
for i in range(n+1):
    for j in range(3*n):
        if base * i + j <= weight and ans < dp[i][j]:
            ans = dp[i][j]

print(ans)

### FIXED CODE ###

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

n, weight = map(int, input().split())
w, v = [0]*n, [0]*n
for i in range(n):
    w[i], v[i] = map(int, input().split())

base = w[0]

for i in range(n):
    w[i] -= base

# dp[i][j] = i個選んで重さの余りがjの時の、価値の最大値
dp = [[0] * (3*n+1) for _ in range(n+1)]

for i in range(n):
    for j in range(i, -1, -1):
        for k in range(3*j+1):
            if dp[j+1][k+w[i]] < dp[j][k] + v[i]:
                dp[j+1][k+w[i]] = dp[j][k] + v[i]

ans = 0
for i in range(n+1):
    for j in range(3*n+1):
        if base * i + j <= weight and ans < dp[i][j]:
            ans = dp[i][j]

print(ans)
n = int(input())
s = input()
flag = 1

if n % 2:
    for i in range(n):
        if s[i] != s[n//2 + i]:
            flag = 0
    if flag:
        print('Yes')
    else:
        print('No')
else:
        print('No')

### FIXED CODE ###

n = int(input())
s = input()
flag = 1

if n % 2:
    print('No')
else:
    for i in range(n//2):
        if s[i] != s[n//2 + i]:
            flag = 0
    if flag:
        print('Yes')
    else:
        print('No')
a=int(input())
List=[]
for i in range (1,1000000):
    x=str(i)
    b=True
    for j in range(len(x)-1):
        if abs(int(x[j])-int(x[j+1]))<=1:
            continue
        else:
            b=False
            break
    if b:
        List+=[i]
print(List[a-1])

### FIXED CODE ###

import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a=ii()
q=deque(list(range(1,10)))
c=0
while c<a:
  t=q.popleft()
  c+=1
  if t%10!=0:
    q.append(10*t+(t%10)-1)
  q.append(10*t+(t%10))
  if t%10!=9:
    q.append(10*t+(t%10)+1)
print(t)
s=input()
t=input()

for i in range(len(s)-len(t)):
    ans=10**9+7
    miss=0
    tmp=s[i:i+len(t)]
    for j in range(len(t)):
        if tmp[j]!=t[j]:
            miss+=1
    ans=min(ans, miss)

print(ans)


### FIXED CODE ###

s=input()
t=input()

ans=10**9+7
for i in range(len(s)-len(t)+1):
    miss=0
    tmp=s[i:i+len(t)]
    for j in range(len(t)):
        if tmp[j]!=t[j]:
            miss+=1
    ans=min(ans, miss)

print(ans)
n, k = map(int, input().split())
s = input()

if s[k-1] == 'A':
    s[k-1] = 'a'
elif s[k-1] == 'B':
    s[k-1] = 'b'
else:
    s[k-1] = 'c'

### FIXED CODE ###

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

if s[k-1] == 'A':
    s[k-1] = 'a'
elif s[k-1] == 'B':
    s[k-1] = 'b'
else:
    s[k-1] = 'c'

print(''.join(s))
import numpy as np

temp=input().split()
N=int(temp[0])
M=int(temp[1])

A=np.zeros((M, N))

for i in range(M):
  temp=list(map(int, input().split()))
  for j in range(1, temp[0]+1):
    A[i, temp[j]-1]=1
    
    
p=list(map(int, input().split()))

counter=0
for i in range(pow(2, N)):
  temp=format(i, '0'+str(N)+'b')
  s=[int(temp[j]) for j in range(N)]
  
  a=np.dot(A, s)%2
  
  if all(p==a):
    counter+=1
    
print(counter)

### FIXED CODE ###

import numpy as np

N, M=map(int, input().split())
matrix=np.zeros((M, N))

for i in range(M):
  temp=np.array(list(map(int, input().split())))
  temp-=1
  matrix[i, temp[1:]]=1
  
p=np.array(list(map(int, input().split())))

counter=0
for i in range(pow(2, N)):
  s=np.array(list(map(int, list(format(i, '0'+str(N)+'b')))))
  if all(np.dot(matrix, s)%2==p)==True:
    counter+=1
    
print(counter)
class UnionFind():
	def __init__(self, n):
		self.size = n
		self.root = [-1 for _ in range(n+1)]
		self.rnk = [0 for _ in range(n+1)]

	def findRoot(self, a):
		if self.root[a] < 0:
			return a
		else:
			return self.findRoot(self.root[a])

	def uniteTree(self, a, b):
		a = self.findRoot(a)
		b = self.findRoot(b)

		if a == b:
			return

		elif self.rnk[a] > self.rnk[b]:
			self.root[a] += self.root[b]
			self.root[b] = a

		elif self.rnk[b] > self.rnk[a]:
			self.root[b] += self.root[a]
			self.root[a] = b

		elif self.rnk[a] == self.rnk[b]:
			self.root[b] += self.rnk[a]
			self.root[a] = b
			self.rnk[b] += 1

	def judgeTree(self, a, b):
		return self.findRoot(a) == self.findRoot(b)

	def count(self, a):
		return self.rnk[self.findRoot(a)] * (-1)

N, K, S = map(int, input().split())
P = []
Q = []
R = []
L = []

for _ in range(K):
	p_tmp, q_tmp = map(int, input().split())
	P.append(p_tmp)
	Q.append(q_tmp)

for _ in range(S):
	r_tmp, l_tmp = map(int, input().split())
	R.append(r_tmp)
	L.append(l_tmp)
	
road = UnionFind(N)
train = UnionFind(N)

for i in range(K):
	road.uniteTree(P[i], Q[i])

for i in range(S):
	train.uniteTree(R[i], L[i])

ans = [1 for _ in range(N)]

for i in range(1, N+1):
	for j in range(1, N+1):
		if i == j:
			continue
		else:
			if road.judgeTree(i,j) and train.judgeTree(i,j):
				ans[i-1] += 1

for i in ans:
	print(i, end = " ")

### FIXED CODE ###

import sys
import collections as c
sys.setrecursionlimit(10**6)

import sys
sys.setrecursionlimit(10**7)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)

    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    def Unite(self, x, y):
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        if(x == y):
            return 
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    def Count(self, x):
        return -self.root[self.Find_Root(x)]

N, K, L = map(int,input().split())
p = []
q = []
l = []
r = []

for _ in range(K):
	p_tmp, q_tmp = map(int ,input().split())
	p.append(p_tmp)
	q.append(q_tmp)

for _ in range(L):
	l_tmp, r_tmp = map(int, input().split())
	l.append(l_tmp)
	r.append(r_tmp)

road = UnionFind(N)
train = UnionFind(N)

for i in range(K):
	road.Unite(p[i], q[i])

for i in range(L):
	train.Unite(l[i], r[i])

ar = []

for i in range(1,N+1):
	a = road.Find_Root(i)
	b = train.Find_Root(i)
	ar.append(str([a,b]))

Car = c.Counter(ar)

for i in range(N):
	print(Car[ar[i]], end = " ")
w, h, x, y = map(int, input().split())

flag = '0'
size = 0

if (w==x and h==y) or (x==0 and y==0):
	size = x*y
	flag = '1'
elif w == x and h != y:
	size = min(x*y, x*(h-y))
elif h == y and w != x:
	size = min(x*y, (w-x)*y)
else:
	size1 = x * h
	size2 = (w - x) * h
	size3 = w * x
	size4 = w * (h - y)

	min_size1 = min(size1, size2)
	min_size2 = min(size3, size4)

	if min_size1 == min_size2:
		flag = '1'

	if min_size1 < min_size2:
		size = min_size2
	else:
		size = min_size1


print(min_size1)
print(min_size2)
print(size, flag)

### FIXED CODE ###

w,h,x,y=map(int,input().split())

if x*2==w and y*2==h:
    print(w*h/2, 1)
else:
    print(w*h/2, 0)
N=input()
H=[int(i) for i in input().split()]

#len(H)==1は別でOK
for i in range(len(H)-1):
    if H[i] > H[i+1]+1:
        print("No")
        break
    elif H[i] == H[i+1]+1:
        H[i]-=1
    elif i=0:
        H[i]-=1
    elif H[i-1] < H[i]:
        H[i]-=1
else:
    for i in range(len(H)-1):
        if H[i] > H[i+1]:
            print("No")
            break
    else:
        print("Yes")


### FIXED CODE ###

N=input()
H=[int(i) for i in input().split()]

#len(H)==1は別でOK
for i in range(len(H)-1):
    if H[i] > H[i+1]+1:
        print("No")
        break
    elif H[i] == H[i+1]+1:
        H[i]-=1
    elif i==0:
        H[i]-=1
    elif H[i-1] < H[i]:
        H[i]-=1
else:
    for i in range(len(H)-1):
        if H[i] > H[i+1]:
            print("No")
            break
    else:
        print("Yes")
s = list(input())
cnt,ans = [],0
agct = ["A","G","C","T"]
for i in range(len(s)):
    if s[i] in agct:
        cnt += 1
    else:
         ans.append(cnt)
         cnt = 0
if ans == []:
    ans.append(0)
print(max(ans))

### FIXED CODE ###

s = list(input())
cnt,ans = 0,[]
agct = ["A","G","C","T"]
for i in range(len(s)):
    if s[i] in agct:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
if cnt > 0:
  ans.append(cnt)
print(max(ans))
import collections
N, K, L = map(int, input().split())
city = [{"road":{"Connected":[i],"seen":-1}, "rail":{"Connected":[i],"seen":-1}} for i in range(N)]
def dfs(graph, v, way, num):
    graph[v][way]["seen"] = num
    for next_v in graph[v][way]["Connected"]:
        if graph[next_v][way]["seen"] >= 0:
            continue
        dfs(graph, next_v, way, num)

for i in range(K):
    p, q = map(int, input().split())
    city[p-1]["road"]["Connected"].append(q-1)
    city[q-1]["road"]["Connected"].append(p-1)
for i in range(L):
    r, s = map(int, input().split())
    city[r-1]["rail"]["Connected"].append(s-1)
    city[s-1]["rail"]["Connected"].append(r-1)
for X in ["road", "rail"]:
    count = 0
    for v in range(N):
        if city[v][X]["seen"] >= 0:
            continue
        dfs(city, v, X, count)
        count += 1
List = [(city[i]["road"]["seen"],city[i]["rail"]["seen"]) for i in range(N)]
counter = collections.Counter(List)
for i in range(N):
    print(counter[(city[i]["road"]["seen"],city[i]["rail"]["seen"])],end=" ")
        


### FIXED CODE ###

N, K, L = map(int, input().split())

def fp(x, parentList): #findParent
    if parentList[x] == x:
        return x
    else:
        parentList[x] = fp(parentList[x], parentList)
        return parentList[x]

#各ノードのparentをリストで表現(連結前は自身がparent)
road = [i for i in range(N)]
rail = [i for i in range(N)]

for _ in range(K):
    p, q = map(int, input().split())
    par_p, par_q = fp(p-1, road), fp(q-1, road) #p, qのparent 
    #連結する際、若い番号をparentとする
    if par_p < par_q:
        road[par_q] = par_p
    else:
        road[par_p] = par_q

#railについても同様
for _ in range(L):
    s, t = map(int, input().split())
    par_s, par_t = fp(s-1, rail), fp(t-1, rail)
    if par_s < par_t:
        rail[par_t] = par_s
    else:
        rail[par_s] = par_t

#連結成分の要素をカウント
cnt = {}
for i in range(N):
    key = (fp(i,road),fp(i,rail))
    if key in cnt:
        cnt[key] += 1
    else:
        cnt[key] = 1
#出力
for i in range(N):
    key = (fp(i,road),fp(i,rail))
    ans = cnt[key]
    print(ans, end=" ")
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

a,b,c,d,e,f = inm()
s = [False]*3001
for i in range(3001):
    for j in range(1501):
        k = c*i+d*j
        if k<=f:
            s[k] = True
w = [False]*31
for i in range(31):
    for j in range(16):
        k = a*i+b*j
        if 100*k<=f:
            w[k] = True
mx = 0.0
for t in range(3001):  # sugar gram
    if not s[t]:
        continue
    ww = t/e  # ww = ax+by must be this much
    for z in range(f//100 + 1, 0,-1):  # water/100
        if not w[z] or z*100+t>f:
            continue
        if z<ww:
            break
        r = t/(100*z+t)
        if r>mx:
            mx = r
            mxs = t
            mxsw = t+100*z
print("{} {}".format(mxsw,mxs))


### FIXED CODE ###

from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

a,b,c,d,e,f = inm()
s = [False]*3001
for i in range(3001):
    for j in range(1501):
        k = c*i+d*j
        if k<=f:
            s[k] = True
w = [False]*32
for i in range(31):
    for j in range(16):
        k = a*i+b*j
        if 100*k<=f:
            w[k] = True
mx = 0.0
mxs = 0
mxsw = 100*a
for t in range(f-99):  # sugar gram
    if not s[t]:
        continue
    ww = t/e  # ww = ax+by must be this much
    for z in range(f//100 + 1, 0,-1):  # water/100
        if not w[z] or z*100+t>f:
            continue
        if z<ww:
            break
        r = t/(100*z+t)
        if r>mx:
            mx = r
            mxs = t
            mxsw = t+100*z
print("{} {}".format(mxsw,mxs))
from heapq import heappop,heappush,heapify
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
a = list(map(int, input().split()))
a_minus = [-x for x in a]
heapq.heapify(a_minus)

pop = lambda: -heappop(a_minus)
push = lambda x: heappush(a_minus,-x)

for _ in range(m):
    x = pop()
    push(x//2)

print(-sum(a_minus))


### FIXED CODE ###

from heapq import heappop,heappush,heapify
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
a = list(map(int, input().split()))
a_minus = [-x for x in a]
heapify(a_minus)

pop = lambda: -heappop(a_minus)
push = lambda x: heappush(a_minus,-x)

for _ in range(m):
    x = pop()
    push(x//2)

print(-sum(a_minus))
def dokusyo(A,B,i,j,K,total):
    a = A[i]
    b = B[j]
    if total+min(a,b)>K:
        return 0
    if a<b:
        return 1+dokusyo(A,B,i+1,j,K,total+a)
    elif a>b:
        return 1+dokusyo(A,B,i,j+1,K,total+b)
    else:
        return 1+max(dokusyo(A,B,i+1,j,K,total+a),dokusyo(A,B,i,j+1,K,total+b))
       


if __name__ == "__main__":
    (N,M,K) = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    A.append(10**10)
    B.append(10**10)
    i=0
    j=0
    total = 0
    print(dokusyo(A,B,i,j,K,total))


### FIXED CODE ###

if __name__ == "__main__":
    (N,M,K) = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    a = [0]
    b = [0]
    for i in range(N):
        a.append(a[i]+A[i])
    for i in range(M):
        b.append(b[i]+B[i])

    ans, j = 0, M
    for i in range(N+1):
        if a[i] >K:
            break
        while b[j] > K-a[i]:
            j -= 1
        ans = max(ans, i+j)
    print(ans)
S = dict()
S['a'] = list(input())[::-1]
S['b'] = list(input())[::-1]
S['c'] = list(input())[::-1]
p = 'a'
while S[]:
  p = S[p].pop()  
print(player.upper())

### FIXED CODE ###

Sa=list(input())
Sb=list(input())
Sc=list(input())
S = [Sa, Sb, Sc]
Ans = ["A", "B", "C"]
idx = ['a', 'b', 'c']
p = 'a'

def take_turn(i):
  if len(S[i])==0:
    print(Ans[i])
    exit()
  else:
    p = S[i].pop(0)
    return p
    
while True:
  p = take_turn(idx.index(p))
def popcnt_int(n): # n:int
    return bin(n).count('1')

def popcnt_bin(s): # s:str
    return s.count('1')

def poptimes(n, cnt=1): #:int
    if n==0:
        return cnt
    else:
        n %= popcnt_int(n)
        cnt += 1
        return poptimes(n, cnt)

n = int(input())
s = input()

s_int = int(s,2)
pc = popcnt_bin(s)
pc_plus = s_int % (pc+1)
pc_minus = s_int % (pc-1)
#print(n,s,s_int,pc,pc_plus,pc_minus)

l_plus = [2**(n-i-1) % (pc+1) for i in range(n)]
l_minus = [2**(n-i-1) % (pc-1) for i in range(n)]
#print(l_plus)
#print(l_minus)

for i in range(n):
    if s[i] == '1':
        if pc != 1:
            tmp = (pc_minus - l_minus[i]) % (pc-1)
            print(poptimes(tmp))
        else:
            print(0)
            continue
    
    else:
        tmp = (pc_plus + l_plus[i]) % (pc+1)
        print(poptimes(tmp))


### FIXED CODE ###

def popcnt_int(n): # n:int
    return bin(n).count('1')

def popcnt_bin(s): # s:str
    return s.count('1')

def poptimes(n, cnt=1): #:int
    if n==0:
        return cnt
    else:
        n %= popcnt_int(n)
        cnt += 1
        return poptimes(n, cnt)

n = int(input())
s = input()

s_int = int(s,2)
pc = popcnt_bin(s)
pc_plus = s_int % (pc+1)
if  pc != 1:
    pc_minus = s_int % (pc-1)
#print(n,s,s_int,pc,pc_plus,pc_minus)

for i in range(n):
    if s[i] == '1':
        if pc != 1:
            tmp = pc_minus - pow(2, n-i-1, pc-1)
            print(poptimes(tmp % (pc-1)))
        else:
            print(0)
            continue
    
    else:
        tmp = pc_plus + pow(2, n-i-1, pc+1)
        print(poptimes(tmp % (pc+1)))