// source problem : 
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define int long long
#define lb lower_bound
#define ub upper_bound
#define MASK(i) (1LL << (i))
const int inf = 1e18;
void ckmax(int& f, int s)
{
    f = (f > s ? f : s);
}
void ckmin(int& f, int s)
{
    f = (f < s ? f : s);
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int ans = 0, mx = -1;
    string g;
    while (n--) {
        string s;
        cin >> s;
        int a, b;
        cin >> a >> b;
        int c = 0;
        while (b >= a) {
            b -= a;
            b += 2;
            c++;
        }
        ans += c;
        if (c > mx) mx = c, g = s;
    }   
    cout << ans << '\n' << g;
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |