func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T1, typename T2>   istream &operator>>(istream &in, pair<T1, T2> &p) {     in >> p.first >> p.second;     return in;   }   template <typename T>   istream &operator>>(istream &in, vector<T> &v) {     for (auto &x : v) in >> x;     return in;   }   template <typename T1, typename T2>   ostream &operator<<(ostream &out, const std::pair<T1, T2> &p) {     out <<  [  << p.first <<  ,   << p.second <<  ]          <<   n ;     return out;   }   inline int gc() {     static const int BUF = 1e7;     static char buf[BUF], *bg = buf + BUF, *ed = bg;     if (bg == ed) fread(bg = buf, 1, BUF, stdin);     return *bg++;   }   inline int ri() {     int x = 0, f = 1, c = gc();     for (; c < 48 || c > 57; f = c ==  -  ? -1 : f, c = gc())       ;     for (; c > 47 && c < 58; x = x * 10 + c - 48, c = gc())       ;     return x * f;   }   const double EPS = 1e-10;   const double PI = acos(-1.0);   const long long mod = 1e9 + 7;   const int inf = 0x3f3f3f3f;   const long long infLL = 0x3f3f3f3f3f3f3f3fLL;   const long long ONE = 1;   const int maxN = 2e5 + 7;   int n, m, k, ans;   int a[maxN], sumA[2007];   pair<int, int> offers[maxN];   map<int, int> mii;   int dp[2007];   int getSum(int x, int y) {     if (x > y) return 0;     return sumA[y] - sumA[x - 1];   }   inline bool cmp1(const pair<int, int> &x, const pair<int, int> &y) {     return x.first < y.first;   }   inline bool cmp2(const pair<int, int> &x, const pair<int, int> &y) {     return x.first - x.second < y.first - y.second;   }   void CompletePack(int cost, int weight) {     for (int i = (cost); i <= (k); ++i) {       int x = dp[i - cost] + getSum(i - (cost - weight) + 1, i);       dp[i] = min(dp[i], x);     }   }   int main() {     std::ios::sync_with_stdio(false);     std::cin.tie(0);     ;     cin >> n >> m >> k;     for (int i = (1); i <= (n); ++i) cin >> a[i];     for (int i = (1); i <= (m); ++i) {       cin >> offers[i];       if (offers[i].first > k) {         --m;         --i;       } else if (mii.find(offers[i].first) != mii.end()) {         offers[mii[offers[i].first]].second =             max(offers[mii[offers[i].first]].second, offers[i].second);         --m;         --i;       } else {         mii[offers[i].first] = i;       }     }     sort(a + 1, a + n + 1);     n = k;     for (int i = (1); i <= (n); ++i) {       dp[i] = dp[i - 1] + a[i];       sumA[i] = dp[i];     }     sort(offers + 1, offers + m + 1, cmp1);     for (int i = (1); i <= (m); ++i) {       CompletePack(offers[i].first, offers[i].second);     }     sort(offers + 1, offers + m + 1, cmp2);     for (int i = (1); i <= (m); ++i) {       CompletePack(offers[i].first, offers[i].second);     }     cout << dp[k] << endl;     return 0;   }   