<doocs>1031.Maximum Sum of Two Non-Overlapping Subarrays_1.py
def maxSumTwoNoOverlap( nums: List[int], firstLen: int, secondLen: int) -> int:
    n = len(nums)
    s = [0] * (n + 1)
    for i in range(1, n + 1):
        s[i] = s[i - 1] + nums[i - 1]
    ans1, ans2, fm, sm = 0, 0, 0, 0
    for i in range(n - firstLen - secondLen + 1):
        fm = max(fm, s[i + firstLen] - s[i])
        ans1 = max(fm + s[i + firstLen + secondLen] - s[i + firstLen], ans1)
    for i in range(n - firstLen - secondLen + 1):
        sm = max(sm, s[i + secondLen] - s[i])
        ans2 = max(sm + s[i + firstLen + secondLen] - s[i + secondLen], ans2)
    return max(ans1, ans2)
def sample_funcname ( var_0 : List [ int ] , var_3 : int , var_4 : int ) -> int :
    var_6 = len ( var_0 )
    var_9 = [ 0 ] * ( var_6 + 1 )
    for var_11 in range ( 1 , var_6 + 1 ) :
        var_9 [ var_11 ] = var_9 [ var_11 - 1 ] + var_0 [ var_11 - 1 ]
    var_12 , var_13 , var_14 , var_15 = 0 , 0 , 0 , 0
    for var_11 in range ( var_6 - var_3 - var_4 + 1 ) :
        var_14 = max ( var_14 , var_9 [ var_11 + var_3 ] - var_9 [ var_11 ] )
        var_12 = max ( var_14 + var_9 [ var_11 + var_3 + var_4 ] - var_9 [ var_11 + var_3 ] , var_12 )
    for var_11 in range ( var_6 - var_3 - var_4 + 1 ) :
        var_15 = max ( var_15 , var_9 [ var_11 + var_4 ] - var_9 [ var_11 ] )
        var_13 = max ( var_15 + var_9 [ var_11 + var_3 + var_4 ] - var_9 [ var_11 + var_4 ] , var_13 )
    return max ( var_12 , var_13 )
