aboutsummaryrefslogtreecommitdiff
path: root/codeforces/Tram/main.cpp
blob: 9b967d348d159a6c04c1fcb86acbe3e453939536 (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
29
#include <bits/stdc++.h>
#include <vector>

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';
}