Problem:
ウォーキング
会津リバーサイドホスピタルでは、リハビリと健康増進のため、入院患者が一日二回のウォーキングを行っています。元気に退院するために、ウォーキングで体力を回復しようと頑張る人が日に日に増えきたことから、院長が「一日で一番長い距離を歩いた人にプレゼントをあげよう!」という企画を立ち上げました。
患者の数
n
(1 ≤
n
≤ 10000)、それぞれの患者の番号
p
i
(1 ≤
p
i
≤ 10000)、一回目に歩いた距離
d1
i
、二回目に歩いた距離
d2
i
(0 ≤
d1
i
,
d2
i
≤ 5000) を入力とし、歩いた距離の合計が最も長い患者の番号とその距離を出力するプログラムを作成してください。ただし、一日に歩いた距離が同じ患者はいないものとします。
Input
複数のデータセットの並びが入力として与えられます。入力の終わりはゼロひとつの行で示されます。
各データセットは以下の形式で与えられます。
n
p
1
d1
1
d2
1
p
2
d1
2
d2
2
:
p
n
d1
n
d2
n
入力はすべて整数で与えられます。データセットの数は50 を超えません。
Output
入力データセットごとに、最も長い合計距離を歩いた患者の番号とその歩いた距離を１行に出力します。
Sample Input
5
263 2345 2504
1 3210 1985
5000 1501 4132
10000 503 3107
51 1758 2690
3
345 5000 2396
7 3910 1590
6789 2525 3616
0
Output for the Sample Input
5000 5633
345 7396

Submitted solutions:

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

int main() {
	int n, p, d1, d2, m, mnum;
	while (1) {
		cin >> n;
		if (n == 0) break;
		m = 0;
		while (n--) {
			cin >> p >> d1 >> d2;
			if (m < d1 + d2) {
				m = d1 + d2;
				mnum = p;
			}
		}
		cout << mnum << ' ' << m << endl;
	}
}
accuracy: 1
time_ms: 50
memory_kb: 3456
final_rank: 7

code_snippet: #include <bits/stdc++.h>
using namespace std;
// #include<atcoder/all>
// using mint = atcoder::modint998244353;
using ld = long double;
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(int)(n);++i)
template<typename T>bool chmin(T&a,T b){return b<a?(a=b,1):0;}
template<typename T>bool chmax(T&a,T b){return b>a?(a=b,1):0;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    for(int N;cin>>N,N!=0;){

        int ans,ma=0;
        rep(i,N){
            int p,a,b;
            cin>>p>>a>>b;
            if(chmax(ma, a+b)) ans=p;
        }
        cout<<ans<<" "<<ma<<"\n";
    }
}
accuracy: 1
time_ms: 10
memory_kb: 3456
final_rank: 2

code_snippet: #include <iostream>
using namespace std;

int main(){
    int n;

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


    return 0;
}
accuracy: 1
time_ms: 70
memory_kb: 3288
final_rank: 9

code_snippet: #include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
const ll inf=1e18;

int main(){
  int n;cin >> n;
  while(n!=0){
    map<int,ll> sm;
    vector<int> patient(n);
    rep(i,n){
      int p;cin >> p;
      int d1,d2;cin >> d1 >> d2;
      p--;
      patient[i]=p;
      sm[p]=d1+d2;
    }
    int respatient;
    ll ressm=-1;
    rep(i,n){
      if(ressm<sm[patient[i]]){
        ressm=sm[patient[i]];
        respatient=patient[i];
      }
    }
    cout << respatient+1 << " " << ressm << endl;
    cin >> n;
  }
}
accuracy: 1
time_ms: 110
memory_kb: 4024
final_rank: 20

code_snippet: #line 1 "/opt/library/template.hpp"
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using i64 = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;
using u128 = unsigned __int128;
using f128 = __float128;

template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'000'001'000;
template <>
constexpr ll infty<ll> = ll(infty<int>) * infty<int> * 2;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * infty<ll>;
template <>
constexpr double infty<double> = infty<ll>;
template <>
constexpr long double infty<long double> = infty<ll>;
#define inf infty<ll>

using pi = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vector<ll>>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using vvvvvc = vector<vvvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;

#define vv(type, name, h, ...) \
  vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...)   \
  vector<vector<vector<type>>> name( \
      h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...)       \
  vector<vector<vector<vector<type>>>> name( \
      a, vector<vector<vector<type>>>(       \
             b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))

#define rep1(a) for (ll _ = 0; _ < (ll)(a); ++_)
#define rep2(i, a) for (ll i = 0; i < (ll)(a); ++i)
#define rep3(i, a, b) for (ll i = a; i < (ll)(b); ++i)
#define rep4(i, a, b, c) for (ll i = a; i < (ll)(b); i += (c))
#define rrep1(a) for (ll i = (a)-1; i >= (ll)(0); --i)
#define rrep2(i, a) for (ll i = (a)-1; i >= (ll)(0); --i)
#define rrep3(i, a, b) for (ll i = (b)-1; i >= (ll)(a); --i)
#define rrep4(i, a, b, c) for (ll i = (b)-1; i >= (ll)(a); i -= (c))
#define overload4(a, b, c, d, e, ...) e
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)

#define all(x) (x).begin(),(x).end()
#define len(x) (ll)(x.size())
#define elif else if
#define bit(x, i) (((x)>>(i))&1)

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second

#define stoi stoll
#define abs llabs

#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) \
  sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()

ll popcnt(ll x) { return __builtin_popcountll(x); }
ll popcnt(u64 x) { return __builtin_popcountll(x); }
ll popcnt_mod_2(ll x) { return __builtin_parityll(x); }
ll popcnt_mod_2(u64 x) { return __builtin_parityll(x); }
ll topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
ll topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
ll lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
ll lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }

template <typename T>
T floor(T a, T b) {
  return a / b - (a % b && (a ^ b) < 0);
}
template <typename T>
T ceil(T x, T y) {
  return floor(x + y - 1, y);
}
template <typename T>
T bmod(T x, T y) {
  return x - y * floor(x, y);
}
template <typename T>
pair<T, T> divmod(T x, T y) {
  T q = floor(x, y);
  return {q, x - q * y};
}

template<typename T> T SUM(const vector<T> &A) {
  T s = 0; for (auto &&a: A) s += a;
  return s;
}

template <typename T>
T POP(queue<T> &que) {
  T a = que.front();
  que.pop();
  return a;
}
template <typename T>
T POP(deque<T> &que) {
  T a = que.front();
  que.pop_front();
  return a;
}
template <typename T>
T POP(pq<T> &que) {
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(pqg<T> &que) {
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(vc<T> &que) {
  T a = que.back();
  que.pop_back();
  return a;
}

template <typename F>
ll binary_search(F check, ll ok, ll ng, bool check_ok = true) {
  if (check_ok) assert(check(ok));
  while (abs(ok - ng) > 1) {
    auto x = (ng + ok) / 2;
    (check(x) ? ok : ng) = x;
  }
  return ok;
}
template <typename F>
f128 binary_search_real(F check, f128 ok, f128 ng, ll iter = 100) {
  rep(iter) {
    f128 x = (ok + ng) / 2;
    (check(x) ? ok : ng) = x;
  }
  return (ok + ng) / 2;
}

// ? は -1
vc<int> s_to_vi(const string &S, char first_char) {
  vc<int> A(S.size());
  rep(i, S.size()) { A[i] = (S[i] != '?' ? S[i] - first_char : -1); }
  return A;
}

template <typename T, typename U>
vc<T> cumsum(vc<U> &A, ll off = 1) {
  ll N = A.size();
  vc<T> B(N + 1);
  rep(i, N) { B[i + 1] = B[i] + A[i]; }
  if (off == 0) B.erase(B.begin());
  return B;
}

// stable sort
template <typename T>
vi argsort(const vector<T> &A) {
  vi ids(len(A));
  iota(all(ids), 0);
  sort(all(ids),
       [&](ll i, ll j) { return (A[i] == A[j] ? i < j : A[i] < A[j]); });
  return ids;
}

// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vi &I) {
  vc<T> B(len(I));
  rep(i, len(I)) B[i] = A[I[i]];
  return B;
}

template<typename T> inline bool chmax(T &a, T b) {return ((a<b)?(a=b,true):(false));}
template<typename T> inline bool chmin(T &a, T b) {return ((a>b)?(a=b,true):(false));}

inline void wt(const char c) { cout << c; }
inline void wt(const string s) { cout << s; }
inline void wt(const char *s) { cout << s; }

template <typename T>
void wt_integer(T x) {
  cout << (x);
}
template <typename T>
void wt_real(T x) {
  cout << fixed << setprecision(15) << (long double)(x);
}
template <typename T>
void wt_integer128(T x) {
  char buf[64];
  char *d = end(buf);
  d--; *d = '\0';
  __uint128_t tmp = ((x < 0)? -x : x);
  do {
    d--; *d = char(tmp%10 + '0'); tmp /= 10;
  } while (tmp);
  if (x < 0) {
    d--; *d = '-';
  }
  cout << d;
}

inline void wt(int x) { wt_integer(x); }
inline void wt(ll x) { wt_integer(x); }
inline void wt(i128 x) { wt_integer128(x); }
inline void wt(u32 x) { wt_integer(x); }
inline void wt(u64 x) { wt_integer(x); }
inline void wt(u128 x) { wt_integer128(x); }
inline void wt(double x) { wt_real(x); }
inline void wt(long double x) { wt_real(x); }
inline void wt(f128 x) { wt_real(x); }

template <class T, class U>
void wt(const pair<T, U> val) {
  wt(val.first); wt(' '); wt(val.second);
}
template <size_t N = 0, typename T>
void wt_tuple(const T t) {
  if constexpr (N < std::tuple_size<T>::value) {
    if constexpr (N > 0) { wt(' '); }
    const auto x = std::get<N>(t);
    wt(x);
    wt_tuple<N + 1>(t);
  }
}
template <class... T>
void wt(tuple<T...> tpl) {
  wt_tuple(tpl);
}
template <class T, size_t S>
void wt(const array<T, S> val) {
  auto n = val.size();
  for (size_t i = 0; i < n; i++) {
    if (i) wt(' ');
    wt(val[i]);
  }
}
template <class T>
void wt(const vector<T> val) {
  auto n = val.size();
  for (size_t i = 0; i < n; i++) {
    if (i) wt(' ');
    wt(val[i]);
  }
}

void print() { wt('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
  wt(head);
  if (sizeof...(Tail)) wt(' ');
  print(forward<Tail>(tail)...);
}

void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
void onez(bool t = 1) { print(t ? 1 : 0); }
#define endl '\n'
#define dump(x) {cerr << #x " = " << x << '\n';}
#line 2 "main.cpp"

int solve();
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  while (!solve()) {}
  return 0;
}

int solve() {
  ll n, p, d1, d2;
  cin >> n;
  if (n == 0) return 1;
  ll max_d=-inf, max_p=-1;
  rep(i, n) {
    cin >> p >> d1 >> d2;
    if (chmax(max_d, d1+d2)) {
      max_p = p;
    }
  }
  print(max_p, max_d);
  return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 3332
final_rank: 1

code_snippet: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
  for(int i=1;i<=59;i++){
    int n,p[10009],d[10009],D[10009];
    cin>>n;
    if(n==0) break;
    for(int j=1;j<=n;j++){
      cin>>p[j]>>d[j]>>D[j];
    }
    int A=0;
    int P;
    for(int j=1;j<=n;j++){
      if(d[j]+D[j]>A) {
        A=d[j]+D[j];
        P=p[j];
      }
    }
    cout<<P<<" "<<A<<endl;
  }
  return 0;
}
accuracy: 1
time_ms: 70
memory_kb: 3304
final_rank: 10

code_snippet: #include<bits/stdc++.h>
using namespace std;
    int main(){

        for(int a=0;a<55;a++){
            int n;
            cin >> n;
            if(n==0)break;
            std::vector<int> v(15000);
            std::vector<int> ans(15000);
            for(int s=0;s<n;s++){
                int p,d1,d2;
                cin >> p >> d1 >> d2;
                v[p]=d1+d2;
                ans[p]=v[p];

            }

            sort(v.begin(), v.end(),greater<int>());
            int as = v[0];
            int x;
            for(int f=0;f<10200;f++){
                if(ans[f]==v[0])x = f;
            }
            cout << x << " " << v[0] << endl;
        }

        


        }
accuracy: 1
time_ms: 100
memory_kb: 3228
final_rank: 18

code_snippet: #include <iostream>
using namespace std;
int main(void){
    int i, n, p, d1, d2, w;
    while (true) {
        cin >> n;
        if (n == 0) break;
        int pMax = 0, wMax = 0;
        for (i = 0; i < n; i++) {
            cin >> p >> d1 >> d2;
            if ((d1 + d2) > wMax) {
                wMax = d1 + d2;
                pMax = p;
            }
        }
        cout << pMax << " " << wMax << endl;
    }
    
}
accuracy: 1
time_ms: 90
memory_kb: 3012
final_rank: 5

code_snippet: #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}
inline double time() {
    return static_cast<long double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    while (cin >> n, n) {
        vector<pair<int,int>> v(n);
        for (int i = 0; i < n; ++i) {
            int a,b,c; cin >> a >> b >> c;
            v[i] = {b+c, a};
        }
        sort(v.rbegin(), v.rend());
        cout << v[0].second << " " << v[0].first << endl;
    }
}
accuracy: 1
time_ms: 30
memory_kb: 3388
final_rank: 4

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

int main() {
  int n, p, d1, d2;
  while (cin >> n, n) {
    cin >> p >> d1 >> d2;
    int s = p, t = d1 + d2;
    n--;
    while (n--) {
      cin >> p >> d1 >> d2;
      if (d1 + d2 > t) {
        s = p, t = d1 + d2;
      }
    }
    cout << s << " " << t << "\n";
  }
  return 0;
}
accuracy: 1
time_ms: 70
memory_kb: 3336
final_rank: 14

code_snippet: #include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vvvvll = vector<vvvll>;
using vvvvvll = vector<vvvvll>;
using vvvvvvll = vector<vvvvvll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using vvvvb = vector<vvvb>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vvvvd = vector<vvvd>;
using vvvvvd = vector<vvvvd>;
#define all(A) A.begin(),A.end()
#define ALL(A) A.begin(),A.end()
#define rep(i, n) for (ll i = 0; i < (ll) (n); i++)
using pqr = priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>;


template<class T>
bool chmax(T& p, T q, bool C = 1) {
    if (C == 0 && p == q) {
        return 1;
    }
    if (p < q) {
        p = q;
        return 1;
    }
    else {
        return 0;
    }
}

template<class T>
bool chmin(T& p, T q, bool C = 1) {
    if (C == 0 && p == q) {
        return 1;
    }
    if (p > q) {
        p = q;
        return 1;
    }
    else {
        return 0;
    }
}

ll gcd(ll(a), ll(b)) {
    if (a == 0)return b;
    if (b == 0)return a;
    ll c = a;
    while (a % b != 0) {
        c = a % b;
        a = b;
        b = c;
    }
    return b;
}
ll sqrtz(ll N) {
    ll L = 0;
    ll R = sqrt(N) + 10000;
    while (abs(R - L) > 1) {
        ll mid = (R + L) / 2;
        if (mid * mid <= N)L = mid;
        else R = mid;
    }
    return L;

}

/*
using mint = modint998244353;
//using Mint = modint;
vector<mint> fact, factinv, inv;
const ll mod = 998244353;
void prenCkModp(ll n) {
    fact.resize(n + 5);
    factinv.resize(n + 5);
    inv.resize(n + 5);
    fact[0] = fact[1] = 1;
    factinv[0] = factinv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < n + 5; i++) {
        fact[i] = (fact[i - 1] * i);
        inv[i] = mod - (inv[mod % i] * (mod / i));
        factinv[i] = (factinv[i - 1] * inv[i]);
    }

}

mint nCk(ll n, ll k) {
    if (n < k || k < 0) return 0;
    return fact[n] * (factinv[k] * factinv[n - k]);
}
*/

template<class T>
vector<vector<T>> mul(vector<vector<T>> A, vector<vector<T>> B) {
    ll N = A.size();
    vector<vector<T>> res(N, vector<T>(N, 0));
    rep(i, N)rep(j, N)rep(k, N) {
        res[i][j] += A[i][k] * B[k][j];
    }
    return res;
}

vll S(vll V,ll A){
    A--;
    vll res;
    res.push_back(V[A]);
    rep(i,V.size()){
        if(i!=A)res.push_back(V[i]);
    }
    return res;
}

int main() {

    
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll N;
    while(1){
        cin>>N;
        if(N==0)return 0;
        ll M=-1;
        ll an=-10;
        rep(i,N){
            ll p,a,b;
            cin>>p>>a>>b;
            if(chmax(M,a+b))an=p;
        }
        cout<<an<<" "<<M<<endl;
    }
}
accuracy: 1
time_ms: 20
memory_kb: 3460
final_rank: 3

code_snippet: #include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    while(1){
        int max=0,max_p=0,d1,d2,p;
        cin >> n;
        if(n==0){
            break;
        }
        for(int i=0; i<n; i++){
            cin >> p >> d1 >> d2;
        if((d1+d2)>max){
            max=d1+d2;
            max_p=p;
        }
        }
        cout << max_p << " " << max << endl;
    }
}
accuracy: 1
time_ms: 90
memory_kb: 3108
final_rank: 11

code_snippet: #include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,c,d,e,f;
while(true){
    cin>>a;
    if(a==0){
        break;
    }
    e=0;f=0;
    for(int i=0;i<a;i+=1){
        cin>>b>>c>>d;
        if(f<c+d){
            e=b;f=c+d;
        }
    }
    cout<<e<<" "<<f<<endl;
}
}
accuracy: 1
time_ms: 90
memory_kb: 3064
final_rank: 8

code_snippet: #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rrep(i,a,b) for(int i = a; i < b; i++)
#define all(A) (A).begin(),(A).end()
#define MOD 1000000007
#define grt greater<int>()
#define mfor(i,M) for(auto i = M.begin(); i != M.end(); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll INF = 1LL<<60;
typedef vector<vector<ll> > Graph;

int main(void){
	while(1){
		vector<int> D(10101,0);
		int n,p,d,d2; cin >> n;
		if(n == 0) break;
		rep(i,n){
			cin >> p >> d >> d2;
			D[p] += d+d2;
		}
		int M = 0,s = 0;
		rep(i,10101) if(D[i] > s) M = i,s = D[i];
		cout << M << " " << s << endl;
	}

	return 0;
}
accuracy: 1
time_ms: 90
memory_kb: 3116
final_rank: 12

code_snippet: #include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
    ll n,x,y,p,d1,d2,i;
    while(cin>>n){
        if(n==0){
            return 0;
        }
        for(i=x=0;i<n;i++){
            cin>>p>>d1>>d2;
            if(x<d1+d2){
                x=d1+d2;
                y=p;
            }
        }
        cout<<y<<" "<<x<<endl;
    }
}
accuracy: 1
time_ms: 70
memory_kb: 3324
final_rank: 13

code_snippet: #pragma region Template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vpi = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;
using vs = vector<string>;
using pi = pair<int,int>;
using pll = pair<ll,ll>;
#define fi first
#define se second
#define pb push_back
#define fore(p,a) for (auto p : a)
#define overload4(a,b,c,d,name,...) name
#define rep1(n) for (ll i = 0; i < ll(n); ++i)
#define rep2(i,n) for (ll i = 0; i < ll(n); ++i)
#define rep3(i,a,b) for (ll i = a; i < ll(b); ++i)
#define rep4(i,a,b,c) for (ll i = a; i < ll(b); i += c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define rrep1(n) for (ll i = n; i--;)
#define rrep2(i,n) for (ll i = n; i--;)
#define rrep3(i,a,b) for (ll i = b; i-- > (a);)
#define rrep4(i,a,b,c) for (ll i = (a) + ((b) - (a) - 1) / (c) * (c); i >= (a); i-=c)
#define rrep(...) overload4(__VA_ARGS__,rrep4,rrep3,rrep2,rrep1)(__VA_ARGS__)
#define all(container) begin(container), end(container)
#define rall(container) rbegin(container), rend(container)
#define Vvll(name,row,column) vvll name(row, vll (column))
#define Max(...) max({__VA_ARGS__})
#define Min(...) min({__VA_ARGS__})
#define fin exit(0)
const int INF = 1001001001;
const ll LINF = 1LL << 60;
const double PI = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll fact(ll x) { return x == 0 ? 1 : x * fact(x - 1); }
ll comb(ll n, ll r) { if (r == 0 || r == n) return 1; else if (r == 1) return n; return comb(n - 1, r - 1) + comb(n - 1, r); }
void prfl(double x) { printf("%.15f\n", x); }
bool ise(ll x) { return x % 2 == 0; }
bool dv(ll waru, ll warareru) { return warareru % waru == 0; }
int ci(char c) { return c - '0'; }
char ic(int i) { return '0' + i; }
#pragma endregion

int main() {
    while (1) {
        int n;
        cin >> n;
        if (n == 0) fin;
        vpi a(n);
        rep(n) {
            int x, y, z;
            cin >> x >> y >> z;
            a[i].fi = y + z, a[i].se = x;
        }
        sort(all(a));
        cout << a.back().se << ' ' << a.back().fi << '\n';
    }
}
accuracy: 1
time_ms: 80
memory_kb: 3552
final_rank: 19

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

int main() {
    while(true) {
    int n;
    cin >> n;
    if(n == 0) return 0;
    vector<pair<int,int>>tmp(n);
    for(int i = 0; i < n; i++) {
        int p,d1,d2;
        cin >> p >> d1 >> d2;
        tmp[i] = {d1+d2,p};
    }
    sort(tmp.rbegin(),tmp.rend());
    cout << tmp[0].second << " " << tmp[0].first << endl;
    }
}
accuracy: 1
time_ms: 80
memory_kb: 3300
final_rank: 16

code_snippet: #include<iostream>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<bitset>
#include<vector>
#include<string>
#include <iomanip>
#include <deque>
#include<list>
#include<cmath>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll=long long;
using P=pair<int,int>;
using P_S=pair<int,string>;
using P_D=pair<double,int>;
using T=tuple<int,int,char,ll,string>;

int main()
{
   while(1)
   {
       int n;
       cin>>n;
       if(n==0) break;
       int max_m=-1,ans=0;
       rep(i,n){
           int p,d1,d2;
           cin>>p>>d1>>d2;
           int sum=d1+d2;
           if(sum>max_m){
               max_m=sum;
               ans=p;
           }
       }
       cout<<ans<<" "<<max_m<<endl;
   }
}
accuracy: 1
time_ms: 90
memory_kb: 3016
final_rank: 6

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

int main(){
  for(;;){
    int n;
    cin >> n;
    if(n == 0) break;
    vector<pair<int,int> > vec(n);
    for(int i=0;i<n;i++){
      int p,d1,d2;
      cin >> p >> d1 >> d2;
      vec[i] = make_pair(d1+d2,p);
    }
    sort(vec.rbegin(),vec.rend());
    cout << vec[0].second << " " << vec[0].first<< endl;
  }
}
accuracy: 1
time_ms: 100
memory_kb: 3160
final_rank: 17

code_snippet: #include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<list>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<iomanip>
#include<regex>
#include<random>
using namespace std;
#define int long long
#define uint unsigned long long
const int mod=1e9+7;
const int inf=mod*mod;
const double eps=1e-9;
signed main(){
	int n;
	while(cin>>n,n){
		int p,d1,d2,mx=0,ans;
		for(int i=0;i<n;i++){
			cin>>p>>d1>>d2;
			if(d1+d2>mx){
				mx=d1+d2;
				ans=p;
			}
		}
		cout<<ans<<' '<<mx<<endl;
	}
}
accuracy: 1
time_ms: 70
memory_kb: 3356
final_rank: 15