Go: package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	for n != 0 {
		arr := make([]int, n)
		for i := range arr {
			fmt.Scan(&arr[i])
		}
		sort.Ints(arr)

		sum := 0
		for i := 1; i < len(arr)-1; i++ {
			sum += arr[i]
		}
		fmt.Println(sum / (n - 2))
		fmt.Scan(&n)
	}
}

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

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


int main() {
  int n;

  while (cin >> n, n) {
    int m = 1001;  
    int M = -1;
    int sum = 0;
    for (int i = 0; i < n; i++) {
      int score;
      cin >> score;
      m = min(m, score);
      M = max(M, score);
      sum += score;
    }
    cout << (sum - m - M) / (n - 2) << endl;
  }
  return 0;
}

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

using namespace std;

int main()
{
	int n;
	int s[101];
	int sum;
	
	while(scanf("%d", &n), n != 0){
		sum = 0;
		for (int i = 0; i < n;i++) scanf("%d", &s[i]);
		
		sort(s, s + n);
		
		for (int i = 1; i < n-1; i++){
			sum += s[i];
		}
		
		printf("%d\n", sum/(n-2));
	}
}

C++: #include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)

using namespace std;

int main(){
  int n;
  while(scanf("%d", &n) && n){
    int lmin = 9999, lmax = 0, sum = 0, s;
    rep(i, n){
      scanf("%d", &s);
      lmin = min(lmin, s); lmax = max(lmax, s);
      sum += s;
    }

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

C++: #include <stdio.h>

int main(){

  int i,n,sum=0,min=1000,max=0,ave=0,x,l;
  int score[101];

  for(;;){
    scanf("%d",&n);
    if(n==0){
      break;
    }
    for(i=1;i<=n;i++){

      scanf("%d",&score[i]);

      if(max<score[i]){
	max=score[i];
	x=i;
      }

      if(min>score[i]){
	min=score[i];
	l=i;
      }
    }


    score[l]=0;
    score[x]=0;


    for(i=1;i<=n;i++){
      sum+=score[i];
    }
    ave=sum/(n-2);

    printf("%d\n",ave);

    ave=0;
    sum=0;
    min=1000;
    max=0;

  }
  return 0;
}