when delta = +1, adds an interval [i, k], when delta = -1, removes it
        :complexity: O(log L)
179298
def change(self, i, k, delta):
        
        self._change(1, 0, self.N, i, k, delta)
583905
def _subtract_timedelta(self, delta):
        
        if isinstance(delta, pendulum.Duration):
            return self.subtract(
                years=delta.years,
                months=delta.months,
                weeks=delta.weeks,
                days=delta.remaining_days,
            )

        return self.subtract(days=delta.days)
713460
def increment(self, delta=1, text=None):
        """"""
        return self.update(value=min(self.max, self.value + delta), text=text)
341692
function determineDeltas(sizes, column, step, min, isPercentageBased) {

        var result = sizes.slice(0);

        function generateZeros(array) {
          return Tools.map(array, function () {
            return 0;
          });
        }

        function onOneColumn() {
          var deltas;
          if (isPercentageBased) {
            // If we have one column in a percent based table, that column should be 100% of the width of the table.
            deltas = [100 - result[0]];
          } else {
            var newNext = Math.max(min, result[0] + step);
            deltas = [newNext - result[0]];
          }
          return deltas;
        }

        function onLeftOrMiddle(index, next) {

          var startZeros = generateZeros(result.slice(0, index));
          var endZeros = generateZeros(result.slice(next + 1));
          var deltas;

          if (step >= 0) {
            var newNext = Math.max(min, result[next] - step);
            deltas = startZeros.concat([step, newNext - result[next]]).concat(endZeros);
          } else {
            var newThis = Math.max(min, result[index] + step);
            var diffx = result[index] - newThis;
            deltas = startZeros.concat([newThis - result[index], diffx]).concat(endZeros);
          }

          return deltas;
        }

        function onRight(previous, index) {
          var startZeros = generateZeros(result.slice(0, index));
          var deltas;

          if (step >= 0) {
            deltas = startZeros.concat([step]);
          } else {
            var size = Math.max(min, result[index] + step);
            deltas = startZeros.concat([size - result[index]]);
          }

          return deltas;

        }

        var deltas;

        if (sizes.length === 0) { // No Columns
          deltas = [];
        } else if (sizes.length === 1) { // One Column
          deltas = onOneColumn();
        } else if (column === 0) { // Left Column
          deltas = onLeftOrMiddle(0, 1);
        } else if (column > 0 && column < sizes.length - 1) { // Middle Column
          deltas = onLeftOrMiddle(column, column + 1);
        } else if (column === sizes.length - 1) { // Right Column
          deltas = onRight(column - 1, column);
        } else {
          deltas = [];
        }

        return deltas;
      }
23989
function compareKey(one, two) {
  const delta = one.length - two.length;
  if (delta > 0) {
    return 1;
  }
  if (delta < 0) {
    return -1;
  }
  return one > two ? 1 : -1;
}
460188
def _subtract_timedelta(self, delta):
        
        if isinstance(delta, pendulum.Duration):
            return self.subtract(
                years=delta.years,
                months=delta.months,
                weeks=delta.weeks,
                days=delta.remaining_days,
                hours=delta.hours,
                minutes=delta.minutes,
                seconds=delta.remaining_seconds,
                microseconds=delta.microseconds,
            )

        return self.subtract(
            days=delta.days, seconds=delta.seconds, microseconds=delta.microseconds
        )
550243
private double delta(double y, double bMutationParameter) {
    double rand = randomGenenerator.getRandomValue();
    int it, maxIt;
    it = currentIteration;
    maxIt = maxIterations;

    return (y * (1.0 -
        Math.pow(rand,
            Math.pow((1.0 - it / (double) maxIt), bMutationParameter)
        )));
  }
462221
public int addAndGetHi(int delta) {
        while (true) {
            long encoded = get();
            int hi = getHi(encoded) + delta;
            long update = encodeHi(encoded, hi);
            if (compareAndSet(encoded, update))
                return hi;
        }
    }
432676
def maxEntropy(n,k):
  

  s = float(k)/n
  if s > 0.0 and s < 1.0:
    entropy = - s * math.log(s,2) - (1 - s) * math.log(1 - s,2)
  else:
    entropy = 0

  return n*entropy
1101323
public void plusDays(long delta)
    {
        if (delta != 0)
        {
            long result = getDay() + delta;
            if (result >= 1 && result <= 28)
            {
                setDay((int) result);
            }
            else
            {
                ZonedDateTime zonedDateTime = ZonedDateTime.from(this);
                ZonedDateTime plusDays = zonedDateTime.plusDays(delta);
                set(plusDays);
            }
        }
    }
497744
def tick_deltas
      unless @delta.empty?
        merge_to_db(@delta)
        @tick_delta.concat(@delta.values) if accumulate_tick_deltas
        @delta.clear
      end
      unless @new_delta.empty?
        # We allow @new_delta to contain duplicates but eliminate them here. We
        # can't just allow duplicate delta tuples because that might cause
        # spurious infinite delta processing loops.
        @new_delta.reject! {|key, val| self[key] == val}

        @delta = @new_delta
        @new_delta = {}
      end
      return !(@delta.empty?)
    end
177120
private void del(int k)
	{
		//if(last < 0)    last = sapp[-1] -= (k);
		//else            last = *sapp++ = -(k);

		if(last < 0)    last = sapp[sappPos-1]   -=  (k);
		else            last = sapp[(sappPos++)]  = -(k);
	}
1012040
def choose(n, k):
    
    if 0 <= k <= n:
        ntok = 1
        ktok = 1
        for t in xrange(1, min(k, n - k) + 1):
            ntok *= n
            ktok *= t
            n -= 1
        return ntok // ktok
    else:
        return 0
436653
public void plusMinutes(long delta)
    {
        if (delta != 0)
        {
            long result = getMinute() + delta;
            setMinute((int) Math.floorMod(result, 60));
            plusHours(Math.floorDiv(result, 60));
        }
    }
1145704
public void plusSeconds(long delta)
    {
        if (delta != 0)
        {
            long result = getSecond() + delta;
            setSecond((int) Math.floorMod(result, 60));
            plusMinutes(Math.floorDiv(result, 60));
        }
    }
1348709
private static long specialNStar(final long numSamplesI, final double p, final double delta) {
    final double q, numSamplesF;
    double tot, curTerm;
    long m;
    assertTrue(numSamplesI >= 1);
    assertTrue((0.0 < p) && (p < 1.0));
    assertTrue((0.0 < delta) && (delta < 1.0));
    q = 1.0 - p;
    numSamplesF = numSamplesI;
    // Use a different algorithm if the following isn't true; this one will be too slow, or worse.
    assertTrue((numSamplesF / p) < 500.0);
    curTerm = Math.pow(p, numSamplesF);  // curTerm = posteriorProbability (k, k, p)
    assertTrue(curTerm > 1e-100); // sanity check for non-use of logarithms
    tot = curTerm;
    m = numSamplesI;
    while (tot <= delta) { // this test can fail even the first time
      curTerm = (curTerm * q * (m)) / ((m + 1) - numSamplesI);
      tot += curTerm;
      m += 1;
    }
    // we have reached a state where tot > delta, so back up one
    return (m - 1);
  }
518401
function addInt(x, n) {
  var ans=expand(x, x.length+1);
  addInt_(ans, n);
  return trim(ans, 1);
}