criyle/codenet-compile-errors huggingface dataset:
Language: C

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<ctype.h>



int main()

{
    int n,m,k,i;
    scanf("%d %d %d",&n,&m,&k);
    int a[n],b[m];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<m;i++)
    {
        scanf("%d",&b[i]);
    }
    i=0;
    int j=0,count=0;
    while(1)
    {
        if(a[i]<b[j])
        {
            if(a[i]<=k)
            {
                k=k-a[i];
                count++;
                i++;
            }
            else break;
        }
        else
        {
            if(b[j]<=k)
            {
                k=k-b[j];
                count++;
                j++;
            }
            else break;
        }
    }
    printf("%d\n",count);


    return 0;
}


/*
presented by codeRumi
thanks for watching & being here,thank me later... :)
*/

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<ctype.h>



int main()

{
    int n,m,k,i;
    scanf("%d %d %d",&n,&m,&k);
    int a[n],b[m];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<m;i++)
    {
        scanf("%d",&b[i]);
    }
    i=0;
    int j=0,count=0;
    while(1)
    {
        if(a[i]<b[j])
        {
            if(a[i]<=k)
            {
                k=k-a[i];
                count++;
                i++;
            }
            else break;
        }
        else
        {
            if(b[j]<=k)
            {
                k=k-b[j];
                count++;
                j++;
            }
            else break;
        }
    }
    printf("%d\n",count);


    return 0;
}


/*
presented by codeRumi
thanks for watching & being here,thank me later... :)
*/



Compiler output:
main.c:66:5: error: redefinition of 'main'
   66 | int main()
      |     ^~~~
main.c:8:5: note: previous definition of 'main' with type 'int()'
    8 | int main()
      |     ^~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
	int n,m,k,nn=0,mm=0,i,ans=0;
	long long a[200010],b[200010];
	cin >> n;
	cin >> m;
	cin >> k;
	for (i=0;i<n;i++) {
		cin >> a[i];
	}
	for (i=0;i<m;i++) {
		cin >> b[i];
	}
	std::sort(a,a+n);
	std::sort(b,b+m);
	for (;k>0;) {
//cout << k << '\n';
		if (nn == n) {
			if (mm == m) {
				break
			}	
			if (b[mm] <= k) {
				ans++;
				k -= b[mm];
				mm++;
			} else {
				break;
			}
		} else if (mm == m) {
			if (a[nn] <= k) {
				ans++;
				k -= a[nn];
				nn++;
			} else {
				break;
			}
		} else {
			if (a[nn] <= b[mm]) {
				if (a[nn] <= k) {
					ans++;
					k -= a[nn];
					nn++;
				} else {
					break;
				}
			} else {
				if (b[mm] <= k) {
					ans++;
					k -= b[mm];
					mm++;
				} else {
					break;
				}
			}
		}
	}
	
	cout << ans << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:38: error: expected ';' before '}' token
   22 |                                 break
      |                                      ^
      |                                      ;
   23 |                         }
      |                         ~
Language: C++

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

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vecter<int> a(n+1),b(m+1);
  for(int i=0;i<n;i++)	cin >> a.at(i);
  for(int i=0;i<m;i++)	cin >> b.at(i);
  a.at(n)=10000000000;
  b.at(m)=10000000000;
  
  int t=0,c=0;
  int i=0,j=0;
  while(t<k){
    if(a.at(i)>b.at(j)){
      t+=b.at(j);
      j++;
      if(t<=k)	c++;
    }
    else{
      t+=a.at(i);
      i++;
      if(t<=k)	c++;
    }
  }

  cout << c;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vecter' was not declared in this scope
    7 |   vecter<int> a(n+1),b(m+1);
      |   ^~~~~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vecter<int> a(n+1),b(m+1);
      |          ^~~
a.cc:8:32: error: 'a' was not declared in this scope
    8 |   for(int i=0;i<n;i++)  cin >> a.at(i);
      |                                ^
a.cc:9:32: error: 'b' was not declared in this scope
    9 |   for(int i=0;i<m;i++)  cin >> b.at(i);
      |                                ^
a.cc:10:3: error: 'a' was not declared in this scope
   10 |   a.at(n)=10000000000;
      |   ^
a.cc:11:3: error: 'b' was not declared in this scope
   11 |   b.at(m)=10000000000;
      |   ^
Language: C

#include<stdlib.h>
#include<string.h>

#define kLENGTH 200000

int main()
{
  int N, M, K, sum;
  int cA, cB;
  int* A, *B;
  scanf("%d %d %d",&N, &M, &K);
  
  A= (int*)malloc(N * sizeof(int));  
  B= (int*)malloc(M * sizeof(int));
  
  //Aの読みとり
for(int i=0;i<N;i++)
{
  scanf("%d",&A[i]);
}
    //Bの読みとり
for(int i=0;i<M;i++)
{
  scanf("%d",&B[i]);
}
  
  sum = 0;
  cA =0;
  cB=0;
  while(K>=0)
  {
    if(A[cA] >= B[cB])
    {
      K -= B[cB];
      cB++;
      if(K>=0)
      {
        counta++;
      }
    }
    else
    {
      K -= A[cA];
      cA++;
      if(K>=0)
      {
        counta++;
      }
    }
  }
  printf("%d\n",sum);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   11 |   scanf("%d %d %d",&N, &M, &K);
      |   ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    2 | #include<string.h>
  +++ |+#include <stdio.h>
    3 | 
main.c:11:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   11 |   scanf("%d %d %d",&N, &M, &K);
      |   ^~~~~
main.c:11:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:38:9: error: 'counta' undeclared (first use in this function)
   38 |         counta++;
      |         ^~~~~~
main.c:38:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:51:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   51 |   printf("%d\n",sum);
      |   ^~~~~~
main.c:51:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:51:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:51:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long X[200200];
int main()
{
  int Ans=0;
  int N,M,K;
  cin>>N>>M>>K;
  for(int i=1;i<=N;i++)
  {
    cin>>X[i];
    X[i]+=X[i-1];
  }
  Ans=lower_bound(X+1,X+N+1,K)-X-1;
  for(int i=1;i<=M;i++)
  {
    int Y;
    cin>>Y;
    K-=Y;
    if(K<=0)
    {
    	for(int j=i+1;j<=M;j++)
    		cin>>Y;
    	break;
	}
    Ans=max(Ans,lower_bound(X+1,X+N+1,K)-X+i-1);
  }
  cout<<Ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:12: error: no matching function for call to 'max(int&, long int)'
   26 |     Ans=max(Ans,lower_bound(X+1,X+N+1,K)-X+i-1);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:   template argument deduction/substitution failed:
a.cc:26:12: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   26 |     Ans=max(Ans,lower_bound(X+1,X+N+1,K)-X+i-1);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:26:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   26 |     Ans=max(Ans,lower_bound(X+1,X+N+1,K)-X+i-1);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,m,k;
    cin>>n>>m>>k;
    ll ar[n+5],br[m+5];
    for(int i=0;i<n;i++) scanf("%lld",&ar[i]);
    for(int i=0;i<m;i++) scanf("%lld",&br[i]);
    ll sum=0,i=0,j=0;
    ll cnt=0;
    while(sum<k && (i<n || j<m)){
        if((i<n && j<m){
            if(ar[i]<br[j]){
                sum+=ar[i];
                i++;
            }else{
                sum+=br[j];
                j++;
            }
        }
        else if(i<n){
            sum+=ar[i];
            i++;
        }else if(j<m){
            sum+=br[j];
            j++;
        }
        else break;
        if(sum>k) break;
        cnt++;
    }
    cout<<cnt<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:24: error: expected ';' before '{' token
   14 |         if((i<n && j<m){
      |                        ^
      |                        ;
a.cc:23:9: error: expected primary-expression before 'else'
   23 |         else if(i<n){
      |         ^~~~
a.cc:22:10: error: expected ')' before 'else'
   22 |         }
      |          ^
      |          )
   23 |         else if(i<n){
      |         ~~~~
a.cc:14:11: note: to match this '('
   14 |         if((i<n && j<m){
      |           ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define kLENGTH 200000

int main()
{
  int N, M, K, sum;
  int cA, cB;
  int* A, *B;
  scanf("%d %d %d",&N, &M, &K);
  
  A= (int*)malloc(N * sizeof(int));  
  B= (int*)malloc(M * sizeof(int));
  
  //Aの読みとり
for(int i=0;i<N;i++)
{
  scanf("%d",A[i]);
}
    //Bの読みとり
for(int i=0;i<M;i++)
{
  scanf("%d",B[i]);
}
  
  sum = 0;
  cA =0;
  cB=0;
  while(K>=0)
  {
    if(A[cA] >= B[cB])
    {
      K -= B[cB];
      cB++;
      if(K>=0)
      {
        counta++;
      }
    }
    else
    {
      K -= A[cA];
      cA++;
      if(K>=0)
      {
        counta++;
      }
    }
  }
  printf("%d\n",sum);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:39:9: error: 'counta' undeclared (first use in this function)
   39 |         counta++;
      |         ^~~~~~
main.c:39:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vecter<int> a(n+1),b(m+1);
  for(int i=0,i<n,i++)	cin >> a.at(i);
  for(int i=0,i<m,i++)	cin >> b.at(i);
  a.at(n)=10000000000;
  b.at(m)=10000000000;
  
  int t=0,c=0;
  int i=0,j=0;
  while(t<k){
    if(a.at(i)>b.at(j)){
      t+=b.at(j);
      j++;
      if(t<=k)	c++;
    }
    else{
      t+=a.at(i);
      i++;
      if(t<=k)	c++;
    }
  }

  cout << c;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vecter' was not declared in this scope
    7 |   vecter<int> a(n+1),b(m+1);
      |   ^~~~~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vecter<int> a(n+1),b(m+1);
      |          ^~~
a.cc:8:16: error: expected ';' before '<' token
    8 |   for(int i=0,i<n,i++)  cin >> a.at(i);
      |                ^
      |                ;
a.cc:8:16: error: expected primary-expression before '<' token
a.cc:8:22: error: expected ';' before ')' token
    8 |   for(int i=0,i<n,i++)  cin >> a.at(i);
      |                      ^
      |                      ;
a.cc:8:32: error: 'a' was not declared in this scope
    8 |   for(int i=0,i<n,i++)  cin >> a.at(i);
      |                                ^
a.cc:9:16: error: expected ';' before '<' token
    9 |   for(int i=0,i<m,i++)  cin >> b.at(i);
      |                ^
      |                ;
a.cc:9:16: error: expected primary-expression before '<' token
a.cc:9:22: error: expected ';' before ')' token
    9 |   for(int i=0,i<m,i++)  cin >> b.at(i);
      |                      ^
      |                      ;
a.cc:9:32: error: 'b' was not declared in this scope
    9 |   for(int i=0,i<m,i++)  cin >> b.at(i);
      |                                ^
a.cc:10:3: error: 'a' was not declared in this scope
   10 |   a.at(n)=10000000000;
      |   ^
a.cc:11:3: error: 'b' was not declared in this scope
   11 |   b.at(m)=10000000000;
      |   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int a,b,tt,i,k,c=0,sum=0;
  cin>>a>>b>>tt;
  vector<long long int > ar[a+b];
  for(i=0; i<a+b;i++)
  {
    cin>>k;
    ar.push_back(k);
  }
  sort(ar,ar+a+b);
  for(i=0; i<a+b; i++)
  {
    if(sum<=tt)
    {
      c++;
      sum+=ar[i];
    }
    
  }
  cout<<c;
  
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:11:8: error: request for member 'push_back' in 'ar', which is of non-class type 'std::vector<long long int> [(a + b)]'
   11 |     ar.push_back(k);
      |        ^~~~~~~~~
a.cc:19:10: error: no match for 'operator+=' (operand types are 'long long int' and 'std::vector<long long int>')
   19 |       sum+=ar[i];
      |       ~~~^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int n, m;
ll k, a[200200], b[200200], ans;
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin >> n >> m >> k;
    for(int i=1;i<=n;i++) cin >> a[i], a[i] += a[i-1];
    for(int i=1;i<=m;i++) cin >> b[i], b[i] += b[i-1];
    b[++m] = 1e18;

    for(int i=0;i<=n;i++){
        if(a[i] > k) break;
        ans = max(ans, i + (upper_bound(b+1, b+1+m, k-a[i])-b-1));
    }

    cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:18: error: no matching function for call to 'max(ll&, long int)'
   15 |         ans = max(ans, i + (upper_bound(b+1, b+1+m, k-a[i])-b-1));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:   template argument deduction/substitution failed:
a.cc:15:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
   15 |         ans = max(ans, i + (upper_bound(b+1, b+1+m, k-a[i])-b-1));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:15:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   15 |         ans = max(ans, i + (upper_bound(b+1, b+1+m, k-a[i])-b-1));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
  ll N,M,K
  cin >> N >> M >> K;
  vector<ll> A(N,0),B(M,0);
  for(ll &i:A)cin >> i;
  for(ll &i:B)cin >> i;
  ll ca=0,cb=0;
  ll time=0;
  ll count=0;
  while(time+max(A[ca],B[cb])<K){
    if(A[ca]>B[cb]){
      time+=A[ca];
      ca++;
    }else{
      time+=B[cb];
      cb++;
    }
    count++;
  }
  
  
  cout << count << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected initializer before 'cin'
    7 |   cin >> N >> M >> K;
      |   ^~~
a.cc:14:31: error: 'K' was not declared in this scope
   14 |   while(time+max(A[ca],B[cb])<K){
      |                               ^
Language: C++

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

int main() {
    ll n, m, k;
    cin >> n >> m >> k;

    vector<ll> a(n), b(m);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < m; i++)
        cin >> b[i];
    
    ll ans = 0, a_p = 0, b_p = 0, numbers = 0;
    while (a_p < n && b_p < m) {
        if (a[a_p] < b[b_p]) {
            ans += a[a_p++];
        } else {
            ans += b[b_p++];
        }

        if (ans <= k)
            numbers++;
        }
    }

    while (a_p < n && ans + a[a_p] <= k) {
        ans += a[a_p++];
        numbers++;
    }
    while (b_p < m && ans + b[b_p] <= k) {
        ans += b[b_p++];
        numbers++;
    }

    cout << numbers << endl;
}

Compiler output:
a.cc:28:5: error: expected unqualified-id before 'while'
   28 |     while (a_p < n && ans + a[a_p] <= k) {
      |     ^~~~~
a.cc:32:5: error: expected unqualified-id before 'while'
   32 |     while (b_p < m && ans + b[b_p] <= k) {
      |     ^~~~~
a.cc:37:5: error: 'cout' does not name a type
   37 |     cout << numbers << endl;
      |     ^~~~
a.cc:38:1: error: expected declaration before '}' token
   38 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m,k,data;
  cin>>n>>m>>k;
  stack <int> a,b;
  for(int i=0;i<n;i++)
  {cin>>data;
   a.push(data);
  }
  for(int i=0;i<m;i++)
  {cin>>data;
   b.push(data);
  }
  int count=0;
  while(k>0&&(!a.empty()||!b.empty()))
  {
    if(!a.empty()&&!b.empty())
    {
      int ans=min(a.top(),b.top());
      k=k-ans;
      if(ans==a.top())
        a.pop();
      else
        b.pop();
      count++;
    }
    else if(!b.empty())
    {
      k=k-b.top();
      b.pop();
      count++;
    }
    else
    {
      k=k-a.top();
      a.pop();
      count++;)
    }
  }
    if(k==0)
    cout<<count;
  else
    cout<<count-1;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:15: error: expected primary-expression before ')' token
   39 |       count++;)
      |               ^
Language: C

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#define STR 200000
int main(){
    int n,m,k;
    int check=0,ans=0;
    scanf("%d %d %k",&n,&m,&k);
    int A[n],B[m];
    for(int i=0;i<n;i++){
        scanf("%d",A[i]);
    }
    for(int i=0;i<m;i++){
        scanf("%d",B[i]);
    }
    while(check<k){
        if(A[ai]<=B[bi]){
            check+=A[ai];
            ai+=1;
            ans+=1;
        }else if(B[bi]<A[ai]){
            check+=B[bi];
            bi+=1;
            ans+=1;
        }
    }
    printf("%d",ans-1);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:14: error: 'ai' undeclared (first use in this function)
   19 |         if(A[ai]<=B[bi]){
      |              ^~
main.c:19:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:19:21: error: 'bi' undeclared (first use in this function)
   19 |         if(A[ai]<=B[bi]){
      |                     ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;

ll main(){
    ll n,m,k;
    cin >> n >> m >> k;
    ll suma = 0;
    ll sumb = 0;
    vector<ll> a(n),b(m);
    ll nowa = 0;
    ll nowb = 0;
    ll ans = 0;
    for(ll i = 0; i < n; i++){
        cin >> a[i];
        if(suma+a[i] <= k){
            suma += a[i];
            nowa = i;
            ans++;
        }
    }
    for(ll i = 0; i < m; i++){
        cin >> b[i];
        if(sumb+suma+b[i] <= k){
            sumb += b[i];
            nowb = i;
            ans++;
        }
    }
    for(ll i = nowa; i >= 0; i--){
        suma -= a[i];
        ll can = -1;
        ll st = nowb;
        for(ll j = st+1; j < m; j++){
            if(suma+sumb+b[j] <= k){
                sumb += b[j];
                nowb++;
                can++;
            } else break;
        }
        if(can > 0) ans += can;
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc:6:1: error: '::main' must return 'int'
    6 | ll main(){
      | ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ul unsigned long long int
#define vi vector<int>
#define vl vector<int64_t>
#define all(x) x.begin(),x.end()
#define pb push_back
#define fo(x,a,b) for(int x=a; x<b; x++)
#define fi first
#define sec second
int sgn(int x) { return x>0 ? 1 : ( x<0 ? -1 : 0); }
typedef pair<int,int> pairs;
double pi = 3.14159265358979323846;
ll mod = 1000000007;
void solve()
{
    ll n,m,k;
    cin>>n>>m>>k;
    vi a(n),b(m);
    fo(i,0,n) cin>>a[i];
    fo(i,0,m) cin>>b[i];
    ll su=0,cnt=0,x=0,y=0;
    fo(i,0,n+m)
    {
        ll temp = min(a[x],b[y]);
        if(min==a[x]) x++;
        else y++;
        su+=temp;
        if(su>k) break;
        cnt++;
    }
    cout<<cnt;
    cout<<"\n";
    return;
}
int main()
{
#ifdef _DEBUG
    freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll t;
    //cin>>t;
    //while(t--)
    {
        solve();
    }
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:27:15: error: invalid operands of types '<unresolved overloaded function type>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to binary 'operator=='
   27 |         if(min==a[x]) x++;
Language: C++

#incclude<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m,k,data;
  cin>>n>>m>>k;
  stack <int> a,b;
  for(int i=0;i<n;i++)
  {cin>>data;
   a.push(data);
  }
  for(int i=0;i<m;i++)
  {cin>>data;
   b.push(data);
  }
  int count=0;
  while(k>0&&(!a.empty()||!b.empty()))
  {
    if(!a.empty()&&!b.empty())
    {
      int ans=min(a.top(),b.top());
      k=k-ans;
      if(ans==a.top())
        a.pop();
      else
        b.pop();
      count++;
    }
    else if(!b.empty())
    {
      k=k-b.top();
      b.pop();
      count++;
    }
    else
    {
      k=k-a.top();
      a.pop();
      count++;)
    }
  }
    if(k==0)
    cout<<count;
  else
    cout<<count-1;
    return 0;
}


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #incclude; did you mean #include?
    1 | #incclude<bits/stdc++.h>
      |  ^~~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin>>n>>m>>k;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #incclude<bits/stdc++.h>
a.cc:7:3: error: 'stack' was not declared in this scope
    7 |   stack <int> a,b;
      |   ^~~~~
a.cc:1:1: note: 'std::stack' is defined in header '<stack>'; this is probably fixable by adding '#include <stack>'
  +++ |+#include <stack>
    1 | #incclude<bits/stdc++.h>
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   stack <int> a,b;
      |          ^~~
a.cc:10:4: error: 'a' was not declared in this scope
   10 |    a.push(data);
      |    ^
a.cc:14:4: error: 'b' was not declared in this scope
   14 |    b.push(data);
      |    ^
a.cc:17:16: error: 'a' was not declared in this scope
   17 |   while(k>0&&(!a.empty()||!b.empty()))
      |                ^
a.cc:17:28: error: 'b' was not declared in this scope
   17 |   while(k>0&&(!a.empty()||!b.empty()))
      |                            ^
a.cc:21:15: error: 'min' was not declared in this scope; did you mean 'main'?
   21 |       int ans=min(a.top(),b.top());
      |               ^~~
      |               main
a.cc:39:15: error: expected primary-expression before ')' token
   39 |       count++;)
      |               ^
a.cc:43:5: error: 'cout' was not declared in this scope
   43 |     cout<<count;
      |     ^~~~
a.cc:43:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:45:5: error: 'cout' was not declared in this scope
   45 |     cout<<count-1;
      |     ^~~~
a.cc:45:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++


        {
            int pos = i+1 + id;
            DBG(pos);
            mx = max(mx,pos);
        }
    }

    cout<<mx<<endl;

    return 0;
}

/**
3 4 10
60 90 120
80 150 80 150
**/

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}




Compiler output:
a.cc:2:9: error: expected unqualified-id before '{' token
    2 |         {
      |         ^
a.cc:7:5: error: expected declaration before '}' token
    7 |     }
      |     ^
a.cc:9:5: error: 'cout' does not name a type
    9 |     cout<<mx<<endl;
      |     ^~~~
a.cc:11:5: error: expected unqualified-id before 'return'
   11 |     return 0;
      |     ^~~~~~
a.cc:12:1: error: expected declaration before '}' token
   12 | }
      | ^
a.cc:21:1: error: 'ostream' does not name a type
   21 | ostream &operator <<(ostream &os, pair<T1,T2>&p)
      | ^~~~~~~
a.cc:27:1: error: 'ostream' does not name a type
   27 | ostream &operator <<(ostream &os, vector<T>&v)
      | ^~~~~~~
a.cc:39:1: error: 'ostream' does not name a type
   39 | ostream &operator <<(ostream &os, set<T>&v)
      | ^~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 200005;
ll A[MAX_N],B[MAX_N];
vector<ll> sumA,sumB;

int main()
{
	ll N,M,K;
	cin >> N >> M >> K;
	sumA.push_back(0);
	rep(i,N)
	{
		cin >> A[i];
		sumA.push_back(sumA[i] + A[i]);
	}
	sumB.push_back(0);
	rep(i,M)
	{
		cin >> B[i];
		sumB.push_back(sumB[i] + B[i]);
	}
	int ans = 0;
	for (int i = 0; i <= N; ++i)
	{
		if (sumA[i] > K) break;
		ans = max(ans,i+(upper_bound(sumB.begin(), sumB.end(), K - sumA[i]) - sumB.begin() - ll(1)));
		//cout << ans << " ";
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:26: error: no matching function for call to 'max(int&, long long int)'
   30 |                 ans = max(ans,i+(upper_bound(sumB.begin(), sumB.end(), K - sumA[i]) - sumB.begin() - ll(1)));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:   template argument deduction/substitution failed:
a.cc:30:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   30 |                 ans = max(ans,i+(upper_bound(sumB.begin(), sumB.end(), K - sumA[i]) - sumB.begin() - ll(1)));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:30:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   30 |                 ans = max(ans,i+(upper_bound(sumB.begin(), sumB.end(), K - sumA[i]) - sumB.begin() - ll(1)));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <iterator>

using namespace std;

int main()
{
	int N, M, K;
	cin >> N >> M >> K;
	vector<long long> A(N), B(M);
	for (auto& A_i : A) {
		cin >> A_i;
	}
	for (auto& B_i : B) {
		cin >> B_i;
	}

	vector<long long> accA(1, 0);
	vector<long long> accB(1, 0);

	partial_sum(A.begin(), A.end(), back_inserter(accA));
	partial_sum(B.begin(), B.end(), back_inserter(accB));

	int ans = 0;

	for (int i = 1; i <= N; ++i) {
		if (accA[i] > K) {
			continue;
		}
		auto j = upper_bound(accB.begin(), accB.end(), K - accA[i]) - accB.begin() - 1;
		ans = max(ans, i + j);
	}


	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:26: error: no matching function for call to 'max(int&, long int)'
   34 |                 ans = max(ans, i + j);
      |                       ~~~^~~~~~~~~~~~
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:   template argument deduction/substitution failed:
a.cc:34:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   34 |                 ans = max(ans, i + j);
      |                       ~~~^~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:34:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   34 |                 ans = max(ans, i + j);
      |                       ~~~^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

const lll N = 2e5 + 500;

ll a[N], b[N], pf[N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ll n, m, t;
    cin >> n >> m >> t;
    for (ll i = 0; i < n; ++i)
	cin >> a[i];
    for (ll i = 0; i < m; ++i)
	cin >> b[i];
    for (ll i = 0; i < n; ++i)
	pf[i] = (i - 1 < 0 ? 0 : pf[i - 1]) + a[i];

    ll ans = 0;
    for (ll i = 0; i < n; ++i)
	if (pf[i] <= t)
	    ans = max(ans, i + 1);

    ll cur = 0;
    for (ll i = 0; i < m; ++i)
	if (cur + b[i] <= t)
	    cur += b[i], ans = max(ans, i + 1);

    cur = 0;

    for (ll i = 0; i < m; ++i) {
	cur += b[i];
	ll l = 0, r = n - 1;
	ll ost = t - cur;

	while (l < r) {
	    int md = (l + r + 1) >> 1;
	    if (pf[md] > ost) r = md - 1;
		else l = md;
	}

	if (pf[l] > ost)
	    continue;

	ans = max(ans, (i + 1) + (l + 1));
    }

    cout << ans << "\n";
}


Compiler output:
a.cc:6:7: error: 'lll' does not name a type; did you mean 'll'?
    6 | const lll N = 2e5 + 500;
      |       ^~~
      |       ll
a.cc:8:6: error: 'N' was not declared in this scope
    8 | ll a[N], b[N], pf[N];
      |      ^
a.cc:8:12: error: 'N' was not declared in this scope
    8 | ll a[N], b[N], pf[N];
      |            ^
a.cc:8:19: error: 'N' was not declared in this scope
    8 | ll a[N], b[N], pf[N];
      |                   ^
a.cc: In function 'int main()':
a.cc:16:16: error: 'a' was not declared in this scope
   16 |         cin >> a[i];
      |                ^
a.cc:18:16: error: 'b' was not declared in this scope
   18 |         cin >> b[i];
      |                ^
a.cc:20:9: error: 'pf' was not declared in this scope
   20 |         pf[i] = (i - 1 < 0 ? 0 : pf[i - 1]) + a[i];
      |         ^~
a.cc:20:47: error: 'a' was not declared in this scope
   20 |         pf[i] = (i - 1 < 0 ? 0 : pf[i - 1]) + a[i];
      |                                               ^
a.cc:24:13: error: 'pf' was not declared in this scope
   24 |         if (pf[i] <= t)
      |             ^~
a.cc:29:19: error: 'b' was not declared in this scope
   29 |         if (cur + b[i] <= t)
      |                   ^
a.cc:35:16: error: 'b' was not declared in this scope
   35 |         cur += b[i];
      |                ^
a.cc:41:17: error: 'pf' was not declared in this scope
   41 |             if (pf[md] > ost) r = md - 1;
      |                 ^~
a.cc:45:13: error: 'pf' was not declared in this scope
   45 |         if (pf[l] > ost)
      |             ^~
Language: C++

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

int main(){
  int n, k, m;
  cin >> n >> m >> k;
  vector<int> a(n);
  vector<int> b(m);
  for(int i = 0;i < n;i++)cin >> a.at(i);
  for(int i = 0;i < m;i++)cin >> b.at(i);
  int count = 0;
  int counter = 0;
  int i = 0;
  int j - 0;
  while(true){
    if(i < n && j < m){
      if(a.at(i) <= b.at(j)){
        if(counter + a.at(i) <= k){
          counter += a.at(i);
        	count++;
        	i++;
        }
        else break;
      }
      else{
        if(counter + b.at(j) <= k){
          counter += b.at(j);
        	count++;
       		j++;
        }
        else break;
      }
    }
    else if(i >= n && j < m){
      if(counter + b.at(j) <= k){
        counter += b.at(j);
        count++;
        j++;
      }
      else break;
    }
    else if(i < n && j >= m){
      if(counter + a.at(i) <= k){
        counter += a.at(i);
        count++;
        i++;
      }
      else break;
    }
    else break;
  }
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: expected initializer before '-' token
   14 |   int j - 0;
      |         ^
a.cc:16:17: error: 'j' was not declared in this scope
   16 |     if(i < n && j < m){
      |                 ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(void)
{
    int N, M, K;
    cin >> N >> M >> K;

    stack<int> A;
    stack<int> B;
    int a,b;
    for(int i = 0 ;i < N;i++){
        cin >> a;
        A.push(a);
    }
     for(int i = 0 ;i < M;i++){
        cin >> b;
        B.push(b);
    }

    int t = 0;
    int result = 0;
    while(1) {
        if(t >= K) {
            break;
        }
        if(A.empty() == true){
            t += B.front();
            B.pop();
            result++;
            continue;
        }
        if(B.empty() == true) {
            t += A.front();
            A.pop();
            result++;
            continue;
        }
        if(A.front() >= B.front()) {
            t += B.front();
            B.pop();
            result++;
        }
        else {
            t += A.front();
            A.pop();
            result++;
        }
    }
    cout << result << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:20: error: 'class std::stack<int>' has no member named 'front'
   29 |             t += B.front();
      |                    ^~~~~
a.cc:35:20: error: 'class std::stack<int>' has no member named 'front'
   35 |             t += A.front();
      |                    ^~~~~
a.cc:40:14: error: 'class std::stack<int>' has no member named 'front'
   40 |         if(A.front() >= B.front()) {
      |              ^~~~~
a.cc:40:27: error: 'class std::stack<int>' has no member named 'front'
   40 |         if(A.front() >= B.front()) {
      |                           ^~~~~
a.cc:41:20: error: 'class std::stack<int>' has no member named 'front'
   41 |             t += B.front();
      |                    ^~~~~
a.cc:46:20: error: 'class std::stack<int>' has no member named 'front'
   46 |             t += A.front();
      |                    ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
int n,m,k;
int a[N],b[N];
LL s[N];
int main() {
  ios::sync_with_stdio(false);
  cin>>n>>m>>k;
  for(int i=1;i<=n;i++)cin>>a[i];
  for(int i=1;i<=m;i++)cin>>b[i],s[i]=s[i-1]+b[i];
  int ans=0;
  for(int i=0;i<=n;i++){
    k-=a[i];
    if(k<0)break;
    auto x=upper_bound(s+1,s+1+m,k)-s-1;
    ans=max(ans,i+x);
  }
  cout<<ans<<'\n';
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:12: error: no matching function for call to 'max(int&, long int)'
   21 |     ans=max(ans,i+x);
      |         ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:   template argument deduction/substitution failed:
a.cc:21:12: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   21 |     ans=max(ans,i+x);
      |         ~~~^~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:21:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |     ans=max(ans,i+x);
      |         ~~~^~~~~~~~~
Language: C++

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

int main(){
  int n,m,k;
  cin>>n>>m>>k;
  int a[n];
  int b[m];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<m;i++}{
    cin>>b[i];
  }
  int i=0,j=0;
  int time=0;
      int count=0;
  while(i<n || j<m && time<=k){
    if(a[i]<=b[j]){
      count++;
      i++;
      time+=a[i];
    }
    else{
      count++;
      time+=b[j];
      j++;
    
    }
  }
    cout<count;
      return 0;
      }

Compiler output:
a.cc: In function 'int main()':
a.cc:12:22: error: expected ')' before '}' token
   12 |   for(int i=0;i<m;i++}{
      |      ~               ^
      |                      )
a.cc:12:22: error: expected primary-expression before '}' token
a.cc: At global scope:
a.cc:12:23: error: expected unqualified-id before '{' token
   12 |   for(int i=0;i<m;i++}{
      |                       ^
a.cc:16:7: error: 'int time' redeclared as different kind of entity
   16 |   int time=0;
      |       ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc:18:3: error: expected unqualified-id before 'while'
   18 |   while(i<n || j<m && time<=k){
      |   ^~~~~
a.cc:31:5: error: 'cout' does not name a type
   31 |     cout<count;
      |     ^~~~
a.cc:32:7: error: expected unqualified-id before 'return'
   32 |       return 0;
      |       ^~~~~~
a.cc:33:7: error: expected declaration before '}' token
   33 |       }
      |       ^
Language: C++

#include <bits/stdc++.h>

#define int long long

using namespace std;



int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int N, M, K;
    cin >> N >> M >> K;

    vector<int> va, vb;

    for(int i = 0 ; i < N ; i++)
    {
    	int n;
    	cin >> n;
    	va.push_back(n);
    }

    for(int i = 0 ; i < M ; i++)
    {
    	int n;
    	cin >> n;
    	vb.push_back(n);
    }

    for(int i = 1 ; i < N ; i++)
    {
    	va[i] += va[i-1];
    }

    for(int i = 1 ; i < M ; i++)
    {
    	vb[i] += vb[i-1];
    }

    int res = 0;

    for(int i = 0 ; i < N ; i++)
    {
    	if(va[i] > K)break;
    	int temp = K-va[i];

    	int pos = upper_bound(vb.begin(),vb.end(),temp)-vb.begin();

    	res = maX(res,i+1+pos);
    }

    cout << res << '\n';

    return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:52:15: error: 'maX' was not declared in this scope
   52 |         res = maX(res,i+1+pos);
      |               ^~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define pii_ pair<int,int>
#define mp_ make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define show1(a) cout<<#a<<" = "<<a<<endl
#define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
const int maxn = 2e5+5;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

ll a[maxn],b[maxn],sa[maxn],sb[maxn];
int n,m,k;

int main()
{
    fastio();
    cin>>n>>m>>k;
    rep(i,1,n) cin>>a[i];
    rep(i,1,m) cin>>b[i];
    rep(i,1,n){
        sa[i] = sa[i-1] + a[i];
    }
    rep(i,1,m){
        sb[i] = sb[i-1] + a[i];
    }
    int ans = 0;
    rep(i,0,n){
        if(k-sa[i]<0) break;
        ans = max(ans,upper_bound(sb+1,sb+m+1,k-sa[i])-sb-1+i);
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:18: error: no matching function for call to 'max(int&, long int)'
   36 |         ans = max(ans,upper_bound(sb+1,sb+m+1,k-sa[i])-sb-1+i);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:   template argument deduction/substitution failed:
a.cc:36:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   36 |         ans = max(ans,upper_bound(sb+1,sb+m+1,k-sa[i])-sb-1+i);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:36:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   36 |         ans = max(ans,upper_bound(sb+1,sb+m+1,k-sa[i])-sb-1+i);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~