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>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<map>
using namespace std;
struct data{
    int n,m;
    data(int a,int b){
        n=a;m=b;
    }
    data(){}
    bool operator<(const data &d)const{
        if(m!=d.m)return (m<d.m);
        else return (n>d.n);
    }

};
int main(){
    int n;
    cin>>n;
    data Max(100000,0);
    for(int i=0;i<n;i++){
        int p,q;
        cin>>p>>q;
        Max=max(Max,data(p,q));
    }
    cout<<Max.n<<" "<<Max.m<<endl;
}

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

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

int main(){
  int n,max=0,maxi=0,num,rec;
  cin >> n;
  for(int i=0;i<n;i++){
    scanf(" %d %d",&num,&rec);
    if(rec>max){
      max=rec;
      maxi=num;
    } else if(rec==max){
      if(maxi>num){
	maxi=num;
      }
    }
  }
  cout << maxi << " " << max << endl;  
  return(0);
}

C++: #include <iostream>
#include <algorithm>
#define P pair<int,int>
using namespace std;
bool cmp(const P& p, const P& q){
	if(p.first!=q.first) return p.first>q.first;
	return p.second<q.second;
}
int main() {
	int n ; cin >> n ;
	P a[20]; for(int i=0;i<n;i++) cin >> a[i].second >> a[i].first ;
	sort(a,a+n,cmp);
	cout << a[0].second << ' ' << a[0].first << '\n';
}

C++: #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59
using ld = long double;

bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
    {
        return a.second < b.second;
    }
    return a.first < b.first;
}
int main()
{
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    cout << fixed << setprecision(6);

    int n;
    cin >> n;
    vector<pair<int, int>> vp;

    for (int i = 0; i < n; ++i)
    {
        int a, v;
        cin >> a >> v;
        vp.push_back({v, a});
    }
    sort(vp.rbegin(), vp.rend());

    if (n == 1)
    {
        cout << vp[0].second << " " << vp[0].first << endl;
    }
    else
    {
        int maxV = vp[0].first;
        int idx = vp[0].second;
        for (int i = 0; i < n; ++i)
        {
            if (maxV != vp[i].first)
            {
                break;
            }
            idx = vp[i].second;
        }
        cout << idx << " " << maxV << endl;
    }
    return 0;
}

C++: #include <cstdio>

using namespace std;

int main()
{
 int n;
 int a[20], v[20];
 scanf("%d", &n);

 for (int i = 0; i < n; i++) scanf("%d %d", a + i, v + i);

 int ai = 9999, vi = -1;

 for (int i = 0; i < n; i++){
  if (v[i] > vi){
    vi = v[i];
    if (ai > a[i]) ai = a[i];
  }
  else if (v[i] == v[i]){

  }
 }
 return (!printf("%d %d\n", ai, vi));
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
typedef pair<int, int> P;

int main(){
  int N;
  while(cin >> N){
    vector<P> v(N);
    REP(i, N) {
      int a, t;
      cin >> a >> t;
      v[i] = P(-t, a);
    }
    sort(v.begin(), v.end());
    cout << v[0].second << endl;
  }
  return 0;
}

C++: #include<iostream>
int a,v,M;
main(A)
{
for(std::cin>>a;std::cin>>a>>v;)M<v&&(M=v)&(A=a);
std::printf("%d %d\n",A,M); 
}

C++: #include<stdio.h>
int main(void)
{
	int a,s,d,f,g,i;
	f=0;
	scanf("%d",&a);
	for(i=1;i<=a;i++){
		scanf("%d %d",&s,&d);
		if(f<d){
			f=d;
			g=s;
		}
	}
	printf("%d %d\n",g,f);
	return 0;
}

C++: #include<iostream>
int a,v,A,V;main(){for(std::cin>>A;std::cin>>a>>v;)(V<v||V==v&&A>a)&&(V=v)&(A=a);std::cout<<A<<" "<<V<<"\n";}

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

C++: #include <iostream>

using namespace std;

int main() {
    int n; cin>>n;
    int ta=0, tv=0;
    for(int i=0; i<n; ++i) {
        int a,v; cin>>a>>v;
        if(v > tv) {
            ta = a;
            tv = v;
        }
    }

    cout << ta << " " << tv << endl;

    return 0;
}

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

using namespace std;


struct fish{
    int man;
    int point;
};


bool comp(const fish f1, const fish f2){
    if(f1.point<f2.point){
        return 0;
    }else if(f1.point>f2.point){
        return 1;
    }else{
        if(f1.man<f2.man){
            return 1;
        }else if(f1.man>f2.man){
            return 0;
        }else{
            return 0;
        }
    }
}

int main(){
    int n;
    while(cin>>n){
        fish f[20];
        for(int i=0; i<n; i++){
            cin>>f[i].man>>f[i].point;
        }
        
        sort(f, f+n, comp);
        
        
        
        cout<<f[0].man<<" "<<f[0].point<<endl;
        
        
       
    }
}