Go: package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for {
		num := nextInt(sc)
		if num == 0 {
			break
		}

		score_list := []int{}
		for i := 0; i < num; i++ {
			score_list = append(score_list, nextInt(sc))
		}
		// 得点リストをソートした後、最低点と最高点を取り除く(3 ≤ n ≤ 100)
		sort.Sort(sort.IntSlice(score_list))
		score_list = score_list[1 : len(score_list)-1]
		// 得点リストの得点を合計し、スライスの個数で割って平均点を出す
		sum := 0
		for _, score := range score_list {
			sum += score
		}
		fmt.Println(sum / len(score_list))
	}
}

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

int main(void){
	int n,m,max,min,answer;
	while(1){
		cin >> n;
		max = 0;
		min = INT_MAX;
		answer = 0;
		if (!n) break;
		for (int i=0;i< n;i++){
			cin >> m;
			if (m > max) max = m;
			else if (m < min) min = m;
			answer += m;

		}
		cout << answer-max-min << endl;

	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
bool test = true;
int num;
while(test)
{
int ans = 0;
cin >> num;
if(num != 0)
{
int a[num];
for(int i = 0;i<num;i++)
{
 cin >> a[i];
}
sort(a, a + num);
for(int i=1; i<num-1;i++)
{
ans += a[i];
}
cout << ans << endl;
}
else
{
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[20];
    
    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;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int judge;
int maxscore =0;
int minscore =0;
int totalscore = 0;
cin >> judge;
if(judge != 0){
	int score;	
	for(int i=0; i<judge; i++){
	cin >> score;
		if(score > maxscore){
		maxscore = score;
		}
		if(score < minscore){
		minscore = score;
		}
		if(i==0){
		minscore = score;
		}
	totalscore += score;
	}

int lastscore = (totalscore - maxscore - minscore)/(judge - 2);
cout << lastscore <<endl;
}
return 0;
}

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

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

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

using namespace std;

int main(void)
{
	int n;


	int s;

	int sum,ave;

	int i;

	while(1){
		vector<int> v;
		sum = 0;

		cin >> n;
		if (n==0) break;

		for(i=0;i<n;i++){
			cin >> s;
			v.push_back(s);
		}

		
		sort(v.begin(),v.end());

		for(i=1;i<v.size()-1;i++){
			sum += v[i];
		}

		ave = sum/(v.size()-2);

		cout << ave << endl;

	}
	return 0;
}

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

int main(){
	int ninzuu;
	while(cin >> ninzuu && ninzuu != 0){
		int max_value=-1;
		int min_value=1001;
		int sum=0;
		int average;
		for(int i=0;i<ninzuu;i++){
			int tmpNum;
			cin >> tmpNum;
			max_value = max(tmpNum,max_value);
			min_value = min(tmpNum,min_value);
			sum += tmpNum;
		}
		sum -= (max_value + min_value);
		average = sum / (ninzuu - 2);
		cout << average << endl; // 出力
	}
}

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

#define FOR(i,l,n) for(int i=(l);i<(n);i++)
#define REP(i,n) FOR(i,0,n)
#define MAX_JUDGE 100
using namespace std;

int main(){
  int n,score[MAX_JUDGE];
  while(cin>>n){
    if(n==0)break;
    REP(i,n)cin>>score[i];
    sort(score,score+n);
    int c=0;
    FOR(i,1,n-1)c+=score[i];
    cout << c/(n-2);
  }
  return 0;
}

C++: #include<iostream>
#define INF 1<<29
using namespace std;

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

C++: #include <iostream>

using namespace std;

int main( void )
{
	int n;
	while(cin >> n, n) {
		int Max = 0, Min = 1001, Sum = 0;
		int i=n;
		while(i--) {
			int s;
			cin >> s;
			Sum += s;
			if(Max < s) Max = s;
			if(Min > s) Min = s;
		}
		int ave = (Sum - Max - Min) / (n - 2);
		cout << ave << endl;

	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  while(1){
        int n,sum=0,ans=0,max=0,min=1001;
        cin >> n;
        if(n==0) break;
        int s[n];
        for(int i=0; i<n; i++){
          cin >> s[i];
          sum += s[i];
        }
        for(int i=0; i<n; i++){
          if(s[i] > max) max = s[i];
          if(s[i] < min) min =s[i];
        }
        sum = sum -max -min;
        ans = sum/(n-2);
        cout << ans << endl;
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#define INF 100000000

#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;

static const double EPS = 1e-8;

const int tx[] = {0,1,0,-1};
const int ty[] = {1,0,-1,0};

int main(){
	int n;
	while(~scanf("%d",&n)){
		if(n==0) break;

		vector<int> score;
		for(int i=0;i<n;i++){
			int s;
			scanf("%d",&s);
			score.push_back(s);
		}

		sort(score.begin(),score.end());

		int sum=0;
		for(int i=1;i<score.size()-1;i++){
			sum += score[i];
		}

		printf("%d\n",sum/(score.size()-2));
	}
}

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

int main(void){
  while(true){
    long n;
    cin >> n;
    if(n == 0){
      break;
    }
    vector<long> S;
    for(int i = 0; i < n;++i){
      long s;
      cin >> s;
      S.push_back(s);
    }
      long mx = *max_element(S.begin(), S.end());
      long mn = *min_element(S.begin(), S.end());
      long sum = accumulate(S.begin(), S.end(), 0);
      cout << (sum - mx - mn) / (n - 2)  << endl;
  }
 return 0;
}

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


int main()
{
	int n, s[101];
	while (cin >>n &&n> 0) {
		int mean = 0;
		for (int i = 0; i < n; i++) cin >> s[i];
		sort(s, s + n);
		for (int i = 1; i < n - 1; i++)mean += s[i];
		cout << mean << endl;
	}
    return 0;
}

C++: #include <iostream>
#include<stdio.h>
using namespace std;
int main(void){
   int n;
   int x;
   while(1){
       int max=-1,min=1001;
       int S=0;
       cin>>n;
       if(n==0){
           break;
       }
       for(int i=0;i<n;i++){
            cin>>x;
            if(min>x){
                min=x;
            }
            if(max<x){
                max=x;
            }
           S=S+x;            
       }
       cout<<(S-(max+min))/(n-2)<<endl;
   }
   return 0;
}