comefrom: <doocs>1420.Build Array Where You Can Find The Maximum Exactly K Comparisons_1.py
code: def numOfArrays( n: int, m: int, k: int) -> int:
      if k == 0:
          return 0
      dp = [[[0] * (m + 1) for _ in range(k + 1)] for _ in range(n + 1)]
      mod = 10**9 + 7
      for i in range(1, m + 1):
          dp[1][1][i] = 1
      for i in range(2, n + 1):
          for c in range(1, min(k + 1, i + 1)):
              for j in range(1, m + 1):
                  dp[i][c][j] = dp[i - 1][c][j] * j
                  for j0 in range(1, j):
                      dp[i][c][j] += dp[i - 1][c - 1][j0]
                      dp[i][c][j] %= mod
      ans = 0
      for i in range(1, m + 1):
          ans += dp[n][k][i]
          ans %= mod
      return ans
masked: def sample_funcname ( var_0 : int , var_1 : int , var_2 : int ) -> int :
      if var_2 == 0 :
          return 0
      var_4 = [ [ [ 0 ] * ( var_1 + 1 ) for var_3 in range ( var_2 + 1 ) ] for var_3 in range ( var_0 + 1 ) ]
      var_5 = 10 ** 9 + 7
      for var_6 in range ( 1 , var_1 + 1 ) :
          var_4 [ 1 ] [ 1 ] [ var_6 ] = 1
      for var_6 in range ( 2 , var_0 + 1 ) :
          for var_7 in range ( 1 , min ( var_2 + 1 , var_6 + 1 ) ) :
              for var_8 in range ( 1 , var_1 + 1 ) :
                  var_4 [ var_6 ] [ var_7 ] [ var_8 ] = var_4 [ var_6 - 1 ] [ var_7 ] [ var_8 ] * var_8
                  for var_9 in range ( 1 , var_8 ) :
                      var_4 [ var_6 ] [ var_7 ] [ var_8 ] += var_4 [ var_6 - 1 ] [ var_7 - 1 ] [ var_9 ]
                      var_4 [ var_6 ] [ var_7 ] [ var_8 ] %= var_5
      var_10 = 0
      for var_6 in range ( 1 , var_1 + 1 ) :
          var_10 += var_4 [ var_0 ] [ var_2 ] [ var_6 ]
          var_10 %= var_5
      return var_10
  