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>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

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

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

long long int a[10000] = {0},x,y,p;

int main(){

  long long int n;

  while(cin >> n, n){

    for(int i=0;i<n;i++){
      cin >> p >> x >> y;

      a[p] = x + y + a[p];
    }

    p = 0;

    for(int i=0;i<=10000;i++){
      if(a[0] < a[i]){
	a[0] = a[i];
	p = i;
      }
    }

    cout << p << " " << a[0] << endl;

  }
}

C++: #include<cstdio>
#include<algorithm>
using namespace std;
int main(){

  int n,a,b,c,num,ma;
  scanf("%d",&n);
  while(n != 0){
    
    for(int i=0;i<n;i++){
      scanf("%d %d %d",&a,&b,&c);
      if(i == 0 || ma<b+c ){
	num = a;
	ma = b+c;
      }
    }

    printf("%d %d\n",num,ma);
    scanf("%d",&n);
  }

  return (0);
}

C++: #define scanf_s scanf
#include <stdio.h>
#include <string>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <iostream>
using namespace std;

#define MAX 100000

int main()
{
	while (1) {
		int n, max, maxi = 0, p, d1, d2, d;
		scanf_s("%d", &n);
		if (n == 0)break;
		for (int i = 0; i < n; ++i) {
			scanf_s("%d %d %d", &p, &d1, &d2);
			d = d1 + d2;
			if (i == 0 || max < d) {
				max = d;
				maxi = p;
			}
			printf("%d %d\n", maxi, max);
		}
	}
}

C++: #include<stdio.h>
int main(void)
{
	int a,s,d,i,f,g,max,h;
	scanf("%d",&a);
		while(a!=0){
		max=-1;
		for(i=1;i<=a;i++){
			scanf("%d %d %d",&s,&d,&f);
			g=d+f;
			if(max<g){
				max=g;
				h=s;
			}
		}

	printf("%d %d\n",h,max);
	scanf("%d",&a);
	}
	
	return 0;
}

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

	   printf("%d %d\n", walk[0].num, walk[0].pt);
	}

	return (0);
}

C++: #include <stdio.h>
#include <iostream>

using namespace std;

int main() {
	int n,p,d1,d2,wa;
	int maxp, maxd = 0;

	while(1) {
		cin >> n;
		maxd = 0;
		if (n == 0) {
			break;
		} else {
			for (int i = 0; i < n; i++) {
				cin >> p >> d1 >> d2;
				wa = d1 + d2;
				if (wa > maxd) {
					maxd = wa;
					maxp = p;
				}
			}
		}

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

C++: #include<bits/stdc++.h>
using namespace std;
main(){
  int n,p,d1,d2,mp,mc;
  while(1){
    cin>>n;
    if(n==0)break;
    mc=0;
    mp=0;
    for(int i=0;i<n;i++){
      cin>>p>>d1>>d2;
      if(d1+d2>mc){
	mc=d1+d2;
	mp=p;
      }
    }
    cout<<mp<<" "<<mc<<endl;
  }
}

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

using namespace std;

int solve(){
    int n;
    cin>>n;
    if(n==0)return -1;
    int ans=0;
    int ansn;
    for (int i = 0; i < n; ++i) {
        int t;
        int a,b;
        cin>>t>>a>>b;

        if(ans<a+b){
            ans=a+b;
            ansn=t;
        }
    }
    cout<<ansn<<" "<<ans<<endl;
    return 0;
}

int main(){
    while(solve()==0);
    return 0;
}

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

typedef struct P {
	int p, d;
	bool operator<(const P &r) {
		return d < r.d;
	}
} P;
int n, d[10001];
vector<P> v;

int main(){
	int p, d1, d2;
	while (cin >> n && n != 0) {
		v = vector<P>();
		for (int i = 0; i < n; i++) {
			cin >> p >> d1 >> d2;
			v.push_back({ p,d1 + d2 });
		}
		P m = v[0];
		for (int i = 1; i < v.size(); i++) {
			if (m < v[i]) {
				m = v[i];
			}
		}
		cout << m.p << " " << m.d << 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++: #define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;

static const double eps = 1e-8;

int main(){
	int n;	
	while(~scanf("%d",&n)){	
		if(n==0) break;
		priority_queue<P> que;
		for(int i=0;i<n;i++){
			int p,d1,d2;
			scanf("%d %d %d",&p,&d1,&d2);
			que.push(P(d1+d2,p));
		}

		printf("%d %d\n",que.top().second,que.top().first);
	}
}

C++: #include<stdio.h>
int main(){
	int a;
	while(scanf("%d",&a),a){
		int ret1=0;
		int ret2=0;
		for(int i=0;i<a;i++){
			int b,c,d;
			scanf("%d%d%d",&b,&c,&d);
			if(c+d>ret1){
				ret1=c+d;
				ret2=b;
			}
		}
		printf("%d %d\n",ret2,ret1);
	}
}

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