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... | def main():
nk = list(map(int, input("").split()))
aList = list(map(int, input("").split()))
n = nk[0]
k = nk[1]
sum = 0
count = 0
j = 0
result = 0
for i in range(0, len(aList)):
sum = sum + aList[i]
while sum > k:
sum = sum - aList[j]
count -=... | FUNC_DEF ASSIGN VAR FUNC_CALL 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 VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER 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(i) for i in input().split()]
a = [int(i) for i in input().split()]
start = 0
end = 0
sumtime = 0
ans = 0
for i in range(n):
sumtime += a[i]
end = i + 1
while start < end and sumtime > t:
sumtime -= a[start]
start += 1
if end - start > ans:
ans = end - start
print(ans) | 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 FOR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR VAR VAR VAR VAR VAR VAR NUMBER IF 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... | def mi():
return map(int, input().split())
n, t = mi()
a = list(mi())
res = 0
time = 0
count = 0
i, j = 0, 0
while i < len(a) and j < len(a):
if time + a[j] <= t:
time += a[j]
j += 1
count += 1
res = max(count, res)
else:
time -= a[i]
count -= 1
i +=... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER WHILE VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER 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 = [int(i) for i in input().split()]
books = [int(i) for i in input().split()]
i = 0
j = 0
count = 0
acum = 0
tmp_acum = 0
tmp_count = 0
while i < n:
if tmp_acum + books[i] <= t:
tmp_acum += books[i]
tmp_count += 1
i += 1
else:
count = max(count, tmp_count)
tmp_acum =... | 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 ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER 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... | n, t = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
total_time = 0
count = 0
j = 0
for i in range(n):
while j < n and total_time + a[j] <= t:
total_time += a[j]
j += 1
count = max(count, j - i)
total_time -= a[i]
if j == n - 1:
print(count)
exit()
p... | 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 FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR 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... | def ans(a_list, k):
length = len(a_list)
l_length = 0
longest = 0
s = 0
for i in range(length):
while s <= k:
longest = max(l_length, longest)
if i + l_length == length:
return longest
s += a_list[i + l_length]
l_length += 1
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR VAR VAR RETURN VAR VAR VAR BIN_OP VAR VAR VAR NUMBER VAR NUMBER VAR VAR VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL 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... | I = lambda: map(int, input().split())
n, t = I()
a = list(I())
i = 0
read = 0
s = 0
k = 0
MAX = -float("inf")
while k < n:
s += a[k]
if s > t:
MAX = max(MAX, read)
s -= a[i]
s -= a[k]
i += 1
read -= 1
k -= 1
else:
read += 1
k += 1
print(max(read, M... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING WHILE VAR VAR VAR VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR 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 = map(int, input().split())
l = list(map(int, input().split()))
j, i = 0, 0
c = 0
m = 0
while j < n:
if t - l[j] >= 0:
t -= l[j]
c = j - i + 1
else:
t += l[i]
c = j - i
i += 1
j -= 1
m = max(m, c)
j += 1
print(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 VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR ASSIGN 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... | a, b = map(int, input().rstrip().split())
l = list(map(int, input().split()))
start, maxi = 0, 0
cur_sum = l[0]
for i in range(1, a + 1):
while cur_sum > b and start < i - 1:
cur_sum = cur_sum - l[start]
start += 1
if cur_sum <= b:
maxi = max(maxi, i - start)
if i < a:
cur_su... | 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 VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER WHILE VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR 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... | from sys import *
input = stdin.readline
n, k = map(int, input().split())
l = list(map(int, input().split()))
c = 0
j = 0
for i in range(n):
c = c + l[i]
if c > k:
c = c - l[j]
j = j + 1
print(n - j) | 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP 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... | import sys
n, t = map(int, input().split())
a = list(map(int, input().split()))
tottime = 0
left = 0
cnt = 0
finalcnt = 0
for x in a:
tottime += x
cnt += 1
while tottime > t:
cnt -= 1
tottime -= a[left]
left += 1
finalcnt = max(finalcnt, cnt)
print(finalcnt) | IMPORT 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 FOR VAR VAR VAR VAR VAR NUMBER WHILE VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR 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... | n, m = list(map(int, input().split()))
l = list(map(int, input().split()))
maxi = 0
ind = 0
ran = 0
back = 0
us = m
while ind < n:
back = ind - ran
while us - l[ind] < 0:
if back == ind:
break
us += l[back]
back += 1
if ran > 0:
ran -= 1
if us - l[ind]... | 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 ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR WHILE BIN_OP VAR VAR VAR NUMBER IF 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... | def f():
return [int(i) for i in input().split()]
[n, t], a = f(), f()
max_read = 0
books_read = 0
time = 0
for i in range(n):
if books_read > 0:
books_read -= 1
time -= a[i - 1]
i += books_read
for j in range(i, n):
if time + a[j] <= t:
time += a[j]
... | FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN LIST VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER VAR VAR BIN_OP VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR 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... | n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
i = n - 1
s = 0
while i >= 0 and s <= t:
s += a[i]
i -= 1
if i >= 0:
i += 1
s -= a[i]
j = n - 2
max_res = n - 1 - i
while j >= 0 and i >= 0:
s -= a[j + 1]
while i >= 0 and s <= t:
s += a[i]... | 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 BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER VAR VAR VAR VAR VAR VAR NUMBER IF VAR NUMBER VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP 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... | first = input("").split()
n = int(first[0])
t = int(first[1])
data = list(map(int, input("").split()))
total = 0
lst = list()
max_len = len(lst) - 1
for i in range(0, n):
total = total + data[i]
lst.append(data[i])
while total > t:
if len(lst) > max_len:
max_len = len(lst) - 1
to... | ASSIGN 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 FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER 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... | tt = 1
for i in range(tt):
n, t = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
p = 0
s = 0
rec = 0
l = 0
for i in range(n):
if arr[i] > t:
p = i + 1
s = 0
l = 0
continue
s += arr[i]
l += 1
... | ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR 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 FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR BIN_OP VAR 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... | n, t = map(int, input().split())
a = list(map(int, input().split()))
sumA = 0
c = 0
i = 0
j = 0
sumA = 0
ans = []
c = 0
while i < n:
check = 1
for k in range(j, n):
sumA += a[k]
if sumA > t:
check = 0
ans.append(c)
goback = k
sumA -= a[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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR 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... | def canBeRead(n, totalTime, times):
total = totalTime
tot1 = 0
tot2 = 0
for i in times[:n]:
tot1 += i
if tot1 <= totalTime:
return True
else:
for j in range(n, len(times)):
tot1 -= times[j - n]
tot1 += times[j]
if tot1 <= totalTime:
... | FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR VAR IF VAR VAR RETURN NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR VAR IF VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP 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... | n, t = input().strip().split()
n = int(n)
t = int(t)
a = input().strip().split()
for index, item in enumerate(a):
a[index] = int(item)
i = 0
j = 0
s = 0
ans = 0
while j < n:
s += a[j]
if s <= t:
ans = max(ans, j - i + 1)
else:
while s > t:
s -= a[i]
i += 1
j +... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR 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 = map(int, input().split())
l = list(map(int, input().split()))
sum = 0
max = 0
c = 0
for i in range(n):
if sum + l[i] <= t:
sum = sum + l[i]
c = c + 1
elif sum != 0:
sum = sum - l[i - c] + l[i]
if c > max:
max = c
print(max) | 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 IF BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER 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())
l = [int(x) for x in input().split()]
ar = [0]
temp = 0
for i in l:
temp += i
ar.append(temp)
i = 0
j = 1
m = 0
while j != n + 1:
if abs(ar[i] - ar[j]) <= t:
if m < abs(i - j):
m = abs(i - j)
j += 1
else:
i += 1
j += 1
print(m) | 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 NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR BIN_OP 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_livros, tempo_livre = map(int, input().split())
minutos_livro = list(map(int, input().split()))
i, j, cont, livros_lidos = 0, 0, 0, 0
while i < n_livros:
cont += minutos_livro[i]
if cont > tempo_livre:
cont -= minutos_livro[j]
j += 1
livros_lidos = i - j + 1
i += 1
print(livros_lidos) | 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 VAR VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER EXPR 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 = map(int, input().split())
a = list(map(int, input().split()))
s = 0
arr = []
for i in range(n):
s += a[i]
arr.append(s)
def binary(arr, mid, n, t):
start = 0
end = n - 1
while start <= end:
pivot = (start + end) // 2
if arr[pivot] - mid <= t:
start = pivot + 1
... | 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 FOR VAR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP 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... | n, M = map(int, input().split())
a = list(map(int, input().split()))
j = 0
m = 0
sum1 = 0
count = 0
for i in range(n):
sum1 = sum1 + a[i]
count += 1
while sum1 >= M:
if sum1 == M:
count = count
m = max(count, m)
sum1 = sum1 - a[j]
count = count - 1
... | 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR NUMBER WHILE VAR VAR IF VAR VAR ASSIGN VAR 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, k = input().split()
n = int(n)
k = int(k)
a = [int(x) for x in input().split()]
l = 0
r = 0
s = 0
m = 0
for i in range(n):
while s <= k:
m = max(r - i, m)
if r == n:
break
s += a[r]
r += 1
s -= a[i]
print(m) | 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR 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())
a = [int(x) for x in input().split()]
right, left, books, sum = 0, 0, 0, 0
while left != n:
sum += a[left]
if sum <= t and books < left + 1 - right:
books = left + 1 - right
elif sum > t:
sum -= a[right]
right += 1
left += 1
print(books) | 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 VAR VAR NUMBER NUMBER NUMBER NUMBER WHILE VAR VAR VAR VAR VAR IF VAR VAR VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR IF VAR VAR VAR VAR VAR VAR NUMBER 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())
B = [int(i) for i in input().split()]
i, j, sum, res = 0, 0, B[0], 0
while j < len(B) - 1 and i < len(B):
if sum <= t:
res = max(res, j - i + 1)
j = j + 1
sum = sum + B[j]
else:
sum = sum - B[i]
i = i + 1
if sum <= t:
res = max(res, j ... | 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 VAR VAR NUMBER NUMBER VAR NUMBER NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER 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... | def solve(N, T, A):
sum = [0, int(A[0])]
for i in range(1, N):
sum.append(int(A[i]) + sum[i])
count = 0
j = 0
for i in range(1, N + 1):
while sum[i] - sum[j] > T:
j += 1
count = max(count, i - j)
return count
num_input = input()
num_input = num_input.split("... | FUNC_DEF ASSIGN VAR LIST NUMBER FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER WHILE BIN_OP VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR RET... |
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(item) for item in input().split()]
j = 0
max_item = 0
total = 0
count = 0
for i in range(n):
while j < n:
total = total + a[j]
if total > t:
break
else:
count = count + 1
j = j + 1
max_item = max(max_it... | 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF 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... | n, m = map(int, input().split())
d = list(map(int, input().split()))
s = 0
r = 0
i = j = 0
ans = 0
while i < n and j < n:
if s + d[j] <= m:
r += 1
s += d[j]
j += 1
else:
r = max(r - 1, 0)
s = max(s - d[i], 0)
i += 1
j = max(i, j)
ans = max(ans, r)
prin... | 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 VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR IF BIN_OP VAR VAR VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP 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... | while True:
try:
def solution(a, n, t):
j = tsum = i = 0
while i < n:
tsum = tsum + a[i]
if tsum > t:
tsum -= a[j]
j += 1
i += 1
print(n - j)
def read():
n, t = m... | WHILE NUMBER FUNC_DEF ASSIGN VAR VAR VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR 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 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... | def soln(arr, t):
result = 0
L, R = 0, 0
currSum = 0
while R < len(arr):
if currSum + arr[R] <= t:
currSum += arr[R]
R += 1
result = max(result, R - L)
else:
currSum -= arr[L]
L += 1
return result
def main():
n, t = [i... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR 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... | n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
res = 0
i = 0
j = 0
ts = 0
while i < n:
if a[i] > t:
i += 1
continue
if ts == 0:
ts += a[i]
res = max(1, res)
j = i + 1
while j < n and ts + a[j] <= t:
ts += a[j]
j += 1
res... | 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 ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR VAR NUMBER IF VAR NUMBER VAR VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER 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... | def books(t, books):
i = 0
j = 0
ds = [0]
sum = 0
while i < len(books) and j < len(books):
if sum + books[j] > t:
sum -= books[i]
i += 1
else:
sum += books[j]
j += 1
ds.append(j - i)
return max(ds)
n, t = [int(x) for x... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR RETURN FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL 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... | def pointers(n, t, array):
if t <= 0:
return 0
start, end = 0, 0
ans = 0
curr = 0
while end < n:
curr += array[end]
while curr > t:
curr -= array[start]
start += 1
ans = max(end - start + 1, ans)
end += 1
return ans
n, t = input()... | FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR VAR WHILE VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR 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())
l = list(map(int, input().split()))
start = stop = 0
res = []
try:
while True:
while t >= 0:
res.append(stop - start)
if stop == n:
raise StopIteration
t -= l[stop]
... | 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 VAR NUMBER ASSIGN VAR LIST WHILE NUMBER WHILE VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR IF VAR VAR VAR VAR VAR VAR VAR NUMBER WHILE VAR NUMBER VAR VAR VAR VAR NUMBER VAR EXP... |
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 = j = 0
ans = 0
temp = 0
while j < n:
if t >= a[j]:
temp += 1
t -= a[j]
j += 1
elif i + 1 < n:
t += a[i] if i < j else 0
i += 1
ans = max(temp, ans)
temp = temp - 1 if i <= j else 0
... | 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 NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER VAR VAR VAR VAR 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... | from sys import stdin
def libros(n, t, libros):
con = 0
a = 0
men = 0
may = 0
while men < n:
while may < n and con + libros[may] <= t:
con += libros[may]
may += 1
b = may - men
if b > a:
a = b
con -= libros[men]
men += 1
... | FUNC_DEF 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 ASSIGN VAR BIN_OP VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL 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... | n, t = map(int, input().split())
books = [int(i) for i in input().split()]
back = 0
front = 0
ans = 0
tmp = 0
while front < n:
if tmp + books[front] <= t:
tmp += books[front]
front += 1
else:
tmp += books[front]
if front - back > ans:
ans = front - back
while ... | 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 ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR NUMBER VAR VAR VAR IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR WHILE 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... | def sol(a, n, t):
i, j, ans, tans = 0, 0, 0, 0
while j < n:
if a[j] <= t:
tans += 1
t -= a[j]
j += 1
else:
ans = max(ans, tans)
while j < n and a[j] > t:
if i != j:
t += a[i]
i += ... | FUNC_DEF ASSIGN VAR VAR VAR VAR NUMBER NUMBER NUMBER NUMBER WHILE VAR VAR IF VAR VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR WHILE VAR VAR VAR VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL 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 = [0]
a += list(map(int, input().split()))
for i in range(1, n + 1):
a[i] += a[i - 1]
l = 0
lb = 0
rb = 0
nb = 0
for r in range(1, n + 1):
while a[r] - a[l] > t:
l += 1
if r - l > nb:
rb = r
lb = l
nb = r - l
print(nb) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER VAR 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 ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER 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... | arr = [0] * 200000
tt = [0] * 200000
ans = 0
nt = input().split()
n = int(nt[0])
t = int(nt[1])
isi = input().split()
for i in range(1, n + 1, 1):
arr[i] = int(isi[i - 1])
kiri = 1
r = 0
for i in range(1, n + 1, 1):
if arr[i] <= t:
kiri = i
r = i
break
tt[kiri - 1] = 2 * arr[kiri]
arr[ki... | ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER 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 BIN_OP VAR NUMBER NUMBER ASSIGN VAR 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 = map(int, input().split())
a = list(map(int, input().split()))
sum1 = 0
maxbooks = 0
p1 = 0
p2 = 0
while p1 < n and p2 < n:
if sum1 + a[p2] > t:
maxbooks = max(maxbooks, p2 - p1)
sum1 = max(0, sum1 - a[p1])
p1 += 1
else:
sum1 += a[p2]
p2 += 1
if p2 < p1:
... | 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 VAR VAR IF BIN_OP VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL 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())
al = list(map(int, input().split()))
al = [0] + al
for i in range(1, n + 1):
al[i] += al[i - 1]
j = 1
su = 0
ans = 0
for i in range(1, n + 1):
while j <= n and al[j] - al[i - 1] <= t:
j += 1
ans = max(ans, j - i)
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 BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER 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... | n, t = map(int, input().split())
l = list(map(int, input().split()))
start, res = 0, []
for stop, a in enumerate(l):
t -= a
while t < 0:
t += l[start]
start += 1
res.append(stop - start)
print(max(res) + 1) | 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 LIST FOR VAR VAR FUNC_CALL VAR VAR VAR VAR WHILE VAR NUMBER VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL 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())
mat = list(map(int, input().split()))
cnt = 0
tail = 0
res = 0
for i in range(n):
cnt += mat[i]
while cnt > t:
cnt -= mat[tail]
tail += 1
if res < i - tail + 1:
res = i - tail + 1
print(res) | 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 WHILE VAR VAR VAR VAR VAR VAR NUMBER IF VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP 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... | class Solution:
def __init__(self):
self.n, self.t = [int(x) for x in input().split()]
self.a = [int(x) for x in input().split()]
def solve_and_print(self):
i = s = 0
for j in range(self.n):
s += self.a[j]
if s > self.t:
s -= self.a[i]
... | CLASS_DEF 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 FUNC_DEF ASSIGN VAR 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 VAR VAR EXPR FUNC_CALL 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... | r = lambda: map(int, input().split())
n, t = r()
a = list(r())
i = 0
s = 0
u = 0
while i < n:
s += a[i]
if s > t:
s -= a[u]
u += 1
i += 1
print(n - u) | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER 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... | s = input().split()
n = int(s[0])
t = int(s[1])
s = input().split()
for i in range(len(s)):
s[i] = int(s[i])
l = 0
r = 0
v = s[0]
res = 0
while r < len(s):
if v <= t:
res = max([res, r - l + 1])
if r == len(s) - 1:
break
else:
r += 1
v += s[r]
elif... | 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 FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL 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... | a1 = [int(s) for s in input().split()]
a2 = [int(s) for s in input().split()]
nullArray = [0]
a2 = nullArray + a2
i = 0
j = 0
minutes = a1[1]
runningTotal = 0
maximum = 0
for i in range(0, len(a2)):
runningTotal -= a2[i]
while j + 1 < len(a2) and runningTotal + a2[j + 1] <= minutes:
j += 1
runni... | ASSIGN 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 LIST NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR 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... | import sys
def binary(arraySum, n, value):
low, high = 0, n
while low <= high:
mid = (low + high) // 2
if arraySum[mid] == value:
return mid
elif arraySum[mid] > value:
high = mid - 1
else:
low = mid + 1
return high
def main():
n, t... | IMPORT FUNC_DEF ASSIGN VAR VAR NUMBER VAR WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR RETURN VAR IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN 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 = input().split()
n, t = int(n), int(t)
l = list(map(int, input().split()))
sum = 0
j = 0
ans = 0
for i in range(n):
if l[i] + sum <= t:
sum = sum + l[i]
else:
sum = sum + l[i]
while sum > t:
sum = sum - l[j]
j += 1
ans = max(ans, i + 1 - j)
print(ans) | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR 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 IF BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR 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(s) for s in input().rstrip().split(" ")]
b = [int(s) for s in input().rstrip().split(" ")]
i = 0
j = 0
ans = 0
s = 0
while j < n:
if s + b[j] <= t:
s += b[j]
ans = max(ans, j - i + 1)
j += 1
elif i == j:
j += 1
i += 1
else:
s -= b[i]
i += 1... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL 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 VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP 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... | mt = list(map(int, input().split()))
n = mt[0]
T = mt[1]
A = list(map(int, input().split()))
res = 0
cnt = 0
t = T
suffix = [0] * (len(A) + 1)
for i in range(1, len(A) + 1, 1):
suffix[i] = suffix[i - 1] + A[i - 1]
l = 1
r = 1
while l < len(suffix) and r < len(suffix):
if suffix[r] - suffix[l - 1] <= T:
... | 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL 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... | inputs = [int(x) for x in input().split()]
mins = inputs[1]
book_times = [int(x) for x in input().split()]
current_max = -1
current_time = 0
start_idx = 0
end_idx = -1
for i in range(len(book_times)):
t = book_times[i]
if t + current_time > mins:
current_max = (
end_idx - start_idx if end_id... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR 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 FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR 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... | from sys import stdin
n, t = map(int, stdin.readline().rstrip().split(" "))
nums = list(map(int, stdin.readline().rstrip().split(" ")))
l = r = 0
m = float("-inf")
s = nums[0]
while r < len(nums):
if s == t:
m = max(m, r - l + 1)
s -= nums[l]
l += 1
elif s > t:
s -= nums[l]
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP 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())
v = list(map(int, input().split()))
tmp = t
ans = 0
a = 0
l = 0
for i in range(len(v)):
if v[i] > t:
l = i + 1
a = 0
tmp = t
else:
while tmp < v[i]:
a -= 1
tmp += v[l]
l += 1
a += 1
tmp -= v[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 VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN 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... | n, t = map(int, input().split())
a = list(map(int, input().split()))
b = [a[0]]
ans = 0
for i in range(1, n):
b.append(b[i - 1] + a[i])
j = 0
for i in range(n):
while j < n and b[j] - b[i] + a[i] <= t:
j += 1
if b[j - 1] - b[i] + a[i] <= t and j - i > ans:
ans = j - i
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 VAR NUMBER ASSIGN 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 FOR VAR FUNC_CALL VAR VAR WHILE 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... | import sys
input = sys.stdin.readline
x, y = map(int, input().split())
(*li,) = map(int, input().split())
li2 = [0] * x
li2[-1] = 1 if li[-1] <= y else 0
sum1 = li[-1]
ans = li2[-1]
j = x - 1
for i in range(x - 2, -1, -1):
if li[i] > y:
li2[i] = 0
sum1 = 0
j = i - 1
continue
sum... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR N... |
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 ans(b, n, t):
if sum(b) <= t:
return n
i = 0
ans = 0
while i < n and b[i] > t:
i += 1
if i < n:
ans = 1
t -= b[i]
j = i + 1
while j < n:
if b[j] <= t:
tmp = j - i + 1
if tmp > ans:
ans = tmp
t -= ... | FUNC_DEF IF FUNC_CALL VAR VAR VAR RETURN VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR IF VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR ASSIGN VAR VAR VAR VAR VAR 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... | a, b = map(int, input().split())
l = list(map(int, input().split()))
i = 0
j = 0
m = 0
count = 0
while j < len(l):
if l[j] <= b:
count += 1
b -= l[j]
j = j + 1
m = max(m, count)
elif i < j:
b += l[i]
count -= 1
i = i + 1
else:
i += 1
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 FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP 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... | def solve(arr, n, time):
sum1, count = 0, 0
j = -1
for i in range(n):
if sum1 + arr[i] <= time:
sum1 += arr[i]
else:
sum1 += arr[i]
while sum1 > time:
j += 1
sum1 -= arr[j]
count = max(count, i - j)
return count
... | FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR WHILE VAR VAR VAR NUMBER VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL 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... | n, t = map(int, input().split())
a = list(map(int, input().split()))
sum1 = 0
z = 0
j = 0
k = 0
for x in range(n):
z += 1
sum1 += a[x]
while sum1 > t:
sum1 -= a[j]
j += 1
z -= 1
if z > k:
k = z
if z > k:
k = z
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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER VAR VAR VAR WHILE VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR ASSIGN VAR VAR I... |
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, b = map(int, input().split())
l = list(map(int, input().split()))
k = 0
c = 0
s = 0
for i in range(len(l)):
s = s + l[i]
if s <= b:
c = c + 1
else:
s = s - l[k]
k = k + 1
print(c) | 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 FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR 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... | n, k = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
start = 0
end = 0
ans = 0
s = 0
l = 0
while end < n:
s += arr[end]
l += 1
if s <= k:
ans = max(ans, l)
while start <= end and s > k:
if s <= k:
ans = max(ans, l)
l -= 1
s -= arr[s... | 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 VAR VAR VAR VAR VAR NUMBER IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR WHILE VAR VAR VAR VAR IF 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... | s = list(map(int, input().split()))
if int(s[0]) >= 1 and int(s[0]) <= 100000:
n = int(s[0])
if int(s[1]) >= 1 and int(s[1]) <= 1000000000:
t = int(s[1])
b_list = list(map(int, input().split()))
book_read = 0
sum_count = 0
counter = 0
finish = -1
while counter < len(b_list):
if b_list[counter] > t:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL 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... | l1 = input()
ant = l1.split()
n = int(ant[0])
t = int(ant[1])
l2 = input()
aa = l2.split()
a = []
for i in range(0, n):
ai = int(aa[i])
a.append(ai)
start = 0
max = 0
sum = 0
for i in range(0, n):
sum += a[i]
if sum <= t:
max += 1
else:
sum = sum - a[start]
start += 1
print(m... | 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 LIST FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN ... |
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 = [int(i) for i in input().split()]
ans = 0
tmp_ans = 0
count = 0
i = 0
j = i
while i < n:
if books[i] > t:
j = i
if ans < tmp_ans:
ans = tmp_ans
tmp_ans = 0
else:
count += books[i]
if count <= t:
tmp_ans += 1... | 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 ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR IF VAR VAR VAR ASSIGN VAR VAR IF VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER VAR VAR VAR IF 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... | g = input()
n, t = [int(x) for x in g.split()]
r = input()
li = []
if n > 1:
for y in r.split():
li.append(int(y))
else:
li.append(int(r))
lis = []
flag = 0
tt = 0
l = 0
d = 0
j = 0
for i in range(n):
l += 1
d += li[i]
if d > t:
if l == 1:
flag = 1
tt = 0
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST IF VAR NUMBER FOR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN 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... | n, k = map(int, input().split())
l = list(map(int, input().split()))
s = [0] * (n + 1)
s[0] = 0
for i in range(1, n + 1):
s[i] = s[i - 1] + l[i - 1]
last = n
no = 0
r = n
while r >= 0:
if s[last] - s[r] > k:
no = max(no, last - r - 1)
last -= 1
r += 1
r -= 1
no = max(no, last - r - 1... | 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 BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER 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... | n, t = map(int, input().split())
times = list(map(int, input().split())) + [0]
for i in range(1, n):
times[i] += times[i - 1]
l = 0
r = n + 1
while l + 1 < r:
label = False
m = (r + l) // 2
for i in range(m - 1, n):
if times[i] - times[i - m] <= t:
label = True
break
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP 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 = list(map(lambda x: int(x), input().split()))
a = list(map(lambda x: int(x), input().split()))
maximum = 0
i = 0
j = 1
s = a[i]
maximum = 0
if len(a) == 1 and a[0] <= t:
print(1)
else:
while i < len(a) and j < len(a):
if s + a[j] <= t:
s = s + a[j]
j += 1
if j -... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL 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 VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR EXPR FUNC_CALL VAR N... |
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 bs(a, t):
d = 0
c = 0
for i in range(len(a)):
d += a[i]
if d > t:
d -= a[c]
c += 1
return len(a) - c
n, t = map(int, input().split())
a = [int(i) for i in input().split()]
print(bs(a, t)) | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER RETURN BIN_OP FUNC_CALL VAR VAR VAR 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 FUNC_CALL VAR 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... | startIndex = 0
endIndex = 0
timeSum = 0
counter = 0
n, t = map(int, input().split())
timeList = input().split()
for i in range(n):
timeSum += int(timeList[i])
endIndex = i
if timeSum > t:
timeSum -= int(timeList[startIndex])
startIndex += 1
if counter < endIndex - startIndex + 1:
... | ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR IF VAR VAR VAR FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR BIN_OP BIN_OP VAR 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... | l = 0
r = -1
segL, time = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
segSum = 0
segments = []
while r < segL - 1:
r += 1
segSum += a[r]
if segSum == time:
segments.append(r + 1 - l)
segSum -= a[l]
l += 1
elif segSum > time:
segments.append(r -... | ASSIGN VAR NUMBER ASSIGN VAR NUMBER 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 LIST WHILE VAR BIN_OP VAR NUMBER VAR NUMBER VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER VAR 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... | def maxBookRead(book_minutes, quota):
i = 0
j = 0
total_minutes = book_minutes[0]
max_book = 0
while i <= len(book_minutes) - 1 and j <= len(book_minutes) - 1:
count = j - i + 1
while total_minutes <= quota and j < len(book_minutes) - 1:
j += 1
total_minutes +... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER WHILE VAR VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR VAR VAR VAR NUMBER IF VAR VAR 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, m = map(int, input().split())
s = 0
c = 0
cnt = 0
a = list(map(int, input().split()))
for i in range(len(a)):
s = s + a[i]
if s <= m:
cnt = cnt + 1
else:
s = s - a[c]
c = c + 1
print(cnt) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR 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... | ino = list(map(int, input().split()))
n = ino[0]
t = ino[1]
summ = 0
k = 0
i = 0
maxx = -1
j = 0
a = list(map(int, input().split()))
while j < n:
if summ + a[j] <= t:
summ += a[j]
j += 1
else:
summ -= a[i]
i += 1
if j - i > maxx:
maxx = j - i
print(maxx) | 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 ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR 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... | a = input()
b = input()
num_books, max_time = [int(i) for i in a.split()]
read_time = [int(i) for i in b.split()]
max_val = 0
j = 0
count = 0
time = 0
for i in range(num_books):
time += read_time[i]
count += 1
while time > max_time:
time -= read_time[j]
j += 1
count -= 1
max_val ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR 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 WHILE VAR VAR VAR VAR VAR VAR NUMBER 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().split())
arr = list(map(int, input().split()))
longest = curr = s = i = 0
while i < n:
if s > t:
longest = max(curr - 1, longest)
s -= arr[i - curr]
curr -= 1
else:
s += arr[i]
curr += 1
i += 1
while s > t:
longest = max(curr - 1, longe... | 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 WHILE VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER VAR NUMBER WHILE VAR VAR 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... | n, t = map(int, input().split())
count = 0
a = list(map(int, input().split()))[:n]
c = 0
d = 0
for i in range(len(a)):
d += a[i]
if d > t:
d -= a[c]
c += 1
print(n - c) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL 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, t = map(int, input().split())
b = list(map(int, input().split()))
l = 0
r = 0
s = b[r]
mx = 0
while r < n - 1 or l < n:
if s <= t and r < n - 1:
r += 1
s += b[r]
elif r == n - 1 and s <= t:
mx = max(mx, r - l + 1)
break
elif r < n - 1:
mx = max(mx, r - l)
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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER VAR VAR VAR IF VAR BIN_OP VAR NUMBER 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 = input().split()
for i in range(n):
a[i] = int(a[i])
b = []
c = [0]
i = 0
count = 0
while i < n:
if t >= a[i]:
b.append(a[i])
t -= a[i]
count += 1
elif len(b) > 0:
c.append(count)
t += b[0]
b.pop(0)
count -= 1
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR NUMBER IF FUNC_CAL... |
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 = [0] + a
for i in range(1, len(a)):
a[i] += a[i - 1]
l = 1
r = 1
res = 0
while l <= n:
while r <= n and a[r] - a[l - 1] <= t:
r += 1
r -= 1
res = max(res, r - l + 1)
l += 1
print(res) | 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 FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR WHILE 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... | def read_input():
n, t = [int(i) for i in input().split(" ")]
a = [int(i) for i in input().split(" ")]
return n, t, a
def read_them(n, t, a):
ts = [0] * len(a)
cs = [0] * len(a)
start_pos = 0
time_remain = t
while start_pos < len(a):
i = cs[max(start_pos - 1, 0)] + max(start_po... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING RETURN VAR VAR VAR FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR FUNC_CALL 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())
booklist = list(map(int, input().split()))
pfs = []
pfs.append(0)
for i in range(n):
pfs.append(pfs[i] + booklist[i])
def isPossible(nbooks):
ttimes = [(pfs[i + nbooks] - pfs[i]) for i in range(n - nbooks + 1)]
for tt in ttimes:
if tt <= t:
return True
... | 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 EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FUNC_DEF ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR BIN_OP 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())
l = list(map(int, input().split()))
ma = j = k = kt = 0
for i in range(n):
if l[i] + kt <= t:
k += 1
kt += l[i]
if ma < k:
ma = k
else:
while l[i] + kt > t:
if k == 0:
j = i + 1
break
... | 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 FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR NUMBER VAR VAR VAR IF VAR VAR ASSIGN VAR VAR WHILE BIN_OP VAR VAR VAR VAR IF VAR NUMBER ASSIGN 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... | def maxBooks1(n, t, arr):
mx = 0
for i in range(0, n):
for j in range(i, n):
sum = 0
for k in range(i, j + 1):
sum += arr[k]
segmenLen = j - i + 1
if sum <= t and segmenLen > mx:
mx = segmenLen
return mx
def maxBooks2(... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER 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... | n, l = map(int, input().strip().split())
a = list(map(int, input().strip().split()))
i, j = -1, 0
s, ans = 0, 0
while j != n:
s = s + a[j]
while s > l:
i = i + 1
s = s - a[i]
if j - i > ans:
ans = j - i
j = j + 1
print(ans) | 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 VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR I... |
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 = [int(x) for x in input().split()]
i = 0
j = 0
mx = 0
sm = 0
if n == 1:
if a[0] > k:
print(0)
else:
print(1)
else:
while j < n:
sm += a[j]
if sm > k:
sm -= a[i]
i += 1
ln = j - i + 1
if ln > mx:
... | 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 ASSIGN VAR NUMBER IF VAR NUMBER IF VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER WHILE VAR VAR VAR VAR VAR IF VAR VAR VAR VAR 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 = map(int, input().split())
A = list(map(int, input().split()))
A.insert(0, 0)
m = 0
count = 0
li = 1
ri = 1
for i in range(1, n + 1):
count += A[ri]
if count == t:
books = ri - li + 1
if m < books:
m = books
while count > t:
books = ri - li
if m < books:
... | 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 ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP 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... | first_line = list(map(int, input().split()))
n = first_line[0]
t = first_line[1]
a = list(map(int, input().split()))
def main():
sum = 0
ans = 0
i, l = 0, 0
while i < n:
sum += a[i]
while sum > t:
sum -= a[l]
l += 1
ans = max(ans, i - l + 1)
i +=... | 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 FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER WHILE VAR VAR VAR VAR VAR WHILE VAR VAR VAR VAR VAR 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... | books_count, free_time = input().split(" ")
books_count, free_time = int(books_count), int(free_time)
books = input().split(" ")
books_timing = [int(book) for book in books]
biggest_count = 0
counter = 1
x = 0
start = 0
end = 0
total = books_timing[0]
z = 0
looped_all = False
while total > free_time:
if z == len(bo... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN 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 = list(map(int, input().split()))
a = list(map(int, input().split()))
be = 0
en = -1
time = 0
ans = 0
while en < n - 1:
while time <= t and en < n - 1:
ans = max(ans, en - be + 1)
en += 1
time += a[en]
while time > t:
... | FUNC_DEF 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 ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER WHILE VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP 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... | n_books, n_time_reading = list(map(int, input().split()))
minutes = list(map(int, input().split()))
def get_max_with_o_n_2():
my_max = 0
for i in range(n_books):
total = 0
count = 0
for j in range(i, n_books):
total += minutes[j]
if total <= n_time_reading:
... | 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 FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR IF VAR VAR VAR NUMBER IF VAR VAR RETURN 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... | def solve(A, k):
i, j = 0, 0
mx = 0
while j < len(A):
k -= A[j]
while i < len(A) and k < 0:
k += A[i]
i += 1
mx = max(mx, j - i + 1)
j += 1
return mx
k = int(input().split(" ")[1])
arr = input().split(" ")
A = [int(n) for n in arr]
print(solve(A,... | FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR VAR WHILE VAR FUNC_CALL VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING NUMBER ASSIGN VAR FUNC_CAL... |
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(i) for i in input().split()]
start = 0
max1 = 0
sum = a[0]
for i in range(1, len(a) + 1):
if sum <= t:
max1 = max(max1, i - start)
while i < len(a) and sum + a[i] > t and start < i:
sum -= a[start]
start += 1
if i < len(a):
sum += a[i... | 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 VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR WHILE 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... | from itertools import accumulate
n, t = map(int, input().split())
a = [int(x) for x in input().split()]
def prefixsums(arr):
from itertools import accumulate
pref = [0] + list(accumulate(arr))
return lambda l, r: pref[r] - pref[l - 1]
get = prefixsums(a)
r = 1
ans = 0
for l in range(1, n + 1):
whi... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR RETURN BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL 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().strip().split())
l = list(map(int, input().strip().split()))
g = 0
left = 0
right = 0
curr = 0
while True:
if right == n:
break
curr += l[right]
right += 1
if curr > t:
while curr > t:
curr -= l[left]
left += 1
g = max(g, right - left)
... | 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 WHILE NUMBER IF VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR WHILE VAR VAR VAR VAR VAR 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, k = list(map(int, input().split()))
l = list(map(int, input().split()))
ma = 0
sum = 0
s = 0
end = 0
while s < n and end < n:
while sum > k and s < end:
sum = sum - l[s]
s = s + 1
sum = sum + l[end]
end = end + 1
if sum <= k and end - s > ma:
ma = end - s
print(ma) | 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 ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR WHILE VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.