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

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

int main() {

    while(true){

        int n;

        cin >> n;

        if(n == 0){
            break;
        }

        int ma=-1,mi=1001,sums=0;

        for(int i=0; i<n; i++){
            int input;
            cin >> input;
            sums += input;
            if(ma < input){
                ma = input;
            }
            if(mi > input){
                mi = input;
            }
        }

        sums -= ma + mi;
        cout << sums/ (n-2) << endl;

    }

    return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n1;
	cin >> n1;
		int a[100000] = { 0 };
		for (int i = 0; i < n1; i++){
			cin >> a[i];
		}
		sort(a, a + n1);
		a[0] = { 0 };
		a[n1 - 1] = { 0 };
		for (int i2 = 1; i2 < n1; i2++){
			a[0] += a[i2];
		}
		cout << a[0] / (n1 - 2) << endl;
		return n1;
		return 0;
}