<doocs>0016.3Sum Closest_1.py
def twoSumClosest(nums, start, end, target):
    res = 0
    diff = 10000
    while start < end:
        val = nums[start] + nums[end]
        if val == target:
            return val
        if abs(val - target) < diff:
            res = val
            diff = abs(val - target)
        if val < target:
            start += 1
        else:
            end -= 1
    return res
def sample_funcname ( var_0 , var_1 , var_2 , var_3 ) :
    var_5 = 0
    var_7 = 10000
    while var_1 < var_2 :
        var_8 = var_0 [ var_1 ] + var_0 [ var_2 ]
        if var_8 == var_3 :
            return var_8
        if abs ( var_8 - var_3 ) < var_7 :
            var_5 = var_8
            var_7 = abs ( var_8 - var_3 )
        if var_8 < var_3 :
            var_1 += 1
        else :
            var_2 -= 1
    return var_5
