Returns the median value of the array of ints
189856
public static double median(int[] values) {
        if (values.length == 0)
            throw new IllegalArgumentException("No median in an empty array");        
        int[] sorted = Arrays.copyOf(values, values.length);
        Arrays.sort(sorted);
        return sorted[sorted.length/2];
    }
1243958
public static function median($arr)
    {
        $vals = array_values($arr);
        sort($vals);
        
        $num_vals = count($vals);
        return ($num_vals % 2)
            ? ($vals[$num_vals / 2] + $vals[($num_vals / 2) + 1]) / 2
            : $vals[($num_vals + 1) / 2];
    }
768336
function median(input) {
                if (!Array.isArray(input)) {
                    throw new Error('input must be an array');
                }

                if (input.length === 0) {
                    throw new Error('input must not be empty');
                }

                return medianQuickselect_min(input.slice());
            }
1313849
public static /*@pure@*/ int minIndex(int[] ints) {

    int minimum = 0;
    int minIndex = 0;

    for (int i = 0; i < ints.length; i++) {
      if ((i == 0) || (ints[i] < minimum)) {
	minIndex = i;
	minimum = ints[i];
      }
    }

    return minIndex;
  }
911760
function getMaxSumStack(arr) { //here!!!
    let maxValue = Number.MIN_VALUE;
    arr
      .forEach((d) => {
        let stackSum = computeArrayValueSum(d);
        if (stackSum > maxValue) {
          maxValue = stackSum;
        }
      });
      return maxValue;
  }
786409
function stat(fn, n) {
	var n2 = n,
		times = [],
		sum = 0,
		t, avg, median
	while (n2--) {
		t = fn()
		sum += t
		times.push(t)
	}
	avg = sum / n
	times.sort(function (a, b) {
		return a - b
	})
	median = times[Math.floor(times.length / 2)]
	if (times.length % 2 === 0) {
		median = (median + times[times.length / 2 - 1]) / 2
	}
	return {
		avg: avg,
		median: median
	}
}
303616
def index_nearest(array, value):
    
    idx = (np.abs(array-value)).argmin()
    return idx
1332953
public static int min(IntArrayND array)
    {
        return array.stream().parallel().reduce(
            Integer.MAX_VALUE, Math::min);
    }
831925
public static int Median( int[] values ){
        int total = 0, n = values.length;

        // for all values
        for ( int i = 0; i < n; i++ )
        {
            // accumalate total
            total += values[i];
        }

        int halfTotal = total / 2;
        int median = 0, v = 0;

        // find median value
        for ( ; median < n; median++ )
        {
            v += values[median];
            if ( v >= halfTotal )
                break;
        }

        return median;
    }
932664
def median(self):
        
        return round(float(np.median(self.array)), self.precision)\
            if len(self.array) else None
954425
public static <T> Collector<T, ?, Optional<T>> median(Comparator<? super T> comparator) {
        return percentile(0.5, comparator);
    }
902170
def median(numbers):
    

    # Sort the list and take the middle element.
    n = len(numbers)
    copy = sorted(numbers)
    if n & 1:  # There is an odd number of elements
        return copy[n // 2]
    else:
        return (copy[n // 2 - 1] + copy[n // 2]) / 2.0
1156190
public static <T extends Comparable<? super T>> T median(final T[] a) {
        N.checkArgNotNullOrEmpty(a, "The spcified array 'a' can not be null or empty");

        return median(a, 0, a.length);
    }
169907
public function median(): float
    {
        $a = $this->a;
        $b = $this->b;

        return ($a + $b) / 2;
    }
410725
public static double median (double[] vector) {
        final double[] sorted = vector.clone();
        Arrays.sort(sorted);
        if (vector.length % 2 == 1) {
            return sorted[vector.length / 2];
        }
        return (sorted[vector.length / 2 - 1] + sorted[vector.length / 2]) / 2;
    }
922249
protected function median($values) {
        $count = count($values);

        if ($count === 1) {
            return reset($values);
        }

        $middlevalue = (int)floor(($count - 1) / 2);

        if ($count % 2) {
            // Odd number, middle is the median.
            $median = $values[$middlevalue];
        } else {
            // Even number, calculate avg of 2 medians.
            $low = $values[$middlevalue];
            $high = $values[$middlevalue + 1];
            $median = (($low + $high) / 2);
        }
        return intval($median);
    }
865337
def median(items):
    """"""
    items.sort()
    k = len(items)//2
    if len(items) % 2 == 0:
        return (items[k] + items[k - 1]) / 2
    else:
        return items[k]