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;

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int main() {

  for(int n;cin>>n,n;) {
    vector<int> a(n);
    for (int m=n;m--;) cin >> a[m];
    sort(all(a));
    int t=0;
    for (int m=n-1;--m;) t+=a[m];
    cout<<t/(n-2)<<endl;
  }

  return 0;
}

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

using namespace std;

int main(){
    int N,sum,mn,mx;
    
    while(true){
        scanf("%d",&N);
        
        if(N == 0) break;
        
        sum = 0;
        mn = 1000;
        mx = 0;
        
        for(int i = 0,a;i < N;++i){
            scanf("%d",&a);
            
            sum += a;
            mn = min(mn,a);
            mx = max(mx,a);
        }
        
        printf("%d\n",(sum - mn - mx) / (N - 2));
    }
    
    return 0;
}

C++: #include<stdio.h>

int main(void){
    while(1){
        int n;
        scanf("%d",&n);
        if(n == 0)
            break;

        int p[n];
        for(int i = 0;i < n;i++){
            scanf("%d",&p[i]);
        }

        int sum = 0,min = 100000,max = -1;
        for(int i = 0;i < n;i++){
            if(min > p[i])
                min = p[i];
            if(max < p[i])
                max = p[i];

            sum += p[i];
        }
        sum -= min + max;

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

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

using namespace std;

int main() {
	int n;
	cin >> n;

	while (n != 0) {
		vector<int> point(n);
		for (int i = 0; i < n; i++) cin >> point[i];

		sort(point.begin(), point.end());
		int sum = 0;
		for (int i = 1; i < n - 1; i++) sum += point[i];

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

		cin >> n;
	}

	return 0;
}

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

const int MAX_N = 100;

int max(int n, int a[]){
  int j, k = 0;

  for(j = 0; j < n; j++){
    if(a[j] > k){
      k = a[j];
    }
  }

  return k;
}

int min(int n, int b[]){
  int j, k = 100000000;

  for(j = 0; j < n; j++){
	if (b[j] < k) {
		k = b[j];
	}
  }

  return k;
}



int main(){
  int n, s[MAX_N], max_num, min_num, sum = 0, ave;

  while(scanf("%d", &n), n != 0){
    for(int i = 0;i < n; i++){
      cin >> s[i]; 
    }

    max_num = max(n, s);
    min_num = min(n, s);

    sum = 0;
    for(int l = 0; l < n; l++){
      sum = sum + s[l];
    }

    sum = sum - max_num - min_num;
    ave = sum / (n - 2);

    cout << ave << endl;
  }
    return 0;
}

C++: int main()
{
    int n;
    while(1){
        cin >> x;
        if(x == 0) break;
        int max = -1, mini = 10000, sum = 0, ten = 0, y = 0;
        for(int i = 0; i < n; i++){
            cin >> ten;
            sum += ten;
            if(ten > max) max = ten;
            if(ten < mini) mini = ten;
        }
        sum -= max + mini;
        y = sum / (x - 2);
        cout << y << endl;
    }
    return 0;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

int main(){
  int n;
  while(1){
    cin >> n;
    if(n==0) return 0;
    vector<int> s(n);
    for(int i=0;i<n;i++){
      cin >> s[i];
    }
    sort(s.begin(),s.end());
    int ans=0;
    for(int i=1;i<n-1;i++){
      ans+=s[i];
    }
    cout << ans/(n-2) << endl;
  }
  return 0;
}

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

int n;

int main() {
  while (1) {
    scanf("%d", &n);
    if (n == 0) return 0;

    int sum = 0;
    int max_s = -1;
    int min_s = 1001;
    for (int i=0; i<n; i++) {
      int s;
      scanf("%d", &s);
      sum += s;
      max_s = max(max_s, s);
      min_s = min(min_s, s);
    }

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

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

using namespace std;

int main(void){
    while(1){
        int n; cin >> n;
        if(n == 0) break;

        int max_s = 0, min_s = 1000, sum = 0;
        for(int i = 0; i < n; i++){
            int s; cin >> s;
            
            max_s = max(max_s, s);
            min_s = min(min_s, s);
            sum  += s;
        }

        cout << sum - min_s - max_s << endl;
    }

    return 0;
}

C++: #include <iostream>

int main()
{
    int n;
    while(1){
        std::cin >> n;
        if(n == 0){
            break;
        }
        int score[n];
        int sum = 0;
        int max = 0;
        int min = 1000;
        for(int i = 0; i < n; i++){
            std::cin >> score[i];
            if(max < score[i]){
                max = score[i];
            }
            if(min > score[i]){
                min = score[i];
            }
            sum += score[i];
        }
        int average;
        average = (sum - max - min) / (n - 2);
        std::cout << average << std::endl;
    }
    return 0;
}

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

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

using namespace std;

int n;
int s[102];
void solve() {
    int mini = 10000;
    int maxi = -1;
    int ans = 0;
    rep(i, n) {
        if (s[i] < mini) mini = s[i];
        if (s[i] > maxi) maxi = s[i];
        ans += s[i];
    }
    ans -= mini;
    ans -= maxi;

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

int main() {
    while (cin >> n) {
        if (n == 0) break;
        rep(i, n) cin >> s[i];
        solve();
    }
}

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

int N;
int S[100];

int main() {
  while (cin >> N) {
    if (N == 0) break;
    for (int i=0; i<N; i++) cin >> S[i];
    sort(S, S+N);
    int s = 0;
    for (int i=1; i<N-1; i++) s += S[i];
    cout << s / (N-2) << "\n";
  }
  return 0;
}

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

int main(){
	while(1){
		int n, av, max, min, sum = 0,s;
		cin>>n;
		if(n == 0) break;
			cin>>s;
			sum = s;
			max = s;
			min = s;
		for(int i = 1; i < n; i++){
			cin>>s;
			sum += s;
			if(s > max) max = s;
			if(s < min) min = s;
		}
		av = (sum - max - min)/ n - 2;
		cout<<av<<endl;
	}
	
	return 0;
}

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

int main(){
  int n, data, max,min;
  int sum;

  while( cin>>n,n ){
    min = 10000, max = -1;
    sum = 0;
    for( int i=0;i<n;i++ ){
      cin >> data;
      if( data>max ) max = data;
      if( data<min ) min = data;
      sum += data;
    }
    sum = sum - max -min;
    cout << sum/(n-2) << endl;
  }

  return 0;
}