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

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

int main(){
  int n;
  while(1){
    cin >> n;
    if(n == 0)
      break;
    int x[n];
    for(int i=0;i<n;i++){
      cin >> x[i];
    }

    //sort
    int t;
    for(int i=0;i<n-1;i++){
      for(int j=i+1;j<n;j++){
        if(x[i]<x[j]){
          t = x[i];
          x[i] = x[j];
          x[j] = t;
        }
      }
    }

    //calc
    int sum=0;
    for(int i=1;i<n-1;i++){
      sum+=x[i];
    }
    cout << sum/(n-2) << "\n";
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
#include <utility>
#include <functional>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define rem(i,n,x) for(int i=n;i>x;i--)
#define SORT(x) sort(x.begin(),x.end())
#define REV(x) reverse(x.begin(),x.end())
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;

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 <algorithm>
using namespace std;

int main(){

  int n, s;

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

C++: #include <iostream>
#include <stdlib.h>
using namespace std;
int N, S;
int main()
{
  while (cin >> N && N > 0){
    int sum = 0;
    int largest = 0;
    int smallest =1000;
    for (int i=0; i<N; ++i){
      cin >> S;
      sum += S;
      if (largest < S)
	largest=S;
      if (smallest > S)
	smallest=S;
    }
    int average = 0;
    average = (sum - largest - smallest) / (N - 2);
    cout << "Average:";
    cout << average << endl;
  }
}

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

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

#define int ll

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

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

int main()
{
    int a,b[100];
    int max=0,min=100,sum=0,result;
    for(int i=0;i<a;i++){
        cin>>b[i];
        sum+=b[i];
        if(b[i]<min){
            min=b[i];
        }
        else if(b[i]>max){
            max=b[i];
        }
    }
    result=sum-min-max;
    cout<<result;
    return 0;
}

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

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

C++: #include<iostream>

using namespace std;

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

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

int main(){
  int N;
  
  while(cin>>N){
    if(N==0){
      break;
    }
    int max=0,min=1001,sum=0,a;
    for(int i=0;i<N;i++){
      cin >>a;
      if(max<a){ max=a; }
      if(min>a){ min=a; }
      sum+=a;
  }
    sum-=max;
    sum-=min;
    int ave = sum/(N-2);
    cout << ave <<endl;
  }

  return 0;
}

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

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

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

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

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

        int max=0,min=1000;;

        for(int i=0;i<n;i++){
            if(s[i]>max)max=s[i];
            else if(s[i]<min)min=s[i];
        }
        
        int sum=0;
        for(int i=0;i<n;i++){
            sum +=s [i];
        }


        sum -=max;
        sum -=min;

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

    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

int main(){
  ll N;
  cin>>N;
  ll T[N];
  ll sum=0;
  for(ll i=0; i<N; ++i){
    cin>>T[i];
    sum+=T[i];
  }
  cout<<sum/N<<endl;
  
}