Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

type Pair struct {
	key   int
	value int
}

func main() {
	scanner.Split(bufio.ScanWords)

	counts := map[int]int{}
	for {
		n, err := nextInt()
		if err != nil {
			break
		}

		counts[n]++
	}

	pairs := []Pair{}
	for k, v := range counts {
		pairs = append(pairs, Pair{k, v})
	}
	sort.Slice(pairs, func(i, j int) bool {
		if pairs[i].value == pairs[j].value {
			return pairs[i].key < pairs[j].key
		}
		return pairs[i].value > pairs[j].value
	})

	vMax := 0
	for _, pair := range pairs {
		if vMax != 0 && vMax != pair.value {
			break
		}
		if pair.value > vMax {
			vMax = pair.value
		}
		fmt.Println(pair.key)
	}
}

C++: #include <iostream>

using namespace std;

int main() {
  int n, max;
  int t[100] = {0};

  while (cin >> n)
    t[n - 1] += 1;

  for (int i = max = 0; i < 100; i++)
    if (t[i] > 0)
      if (max < t[i]) max = t[i];

  for (int i = 0; i < 100; i++)
    if (t[i] == max)
      cout << i + 1 << endl;

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <climits>
#include <utility>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define SPACE " "

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 1LL << 25;
double EPS = 1e-9;

// BEGIN //////////////////////////////////////////////////////////////
int main() {
	int ds[101] = {0};
	int n;
	while (scanf("%d", &n) != EOF) {
		ds[n]++;
	}
	int d_max = -1;
	REP(i, 100) {
		d_max = max(d_max, ds[i]);
	}
	REP(i, 100) {
		if (ds[i] == d_max) {
			PRINT(i);
		}
	}
	return 0;
}
// END   //////////////////////////////////////////////////////////////

C++: #include <stdio.h>
#include <array>
#include <algorithm>

int
main(void)
{
	char line[80];

	int a;
	std::array<int, 101> h;

	for (int& s: h) {
		s = 0;
	}
	
	while (true) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			break;
		}
		if (sscanf(line, "%d", &a) != 1) {
			break;
		}

		h[a] ++;
	}
	
	int m = *(std::max_element(h.begin()+1, h.end()));

	for (auto i = h.begin()+1; i != h.end(); i++) {
		if (*i == m) {
			printf("%d\n", std::distance(h.begin(), i));
		}
	}
	
	return 0;
}

C++: #include <cstdio>

int val[101],a,mx;

int main(){
	mx = 0;
	while(scanf("%d",&a) != EOF){
		val[a]++;
		if(val[a] > mx){
			mx = val[a];
		}
	}
	for(int i = 1; i <= 100; i++){
		if(val[i] == mx){
			printf("%d\n",i);
		}
	}
	return 0;
}

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

using namespace std;

int main() {

    int num, cntMax = -1;
    int cnt[101] = {0};

    while(cin >> num) {
       ++cnt[num];
    }

    for(int i = 1; i <= 100; ++i) {
        cntMax = max(cntMax, cnt[i]);
    }

    for(int i = 1; i <= 100; ++i) {
        if(cnt[i] == cntMax) cout << i << endl;
    }

}

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

int main(){
	int value[100], x, max=0;
        string max_is = "";
	
	for(int j=0; j<100; j++){
		value[j] = 0;
	}
	
	while(cin>>x){
		value[x-1]++;
	}
	
	for(int i=0; i<100; i++){
		if(max<value[i]){
			max = value[i]; 
			max_is = "";
			max_is = to_string(i+1);
		}else if(max == value[i]){
			max_is = max_is + "\n" + to_string(i+1);
		}
	}

	cout << max_is << endl;

	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
    int Number[9] = {0,0,0,0,0,0,0,0,0};
    char cNumber[9] = {'1','2','3','4','5','6','7','8','9'};

    int x;

    while(cin >> x)
    {
        //+1 for each x element
        for(int a = 1; a <= 9; a++)
        {
            if(x == a)
            {
                Number[a-1]++;
            }
        }
    }

    for(int b = 0; b < 9; b++)
    {
        for(int c = 0; c < 8; c++)
        {
            if(Number[c] < Number[c+1])
            {
                int temp = Number[c];
                Number[c] = Number[c+1];
                Number[c+1] = temp;

                char ctemp = cNumber[c];
                cNumber[c] = cNumber[c+1];
                cNumber[c+1] = ctemp;
            }
        }
    }

    int y = 0;
    for(int d = 1; d < 9; d++)
    {
        if(Number[0] != Number[d])
        {
            break;
        }
        else
        {
            y++;
        }

    }

    for(int e = 0; e <= y; e++)
    {
        cout << cNumber[e] << endl;
    }


}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector <string> VS;
typedef vector <int> VI;
typedef vector <VI> VVI;
template <class T> T gcd( T a, T b ) { return !b ? a : gcd( b, a % b ); }
template <class T> T lcm( T a, T b ){ return a / gcd( a, b ) * b; }
template <class T> string print_v( vector<T> v ) { OSS oss; for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++ it_i ) { oss << *it_i << ", "; } return oss.str(); }

int main() {
    int D[101] = {};
    int a;
    int max_d = 0;
    while ( cin >> a ) max_d = max( max_d, ++D[a] );
    for ( int i = 1; i <= 100; ++ i ) {
        if ( D[i] == max_d ) cout << i << endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <algorithm>
using namespace std;
pair<int, int> p[101];
bool comp(const pair<int, int> &a, const pair<int, int> &b) {
    if (a.second == b.second) return a.first < b.first;
    return a.second > b.second;
}
int main(){
    int n;
    for (int i = 0; i <= 100; i++) p[i] = {i, 0};
    while(scanf("%d", &n) != EOF) {
        p[n].second++;
    }
    sort(p, p+101, comp);
    int minv = p[0].second;
    for (int i = 0; i <= 100; i++) {
        if (p[i].second < minv) break;
        printf("%d\n", p[i].first);
    }
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  int d[10]={0};
  int max=0;
  while(cin>>n){
    d[n]++;
    if(max<d[n]){
      max=d[n];
    }
  }
  if(max!=0){
    for(int i=0;i<10;i++){
      if(d[i]==max){
	cout<<i<<endl;
      }
    }
  }
  return 0;
}

C++: #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000
#define MAXN 110
typedef long long ll;

int a[MAXN];

int main(void) {
    int cur, b;
    while (cin >> b) {
        a[cur++] = b;
    }
    map<int, int> m;
    for (int i = 0; i <= cur; i++) {
        m[a[i]]++;
    }
    // maxを見つける
    int ma = 0;
    for (int i = 0; i <= m.size(); i++) {
        ma = max(m[i], ma);
    }
    // maxの数を探す
    for (int i = 0; i <= m.size(); i++) {
        if (m[i] == ma) {
            cout << i << endl;
        }
    }
    return 0;
}