<garvit244>1039_1.py
def minScoreTriangulation( A):
    n = len(A)
    dp = [[0]*n for _ in range(n)]
    for length in range(n):
        index_i = 0
        for index_j in range(length, n):
            if index_j < index_i+2:
                dp[index_i][index_j] = 0
            else:
                dp[index_i][index_j] = float('inf')
                for index_k in range(index_i+1, index_j):
                    val = dp[index_i][index_k] + dp[index_k][index_j] + (A[index_i]*A[index_k]*A[index_j])
                    dp[index_i][index_j] = min(dp[index_i][index_j], val)
            index_i += 1
    return dp[0][n-1]
def sample_funcname ( var_0 ) :
    var_2 = len ( var_0 )
    var_6 = [ [ 0 ] * var_2 for var_4 in range ( var_2 ) ]
    for var_7 in range ( var_2 ) :
        var_8 = 0
        for var_9 in range ( var_7 , var_2 ) :
            if var_9 < var_8 + 2 :
                var_6 [ var_8 ] [ var_9 ] = 0
            else :
                var_6 [ var_8 ] [ var_9 ] = float ( 'inf' )
                for var_14 in range ( var_8 + 1 , var_9 ) :
                    var_15 = var_6 [ var_8 ] [ var_14 ] + var_6 [ var_14 ] [ var_9 ] + ( var_0 [ var_8 ] * var_0 [ var_14 ] * var_0 [ var_9 ] )
                    var_6 [ var_8 ] [ var_9 ] = min ( var_6 [ var_8 ] [ var_9 ] , var_15 )
            var_8 += 1
    return var_6 [ 0 ] [ var_2 - 1 ]
