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 <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int main() {
    int n;
    int times[101]={};

    while(cin>>n){
        if(n==0)break;
        times[n]++;
    }
    int maxi=-1;
    rep(i,100+1){
        maxi=max(maxi,times[i]);
    }
    rep(i,100+1){
        if(times[i]==maxi){
            cout<<i<<endl;
        }
    }

    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int sum[101],n,mx,cou;
int main(){
    while(cin>>n){
        sum[n]++;
    }
    for(int i=0;i<100;i++)mx=max(mx,sum[i]);
    for(int i=0;i<100;i++){
        if(mx==sum[i]){
            cout<<i<<endl;
    }
    }
return 0;
}

C++: #include<iostream>

using namespace std;

int list[101];

int main(){
  int n, i, max=0;
  while(cin >> n){
    list[n]+=1;
  }
  for(i=1; i<101; i++){
    if(list[i] >= max)max=list[i];
  }
  for(i=1; i<101; i++){
    if(list[i] == max)cout << i << endl;
  }
}

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

using namespace std;

const int N = 100;

int main(void){
    int in[N] = { 0 };
    for(int n; cin >> n; in[n - 1] ++);

    for(int *p = max_element(in, in + N), result = *p; *(p = max_element(in, in + N)) == result; cout << int(p + 1 - in) << endl) *p = -1;
    
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>
#include <utility>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
using namespace std;

Int aa[120];

int main(){
	int a  = -1;
	while (cin >> a){
		++aa[a];
	}

	Int b = 0;

	REP(i, 120){
		b = max(b, aa[i]);
	}

	REP(i, 120){
		if (aa[i] == b)
			cout << i << endl;
	}

	return 0;
}

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

#define N 100

int main(void){

	int i;
	int input, max = 0;
	int bucket[N + 1];

	// テゥツ?催・ツ按療」ツ?ョテ・ツ按敕ヲツ慊淌・ツ個?
	for (i = 0; i < N + 1; i++){
		bucket[i] = 0;
	}

	// テ・ツ?・テ・ツ環崚」ツ?ォテ」ツ?療」ツ?淌」ツ?古」ツ?」テ」ツ?ヲテゥツ??ヲツャツ。テゥツ?催・ツ按療」ツつ津」ツつォテ」ツつヲテ」ツδウテ」ツδ暗」ツつ「テ」ツδε」ツδ?
	while (cin >> input){
		bucket[input]++;
	}

	// テ」ツつづ」ツ?」テ」ツ?ィテ」ツつづ・ツ、ツ堙」ツ?湘・ツ?コテ」ツ?淌・ツ崢榲ヲツ閉ーテ」ツつ津ヲツアツづ」ツつ?」ツつ?
	for (i = 0; i < N + 1; i++){
		if (max < bucket[i]){
			max = bucket[i];
		}
	}

	// テ」ツ?敕」ツ?ョテ・ツ崢榲ヲツ閉ーテ」ツ??」ツ?妥・ツ?・テ・ツ環崚」ツ?陛」ツつ古」ツ?淌ヲツ閉ーテ・ツ?、テ」ツつ津・ツ?コテ・ツ環?
	for (i = 0; i < N + 1; i++){
		if (max == bucket[i]){
			printf("%d\n", i);
		}
	}

	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,s[101],d,f[101],g,i,j;
	for(i=1;i<=100;i++){
		f[i]=i;
		//printf("%d\n",f[i]);
	}
	for(i=1;i<=100;i++){
		s[i]=0;
	}
	while(scanf("%d",&a)!=EOF){
		s[a]++;
	}
	for(i=1;i<=100;i++){
		for(j=i+1;j<=100;j++){
			if(s[i]<s[j]){
				d=f[i];
				f[i]=f[j];
				f[j]=d;
				d=s[i];
				s[i]=s[j];
				s[j]=d;
			}
		}
	}
	printf("%d\n",f[1]);
	for(i=2;i<=100;i++){
		if(s[1]==s[i]){
			printf("%d\n",f[i]);
		}
		if(s[1]<s[i]){
			break;
		}
	}
	return 0;
}

C++: #include <stdio.h>
#include<math.h>
using namespace std;

int main(){

	int count[101],tmp,max=-1;
	for(int i=0;i < 101;i++)count[i] = 0;

	while(scanf("%d",&tmp)!=EOF){
		count[tmp]++;
		max = (max >= count[tmp])?max:count[tmp];
	}

	for(int i=0;i<101;i++){
		if(count[i] == max)printf("%d\n",i);
	}
    return 0;
}

C++: #include <iostream>
#include <queue>
using namespace std;
int main()
{
	int num[101]={},a;
	while(cin>>a)num[a]++;
	int m=0;
	queue<int> que;
	for(int i=1;i<=100;i++){
		if(num[i]>m){
			m=num[i];
			while(!que.empty())que.pop();
			que.push(i);
		}else if(num[i]==m){
			que.push(i);
		}
	}
	while(!que.empty()){
		cout<<que.front()<<endl;
		que.pop();
	}
    return 0;
}

C++: #include <math.h>
#include <ctype.h>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)
struct omt{omt(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int main(){
    int n;
    map<int, int> mp;

    while(cin >> n){
        mp[n]++;
    }
    
    int ma = 0;
    vector<int> A;
    for(auto x : mp){
        if(x.second > ma){
            A.clear();
            ma = x.second;
            A.push_back(x.first);
        }else if(x.second == ma){
            A.push_back(x.first);
        }
    }
    sort(A.begin(), A.end());
    for(auto x : A) cout << x << endl;


    return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
//	cut here before submit 
//	freopen ("testcase.MV", "r", stdin );
	string str = "";
	map<int,int> cnt; cnt.clear();
	int max_cnt = 0;
	while (getline (cin, str ) ){
		stringstream ss (str );
		int a;
		ss >> a;
		cnt[a]++;
		max_cnt = max (max_cnt, cnt[a] );
	} // end while
	vector<int> res; res.clear();
	map<int,int>::iterator it = cnt.begin();
	for (;it != cnt.end(); it++ ){
		int num = (*it).first;
		int c = (*it).second;
		if (max_cnt == c ){
			res.push_back (num );
		} // end if
	} // end for
	sort (ALL (res ) );
	rep (i, res.size() ){
		cout << res[i] << endl;
	} // end rep
		
	return 0;
}

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

int main()
{
	int val[100] = {0};
	int i;
	while(cin >> i){
		val[i]++;
	}
	int rec=0;
	for(int i=0;i<100;i++)
		rec = max(rec,val[i]);
	for(int i=0;i<100;i++)
		if(val[i]==rec)
			cout << i << endl;
	return 0;
}

C++: #include<iostream>
using namespace std;
int num[101];
int main(){
  int n,m=0;
  while(cin >>n){
    num[n]++;
    if(num[n]>m) m = num[n];
  }
  for(int i=0; i<101; i++)
    if(num[i] == m) cout <<i<<endl;
  return 0;
}