func_code_string: #include <bits/stdc++.h>   using namespace std;   using pii = pair<int, int>;   using vpii = vector<pii>;   using vi = vector<int>;   using vvi = vector<vi>;   using ll = long long;   using vll = vector<long long>;   template <class T>   using min_queue = priority_queue<T, vector<T>, greater<T>>;   template <class T>   istream &operator>>(istream &, vector<T> &);   template <class T>   ostream &operator<<(ostream &, const vector<T> &);   template <class T, class U>   istream &operator>>(istream &, pair<T, U> &);   template <class T, class U>   ostream &operator<<(ostream &, const pair<T, U> &);   template <class T>   struct Inf {     static constexpr T inf() {       return std::numeric_limits<T>::has_infinity()                  ? std::numeric_limits<T>::infinty()                  : std::numeric_limits<T>::max();     }   };   template <>   struct Inf<int> {     static constexpr int inf() { return 0x3f3f3f3f; }   };   template <>   struct Inf<long long> {     static constexpr long long inf() { return 0x3f3f3f3f3f3f3f3fLL; }   };   constexpr int INF = Inf<int>::inf();   constexpr ll BINF = Inf<ll>::inf();   int solve() {     int n, k;     cin >> n >> k;     vi a(n);     cin >> a;     ll ans = a[n - 1] - a[0];     vi wtf;     for (int i = 0; i + 1 < n; i++) wtf.push_back(a[i] - a[i + 1]);     sort(wtf.begin(), wtf.end());     for (int i = 0; i < k - 1; i++) ans += wtf[i];     cout << ans << endl;     return 0;   }   int main() {     ios::sync_with_stdio(0);     solve();     return 0;   }   template <class T>   istream &operator>>(istream &is, vector<T> &v) {     for (auto it = v.begin(); it != v.end(); ++it) is >> *it;     return is;   }   template <class T>   ostream &operator<<(ostream &os, const vector<T> &v) {     for (auto it = v.begin(); it != v.end();)       os << *it, os <<    n [++it == v.end()];     return os;   }   template <class T, class U>   istream &operator>>(istream &is, pair<T, U> &p) {     return is >> p.first >> p.second;   }   template <class T, class U>   ostream &operator<<(ostream &os, const pair<T, U> &p) {     return os << p.first <<     << p.second;   }   