<doocs>1588.Sum of All Odd Length Subarrays_1.py
def sumOddLengthSubarrays( arr: List[int]) -> int:
    n = len(arr)
    presum = [0] * (n + 1)
    for i in range(n):
        presum[i + 1] = presum[i] + arr[i]
    
    res = 0
    for i in range(n):
        for j in range(0, n, 2):
            if i + j < n:
                res += presum[i + j + 1] - presum[i]
    return res
def sample_funcname ( var_0 : List [ int ] ) -> int :
    var_4 = len ( var_0 )
    var_7 = [ 0 ] * ( var_4 + 1 )
    for var_9 in range ( var_4 ) :
        var_7 [ var_9 + 1 ] = var_7 [ var_9 ] + var_0 [ var_9 ]
    var_10 = 0
    for var_9 in range ( var_4 ) :
        for var_12 in range ( 0 , var_4 , 2 ) :
            if var_9 + var_12 < var_4 :
                var_10 += var_7 [ var_9 + var_12 + 1 ] - var_7 [ var_9 ]
    return var_10
