func_code_string: #include <bits/stdc++.h>   const int INFI = (1 << 29);   const long long INFL = (1LL << 62);   using namespace std;   void solve() {     long long a, n, m;     cin >> a >> n >> m;     bitset<2010> rain;     vector<long long> v(m + 1);     vector<pair<long long, long long> > umb(a + 1, {INFL, 0});     for (long long i = 0; i < n; i++) {       long long l, r;       cin >> l >> r;       for (long long j = l; j <= r - 1; j++) rain[j] = 1;     }     for (long long i = 1; i <= m; i++) {       long long l, r;       cin >> l >> r;       v[i] = r;       umb[l] = min(umb[l], {r, i});     }     vector<vector<long long> > dp(a + 1, vector<long long>(m + 1, INFL));     dp[0][0] = 0;     for (long long i = 0; i < a; i++) {       for (long long j = 0; j <= m; j++) {         if (dp[i][j] == INFL) continue;         if (umb[i].first != INFL)           dp[i + 1][umb[i].second] =               min(dp[i + 1][umb[i].second], dp[i][j] + umb[i].first);         if (j) dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + v[j]);         if (!rain[i]) dp[i + 1][0] = min(dp[i + 1][0], dp[i][j]);       }     }     long long r = *min_element(dp[a].begin(), dp[a].end());     if (r == INFL) r = -1;     cout << r <<   n ;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     solve();     return 0;   }   