Harryxun/stf_run huggingface dataset:
N = int("2")
T,A = map(int,"12 5".split(" "))
h = "1000 2000".split(" ")
H_ = [abs(T-0.006*int(k)-A) for k in h]

m = float("inf")
arg = 0
for i in range(N):
  if H_[i] < m:
    arg = i+1
    m = H[i]

print(arg)

  
  

### FIXED CODE ###

N = int(input())
T,A = map(int,input().split(" "))
h = input().split(" ")
H_ = [abs(T-0.006*int(k)-A) for k in h]
     
m = float("inf")
arg = 0
for i in range(N):
  if H_[i] < m:
    arg = i+1
    m = H_[i]
     
print(arg)
input()
a=list(map(int,input().split()))
print(' '.join([str(i[0]) for i in sorted([[i+1,a[i]]for i in range(0,len(a))],key=lambda x: x[1])]))

### FIXED CODE ###

input()
a=list(map(int,input().split()))
print(' '.join([str(i[0]) for i in sorted([[i+1,a[i]]for i in range(0,len(a))],key=lambda x: x[1])]))
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
import bisect
from heapq import heappush, heappop
from scipy.sparse.csgraph import floyd_warshall

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, T = MAP()
wv = [LIST() for _ in range(N)]
dp1 = [[0]*T for _ in range(N+1)]
dp2 = [[0]*T for _ in range(N+1)]


for i in range(N):
	for j in range(T):
		if j < wv[i][0]:
			dp1[i+1][j] = dp1[i][j]
		else:
			dp1[i+1][j] = max(dp1[i][j], dp1[i][j-wv[i][0]]+wv[i][1])

wv = wv[::-1]

for i in range(N):
	for j in range(T):
		if j < wv[i][0]:
			dp2[i+1][j] = dp2[i][j]
		else:
			dp2[i+1][j] = max(dp2[i][j], dp2[i][j-wv[i][0]]+wv[i][1])

wv = wv[::-1]
ans = 0
for i in range(1, N+1):
	tmp = 0
	for j in range(T):
		tmp = max(tmp, dp1[i-1][j] + dp2[N-i][T-1-j])
	ans = max(ans, tmp+wv[i-1][1])

print(ans)


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
import bisect
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, T = MAP()
wv = [LIST() for _ in range(N)]
dp1 = [[0]*T for _ in range(N+1)]
dp2 = [[0]*T for _ in range(N+1)]


for i in range(N):
	for j in range(T):
		if j < wv[i][0]:
			dp1[i+1][j] = dp1[i][j]
		else:
			dp1[i+1][j] = max(dp1[i][j], dp1[i][j-wv[i][0]]+wv[i][1])

wv = wv[::-1]

for i in range(N):
	for j in range(T):
		if j < wv[i][0]:
			dp2[i+1][j] = dp2[i][j]
		else:
			dp2[i+1][j] = max(dp2[i][j], dp2[i][j-wv[i][0]]+wv[i][1])

wv = wv[::-1]
ans = 0
for i in range(1, N+1):
	tmp = 0
	for j in range(T):
		tmp = max(tmp, dp1[i-1][j] + dp2[N-i][T-1-j])
	ans = max(ans, tmp+wv[i-1][1])

print(ans)
S = int(input())
h = S / 3600
m = (S % 3600) / 60
s = (S % 3600) % 60
print(h: m: s)

### FIXED CODE ###

S = int(input())
h = S // 60 //60
m = S // 60 % 60
s = S % 60
print("{0}:{1}:{2}".format(h,m,s))
x = input().split()
a,op,b = int(x[0]),x[1],int(x[2])
if op == "+":
    print a+b
elif op == "-":
    print a-b
elif op == "*":
    print a*b
elif op == "/":
    print a/b
else:
    break
    
    
    
    

### FIXED CODE ###

while True:
    x = raw_input().split()
    a,op,b = int(x[0]),x[1],int(x[2])
    if op == "+":
        print a+b
    elif op == "-":
        print a-b
    elif op == "*":
        print a*b
    elif op == "/":
        print a/b
    else:
        break
= input()
Q = 0
for i in range(int(N)):
  P = []
  for j in range(len(str(i))):
    k= str(i)
    P.append(int(k[j]))
  if(sum(P)%3 == 0 and P[-1]/5 == 0):
      Q += 0
  elif(sum(P)%3 == 0):
      Q += 0
  elif(P[-1] == 0 or P[-1] == 5):
      Q += 0
  else:
      Q += i
print(Q)

### FIXED CODE ###

N = int(input())
Q = 0
for i in range(1,N+1):
  if(i%3 != 0 and i%5 != 0):
      Q += i
print(Q)
from heapq import heappop,heapify
n,k=map(int,input().split())
q=[-int(i) for i in input().split()]
if k==0:
  print(sum(q))
  exit()
heapify(q)
for i in range(k):
  x=heappop(q)
print(-sum(q))

### FIXED CODE ###

n,k=map(int,input().split())
q=[int(i) for i in input().split()]
q.sort(reverse=True)
print(sum(q[k:]))
import collections
s=list(input())
a=collections.Counter(s)
b=a.keys()
c=a.values()
values, counts = zip(*a.most_common())
if counts[0]==counts[1]==2 and len(values)==2:
    print("Yes")
else:
   print("No")

### FIXED CODE ###

s=list(input())
if s.count(s[0])==s.count(s[1])==s.count(s[2])==s.count(s[3])==2:
   print("Yes")
else:
   print("No")
from decimal import Decimal

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


a = math.floor(n*k)
print(a)

### FIXED CODE ###

from decimal import *
import math 
n,k = input().split()
n =Decimal(n)
k =Decimal(k)
a = math.floor(n*k)
print(a)
N = int(input())
total = 0
A = [None] * N
B = [None] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
	
for t in range(N):
	i = N + 1 - t
	a = A[i] % B[i]
	if a == 0:
		pass
	else:
		total = B[i]-a:
		for j in range (i):
			A[i] = A[i] + B[i] - a


print (total)
	


### FIXED CODE ###


N = int(input())
total = 0
A = [None] * N
B = [None] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
	
for i in range(N-1,-1,-1):
	b = A[i] + total
	a = b % B[i]
	if a == 0:
		pass
	else:
		total = total + B[i] - a


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


### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1, N + 1):
	if len(str(i)) % 2 == 1:
		ans += 1
print(ans)
v=[]
v = str(input()).split()
dif_max = -200000

print(v[2])

### FIXED CODE ###

cnt = int(input())
dif_max = -1000000000
v_min = 1000000000

for i in range(cnt):
    buf = int(input())
    if i > 0:
        dif_max = dif_max if buf - v_min < dif_max else buf - v_min
    v_min = buf if buf < v_min else v_min
print(dif_max)
import math
N, X = map(int, input().split())
Y = list(map(int, input().split()))
ans = abs(Y[0]-X)
for i in range(1,N):
    ans = math.gcd(ans, abs(Y[i]-X))

print(ans)

### FIXED CODE ###

import fractions
N, X = map(int, input().split())
Y = list(map(int, input().split()))
ans = abs(Y[0]-X)
for i in range(1,N):
    ans = fractions.gcd(ans, abs(Y[i]-X))

print(ans)
n = int(input())
l = []
ans = 0
for i in range(n):
    l.append(int(input()))
m = sum(l) / n
large_l = []
small_l = []
for i in range(n):
    if l[i] > m:
        large_l.append(abs(l[i]-m))
    else:
        small_l.append(abs(l[i]-m))
large_l.sort()
small_l.sort()
if n % 2 == 1:
    if len(large_l) < len(small_l):
        ans += small_l[0] + small_l[1]
        for i in range(2, len(small_l)):
            ans += 2 * small_l[i]
        for i in range(len(large_l)):
            ans += 2 * large_l[i]
    else:
        ans += large_l[0] + large_l[1]
        for i in range(len(small_l)):
            ans += 2 * small_l[i]
        for i in range(2, len(large_l)):
            ans += 2 * large_l[i]
else:
    ans += large_l[0] + small_l[0]
    for i in range(1, len(small_l)):
        ans += 2 * small_l[i]
    for i in range(1, len(large_l)):
        ans += 2 * large_l[i]
print(int(ans))

### FIXED CODE ###

n = int(input())
l = [0] * n
for i in range(n):
    l[i] = int(input())
l.sort(reverse=True)
ans1 = 0
ans2 = 0
if n % 2 == 1:
    for i in range((n-3)//2):
        ans1 += 2 * l[i]
    ans1 += l[(n-3)//2] + l[(n-3)//2+1]
    for i in range((n-3)//2+2, n):
        ans1 -= 2 * l[i]

    for j in range((n-1)//2):
        ans2 += 2 * l[j]
    ans2 -= l[(n-1)//2] + l[(n-1)//2+1]
    for j in range((n-1)//2+2, n):
        ans2 -= 2 * l[j]

else:
    for i in range(((n-2)//2)):
        ans1 += 2 * l[i]
    ans1 += l[(n-2)//2]
    ans1 -= l[(n-2)//2+1]
    for i in range((n-2)//2+2, n):
        ans1 -= 2 * l[i]

ans = max(ans1, ans2)
print(ans)
def prm(a):
  if a == 1 or a == 4:
    return False
  for i in range(2,int((a)**0.5+1)):
    if a%i == 0:
      return False
  else:
    return True
prime = []
for i in range(1,10**6+1):
  if prm(i):
    prime.append(i)
def sepa(a):
  ans = []
  while a>1:
    for x in prime:
      if a%x == 0:
        ans.append(x)
        a = a//x
        break
    else:
      ans.append(a)
      a = 1
  return Counter(ans)
n,p = map(int,input().split())
c = sepa(p)
ans = 1
for k,v in c.values():
  if n<=v:
    ans *= k**(v//n)
print(ans)

### FIXED CODE ###

from collections import Counter
def prm(a):
  if a == 1 or a == 4:
    return False
  for i in range(2,int((a)**0.5+1)):
    if a%i == 0:
      return False
  else:
    return True
prime = []
for i in range(1,10**6+1):
  if prm(i):
    prime.append(i)
def sepa(a):
  ans = []
  while a>1:
    for x in prime:
      if a%x == 0:
        ans.append(x)
        a = a//x
        break
    else:
      ans.append(a)
      a = 1
  return Counter(ans)
n,p = map(int,input().split())
c = sepa(p)
ans = 1
for k,v in c.items():
  if n<=v:
    ans *= k**(v//n)
print(ans)
N=int(input())
XA=0
BA=0
BX=0
internalAB=0
for t in range(N):
    i=input()
    headUsed=False
    footUsed=False
    for x,j in enumerate(i):
        if x==len(i)-1:break
        if j=="A" and i[x+1]=="B":
            internalAB+=1
            if x==0:headUsed=True
            if x==len(i)-2:footUsed=True
    if i[0]=="B" and not headUsed:
        if i[-1]=="A" and not footUsed:
            BA+=1
        else:BX+=1
    elif i[-1]=="A" and not footUsed:
        XA+=1
ans=internalAB+BA+min(XA,BX)
if XA=BX=0:ans-=1
print(ans)


### FIXED CODE ###

N=int(input())
XA=0
BA=0
BX=0
internalAB=0
for t in range(N):
    i=input()
    headUsed=False
    footUsed=False
    for x,j in enumerate(i):
        if x==len(i)-1:break
        if j=="A" and i[x+1]=="B":
            internalAB+=1
            if x==0:headUsed=True
            if x==len(i)-2:footUsed=True
    if i[0]=="B" and not headUsed:
        if i[-1]=="A" and not footUsed:
            BA+=1
        else:BX+=1
    elif i[-1]=="A" and not footUsed:
        XA+=1
if XA or BX:
    externalAB=max(0,BA+min(XA,BX))
else:externalAB=max(0,BA-1)
ans=internalAB+externalAB
print(ans)
A=[list(map(int,input().split())) for i in range(3)]
n=int(input())

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[x][y]:
        A[x][y]=-1
for x in range(3):
  if A[x][0]==-1:
    f=True
    for y in range(3):
      if A[x][y]!=-1:
        f=False
    if f:
      print('Yes')
      exit()
for y in range(3):
  if A[0][y] == -1:
    f=True
    for x in range(3):
      if A[y][[x] != -1:
        f=False
    if f:
      print('Yes')
      exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
f=True
for i in range(1,3):
  if A[-i][-i]!=-1:
    f=False
if f:
  print('Yes')

### FIXED CODE ###

A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())

for _ in range(N):
    b = int(input())
    for y in range(3):
        for x in range(3):
            if A[y][x] == b:
                A[y][x] = -1

for y in range(3):
    f = True
    for x in range(3):
        if A[y][x] != -1:
            f = False
    if f:
        print('Yes')
        exit()

for x in range(3):
    f = True
    for y in range(3):
        if A[y][x] != -1:
            f = False
    if f:
        print('Yes')
        exit()

f = True
for x in range(3):
    if A[x][x] != -1:
        f = False
if f:
    print('Yes')
    exit()

f = True
for x in range(3):
    if A[2 - x][x] != -1:
        f = False
if f:
    print('Yes')
    exit()

print('No')
X,Y,Z,K = map(int, input().split())
A = [int(x) for x in input().split()]
A.sort(reverse=True)
B = [int(x) for x in input().split()]
B.sort(reverse=True)
C = [int(x) for x in input().split()]
C.sort(reverse=True)


bi_comb = []
for i in A[:K]:
    for j in B[:K]:
        bi_comb.append(i+j)
bi_comb.sort(reverse=True)
bi_comb = bi_comb[:K]
tri_comb = []
for k in range(K):
    for l in range(len(C[:K])):
        tri_comb.append(bi_comb[k] + C[l])
tri_comb.sort(reverse=True)

print(*result_l, sep="\n")

### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
A = sorted([int(x) for x in input().split()], reverse=True)
B = sorted([int(x) for x in input().split()], reverse=True)
C = sorted([int(x) for x in input().split()], reverse=True)

bi_comb = []
for i in range(min(X, K)):
    for j in range(min(Y, K)):
        if (i+1)*(j+1) > K:
            break
        bi_comb.append(A[i] + B[j])
bi_comb.sort(reverse=True)

tri_comb = []
for k in range(min(len(bi_comb), K)):
    for l in range(min(Z, K)):
        if (k+1)*(l+1) > K:
            break
        tri_comb.append(bi_comb[k] + C[l])
tri_comb.sort(reverse=True)

print(*tri_comb[:K], sep="\n")
S = list(map(int,input().split()))
N=S[0]
M=S[1]
N1=0
M1=0
count = 0
if N<2*M:
    count = N
    N1=0
    M1=M-2*N
    count+=M1//4
else:
    count += M//2
print(count)

### FIXED CODE ###

N=int(input())

x=N*800
y=200*(N//15)
print(x-y)
r, g, b, n = map(int, input().split())

ans = 0

for i in range(3001):
    if i*r > n:
        break
    for j in range(3001):
        value = r*i + g*j
        if (n - value) < 0:
            break
        elif (n - value) % b == 0:
            ans += 1
print(ans)


### FIXED CODE ###

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

print(n+1-k)
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)

f = 0
x = 0
for i in range(len(a)):
    if a[i] == a[i+1] != x:
        f += 1
    if f == 1:
        x = a[i]
        f += 1
        if a.count(x) >= 4:
          f = 3
    if f >= 3:
        print(x*a[i])
        exit()
print(0)

### FIXED CODE ###

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

f = 0
x = 0
for i in range(len(a)-1):
    if a[i] == a[i+1] != x:
        f += 1
    if f == 1:
        x = a[i]
        f += 1
        if a.count(x) >= 4:
          f = 3
    if f >= 3:
        print(x*a[i])
        exit()
print(0)
from collections import defaultdict
N,M=map(int,input().strip().split())
G=defaultdict(list)
for i in range(M):
  u,v=map(int,input().strip().split())
  G[u].append(v)
  G[v].append(V)
dist=[(-1,parent)]*(N+1)
valid=False
Q=[1]
visited=[False]*(N+1)
while(len(Q)!=0):
  top=Q[0]
  Q.pop(0)
  for u in G[top]:
    if not visited[u]:
      Q.append(u)
      dist[u][0]=1+dist[top][0]
      dist[u][1]=top
      visited[u]=True
for pair in dist[1:]:
  if pair[0]==-1:
    valid=True
    print("No")
    return 
if not valid:
  print("Yes")
  for pair in dist[1:]:
    print(pair[1])




### FIXED CODE ###


from collections import defaultdict
N,M=map(int,input().strip().split())
G=defaultdict(list)
for i in range(M):
  u,v=map(int,input().strip().split())
  G[u].append(v)
  G[v].append(u)
dist=[]
for i in range(N+1):
    dist.append([0,-1])
valid=False
Q=[1]
visited=[False]*(N+1)
visited[1]=True
while(len(Q)!=0):
  top=Q[0]
  Q.pop(0)
  for u in G[top]:
    if not visited[u]:
      Q.append(u)
      dist[u][0]=1+dist[top][0]
      dist[u][1]=top
      visited[u]=True
for pair in dist[2:]:
  if pair[0]==-1:
    valid=True
    print("No")
if not valid:
  print("Yes")
  for pair in dist[2:]:
    print(pair[1])
r=lambda x:p[x]>=0and r(p[x])or x
(n,m,k),*t=[map(int,t.split())for t in open(0)]
p=[-1]*-~n
f=[[]for _ in p]
for a,b in t[:m]:
  x,y=r(a),r(b)
  if x!=y:
    p[x]+=p[y]
    p[y]=x
  f[a]+=b,
  f[b]+=a,
a=[~len(f[i])-p[r(i)]for i in range(n+1)]
for c,d in t[m:]:
  if r(c)==r(d):
    a[c]-=1
    a[d]-=1
print(*a[1:])

### FIXED CODE ###

def root(x):
  while par[x]>=0:x=par[x]
  return x
def unite(x,y):
  x,y=root(x),root(y)
  if x!=y:
    if x>y:x,y=y,x
    par[x]+=par[y]
    par[y]=x
def same(x,y):
  return root(x)==root(y)
def size(x):
  return-par[root(x)]
n,m,k,*t=map(int,open(0).read().split())
par=[-1]*n
f=[set()for _ in range(n)]
for a,b in zip(*[iter(t[:m*2])]*2):
  a-=1
  b-=1
  unite(a,b)
  f[a].add(b)
  f[b].add(a)
a=[size(i)-len(f[i])-1for i in range(n)]
for c,d in zip(*[iter(t[m*2:])]*2):
  c-=1
  d-=1
  if same(c,d):
    a[c]-=1
    a[d]-=1
print(*a)
a = int(input()) // 数の個数
b = list(map(int, input().split())) // それぞれの値
min = 100000
for i in range(a):
  if (min > (b[i]/2)):
    min = b[i]/2
print(min)

### FIXED CODE ###

a = int(input())
b = list(map(int, input().split()))
count = 0
while(1):
  flag = 0
  for i in range(0, a, 1):
    if (b[i] % 2 == 1) :
      flag = 1
  if (flag == 1) :
    break
  for i in range(0, a, 1):
    b[i] /= 2
  count += 1
print(count)
K=int(input())
S=input()

def printt(S,K):
	if len(S)<=K:
      print(S)
    else:
      print(s[:k]+'...')
      
printt(S,K)

### FIXED CODE ###

K=int(input())
S=input()
 
def printt(S,K):
  if len(S)<=K:
    print(S)
  else:
    print(S[:K]+'...')
      
printt(S,K)
a=ord(input());print('YNeos'[a[0]^a[1]^a[2]==96::2])

### FIXED CODE ###

print("YNeos"[len(set(input()))<3::2])
import sys
sys.setrecursionlimit=10**12

def modinv(a,m=10**9+7):
    if a==0: return 1
    else:
        b=m
        (x, lastx) = (0, 1)
        (y, lasty) = (1, 0)
        while b != 0:
            q = a // b
            (a, b) = (b, a % b)
            (x, lastx) = (lastx - q * x, x)
            (y, lasty) = (lasty - q * y, y)
        return lastx % m

def cur(p):
    for x in neighbor[p]:
        par[x]=p
        neighbor[x].remove(p)
        cur(x)
    descend[par[p]]+=descend[p]
def cur2(p):
    for x in neighbor[p]:
        ans[x]=ans[p]*descend[x]*modinv(n-descend[x])
        ans[x]%=mod
        cur2(x)

mod=10**9+7
n=int(input())
neighbor=[set()  for _ in range(n+2)]
descend=[1 for i in range(n+1)]
par=[0]+[0]*(n+1)

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].add(b)
    neighbor[b].add(a)

cur(1)


ans=[1]*(n+1)
ans1=1
for i in range(1,n+1):
    ans1=ans1*i*modinv(descend[i])
    ans1%=mod
ans[1]=ans1

cur2(1)

for i in range(1,n+1):
    print(ans[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

def modinv(a,m=10**9+7):
    if a==0: return 1
    else:
        b=m
        (x, lastx) = (0, 1)
        (y, lasty) = (1, 0)
        while b != 0:
            q = a // b
            (a, b) = (b, a % b)
            (x, lastx) = (lastx - q * x, x)
            (y, lasty) = (lasty - q * y, y)
        return lastx % m

def cur(p):
    if neighbor[p]==[]: return
    for x in neighbor[p]:
        par[x]=p
        neighbor[x].remove(p)
        cur(x)
    descend[par[p]]+=descend[p]

def cur2(p):
    for x in neighbor[p]:
        ans[x]=ans[p]*descend[x]*modinv(n-descend[x])
        ans[x]%=mod
        cur2(x)

mod=10**9+7
n=int(input())
neighbor=[set()  for _ in range(n+2)]
descend=[1 for i in range(n+1)]
par=[0]+[0]*(n+1)

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].add(b)
    neighbor[b].add(a)

cur(1)


ans=[1]*(n+1)
ans1=1
for i in range(1,n+1):
    ans1=ans1*i*modinv(descend[i])
    ans1%=mod
ans[1]=ans1

cur2(1)

for i in range(1,n+1):
    print(ans[i])
H,W=int(input())
h,w=int(input())
print(H*W-(W*h)+((H*w)-(h*w)))

### FIXED CODE ###

H,W=map(int,input().split())
h,w=map(int,input().split())
print(H*W-((W*h)+((H*w)-(h*w))))
import sys

def comb(n, r):
    if r > n or r < 0: return 0
    r = min(r, n - r)
    if r == 0: return 1
    if r == 1: return n
    numerator = list(range(n-r+1, n+1))
    denominator = list(range(1, r+1))
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
    return result

n, k = map(int, sys.stdin.read().split())

def solve(n, k):
    p = int(str(n)[0])
    l = len(str(n))

    if k == 1:
        return 9 * (l - 1) + p
    
    elif k == 2:
        res = 0
        for i in range(1, l-1):
            res += comb(i, 1) * 9 * 9
        res += comb(l-1, 1) * 9 * (p - 1)
        res += solve(int(str(n)[1:]), 1)
        return res
    
    elif k == 3:
        res = 0
        for i in range(2, l-1):
            res += comb(i, 2) * 9 ** 2 * 9
        res += comb(l-1, 2) * 9 ** 2 * (p - 1)
        res += solve(int(str(n)[1:]), 2)
        return res

def main():
    return solve(n, k)

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

### FIXED CODE ###

import sys

def comb(n, r):
    if r > n or r < 0: return 0
    r = min(r, n - r)
    if r == 0: return 1
    if r == 1: return n
    numerator = list(range(n-r+1, n+1))
    denominator = list(range(1, r+1))
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
    return result

n, k = map(int, sys.stdin.read().split())

def solve(n, k):
    p = int(str(n)[0])
    l = len(str(n))

    if k == 1:
        return 9 * (l - 1) + p
    
    elif k == 2:
        if l <= 1:
            return 0
        res = 0
        for i in range(1, l-1):
            res += comb(i, 1) * 9 * 9
        res += comb(l-1, 1) * 9 * (p - 1)
        res += solve(int(str(n)[1:]), 1)
        return res
    
    elif k == 3:
        if l <= 2:
            return 0
        res = 0
        for i in range(2, l-1):
            res += comb(i, 2) * 9 ** 2 * 9
        res += comb(l-1, 2) * 9 ** 2 * (p - 1)
        res += solve(int(str(n)[1:]), 2)
        return res

def main():
    return solve(n, k)

if __name__ == '__main__':
    ans = main()
    print(ans)
s=input()
t=input()
print("{}{}".format(t,s))

### FIXED CODE ###

b, c = map(str, input().split())

print(c+b)
a, b = input().split()
print(min(a*b, b*a))

### FIXED CODE ###

a,b = input().split()
num_a = int(a)
num_b = int(b)

if num_a < num_b:
  print(a*num_b)
else:
  print(b*num_a)
x = 2
print x =^ 3

### FIXED CODE ###

x = input()
print x*x*x
N = int(input())
A = [int(input()) for i in range(N)]
max = max(A)
if A.count(max) >=2:
    for i in range(N):
        print(max)
else:
    M = A.index(max)
    for i in range(M):
        print(max)
    print(max(A.remove(max)))
    for i in range(M+1,N):
        print(max)

### FIXED CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
f = max(A)
if A.count(f) >=2:
    for i in range(N):
        print(f)
else:
    M = A.index(f)
    del A[M]
    for i in range(M):
        print(f)
    print(max(A))
    for i in range(M+1,N):
        print(f)
s=[]
for i in raw_input().split():
    if i<"0":
        t=s.pop()
        s.append("("+s.pop()+i+t+")")
    else:
        s.append(i)
print eval(s[0])

### FIXED CODE ###

s=[]
for i in raw_input().split():
    if i<"0":
        t=s.pop()
        s.append(str(eval(s.pop()+i+t)))
    else:
        s.append(i)
print s[0]
import sys
N = int(input())
H = [int(_) for _ in input().split()]

diff = [0] * (N - 1)
for n in range(N - 1):
    diff[n] = H[n] - H[n + 1]

for n in range(N - 1):
    if diff[n] >= 2:
        print('No')
        sys.exit()
    if diff[n] == 1 and diff[n + 1] == 1:
        print('No')
        sys.exit()

print('Yes')

### FIXED CODE ###

import sys
N = int(input())
A = [int(_) - 1 for _ in input().split()]

for n in range(1, N):
    if A[n] + 1 == A[n - 1]:
        A[n] += 1
    elif A[n] + 1 < A[n - 1]:
        print('No')
        sys.exit()
print('Yes')
x = int(input())

for i in range(x):
    s = x - i**5
    t = int(s ** 0.2)
    if(s == t**5):
        print(i,-t)
        exit()

### FIXED CODE ###

x = int(input())


for i in range(-1000,1000):
    s = x + pow(i,5)
    t = pow(s,0.2)
    if(t.imag == 0):
        t = int(t)
        if(pow(t,5) == s):
            print(t,i)
            exit()