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>
#include <algorithm>
#include <functional>

using namespace std;

int main(void){
	int times[10];
	int i, n;
	int max;

	for(i=0;i<10;i++){
		times[i] = 0;
	}

	while(cin >> n){
		times[n]++;
	}

	max = 0;
	for(i=0;i<10;i++){
		if(max < times[i]){
			max = times[i];
		}
	}

	for(i=0;i<10;i++){
		if(max == times[i]){
			cout << i << endl;
		}
	}
	return 0;
}

C++: #include <stdio.h>
	int main(){
		int input,suu[101]={0},i,max=0;
		while(scanf("%d",&input)!=EOF){
			suu[input]++;
			if(max<=suu[input]) max=suu[input];
		}
		for(i=1;i<101;i++){
			if(max==suu[i]){
				printf("%d\n",i);
			}
		}
	return 0;
}

C++: #include<iterator>
#include<algorithm>
#include<vector>
#include<map>
#include<iostream>
auto main ( ) -> int
{
    using namespace std ;
    vector < int > ns ;
    copy ( istream_iterator < int > { cin } , istream_iterator < int > { } , back_inserter ( ns ) ) ;
    map < int , int > table ;
    for ( auto n : ns )
    {
        auto table_find = table.find ( n ) ;
        if ( table_find != table.end ( ) )
	{
            ++ table_find->second ;
	}
	else
	{
            table [ n ] = 1 ;
	}
    }
    vector < pair < int , int > > sorted_table ;
    for ( auto p : table )
    {
        sorted_table.emplace_back ( p.second , p.first ) ;
    }
    sort ( sorted_table.rbegin ( ) , sorted_table.rend ( ) , [ ] ( pair < int , int > p1 , pair < int , int > p2 ) { return make_pair ( p1.first , p2.second ) < make_pair ( p2.first , p1.second ) ; } ) ;
    sorted_table.erase ( remove_if ( sorted_table.begin ( ) , sorted_table.end ( ) , [ sorted_table ] ( pair < int , int > p ) { return p.first < sorted_table [ 0 ].first ; } ) , sorted_table.end ( ) ) ;
    for ( auto p : sorted_table )
    {
        cout << p.second << endl ; 
    }
}

C++: 
#include<iostream>
#include<cstdio>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
typedef pair<int,int>PAIR;
 
bool cmp(const PAIR&left,const PAIR&right){     //Õâ¶ùÓÐ¸Ä¶¯ 
	
		return left.second == right.second ? left.first < right.first : left.second > right.second;
	
};
  
int main()
{
	map<int,int>m;
	int a,max;
	while(~scanf("%d",&a))
		m[a]++;
	vector<PAIR>v(m.begin(),m.end());
	sort(v.begin(),v.end(),cmp);
	max=v[0].second;
	for(int i=0;i!=(int)v.size();++i)
		if(v[i].second==max)
			cout<<v[i].first<<endl;
		else 
			break;
	return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   vector<bool> i;
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   int a[101]={0},max=0,tmp=0;
   VI ans;
   
   while(cin>>tmp){
      a[tmp]++;
      if(max==a[tmp]) ans.PB(tmp);
      if(max<a[tmp]){
         ans.clear();
         ans.PB(tmp);
         max=a[tmp];
      }
   }
   sort(ALL(ans));
   REP(i,ans.size()) cout << ans[i] << endl;
}

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

int main(){
   int n, m = 0;
   int a[101];
   vector<int> ans;

   for(int i=1 ; i <= 100 ; i++){
       a[i] = 0;
   }
   while( cin >> n ){
       a[n]++;
   }
   for(int i=1 ; i <= 100 ; i++){
       m = max( a[i] , m );
   }
   for(int i=1 ; i <= 100 ; i++){
       if( m == a[i] ) ans.push_back(i);
   }
   for(int i=0 ; i < ans.size() ; i++ ){
       cout << ans[i] << endl;
   }
}

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

#define N 100

int main(void){

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

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

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

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

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

	return 0;
}

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

int main(){
    int n;
    int nn[100];
    int max = 0;
    for(int i=0;i<100;i++){
        nn[i] = 0;
    }
    while(cin >> n){
        nn[n-1] += 1
        if(nn[n-1] > max){
            max = nn[n-1];
        }
    }
    for(int i=0;i<100;i++){
        if(nn[i] == max){
            cout << i+1 << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)

using namespace std;

int main(void){
	int a[101]={} , n;
	while(cin>>n){
		a[n]++;
	}
	n = 0;
	FOR(i,1,100){
		if(a[i]>n)
			n=a[i];
	}
	FOR(i,1,100){
		if(a[i]==n)
			cout << i << endl;
	}


	return 0;
}