Go: package main

import "fmt"

func main() {

     for ; true ; {
     var n int
     fmt.Scan(&n)
     if n == 0 { break }
     a := make([]float64, n)
     var sum float64 = 0
     for i := 0; i < n; i++ {
     	 fmt.Scan(&a[i])
	 sum += float64(a[i])
     }
     sum /= float64(n)
     ans := 0
     for i := 0; i < n; i++ {
     	 if a[i] <= sum {
	    ans += 1
	 }
     }
     fmt.Println(ans)
     }
}

C++: #include <bits/stdc++.h>

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);

  while(1) {
    int n; cin >> n;
    if(n == 0) break;
    vector<int> a(n);
    double me = 0;
    for(int i=0;i<n;++i) {
      cin >> a[i];
      me += a[i];
    }
    me /= n;
    me += eps;
    int cnt = 0;
    for(int i=0;i<n;++i) {
      if(a[i] <= me) {
        cnt++;
      }
    }
    cout << cnt << endl;
  }
}

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

int main() {
	while (true) {
	int n;
	std::cin >> n;
	if (n == 0) break;
	std::vector<int> a(n);
	int sum = 0;
	for(auto& v : a) {
		std::cin>>v;
		sum += v;
	}

	int ans = 0;
	for(auto v : a) {
		if (v * n <= sum) ++ans;
	}

	std::cout << ans << std::endl;
}
	return 0;

}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#define INF (long)1e9
const int MOD = 1e9 + 7;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
using namespace std;
typedef long long ll;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	while(cin >> n, n)
	{
		int A[n + 1];
		int sum = 0;
		for(int i = 0; i < n; i++)
		{
			cin >> A[i];
			sum += A[i];
		}
		int avg = sum / n;
		sort(A, A + n);
		int cnt = 0;
		for(int i = 0; i < n; i++)
		{
			if(A[i] <= avg)
				cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#define ll long long
using namespace std;
const int maxn=1e5+10;

int a[maxn], b[maxn], c[maxn];
string s;

int main() {
    //freopen("a.out", "w", stdout);
    ll n;
    while(cin >> n && n) {
        int sum=0;
        for(int i=1;i<=n;++i) cin>>a[i],sum+=a[i];
        sum/=n;
        int res=0;
        for(int i=1;i<=n;++i) if(a[i]<=sum) res++;
        cout<<res<<'\n';
    }
}


/*
100 1100101


*/

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

int main()
{
	int N[10000];
	while(1){
		cin >> N[0];
		if(N[0]==0)break;
		int sum = 0;
		for(int i=1;i<=N[0];i++){
			cin >> N[i];
			sum+=N[i];
		}
		int avr = sum / N[0];
		int cnt = 0;
		for(int i=1;i<=N[0];i++)
			if(N[i]<=avr)cnt++;
		cout << cnt << endl;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
using namespace std;
int main(void){

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

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

  double ave = sum / n;     int ans = 0;
  for(int i = 0 ; i < n ; i++)
    if((double)a[i] <= ave)   ans++;

  cout << ans << endl;
}

  return 0;
}

C++: #include<string>
#include<iostream>
int getlessAve(int num)
{
	std::string income_s, income;
	unsigned int ave = 0;
	int peopleN = 0, i, income_i[num];
	std::getline(std::cin, income_s);
	for(i = 0;i < num;i++)
	{
		income = income_s.substr(0, income_s.find_first_of(" "));
		income_s = income_s.substr(income_s.find_first_of(" ")+1, income_s.size());
		income_i[i] = std::stoi(income);
		ave += income_i[i];
	}
	ave /= num;
	for(i = 0;i < num;i++)
	{
		peopleN += ((unsigned int)income_i[i] <= ave?1:0);
	}
	return peopleN;
}

int main()
{
	std::string num;
	int p[50000], i = 0, count = 0;
	while(1)
	{
		std::getline(std::cin, num);
		if(std::stoi(num) == 0)
			break;
		p[count] = getlessAve(std::stoi(num));
		count++;
	}
	for(i = 0;i < count;i++)
		std::cout << p[i] << std::endl;
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <stdlib.h> //for exit
#include <algorithm> //for sort...etc
#include <numeric> //for accumulate
using namespace std;

int main()
{
    while(1)
        {
            int n,n_sum=0;
            vector<int> income;
            cin >> n; // mは制限値
            if(n == 0) exit(0); //END STATE
            for(int i = 0 ; i < n; i++) //INPUT
            {
                int tpprice;
                cin >> tpprice;
                income.push_back(tpprice);
            }

            for(int i = 0; i < n; i++)
            {
                int target = accumulate(income.begin(),income.end(),0)/n;
                if(income[i] <= target)
                {
                    n_sum++;
                }
            }

            cout << n_sum << endl;  
        }
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int> > minpq;

int main() {
    while (true){
        int n;
        cin >> n;
        if (n == 0) break;
        ll ans = 0;
        vector<ll>a(n);
        for(int i=0; i<n;i++){
            cin>>a.at(i);
        }
        for(int i=0;i<n;i++){
            ans+=a.at(i);
        }
        ll cnt=0;
        for(int i=0;i<n;i++){
            if (a.at(i)*n<=ans){
                cnt++;
            }
        }
        cout << cnt << '\n';
    }
    return 0;
}

C++: #include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()

using namespace std;
main(){
    while(1){
        ll n;cin>>n;
        if(!n)break;
        vector<ll> a(n);
        rep(i,n)cin>>a[i];
        ll sum = accumulate(all(a),0LL);
        int cnt = 0;
        rep(i,n){
            cnt += (a[i]*n <= sum);
        }
        cout << cnt <<endl;
    }
}

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

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

int main() {
  std::ios::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int n;
  cin>>n;
  int a[n];
  double average=0;
  for (int i=0; i<n; i++) {
    cin>>a[i];
    average+=a[i];
  }
  average/=n;
  int ans=0;
  for (int i=0; i<n; i++) {
    if (a[i]<=average) {
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

int main(){
    int n;
    long a[10002];
    long long suma;

    while(true){
        cin >> n;
        suma = 0;
        if(n == 0) break;
        for(int i=0;i<n;i++){
            cin >> a[i];
            suma += a[i];
        }
        double average = (double)suma / (double)n;
        int count = 0;
        for(int i=0;i<n;i++){
            if(a[i] <= average) count++;
        }

        cout << count << "\n";
    }

    return 0;
}