func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( O3 )   const double PI = acos(-1.0);   using namespace std;   const double EPS = 1e-9;   const int N = 2e5 + 9;   int a[N], n, p, k;   long long sum[N], v[N];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t;     cin >> t;     while (t--) {       cin >> n >> p >> k;       for (int i = 1; i <= n; i++) cin >> a[i], v[i] = 0;       sort(a + 1, a + 1 + n);       for (int i = 1; i <= n; i++) sum[i] = a[i] + sum[i - 1];       for (int i = k; i <= n; i++) {         v[i] = a[i] + v[i - k];       }       long long ans = 0;       for (int i = 1; i <= n; i++) {         if (v[i] + sum[i % k] <= p) ans = i;       }       cout << ans << endl;     }     return 0;   }   