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++: int main()
{
	//n: ??????????????°
	int n, point[100], sum = 0, ave = 0, max = 0, min = 0;
	while( cin >> n && n != 0){

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

		sort(point, point + n);

		/*
		for(int i = 0; i < n; i++)
			cout << "Point: " << point[i] << " ";
		cout << endl;*/

		for(int i = 1; i < n-1; i++){
			sum += point[i];
		}
		ave = sum / (n-2);
		//cout << "Ave: ";
		cout << ave << endl;

		sum = 0;
		ave = 0;
		min = 0;
		max = 0;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n);
#define vsort(v) sort(v.begin(),v.end());
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
typedef pair<int,int> p;
typedef pair<ll,ll> lp;
bool is_uruu(int y) {
        return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
}
const ll MOD=1e9+7;
//---------------------------------------------------------------------------//
int n,sum=0;
int a[10000];
int main(){
        while(cin>>n) {
                for(int i=0; i<n; i++) {
                        cin>>a[i];
                }

                sort(a,n);
                for(int i=1; i<n-1; i++) {
                        sum+=a[i];
                }
                cout<<sum/(n-2)<<endl;
        }
}

C++: #include <iostream>

using namespace std;

int main()
{
  int n;
  int max, min, score;
  int s;
  
  while (1) {
    cin >> n;
    if (n == 0) break;

    max = 0;
    min = 1000;
    score = 0;
    for (int i = 0; i < n; i++) {
      cin >> s;
      score += s;
      if (s > max) max = s;
      if (s < min) min = s;
    }
    cout << (score - max - min) / (n - 2) << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }


int main() {
    int n;
    while(1) {
        cin >> n;
        if(n == 0) break;
        vector<int> point(n, 0);
        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;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	while (true) {
		int n; cin >> n;
		if (n == 0) break;
		int score[100];
		rep(i, n) {
			cin >> score[i];
		}
		sort(score, score + n);
		int sum = 0;
		rep(i, n - 2) {
			sum += score[i + 1];
		}
		cout << sum / (n - 2) << endl;
	}

    return 0;
}

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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

typedef pair<int, int> P;

template<class T>bool chmax( T& a, const T& b ) { if( a < b ) { a = b; return 1; } return 0; }
template<class T>bool chmin( T& a, const T& b ) { if( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
  int N, sum;
  while( cin >> N, N ){
    sum = 0;

    vector<int> j( N );
    REP( i, N ) cin >> j[i];
    sort( ALL( j ) );
    FOR( i, 1, N - 1 ) sum += j[i];

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

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;

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

int main()
{
    int n, p;
    while(cin >> n && n)
    {
        vector<int> points;
        int ans = 0;

        REP(n)
        {
            cin >> p;
            points.push_back(p);
        }

        sort(points.begin(), points.end());
        
        for(int i= 1; i < n -1;i++) ans += points[i];

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

    return 0;
}

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

int N;
int S;

int main(){
  while( cin >> N ){
    if( !N ) break;
    int nmax = -1000;
    int nmin  = 2000;
    int sum = 0;
    for(int i=0;i<N;i++){
      cin >> S;
      nmax = max( nmax, S );
      nmin = min( nmin,S );
      sum += S;
    }
    sum -= nmax + nmin;
    cout << sum/(N-2) << endl;
  }
}

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

int main() {
    std::vector<int> vec;
    while (true) {
        vec.clear();

        int n;
        std::cin >> n;

        if (n == 0)
            break;
        
        vec.resize(n);
        for (auto&& e : vec)
            std::cin >> e;
        
        std::sort(vec.begin(), vec.end());
        std::cout << std::accumulate(vec.begin() + 1, vec.end() - 1, 0) / (n - 2) << std::endl;
    }
}

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

int main() {
  for(int tci = 0; ; ++tci) {
    int n; scanf("%d", &n);
    if(n==0) break;
    int m0v=0, m1v=1000, sum=0;
    for(int i = 0; i < n; ++i) {
      int x; scanf("%d", &x);
      sum += x;
      m0v = max(m0v, x);
      m1v = min(m1v, x);
    }
    printf("%d\n", (sum-m0v-m1v)/(n-2));
  }
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main(){
  int N;;
  while(1){
    cin >> N;
    if(N == 0){
      break;
    }else{
      int array[N], ave, sum = 0;
      
      for(int i = 0;i < N;i++){
	cin >>array[i];
      }
      sort(array,array+N);
      for(int i = 0;i < N;i++){
	if(!(i == 0 || i == N-1)){
	sum += array[i];
	}
      }
      ave = sum /( N -2);
      cout << ave << endl;
      
    }
  }
  
  return 0;
}

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

using namespace std;

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

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

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