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 <bits/stdc++.h>

using namespace std;

int main()
{
	int n;

	while (scanf("%d", &n), n){
		vector<int> v;

		for (int i = 0; i < n; i++){
			int s;

			scanf("%d", &s);

			v.push_back(s);
		}

		sort(v.begin(), v.end());

		v[0] = v[n - 1] = 0;

		int sum = 0;

		for (int i = 0; i < n; i++){
			sum += v[i];
		}

		printf("%d\n", sum / (n - 2));
	}

	return (0);
}

C++: #include <iostream>
using namespace std;
int main(){
    int a, b, c, d, max, min;
    
    while(1){c = 0;
        max = 0;
        min = 2000000000;
        cin >> a;
        if(a == 0){break;}
        for(int i=0;i<a;i++){
            cin >> b;
            if(b>max){
                max = b;
            }
            if(b<min){
                min = b;
            }
            c = c + b;
        }
        c = c - max - min;
        d = c / (a-2);
        cout << d << endl;
    }
    
    
    
    
    
    
    return 0;

}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
  int n;
  int point[20], average;
  
  while(1){
    average = 0;
    cin >> n;
    if(n < 3) break;

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

C++: #include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int n = -1;

	vector<int> score;

	while (true)
	{
		int sum = 0;

		cin >> n;

		if (n == 0) { break; }

		vector<int> D(n);

		for (int i = 0; i < n; ++i)
		{
			cin >> D[i];

			sum += D[i];
		}

		sum -= *max_element(D.begin(), D.end());
		sum -= *min_element(D.begin(), D.end());

		score.push_back(static_cast<int>(sum / (D.size() - 2) + 0.5));
	}

	for (int i = 0; i < score.size(); i++)
	{
		cout << score[i] << endl;
	}

	return 0;
}

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

int main()
{
	int N, n, sum, largest, smallest;
	sum  = 0; largest = 0; smallest = 1000;
	
	while(cin >> N && N>0){
		for(int i = 0; i<N; i++)
		{
			cin >> n;
			sum += n;
			
			if(smallest > n){ smallest = n;}
			if(largest < n){ largest = n;}
		}
	
		cout << (sum-smallest-largest)/(N-2) << endl;
	}
}

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

int main() {
int i,n,x,y,a[20],ans;
	while(1){
		scanf("%d",&n);
		if(n == 0)break;
		x = 0;
		y = 0;
		ans = 0;
		for(i=0;i<n;i++){
			scanf("%d",&a[i]);
		if(a[x] < a[i])x = i;
		if(a[y] > a[i])y = i;
			ans += a[i];
		}
		ans = ans - a[x] - a[y];
		ans = ans / (n-2);
		printf("%d\n",ans);
	}
	return 0;
}

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

int main(){
        int i = 0;
        
        while(cin >> i && !(i == 0)){
                int a[i];
                int j = 0;              

                for(j=0; j<i; j++){
                        cin >> a[j];
                }
        
                //sum
                int sum = 0;
                for (j=0; j<i; j++) {
                        sum += a[j];
                }
        
                //largest,smallest
                int largest = 0;
                int smallest = 1000;
                for (j=0; j<i; j++){
                        if (a[j] > largest)
                                largest = a[j];
                        if (a[j] < smallest)
                                smallest = a[j];
                }
                
                //average
                int average = 0;
                average = (sum - largest - smallest) / (i - 2);
                cout << average << endl;
        }

}

C++: #include <iostream>

int main()
{

    while(1) {
        int judgeNum = 0;
        int pointSum = 0;
        int maximumPoint = 0;
        int minimumPoint = 1000;

        std::cin >> judgeNum;
        if (judgeNum == 0) {
            break;
        }

        for(int i = 0; i < judgeNum; i++) {
            int point;
            std::cin >> point;
            if(point > maximumPoint) {
                maximumPoint = point;
            }

            if (point < minimumPoint) {
                minimumPoint = point;
            }
            pointSum += point;
        }

        int answerSum = pointSum - maximumPoint - minimumPoint;

        std::cout << answerSum / (judgeNum - 2) << std::endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<random>
#include<string>
typedef long long ll;
using namespace std;
int main(){
  ll N;
  ll s[1100];
  ll sum=0;
  ll t=0;
  while(t<=20){
  s++;
  cin >> N;
  for(ll i = 0; i < N; ++i;){
      cin >> s[i];
  }
  sort(s,s+N);
  for(ll i = 1; i < N-1; ++i){
    sum+=s[i];
  }
  cout<<sum/(N-2)<<endl;
}
}

C++: #include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main(int, char**){
	int n;
	vector<int> ret;
	while(0){
		int n,buf;
		vector<int> scores;
		cin >> n;
		if(n == 0) break;

		for(int i = 0; i < n; ++i){
			cin >> buf;
			scores.push_back(buf);
		}
		ret.push_back(accumulate(scores.begin(), scores.end(), 0) / scores.size());
	}

	for(int av : ret){
		cout << av << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

typedef vector <int> VI;
typedef vector <VI> VVI;
typedef vector <string> VS;
typedef pair<int,int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int, LL> PIL;
typedef vector <PIL> VPIL;


#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define sort(c) sort((c).begin(),(c).end())

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

#define MAX_INT 2147483647

int main(){
	int n, s, total;
	int max_s, min_s;
	while (1){
		cin >> n;
		if (!n) break;
		total = 0; max_s = 0; min_s= 1000; 
		rep(i,n){
			cin >> s;
			total += s;
			max_s = max(s, max_s);
			min_s = min(s, min_s);
		} 
		cout << (total - max_s - min_s) / (n-2) << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>

using namespace std;

int main() {
	while (1) {
		int n;
		cin >> n;
		if (n == 0)break;
		int M = 0, m = 2525;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			int a;
			cin >> a;
			M = max(a, M), m = min(a, m);
			cnt += a;
		}

		cout << (cnt - M - m) / (n - 2) << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int N;
    while (cin >> N, N) {
        int a, maxi = 0, mini = 1000, sum = 0;
        for (int i = 0; i < N; i++) {
            cin >> a;
            maxi = max(maxi, a);
            mini = min(mini, a);
            sum += a;
        }
        cout << (sum - maxi - mini) / (N - 2) << endl;
    }
    return 0;
}