<doocs>1420.Build Array Where You Can Find The Maximum Exactly K Comparisons_1.py
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
def sample_funcname ( var_0 : int , var_2 : int , var_3 : int ) -> int :
    if var_3 == 0 :
        return 0
    var_8 = [ [ [ 0 ] * ( var_2 + 1 ) for var_6 in range ( var_3 + 1 ) ] for var_6 in range ( var_0 + 1 ) ]
    var_12 = 10 ** 9 + 7
    for var_13 in range ( 1 , var_2 + 1 ) :
        var_8 [ 1 ] [ 1 ] [ var_13 ] = 1
    for var_13 in range ( 2 , var_0 + 1 ) :
        for var_16 in range ( 1 , min ( var_3 + 1 , var_13 + 1 ) ) :
            for var_17 in range ( 1 , var_2 + 1 ) :
                var_8 [ var_13 ] [ var_16 ] [ var_17 ] = var_8 [ var_13 - 1 ] [ var_16 ] [ var_17 ] * var_17
                for var_18 in range ( 1 , var_17 ) :
                    var_8 [ var_13 ] [ var_16 ] [ var_17 ] += var_8 [ var_13 - 1 ] [ var_16 - 1 ] [ var_18 ]
                    var_8 [ var_13 ] [ var_16 ] [ var_17 ] %= var_12
    var_19 = 0
    for var_13 in range ( 1 , var_2 + 1 ) :
        var_19 += var_8 [ var_0 ] [ var_3 ] [ var_13 ]
        var_19 %= var_12
    return var_19
