<doocs>0689.Maximum Sum of 3 Non-Overlapping Subarrays_1.py
def maxSumOfThreeSubarrays( nums: List[int], k: int) -> List[int]:
    s = s1 = s2 = s3 = 0
    mx1 = mx12 = 0
    idx1, idx12 = 0, ()
    ans = []
    for i in range(k * 2, len(nums)):
        s1 += nums[i - k * 2]
        s2 += nums[i - k]
        s3 += nums[i]
        if i >= k * 3 - 1:
            if s1 > mx1:
                mx1 = s1
                idx1 = i - k * 3 + 1
            if mx1 + s2 > mx12:
                mx12 = mx1 + s2
                idx12 = (idx1, i - k * 2 + 1)
            if mx12 + s3 > s:
                s = mx12 + s3
                ans = [*idx12, i - k + 1]
            s1 -= nums[i - k * 3 + 1]
            s2 -= nums[i - k * 2 + 1]
            s3 -= nums[i - k + 1]
    return ans
def sample_funcname ( var_0 : List [ int ] , var_3 : int ) -> List [ int ] :
    var_8 = var_4 = var_5 = var_6 = 0
    var_10 = var_9 = 0
    var_11 , var_12 = 0 , ( )
    var_13 = [ ]
    for var_17 in range ( var_3 * 2 , len ( var_0 ) ) :
        var_4 += var_0 [ var_17 - var_3 * 2 ]
        var_5 += var_0 [ var_17 - var_3 ]
        var_6 += var_0 [ var_17 ]
        if var_17 >= var_3 * 3 - 1 :
            if var_4 > var_10 :
                var_10 = var_4
                var_11 = var_17 - var_3 * 3 + 1
            if var_10 + var_5 > var_9 :
                var_9 = var_10 + var_5
                var_12 = ( var_11 , var_17 - var_3 * 2 + 1 )
            if var_9 + var_6 > var_8 :
                var_8 = var_9 + var_6
                var_13 = [ * var_12 , var_17 - var_3 + 1 ]
            var_4 -= var_0 [ var_17 - var_3 * 3 + 1 ]
            var_5 -= var_0 [ var_17 - var_3 * 2 + 1 ]
            var_6 -= var_0 [ var_17 - var_3 + 1 ]
    return var_13
