#C1598. Maximum Consecutive Study Days
Maximum Consecutive Study Days
Maximum Consecutive Study Days
A student has a study plan that lasts for N days, and for each day a certain number of hours is allocated for studying. Given a target total study time S, the goal is to determine the maximum number of consecutive days during which the sum of study hours does not exceed S. Formally, for an array of study times \(a_1, a_2, \dots, a_N\), you need to find the maximum value of \(r - l + 1\) such that \(\sum_{i=l}^{r} a_i \le S\) where \(1 \le l \le r \le N\).
The input begins with an integer T representing the number of test cases. For each test case, there will be two lines of input. The first line contains two integers \(N\) and \(S\) (the number of days and the target sum, respectively). The second line contains \(N\) space-separated integers that denote the study times for each day.
Your program should output T lines, each containing a single integer that represents the maximum number of consecutive days for the corresponding test case.
inputFormat
The first line of the input contains a single integer T (1 ≤ T ≤ 10), the number of test cases. For each test case, the first line contains two space-separated integers N (1 ≤ N ≤ 105) and S (1 ≤ S ≤ 109). The second line contains N space-separated integers representing the study time for each day. All study times are non-negative integers.
outputFormat
For each test case, output a single line containing one integer — the maximum number of consecutive days the student can study without the sum of study times exceeding S.
## sample2
6 15
1 2 3 4 5 6
5 10
3 1 4 1 2
5
4
</p>