<garvit244>1011_2.py
def shipWithinDays( weights, D):
    left, right = max(weights), sum(weights)
    
    while left < right:
        curr_sum, groups, invalid = 0, 0, True
        mid = left + ((right-left) >> 1)
        for weight in weights:
            if weight > mid:
                invalid = False
                break
            if curr_sum + weight > mid:
                groups += 1
                curr_sum = 0
            curr_sum += weight
        if invalid and groups < D:
            right = mid
        else:
            left = mid + 1
    return left
def sample_funcname ( var_0 , var_1 ) :
    var_3 , var_5 = max ( var_0 ) , sum ( var_0 )
    while var_3 < var_5 :
        var_7 , var_8 , var_10 = 0 , 0 , True
        var_12 = var_3 + ( ( var_5 - var_3 ) >> 1 )
        for var_13 in var_0 :
            if var_13 > var_12 :
                var_10 = False
                break
            if var_7 + var_13 > var_12 :
                var_8 += 1
                var_7 = 0
            var_7 += var_13
        if var_10 and var_8 < var_1 :
            var_5 = var_12
        else :
            var_3 = var_12 + 1
    return var_3
