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 <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <random>

// boost
#define USE_BOOST_IN_CODE
#ifdef USE_BOOST_IN_CODE
#include <boost\range.hpp>
#include <boost\range\algorithm.hpp>
#include <boost\range\numeric.hpp>
#include <boost\range\irange.hpp>
#include <boost\range\adaptor\strided.hpp>
#include <boost\range\adaptor\transformed.hpp>
#include <boost\format.hpp>
#endif


using ll = long long;

//vector
template <class T>
using vec = std::vector<T>;

//namespace std
//{
//    template<>
//    class hash<Key>
//    {
//    public:
//        size_t operator() (const Key& key) const
//        {
//            size_t seed = 0;
//            auto i_hash = hash<int>()(key.i_th);
//            auto w_hash = hash<int>()(key.W);
//
//            seed ^= i_hash + 0x9e3779b9 + (seed << 6) + (seed >> 2);
//            seed ^= w_hash + 0x9e3779b9 + (seed << 6) + (seed >> 2);
//
//            return seed;
//        }
//    };
//}

void solve()
{
    using namespace std;

    int count {};
    int n;
    while (cin >> n)
    {
        if (n == 0)
            break;

        vec<int> v(n);
        for (auto& x : v)
            cin >> x;

        boost::sort(v);

        cout << accumulate(v.cbegin() + 1, v.cend() - 1, 0) / (n - 2) << endl;
        ++count;
    }

}

int main()
{
    solve();
    return 0;
}

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

int main(int argc, const char * argv[]) {
    while(1){
        int n; cin >> n;
        if(!n) break;
        
        int big = -1, small = 1001;
        int sum = 0;
        for(int i = 0; i < n; i++){
            int point; cin >> point;
            big = max(big, point);
            small = min(small, point);
            sum += point;
        }
        cout << (sum - big - small) / (n - 2) << endl;
    }
}

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

int main()
{
  int n;
  while(cin >> n && n != 0){
    int maximum = 0, minimum = 1000, sum = 0, s;
    for(int i = 0 ; i < n; ++i){
      cin >> s;
      maximum = max(maximum, s);
      minimum = min(minimum, s);
      sum += s;
    }
    sum = sum - maximum -minimum;
    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, max=0, min=10000 , temp;
        for (int i = 0; i<n; i++){
            cin >> s;
            if (s > max){
                sum += max;
                max=s;
            }
            else{
                if (s < min){
                    if(min != 10000){
                        sum += min;
                        min=s;
                    }
                    else{
                        min=s;
                    }
                }
                else{
                    sum += s;
                }
            }
            if (max > min){
                max = temp;
                min = max;
                max = temp;
            }
        }
        cout << sum/(n-2) << endl;
    }
}

C++: #include <iostream>
using namespace std;
int N, A[1024],Max,Min,Sum;

int main(){
 while(cin >> N && N>0){
  for (int i=0; i<N; ++i)
    cin >> A[i];
  for (int j=0; j<N; ++j){
    Max=0;
	if(A[j]>Max) Max=A[j];
    }
  for (int k=0; k<N; ++k){
    Min=1000;
	if(A[k]<Min) Min=A[k];
	}
  for (int l=0; l<N; ++l){
    Sum += A[l];
	}
  cout<< (Sum-Max-Min)/(N-2) << endl;
  Sum=0;
 }
}

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

void solve(int N){
    long long sum = 0;
    int mx = -1;
    int mn = 10001;
    for(int i=0;i<N;i++){
        int a;cin>>a;
        sum += a;
        mx = max(mx,a);
        mn = min(mn,a);
    }
    sum -= mx;
    sum -= mn;

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

int main(){
    int N;
    while(cin>>N){
        if(N==0) break;
        solve(N);
    }
}

C++: #include <cstdio>

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

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

int main(){
	int d,e;
	while(cin>>d>>e,d){
		double res=10000000;
		for(int i=0;i<=d;i++){
			int j=d-i;
			res=min(res,abs(sqrt(double(int(i*i+j*j)))-e));

		}
		cout<<res<<endl;


	}


}

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

int main()
{
    int a,b[100];
    cin>>a;
    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>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include<map>
#include<type_traits>

long long int D[10000];
long long int E[400000];

using namespace std;
int main() {
	long long int N;
	long long int Y = -1;
	cin >> N;
	while (N) {
		Y++;
		for (long long int i = 0; i < N; i++) {
			cin >> D[i];
		}

		sort(D, D + N);
		long long int W = 0;
		for (long long int i = 1; i < N-1; i++) {
			W += D[i];
		}
		E[Y] = W / (N-2);
		cin >> N;
		
	}

	for (long long int i = 0; i <=Y ;i++) {
		cout << E[i] << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;


int mean(vector<int> v) {
    int size = v.size();
    int sum = 0;
    for (int i = 0; i < size; i++){
        sum += v[i];
    }
    return sum / size;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  int ave;
  std::vector<int> v;
  while(cin >> n,n){
    for(int i=0;i<n;i++){
      int a;
      cin >> a;
      v.push_back(a);
    }
    sort(v.begin(),v.end());
    v.pop_back();
    v.erase(v.begin());
    ave = mean(v);
    cout << ave << endl;
    v.clear();
  }
}

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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= n; i--)
#define ll long long
#define pb push_back
#define popb pop_back
#define debug(i) cout << i << endl
using namespace std;
int main(){
int n, sum = 0;
vector<int> point;

cin >> n;

while(n != 0){
    REP(i, n){
        int tmp;
        cin >> tmp;
        point.pb(tmp);
      }
      sort(point.begin(), point.end());

      FOR(i,1, (n-1)) sum += point[i];
      cout << (sum / (n - 2)) << endl;
      point.clear();
      sum = 0;
      cin >> n;
  }
  return 0;
}