func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1007;   int c[N], t[N];   bool cmp(int i, int j) { return c[i] > c[j]; }   int main() {     int n, k;     cin >> n >> k;     vector<int> v[3];     for (int i = 0; i < n; ++i) {       cin >> c[i] >> t[i];       v[t[i]].push_back(i);     }     sort((v[1]).begin(), (v[1]).end(), cmp);     int sz = (int)((v[1]).size()), uu = (int)((v[2]).size());     double sum = 0;     if (sz < k) {       for (int i = 0; i < sz; ++i) sum += (double)c[v[1][i]] / 2;       for (int i = 0; i < uu; ++i) sum += c[v[2][i]];       cout << fixed << setprecision(1) << sum <<   n ;       for (int i = 0; i < sz; ++i) cout << 1 <<     << v[1][i] + 1 <<   n ;       for (int i = 0; i < k - sz - 1; ++i)         cout << 1 <<     << v[2][i] + 1 <<   n ;       cout << (n - (k - 1)) <<    ;       for (int i = k - sz - 1; i < n - sz; ++i) cout << v[2][i] + 1 <<    ;       cout <<   n ;     } else {       for (int i = 0; i < k - 1; ++i) sum += (double)c[v[1][i]] / 2;       int mini = 1000000000;       for (int i = k - 1; i < sz; ++i) {         sum += c[v[1][i]];         mini = min(mini, c[v[1][i]]);       }       for (int i = 0; i < uu; ++i) {         sum += c[v[2][i]];         mini = min(mini, c[v[2][i]]);       }       sum -= (double)mini / 2;       cout << fixed << setprecision(1) << sum <<   n ;       for (int i = 0; i < k - 1; ++i) cout << 1 <<     << v[1][i] + 1 <<   n ;       cout << (n - (k - 1)) <<    ;       for (int i = k - 1; i < sz; ++i) cout << v[1][i] + 1 <<    ;       for (int i = 0; i < uu; ++i) cout << v[2][i] + 1 <<    ;       cout <<   n ;     }   }   