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 n,bell,most2,number,length1,length2,totallength[10000],most1=-1;
  while(1){
    cin >> n;
    if(n==0){
      break;
    }
    for(int i=0;i<n;i++){
      cin >> number >> length1 >> length2;
      totallength[number]=length1+length2;
      if(most1<totallength[number]){
	most1=totallength[number];
	most2=number;
      }
    }
    cout << most2 << " " << most1 << endl;
  }
  return (0);
}

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

C++: #include <iostream>
using namespace std;
int main(){
	int n,maxd,maxp,p,d1,d2;
	maxd=0;
	maxp=0;
	while(cin>>n,n){
		for(int i=0; i<n; i++){
		cin>>p>>d1>>d2;
	if(maxd<d1+d2){
		maxd=d1+d2;
		maxp=p;
			}
		}	
		cout<<maxp<<" "<<maxd<<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 = 0;
		while(n --){
			cin >> p >> d1 >> d2;
			if(maxv < d1+d2){
				maxp = p;
				maxv = d1+d2;
                                }
		}
		cout<< maxp << maxv;
	}
}

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

using namespace std;

int main()
{
	int num;
	map<int, int, greater<int> > mp;

	while(cin >> num, num)
	{
		mp.clear();

		int patient, walk1, walk2;
		for(int i = 0; i < num; i++)
		{
			cin >> patient >> walk1 >> walk2;
			mp.insert( make_pair( walk1 + walk2 , patient ) );
		}

		map<int,int>::iterator it = mp.begin();
		printf("%d %d\n",(*it).second ,(*it).first);		
	}
	return 0;
}

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

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

typedef struct P {
	int p, d;
	bool operator<(const P &r) {
		return d < r.d;
	}
} P;
int n;;

int main(){
	int p, d1, d2;
	while (true) {
		scanf("%d", &n);
		if (n == 0) break;
		P m = { 0,-1 };
		P t;
		for (int i = 0; i < n; i++) {
			scanf("%d %d %d", &p, &d1, &d2);
			t = { p,d1 + d2 };
			if (m < t) {
				m = t;
			}
		}
		printf("%d %d\n", m.p, m.d);
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,bell,most2,number,length1,length2,totallength[10000],most1=0;
  while(1){
    cin >> n;
    if(n==0){
      break;
    }
    for(int i=0;i<n;i++){
      cin >> number >> length1 >> length2;
      totallength[number]=length1+length2;
      if(most1<totallength[number]){
	most1=totallength[number];
	most2=number;
      }
    }
    cout << most2 << " " << most1 << endl;
  }
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <stack>
#include <list>

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,b,n) for(int i=b;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

const float PI = 3.1415926;
static const int INFTY = (1<<30);

using namespace std;

typedef long long ll;
typedef long double ld;

int n, maxn, maxdis;
int main() {
  while(cin >> n, n) {
    maxn = 0; maxdis = 0;
    rep(i, n) {
      int p, d0, d1;
      cin >> p >> d0 >> d1;
      if(maxdis < d0 + d1) {
        maxn = p;
        maxdis = d0 + d1;
      }
    }

    cout << maxn << " " << maxdis << endl;
  }
  
  return 0;
}

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

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

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

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        int maxP, maxD = 0;
        for (int i = 0; i < n; i++) {
            int p, d1, d2;
            cin >> p >> d1 >> d2;
            if (maxD < d1 + d2) {
                maxP = p;
                maxD = d1 + d2;
            }
        }
        cout << maxP << " " << maxD << endl;
    }
}

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 < 1; j++)
			{
				if (sum[0] < sum[i])
				{
					swap(sum[i], sum[0]);
					swap(d[i], d[0]);
				}
			}

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

C++: #include <stdio.h>

int main()
{
	int NO,max,p,d1,d2;
	int n,i,j;

	scanf("%d",&n);

	while(n != 0){
		max = 0;

		for(i = 0; i < n; i++){
			scanf("%d%d%d",&p,&d1,&d2);
			if(max < d1+d2){
				max = d1+d2;
				NO = p;
			}
		}

		printf("%d %d\n",NO,max);

		scanf("%d",&n);
	}

	return 0;
}

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

}

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

typedef std::pair<int, int>P;

int main(){

	int n;

	while (std::cin >> n, n){
		std::priority_queue<P>que;

		for (int i = 0; i < n; i++){
			int p, d1, d2;
			std::cin >> p >> d1 >> d2;
			que.push(P(d1 + d2, p));
		}

		std::cout << que.top().second << " " << que.top().first << std::endl;
	}

	return 0;
}

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

int main(){
	int maxP=-1, maxD=-1;
	int p, d1, d2;
	int num;
	while(cin >> num, num){
		for(int i=0; i< num; i++){
			cin >> p >> d1 >> d2;
			maxD = max(maxD, d1 + d2);
			if(maxD == d1+d2) maxP = p;
		}
		cout << maxP << " " << maxD << endl;
	}
}