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(void){
    int n,p[10100];
    int d1[10100],d2[10100];
    
    while(true){
        cin>>n;
        if(n==0){
            break;
        }
        for(int i=0; i<n; i++){
            cin>>p[i]>>d1[i]>>d2[i];
        }
        int d_sum[10100];
        int d_max=0, p_max;
        
        for(int i=0; i<n; i++){
            d_sum[i]=d1[i]+d2[i];
            if(d_sum[i]>d_max){
                d_max=d_sum[i];
                p_max=p[i];
            }
        }
        cout<<p_max<<" "<<d_max<<endl;
    }
}

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 (1)
	{
		cin >> n;

		if (n == 0)break;

		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 <iostream>

using namespace std;

typedef struct {
	int p;
	int d;
} Patient;

static const int MAX_N = 10000;

Patient P[MAX_N];

int main(int argc, char**)
{
	int n, d1, d2;

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

		int idx = 0;
		for(int i=0; i<n; i++)
		{
			cin >> P[i].p; 
			cin >> d1;
			cin >> d2;
			P[i].d = d1 + d2;

			if(P[idx].d < P[i].d)
			{
				idx = i;
			}
		}

		cout << P[idx].p << " " << P[idx].d << 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",NO,max);

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

	return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){
int n, p, d1, d2;
int ans1,ans2;
while(1){
cin >> n;
if(n == 0){
break;
}
ans1 = -1, ans2 = -1;
for(int i = 0;i < n;i++){
cin >> p >> d1 >> d2;
if(ans2 < d1 + d2){
ans1 = p;
ans2 = d1 + d2;
}
}
cout << ans1 << " " << ans2 << 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++: // Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;

		if(n==0)
			break;

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

			if(d1+d2>d_max){
				p_max = p;
				d_max = d1+d2;
			}
		}

		cout << p_max << ' ' << d_max << '\n';
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int n=1,max=0,num=0;
	while(true){

	cin>>n;
	if(n==0)return 0;
	for(int p,d1,d2;n>=1;n--){
		cin>>p>>d1>>d2;
		if((d1+d2)>max){
			num=p;
			max=d1+d2;
		}
	}
	cout<<num<<" "<<max<<endl;
	}
}

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

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

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

		int mp = 0, mb = 0;
	    for (int i = 0; i < n; i++){
			int p, b1, b2;
			cin >> p >> b1 >> b2;

			if (mb >= b1 + b2){
				mb = b1 + b2;
				mp = p;
			}
	    }
		cout << mp << " " << mb << endl;
	}

	return 0;
}

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

using namespace std;

int main()
{
    int n;

    while (cin >> n, n) {
        int max_p, max_d;
        int p, d1, d2;

        max_p = max_d = -100;
        for (int i = 0; i < n; i++) {
            cin >> p >> d1 >> d2;
            
            if (d1 + d2 > max_d) {
                max_d = d1 + d2;
                max_p = p;
            }
        }
        cout << max_p << " " << max_d << endl;
    }

    return 0;
}

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

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

C++: #include<stdio.h>
int main(void)
{
	int n,a[1000],s,d,max,z,x[1000],i,j;
	while(1){
	scanf("%d",&n);
	if(n==0)	break;
	for(i=0;i<n;i++){
		scanf("%d %d %d",&a[i],&s,&d);
		  x[i]=s+d;
	}
	max=-1;
	for(j=0;j<n;j++){
		if(max<x[i])	{
				max=x[i];
				z=a[i];
		}
	}	
	printf("%d %d\n",z,max);
   }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
typedef pair<int, int> P;
int main(){
    int n, p, d1, d2;
    while(cin >> n, n){
	vector<P> patient;
	for(int i = 0;i < n;i++){
	    cin >> p >> d1 >> d2;
	    patient.push_back(P(d1 + d2, p));
	}
	sort(patient.begin(), patient.end());
	cout << patient[n - 1].second << " " << patient[n - 1].first << 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<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<cmath>
#include<cstring>
using namespace std;

int main(){
  int w,sum=0;
  while(1){
    scanf("%d",&w);
    if(w==-1) break;
    if(w>30){
      sum+=(w-30)*160;
      w=30;
    }
    if(w>20){
      sum+=(w-20)*140;
      w=20;
    }
    if(w>10){
      sum+=(w-10)*125;
    }
    printf("%d\n",4280-(sum+1150));
    sum=0;
  }   
  return 0;
}

C++: #include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const int INF = 1001001001;

int main()
{
	int n;
	while(scanf("%d", &n), n){
		int Bp, Bd = -1;
		rep(i, n){
			int p, d1, d2;
			scanf("%d%d%d", &p, &d1, &d2);
			d1 += d2;
			if(d1 > Bd){
				Bd = d1;
				Bp = p;
			}
		}
		printf("%d %d\n", Bp, Bd);
	}
	return 0;
}