func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 10;   const int INF = 0x3f3f3f3f;   int n, h, m, k;   pair<int, int> arr[maxn];   vector<int> out;   int calc(int l, int r, int s) {     if (l <= r) {       int low = lower_bound(arr + 1, arr + 1 + n, make_pair(l, 0)) - arr;       int up = upper_bound(arr + 1, arr + 1 + n, make_pair(r, INF)) - arr;       --up;       if (s) {         for (int i = low; i <= up; i++) out.emplace_back(arr[i].second);       }       return max(0, up - low + 1);     }     swap(l, r);     int low = upper_bound(arr + 1, arr + 1 + n, make_pair(l, INF)) - arr;     --low;     if (s) {       for (int i = 1; i <= low; i++) out.emplace_back(arr[i].second);     }     int up = lower_bound(arr + 1, arr + 1 + n, make_pair(r, 0)) - arr;     if (s) {       for (int i = up; i <= n; i++) out.emplace_back(arr[i].second);     }     return low + (n - up + 1);   }   int solve(int t, int s) {     t = (t + m) % m;     int s1 = t;     int t1 = (s1 + k - 1) % m;     int s2 = (t + m / 2) % m;     int t2 = (s2 + k - 1) % m;     return calc(s1, t1, s) + calc(s2, t2, s);   }   int main() {     scanf( %d%d%d%d , &n, &h, &m, &k);     --k;     for (int i = 1; i <= n; i++) {       int h;       scanf( %d%d , &h, &arr[i].first);       arr[i].second = i;     }     if (k == 0) {       printf( 0 0 n );       return 0;     }     sort(arr + 1, arr + 1 + n);     int ans = INF;     int t = 0;     for (int i = 1; i <= n; i++) {       int nt = arr[i].first + 1;       int ncnt = solve(nt, 0);       if (ncnt < ans) {         ans = ncnt;         t = arr[i].first + k + 1;       }       nt = arr[i].first - k;       ncnt = solve(nt, 0);       if (ncnt < ans) {         ans = ncnt;         t = arr[i].first;       }     }     printf( %d %d n , ans, t % (m / 2));     solve(t - k, 1);     int lens = out.size();     for (int i = 0; i < lens; i++)       printf( %d%c , out[i], i == lens - 1 ?   n  :    );     return 0;   }   