#include <cstdio>
#include <algorithm>
using namespace std; 

struct Strawberry
{
    int a;
    int t;
};

Strawberry st[100005];

bool comp(Strawberry x, Strawberry y)
{
    return x.a<y.a;
}

int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d %d",&st[i].a,&st[i].t);
    }
    sort(st,st+n,comp);
    int mt=st[n-1].a*2;
    for(int i=0; i<n; i++)
    {
        int ct=st[i].t+st[i].a;
        if(ct>mt)
            mt=ct;
    }
    printf("%d",mt);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: