#include #include #include #include #define Maxn 200010 #define ll long long using namespace std; int s[Maxn],a[Maxn]; int main() { int t,n,m,k; cin>>t; while(t--){ scanf("%d%d%d",&n,&m,&k); for(int i=1;i<=n;i++){ scanf("%d",a+i); a[i]-=m; if(a[i]<0) a[i]=0; else a[i]=1; s[i]=s[i-1]+a[i]; } ll ans=0; for(int i=1;i<=n;i++){ if(s[i]>=k) ans+=upper_bound(s,s+i,s[i]-k)-s; } cout<