Pagini recente » Cod sursa (job #3131347) | Cod sursa (job #84395) | Cod sursa (job #879276) | Cod sursa (job #150423) | Cod sursa (job #2286655)
#include <bits/stdc++.h>
using namespace std;
#if 1
#define pv(x) cout<<#x<<" = "<<(x)<<"; ";cout.flush()
#define pn cout<<endl
#else
#define pv(x)
#define pn
#endif
#ifdef INFOARENA
ifstream in("stergeri.in");
ofstream out("stergeri.out");
#else
#define in cin
#define out cout
#endif
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pld = pair<ld, ld>;
#define pb push_back
const double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862;
const int inf_int = 1e9 + 5;
const ll inf_ll = 1e18 + 5;
const int NMax = 1e2 + 5;
const int dx[] = {-1,0,0,+1}, dy[] = {0,-1,+1,0};
int main() {
cin.sync_with_stdio(false);
cin.tie(0);
int N,M,K;
in >> N >> M >> K;
vector<pii> op(M);
for (auto& o : op) {
in >> o.first >> o.second;
}
reverse(op.begin(), op.end());
for (auto& o : op) {
if (o.first <= K) {
K += o.second - o.first + 1;
}
}
out << K << '\n';
return 0;
}