#include <bits/stdc++.h>
using namespace std;
#define rall(x) x.rbegin(), x.rend()
#define int long long
signed main() {
    int t;
    cin >> t;
    while (t--) {
        int n, a, M;
        cin >> n >> a >> M;
        vector<int> b(n);
        for (auto& x : b) cin >> x;
        sort(rall(b));
        int ans = 1, sum = 0;
        for (int i = 0; i < n; i++) {
            sum += 1 + 2LL * a * b[i];
        }
        int left = 0, right = sum;
        for (auto& x : b) {
            right -= 1 + 2LL * a * x;
            left += 1;
            // printf("%d: left %d, right %d\n", x - 1, left * 2 * (x - 1) * a + left, right);
            if (left * 2LL * (x)*a + left + right < M) {
                ans = x;
                break;
            }
            if (left * 2LL * (x - 1) * a + left + right < M) {
                ans = x - 1;
                break;
            }
        }
        cout << ans << endl;
    }
}