Harryxun/stf_run huggingface dataset:
N = int(input())
T,A = int(i) for i in input().split()
Hi = [int(i) for i in input().split()]
Ave = T - i*0.006 for i in Hi
Result = [abs(i) for i in Ave - A]
print(index(min(result)) + 1)


### FIXED CODE ###

N = int(input())
T,A = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
sub = [0 for i in range(N)]
for i in range(N):
    sub[i] = abs(A - (T - 0.006*H[i]))
print(sub.index(min(sub))+1)
S = input()
if len(S) == 3 and S.count('A')==2 or S.count('B')==2:
  print('Yes')
  else:
    print('No')

### FIXED CODE ###

S = input()

if len(S)==3 and S.count('A')==2 or S.count('B')==2:
    print('Yes')

else:
    print('No')
input(a)
if a/2==0:
	i=(a+1)/2
	j=(a-1)/2
else:
	i=a/2
	j=a/2
print(i*j)

### FIXED CODE ###

a=int(input())
if a%2==0:
  ans=int((a/2)**2)
else:
  ans=int(((a-1)/2)*((a+1)/2))
print(ans)
n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=10**9+7
a.sort()
def comb(n,k,mod):
  if (r<0 or r>n):
    return 0
  r=min(r,n-r)
  return fact[n]*factinv[r]*factinv[n-r]%mod

N=10**5
fact=[1,1]
factinv=[1,1]
inv=[0,1]

for i in range(2,N+1):
  fact.append((fact[-1]*i)%mod)
  inv.append((-inv[mod%i]*(mod//i))%mod)
  factinv.append((factinv[-1]*inv[-1])%mod)
  
if k>1:
  s=0
  for i in range(0,n-k):
    for j in range(i+k-1,n-1):
      s+=((a[j]-a[i])*comb(j-i-1,k-2,mod))%mod
  print(s%mod)
else:
  print(0)


### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
mod=10**9+7
fan=[1]*(N+1)
for i in range(2,N):
  fan[i]=fan[i-1]*(i)%mod
ans=0
def comb(a,b):
  return fan[a]*pow(fan[b],mod-2,mod)*pow(fan[a-b],mod-2,mod)
for i in range(N-K+1):
  ans+=comb(N-i-1,K-1)*(A[N-i-1]-A[i])
  ans%=mod
print(ans)
n, m = map(int, input().split())
list_score = set([int(input()) for _ in range(m)])

dp = [0] * (n + 1)
mod = pow(10, 9) + 7

dp[0] = 1
if list_score[0] == 1:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2, n + 1):
    if i in list_score:
        continue
    dp[i] = dp[i - 1] + dp[i - 2]
    dp[i] %= mod

print(dp[n])

### FIXED CODE ###

N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])
INF = 1000000007

dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
	dp[1] = 1
else:
	dp[1] = 0
for i in range(2, N + 1):
	if i in a:
		continue
	dp[i] = dp[i - 1] + dp[i - 2]
	dp[i] %= INF

print(dp[N])
nN = int(input())

Tmp = []
Tmp = input().rstrip().split(' ')

nData = [0 for i in range(nN)]

for i in range(nN):
  nData[i] = int (input(Tmp[i]))

nFlag = 0
nCnt = 0

for i in range(nN-1):
  if nData[i] > nData[i+1]:
    nCnt += 1

if nCnt < 2:
  print('YES')
else:
  print('NO')
  




### FIXED CODE ###

nN = int(input())

Tmp = []
Tmp = input().rstrip().split(' ')

nData = [0 for i in range(nN)]

for i in range(nN):
  nData[i] = int(Tmp[i])

nFlag = 0
nCnt = 0

for i in range(nN):
  nTmp = i + 1
  if nData[i] != nTmp:
    nCnt += 1
    nTmp2 = nData[i] - 1
    nTmp3 = nData[nTmp2]
    if nTmp3 != nTmp:
      nCnt += 1
    else:
      nData[nTmp2]=nTmp2+1
  

  
if nCnt < 2:
  print('YES')
else:
  print('NO')
a,b,c=map(int,input().split())
arr=[a,b,c]
arr=sorted(a,b,c)
print(10*arr[-1]+arr[1]+arr[0])

### FIXED CODE ###

a,b,c=map(int,input().split())
arr=[a,b,c]
arr=sorted(arr)
print(10*arr[-1]+arr[1]+arr[0])
a, b, k = map(int, input().split(" "))

l = [1]
for i in range(2, min(a, b), 1):
  if a % i == 0 and b % i == 0:
    l.append(i)

print(l[k-1])

### FIXED CODE ###

a, b, k = map(int, input().split(" "))

l = [1]
for i in range(2, min(a, b) + 1, 1):
  if a % i == 0 and b % i == 0:
    l.append(i)

print(l[-k])
n = int(input()) # the num of monster

ls = list(map(int, input().split()))

ls.sort()

for i in range(len(ls)-1):
  if(len(ls)==1):
    print(len[0])
  for j in range(1, len(ls)):
    if(ls[j] % ls[i] == 0):
      ls.remove(ls[j])



### FIXED CODE ###

n = int(input()) # the num of monster
 
ls = list(map(int, input().split()))
n = len(ls)

def gcd(a,b):
  while b != 0:
    a,b = b, a % b
  return a

ans = gcd(ls[0], ls[1])
 
for i in range(n):
    ans = gcd(ans, ls[i])
    
print(ans)
_, X = map(int, input().split())
A = sorted(list(map(int, input().split())))

count = 0
for a in A:
    if X - a >= 0:
        X -= a
        count += 1
else:
    if count > 1 and X > 0:
        count -= 1

print(count)

### FIXED CODE ###

_, X = map(int, input().split())
A = sorted(list(map(int, input().split())))

count = 0
for a in A:
    if X - a >= 0:
        X -= a
        count += 1

if count == len(A) and X > 0:
    count -= 1

print(count)
def mixing_experiment(N: int, Ma: int, Mb: int, drags: list)->int:
    INF = float('inf')
    max_A = N * max(a for a, _, _ in drags)
    max_B = N * max(b for _, b, _ in drags)
    dp = [[INF] * (max_A+1) for _ in range(max_B+1)]
    dp[0][0] = 0

    for (a, b, c) in drags:
        for ca in range(max_A-a, -1, -1):
            for cb in range(max_B-b, -1, -1):
                dp[ca+a][cb+b] = \
                    min(dp[ca+a][cb+b], dp[ca][cb] + c)
        dp[a][b] = min(dp[a][b], c)

    ans = min(
        dp[ca][cb]
        for ca in range(1, max_A+1)
        for cb in range(1, max_B+1)
        if ca * Mb == cb * Ma)
    # print(dp)

    return ans if 0 < ans and ans < INF else -1


if __name__ == "__main__":
    N = 0
    N, Ma, Mb = map(int, input().split())
    drags = [tuple(int(s) for s in input().split()) for _ in range(N)]
    ans = mixing_experiment(N, Ma, Mb, drags)
    print(ans)


### FIXED CODE ###

# import time


def mixing_experiment(N: int, Ma: int, Mb: int, drags: list)->int:
    INF = float('inf')

    max_A = min(100, N * max(a for a, _, _ in drags))
    max_B = min(100, N * max(b for _, b, _ in drags))

    dp = [[INF] * (max_B+1) for _ in range(max_A+1)]
    dp[0][0] = 0

    # print(max_A, max_B)
    # t1 = time.time()

    # op = 0
    for (a, b, c) in drags:
        for ca in range(max_A-a, -1, -1):
            for cb in range(max_B-b, -1, -1):
                dp[ca+a][cb+b] = \
                    min(dp[ca+a][cb+b], dp[ca][cb] + c)
                # dp[ca+a][cb+b] = 0
                # op += 1
        dp[a][b] = min(dp[a][b], c)

    # t2 = time.time()
    # print('dp: {} [s]'.format(t2 - t1))

    ans = INF
    for ca in range(1, max_A+1):
        for cb in range(1, max_B+1):
            if ca * Mb != cb * Ma:
                continue
            ans = min(ans, dp[ca][cb])

    # t3 = time.time()
    # print('min: {} [s]'.format(t3 - t2))

    return ans if 0 < ans and ans < INF else -1


if __name__ == "__main__":
    N = 0
    N, Ma, Mb = map(int, input().split())
    drags = [tuple(int(s) for s in input().split()) for _ in range(N)]
    ans = mixing_experiment(N, Ma, Mb, drags)
    print(ans)
import numpy as np
H, W = map(int, input().split())
maze = np.array([[c == '#' for c in input()] for _ in range(H)], dtype=bool)

n_walls = np.sum(maze)
n_aisle = W * H - n_walls

d = dict(enumerate(map(dict, map(enumerate, maze))))
directions = [(1, 0), (-1, 0), (0, 1), (0, -1)]
adj = {(i, j): {(i + k, j + l): 1 for k, l in directions if not d.get(i + k, {}).get(j + l, True)}
       for i in range(H) for j in range(W) if not d[i][j]}
start = (0, 0)
end = (H-1, W-1)
for i in adj.keys():
    for j in adj.keys():
        for k in adj.keys():
            distance = adj.get(i, {}).get(k, np.inf) + adj.get(k, {}).get(j, np.inf)
            if adj.get(i, {}).get(j, np.inf) > distance:
                adj[i][j] = distance
print(n_aisle - adj[start][end] - 1)

### FIXED CODE ###

H, W = map(int, input().split())
maze = []
distances = []
n_aisle = 0
for i in range(H):
    row = input()
    maze.append(row)
    distances.append([100000000 for i in range(W)])
    n_aisle += row.count('.')

distances[0][0] = 0
directions = [(1, 0), (-1, 0), (0, 1), (0, -1)]

visited = [(0, 0)]
queue = [(0, 0)]
while len(queue) > 0:
    y, x = queue.pop(0)
    for dy, dx in directions:
        y2, x2 = y + dy, x + dx
        if y2 < 0 or y2 >= H or x2 < 0 or x2 >= W:
            continue
        if (y2, x2) in visited:
            continue
        if maze[y2][x2] == '.':
            distances[y2][x2] = distances[y][x] + 1
            visited.append((y2, x2))
            queue.append((y2, x2))

if distances[H - 1][W - 1] == 100000000:
    print(-1)
else:
    print(n_aisle - distances[H - 1][W - 1] - 1)
import math

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

if n == 2:
    print(max(nums))
else:
    l_gcds = [nums[0]]
    r_gcds = [nums[-1]]
    for i in range(1, n - 1):
        l = math.gcd(l_gcds[-1], nums[i])
        r = math.gcd(r_gcds[-1], nums[n - i - 1])
        l_gcds.append(l)
        r_gcds.append(r)
        if i == 1:
          break

### FIXED CODE ###

def gcd(a, b):
    while True:
        a, b = b, a % b
        if b == 0:
            break
    return a


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

if n == 2:
    print(max(nums))
else:
    l_gcds = [nums[0]]
    r_gcds = [nums[-1]]
    for i in range(1, n - 1):
        l = gcd(l_gcds[-1], nums[i])
        r = gcd(r_gcds[-1], nums[n - i - 1])
        l_gcds.append(l)
        r_gcds.append(r)
    r_gcds = r_gcds[::-1]
    gcds = [l_gcds[-1], r_gcds[0]]
    for i in range(1, n - 1):
        gcds.append(gcd(l_gcds[i - 1], r_gcds[i]))
    print(max(gcds))
import sys

keyword = input().lowercase()
count = 0
for line in sys.stdin:
    count += sum([1 for word in line.lowercase().split() if word == keyword])
    
print(count)

### FIXED CODE ###

import sys

keyword = input().lower()
count = 0
for line in sys.stdin:
    count += sum([1 for word in line.lower().split() if word == keyword])
    
print(count)
S = input()
T = input()
ans = float("INF")
for i in range(len(S)-len(T)):
    cnt = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            cnt += 1
    ans = min(ans,cnt)
print(cnt)

### FIXED CODE ###

S = input()
T = input()
ans = float("INF")
for i in range(len(S)-len(T)+1):
    cnt = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            cnt += 1
    ans = min(ans,cnt)
print(ans)
while True:
    x,y = map(int,input().split)
    if (x,y) == (0,0):
        break
    else:
        if x < y:
            print(x,y)
        else:
            print(y,x)



### FIXED CODE ###

while True:
    x,y = map(int,input().split())
    if (x,y) == (0,0):
        break
    else:
        if x < y:
            print(x,y)
        else:
            print(y,x)
a,b=input().split()
print(a*b)

### FIXED CODE ###

a,b=input().split()
a=int(a)
b=int(b)
print(a*b)
from itertools import product
S = input()
ans = 0

for string in product(["","+"],repeat=len(S) - 1):
    string = list(string)
    string.append("")
    sum_ = [a + b for a,b in zip(S,string)]
    ans += sum_

print(ans)

### FIXED CODE ###

from itertools import product
S = input()
ans = 0

for string in product(["","+"],repeat=len(S) - 1):
    string = list(string)
    string.append("")
    sum_ = [a + b for a,b in zip(S,string)]
    ans += eval("".join(sum_))

print(ans)
N = input()
N = int(N)

a = []
for i in range(N):
	s_input = raw_input()
	s_input = int(s_input)
	if s_input in a:
		a.remove(s_input)
	else:
		a.append(s_input)

print(len(a))

### FIXED CODE ###

N = raw_input()
N = int(N)

num10 = N/10
num1 = N - num10*10

if num10 == 9 or num1 == 9:
	print('Yes')
else:
	print('No')
if S.startswith('k') and S.endswith('eyence'):
    print('YES')
elif S.startswith('ke') and S.endswith('yence'):
    print('YES')
elif S.startswith('key') and S.endswith('ence'):
    print('YES')
elif S.startswith('keye') and S.endswith('nce'):
    print('YES')
elif S.startswith('keyen') and S.endswith('ce'):
    print('YES')
elif S.startswith('keyenc') and S.endswith('e'):
    print('YES')
elif S == 'keyence':
    print('YES')
else:
    print('NO')

### FIXED CODE ###

S = raw_input()
if S.startswith('k') and S.endswith('eyence'):
    print('YES')
elif S.startswith('ke') and S.endswith('yence'):
    print('YES')
elif S.startswith('key') and S.endswith('ence'):
    print('YES')
elif S.startswith('keye') and S.endswith('nce'):
    print('YES')
elif S.startswith('keyen') and S.endswith('ce'):
    print('YES')
elif S.startswith('keyenc') and S.endswith('e'):
    print('YES')
elif S == 'keyence':
    print('YES')
else:
    print('NO')
S = input()
a = list()
b = 0
u = 0
for i in range (len(S)):
    if S[u] == 'R':
        b = b + 1
    else:
        a.append(b)
        b = 0
    u = u + 1
a.sort()
a.reverse()
print(a[0])


### FIXED CODE ###

S = input()
a = list()
b = 0
u = 0
for i in range (len(S)):
    if S[u] == 'R':
        b = b + 1
    else:
        a.append(b)
        b = 0
    u = u + 1
a.append(b)
a.sort()
a.reverse()
print(a[0])
S = input()
c0, c1 = 0,0
ans = 0
for ch in S:
  if c0 == 0 and ch = '1':
    c1 += 1
  elif c1 == 0 and ch = '0':
    c0 += 1
  elif ch == '1':
    ans += 2
    c0 -= 1
  else:
    ans += 2
    c1 -= 1
    
print(ans)


### FIXED CODE ###

S = input()
c0, c1 = 0,0
ans = 0
for ch in S:
  if c0 == 0 and ch == '1':
    c1 += 1
  elif c1 == 0 and ch == '0':
    c0 += 1
  elif ch == '1':
    ans += 2
    c0 -= 1
  else:
    ans += 2
    c1 -= 1
    
print(ans)
N,K = map(int,input().split())
L = sorted(list[map(int,input().split())], reverse=True)

print(sum(L[:K]))



### FIXED CODE ###

N,K = map(int,input().split())
L = sorted(list(map(int,input().split())), reverse=True)

print(sum(L[:K]))
N, M, x= map(int, input().split())
dp=[[0 for i in range(N+1)] for j in range(M+1)]
nap = []
dp[0][0]=0
answ = [10]*M
for _ in range(N):
    nap.append(list(map(int, input().split()))) 

mon=[]
value=[]
for x in nap:
    mon.append(x[0])
for y in nap:
    value.append(y[1:])

ans = []
for i in range(N):
    for j in range(M):
        dp[i+1][j+1] = dp[i][j]+value[i][j]
for m in range(M):
    if answ[m] > ans[m]:
        print(-1)
        exit()


return dp[N][M]


### FIXED CODE ###


import itertools
import sys
import numpy as np
INF = float("inf")
N, M, X = list(map(int, sys.stdin.buffer.readline().split()))
A = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(N)]
 
A = np.array(A, dtype=int)
mat = A[:, 1:]
C = A[:, 0]
 
ans = INF
for choices in itertools.product((True, False), repeat=N):
    choices = np.array(list(choices), dtype=bool)
    if np.all(mat[choices, :].sum(axis=0) >= X):
        ans = min(ans, C[choices].sum())
if ans == INF:
    print(-1)
else:
    print(ans)
N = int(input())
A = list(map(int,input().split()))

x = 1


for i in A:
  x = x*i  

if (x>1000000000000000000) :
    print(-1)
else:
    print(x)


### FIXED CODE ###

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

print(A*B)
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans = 0
m = A
for i in range(N):
  if m > abs(0.1 * T - H[i] * 0.006 - 0.1 * A):
    m = abs(0.1 * T - H[i] * 0.006 - 0.1 * A)
    ans = i + 1
print(ans)


### FIXED CODE ###

N, M = map(int, input().split())
A = []
B = [[] for i in range(N)]
for i in range(M):
  P, Y = map(int, input().split())
  A.append([P, Y])
  B[P-1].append(Y)
for i in range(N):
  B[i].sort()
d = {}
for i in range(N):
  for y in range(len(B[i])):
    d[(i+1, B[i][y])] = y + 1
for i in range(M):
  print('{:0=6}'.format(A[i][0]) + '{:0=6}'.format(d[(A[i][0], A[i][1])]))
#ABC132 A

S = str(input())
T = [S[0],S[1],S[2],S[3]]
T.sort()
if T[0] == T[1] and T[2] == T[3] and T[1] != T[2]
    print("Yes")
else:
    print("No")

### FIXED CODE ###

#ABC132 A

S = str(input())
T = [S[0],S[1],S[2],S[3]]
T.sort()
if T[0] == T[1] and T[2] == T[3] and T[1] != T[2]:
    print("Yes")
else:
    print("No")
n = int(input())
int ans = (n + 1) // 2
print(ans)
  

### FIXED CODE ###

n = int(input())
ans = (n + 1) // 2;
print(ans)
n=int(input())
b=[int(x) for x in input().split()]
a=[0]*n
for i in range(n-1):
	if(i==0):
		a[0]=b[0]
		a[1]=b[1]
    else:    
      if(b[i]>=b[i-1]):
          a[i+1]=b[i]
      if(b[i]<b[i-1]):		
          a[i]=b[i]
          a[i+1]=b[i]
print(sum(a))

### FIXED CODE ###

n=int(input())
b=[int(x) for x in input().split()]
a=[0]*n
for i in range(n-1):
	if(i==0):
		a[0]=b[0]
		a[1]=b[0]
	else:	
		if(b[i]>=b[i-1]):
			a[i+1]=b[i]
		if(b[i]<b[i-1]):		
			a[i]=b[i]
			a[i+1]=b[i]
print(sum(a))
s = input()
n  =len(s)
res = 0
ans = 0
for i in range(n):
    if s[i] == 'B':
        res+=1AC
    else:
        ans+=res


print(ans)

### FIXED CODE ###

s = input()
n  =len(s)
res = 0
ans = 0
for i in range(n):
    if s[i] == 'B':
        res+=1
    else:
        ans+=res


print(ans)
_, *A = map(int, input().split())
A.sort()

ans = 1

if A[0] == 0:
  print(0)
else:
  for a in A:
    ans *= a
    if ans > 1000000000000000000:
      print(-1)
      break
  print(ans)


### FIXED CODE ###

_, *A = map(int, open(0).read().split())
ans = 1

if 0 in A:
  ans = 0
else:
  for a in A:
    ans *= a
    if ans > 10 ** 18:
      ans = -1
      break
print(ans)
r=(int,input())
a=3(r*r)


### FIXED CODE ###

r=int(input())
a=3*(r*r)
print(a)
n=int(input())
a=int(input())
b=int(input())
c=a+b
print("Hello World" if n==1 else str(c) if n==2)

### FIXED CODE ###

n=int(input())
if n==2:
  a=int(input())
  b=int(input())
  c=a+b
print("Hello World" if n%2==1 else str(c))
def gcd(x,y):
  if y == 0:
    return x
  else:
    return gcd(y,x%y)
gcd_A_all = []
for i in range(n):
    A_pop = [a for a in A[0:i] + A[i+1:n]]
    gcd_A = A_pop[0]
    for j in range(n-1):
        gcd_A = gcd(gcd_A, A_pop[j])
    gcd_A_all.append(gcd_A)
print(max(gcd_A_all))

### FIXED CODE ###

def gcd(x,y):
  if y == 0:
    return x
  else:
    return gcd(y,x%y)

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

accum_gcd = []
gcd_A = A[0]
for j in range(n):
    gcd_A = gcd(gcd_A,A[j])
    accum_gcd.append(gcd(gcd_A,A[j]))

accum_gcd_i = []
A_i = A[::-1]
gcd_A_i = A_i[0]
for j in range(n):
    gcd_A_i = gcd(gcd_A_i,A_i[j])
    accum_gcd_i.append(gcd(gcd_A_i,A_i[j]))

accum_gcd_pop = []

for j in range(n):
    if j == 0:
        accum_gcd_pop.append(accum_gcd_i[n-2])
    elif j == n-1:
        accum_gcd_pop.append(accum_gcd[n-2])
    else:
        accum_gcd_pop.append(gcd(accum_gcd[j-1],accum_gcd_i[n-j-2]))
print(max(accum_gcd_pop))
import itertools
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
A = [i for i in range(1, N)]
B = list(itertools.permutations(A))
ans = abs(B.find(P)-B.find(Q))
print(ans)

### FIXED CODE ###

import itertools
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
A = [i for i in range(1, N+1)]
B = list(itertools.permutations(A))
ans = abs(B.index(P)-B.index(Q))
print(ans)
import math
a, b = input().split()
c = int(a + b)

if (int)math.sqrt(c) - math.sqrt(c) == 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
N,M = map(int,input().split())
array = [10]*N
T_F = True

for i in range(M):
  s,c = map(int,input().split())
  if s>N or (array[s-1] != 10 and array[s-1] !=c) or (s == 1 and c == 0):
    T_F = False
    break
  else:
    array[s-1] = c
ans = 0

if T_F:
  for i in range(N):
  if array[i] == 10:
      array[i] == 0
  ans += array[i]*(10**(N-i-1))
  if array[0]:
    print(ans)
  else:
    print(ans+10**(N-1))
else:
  print(-1)

### FIXED CODE ###

N,M = map(int,input().split())
array = [10]*N
T_F = True

for i in range(M):
  s,c = map(int,input().split())
  if s>N or (array[s-1] != 10 and array[s-1] !=c) or (s == 1 and c == 0 and N != 1):
    T_F = False
    break
  else:
    array[s-1] = c

ans = 0
if T_F:
  for i in range(N):
    if array[i] == 10:
        array[i] = 0
    ans += array[i]*(10**(N-i-1))
  if array[0] or N == 1:
    print(ans)
  else:
    print(ans+10**(N-1))
else:
  print(-1)
import sys
input = sys.stdin.readline
def main():
    n = int(input())
    s = int(input(), 2)
    pc0 = bin(s).count("1")
    ans = []
    for i in range(n):
        k = 1 << (n - 1 - i)
        x = k ^ s
        if x >= s:
            pc1 = pc0 + 1
        else:
            pc1 = pc0 - 1
        x %= pc1
        cnt = 1
        while x > 0:
            pc = bin(x).count("1")
            x %= pc
            cnt += 1
        ans.append(cnt)
    print("\n".join(str(y) for y in ans))
if __name__ == '__main__':
    main()

### FIXED CODE ###

n = int(input())
s = input()
x = int(s, 2)
pcx = s.count("1")
pc1 = x % (pcx - 1) if pcx > 1 else 0
pc2 = x % (pcx + 1)

def f(j):
    cnt = 0
    while j:
        j %= bin(j).count("1")
        cnt += 1
    return cnt

for i, y in enumerate(s):
    k = n - 1 - i
    if y == "0":
        print(f((pc2 + pow(2, k, pcx + 1)) % (pcx + 1)) + 1)
    elif pcx > 1:
        print(f((pc1 - pow(2, k, pcx - 1)) % (pcx - 1)) + 1)
    else:
        print(0)
import numpy as np

K = int(input())
S = input()
S = list(S)
mojiretu=''
if len(S) <= K:
    print(S)

else:
    del S[K:len(S)]
    for x in S:
        mojiretu += x
    print(str(mojiretu)+'...')

### FIXED CODE ###

import numpy as np

N = int(input())

amari = N%10
hon_set = [2,4,5,7,9]
pon_set = [0,1,6,8]
bon_set = [3]

for x in hon_set:
    if amari == x:
        print('hon')

for x in pon_set:
    if amari == x:
        print('pon')

for x in bon_set:
    if amari == x:
        print('bon')
n = int(input())

print(m // 3)


### FIXED CODE ###

n = int(input())

print(n // 3)
N = int(input())
A = [int(input()) for i in range(N)]
A_m = max(A)
if A.count(max) >= 2:
    for i in range(N):
        print(A_m)
else:
    for i in range(N):
        if A[i] == A_m:
            del A[i]
            A_m_new = max(A)
            print(A_m_new)
        else:
            print(A_m)


### FIXED CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
A_m = str(max(A))
a = A.index(int(A_m))
A = sorted(A)
if A.count(int(A_m)) >= 2:
    print((A_m + '\n')*(N-1) + A_m)
else:
    print((A_m + '\n')*a + str(A[-2]))
    if N-(a+1) == 1:
        print(A_m)
    elif N-(a+1) < 1:
        pass
    else:
        print((A_m + '\n')*(N-(a+2)) + A_m)
import sys

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

N = int(input())
ans = 0
for i in range(1, N + 1):
    if len(str(i)) % 2 == 1:
    ans += 1
print(ans)


### FIXED CODE ###

import sys

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

N = int(input())
ans = 0
for i in range(1, N + 1):
    if len(str(i)) % 2 == 1:
        ans += 1
print(ans)
n, k, *h = map(int,open(0).read().split());
print(sum(h>=k for h_i in h))

### FIXED CODE ###

# -*- coding: utf-8 -*-
n, k = map(int, input().split())
list = list(map(int, input().split()))
ans = 0
for n_i in range(0, n):
    if list[n_i] >= k:
        ans += 1
print(ans)
N = int(input())

for x in range(N/4)
	for y in range(N/7)
  		if(4*x + 7*y ==)
    		print("Yes")
      		break
   

### FIXED CODE ###

N = int(input())
answer = "No"
cake = N//4
nut = N//7

for x in range(cake+1):
  for y in range(nut+1):
    if 4*x + 7*y == N:
      answer = "Yes"

print(answer)
N,A,B=map(int,input().split())
r=1
S=set()
while r<= 10**100:
	S='b'*A + str(S) +'r'*B
	if len(S)>10**18:
		S = S[1,10**18]
	r=r+1
print(S[1,N],count('b'))

### FIXED CODE ###

n,a,b=map(int,input().split())
q,mod=divmod(n,(a+b))
if mod>a:
  mod=a
print(q*a+mod)