Go: package main

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

var (
	sc = bufio.NewScanner(os.Stdin)
)

func main() {
	for sc.Scan() {
		n, _ := strconv.Atoi(sc.Text())
		scores := make([]int, n, n)
		for i := 0; i < n; i++ {
			sc.Scan()
			scores[i], _ = strconv.Atoi(sc.Text())
		}
		sort.IntSlice(scores).Sort()
		var sum = 0
		for i := 1; i < n-1; i++ {
			sum += scores[i]
		}
		fmt.Println(sum / (n - 2))
	}
}

C++: 
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <memory>
#include <iomanip>
#include <functional>
using namespace std;
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < (int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int main(int argc, char* argv[])
{
    int ninzu=0;
    while(cin >> ninzu,ninzu){
        int ans=0;
        int i=0;
        int temp=0;
        int a=0;
        
        vector <int>  s;
        
        
        for(i=0;i<ninzu;i++){
            cin >> a;
            if(temp < a){
                temp = a;
            }
            s.push_back(a);
        }
        
        sort( ALL(s) );
        
        for(i=0;i<s.size()-1;i++)
            ans+= s[i];
        
        ans = (ans- s[0]) / (i-1);
        
        cout << ans << endl;
        ans=0;
    }
    
    return 0;
}

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

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

    cout << ave << endl;
  }

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

int main() {
  i64 n;
  while(cin >> n, n) {
    vector<i64> a(n);
    rep(i,0,n) cin >> a[i];
    sort(all(a));
    i64 sum = 0;
    rep(i,1,n-1) sum +=a[i];
    cout << sum / (n - 2) << endl;
  }
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int n;
int main(void){
    while(1){
        int ans = 0;
        cin >> n;
        if(n == 0) break;
        vector<int> a(n);
        for(int i = 0;i < n;i++) cin >> a[i];
        
        sort(a.begin(),a.end());
        for(int i = 0;i < n;i++){
            if(i == 0 || i == n-1) continue;
            ans += a[i];
        }
        cout << ans/(n-2) << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define all(c) (c).begin(), (c).end()
using namespace std;
int S[1001] = {0};

int main() {
	int N;

	while(true) {
		cin >> N;

		if (N == 0) { break; }
		rep(i,N) {
			cin >> S[i];
		}
		sort(S,S+N);
		int ave = accumulate(S+1,S+N-1,0) / (N-2);
		cout << ave << endl;
	}
	

	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
    int n,s[1000], i;
    while (cin >> n && n>0){
        int sum = 0, maximum =0, minimum = 10000;
        for (i = 0; i < n; i++){
            cin >> s[i];
            sum += s[i];
        }
        for (i = 0; i < n; i++){
            maximum = max(maximum, s[i]);
            minimum = min(minimum, s[i]);
        }
        cout << (sum - maximum - minimum)/(n -2) << endl;
    }
}

C++: #include<stdio.h>
int main(){
  int n,a[100],i,max=0,min=1000,c;
  while(1){
    c=0;
    scanf("%d",&n);
    if(n==0)break;
    for(i=0;i<n;i++){
      scanf("%d",&a[i]);
      if(max<a[i])max=a[i];
      if(min>a[i])min=a[i];
    }
    for(i=0;i<n;i++){
      if(max==a[i])a[i]=0;
      if(min==a[i])a[i]=0;
      c+=a[i];
    }
    printf("%d\n",c/(n-2));
  }
  return 0;
}

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

using namespace std;

struct CONTEST_DATA{
	int judgements;
	vector< int > points;
};

int main( void ){

	vector< CONTEST_DATA > contests;
	vector< int > answers;

	while( true ){
		CONTEST_DATA cd;
		cin >> cd.judgements;
		if( cd.judgements == 0 ){
			break;
		}
		int point;
		for( int i = 0; i < cd.judgements; i++ ){
			cin >> point;
			cd.points.push_back( point );
		}
		contests.push_back( cd );
	}

	for( int i = 0; i < contests.size(); ++i ){
		sort( contests[ i ].points.begin(), contests[ i ].points.end() );
	}
	for( int i = 0; i < contests.size(); ++i ){
		auto p = contests[i].points.begin;
		contests[ i ].points.erase( p );
	}
	for( int i = 0; i < contests.size(); ++i ){
		sort( contests[ i ].points.begin(), contests[ i ].points.end(), greater<int>() );
	}
	for( int i = 0; i < contests.size(); ++i ){
		auto p = contests[i].points.begin;
		contests[ i ].points.erase( p );
	}

	for( int i = 0; i < contests.size(); ++i ){
		int answer;
		for( int l = 0; l < contests[ i ].points.size(); ++l ){
			answer += contests[ i ].points[ l ];
		}
		answer / contests[ i ].judgements;
		answers.push_back( answer );
	}

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

	return 0;
}

C++: #include <iostream>

using namespace std;

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

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define rep(i, n) for(int i = 0;i < n;i++)
#define reprb(i, n) for(int i = n;i >= 0;i--)
#define reps(i, m, n) for(int i = m;i < n;i++)
#define repsb(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
vector<int> a;
vector<int> b;

int main(int argc,char const *argv[]) {
	int n,s,mx=0,mi=0,total=0;
	while(true)
	{
		total=0,mx=0,mi=100000;
		cin>>n;

		if(n==0)	break;
		rep(i,n){
			cin>>s;
			total+=s;
			mx=max(s,mx);
			mi=min(s,mi);
		}
		total=total-mi-mx;
		total=total/(n-2);
		a.pb(total);
	}
	rep(i,a.size()){
		cout<<a[i]<<endl;
	}
	return 0;
}

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