func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2005;   bool vis[N];   pair<int, int> pt[N];   int dp[N];   int main() {     memset(dp, 0x3f, sizeof(dp));     int a, m, n;     cin >> a >> n >> m;     for (int i = 1; i <= n; i++) {       int l, r;       scanf( %d %d , &l, &r);       for (int j = l + 1; j <= r; j++) {         vis[j] = true;       }     }     for (int i = 1; i <= m; i++) {       scanf( %d %d , &pt[i].first, &pt[i].second);     }     sort(pt + 1, pt + 1 + m);     for (int i = 1; i <= pt[1].first; i++) {       if (vis[i] == true) {         puts( -1 );         return 0;       }     }     dp[0] = 0;     int cnt = 1;     for (int i = 1; i <= a; i++) {       while (cnt <= m && pt[cnt].first < i) cnt++;       if (vis[i] == false)         dp[i] = dp[i - 1];       else {         for (int j = 1; j < cnt; j++) {           dp[i] = min(dp[i], dp[pt[j].first] + pt[j].second * (i - pt[j].first));         }       }     }     printf( %d n , dp[a]);     return 0;   }   