<doocs>1605.Find Valid Matrix Given Row and Column Sums_1.py
def restoreMatrix( rowSum: List[int], colSum: List[int]) -> List[List[int]]:
    m, n = len(rowSum), len(colSum)
    ans = [[0] * n for _ in range(m)]
    for i in range(m):
        for j in range(n):
            x = min(rowSum[i], colSum[j])
            ans[i][j] = x
            rowSum[i] -= x
            colSum[j] -= x
    return ans
def sample_funcname ( var_0 : List [ int ] , var_3 : List [ int ] ) -> List [ List [ int ] ] :
    var_5 , var_6 = len ( var_0 ) , len ( var_3 )
    var_10 = [ [ 0 ] * var_6 for var_8 in range ( var_5 ) ]
    for var_11 in range ( var_5 ) :
        for var_12 in range ( var_6 ) :
            var_14 = min ( var_0 [ var_11 ] , var_3 [ var_12 ] )
            var_10 [ var_11 ] [ var_12 ] = var_14
            var_0 [ var_11 ] -= var_14
            var_3 [ var_12 ] -= var_14
    return var_10
