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

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

int main()
{
	int t,n,m;
	cin>>t;
	for(int i=1; i<=t; i++)
	{
		cin>>n>>m;
		long long a[n+1],v=0;
		long long b[n+1];
		for(int i=1; i<=n; i++)
		{
			cin>>a[i];
			a[i]%=m;
		 }
		a[0]=-1; 
		sort(a+1,a+n+1);
		
		memset(b,0LL,sizeof(b));
		for(int i=1; i<=n; i++)
		{
			if(a[i])
		a	{
				if(a[i]==a[i-1])
					b[i]=b[i-1]+m;
				else
					b[i]=m-a[i];
			}
			v=max(b[i],v);
		}
		if(v==0)	cout<<0<<endl;
		else	cout<<v+1<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:24: error: expected ';' before '{' token
   25 |                 a       {
      |                  ^~~~~~~~
      |                        ;
Language: C++

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

typedef long long ll;

int main()
{
    ll n,m,k;
    int res=0;
    cin>>n>>m>>k;
    vector<ll> a(n+1,0),b(m+1,0);
    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];
    }
    
    int j=m;
    
    for (int i=0; i<n; i++)
    {
        if (a[i]>k)
		  break; 
        while (a[i]+b[j]>k)
           j--;
        res=max(res,i+j);
    }
    cout<<res<<endl;
    return 0;
}

Compiler output:
a.cc:1:1: error: stray '##' in program
    1 | ##include <bits/stdc++.h>
      | ^~
a.cc:1:3: error: 'include' does not name a type
    1 | ##include <bits/stdc++.h>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:10:5: error: 'cin' was not declared in this scope
   10 |     cin>>n>>m>>k;
      |     ^~~
a.cc:11:5: error: 'vector' was not declared in this scope
   11 |     vector<ll> a(n+1,0),b(m+1,0);
      |     ^~~~~~
a.cc:11:14: error: expected primary-expression before '>' token
   11 |     vector<ll> a(n+1,0),b(m+1,0);
      |              ^
a.cc:11:16: error: 'a' was not declared in this scope
   11 |     vector<ll> a(n+1,0),b(m+1,0);
      |                ^
a.cc:11:25: error: 'b' was not declared in this scope
   11 |     vector<ll> a(n+1,0),b(m+1,0);
      |                         ^
a.cc:31:13: error: 'max' was not declared in this scope
   31 |         res=max(res,i+j);
      |             ^~~
a.cc:33:5: error: 'cout' was not declared in this scope
   33 |     cout<<res<<endl;
      |     ^~~~
a.cc:33:16: error: 'endl' was not declared in this scope
   33 |     cout<<res<<endl;
      |                ^~~~
Language: C++

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

typedef long long ll;

int main()
{
    ll n,m,k;
    int res=0;
    cin>>n>>m>>k;
    vector<ll> a(n+1,0),b(m+1,0);
    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];
    }
    int j=m;
    for (int i=0; i<=n; i++)
    {
        if (a[i]>k)
		  break; 
        while (a[i]+b[j]>k)
           j--;
        res=max(res,i+j);
    }
    cout<<res<<endl;
    return 0;
}

Compiler output:
a.cc:1:1: error: stray '##' in program
    1 | ##include <bits/stdc++.h>
      | ^~
a.cc:1:3: error: 'include' does not name a type
    1 | ##include <bits/stdc++.h>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:10:5: error: 'cin' was not declared in this scope
   10 |     cin>>n>>m>>k;
      |     ^~~
a.cc:11:5: error: 'vector' was not declared in this scope
   11 |     vector<ll> a(n+1,0),b(m+1,0);
      |     ^~~~~~
a.cc:11:14: error: expected primary-expression before '>' token
   11 |     vector<ll> a(n+1,0),b(m+1,0);
      |              ^
a.cc:11:16: error: 'a' was not declared in this scope
   11 |     vector<ll> a(n+1,0),b(m+1,0);
      |                ^
a.cc:11:25: error: 'b' was not declared in this scope
   11 |     vector<ll> a(n+1,0),b(m+1,0);
      |                         ^
a.cc:29:13: error: 'max' was not declared in this scope
   29 |         res=max(res,i+j);
      |             ^~~
a.cc:31:5: error: 'cout' was not declared in this scope
   31 |     cout<<res<<endl;
      |     ^~~~
a.cc:31:16: error: 'endl' was not declared in this scope
   31 |     cout<<res<<endl;
      |                ^~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    vector<long long >v1;
    vector<long long >v2;
    int n,m;
    long long k;
    cin >> n >> m >> k;
    long long sum  = 0,num;
    for(int i=0;i<n;i++){
        cin >> num ;
        sum+=num;
        v1.push_back(sum);
        //cout << sum << endl;
    }
    sum=0;
    for(int i=0;i<m;i++){
        cin >> num ;
        sum+=num;
        v2.push_back(sum);
    }
    int ans = upper_bound(v2.begin(),v2.end(),k)-v2.begin();
    for(int i=0;i<n;i++){
        //cout << 1+i+(upper_bound(v2.begin(),v2.end(),k-v1[i])-v2.begin()) <<endl;
        if(v1[i]<=k){
            int te = (upper_bound(v2.begin(),v2.end(),k-v1[i])-v2.begin());
            ans = max(ans,1+i+et);
        }
    }
    cout<< ans <<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:31: error: 'et' was not declared in this scope; did you mean 'te'?
   31 |             ans = max(ans,1+i+et);
      |                               ^~
      |                               te
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
    vector<long long >v1;
    vector<long long >v2;
    int n,m,k;
    cin >> n >> m >> k;
    long long sum  = 0,num;
    for(int i=0;i<n;i++){
        cin >> num ;
        sum+=num;
        v1.push_back(sum);
        cout << sum << endl;
    }
    sum=0;
    for(int i=0;i<m;i++){
        cin >> num ;
        sum+=num;
        v2.push_back(sum);
    }
    int ans = upper_bound(v2.begin(),v2.end(),k)-v2.begin();
    for(int i=0;i<n;i++){
        if(v1[i]>=sum){
            ans = max(ans,i+1+upper_bound(v2.begin(),v2.end(),k-v1[i])-v2.begin());
        }
    }
    cout<< ans <<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector<long long >v1;
      |     ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <algorithm>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:7:12: error: expected primary-expression before 'long'
    7 |     vector<long long >v1;
      |            ^~~~
a.cc:8:12: error: expected primary-expression before 'long'
    8 |     vector<long long >v2;
      |            ^~~~
a.cc:15:9: error: 'v1' was not declared in this scope; did you mean '__pstl::execution::v1'?
   15 |         v1.push_back(sum);
      |         ^~
      |         __pstl::execution::v1
In file included from /usr/include/c++/14/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/execution_defs.h:19:18: note: '__pstl::execution::v1' declared here
   19 | inline namespace v1
      |                  ^~
a.cc:22:9: error: 'v2' was not declared in this scope
   22 |         v2.push_back(sum);
      |         ^~
a.cc:24:27: error: 'v2' was not declared in this scope
   24 |     int ans = upper_bound(v2.begin(),v2.end(),k)-v2.begin();
      |                           ^~
a.cc:26:12: error: 'v1' was not declared in this scope; did you mean '__pstl::execution::v1'?
   26 |         if(v1[i]>=sum){
      |            ^~
      |            __pstl::execution::v1
/usr/include/c++/14/pstl/execution_defs.h:19:18: note: '__pstl::execution::v1' declared here
   19 | inline namespace v1
      |                  ^~
Language: C

#include <stdio.h>

int main()
{
  int x;

  scanf ("%d", &x);
  
  printf("%d\n", x + x * x + x * x * x);
  return 0;
  
    int x;

  scanf ("%d", &x);
  
  printf("%d\n", x + x * x + x * x * x);
  return 0;
  
    int x;

  scanf ("%d", &x);
  
  printf("%d\n", x + x * x + x * x * x);
  return 0;
  
  
}

Compiler output:
main.c: In function 'main':
main.c:12:9: error: redeclaration of 'x' with no linkage
   12 |     int x;
      |         ^
main.c:5:7: note: previous declaration of 'x' with type 'int'
    5 |   int x;
      |       ^
main.c:19:9: error: redeclaration of 'x' with no linkage
   19 |     int x;
      |         ^
main.c:12:9: note: previous declaration of 'x' with type 'int'
   12 |     int x;
      |         ^
Language: C++

#include <iostream>
using namespace std;
int main()
{
  	int a,b,m;
  	cin >> a >> b >> m;
  	vector<int> ar;
  	vector<int> arr;
  	for(int i=0;i<a;i++){
    	cin >> ar[i];
    }
  	for(int i=0;i<b;i++){
    	cin >> arr[i];
    }
  	int min = a<b?a:b;
  	int time=0,k=1,c=0;
  	for(int i=0;i<min;i++){
       	if(m>=0 && k){
     		m-=ar[i];
           	k--;
           	c++;
         }
       	if(m>=0 && !k){
     		m-=arr[i];
           	k++;
           	c++;
        }
      	
    }
  	cout << c-1;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'vector' was not declared in this scope
    7 |         vector<int> ar;
      |         ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:7:16: error: expected primary-expression before 'int'
    7 |         vector<int> ar;
      |                ^~~
a.cc:8:16: error: expected primary-expression before 'int'
    8 |         vector<int> arr;
      |                ^~~
a.cc:10:16: error: 'ar' was not declared in this scope; did you mean 'a'?
   10 |         cin >> ar[i];
      |                ^~
      |                a
a.cc:13:16: error: 'arr' was not declared in this scope
   13 |         cin >> arr[i];
      |                ^~~
a.cc:19:20: error: 'ar' was not declared in this scope; did you mean 'a'?
   19 |                 m-=ar[i];
      |                    ^~
      |                    a
a.cc:24:20: error: 'arr' was not declared in this scope
   24 |                 m-=arr[i];
      |                    ^~~
Language: C++

#include <iostream>
using namespace std;
int main()
{
  	int a,b,m;
  	cin >> a >> b >> c;
  	int ar[10000000000],arr[10000000000];
  	for(int i=0;i<a;i++){
    	cin >> ar[i];
    }
  	for(int i=0;i<b;i++){
    	cin >> arr[i];
    }
  	min = a<b?a:b;
  	int time=0,k=1,c=0;
  	for(int i=0;i<min;i++){
      	if(time<=c && k){
    		time += ar[i];
          	k--;
          	c++;
        }
      	if(time<=c && !k){
    		time += arr[i];
          	k++;
          	c++;
        }
      	
    }
  	cout << c-1;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:26: error: 'c' was not declared in this scope
    6 |         cin >> a >> b >> c;
      |                          ^
a.cc:14:21: error: overloaded function with no contextual type information
   14 |         min = a<b?a:b;
      |                     ^
a.cc:16:22: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<'
   16 |         for(int i=0;i<min;i++){
      |                     ~^~~~
Language: C++

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file 
//#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define pb push_back
#define ff first
#define ss second
#define ii insert
#define ld long double
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define ppb pop_back
#define nuenxfiu ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);
#define TT int testcases;cin>>testcases;while(testcases--)
#define mk make_pair
#define MAX ((int)2e9+17)
#define N 200005
#define mod ((int)1e9+7)
#define MOD 1000003
//int fact[1000007]={0};
int fpow(int n, int k, int p = mod) {int r = 1; while(k > 0) {if (k & 1) r = r * n%p; n = n * n%p; k = k >> 1;} return r;}
int expo(int x,int y){ int res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
int sub(int a, int b) {return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b) {return ((a%mod)*(b%mod) + mod)%mod;}
int inv(int x) {return expo(x, mod-2);}
using namespace std;





void solve()
{
	int n,m,k;
	cin>>n>>m>>k;
	
	vector<int>v1(n+1);
	vector<int>v2(m+1);
	
	
	for(int i=1;i<=n;i++)
	cin>>v1[i];
	
	for(int i=1;i<=m;i++)
	cin>>v2[i];
	
	for(int i=2;i<=n;i++)
	v1[i]+=v1[i-1];
	
	for(int i=2;i<=m;i++)
	v2[i]+=v2[i-1];
	
	int ans=0;
	
	int id=m;
	
	for(int i=1;i<=n;i++)
	{
		if(a[i]>k)
		break;
		while(a[i]+b[id]>k)
		id--;
		ans=max(ans,i+id);
	}
	
	cout<<ans<<endl;
	
	
}
signed main()
{
    
	nuenxfiu
	//TT
	solve();
     return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:60:20: error: 'a' was not declared in this scope
   60 |                 if(a[i]>k)
      |                    ^
a.cc:62:23: error: 'a' was not declared in this scope
   62 |                 while(a[i]+b[id]>k)
      |                       ^
a.cc:62:28: error: 'b' was not declared in this scope
   62 |                 while(a[i]+b[id]>k)
      |                            ^
Language: C++

#include<iostream>
#include<stdio.h>
#include<vector>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;

int main(){
    int n,m,k,ans = 0;
    cin >> n >> m >> k;
    vector<int> a(n),b(m);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];

    long long t = 0;
    rep(i,m)t+=b[i];

    int j = m;
    int ans = 0;
    rep(i,n+1){
        while(j > 0 && t > k){
            --j;
            t -= b[j];
        }
        if(t > k)break;
        ans = max(ans,i+j);
        if(i == n)break;
        t += a[i];
    }
    cout  << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: redeclaration of 'int ans'
   18 |     int ans = 0;
      |         ^~~
a.cc:8:15: note: 'int ans' previously declared here
    8 |     int n,m,k,ans = 0;
      |               ^~~
Language: C++

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

int main() {
  int N, M;
  long K;
  vector<long> A, B;
  
  cin >> N >> M >> K;
  
  long input;
  for (int i = 0; i < N; i++) {
    cin >> input;
    A.push_back(input);
  }
  for (int i = 0; i < M; i++) {
    cin >> input;
    B.push_back(input);
  }
  
  int i = 0, j = 0, count = 0;
  while (i < N && j < N) {
    if (A[i] < B[j]) {
      if (A[i] < K) {
        K -= A[i];
        i++;
      } else {
        break
      }
    } else {
      if (B[j] < K) {
        K -= B[j];
        j++;
      } else {
        break
      }
    }
  }
  
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:14: error: expected ';' before '}' token
   29 |         break
      |              ^
      |              ;
   30 |       }
      |       ~       
a.cc:36:14: error: expected ';' before '}' token
   36 |         break
      |              ^
      |              ;
   37 |       }
      |       ~
Language: C++

int N, M, K, A[201010], B[201010];
ll Atot[201010], Btot[201010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> M >> K;
    rep(i, 0, N) cin >> A[i];
    rep(i, 0, M) cin >> B[i];

    Atot[0] = 0;
    rep(i, 0, N) Atot[i + 1] = Atot[i] + A[i];
    Btot[0] = 0;
    rep(i, 0, M) Btot[i + 1] = Btot[i] + B[i];

    int ans = 0;
    int ok = M;
    rep(a, 0, N + 1) {
        while (0 <= ok && K < Atot[a] + Btot[ok]) ok--;
        if(0 <= ok) chmax(ans, a + ok);
    }
    cout << ans << endl;
}

Compiler output:
a.cc:2:1: error: 'll' does not name a type
    2 | ll Atot[201010], Btot[201010];
      | ^~
a.cc: In function 'void _main()':
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin >> N >> M >> K;
      |     ^~~
a.cc:6:9: error: 'i' was not declared in this scope
    6 |     rep(i, 0, N) cin >> A[i];
      |         ^
a.cc:6:5: error: 'rep' was not declared in this scope
    6 |     rep(i, 0, N) cin >> A[i];
      |     ^~~
a.cc:9:5: error: 'Atot' was not declared in this scope
    9 |     Atot[0] = 0;
      |     ^~~~
a.cc:11:5: error: 'Btot' was not declared in this scope
   11 |     Btot[0] = 0;
      |     ^~~~
a.cc:16:9: error: 'a' was not declared in this scope
   16 |     rep(a, 0, N + 1) {
      |         ^
a.cc:20:5: error: 'cout' was not declared in this scope
   20 |     cout << ans << endl;
      |     ^~~~
a.cc:20:20: error: 'endl' was not declared in this scope
   20 |     cout << ans << endl;
      |                    ^~~~
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];
  }
  
  vector<int >prea(n+1,0);
  vector<int >preb(m+1,0);
  
  for(int i=0;i<n;i++)
  {
    prea[i+1]=prea[i]+a[i];
  }
  
  for(int i=0;i<n;i++)
  {
    preb[i+1]=preb[i]+b[i];
  }
  
  int ans=0;
  for(int i=0;i<=n;i++)
  {
    int left = k-prea[i];
    if(left<0)
      continue;
    
    int searchb = lower_bound(preb.begin(),preb.end(),left)-searchb.begin();
    if(searchb>m || a[searchb]>left)
      searchb--;
    
    ans=max(ans,i+searchb);
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:69: error: request for member 'begin' in 'searchb', which is of non-class type 'int'
   40 |     int searchb = lower_bound(preb.begin(),preb.end(),left)-searchb.begin();
      |                                                                     ^~~~~
Language: C

// ABC 172 C問題　なぜ不正解?

#include<stdio.h>

int main(void)
{
    int i=0, count=0, time=0, c_a=0, c_b=0;
    long long int N, M, K;

    scanf("%ld %ld %ld", &N, &M, &K);
    long　long int A[N], B[M], C[N+M];
    
    for(i=0; i<N; i++) {
        scanf("%lld", &A[i]);
    }
    for(i=0; i<M; i++) {
        scanf("%lld", &B[i]);
    }

    for(i=0; i<N+M; i++){
        if(A[c_a] > B[c_b]) {
            C[i] = B[c_b];
            c_b++;
        }  else {
            C[i] = A[c_a];
            c_a++;
        }
    }
    
    for(i=0; i<N+M; i++) {
        time += C[i];
        if(time <= K) {
            count++;
        } else {
            break;
        }
    }

    printf("%d\n", count);

    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:9: error: stray '\343' in program
   11 |     long<U+3000>long int A[N], B[M], C[N+M];
      |         ^~~~~~~~
Language: C++

// Problem : C - Tsundoku
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n=0,m=0,t=0,books=0;
	cin>>n>>m>>t;
	vector<int>a(n);
	vector<int>b(m);
	for(auto &x:a)
	cin>>x;
	for(auto &x:b)
	cin>>x;
	long long hrs=0;
	int x=0,y=0;
	for(int i=0;hrs+a[i]<=t&&i<n;i++)
	{
		hrs=hrs+a[i];
		books++;
		x=i;
	}
	for(int i=0;hrs+b[i]<=t&&i<m;i++)
	{
		hrs=hrs+b[i];
		books++;
		y=i+1;		
	}
	int temp=books;
	while(x>=0)
	{
		hrs=hrs-a[x];
		x--;
		temp--;
		while(y<m&&b[y]+hrs<=t)
		{
			hrs=hrs+b[y];
			y++;
			temp++;
		}
		books=max(temp,books);
	}
	cout<<books<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:26: error: no matching function for call to 'max(int&, long long int&)'
   46 |                 books=max(temp,books);
      |                       ~~~^~~~~~~~~~~~
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:8:
/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:46:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   46 |                 books=max(temp,books);
      |                       ~~~^~~~~~~~~~~~
/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:46:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   46 |                 books=max(temp,books);
      |                       ~~~^~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  queue<int> a,b;
  int n,m,k;
  cin>>n>>m>>k;
  int sum =0;
  for(int i=0;i<n;i++){
    int x;
    cin >> x;
    a.push(x);
  }
  for(int i=0;i<m;i++){
    int x;
    cin >> x;
    b.push(x);
  }
  int c = 0;
  bool ans = false;
  while(!a.empty() && !b.empty()){
    if(sum + min(a.front(),b.front()) > k){
      ans = true;
      break;
    }
      if(a.front()<b.front()){
        sum += a.front();
        a.pop();
      }else{
        sum += b.front();
        b.pop();
      }
      c++;
   }
   if(!ans){
      while(!a.empty()){
        if(sum + a.front()<=k){
          sum += a.front();
          a.pop();
          c++;
        }else{
          break;
        }
      }
        while(!b.empty()){
          if(sum + b.front()<=k){
            sum += b.front();
            b.pop();
            c++;
          }else{
            break;
          }
        }
     }
         cout<<c<;
         return 0;
         }
         


Compiler output:
a.cc: In function 'int main()':
a.cc:54:18: error: expected primary-expression before ';' token
   54 |          cout<<c<;
      |                  ^
Language: C++

//
#include <vector>
#include <set>
#include <array>
#include <iostream>
//
#include <cstdio>
#include <cstdint>

//
int64_t readI()
{
	int64_t v;
	std::cin >> v;
	return v;
}
//
float readF()
{
	float v;
	std::cin >> v;
	return v;
}
//
std::vector<int64_t> readVecI(int64_t N)
{
	std::vector<int64_t> vec;
	for (int64_t i = 0; i < N; ++i)
	{
		int64_t v;
		std::cin >> v;
		vec.push_back(v);
	}
	return vec;
}
//
std::vector<float> readVecF(int64_t N)
{
	std::vector<float> vec;
	for (int64_t i = 0; i < N; ++i)
	{
		float v;
		std::cin >> v;
		vec.push_back(v);
	}
	return vec;
}
//
int main()
{
	auto N = readI();
	auto M = readI();
	auto K = readI();
	auto A = readVecI(N);
	auto B = readVecI(M);
	// Bを累積にする
	std::vector<int64_t> bc;
	bc.push_back(0);
	for (auto& b : B)
	{
		bc.push_back(bc.back() + b);
	}
	// Aを読めるだけ読む
	int64_t total = 0;
	int64_t ai = 0;
	for (ai=0;ai< A.size();++ai)
	{
		total += A[ai];
		if (K < total)
		{
			total -= A[ai];
			--ai;
			break;
		}
	}
	// Aを一冊ずつ減らしていって、読めるBを求める
	int64_t maxCount = ai;
	for (int64_t i=ai;0<=i;--i)
	{
		const int64_t remainTime = K - total;
		auto ite = std::lower_bound(bc.begin(), bc.end(), remainTime);
		if (ite != bc.end())
		{
			const int64_t bcount = std::distance(bc.begin(), ite);
			maxCount = std::max(maxCount, i + bcount);
		}
		else
		{
			maxCount = std::max(maxCount, i);
		}
	}
	//
	maxCount = std::max(maxCount, 0LL);
	printf("%d", maxCount);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:93:28: error: no matching function for call to 'max(int64_t&, long long int)'
   93 |         maxCount = std::max(maxCount, 0LL);
      |                    ~~~~~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:62,
                 from a.cc:2:
/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:93:28: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   93 |         maxCount = std::max(maxCount, 0LL);
      |                    ~~~~~~~~^~~~~~~~~~~~~~~
/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
Language: C++

//
#include <vector>
#include <set>
#include <array>
#include <iostream>
//
#include <cstdio>
#include <cstdint>

//
int32_t readI()
{
	int32_t v;
	std::cin >> v;
	return v;
}
//
float readF()
{
	float v;
	std::cin >> v;
	return v;
}
//
std::vector<int32_t> readVecI(int32_t N)
{
	std::vector<int32_t> vec;
	for (int32_t i = 0; i < N; ++i)
	{
		int32_t v;
		std::cin >> v;
		vec.push_back(v);
	}
	return vec;
}
//
std::vector<float> readVecF(int32_t N)
{
	std::vector<float> vec;
	for (int32_t i = 0; i < N; ++i)
	{
		float v;
		std::cin >> v;
		vec.push_back(v);
	}
	return vec;
}
//
void main()
{
	auto N = readI();
	auto M = readI();
	auto K = readI();
	auto A = readVecI(N);
	auto B = readVecI(M);
	// Bを累積にする
	std::vector<int32_t> bc;
	bc.push_back(0);
	for (auto& b : B)
	{
		bc.push_back(bc.back() + b);
	}
	// Aを読めるだけ読む
	int32_t total = 0;
	int32_t ai = 0;
	for (ai=0;ai< A.size();++ai)
	{
		total += A[ai];
		if (K < total)
		{
			total -= A[ai];
			--ai;
			break;
		}
	}
	// Aを一冊ずつ減らしていって、読めるBを求める
	int32_t maxCount = 0;
	for (int32_t i=ai;0<=i;--i)
	{
		const int32_t remainTime = K - total;
		auto ite = std::lower_bound(bc.begin(), bc.end(), remainTime);
		if (ite != bc.end())
		{
			const int32_t bcount = std::distance(bc.begin(), ite);
			maxCount = std::max(maxCount, i + bcount);
		}
		else
		{
			maxCount = std::max(maxCount, i);
		}
	}
	//
	printf("%d", maxCount);
}

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

#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int *a_heap,*b_heap;

int cal(int a,int b,int t){
    if(cal(a+1,
    
    a_heap[a])
}

int main(){
    int n,m,k,t = 0;
    cin >> n >>m >> k;
    a_heap = new int[n];
    b_heap = new int[m];
    for(int i = 0; i < n;i++){
        cin >> a_heap[i];
    }
    for(int i = 0; i < m;i++){
        cin >> b_heap[i];
    }
    int a=0,b=0,c = 0;
    while(t+min(a_heap[a],b_heap[b]) <= k){
        if(a_heap[a] < b_heap[b]){
            t += a_heap[a];
            cout << a_heap[a]<< endl;
            a++;
        }else if(a_heap[a] > b_heap[b]){
            t += b_heap[b];
            cout << b_heap[b] <<endl;
            b++;
        }else if(a_heap[a] == b_heap[b]){
            if(a_heap[a+1] > b_heap[b+1])
        }
        if(a == n && b == m){
            c++;
            break;
        }
        c++;
    }
    printf("%d",c);
}

Compiler output:
a.cc: In function 'int cal(int, int, int)':
a.cc:8:11: error: too few arguments to function 'int cal(int, int, int)'
    8 |     if(cal(a+1,
      |        ~~~^~~~~
    9 | 
      |            
   10 |     a_heap[a])
      |     ~~~~~~~~~~
a.cc:7:5: note: declared here
    7 | int cal(int a,int b,int t){
      |     ^~~
a.cc:10:15: error: expected ')' before '}' token
   10 |     a_heap[a])
      |               ^
      |               )
   11 | }
      | ~              
a.cc:8:7: note: to match this '('
    8 |     if(cal(a+1,
      |       ^
a.cc:11:1: error: expected primary-expression before '}' token
   11 | }
      | ^
a.cc:11:1: warning: no return statement in function returning non-void [-Wreturn-type]
a.cc: In function 'int main()':
a.cc:36:9: error: expected primary-expression before '}' token
   36 |         }
      |         ^
Language: C++

#include <bits/stdc++.h>


using namespace std;

int main()
{

    int n,m,k;
    int ctn  = 0;

    bool cont = true;

    queue<int> a,b;

    cin>>n>>m>>k;

    int rd = 0;

    for (int i = 0 ; i < n; ++i)
    {
        cin>>rd;
        a.push(rd);
    }

    for(int i = 0 ; i < m ; ++i)
    {
        cin>>rd;
        b.push(rd);
    }

    while(cont == true)
    {
        int aa = a.front();
        int bb = b.front();

        if(aa <= bb && !aa.empty())
        {
            if(k-aa > 0)
            {
                ++ctn;
                k = k - aa;
                a.pop();

            }else
            {
                cont = false;
            }
        }else if(!bb.empty())
        {
            if(k-bb > 0)
            {
                ++ctn;
                k = k - bb;
                b.pop();

            }else
            {
                cont = false;
            }
        }else
        {
            cont = false;
        }
    }

    cout<<ctn<<endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:28: error: request for member 'empty' in 'aa', which is of non-class type 'int'
   37 |         if(aa <= bb && !aa.empty())
      |                            ^~~~~
a.cc:49:22: error: request for member 'empty' in 'bb', which is of non-class type 'int'
   49 |         }else if(!bb.empty())
      |                      ^~~~~
Language: C++

#include<bits/stdc++.h>
#define endl "\n" 
#define pi acos(-1)
#define ll long long 
using namespace std;
void att(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
}
void sirra(){
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif
}
void solve();
int main(){
	att();sirra();
	int q=1;//cin>>q;
	while(q--){
		solve();
	}
}
void solve(){
	ll a,b,t,x,f(0),k(0),pa(0),pb(0);cin>>a>>b>>t;
	int aa[a];
	int ba[b];
	for(int i=0;i<a;i++){
		cin>>aa[i];
	}
	for(int i=0;i<b;i++){
		cin>>ba[i];
	}
	while(true){
		if(pa<a && pb<b){
			if(aa[pa]<ba[pb]){
				f+=aa[pa];pa++;k++;
			}
			else if(aa[pa]>ba[pb]){
				f+=ba[pb];pb++;k++;
			}
			else{
				if(pa<a-1 && pb<b-1){
					if(aa[pa+1]<ab[pb+1]){
						f+=aa[pa];pa++;k++;
					}
					else{
						f+=ba[pb];pb++;k++;
					}
				}
				else{
					f+=ba[pb];pb++;k++;
				}
			}
		}
		else if(pa==a && pb<b){
			f+=ba[pb];pb++;k++;
		}
		else if(pb==b && pa<a){
			f+=aa[pa];pa++;k++;
		}
		else 
			break;
		if(f>=t){
			break;
		}
	}
	if(f>t)
		cout<<k-1;
	else
		cout<<k;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:44:53: error: 'ab' was not declared in this scope; did you mean 'ba'?
   44 |                                         if(aa[pa+1]<ab[pb+1]){
      |                                                     ^~
      |                                                     ba
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;


class Main {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static long timeResult = 0;
    static long countA, countB;
    static long maxNum;

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int M = sc.nextInt();
        long K = sc.nextLong();
        int[] timeTakenA = new int[N];
        int[] timeTakenB = new int[M];

        
        for (int i = 0; i <N; i++){
            timeTakenA[i] = sc.nextInt();
        }

        for (int i = 0; i <N; i++){
            timeTakenB[i] = sc.nextInt();
        }

        for(int i = 0; i < N; i++){
            if(timeResult + timeTakenA[i] > K) break;
            timeResult += (long)timeTakenA[i];
            countA++;
        }

        maxNum = countA;
        for (int i = 0; i <M; i++){
            while(timeResult + timeTakenB[i] > K){
                if(countA == 0) break;
                timeResult -= timeTakenA[countA - 1];
                countA--;
            }

            if(timeResult + timeTakenB[i] > K){
                break;
            }

            timeResult += timeTakenB[i];
            countB++;
            
            if(countA + countB >= maxNum){
                maxNum = countA + countB;
            }
        }
        
        System.out.println(maxNum);

    }


}

Compiler output:
Main.java:41: error: incompatible types: possible lossy conversion from long to int
                timeResult -= timeTakenA[countA - 1];
                                                ^
1 error
Language: C++

#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>

using namespace std;

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

  cin >> N >> M >> K;
  vector<int> N_v(N + 1), M_v(M + 1);
  N_v[0] = 0;
  M_v[0] = 0;
  int x;
  for (int i = 1; i <= N; i++) {
    cin >> x;
    N_v[i] = N_v[i - 1] + x;
  }
  for (int i = 1; i <= M; i++) {
    cin >> x;
    M_v[i] = M_v[i - 1] + x;
  }

  int ans = 0, idx = M;
  for (int i = 0; i <= N && N_v[i] <= K; i++) {
    while (n_V[i] + M_v[idx] > K) {
      idx;
    }
    ans = max(ans, i + idx);
  }
  cout << Count;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:12: error: 'n_V' was not declared in this scope; did you mean 'N_v'?
   30 |     while (n_V[i] + M_v[idx] > K) {
      |            ^~~
      |            N_v
a.cc:35:11: error: 'Count' was not declared in this scope
   35 |   cout << Count;
      |           ^~~~~
Language: C++

#include <cstdio>
#include <algorithm>
#define maxn 200010
using namespace std;
int a[maxn],b[maxn],sum;
int main(){
	int n,m,k,i,j,ans;
	scanf("%d%d%d",&n,&m,&k);
	for(i=1;i<=n;i++)scanf("%d",&a[i]);
	for(i=1;i<=m;i++)scanf("%d",&b[i]);
	i=j=1;
	while(i<=n&&sum+a[i]<=k)sum+=a[i],i++;
	while(j<=m&&sum+b[j]<=k)sum+=b[j],j++;
	i--,j--;
	ans=i+j;
	while(i){
		sum-=a[i],i--;
		j++;
		while(j<=m&&sum+b[j]<=k)sum+=b[j],j++;/
		j--;
		ans=max(ans,i+j);
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:55: error: expected primary-expression before '/' token
   19 |                 while(j<=m&&sum+b[j]<=k)sum+=b[j],j++;/
      |                                                       ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#include<algorithm>

using namespace std;
typedef long long ll;

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

    vector<ll> a(n, 0);
    vector<ll> b(m, 0);

    vector<ll> aSum(n, 0);
    vector<ll> bSum(m, 0);

    REP(i, n){
        cin >> a[i];
        if (i != 0) aSum[i] = aSum[i-1] + a[i];
        else aSum[i] = a[i];
    }
    REP(i, m){
        cin >> b[i];
        if (i != 0) bSum[i] = bSum[i-1] + b[i];
        else bSum[i] = b[i];
    }

    ll maxPage = 0;
    ll maxBooks = 0;

    REP(i, n){
        if (aSum[i] > k) break;
        REPR(j, m-1){
            if (aSum[i] + bSum[j] <= k && aSum[i] + bSum[j] > maxPage) {
                maxPage = aSum[i] + bSum[j];
                maxBooks = i + j + 2;
            }
            if (aSum[i] + bSum[j] > k) break;
        }
    }
    cout << maxBooks << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:46:30: error: expected '}' at end of input
   46 |     cout << maxBooks << endl;
      |                              ^
a.cc:12:12: note: to match this '{'
   12 | int main() {
      |            ^
Language: C++

#include "stdafx.h"
#include <iostream>
#include <string>
#include<vector>
#include <queue>
using namespace std;
int main()
{
	//int a = 0;
	//cin >> a;
	//cout << a + a*a + a*a*a;

	//char duck[50] = {NULL};
	////cin >> duck;
	//char sheet[50] = {0};
	////cin >> sheet;
	////cout << duck[0]== sheet[4];
	//B失敗

	queue<long> A;
	queue<long> B;
	int a, b, c = 0;
	cin >> a >> b >> c;
	for (int i = 0; i < a; i++)
	{
		long dog = 0;
		cin >> dog;
		A.push(dog);
	}
	for (int i = 0; i < b; i++)
	{
		long dog = 0;
		cin >> dog;
		B.push(dog);
	}
	int time = 0;
	int cnt = 0;
	int keya = 0;
	int keyb = 0;
	int u = 0;
	int v = 0;
	while (time <c)
	{
		if (A.empty() != true) {
			u = A.front();
			keya = 1;
		}
		else { keya = 0; }
		if (B.empty() != true) {
			v = B.front();
			keyb = 1;
		}
		else { keyb = 0; }
		if (keya == 1 && u <= v && A.empty() != true)
		{
		 
			if (time + u <= c)
				cnt += 1;
			time += u;
			A.pop();
		}
		else if (keyb == 1 && v <= u && !B.empty())
		{
		 
			if (time + v <= c)
				cnt += 1;
			time += v;
			B.pop();
		}
		else if (keya == 0 && !B.empty())
		{
	 
			if (time + v <= c)
				cnt += 1;
			time += v;
			B.pop();
		}
		else if (keyb == 0 && A.empty() != true) 
		{
 
			if (time + u <= c)
				cnt += 1;
			time += u;
			A.pop();
		}
	}
	cout << cnt;
	return 0;
}

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

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

int main() {
  int N , M , K;
  cin >> N >> M >> K ;
  
  vector<int> vecA(N) ;
  vector<int> vecB(M) ;
  
  for( int i=0 ; i<N ; i++ ){
	cin >> vecA.at(i) ;
  }
  for( int j=0 ; j<M ; j++ ){
    cin >> vecB.at(j) ;
  }
  
  int n = N ;
  int m = M ;
  int count = 0 ;
  
  for( int k=0 ; k<3000 ; k++){
    
    
    if( K > mini( vecA.at(n) , vecB.at(m) ) ){
    	if( vecA.at(n) < vecB.at(m) ){
     	 	K -= vecA.at(n) ;
      		n--;
      		count++;
   	 	}
   		else if( vec.at(n) > vecB.at(m) ){
      		K -= vecB,at(m) ;
      		m--;
      		count++;
    	}
    	else if( vecA.at(n) == vecB.at(m) ){
      		K -= vecA.at(n) ;
      		n--;
      		count++;
    	}
    }
    
    else if( K < mini( vecA.at(n) , vecB.at(m) ) ){
		break;
    }
    
    else if( K == 0 ){
      count++;
      break;
    }
    
    cout << count << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:13: error: 'mini' was not declared in this scope
   25 |     if( K > mini( vecA.at(n) , vecB.at(m) ) ){
      |             ^~~~
a.cc:31:26: error: 'vec' was not declared in this scope; did you mean 'vecB'?
   31 |                 else if( vec.at(n) > vecB.at(m) ){
      |                          ^~~
      |                          vecB
a.cc:32:19: error: no match for 'operator-=' (operand types are 'int' and 'std::vector<int>')
   32 |                 K -= vecB,at(m) ;
      |                 ~~^~~~~~~
a.cc:32:27: error: 'at' was not declared in this scope
   32 |                 K -= vecB,at(m) ;
      |                           ^~
a.cc:53:2: error: expected '}' at end of input
   53 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main() {
  int N , M , K;
  cin >> N >> M >> K ;
  
  vector<int> vecA(N) ;
  vector<int> vecB(M) ;
  
  for( int i=0 ; i<N ; i++ ){
	cin >> vecA.at(i) ;
  }
  for( int j=0 ; j<M ; j++ ){
    cin >> vecB.at(j) ;
  }
  
  for( int k=0 ; k<3000 ; k++){
    int n = N ;
    int m = M ;
    int count = 0 ;
    
    if( K > mini( vecA.at(n) , vecB.at(m) ) ){
    	if( vecA.at(n) < vecB.at(m) ){
     	 	K -= vecA.at(n) ;
      		n--;
      		count++;
   	 	}
   		else if( vec.at(n) > vecB.at(m) ){
      		K -= vecB,at(m) ;
      		m--;
      		count++;
    	}
    	else if( vecA.at(n) == vecB.at(m) ){
      		K -= vecA.at(n) ;
      		n--;
      		count++;
    	}
    }
    
    else if( K < mini( vecA.at(n) , vecB.at(m) ) ){
		break;
    }
    
    else if( K == 0 ){
      count++;
      break;
    }
    
    cout << count << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: 'mini' was not declared in this scope
   23 |     if( K > mini( vecA.at(n) , vecB.at(m) ) ){
      |             ^~~~
a.cc:29:26: error: 'vec' was not declared in this scope; did you mean 'vecB'?
   29 |                 else if( vec.at(n) > vecB.at(m) ){
      |                          ^~~
      |                          vecB
a.cc:30:19: error: no match for 'operator-=' (operand types are 'int' and 'std::vector<int>')
   30 |                 K -= vecB,at(m) ;
      |                 ~~^~~~~~~
a.cc:30:27: error: 'at' was not declared in this scope
   30 |                 K -= vecB,at(m) ;
      |                           ^~
a.cc:51:2: error: expected '}' at end of input
   51 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<vector>

using namespace std;
 
int main(){
  vector<unsigned> v;
  unsigned books = 0;
  unsigned asum = 0;
  unsigned n,m,k;
  cin >> n >> m >> k;
  unsigned a[n],b[m]; 
  for (unsigned i = 0; i < n; i++){
    cin >> a[i]; 
  }
  for (unsigned i = 0; i < m; i++){
    cin >> b[i]; 
  }
  for (int i = 0;a[0] <= k && asum <= k; i++ ){
    int bsum = 0;
    books = 0;
    for (int j = 0;b[0] <= k && bsum <= k -asum; j++){
      books++;
      bsum += b[j];
    }
    v.push_back(books);
    asum += a[i];  
  }
  cout << *max_element(v.begin(), v.end()) << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:12: error: 'max_element' was not declared in this scope
   29 |   cout << *max_element(v.begin(), v.end()) << endl;
      |            ^~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
 
int main(){
  unsigned n,m,k;
  unsigned a[n],b[m];
  unsigned books = 0;
  unsigned asum = 0;
  cin >> n >> m >> k;
  for (unsigned i = 0; i < n; i++){
    cin >> a[i]; 
  }
  for (unsigned i = 0; i < m; i++){
    cin >> b[i]; 
  }
  for (int i = 0;a[0] <= K && asum <= K; i++ ){
    int bsum = 0;
    for (int j = 0;b[0] <= K && bsum <= K -asum; j++){
      books++;
      bsum += b[j];
    }
    asum += a[i];  
  }
  cout << books << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:26: error: 'K' was not declared in this scope
   16 |   for (int i = 0;a[0] <= K && asum <= K; i++ ){
      |                          ^
Language: C++

#include<iostream>
using namespace std;
 
int main(){
  unsigned n,m,k;
  unsigned a[n],b[m];
  unsigned books;
  unsigned asum = 0;
  cin >> n >> m >> k;
  for (auto i = 0; i < n; i++){
    cin >> a[i]; 
  }
  for (auto i = 0; i < m; i++){
    cin >> b[i]; 
  }
  for (int i = 0;a[0] <= K, asum <= K; i++ ){
    int bsum = 0;
    for (int j = 0;b[0] <= K, bsum <= K -asum; j++){
      books++;
      bsum += b[j];
    }
    asum += a[i];  
  }
  cout << books << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:26: error: 'K' was not declared in this scope
   16 |   for (int i = 0;a[0] <= K, asum <= K; i++ ){
      |                          ^
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: 'j' was not declared in this scope
   20 |     while(b[j]>=a[i]+k)j-=k;
      |             ^
a.cc:21:19: error: 'j' was not declared in this scope
   21 |     ans=max(ans,i+j);
      |                   ^
Language: Java

import java.util.*;
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];
	long a[]= new long[N+1];
	long b[]= new long[M+1];
	a[0]=0;
	b[0]=0;

	int best[]= new int[N+1];
	
	for(int i=0; i<N; i++){
	    A[i]= sc.nextInt();
	    a[i+1]=a[i]+A[i];
	}
	for(int i=0; i<M; i++){
	    B[i]=sc.nextInt();
	    b[i+1]=b[i]+B[i];
	}

	for(int i =0; i<N+1; i++){
	    if(a[i]>K){
		break;
	    }
	    int j=M;
      long dif=K-a[i]
	    while(dif<b[j]){
		j=j-1;
	    }
	    best[i]=i+j;
	}

	int max=best[0];
	for(int i=0; i<best.length; i++){
	    if(max<best[i]){
		max=best[i];
	    }
	}
	System.out.println(max);
	
    }
}



Compiler output:
Main.java:33: error: ';' expected
      long dif=K-a[i]
                     ^
1 error
Language: C++

#include<bits/stdc++.h>
#define ll long long int 
using namespace std;
 int main()
 {
   ll n,m,total,ans=0;
   cin>>n>>m>>total;
   ll a[n],b[m];
   for(ll i =0;i<n;i++)
     cin>>a[i];
   for(ll i=0;i<m;i++)
	cin>>b[i];
   ll time=0;
   bool flag=true;
   for(ll i=0;j=0;i<n && j<m&& time<total;)
   {
     if(a[i]<b[j] || j==m )
     {
       if(time+a[i]>total)
        break;
       else
         time=time+a[i],ans++,i++;
     }
      else if(b[j]<=a[i] || i==n )
       {
         if(time+b[j]>total)
           break;
        else
          time+=b[j],ans++,j++;
       }
   }
	cout<<ans<<endl;
   return 0;
 }


Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: 'j' was not declared in this scope
   15 |    for(ll i=0;j=0;i<n && j<m&& time<total;)
      |               ^
a.cc:15:42: error: expected ')' before ';' token
   15 |    for(ll i=0;j=0;i<n && j<m&& time<total;)
      |       ~                                  ^
      |                                          )
a.cc:15:43: error: expected primary-expression before ')' token
   15 |    for(ll i=0;j=0;i<n && j<m&& time<total;)
      |                                           ^
Language: C++

#include<bits/stdc++.h>
#define ll long long int 
using namespace std;
 int main()
 {
   ll n,m,total,ans=0;
   cin>>n>>m>>total;
   ll a[n],b[m];
   for(ll i =0;i<n;i++)
     cin>>a[i];
   for(ll i=0;i<m;i++)
	cin>>b[i];
   ll time=0;
   for(ll i=0;j=0;i<n && j<m&& time<total;)
   {
     if(a[i]<b[j])
       i++,ans++,time+=a[i];
     else
       j++,ans++,time+=b[i];
   }
	cout<<ans<<endl;
   return 0;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: 'j' was not declared in this scope
   14 |    for(ll i=0;j=0;i<n && j<m&& time<total;)
      |               ^
a.cc:14:42: error: expected ')' before ';' token
   14 |    for(ll i=0;j=0;i<n && j<m&& time<total;)
      |       ~                                  ^
      |                                          )
a.cc:14:43: error: expected primary-expression before ')' token
   14 |    for(ll i=0;j=0;i<n && j<m&& time<total;)
      |                                           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n, m, k, i, j, cnt, a[200001], b[200001]; long long sum;
int main ()
{
    cin >> n >> m >> k;
    for(i = 1; i <= n; i++) cin >> a[i];
    for(i = 1; i <= m; i++) cin >> b[i];
    for(i = 1, j = 1; i <= n, j <= m;)
    {
        if(i <= n and j <= m and a[i] <= b[j] and sum + a[i] <= k)
        {
            sum += a[i];
        }
        else if(i <= n and j <= m and a[i] > b[j] and sum + b[j] <= k)
        {
            sum += b[j];
        }
        else if(i <= n sum + a[i] <= k)
        {
            sum += a[i];
        }
        else if(j <= m and sum + b[j] <= k)
        {
            sum += b[j];
        }
        else break;
        cnt++;
    }
    cout << cnt << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:23: error: expected ')' before 'sum'
   19 |         else if(i <= n sum + a[i] <= k)
      |                ~      ^~~~
      |                       )