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 <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

class Point{
public:
  int n,walk;
  Point(int n = 0,int walk = 0):n(n),walk(walk){}
  bool operator < (const Point &s) const{ return walk > s.walk;}
};

int main(){
  int i,j,n;
  while(1){
    Point p[10000];
    cin >> n;
    if(n == 0) break;
    int a,b;
    for(i=0;i<n;i++){
      cin >> p[i].n >> a >> b;
      p[i].walk = a + b;
    }
    sort(p,p+n);
    cout << p[0].n << " " << p[0].walk << endl;

  }
  return 0;
}

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

using namespace std;

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

C++: #include <cstdio>

int n, p, d1, d2, mp, md;

int main(){
    while(scanf("%d", &n) != EOF){
        if(n == 0) break;

        md = 0;
        for(int i = 0; i < n; i++){
            scanf("%d %d %d", &p, &d1, &d2);

            if(d1 + d2 > md){
                mp = p;
                md = d1 + d2;
            }
        }

        printf("%d %d\n", mp, md);
    }

    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<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
  int n;
  while(1){
    cin>>n;
    if(n==0){
      break;
    }
    int p,d,d2;
    int mxl=0,mxd=0;
    for(int i=0;i<n;i++){
      cin>>p>>d>>d2;
      if(mxl<d+d2){
	mxl=d+d2;
	mxd=p;
      }
    }
    cout<<mxd<<' '<<mxl<<endl;
  }
  return(0);
}

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

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

C++: /* 00:08 - 12:00 */
#include <iostream>
using namespace std;
int main(){
	int n,ret,p,a,b;
	
	while(cin >> n , n){
		pair<int,int> ret = make_pair(0,0) ;
		for(int i=0;i<n;i++){
			cin >> p >> a >> b;
			ret = max(ret,make_pair(a+b,p));
		}
		cout << ret.second << ret.first << " " << endl;
	}
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f,g=0,max=0;
	while(scanf("%d",&a),a!=0)
	{
		for(e=0;e<a;e++)
		{
			scanf("%d %d %d",&b,&c,&d);
			f=c+d;
			if(max<f)
			{
				max=f;
				g=b;
			}
		}
		printf("%d %d\n",g,max);
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int n;
    while(scanf("%d",&n),n){
        int a,b,c;
        int ans = 0;
        int x = 0;//比較用
        for(int i = 0;i < n; i++){
            scanf("%d%d%d",&a,&b,&c);
            if(x < b+c){
                x = b+c;
                ans = a;
            }
        }
        printf("%d %d\n",ans,x);
    }
    return 0;
}

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) {
		if(!n) {
			break;
		}
		int pp, max=0;
		for(int i=0; i<n; i++) {
			int p, d1, d2;
			cin >> p >> d1 >> d2;
			if(d1+d2>max) {
				max=d1+d2;
				pp=p;
			}
		}
		cout << pp << " " << max << endl;
	}

	return 0;

}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	int n;
	while(cin >> n && n)
	{
		int mah, mad = -1;

		rep(i, n)
		{
			int p, d1, d2;
			cin >> p >> d1 >> d2;

			if(d1 + d2 > mad)
			{
				mad = d1 + d2;
				mah = p;
			}

			cout << mah << " " << mad << endl;
		}
	}
}

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

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

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

  return (0);
}

C++: #include <iostream>

using namespace std;

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

C++: #include<iostream>
using namespace std;
int main(){
	int n,p,d1,d2,maxp,maaxv;
	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;
	}
}