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<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
using namespace std;
int main(){
int n;
cin>>n;
vector<int>in;
vector<int>no;
rep(i,n){
int a,b;
cin>>a>>b;
pb(in,b);
pb(no,a);
}
rep(i,2*n){
rep(j,n-1){
if(in[j]<in[j+1]){swap(in[j],in[j+1]);swap(no[j],no[j+1]);}
if(in[j]==in[j+1]&&no[j]<no[j+1])swap(no[j],no[j+1]);
}
}
cout<<no[0]<<" "<<in[0]<<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];
			}
		}
		printf("%d %d\n",m,max);
	}
	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(m_v < v){
      m_a = a;
      m_v = v;
    }
  }

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

  return 0;

}

C++: #include <iostream>

using namespace std;

int main()
{
	int n, a, v, maxa, maxv;

	cin >> n >> maxa >> maxv;

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

		if(v >= maxv && a < maxa){
			maxa = a;
			maxv = v;
		}
	}

	cout << maxa << ' ' << maxv << 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;
    while(n--){
        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<vector>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int N,x,y,ans1,ans2=-1;
	vector <int> num;
	cin >> N;
	while(N--){
		cin >> x >> y;
		if(y>ans2){
			num.clear();
			num.push_back(x);
			ans2 = y;
		}
		else if(y==ans2){
			num.push_back(x);
		}
	}
	sort(num.begin(),num.end());
	cout << num[0] << ' ' << ans2 << endl;
	return 0;
}

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

int main() {
  int n, a, b, max_a, max_b;
  scanf("%d", &n);
  max_a = max_b = 0;
  for (int i=0; i<n; i++) {
    scanf("%d %d", &a, &b);
    if (max_b<b) {
      max_b = b;
      max_a = a;
    } else if (max_b==b && max_a>a) {
      max_a = a;
    }
  }
  printf("%d %d\n", max_a, max_b);
  return 0;
}

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

#define n_fish first
#define number second

using namespace std;

typedef pair<int, int> PAIR;

int main()
{
  int n_entrants;
  vector<PAIR> entrants;
  PAIR entrant;

  cin >> n_entrants;
  for(int i = 0; i < n_entrants; ++i){
    cin >> entrant.number >> entrant.n_fish;
    entrants.push_back(entrant);
  }
  sort(entrants.begin(), entrants.end(), greater<PAIR>());

  cout << entrants.front().number << " " << entrants.front().n_fish << 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];
    ai = a[i];
  }
  else if (v[i] == vi){
    if (ai > a[i]) ai = a[i];
  }
 }
 return (!printf("%d %d\n", ai, vi));
}

C++: #include<iostream>
using namespace std;
int main(){
long n,i,a,b,aa,bb=0;
cin>>n;
for(i=0;i<n;i++){
cin>>a>>b;
if(bb<b){aa=a;bb=b;}
else if(bb==b&&a<aa){aa=a;bb=b;}
}
cout<<aa<<" "<<bb<<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[n-1].second << " " << fish[n-1].first << endl;
}

C++: #include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;

int main(void){
	int n,m,a[1000],max=0;
	a[0]=-1;
	cin >> n;
	for(int i=0;i<=n;i++){
		cin >> m;
		cin >> a[m];
	}
	rep(i,0,n+1){
		if(max<a[i]){
			max=a[i];
		}
	}
	rep(i,0,n+1){
		if(max == a[i]){
			cout << i << " " << a[i] << "\n";
		}
	}
	return 0;
}

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

using namespace std;
 
int main()
{
    int n, num, w;
    pair<int, int> p[20];  
 
    cin >> n;
    for (int i = 0; i < n; i++) {
	cin >> num >> w;
	p[i] = make_pair(-w, num);
    }
    sort(p, p+n);
    cout << p[0].second << ' ' << (-1) * p[0].first << endl;
    return 0;
}

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

using namespace std;

int main(void)
{
	int n;
	int a, v;
	vector < pair <int, int> > vi;

	cin >> n;
	while (n--){
		cin >> a >> v;
		vi.push_back(make_pair(v, a));
	}
	sort(vi.rbegin(), vi.rend());

	int ret[2] = {0}, ma = vi[0].first;
	for (int i = 0; i < vi.size(); i++){
		if (ma == vi[i].first){
			ret[0] = vi[i].first;
			ret[1] = vi[i].second;
		}
		else {
			break;
		}
	}


	cout << ret[1] << " " << ret[0] << endl;

	return 0;
}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		vector<int> h(n);

		for (int i = 0; i < n; i++) {
			cin >> h[i];
		}
		int up = 0, down = 0;
		for (int i = 0; i < n - 1; i++) {
			if (h[i] < h[i + 1]) {
				up = max(up, abs(h[i] - h[i + 1]));
			}
			else {
				down = max(down, abs(h[i] - h[i + 1]));
			}
		}

		cout << up << " " << down << endl;
	}
}

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

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,i;
	cin>>ss;
	for(int e=0;e<ss;e++){
		cin>>a;
		cin>>ac[e];
		if(ac[e]>win){
			win=ac[e];
			qq=a;
		}
	}
	cout<<qq<<" "<<win<<endl;
}

C++: #include <iostream>

using namespace std;

int main() {
    int n, id, p, tid = 0, tp = -1;
    cin >> n;
    while (n--) {
        cin >> id >> p;
        if (tp == p) {
            if (tid > id) {
                tid = id;
            }
        }
        else if (tp < p) {
            tp = p;
            tid = id;
        }
    }
    cout << tid << " " << tp << endl;

    return 0;
}