1 #include<bits/stdc++.h>
2 using namespace std;
3 int a[10100],pre[10100];
4 int main()
5 {
6 int T,L,M,N,i,j,k;
7 cin>>T;
8 while(T--){
9 vector<int>q;
10 cin>>N>>L>>M;
11 for(i=1;i<=N;++i){
12 scanf("%d",a+i);
13 pre[i]=pre[i-1]+a[i];
14 }
15 int ans=0;
16 for(i=N;i>=L;i--){
17 int p=lower_bound(q.begin(),q.end(),pre[i])-q.begin();
18 q.insert(q.begin()+p,pre[i]);
19 vector<int>::iterator x=lower_bound(q.begin(),q.end(),M+pre[i-L]);
20 ans+=q.end()-x;
21 }
22 cout<<ans<<endl;
23 }
24 return 0;
25 }