Go: // ICPC 得点集計ソフトウェア
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1147&lang=jp
package main

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

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

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

		score_list := []int{}
		for i := 0; i < n; 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))
	}
}

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

C++: #include<utility>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<deque>
#include<stack>
#include<complex>
#include<cmath>
#include<iostream>
#include<set>
#include<map>
#include<sstream>
#include<fstream>
#include<climits>
#include<chrono>
#include<random>
#include<functional>
#include<regex>

using namespace std;
typedef pair<int, int> P;
typedef long long ll;

// ??§????????°INF
const int INF = (1 << 30);
// ?¨±?????????????????
const double EPS = (1e-10);
// 2??????????????????????????????????????????
#define EQ(a,b) (abs((a)-(b)) < EPS)


int main()
{
	int n;
	while (true) {
		cin >> n;
		if (n == 0)break;
		vector<int> judges(n);
		int total = 0;
		for (int i = 0; i < n; ++i) {
			cin >> judges[i];
			total += judges[i];
		}
		int M = *max_element(judges.begin(), judges.end()),m=*min_element(judges.begin(),judges.end());
		total -= (M + m);
		int ans = total / (n - 2);
		cout << ans << endl;
	}
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#define rep(i, n) for (int i = 0; i < (n); i++)
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<ll, int> mp;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	for (;;) {
		int n;
		cin >> n;
		if (n == 0) return 0;
		int mi = 100000000;
		int ma = 0;
		int sum = 0;
		rep(i, n) {
			int a;
			cin >> a;
			mi = min(a, mi);
			ma = max(a, ma);
			sum += a;
		}
		sum -= (mi + ma);
		cout << sum / (n - 2) << endl;
	}
	return 0;
}

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

int main() {
	int n, a, sum;
	multiset<int> s;
	multiset<int>::iterator it2;
	while(1) {
		cin >> n;
		if(!n) break;
		s.clear();
		for(int i=0; i<n; ++i) {
			cin >> a;
			s.insert(a);
		}
		s.erase(s.begin());
		s.erase(--s.end());
		sum = 0;
		for(multiset<int>::iterator it=s.begin(); it!=s.end(); ++it) {
			sum += (*it);
		}
		cout << (sum/(n-2)) << endl;
	}
	return 0;
}

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

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

C++: #include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <random>

// boost
#define USE_BOOST_IN_CODE
#ifdef USE_BOOST_IN_CODE
#include <boost\range.hpp>
#include <boost\range\algorithm.hpp>
#include <boost\range\numeric.hpp>
#include <boost\range\irange.hpp>
#include <boost\range\adaptor\strided.hpp>
#include <boost\range\adaptor\transformed.hpp>
#include <boost\format.hpp>
#endif


using ll = long long;

//vector
template <class T>
using vec = std::vector<T>;

//namespace std
//{
//    template<>
//    class hash<Key>
//    {
//    public:
//        size_t operator() (const Key& key) const
//        {
//            size_t seed = 0;
//            auto i_hash = hash<int>()(key.i_th);
//            auto w_hash = hash<int>()(key.W);
//
//            seed ^= i_hash + 0x9e3779b9 + (seed << 6) + (seed >> 2);
//            seed ^= w_hash + 0x9e3779b9 + (seed << 6) + (seed >> 2);
//
//            return seed;
//        }
//    };
//}

void solve()
{
    using namespace std;

    int count {};
    int n;
    while (cin >> n)
    {
        if (n == 0)
            break;

        vec<int> v(n);
        for (auto& x : v)
            cin >> x;

        boost::sort(v);

        cout << accumulate(v.cbegin() + 1, v.cend() - 1, 0) / (n - 2) << endl;
        ++count;
    }

}

int main()
{
    solve();
    return 0;
}

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;


	}


}