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

#include<stdio.h>

#define N 200020

//output is int  not float
//1000000000?

int a[N]={0};
int b[N]={0};
int flag=0;

int more(int a, int b){
if(a>b){
  flag=1;
  return a; 
}
  else{
    
    flag=2;
    return b;
  }
}

int main(){
int n,m,k; // number of books on a desk and b desk k is min for reading books
  //a1 ,a2 ...
  //b1, b2 ...   time for reading a book
int i=0,j=0;//ia=0,ib=0;  
//int flag=0;  
  int work=0;// currently reading book time  
  int total=0;
  
 for(int k=0; k<200020; k++){//for banpei  gardner
 a[k]=1000000000;
 b[k]=1000000000;
 } 
  
  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]);

 i=0;
  
 while( k<work || total==n+m  ){
 //book live out libraly out ? complete
   // not yet 
 work=more(a[i],b[j]);
 if( flag==1 ) i++;
 else if( flag==2 )j++
 
   if( k-work>=0 ) total++;
   k-=work;
   
 } 
  
  
  //use stack and compare?// not stack // think simply?
  // by greeding way is ok?
  printf("%d\n",total);

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:51:23: error: expected ';' before 'if'
   51 |  else if( flag==2 )j++
      |                       ^
      |                       ;
   52 | 
   53 |    if( k-work>=0 ) total++;
      |    ~~
Language: C++

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

int main() {
  int N, M, max = 0, count = 0;
  int64_t T, K;
  cin >> N >> M >> K;
  vector<int64_t> A(N), B(M);
  for (int &x : A) {
    cin >> x;
  }
  for (int &x : B) {
    cin >> x;
  }
  for (int i = 0; i < N; i++) {
    count = 0, T = 0;
    for (int j = 0; j < i + 1; j++) {
      T += A.at(j);
      count++;
      if (T > K) goto swap;
    }
    if (false) {
      swap:
      continue;
    }
    if (T > K) continue;
    for (int j = 0; j < M; j++) {
      T += B.at(j);
      count++;
      if (T > K) {
        count--;
        break;
      }
    }
    if (count > max) {
      max = count;
    }
  }
  cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long int'
    9 |   for (int &x : A) {
      |                 ^
a.cc:12:17: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long int'
   12 |   for (int &x : B) {
      |                 ^
Language: Java

import java.util.*;
import java.util.Scanner;
import java.io.*;
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
 
public class at172c
{
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
    public static void main (String[] args) 
	{
        //code by sushant kumar
        FastReader in=new FastReader();
        int n=in.nextInt();
        int m=in.nextInt();
        long k=in.nextLong();
        long arr1[]=new long[n+1];
        long arr2[]=new long[m+1];
        long a[]=new long[n+1];
        long b[]=new long[m+1];

        for(int i=1;i<n+1;i++)
        {
            arr1[i]=in.nextLong();
            a[i]=arr1[i]+a[i-1];
        }
        for(int i=1;i<m+1;i++)
        {
            arr2[i]=in.nextLong();
            b[i]=arr2[i]+b[i-1];
        }
        long ans=0; int j=m;
        for(int i=1;i<n+1;i++)
        {
            if(a[i]>k)
                break;
            while(a[i]+b[j]>k)
                j--;
            ans=Math.max(ans,i+j);
        }
        System.out.println(ans);

    

       
    }
}

Compiler output:
Main.java:10: error: class at172c is public, should be declared in a file named at172c.java
public class at172c
       ^
1 error
Language: C

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

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, k, p, sum=0;
  cin>>n>>m>>k;
  vector<int> v, w;
  for(int i=0; i<n; i++){
    cin>>p;v.push_back(p);
  }
  for(int i=0; i<m; i++){
    cin>>p;w.push_back(p);
  }
  int indxa = 0, indxb = 0, cnt = 0;
  while(sum<=k||(indxa==v.size()&&indxb==w.size())){
    if(v[indxa]<w[indxb]||indxb==w.size()){
      sum+=v[indxa];
      indxa++;
    }
    else{
      sum+=w[indxb];
      indxb++;
    }
    cnt++;
  }
  cout<<cnt-1;
}


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

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

int main(){
	long long n,m,k
	cin >> n >> m >> k;
	long long a[n+1],b[m+1];
	long long sa[n+1],sb[m+1];
	sa[0] = 0; sb[0] = 0;
	for(int i=0;i<n;i++){
		cin >> a[i+1];
		sa[i+1] = a[i+1] + sa[i];
	}
	for(int i=0;i<m;i++){
		cin >> b[i+1];
		sb[i+1] = b[i+1] + sb[i];
	}
	int ans = 0,kari = 0,end = m;
	for(int i=0;i<=n;i++){
		for(int j=end;j>=0;j--){
			if(sa[i] + sb[j] > k){
				continue;
			}else{
				end = j;
				kari = i + j;
				ans = max(ans,kari);
				break;
			}
		}
	}
	cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: expected initializer before 'cin'
    6 |         cin >> n >> m >> k;
      |         ^~~
a.cc:21:44: error: 'k' was not declared in this scope
   21 |                         if(sa[i] + sb[j] > k){
      |                                            ^
Language: C

#include<stdio.h>

int main(void)
{
  char nmk[256];
  long int n,m,k,i,j,time=0,count=0,a[200000],b[200000];
  
  fgets(nmk,sizeof(nmk),stdin);
  sscanf(nmk,"%ld %ld %ld",&n,&m,&k);
  
  for(i=0;i<n;i++)
  {
    scanf("%ld",&a[i]);
  }
  
  for(i=0;i<m;i++)
  {
    scanf("%ld",&b[i]);
  }
  i=0;
  j=0;
  
  do
  {
    if(a[i]>b[j])
    {
      time+=b[j];
      j++;
    }else{
      time+=a[i];
      i++;
    }
    count++;
  }while(time<=k)
  
  printf("%ld",count);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:34:18: error: expected ';' before 'printf'
   34 |   }while(time<=k)
      |                  ^
      |                  ;
   35 | 
   36 |   printf("%ld",count);
      |   ~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
    int n,m,k;
    cin >> n >> m >> k;
    int A[n]={};
    for(int i=0;i<n;i++){
        cin >> A[i];
    }
    int B[m]={};
    for(int i=0;i<n;i++){
        cin >> B[i];
    }
    longlong 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:16:5: error: 'longlong' was not declared in this scope
   16 |     longlong t = 0;
      |     ^~~~~~~~
a.cc:17:14: error: 't' was not declared in this scope
   17 |     rep(i,m) t += B[i];
      |              ^
a.cc:22:23: error: 't' was not declared in this scope
   22 |         while(j > 0&& t > k){
      |                       ^
a.cc:26:12: error: 't' was not declared in this scope
   26 |         if(t > k){
      |            ^
a.cc:33:9: error: 't' was not declared in this scope
   33 |         t += A[i];
      |         ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
    int n,m,k;
    cin >> n >> m >> k;
    int A[n]={};
    for(int i=0;i<n;i++){
        cin >> A[i];
    }
    int B[m]={};
    for(int i=0;i<n;i++){
        cin >> B[i];
    }
    ll 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:16:5: error: 'll' was not declared in this scope
   16 |     ll t = 0;
      |     ^~
a.cc:17:14: error: 't' was not declared in this scope
   17 |     rep(i,m) t += B[i];
      |              ^
a.cc:22:23: error: 't' was not declared in this scope
   22 |         while(j > 0&& t > k){
      |                       ^
a.cc:26:12: error: 't' was not declared in this scope
   26 |         if(t > k){
      |            ^
a.cc:33:9: error: 't' was not declared in this scope
   33 |         t += A[i];
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+1000;
ll a[N],b[N];
int n,m;
ll k;
int main()
{
	cin>>n>>m>>k;
	ll ans=0;
	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(k>=a[i]) 
		{
			ans=max(ans,upper_bound(b+1,b+1+m,k-a[i])-b-1+i);
		 } 
	}
	cout<<ans<<endl;
}

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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=4e5+1000;
ll a[N],b[N];
int n,m;
ll k;
int main()
{
	cin>>n>>m>>k;
	ll ans=0;
	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(k>=a[i]) 
		{
			ans=max(ans,upper_bound(b+1,b+1+m,k-a[i])-b-1+i);
		 } 
	}
	cout<<ans<<endl;
}

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

#include <bits/stdc++.h>
#define MAXN 200010
using namespace std;
long long n,m,k;
long long a[MAXN],b[MAXN];

int main(){
	cin>>n>>m>>k;
	long long ans=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];
	}
	for(int i=0;i<=n;i++){
		if(k>=a[i])ans=max(ans,upper_bound(b+1,b+1+m,k-a[i])-b-1+i);
	}
	cout<<ans;
	return 0;
}

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

#include<iostream>
using namespace std;
typedef long long int int64;
int64 total_time = 0;
int64 latest_a = 0;	//机Aの一番上にある本のインデックス
int64 latest_b = 0;	//机Bの一番上にある本のインデックス
int64 tmp_a = 0;		//机Aの仮に参照している本のインデックス
int64 tmp_b = 0;		//机Bの仮に参照している本のインデックス
 
int check(int64 A, int64 B);
 
int main()
{
	int64 N,M,K;
  	
  	cin>>N>>M>>K;
  	
  	int64 A[N],B[M];
	int64 loop;
  	for(loop = 0; loop < N; loop++)
    {
      cin>>A[loop];
    }
  	for(loop = 0; loop < M; loop++)
    {
      cin>>B[loop];
    }
  	
  	//int ret;
  	int64 total_cnt = 0;
  
	while(1)
  	{
    	check(A[tmp_a], B[tmp_b]);
      	total_cnt++;
      	if((tmp_a == M)||(tmp_b == N))
        {
          break;
        }
      	if(K >= total_time)
        {
          total_cnt -=1;
          break;
        }
    }
 	cout<<total_cnt<<endl;
  
	return 0; 
}

Compiler output:
/usr/bin/ld: /tmp/ccAmQAbb.o: in function `main':
a.cc:(.text+0x180): undefined reference to `check(long long, long long)'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll=long long;
using P=pair<int,int>;
 
int main(){
 
  int N,M,K;
  cin>>N>>M>>K;
  int A[N+1];
  int B[M+1];
  rep(i,N)cin>>A[i];
  rep(i,M)cin>>B[i];

  int ai=0,bi=0;
  A[N]=INFTY;
  B[M]=INFTY;
  int sum=0;
  int cnt=0;
  int m;
  while(1){
    if(cnt==K)break;
    if(ai<N&&bi<M) m=min(A[ai],B[bi]);
    else if(ai<N)m=A[ai];
    else m=B[bi];
    if(m==A[ai])ai++;
    else bi++;
    sum+=m;
    cout<<m<<endl;
    if(sum>K)break;
    cnt++;
  }
  cout<<cnt<<endl;
  
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:8: error: 'INFTY' was not declared in this scope
   17 |   A[N]=INFTY;
      |        ^~~~~
Language: C++

#include<iostream>
using namespace std;
long int total_time = 0;
long int latest_a = 0;
long int latest_b = 0;

int check(A,i,B,j);

int main()
{
	long int N,M,K;
  	
  	cin>>N>>M>>K;
  	
  	long int A[N],B[M];
	long int loop;
  	for(loop = 0; loop < N; loop++)
    {
      cin>>A[loop];
    }
  	for(loop = 0; loop < M; loop++)
    {
      cin>>B[loop];
    }
  	
 	int ret;
  	long int tmp_a = 0;
  	long int tmp_b = 0;
  	long int total_cnt = 0;
  
	while(1)
  	{
    	ret = check(A[tmp_a],tmp_a,B[tmp_b],tmp_b);
      	if((tmp_a == M)||(tmp_b == N)||(total_time >= K))
        {
          break;
        }
      	total_cnt++;
      	tmp_a++;
      	tmp_b++;
    }
 	cout<<total_cnt<<endl;
  
	return 0; 
}

int check(A,i,B,j)
{
  if(A>B)
  {
    total_time += B;   
    latest_b = j + 1;
    return 0;
  }
  else if(A<B)
  {
    total_time += A;
    latest_a = i + 1;
    return 0;
  }
  else
  {
    total_time += A;
    return 1;
  }
}
    
  


Compiler output:
a.cc:7:11: error: 'A' was not declared in this scope
    7 | int check(A,i,B,j);
      |           ^
a.cc:7:13: error: 'i' was not declared in this scope
    7 | int check(A,i,B,j);
      |             ^
a.cc:7:15: error: 'B' was not declared in this scope
    7 | int check(A,i,B,j);
      |               ^
a.cc:7:17: error: 'j' was not declared in this scope
    7 | int check(A,i,B,j);
      |                 ^
a.cc:7:18: error: expression list treated as compound expression in initializer [-fpermissive]
    7 | int check(A,i,B,j);
      |                  ^
a.cc: In function 'int main()':
a.cc:33:20: error: 'check' cannot be used as a function
   33 |         ret = check(A[tmp_a],tmp_a,B[tmp_b],tmp_b);
      |               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: At global scope:
a.cc:47:5: error: redefinition of 'int check'
   47 | int check(A,i,B,j)
      |     ^~~~~
a.cc:7:5: note: 'int check' previously defined here
    7 | int check(A,i,B,j);
      |     ^~~~~
a.cc:47:11: error: 'A' was not declared in this scope
   47 | int check(A,i,B,j)
      |           ^
a.cc:47:13: error: 'i' was not declared in this scope
   47 | int check(A,i,B,j)
      |             ^
a.cc:47:15: error: 'B' was not declared in this scope
   47 | int check(A,i,B,j)
      |               ^
a.cc:47:17: error: 'j' was not declared in this scope
   47 | int check(A,i,B,j)
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, m, k;
    cin >> n >> m >> k;
    int count = 0;
    stack<int> s;
    while (n--)
    {
        int a;
        cin >> a;
        s.push(a);
    }
    stack<int> p;
    while (m--)
    {
        int b;
        cin >> b;
        p.push(b);
    }

    while (k >= 0)
    {
        if (s.top() > p.top()])
        {
            k = k - p.top();
            count++;
        }
        else
        {
            k = k - s.top();
            count++;
        }
    }
    cout << count - 1;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:30: error: expected ')' before ']' token
   25 |         if (s.top() > p.top()])
      |            ~                 ^
      |                              )
a.cc:25:30: error: expected primary-expression before ']' token
Language: C

#include <stdio.h>

int main(){
    int n,m,k;
    scanf("%d%d%d",&n,&m,&k);
    int a[200010]={0},b[200010]{0};
    for(int i=0;i<n;i++) scanf("%d",&a[i]);
    for(int i=0;i<m;i++) scanf("%d",&b[i]);
    int count_a=0;
    int time_a=0;
    while(a[count_a]!=0){
        time_a+=a[count_a];
        if(time_a>k) break;
        count_a++;
    }

    int count_max=0;
    for(int i=0;i==0||i<count_a;i++){
        int count=0;
        int time=0;
        for(int j=0;j<=i;j++){
            time+=a[j];
            count++;
        }
        int j=0;
        while(b[j]!=0){
            time+=b[j];
            if(time>k) break;
            count++;
            j++;
        }
        if(count>count_max){
            count_max=count;
        }
    }
    printf("%d",count_max);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:32: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    6 |     int a[200010]={0},b[200010]{0};
      |                                ^
main.c:8:38: error: 'b' undeclared (first use in this function)
    8 |     for(int i=0;i<m;i++) scanf("%d",&b[i]);
      |                                      ^
main.c:8:38: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

const main = args =>{
  const [N, M, K] = split_string(args[0]);
  const A = split_string(args[1]);
  const B = split_string(args[2]);
  
  let A_i=0, B_i=0, res=0, count=0;
  while(ture){
  	if(A[A_i]<B[B_i]){
		res += A[A_i];
      	if(res>K){
        	console.log(count);
          	return;
        }
      	A_i++;
    }else{
    	res += B[B_i];
      	if(res>K){
        	console.log(count);
          	return;
        }
      	B_i++;
    }
    count++;
  }
}

const split_string = s => {
  return s.split(' ').map(Number);
}
 
main( require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n") );
 
 
 


Compiler output:
a.cc:1:7: error: 'main' does not name a type
    1 | const main = args =>{
      |       ^~~~
a.cc:27:7: error: 'split_string' does not name a type
   27 | const split_string = s => {
      |       ^~~~~~~~~~~~
a.cc:31:5: error: expected constructor, destructor, or type conversion before '(' token
   31 | main( require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n") );
      |     ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  ll N, M, K; cin >> N >> M >> K;
  vector<ll> A(N); rep(i,N) cin >> A[i];
  vector<ll> B(M); rep(i,M) cin >> B[i];
  vector<ll> sa(N+1,0);
  rep(i,N) sa[i+1] = sa[i] + A[i];
  vector<ll> sb(M+1,0);
  rep(i,M) sb[i+1] = sb[i] + B[i];
  ll ans = 0;
  rep(i,N+1){
    ll t = sa[i];
    if(t>K) continue;
    ll lft = K-t;

    chmax(ans,i-1+upper_bound(all(sb), lft) - sb.begin());
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:10: error: no matching function for call to 'chmax(ll&, __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type)'
   44 |     chmax(ans,i-1+upper_bound(all(sb), lft) - sb.begin());
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:25:23: note: candidate: 'template<class T> bool chmax(T&, const T&)'
   25 | template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
      |                       ^~~~~
a.cc:25:23: note:   template argument deduction/substitution failed:
a.cc:44:10: note:   deduced conflicting types for parameter 'const T' ('long long int' and '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type' {aka 'long int'})
   44 |     chmax(ans,i-1+upper_bound(all(sb), lft) - sb.begin());
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

#define ll long long
#define ar array

const int mxN=2e5;
int n, m;
ll k, a[mxN+1], b[mxN+1];

int main() {
	ios::sync_wif_stdio(0);
	cin.tie(0);

	cin >> n >> m >> k;
	for(int me=0; me<n; ++me) {
		cin >> a[me+1];
		a[me+1]+=a[me];
	}
	for(int me=0; me<m; ++me) {
		cin >> b[me+1];
		b[me+1]+=b[me];
	}
	int ans=0;
	for(int me=0, j=m; me<=n; ++me) {
		if(a[me]>k)
			break;
		while(a[me]+b[j]>k)
			--j;
		ans=max(me+j, ans);
	}
	cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: 'sync_wif_stdio' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
   12 |         ios::sync_wif_stdio(0);
      |              ^~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long  long
#define double long double
int t,n,m,k,a[200005],pnt,cnt,b[200005],ans;
int bs(int b[],int l,int r,int s)
{
    int ls=0;
    while(1)
    {
        if(b[(l+r)/2]<=s)
        {
            l+=(r-l+1)/2;
            ls=l;
        }
        else
        {
            r-=(r-l+1)/2;
        }
        if(r-l==1)
        {
            if(b[r]<=s && b[l]<=s) return (b[l]>=b[r] ? l:r);
            else if(b[r]>s && b[l]>s) return ls;
            return (b[l]<=b[r] ? l:r);
        }
    }
    return ls;
}
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    t=1;
  //  cin>>t;
    while(t--)
    {
        cin>>n>>m>>k;
        a[0]=0;b[0]=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];
        }
        for(int i=0;i<=n;i++)
        {
            if(a[i]>k) break;
            ans=max(i+bs(b,1,m,k-a[i]),ans);
        }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:2: error: expected '}' at end of input
   51 | }
      |  ^
a.cc:30:1: note: to match this '{'
   30 | {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M, K;
  cin >> N >> M >> K;
  vector<int> Abook(N); //Aの本棚の本を読む時間
  vector<int> Bbook(M); //Bの本棚の本を読む時間
  for (int i = 0; i < N; i++) {
    cin >> Abook[i];
  }
  for (int i = 0; i < M; i++) {
    cin >> Bbook[i];
  }
  int time = 0;
  //Bの本をすべて読んだと仮定して、Bの本をしたから減らしつつAの本を追加して最大値を見る（尺取り法）
  for (int i = 0; i < M; i++) {
    time += Bbook[i];
  }
  int j = M;
  int ans = 0;
  for (int i = 0; i < N + 1; i++) {   
    while (j > 0 && time > K) { // Bの本が尽きず、時間が超過している場合
      j--; 
      time -= Bbook[j]; //Bの残っている一番下の本を諦める
    }
    if (time > K) {
      break;
    } //時間が足りないのでもう一周
    ans = max(ans, i + j); //一応0冊の場合を考慮
    if (i == N) {
      break;
    } //Aの本が尽きたのでもう一周
    time += A[i]; //時間が余ってるのでAの本を足す
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:13: error: 'A' was not declared in this scope
   33 |     time += A[i]; //時間が余ってるのでAの本を足す
      |             ^
Language: C++

int main(){
    int n,m,k;
    cin >> n >> m >> k;
    vector<int> A(n), B(m), a(n+1), b(m+1);
    for(int i = 0; i < n; i++) {
        cin >> A[i];
        a[i+1] = a[i] + A[i];
    }
    for(int j = 0; j < m; j++){
         cin >> B[j];
         b[j+1] = b[j] + B[j]; 
    }
    int i = 0, j = m, ans = 0;
    while(i++ <= n){
        if(a[i] > k) 
          break;
        while(b[j] > k-a[i]) 
           j--;
        ans = max(ans, i + j );
    }
    cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >> n >> m >> k;
      |     ^~~
a.cc:4:5: error: 'vector' was not declared in this scope
    4 |     vector<int> A(n), B(m), a(n+1), b(m+1);
      |     ^~~~~~
a.cc:4:12: error: expected primary-expression before 'int'
    4 |     vector<int> A(n), B(m), a(n+1), b(m+1);
      |            ^~~
a.cc:6:16: error: 'A' was not declared in this scope
    6 |         cin >> A[i];
      |                ^
a.cc:7:9: error: 'a' was not declared in this scope
    7 |         a[i+1] = a[i] + A[i];
      |         ^
a.cc:10:17: error: 'B' was not declared in this scope
   10 |          cin >> B[j];
      |                 ^
a.cc:11:10: error: 'b' was not declared in this scope
   11 |          b[j+1] = b[j] + B[j];
      |          ^
a.cc:15:12: error: 'a' was not declared in this scope
   15 |         if(a[i] > k)
      |            ^
a.cc:17:15: error: 'b' was not declared in this scope
   17 |         while(b[j] > k-a[i])
      |               ^
a.cc:17:24: error: 'a' was not declared in this scope
   17 |         while(b[j] > k-a[i])
      |                        ^
a.cc:19:15: error: 'max' was not declared in this scope
   19 |         ans = max(ans, i + j );
      |               ^~~
a.cc:21:5: error: 'cout' was not declared in this scope
   21 |     cout << ans;
      |     ^~~~
Language: C++

int main(){
    int n,m,k;
    cin >> n >> m >> k;
    vector<int> A(n), B(m), a(n), b(m);
    for(int i = 0; i < n; i++) {
        cin >> A[i];
        a[i] = i == 0? A[i] : a[i-1] + A[i];
    }
    for(int j = 0; j < m; j++){
         cin >> B[j];
         b[j] = j == 0? B[j] : b[j-1] + B[j];
    }
    int i = 0, j = m-1, ans = 0;
    while(i < n){
        if(a[i] > k) break;
        while(b[j] > k-a[i]) j--;
        ans = max(ans, i+j);
    }
    cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >> n >> m >> k;
      |     ^~~
a.cc:4:5: error: 'vector' was not declared in this scope
    4 |     vector<int> A(n), B(m), a(n), b(m);
      |     ^~~~~~
a.cc:4:12: error: expected primary-expression before 'int'
    4 |     vector<int> A(n), B(m), a(n), b(m);
      |            ^~~
a.cc:6:16: error: 'A' was not declared in this scope
    6 |         cin >> A[i];
      |                ^
a.cc:7:9: error: 'a' was not declared in this scope
    7 |         a[i] = i == 0? A[i] : a[i-1] + A[i];
      |         ^
a.cc:10:17: error: 'B' was not declared in this scope
   10 |          cin >> B[j];
      |                 ^
a.cc:11:10: error: 'b' was not declared in this scope
   11 |          b[j] = j == 0? B[j] : b[j-1] + B[j];
      |          ^
a.cc:15:12: error: 'a' was not declared in this scope
   15 |         if(a[i] > k) break;
      |            ^
a.cc:16:15: error: 'b' was not declared in this scope
   16 |         while(b[j] > k-a[i]) j--;
      |               ^
a.cc:16:24: error: 'a' was not declared in this scope
   16 |         while(b[j] > k-a[i]) j--;
      |                        ^
a.cc:17:15: error: 'max' was not declared in this scope
   17 |         ans = max(ans, i+j);
      |               ^~~
a.cc:19:5: error: 'cout' was not declared in this scope
   19 |     cout << ans;
      |     ^~~~
Language: Java

import java.io.IOException;
import java.util.Scanner;


public class Main {
	public static void main(String[] aegs) throws IOException{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int k = sc.nextInt();

		long[] a = new long[n+1];
		long[] b = new long[m+1];

		a[0]= 0 ;
		b[0]= 0 ;

		for(int i=1;i<n+1;i++)a[i]=sc.nextLong()+a[i-1];
		for(int i=1;i<M+1;i++)a[i]=sc.nextLong()+b[i-1];

		int j = m;
		int count = 0;

		for(int i=0;i<n+1;i++)
        {
			if(a[i]>k) break;
            while (b[j] > k- a[i]) 
            {
                j -= 1;
            }
			count=Math.max(count,i+j);
		}
		System.out.println(count);

	}
}


Compiler output:
Main.java:19: error: cannot find symbol
		for(int i=1;i<M+1;i++)a[i]=sc.nextLong()+b[i-1];
		              ^
  symbol:   variable M
  location: class Main
1 error
Language: Java

import java.util.*;
import java.io.*;

public class ATCODERabc172_cTsundoku {
    static StringTokenizer st;
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args) throws IOException {
        int stack1 = nextInt();
        int stack2 = nextInt();
        int totalTime = nextInt();
        long psa1 [] = new long [stack1+1];
        long psa2 [] = new long [stack2+1];
        for (int x=1; x<=stack1; x++) {
            psa1[x] = psa1[x-1] + nextInt();
        }
        for (int x=1; x<=stack2; x++) {
            psa2[x] = psa2[x-1] + nextInt();
        }
        int stack1Pointer = 1;
        int stack2Pointer = stack2;
        while (stack1Pointer<=stack2Pointer && stack1Pointer<=stack1) {
            long stack2PSA = psa2[stack2] - psa2[stack2Pointer-1];
            if (psa1[stack1Pointer]+stack2PSA<=totalTime) {
                stack1Pointer++;
            }
            else {
                stack2Pointer--;
            }
        }
        if (stack1Pointer>stack1)
            stack1Pointer--;
        System.out.println(stack1Pointer+stack2Pointer);
    }
    
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}




Compiler output:
Main.java:4: error: class ATCODERabc172_cTsundoku is public, should be declared in a file named ATCODERabc172_cTsundoku.java
public class ATCODERabc172_cTsundoku {
       ^
1 error
Language: Java

import java.util.*;
import java.io.*;

public class Main
{   
    public static void main(String[] args) throws IOException
    {
        Foster sc = new Foster();
        int n = sc.nextInt(), m = sc.nextInt(), k = sc.nextLong();
        long N[] = sc.longArray(n);
        long  M[] = sc.longArray(m);
        N[n] = Long.MAX_VALUE;
        M[m] = Long.MAX_VALUE;
        long[] arr = new long[n+m];
        int p1 = 0, p2 = 0;
        for(int i = 0; i < (m+n); i++)
        {
            if(N[p1] < M[p2])
            {
                arr[i] = N[p1++];
            }
            else
            {
                arr[i] = M[p2++];
            }
        }
        long count = 0;
        for(int i = 0; i < (m+n); i++)
        {
            if(k - arr[i] >= 0)
            {
                count++;
                k -= arr[i];
            }
            else
                break;
        }
        System.out.println(count);
    }

    static class Foster 
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");
        String next() 
        {
            while (!st.hasMoreTokens())
                try 
                {
                    st = new StringTokenizer(br.readLine());
                } 
                catch (IOException e) 
                {
                    e.printStackTrace();
                }
            return st.nextToken();
        }
        int nextInt() 
        {
            return Integer.parseInt(next());
        }
        long nextLong() 
        {
            return Long.parseLong(next());
        }
        int[] intArray(int n)
        {
            int arr[] = new int[n];
            for(int i = 0; i < n; i++)
            {
                arr[i] = nextInt();
            }
            return arr;
        }
        long[] longArray(int n)
        {
            long arr[] = new long[n+1];
            for(int i = 0; i < n; i++)
            {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}

Compiler output:
Main.java:9: error: incompatible types: possible lossy conversion from long to int
        int n = sc.nextInt(), m = sc.nextInt(), k = sc.nextLong();
                                                               ^
1 error
Language: Java

import java.util.*;
import java.io.*;

public class B 
{   
    public static void main(String[] args) throws IOException
    {
        Foster sc = new Foster();
        int n = sc.nextInt(), m = sc.nextInt(), k = sc.nextInt();
        long N[] = sc.longArray(n);
        long  M[] = sc.longArray(m);
        N[n] = Long.MAX_VALUE;
        M[m] = Long.MAX_VALUE;
        long[] arr = new long[n+m];
        int p1 = 0, p2 = 0;
        for(int i = 0; i < (m+n); i++)
        {
            if(N[p1] < M[p2])
            {
                arr[i] = N[p1++];
            }
            else
            {
                arr[i] = M[p2++];
            }
        }
        long count = 0;
        for(int i = 0; i < (m+n); i++)
        {
            if(k - arr[i] >= 0)
            {
                count++;
                k -= arr[i];
            }
            else
                break;
        }
        System.out.println(count);
    }

    static class Foster 
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");
        String next() 
        {
            while (!st.hasMoreTokens())
                try 
                {
                    st = new StringTokenizer(br.readLine());
                } 
                catch (IOException e) 
                {
                    e.printStackTrace();
                }
            return st.nextToken();
        }
        int nextInt() 
        {
            return Integer.parseInt(next());
        }
        long nextLong() 
        {
            return Long.parseLong(next());
        }
        int[] intArray(int n)
        {
            int arr[] = new int[n];
            for(int i = 0; i < n; i++)
            {
                arr[i] = nextInt();
            }
            return arr;
        }
        long[] longArray(int n)
        {
            long arr[] = new long[n+1];
            for(int i = 0; i < n; i++)
            {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}

Compiler output:
Main.java:4: error: class B is public, should be declared in a file named B.java
public class B 
       ^
1 error
Language: Java

import java.util.*;
import java.io.*;

public class B 
{   
    public static void main(String[] args) throws IOException
    {
        Foster sc = new Foster();
        int n = sc.nextInt(), m = sc.nextInt(), k = sc.nextInt();
        int N[] = sc.intArray(n);
        int M[] = sc.intArray(m);
        Stack<Integer> one = new Stack<>();
        Stack<Integer> two = new Stack<>();
        for(int i = n-1; i >= 0; i--)
        {
            one.push(N[i]);
        }
        for(int i = m-1; i >= 0; i--)
        {
            two.push(M[i]);
        }
        int count = 0;
        int topOne = 0, topTwo = 0;

        while(k > 0)
        {
            if(one.isEmpty() && two.isEmpty())
                break;

            if(one.isEmpty())
                topOne = Integer.MAX_VALUE; 
            else
                topOne = one.peek();   

            if(two.isEmpty())
                topTwo = Integer.MAX_VALUE;
            else
                topTwo = two.peek();
                
            if(topOne < topTwo && topOne != Integer.MAX_VALUE)
            {
                one.pop();
                if(k - topOne >= 0)
                {
                    k -= topOne;
                    count++;
                }
                else
                    break;
            }
            else if(topTwo <= topOne && topTwo != Integer.MAX_VALUE)
            {
                two.pop();
                if(k - topTwo >= 0)
                {
                    k -= topTwo;
                    count++;
                }
                else    
                    break;
            }
        }
        System.out.println(count);
    }

    static class Foster 
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");
        String next() 
        {
            while (!st.hasMoreTokens())
                try 
                {
                    st = new StringTokenizer(br.readLine());
                } 
                catch (IOException e) 
                {
                    e.printStackTrace();
                }
            return st.nextToken();
        }
        int nextInt() 
        {
            return Integer.parseInt(next());
        }
        long nextLong() 
        {
            return Long.parseLong(next());
        }
        int[] intArray(int n)
        {
            int arr[] = new int[n];
            for(int i = 0; i < n; i++)
            {
                arr[i] = nextInt();
            }
            return arr;
        }
        long[] longArray(int n)
        {
            long arr[] = new long[n];
            for(int i = 0; i < n; i++)
            {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}

Compiler output:
Main.java:4: error: class B is public, should be declared in a file named B.java
public class B 
       ^
1 error
Language: Java

import java.util.Scanner;
public class Main
{
 
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
        int c = sc.nextInt();
      
        int r1[] = new int[a];
        int r2[] = new int[b];
      
        for( int i = 1; i < a; i++)
        {
          r1 = sc.nextInt();
        }
       
        for( int i = 1; i < b; i++ )
        {
          r2 = sc.nextInt();
        }
      
        int read = 0;
        int read1 = 0;
        int read2 = 0;
      
        for(int i = 1; i <= c; i++)
        {
          if(r1 < r2)
          {
            read = 1;
          }
          else
          {
            read1 = 1;
          }
        }
    }

Compiler output:
Main.java:40: error: reached end of file while parsing
    }
     ^
1 error
Language: Java

import java.util.Scanner;
public class Main
{
 
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
        int c = sc.nextInt();
      
        int r1[] = new int[a];
        int r2[] = new int[b];
      
        for( int i = 1; i < a; i++)
        {
          r1 = sc.nextInt();
        }
       
        for( int i = 1; i < b; i++ )
        {
          r2 = sc.nextInt();
        }
      
        int read = 0;
        int read1 = 0;
        int read2 = 0;
      
        for(int i = 1; i <= c; i++)
        {
          if(r1 < r2)
          {
            read = 1;
          }
          else
          {
            read1 = 1;
          }
        }

Compiler output:
Main.java:39: error: reached end of file while parsing
        }
         ^
1 error
Language: Java

import java.util.Scanner;
public class readBooks
{

	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
        int c = sc.nextInt();
      
        int r1 = new int[a];
        int r2 = new int[b];
      
        for( int i = 1; i < a; i++)
        {
          r1 = sc.nextInt();
        }
       
        for( int i = 1; i < b; i++ )
        {
          r2 = sc.nextInt();
        }
      
        int read = 0;
        int read1 = 0;
        int read2 = 0;
      
        for(int i = 1; i <= c; i++)
        {
          if(r1 < r2)
          {
            read = 1;
          }
          else
          {
            read1 = 1;
          }
        }
      
       	read2 = read + read1;
      	System.out.println(read2);
    }
}
      

Compiler output:
Main.java:2: error: class readBooks is public, should be declared in a file named readBooks.java
public class readBooks
       ^
Main.java:12: error: incompatible types: int[] cannot be converted to int
        int r1 = new int[a];
                 ^
Main.java:13: error: incompatible types: int[] cannot be converted to int
        int r2 = new int[b];
                 ^
3 errors
Language: C++

#include<bits/stdc++.h>
#define ll long long int
 
using namespace std;
 
int main()
{
  ll N, M, K, i, j, temp, c;
  cin>>N>>M>>K;
  ll A[N], B[M];
  for(i=0; i<N; i++)
    cin>>A[i];
  for(i=0; i<M; i++)
    cin>>B[i];
 sort(A, A+N);
 sort(B, B+M);
  i=0;
  j=0;
  if(A[0]>K || B[0]>K)
  {
    cout<<"0";
    return 0;
  }
  c=0;
  while(K>0 && (i<=N || j<=M)
  {
    if(A[i]<=B[j])
       {
         K-=A[i];
      if(K<0)
        break;
         i++;
         c++;
       }
       else
       {
         K-=B[j];
         if(K<0)
           break; 
         j++;
         c++;
       }
  }
       cout<<c;
       return 0;
       }

Compiler output:
a.cc: In function 'int main()':
a.cc:25:30: error: expected ')' before '{' token
   25 |   while(K>0 && (i<=N || j<=M)
      |        ~                     ^
      |                              )
   26 |   {
      |   ~