Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long  long
#define double long double
int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    t=1;
  //  cin>>t;
    while(t--)
    {
        cin>>n>>m>>k;
        ans=0;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
        }
        for(int i=0;i<m;i++) cin>>b[i];
        pnt=0;cnt=0;
        while(1)
        {
            if(pnt==n && cnt==m) break;
            if(pnt<n && cnt<m)
            {
                if(a[pnt]>=b[cnt])
                {
                    k-=b[cnt];
                    if(k>=0)
                    {
                        ans++;
                        cnt++;
                    }
                    else break;
                }
                else if(a[pnt]<b[cnt])
                {
                    k-=a[pnt];
                    if(k>=0)
                    {
                        ans++;pnt++;
                    }
                    else break;
                }
            }
            else
            {
                if(pnt==n)
                {
                    k-=b[cnt];
                    if(k>=0)
                    {
                        ans++;
                        cnt++;
                    }
                    else break;
                }
                else
                {
                    k-=a[pnt];
                    if(k>=0)
                    {
                        ans++;
                        cnt++;
                    }
                    else break;
                }
            }
        }
        cout<<ans<<endl;
    }
}
#include<bits/stdc++.h>
using namespace std;
#define int long  long
#define double long double
int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    t=1;
  //  cin>>t;
    while(t--)
    {
        cin>>n>>m>>k;
        ans=0;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
        }
        for(int i=0;i<m;i++) cin>>b[i];
        pnt=0;cnt=0;
        while(1)
        {
            if(pnt==n && cnt==m) break;
            if(pnt<n && cnt<m)
            {
                if(a[pnt]>=b[cnt])
                {
                    k-=b[cnt];
                    if(k>=0)
                    {
                        ans++;
                        cnt++;
                    }
                    else break;
                }
                else if(a[pnt]<b[cnt])
                {
                    k-=a[pnt];
                    if(k>=0)
                    {
                        ans++;pnt++;
                    }
                    else break;
                }
            }
            else
            {
                if(pnt==n)
                {
                    k-=b[cnt];
                    if(k>=0)
                    {
                        ans++;
                        cnt++;
                    }
                    else break;
                }
                else
                {
                    k-=a[pnt];
                    if(k>=0)
                    {
                        ans++;
                        cnt++;
                    }
                    else break;
                }
            }
        }
        cout<<ans<<endl;
    }
}


Compiler output:
a.cc:77:5: error: redefinition of 'long long int t'
   77 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |     ^
a.cc:5:5: note: 'long long int t' previously declared here
    5 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |     ^
a.cc:77:7: error: redefinition of 'long long int n'
   77 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |       ^
a.cc:5:7: note: 'long long int n' previously declared here
    5 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |       ^
a.cc:77:9: error: redefinition of 'long long int m'
   77 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |         ^
a.cc:5:9: note: 'long long int m' previously declared here
    5 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |         ^
a.cc:77:11: error: redefinition of 'long long int k'
   77 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |           ^
a.cc:5:11: note: 'long long int k' previously declared here
    5 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |           ^
a.cc:77:13: error: redefinition of 'long long int a [200005]'
   77 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |             ^
a.cc:5:13: note: 'long long int a [200005]' previously declared here
    5 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |             ^
a.cc:77:23: error: redefinition of 'long long int pnt'
   77 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |                       ^~~
a.cc:5:23: note: 'long long int pnt' previously declared here
    5 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |                       ^~~
a.cc:77:27: error: redefinition of 'long long int cnt'
   77 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |                           ^~~
a.cc:5:27: note: 'long long int cnt' previously declared here
    5 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |                           ^~~
a.cc:77:31: error: redefinition of 'long long int b [200005]'
   77 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |                               ^
a.cc:5:31: note: 'long long int b [200005]' previously declared here
    5 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |                               ^
a.cc:77:41: error: redefinition of 'long long int ans'
   77 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |                                         ^~~
a.cc:5:41: note: 'long long int ans' previously declared here
    5 | int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
      |                                         ^~~
a.cc:78:8: error: redefinition of 'int main()'
   78 | signed main()
      |        ^~~~
a.cc:6:8: note: 'int main()' previously defined here
    6 | signed main()
      |        ^~~~