-1 (in past), 1d, 4d, 1w, 2w, 1m, 2m, -
481714
private String getUpfrontReservationTime(Long dateInMillis) {
        DateTime now = new DateTime(DateTimeZone.forTimeZone(TimeZone.getTimeZone("UTC")));
        DateTime event = new DateTime(dateInMillis, DateTimeZone.forTimeZone(TimeZone.getTimeZone("UTC")));
        Duration duration = new Duration(now, event);

        if (duration.getMillis() < 0) {
            return "-1";
        } else if (duration.getStandardSeconds() < 86400) {
            return "1d";
        } else if (duration.getStandardDays() < 4) {
            return "4d";
        } else if (duration.getStandardDays() < 7) {
            return "1w";
        } else if (duration.getStandardDays() < 14) {
            return "2w";
        } else if (duration.getStandardDays() < 28) {
            return "4w";
        } else if (duration.getStandardDays() < 56) {
            return "8w";
        } else {
            return "-";
        }
    }
1309969
public boolean previous()
	{
		if( indexes.length <= 1 || permutation <= 0 )
			return false;

		int N = indexes.length-2;
		int k = N;

		while( counters[k] <= k ) {
			k--;
		}

		swap(counters[k], k);
		counters[k]--;
		swap(k, counters[k]);
		int foo = k+1;
		while( counters[k+1] == k+1 && k < indexes.length-2) {
			k++;
			swap(k, indexes.length-1);
		}

		for (int i = foo; i < indexes.length - 1; i++) {
			counters[i] = indexes.length - 1;
		}

		permutation--;
		return true;
	}
1276182
function ( t, p0, p1, p2, p3 ) {

		return - 3 * p0 * ( 1 - t ) * ( 1 - t )  +
			3 * p1 * ( 1 - t ) * ( 1 - t ) - 6 * t * p1 * ( 1 - t ) +
			6 * t *  p2 * ( 1 - t ) - 3 * t * t * p2 +
			3 * t * t * p3;

	}
1142395
public static long nextPowOf2(long v) {
        v--;
        v |= v >> 1;
        v |= v >> 2;
        v |= v >> 4;
        v |= v >> 8;
        v |= v >> 16;
        v++;
        return v;

    }
1355715
def enbw(wnd):
  
  return sum(el ** 2 for el in wnd) / sum(wnd) ** 2 * len(wnd)
866529
def dBinaryRochedy (r, D, q, F):
    
    return -r[1]*(r[0]*r[0]+r[1]*r[1]+r[2]*r[2])**-1.5 -q*r[1]*((r[0]-D)*(r[0]-D)+r[1]*r[1]+r[2]*r[2])**-1.5 + F*F*(1+q)*r[1]
433322
function(n) {
      return {
        x1: n.x - n.size,
        y1: n.y - n.size,
        x2: n.x + n.size,
        y2: n.y - n.size,
        height: n.size * 2
      };
    }
1111049
def recenter(positions):
    '''
    '''
    (x0, y0, z0), (x1, y1, z1) = bounding_box(positions)
    dx = x1 - (x1 - x0) / 2.0
    dy = y1 - (y1 - y0) / 2.0
    dz = z1 - (z1 - z0) / 2.0
    result = []
    for x, y, z in positions:
        result.append((x - dx, y - dy, z - dz))
    return result
109169
private static Short[] short2DToShort( short[][] dd )
    {
        Short[] d = new Short[ dd.length*dd[0].length ];
        for ( int n = 0; n < dd[0].length; n++ )
        {
            for ( int m = 0; m < dd.length; m++ )
            {
                d[ m+n*dd.length ] = dd[m][n]; 
            }
        }
        return d;
    }
1294194
def wye_to_delta(z1,z2,z3):
    """"""
    summand = z1*z2 + z2*z3 + z3*z1
    return (summand/z2,summand/z1,summand/z3)
629715
function () {
    var tmp = this.elements[0*4+1];
    this.elements[0*4+1] = this.elements[1*4+0];
    this.elements[1*4+0] = tmp;

    tmp = this.elements[0*4+2];
    this.elements[0*4+2] = this.elements[2*4+0];
    this.elements[2*4+0] = tmp;

    tmp = this.elements[0*4+3];
    this.elements[0*4+3] = this.elements[3*4+0];
    this.elements[3*4+0] = tmp;

    tmp = this.elements[1*4+2];
    this.elements[1*4+2] = this.elements[2*4+1];
    this.elements[2*4+1] = tmp;

    tmp = this.elements[1*4+3];
    this.elements[1*4+3] = this.elements[3*4+1];
    this.elements[3*4+1] = tmp;

    tmp = this.elements[2*4+3];
    this.elements[2*4+3] = this.elements[3*4+2];
    this.elements[3*4+2] = tmp;

    return this;
  }
1365067
def merge_moments(m_a, m_a2, m_a3, m_a4, n_a, m_b, m_b2, m_b3, m_b4, n_b):
    '''
    
    '''
    delta = m_b - m_a
    delta_2 = delta * delta
    delta_3 = delta * delta_2
    delta_4 = delta * delta_3
    n_x = n_a + n_b
    m_x = m_a + delta * n_b / n_x
    m_x2 = m_a2 + m_b2 + delta_2 * n_a * n_b / n_x
    m_x3 = m_a3 + m_b3 + delta_3 * n_a * n_b * (n_a - n_b) + 3 * delta * (n_a * m_2b - n_b * m_2a) / n_x
    m_x4 = (m_a4 + m_b4 + delta_4 * (n_a * n_b * (n_a * n_a - n_a * n_b + n_b * n_b)) / (n_x ** 3) +
            6 * delta_2 * (n_a * n_a * m_b2 + n_b * n_b * m_a2) / (n_x ** 2) +
            4 * delta * (n_a * m_b3 - n_b * m_a3) / n_x )
    return m_x, m_x2, m_x3, m_x4, n_x
450239
function transpose (M) {
	return (
		[[M[0][0], M[1][0], M[2][0]],
		 [M[0][1], M[1][1], M[2][1]],
		 [M[0][2], M[1][2], M[2][2]]]
	);
}
290834
private void fillM( Point2D_F64 x1 , Point2D_F64 x2 , Point2D_F64 x3 ) {
		M.data[0] = x1.x; M.data[1] = x1.y; M.data[2] = 1;
		M.data[3] = x2.x; M.data[4] = x2.y; M.data[5] = 1;
		M.data[6] = x3.x; M.data[7] = x3.y; M.data[8] = 1;
	}
1151056
function w3calgo(s, d) {
        var carry, temp, tempDays, e = {};
        //months
        temp = s.M + d.M;
        e.M = modulo(temp, 1, 13);
        carry = fQuotient(temp, 1, 13);
        // years
        e.Y = s.Y + d.Y + carry;
        // zone
        // e.Z = s.Z;
        // seconds 
        temp = s.S + d.S;
        e.S = modulo(temp, 60);
        carry = fQuotient(temp, 60);
        // minutes
        temp = s.m + d.m + carry;
        e.m = modulo(temp, 60);
        carry = fQuotient(temp, 60);
        // hours	
        temp = s.H + d.H + carry;
        e.H = modulo(temp, 24);
        carry = fQuotient(temp, 24);
        // days
        if (s.D > maximumDayInMonthFor(e.Y, e.M)) {
            tempDays = maximumDayInMonthFor(e.Y, e.M);
        } else if (s.D < 1) {
            tempDays = 1;
        } else {
            tempDays = s.D;
        }
        e.D = tempDays + d.D + carry;
        // start loop
        while (true) {
            if (e.D < 1) {
                e.D = e.D + maximumDayInMonthFor(e.D, e.M - 1);
                carry = -1;
            } else if (e.D > maximumDayInMonthFor(e.Y, e.M)) {
                e.D = e.D - maximumDayInMonthFor(e.Y, e.M);
                carry = 1;
            } else {
                break;
            }
            temp = e.M + carry;
            e.M = modulo(temp, 1, 13);
            e.Y = e.Y + fQuotient(temp, 1, 13);
        }
        e.Y = e.Y | 0;
        // in js dates month start at 0.
        e.M = e.M - 1 | 0;
        e.D = e.D | 0;
        e.H = e.H | 0;
        e.m = e.m | 0;
        e.S = e.S | 0;
        return new Date(e.Y, e.M, e.D, e.H, e.m, e.S);
    }
205430
def _recenter(self):
        
        for split_idx in range(len(self._splits)):
            split = self._splits[split_idx]
            len_idx = self._split2len_idx[split]
            if split == self._splits[-1]:
                continue
            right_split = self._splits[split_idx + 1]

            # Try shifting the centroid to the left
            if len_idx > 0 and self._lengths[len_idx - 1] not in self._split_cntr:
                new_split = self._lengths[len_idx - 1]
                left_delta = self._len_cntr[split] * (right_split - new_split) - self._split_cntr[split] * (
                        split - new_split)
                if left_delta < 0:
                    self._splits[split_idx] = new_split
                    self._split2len_idx[new_split] = len_idx - 1
                    del self._split2len_idx[split]
                    self._split_cntr[split] -= self._len_cntr[split]
                    self._split_cntr[right_split] += self._len_cntr[split]
                    self._split_cntr[new_split] = self._split_cntr[split]
                    del self._split_cntr[split]

            # Try shifting the centroid to the right
            elif len_idx < len(self._lengths) - 2 and self._lengths[len_idx + 1] not in self._split_cntr:
                new_split = self._lengths[len_idx + 1]
                right_delta = self._split_cntr[split] * (new_split - split) - self._len_cntr[split] * (
                        new_split - split)
                if right_delta <= 0:
                    self._splits[split_idx] = new_split
                    self._split2len_idx[new_split] = len_idx + 1
                    del self._split2len_idx[split]
                    self._split_cntr[split] += self._len_cntr[split]
                    self._split_cntr[right_split] -= self._len_cntr[split]
                    self._split_cntr[new_split] = self._split_cntr[split]
                    del self._split_cntr[split]
1326228
function (m, n) {
      n %= 64
      if (n === 32) {
        return [m[1], m[0]]
      } else if (n < 32) {
        return [(m[0] << n) | (m[1] >>> (32 - n)), (m[1] << n) | (m[0] >>> (32 - n))]
      } else {
        n -= 32
        return [(m[1] << n) | (m[0] >>> (32 - n)), (m[0] << n) | (m[1] >>> (32 - n))]
      }
    }