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)
	}
}

C++: #include<iostream>
using namespace std;
int main()
{
	int a, b, c;
	while (cin >> a,a != 0)
	{	
		int d[10000] = {}, sum[10000] = {};
		for (int i = 0; i < a; i++)
		{
			cin >> d[i] >> b >> c;
			sum[i] = b + c;
			for (int j = 0; j < a; j++)
			{
				if (sum[0] < sum[i])
				{
					swap(sum[i], sum[0]);
					swap(d[i], d[0]);
				}
			}

		}
		cout << d[0] << " " << sum[0] << endl;
	}
     return 0;
}

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

int main(void)
{
  int n, p, d1, d2;
  int top=0, sum=0;

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

      for(int i = 0 ; i < n ; i++)
	{
	  cin >> p >> d1 >> d2;
	  if(sum < d1 + d2)
	    {
	      top = p;
	      sum = d1 + d2;
	    }
	}
      cout << top << ' ' << sum << endl;
    }
  return 0;
}

C++: #include <cstdio>
int main()
{
    int n;
    while (scanf("%d",&n)&&n!=0) {
        int maxP,maxD=0,p,d1,d2;
        for (int i=0; i<n; i++) {
            scanf("%d%d%d",&p,&d1,&d2);
            if (maxD<d1+d2) {
                maxP=p;
                maxD=d1+d2;
            }
        }
        printf("%d %d\n",maxP,maxD);
    }
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        pair<int, int> ret(-1, -1);
        for(int i=0; i<n; ++i){
            int p, d1, d2;
            cin >> p >> d1 >> d2;
            ret = max(ret, make_pair(d1 + d2, p));
        }
        cout << ret.second << ' ' << ret.first << endl;
    }
}

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

using namespace std;

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

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

int main(){
    while(1){
        int n;
        cin >> n;
        if(!n) break;

        vector<pair<int, int> > ary(n);
        for(int i = 0;i < n;i++){
            int p, d1, d2;
            cin >> p >> d1 >> d2;
            ary.push_back(pair<int, int>(d1 + d2, p));
        }
        sort(ary.begin(), ary.end());
        pair<int, int> ans = ary.back();
        cout << ans.second << ' ' << ans.first << endl;
    }
    return 0;
}

C++: //============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <cctype>
using namespace std;

int main() {
	int n,p,d1,d2;
	int A[10000],R,L;
	while(1){
		A[10000]={};
		R=0;
		L=0;
		cin>>n;
		if(n==0)break;
		for(int i=0;i<n;i++){
			cin>>p>>d1>>d2;
			A[i]=d1+d2;
			if(R<A[i]){
				R=A[i];
				L=p;
			}
		}
		cout<<L<<" "<<R<<endl;
	}

	return 0;
}

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

int main(void){
  int count=0;
  while(1){
  cin >> count;
  if(count == 0) break;
  else{
    int maxkan,maxkyori=-1,kan=0,kyori1=0,kyori2=0;
    for(int i=0;i<count;i++){
      cin >> kan >> kyori1 >> kyori2;
       if(maxkyori < kyori1+kyori2){
         maxkan = kan;
         maxkyori = kyori1+kyori2;
       }
    }
    cout << maxkan << " " << maxkyori << endl;
   } 
  }
}

C++: #include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <limits>
#include <sstream>

using namespace std;

int main (void)
{
	for (int u = 0; u < 50; u++)
	{
		long n;
		long id[51],a[51],b[51];
		int p = -1;
		int q = 0;

		cin >> n;
		if (n == 0)
		{
			break;
		}

		for (int i = 0; i < n; i++)
		{
			cin >> id[i] >> a[i] >> b[i];
		}

		for (int i = 0; i < n; i++)
		{
			if (a[i] + b[i] > q)
			{
				p = 0;
				p = id[i];
				q = 0;
				q = a[i] + b[i];
			}
		}

		cout << p << " " << q << endl;
	}
}

C++: #include <cstdio>
#include <iostream>
#include <iomanip>
#include <string> 
#include <vector> 
using namespace std;
  
int main(){
    /*??£???????????????????????????
            int a[2];
            cin >> a[1] >> a[2];
            cout << "[+] " << a[1] + a[2] << endl;
            cout << "[-] " << a[1] - a[2] << endl;
            cout << "[*] " << a[1] * a[2] << endl;
            cout << "[/] " << a[1] / a[2] << endl;
    */

    int a,ans[2];
    while(cin >> a){
    if(a == 0){break;}
    int p[a][3];
    for(int i = 1;a >= i;i++){
        cin  >> p[i][0] >> p[i][1] >> p[i][2];
        if(i == 1){
            ans[0] = p[i][0];
            ans[1] = p[i][1] + p[i][2];            
        }       
        for(int ii = 1;i > ii;ii++){
            if(ans[1] < p[i][0] + p[i][2]){
                ans[0] = p[i][0];
                ans[1] = p[i][1] + p[i][2];
            }
        }
    }
    cout << ans[0] << " " <<  ans[1] << endl;

    }
}

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 = -1;
		while(n --){
			cin >> p >> d1 >> d2;
			if(maxv < d1+d2){
				maxp = p;
				maxv = d1+d2;
				}
		}
		cout<< maxp <<" "<< maxv;
	}
}

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

int N;
int d[10001];
int ans[100][2];

int main(){
	int i,j;
	for(i = 0;cin >> N;i++){
		if(N == 0)
			break;
		for(j = 0;j < 10001;j++){
			d[j] = 0;
		}
		for(j = 0;j < N;j++){
			int p,d1,d2;
			cin >> p >> d1 >> d2;
			d[p] = d1 + d2;
		}
		for(j = 0;j < 10001;j++){
			if(d[j] > ans[i][1] ){
				ans[i][1] = d[j];
				ans[i][0] = j;
			}
		}
	}
	for(j = 0;j < i;j++){
		cout << ans[j][0] << " " << ans[j][1] << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(void) {

	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<stdio.h>
int main(void)
{
    int n,p,d1,d2,i,max,a;
	scanf("%d",&n);
	while (1){
	    if (n==0) break;
	    max=0;
	    
		if (n==0) break;
		for(i=0;i<n;i++){
		    scanf("%d %d %d",&p,&d1,&d2);
			if (max<d1+d2){
			    max=d1+d2;
				a=p;
			}
		}
		printf("%d %d\n",a,max);
		return 0;
	}
}