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<stdio.h>
#include<vector>
#include<stdlib.h>
#include<set>
#include<string>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>

#define INF 99999999

using namespace std;

int main(){
	int n;

	cin >> n;
	do{
		int point[110];
		int sum = 0;

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

		sort(point, point+n);

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

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

		cin >> n;
	} while (n != 0);
	


	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;

int main(){
  int n;
  int mx, mn;
  int sum;
  cin >> n;
  while(n != 0){
    mx = 0;
    mn = 1e9;
    sum = 0;
    int in;
    for(int i = 0; i < n; i++){
      cin >> in;
      mx = max(mx, in);
      mn = min(mn, in);
      sum += in;
    }
    sum -= mx + mn;
    cout << sum / (n - 2) << endl;
    cin >> n;
  }
      

}

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

typedef long long ll;
typedef std::vector<int> vi;

void output() { std::cout << std::endl; }
void input() {}

template <class Head, class... Tail> void input(Head &&head, Tail &&... tail) {
  std::cin >> head;

  input(std::forward<Tail>(tail)...);
}

template <class Head, class... Tail> void output(Head &&head, Tail &&... tail) {
  std::cout << head;
  if (sizeof...(tail))
    std::cout << " ";

  output(std::forward<Tail>(tail)...);
}

int main() {
  do {

    ll n;
    input(n);
    if (!n)
      break;

    vi s(n);
    for (int &elem : s) {
      input(elem);
    }

    sort(s.begin(), s.end());
    output(std::accumulate(s.begin() + 1, s.end() - 1, 0) / (s.size() - 2));

  } while (true);
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define CHMIN(a,b) (a) = min((a),(b))
#define CHMAX(a,b) (a) = max((a),(b))

int main()
{
    int in;
    int num;
    int ans=0;
    int point[105]={};
    while(1==1)
    {
        
        scanf("%d\n",&in);
        if(in==0)return 0;
        num=in;
        ans=0;
        REP(i,num)
        {
            scanf("%d\n",&point[i]);
            ans+=point[i];
        }
        sort(point[0],point[num]);
        ans-=(point[0]+point[num-1])
        printf("%d\n",ans);
    }
    return 0;
}

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

int main(void){
  int n;
  while(1){
    cin>>n;
    vector<int> score;
    if(n==0){break;}
    for(int i=0;i<n;i++){
      int tmp;
      cin>>tmp;
      score.push_back(tmp);
    }
    sort(score.begin(),score.end());
    int mean=0;
    for(int i=1;i<n-1;i++){
      mean+=score[i];
    }
    mean=mean/(n-2);
    cout<<mean<<endl;
  }
  return 0;
}

C++: #include <stdio.h>
int main()
{
  int n,i,t,max,min,sum;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    max=0;
    min=1001;
    sum=0;
    for(i=0;i<n;i++){
      scanf("%d",&t);
      if(t>max)max=t;
      if(t<min)min=t;
      sum+=t;
    }
    sum=sum-max-min;
    printf("%d\n",sum/(n-2));
  }
  return 0;
}

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

int main(){

	int n;
	while(cin >> n, n){
		vector<int> score;
		for(int i=0; i<n; i++){
			int s; cin >> s;
			score.push_back(s);
		}
		sort(score.begin(), score.end());
		int sum = accumulate(score.begin(), score.end(),0);
		cout << ( sum - score.back() - score.front() )/ (score.size()-2) << endl;
	}

	return 0;
}

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

int main(){
  int n,s[100],num,max=s[0],min=s[0];
  
  while(n != 0){
  cin>>n;    
    num=0;
    
  for(int i=0;i<n;i++){
    cin>>s[i];

    if(max<s[i])max=s[i];
    if(max>s[i])min=s[i];
       
    num += s[i];
  }
  num = (num-max-min)/n;
    cout<<num<<endl;

  }
  return 0;
}

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

int main(){
	int n;
	while(cin >> n , n){
		vector<int> v(n);
		for(int i=0;i<n;++i){
			cin >> v[i];
		}
		sort(v.begin(),v.end());
		int sum=0;
		for(int i=1;i<n-1;++i){
			sum+=v[i];
		}
		cout << floor((double)sum/(n-2)) << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#define INF (int)1e9 + 7
using namespace std;

int main() {
    int n;
    while (cin >> n && n) {
        vector<int> s(n);
        for (int i = 0; i < n; i++) {
            cin >> s[i];
        }
        sort(s.begin(), s.end());
        int sum = 0;
        for (int i = 1; i < n - 1; i++) {
            sum += s[i];
        }
        cout << sum / (n - 2) << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
  int n; //l
  int point[20], average;
  
  while(1){
    average = 0;
    cin >> n;
    if(n == 0) break;

    for(int i = 0 ; i < n ; i++){
      cin >> point[i];
    }
    sort(point, point + n);
    for(int i = 1 ; i < n - 1 ; i++){
      average += point[i];
    }
    average /= (n-2);
    cout << average << endl;
  }
  return 0;
}

C++: #include <stdio.h>

int main(void)
{
    int n;
    while(19)
    {
        scanf("%d",&n);
        if(n==0)break;
        int sum=0;
        for(int i=0;i<n;i++)
        {
            int tmp;
            scanf("%d",&tmp);
            sum+=tmp;
        }
        printf("%d\n",sum/n);
    }
    return 0;
}

C++: #include<stdio.h>

int main(){
  int n,s;
  int maxm,mini,sum;
  
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    sum=0;
    maxm=1000;
    mini=0;
    for(int i=0;i < n;i++){
      scanf("%d",&s);
      sum=sum+s;
      if(maxm < s){
        maxm=s;
      }
      if(mini > s){
        mini=s;
      }
    }

    printf("%d\n", (sum-maxm-mini)/(n-2) );
  }
  return 0;
}

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

using namespace std;

int main()
{
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        vector<int> score(n);
        for (int i = 0; i < n; i++) {
            cin >> score[i];
        }
        sort(score.begin(), score.end());

        int s = 0;
        for (int i = 1; i < n - 1; i++) {
            s += score[i];
        }
        cout << s / (n - 2) << endl;
    }

    return 0;
}

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

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

C++: #include<bits/stdc++.h>
#define SIZE 100005
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,s[105];

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