Harryxun/stf_run huggingface dataset:
n=int(input())
rates=list(map(int,input().split()))
over3200=sum(1 for i in rates if i>=3200)
fixed=set()
for i in rates:
  if i//<=7:
    fixed.add(i)
f=len(fixed)
if f==0:
  print(1,over3200)
else:
  print(f,f+over3200)

### FIXED CODE ###

n=int(input())
rates=list(map(int,input().split()))
over3200=sum(1 for i in rates if i>=3200)
fixed=set()
for i in rates:
  if i//400<=7:
    fixed.add(i//400)
f=len(fixed)
if f==0:
  print(1,over3200)
else:
  print(f,f+over3200)
n = int(input())
h = []
dp = [0]*n
h.append(int(input().split()))
dp[0], dp[1] = 0, abs(hs[1]-hs[0])
for i in range(2, n):
  dp(i) = min(dp[i-1] + abs (hs[i] - hs[i-1]), dp[i-2] + abs(hs[i] - hs[i-2]))
print(dp[-1])

### FIXED CODE ###

n = int(input())
hs = [int(s) for s in input().split()]
dp = [0]*n
dp[0], dp[1] = 0, abs(hs[1]-hs[0])
for i in range(2, n):
  dp[i] = min(dp[i-1] + abs (hs[i] - hs[i-1]), dp[i-2] + abs(hs[i] - hs[i-2]))
print(dp[-1])
import math

a, b, x = map(int,input().split())
if (a**2)*b<2*x:
    print(90-math.degrees(math.atan((a**3)/(2*((a**2)*b-x)))))
else:
    print(90-math.degrees(math.atan((2*x)/(a*(b**2)))))

### FIXED CODE ###

import math

a, b, x = map(int,input().split())
if (a**2)*b == x:
    print(0)
elif (a**2)*b<2*x:
    print(90-math.degrees(math.atan((a**3)/(2*((a**2)*b-x)))))
else:
    print(90-math.degrees(math.atan((2*x)/(a*(b**2)))))
n,m,q=map(int,input().split())
counts=[[0 for _ in range(n)] for _ in range(n)]
for _ in range(m):
    l,r=map(int,input().split())
    counts[l-1][r-1]+=1
cumsum=[[0 for _ in range(n+1)] for _ in range(n)]
for i in range(m):
    for j in range(m):
        cumsum[i][j+1]=cumsum[i][j]+counts[i][j]
    
for _ in range(q):
    l,r=map(int,input().split())
    print(sum(cumsum[i][r]-cumsum[i][l-1] for i in range(l-1,r)))

### FIXED CODE ###

n,m,q=map(int,input().split())
counts=[[0 for _ in range(n)] for _ in range(n)]
for _ in range(m):
    l,r=map(int,input().split())
    counts[l-1][r-1]+=1
cumsum=[[0 for _ in range(n+1)] for _ in range(n+1)]
for i in range(n):
    for j in range(n):
        cumsum[i+1][j+1]=cumsum[i+1][j]+counts[i][j]
for j in range(n+1):
    for i in range(n):
        cumsum[i+1][j]+=cumsum[i][j]
        
for _ in range(q):
    l,r=map(int,input().split())
    print(cumsum[r][r]-cumsum[r][l-1]-cumsum[l-1][r]+cumsum[l-1][l-1])
n,k=map(int,input().split())
li=list(map(int,input().split()))
q=[]
for i in range(k,n):
  if li[i-1]<0:
    q.append(-li[i-k])
  elif li[i-k]>0:
    q.append(li[i-1])
  else:
    q.append(li[i-1]-li[i-k]+min(li[i-1],abs(li[i-k])))
print(min(q))


### FIXED CODE ###

n,k=map(int,input().split())
li=list(map(int,input().split()))
q=[]
if k==n:
  q.append(li[n-1]-li[0]+min(abs(li[n-1]),abs(li[0])))
else:
  for i in range(k,n+1):
    if li[i-1]<0:
      q.append(-li[i-k])
    elif li[i-k]>0:
      q.append(li[i-1])
    else:
      q.append(li[i-1]-li[i-k]+min(li[i-1],abs(li[i-k])))
print(min(q))
n = int(input())
a = list(map(int,input().split()))
ans = [0]*n
for i in range(n):
  ans[a.pop(i)-1] = i+1
for i in range(n):
  print(ans,end=" ")

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = [0]*n
for i in range(n):
  ans[a[i]-1] = i+1
for i in range(n):
  print(ans[i],end=" ")
import sys
input = sys.stdin.readline

n,m = map(int,input().split())
heap = [int(i) for i in input().split()]
heap.sort()
ans = sum(heap)
ml = []
cnt = 0

for i in range(m):
  a,b = map(int,input().split())
  ml += [[b,a]]
ml.sort(reverse=True)

for i in range(m):
  for j in range(ml[i][1]):
    if ml[i][0] > heap[cnt]:
      ans += ml[i][0] - heap[cnt]
      cnt += 1
    else:
      break

print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

n,m = map(int,input().split())
heap = [int(i) for i in input().split()]
heap.sort()
ans = sum(heap)
ml = []
cnt = 0

for i in range(m):
  a,b = map(int,input().split())
  ml += [[b,a]]
ml.sort(reverse=True)

for i in range(m):
  for j in range(ml[i][1]):
    if ml[i][0] > heap[cnt]:
      ans += ml[i][0] - heap[cnt]
      cnt += 1
      if cnt == n:
        print(ans)
        exit()
    else:
      print(ans)
      exit()
print(ans)
n = int(input())
a = list(map(int, input().split()))

cnt = [0]*(10**9+1)

for i in a:
    cnt[i] += 1
    if cnt[i] > 1:
        print('NO')
        exit()
print('YES')

### FIXED CODE ###

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

a.sort()
for i in range(n-1):
    if a[i] == a[i+1]:
        print('NO')
        exit()
print('YES')
def dfs(a,adjl,visited,dp):
  for i in adjl[a]:
    if visited[i]==0:
      visited[i]=1
      dfs(i,adjl,visited,dp)
 
    dp[a]=max(dp[a],1+dp[i])
n,m=map(int,input().split())
li=[]
for i in range(m):
  li.append([int(k) for k in input().split()])
adjl=[[] for j in range(n+1)]
for k in range(len(li)):
  adjl[li[0]].append(li[1])
visited=[0]*(n+1)
dp=[0]*(n+1)
for a in range(1,n+1):
  if visited[a]==0:
    visited[a]=1
    dfs(a,adjl,visited,dp)
print(max(dp))

  
  


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
def dfs(a,adjl,visited,dp):
  for i in adjl[a]:
    if visited[i]==0:
      visited[i]=1
      dfs(i,adjl,visited,dp)
 
    dp[a]=max(dp[a],1+dp[i])
n,m=map(int,input().split())
li=[]
for i in range(m):
  li.append([int(k) for k in input().split()])
adjl=[[] for j in range(n+1)]
for k in range(len(li)):
  adjl[li[k][0]].append(li[k][1])
visited=[0]*(n+1)
dp=[0]*(n+1)
for a in range(1,n+1):
  if visited[a]==0:
    visited[a]=1
    dfs(a,adjl,visited,dp)
print(max(dp))
h, w = map(int, input().split())
S = [list(input()) for _ in range(h)]
drc = [[0,1],[0,-1],[1,0],[-1,0]]
for i in range(h):
  for j in range(w):
    if S[i][j] == "#":
      if all([S[i+x][j+y] =="." for x, y in drc if 0 <= i+x < w and 0 <= j+y < h]):
        print("No")
        exit()
print("Yes")

### FIXED CODE ###

import numpy as np

h, w = map(int,input().split())
hw = [input() for i in range(h)]

isPaintable = [[1]*w for _ in range(h)]

predList = [[0,1],[0,-1],[1,0],[-1,0]]

for i in range(h):
  for j in range(w):
    if hw[i][j] == "#":
      for x, y in predList:
        if i+y in range(h) and j+x in range(w):
#          print(hw[i][j],hw[i+y][j+x],i,j,y,x)
          if hw[i+y][j+x]=="#":
            isPaintable[i][j] = 0
            break
    elif hw[i][j] == ".":
      isPaintable[i][j] = 0

if np.array(isPaintable).sum() == 0:
  print("Yes")
else:
  print("No")
a=int(input())
b=int(input())
PCM_Multiply=a*b
print(PCM_Multiply)

### FIXED CODE ###

lst=[int (x) for x in input().split(' ')]
print(lst[0]*lst[1])
w=eval(input(""))
s=eval(input(""))
if w>=s:
  print("unsafe")
else:
  print("safe")

### FIXED CODE ###

str = input("")
li = str.split()
if(eval(li[0])<=eval(li[1])):
  print("unsafe")
else:
  print("safe")
ACGT = ['A','C','G','T']
l,count = 0,0
for i in range(len(s)):
	if ACGT.find(s[i]) >= 0:
		count += 1
	else:
		if l < count:
			l = count
		count = 0
print(l)

### FIXED CODE ###

ACGT = ['A','C','G','T']
s = input() + 'X'
l,count = 0,0
for i in range(len(s)):
	if s[i] in ACGT:
		count += 1
	else:
		if l < count:
			l = count
		count = 0
print(l)
N=list(input())

N=N[::-1]

if N[0]=="2"):
    print("hon")
    break


### FIXED CODE ###

n=list(input())

n==n.reverse()

if (n[0]=="2" or n[0]=="4" or n[0]=="5" or n[0]=="7" or n[0]=="9"):
    print("hon")
elif (n[0]=="0" or n[0]=="1" or n[0]=="6" or n[0]=="8"):
    print("pon")
elif (n[0]=="3"):
    print("bon")
a, b, c = input.split()
print(a[0] + b[0] + c[0])

### FIXED CODE ###

a, b, c = input().split()
a = a[0]
b = b[0]
c = c[0]
a = [a, b, c]
print(''.join(a))
def gcd(a,b): return a if b==0 else gcd(b,a%b)
def lcm(a,b): return a*b//gcd(a,b)
n,m=map(int,input().split())
s=input()
t=input()
n,m=max(n,m),min(n,m)
l=lcm(n,m)
d=[set() for i in range(l)]
f=l
for i in range(max(n,m)):
    o=i*(l//n)
    p=i*(l//m)
    if i<n: d[o].add(s[i])
    if i<m: d[p].add(t[i])
    if i<n and len(d[o])==2: f=-1
    if i<m and len(d[p])==2: f=-1
print(f)

### FIXED CODE ###

def gcd(a,b): return a if b==0 else gcd(b,a%b)
def lcm(a,b): return a*b//gcd(a,b)
n,m=map(int,input().split())
s=input()
t=input()
l=lcm(n,m)
d={}
f=l
for i in range(max(n,m)):
    o=i*(l//n)
    p=i*(l//m)
    if i<n and o not in d:
        d[o]=s[i]
    elif i<n and o in d and d[o]!=s[i]:
        f=-1
    if i<m and p not in d:
        d[p]=t[i]
    elif i<m and p in d and d[p]!=t[i]:
        f=-1
print(f)
import math

def main():
  t1, t2 = map(int, input().split())
  a1, a2 = map(int, input().split())
  b1, b2 = map(int, input().split())

  sumA = t1 * a1 + t2 * a2
  sumB = t1 * b1 + t2 * b2

  if sumA == sumB:
    return 'infinity'
  if sumA < sumB:
    sumA, sumB = sumB, sumA
    a1, b1 = b1, a1
    a2, b2 = b2, a2
  # A の方が sum が大きいとする

  halfA = t1 * a1
  halfB = t1 * b1
  if halfA > halfB:
    return 0
  div, mod = divmod((halfB - halfA) // (sumA - sumB))
  if mod == 0
    return div * 2
  return div * 2 + 1

print(main())

### FIXED CODE ###

import math

def main():
  t1, t2 = map(int, input().split())
  a1, a2 = map(int, input().split())
  b1, b2 = map(int, input().split())

  sumA = t1 * a1 + t2 * a2
  sumB = t1 * b1 + t2 * b2

  if sumA == sumB:
    return 'infinity'
  if sumA < sumB:
    sumA, sumB = sumB, sumA
    a1, b1 = b1, a1
    a2, b2 = b2, a2
  # A の方が sum が大きいとする

  halfA = t1 * a1
  halfB = t1 * b1
  if halfA > halfB:
    return 0
  div, mod = divmod(halfB - halfA, sumA - sumB)
  if mod == 0:
    return div * 2
  return div * 2 + 1

print(main())
s=list(input())
n=len(s)
s1=s[:n//2]
s2=s[n//2:]
for i in range(n//2):
  s2=s1[-1]+s2[:-2]
  s1=s1[:-1]
  if s2==s1:
    break
print(len(s1+s2)

### FIXED CODE ###

s=list(input())
n=len(s)
s1=s[:n//2]
s2=s[n//2:]
for i in range(n//2):
  s2=[s1[-1]]+s2[:-2]
  s1=s1[:-1]
  if s2==s1:
    break
print(len(s1+s2))
X, Y, A, B, C = map(int, input().split())
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]
r = [int(i) for i in input().split()]
p.sort()
q.sort()
r.sort()
red_remain = X
green_remain = Y
ans = 0
flag = False
for i in range(X+Y):
    if flag:
        flag = False
        continue
    if red_remain == 0 or len(p) == 0:
        if green_remain == 0 or len(q) == 0:
            ans += r.pop(-1)
        elif q[-1] < r[-1]:
            ans += r.pop(-1)
        else:
            ans += q.pop(-1)
            green_remain -= 1
    elif green_remain == 0 or len(q) == 0:
        if p[-1] < r[-1]:
            ans += r.pop(-1)
        else:
            ans += p.pop(-1)
            red_remain -= 1
    else:
        if p[-1] < r[-1] and q[-1] < r[-1]:
            ans += r.pop(-1)
        elif p[-1] == q[-1]:
            if i == X+Y-1:
                ans += p[-1]
            else:
                flag = True
                ans += p.pop(-1) + q.pop(-1)
                red_remain -= 1
                green_remain -= 1
        elif p[-1] < q[-1]:
            ans += q.pop(-1)
            green_remain -= 1
        else:
            ans += p.pop((-1))
            red_remain -= 1
print(ans)

### FIXED CODE ###

X, Y, A, B, C = map(int, input().split())
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]
r = [int(i) for i in input().split()]
p.sort()
q.sort()
r.sort()
red_remain = X
green_remain = Y
ans = 0
flag = False
for i in range(X+Y):
    if flag:
        flag = False
        continue
    if red_remain == 0 or len(p) == 0:
        if green_remain == 0 or len(q) == 0:
            ans += r.pop(-1)
        elif len(r) == 0:
            ans += q.pop(-1)
            green_remain -= 1
        elif q[-1] < r[-1]:
            ans += r.pop(-1)
        else:
            ans += q.pop(-1)
            green_remain -= 1
    elif green_remain == 0 or len(q) == 0:
        if len(r) == 0:
            ans += p.pop(-1)
            red_remain -= 1
        elif p[-1] < r[-1]:
            ans += r.pop(-1)
        else:
            ans += p.pop(-1)
            red_remain -= 1
    elif len(r) == 0:
        if p[-1] == q[-1]:
            if i == X+Y-1:
                ans += p[-1]
            else:
                flag = True
                ans += p.pop(-1) + q.pop(-1)
                red_remain -= 1
                green_remain -= 1
        elif p[-1] < q[-1]:
            ans += q.pop(-1)
            green_remain -= 1
        else:
            ans += p.pop((-1))
            red_remain -= 1
    else:
        if p[-1] < r[-1] and q[-1] < r[-1]:
            ans += r.pop(-1)
        elif p[-1] == q[-1]:
            if i == X+Y-1:
                ans += p[-1]
            else:
                flag = True
                ans += p.pop(-1) + q.pop(-1)
                red_remain -= 1
                green_remain -= 1
        elif p[-1] < q[-1]:
            ans += q.pop(-1)
            green_remain -= 1
        else:
            ans += p.pop((-1))
            red_remain -= 1
print(ans)
#3問目
import itertools

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N, P = map(int, input().split())
A = list(map(int, input().split()))
#偶数グループと奇数グループにわける
odd = []
even = []
c = 0
for i in A:
    if i % 2 == 0:
        even.append(i)
    else:
        odd.append(i)
#奇数グループは組み合わせの総数を出す
#もしP=1なら奇数グループから奇数個を出す組み合わせの数、P=0なら奇数グループから偶数個を出す組み合わせの数
if P == 1:
    #奇数グループから奇数個を出す組み合わせの数
    for i in range(1, len(odd)+1, 2):
        c += combinations_count(len(odd), i)
if P == 0:
    #奇数グループから偶数個を出す組み合わせの数
    for i in range(0, len(odd)+1, 2):
        c += combinations_count(len(odd), i)
        
print(2 ** len(even) * c) 

### FIXED CODE ###

#3問目
import itertools
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N, P = map(int, input().split())
A = list(map(int, input().split()))
#偶数グループと奇数グループにわける
odd = []
even = []
c = 0
for i in A:
    if i % 2 == 0:
        even.append(i)
    else:
        odd.append(i)
#奇数グループは組み合わせの総数を出す
#もしP=1なら奇数グループから奇数個を出す組み合わせの数、P=0なら奇数グループから偶数個を出す組み合わせの数
if P == 1:
    #奇数グループから奇数個を出す組み合わせの数
    for i in range(1, len(odd)+1, 2):
        c += combinations_count(len(odd), i)
if P == 0:
    #奇数グループから偶数個を出す組み合わせの数
    for i in range(0, len(odd)+1, 2):
        c += combinations_count(len(odd), i)
        
print(2 ** len(even) * c)
N = int(input())
S = [str(x) for x in input().split()]
K = int(input())
for a in range(N):
    if not S[a] == S[K - 1]:
        S[a] = '*'
print(''.join(S))

### FIXED CODE ###

N = int(input())
S = [str(x) for x in input()]
K = int(input())
for a in range(N):
    if not S[a] == S[K - 1]:
        S[a] = '*'
print(''.join(S))
n,k=map(int,input().split())
s=input()
s[k-1]=s[k-1].lower()
print(s)

### FIXED CODE ###

n,k=map(int,input().split())
s=input()
print(s[:k-1]+s[k-1].lower()+s[k:])
def Ii():return int(sys.stdin.buffer.read())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))
 
a,b,c,k = Mi()
if k <= a:
  ans = k
  exit(0)
ans = a
k -= a
if k > b:
  ans -= k-b
  
print(ans)

### FIXED CODE ###

import sys
def Ii():return int(sys.stdin.buffer.read())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))
 
a,b,c,k = Mi()
if k <= a:
  print(k)
  exit(0)
ans = a
k -= a
if k > b:
  ans -= k-b
  
print(ans)
s = input()
alphabet = 'abcdefghijklmnopqrstuvwxyz'

s_list = set(s)
s_list = sorted(s_list)


for i in range(len(s)):
    if s_list[i] != alphabet[i]:
        print(alphabet[i])
        break
if alphabet in s:
    print('None')

### FIXED CODE ###

l=[chr(ord("a")+i) for i in range(26)]
s=set(input())
for i in s:
    l.remove(i)
print(l[0] if len(l)>0 else "None")
def solve():
  N = int(input())
  lines = [input().split() for i in range(N)]
  for d,e in lines:
    if d==e:
      count += 1
      if count>=3:
        print("Yes")
        return
    else:
      count = 0
  print("No")
  return

solve()

### FIXED CODE ###

def solve():
  N = int(input())
  lines = [input().split() for i in range(N)]
  count = 0
  for d,e in lines:
    if d==e:
      count += 1
      if count>=3:
        print("Yes")
        return
    else:
      count = 0
  print("No")
  return

solve()
import itertools
N = map(int, input().split())
L = [map(int, input().split())]
if max(L) < sum(L) - max(L):
    print('Yes')
else:
    print('No')


### FIXED CODE ###

from sys import stdin
N = int(stdin.readline().rstrip())
L = [int(x) for x in stdin.readline().rstrip().split()]

if max(L) < sum(L) - max(L):
    print('Yes')
else:
    print('No')
s=sorted(input())
t=sorted(input(),reverse=True)

lista=list()

for i in s:
    c=c+i
for x in t:
    d=d+x
lista.append(c)
lista.append(d)
if s==t:
    print("No")
elif lista==sorted(lista):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s=input()
t=input()
c=""
d=""
lista=list()
sa=sorted(s)
ta=sorted(t,reverse=True)
for i in sa:
    c=c+i
for x in ta:
    d=d+x
lista.append(c)
lista.append(d)
if s==t:
    print("No")
elif lista==sorted(lista):
    print("Yes")
else:
    print("No")
n, a, b = list(map(int, input().split()))
if int(a) > int(n):
  print(int(n))
else:
  if int(a) + int(b) > int(n):
    print(int(a))
  else:
    print(int(a) + (int(n) % int(a)))

### FIXED CODE ###

N, A, B = list(map(int,input().split()))
if A == 0:
  print(0)
elif A >= N:
  print(N)
elif A + B >= N:
  print(A)
else:
  print((N//(A+B))*A + min(A,N % (A+B)))
import heapq

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

from operator import mul
from functools import reduce

def cmb(n, r):
    r = min(n - r, r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

heapq.heapify(A)

cmb_list = {}
cmb_list[(K - 1, K - 1)] = cmb(K - 1, K - 1)
for i in range(K, N):
    cmb_list[(i, K-1)] = int(cmb_list[(i-1, K-1)] * i / (i - (K - 1)))
# print(cmb_list)

# print(A)

max_f = 0
min_f = 0


for idx in range(N):
    a = heapq.heappop(A)
    if idx >= K-1:
        max_f += cmb_list[(idx, K-1)]*a
        # print("max", cmb(idx, K-1), idx, K-1, a)

    if N-(idx+1) >= K - 1:
        min_f += cmb_list[(N-(idx+1), K-1)]*a
        # print("min", cmb(N-(idx+1), K-1), N-(idx+1), K-1, a)

print((max_f - min_f) % (10**9+7))

### FIXED CODE ###

import heapq

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

from operator import mul
from functools import reduce

MOD = 10 ** 9 + 7

def mpow(a, n):
    if n == 0: return 1
    if n == 1: return a % MOD
    if n % 2 == 1: return (a % MOD * mpow(a, n - 1) % MOD) % MOD
    t = mpow(a, n // 2)
    return (t * t) % MOD

fac = [1] * (n + 1)
inv_fac = [1] * (n + 1)
for i in range(n):
    fac[i + 1] = (fac[i] * (i + 1)) % MOD
inv_fac[n] = mpow(fac[n], MOD - 2)
for i in range(n, 0, -1):
    inv_fac[i - 1] = (inv_fac[i] * i) % MOD

def cmb(n, r):
    if n == 0 and r == 0: return 1
    if n < r or n < 0: return 0
    return (fac[n] * (inv_fac[r] * inv_fac[n - r]) % MOD) % MOD

A.sort()

# cmb_list = {}
# cmb_list[(K - 1, K - 1)] = cmb(K - 1, K - 1)
# for i in range(K, n):
#     cmb_list[(i, K-1)] = cmb_list[(i-1, K-1)] * i // (i - (K - 1))

max_f = 0
min_f = 0

for idx in range(n):
    a = heapq.heappop(A)
    if idx >= K - 1:
        max_f += cmb(idx, K - 1) * a
        # print("max", cmb(idx, K-1), idx, K-1, a)

    if n - (idx + 1) >= K - 1:
        min_f += cmb(n - (idx + 1), K - 1) * a
        # print("min", cmb(N-(idx+1), K-1), N-(idx+1), K-1, a)

print((max_f - min_f) % (10**9+7))
n = int(input())
x = input()


def popcount(ni):
    n_b = str(bin(ni))
    return n_b.count("1")


def ans(n,x):
    x_i = int(x, 2)
    x_orig = popcount(x_i)
    solve = 0
    n_i = 2**(n-1)
    for i in range(n):
        x_count = x_orig
        if x[i] == "0":
            solve = x_i+n_i
            x_count += 1
        else:
            solve = x_i-n_i
            x_count -= 1
        n_i = int(n_i / 2)
        count = 0

        if solve != 0 :
            solve = solve % x_count
            count+=1

        while solve > 0:
            solve = solve % popcount(solve)
            count+=1

        print(count)

    
ans(n,x)


### FIXED CODE ###


n = int(input())
x = input()

def popcount(ni):
    n_b = str(bin(ni))
    return n_b.count("1")

def ans(n,x):
    x_i = int(x, 2)
    x_orig = popcount(x_i)
    x_i_t = x_i % (x_orig+1)
    if x_orig != 1:
        x_i_b = x_i % (x_orig-1)
    else:
        x_i_b = x_i
    solve = 0
    for i in range(n):
        x_count = x_orig
        if x[i] == "0":
            x_count += 1
            solve = x_i_t + pow(2,n-1-i,x_count)
        else:
            x_count -= 1
            if x_count != 0:
                solve = x_i_b - pow(2,n-1-i,x_count)
            else:
                print(0)
                continue
        count = 0

        if x_count != 0 :
            solve = solve % x_count
            count+=1

        while solve > 0:
            solve = solve % popcount(solve)
            count+=1

        print(count)

    
ans(n,x)
# solution

nim, mike = map(int, input().split())
print(mike * (mike - 1) ** (nim - 1))

### FIXED CODE ###

# solution

cols = set( map( int, input().split() ) )

print( len( cols ) )
def main(): 
  import sys
  read = sys.stdin.buffer.read
  readline = sys.stdin.buffer.readline
  readlines = sys.stdin.buffer.readlines
  from bisect import bisect

  n = int(readline())
  g = []
  for i in range(n):
    v,W = map(int,readline().split())
    g.append((v,W))

  q = int(readline())
  for i in range(q):
    V,w = map(int,readline().split())
    c = []
    ans = 0
    while V > 0:
      c.append(g[V-1])
      V //= 2
    d = []
    e = []
    h = n//2-1
    H = n-h
    for i in range(2**h):
      cw = 0
      cv = 0
      for j,cj in enumerate(c[:h]):
        if (i>>j)&1 == 1:
          cw += cj[1]
          cv += cj[0]
      d.append((cv,cw))

    for i in range(2**H):
      cw = 0
      cv = 0
      for j,cj in enumerate(c[h:]):
        if (i>>j)&1 == 1:
          cw += cj[1]
          cv += cj[0]
      e.append((cv,cw))

    from operator import itemgetter
    e = sorted(e,key=itemgetter(1))

    Ev = [0]
    Ew = [0]
    ch = 0
    for i in range(1,len(e)):
      ev,ew = e[i]
      if ev > ch:
        Ev.append(ev)
        Ew.append(ew)
        ch = ev

    for i in d:
      Cv,Cw = i
      if Cw > w:
        continue
      ind = bisect(Ew,w-Cw)
      cc = Cv+Ev[ind-1]
      ans = max(cc,ans)

    print(ans)
if __name__ == '__main__':
    main()

### FIXED CODE ###

s = input()
print(s[:3])
def dfs(a, b, k):
    global cnt
    seen[a][b] = True
    na = a + 1
    nb = b + 1
    if cnt < N + M:
        if na <= N and seen[na][b] is False and k >= book_a[na]:
            k -= book_a[na]
            cnt = max(cnt, na + b)
            dfs(na, b, k)
        if nb <= M and seen[a][nb] is False and k >= book_b[nb]:
            k -= book_b[nb]
            cnt = max(cnt, a + nb)
            dfs(a, nb, k)

N, M, k = map(int, input().split())
book_a = [int(x) for x in input().split()]
book_b = [int(x) for x in input().split()]
book_a.insert(0, 0)
book_b.insert(0, 0)
cnt = 0
seen = [[False] * (M + 1) for _ in range(N + 1)]
dfs(0, 0, k)
print(cnt)

### FIXED CODE ###

def resolve():
    N, M, K = map(int, input().split())
    A = [int(x) for x in input().split()]
    B = [int(x) for x in input().split()]

    # a,bをA,Bの累積和のリストとして作成
    a, b = [0], [0]
    for i in range(N):
        a.append(a[i] + A[i])
    for i in range(M):
        b.append(b[i] + B[i])

    # i+jの最大値をiをインクリメントとしながら全探索
    ans, j = 0, M
    for i in range(N + 1):
        if a[i] > K:
            break
        while b[j] > K - a[i]:  # i,Kの値が定まればjは一位に定まる
            j -= 1
        ans = max(ans, i + j)
    print(ans)



if __name__ == "__main__":
    resolve()
N = int(input()) %10
hon=[2,4,5,7,9]
bon=[3]

if N in hon:
    print("hon")
elif N in bon:
    print("bon")
else:
    print("pon")


### FIXED CODE ###

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

print(k * (k-1)**(n-1))
A,B,K=map(int,input().split())
ans=[]
i=1
for i in range(1,101):
  if A%i==0 and B%i==0:
    ans.append(i)
    i+=1
print(ans[1])


### FIXED CODE ###

A,B,K=map(int,input().split())
ans=[]
i=1
for i in range(1,101):
  if A%i==0 and B%i==0:
    ans.append(i)
    i+=1
ans.reverse()
print(ans[K-1])