Từ 2025 HEMS 6
Thông tin
include<bits/stdc++.h>
using namespace std;
int main()
{
long long n, a, b, x = 0, y = 0, t=0;
cin >> n;
for(int i = 0;i < n; i++)
{
cin >> a >> b;
t+=b;
x = x - a + b;
y =max(x,y);
}
cout << t << endl << y;
return 0;
}