#include<iostream>#include<algorithm>#include<cstdio>#include<cstdlib>#include<ctime>#include<string>#include<cstring>#include<cctype>#include<cmath>#include<vector>#include<stack>#include<queue>#include<deque>#include<map>usingnamespace std;typedeflonglong ll;typedef pair<int,int> pii;constint inf =0x3f3f3f3f;#define elif else if#define il inlineint t, n, k, q, a[200005];intmain(){
cin >> t;while(t--){
cin >> n >> k >> q;int d =0;
ll ans =0;for(int i =1; i <= n; i++){
cin >> a[i];if(a[i]<= q)
d++;else
d =0;
ans +=max(0, d - k +1);}
cout << ans << endl;}return0;}