Go: package main

import (
    "fmt"
    "sort"
)

type Player struct {
    Name int
    Score  int
}

type Place []Player

func (p Place) Len() int {
    return len(p)
}

func (p Place) Swap(i, j int) {
    p[i], p[j] = p[j], p[i]
}

func (p Place) Less(i, j int) bool {

	if p[i].Score == p[j].Score {
		return p[i].Name < p[j].Name
	} else {
		return p[i].Score > p[j].Score
	}
   
}

func DataEntry(n int) Place {
	var id, sc int
	var ranking Place
	var adding Player

	for i := 0; i < n; i++ {

		fmt.Scan(&id, &sc)

		adding.Name = id
		adding.Score = sc

		ranking = append(ranking, adding)
	}

	return ranking
}

func main() {
	var ranking Place
	var num int

		fmt.Scan(&num)
		ranking = DataEntry(num)
	
	sort.Sort(Place(ranking))
	fmt.Println(ranking[0].Name ,ranking[0].Score)
}

C++: #include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define sort(ss) sort(ss.begin(), ss.end())
#define rsort(ss) sort(ss.rbegin(), ss.rend())
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return acos(-1.0);
}
typedef set<int> set_i;
typedef set<string> set_s;
int INF=1000000;
int main(){
	int a,ac[30]={},win=0,ss,qq=10,i;
	cin>>ss;
	for(int e=0;e<ss;e++){
		cin>>a;
		cin>>ac[e];
		if(ac[e]>=win){
			if(ac[e]==win){
				if(qq>a) qq=a;
			}
			else{
				win=ac[e];
				qq=a;
			}
		}
	}
	cout<<qq<<" "<<win<<endl;
}

C++: #include <iostream>

using namespace std;

int p[20];
int fish[20];

void bubble_sort_fish(int n){

  for( int i = 0 ; i < n - 1 ; i++ ){
    for( int j = n - 1 ; j > i ; j-- ){
      if( fish[j-1] > fish[j] ){

	int temp1 = fish[j];
	fish[j] = fish[j-1];
	fish[j-1] = temp1;

	int temp2 = p[j];
	p[j] = p[j-1];
	p[j-1] = temp2;

      }
    }
  }
}

int main(void){

  int n;

  cin >> n;
  for( int i = 0 ; i < n ; i++ ){
    cin >> p[i] >> fish[i];
  }

  bubble_sort_fish(n);//ただのバブルソートの練習、とくに意味はない。
  //  for( int i = 0 ; i < n; i++ )cout << p[i] << "---" << fish[i] << endl;
  //確認のアウトプット
  //以下がアルゴリズム
  int max_fish = 0;
  int min_p = 20;
  for( int i = n - 1 ; i >= 0 ; i-- ){
    if( max_fish <= fish[i] && min_p > p[i] ){
      max_fish = fish[i];
      min_p = p[i];
    }
  }
  cout << min_p << " " << max_fish << endl;
}

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

int main(void){

  int n;
  int a[2000];
  int v[10000];
  int max = 0;
  int num = 0;

  cin >> n;

  for( int i = 0 ; i < n ; i++ ){

    cin >> a[i] >> v[i];

    if( max < v[i] ){
      
      max = v[i];
      num = a[i];

    }

  }

  cout << num << " " << max << endl;

  return 0;

}

C++: // #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>	// istringstream
using namespace std;

int main(){
	int n, max = 0, ans = 0;
	int bangou = 0, num = 0;
	map<int, int> list;

	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> bangou >> num;
		if (max < num){
			max = num;
			ans = bangou;
		}
	}
	cout << ans << " " << max << endl;

	return 0;
}

C++: #include <cstdio>

int main(){
	int n,a,v,ta = -1,tv = -1;
	scanf("%d",&n);
	for(int i = 0; i < n; i++){
		scanf("%d%d",&a,&v);
		if(v > tv || (v == tv && a < ta)){
			tv = v;
			ta = a;
		}
	}
	printf("%d %d\n",ta,tv);
	return 0;
}

C++: #include<cstdio>
using namespace std;
int main(void)
{
    int n,a,b,i,max,x;
    scanf("%d",&n);
	max=0;
    for(i=0;i<n;i++){
        scanf("%d %d",&a,&b);
        if(max<=b){
            if(max<b){
                x=a;
                max=b;
            }
			else{
				x=a;
			}
		}
    }
    printf("%d %d\n",x,max);
    return 0;
}

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

#define reep(i,n,m) for(int i=(n);i<(m);i++)
#define rep(i,n) reep(i,0,n)

using namespace std;

pair<int, int> pii;

int main(){
    int n;
    cin >> n;
    int s[21] = {0};
    int ans=0;
    int sum=0;
    rep(i,n){
        int a,v;
        cin >> a >> v;
        s[a] += v;
        if(sum<s[a]){
            ans = a;
            sum = v;
        }else if(sum==s[a] && ans > a){
            ans = a;
        }
    }

    printf("%d %d\n",ans, sum);
}

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

using namespace std;

int main()
{
  pair<int, int> perf[20], max;
  int i, n;

  cin >> n;
  for (i = 0; i < n; i++) {
	cin >> perf[i].first >> perf[i].second;
  }

  max = perf[0];
  for (i = 1; i < n; i++) {
    if (max.second < perf[i].second) {
      max = perf[i];
    }
  }

  cout << max.first << " " << max.second << endl;

  return 0;
}

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

int main(){
	
	int n;
	int a,b;
	
	cin >> n ;
	cin >> a >> b ;
	
	int max=a,num=a;
	
	for( int i=1 ; i<n ; i++ ){
		cin >> a >> b ;
		if( max < b ){
			max=b;
			num=a;
		}
		else if( max == b && num > a ) num=a;
	}
	
	cout << num << " " << max << endl ;
	
return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,m=0;cin >> n;
  int d[21]={};
  int a,v;
  while(n--){
    cin >> a >> v;d[a]=v;
    if(d[m]==d[a]&&a<m)m=a;
    if(d[m]<d[a])m=a;
  }
  cout << m << " " << d[m] << endl;
}

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

int main(void){

  int n;
  int max = 0;
  int num = 0;

  cin >> n;

  for( int i = 0 ; i < n ; i++ ){

    int a[20];
    int v[100];

    cin >> a[i] >> v[i];

    if( max < v[i] ){
      
      max = v[i];
      num = a[i];

    }

  }

  cout << num << " " << max << endl;

  return 0;

}

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

int main(){
  int n;
  int i,num,w;
  pair<int,int> fish[100] ;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> num >> w;
    fish[i] = make_pair(-w,num);
  }
  sort(fish,fish+n);
  cout << fish[0].second << " " << (-1)*fish[0].first << endl;
}

C++: #include<stdio.h>

int main(){

int x,y,n;
int X=0,Y=0;


scanf("%d",&n);

for(int i=0;i<n;i++)
{
scanf("%d %d",&x,&y);
if(Y==y&&x<X){X=x;Y=y;}
if(Y<y){X=x;Y=y;}

}

printf("%d %d\n",X,Y);
return 0;
}

C++: #include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

////////////////*My library*////////////////////////
#define rep_to(a,i,n) for(i=a;i<n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define rep_r(i,n) for(i=n-1;i>=0;i--)
#define debug_i(x) printf("x:%d\n",x)
#define debug_s(str) printf("str:%s\n",str)
#define debug_c(c) printf("c:%c\n",c)
#define s_i1(x) scanf("%d",&x)
#define s_i2(x,y) scanf("%d %d",&x,&y)
#define s_i3(x,y,z) scanf("%d %d %d",&x,&y,&z)
////////////////////////////////////////////////////
////////////////////////
/*prime()*/
/*primecount()*/
/*sort()*/
///////////////////////

int main()
{
	int i,j,k;
	int n,q;
	int x,y,sd_num=0;
	double max=0,num=0,sd_max=0;
	int a[100000]={},v[100000]={};

	s_i1(n);
	rep(i,n)
	{
		scanf("%d %d",&x,&y);
		if(i==0)
		{
			max=y;
			num=x;
		}
		else 
		{
			num=(max<y)? x : num;
			max=fmax(y,max);
		}
		if(max==y)num=fmin(num,x);
	}
	printf("%d %d\n",(int)num,(int)max);
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,men,fish,num,fishmax;
cin>>n;
for(int i=0;i<n;i++){
cin>>men>>fish;
if(i==0){
num=men;
fishmax=fish;
}
else {
if(fish>fishmax){
fishmax=fish;
num=men;
}
else if(num>men&&fish==fishmax)num=men;
}
}
cout<<num<<" "<<fishmax<<endl;
}

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

using namespace std;

const int N = 20;

int main() {
	int n, m = 0;
	int a[N + 1] = { 0 };
	int x, y;
	cin >> n;
	for(int i = 0;i < n;++i) {
		cin >> x >> y;
		a[x] = y;
		m = y > m ? y : m;
	}
	for(int i = 1;i <= N;++i) {
		if(a[i] == m) {
			cout << i << " " << a[i] << endl;
			break;
		}
	}
	return 0;
}