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

#include <iostream>
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	long* a, * b;
	a = new long[n+1];
	b = new long[m+1];
	long long k;
	cin >> k;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	for (int i = 0; i < m; i++)
	{
		cin >> b[i];
	}

	int passTime = 0;
	int i = 0, j = 0, cnt = 0;
	while (i < n || j < m)
	{
		if (a[i] < b[j]) {
			passTime += a[i];
			if (passTime > k) break;
			i++;
			if (i == n)a[i] = INT_MAX;
			cnt++;
		}
		else
		{
			passTime += b[j];
			if (passTime > k) break;
			j++;
			if (j == m)b[j] = INT_MAX;
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:43: error: 'INT_MAX' was not declared in this scope
   29 |                         if (i == n)a[i] = INT_MAX;
      |                                           ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | using namespace std;
a.cc:37:43: error: 'INT_MAX' was not declared in this scope
   37 |                         if (j == m)b[j] = INT_MAX;
      |                                           ^~~~~~~
a.cc:37:43: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vl(p) vector<p>
#define W while
#define For(i,s,x) for(i=s;i<x;i++)
#define Fore(i,s,x) for(i=s;i<=x;i++)
#define FOR(i,x) for(i=0;i<x;i++)
#define Rof(i,s,x) for(i=s;i>=x;i--)
#define all(v) v.begin(),v.end()
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define pb push_back
#define in insert
#define sz size()
#define F first
#define S second
#define nl cout<<"\n"
#define pr(a) cout<<a<<" "
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define mod 1000000007
#define mp make_pair

  int main()
  {
        ll n,m,k,i;
        cin>>n>>m>>k;
        ll a[n],b[m],sum=0;
        for(i=0;i<n;i++)
        cin>>a[i];
        for(i=0;i<m;i++)
        cin>>b[i];
       // queue <ll> num;
        stack <ll> num;
        ll count=0,count1=0,ans=0,l;
        for(i=0;i<n;i++)
        {
            if(sum+a[i]>k)
            break;
            else
            {
                sum=sum+a[i];
                count++;
                num.push(a[i]);
            }
        }
      ans=count;
        for(i=0;i<m;i++)
        {
            if(sum+b[i]<=k)
            {
                sum +=b[i];
                count1++;
                ans=max(ans,count1+count);
                continue;
            }
            else if(!num.empty())
            {
                while(!num.empty())
            if(sum-num.top()+b[i]<=k)
             {   count1++;
                    sum=sum-num.top()+b[i];
                num.pop();
                count--;
                //ans +=count-1+count1+1;
            }
            else
            {
                sum=sum-num.top();
                num.pop();
                count--;
                //pr(count);
            }
            if(sum<=max)
                ans=max(ans,count1+count);
            }
            else
            break;
        }
         cout<<ans;
        nl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:79:19: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator<='
   79 |             if(sum<=max)
      |                ~~~^~~~~
Language: Java


import java.util.*;
public class Main
{
  
  public static void main(String args[]) 
  {
    
    Scanner sc=new Scanner(System.in);
   int len1=sc.nextInt();
   int len2=sc.nextInt();
   long k=sc.nextLong();
   long a1[]=new long[len1+1];
  long a2[]=new long[len2+1];
a1[0]=0;
a2[0]=0;
   for(int i=1;i<=len1;i++)
     a1[i]=sc.nextLong()+a1[i-1];
    for(int i=1;i<=len2;i++)
      a2[i]=sc.nextLong()+a2[i-1];
    int count=0;
   int dec=len2;
   for(int i=0;i<len1 && a1[i]<=k;i++)
{
        while(a1[i]+a2[dec]>=k)
            dec--;
         
        count=Math.max(count,dec+i);
}
System.out.println(count);
 
 
  }
}
import java.util.*;
public class C_Tsundoku
{
  
  public static void main(String args[]) 
  {
    
    Scanner sc=new Scanner(System.in);
   int len1=sc.nextInt();
   int len2=sc.nextInt();
   long k=sc.nextLong();
   long a1[]=new long[len1+1];
  long a2[]=new long[len2+1];
a1[0]=0;
a2[0]=0;
   for(int i=1;i<=len1;i++)
     a1[i]=sc.nextLong()+a1[i-1];
    for(int i=1;i<=len2;i++)
      a2[i]=sc.nextLong()+a2[i-1];
    int count=0;
   int dec=len2;
   for(int i=0;i<len1 && a1[i]<=k;i++)
{
        while(a1[i]+a2[dec]>=k)
            dec--;
         
        count=Math.max(count,dec+i);
}
System.out.println(count);
 
 
  }
}

Compiler output:
Main.java:35: error: class, interface, enum, or record expected
import java.util.*;
^
1 error
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
using namespace std; 

int main() 
{ 
  	int64_t n,m,k; cin>>n>>m>>k; 
	vector<int64_t> arr1; for(int64_t i=0;i<n;i++) {int64_t x; cin>>x; arr1.push_back(x);}
	vector<int64_t> arr2; for(int64_t i=0;i<m;i++) {int64_t x; cin>>x; arr2.push_back(x);}
	// declaring resultant container 
	vector<int64_t> arr3(n+m); 

	// sorting initial containers 
	sort(arr1.begin(), arr1.end()); 
	sort(arr2.begin(), arr2.end()); 
	merge(arr1.begin(), arr1.end(), arr2.begin(), arr2.end(), arr3.begin()); 

    int64_t count{0},i{0},sum{0},flag=INT_MAX;
    sum = accumulate(arr3.begin(),arr3.end(),sum);
    if(k<sum){
        flag=-1;
        while (k>arr3[i])
        {
            k -= arr3[i];
            ++count; ++i;
        } 
    }

    flag == -1 ? cout<<count<<endl : cout<<n+m<<endl;

	return 0; 
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:21:39: error: 'INT_MAX' was not declared in this scope
   21 |     int64_t count{0},i{0},sum{0},flag=INT_MAX;
      |                                       ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <numeric>
  +++ |+#include <climits>
    6 | using namespace std;
Language: C++

#include <iostream>

long main() {
  long n, m, k;
  std::cin >> n >> m >> k;
  long a[n];
  long b[m];
  for (auto&& x : a) std::cin >> x;
  for (auto&& x : b) std::cin >> x;
  long accA = 0, accB = 0;
  long time = 0, book = 0;
  while (accA < n || accB < m) {
    long next;
    if (accB >= m || a[accA] <= b[accB]) {
      next = a[accA];
      accA++;
    } else if (accA >= n || a[accA] > b[accB]) {
      next = b[accB];
      accB++;
    }
    if (time + next > k) break;
    time += next;
    book++;
  }
  std::cout << book << std::endl;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C

#include<stdio.h>
 
int main(void){
  int N,M;
  long K;
  int sum=0;
  scanf("%d%d%d",&N,&M,&K);
  long 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]);
  N--;M--;
  while(A[N]<K||b[M]<K){
    if(A[N]<B[M]){
      K=K-A[N];
      N--;
      sum++;
    }else{
      K=K-B[M];
      M--;
      sum++;
    }
  }
  printf("%d\n",sum);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:17: error: 'b' undeclared (first use in this function)
   12 |   while(A[N]<K||b[M]<K){
      |                 ^
main.c:12:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
 
int main(void){
  int N,M;
  long K;
  int sum=0;
  scanf("%d%d%d",&N,&M,&K);
  long 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]);
  N--;M--;
  while(A[N]<K||b[M]<K){
    if(A[N]<B[M]){
      K=K-A[N];
      N--;
      sum++;
    }else{
      K=K-B[M];
      M--;
      sum++;
    }
  }
  printf("%d\n",sum);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    9 |   for(int i=0,i<N,i++)scanf("%d",&A[i]);
      |                ^
main.c:10:3: error: expected expression before 'for'
   10 |   for(int i=0,i<M,i++)scanf("%d",&B[i]);
      |   ^~~
main.c:11:6: error: expected ')' before ';' token
   11 |   N--;M--;
      |      ^
      |      )
main.c:9:6: note: to match this '('
    9 |   for(int i=0,i<N,i++)scanf("%d",&A[i]);
      |      ^
main.c:25:1: error: expected expression before '}' token
   25 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
int main() {
  int n,m,k; cin >> n >> m >> k;
  int arr[n],brr[m];
  for (int i=0; i<n; i++) cin >> arr[i];
  for (int i=0; i<m; i++) cin >> brr[i];
  for (int i=0,j=0; i<n||j<m; cnt++) {
    if ( i<n && j<m && arr[i] < brr[j] && k-arr[i] >= 0) {
      i++;
    }else if ( i<n && j<m && arr[i] >= brr[j] && k-brr[j] >= 0 ) {
      j++;
    }else if (i < n && k-arr[i] >= 0) {
      i++;
    }else if (j < m && k-brr[j] >= 0) {
      j++;
    }else {
      break;
    }
  }
  cout << cnt << endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:8:31: error: 'cnt' was not declared in this scope; did you mean 'int'?
    8 |   for (int i=0,j=0; i<n||j<m; cnt++) {
      |                               ^~~
      |                               int
a.cc:21:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
   21 |   cout << cnt << endl;
      |           ^~~
      |           int
Language: C++

#include <bits/stdc++.h>

using namespace std;

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

    vector< long long > a( n );
    vector< long long > b( m );

    for( int i = 0; i < n; i++ )
        cin >> a[ i ];
    
    for( int i = 0; i < m; i++ )
        cin >> b[ i ];
    
    for( int i = 1; i < n; i++ )
        a[ i ] += a[ i - 1 ];
    
    for( int i = 1; i < m; i++ )
        b[ i ] += b[ i - 1 ];
    
    int ans = 0, j = m - 1;

    for( int i = 0; i < n; i++ )
    {
        if( a[ i ] > k )
            break;
        
        while( j > 0 && a[ i ] + b[ j ] > k )
            j--;

        ans = max( ans, i + j );       
    }

    if( ans )
        cout << ans + 2 << "\n";
    else
        cout << 0 << "\n";
    return 0;
}#include <bits/stdc++.h>

using namespace std;

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

    vector< long long > a( n );
    vector< long long > b( m );

    for( int i = 0; i < n; i++ )
        cin >> a[ i ];
    
    for( int i = 0; i < m; i++ )
        cin >> b[ i ];
    
    for( int i = 1; i < n; i++ )
        a[ i ] += a[ i - 1 ];
    
    for( int i = 1; i < m; i++ )
        b[ i ] += b[ i - 1 ];
    
    int ans = 0, j = m - 1;

    for( int i = 0; i < n; i++ )
    {
        if( a[ i ] > k )
            break;
        
        while( j > 0 && a[ i ] + b[ j ] > k )
            j--;

        ans = max( ans, i + j );       
    }

    if( ans )
        cout << ans + 2 << "\n";
    else
        cout << 0 << "\n";
    return 0;
}

Compiler output:
a.cc:43:2: error: stray '#' in program
   43 | }#include <bits/stdc++.h>
      |  ^
a.cc:43:3: error: 'include' does not name a type
   43 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:47:5: error: redefinition of 'int main()'
   47 | int main()
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main()
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define mp          make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
// #define vb          vector<bool>
// #define vc          vector<char>
#define vii         vector<pii>
//#define mi          map<int,int>
//#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
// #define ub(x)       upper_bound(x)
// #define lb(x)       lower_bound(x)
#define endl        '\n'
#define file        freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define fastio      ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
// #define N            1e5+5
#define PRIME           1000000007
#define MAX         50000
#define mem0(a)     memset(a,0,sizeof(a))
#define prec        cout<<std::setprecision(9)<<std::fixed
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define pi          3.14159265358979323
int i,j,k;
int power(int x,int y){
    if(y==0)return 1;
    if(y==1)return x;
    if(y&1)return (((power(x,y/2)*power(x,y/2))%PRIME)*x)%PRIME;
    else return (power(x,y/2)*power(x,y/2))%PRIME;
}
void Anon_mouS(){
    int N, M, K;
    cin >> N >> M >> K;
    vector<int> A(N);
    vector<int> B(M);
    for(i=0;i<n;i++) cin >> A[i];
    for(i=0;i<m;i++) cin >> B[i];
 
    int tot = 0;
    for(i=0;i<m;i++) tot += B[i];
 
    int j = M;
    int ans = 0;
    for(i=0;i<=n;i++) {
        while (j > 0 && tot > K) {
            j -= 1;
            tot -= B[j];
        }
        if (tot > K) break;
        ans = max(ans, i+j);
        if (i == N) break;
        tot += A[i];
    }
    cout << ans << endl;
}
 
int32_t main(){
    fastio;
    int q=1;
    // cin>>q;
    // SieveOfEratosthenes();
    while(q--){
        Anon_mouS();
    }
    return 0;   
}

Compiler output:
a.cc: In function 'void Anon_mouS()':
a.cc:41:15: error: 'n' was not declared in this scope
   41 |     for(i=0;i<n;i++) cin >> A[i];
      |               ^
a.cc:42:15: error: 'm' was not declared in this scope
   42 |     for(i=0;i<m;i++) cin >> B[i];
      |               ^
a.cc:45:15: error: 'm' was not declared in this scope
   45 |     for(i=0;i<m;i++) tot += B[i];
      |               ^
a.cc:49:16: error: 'n' was not declared in this scope
   49 |     for(i=0;i<=n;i++) {
      |                ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 2e5 + 5;
typedef long long ll;
ll a[maxn], b[maxn];
int main()
{
	ios::sync_with_stdio(false);
	ll n, m, k;
	int ans = 0;
	cin >> n >> m >> k;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		a[i] += a[i - 1];
	}
	for (int j = 1; j <= m; j++)
	{
		cin >> b[j];
		b[j] += b[j - 1];
	}
	for (int i = 0; i <= n; i++)
	{
		if (k >= a[i])
		{
			ans = max(ans, upper_bound(b + 1, b + m + 1, k - a[i]) - b - 1 + i);
		}
	}
	cout << ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:34: error: no matching function for call to 'max(int&, long int)'
   27 |                         ans = max(ans, upper_bound(b + 1, b + m + 1, k - a[i]) - b - 1 + i);
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:27:34: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   27 |                         ans = max(ans, upper_bound(b + 1, b + m + 1, k - a[i]) - b - 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,
                 from a.cc:2:
/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:27:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   27 |                         ans = max(ans, upper_bound(b + 1, b + m + 1, k - a[i]) - b - 1 + i);
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 2e5 + 5;
typedef long long ll;
ll a[maxn], b[maxn];
int main()
{
	ios::sync_with_stdio(false);
	ll n, m, k;
	int ans = 0;
	cin >> n >> m >> k;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		a[i] += a[i - 1];
	}
	for (int j = 1; j <= m; j++)
	{
		cin >> b[j];
		b[j] += b[j - 1];
	}
	for (int i = 0; i <= n; i++)
	{
		if (k >= a[i])
		{
			ans = max(ans, upper_bound(b + 1, b + m + 1, k - a[i]) - b - 1 + i);
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:34: error: no matching function for call to 'max(int&, long int)'
   27 |                         ans = max(ans, upper_bound(b + 1, b + m + 1, k - a[i]) - b - 1 + i);
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:27:34: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   27 |                         ans = max(ans, upper_bound(b + 1, b + m + 1, k - a[i]) - b - 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,
                 from a.cc:2:
/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:27:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   27 |                         ans = max(ans, upper_bound(b + 1, b + m + 1, k - a[i]) - b - 1 + i);
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C

#include<stdio.h>

int main(void)
{
  int i, j, k, max;
  int N, M, K;
  int A[SIZE], B[SIZE];
  long long a[SIZE+1], b[SIZE+1];
  
  scanf("%d %d %d", &N, &M, &K);
  for ( i=0; i<N; ++i)
    scanf("%d", &A[i]);
  for ( i=0; i<M; ++i)
    scanf("%d", &B[i]);
  max = 0;
  
  /* a[i] (b[i]): A (B) から i 冊読む時間 */
  a[0] = b[0] = 0;
  for ( i=1; i<=N; ++i)
    a[i] = a[i-1] + A[i-1];
  for ( i=1; i<=M; ++i)
    b[i] = b[i-1] + B[i-1];
  
  /* A から i 冊，B から j 冊読む */
  j = M;
  for ( i=0; i<=N; ++i) {
    if ( A[i] > K)
      break;
    while ( a[i]+b[j] > K)
      --j;
    if ( max < i+j)
      max = i+j;
  }
  printf("%d\n", max);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:9: error: 'SIZE' undeclared (first use in this function)
    7 |   int A[SIZE], B[SIZE];
      |         ^~~~
main.c:7: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() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long int n,m,k;
  cin >> n >> m >> k;
  long int a[n],b[m];
  for(int i=0;i<n;i++) {
    cin >> a[i];
  }
  for(int i=0;i<m;i++) {
    cin >> b[i];
  }
  sort(a,a+n);
  sort(b,b+n);
  long int total = 0;
  int i=0,j=0;
  while((i<n || j<m) && total<=k) {
    if(i<n) {
      total+=a[i];
    }
    if(j<m) {
      total+=b[j];
    }
    i++;
    j++:
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:8: error: expected ';' before ':' token
   27 |     j++:
      |        ^
      |        ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long int n,m,k;
  cin >> n >> m >> k;
  long int a[n],b[m];
  for(int i=0;i<n;i++0) {
    cin >> a[i];
  }
  for(int i=0;i<m;i++) {
    cin >> b[i];
  }
  sort(a,a+n);
  sort(b,b+n);
  long int total = 0;
  int i=0,j=0;
  while((i<n || j<m) && total<=k) {
    if(i<n) {
      total+=a[i];
    }
    if(j<m) {
      total+=b[j];
    }
    i++;
    j++:
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:22: error: expected ')' before numeric constant
    9 |   for(int i=0;i<n;i++0) {
      |      ~               ^
      |                      )
a.cc:9:23: error: expected ';' before ')' token
    9 |   for(int i=0;i<n;i++0) {
      |                       ^
      |                       ;
a.cc:27:8: error: expected ';' before ':' token
   27 |     j++:
      |        ^
      |        ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL):
  long int n,m,k;
  cin >> n >> m >> k;
  long int a[n],b[m];
  for(int i=0;i<n;i++) {
    cin >> a[i];
  }
  for(int i=0;i<m;i++) {
    cin >> b[i];
  }
  sort(a,a+n);
  sort(b,b+n);
  long int total = 0;
  int i=0,j=0;
  while((i<n || j<m) && total<=k) {
    if(i<n) {
      total+=a[i];
    }
    if(j<m) {
      total+=b[j];
    }
    i++;
    j++:
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:16: error: expected ';' before ':' token
    5 |   cin.tie(NULL):
      |                ^
      |                ;
a.cc:7:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |   cin >> n >> m >> k;
      |          ^
      |          yn
a.cc:7:15: error: 'm' was not declared in this scope; did you mean 'tm'?
    7 |   cin >> n >> m >> k;
      |               ^
      |               tm
a.cc:7:20: error: 'k' was not declared in this scope
    7 |   cin >> n >> m >> k;
      |                    ^
a.cc:10:12: error: 'a' was not declared in this scope
   10 |     cin >> a[i];
      |            ^
a.cc:13:12: error: 'b' was not declared in this scope
   13 |     cin >> b[i];
      |            ^
a.cc:15:8: error: 'a' was not declared in this scope
   15 |   sort(a,a+n);
      |        ^
a.cc:16:8: error: 'b' was not declared in this scope
   16 |   sort(b,b+n);
      |        ^
a.cc:27:8: error: expected ';' before ':' token
   27 |     j++:
      |        ^
      |        ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL):
  long int n,m,k;
  cin >> n >> m >> k;
  long int a[n],b[m];
  for(int i=0;i<n;i++0) {
    cin >> a[i];
  }
  for(int i=0;i<m;i++) {
    cin >> b[i];
  }
  sort(a,a+n);
  sort(b,b+n);
  long int total = 0;
  int i=0,j=0;
  while((i<n || j<m) && total<=k) {
    if(i<n) {
      total+=a[i];
    }
    if(j<m) {
      total+=b[j];
    }
    i++;
    j++:
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:16: error: expected ';' before ':' token
    5 |   cin.tie(NULL):
      |                ^
      |                ;
a.cc:7:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |   cin >> n >> m >> k;
      |          ^
      |          yn
a.cc:7:15: error: 'm' was not declared in this scope; did you mean 'tm'?
    7 |   cin >> n >> m >> k;
      |               ^
      |               tm
a.cc:7:20: error: 'k' was not declared in this scope
    7 |   cin >> n >> m >> k;
      |                    ^
a.cc:9:22: error: expected ')' before numeric constant
    9 |   for(int i=0;i<n;i++0) {
      |      ~               ^
      |                      )
a.cc:9:23: error: expected ';' before ')' token
    9 |   for(int i=0;i<n;i++0) {
      |                       ^
      |                       ;
a.cc:13:12: error: 'b' was not declared in this scope
   13 |     cin >> b[i];
      |            ^
a.cc:15:8: error: 'a' was not declared in this scope
   15 |   sort(a,a+n);
      |        ^
a.cc:16:8: error: 'b' was not declared in this scope
   16 |   sort(b,b+n);
      |        ^
a.cc:27:8: error: expected ';' before ':' token
   27 |     j++:
      |        ^
      |        ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,k,ans=0,x;
	cin>>n>>m>>k;
	int a[n+5],b[m+5];
	a[0]=0,b[0]=0;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		a[i]=a[i-1]+x;
	}
	for(int i=1;i<=m;i++)
	{
		cin>>x;
		b[i]=b[i-1]+x;
	}
	if(a[n]+b[m]<=k)
	{
		cout<<m+n<<endl;
		return 0;
	}
	for(int i=0;i<=n;i++)
		if(k>=a[i])
			ans=max(ans,upper_bound(b+1,b+m+1,k-a[i])-b-1+i);
	cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:32: error: no matching function for call to 'max(int&, long int)'
   26 |                         ans=max(ans,upper_bound(b+1,b+m+1,k-a[i])-b-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:26:32: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   26 |                         ans=max(ans,upper_bound(b+1,b+m+1,k-a[i])-b-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:26:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   26 |                         ans=max(ans,upper_bound(b+1,b+m+1,k-a[i])-b-1+i);
      |                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,k,ans=0,x;
	cin>>n>>m>>k;
	int a[n+5],b[n+5];
	a[0]=0,b[0]=0;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		a[i]=a[i-1]+x;
	}
	for(int i=1;i<=m;i++)
	{
		cin>>x;
		b[i]=b[i-1]+x;
	}
	if(a[n]+b[n]<=k)
	{
		cout<<m+n<<endl;
		return 0;
	}
	for(int i=0;i<=n;i++)
		if(k>=a[i])
			ans=max(ans,upper_bound(b+1,b+m+1,k-a[i])-b-1+i);
	cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:32: error: no matching function for call to 'max(int&, long int)'
   26 |                         ans=max(ans,upper_bound(b+1,b+m+1,k-a[i])-b-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:26:32: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   26 |                         ans=max(ans,upper_bound(b+1,b+m+1,k-a[i])-b-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:26:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   26 |                         ans=max(ans,upper_bound(b+1,b+m+1,k-a[i])-b-1+i);
      |                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;
#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 


int main() 
{ 
    IOS
    ll n,m,k;
    cin>>n>>m>>k;
    vll a(n);
    ll idx=0,now=0;
    bool flag=false;
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]+now<=k and !flag)
        {
            now+=a[i];
            idx++;
        }
        else
        {
            flag=true;
        }
    }
    ll ans=idx;
    ll ct=idx;

    for(ll i=0;i<m;i++)
    {
        ll x;
        cin>>x;
        now+=x;
        if(now<=k) ct++;

        if(now>k)
        {
            while(now>k and idx=0)
            {
                now-=a[idx-1];
                idx--;
                ct--;
            }
            if(now<=k) ct++;
        }
        ans=max(ans,ct);

    }
    cout<<ans<<endl;


    return 0; 
} 
/*
3 4 730
60 90 120
80 150 80 150
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:50:25: error: lvalue required as left operand of assignment
   50 |             while(now>k and idx=0)
      |                   ~~~~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using ll = longlong;

int main(void){
	int max = 0;
	int n,m;
	ll k;
	cin >> n >> m >> k;
	
	vector<int> a(n,0),b(m,0);
	vector<ll> aa(n,0),bb(m,0);
	
	rep(i,n){
		cin >> a[i];
		aa[i+1] += a[i] + aa[i];
	}
	
	rep(i,m){
		cin >> b[i];
		bb[i+1] += b[i] + bb[i];
	}
	
	int j = M;
	
	rep(i,n+1){
		while(b[j] > k-a[i]){
			if(j<0) break;
			j--;
		}
		if(max<i+j) max=i+j;
	}

	cout << max << endl;
}


Compiler output:
a.cc:5:12: error: 'longlong' does not name a type
    5 | using ll = longlong;
      |            ^~~~~~~~
a.cc: In function 'int main()':
a.cc:10:9: error: 'll' was not declared in this scope
   10 |         ll k;
      |         ^~
a.cc:11:26: error: 'k' was not declared in this scope
   11 |         cin >> n >> m >> k;
      |                          ^
a.cc:14:18: error: template argument 2 is invalid
   14 |         vector<ll> aa(n,0),bb(m,0);
      |                  ^
a.cc:14:26: error: expression list treated as compound expression in initializer [-fpermissive]
   14 |         vector<ll> aa(n,0),bb(m,0);
      |                          ^
a.cc:14:34: error: expression list treated as compound expression in initializer [-fpermissive]
   14 |         vector<ll> aa(n,0),bb(m,0);
      |                                  ^
a.cc:18:19: error: invalid types 'int[int]' for array subscript
   18 |                 aa[i+1] += a[i] + aa[i];
      |                   ^
a.cc:18:37: error: invalid types 'int[int]' for array subscript
   18 |                 aa[i+1] += a[i] + aa[i];
      |                                     ^
a.cc:23:19: error: invalid types 'int[int]' for array subscript
   23 |                 bb[i+1] += b[i] + bb[i];
      |                   ^
a.cc:23:37: error: invalid types 'int[int]' for array subscript
   23 |                 bb[i+1] += b[i] + bb[i];
      |                                     ^
a.cc:26:17: error: 'M' was not declared in this scope
   26 |         int j = M;
      |                 ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using ll longlong;

int main(void){
	int max = 0;
	int n,m;
	ll k;
	cin >> n >> m >> k;
	
	vector<int> a(n,0),b(m,0);
	vector<ll> aa(n,0),bb(m,0);
	
	rep(i,n){
		cin >> a[i];
		aa[i+1] += a[i] + aa[i];
	}
	
	rep(i,m){
		cin >> b[i];
		bb[i+1] += b[i] + bb[i];
	}
	
	int j = M;
	
	rep(i,n+1){
		while(b[j] > k-a[i]){
			if(j<0) break;
			j--;
		}
		if(max<i+j) max=i+j;
	}

	cout << max << endl;
}


Compiler output:
a.cc:5:7: error: expected nested-name-specifier before 'll'
    5 | using ll longlong;
      |       ^~
a.cc: In function 'int main()':
a.cc:10:9: error: 'll' was not declared in this scope
   10 |         ll k;
      |         ^~
a.cc:11:26: error: 'k' was not declared in this scope
   11 |         cin >> n >> m >> k;
      |                          ^
a.cc:14:18: error: template argument 2 is invalid
   14 |         vector<ll> aa(n,0),bb(m,0);
      |                  ^
a.cc:14:26: error: expression list treated as compound expression in initializer [-fpermissive]
   14 |         vector<ll> aa(n,0),bb(m,0);
      |                          ^
a.cc:14:34: error: expression list treated as compound expression in initializer [-fpermissive]
   14 |         vector<ll> aa(n,0),bb(m,0);
      |                                  ^
a.cc:18:19: error: invalid types 'int[int]' for array subscript
   18 |                 aa[i+1] += a[i] + aa[i];
      |                   ^
a.cc:18:37: error: invalid types 'int[int]' for array subscript
   18 |                 aa[i+1] += a[i] + aa[i];
      |                                     ^
a.cc:23:19: error: invalid types 'int[int]' for array subscript
   23 |                 bb[i+1] += b[i] + bb[i];
      |                   ^
a.cc:23:37: error: invalid types 'int[int]' for array subscript
   23 |                 bb[i+1] += b[i] + bb[i];
      |                                     ^
a.cc:26:17: error: 'M' was not declared in this scope
   26 |         int j = M;
      |                 ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <random>
#include <fstream>
#include <set>
#include <map>
#include "HTTPRequest.hpp"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, m, z = 0;
    ll a[200005] = {}, b[200005] = {}, k;
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= m; i++) cin >> b[i];
    for (int i = 1; i <= n; i++) a[i] += a[i - 1];
    for (int i = 1; i <= m; i++) b[i] += b[i - 1];
    for (int i = 0; i <= n; i++) {
        if (a[i] <= k) {
            int l = 0, r = m + 1;
            while (l + 1 < r) {
                int x = (l + r) / 2;
                if (a[i] + b[x] <= k) {
                    l = x;
                } else {
                    r = x;
                }
            }
            z = max(z, i + l);
        }
    }
    cout << z;
}


Compiler output:
a.cc:10:10: fatal error: HTTPRequest.hpp: No such file or directory
   10 | #include "HTTPRequest.hpp"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,m,k,ans,a[100001],b[100001];
int main()
{
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		a[i]=a[i-1]+a[i];
	}
	for(int i=1;i<=m;i++)
	{
		cin>>b[i];
		b[i]=b[i-1]+b[i];
	}
	for(int i=0;i<=n;i++)
		if(k>=a[i])
			ans=max(ans,upper_bound(b+1,b+m+1,k-a[i])-b-1+i);
	cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:32: error: no matching function for call to 'max(int&, long int)'
   19 |                         ans=max(ans,upper_bound(b+1,b+m+1,k-a[i])-b-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:19:32: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   19 |                         ans=max(ans,upper_bound(b+1,b+m+1,k-a[i])-b-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:19:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   19 |                         ans=max(ans,upper_bound(b+1,b+m+1,k-a[i])-b-1+i);
      |                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
     n,m,k;
    cin >> n >> m >> k;
    vector<ll> a(n),b(m);
    cin >> a[0];
    for(int i=1;i<n;i++){
        ll x;
        cin >> x;
        a[i] = a[i-1] + x;
    }
    cin >> b[0];
    for(int i=1;i<m;i++){
        ll x;
        cin >> x;
        b[i] = b[i-1] + x;
    }
    int ans = 0;
    for(int i=0;i<n;i++){
        ll temp = a[i];
        int index = upper_bound(b.begin(),b.end(),k-a[i]) - b.begin();
        if(b[index-1] <= (ll)k-a[i])
          ans = max(ans,i+index+1);
         //cout << index << "\n";
    }
    cout << ans << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:6: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |      n,m,k;
      |      ^
      |      yn
a.cc:6:8: error: 'm' was not declared in this scope; did you mean 'tm'?
    6 |      n,m,k;
      |        ^
      |        tm
a.cc:6:10: error: 'k' was not declared in this scope
    6 |      n,m,k;
      |          ^
Language: C

#include <bits/stdc++.h>

using namespace std;

int A[100002],B[100002];

int main(){
    int t;
    cin >> t;
    while (t--) {
        int n, m ,ms;
        scanf("%d%d%d", &n, &m, &ms);
 
        for(int A_i = 0; A_i < n; A_i++){
            scanf("%d",&A[A_i]);
        }
        for(int B_i = 0; B_i < m; B_i++){
           scanf("%d",&B[B_i]);
        }

        long long sum = 0;
        int x = 0, y = 0;

        while (x < n && sum + A[x] <= ms) {
            sum += A[x++];
        }

        int ans = x;

        while (y < m && x >= 0) {
            sum += B[y++];
            while (sum > ms && x > 0) {
                sum -= A[--x];
            }

            if (sum <= ms && ans < x + y) {
                ans = x + y;
            }
        }

        printf("%d\n",ans);
    }
    return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include<vector>
using namespace std;


//yの要素の中でxよりも小さい値で最大のbを求める
/*
int binary_search(int x,vector<long long> S_B){
    
    int y_size = M;
    cout << y_size << endl;
    int left = 0,right = S_B[y_size - 1];
    cout << left << "  " << right << endl;
    int mid = (left + right)/2;

    while(right - left > 1){
        if(S_B[mid] > x){
            right = mid;
        }
        else{
            left = mid;
        }
        mid = (left + right)/2;
        cout << S_B[mid] << "  " << x << endl;
    }

    cout << mid << endl;

    return mid;
}
*/

int main(){
    int N,M,K;
    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);
    vector<long long> S_A(N+1);
    S_A.at(0) = 0;
    for (int i=1 ; i<N+1 ; i++)
        S_A.at(i) = S_A.at(i-1)+A.at(i-1);
    vector<long long> S_B(M+1);
    S_B.at(0) = 0;
    for (int i=1 ; i<M+1 ; i++)
        S_B.at(i) = S_B.at(i-1)+B.at(i-1);

    /**/
    vector<int> best_j;
    for (int i=0 ; i<N+1 ; i++){
        if (S_A.at(i)>K){
        break;
        }
        /*binary_search*/

        int x = K - S_A.at(i);
        
        int y_size = M;
        int left = 0,right = y_size;
        //cout << left << " " << right << endl;
        int mid = (left + right)/2;

        while(right - left > 1){
            if(S_B[mid] > x){
                right = mid;
            }
            else{
                left = mid;
            }
            mid = (left + right)/2;
        }
        
        best_j.push_back(mid);

        //cout << S_B[mid] << " " << S_A[i] << endl;
        /*
        for (int j=M ; j>=0 ; j--){ 
            if (S_A.at(i)+S_B.at(j) <= K){
                best_j.push_back(j);
                break;
            }
        }
        */
    } 

    int length = best_j.size();
    vector<int> answer(length);
    for (int i=0 ; i<length ; i++)
    answer.at(i) = i+best_j.at(i);
    sort(answer.begin(), answer.end());
    cout << answer.at(length-1) << endl;
}







Compiler output:
a.cc: In function 'int main()':
a.cc:93:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   93 |     sort(answer.begin(), answer.end());
      |     ^~~~
      |     short
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(String[] args){
  	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int K = sc.nextInt();
    int[] A = new int[N];
    int[] B = new int[M];
    int book = 2;
    for(int i=0;i<N;i++)
      A[i] = sc.nextInt();
    for(int i=0;i<M;i++)
      B[i] = sc.nextInt();
    int i = 0;
    while(A[i] + B[i] <= K){
       A[i] = A[i] + A[i+1];
      if(A[i] + B[i] > k)
        break;
      else
        book++;
      B[i] = B[i] + B[i+1];
      if(A[i] + B[i] > k)
        break;
      else
      	book++;
    }
    System.out.println(book);
  }
}


Compiler output:
Main.java:18: error: cannot find symbol
      if(A[i] + B[i] > k)
                       ^
  symbol:   variable k
  location: class Main
Main.java:23: error: cannot find symbol
      if(A[i] + B[i] > k)
                       ^
  symbol:   variable k
  location: class Main
2 errors
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(String[] args){
  	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int K = sc.nextInt();
    int[] A = new int[N];
    int[] B = new int[M];
    int book = 2;
    for(int i=0;i<N;i++)
      A[i] = sc.nextInt();
    for(int i=0;i<M;i++)
      B[i] = sc.nextInt();
    int j = 0;
      while(A[i] + B[i] <= K){
       	A[i] = A[i]+A[i++];
        if(A[i] + B[i] <= K)
          book++;
        B[i] = B[i]+B[i++];
        book++;
      }
    System.out.println(--book);
  }
}


Compiler output:
Main.java:16: error: cannot find symbol
      while(A[i] + B[i] <= K){
              ^
  symbol:   variable i
  location: class Main
Main.java:16: error: cannot find symbol
      while(A[i] + B[i] <= K){
                     ^
  symbol:   variable i
  location: class Main
Main.java:17: error: cannot find symbol
       	A[i] = A[i]+A[i++];
       	  ^
  symbol:   variable i
  location: class Main
Main.java:17: error: cannot find symbol
       	A[i] = A[i]+A[i++];
       	         ^
  symbol:   variable i
  location: class Main
Main.java:17: error: cannot find symbol
       	A[i] = A[i]+A[i++];
       	              ^
  symbol:   variable i
  location: class Main
Main.java:18: error: cannot find symbol
        if(A[i] + B[i] <= K)
             ^
  symbol:   variable i
  location: class Main
Main.java:18: error: cannot find symbol
        if(A[i] + B[i] <= K)
                    ^
  symbol:   variable i
  location: class Main
Main.java:20: error: cannot find symbol
        B[i] = B[i]+B[i++];
          ^
  symbol:   variable i
  location: class Main
Main.java:20: error: cannot find symbol
        B[i] = B[i]+B[i++];
                 ^
  symbol:   variable i
  location: class Main
Main.java:20: error: cannot find symbol
        B[i] = B[i]+B[i++];
                      ^
  symbol:   variable i
  location: class Main
10 errors
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(String[] args){
  	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int K = sc.nextInt();
    int[] A = new int[N];
    int[] B = new int[M];
    int book = 2;
    for(int i=0;i<N;i++)
      A[i] = sc.nextInt();
    for(int i=0;i<M;i++)
      B[i] = sc.nextInt();
    int j = 0;
      while(A[i] + B[i] <= K){
       	A[i] = A[i]+A[i++];
        if(A[] + B[] <= K)
          book++;
        B[i] = B[i]+B[i++];
        book++;
      }
    System.out.println(book);
  }
}


Compiler output:
Main.java:18: error: '.class' expected
        if(A[] + B[] <= K)
               ^
Main.java:18: error: '.class' expected
        if(A[] + B[] <= K)
                     ^
2 errors