Language: C++

#include<bits/stdc++.h>
using namespace std;


#define ll                      long long
#define pii                     pair<int, int>
#define pli                     pair<ll, int>
#define pil                     pair<int, ll>
#define pll                     pair<ll, ll>
#define vi                      vector<int>
#define vll                     vector<ll>
#define vb                      vector<bool>
#define vd                      vector<double>
#define vs                      vector<string>
#define ff                      first
#define ss                      second
#define pb                      push_back
#define eb                      emplace_back
#define ppb                     pop_back
#define pf                      push_front
#define ppf                     pop_front
#define vpii                    vector<pii>
#define umap                    unordered_map
#define all(x)                  x.begin(),x.end()
#define clr(a,b)                memset(a,b,sizeof a)
#define fr(i, n)                for(ll i=0; i<n;++i)
#define fr1(i, n)               for(ll i=1; i<=n; ++i)
#define rfr(i, n)			    for(ll i=n-1; i>=0; --i)
#define precise(x)              cout<<fixed<<setprecision(x)
#define wh						while
#define mp						make_pair
#define le						length()


ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

ll lcm(ll a,ll b) 
{ return (a*b)/__gcd(a,b); }

ll mulpow(ll x,ll y,ll p) 
{ ll res=1; x=x%p;
    while(y>0) 
    { if (y&1) res=(res*x)%p; 
      y=y>>1; x=(x*x)%p; } 
    return res; } 
    
bool inside(ll x,ll y,ll n,ll m)
{
	return(x>=0&&x<n&&y>=0&&y<=m);
}   

/*void dfs(int s)
{
		if(vis[s])return;
		
		vis[s]=true;
		nodes++;
		for(auto u:g[s])
		{
			if(!vis[u])
			{
				dfs(u);	
			}		
		}
}*/






void solve()
{	
	ll n,m,k;
	
	cin>>n>>m>>k;
	
	queue <ll> a,b;
	
	fr(i,n)
	{
		ll e;
		cin>>e;
		a.pb(e);
	}
	fr(i,m)
	{
		ll e;
		cin>>e;
		b.push(e);
	}
	
	ll t=0,ans=0;
	
	wh(t<k&&(!a.empty()||!b.empty()
	{
		bool done=false;
		ll t1=LLONG_MAX,t2=LLONG_MAX;
		if(!a.empty())
		t1=a.front();
		if(!b.empty())
		t2=b.front();
//		cout<<t1<<" "<<t2<<endl;
		if(t1<t2&&t+t1<=k)
		{
			ans++;
			done=1;
			t+=t1;
			a.pop();
		}
		else if(t2<=t1&&t+t2<=k)
		{
			ans++;
			done=1;
			t+=t2;
			b.pop();
		}
		if(!done)
		break;
	
	}
	cout<<ans<<endl;
}

int main()
{
//	int t;
//	cin>>t;
//	wh(t--)
	{
		solve();
	}
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:17:33: error: 'class std::queue<long long int>' has no member named 'push_back'
   17 | #define pb                      push_back
      |                                 ^~~~~~~~~
a.cc:84:19: note: in expansion of macro 'pb'
   84 |                 a.pb(e);
      |                   ^~
a.cc:95:40: error: expected ')' before '{' token
   95 |         wh(t<k&&(!a.empty()||!b.empty()
      |                 ~                      ^
      |                                        )
   96 |         {
      |         ~                               
a.cc:121:10: error: expected ')' before 'cout'
  121 |         }
      |          ^
      |          )
  122 |         cout<<ans<<endl;
      |         ~~~~
a.cc:95:11: note: to match this '('
   95 |         wh(t<k&&(!a.empty()||!b.empty()
      |           ^