Language: C++

#include <iostream>
#include<bits/stdc++.h>
#define li __int64
#define lis int
using namespace std;

lis main()
{

   li n,m,k;
   cin>>n>>m>>k;

   li* a=new li[n];
   for(li i=0;i<n;i++){
        cin>>a[i];
   }

   li* b=new li[m];
   for(li i=0;i<m;i++){
        cin>>b[i];
   }

   li c_sum=0;
   li c=0;

   li ii=0;
   li jj=0;

   while(ii<n && jj<m && c_sum<k){

        if(a[ii]<b[jj]){
            c++;
            c_sum+=a[ii];
            ii++;
        }
        else{
            c_sum+=b[jj];
            c++;
            jj++;
        }

   }

   if(c_sum>k){
    if(c>=1){
        cout<<c-1<<endl;
    }
    else{
        cout<<0<<endl;
    }
   }

   else if(c_sum==k){
    cout<<c<<endl;
   }

   else if(ii==n && jj<m){

        while(jj<m && c_sum<k){
            c_sum+=b[jj];
            jj++;
            c++;

        }
        if(c_sum>k){
            cout<<c-1<<endl;
        }
        else{
            cout<<c<<endl;
        }


   }

   else if(jj==m && ii<n){

        while(ii<n && c_sum<k){
            c_sum+=a[ii];
            ii++;
            c++;

        }
        if(c_sum>k){
            cout<<c-1<<endl;
        }
        else{
            cout<<c<<endl;
        }


   }
   else{
    cout<<c<<endl;
   }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:12: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
    3 | #define li __int64
      |            ^~~~~~~
a.cc:10:4: note: in expansion of macro 'li'
   10 |    li n,m,k;
      |    ^~
a.cc:11:9: error: 'n' was not declared in this scope; did you mean 'yn'?
   11 |    cin>>n>>m>>k;
      |         ^
      |         yn
a.cc:11:12: error: 'm' was not declared in this scope; did you mean 'tm'?
   11 |    cin>>n>>m>>k;
      |            ^
      |            tm
a.cc:11:15: error: 'k' was not declared in this scope
   11 |    cin>>n>>m>>k;
      |               ^
a.cc:13:8: error: 'a' was not declared in this scope
   13 |    li* a=new li[n];
      |        ^
a.cc:3:12: error: '__int64' does not name a type; did you mean '__int64_t'?
    3 | #define li __int64
      |            ^~~~~~~
a.cc:13:14: note: in expansion of macro 'li'
   13 |    li* a=new li[n];
      |              ^~
a.cc:14:11: error: expected ';' before 'i'
   14 |    for(li i=0;i<n;i++){
      |           ^
a.cc:14:15: error: 'i' was not declared in this scope; did you mean 'li'?
   14 |    for(li i=0;i<n;i++){
      |               ^
      |               li
a.cc:18:8: error: 'b' was not declared in this scope
   18 |    li* b=new li[m];
      |        ^
a.cc:3:12: error: '__int64' does not name a type; did you mean '__int64_t'?
    3 | #define li __int64
      |            ^~~~~~~
a.cc:18:14: note: in expansion of macro 'li'
   18 |    li* b=new li[m];
      |              ^~
a.cc:19:11: error: expected ';' before 'i'
   19 |    for(li i=0;i<m;i++){
      |           ^
a.cc:19:15: error: 'i' was not declared in this scope; did you mean 'li'?
   19 |    for(li i=0;i<m;i++){
      |               ^
      |               li
a.cc:23:7: error: expected ';' before 'c_sum'
   23 |    li c_sum=0;
      |       ^~~~~
a.cc:24:7: error: expected ';' before 'c'
   24 |    li c=0;
      |       ^
a.cc:26:7: error: expected ';' before 'ii'
   26 |    li ii=0;
      |       ^~
a.cc:27:7: error: expected ';' before 'jj'
   27 |    li jj=0;
      |       ^~
a.cc:29:10: error: 'ii' was not declared in this scope; did you mean 'li'?
   29 |    while(ii<n && jj<m && c_sum<k){
      |          ^~
      |          li
a.cc:29:18: error: 'jj' was not declared in this scope; did you mean 'jn'?
   29 |    while(ii<n && jj<m && c_sum<k){
      |                  ^~
      |                  jn
a.cc:29:26: error: 'c_sum' was not declared in this scope
   29 |    while(ii<n && jj<m && c_sum<k){
      |                          ^~~~~
a.cc:32:13: error: 'c' was not declared in this scope
   32 |             c++;
      |             ^
a.cc:38:13: error: 'c' was not declared in this scope
   38 |             c++;
      |             ^
a.cc:44:7: error: 'c_sum' was not declared in this scope
   44 |    if(c_sum>k){
      |       ^~~~~
a.cc:45:8: error: 'c' was not declared in this scope
   45 |     if(c>=1){
      |        ^
a.cc:54:11: error: 'c' was not declared in this scope
   54 |     cout<<c<<endl;
      |           ^
a.cc:57:12: error: 'ii' was not declared in this scope; did you mean 'li'?
   57 |    else if(ii==n && jj<m){
      |            ^~
      |            li
a.cc:57:21: error: 'jj' was not declared in this scope; did you mean 'jn'?
   57 |    else if(ii==n && jj<m){
      |                     ^~
      |                     jn
a.cc:62:13: error: 'c' was not declared in this scope
   62 |             c++;
      |             ^
a.cc:66:19: error: 'c' was not declared in this scope
   66 |             cout<<c-1<<endl;
      |                   ^
a.cc:69:19: error: 'c' was not declared in this scope
   69 |             cout<<c<<endl;
      |                   ^
a.cc:80:13: error: 'c' was not declared in this scope
   80 |             c++;
      |             ^
a.cc:84:19: error: 'c' was not declared in this scope
   84 |             cout<<c-1<<endl;
      |                   ^
a.cc:87:19: error: 'c' was not declared in this scope
   87 |             cout<<c<<endl;
      |                   ^
a.cc:93:11: error: 'c' was not declared in this scope
   93 |     cout<<c<<endl;
      |           ^