comefrom: <garvit244>1011_2.py
code: 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
masked: def sample_funcname ( var_0 , var_1 ) :
      var_2 , var_3 = max ( var_0 ) , sum ( var_0 )
      while var_2 < var_3 :
          var_4 , var_5 , var_6 = 0 , 0 , True
          var_7 = var_2 + ( ( var_3 - var_2 ) >> 1 )
          for var_8 in var_0 :
              if var_8 > var_7 :
                  var_6 = False
                  break
              if var_4 + var_8 > var_7 :
                  var_5 += 1
                  var_4 = 0
              var_4 += var_8
          if var_6 and var_5 < var_1 :
              var_3 = var_7
          else :
              var_2 = var_7 + 1
      return var_2
  