#include <iostream>
using namespace std;

int main()
{
    int a, b;
    int max = 0;
    int result = 0;
    for (int i = 0; i < 4; i++)
    {
        cin >> a >> b;
        result -= a;
        result += b;
        if (max < result)
        {
            max = result;
        }
    }
    cout << max;
    return 0;
}

Embed on website

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