func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<pair<pair<int, int>, int>> ordered;   deque<pair<int, int>> solutions;   vector<bool> stay, check;   bool cmp(pair<pair<int, int>, int> &a, pair<pair<int, int>, int> &b) {     int A = a.first.second - a.first.first;     int B = b.first.second - b.first.first;     return A < B;   }   vector<pair<pair<int, int>, int>> new_array(       vector<pair<pair<int, int>, int>> &v, int value) {     vector<pair<pair<int, int>, int>> temp;     for (int i = 0; i < v.size(); i++) {       if (stay[i])         temp.push_back(make_pair(             make_pair(v[i].first.first + value, v[i].first.second), v[i].second));     }     return temp;   }   int main() {     cin.sync_with_stdio(0);     cin.tie(0);     int n, k;     cin >> n >> k;     for (int i = 0; i < n; i++) {       int aux;       cin >> aux;       stay.push_back(false);       check.push_back(false);       if (i < k)         ordered.push_back(make_pair(make_pair(1, aux), i));       else         solutions.push_back(make_pair(aux, i));     }     sort(ordered.begin(), ordered.end(), cmp);     int d = 0, ans = 0, m = 0;     while (ordered.size() != 0) {       int mini = ordered[0].first.second - ordered[0].first.first + 1;       int index = 0, out = 0, change = 0, intern_ans = 0;       for (auto &x : ordered) {         int L = x.first.first;         int R = L + mini - 1;         int id = x.second;         if (L <= d && d <= R && check[id] == false) {           ans++;           intern_ans++;           check[id] = true;         }         int range = x.first.second - x.first.first + 1;         if (range == mini) {           stay[index++] = false;           m++;           out++;           change = true;         } else           stay[index++] = true;       }       ordered = new_array(ordered, mini);       double temp = 100.00 * ((double)m / n) + 0.5;       d = (int)temp;       while (solutions.size() != 0 && out > 0) {         ordered.push_back(             make_pair(make_pair(1, solutions[0].first), solutions[0].second));         solutions.pop_front();         out--;       }       if (change) sort(ordered.begin(), ordered.end(), cmp);     }     cout << ans <<   n ;     return 0;   }   