func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long INF = 2e9 + 10, MAX = 2100, MOD = 1e9 + 7, MAXL = 25;   void OUT(long double o, int x) {     cout << fixed << setprecision(x) << o;     return;   }   long long dp[MAX][MAX], ra[MAX], a[MAX], re[200000], w[MAX];   vector<int> v[MAX];   pair<long long, long long> c[MAX];   set<int> st;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n, m, t;     cin >> n >> m >> t;     for (int i = 1; i <= m; i++) {       int l, r;       cin >> l >> r;       for (int j = l + 1; j <= r; j++) ra[j] = 1;     }     for (int i = 1; i <= t; i++) {       cin >> c[i].first >> c[i].second;       st.insert(c[i].second);     }     int cnt = 0;     for (int i = 1; i <= 2000; i++) w[i] = INF;     for (int u : st) {       re[u] = ++cnt;       w[cnt] = u;     }     for (int i = 1; i <= t; i++) v[c[i].first].push_back(re[c[i].second]);     for (int i = 1; i <= 2000; i++) dp[0][i] = INF;     for (int u : v[0]) dp[0][u] = 0;     for (int i = 1; i <= n; i++) {       long long mi = INF;       for (int j = 1; j <= 2000; j++) mi = min(mi, dp[i - 1][j] + w[j]);       if (!ra[i]) mi = min(mi, dp[i - 1][0]);       dp[i][0] = mi;       for (int j = 1; j <= 2000; j++) dp[i][j] = dp[i - 1][j] + w[j];       for (int u : v[i]) dp[i][u] = min(dp[i][u], mi);     }     long long ans = INF;     for (int i = 0; i <= 2000; i++) ans = min(ans, dp[n][i]);     if (ans < INF)       cout << ans;     else       cout << -1;     return 0;   }   