<garvit244>1011_1.py
def shipWithinDays( weights, D):
    high, low = sum(weights)+1, max(weights)
    
    while(low < high):
        mid = (high+low)/2
        temp_left = mid
        packet_at_left = D-1
        for weight in weights:
            if weight <= mid:
                if temp_left < weight:
                    if packet_at_left == 0:
                        low = mid+1
                        break
                    packet_at_left -= 1
                    temp_left = mid-weight
                else:
                    temp_left -= weight
        else:
            high = mid
            
    return low
def sample_funcname ( var_0 , var_1 ) :
    var_4 , var_6 = sum ( var_0 ) + 1 , max ( var_0 )
    while ( var_6 < var_4 ) :
        var_8 = ( var_4 + var_6 ) / 2
        var_9 = var_8
        var_10 = var_1 - 1
        for var_11 in var_0 :
            if var_11 <= var_8 :
                if var_9 < var_11 :
                    if var_10 == 0 :
                        var_6 = var_8 + 1
                        break
                    var_10 -= 1
                    var_9 = var_8 - var_11
                else :
                    var_9 -= var_11
        else :
            var_4 = var_8
    return var_6
