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 <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main(){
	int n,a[20],b[20],k;
	while(cin >> n){
	for(int i=0;i<n;i++){
		cin >> a[i] >> b[i];
	}
	for(int j=1;j<n;j++){
		for(int i=0;i<n-j;i++){
			if(b[i]<b[i+1]){
				k=b[i];b[i]=b[i+1];b[i+1]=k;
				k=a[i];a[i]=a[i+1];a[i+1]=k;
			}
		}
	}
	cout << a[0] <<" "<< b[0] <<"\n";
	}
return 0;
}

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

int main() {
	int n;
	cin >> n;
	int num = 0;
	int fish = 0;
	for (int i = 0; i < n; ++i) {
		int a, v;
		cin >> a >> v;
		if (fish < v) {
			num = a;
			fish = v;
		}
		else if (fish == v && num > a) {
			num = a;
		}
	}
	cout << num << ' ' << fish << endl;
	
	return 0;
}

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

int main(void){

  int n;
  int a[20] = {0};
  int v[100] = {0};
  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++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[2];
	a[1]=0;
	for(int i=0;i<n;i++){
		int b,c;
		cin>>b>>c;
		if(c>a[1]){
			a[0]=b;
			a[1]=c;
		}
	}
	cout<<a[0]<<" "<<a[1]<<endl;
	return 0;
}

C++: #include<stdio.h>
 
int main(){
	int n, a, b, i, max = 0, num = 100;
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d %d", &a, &b);
		if(max <= b){
			max = b;
			if(max < b) num = a;
			else if(num > a) num = a; 
		}
	}
	printf("%d %d\n", num, max);
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
	int n,v,a;
	int max=0,ans=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>v;
		if(max<v){
			ans=a;
			max=v;
		}
	}
	cout<<ans<<" "<<max<<endl;
}

C++: #include<stdio.h>
int main(void)
{
	int n;
	int a[21],v[101];
	int i;
	int max=0,m;

	while(scanf("%d",&n)!=EOF){
		for(i=0;i<n;i++){
			scanf("%d %d",&a[i],&v[i]);
			if(max<v[i]){
				max=v[i];
				m=a[i];
			}
			if(max==v[i] && m>a[i]){
				m=a[i];
			}
		}
		printf("%d %d\n",m,max);
	}
	return 0;
}

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

struct Human {
    int no;
    int result;
};
typedef struct Human Human;

int compareTo(const Human& a, const Human& b) {
    return(a.result > b.result);
}

int main(void) {
    int num; cin >> num;
    Human table[num];
    for(int r = 0; r < num; r++) cin >> table[r].no >> table[r].result;
    sort(table, table+num, compareTo);
    
    int minNo = INT_MAX, minResult = INT_MAX;
    int topResult = table[0].result;
    for(int r = 0; r < num && (table[r].result == topResult); r++) {
        if(table[r].no < minNo) {
            minNo = table[r].no; minResult = table[r].result;
        }
    }
    cout << minNo << " " << minResult << endl;
    return(0);
}

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

int main(void){
  int n,num,w,takata,vic = 0;
  int p[20] = {0};

  cin >> n;
  for(int i = 0 ; i < n ; i++){
    cin >> num >> w;
    p[num-1] = w;  
  }

  takata = p[0];
  for(int i = 1 ; i < n ; i++){
    if(takata < p[i]){
      takata = p[i];
      vic = i;
    } 
  }
  vic++;
  cout << vic << ' ' << takata << endl;

  return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	int maxn, maxs;
	cin >> maxn >> maxs;
	for (int i = 0; i < n - 1; i++){
		int a, b; cin >> a >> b;
		if (maxs < b){
			maxn = a;
			maxs = b;
		}
		else if (maxs == b){
			maxn = min(maxn, a);
		}
	}
	cout << maxn <<' '<< maxs << endl;
}

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

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

struct person {
	int a;
	int v;
};
int main() {
	struct person man[25],max;
	max.a=max.v=0;
	int n;
	cin>>n;
	while(n--){
		cin>>man[n].a>>man[n].v;
		if(max.v<man[n].v)max=man[n];
	}
	cout<<max.a<<" "<<max.v<<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[21] = {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>
#include<map>
using namespace std;

int main() {
	int n;
	map<int, int>m;
	map<int, int>::iterator pm;
	cin >> n;

	for (int i = 0;i < n;i++) {
		int a, b;
		cin >> a >> b;
		m.insert(pair<int, int>(b, a));
	}

	pm = m.end();
	pm--;
	cout << pm->second << ' ' << pm->first << endl;
	return 0;

}

C++: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

int main(){
  int n;
  while(~scanf("%d",&n)){
    int fish_num[21];
    memset(fish_num,0,sizeof(fish_num));

    int max_fish = 0;
    for(int i=0;i<n;i++){
      int a,v;
      scanf("%d %d",&a,&v);
      fish_num[a] += v;
      max_fish = max(max_fish,fish_num[a]);
    }

    for(int a=1;a<=n;a++){
      if(fish_num[a] == max_fish){
	printf("%d %d\n",a,fish_num[a]);
	break;
      }
    }
  }
}

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

int main(){
  int n;
  cin >> n;
  vector<pair<int,int> > p(n, pair<int,int>(0,0));
  for (int i = 0; i < n; i++){
    cin >> p[i].second >> p[i].first;
    p[i].second = -p[i].second;
  }
  sort(p.begin(), p.end(), greater<pair<int,int> >());
  cout << (-p[0].second) << ' ' << p[0].first;
}

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

#define loop(v, f, l) for(int v = (f), v##_ = (l); v < v##_; ++v)

using namespace std;

typedef long long int lint;
static inline int in(){ int x; scanf("%d", &x); return (x); }
static inline lint inl(){ lint x; scanf("%lld", &x); return (x); }

int main()
{
	int maxF = 0, winNum = 0;
	int n;
	int get, num;
	scanf("%d", &n);
	loop(i, 0, n)
	{
		scanf("%d%d", &num, &get);
		if( maxF < get )
		{
			winNum = num;
			maxF = get;
		}
	}
	printf("%d %d\n", winNum, maxF);
	return (0);
}

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

int main(){

  int n, a, v, m_a, m_v;

  cin >> n;

  m_v = 0;
  for(int i=0; i<n; i++){
    cin >> a >> v;

    if(v >= m_v){
      if(v != m_v || v == m_v && a < m_a){
        m_a = a;
        m_v = v;
      }
    }
  }

  cout << m_a << " " << m_v << endl;

  return 0;

}