Language: C++

# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
#     combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
# mod = 998244353
INF = 1<<50

def readInt():
    return list(map(int,input().split()))

def main():
    n,m,k = readInt()
    a = readInt()
    b = readInt()
    a_sum = [0]
    for i in range(n):
        a_sum.append(a_sum[i] + a[i])
    b_sum = [0]
    for i in range(m):
        b_sum.append(b_sum[i] + b[i])
    b_sum.append(INF)
    ans = 0
    for i in range(n+1):
        t = a_sum[i]
        l = 0
        r = m+2
        while l+1<r:
            c = (l + r) // 2
            if t+b_sum[c]<=k:
                l = c
            else:
                r = c
        if a_sum[i]+b_sum[l]<=k:
            ans = max(ans,i+l)
    print(ans)
    return

if __name__=='__main__':
    main()


Compiler output:
a.cc:1:3: warning: #import is a deprecated GCC extension [-Wdeprecated]
    1 | # import sys
      |   ^~~~~~
a.cc:1:10: error: #import expects "FILENAME" or <FILENAME>
    1 | # import sys
      |          ^~~
a.cc:2:3: warning: #import is a deprecated GCC extension [-Wdeprecated]
    2 | # import math #sqrt,gcd,pi
      |   ^~~~~~
a.cc:2:10: error: #import expects "FILENAME" or <FILENAME>
    2 | # import math #sqrt,gcd,pi
      |          ^~~~
a.cc:3:3: warning: #import is a deprecated GCC extension [-Wdeprecated]
    3 | # import decimal
      |   ^~~~~~
a.cc:3:10: error: #import expects "FILENAME" or <FILENAME>
    3 | # import decimal
      |          ^~~~~~~
a.cc:4:3: warning: #import is a deprecated GCC extension [-Wdeprecated]
    4 | # import queue # queue
      |   ^~~~~~
a.cc:4:10: error: #import expects "FILENAME" or <FILENAME>
    4 | # import queue # queue
      |          ^~~~~
a.cc:5:3: warning: #import is a deprecated GCC extension [-Wdeprecated]
    5 | # import bisect
      |   ^~~~~~
a.cc:5:10: error: #import expects "FILENAME" or <FILENAME>
    5 | # import bisect
      |          ^~~~~~
a.cc:6:3: warning: #import is a deprecated GCC extension [-Wdeprecated]
    6 | # import heapq # priolity-queue
      |   ^~~~~~
a.cc:6:10: error: #import expects "FILENAME" or <FILENAME>
    6 | # import heapq # priolity-queue
      |          ^~~~~
a.cc:7:3: warning: #import is a deprecated GCC extension [-Wdeprecated]
    7 | # import time
      |   ^~~~~~
a.cc:7:10: error: #import expects "FILENAME" or <FILENAME>
    7 | # import time
      |          ^~~~
a.cc:8:3: error: invalid preprocessing directive #from
    8 | # from itertools import product,permutations,\
      |   ^~~~
a.cc:10:3: error: extended character 、 is not valid in an identifier
   10 | # 重複あり順列、順列、組み合わせ、重複あり組み合わせ
      |   ^
a.cc:10:3: error: extended character 、 is not valid in an identifier
a.cc:10:3: error: extended character 、 is not valid in an identifier
a.cc:10:3: error: invalid preprocessing directive #\U000091cd\U00008907\U00003042\U0000308a\U00009806\U00005217\U00003001\U00009806\U00005217\U00003001\U00007d44\U0000307f\U00005408\U0000308f\U0000305b\U00003001\U000091cd\U00008907\U00003042\U0000308a\U00007d44\U0000307f\U00005408\U0000308f\U0000305b
   10 | # 重複あり順列、順列、組み合わせ、重複あり組み合わせ
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:11:3: warning: #import is a deprecated GCC extension [-Wdeprecated]
   11 | # import collections # deque
      |   ^~~~~~
a.cc:11:10: error: #import expects "FILENAME" or <FILENAME>
   11 | # import collections # deque
      |          ^~~~~~~~~~~
a.cc:12:3: error: invalid preprocessing directive #from
   12 | # from operator import itemgetter,mul
      |   ^~~~
a.cc:13:3: error: invalid preprocessing directive #from
   13 | # from fractions import Fraction
      |   ^~~~
a.cc:14:3: error: invalid preprocessing directive #from
   14 | # from functools import reduce
      |   ^~~~
a.cc:17:3: error: invalid preprocessing directive #mod
   17 | # mod = 998244353
      |   ^~~
a.cc:50:14: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   50 | if __name__=='__main__':
      |              ^~~~~~~~~~
a.cc:16:1: error: 'mod' does not name a type
   16 | mod = int(1e9+7)
      | ^~~