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 <bits/stdc++.h>
using namespace std;

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

int main() {
   while (1) {
      int n;
      cin >> n;
      if (n == 0) break;
      int sum = 0, Max = -1, Min = 111111;
      rep (i, n) {
         int a;
         cin >> a;
         Max = max(Max, a);
         Min = min(Min, a);
         sum += a;
      }
      int p = sum - Max - Min;
      cout << p / (n-2) << endl;
   }

   return 0;
}

C++: #include<stdio.h>

int main(){
        int i = 0,j = 0;
        int n = 1;
        int s[1000];
        int sum = 0;
        int tmp;
        while(1){
                scanf("%d",&n);
                if(n == 0)
                        break;               
                for(j=0;j<n;j++){
                        scanf("%d",&s[j]);
                }
                
                for(i = 0;i < n;i++){
                        for(j = n - 1; j > i; j--){
                                if(s[i] > s[j]){
                                        tmp = s[i];
                                        s[i] = s[j];
                                        s[j] = tmp;
                                }
                        }
                }
                for(j = 1;j < n - 1;j++){
                        sum += s[j];
                }
                printf("%d\n",sum/(n-2));                
                sum = 0;
        }        
        return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int judge;
int maxscore;
int minscore;
int maxnum;
int minnum;
cin >> judge;
int score[judge];
	for(int i=0; i<=judge; i++){
	cin >> score[i];
		if(score[i] > maxscore){
		maxscore = score[i];
		i=maxnum;
		}
		if(score[i] < minscore){
		minscore = score[i];
		i = minnum;
		}
	}
score[maxnum] = 0;
score[minnum] = 0;
int lastscore = 0;
for(int j=0;j<=judge;j++){
lastscore += score[j];
}
lastscore = lastscore/(judge - 2);
cout << lastscore <<endl;
return 0;
}

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

int main(){
	int n, s, sum, maxs, mins, i;
	while((cin >> n), n){
		sum = maxs = 0;
		mins = 1000;
		for(i = 0; i < n; i++){
			cin >> s;
			sum += s;
			maxs = max(maxs, s);
			mins = min(mins, s);
		}
		cout << (int)(sum / n) << endl;
	}
}

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

using namespace std;

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

C++: #include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
#define INF (1<<29)

int main(){
	int n,s,mi,ma,t;
	while(cin>>n&&n){
		mi=INF;ma=-1;
		s=0;
		for(int i=0;i<n;i++){
			cin>>t;
			s+=t;
			mi=min(mi,t);
			ma=max(ma,t);
		}
		cout<<(s-ma-mi)/(n-2)<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
 
using namespace std;
 
int main(){
    while( true ){
        int n;
        int ma = 0;
        int mi = 0;
        cin >> n;

        if(n == 0){
            break;
        }

        int a[n];

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

        sort(a,a+n);

        for(int i = 2;i < n-1;i++){
            a[1]+=a[i];
        }

        cout << a[1]/(n-2) << endl;
    }   
 
}

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

using namespace std;

int main(){
	vector<int> array;
	int i,x,max,min,sum,n;
	max = 0;
	min = 1000;

	while(cin>>n){
	array.clear();
	sum=0;

	for(i=0;i<sizeof(array);i++){
		cin >> x;
		array.push_back(x);
	}
	for(i=0;i<n;i++){
		if(max<array[i]){
			max= array[i];
		}
	}
	for(i=0;i<n;i++){
		if(min>array[i]){
			min= array[i];
		}
	}
	for(i=0;i<sizeof(array);i++){
		sum += array[i];
	}
	sum = sum-max-min;
	cout << sum/sizeof(array) << endl; 
	}

}

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

int main(){
    int a,n;
    for(;;){
        vector<int> num;
        cin>>n;
        if(n==0) break;
        for(int i = 0; i < n; i++){
            cin>>a;
            num.push_back(a);
        }
        sort(num.begin(), num.end());
        num.erase(num.begin());
         num.pop_back();
        int sum=0;
        for(int x : num){
            sum+=x;
        }
        sum/=num.length();
        cout<<sum<<endl;
    }
    return 0;
}

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 minv = 1000, maxv=0, sum=0;
    for(int i = 0; i < n; i++) <%
      int x; scanf("%d", &x);
      minv=min(minv,x);
      maxv=max(maxv,x);
      sum+=x;
    %>
    printf("%d\n", (sum-maxv-minv)/(n-2));
  %>
  return 0;
%>

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(i = 0; i < n; ++i)

int score[100];
int n, i, k, ans;

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

C++: #include <iostream>
#include <cmath>

using namespace std;

void find_max(int *data, int N){
  int flag = -1;
  int max = 0;
  for (int i=0; i<N; ++i){
    if (max < data[i]){
      max = data[i];
      flag = i;
    }
  }
  data[flag] = 0;
}

void find_min(int *data, int N){
  int flag = -1;
  int min = 1000000;
  for (int i=0; i<N; ++i){
    if (min > data[i]){
      min = data[i];
      flag = i;
    }
  }
  data[flag] = 0;
}

int main(void){
  int n;
  while (cin >> n){
    if (n == 0){
      return -1;
    }
    
    int *data = new int[n];
    
    for (int i=0; i<n; ++i){
      cin >> data[i];
    }
    find_min(data, n);
    find_max(data, n);
    int sum = 0;
    for (int i=0; i<n; ++i){
      sum += data[i];
    }
    int total = floor((double)sum/(n-2));
    cout << total << endl;
    delete[] data;
  }
  return 0;
}

C++: #include <iostream>

#define el endl
#define fd fixed

using namespace std;

int main() {
  while (1) {
    int n;
    cin >> n;
    int m = n;
    if (n == 0) break;
    int max = INT_MIN;
    int min = INT_MAX;
    int ave = 0;
    while (m--) {
      int x;
      cin >> x;
      ave += x;
      if (x < min) min = x;
      if (x > max) max = x;
    }
    ave = ave - (max + min);
    ave = ave / (n-2);
    cout << ave << el;
  }
}