#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve() {
int n;
ll l, r;
cin >> n >> l >> r;
vector<ll> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
ll current_sum = 0, ans = 0;
for (int i = 0; i < n; i++) {
if (a[i] > r) {
// Single card is too large, reset sum
current_sum = 0;
} else if (a[i] >= l && a[i] <= r) {
// Single card itself forms a valid round
ans++;
current_sum = 0;
} else {
// Accumulate sum
current_sum += a[i];
if (current_sum >= l && current_sum <= r) {
ans++;
current_sum = 0; // Reset for the next round
} else if (current_sum > r) {
current_sum = 0; // Reset if sum exceeds r
}
}
}
cout << ans << endl;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
solve();
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgbGwgbG9uZyBsb25nCgp2b2lkIHNvbHZlKCkgewogICAgaW50IG47CiAgICBsbCBsLCByOwogICAgY2luID4+IG4gPj4gbCA+PiByOwoKICAgIHZlY3RvcjxsbD4gYShuKTsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSBjaW4gPj4gYVtpXTsKCiAgICBsbCBjdXJyZW50X3N1bSA9IDAsIGFucyA9IDA7CgogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgICAgICBpZiAoYVtpXSA+IHIpIHsKICAgICAgICAgICAgLy8gU2luZ2xlIGNhcmQgaXMgdG9vIGxhcmdlLCByZXNldCBzdW0KICAgICAgICAgICAgY3VycmVudF9zdW0gPSAwOwogICAgICAgIH0gZWxzZSBpZiAoYVtpXSA+PSBsICYmIGFbaV0gPD0gcikgewogICAgICAgICAgICAvLyBTaW5nbGUgY2FyZCBpdHNlbGYgZm9ybXMgYSB2YWxpZCByb3VuZAogICAgICAgICAgICBhbnMrKzsKICAgICAgICAgICAgY3VycmVudF9zdW0gPSAwOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIC8vIEFjY3VtdWxhdGUgc3VtCiAgICAgICAgICAgIGN1cnJlbnRfc3VtICs9IGFbaV07CiAgICAgICAgICAgIGlmIChjdXJyZW50X3N1bSA+PSBsICYmIGN1cnJlbnRfc3VtIDw9IHIpIHsKICAgICAgICAgICAgICAgIGFucysrOwogICAgICAgICAgICAgICAgY3VycmVudF9zdW0gPSAwOyAvLyBSZXNldCBmb3IgdGhlIG5leHQgcm91bmQKICAgICAgICAgICAgfSBlbHNlIGlmIChjdXJyZW50X3N1bSA+IHIpIHsKICAgICAgICAgICAgICAgIGN1cnJlbnRfc3VtID0gMDsgLy8gUmVzZXQgaWYgc3VtIGV4Y2VlZHMgcgogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQoKICAgIGNvdXQgPDwgYW5zIDw8IGVuZGw7Cn0KCmludCBtYWluKCkgewogICAgaW9zOjpzeW5jX3dpdGhfc3RkaW8oMCk7CiAgICBjaW4udGllKDApOwoKICAgIGludCB0OwogICAgY2luID4+IHQ7CiAgICB3aGlsZSAodC0tKSB7CiAgICAgICAgc29sdmUoKTsKICAgIH0KCiAgICByZXR1cm4gMDsKfQo=
OAo1IDMgMTAKMiAxIDExIDMgNwoxMCAxIDUKMTcgOCAxMiAxMSA3IDExIDIxIDEzIDEwIDgKMyA0IDUKMyA0IDIKOCAxMiAyNQoxMCA3IDUgMTMgOCA5IDEyIDcKMiAzIDMKNSAyCjkgNyA5CjIgMTAgNSAxIDMgNyA2IDIgMwoxIDggMTAKOQo1IDUgNgoxIDQgMiA2IDQK
8
5 3 10
2 1 11 3 7
10 1 5
17 8 12 11 7 11 21 13 10 8
3 4 5
3 4 2
8 12 25
10 7 5 13 8 9 12 7
2 3 3
5 2
9 7 9
2 10 5 1 3 7 6 2 3
1 8 10
9
5 5 6
1 4 2 6 4