Go: package main

import "fmt"

func main() {
    var n int
    a := make([]float64, 10004)
    for {
        fmt.Scan(&n)
        if n == 0 { break }

        ave_num := 0.0
        for i := 0; i < n; i++ {
            fmt.Scan(&a[i])
            ave_num += a[i]
        }
        ave_num /= float64(n)
        cnt := 0
        for i := 0; i < n; i++ {
            if a[i] <= ave_num {
                cnt++
            }
        }
        fmt.Println(cnt)
    }
}

C++: #include <iostream>

using namespace std;

int main() {
  int n;
  int a[10004];

  while ( cin >> n ) {
    // n == 0 と同じ
    if (!n) { break; }

    double ave_num = 0;

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

    ave_num /= n;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] <= ave_num) {
        cnt++;
      }
    }
    cout << cnt << endl;
  }

  return 0;
}

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

typedef long long ll;

int main(){
	int n;
	while(cin >> n,n){
		vector<int> a(n);
		int sum=0;
		for(int i=0;i<n;i++){
			cin >> a[i];
			sum+=a[i];
		}
		int res=0;
		for(int i=0;i<n;i++){
			if(sum>=n*a[i])res++;
		}
		printf("%d\n",res);
	}
}

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

using namespace std;
typedef long long ll;

int n;
ll ar[10000];

int main() {
	
	while (1) {
		cin >> n;
		if (n == 0)break;
		ll avep = 0;
		for (int i = 0; i < n; i++) {
			cin >> ar[i];
			avep += ar[i];
			ar[i] *= n;
		}

		sort(ar, ar + n);
		cout << upper_bound(ar, ar + n, avep) - ar << endl;


	}

	return 0;
}

C++: #include <iostream>
#include <vector> 
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <cerrno>
#include <cfenv>
#include <math.h>
#include <iomanip>
#include <limits>
#define ll long long int

using namespace std;

int main(){

    int n;

    while(true){

        cin >> n;

        if(n==0){
            break;
        }

        vector<int> data(10000);
        int sum = 0;

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

        double ave = (sum/n);

        int cnt = 0;
        
        for(int i=0;i<n;i++){
            if(ave>=(double)data[i]){
                cnt++;
            }
        }

        cout << cnt << endl;

    }

    return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
    int n,i,a[50005];
    while(1)
    {
        cin>>n;
        if(n<2) break;
        int average=0,total=0;
        for(i=0;i<n;i++)
            {
                cin>>a[i];
                total=total+a[i];
            }
         average=total/n;
         int numbers=0;
         for(i=0;i<n;i++)
         {
             if(a[i]<=average)
             numbers++;
         }
         cout<<numbers<<endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<int ,P> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n, a[10005], sum, ans;
    while(cin >> n, n){
        sum = 0;
        ans = 0;
        REP(i,n){
            cin >> a[i];
            sum += a[i];
        }
        sum /= n;
        REP(i,n){
            if(a[i]<=sum)ans++;
        }
        cout << ans << endl;
    }
    return 0;
}

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

int main(){
        double n;
        while (cin >> n && n != 0){
                int ans = 0;
                double wa = 0;
                vector<double> a(n);
                for (int i = 0; i < n; i++){
                        cin >> a[i];
                        wa += a[i];
                }
                double avg = wa / n;
                for (int i = 0; i < n; i++){
                        if (avg >= a[i]) ans++;
                }
                cout << ans << endl;
        }
        return 0;
}

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

int main(void)
{
    int Members, Scores[10000], Total = 0, Average, Poors = 0, i;

    while(true)
    {
        cin >> Members;
        if(!Members){ break; }
        for(i = 0; i < Members; i++)
        {
            Scores[i] = 0;
            cin >> Scores[i];
            Total = Total + Scores[i];
        }
        Average = Total / Members;
        for(i = 0; i < Members; i++)
        {
            if(Scores[i] <= Average){ Poors++; }
        }
        cout << Poors << "\n";
    }
}

C++: #include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

int N, A[10101];
//---------------------------------------------------------------------------------------------------
void _main() {
	while (cin >> N) {
		if (N == 0) return;
		rep(i, 0, N) cin >> A[i];

		int sm = 0;
		rep(i, 0, N) sm += A[i];

		int ans = 0;
		rep(i, 0, N) if (A[i] * N <= sm) ans++;
		printf("%d\n", ans);
	}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll n = -1;
  while (n != 0) {
    ll sum = 0;
    cin >> n;
    if (n == 0)
      return 0;
    vector<ll> a;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      a.push_back(x);
      sum += x;
    }
    double mean = sum * 1.0 / n;
    int cnt = 0;
    for (int i = 0; i < n; i++)
      if (a[i] <= mean)
        cnt++;
    cout << cnt << endl;
  }
}

C++: #include <stdio.h>
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

int main()	{

	int n, temp, mean, count, res;
	vector<int> a;

	while (true)	{

		scanf("%d", &n);
		if (n == 0)	break;

		count = 0;

		for (int i = 0; i < n; i++)	{
			cin >> temp;
			a.push_back(temp);
		}

		mean = accumulate(a.begin(), a.end(), 0) / n;
		///
		//printf("mean::%d\n", mean);
		///
		sort(a.begin(), a.end());

		for (int i = 0; i < n; i++)	{
			if (a[i] <= mean)	{
				count++;
			} else	{
				break;
			}
		}

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

		a.clear();
	}

	return 0;
}

C++: #include<stdio.h>
int main() {
while (1) {
int n, j,k, a[10000], sum = 0, m = 0;
scanf("%d", &n);
if (n == 0)
break;
for (j = 1; j <=n; j++) {
scanf("%d", &a[j]);
sum += a[j];
}
for (j = 1; j <=n; j++) {
if (a[j] <= sum / n)
m++;
}
printf("%d\n", m);
}
return 0;
}