Language: C++

#include<bits/stdc++.h>
using namesopace std;
int main(){
long long int n,m,k;
  cin>>n>>m>>k;
  long long int a[n+1],b[m+1];
  long long int ta[n+1],tb[m+1];
  ta[0]=0;
  tb[0]=0;
  for(long long int j =1;j<=n;j++){
    cin>>a[j];
    ta[j]=ta[j-1]+a[j];
  }
  for(long long int j=1;j<=m;j++){
cin>>b[j];
    tb[j]=tb[j-1]+b[j];
  }
  long long int mx = 0;
  long long int best = m;
  for(long long int j =0;j<=n;j++){
    if(ta[j]<=k){
      for(long long int v = best;v>=0;v--){
        if(ta[j]+tb[v]<=k){best=v;
                           mx=max(mx,j+v);
                           break;
                          }
      }
      if(v==-1){mx=max(mx,j);
                best=0;
               }
    }
  }
    cout<<mx<<endl;
}
      
    

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namesopace'
    2 | using namesopace std;
      |       ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   cin>>n>>m>>k;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 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:24:31: error: 'max' was not declared in this scope; did you mean 'std::max'?
   24 |                            mx=max(mx,j+v);
      |                               ^~~
      |                               std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:28:10: error: 'v' was not declared in this scope
   28 |       if(v==-1){mx=max(mx,j);
      |          ^
a.cc:28:20: error: 'max' was not declared in this scope; did you mean 'std::max'?
   28 |       if(v==-1){mx=max(mx,j);
      |                    ^~~
      |                    std::max
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:33:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   33 |     cout<<mx<<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:33:15: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   33 |     cout<<mx<<endl;
      |               ^~~~
      |               std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~