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))
	}
}

C++: #include <stdio.h>

int main(void)	{
	
	int n, s, smax, smin, ssum, mean;
	
	while (true)	{
		
		scanf("%d", &n);
		
		if (n == 0)	{
			break;
		}
		
		smax = 0;
		smin = 1000;
		ssum = 0;
		
		for (int i = 1; i <= n; i++)	{
			
			scanf("%d", &s);
			
			if (smax < s)	{
				smax = s;
			}
			if (smin > s)	{
				smin = s;
			}
			
			ssum += s;
		}
		
		mean = (ssum - smax - smin) / (n - 2);
		
		printf("%d\n", mean);
	}
	
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;

int main() {
	int n, data;
	while(1) {
		scanf("%d", &n);
		if (n == 0) break;
		int sum=0, max=0, min=1001;
		for (int i=0; i<n; i++) {
			scanf("%d", &data);
			sum+=data;
			if (max < data) max=data;
			if (data < min) min=data;
		}
		printf("%d\n", (sum-max-min)/(n-2));
	}
}

C++: //ICPC Score Totalizer Software
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)

int main(){
  int n;
  while(true){
    cin>>n;
    if(n==0)break;
    int sum=0;
    vector<int> v;
    rep(i,n){
      int tmp;
      cin>>tmp;
      sum+=tmp;
      v.push_back(tmp);
    }
    sort(v.begin(), v.end());
    cout<<(sum-v[0]-v[n-1])/(n-2)<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    int n;
    while (cin>>n,n) {
        vector<int> a(n);
        rep(i,n) cin>>a[i];
        sort(a.begin(), a.end());
        ll ans = 0;
        for (int i = 1; i < n-1; ++i) {
            ans += a[i];
        }
        cout << ans/(n-2) << endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int n;
	int max;
	int min;
	int y[20] = { 0 };

	n = 1;
		int j = 0;
		while (1){
			
			cin >> n;
			if (n == 0) break;
			max = 0;
			min = 1000;
			for (int i = 0; i < n; i++){
				int x[1000] = { 0 };
				cin >> x[i];

				if (max < x[i]) max = x[i];
				if (min > x[i]) min = x[i];
				y[j] += x[i];
			}
			y[j] = y[j]-max - min;
			y[j] = y[j] / (n - 2);
			j++;
		}
	for (int k = 0; k < j; k++){
		cout << y[k]<< endl ;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;

void score(int x){
    int n;
    int point[21];
    int ave = 0;

    n = x;
    for(int i=0;i<n;i++) cin >> point[i];
    sort(point,point+n);
    for(int i=1;i<n-1;i++){
        ave += point[i];
    }
    cout << ave / (n - 2) << endl;
}

int main(){
    int x;
    while(x != 0){
        cin >> x;
        score(x);
    }
    
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
using namespace std;
int main(){
	int n;
	while(cin>>n,n){
		int a=10000,b=-1,sum=0;
		for(int i=0;i<n;i++){
			int s;
			cin>>s;
			sum+=s;
			a=min(a,s);
			b=max(b,s);
		}
		cout<<(sum-a-b)/(n-2)<<endl;
	}
}

C++: # include <algorithm>
# include <cassert>
# include <cctype>
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <cmath>
# include <iostream>
# include <map>
# include <queue>
# include <set>
# include <sstream>
# include <stack>
# include <string>
# include <vector>
# include <iomanip>

# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)

using namespace std;


int main() {
  int n;

  while (cin >> n && n) {
    vector<int> scr(n);
    for (int i=0; i<n; i++) {
      cin >> scr[i];
    }

    int  sum = 0;
    int _max = scr[0];
    int _min = scr[0];

    for (int s : scr) {
      sum  += s;
      _min = min(_min, s);
      _max = max(_max, s);
    }

    sum -= _max;
    sum -= _min;

    cout << sum / (n-2) << endl;
  }

  return 0;
}