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())
		if n == 0 {
			break
		}
		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 < len(scores)-1; i++ {
			sum += scores[i]
		}
		fmt.Println(sum / (n - 2))
	}
}

C++: #include<cstdio>
#include<cstdlib>
using namespace std;
#define MAX_N 100
int  n, i, judge[MAX_N], ans;

int sort(const void *a, const void *b){
  return *(int*)a - *(int*)b;
}

int main(){
  while(1){
    scanf("%d", &n);
    if(n == 0) break;
    for(i = 0; i < n; i++) scanf("%d", &judge[i]);
    qsort(judge, n, sizeof(int), sort);
    ans = 0;
    for(i = 1; i < n - 1; i++) ans += judge[i];
    printf("%d\n", ans / (n - 2));
  }
  return 0;
}

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

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

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
  int n; //l
  int point[20], average;
  
  while(1){
    for(int i = 0 ; i < 20 ; i++){
      point[i] = 0;
    }
    average = 0;
    cin >> n;
    if(n == 0) 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<stdio.h>
#include<algorithm>
using namespace std;
int n, w[110], s;
int main(){
    int i;
    while(1){
        scanf("%d",&n);
        if(!n)break;
        for(i=1;i<=n;i++)scanf("%d",&w[i]);
        sort(w+1,w+n+1);
        s=0;
        for(i=2;i<n;i++)s+=w[i];
        s/=(n-2);
        printf("%d\n",s);
    }
}

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

int n,s[100];
int temp,ave,sum;

void sort(void){
  for(int i=0;i<n;i++){
    for(int j=i;j<n;j++){
      if(s[i]>s[j]){
	temp=s[i];
	s[i]=s[j];
	s[j]=temp;
      }
    }
  }
}

int main(){
  while(cin >> n,n){
    for(int i=0;i<n;i++)
      cin >> s[i];  
    
    sort();
    
    sum=0;

    for(int i=0;i<n-2;i++)
      sum+=s[i+1];

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

C++: #include <iostream>
using namespace std;
int N,S;

int main() {
  while (cin >> N && N > 0) {
    int sum = 0, M = 0, m = 1e9;
    for (int i = 0; i < N; i++) {
      cin >> S;
      sum += S;
      if (M < S) M = S;
      if (m > S) m = S;
    }
    cout << (sum - M - m)/(N-2) << endl;
  }
}

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

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

C++: #include <iostream>
using namespace std;
int main() {
    int n, s;
    while (cin >> n && n) {
        int mx = -1;
        int mn = 1001;
        int sum = 0;
        for (int i=0; i<n; ++i) {
            cin >> s;
            sum += s;
            mx = max(mx, s);
            mn = min(mn, s);
        }
        sum = sum - mx - mn;
        cout << sum / (n - 2) << endl;
    }
    return 0;
}

C++: #include<utility>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<deque>
#include<stack>
#include<complex>
#include<cmath>
#include<iostream>
#include<set>
#include<map>
#include<sstream>
#include<fstream>
#include<climits>
#include<chrono>
#include<random>
#include<functional>
#include<regex>

using namespace std;
typedef pair<int, int> P;
typedef long long ll;

// ??§????????°INF
const int INF = (1 << 30);
// ?¨±?????????????????
const double EPS = (1e-10);
// 2??????????????????????????????????????????
#define EQ(a,b) (abs((a)-(b)) < EPS)


int main()
{
	int n;
	while (true) {
		cin >> n;
		if (n == 0)break;
		vector<int> judges(n);
		int total = 0;
		for (int i = 0; i < n; ++i) {
			cin >> judges[i];
			total += judges[i];
		}
		int M = *max_element(judges.begin(), judges.end()),m=*min_element(judges.begin(),judges.end());
		total -= (M + m);
		int ans = total / (n - 2);
		cout << ans << endl;
	}
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <climits>
using namespace std;

void solve(vector<int>& point)
{
	int total = point[0];
	int maxPoint = point[0];
	int minPoint = point[0];
	for(unsigned i=1; i<point.size(); ++i){
		total += point[i];
		maxPoint = max(maxPoint, point[i]);
		minPoint = min(minPoint, point[i]);
	}
	cout << ((total-maxPoint-minPoint)/(point.size()-2)) << endl;
}

int main()
{
	int number = 0;
	for(;;){
		int n;
		cin >> n;
		if(n == 0)
			break;

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

		solve(point);
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
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 dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;
int a[110];

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

C++: #include <cstdio>

#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
    vector<int> vec;
    int n_data, in;
    for (;;) {
	scanf("%d", &n_data);
	if (n_data == 0)
	    return 0;

	for (int i = 0; i < n_data; ++i) {
	    scanf ("%d", &in);
	    vec.push_back(in);
	}
	sort(vec.begin(), vec.end());

	int ave = 0;
	for (auto it = vec.begin() + 1; it < vec.end() - 1; ++it)
	    ave += *it;
	printf("%d\n", ave / (n_data - 2));
	vec.clear();
    }
}

C++: #include<iostream>

using namespace std;

int main () {

  while (true){

    int n;
    int i;
    int s = 0;
    int mi = 0;
    int ma = 0;
    cin >> n;

    if (n == 0) break;
??????
??????int p[100];

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

      if (p[i] < mi;)
        mi << p[i];

      if (p[i] > ma;)
        ma << p[i];

      s += p[i];

    }

    cout << (s - mi - ma) / (n-2) << endl;

  }

  return 0;

}