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

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

int main() {
	int n;
	
	while (cin >> n, n) {
		int ans = -1, mx = -1;
		
		for_(i,0,n) {
			int p, d1, d2;
			cin >> p >> d1 >> d2;
			
			if (mx < d1 + d2) {
				mx = d1 + d2;
				ans = p;
			}
		}
		
		cout << ans << " " << mx << endl;
	}
}

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

int main(void){
	int n, N, d;

	while (1){
		n = 0;
		N = 0;
		d = 0;
		cin >> n;
		if (n == 0)
			break;
		vector<int> p(10001), d1(10001), d2(10001), dsum(10001);

		for (int i = 0; i < n; i++){
			cin >> p.at(i) >> d1.at(i) >> d2.at(i);
			dsum.at(i) = d1.at(i) + d2.at(i);
		}

		d = dsum.at(0);
		for (int i = 1; i < n; i++){
			if (d < dsum.at(i)){
				N = i;
			}
		}

		cout << p.at(N) << " " << dsum.at(N) << endl;
	}
	return 0;
}

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

C++: #include<stdio.h>
int p[10000],d[10000];
int main(void)
{
	int n,i,j,d1,d2,T,max=0,maxn;
	while(1){
	scanf("%d",&n);
	if(n == 0)
		break;

	for(i=0;i<n;i++){
		scanf("%d %d %d",&p[i],&d1,&d2);
		d[i] = d1+d2;
	}
	for(i=0;i<n;i++){
		if(max < d[i]){
			max = d[i];
			maxn = p[i];
		}
	}
	printf("%d %d\n",maxn,max);
	}
	return 0;
}

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

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

C++: 
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 <cstdio>
main(){int n;while(scanf("%d", &n), n){int t, m = 0, p, a, b;for(;n;n--){scanf("%d%d%d",&p,&a,&b);if(a+b>m)t=p,m=a+b;}printf("%d %d\n",t,m);}}

C++: #include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define lcm( a, b ) ((a)/__gcd(a,b)*(b))
#define MP make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> i_P;
typedef pair< LL, LL > L_P;

const int INF = INT_MAX;
const int MIN = INT_MIN;
const LL LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const int SIZE = 100005;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while( true ) {
        int n;
        cin >> n;
        if( n == 0 ) break;
        int mx = 0, num;
        for( int i  = 0; i < n; ++i ) {
            int a, b, c;
            cin >> a >> b >> c;
            if( mx < b + c ) {
                mx = b + c;
                num = a;
            }
        }
        cout << num << " " <<  mx << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <map>
 
using namespace std;
 
map<int, int> dist;
 
int main() {
    int n;
    while (cin >> n) {
        dist.clear();
        if (n == 0) break;
        int p, d1, d2;
        for (int i = 0; i < n; i++) {
            cin >> p >> d1 >> d2;
            dist[p] = d1 + d2;
        }
        int max = 0, max_p;
        for (map<int, int>::iterator m = dist.begin(); m != dist.end(); m++) {
            if ((*m).second > max) {
                max = (*m).second;
                max_p = (*m).first;
            }
        }
        cout << max_p << ' ' << max << endl;
    }
    return 0;
}

C++: #include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
using namespace std;
typedef long long  ll;

int main()
{
	int n;
	
	while (cin>>n, n) {
		int p, a, b, max=0, maxP;
		rep(i, n) {
			cin >> p >> a >> b;
			if (a+b>max) {
				max = a+b;
				maxP = p;
			}
		}
		cout << maxP << " " << max << endl;
	}
	return 0;
}

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<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<utility>

using namespace std;

int n;

int pd[10010][3];

int ans;

int cnt;

int people;

int main(void)
{

	while (cin >> n, n)
	{

		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < 3; j++)
			{
				cin >> pd[i][j];
			}
		}

		for (int i = 0; i < n; i++)
		{
			for (int j = 1; j < 3; j++)
			{
				cnt += pd[i][j];
			}

			if (people < cnt)
			{
				ans = i;

				people = cnt;
			}

			cnt = 0;
		}

		cout << pd[ans][0] << " " << people << endl;

	}
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int n;
    for(;;){
        scanf("%d",&n);
        if(n==0) break;
        vector<pair<int,int> > ar(n);
        for(int i=0;i<n;i++){
            int n[3];
            for(int j=0;j<3;j++){
                scanf("%d",&n[j]);
            }
            ar[i]=make_pair(n[0],n[1]+n[2]);
        }
        int maxa,maxb=0;
        for(int i=0;i<n;i++){
            if(ar[i].second>maxb){
                maxa=ar[i].first;
                maxb=ar[i].second;
            }
        }
        printf("%d %d\n",maxa,maxb);
        
    }
}

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>
#include<queue>
#include<vector>
using namespace std;

class Data{
public:
	int id;
	int h;
	Data(int _id,int _h){
		id=_id;h=_h;
	}
	bool operator < (const Data &o) const{
		return h < o.h;
	}
};
typedef priority_queue<Data> PQ;
int main(){
	int d;
	while(cin>>d&&d){
		PQ pq;
		for(int p,d1,d2;d--;){
			cin>>p>>d1>>d2;
			pq.push(Data(p,d1+d2));
		}
		cout<<pq.top().id<<" "<<pq.top().h<<endl;
	}
}

C++: #include<iostream>
using namespace std;
int main(){
	int n,max=0,num=0;
	cin>>n;
	for(int p,d1,d2;n>=1;n--){
		cin>>p>>d1>>d2;
		if((d1+d2)>max){
			num=p;
			max=d1+d2;
		}
	}
	cout<<num<<" "<<max;
}