Language: C++

# -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
# スペース区切りの整数の入力
#b, c = map(int, input().split())
# 文字列の入力
#s = input()
# 出力
#print("{} {}".format(a+b+c, s))

import numpy as np

nrow = input()
k = int(input())

l = len(nrow)

dp = np.zeros((l, 2, 4), int)
topmax = int(nrow[0])
dp[0, 0, 1] = 1  # =topmax
dp[0, 1, 0] = 1  # =0
dp[0, 1, 1] = topmax-1  # <topmax

for i in range(1, l):
  topmax = int(nrow[i])

  dp[i, 1, 0] = dp[i-1, 1, 0]  # =0
  for j in range(1,4):
    dp[i, 1, j] = dp[i-1, 1, j] + dp[i-1, 1, j-1] * 9  # =0,any

  if topmax == 0:
    for j in range(1, 4):
      dp[i, 0, j] = dp[i-1, 0, j]  #=0
  else:
    dp[i, 0, 2] = dp[i-1, 0, 1]  # =topmax,
    dp[i, 0, 3] = dp[i-1, 0, 2]  # =topmax,
    dp[i, 1, 1] += dp[i-1, 0, 1] # =0,<topmax
    dp[i, 1, 2] += dp[i-1, 0, 2]+dp[i-1, 0, 1] * (topmax-1)  # =0,<topmax
    dp[i, 1, 3] += dp[i-1, 0, 3]+dp[i-1, 0, 2] * (topmax-1)  # =0,<topmax

print(dp[l-1,0,k]+dp[l-1,1,k])


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #-
    1 | # -*- coding: utf-8 -*-
      |   ^
a.cc:2:3: error: invalid preprocessing directive #\U00006574\U00006570\U0000306e\U00005165\U0000529b
    2 | # 整数の入力
      |   ^~~~~~~~~~
a.cc:3:2: error: invalid preprocessing directive #a
    3 | #a = int(input())
      |  ^
a.cc:4:3: error: invalid preprocessing directive #\U000030b9\U000030da\U000030fc\U000030b9\U0000533a\U00005207\U0000308a\U0000306e\U00006574\U00006570\U0000306e\U00005165\U0000529b
    4 | # スペース区切りの整数の入力
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:5:2: error: invalid preprocessing directive #b
    5 | #b, c = map(int, input().split())
      |  ^
a.cc:6:3: error: invalid preprocessing directive #\U00006587\U00005b57\U00005217\U0000306e\U00005165\U0000529b
    6 | # 文字列の入力
      |   ^~~~~~~~~~~~
a.cc:7:2: error: invalid preprocessing directive #s
    7 | #s = input()
      |  ^
a.cc:8:3: error: invalid preprocessing directive #\U000051fa\U0000529b
    8 | # 出力
      |   ^~~~
a.cc:9:2: error: invalid preprocessing directive #print
    9 | #print("{} {}".format(a+b+c, s))
      |  ^~~~~
a.cc:20:18: error: stray '#' in program
   20 | dp[0, 0, 1] = 1  # =topmax
      |                  ^
a.cc:21:18: error: stray '#' in program
   21 | dp[0, 1, 0] = 1  # =0
      |                  ^
a.cc:22:25: error: stray '#' in program
   22 | dp[0, 1, 1] = topmax-1  # <topmax
      |                         ^
a.cc:27:32: error: stray '#' in program
   27 |   dp[i, 1, 0] = dp[i-1, 1, 0]  # =0
      |                                ^
a.cc:29:56: error: stray '#' in program
   29 |     dp[i, 1, j] = dp[i-1, 1, j] + dp[i-1, 1, j-1] * 9  # =0,any
      |                                                        ^
a.cc:33:36: error: stray '#' in program
   33 |       dp[i, 0, j] = dp[i-1, 0, j]  #=0
      |                                    ^
a.cc:35:34: error: stray '#' in program
   35 |     dp[i, 0, 2] = dp[i-1, 0, 1]  # =topmax,
      |                                  ^
a.cc:36:34: error: stray '#' in program
   36 |     dp[i, 0, 3] = dp[i-1, 0, 2]  # =topmax,
      |                                  ^
a.cc:37:34: error: stray '#' in program
   37 |     dp[i, 1, 1] += dp[i-1, 0, 1] # =0,<topmax
      |                                  ^
a.cc:38:62: error: stray '#' in program
   38 |     dp[i, 1, 2] += dp[i-1, 0, 2]+dp[i-1, 0, 1] * (topmax-1)  # =0,<topmax
      |                                                              ^
a.cc:39:62: error: stray '#' in program
   39 |     dp[i, 1, 3] += dp[i-1, 0, 3]+dp[i-1, 0, 2] * (topmax-1)  # =0,<topmax
      |                                                              ^
a.cc:11:1: error: 'import' does not name a type
   11 | import numpy as np
      | ^~~~~~
a.cc:11:1: note: C++20 'import' only available with '-fmodules-ts'