TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.  Operation: Choose one character of S and replace it with a different character.

Submission attempts (in order):
A = input()

A = A.splitlines()

change_num = 0

Num = len(A[0])

S = list(A[0])
T = list(A[1])

for i in range(Num):
    if S[i] is not T[i]:
        change_num += 1

print(change_num)

S = input()
T = input()

Num = len(S)

S = list(S)
T = list(T)

change_num = 0

for i in range(Num):
    if S[i] is not T[i]:
        change_num += 1

print(change_num)

Verdicts: Runtime Error

Accepted
Problem: Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.  Operation: Choose one character of S and replace it with a different character.

Submission attempts (in order):
S = input()
T = input()
 
len([x for x in map(set, zip(S, T)) if len(x) == 2])

S = input()
T = input()
 
print(len([x for x in map(set, zip(S, T)) if len(x) == 2]))

Verdicts: Wrong Answer

Accepted
Problem: Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.  Operation: Choose one character of S and replace it with a different character.

Submission attempts (in order):
k=list(input())
m=list(input())
ams=0
for i in (len(k)):
  if(k[i]!=m[i]):
    ams+=1
print(ams)

k=list(input())
m=list(input())
ams=0
for i in range(len(k)):
  if(k[i]!=m[i]):
    ams+=1
print(ams)

Verdicts: Runtime Error

Accepted
Problem: Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.  Operation: Choose one character of S and replace it with a different character.

Submission attempts (in order):
s = input()
t = input()
ans = 0
for S, T in zip(s, t):
  if S == T:
    ans += 1
print(ans)

s = input()
t = input()
ans = 0
for S, T in zip(s, t):
  if S != T:
    ans += 1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.  Operation: Choose one character of S and replace it with a different character.

Submission attempts (in order):
a = input()
b = input()
count = 0
for i in a:
    if b[i] != a[i]:
        b[i] = a[i]
        count +=  1
print(count)

a = input()
b = input()
count = 0
for i in range(len(a)):
    if b[i] != a[i]:
        b = b[i-1:] + a[i] + b[:i+1]
        count +=  1
print(count)

a = input()
b = input()
count = 0
for i in range(len(a)):
    if b[i] != a[i]:
        count +=  1
print(count)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.  Operation: Choose one character of S and replace it with a different character.

Submission attempts (in order):
a = input()
b = input()
ans = 0
for i in range(len(a)):
  if a[i] == b[i]:
    ans += 1
print(ans)

a = input()
b = input()
ans = 0
for i in range(len(a)):
  if a[i] != b[i]:
    ans += 1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.  Operation: Choose one character of S and replace it with a different character.

Submission attempts (in order):
S = input()
T = input()
count = 0
for i in [:len(S)]:
  if S[i] != T[i]:
    count += 1
print(count)


S = input()
T = input()
count = 0
for i in [:len(S)]:
  if S[i] == T[i]:
    count += 1
print(count)

S = input()
T = input()
count = 0
for i in [0:len(S)]:
  if S[i] != T[i]:
    count += 1
print(count)


S = input()
T = input()
count = 0
for i in range(len(S)):
  if S[i] == T[i]:
    count += 1
print(count)


S = input()
T = input()
count = 0
for i in range(len(S)):
  if S[i] != T[i]:
    count += 1
print(count)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.  Operation: Choose one character of S and replace it with a different character.

Submission attempts (in order):
S = input()
T = input()
N = len(S)
ans = 0
for i in range(N):
    if not S[i] == T[i]:
        S[i] = T[i]
        ans += 1
print(ans)


S = input()
T = input()
N = len(S)
ans = 0
for i in range(N):
    if S[i] != T[i]:
        ans += 1
print(ans)


Verdicts: Runtime Error

Accepted
Problem: Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.  Operation: Choose one character of S and replace it with a different character.

Submission attempts (in order):
S = list(input())
T = list(input())
cnt = 0
for s,t in S,T:
  if s != t:
    cnt++
print(cnt)

S = list(input())
T = list(input())
cnt = 0
for t in range(0,int(len(S))-1):
  if S[t] != T[t]:
    cnt += 1
print(cnt)

S = list(input())
T = list(input())
cnt = 0
for t in range(int(len(S))):
  if S[t] != T[t]:
    cnt++
print(cnt)

S = list(input().split(''))
T = list(input().split(''))
cnt = 0
for s,t in S,T:
  if s != t:
    cnt++
print(cnt)

S = list(input())
T = list(input())
cnt = 0
for t in range(0,int(len(S))-1):
  if S[t] != T[t]:
    cnt++
print(cnt)

S = list(input())
T = list(input())
cnt = 0
for t in range(0,int(len(S))):
  if S[t] != T[t]:
    cnt += 1
print(cnt)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.  Operation: Choose one character of S and replace it with a different character.

Submission attempts (in order):
# B Minor Change
S = list(input())
T = list(input())
l=len(S)
ct = 0
print(l)
for i in range(l):
    if S[i] != T[i]:
        ct += 1
print(ct)


# B Minor Change
S = list(input())
T = list(input())
l=len(S)
ct = 0
print(l)
for i in range(l):
    if S[i] != T[i]:
        ct += 1
print(ct)

# B Minor Change
S = list(input())
T = list(input())
l =len(S)
ct = 0
for i in range(l):
    if S[i] != T[i]:
        ct += 1
print(ct)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.  Operation: Choose one character of S and replace it with a different character.

Submission attempts (in order):
s = input()
t = input()
result = len([_ for a,b in zip(s,t) if a != b])
print(result)

s  = input()
t = input()
result = len([e for a,b in zip(s,t) if a != b])
print(result)

s  = input()
t = input()
result = len([a,b for a,b in zip(s,t) if a != b])
print(result)

s  = input()
t = input()
result = len([e for a,b in zip(s,t) if a != b])
print(result)

s = input()
t = input()
result = len([e for a,b in zip(s,t) if a != b])
print(result)

s = input()
t = input()
result = len([e for a,b in zip(s,t) if a != b])
print(result)

s = input()
t = input()
result = len([a for a,b in zip(s,t) if a != b])
print(result)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.  Operation: Choose one character of S and replace it with a different character.

Submission attempts (in order):
c = 0
s = str(input())
t = str(input())

d = {}
if s==t:
	print(0)
elif sorted(s) == sorted(t):
	print(len(s))
else:
	for i in s:
		if i not in d:
			d[i] = 1
		else:
			d[i] +=1

	for i in d:
		if i in t:
			d[i]-=1
		else:
			c+=d[i]
	print(c)


c = 0
s = str(input())
t = str(input())

d = {}
if sorted(s) == sorted(t):
	print(len(s))
else:
	for i in s:
		if i not in d:
			d[i] = 1
		else:
			d[i] +=1

	for i in d:
		if i in t:
			d[i]-=1
		else:
			c+=d[i]
	print(c)



t = str(input())
s = str(input())

print(len(list(filter(lambda i: t[i]!=s[i], range(len(t))))))


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.  Operation: Choose one character of S and replace it with a different character.

Submission attempts (in order):
s = input()
t = input()
 
ans = 0:
for i in range(len(s)):
  if s[i] != t[i]:
    ans += 1
print(ans)

s = input()
t = input()

ans = 0:
for i in range(s):
  if s[i] != t[i]:
    ans += 1
print(ans)

s = input()
t = input()
 
ans = 0
for i in range(len(s)):
    if s[i] != t[i]:
        ans += 1
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
from biesect import biesect_right
from numpy import cumsum
from sys import stdin
input=stdin.readline
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a=numpy.cumsum(a)
b=numpy.cumsum(b)
ans=0
for i in range(len(a)):
  x=k-a[i]
  y=biesect.biesect_right(b,x)
  if ans<y+i+1:
    ans=y+i+1
print(ans)

from bisect import bisect_right
from numpy import cumsum
from sys import stdin
input=stdin.readline
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a=cumsum(a)
b=cumsum(b)
ans=0
if a[0]<k:
  for i in range(len(a)):
    x=k-a[i]
    y=bisect_right(b,x)
    print(y)
    if ans<y+i+1:
      ans=y+i+1
print(ans)

from bisect import bisect_right
from numpy import cumsum
from sys import stdin
input=stdin.readline
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a=numpy.cumsum(a)
b=numpy.cumsum(b)
ans=0
for i in range(len(a)):
  x=k-a[i]
  y=bisect.bisect_right(b,x)
  if ans<y+i+1:
    ans=y+i+1
print(ans)

from bisect import bisect_right
from numpy import cumsum
from sys import stdin
input=stdin.readline
n,m,k=map(int,input().split())
a=[0]+list(map(int,input().split()))
b=list(map(int,input().split()))
a=cumsum(a)
b=cumsum(b)
ans=0
for i in range(len(a)):
  x=k-a[i]
  if x>=0:
    y=bisect_right(b,x)
    if ans<y+i:
      ans=y+i
  else:
    break
print(ans)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
import bisect

N, M, K = map(int, input().split())
Alist = [0] + list(map(int, input().split()))
Blist = list(map(int, input().split()))

B = [Blist[0]]
for b in Blist[1:]:
    B.append(b + B[-1])


sums = 0
ans = 0
for idx, a in enumerate(Alist):
    sums += a
    if sums > K:
        break
    k = K - sums
    print(k)
    tmp = bisect.bisect_right(B, k)
    ans = max(ans, idx + tmp)

print(ans)

import bisect

N, M, K = map(int, input().split())
Alist = [0] + list(map(int, input().split()))
Blist = list(map(int, input().split()))

B = [Blist[0]]
for b in Blist[1:]:
    B.append(b + B[-1])

print(B)

sums = 0
ans = 0
for idx, a in enumerate(Alist):
    sums += a
    if sums > K:
        break
    k = K - sums
    tmp = bisect.bisect_right(B, k)
    ans = max(ans, idx + tmp)

print(ans)

import bisect

N, M, K = map(int, input().split())
Alist = [0] + list(map(int, input().split()))
Blist = list(map(int, input().split()))

B = [Blist[0]]
for b in Blist[1:]:
    B.append(b + B[-1])


sums = 0
ans = 0
for idx, a in enumerate(Alist):
    sums += a
    if sums > K:
        break
    k = K - sums
    tmp = bisect.bisect_right(B, k)
    ans = max(ans, idx + tmp)

print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a2 = [0]
b2 = [0]
for i in range(n):
    a2.append(a2[i]+a[i])
for i in range(n):
    b2.append(b2[i]+b[i])
for i in range(len(a)):
    if a[0] > k:
        break
    cnt = 0
    sm = 0
    while sm < k-a2[i]:
        sm = b2[cnt]
        cnt += 1
    ans = max(cnt, ans)
print(ans)

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a2 = [0]
b2 = [0]
for i in range(n):
    a2.append(a2[i]+a[i])
for i in range(m):
    b2.append(b2[i]+b[i])
ans = 0
cnt = m
for i in range(n+1):
    if a2[i] > k:
        break
    sm = 0
    while b2[cnt] > k-a2[i]:
        cnt -= 1
    ans = max(cnt+i, ans)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

sa=[]
ka=0
sb=[]
kb=0
for i in range(n):
  if ka+a[i]<=k:
    ka+=a[i]
    sa.append(a[i])
  else:
    break
for i in range(m):
  if kb+b[i]<=k:
    kb+=b[i]
    sb.append(b[i])
  else:
    break
ans=max(len(sa),len(sb))
tb=[]
for i in range(len(sa)):
  if sa[i]>k:
    break
  while kb+sa[i]>k:
    kb-=sb[-1]
    sb.pop(-1)
  tb.append(sa[i])
  kb+=sa[i]
  if ans<(len(sb)+len(tb)):
    ans=len(sb)
print(ans)


n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

sa=[]
ka=0
sb=[]
kb=0
for i in range(n):
  if ka+a[i]<=k:
    ka+=a[i]
    sa.append(a[i])
  else:
    break
for i in range(m):
  if kb+b[i]<=k:
    kb+=b[i]
    sb.append(b[i])
  else:
    break
ans=max(len(sa),len(sb))
tb=[]
for i in range(len(sa)):
  if sa[i]>k:
    break
  while kb+sa[i]>k:
    kb-=sb[-1]
    sb.pop(-1)
  tb.append(sa[i])
  kb+=sa[i]
  if ans<(len(sb)+len(tb)):
    ans=(len(sb)+len(tb))
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

import numpy as np

n,m,k = iim()
a = iil()
cuma = np.cumsum(a)
b = iil()
cumb = np.cumsum(b)

best = m
ans = 0
for i in range(n):
    if cuma[i] > k:
        break
    while b[best] > k-a[i]:
        best -= 1
    ans = max(ans,best+i)
print(ans)


def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

import numpy as np

n,m,k = iim()
a = iil()
cuma = [0]
for i in a:
    cuma.append(cuma[-1]+i)
b = iil()
cumb = [0]
for i in b:
    cumb.append(cumb[-1]+i)

best = m
ans = 0
for i in range(n+1):
    if cuma[i] > k:
        break
    while cumb[best] > k-cuma[i]:
        best -= 1
    ans = max(ans,best+i)

print(ans)


Verdicts: Runtime Error

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
n,m,k = map(int,input().split())
a_list = list(map(int,input().split()))
b_list = list(map(int,input().split()))

from itertools import accumulate
import bisect

sum_a_list = list(accumulate([0] + a_list))
sum_b_list = list(accumulate([0] + b_list))

ans = 0
b_idx = 0
for a_idx in range(n+1):
    if sum_a_list[a_idx] > k:
        continue

    time_rest = k - sum_a_list[a_idx]
    b_idx = bisect.bisect_right(sum_b_list,time_rest)

    ans = max(ans, a_idx + b_idx)

print(ans)

n,m,k = map(int,input().split())
a_list = list(map(int,input().split()))
b_list = list(map(int,input().split()))

from itertools import accumulate
import bisect

sum_a_list = list(accumulate([0] + a_list))
sum_b_list = list(accumulate([0] + b_list))

ans = 0
b_idx = 0
for a_idx in range(n+1):
    if sum_a_list[a_idx] > k:
        continue

    time_rest = k - sum_a_list[a_idx]
    b_idx = bisect.bisect_left(sum_b_list,time_rest)
    
    ans = max(ans, a_idx + b_idx)
        
print(ans)

n,m,k = map(int,input().split())
a_list = list(map(int,input().split()))
b_list = list(map(int,input().split()))

from itertools import accumulate
sum_a_list = list(accumulate([0] + a_list))
sum_b_list = list(accumulate([0] + b_list))

ans = 0
b_idx = 0
for a_idx in range(n+1):
    if sum_a_list[a_idx] > k:
        continue

    time_rest = k - sum_a_list[a_idx]
    b_idx = bisect.bisect_left(sum_b_list,time_rest)
    
    ans = max(ans, a_idx + b_idx)
        
print(ans)

n,m,k = map(int,input().split())
a_list = list(map(int,input().split()))
b_list = list(map(int,input().split()))

from itertools import accumulate
import bisect

sum_a_list = list(accumulate([0] + a_list))
sum_b_list = list(accumulate([0] + b_list))

ans = 0
b_idx = 0
for a_idx in range(n+1):
    if sum_a_list[a_idx] > k:
        continue

    time_rest = k - sum_a_list[a_idx]
    
    b_idx = bisect.bisect_right(sum_b_list,time_rest) - 1
    
    ans = max(ans, a_idx + b_idx)
        
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
def main():
  N, M, K = map(int, input().split())
  A = list(map(int, input().split()))
  B = list(map(int, input().split()))
  time = 0
  num = 0
  while True:
    if num < N and time + A[num] <= K:
      time += A[num]
      num += 1
    else:
      break
  ans = num
  ans_temp = num
  for i in range(M):
    print(time)
    time += B[i]
    ans_temp += 1
    print(time)
    while time > K:
      if num > 0:
        time -= A[num-1]
        num -= 1
        ans_temp -=1
      else:
        break
    if num == 0 and time > K:
      break
    ans = max(ans, ans_temp)
  print(ans)
  
if __name__ == "__main__":
  main()
  

def main():
  N, M, K = map(int, input().split())
  A = list(map(int, input().split()))
  B = list(map(int, input().split()))
  time = 0
  num = 0
  while True:
    if num < N and time + A[num] <= K:
      time += A[num]
      num += 1
    else:
      break
  ans = num
  ans_temp = num
  for i in range(M):
    time += B[i]
    ans_temp += 1
    while time > K:
      if num > 0:
        time -= A[num-1]
        num -= 1
        ans_temp -=1
      else:
        break
    if num == 0 and time > K:
      break
    ans = max(ans, ans_temp)
  print(ans)
  
if __name__ == "__main__":
  main()
  

Verdicts: Wrong Answer

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
N,M,K = map(int,input().split())

A = list(map(int, input().split()))
B =list(map(int, input().split()))

sumA=[A[0]]
sumB=[B[0]]


for i in range(1,N):
  sumA.append(sumA[-1]+A[i])

for a in range(len(sumA)):
  if sumA[a]>K:
    lessthanA=a-1
    break
if sumA[-1]<=K:
  lessthanA=N-1

 
for i in range(1,M):
  sumB.append(sumB[-1]+B[i])

  
totalBook=0
time=0

if A[0]>K and B[0]>K:
  totalBook=0
elif A[-1]+B[-1]<=K:
  totalBook=N+M

else:
  for a in range(lessthanA,-1,-1):
    print(a*10000)
    for b in range(len(sumB)):
      print(b*1000000)
      if sumB[b]>=K-sumA[a]:
        print("sumB")
        print(sumB[b])
        break
      
    if a+b>=totalBook:
      print("totalBook")
      print(a)
      print(b)
      totalBook=a+b+1

print(totalBook)
  

N,M,K = map(int,input().split())

A = list(map(int, input().split()))
B =list(map(int, input().split()))

sumA=[0]
sumB=[0]


for i in range(N):
  sumA.append(sumA[-1]+A[i])
for i in range(M):
  sumB.append(sumB[-1]+B[i])

  
total=0
startB=len(sumB)-1
for a in range(len(sumA)):
  for b in range(startB,-1,-1):
    if sumA[a]+sumB[b]<=K:
      total=max(total,a+b)
      startB=b
      break
  if sumA[a]>K:
    break
    
print(total)
  

Verdicts: Wrong Answer

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

a.append(10**9+1)
b.append(10**9+1)

i,j,ans=0,0,0
while k>=0:
    print(i,j)
    if a[i]>10**9:
        k-=b[j]
        j+=1
    elif b[i]>10**9:
        k-=a[i]
        i+=1
    elif a[i]>b[j]:
        k-=b[j]
        j+=1
    else:
        k-=a[i]
        i+=1
    if k<0:
        break
    ans+=1

print(ans)
    

n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

a,b=[0],[0]
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])

j,ans=m,0
for i in range(n+1):
    if a[i]>k:
        break
    while b[j] > k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
# f = open('test.txt')
f = open('b11.txt')
n, m, k = map(int, f.readline().split())
a = list(map(int, f.readline().split()))
b = list(map(int, f.readline().split()))

a_sum = [0]
b_sum = [0]
cnt = 0
best_b = m
confirm = ()

for i in a:
    a_sum.append(i + a_sum[-1])

for i in b:
    b_sum.append(i + b_sum[-1])

for a_idx in range(n + 1):
    if a_sum[a_idx] > k:
        break
    for b_idx in reversed(range(best_b + 1)):
        if b_sum[b_idx] + a_sum[a_idx] <= k:
            # if cnt < a_idx + b_idx:
            cnt = max(cnt, a_idx + b_idx)
            best_b = b_idx
            break

print(cnt)


n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

a_sum = [0]
b_sum = [0]
cnt = 0
best_b = m
confirm = ()

for i in a:
    a_sum.append(i + a_sum[-1])

for i in b:
    b_sum.append(i + b_sum[-1])

for a_idx in range(n + 1):
    if a_sum[a_idx] > k:
        break
    for b_idx in reversed(range(best_b + 1)):
        if b_sum[b_idx] + a_sum[a_idx] <= k:
            # if cnt < a_idx + b_idx:
            cnt = max(cnt, a_idx + b_idx)
            best_b = b_idx
            break

print(cnt)


Verdicts: Runtime Error

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
n, m, k = map(int, input().split())
a =  list(map(int, input().split()))
b = list(map(int, input().split()))
a_sum, b_sum = [0], [0]
for i in range(n):
  a_sum.append(a_sum[i]+a[i])
for i in range(m):
  b_sum.append(b_sum[i]+b[i])
ans, j = 0, m
for i in range(n+1):
  if a_sum[i] > k:
    break
  while b_sum[j] > k - a_sum[i]:
    j =- 1
  ans = max(ans, i+j)
print(ans)

n, m, k = map(int, input().split())
a =  list(map(int, input().split()))
b = list(map(int, input().split()))
a_sum, b_sum = [0], [0]
for i in range(n):
  a_sum.append(a_sum[i]+a[i])
for i in range(m):
  b_sum.append(b_sum[i]+b[i])
ans, j = 0, m
for i in range(n+1):
  if a_sum[i] > k:
    break
  while b_sum[j] > k - a_sum[i]:
    j -= 1
  ans = max(ans, i+j)
print(ans)

Verdicts: Time Limit Exceeded

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
 
A, B = [0], [0]
for i in range(n):
    A.append(A[i] + a[i])
for i in range(m):
    B.append(B[i] + b[i])

print(A)
print(B)
    
ans, j = 0, m
for i in range(n+1):
    if A[i] > k:
        break
    while B[j] > k - A[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
 
A, B = [0], [0]
for i in range(n):
    A.append(A[i] + a[i])
for i in range(m):
    B.append(B[i] + b[i])
    
ans, j = 0, m
for i in range(n+1):
    if A[i] > k:
        break
    while B[j] > k - A[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M): 
    b.append(b[i] + B[i])
print(a)
print(b)
ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M): 
    b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
n,m,k=map(int,input().split())
A=[0]+list(map(int,input().split()))
B=[0]+list(map(int,input().split()))
i=0
j=0
count=0
ans=0
for i in range(1,n):
  A[i]=A[i]+A[i-1]


for j in range(1,m):
  B[i]=B[i]+B[i-1]

a_cnt=0
b_cnt=m
for a_cnt in range(n+1):
  if A[a_cnt]>k:
    continue
  #print('A',A[a_cnt])
  while A[a_cnt]+B[b_cnt]>k:
    #print('B',B[b_cnt+1])
    b_cnt-=1 
  ans=max(ans,a_cnt+b_cnt)
print(ans)

n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
M=0
count=0
while M<k:
  if len(A)==0:
    M+=B.pop(0)
    if M>k:
        break
    print(M,'B')
    count+=1
    continue
  if len(B)==0:
    M+=A.pop(0)
    if M>k:
        break
    print(M,'A')
    count+=1
    continue
  if min(A[0],B[0])==A[0]:
    M+=A.pop(0)
    if M>k:
        break
    print(M,'A')
    count+=1
  else:
    M+=B.pop(0)
    if M>k:
        break
    print(M,'B')
    count+=1
print(count)

n,m,k=map(int,input().split())
A=[0]+list(map(int,input().split()))
B=[0]+list(map(int,input().split()))
i=0
j=0
count=0
ans=0
for i in range(1,n+1):
  A[i]=A[i]+A[i-1]


for j in range(1,m+1):
  B[i]=B[i]+B[i-1]

a_cnt=0
b_cnt=m
for a_cnt in range(n+1):
  if A[a_cnt]>k:
    continue
  while A[a_cnt]+B[b_cnt]>k:
    b_cnt-=1 
  ans=max(ans,a_cnt+b_cnt)
print(ans)

n,m,k=map(int,input().split())
A=[0]+list(map(int,input().split()))
B=[0]+list(map(int,input().split()))

ans=0
for i in range(1,n+1):
  A[i]+=A[i-1]


for j in range(1,m+1):
  B[j]+=B[j-1]


b_cnt=m
for a_cnt in range(n+1):
  if A[a_cnt]>k:
    continue
  while A[a_cnt]+B[b_cnt]>k:
    b_cnt-=1 

  ans=max(ans,a_cnt+b_cnt)
print(ans)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
N,M,K = map(int,input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
AA = [0]
BB = [0]
r = 0
for i in A:
    r += i
    AA.append(r)
r = 0
for i in B:
    r += i
    BB.append(r)
ans = 0
a = N
b = 0
while AA[a]+BB[b] > K:
    a -= 1
ans = a+b

while a > 0:
    while b < M:
        if AA[a]+BB[b+1] <= K:
            b += 1
        else:
            break
    print(a,b,AA[a]+BB[b])
    if ans < a+b:
        ans = a+b
    if b == M:
        break
    a -= 1
print(ans)


N,M,K = map(int,input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
AA = [0]
BB = [0]
r = 0
for i in A:
    r += i
    AA.append(r)
r = 0
for i in B:
    r += i
    BB.append(r)
ans = 0
a = N
b = 0
while AA[a]+BB[b] > K:
    a -= 1
ans = a+b

while a >= 0:
    while b < M:
        if AA[a]+BB[b+1] <= K:
            b += 1
        else:
            break
    print(a,b,AA[a]+BB[b])
    if ans < a+b:
        ans = a+b
    if b == M:
        break
    a -= 1
print(ans)



N,M,K = map(int,input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
AA = [0]
BB = [0]
r = 0
for i in A:
    r += i
    AA.append(r)
r = 0
for i in B:
    r += i
    BB.append(r)
ans = 0
a = N
b = 0
while AA[a]+BB[b] > K:
    a -= 1
ans = a+b

while a >= 0:
    while b < M:
        if AA[a]+BB[b+1] <= K:
            b += 1
        else:
            break
    if ans < a+b:
        ans = a+b
    if b == M:
        break
    a -= 1
print(ans)



Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ea=[0]
for i in range(n):
    ea.append(ea[i]+a[i])
eb=[0]
for i in range(m):
    eb.append(eb[i]+b[i])
tb=m
p=0
if n<m:
    ea,eb=eb,ea
    n,m=m,n
for i in range(n+1):
    while ea[i]+eb[tb]>k:
        if tb==0:
            break
        tb-=1
    if ea[i]+eb[tb]<=k:
        p=max(i+tb,p)
print(p)

n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ea=[0]
for i in range(n):
    ea.append(ea[i]+a[i])
eb=[0]
for i in range(m):
    eb.append(eb[i]+b[i])
if n<m:
    ea,eb=eb,ea
    n,m=m,n
tb=m
p=0
for i in range(n+1):
    while ea[i]+eb[tb]>k:
        if tb==0:
            break
        tb-=1
    if ea[i]+eb[tb]<=k:
        p=max(i+tb,p)
print(p)

Verdicts: Runtime Error

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
from itertools import accumulate
from bisect import bisect_right

n, m, k = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]


a_cum = list(accumulate(a))
b_cum = list(accumulate(b))

ans = [0]
for i in range(n+1):    
    c = bisect_right(b, k-a[i]) - 1 
    if c != -1: 
        ans.append(c+i)
print(max(ans))

from itertools import accumulate
from bisect import bisect_right

n, m, k = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]


a_cum = list(accumulate(a))
b_cum = list(accumulate(b))

ans=[0]
for i in range(n+1):    #0~n+1
    c = bisect_right(b,k-a[i])-1 
                                 
    if c!=-1: 
        ans.append(c+i)
print(max(ans))

from itertools import accumulate
from bisect import bisect_right

n, m, k = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]


a_cum = [0] + list(accumulate(a))
b_cum = [0] + list(accumulate(b))

ans = [0]
for i in range(n + 1):    #0~n+1
    c = bisect_right(b_cum, k-a_cum[i]) - 1 
                                 
    if c != -1: 
        ans.append(c+i)

print(max(ans))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
import numpy as np
def main():
    n, m, k = map(int, input().split())
    a = np.array(readline().split(), np.int64)
    b = np.array(readline().split(), np.int64)
    aa = a.cumsum()
    ba = b.cumsum()
    r = np.searchsorted(ba, k)
    aaa = k - aa
    for i1, aaae in enumerate(aaa):
        if aaae > 0:
            r = max(r, np.searchsorted(ba, aaae) + i1 + 2)
    print(r)

if __name__ == '__main__':
    main()

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
import numpy as np
def main():
    n, m, k = map(int, input().split())
    a = np.array(readline().split(), np.int64)
    b = np.array(readline().split(), np.int64)
    aa = a.cumsum()
    ba = b.cumsum()
    aa = aa[aa <= k]
    ba = ba[ba <= k]
    r = np.searchsorted(ba, k, side='right')
    rs = np.searchsorted(ba, k - aa, side='right')
    rs += np.arange(1, len(ba))
    r = max(r, rs.max())
    print(r)

if __name__ == '__main__':
    main()


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
import numpy as np
def main():
    n, m, k = map(int, input().split())
    a = np.array(readline().split(), np.int64)
    b = np.array(readline().split(), np.int64)
    aa = np.zeros(n + 1, np.int64)
    ba = np.zeros(m + 1, np.int64)
    aa[1:] = a.cumsum()
    ba[1:] = b.cumsum()
    aa = aa[aa <= k]
    ba = ba[ba <= k]
    rs = np.searchsorted(ba, k - aa, side='right') - 1
    rs += np.arange(len(aa))
    r = rs.max()
    print(r)

if __name__ == '__main__':
    main()

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    ruia, ruib = [0], [0]
    for i in range(n): ruia.append(a[i]+ruia[i])
    for i in range(m): ruib.append(b[i]+ruib[i])
    ans = 0
    j = m
    for i in range(n+1):
        if ruia[i] > k:
            break
        while(k > ruia[i]+ruib[j]):
            j -= 1
        ans = max(ans, i+j)
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    ruia, ruib = [0], [0]
    for i in range(n): ruia.append(a[i]+ruia[i])
    for i in range(m): ruib.append(b[i]+ruib[i])
    ans = 0
    j = m
    for i in range(n+1):
        if ruia[i] > k:
            break
        while(k > ruia[i]+ruib[j]):
            j -= 1
            ans = max(ans, i+j)
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    ruia, ruib = [0], [0]
    for i in range(n): ruia.append(a[i]+ruia[i])
    for i in range(m): ruib.append(b[i]+ruib[i])
    ans = 0
    j = m
    for i in range(n+1):
        if ruia[i] > k:
            break
        while(ruib[j]>k-ruia[i]):
            j -= 1
        ans = max(ans, i+j)
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):





N,M,K=map(int,input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))






A_wa = [0]
for i in range(N) :
    A_wa.append(A_wa[i]+A[i])

B_wa = [0]
for i in range(M) :
    B_wa.append(B_wa[i]+B[i])




ans = 0
end = N 

for i in range(M+1):
    A_use = K-B_wa[i]
    if A_use<0: 
        break
    
    
    A_MAX = 0
    start = 0
    while  end-start>=1 : 
        now = int((start + end+1)/2) 
        if A_wa[now]==A_use :  
            A_MAX = now 
            break
        elif A_wa[now]<A_use : 
            start = now 
            A_MAX = now 
        else : 
            end = now-1
    
    
    
    if A_MAX+i>ans :
        ans=A_MAX+i

    end=A_MAX　


print(ans)
    

    











N,M,K=map(int,input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))






A_wa = [0]
for i in range(N) :
    A_wa.append(A_wa[i]+A[i])

B_wa = [0]
for i in range(M) :
    B_wa.append(B_wa[i]+B[i])




ans = 0
end = N 



for i in range(M+1):
    A_use = K-B_wa[i]
    if A_use<0: 
        break
    
    
    
    A_MAX = 0
    start = 0
    while  end-start>=1 : 
        now = int((start + end + 1)/2)
        if A_wa[now]==A_use :  
            A_MAX = now 
            break
        elif A_wa[now]<A_use : 
            start = now 
            A_MAX = now 
        else : 
            end = now-1
    
    end=A_MAX 
    
    
    
    if A_MAX+i>ans :
        ans=A_MAX+i



print(ans)
    

    






Verdicts: Runtime Error

Accepted
Problem: We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.  It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).  Consider the following action:    * Choose a desk with a book remaining, read the topmost book on that desk, and remove it from the desk.  How many books can we read at most by repeating this action so that it takes us at most K minutes in total? We ignore the time it takes to do anything other than reading.

Submission attempts (in order):
# D - Sum of Divisors
from numba import njit


@njit
def solve(N):
    res = 0
    for a in range(1, N + 1):
        for b in range(1, N // a + 1):
            res += a * b
    return res


def main():
    N = int(input())
    print(solve(N))


if __name__ == "__main__":
    main()


from bisect import*;from itertools import*;n,_,k,*x=map(int,open(0).read().split());c=accumulate;*b,=c(x[n:]);print(max(i+bisect(b,k-v)for i,v in enumerate(c([0]+x[:n]))if v<=k))

Verdicts: Runtime Error

Accepted