func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   int n, m, k;   const int maxn = 1100000;   int has[maxn];   pair<int, int> buy[maxn];   int tmp[maxn * 2];   bool test(int mid) {     for (int i = 1; i <= n; i++) tmp[i] = has[i];     for (int i = 1; i <= mid; i++) {       tmp[i + n] = buy[i].first;     }     sort(tmp + 1, tmp + 1 + n + mid);     int dd = 0;     int cnt = 0;     bool du = true;     for (int i = 1; i <= n + mid; i++) {       if (dd > tmp[i]) {         du = false;         break;       }       cnt++;       if (cnt == k) {         dd++;         cnt = 0;       }     }     return du;   }   void solve() {     int dd = 0;     int cnt = 0;     bool du = true;     for (int i = 1; i <= n; i++) {       if (dd > has[i]) {         du = false;         break;       }       cnt++;       if (cnt == k) {         dd++;         cnt = 0;       }     }     if (du == false) {       cout << -1 << endl;       return;     }     int l = 0;     int r = m;     int ans = 0;     while (l <= r) {       int mid = (l + r) / 2;       if (test(mid)) {         ans = max(ans, mid);         l = mid + 1;       } else         r = mid - 1;     }     cout << ans << endl;     for (int i = 1; i <= ans; i++) {       if (i == 1)         printf( %d , buy[i].second);       else         printf(  %d , buy[i].second);     }     cout << endl;   }   int main() {     while (cin >> n >> m >> k) {       for (int i = 1; i <= n; i++) scanf( %d , &has[i]);       for (int i = 1; i <= m; i++) {         int x;         scanf( %d , &x);         buy[i].first = x;         buy[i].second = i;       }       sort(has + 1, has + n + 1);       sort(buy + 1, buy + m + 1);       reverse(buy + 1, buy + m + 1);       solve();     }     return 0;   }   