Go: package main

import (
	"bufio"
			"os"
	"strconv"
	"strings"
	"sort"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

type Patient struct {
	ID, Distance int
}
type ByDistance []Patient
func (p ByDistance) Len() int { return len(p) }
func (p ByDistance) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
func (p ByDistance) Less(i, j int) bool { return p[i]. Distance > p[j].Distance }

func main() {
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		patients := make([]Patient, n)
		for i := 0; i < n; i++ {
			scanner.Scan()
			buf := strings.Split(scanner.Text(), " ")
			id, _ := strconv.Atoi(buf[0])
			am, _ := strconv.Atoi(buf[1])
			pm, _ := strconv.Atoi(buf[2])
			patients[i] = Patient{id, am+pm}
		}
		sort.Sort(ByDistance(patients))
		fmt.Println(patients[0].ID, patients[0].Distance)
	}
}

Python: while True:
    n = int(input())
    if n == 0:
        break

    patients = [map(int, input().split()) for _ in range(n)]
    patients = [(p, d1+d2) for p, d1, d2 in patients]
    print(*max(patients, key=lambda x: x[1]))

C++: #include <bits/stdc++.h>
using namespace std;

int main()
{
	int N;
	
	while ( cin >> N, N != 0 ) {

		int index, maxv;
		int a, b, c;
		cin >> index >> b >> c;
		maxv = b + c;
		for ( int i = 1; i < N; i++ ) {
			cin >> a >> b >> c;
			if ( b + c > maxv ) {
				maxv = b + c;
				index = a;
			}
		}
		cout << index << " " << maxv << endl;
	}

	return ( 0 );
}

C++: #include<iostream>
using namespace std;
int main(){
	int n,p,d1,d2,maxp,maxv;
	while(1){
		cin >> n;
		if(n == 0) break;
		maxp = maxv = 0;
		while(n --){
			cin >> p >> d1 >> d2;
			if(maxv < d1+d2){
				maxp = p;
				maxv = d1+d2;
				}
		}
		cout<< maxp << maxv;
	}
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<utility>

using namespace std;

int n;

int p[10010];

int cnt;

int people;

int main(void)
{

	while (cin >> n, n)
	{
		fill(&p[0], &p[10010], -1);
		for (int i = 0; i < n; i++)
		{
			int pn, d1, d2;

			cin >> pn >> d1 >> d2;

			p[pn] = d1 + d2;
		}

		int ans = max_element(&p[0], &p[10010]) - p;



		

		cout << ans  << " " << p[ans] << endl;

	}
	return 0;
}

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

int main()
{
        int n,p,d1,d2,sum=0,num;
        while(true){
        cin >> n;
        if(n == 0){
                break;
        }
        for(int i=0;i<n;i++){
                cin >> p >> d1 >> d2;

                if(i==0){
                        sum = d1 + d2;
                        num = p;
                }
                else if(sum < (d1+d2)){
                        sum = d1 + d2;
                        num = p;
                }
        }
        cout << num << ' ' << sum << endl;
        }

        return 0;
}

C++: #include <iostream>
using namespace std;
struct k{
  int bangou;
  int score;
};
int main(){
  int n;
  int d1,d2,b;
  k id[1000];
  while(  cin >> n,n ){
    for(int i = 0 ; i < n ; i++){
      cin >> b >> d1 >> d2;
      id[i].bangou = b;
      id[i].score = (d1 + d2);
    }
    int max = 0;
    int ans_b; 
    for(int i = 0 ; i < n ; i++){
      if(id[i].score > max){
	max = id[i].score;
	ans_b = id[i].bangou;
      }
    }
    cout << ans_b << " " << max << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<map>
using namespace std;
 
int main()
{
 map< int,int, greater<int> > m;
 int n,i,p,d1,d2;
 while(cin>>n,n){
  m.clear();
  for(i=0;i<n;i++){
   cin>>p>>d1>>d2;
   m[d1+d2] = p;
  }
  cout<<(*m.begin()).second<<" "<<(*m.begin()).first<<endl;
 }
 return 0;
}

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

int main(){
  int N,a,b;
  int p_index,length,index;
  while(cin >> N && N != 0){
    //    cout << N << endl;
    int sum = 0;int temp = 0;
    for(int k=0;k<N;k++){
      cin >> p_index >> a >> b;
      //      cout << p_index << endl;
      temp = a + b;
      index = temp> sum? p_index : index;
      sum = temp>sum ? temp : sum;

      //      cout << p_index << " " << index << " " << temp << " " << sum << endl;
    }
    cout << index << " " << sum << endl;

  }
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,p[10005],d1[10005],d2[10005],sum[10005];
  int max[55],max2[55],j=0;
  cin>>n;
  while(n!=0){
    max2[j]=0;
    for(int i=0;i<n;i++){
      cin>>p[i]>>d1[i]>>d2[i];
      sum[i]=d1[i]+d2[i];
      if(sum[i]>max2[j]){
	max2[j]=sum[i];
	max[j]=p[i];
      }
    }
    j++;
    cin>>n;
  }
  for(int i=0;i<j;i++){
    cout<<max[i]<<" "<<max2[i]<<"\n";
  }
  return 0;
}

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

int main(){
	int n[10010], array[10010];

	fill(n, n+10010, 0);

	int num;
	while(cin >> num, num){
		for(int i=0; i< num; i++){
			int p, d1, d2;
			cin >> p >> d1 >> d2;
			n[p] = d1 + d2;
		}
		for(int i=0; i < 10010; i++) array[i] = n[i];
		sort(array, array+10010, greater<int>());

		for(int i=0; i < 10010; i++){
			if(array[0] == n[i]){
				cout << i << " " << array[0] << endl;
				break;
			}
		}
	}
}

C++: #include<iostream>

using namespace std;

int main(){

    while(true){
		int n;
		cin >> n;
		if(n == 0) break;

		int max_p = 0, max_d = 0;

		for (int i = 0; i < n; i++){
			int p, d1, d2;
			cin >> p >> d1 >> d2;

			if (max_d <= d1 + d2) {
				max_d = d1+ d2;
				max_p = p;
			}

		}
		cout << max_p << " " <<  max_d << endl;

	}

	return 0;
}

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

int main(){
    int n;
    int p,d1,d2;
    while(1){
    	cin >> n;
    	if(n == 0) break;
    	cout << "0" << endl;
    	int msum=0,mnum=0;
        for(int i=0;i<n;i++){
            cin >> p >> d1 >> d2;
            msum = max(msum,d1+d2);
            if(msum == d1+d2) mnum = p;
        }
        cout << mnum << " " << msum << endl;
    }
}

C++: #include<iostream>
using namespace std;
int main(){
	int n,p,d1,d2,max=0,ID=0;
	while(cin>>n){
		if(n==0)break;
	for(int i=0;i<n;i++){
		int D=0;
		cin>>p>>d1>>d2;
		D=d1+d2;
		if(D>max){
			max=D;
			ID=p;
			}
		}
	cout<<ID<<" "<<max<<endl;
	}
	return 0;
}

C++: #include<stdio.h>
int main()
{
	int n,p,d1,d2,i,m,a;
	while(1){
		scanf("%d",&n);
		if(n==0){
			break;
		}
		m=0;
		for(i=0;i<n;i++){
			scanf("%d%d%d",&p,&d1,&d2);
			if(d1+d2>m){
				a=p;
				m=d1+d2;
			}
		}
		printf("%d %d\n",a,m);
	}
	return 0;
}

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

using namespace std;

typedef struct {
	int num;
	int pt;
} HOS;
int main()
{
	HOS walk[10000], tmp;
	int n;
	int d1, d2;

	while (scanf("%d", &n), n != 0){
	   for (int i = 0; i < n; i++){
		   scanf("%d%d%d", &walk[i].num, &d1, &d2);
		   walk[i].pt = d1 + d2;
	   }

	   for (int i = 0; i < n - 1; i++){
		   for (int j = n - 1; j > i; j--){
			   if (walk[j].pt > walk[j - 1].pt){
				   tmp = walk[j];
				   walk[j] = walk[j - 1];
				   walk[j - 1] = tmp;
			   }
		   }
	   }

	   cout << walk[0].num << " " << walk[0].pt << endl;
	}

	return (0);
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  int n,d1,d2,ans;
  string kn,anskn;
  while(cin>>n){
    if(n==0) break;
    ans = 0;
    for(int i=0;i<n;i++){
	cin >> kn >> d1 >> d2;
	if(ans<d1+d2){
	  ans = d1+d2;
	  anskn = kn;
	}
      }
    cout << anskn << ' ' << ans << endl;
  }
  return 0;
}

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

int main(){
	int d;
	while(cin>>d&&d){
		int MAX_p=0,MAX_d=0;
		for(int p,d1,d2;d--;){
			cin>>p>>d1>>d2;
			if(MAX_d<d1+d2){
				MAX_d=d1+d2;
				MAX_p=p;
			}
		}
		cout<<MAX_p<<" "<<MAX_d<<endl;
	}
}

C++: #include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
	int n;
	
	while( cin >> n ) {

		int p, d1, d2;
		int maxd = 0;
		int maxp = 0;
		
		for( int i = 0; i < n; i++ ) {
			cin >> p >> d1 >> d2;
			int d = d1+d2;
			if( maxd <= d ) {
				maxd = d;
				maxp = p;
			}
		}

		cout << maxp << " " << maxd << endl;
	}

    return 0;
}