Language: C++

#include<iostream>
#include<vector>
using ll = long long
using namespace std;

int main(){
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> A(n),a(n);
    vector<ll> B(m),b(m);

    for(int i = 0;i<n;i++) {
        cin >> A[i];
        if(i == 0) a[i] = A[i];
        else a[i] = a[i-1] + A[i];
    }
    for(int i = 0;i<m;i++) {
         cin >> B[i];
        if(i == 0) b[i] = B[i];
        else b[i] = b[i-1] + B[i];
    }
    //bj <= k - aiを満たす j の最大値
    ll bestj = m-1;
    ll ans = 0;
    for (int i = 0;i < n;i++){
        if(a[i] > k) break;
        while(b[bestj] <= k - a[i]){
            bestj--;
        }
        ans = max(ans,i + bestj);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc:3:21: error: expected ';' before 'using'
    3 | using ll = long long
      |                     ^
      |                     ;
    4 | using namespace std;
      | ~~~~~                
a.cc: In function 'int main()':
a.cc:7:5: error: 'll' was not declared in this scope
    7 |     ll n,m,k;
      |     ^~
a.cc:8:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |     cin >> n >> m >> k;
      |     ^~~
      |     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:12: error: 'n' was not declared in this scope
    8 |     cin >> n >> m >> k;
      |            ^
a.cc:8:17: error: 'm' was not declared in this scope; did you mean 'tm'?
    8 |     cin >> n >> m >> k;
      |                 ^
      |                 tm
a.cc:8:22: error: 'k' was not declared in this scope
    8 |     cin >> n >> m >> k;
      |                      ^
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector<ll> A(n),a(n);
      |     ^~~~~~
a.cc:9:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:9:16: error: 'A' was not declared in this scope
    9 |     vector<ll> A(n),a(n);
      |                ^
a.cc:9:21: error: 'a' was not declared in this scope
    9 |     vector<ll> A(n),a(n);
      |                     ^
a.cc:10:16: error: 'B' was not declared in this scope
   10 |     vector<ll> B(m),b(m);
      |                ^
a.cc:10:21: error: 'b' was not declared in this scope
   10 |     vector<ll> B(m),b(m);
      |                     ^
a.cc:23:7: error: expected ';' before 'bestj'
   23 |     ll bestj = m-1;
      |       ^~~~~~
      |       ;
a.cc:24:7: error: expected ';' before 'ans'
   24 |     ll ans = 0;
      |       ^~~~
      |       ;
a.cc:27:17: error: 'bestj' was not declared in this scope
   27 |         while(b[bestj] <= k - a[i]){
      |                 ^~~~~
a.cc:30:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |         ans = max(ans,i + bestj);
      |         ^~~
      |         abs
a.cc:30:27: error: 'bestj' was not declared in this scope
   30 |         ans = max(ans,i + bestj);
      |                           ^~~~~
a.cc:30:15: error: 'max' was not declared in this scope; did you mean 'std::max'?
   30 |         ans = max(ans,i + bestj);
      |               ^~~
      |               std::max
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
a.cc:32:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   32 |     cout << ans << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:32:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |     cout << ans << endl;
      |             ^~~
      |             abs
a.cc:32:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   32 |     cout << ans << endl;
      |                    ^~~~
      |                    std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~