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;
	while (cin >> n&&n) {
		int p[10000], d1[10000], d2[10000];
		int top[2] = {};
		for (int i = 0; i < n; i++) {
			cin >> p[i] >> d1[i] >> d2[i];
			if (top[1] < d1[i] + d2[i]) {
				top[0] = p[i];
				top[1] = d1[i] + d2[i];
			}
		}
		cout << top[0] << top[1] << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int n;
  while (cin >> n, n) {
    int p[10010], d1[10010], d2[10010];
    for (int i = 0; i < n; i++) {
      cin >> p[i] >> d1[i] >> d2[i];
    }
    int pos = 0;
    for (int i = 0; i < n; i++) {
      if (d1[i] + d2[i] <= d1[pos] + d2[pos]) continue;
      pos = i;
    }
    cout << p[pos] << " " << d1[pos] + d2[pos] << endl;
  }

  return 0;
}

C++: // 2011/02/16 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		// üÍi³ÒÌj
		int n;
		cin >> n;
		if(n==0)
			break;

		// üÍi³ÒÌîñjÆZ
		int p_max = 0;		// Å·Ì³ÒÌÔiúlÍ0j
		int d_max = -1;		// Å·Ìà¢½£iúlÍ-1j
		for(int i=0; i<n; i++){
			int p, d1, d2;
			cin >> p >> d1 >> d2;
			if(d_max<d1+d2){		// àµà¢½£ª·©Á½ç
				p_max = p;
				d_max = d1+d2;
			}
		}

		// oÍ
		cout << p_max << ' ' << d_max << endl;
	}

	return 0;
}

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++: // 2012/07/13 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 << endl;
	}

	return 0;
}

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

int main()
{
	int n,p,d1,d2,mp=0,md=0;
	while(cin >> n){
		if(n == 0)
			break;
		for(int i=0;i<n;i++){
			cin >> p >> d1 >> d2;
			if(md < d1+d2){
				mp = p;
				md = d1+d2;
			}
		}
		cout << mp <<" "<< md << 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 <cstdio>

int main(){
  int n;

  while(scanf("%d" ,&n) ,n){
    int p,d1,d2;
    int ans = 0,num;

    while(n--){
      scanf("%d %d %d" ,&p ,&d1 ,&d2);
      if(ans < d1+d2){
	ans = d1+d2;
	num = p;
      }
    }
    printf("%d %d\n" ,num ,ans);
  }

  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 (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<stdio.h>
int main(void)
{
	int n,a[10000],s,d,max,z,x[10000],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=0;
	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>
using namespace std;

int main(){
	int n, p, d1, d2, ap, ad;

	while(cin>>n, n){
		ap=ad=-1;
		while(n--){
			cin>>p>>d1>>d2;
			if(ad<d1+d2)ap=p, ad=d1+d2;
		}
		printf("%d %d\n", ap, ad);
	}
	return 0;
}

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

using namespace std;

int main()
{
	int N, D1, D2; vector<int> P, D;

	while (true)
	{
		cin >> N;

		if (N == 0) { break; }

		P = vector<int>(N);
		D = vector<int>(N);

		for (int i = 0; i < N; i++)
		{
			cin >> P[i] >> D1 >> D2;

			D[i] = D1 + D2;
		}

		int maxptr = distance(D.begin(), max_element(D.begin(), D.end()));

		cout << P[maxptr] << ' ' << D[maxptr] << endl;
	}

	return 0;
}

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

pair<int,int> solve(int n){
  vector<pair<int,int>> list;
  for(int i=0;i<n;i++){
    int p,d1,d2;
    cin>>p>>d1>>d2;
    list.push_back(make_pair(d1+d2,p));
  }
  sort(list.begin(),list.end());
  return list[list.size()-1];
}

int main(){
  int n;
  while(cin>>n,n!=0){
    auto ans = solve(n);
    cout<<ans.second<<" "<<ans.first<<endl;
  }
}

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 <iostream>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstring>
#include <cstdlib>
#include <iomanip>
#include <string>
#include <ctype.h>

const int INF =100000000;

using namespace std;


int main(){

  while(1){

    int n;

    cin >> n;

    if(n == 0){
      break;
    }else{

      int ansa=0;
      int ansb=0;

      for(int i = 0;i < n;i++){
	int aa,bb,cc;

	cin >> aa >> bb >>cc;

	if(ansb < bb+cc){
	  ansa = aa;
	  ansb = bb + cc;
	}
      }
      cout << ansa << " " << ansb << endl;
    }
  }
}

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<iostream>
using namespace std;
int main(){
	int n,p,d1,d2,max=0,num=0,D=0;;
	while(1){
	cin>>n;
	if(n==0)break;
	for(int i=0;i<n;i++){
		cin>>p>>d1>>d2;
		D=d1+d2;
		if(D>max){
			max=D;
			num=p;
			}
		}
	cout<<num<<" "<<max<<endl;
	}
	return 0;
}

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

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