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

#include <iostream>
using L = long long int;
L maxbook = 0;
L counter = 0;
L time = 0;
L n,m,k;
L * a;
L *b;
void dfs(L,L);
int main(){
	std::cin >> n >> m >>k;
	a = new L[n];
	b = new L[m];
	for(int i = 0;i < n;i++){
		std::cin >> a[i];
	}
	for(int i = 0;i < m;i++){
		std::cin >> b[i];
	}
	dfs(0,0);
	std::cout << maxbook;

	return 0;
}

void dfs(L amyon,L bmyon){
	if(time > k){
		if(counter-1 > maxbook){
			maxbook = counter -1;
		}
		return;
	}
	L bufcounter = counter;
	L buftime = time;
	if(amyon <= n){
	time += a[amyon];
	counter ++;
	dfs(amyon + 1,bmyon);}
	if(bmyon <= m){
	time = buftime + b[bmyon];
	counter = bufcounter + 1;
	dfs(amyon,bmyon + 1);
	}
	return;
}


Compiler output:
a.cc:5:3: error: 'L time' redeclared as different kind of entity
    5 | L time = 0;
      |   ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'void dfs(L, L)':
a.cc:27:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   27 |         if(time > k){
      |            ~~~~~^~~
a.cc:34:21: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'L' {aka 'long long int'} [-fpermissive]
   34 |         L buftime = time;
      |                     ^~~~
      |                     |
      |                     time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:36:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   36 |         time += a[amyon];
      |         ~~~~~^~~~~~~~~~~
a.cc:36:14: error: assignment of read-only location 'time'
a.cc:40:14: error: assignment of function 'time_t time(time_t*)'
   40 |         time = buftime + b[bmyon];
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
	long long int n,m,k;
	cin>>n>>m>>k;
	long long int count =0,i;
	long long int sum=0,a;
	for(i=0; i<n; i++)
	{
		cin>>a;
		sum+=a;
		if(sum<=k)
		{
			count++;
		}
		else
		{
			sum-=a;
		}
	}
	int res = k-sum;
	for(i=0; i<m; i++)
	{
		cin>>a;
		sum+=a
		if(sum<=k)
		{
			count++;			
		}
		else
		{
			sum-=a;	
		}
	}
	cout<<count;
return 0;	
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:23: error: expected ';' before 'if'
   26 |                 sum+=a
      |                       ^
      |                       ;
   27 |                 if(sum<=k)
      |                 ~~     
a.cc:31:17: error: 'else' without a previous 'if'
   31 |                 else
      |                 ^~~~
Language: C++

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

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

#include <iostream>
using namespace std;
using L = long long int;
L maxbook = 0;
L counter = 0;
L time = 0;
L n,m,k;
L * a;
L *b;
void dfs(L,L);
int main(){
	cin >> n >> m >>k;
	a = new L[n];
	b = new L[m];
	for(int i = 0;i < n;i++){
		cin >> a[i];
	}
	for(int i = 0;i < m;i++){
		cin >> b[i];
	}
	dfs(0,0);
	cout << maxbook;

	return 0;
}

void dfs(L amyon,L bmyon){
	if(time > k){
		if(counter-1 > maxbook){
			maxbook = counter -1;
		}
		return;
	}
	L bufcounter = counter;
	L buftime = time;
	if(amyon <= n){
	time += a[amyon];
	counter ++;
	dfs(amyon + 1,bmyon);}
	if(bmyon <= m){
	time = buftime + b[bmyon];
	counter = bufcounter + 1;
	dfs(amyon,bmyon + 1);
	}
	return;
}


Compiler output:
a.cc:6:3: error: 'L time' redeclared as different kind of entity
    6 | L time = 0;
      |   ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'void dfs(L, L)':
a.cc:28:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   28 |         if(time > k){
      |            ~~~~~^~~
a.cc:35:21: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'L' {aka 'long long int'} [-fpermissive]
   35 |         L buftime = time;
      |                     ^~~~
      |                     |
      |                     time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:37:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   37 |         time += a[amyon];
      |         ~~~~~^~~~~~~~~~~
a.cc:37:14: error: assignment of read-only location 'time'
a.cc:41:14: error: assignment of function 'time_t time(time_t*)'
   41 |         time = buftime + b[bmyon];
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~
Language: C

#include <bits/stdc++.h>
#include <vector>
#include <algorithm>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main() {
    int n, m,  t, q;
    ll k;
    cin >> n >> m >> k;
    vector<int> a;
    q = 0;
    rep(i, n) {
        cin >> t;
        a.push_back(t);
    }
    rep(j, m) {
        cin >> t;
        a.push_back(t);
    }
    sort(a.begin(), a.end());
    rep(p, n + m) {
        k = k - a[p];
        if (k >= 0) {
            q = q + 1;
        }
        else {
            break;
        }
    }
    cout << q << endl;
	return 0;
}

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

// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
//#include <ext/numeric>
//using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

int arr1[200001];
int arr2[200001];

int dp[1000000001];

int n , m;

int func(int curr1 , int curr2 , int time ){

    if(time <= 0) return 0;

    if(curr1 >= n && curr2 >=m) return 0;

    if(dp[time] !=-1)  return dp[curr1][curr2];

    int ans;

    if(curr1 >=n && arr2[curr2] <= time){
        ans = 1 + func(curr1 , curr2 + 1 , time - arr2[curr2]);
        return ans;

    }

    if(curr2 >=m && arr1[curr1] <= time){
        ans = 1 + func(curr1 + 1 , curr2 , time - arr1[curr1]);
        return ans;
    }

    ans = 1 + min(func(curr1 , curr2 + 1 , time - arr2[curr2]) , func(curr1 + 1 , curr2 , time - arr1[curr1]));

    dp[time] = ans;
    return ans;

}

void solve(){

    int a,b,c, ans=0, count=0, sum=0;
    cin>>n>>m>>b;
    fill(dp , -1);
    for(int i=0;i<n;i++){
      cin>>arr1[i];
    }

    for(int i=0;i<m;i++){
      cin>>arr2[i];
    }

    ans = func(0 ,0 , b);

    // int i = 0;
    // int j = 0;

    // while(i <n && j<m && b >=0){

    //     if(arr1[i] < arr2[j] && arr1[i] <= b){
    //         ans++;
    //         b -= arr1[i];
    //         i++;
    //     }

    //     else if(arr1[i] >= arr2[j] && arr2[j] <= b){
    //         ans++;
    //         b -= arr2[j];
    //         j++;
    //     }

    //     else{
    //         break;
    //     }

    // }

    // while(i <n && b >= 0){

    //     if(arr1[i] <=b){
    //         ans++;
    //         b-= arr1[i];
    //         i++;
    //     }

    //     else{
    //         break;
    //     }
    // } 

    // while(j <m && b >= 0){

    //     if(arr2[j] <=b){
    //         ans++;
    //         b-= arr2[j];
    //         j++;
    //     }

    //     else{
    //         break;
    //     }
    // }

    cout<<ans<<endl;
}


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Compiler output:
a.cc: In function 'long long int func(long long int, long long int, long long int)':
a.cc:46:40: error: invalid types 'long long int[long long int]' for array subscript
   46 |     if(dp[time] !=-1)  return dp[curr1][curr2];
      |                                        ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
    int n,m,k,h=0;
    int a[10],b[10];
    cin >> n >> m >> k ;
    for(int w=0;w<n;w++){
        cin >> a[w];
    }
     for(int z=0;z<m;z++){
        cin >> b[z];
    }
    
    for(int i=0;k>0;i++){
         k=k-a[i];
        if(k>=0){
            h++;
        }else{
            break;
        }
        k=k-b[i];
        if(k>=0){
            h++;
        }else{
            break;
        }
    }
    cout << h;
    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: expected '}' at end of input
   30 |     return 0;
      |              ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C

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

using namespace std;
using ll = long long;
using P = pair<int, int>;


int main() {
    int n, m,  t, q;
    ll k;
    cin >> n >> m >> k;
    vector<int> a;
    q = 0;
    rep(i, n) {
        cin >> t;
        a.push_back(t);
    }
    rep(j, m) {
        cin >> t;
        a.push_back(t);
    }
    sort(a.begin(), a.end());
    rep(p, n + m) {
        k = k - a[p];
        if (k >= 0) {
            q += 1;
        }
        else {
            break;
        }
    }
    cout << q << endl;
	return 0;
}

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

#include <bits/stdc++.h>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int n, m,  t, q;
    ll k;
    cin >> n >> m >> k;
    vector<int> a;
    q = 0;
    rep(i, n) {
        cin >> t;
        a.push_back(t);
    }
    rep(j, m) {
        cin >> t;
        a.push_back(t);
    }
    sort(a.begin(), a.end());
    rep(p, n + m) {
        k = k - a[p];
        if (k >= 0) {
            q += 1;
        }
        else {
            break;
        }
    }
    cout << q << endl;
	return 0;
}

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

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

int main()
{
  int n,m,k;
  cin >> n >> m >> k;
  
  vector<int> a(n);
  for(int i=0; i<n; ++i) {
    cin >> a.at(i);
  }
  
  vector<int> b(m);
  for(int i=0; i<m; ++i) {
    cin >> b.at(i);
  }
  
  int bestNum = 0;
  int numA = 0;
  int numATime = k;
  
  {
    int tempK = k;
  	for(int i=0; i<n; ++i) {
    	tempK -= a[i];
    	if (tempK < 0 ) {
          tempk += a[i];
      		break;
    	}
      	++bestNum;

  	}
    numA = bestNum;
    numATime = tempK;
    
    for(int i=0; i<m; ++i) {
    	tempK -= b[i];
    	if (tempK < 0 ) {
      		break;
    	}
      ++bestNum;
  	}
  }
  
  while(numA > 0) {
    --numA;
    int tempK = k;
    int tempNum = 0;
    
    if(numA > 0) {
    	numATime += a[numA-1];
      	tempK = numATime;
      	tempNum = numA;
    }   
    
    for(int mi = 0; mi < m; ++mi){
      tempK -= b[mi];
      if(tempK < 0) {
        break;
      }
      ++tempNum;
    }
    
    if(tempNum > bestNum ){
      bestNum = tempNum;
    }
  }
  
  cout << bestNum;  
  
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:11: error: 'tempk' was not declared in this scope; did you mean 'tempK'?
   28 |           tempk += a[i];
      |           ^~~~~
      |           tempK
Language: C++

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

int main(){
    int m,n,k;
    int cnt=0;
    cin >>m >>n >>k;
vector<unsigned long long> x;
vector<unsigned long long> y;
for(int i=0; i<m; i++){
    unsigned long long  a;
    cin >>a; 
    x.push_back(a);
}
for(int i=0; i<n; i++){
unsigned long long b;
cin >>b;
  y.push_back(b);
} 
int sum=0;
int i=0,j=0;
while(true){
    if(sum>=k){break;//cnt-1?
  else{
     if(x[i]==0 && y[j]==0)break;
    else if(x[i]==0) {
      sum+=y[j]; 
      cnt++;
        j++;
      }//配列のサイズを超えたときはその配列がないので
     else if(y[j]==0){
       sum+=x[i]; 
       cnt++;
       i++;
     }
       else if(x[i]<=y[j]){
        sum+=x[i];
        cnt++;
        cout <<"x[" <<i <<"]=" <<x[i] <<endl;
  	    i++;
     }
        else {
        sum+=y[j];
        cnt++;
        cout <<"y[" <<j <<"]=" <<y[j] <<endl;
        j++;
    }
  cout <<"sum=" <<sum <<endl;
    }

}
  cout <<cnt-1 <<endl;
 // */
return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:27:3: error: expected '}' before 'else'
   27 |   else{
      |   ^~~~
a.cc:26:15: note: to match this '{'
   26 |     if(sum>=k){break;//cnt-1?
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;
const ll inf = 1e18;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,m,k; cin >> n >> m >> k;
    vec<ll> a(n),b(m);
    rep(i,n)cin >> a[i];
    rep(i,m)cin >> b[i];
    vec<ll> sa(n),sb(m); sa[0]; sb[0];
    rep(i,n-1)sa[i+1] = sa[i] + a[i+1];
    rep(i,m)sb[i+1] = sb[i] + b[i+1];
    ll res = 0;
    rep(i,n){
        ll t = k - sa[i];
        if(t < 0)continue;
        if(t == 0){
            res = max(res,i+1);
            continue;
        }
         res = max(res,i+*lower_bound(sb.begin(), sb.end(),t))
    }
    cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:30: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = long long int; _Alloc = std::allocator<long long int>; reference = long long int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   17 |     vec<ll> sa(n),sb(m); sa[0]; sb[0];
      |                              ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
a.cc:17:37: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = long long int; _Alloc = std::allocator<long long int>; reference = long long int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   17 |     vec<ll> sa(n),sb(m); sa[0]; sb[0];
      |                                     ^
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
a.cc:28:63: error: expected ';' before '}' token
   28 |          res = max(res,i+*lower_bound(sb.begin(), sb.end(),t))
      |                                                               ^
      |                                                               ;
   29 |     }
      |     ~
Language: C++

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

int main(){
    long long int N, M, K;
    vector<long long int> A, B;
    vector<long long int> A_sum, B_sum;
    long long int sum;
    long long int count;
    int i, j;

    cin >> N >> M >> K;

    long long int a_sum, b_sum;
    a_sum = 0;
    b_sum = 0;
    A_sum.push_back(0);
    B_sum.push_back(0);
    for(i=0;i<N;i++){
        int ai;
        cin >> ai;
        A.push_back(ai);
        a_sum += ai;
        if(a_sum > K){N=i-1;ideal_ij=0;break;}
        A_sum.push_back(a_sum);
    }

    for(i=0;i<M;i++){
        int bi;
        cin >> bi;
        B.push_back(bi);
        b_sum += bi;
        if(b_sum > K){M=i-1;ideal_ij=0;break;}
        B_sum.push_back(b_sum);
    }


    sum = 0;
    int ideal_ij;
    long long int ideal_sum;

    for(i=0;i<=N;i++){
     for(j=0;j<=M;j++){
      sum = A_sum[i] + B_sum[j];  
      if(i==0 && j==0){ideal_sum = K - sum; ideal_ij = i+j;}
      if(K - sum < 0){if(i==0 && j==0){ideal_ij = i+j; break;}else{continue;}}
      else if(ideal_sum >  (K - sum)){ideal_sum = K - sum; ideal_ij = i+j;}
      else if(ideal_sum == (K - sum)){ideal_ij = max(ideal_ij, i+j);}
     }
    }
    cout << ideal_ij << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:29: error: 'ideal_ij' was not declared in this scope
   25 |         if(a_sum > K){N=i-1;ideal_ij=0;break;}
      |                             ^~~~~~~~
a.cc:34:29: error: 'ideal_ij' was not declared in this scope
   34 |         if(b_sum > K){M=i-1;ideal_ij=0;break;}
      |                             ^~~~~~~~
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 N,M,K;
vector<int> A(200001),B(200001);
int m[200001][200001];

int solve(int i, int j, int k){
    if (m[i][j] >=0){
        return m[i][j];

    }
    if(k < 1 || (A[i]>k && B[i]>k)){
        return 0;
    }
    cout << i << " " << j << " "<< k << endl;
    int ans;
    if(i >= N && j >= M){
        ans = 0;
    }else if(i < N && j >= M){
        ans = 1 + solve(i+1, j, k - A[i]);
    }else if(i >= N && j < M){
        ans = 1 + solve(i, j+1, k - B[j]);
    }else{
        ans = max(1 +solve(i+1, j, k - A[i]),1 +solve(i, j+1, k - B[j]));
        // cout << ans << endl;
    }
    m[i][j] = ans
    return ans;

}



int main() {
    
    cin >> N >> M >> K;
    
    rep(i,N){
        cin >> A[i];
    }
    rep(i,M){
        cin >> B[i];
    }
    // int dp[max(N,M)][2];

    // dp[i+1][0] = max 

    
    cout << solve(0,0,K) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int solve(int, int, int)':
a.cc:32:18: error: expected ';' before 'return'
   32 |     m[i][j] = ans
      |                  ^
      |                  ;
   33 |     return ans;
      |     ~~~~~~        
a.cc:32:13: warning: control reaches end of non-void function [-Wreturn-type]
   32 |     m[i][j] = ans
      |     ~~~~~~~~^~~~~
Language: C++

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

int main(){
	long long N, M, K;
	cin >> N >> M >> K;
    vector<long long> A(N), B(M);
    for(int i=0; i<N; i++){
        cin >> A.at(i);
    }
    for(int i=0; i<M; i++){
        cin >> B.at(i);
    }

    long long num = N+M;
    long long maxans=0;

    int ca=0;
    int cb=0;
    long long cnt=0;
    long long time=0;

    for(long long i=0; i<num; i++){
        if( ca == N ){
            time += B.at(cb); 
            cb++;
            cnt++;
        }
        else if ( cb == M ){
            time += A.at(ca); 
            ca++;
            cnt++;
        }
        else{

            if( A.at(ca) < B.at(cb) ){
                time += A.at(ca);
                ca++;
            }
            else if ( A.at(ca) >= B.at(cb) ){
                time += B.at(cb);
                cb++;
            }
            else if ( A.at(ca) == B.at(cb) ){
/*                int tmpa = ca;
                int tmpb = cb;
                bool flag=true;
                while(true){
                    tmpa++;
                    tmpb++;
                    if( tmpa == N ) break;
                    if( tmpb == M ) break;
                    if( A.at(tmpa) < B.at(tmpb) ){
                        time += A.at(ca);
                        ca++;
                        flag=false;
                        break;
                    }
                    else if ( A.at(ca) > B.at(cb) ){
                        time += B.at(cb);
                        cb++;
                        flag=false;
                        break;
                    }
                    else if ( A.at(ca) == B.at(cb) ){
                    }
                    
                }
                if(flag){
                    if( N<M ){
                        time += B.at(cb);
                        cb++;
                    }
                    else{
                        time += A.at(ca);
                        ca++;
                    }
                }
                cnt++;
                
            }
        }
*/
        if( time <= K ){
            maxans = max(maxans,cnt);
        }
        else{
            break;
        }
    }

	cout << maxans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:93:2: error: expected '}' at end of input
   93 | }
      |  ^
a.cc:23:35: note: to match this '{'
   23 |     for(long long i=0; i<num; i++){
      |                                   ^
a.cc:93:2: error: expected '}' at end of input
   93 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> a(n + 1), b(m + 1);
  bool flag = false;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    if (flag)
      a[i] = k + 1;
    else
      a[i] = a[i - 1] + x;
    if (a[i] > k) flag = true;
  }
  flag = false;
  for (int i = 1; i <= m; i++) {
    int x;
    cin >> x;
    if (flag)
      b[i] = k + 1;
    else
      b[i] = b[i - 1] + x;
    if (b[i] > k) flag = true;
  }
  int ans = 0;
  for (int i = 0; i <= n; i++) {
    if (acc[i][0] > k) break;
    for (int j = 0; j <= m; j++) {
      if (a[i] + b[j] <= k) {
        ans = max(ans, i + j);
      } else {
        continue;
      }
      }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: error: 'acc' was not declared in this scope; did you mean 'acct'?
   33 |     if (acc[i][0] > k) break;
      |         ^~~
      |         acct
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
	int n,m;
	long k;
	cin >> n >> m >> k;
	
	vector<long> a(n);
	vector<long> b(m);
	
	for(int i = 0; i < n; i++){
		cin >> a.at(i);
	}
	for(int i = 0; i < m; i++){
		cin >> b.at(i);
	}
	
	int sum_min = 0;
	int ans = 0;
	
	int ap=0, bp=0;
	
	vector<int> counts;
	for(int i = 0; i < n; i++){
		int count = 0;
		for(int j = i; j > 0; j--){
			sum_min += a.at(j);
			count++;
		}
		while(sum_min < k && bp < m){
			sum_min += b.at(bp);
			bp++;
			count++;
		}
		counts.append(count);
	}
	
	int max = 0;
	for(int i = 0; i < counts.size(); i++){
		if(max < counts.at(i)) max = counts.at(i);
	}
	
	cout << max << endl;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:24: error: 'class std::vector<int>' has no member named 'append'
   37 |                 counts.append(count);
      |                        ^~~~~~
Language: C

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

int W_Length(char *str){
	int length = 0;
	while(*str++ != '\0')
		length++;
	return length;
}

double deg(double theta){//deg to theta
return theta*(2*3.14159265359)/360;
}

int cmp( const void *p, const void *q ) {
    return *(int*)p - *(int*)q;
}//ちいさい順
//qsort(a,n,sizeof(int),cmp);
//char s[n][11]

int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}
//qsort(s,n,sizeof(s[0]),cmp_s);


int main (void)
{
	long long int a[200005],b[200005],i,n,m,k,j,a_c=1,b_c=1;
  long long int sum=0,temp1=0, temp2=0,temp_sum1,temp_sum2;
	
	scanf("%lld%lld%lld", &n,&m,&k);
	for(i=0; i<n;i++){
		scanf("%lld", &a[i+1]);
		temp1+=a[i+1];
}
for(i=0; i<m;i++){
		scanf("%lld", &b[i+1]);
		temp2+=b[i+1];
}

if(temp1+temp2<=k){
	printf("%lld\n",n+m);
	return 0;
}
  
  
  for(i=1;temp1<=sum-k||i<=n;i++){
  temp1+=a[i];
    temp_sum1++;
  }
  for(j=1;temp2<=sum-k||j<=m;j++){
  temp1+=b[j];
    temp_sum2++;
  }
  
    while(1){
      
      if(sum_>=k||(temp_sum1==0&&temp_sum2==0)){
        printf("%lld\n",a_c+b_c-2);
      }
  if(temp_sum1>=temp_sum2){
  sum+=1;
    temp1=temp1-a[a_c]+a[i+1];
    i++;
    temp_sum1--;
    sum+=a[a_c]
      
    a_c++;
  }
     else if(temp_sum1<temp_sum2){
  sum+=1;
    temp2=temp2-b[b_c]+b[j+1];
       
       temp_sum2--;
    j++;
       sum+=b[b_c];
       b_c++;
  }

}


}


Compiler output:
main.c: In function 'main':
main.c:64:10: error: 'sum_' undeclared (first use in this function); did you mean 'sum'?
   64 |       if(sum_>=k||(temp_sum1==0&&temp_sum2==0)){
      |          ^~~~
      |          sum
main.c:64:10: note: each undeclared identifier is reported only once for each function it appears in
main.c:72:16: error: expected ';' before 'a_c'
   72 |     sum+=a[a_c]
      |                ^
      |                ;
   73 | 
   74 |     a_c++;
      |     ~~~
Language: C++

#include <iostream>
#include<vector>
#include<map>
#include<cmath>

using namespace std;

int main()
{
    long long N, M, K;
    vector<long long> A, B;
    map<long long, long long> leftTimeToNumber;

    cin >> N >> M >> K;
    A.resize(N + 1, 0);
    B.resize(M + 1, 0);
    long long maxCountB = 0;
    long long maxCountA = 0;
    long long countB = 0;
    leftTimeToNumber[0] = 0;
    for (long long i = 1; i <= N; i++)
    {
        long long a;
        cin >> a;
        A[i] = a + A[i - 1];
        if (A[i] <= K)
        {
            maxCountA = i;
        }
    }
    long long result = 0;
    long long count = 0;
    for (long long i = 1; i <= M; i++){
        long long b;
        cin >> b;
        B[i] = b + B[i - 1];
        if(B[i] <= K){
            maxCountB = i;
        }
    }
    long long result = 0ll;
    long long count = maxCountA;
    while(A[count] + B[maxCountB] > K){
        count--;
    }
    result = count + maxCountB;

    count = maxCountB;
    while(A[maxCountA] + B[count] > K){
        count--;
    }
    result = max(result, count + maxCountA);
    cout << result << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:15: error: redeclaration of 'long long int result'
   41 |     long long result = 0ll;
      |               ^~~~~~
a.cc:31:15: note: 'long long int result' previously declared here
   31 |     long long result = 0;
      |               ^~~~~~
a.cc:42:15: error: redeclaration of 'long long int count'
   42 |     long long count = maxCountA;
      |               ^~~~~
a.cc:32:15: note: 'long long int count' previously declared here
   32 |     long long count = 0;
      |               ^~~~~
Language: C++

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



Compiler output:
a.cc: In function 'int main()':
a.cc:22:7: error: 'j' was not declared in this scope
   22 |   for(j=i; j<a+b;j++)
      |       ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define prtd(var, i) cout << fixed << setprecision(i) << var << endl;
#define ll long long
using namespace std;


ll n, m, k;
vector<int> a(n+2), b(m+2);
ll ans = 0;

void bfs(ll k, ll aa, ll bb, ll cnt){
    if(k < a[aa] || k < b[bb]) return;
    if(aa == n || bb == m) return;
    ans = max(ans, cnt);
    bfs(k-a[aa], aa+1, bb, cnt+1);
    bfs(k-b[bb], aa, bb+1, cnt+1)
}


int main(){
    cin >> n >> m >> k;
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];

    bfs(k-a[0], 1, 0, 0);
    bfs(k-b[0], 0, 1, 0);
        
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'void bfs(long long int, long long int, long long int, long long int)':
a.cc:17:34: error: expected ';' before '}' token
   17 |     bfs(k-b[bb], aa, bb+1, cnt+1)
      |                                  ^
      |                                  ;
   18 | }
      | ~
Language: C++

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

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];
    ll tot = 0;
    ll cnt=0, cnta=0, cntb=0;
    while (cnt =< n+m){
        if (cnta >= n){
            tot += b[cntb];
            cntb += 1;
        }
        else if (cntb >= n){
            tot += a[cnta];
            cnta += 1;
        }
        else if (a[cnta] <= b[cntb]){
            tot += a[cnta];
            cnta += 1;
        }
        else if (b[cntb] < a[cnta]){
            tot += b[cntb];
            cntb += 1;
        }
        if (tot > k) break;
        else cnt += 1;
    }
    cout << cnt << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: expected primary-expression before '<' token
   16 |     while (cnt =< n+m){
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(),v.end()

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

  cout << max << endl;

}




Compiler output:
a.cc: In function 'int main()':
a.cc:27:11: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   27 |     time[i]=aa[i];
      |           ^
a.cc:27:12: error: assignment of read-only location '*(time + ((sizetype)i))'
   27 |     time[i]=aa[i];
a.cc:29:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   29 |         if(aa[j]+bb[i-j]<time[i]){time[i]=aa[j]+bb[i-j];}
      |                                ^
a.cc:29:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   29 |         if(aa[j]+bb[i-j]<time[i]){time[i]=aa[j]+bb[i-j];}
a.cc:29:41: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   29 |         if(aa[j]+bb[i-j]<time[i]){time[i]=aa[j]+bb[i-j];}
      |                                         ^
a.cc:29:42: error: assignment of read-only location '*(time + ((sizetype)i))'
   29 |         if(aa[j]+bb[i-j]<time[i]){time[i]=aa[j]+bb[i-j];}
a.cc:35:18: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   35 |         if(time[i]<=k){max=i;}
      |                  ^
a.cc:35:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   35 |         if(time[i]<=k){max=i;}
      |            ~~~~~~~^~~
Language: C++

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

int main(void)
{
  int N, M, K, B = 0, i = 0, j = 0, suma = 0, max = 0, read = 0, readmax = 0;
  int deskA[200001], deskB[200001];
  scanf("%d %d %d", &N, &M, &K);
  for (i = 0; i < N; i++)
  {
    scanf("%d", &deskA[i]);
  }
  for (i = 0; i < M; i++)
  {
    scanf("%d", &deskB[i]);
  }

  for (i = 0; i < N; i++)
  {
    if (suma + deskA[i] < K)
    {
      suma += deskA[i];
      read++;
    }
  }
  readmax = read;
  max = suma;
  for (i = 0; i < N; i++)
  {
    max = suma - deskA[N - i - 1];
    read--;
    for (j = B; j < M; j++)
    {
      if (max + deskB[j] < K)
      {
        max += deskB[j];
        read++;
      }
      B++;
    }
    if (readmax < read)
    {
      readmax = read;
    }
  }
  printf("%d\n", readmax);
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:49:12: error: expected '}' at end of input
   49 |   return 0;
      |            ^
a.cc:7:1: note: to match this '{'
    7 | {
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m,k;
    cin>>n>>m>>k;
    vector<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 ans=0;
    ll cur=0;
    ll t=0;
    while(cur<n && t+a[cur]<=k){
        ans++;
        t+=a[cur++];
    }
    ll Max=ans;
    if(cur)cur--;
    for(ll i=0;i<m;){
        if(t+b[i]<=k){
            ans++;
            Max=max(Max,ans);
            t+=b[i++];
            continue;
        }
        else{
            if(cur>=0)t=max(0,t-a[cur--]);
            else break;
            ans--;
        }
    }
    cout<<Max;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:30:28: error: no matching function for call to 'max(int, long long int)'
   30 |             if(cur>=0)t=max(0,t-a[cur--]);
      |                         ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:30:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   30 |             if(cur>=0)t=max(0,t-a[cur--]);
      |                         ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:30:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   30 |             if(cur>=0)t=max(0,t-a[cur--]);
      |                         ~~~^~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const double EPS = 1e-10;

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

    vector<ll> A(N);
    vector<ll> B(M);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    for (int i = 0; i < M; i++)
    {
        cin >> B[i];
    }

    // Ruiseki
    vector<int> Arui(N + 1, 0);
    for (int i = 0; i < N; i++)
    {
        Arui[i + 1] = Arui[i] + A[i];
    }
    vector<int> Brui(M + 1, 0);
    for (int i = 0; i < M; i++)
    {
        Brui[i + 1] = Brui[i] + B[i];
    }

    // debug
    ll A_max = N, B_max = M;
    for (int i = 1; i < N; i++)
    {
        if (Arui[i] > K)
        {
            A_max = i - 2;
        }
        // printf("%ld ", Arui[i]);
    }
    // printf("\n");
    for (int i = 1; i < M; i++)
    {
        if (Brui[i] > K)
        {
            B_max = i - 2;
        }
        // printf("%ld ", Brui[i]);
    }
    // printf("A = %ld, B = %ld\n", A_max, B_max);
    int i = A_max;
    int j = B_max;
    ll ans;
    while (true)
    {
        if (Arui[i] + Brui[j] <= K)
        {
            ans = i + j;
        }
        else
        {
            if (Arui[i - 1])
        }
    }
    // printf("\n");

    return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:9: error: expected primary-expression before '}' token
   69 |         }
      |         ^
Language: C++


#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N,M,K;
    cin >> N >> M >> K;
    vector<int>A1(N);
    vector<int>B1(M);
    vector<int>A;
    vector<int>B;
    int cnt1 = N;
    for(int i = 0; i < N; i++) {
        cin >> A1[i];
    }
    for(int i = 0; i < M; i++) {
        cin >> B1[i];
    }
    A.push_back(0);
    B.push_back(0);
    int cnt = 0;
    for(int i = 0; i < N; i++) {
        cnt = cnt+A1[i];
        if(cnt > K) {
            cnt1 = i;
        }
        A.push_back(cnt);
    }
    cnt = 0;
    for(int i = 0; i < M; i++) {
        cnt = cnt+B1[i];
        B.push_back(cnt);
    }
    int ans = 0;
    for(int i = 0; i <= cnt1; i++) {
        auto it = upper_bound(B.begin(),B.end(),K-A[i]);
        if(it = B.end()) {
            ans = max(ans,i+M);
        }
        int X = it-B.begin()-1;
        if(X > 0) {
            ans = max(ans,i+X);
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:15: error: could not convert '(it = B.std::vector<long long int>::end())' from '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' to 'bool'
   41 |         if(it = B.end()) {
      |            ~~~^~~~~~~~~
      |               |
      |               __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >
Language: C++

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

struct ans{
  long int time[mi]={0};
  long int number[mi]={0};
};

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

  long int mi = min(n,m);
  ans v;
  for(long int i=0; i< 1<<mi; i++){
    for(long int j=0; j<mi; j++){
      if(i>>j & 0 && (v.time[j]+=a[j])<k){
        v.time[j] +=a[j];
        v.number +=1;
      }else if(v.time[j]+=b[j])<k){
        v.time[j] +=b[j];
        v.number +=1;
      }
    }
  }

  long int homuzu = v.number[i];

  for(long int i=mi; i>0; i--){
    if(v.number[i] > v.number[i-1]){
      homuzu = v.number[i-1];
    }
  }

  cout << homuzu << endl;

  return 0;
}

Compiler output:
a.cc:5:17: error: 'mi' was not declared in this scope
    5 |   long int time[mi]={0};
      |                 ^~
a.cc:6:19: error: 'mi' was not declared in this scope
    6 |   long int number[mi]={0};
      |                   ^~
a.cc: In function 'int main()':
a.cc:24:25: error: 'struct ans' has no member named 'time'
   24 |       if(i>>j & 0 && (v.time[j]+=a[j])<k){
      |                         ^~~~
a.cc:25:11: error: 'struct ans' has no member named 'time'
   25 |         v.time[j] +=a[j];
      |           ^~~~
a.cc:26:11: error: 'struct ans' has no member named 'number'
   26 |         v.number +=1;
      |           ^~~~~~
a.cc:27:18: error: 'struct ans' has no member named 'time'
   27 |       }else if(v.time[j]+=b[j])<k){
      |                  ^~~~
a.cc:27:32: error: expected primary-expression before '<' token
   27 |       }else if(v.time[j]+=b[j])<k){
      |                                ^
a.cc:34:23: error: 'struct ans' has no member named 'number'
   34 |   long int homuzu = v.number[i];
      |                       ^~~~~~
a.cc:34:30: error: 'i' was not declared in this scope
   34 |   long int homuzu = v.number[i];
      |                              ^
a.cc:37:10: error: 'struct ans' has no member named 'number'
   37 |     if(v.number[i] > v.number[i-1]){
      |          ^~~~~~
a.cc:37:24: error: 'struct ans' has no member named 'number'
   37 |     if(v.number[i] > v.number[i-1]){
      |                        ^~~~~~
a.cc:38:18: error: 'struct ans' has no member named 'number'
   38 |       homuzu = v.number[i-1];
      |                  ^~~~~~
Language: C++

#include <iostream>
#include <boost/multiprecision/cpp_int.hpp>

using namespace boost::multiprecision;
using namespace std;


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

  cpp_int* ar = new cpp_int[n];
  cpp_int* br = new cpp_int[m];

  for (int i=0; i<n; ++i){
      int x;
      cin >> x;
      ar[i] = x;
  }
  for (int i=0; i<m; ++i){
      int x;
      cin >> x;
      br[i] = x;
  }

  cpp_int as = 0;
  cpp_int bs = 0;
  int ac = 0;
  int bc = 0;
  
  cpp_int maxc = 0;
  
  for (int i=0; i<n; ++i){
      if (as + ar[ac] > k) break; 
      as += ar[ac];
      ac++; 
  }
  maxc = ac;

  for (int i=0; i<m; ++i){
      bs += br[bc];
      bc++ ;
    while(ac >= 0){
      if (as + bs <= k) break;
      as -= ar[ac];
      ac--;
    }
    if (as + bs <= k) maxc = std::max(maxc, ac + bc);
  }

  cout << maxc << endl;
  
  return 0;
}


Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
using ll = long long;
using namespace std;
using P = pair<int, int>;



int main(){
    int N, M;
    ll K;
    cin >> N >> M >> K;
    vector<ll> A(1000002), B(1000002);
    vector<ll> A_sum(1000002), B_sum(1000002);
    rep(i, N) cin >> A[i];
    rep(i, M) cin >> B[i];
    A_sum[0] = 0;
    B_sum[0] = 0;
    for (int i = 1; i < N+1; i++) A_sum[i] = A_sum[i-1] + A[i];
    for (int i = 1; i < M+1; i++) B_sum[i] = B_sum[i-1] + B[i];
    int mx = 0;
    // Aが0冊のときの読める冊数
    rep(i, M+1) if(K >= B_sum[i]) mx = max(mx, i);
    // Aが1冊以上
    rep(i, N){
        while(1){
            if (mx-i >= 0){
                if (A_sum[i+1] + B_sum[mx-i] <= K) mx++;
                else continue
            }
        }
    }
    cout << mx << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:30: error: expected ';' before '}' token
   30 |                 else continue
      |                              ^
      |                              ;
   31 |             }
      |             ~
Language: C++

#include<cstring>
#include <cstdio> 
#include <iostream>
#include <cmath>
#include<algorithm>
using namespace std;
#define pi 3.1415926 
#define N 510
int n,m,k,i,j,num=0;
int a[1000000001];
int b[1000000001];
bool is(int nn,int mm)
{
	if(is(nn-1,mm))
	{
		return true;
	}
	else if(is(nn,mm-1))
	{
		return false;
	}
}
int dig( int nn,int mm,int kk) 
{
	if((k-a[nn]<0&&k-a[mm]<0)||m+n==0)
	{
		return 0;
	}
	else
	{
		if(is(nn,mm))
		{
			dig(nn-1,mm,k-a[nn]);
			num++;
		}
		else
		{
			dig(nn,mm-1,k-b[mm]);
			num++;
		}
	}
	return num;
}
int main()
{
	cin>>n>>m>>k;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(j=0;j<m;j++)
	{
		cin>>b[j];
	}
	dig(n,m,k);
	printf("%d",num);
	
	
	return 0;
}



Compiler output:
a.cc: In function 'bool is(int, int)':
a.cc:22:1: warning: control reaches end of non-void function [-Wreturn-type]
   22 | }
      | ^
/tmp/cclagDWf.o: in function `dig(int, int, int)':
a.cc:(.text+0x12a): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cclagDWf.o
/tmp/cclagDWf.o: in function `main':
a.cc:(.text+0x219): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cclagDWf.o
collect2: error: ld returned 1 exit status