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

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

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

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
typedef long double ld;
const char sp = ' ';

using namespace boost::multiprecision;
using namespace std;

ll N, M, K;
ll A[200000], B[200000];
ll deci=0;
bool can_clear(ll index){
    //cout<<deci<<sp<<index<<sp<<B[index]<<endl;
    return deci+B[index]<=K;
}

//条件に合致する最大indexを二分探索 O(logN)
//-2...全indexがみたす -1...条件に合致するものがない
ll nibutan_max(ll min, ll max){
  //評価関数can_clear(ll　value) を指定すること
  ll left=min, right=max;
  ll ans;
  while(true){
      //cout<<left<<" " <<right<<endl; //debug用
      if(left==right){
          if(can_clear()) return right;
          else return -1;
      }
      if(left+1==right){
        if(can_clear(right)){
          if(right==max) return max;
          else return right;
        }
        else{
          if(can_clear(left)) return left;
          else return -1;
        }
        break;
      }
      ll nibutan=(left+right)/2;
      bool can_do_it=can_clear(nibutan);
      if(can_do_it) left = nibutan;
      else right = nibutan;
  }
}



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

    rep(i, N){
        cin>>A[i];
        if(i!=0) A[i]+=A[i-1];
    }
    rep(i, M){
        cin>>B[i];
        if(i!=0) B[i]+=B[i-1];
    }
    ll Maxim=0;
    deci=0;
    Maxim=max(Maxim, nibutan_max(0,M-1)+1);
    rep(i, N){
        deci=A[i];
        if(deci>K) break;
        Maxim=max(Maxim, i+1+nibutan_max(0,M-1)+1);
    }
        cout<<Maxim<<endl;
    return 0;
}


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

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

int main()
{
	int n,m,ky,kx,d=0;
	cin>>n>>m>>ky;
	long long a[n+1];
	long long b[m+1];
	a[0]=0;
	b[0]=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		a[i]=a[i]+a[i-1];
		if(a[i]<=ky)
		d=i;
	}
	for(int i=1;i<=m;i++)
	{
		x
	}
	for(int i=d;i>=1;i--)
	{
		kx=ky-a[i];
		for(int p=1;p<=m;p++)
		{
			if(b[p]<=kx&&d<i+p)
			d=i+p;
			#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n,m,ky,kx,d=0;
	cin>>n>>m>>ky;
	long long a[n+1];
	long long b[m+1];
	a[0]=0;
	b[0]=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		a[i]=a[i]+a[i-1];
		if(a[i]<=ky)
		d=i;
	}	
	for(int i=d;i>=0;i--)
	{
		kx=ky-a[i];
		for(int p=1;p<=m;p++)
		{
			cin>>b[p];
			b[p]=b[p]+b[p-1];
			if(b[p]<=kx&&d<i+p)
			d=i+p;
		}
	}
	cout<<d;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'x' was not declared in this scope
   21 |                 x
      |                 ^
a.cc:33:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   33 | int main()
      |         ^~
a.cc:33:9: note: remove parentheses to default-initialize a variable
   33 | int main()
      |         ^~
      |         --
a.cc:33:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:34:1: error: a function-definition is not allowed here before '{' token
   34 | {
      | ^
a.cc:61:2: error: expected '}' at end of input
   61 | }
      |  ^
a.cc:27:17: note: to match this '{'
   27 |                 {
      |                 ^
a.cc:61:2: error: expected '}' at end of input
   61 | }
      |  ^
a.cc:24:9: note: to match this '{'
   24 |         {
      |         ^
a.cc:61:2: error: expected '}' at end of input
   61 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: expected ';' before 'cnt'
   22 |   {  k=k-brr[j]
      |                ^
      |                ;
   23 |     cnt++;
      |     ~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:4: error: expected initializer before 'cin'
    5 |    cin>>n>>m>>k;
      |    ^~~
a.cc:9:14: error: 'i' was not declared in this scope; did you mean 'ji'?
    9 | for(int ji=0;i<m;i++)
      |              ^
      |              ji
a.cc:13:8: error: 'k' was not declared in this scope
   13 |  while(k>0)
      |        ^
Language: C++

using namespace std;

int main()
{
    int n, m, ca, cb, maxb;
    int sum, asum, k;
    cin >> n;
    cin >> m;
    cin >> k;
    int a[n];
    int b[m];
    for ( int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for ( int i = 0; i < m; i++) {
        cin >> b[i];
    }
    asum = 0;
    ca = cb = maxb = 0;
    bool flag;
    for (int i = 0; i < n; i++) {
        asum += a[i];
        if ( asum < 0) break;
        if ( asum > k) break;
        sum = asum;
        cb = 0;
        flag = false;
        while ( cb < m && sum + b[cb] <= k ) {
            sum += b[cb++];
            if (sum < 0) {
                flag = true;
                break;
            }
        }
        if ( !flag && i+1 + cb > maxb) maxb = i+1 + cb;
    }
    cout << maxb <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin >> n;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:37:5: error: 'cout' was not declared in this scope
   37 |     cout << maxb <<endl;
      |     ^~~~
a.cc:37:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:20: error: 'endl' was not declared in this scope
   37 |     cout << maxb <<endl;
      |                    ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
int main(){
    ll n,m;
    ll k;
    vector<ll> a,b;
    cin >> n >> m >> k;
    a.resize(n+10));
    b.resize(m+10);
    vector<ll> sum_a(n+10,0);
    vector<ll> sum_b(m+10,0);
    for(int i=0; i<n; i++){
        cin >> a[i];
        sum_a[i+1] = sum_a[i]+a[i];
    }
    for(int j=0; j<m; j++){
        cin >> b[j];
        sum_b[j+1] = sum_b[j]+b[j];
    } 
    ll ans=0;
    ll j=m;
    for(ll i=0; i<=n; i++){
        if(sum_a[i]>k) break;
        ll temp_max=k-sum_a[i];
        while(sum_b[j]>temp_max) j--;
        ans = max(ans,i+j);
    }
    cout << ans << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: expected ';' before ')' token
   12 |     a.resize(n+10));
      |                   ^
      |                   ;
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <queue>
#include <algorithm> // sort
#include <math.h>

#define DEBUG 0

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
                    //999999997000000003
                    //1000000000000000000

using namespace std;

int solve(){
    ll N,M,K;
    cin >> N >> M >> K;
    vector <ll> a(N);
    vector <ll> b(M);
    REP(i, N)cin >> a[i];
    REP(i, M)cin >> b[i];

    vector <ll> a_l_Sum(N+1,0);

    for(int i = 0; i < N; ++i)
    {
        a_l_Sum[i+1] = a[i] + a_l_Sum[i];
    }

    vector <ll> b_l_Sum(M+1,0);

    for(int i = 0; i < M; ++i)
    {
        b_l_Sum[i+1] = b[i] + b_l_Sum[i];
    }


    //なぜかdequeでつなげてたがそんなはずはなかった

    //a[0]～a[n-1] + 
    //b[0]～b[m-1]の最善をみつける

    //a[0]とb[0]は固定
    int res = 0;
    //Aの机の本を何冊読むか
    for(int i = 0; i <= N ; ++i)
    {
        //0冊のとき
        if((a_l_Sum[i] + b_l_Sum[0] <= K)
        {
                res = max(res, i);
        }
        int l = 0;
        int r = M+1;
        while (l+1 < r)
        {
            int mid = (l+r)/2;
            if(a_l_Sum[i] + b_l_Sum[mid] <= K)
            {
                l = mid; 
                res = max(res, i + mid);
            }
            else r = mid;
        }
    }

    cout << res << endl;

    return 0;
}

int main()
{
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'int solve()':
a.cc:54:42: error: expected ';' before '{' token
   54 |         if((a_l_Sum[i] + b_l_Sum[0] <= K)
      |                                          ^
      |                                          ;
   55 |         {
      |         ~                                 
a.cc:58:18: error: expected ')' before ';' token
   58 |         int l = 0;
      |                  ^
      |                  )
a.cc:54:11: note: to match this '('
   54 |         if((a_l_Sum[i] + b_l_Sum[0] <= K)
      |           ^
a.cc:60:16: error: 'l' was not declared in this scope
   60 |         while (l+1 < r)
      |                ^
Language: C++

#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <sstream>
#include <map>

// #pragma GCC optimize ("O3")

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, m; long long k; cin >> n >> m >> k;
    vector<long long> a(n);
    vector<long long> b(m);
    // vector<long long> sum_a(n+1);
    // vector<long long> sum_b(m+1);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < m; i++) cin >> b[i];
    // sum_a[0] = 0;
    // sum_b[0] = 0;
    // for (int i = 1; i < n+1; i++) sum_a[i] = sum_a[i-1] + a[i-1];
    // for (int i = 1; i < m+1; i++) sum_b[i] = sum_b[i-1] + b[i-1];

    // int lower_a = 0;
    // int lower_b = 0;
    // for (int i = 0; i < n; i++)
    //     if (sum_a[i] <= k)
    //         lower_a = i;
    // for (int i = 0; i < m; i++)
    //     if (sum_b[i] <= k)
    //         lower_b = i;
    // if (lower_a == 0 && lower_b == 0) {
    //     cout << 0;
    //     return 0;
    // }
    int out = 0;
    long long sum_sofar = 0;
    for (int i = 0; i < n; i++) {
        if (sum_sofar + a[i] <= k) {
            sum_sofar += a[i];
            out++;
        }
        else {
            break;
        }
    }
    int low = out - 1;
    // cout << low << " ";
    // sum = sum_a[out];
    int max_out = out;
    for (int j = 0; j < m; j++) {
        if (sum_sofar + b[j] <= k) {
            sum_sofar += b[j];
            out++;
            max_out = max(out, max_out);
            // cout << out << " ";
        }
        else {
            while (low >= 0 && sum_sofar + b[j] > k) {
                sum_sofar -= a[low];
                low--;
                out--;
                // cout << sum_sofar << " ";
            }
            if (sum_sofar + b[j] <= k) {
                sum_sofar += b[j];
                out++;
                max_out = max(out, max_out);
                // cout << sum_sofar << " ";
            }
            } else {
                break;
            }
        }
    }
    cout << max_out;

    // int out1 = 0;
    // int remain = k - sum_a[lower_a];
    // int i = 0;
    // while (i < sum_b.size() && sum_b[i] <= remain) {
    //     i++;
    // }
    // out1 = lower_a + i +1;

    // int out2 = 0;
    // remain = k - sum_b[lower_b];
    // i = 0;
    // while (i < sum_a.size() && sum_a[i] <= remain) {
    //     i++;
    // }
    // out2 = lower_b + i +1;
    // cout << max(out2, out1);


}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:15: error: 'else' without a previous 'if'
   78 |             } else {
      |               ^~~~
a.cc: At global scope:
a.cc:83:5: error: 'cout' does not name a type
   83 |     cout << max_out;
      |     ^~~~
a.cc:103:1: error: expected declaration before '}' token
  103 | }
      | ^
Language: C++

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

int main(){
    int n, m ,k ;
    cin >> n >> m >> k ;
    vector<int> a (n) ;
    vector<ll> b (m) ;
    rep(i, n) cin >> a[i] ;
    rep(i, m) cin >> b[i] ;
    ll sum = 0 ;
    rep(i, n){
        sum += a[i] ;
    }
    rep(i, m - 1) {
        b[i+1] += b[i] ;
    }
    if(b[m] + sum <= k){
        cout << n + m << endl ;
    }
    int ans = 0 ;
    int f = n ;
    for(int i = n - 1 ; i >= 0 ; i--){
        f-- ;
        sum -= a[i] ;
        ll t = k - sum ; 
        if(t < 0){
            ans = max(f, ans)
            continue ;
        }
        else {
            int p = lower_bound(b.begin(), b.end(), t) - b.begin() ;
            if(b[p] == t){
                p++ ;
            }
            ans= max(ans, p + f) ;
        }
    }
    cout << ans << endl ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:30: error: expected ';' before 'continue'
   34 |             ans = max(f, ans)
      |                              ^
      |                              ;
   35 |             continue ;
      |             ~~~~~~~~
Language: C++

#include <algorithm>
int main(){
    vector<long long>w;
    int x,z,m,l=0;
    cin>>x>>z>>m;
    long long a[x],n[z],sum=0;
    for (int i = 0; i <x ; ++i) {
        cin>>a[i];
        w.push_back(a[i]);
    }for (int i = 0; i <z ; ++i) {
        cin >> n[i];
        w.push_back(n[i]);
    }int y = w.size();
    sort(w.begin(), w.end());
    for (int j = 0; j <y ; ++j) {
        sum+=w[j];
        if(sum<=m){
            l++;
        }}cout<<l;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'vector' was not declared in this scope
    3 |     vector<long long>w;
      |     ^~~~~~
a.cc:3:12: error: expected primary-expression before 'long'
    3 |     vector<long long>w;
      |            ^~~~
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin>>x>>z>>m;
      |     ^~~
a.cc:9:9: error: 'w' was not declared in this scope
    9 |         w.push_back(a[i]);
      |         ^
a.cc:12:9: error: 'w' was not declared in this scope
   12 |         w.push_back(n[i]);
      |         ^
a.cc:13:14: error: 'w' was not declared in this scope
   13 |     }int y = w.size();
      |              ^
a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   14 |     sort(w.begin(), w.end());
      |     ^~~~
      |     std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:19:11: error: 'cout' was not declared in this scope
   19 |         }}cout<<l;
      |           ^~~~
Language: C++

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

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

    long long int A[N];
    rep(i, N){
        cin >> A[i];
    }

    long long int B[M];
    rep(i, M){
        cin >> B[i];
    }

    int time_A=0, time_B=0;
    int num_A=0, num_B=0;
    while(true){
        if(num_A == N) break;
        if(time_A+A[num_A] <= K) time_A += A[num_A++];
        else break;
    }
    //K時間でnum_A冊読める
    int ans=num_A;
    rep(i, num_A){
        int K_sub = K-time_A;
        while(true){
            if(num_B == M) break;
            if(time_B+B[num_B] <= K_sub) time_B += B[num_B++];
            else break;
        }
        if(ans <= num_A+num_B) ans = num_A+num_B;
        time_A -= A[num_A-1];
        num_A--;
    }

    if(num_A == 0){
        while(true){
            if(num_B == M) break;
            if(time_B+B[num_B] <= K_sub) time_B += B[num_B++];
            else break;
        }
        ans = num_B;
    }

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:35: error: 'K_sub' was not declared in this scope
   44 |             if(time_B+B[num_B] <= K_sub) time_B += B[num_B++];
      |                                   ^~~~~
Language: C++

int main(void){
    int n,m,k, ans = 0, x = 0;
    cin >> n >> m >> k;
    int a[n],b[m];
    long sum = 0, bsum = 0;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < m; i++){
        
        cin >> b[i];
        cout << "b[i] = " << b[i] << endl;
        bsum += b[i];
        cout << "bsum = " << bsum << endl;
    } 

    int y = m;
    while(k >= sum){
        while(y >= 0){
            //cout << bsum << endl;
            if(bsum + sum > k){
                //cout << b[y] << endl;
                //cout << bsum << endl;
                y--;
                bsum = bsum - b[y];
            }else break;
        }
        ans = max({ans,x + y});
        if(x == n) break;
        sum += a[x];
        x++;
    }

    cout << ans << endl;

    return 0;
}

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:10:9: error: 'cout' was not declared in this scope
   10 |         cout << "b[i] = " << b[i] << endl;
      |         ^~~~
a.cc:10:38: error: 'endl' was not declared in this scope
   10 |         cout << "b[i] = " << b[i] << endl;
      |                                      ^~~~
a.cc:26:15: error: 'max' was not declared in this scope
   26 |         ans = max({ans,x + y});
      |               ^~~
a.cc:32:5: error: 'cout' was not declared in this scope
   32 |     cout << ans << endl;
      |     ^~~~
a.cc:32:20: error: 'endl' was not declared in this scope
   32 |     cout << ans << endl;
      |                    ^~~~
Language: C


/*
*         ****FOX****
*/
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <limits>
//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#include <utility>
#include <list>
#include <cstdio>
#include<forward_list>
#include<algorithm>
#include<string>
#define Omar_Hafez ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 3.1415926536
#define ll long long
#define ull unsigned long long
#define lli long long int
using namespace std;
int main()
{
    Omar_Hafez
        ll n, m, k, x; cin >> n >> m >> k;
    queue<ll> a, b;
    queue<ll> a1, b1,a2,b2;


    for (ll i = 0; i < n; i++) { cin >> x; a.push(x); a1.push(x); a2.push(x); }
    for (ll i = 0; i < m; i++) { cin >> x; b.push(x); b1.push(x); b2.push(x); }
    ll sum = 0, sum1 = 0, sum2 = 0;
    ll ch = 0;
    while (1)
    {
        if (a1.size() == 0) break;
        if (ch + a1.front() <= k)
        {
            ch += a1.front();
            sum1++;
            a1.pop();
        }
        else break;
    }
    if (ch < k)
    {
        while (1)
        {
            if (b2.size() > 0 && ch + b2.front() <= k)
            {
                ch += b2.front();
                sum1++;
                b2.pop();
            }
            else break;
        }
    }
    ch = 0;
    while (1)
    {
        if (b1.size() == 0) break;
        if (ch + b1.front() <= k)
        {
            ch += b1.front();
            sum2++;
            b1.pop();
        }
        else break;
    }
    if (ch < k)
    {
        while (1)
        {
            if (a2.size() > 0 && ch + a2.front() <= k)
            {
                ch += a2.front();
                sum2++;
                a2.pop();
            }
            else break;
        }
    }
    /*
    ch = 0;
    while (1)
    {
        if (a.size() == 0 && b.size() == 0 || k == 0) break;
        else if (a.size() > 0 && b.size() > 0)
        {
            if (a.front() <= b.front())
            {
                if ((ch + a.front()) <= k) { sum++; ch += a.front(); a.pop(); }
                else break;
            }
            else
            {
                if ((ch + b.front()) <= k) { sum++; ch += b.front(); b.pop(); }
                else break;
            }
        }
        else if (a.size() > 0 && b.size() == 0)
        {
            if ((ch + a.front()) <= k) { sum++; ch += a.front(); a.pop(); }
            else break;
        }
        else if (b.size() > 0 && a.size() == 0)
        {
            if ((ch + b.front()) <= k) { sum++; ch += b.front(); b.pop(); }
            else break;
        }
    }
    */
    return cout << max(max(sum, sum1), sum2), 0;
}


Compiler output:
main.c:5:10: fatal error: iostream: No such file or directory
    5 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N,M,K;
    cin >> N >> M >> K;
    long long Arr1[N+1], Arr2[M+1];
    vector <long long> cumm1, cumm2;
    cumm1.push_back(0); cumm2.push_back(0);
    for (int i = 1; i <= N; i++){
        cin >> Arr1[i];
        cumm1.push_back(cumm1[i-1] + Arr1[i]);
    }
    for (int i = 1; i <= M; i++){
        cin >> Arr2[i];
        cumm2.push_back(cumm2[i-1] + Arr2[i]);
    }
    auto upper = upper_bound(cumm1.begin(), cumm1.end(), K);
    idx1 = (upper - cumm1.begin()) - 1;
    long long minutes = K - cumm1[idx1];
    auto upper2 = upper_bound(cumm2.begin(), cumm2.end(), minutes);
    idx1 += (upper2 - cumm2.begin()) - 1;
    auto upper3 = upper_bound(cumm2.begin(), cumm2.end(), K);
    int idx2 = (upper3 - cumm2.begin()) - 1;
    minutes = K - cumm2[idx2];
    auto upper4 = lower_bound(cumm1.begin(), cumm1.end(), minutes);
    idx2 += (upper4 - cumm1.begin()) - 1;
    cout << max(idx1, idx2);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'idx1' was not declared in this scope
   20 |     idx1 = (upper - cumm1.begin()) - 1;
      |     ^~~~
Language: C++

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

int main() {
  int N,M,K; cin>>N>>M>>K;
  vector<int> 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);
  vector<int> A(N),B(M);
  A.at(0)=a.at(0);
  B.at(0)=b.at(0);
  for(int i=1;i<N;i++) A.at(i)=A.at(i-1)+a.at(i);
  for(int i=1;i<M;i++) B.at(i)=B.at(i-1)+b.at(i);
  int best;
  int x1=M-1;
  while(x1>0){
    if(B.at(x1)<K){
      x1=best;
      break;
    }
    x1--;
    if(x1==0) best=0;
  }
  vector<int> ans(N+1);
  ans.at(0)=best;
  for(int i=0;i<N;i++){
    if(A.at(i)>K) break;
    int x2=best;
    while(x2>0){
      if(A.at(i)+B.at(x2)<K) break;
      x2--;
    }
    ans.at(i)=(i+1)+x2;
  }
  sort(ans.begin(),ans.end());
  cout<<ans(N)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:12: error: no match for call to '(std::vector<int>) (int&)'
   36 |   cout<<ans(N)<<endl;
      |         ~~~^~~
Language: C++

#include <sys/_types/_int64_t.h>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>
#include <set>
#include <string>

using namespace std;

int main() {
    int64_t n, m, k;
    cin >> n >> m >> k;
    vector<int64_t> a_vec(n);
    vector<int64_t> b_vec(m);
    for (int64_t i = 0; i < n; ++i) cin >> a_vec[i];
    for (int64_t i = 0; i < m; ++i) cin >> b_vec[i];

    vector<int64_t> accumulate_a(n + 1);
    for (int64_t i = 1; i < n + 1; ++i)
        accumulate_a[i] = accumulate_a[i - 1] + a_vec[i];
    vector<int64_t> accumulate_b(m + 1);
    for (int64_t i = 1; i < m + 1; ++i)
        accumulate_b[i] = accumulate_b[i - 1] + b_vec[i];
    int64_t ans = 0;
    for (int64_t i = 0; i < n; ++i) {
        if (k - a_vec[i] < 0) break;
        int64_t tmp = i + distance(accumulate_a.begin(),
                                   lower_bound(accumulate_a.begin(),
                                               accumulate_a.end(),
                                               k - a_vec[i]));
        ans         = max(ans, tmp);
    }
    for (int64_t i = 0; i < m; ++i) {
        if (k - b_vec[i] < 0) break;
        int64_t tmp = i + distance(accumulate_b.begin(),
                                   lower_bound(accumulate_b.begin(),
                                               accumulate_b.end(),
                                               k - b_vec[i]));
        ans         = max(ans, tmp);
    }

    cout << max(int64_t(0), ans-1) << endl;

    return 0;
}


Compiler output:
a.cc:1:10: fatal error: sys/_types/_int64_t.h: No such file or directory
    1 | #include <sys/_types/_int64_t.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <stdio.h>
using namespace std;

int main() {
	int64_t n, m, k; cin >> n >> m >> k;
	vector<int64_t> a(n + 1); vector<int64_t> b(m + 1);
	for (int64_t i = 0; i < n; i++) cin >> a.at(i);
	for (int64_t i = 0; i < m; i++) cin >> b.at(i);
	a.at(n) = 200001; b.at(m) = 200001;


	int64_t i = 0; int64_t j = 0; int64_t All = 0; int64_t count;
	while (i < n + 1 && j < m + 1) {
		if (a.at(i) < b.at(j)) {
			All += a.at(i); i++;
		}
		else if (a.at(i) > b.at(j)) {
			All += b.at(j); j++;
		}
		else {
			if (a.at(i + 1) > b.at(j + 1)) All += b.at(j); j++;
			if (a.at(i + 1) < b.at(j + 1))All += a.at(i); i++;
		}

		if (All == k) {
			count = i + j;
			break;
		} else if(All > k) {
			count = i + j - 1;
			break;
		}

	 cout << count << endl;
}

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

int main() {
  long long n,m,k;
  cin>>n>>m>>k;
  long long a[n+1],b[m+1];
  for (int i=1;i<=n;i++){
    cin>>a[i];
  }
  for (int i=1;i<=m;i++){
    cin>>b[i];
  }
  long long time=0,ans=0,A=1,B=1;
  while (time<k){
    if (a[A]<b[B]||B==m) {
      time+=a[A];
      A++;
      ans++;
    }
    else if (a[A]==b[B]){
      if (a[A+1]>b[B+1]){
        time+=b[B];
        B++;
        ans++;
      }
      else {
        time+=a[A];
        A++;
        ans++;
      }
    }
    else {
      time+=b[B];
      B++;
      ans++;
    }
    if (A==n&&B==m) break;
  }
  if (time>k) ans--;
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin>>n>>m>>k;
      |   ^~~
a.cc:38:3: error: 'cout' was not declared in this scope
   38 |   cout<<ans<<endl;
      |   ^~~~
a.cc:38:14: error: 'endl' was not declared in this scope
   38 |   cout<<ans<<endl;
      |              ^~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: 'answer' was not declared in this scope
   20 |             answer=max(val,(i+j));
      |             ^~~~~~
Language: C++

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

int main()
{
    int n,m,k,a;
    vector <int> nbooks,mbooks;
    cin >> n >> m >> k;
    if(1>n || n>200000 || 1>m || m>200000 || 1>k || k>1000000000)
        return 0;
    for(int i=0;i<n;i++){
        cin >> a;
        if(1>a||a>1000000000)
            return 0;
        nbooks.push_back(a);
    }
    for(int i=0;i<m;i++){
        cin >> a;
        if(1>a||a>1000000000)
            return 0;
        mbooks.push_back(a);
    }
    int smallest = 0,total =0;
    int nindex =0,mindex=0;
    int counter=0;
    while(true){
        if(counter==n+m){
            cout << counter;
            return 0;
        }
        if(nbooks[nindex]<mbooks[mindex]){
            smallest = nbooks[nindex];
            nindex++;
            if(total <= INT_MAX-smallest){
                if(total<=k-smallest)
                    total = total + smallest;
                }
            else
                break;

        }
        else{
            smallest = mbooks[mindex];
            mindex++;
            if(total <= INT_MAX-smallest){
                if(total<=k-smallest)
                    total = total + smallest;
                }
            else
                break;

        }
        counter++;
    }
    cout << counter;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:25: error: 'INT_MAX' was not declared in this scope
   35 |             if(total <= INT_MAX-smallest){
      |                         ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | using namespace std;
a.cc:46:25: error: 'INT_MAX' was not declared in this scope
   46 |             if(total <= INT_MAX-smallest){
      |                         ^~~~~~~
a.cc:46:25: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
using namespace std;
int main()
{
    int n, m, ans = 0, maxi = -1;
    long long k;
    cin >> n >> m >> k;
    int a[n], b[m];
    long long total = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        if(total + a[i] <= k)
        {
            total += a[i];
            maxi = i;
        }
    }
    for(int i = 0; i < m; i++)
    {
        cin >> b[i];
    }
    for(int i = maxi, j = -1; i >= -1; i--)
    {
        while(j < m && total <= k)
        {
            total += b[++j];
        }
        ans = max(ans, i + j + 1);
        if(i >= 0)
        {
            total -= a[i];
        }
    }
    cout << ans << endl;
    return 0;
}
#include <iostream>
using namespace std;
int main()
{
    int n, m, ans = 0, maxi = -1;
    long long k;
    cin >> n >> m >> k;
    int a[n], b[m];
    long long total = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        if(total + a[i] <= k)
        {
            total += a[i];
            maxi = i;
        }
    }
    for(int i = 0; i < m; i++)
    {
        cin >> b[i];
    }
    for(int i = maxi, j = -1; i >= -1; i--)
    {
        while(j < m && total <= k)
        {
            total += b[++j];
        }
        ans = max(ans, i + j + 1);
        if(i >= 0)
        {
            total -= a[i];
        }
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc:40:5: error: redefinition of 'int main()'
   40 | int main()
      |     ^~~~
a.cc:3:5: note: 'int main()' previously defined here
    3 | int main()
      |     ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int y,x,m,sum=0;
    bool flag1=true ,flag2=true;
    cin>>x>>y>>m;
    stack<int>st;
    stack<int>st1;
    int arr[x];
    int arr1[y];
    for(int i=0 ; i<x ; i++){
        cin>>arr[i];
    }
    for(int i=x-1 ; i>=0 ; i--){
        st.push(arr[i]);
    }
    for(int i=0 ; i<y ; i++){
        cin>>arr1[i];
    }
    for(int i=y-1 ; i>=0 ; i--){
        st1.push(arr1[i]);
    }
    int z=n+m;
    for(int i=0 ; i<=z ; i++){
        if(st.top()<=st1.top()&& m-st.top()>=0 && flag1==true){
            m-=st.top();
            if(st.size()){
               st.pop();
            }
            else{
                flag1=false;
            }
            sum++;
        }
        else if(st.top()>=st1.top()&& m-st1.top()>=0 && flag2==true ){
              m-=st1.top();
            if(st1.size()){
              st1.pop();
            }
            else{
              flag2=false;
            }
            sum++;
        }
    }
    cout<<sum;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:11: error: 'n' was not declared in this scope
   26 |     int z=n+m;
      |           ^
Language: C++

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

int main() {
	vector<long>a;
	vector<long>b;
	int a_num = 0, b_num = 0;
	long time = 0;
	long num = 0;
	int book_count = 0;
	cin >> a_num >> b_num >> time;


	for (int i = 0; i < a_num; i++) {
		cin >> num;
		a.push_back(num);
	}

	for (int i = 0; i < b_num; i++) {
		cin >> num;
		b.push_back(num);
	}
	reverse(a.begin(), a.end());
	reverse(b.begin(), b.end());

	while (time > 0) {
		if (b.size() == 0 && a.size() == 0) {
			break;
		}
		else if ((a.size() == 0) && (time >= b[b.size() - 1])) {
			time -= b[b.size() - 1];
			b.pop_back();
			book_count++;
		}
		else if ((b.size()==0) && (a[a.size() - 1] <= time)) {
			time -= a[a.size() - 1];
			a.pop_back();
			book_count++;
		}
		else if ((a[a.size()-1] <= b[b.size()-1]) && (a[a.size()-1] <= time)) {
			time -= a[a.size()-1];
			a.pop_back();
			book_count++;
		}
		else if ((a[a.size()-1] >= b[b.size()-1]) && (time >= b[b.size()-1])) {
			time -= b[b.size()-1];
			b.pop_back();
			book_count++;
		}
		else if ((time < b[b.size() - 1]) && (a[a.size() - 1] > time)) {
			break;
		}
	}
	
	cout << book_count;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'reverse' was not declared in this scope
   24 |         reverse(a.begin(), a.end());
      |         ^~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <string>
#include <cstdint>
#include <iterator>
#include <algorithm>
#include <fstream>
#include <unordered_map>

using namespace std;

#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define Int int_fast64_t

Int n,m,k,a[200000],b[200000];

Int solve(Int i,Int j,Int K)
{
    if(N<0)
        return -1;
    if(K==0)
        return 0;
    if(i==n && j==m)
        return 0;
    if(a[i]<=K || b[j]<=K)
        return 1+max(solve(i,j+1,K-b[j]),solve(i+1,j,K-a[i]));
    return 0;

}

int main()
{
    FAST_IO;

    cin >> n >> m >> k;
    for(Int i=0;i<n;++i) {
        cin >> a[i];
    }
    a[n]=k;
    for(Int i=0;i<m;++i) {
        cin >> b[i];
    }
    b[m]=k;
    cout << solve(0,0,k) << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int_fast64_t solve(int_fast64_t, int_fast64_t, int_fast64_t)':
a.cc:18:8: error: 'N' was not declared in this scope
   18 |     if(N<0)
      |        ^
Language: C++

#include <bits/stdc++.h>
#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define maxn 5005
#define mod 998244353
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define vv(z,a,b) vector<vector<int>>z(a,vector<int>(b))
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(c) begin(c),end(c)
#define pp pair<int,int>
#define fix(n) fixed << setprecision(n)
#define gmax(a,b) __gcd(a,b)
#define gmin(a,b) a/__gcd(a,b)*b
using namespace std;


int main(){

int n,m,k;
cin>>n>>m>>k;
vll a(n+1);
vll b(m+1);
rep(i,n+1){
ll an=0;

if(i==0)a.at(i)=0;
else {
cin>>an;
a.at(i)=a.at(i-1)+an;
}
}
rep(i,m+1){
int an=0;
if(i==0)b.at(i)=0;
else {
cin>>an;
b.at(i)=b.at(i-1)+an;
}
}
ll sum=0;
ll ans=0;
int ko=0;
rep(i,n){
	for(int j=m;j>0;--j){
		sum=a.at(i)+b.at(j);
		if(sum<=k){
			ll anti =i+j;
			ans=max(ans,anti);
		}
		m=j;
	}


cout<<ans<<endl;

return 0;
}

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

#include <bits/stdc++.h>
#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define maxn 5005
#define mod 998244353
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define vv(z,a,b) vector<vector<int>>z(a,vector<int>(b))
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(c) begin(c),end(c)
#define pp pair<int,int>
#define fix(n) fixed << setprecision(n)
#define gmax(a,b) __gcd(a,b)
#define gmin(a,b) a/__gcd(a,b)*b
using namespace std;


int main(){

int n,m,k;
cin>>n>>m>>k;
vll a(n+1);
vll b(m+1);
rep(i,n+1){
ll an=0;

if(i==0)a.at(i)=0;
else {
cin>>an;
a.at(i)=a.at(i-1)+an;
}
}
rep(i,m+1){
int an=0;
if(i==0)b.at(i)=0;
else {
cin>>an;
b.at(i)=b.at(i-1)+an;
}
}
ll sum=0;
ll ans=0;
itn ko=0;
rep(i,n){
	for(int j=m;j>0;--j){
		sum=a.at(i)+b.at(j);
		if(sum<=k){
			ll anti =i+j;
			ans=max(ans,anti);
		}
		m=j;
	}


cout<<ans<<endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:1: error: 'itn' was not declared in this scope; did you mean 'int'?
   51 | itn ko=0;
      | ^~~
      | int
a.cc:66:2: error: expected '}' at end of input
   66 | }
      |  ^
a.cc:26:11: note: to match this '{'
   26 | int main(){
      |           ^
Language: Java

import java.util.Scanner;

public class C {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int k = scanner.nextInt();
        int[] da = new int[n];
        int[] db = new int[m];
        for (int i = 0; i < n; i++) {
            da[i] = scanner.nextInt();
        }
        for (int i = 0; i < m; i++) {
            db[i] = scanner.nextInt();
        }
        int pa = 0, pb = 0;
        int ans = 0;
        for (int i = 0; i < n + m; i++) {
            if (pa == n) {
                if (k >= db[pb]) {
                    k -= db[pb++];
                    ans++;
                } else {
                    break;
                }
            } else if (pb == m) {
                if (k >= da[pa]) {
                    k -= da[pa++];
                    ans++;
                } else {
                    break;
                }
            } else {
                if (k < Math.min(da[pa], db[pb])) break;
                if (da[pa] < db[pb]) {
                    k -= da[pa++];
                } else {
                    k -= db[pb++];
                }
                ans++;
            }
        }
        System.out.println(ans);
    }
}

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

#include<bits/stdc++.h>
#include<time.h>
#pragma GCC optimize(2) 
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    int n,m,k,i,ia,ib;
    cin.tie(0);
    cout.tie(0);
    cin>>n>>m>>k;
    int a[n+1],b[m+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    long long tt=0;
    for(i=1;i<=m;i++)
	{
        cin>>b[i];
        tt+=b[i];
    }
    int ans=0;
    ia=0;
    ib=m;
    for(ia=0,ib=m;ia<=n;ia++)
	{
        tot+=a[ia];
        while(tt>k&&ib>0)
        	tt-=b[ib--];
        if(tt>k)
        	break;
        ans=max(ans,ia+ib);
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'tot' was not declared in this scope; did you mean 'tt'?
   26 |         tot+=a[ia];
      |         ^~~
      |         tt
Language: C++

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

int main(){
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])

for i in range(M):
  b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)

print(ans)

}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:1: error: 'N' was not declared in this scope
    5 | N, M, K = map(int, input().split())
      | ^
a.cc:5:4: error: 'M' was not declared in this scope
    5 | N, M, K = map(int, input().split())
      |    ^
a.cc:5:7: error: 'K' was not declared in this scope
    5 | N, M, K = map(int, input().split())
      |       ^
a.cc:5:20: error: 'input' was not declared in this scope; did you mean 'int'?
    5 | N, M, K = map(int, input().split())
      |                    ^~~~~
      |                    int
a.cc:5:14: error: missing template arguments before '(' token
    5 | N, M, K = map(int, input().split())
      |              ^
a.cc:5:15: error: expected primary-expression before 'int'
    5 | N, M, K = map(int, input().split())
      |               ^~~
Language: C++

#include <iostream>
using namespace std;
int main(void){
    int NM, N, M, K, c, ans;
    cin >> N >> M >> K;
    int A[N], B[M], C[c];
    for(int a = 1;a<N;a++){
        cin >> A[a];
    }
    for(int b = 1;b<N;b++){
        cin >> B[b];
    }
    a=1;
    b=1;
    for(){
        if()

        if(ans<A[a]+B[b]){
            ans = A[a]+B[b];
        }
    }
}
c問題

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'a' was not declared in this scope
   13 |     a=1;
      |     ^
a.cc:14:5: error: 'b' was not declared in this scope
   14 |     b=1;
      |     ^
a.cc:15:9: error: expected primary-expression before ')' token
   15 |     for(){
      |         ^
a.cc:22:1: error: expected primary-expression before '}' token
   22 | }
      | ^
a.cc:21:6: error: expected ';' before '}' token
   21 |     }
      |      ^
      |      ;
   22 | }
      | ~     
a.cc:22:1: error: expected primary-expression before '}' token
   22 | }
      | ^
a.cc:21:6: error: expected ')' before '}' token
   21 |     }
      |      ^
      |      )
   22 | }
      | ~     
a.cc:15:8: note: to match this '('
   15 |     for(){
      |        ^
a.cc:22:1: error: expected primary-expression before '}' token
   22 | }
      | ^
a.cc: At global scope:
a.cc:23:1: error: 'c\U0000554f\U0000984c' does not name a type
   23 | c問題
      | ^~~~~
Language: C++

#include <iostream>

using namespace std;

typedef long long ll;

int main() {
    ll N, M, K;
    cin >> N >> M >> K;
    ll *A = new ll[N], *B = new ll[M];
    for (int i = 0; i < N; i++)
        cin >> A[i];
    for (int i = 0; i < M; i++)
        cin >> B[i];
    ll *a = new ll[N], *b = new ll[M];
    a[0] = A[0], b[0] = B[0];

    for (int i = 1; i < N; i++)
        a[i] = a[i-1]+A[i];
    for (int i = 1; i < M; i++)
        b[i] = b[i-1]+B[i];

    ll ans = 0;
    for (int i = 0; i < N; i++) {
        if (K-a[i] >= 0) {
            ll *c = upper_bound(b, b+M, K-a[i]);
            ll ind =(ll)(c-b);
            ans = max(ans, i+1+ind);
        }
    }
    ll *c = upper_bound(b, b+M, 0);
    ans = max(ans, (ll)(c-b));
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: 'upper_bound' was not declared in this scope
   26 |             ll *c = upper_bound(b, b+M, K-a[i]);
      |                     ^~~~~~~~~~~
a.cc:31:13: error: 'upper_bound' was not declared in this scope
   31 |     ll *c = upper_bound(b, b+M, 0);
      |             ^~~~~~~~~~~
Language: C++

#include <iostream>

using namespace std;

typedef long long ll;

int main() {
    ll N, M, K;
    cin >> N >> M >> K;
    ll *A = new ll[N], *B = new ll[M];
    for (int i = 0; i < N; i++)
        cin >> A[i];
    for (int i = 0; i < M; i++)
        cin >> B[i];
    ll *a = new ll[N], *b = new ll[M];
    a[0] = A[0], b[0] = B[0];

    for (int i = 1; i < N; i++)
        a[i] = a[i-1]+A[i];
    for (int i = 1; i < M; i++)
        b[i] = b[i-1]+B[i];

    ll ans = 0;
    for (int i = 0; i < N; i++) {
        if (K-a[i] >= 0) {
            ll ind = upper_bound(b, b+M, K-a[i])-b;
            ans = max(ans, i+1+ind);
        }
    }

    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:22: error: 'upper_bound' was not declared in this scope
   26 |             ll ind = upper_bound(b, b+M, K-a[i])-b;
      |                      ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n,m,k;
    unsigned long int t=0;
    cin >> n >> m >> k;
    vector<int> a(n);
    vector<int> b(m);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<m;i++){
        cin >> b[i];
    }
    for(int i=0;i<m;i++){
        t = t + b[i];
    }
    int j = m;
    int ans = 0;
    for(int i=0;i<n+1;i++){
        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;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:14: error: 'K' was not declared in this scope
   26 |         if(t>K){
      |              ^