<doocs>1049.Last Stone Weight II_1.py
def lastStoneWeightII( stones: List[int]) -> int:
    s = sum(stones)
    m, n = len(stones), s >> 1
    dp = [0] * (n + 1)
    for v in stones:
        for j in range(n, v - 1, -1):
            dp[j] = max(dp[j], dp[j - v] + v)
    return s - dp[-1] * 2
def sample_funcname ( var_0 : List [ int ] ) -> int :
    var_4 = sum ( var_0 )
    var_6 , var_8 = len ( var_0 ) , var_4 >> 1
    var_10 = [ 0 ] * ( var_8 + 1 )
    for var_11 in var_0 :
        for var_13 in range ( var_8 , var_11 - 1 , - 1 ) :
            var_10 [ var_13 ] = max ( var_10 [ var_13 ] , var_10 [ var_13 - var_11 ] + var_11 )
    return var_4 - var_10 [ - 1 ] * 2
