#include<bits/stdc++.h>
#define int long long
using namespace std;
auto mread = [](){int x;scanf("%lld", &x);return x;};
int t = mread();
signed main(){
while(t --){
int n = mread(), m = mread(), k = mread();
int a[n + 5], b[n + 5];
for(int i = 1; i <= n; i ++){
cin >> a[i];
}
auto solve = [&](int l, int r){
for(int i = l; i <= r; i ++){
b[i] = a[i];
}
sort(b + l, b + 1 + r);
int ans = 0;
for(int i = l, j = r; i < j && i - l + 1 <= m; i ++, j --){
ans += (b[j] - b[i]) * (b[j] - b[i]);
}
return ans;
};
int now = 1, ans = 0;
while(now <= n){
int sum = 1;
int p = 1;
while(p){
if(now + sum + p - 1 <= n && solve(now, now + sum + p - 1) <= k){
sum += p;
p <<= 1;
}
else{
p >>= 1;
}
}
now += sum;
ans ++;
}
printf("%lld\n", ans);
}
return 0;
}