Language: C++

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
typedef ll long long;

//------------------------3-------------------------
int main()
{
    ll  n,m,k; std::cin >> n >> m >> k;
    ll  a[200001], b[200001];
    // std::vector<long long>  a(n+1), b(m+1);
    a[0]=0; b[0]=0;
    for (int i=1;i<n+1;i++)
        cin >> a[i];
    for (int i=1; i<m+1; i++)
        cin >> b[i];
    
    for (int i=1; i<n+1; i++)
        a[i]+=a[i-1];
    for (int i=1; i<m+1; i++)
        b[i]+=b[i-1];

    ll ans=0, r=m;
    for (int i=0; i<n+1; i++)
    {
        if(a[i]>k) break;
        while (a[i]+b[r]>k)
            r--;
        ans = std::max({ans, i+r});
    }
    
    std::cout << ans;

    return 0;
}

Compiler output:
a.cc:6:9: error: 'll' does not name a type
    6 | typedef ll long long;
      |         ^~
a.cc: In function 'int main()':
a.cc:11:5: error: 'll' was not declared in this scope
   11 |     ll  n,m,k; std::cin >> n >> m >> k;
      |     ^~
a.cc:11:28: error: 'n' was not declared in this scope
   11 |     ll  n,m,k; std::cin >> n >> m >> k;
      |                            ^
a.cc:11:33: error: 'm' was not declared in this scope; did you mean 'tm'?
   11 |     ll  n,m,k; std::cin >> n >> m >> k;
      |                                 ^
      |                                 tm
a.cc:11:38: error: 'k' was not declared in this scope
   11 |     ll  n,m,k; std::cin >> n >> m >> k;
      |                                      ^
a.cc:12:7: error: expected ';' before 'a'
   12 |     ll  a[200001], b[200001];
      |       ^ ~
      |       ;
a.cc:14:5: error: 'a' was not declared in this scope
   14 |     a[0]=0; b[0]=0;
      |     ^
a.cc:14:13: error: 'b' was not declared in this scope
   14 |     a[0]=0; b[0]=0;
      |             ^
a.cc:25:7: error: expected ';' before 'ans'
   25 |     ll ans=0, r=m;
      |       ^~~~
      |       ;
a.cc:29:23: error: 'r' was not declared in this scope
   29 |         while (a[i]+b[r]>k)
      |                       ^
a.cc:31:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |         ans = std::max({ans, i+r});
      |         ^~~
      |         abs
a.cc:31:32: error: 'r' was not declared in this scope
   31 |         ans = std::max({ans, i+r});
      |                                ^
a.cc:31:23: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   31 |         ans = std::max({ans, i+r});
      |               ~~~~~~~~^~~~~~~~~~~~
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,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
a.cc:34:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
   34 |     std::cout << ans;
      |                  ^~~
      |                  abs