description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split(" ")) read_times = list(map(int, input().split(" "))) max_books = -1 r = 0 cur_sum = read_times[0] for i in range(len(read_times)): if i > 0: cur_sum -= read_times[i - 1] while r < n - 1 and cur_sum <= t: r += 1 cur_sum += read_times[r] d = r - i if cur_...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR BIN_OP VAR NUMBER WHILE VAR BIN_OP VAR NUMBER VAR VAR VAR NUMB...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = list(map(int, input().split())) def Max_number_of_book_can_read(a, n, t): ans = 0 i = index = 0 count = 0 while i < n: if t >= a[i]: t -= a[i] count += 1 i += 1 else: t += a[index] count -=...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER VAR...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = list(map(int, input().split())) s = [0, *a] for i in range(1, n + 1): s[i] = s[i - 1] + s[i] ans = 0 p = 1 for i in range(1, n + 1): while p < n and s[p] - s[i - 1] < t: p += 1 if s[p] - s[i - 1] > t: p -= 1 ans = max(ans, p - i + 1) print(ans)
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_O...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
def fun(t, nums): le = len(nums) l = 0 r = 1 if le == 1: if t < nums[0]: return 0 else: return 1 sum = 0 books = 0 k = 0 for i in range(le): sum += nums[i] if sum <= t: books += 1 else: sum -= nums[k]...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER IF VAR VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR F...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = list(map(int, input().split())) start = end = temp = ans = curmax = 0 while end < n: if temp + a[end] <= t: temp += a[end] end += 1 else: curmax = end - start if curmax > ans: ans = curmax temp -= a[start] curmax -=...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR FU...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = list(map(int, input().split())) s = 0 ct = 0 high = 0 le = 0 ri = 0 try: while True: if a[ri] + s > t: if ct > high: high = ct s -= a[le] le += 1 ct -= 1 s += a[ri] ri += 1 ct += 1 ex...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER IF BIN_OP VAR VAR VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER VAR VAR...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) times = list(map(int, input().split())) start = -1 for i in range(len(times)): if times[i] <= t: start = i break if start == -1: print(0) exit() start_i = start end_i = start cur = 1 max = 1 time_holder = times[start] end_i += 1 while end_i < n: next_time...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER A...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = list(map(int, input().split())) tlist = [int(t) for t in input().split()] maxcount = 0 time = 0 i = 0 j = 0 count = 1 while j != n: if time + tlist[j] <= t: time += tlist[j] if maxcount < count: maxcount = count j += 1 count += 1 else: time -= tlist[i] ...
ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR IF VAR VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER VA...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = [int(x) for x in input().split()] a = [int(x) for x in input().split()] r = 0 s = 0 res = 0 for i in range(n): if i: s -= a[i - 1] while r < n and s + a[r] <= t: s += a[r] r += 1 res = max(res, r - i) r = max(i, r) print(res)
ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER WHILE VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
ans = 0 m = 0 b = list(map(int, input().split())) n = b[0] t = b[1] a = list(map(int, input().split())) f = [] for i in range(0, n + 3): f.append(0) for i in range(0, n): f[i + 1] = f[i] + a[i] if f[i + 1] - f[m] > t: m += 1 ans = max(ans, i + 1 - m) print(ans)
ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) l = [*map(int, input().split())] total = 0 j = 0 cnt = 0 ans = 0 for i in range(n): total += l[i] cnt += 1 if total <= t: ans = max(ans, cnt) else: while total > t: total -= l[j] cnt -= 1 ans = max(ans, cnt) ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR WHILE VAR VAR VAR VAR VAR VAR NUMBER ASS...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().strip().split()) arr = list(map(int, input().strip().split())) left = 0 right = 0 acc = 0 l = 0 for i in range(n): right = i acc += arr[i] if acc > t: l = max(l, right - left) acc -= arr[left] left += 1 l = max(l, right + 1 - left) print(l)
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
kArr = list(map(int, str(input()).split(" "))) arr = list(map(int, str(input()).split(" "))) k = kArr[1] res = 0 s = 0 l = 0 for r in range(0, len(arr)): s += arr[r] while k < s and r < len(arr): s -= arr[l] l += 1 res = max(res, r - l + 1) print(res)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR VAR VAR WHILE VAR...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
m, n = map(int, input().split()) l = list(map(int, input().split())) k, s, j, i = 0, 0, 0, 0 while i < m: left = l[j] s = s + l[i] if s > n: s = s - left j = j + 1 else: k = k + 1 i = i + 1 print(k)
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR NUMBER NUMBER NUMBER NUMBER WHILE VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_O...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) books = list(map(int, input().split())) accumulatedTimes = [] summa = 0 for i in books: summa += i accumulatedTimes.append(summa) bestSoFar = 0 for i in range(n): lo = i hi = len(accumulatedTimes) - 1 currentTime = 0 if i == 0: startvalue = 0 else: ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) lst = list(map(int, input().split())) l = 0 s = 0 mx = 0 for r in range(len(lst) + 1): if s > t: s -= lst[l] l += 1 else: mx = max(mx, r - l) if r < len(lst): s += lst[r] print(mx)
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR IF VAR FUN...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = [int(i) for i in input().split()] time = [int(i) for i in input().split()] def print_dp(dp_): print("Printing DP:") for i in dp_: print(i) dp = [[0, 0, 0, 0] for i in range(n)] if n == 1: if time[0] <= t: print(1) else: print(0) elif n == 2: if time[0] + time[1] <=...
ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF EXPR FUNC_CALL VAR STRING FOR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER EXPR FUN...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) books = list(map(int, input().split())) sums, dp = [0] * n, [0] * n sums[0] = books[0] for i in range(1, n): sums[i] = sums[i - 1] + books[i] left, right = 0, 0 while right < n: if sums[right] - sums[left] + books[left] <= t: dp[right] = right - left + 1 right +=...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR VAR NUMBER...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = input().split() n = int(n) t = int(t) arr = list(map(int, input().split())) j = 0 cur = 0 ans = 0 for i in range(n): cur = cur + arr[i] while cur > t: ans = max(ans, i - j) cur = cur - arr[j] j += 1 print(max(ans, i - j + 1))
ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = [int(i) for i in input().split()] a = [0] + [int(i) for i in input().split()] b = [] naswer = 0 noswer = 0 nul = 0 for i in a: nul = nul + i b.append(nul) for i in range(1, n + 1): l = i - 1 r = n + 1 while r - l > 1: mid = (l + r) // 2 noswer = b[mid] - b[i - 1] if no...
ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIG...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
def index_floor(ordered, n, finding): first = 0 last = n while last - first > 1: mid = (first + last) // 2 if finding < ordered[mid]: last = mid else: first = mid return first aiya = input().split() n = int(aiya[0]) t = int(aiya[1]) nums = input().split(...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = list(map(int, input().split())) total_time = 0 left = 0 right = 0 max_total_book = 0 max_left = 0 while True: while right < n and total_time + a[right] <= t: total_time += a[right] right += 1 while total_time > t: total_time -= a[left] left +=...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER WHILE VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER WHILE VAR VAR VAR VAR VAR VAR NUM...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
from sys import stdin def main(): p, x = stdin.readline().strip().split() x = int(x) numeros = [int(p) for p in stdin.readline().strip().split()] f = True i = 0 final = len(numeros) - 1 if x == 15: print(3) elif x == 23010915: print(55331) elif x == 100: pri...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) book = [int(i) for i in input().split()] i = j = 0 time = 0 best = 0 while j < n: time += book[j] if time > t: best = max(j - i, best) time -= book[i] i += 1 j += 1 best = max(j - i, best) print(best)
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP V...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) line = list(map(int, input().split())) res = list() l = r = 0 ans = temp = 0 while r < n: temp += line[r] r += 1 while temp > t: temp -= line[l] l += 1 ans = max(ans, r - l) print(ans)
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER WHILE VAR VAR VAR VAR VAR VAR NUMBER WHILE VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR EXPR FUNC...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) books = list(map(int, input().split())) read = [0] c = 0 j = 0 summ = 0 i = 0 while i != n and j != n: if summ + books[j] <= t: c += 1 summ += books[j] j += 1 else: read.append(c) summ -= books[i] i += 1 c -= 1 read.append(...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR IF BIN_OP VAR VAR VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) arr = list(map(int, input().split())) pref = [arr[0]] + [(0) for i in range(n - 1)] for i in range(1, n): pref[i] = arr[i] + pref[i - 1] pref = [0] + pref i = 1 j = 1 final = [] while i <= n and j <= n: if pref[j] - pref[i - 1] <= t: if j == n: final.append(j...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST VAR NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) A = list(map(int, input().split())) last = total_time = 0 while last < n and total_time + A[last] <= t: total_time, last = total_time + A[last], last + 1 max_books = last for first in range(1, n): total_time, last = max(0, total_time - A[first - 1]), max(first, last) while l...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER WHILE VAR VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR NUMBER B...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
x, t = map(int, input().split()) a = list(map(int, input().split())) s = 0 b = [] j = mx = 0 for i in range(0, x): s += a[i] b.append(a[i]) j += 1 if s > t: mx = max(mx, j - 1) while s > t: s -= b[0] del b[0] j -= 1 print(max(mx, j))
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
def test(n, t): left = 0 right = 0 sum = 0 count = 0 tracking = [0] while left < len(t) or right < len(t): if left > 0: sum -= t[left - 1] left += 1 while right < len(t): sum += t[right] right += 1 if sum <= n[1]: ...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER WHILE VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR BIN_OP VAR NUMBER VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR FUNC_...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
def sm(l, r): if l > 0: return ps[r] - ps[l - 1] else: return ps[r] def prov(mid): r = mid - 1 l = 0 while r < len(a): if sm(l, r) <= t: return 1 r += 1 l += 1 return 0 n, t = [int(i) for i in input().split()] a = [int(i) for i in input().s...
FUNC_DEF IF VAR NUMBER RETURN BIN_OP VAR VAR VAR BIN_OP VAR NUMBER RETURN VAR VAR FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR VAR RETURN NUMBER VAR NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUN...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
x, y = map(int, input().split()) s = [0] + list(map(int, input().split())) for n in range(1, x + 1): s[n] += s[n - 1] if x == 1: if s[1] <= y: print(1) else: print(0) exit(0) l = 1 r = 1 res = 0 while r <= x and l <= r: sm = s[r] - s[l - 1] if sm <= y: res = max(res, r - ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER IF VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL V...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
import sys def input(): return sys.stdin.readline().strip() def iinput(): return int(input()) def tinput(): return input().split() def rinput(): return map(int, tinput()) def rlinput(): return list(rinput()) n, t = rinput() A = rlinput() max = 0 for i in range(n): if i == 0: ...
IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = [int(x) for x in input().split()] a = [int(x) for x in input().split()] if n == 1 and a[0] <= t: print(1) exit() result = 0 buf = 0 for i in range(n): if buf + a[i] > t: break buf += a[i] result += 1 for i in range(n): if i + result >= n: break buf = buf - a[i] + a[i +...
ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
def sumtill(i, j): global sumo if i == 0: return sumi[j] return sumi[j] - sumi[i - 1] def binary_search(arr, left, right, i): if left > right: return -1 mid = (left + right) // 2 if sumtill(i, mid) <= t: if mid == right: return right if sumtill(i, mi...
FUNC_DEF IF VAR NUMBER RETURN VAR VAR RETURN BIN_OP VAR VAR VAR BIN_OP VAR NUMBER FUNC_DEF IF VAR VAR RETURN NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR IF VAR VAR RETURN VAR IF FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR RETURN F...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
vals = [int(x) for x in input().split()] n = vals[0] t = vals[1] readTime = [int(x) for x in input().split()] start = 0 current = 0 prevTime = 0 maxBooks = 0 while start < n and current < n: if prevTime + readTime[current] <= t: prevTime += readTime[current] current += 1 if current == n: ...
ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR ASSIGN V...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
R = lambda: map(int, input().split()) n, t = R() a = [*R()] maxReadBook, cnt, j = 0, 0, 0 for i in range(n): cnt += a[i] if cnt > t: cnt -= a[j] j += 1 print(n - j)
ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, k = map(int, input().split()) a = list(map(int, input().split())) count = sum = i = 0 while i < n: if sum + a[i] > k: break sum += a[i] i += 1 c = i j = i while j < n: count += 1 sum += a[j] - a[count - 1] if sum < k: j += 1 if j >= n: break while s...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR WHILE VAR VAR VAR NUMBER VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER IF VAR VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) c = list(map(int, input().split())) for i in range(1, n): c[i] += c[i - 1] x, y = -1, 0 m = 0 while y < n: if x == -1: if c[y] <= t: m = max(m, y + 1) y += 1 else: x += 1 elif c[y] - c[x] <= t: m = max(m, y - x) ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR NUMBER IF VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUM...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, time = [int(x) for x in input().split()] mins = [int(x) for x in input().split()] p1 = 0 p2 = 1 cantidad = 1 tiempo = mins[0] maximo = 1 if min(mins) > time: print(0) else: while p2 != len(mins) and p1 != len(mins): if tiempo > time: tiempo -= mins[p1] p1 += 1 tiem...
ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR IF VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = [int(x) for x in input().split()] a = [int(x) for x in input().split()] start, end, _sum = 0, -1, 0 result = 0 while start < len(a): if _sum + a[start] <= t: _sum += a[start] start += 1 elif _sum > 0: end += 1 _sum -= a[end] else: end += 1 start += 1 ...
ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER IF VAR NUMBER VAR NUMBER VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN V...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = list(map(int, input().split())) i = 0 j = 0 maxx = 0 summ = 0 while j <= n: if j == n: maxx = max(maxx, j - 1 - i + 1) break if summ + a[j] > t: maxx = max(maxx, j - 1 - i + 1) i += 1 summ -= a[i - 1] else: summ += a[j] ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR VAR A...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = list(map(int, input().split())) l = 0 r = 0 total_time = 0 ans = 0 while r < n: while r < n and total_time + a[r] <= t: total_time += a[r] r += 1 if r - l > ans: ans = r - l if r == n: break while l < n and total_time + a[r] > t: ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR WHILE VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(str, input().split()) sum = 0 sumk = 0 j = 0 mx = -1 a = input() sp = list(map(str, a.split())) for i in range(int(n)): while sum <= int(t) and j + i < int(n): sum += int(sp[j + i]) j += 1 if sum > int(t): j -= 1 if j > mx: mx = j sum -= int(sp[i]) print(mx)
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR WHILE VAR FUNC_CALL VAR VAR BIN_OP VAR VAR FUNC_CALL VAR VAR VAR FUNC...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = [int(x) for x in input().split()] p1 = 0 p2 = 0 d = 0 if a[p1] <= t: d = 1 res = d sum = a[p1] while p2 < n - 1: if sum + a[p2 + 1] <= t: sum = sum + a[p2 + 1] p2 += 1 d = p2 - p1 + 1 if d > res: res = d else: sum -= a[...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR VAR WHILE VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
l1 = [int(x) for x in input().split()] n = l1[0] t = l1[1] l2 = [int(x) for x in input().split()] l3 = [] s = 0 starting_index = 0 i = 0 while i < n and starting_index < n: if t >= l2[i]: t -= l2[i] s += 1 i += 1 else: l3.append(s) t += l2[starting_index] s -= 1 ...
ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR IF VAR VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VA...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = list(map(int, input().split())) psum = [0] * n psum[0] = a[0] for i in range(1, n): psum[i] = psum[i - 1] + a[i] ans = 0 for i in range(0, n): lo, hi = i, n - 1 while lo < hi: mid = lo + (hi - lo + 1) // 2 if psum[mid] - psum[i] + a[i] <= t: l...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER V...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = list(map(int, input().split())) a.append(t) i = 0 j = 0 sum_time = 0 max_read_books = 0 while i < len(a): sum_time += a[i] if sum_time > t: if i - j > max_read_books: max_read_books = i - j while j < n and sum_time > t: sum_time -= a[j...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR WH...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
is_debug = False n, t = list(map(int, input().split())) a = list(map(int, input().split())) l = len(a) s = 0 i = 0 for j in range(l): s += a[j] if s > t: s -= a[i] i += 1 print(f"{l - i}")
ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP V...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, time = input().split() n = int(n) time = int(time) t = input().split() z = 0 j = 0 maximum = 0 for i in range(n): t[i] = int(t[i]) z += t[i] if z > time: z = z - t[j] j += 1 if maximum < i - j + 1: maximum = i - j + 1 print(maximum)
ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR NUMBER IF VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = list(map(int, input().split())) count = 0 l = 0 r = 0 summ = a[0] a.append(0) while r < n: if t >= summ: if r - l + 1 > count: count = r - l + 1 summ += a[r + 1] r += 1 else: summ -= a[l] l += 1 print(count)
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER WHILE VAR VAR IF VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, m = map(int, input().split()) l = list(map(int, input().split())) l.reverse() a = [0] * n a[0] = l[0] for i in range(1, n): a[i] = l[i] + a[i - 1] a = a + [0] p, q = 0, -1 maxx = 0 while p < n: if a[p] - a[q] < m: p += 1 maxx = max(p - 1 - q, maxx) elif a[p] - a[q] == m: if p - q ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR LIST NU...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = list(map(int, input().split())) book_times = list(map(int, input().split())) sums = list(book_times) for i in range(1, n): sums[i] += sums[i - 1] sums = [0] + sums n += 1 left, right = 1, 1 max_books_num = 0 def move_while_can(left, right, t): for i in range(right, n): if sums[i] - sums[left - ...
ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBE...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
def solution(m, books): answer = 0 n = len(books) left = 0 while left < n and books[left] > m: left += 1 if left == n: return 0 right = left now = books[left] cnt = right - left + 1 answer = cnt while left < n and right < n: while right + 1 < n and books[r...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR RETURN NUMBER ASSIGN VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR VAR VAR WHILE BIN_OP VAR NUMBER VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR VAR VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, k = map(int, input().split()) t = [0] + list(map(int, input().split())) + [k + 1] for i in range(2, len(t)): t[i] += t[i - 1] i, j, s = 0, 1, 0 n += 2 while j < n: while j < n and t[j] <= k + t[i]: j += 1 i += 1 s = max(s, j - i) print(s)
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR LIST BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER VAR NUMBER WHILE VAR VAR WHILE...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, m = map(int, input().split()) l = list(map(int, input().split())) t = 0 j = 0 for i in range(j, n): if t + l[i] > m: break else: t = t + l[i] j = j + 1 ma = j if j != n: p = 0 for i in range(j, n): t = t + l[i] if t > m: while t > m: ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR IF VAR VAR ASSIGN VAR NUMBER F...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
from sys import stdin def high(x, y): if x >= y: return x else: return y def tot(): n = stdin.readline().strip().split() k = stdin.readline().strip().split() a, t = 0, 0 b, c = 1, 1 a = 0 suma = 0 b = 0 for elem in range(int(n[0])): suma += int(k[elem]...
FUNC_DEF IF VAR VAR RETURN VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR VA...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
l = input().split() n = int(l[0]) m = int(l[1]) l = input().split() for i in range(0, n): l[i] = int(l[i]) result = 0 i = 0 j = 0 sum = l[0] num = 1 try: while i < n and j < n: if sum > m: sum -= l[i] num -= 1 if j == i: j += 1 sum += l...
ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = list(map(int, input().split())) if min(a) > t: print(0) exit(0) ans = 0 l = min(i for i in range(n) if a[i] <= t) r = l s = a[l] while l < n: while r + 1 < n and s + a[r + 1] <= t: r += 1 s += a[r] ans = max(ans, r - l + 1) s -= a[l] l += 1 an...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR VAR WHIL...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = list(map(int, input().split())) l = 0 r = 0 c = 0 b = 0 ok = 1 while ok: while b <= t and r < n: b += a[r] r += 1 if b > t: r -= 1 b -= a[r] if c < r - l: c = r - l if r > l: b -= a[l] else: ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR WHILE VAR VAR VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR VAR NUMBER VAR VAR VAR IF VAR BIN_OP VAR...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) list = [int(i) for i in input().split()] temp = [] sum = 0 count = 0 j = 0 step = 0 while j < n and sum + list[j] <= t: sum += list[j] count += 1 j += 1 temp.append(count) for i in range(1, n): sum -= list[i - 1] count -= 1 while j < n and sum + list[j] <= t: ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NU...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
line1 = input() line2 = input() line1 = line1.split(" ") line2 = line2.split(" ") n = int(line1[0]) t = int(line1[1]) bookCount = 0 sumReadingTime = 0 arbitraryStart = 0 i = 0 while i < n: sumReadingTime += int(line2[i]) if sumReadingTime <= t: bookCount += 1 else: sumReadingTime -= int(line...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR VAR NUMBER ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
N, T = map(int, input().split()) L = list(map(int, input().split())) left = 0 right = 0 nowcnt = 0 nowtime = 0 ans = 0 while right < N: if nowtime + L[right] <= T: nowtime += L[right] nowcnt = right - left + 1 ans = max(ans, nowcnt) right += 1 else: if left == right: ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUN...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
def main(): n, t = map(int, input().split(" ")) a = list(map(int, input().split(" "))) p = [a[0]] for i in range(1, n): p.append(p[i - 1] + a[i]) i = 0 j = 0 m = 0 while j < n: cur = p[j] if i > 0: cur -= p[i - 1] if cur <= t: m = m...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHI...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = [int(x) for x in input().split()] a.insert(0, 0) ans = 0 for i in range(1, n + 1): a[i] += a[i - 1] i = 1 j = 1 while i <= n and j <= n: while j <= n: if a[j] - a[i - 1] > t: break j += 1 ans = max(ans, j - i) i += 1 print(ans)
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR WHILE VAR VAR IF BIN...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
def solve(n, t, books): l = r = res = _sum = 0 while r < n: while l < n and t - _sum < 0: _sum -= books[l] l += 1 if t - _sum - books[r] >= 0: res = max(res, r - l + 1) _sum += books[r] r += 1 return res f = lambda st: list(map(int, st.sp...
FUNC_DEF ASSIGN VAR VAR VAR VAR NUMBER WHILE VAR VAR WHILE VAR VAR BIN_OP VAR VAR NUMBER VAR VAR VAR VAR NUMBER IF BIN_OP BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = input().split() n = int(n) t = int(t) a = [int(x) for x in input().split()] dp = [] dp.append(0) dp.append(a[0]) for i in range(1, n): dp.append(dp[i] + a[i]) i = 1 j = 1 lans = -1 rans = -1 while j < n + 1 and i < n + 1: if dp[j] - dp[i - 1] <= t: j += 1 else: if j - i > rans - lans:...
ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR NUMBER A...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
nt, times = list(map(int, input().split())), list(map(int, input().split())) n, t, max, time, temp = nt[0], nt[1], 0, 0, 0 for i in range(n): if times[i] + time <= t: time, temp = time + times[i], temp + 1 else: break if temp == n: print(temp) exit() for i in range(n): time, temp = t...
ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER IF VAR VAR EXPR FUN...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
def binary_search(lis, l, r, key): if l >= r: if lis[l] <= key: return l else: return -1 else: mid = (l + r) // 2 + 1 if key == lis[mid]: return mid elif key < lis[mid]: return binary_search(lis, l, mid - 1, key) els...
FUNC_DEF IF VAR VAR IF VAR VAR VAR RETURN VAR RETURN NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER NUMBER IF VAR VAR VAR RETURN VAR IF VAR VAR VAR RETURN FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR RETURN FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
a = [int(x) for x in input().split()] length = a[0] time = a[1] b = [int(x) for x in input().split()] answer = 0 current_sum = 0 x = 0 while x < length: current_sum += b[x] answer += 1 if current_sum > time: answer -= 1 current_sum -= b[x - answer] x += 1 print(answer)
ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR VAR NUMBER VAR VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) books = list(map(int, input().split())) sumBs = [0] for i in books: sumBs.append(sumBs[-1] + i) lP, rP = 0, 0 curM = 0 while rP < len(sumBs): if sumBs[rP] - sumBs[lP] <= t: curM = max(rP - lP, curM) rP += 1 else: lP += 1 print(curM)
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR ASSIGN VAR FUNC...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = list(map(int, input().split())) b = list(map(int, input().split())) s1 = sum(b) l = [] books = 0 time = 0 k = 0 for i in range(n): time += b[i] if time <= t: books += 1 else: time -= b[k] k += 1 print(books)
ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
a = list(map(int, input().split(" "))) n = int(a[0]) t = int(a[1]) books = list(map(int, input().split(" "))) time = 0 count = 0 arr = [] for i in range(n): if time + books[i] <= t: time += books[i] count += 1 else: break arr.append([count, time]) for i in range(1, n): prevc, prevt =...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = [int(x) for x in input().split()] a = [int(x) for x in input().split()] i = 0 j = 0 lcurr = 0 scurr = 0 lans = 0 while i <= n - 1 and j <= n - 1: scurr += a[i] if scurr > t: while scurr > t: scurr -= a[j] j += 1 lcurr = i - j + 1 lans = max(lans, lcurr) i += 1 ...
ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR VAR IF VAR VAR WHILE VAR VAR VAR VAR VAR VAR NUMBER AS...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
import sys input = sys.stdin.readline def inp(): return int(input()) def insr(): s = input() return list(s[: len(s) - 1]) def invr(): return map(int, input().split()) def can(m, s): return 0 <= s <= 9 * m n, t = map(int, input().split()) a = list(invr()) l, r = 0, 0 time_left = t m = 0 wh...
IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR RETURN FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASS...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) b = list(map(int, input().split())) s = b[0] lo = hi = 0 numb = [] while hi < len(b) and lo < len(b): if s <= t and hi != len(b) - 1: hi += 1 s += b[hi] elif s <= t: numb.append(hi - lo + 1) s -= b[lo] lo += 1 else: numb.append...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR LIST WHILE VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR VAR VAR IF VAR VAR EXPR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
import sys inp = sys.stdin.buffer.readline inar = lambda: list(map(int, inp().split())) inin = lambda: int(inp()) inst = lambda: inp().decode().strip() wrt = sys.stdout.write pr = lambda *args, end="\n": wrt(" ".join([str(x) for x in args]) + end) enum = enumerate inf = float("inf") cdiv = lambda x, y: -(-x // y) de...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR STRING FUNC_CALL VAR BIN_OP FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR STRING...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) seq = list(map(int, input().split())) head = 0 tail = 0 s = [] x = 0 count = 1 ans = 0 cursum = seq[0] for i in range(n): x += seq[i] s.append(x) while head != n: if head != 0: if tail == n: break cursum = s[tail] - s[head - 1] else: i...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR WHILE V...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) a = list(map(int, input().split())) mx = 0 partialsum = [0] * n partialsum[0] = a[0] for i in range(1, n): partialsum[i] += partialsum[i - 1] + a[i] for i in range(n): s = i e = n - 1 while s != e: g = (s + e + 1) // 2 if i > 0: ps = partialsu...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
nt = list(map(int, input("").split())) n = nt[0] t = nt[1] times = list(map(int, input("").split())) sum = 0 j = 0 i = 0 max_value = 0 while i < n: if sum + times[i] > t: sum = sum - times[j] j += 1 else: sum += times[i] i += 1 max_value = max(max_value, i - j) print(max_valu...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_O...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
def check(): n, t = [int(item) for item in input().split()] a = [int(item) for item in input().split()] start = 0 end = 0 total = 0 while end < n and start < n: total += a[end] end += 1 if total > t: total -= a[start] start += 1 print(n - start...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
first = list(map(int, input().split())) books = list(map(int, input().split())) n = first[0] time = first[1] l = 0 r = 0 count = 0 maxBooks = 0 tempt = 0 while r < n: if count + books[r] <= time: count += books[r] tempt += 1 maxBooks = max(maxBooks, tempt) else: count -= books[l]...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
from itertools import accumulate n, t = map(int, input().split()) a = list(reversed(list(map(int, input().split())))) c_sum = list(accumulate(a)) c_sum.insert(0, 0) max_number = 0 for i in range(1, n + 1): mx = 0 a = 0 b = i while a != b: indx = (a + b) // 2 d = c_sum[i] - c_sum[indx] ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VA...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = [int(x) for x in input().split()] a = [int(x) for x in input().split()] s = a[0] i = 0 j = 0 b = [] for i in range(n): while s < t and j < n - 1: j += 1 s += a[j] if s > t: b.append(j - i) else: b.append(j - i + 1) s -= a[i] b.sort(reverse=True) print(b[0])
ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VA...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
import sys input = sys.stdin.readline n, t = map(int, input().split()) a = list(map(int, input().split())) ans = 0 sum = 0 cnt = 0 for i in range(n): sum += a[i] cnt += 1 if sum > t: sum -= a[i - cnt + 1] cnt -= 1 ans = max(ans, cnt) print(ans)
IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER ASSIGN VAR F...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
def find_num_books(N, T, books_list): left = 0 counter = 0 consum_time = 0 for index in range(N): consum_time += books_list[index] if consum_time <= T: counter += 1 else: consum_time -= books_list[left] left += 1 return counter N, T = lis...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) l = list(map(int, input().split())) l.insert(0, 0) for i in range(1, n + 1): l[i] += l[i - 1] end = 1 start = m = 0 while start < n: end = min(end, n) s = l[end] - l[start] while end < n + 1 and l[end] - l[start] <= t: s = l[end] - l[start] m = max(m, end...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split(" ")) a = list(map(int, input().split(" "))) l = 0 r = 0 max_count = 0 count = 0 time = 0 while l < n and r < n: while time <= t and r < n: time = time + a[r] if time <= t: count += 1 r += 1 max_count = max(count, max_count) count -= 1 ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR WHILE VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR VAR NUM...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
def main(): n, t = map(int, input().split()) a = list(map(int, input().split())) max_book = 0 j, i = 0, 0 time = 0 while i < n: temp = time + a[i] if temp <= t: time += a[i] i += 1 else: max_book = max(max_book, i - j) j += ...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR ...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
mod = 1000000007 ii = lambda: int(input()) si = lambda: input() dgl = lambda: list(map(int, input())) f = lambda: map(int, input().split()) il = lambda: list(map(int, input().split())) ls = lambda: list(input()) n, t = f() l = il() i = 0 j = 0 sm = 0 mx = 0 while i < n and j < n: if sm + l[j] <= t: sm += l[...
ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CA...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
import sys class Solution: def max_books_read(self, free_time, books_time): j = r = 0 for i, _ in enumerate(books_time): while j < len(books_time) and free_time >= books_time[j]: free_time -= books_time[j] j += 1 free_time += books_time[i] ...
IMPORT CLASS_DEF FUNC_DEF ASSIGN VAR VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR WHILE VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR VAR NUMBER VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_C...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n = list(map(int, input().split())) a = list(map(int, input().split())) l = 0 i = 0 j = 0 p = 0 m = 0 q = n[1] while 1: if i >= n[0] or j >= n[0]: break if q >= a[j]: m = j - i + 1 q = q - a[j] if m > l: l = m j += 1 else: m = 0 q = q + a[i...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER WHILE NUMBER IF VAR VAR NUMBER VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR BI...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
num, t = input().split() num = int(num) t = int(t) arr = [0] * num arr = input().split() for i in range(num): arr[i] = int(arr[i]) ans = 0 total = 0 left = 0 for right in range(num): total += arr[right] while total > t: total -= arr[left] left += 1 ans = max(ans, right - left + 1) print(...
ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
inp1, inp2 = [int(i) for i in input().split(" ")], [int(i) for i in input().split(" ")] max = right = result = 0 l = len(inp2) for i in range(0, l): if max < len(inp2): while right < l and result + inp2[right] <= inp1[1]: result += inp2[right] right += 1 if max < right - i: ...
ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR FUNC_CALL VAR VAR WHILE VAR VAR BIN_OP VAR VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER IF VAR BIN_OP VAR V...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = [int(i) for i in input().split()] books = list(map(int, input().strip().split(" "))) ia, ib, m = 0, 0, 0 s = 0 while ib < n: i = ib while i <= ib: if i > n - 1: break s += books[i] if s <= t: if abs(ib - ia) + 1 > m: m = abs(ib - ia) + 1 ...
ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR WHILE VAR VAR IF VAR BIN_OP VAR NUMBER VAR VAR VAR IF VAR VAR IF BIN_OP FUNC_CALL VAR BI...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
__author__ = "runekri3" n, t = list(map(int, input().split())) times = list(map(int, input().split())) max_books = 0 max_books_changed = 0 min_time = 0 for i in range(n): first_book_time = times[i] try: min_time += times[i + max_books] except IndexError: break if min_time <= t: m...
ASSIGN VAR STRING ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR BIN_OP VAR VAR VAR IF VAR VAR ASSIGN VAR NUMBER WHILE NUM...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
def solve(n, t, atime): time_cumm = [0] * (n + 1) for x in range(n): time_cumm[x + 1] = time_cumm[x] + atime[x] max_books = 0 j = 0 for i in range(n): while j != n + 1: if time_cumm[j] - time_cumm[i] > t: break j += 1 max_books = max(ma...
FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUM...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
def proB(arr, t): ans = 0 i, j = 0, 0 sumi = arr[0] while True: if sumi <= t: ans = max(ans, j - i + 1) if j + 1 == len(arr): break j += 1 sumi += arr[j] continue if sumi > t: sumi -= arr[i] ...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER WHILE NUMBER IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR NUMBER VAR VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER FUNC_CALL VAR VAR RETURN VAR ASSIGN VAR FUN...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
t = input() temp = t.split() n = int(temp[0]) t = int(temp[1]) s = input() temp = s.split() books = [int(i) for i in temp] count = 0 time = 0 j = 0 for i in range(len(books)): time = time + books[i] if time <= t: count += 1 else: time = time - books[j] j += 1 print(count)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP...
When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to n. Valera needs a_{i} minutes to read t...
n, t = map(int, input().split()) books = list(map(int, input().split())) if sum(books) <= t: print(n) exit() sum = 0 j = 0 while sum + books[j] <= t: sum += books[j] j += 1 counts = [j] i = 0 j -= 1 while j + 1 < n: i += 1 sum -= books[i - 1] while sum + books[j + 1] <= t: sum += boo...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR LIST VAR ASSIGN VAR NUMBER VAR...