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 <cstdio>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	map <int,int> m;
	map <int,vector<int> > l;
	int n;
	while(~scanf("%d\n", &n)) m[n]++;
	for(map<int, int>::iterator it = m.begin(); it != m.end(); it++)
		l[(*it).second].push_back((*it).first);
	sort((*l.rbegin()).second.begin(), (*l.rbegin()).second.end());
	for(int i = 0; i < (*l.rbegin()).second.size(); i++)
		printf("%d\n", (*l.rbegin()).second[i]);
	return 0;
}

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

using namespace std;

int main() {
	map<int, int> cntMap;
	map<int, int>::iterator it;
	int in, buf;
	while(cin>>in){
		if(cntMap.count(in) == 0){ cntMap.insert(make_pair(in, 0)); }
		else{ cntMap.find(in)->second++; }
	}

	int maxCnt = 0;
	for(it=cntMap.begin(); it!=cntMap.end(); it++){
		maxCnt = max(maxCnt, it->second);
	}
	for(it=cntMap.begin(); it!=cntMap.end(); it++){
		if(maxCnt == it->second){
			cout<<it->first<<endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#define Debug 0
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

//最大公約数
template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//最小公倍数
template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

int a[101];

int main(){
    int tmp;
    while (cin >> tmp) {
        a[tmp]++;
    }
    int ma = -1;
    for (int i = 1; i <= 100; i++) {
        ma = max(ma, a[i]);
    }
    vector<int> ans;
    for (int i = 1; i <= 100; i++) {
        if (ma == a[i]) ans.push_back(i);
    }
    for (auto i: ans) {
        cout << i << endl;
    }
}

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

pair<int, int> d[101];

bool cmp(pair<int, int> l, pair<int, int> r){
  if(l.first>r.first) return true;
  if(l.first==r.first) return l.second < r.second;
  return false;
}

int main(){
  int n;
  for(int i=0; i<101; i++){
    d[i].first = 0;
    d[i].second = i;
  }
  while(cin >> n){
    d[n].first++;
  }
  sort(d, d+101, cmp);
  for(int i=0; i<101; i++){
    if(d[0].first > d[i].first)break;
    cout << d[i].second << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int a,n=100,ma=0,memo[101]={};
  while(scanf("%d",&a)!=EOF && n--){
    memo[a]++;
    ma=max(ma,memo[a]);
  }
  for(int i=0;i<=100;i++){
    if(memo[i]==ma)cout<<i<<endl;
  }
  return 0;
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int cnt[110] = {}, a;
  while (cin >> a) {
    cnt[a]++;
  }
  int M = *max_element(cnt, cnt + 110);
  for (int i = 1; i <= 100; i++) {
    if (cnt[i] == M) cout << i << endl;
  }

  return 0;
}

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

int main(){

  int i, a[N];
  while(cin >> i) a[i]++;

  int max = a[1];
  for(int j = 1; j < N; j++){
    if(max <= a[j]) max = a[j];
  }

  for(int k = 1; k < N; k++){
    if(a[k] == max) cout << k << "\n";
  }
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
main(){
	int data[101];
	for(int i=0;i<=100;++i)data[i]=0;
	int tmp;
	while(cin>>tmp)data[tmp]++;
	int ans=0;
	for(int i=1;i<=100;++i)ans=max(ans,data[i]);
	for(int i=0;i<=100;++i)
		if(data[i]==ans)cout<<i<<endl;
}

C++: #include<iostream>
#include<algorithm>
#include<cstring>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main()
{
	int a[100];
	memset(a,0,sizeof(a));
	int in;
	while(cin>>in)a[in-1]++;
	vector<pair<int,int>> P;
	rep(i,100)P.push_back(make_pair(a[i],i));
	sort(P.begin(),P.end(),[](const pair<int,int> p1,const pair<int,int> p2)
	{
		return p1.first==p2.first?p1.second>p2.second:p1.first<p2.first;
	});
	cout<<P[99].second+1<<endl;
	int c=99;
	while(P[c].first==P[c-1].first)
	{
		cout<<P[--c].second+1<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;
vector<int> v(105,0);

int main()
{
  int i=0;
  int m=0;
  int n;
  while(scanf("%d",&n)!=EOF){
    v[n]++;
    i++;
  
  }
  int num=i;

  rep(i,num)
    m=max(m,v[i]);
  
  rep(i,num)
    if(v[i]==m)
      cout<<i<<endl;

}

C++: #include<stdio.h>
int a[100];
int main(){
	int now;
	int max=0;
	while(~scanf("%d",&now)){
		a[now-1]++;
		if(a[now-1]>max)max=a[now-1];
	}
	for(int i=0;i<100;i++){
		if(a[i]==max)printf("%d\n",1+i);
	}
}

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

int main(){
    int x;              // ??????????????¨????????°
    int num[100];       // ???????????????????????????
    int max_num = 0;    // ?????§??????
    for (int i=0; i<100; i++){      // ??????????????????
        num[i] = 0;
    }
    while (cin >> x){               // ??????????¨????
        num[x-1] += 1;
    }
    for (int i=0; i<100; i++){      // ?????§??????????¢????
        if (max_num < num[i]){
            max_num = num[i];
        }
    }
    for (int i=0; i<100; i++){      // ?????§?????????????????¨???
        if (num[i] == max_num) {
            cout << i+1 << endl;
        }
    }
    return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>

int compareq(const void*a, const void*b)
{
	return *(int*)a > *(int*)b ? 1 : *(int*)a == *(int*)b ? 0 : -1;
}

int main()
{
	int numbers[101], i = 0, maxnum[101];
	while (scanf("%d", &numbers[i++]) != EOF);
	qsort(numbers, i, sizeof(int), *compareq);
	int n, cnt = 0, max = 0, j = 0;
	for (n = 0; n < i; n++)
	{
		if (numbers[n] == numbers[n - 1])cnt++;
		else
		{
			if (cnt > max)
			{
				int s = 0;
				while (1)
				{
					maxnum[s++] = 0;
					if (s == 100)break;
				}
				maxnum[0] = n - 1;
				max = cnt;
				cnt = 0;
				j = 0;
			}
			else if (cnt == max)
			{
				maxnum[j++] = n - 1;
				cnt = 0;
			}
			else;
		}
	}
	j = 0;
	while (maxnum[j])
	{
		printf("%d\n", maxnum[j]);
		j++;
	}
	return 0;
}