func_code_string: #include <bits/stdc++.h>   using namespace std;   const long double pi = 3.14159265358979323846;   long long MOD = 1e9 + 7;   const char nl =   n ;   const long long inf = 1e15;   long long power(long long x, long long y) {     long long z = 1;     while (y > 0) {       if (y % 2) z = z * x;       x = x * x;       y /= 2;     }     return z;   }   long long gcd(long long a, long long b) {     if (a < b) return gcd(b, a);     if (b == 0) return a;     return gcd(b, a % b);   }   long long sq(long long a) {     long long ans = (1ll * a * a);     return ans;   }   bool isprime(long long n) {     if (n <= 1) return false;     if (n <= 3) return true;     if (n % 2 == 0 || n % 3 == 0) return false;     for (long long i = 5; i * i <= n; i = i + 6)       if (n % i == 0 || n % (i + 2) == 0) return false;     return true;   }   long long digitsum(long long x) {     long long ans = 0;     while (x > 0) {       ans += (x % 10);       x /= 10;     }     return ans;   }   void solve() {     long long m;     long long n, d;     cin >> n >> d >> m;     long long a[n];     long long i, j;     vector<long long> large;     vector<long long> small;     for (long long i = 0; i < n; i++) {       cin >> a[i];       if (a[i] <= m) {         small.push_back(a[i]);       } else {         large.push_back(a[i]);       }     }     long long ans = 0;     sort(large.begin(), large.end(), greater<int>());     sort(small.begin(), small.end(), greater<int>());     long long temp = 0;     for (i = 0; i < small.size(); i++) {       temp += small[i];     }     ans = max(ans, temp);     for (i = 1; i <= large.size(); i++) {       temp = 0;       if (n - 1 - (i - 1) * (d + 1) >= 0) {         long long x = small.size();         for (j = 0; j < min(n - 1 - (i - 1) * (d + 1), x); j++) {           temp += small[j];         }         temp += large[0];         for (j = 1; j <= i - 1; j++) {           temp += large[j];         }       }       ans = max(ans, temp);     }     cout << ans <<   n ;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0), cout.tie(0);     long long TC = 1;     while (TC--) {       solve();     }   }   