aboutsummaryrefslogtreecommitdiff
path: root/codeforces/Tram/main.cpp
blob: ff917a6ef92f7493bb6790a23aaf14f8c7d01d9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define INF 1000000000

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  int mx = 0;
  int n;
  cin >> n;
  vi v(n);
  int x, y;
  cin >> x >> y;
  v[0] = y;
  for (int i = 0; i < n - 1; ++i) {
    int x, y;
    cin >> x >> y;
    v[i + 1] = v[i] + (y - x);
	}
  cout << *max_element(v.begin(), v.end()) << '\n';
}