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 <iostream>
using namespace std;
int main(){
  int n,a,b,max = 0,ans;
  cin >> n;
  while(n--){
    cin >> a >> b;
    if(max < b ){
      max = b;
      ans = a;
    }
  }
  cout << ans << " " << max << endl; 
}

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

int main() {
  int n, a, v, ma, mv;
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> a >> v;
    if(i == 0) {
      ma = a;
      mv = v;
    }
    if(v >= mv) {
      if(v == mv && a > ma) break;
      ma = a;
      mv = v;
    }
  }
  cout << ma << ' ' << mv << endl;
}

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

int main(void){

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

  cin >> n;

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

    int a = 0,v = 0;

    cin >> a >> v;

    if( max <= v && flag == 0){
      
      max = v;
      num = a;

      if( v == 0 ) flag = 1;

    }

  }

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

  return 0;

}

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

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

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

int a[20], idx, mx;

int main()
{
    int n; cin >> n;
    for(int i=0, index=0;i < n; ++i) {
        cin >> index >> a[index-1];
        if (mx < a[index-1]) mx = a[index-1], idx = index;
    }

    printf("%d %d\n", idx, mx);

    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int n[20]={0},num,a,z=21,max=0;
	cin>>num;
	for(int i=0;i<num;i++){
		cin>>a>>n[a];
		if(max<=n[a]){
			if(z>a)z=a;
			max=n[a];
		}
	}
	cout<<z<<" "<<max<<endl;
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 99999999;

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

typedef long long ll;

using namespace std;



/*
class TheKingsArmyDiv2
{
public:
	int getNumber(vector <string> state)
	{

	}
};
*/




int main()
{
	int n;
	
	cin >> n;
	pair<int, int> av[n];
	
	REP(n)
	{
		cin >> av[i].first >> av[i].second;
	}
	
	int max_num = -1;
	int ind;
	REP(n)
	{
		if (av[i].second > max_num)
		{
			max_num = av[i].second;
			ind = av[i].first;
		} else if (av[i].second == max_num && ind > av[i].first) {
			max_num = av[i].second;
			ind = av[i].first;
		}
	}
	
	cout << ind << " " << max_num << endl;
	
	return 0;
}

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

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

int main() {
  int n;
  int a, b;
  int maxv = -1;
  int id = 21;
  
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> a >> b;
    if ( maxv == b ) {
      if( id > a ) {
	maxv = b;
	id = a;
      }
    } else if ( maxv < b ) {
      maxv = b;
      id = a;
    }
  }

  cout << id << " " << maxv << endl;
  return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,a[20],v[100],deta;
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i]>>v[i];
    for(int i=0;i<n-1;i++)for(int j=0;j<n-1;j++)
    {
        if(v[j]<v[j+1])
        {
            deta=v[j];
            v[j]=v[j+1];
            v[j+1]=deta;
            deta=a[j];
            a[j]=a[j+1];
            a[j+1]=deta;
        }
    }
    cout<<a[0]<<" "<<v[0]<<endl;
    return 0;
}

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

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;

int main() {
	int n;
	cin >> n;
	int fish[n+1];
	rep(i,n) {
		int a, v;
		cin >> a >> v;
		fish[a] = v;
	}
	int mi = 1;
	for(int i=2; i<=n; i++) {
		if(fish[mi] < fish[i]) mi = i;
	}
	cout << mi << ' ' << fish[mi] << endl;
	return 0;
}

C++: #include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int main(){
	int n, mx = -1, mxi, a, b;
	cin >> n;
	rep(i, n){
		cin >> a >> b;
		if(mx < b || mx == b && mxi > a) mx = b, mxi = a;
	}
	cout << mxi << " " << mx << endl;
	return 0;
}

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

int main(){
    int a[30]={0},p,q;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>p>>q;
        a[p]+=q;
    }
    int m=0,b;
    for(int i=0;i<n;i++){
        if(m<a[i]){
            m=a[i];
            b=i;
        }
    }
    cout<<b<<" "<<m<<endl;
}

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

int main(void){

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

  cin >> n;

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

    int a = 0,v = 0;

    cin >> a >> v;

    if( max <= v && flag == 0){
      
      max = v;
      num = a;

      if( v == 0 ) flag = 1;

    }

  }

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

  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;

int main(){
    int n;
    cin >> n;
    int s[100] = {0};

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

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

C++: #include <iostream>

using namespace std;

int info[22];

int main()
{
    int n, a, v;
    int max_idx = -1;

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> a >> v;
        info[a] = v;
    }
    
    for (int i = 1; i <= n; i++)
        if (info[max_idx] < info[i])
            max_idx = i;
    cout << max_idx << " " << info[max_idx] << endl;

    return 0;
}