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

int a[100005]={};
int t[100005]={};

int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d %d",&a[i],&t[i]);
    }
    sort(a,a+n);
    int mt=a[n-1]*2;
    for(int i=0; i<n; i++)
    {
        int ct=t[i]+a[i];
        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: