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<stdio.h>
int main(void)
{
	int n,a[21],b[101],i,z,zz,max;
	max=-1;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a[i],&b[i]);
		if(b[i]>max){
			max=b[i];
			z=a[i];
		}
		if(max==b[i]){
			if(z<a[i]){
			z=z;
			}
			else if(z>a[i]){
			z=a[i];
			}
		}
	}
	printf("%d %d\n",z,max);
	return 0;
}

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

using namespace std;

int main()
{
    int n, a, v;
    
    cin >> n;
    
    vector<int> c(n, 0);
    
    for(int i = 0; i < n; i++)
    {
        cin >> a >> v;
        
        c[a - 1] += v;
    }
    
    int ptr = -1, cnt = -1;
    
    for(int i = 0; i < n; i++)
    {
        if(cnt < c[a - 1])
        {
            ptr = i;
            cnt = c[a - 1];
        }
    }
    
    cout << ptr << ' ' << cnt << endl;
    
    return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<int,int> P;
typedef complex<double> CP;
typedef long long ll;

int n;
P res;

int main(){
	cin>>n;
	int a,v;
	res.F=1; res.S=0;
	rep(i,n){
		cin>>a>>v;
		if(res.S<v){
			res.F=a; res.S=v;
		}
	}
	cout<<res.F<<" "<<res.S<<endl;
	return 0;
}

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

int main() {
	
	int n;
	int p[20]={};
	int a,v;
	int max=0;
	
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>a>>v;
		
		p[a] = v;
		if(v>max)max=v;
	}
	
	for(int i=0;i<n;++i){
		if(p[i]==max){
			cout<<i<<" "<<p[i]<<endl;
			break;
		}
	}
	
	return 0;
}

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

struct Entrant
{
  int num;
  int wakasagi;

  bool operator<(const Entrant& right) const
  {
    return wakasagi == right.wakasagi ? num > right.num : wakasagi < right.wakasagi;
  }
};

int main(void)
{
  int n;
  cin >> n;
  vector<Entrant> entrants(n);
  for (auto& e : entrants)
  {
    cin >> e.num >> e.wakasagi;
  }
  sort(entrants.begin(), entrants.end());
  cout << entrants.back().num << " " << entrants.back().wakasagi << endl;
  return 0;
}

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

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

struct P{
    int num;
    int fish;
    static bool more(const P& left,const P& right){
        return left.fish > right.fish;
    }
    static bool nummore(const P& left,const P& right){
        return left.num < right.num;
    }
};

int main(){
    int n;
    cin >> n;
    vector <P> data;
    P ls[n];
    for(int i=0;i<n;i++){
        cin >> ls[i].num >> ls[i].fish;
        data.push_back(ls[i]);
    }
    sort(data.begin(),data.end(),P::nummore);
    sort(data.begin(),data.end(),P::more);
    cout << data[0].num << " " << data[0].fish << endl;
}

C++: #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

bool comb(pair<int,int> a,pair<int,int> b){
    if(a.first==b.first){
        return a.second>b.second;
    }else return a>b;
}

int main(){
    int n;cin>>n;
    vector<pair<int,int>> v(n);
    
    rep(i,0,n){
        cin>>v[i].se>>v[i].fi;
    }
    rep(i,0,n-1){
        rep(j,i+1,n){
            if(v[i].fi>v[j].fi){
                pair<int,int> temp;
                temp=v[i];
                v[i]=v[j];
                v[j]=temp;
            }else if(v[i].fi==v[j].fi){
                if(v[i].se<v[j].se){
                    pair<int,int> temp;
                    temp=v[i];
                    v[i]=v[j];
                    v[j]=temp;
                }
            }
        }
    }
    cout<<v[n-1].se<<" "<<v[n-1].fi<<endl;

    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
const int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

typedef unsigned long long ull;
typedef std::pair<int,int> P;

bool compare(const P& lp, const P& rp){
    if(lp.second == rp.second){
        return lp.first > rp.first;
    }
    return lp.second < rp.second;
}

int main(){
    int N;
    std::cin >> N;

    std::vector<P> V;
    REP(i, N){
        int a, v;
        std::cin >> a >> v;
        V.push_back({a, v});
    }

    std::sort(V.begin(), V.end(), compare);

    std::cout << V[N-1].first << " " << V[N-1].second << std::endl;
}

C++: #include<stdio.h>
int main()
{
	int n;
	int a[20],v[20],max=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d %d",&a[i],&v[i]);
	}
	for(int i=0;i<n;i++){
		if(v[i]>max){
			max=v[i];
		}
	}
	for(int i=0;i<n;i++){
		if(max==v[i]){
			printf("%d %d\n",a[i],v[i]);
		}
	}
	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;

	return 0;
}

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 n;
	int number;
	int getNum;
	int numOfGetFish[20];
	int winnerIndex;
	int maxFish = 0;

	scanf("%d", &n);
	loop(i, 0, n)
	{
		scanf("%d%d", &number, &getNum);
		numOfGetFish[number - 1] = getNum;
	}
	loop(i, 0, n)
	{
		if( numOfGetFish[i] > maxFish )
		{
			winnerIndex = i + 1;
			maxFish = numOfGetFish[i];
		}
	}
	printf("%d %d\n", winnerIndex, maxFish);
	return (0);
}