Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for {
		num := nextInt(sc)
		if num == 0 {
			break
		}

		score_list := []int{}
		for i := 0; i < num; i++ {
			score_list = append(score_list, nextInt(sc))
		}
		// 得点リストをソートした後、最低点と最高点を取り除く(3 ≤ n ≤ 100)
		sort.Sort(sort.IntSlice(score_list))
		score_list = score_list[1 : len(score_list)-1]
		// 得点リストの得点を合計し、スライスの個数で割って平均点を出す
		sum := 0
		for _, score := range score_list {
			sum += score
		}
		fmt.Println(sum / len(score_list))
	}
}

Python: while True:
    N = int(input())
    if N == 0:
        break
    
    s = [0 for i in range(N)]
    for i in range(N):
        s[i] = int(input())
    print((sum(s) - max(s) - min(s)) // (N - 2))

Python: while True:
    x = int(input())
    if x == 0: break
    y = []
    for i in range(x):
        y.append(int(input()))
    print((sum(y)-max(y)-min(y))//(len(y)-2))

Python: import sys

while 1:
    n = int(sys.stdin.readline().rstrip())

    if n == 0:
        break

    scores = [int(sys.stdin.readline().rstrip()) for i in range(n)]
    ans = (sum(scores) - (max(scores) + min(scores))) // (n - 2)

    print(ans)

Python: while True:
    n=int(input())
    if n == 0 : break
    a,b,c=0,1001,-1
    for i in range(n):
        m=int(input())
        b=min(b,m)
        c=max(c,m)
        a+=m
    print((a-b-c)//(n-2))

Python: while True:
  n = input();
  if n == 0:
    break;
  a = []
  for i in range(n):
    a.append(input());
  print (sum(a) - min(a) - max(a)) / (len(a) - 2)

Python: while True:
    n=int(input())
    x=[]
    if n==0:
        break
    else:
        for i in range(n):
            s=int(input())
            x.append(s)
        a=min(x)
        b=max(x)
        ave=(sum(x)-a-b)/(n-2)
        print(int(ave))

Python: while True:
    n = int(input())
    if n == 0:
        break

    s = [int(input()) for i in range(n)]
    s.sort()
    score = sum(s) - s[0] - s[-1]
    print(score // (n - 2))

Python: from pprint import pprint as pp
from pprint import pformat as pf
import math

def get_data():
    input_data = int(input())
    return input_data

def make_score_list(referee_num):
    score_list = [None] * referee_num
    for i in range(referee_num):
        score_list[i] = get_data()
    return score_list

def calculate_adjusted_average(score_list, referee_num):
    referee_num -= 2
    adjusted_average = (sum(score_list) - max(score_list) - min(score_list)) / referee_num
    return adjusted_average


if __name__ == "__main__":
    while True:
        referee_num = get_data()
        if referee_num == 0:
            break
        score_list = make_score_list(referee_num)
        adjusted_average = math.floor(calculate_adjusted_average(score_list, referee_num))
        print(adjusted_average)

Python: while True:
    n = int(input())
    if n == 0:
        break
    i = [int(input()) for i in range(n)]
    print((sum(i) - min(i) - max(i)) // (n - 2))

Python: import math
while True:
    n = int(input())
    if n == 0 :
        break
    sum = []
    for i in range(n):
        x = int(input())
        sum.append(x)
    sum.sort()
    del sum[n-1]
    del sum[0]
    rsum = 0
    for i in range(n-2):
        rsum = rsum + sum[i]
    average = rsum/(n-2)
    result = math.floor(average)
    print(result)