func_code_string: #include <bits/stdc++.h>   using namespace std;   long long prime[1000005];   long long fac[1000005];   int mul(int a, int b) {     int res = 0;     while (b) {       if (b & 1) res = (res + a);       a = (a + a);       b = b / 2;     }     return res;   }   int bexp(int a, int b) {     int res = 1;     while (b) {       if (b & 1) res = mul(res, a);       a = mul(a, a);       b = b / 2;     }     return res;   }   int inv(int a) { return bexp(a, 1000000007 - 2); }   int nCr(int n, int r) { return mul(fac[n], mul(inv(fac[n - r]), inv(fac[r]))); }   long long power(long long a, long long b, long long c) {     long long res = 1;     while (b) {       if (b & 1) res = (res * a) % c;       a = (a * a) % c;       b /= 2;     }     return res % c;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long n, m, k;     cin >> n >> m >> k;     long long a[n];     vector<pair<long long, long long>> v;     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     long long p = n - k;     if (p == 0) {       cout << n << endl;       return 0;     }     for (int i = 2; i <= n; i++)       v.push_back(make_pair(a[i] - a[i - 1] + 1, i - 1));     sort(v.begin(), v.end());     long long count = 0;     long long sum = 0;     vector<pair<long long, long long>> final;     for (int i = 0; i < v.size(); i++) {       sum += v[i].first;       final.push_back(make_pair(v[i].second, v[i].first));       count++;       if (count == p) break;     }     long long check = 2;     sort(final.begin(), final.end());     for (int i = 1; i < final.size(); i++) {       if (final[i].first - final[i - 1].first == 1) {         sum -= 1;         check += 1;       } else         check += 2;     }     cout << sum + n - check << endl;   }   