<doocs>0134.Gas Station_1.py
def canCompleteCircuit( gas: List[int], cost: List[int]) -> int:
    n = len(gas)
    i = j = n - 1
    cnt = s = 0
    while cnt < n:
        s += gas[j] - cost[j]
        cnt += 1
        j = (j + 1) % n
        while s < 0 and cnt < n:
            i -= 1
            s += gas[i] - cost[i]
            cnt += 1
    return -1 if s < 0 else i
def sample_funcname ( var_0 : List [ int ] , var_3 : List [ int ] ) -> int :
    var_5 = len ( var_0 )
    var_8 = var_6 = var_5 - 1
    var_11 = var_9 = 0
    while var_11 < var_5 :
        var_9 += var_0 [ var_6 ] - var_3 [ var_6 ]
        var_11 += 1
        var_6 = ( var_6 + 1 ) % var_5
        while var_9 < 0 and var_11 < var_5 :
            var_8 -= 1
            var_9 += var_0 [ var_8 ] - var_3 [ var_8 ]
            var_11 += 1
    return - 1 if var_9 < 0 else var_8
