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

using namespace std;

int main()
{
	int i;
	map<int,int> mp;
	while(cin>>i){
		if(!mp.count(i))	mp.insert(make_pair(i,0));
		else				mp.find(i)->second++;
	}

	int vmax=-1e9;
	map<int,int>::iterator it;
	for(it=mp.begin();it!=mp.end();it++)vmax=max(vmax,it->second);
	for(it=mp.begin();it!=mp.end();it++)if(it->second==vmax)printf("%d\n",it->first);

	return 0;
}

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

using namespace std;

typedef struct {
  int v;
  int i;
} data;

data map[100];

int greater(data a, data b){
  if(a.v > b.v) return 1;
  else if(a.v == b.v) return a.i < b.i;
  else return 0;
}

int main(){
  int i;
  for(i=0;i<100;i++) map[i].i=i+1,map[i].v = 0;

  int n;
  while(scanf("%d", &n)!=EOF) map[n-1].v++;

  sort(map, map+100, greater);

  int v = map[0].v;

  for(i=0;i<100;i++){
    if(map[i].v == v) printf("%d\n", map[i].i);
    else break;
  }
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cassert>

using namespace std;


bool solve(){
	vector<vector<int> > a(100, vector<int>(2, 0));
	for(int i=0;i<100;i++){
		a[i][0] = i;
	}
	int n;
	while(cin>>n){
		a[n][1]++;
	}
	for(int i=0;i<100-1;i++){
		for(int j=i;j<100;j++){
			if(a[i][1] < a[j][1]){
				swap(a[i][0],a[j][0]);
				swap(a[i][1],a[j][1]);
			}
		}
	}
	int hoge=0;
	while(1){
		cout<< a[hoge][0]<< endl;
		if(a[hoge][1]!=a[hoge+1][1]) break;
		hoge++;
	}
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

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

using namespace std;
int main(){
	int a[101]={0},n=0,saidai[100]={0},m=0;
	while(cin>>n){
		a[n]++;
	}
	for(int i=1;i<101;i++){
		if(saidai[m]<a[i]){
			for(int x=0;x<=m;x++){
				saidai[x]=0;
				m=0;
			}
			saidai[m]=i;
		}
		else if(saidai[m]==a[i]){
			saidai[m+1]=saidai[m];
			saidai[m]=i;
			m++;
		}
	}
	sort(saidai,saidai+100);
	for(int i=0;i<=100;i++){
		if(saidai[i]!=0){
			cout<<saidai[i]<<endl;
		}
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

#define EPS 1e-8

int main(){
	
	map<int, int> mp;
	
	int a, maxi = 0;
	while(cin >> a){
		mp[a]++;
		maxi = max(maxi, mp[a]);
	}
	for(auto it : mp){
		if(maxi == it.second) cout << it.first << endl;
	}

	
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include<map>
#include<vector>
#define int long long
using namespace std;
int test[123];
signed main() {
	int n, a, ans = 0;
	for (int h = 0; h < 12; h++) {
		cin >> n;
		test[n]++;
	}
	for (int h = 1; h <= 100; h++) {
		ans = max(ans, test[h]);
	}
	for (int h = 1; h <= 100; h++) {
		if (test[h] == ans) {
			cout << h << endl;
		}
	}
}

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

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

C++: #include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>

using namespace std;

int main() {
    int n[101]={0};
    int max = 0;
    int x;
    while(scanf("%d",&x)!=EOF){
        n[x]++;
        if(max<n[x]){
            max=n[x];
        }
    }
    for(int i=0; i<101; i++){
        if(max==n[i]){
            cout<<i<<endl;
        }
    }
    return 0;
}

C++: 5
6
3
5
8
7
5
3
9
7
3
4

C++: // Mode Value

#include <iostream>
using namespace std;

int main() {
    int counter[100] = {};
    int val;
    int freq;
    // count
    while (cin >> val) {
        counter[val-1]++;
    }

    // find mode
    freq = 0;
    for (int idx = 0; idx < 100; idx++) {
        if (counter[idx] > freq)
            freq = counter[idx];
    }

    // print mode(s)
    for (int idx = 0; idx < 100; idx++) {
        if (counter[idx] == freq)
            cout << idx+1 << "\n";
    }
    return 0;
}

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

using namespace std;

int main(){
  int mode[101]={};
  for(int n;cin>>n;){
    mode[n]++;
  }
  int l=0;
  for(;;){
    int *mp=max_element(mode,mode+101);
    if(*mp<l)break;
    l=*mp;
    cout<<mp-mode<<endl;
    *mp=0;
  }
  return 0;
}

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

using namespace std;

void Solution()
{
    int n;
    
    int times = 0; // save the data in here about most frequently times
    
    int a[101] = {0};　// the array which saves the mode value, at the beginning is all "0"
    
    while(cin>>n)
    {
        a[n]++; //after input some value, array's value can be added by 1 (0 -> 1), repeat this part.
    }
    
    
    for(int i = 0; i < 101; i++) // the data is less than 100
    {
        if(a[i] > times) //check the  a[] value for ensuring the mode value
        {
            times = a[i]; //repeat this part, at the last, can find mode value
        }
    }
    
    for(int i = 0; i < 101; i++) //output mode value
    {
        if(a[i] == times)
        {
            cout<<i<<endl;
        }
    }
}

int main()
{
    Solution();
    return 0;
}

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