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

#include<iostream>
#define ll long long int

using namespace std;

int main()
{
  ll N, M, K, i, j, temp, c;
  cin>>N>>M>>K;
  ll A[N], B[M];
  for(i=0; i<N; i++)
    cin>>A[i];
  for(i=0; i<M; i++)
    cin>>B[i];
 for(int i=0; i<N; i++)
 {
   for(j=i+1; j<N; j++)
   {
     if(A[i]>A[j])
        {
          temp=A[i];
          A[i]=A[j];
          A[j]=temp;
     }
   }
 }
  for(int i=0; i<M; i++)
 {
   for(j=i+1; j<M; j++)
   {
     if(B[i]>B[j])
        {
          temp=B[i];
          B[i]=B[j];
          B[j]=temp;
     }
   }
 }
  i=0;
  j=0;
  if(A[0]>K || B[0]>K)
  {
    cout<<"0";
    return 0;
  }
  c=0;
  while(i<=N || j<=M)
  {
    if(K<0)
      break;
    if(A[i]<=B[j]
       {
         K-=A[i];
         i++;
         c++;
       }
       else
       {
         K-=B[j];
         j++;
         c++;
       }
       }
       cout<<c;
       return 0;
       }
    
                
  

Compiler output:
a.cc: In function 'int main()':
a.cc:51:18: error: expected ')' before '{' token
   51 |     if(A[i]<=B[j]
      |       ~          ^
      |                  )
   52 |        {
      |        ~          
a.cc:63:8: error: expected primary-expression before '}' token
   63 |        }
      |        ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){
	int a,b,t;
	cin>>a>>b>>t;
	vector <int> A, B, Asum, Bsum;
	Asum.push_back(0);
	Bsum.push_back(0);
	for (int i = 1; i <= a; ++i)
	{
		int tmp;
		cin >> tmp;
		A.push_back(tmp);
		Asum[i] = Asum[i-1]+tmp;
	}
	for (int i = 1; i <= b; ++i)
	{
		int tmp;
		cin >> tmp;
		B.push_back(tmp);
		Bsum[i] = Bsum[i-1]+tmp;
	}
	int dem=0;
	for (int i = 1; i <= a; ++i)
	{
		for (int j = 1; j <= b; ++j)
		{
			if(Asum[i]+Bsum[j]>k){
				break;
			}
			else{
				if(dem<i+j)
					dem = i+j;
			}
		}
	}
	cout<<dem;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:44: error: 'k' was not declared in this scope
   29 |                         if(Asum[i]+Bsum[j]>k){
      |                                            ^
Language: C++

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

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  long long N, M, K;
  cin >> N >> M >> K;

  vector<long long> A(N), a(N + 1, 0), B(M), b(M + 1, 0);
  for(int i = 0; i < N; ++i) {
    cin >> A[i];
    a[i + 1] = a[i] + A[i];
  }
  for(int i = 0; i < M; ++i) {
    cin >> B[i];
    b[i + 1] = b[i] + B[i];
  }

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:30:26: error: expected ';' before '}' token
   30 |     ans = max(ans, i + j)
      |                          ^
      |                          ;
   31 |   }
      |   ~
Language: C++

#include<bits/stdc++.h>

using namespace std;

const int INF = int(1e9+20);

int main(){
  
  long long n, m, k, ans = 0;
  
  cin >> n >> m >> k;
  
  vector<long long> a(n), b(m), prefa(n), prefb(m);
  
  for(int i = 0; i < n; i++) cin >> a[i];
  
  for(int i = 0; i < m; i++) cin >> b[i];
  
  prefa[0] = a[0];
  
  for(int i = 1; i < n; i++) prefa[i] = a[i]+ prefa[i-1];
  
  prefb[0] = b[0];
  
  for(int i = 1; i < m; i++) prefb[i] = b[i]+ prefb[i-1];

  
  for(int i = 0; i < n; i++){
     if (prefa[i] > k) break;
     
     int k1 = k;
     k1 -= prefa[i];
     
     int p = upper_bound(prefb.begin(), prefb.end(), k1) - prefb.begin()-1;
     ans = max(ans, i+p+2);
  }
  
  cout << ans;
}

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

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

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

    vector<int64_t> s_a(n+1);
    vector<int64_t> s_b(m+1);
    for(i = 0; i < n; i++) {
        s_a[i+1] = s_a[i] + a[i];
    }
    for(i = 0; i < m; i++) {
        s_b[i+1] = s_b[i] + b[i];
    }

    auto ans = 0;
    for(i = 0; i < n+1; i++) {
        if (s_a[i] > k) {
            break;
        }

        auto tmp = upper_bound(s_b.begin(), s_b.end(), k - s_a[i]) - s_b.begin();
        ans = max(ans, tmp + i - 1);
    }
    cout << ans << endl;
}


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

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

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

    vector<int64_t> s_a(n+1);
    vector<int64_t> s_b(m+1);
    for(i = 0; i < n; i++) {
        s_a[i+1] = s_a[i] + a[i];
    }
    for(i = 0; i < m; i++) {
        s_b[i+1] = s_b[i] + b[i];
    }

    int ans = 0;
    for(i = 0; i < n+1; i++) {
        if (s_a[i] > k) {
            break;
        }

        auto tmp = upper_bound(s_b.begin(), s_b.end(), k - s_a[i]) - s_b.begin();
        ans = max(ans, tmp + i - 1);
    }
    cout << ans << endl;
}


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

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    long long n, m, k;
    cin >> n >> m >> k;
 
    long long a[n];
    long long b[m];

    for(int i=0; i<n; i++)
        cin >> a[i];

    for(int i=0; i<m; i++)
        cin >> b[i];

    int ans = 0;
    for(int i=0; i<=n; i++){
        long long num = k;
        int counter = 0;
        if(a[i] > k)
            break;
        if(a[i] > 0)
            num -= a[i - 1];
        int counter = 0;
        while(num - b[i] > 0){
            counter++;
            num -= b[i];
        }
        ans = max(ans, i+counter);
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:25:13: error: redeclaration of 'int counter'
   25 |         int counter = 0;
      |             ^~~~~~~
a.cc:20:13: note: 'int counter' previously declared here
   20 |         int counter = 0;
      |             ^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    long long n, m, k;
    cin >> n >> m >> k;
 
    long long a[n];
    long long b[m];

    for(int i=0; i<n; i++)
        cin >> a[i];

    for(int i=0; i<m; i++)
        cin >> b[i];

    int ans = 0;
    for(int i=0; i<=n; i++){
        long long num = k;
        if(a[i] > k)
            break;
        if(a[i] > 0)
            num -= a[i - 1];
        int counter = 0;
        while(num - b[i] > 0){
            counter++;
            num -= b[i];
        }
        ans = max(ans, i+j);
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:29:26: error: 'j' was not declared in this scope
   29 |         ans = max(ans, i+j);
      |                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    long long n, m, k;
    cin >> n >> m >> k;
 
    long long a[n];
    long long b[m];

    for(int i=0; i<n; i++)
        cin >> a[i];

    for(int i=0; i<m; i++)
        cin >> b[i];

    for(int i=0; i<=n; i++){
        long long num = k;
        if(a[i] > k)
            break;
        if(a[i] > 0)
            num -= a[i - 1];
        int counter = 0;
        while(num - b[i] > 0){
            counter++;
            num -= b[i];
        }
        ans = max(ans, i+j);
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |         ans = max(ans, i+j);
      |         ^~~
      |         abs
a.cc:28:26: error: 'j' was not declared in this scope
   28 |         ans = max(ans, i+j);
      |                          ^
a.cc:31:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C


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

const int maxn=2e5+9;
int n,m;
int a[maxn],b[maxn],k;

void _solve(){
    scanf("%d%d%d",&n,&m,&k);
    int i,j;
    for(i=1;i<=n;++i) scanf("%d",a+i);
    for(i=1;i<=m;++i) scanf("%d",b+i);
    int t=0;
    for(i=1;i<=n;++i){
        if(t+a[i]>k) break;
        t+=a[i];
    }
    i-=1;
    for(j=1;j<=m;++j){
        if(t+b[j]>k) break;
        t+=b[j];
    }
    j-=1;
    int ans=i+j;
    for(;i>=1;--i){
        t-=a[i];
        while(j+1<=m && t+b[j+1]<=k){
            j+=1;
            t+=b[j];
        }
        ans=max(ans,i+j);
    }
    printf("%d\n",ans);
}

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


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

import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int k = sc.nextInt();
    int arr1[] = new int[n];
    int arr2[] = new int[m];
    for(int i=0;i<n;i++){
    	arr[i] = sc.nextInt();
    }
    for(int i=0;i<m;i++){
    	arr1[i] = sc.nextInt();
    }
    int i=0,j=0,count=0;
    int res =0;
    while(res<=k){
    	if(arr[i]<arr1[j]){
        	res+=arr[i];
          	i++;
          count++;
        }
      	else{
        	res+=arr1[j];
          	j++;
          count++;
        }
    }
    System.out.println(count);
    
  	
  }

}
  

Compiler output:
Main.java:11: error: cannot find symbol
    	arr[i] = sc.nextInt();
    	^
  symbol:   variable arr
  location: class Main
Main.java:19: error: cannot find symbol
    	if(arr[i]<arr1[j]){
    	   ^
  symbol:   variable arr
  location: class Main
Main.java:20: error: cannot find symbol
        	res+=arr[i];
        	     ^
  symbol:   variable arr
  location: class Main
3 errors
Language: C++

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

#define fo(i,n) for (int i = 0; i < n; ++i)
#define tr(i,n) for(auto i=n.begin();i!=n.end();i++)
#define w(t) while(t--)
#define ll long long int
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define fst ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
const int mod = 1e9 + 7;

int main() {

    int n, m, k;
    cin >> n >> m >> k;
    stack<ll>a, b;
    while (n--)
    {
        ll x;
        cin >> x;
        a.pb(x);
    }
    while (m--)
    {
        ll x;
        cin >> x;
        b.pb(x);
    }

    ll tot_sum=0,count=0;
    while(tot_sum<k)
    {
        if( !(a.empty()) && !(b.empty))
        {
            if(a.top()<b.top())
            {
                tot_sum+=a.top();
                a.pop();
            }
            else
            {
                tot_sum+=b.top();
                b.pop();

            }
        }
        else if(!a.empty())
        {
            tot_sum+=a.top();
                a.pop();
        }
        else{
            tot_sum+=b.top();
                b.pop();
        }

        if(tot_sum>k)
            break;
        count++;
    }
    cout<<count;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:12: error: 'class std::stack<long long int>' has no member named 'push_back'
    8 | #define pb push_back
      |            ^~~~~~~~~
a.cc:25:11: note: in expansion of macro 'pb'
   25 |         a.pb(x);
      |           ^~
a.cc:8:12: error: 'class std::stack<long long int>' has no member named 'push_back'
    8 | #define pb push_back
      |            ^~~~~~~~~
a.cc:31:11: note: in expansion of macro 'pb'
   31 |         b.pb(x);
      |           ^~
a.cc:37:38: error: cannot convert 'std::stack<long long int>::empty' from type 'bool (std::stack<long long int>::)() const' to type 'bool'
   37 |         if( !(a.empty()) && !(b.empty))
      |                                      ^
a.cc:37:33: error: in argument to unary !
   37 |         if( !(a.empty()) && !(b.empty))
      |                              ~~~^~~~~~
Language: C++

n,m,k = map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

aa = [0]
bb = [0]

for i in range(n):
	aa.append(a[i]+aa[i])

for i in range(m):
	bb.append(b[i]+bb[i])

ans=0
j=m
for i in range(n+1):
	if aa[i]>k:
		break
	while bb[j]>k-aa[i]:
		j-=1
	ans=max(i+j,ans)
print(ans)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,m,k = map(int,input().split())
      | ^
Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
int main(){

int N,M,K,ans,i,j,sum=0;

std::cin>>N>>M>>K;

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

for(int i=1;i<=M;++i){
    std::cin>>B[i];
}

i=j=1;
while(i<=N&&sum+A[i]<=K){
    sum+=A[i];
    i++;
}
while(j<=M&&sum+B[j]<=K){
    sum+=B[j];
    j++;
}
i--,j--; ans=i+j;

while(i){
    sum-=A[i];
    i--;
    j++;
    while(j<=M&&sum+B[j]<=K){
        sum+=B[j];
        j++;
    }j--;
    ans=std::max(ans,i+j);

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:6: error: 'vector' is not a member of 'std'
   10 | std::vector<int>A(N);
      |      ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include<algorithm>
  +++ |+#include <vector>
    4 | int main(){
a.cc:10:13: error: expected primary-expression before 'int'
   10 | std::vector<int>A(N);
      |             ^~~
a.cc:11:6: error: 'vector' is not a member of 'std'
   11 | std::vector<int>B(M);
      |      ^~~~~~
a.cc:11:6: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:11:13: error: expected primary-expression before 'int'
   11 | std::vector<int>B(M);
      |             ^~~
a.cc:13:15: error: 'A' was not declared in this scope
   13 |     std::cin>>A[i];
      |               ^
a.cc:17:15: error: 'B' was not declared in this scope
   17 |     std::cin>>B[i];
      |               ^
a.cc:21:17: error: 'A' was not declared in this scope
   21 | while(i<=N&&sum+A[i]<=K){
      |                 ^
a.cc:25:17: error: 'B' was not declared in this scope
   25 | while(j<=M&&sum+B[j]<=K){
      |                 ^
a.cc:32:10: error: 'A' was not declared in this scope
   32 |     sum-=A[i];
      |          ^
a.cc:35:21: error: 'B' was not declared in this scope
   35 |     while(j<=M&&sum+B[j]<=K){
      |                     ^
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;
int main(){

int N,M,K,ans,i,j,sum=0;

std::cin>>N>>M>>K;

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

for(int i=1;i<=M;++i){
    std::cin>>B[i];
}

i=j=1;
while(i<=N&&sum+A[i]<=K){
    sum+=A[i];
    i++;
}
while(j<=M&&sum+B[j]<=K){
    sum+=B[j];
    j++;
}
i--,j--; ans=i+j;

while(i){
    sum-=A[i];
    i--;
    j++;
    while(j<=M&&sum+B[j]<=K){
        sum+=B[j];
        j++;
    }j--;
    ans=std::max(ans,i+j);

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:6: error: 'cin' is not a member of 'std'
    8 | std::cin>>N>>M>>K;
      |      ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:10:6: error: 'vector' is not a member of 'std'
   10 | std::vector<int>A(N);
      |      ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:10:13: error: expected primary-expression before 'int'
   10 | std::vector<int>A(N);
      |             ^~~
a.cc:11:6: error: 'vector' is not a member of 'std'
   11 | std::vector<int>B(M);
      |      ^~~~~~
a.cc:11:6: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:11:13: error: expected primary-expression before 'int'
   11 | std::vector<int>B(M);
      |             ^~~
a.cc:13:10: error: 'cin' is not a member of 'std'
   13 |     std::cin>>A[i];
      |          ^~~
a.cc:13:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:15: error: 'A' was not declared in this scope
   13 |     std::cin>>A[i];
      |               ^
a.cc:17:10: error: 'cin' is not a member of 'std'
   17 |     std::cin>>B[i];
      |          ^~~
a.cc:17:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:17:15: error: 'B' was not declared in this scope
   17 |     std::cin>>B[i];
      |               ^
a.cc:21:17: error: 'A' was not declared in this scope
   21 | while(i<=N&&sum+A[i]<=K){
      |                 ^
a.cc:25:17: error: 'B' was not declared in this scope
   25 | while(j<=M&&sum+B[j]<=K){
      |                 ^
a.cc:32:10: error: 'A' was not declared in this scope
   32 |     sum-=A[i];
      |          ^
a.cc:35:21: error: 'B' was not declared in this scope
   35 |     while(j<=M&&sum+B[j]<=K){
      |                     ^
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std
int main(){

int N,M,K,ans,i,j,sum=0;

std::cin>>N>>M>>K;

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

for(int i=1;i<=M;++i){
    std::cin>>B[i];
}

i=j=1;
while(i<=N&&sum+A[i]<=K){
    sum+=A[i];
    i++;
}
while(j<=M&&sum+B[j]<=K){
    sum+=B[j];
    j++;
}
i--,j--; ans=i+j;

while(i){
    sum-=A[i];
    i--;
    j++;
    while(j<=M&&sum+B[j]<=K){
        sum+=B[j];
        j++;
    }j--;
    ans=std::max(ans,i+j);

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

Compiler output:
a.cc:3:20: error: expected ';' before 'int'
    3 | using namespace std
      |                    ^
      |                    ;
    4 | int main(){
      | ~~~                 
a.cc: In function 'int main()':
a.cc:8:6: error: 'cin' is not a member of 'std'
    8 | std::cin>>N>>M>>K;
      |      ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | using namespace std
a.cc:10:6: error: 'vector' is not a member of 'std'
   10 | std::vector<int>A(N);
      |      ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<algorithm>
  +++ |+#include <vector>
    3 | using namespace std
a.cc:10:13: error: expected primary-expression before 'int'
   10 | std::vector<int>A(N);
      |             ^~~
a.cc:11:6: error: 'vector' is not a member of 'std'
   11 | std::vector<int>B(M);
      |      ^~~~~~
a.cc:11:6: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:11:13: error: expected primary-expression before 'int'
   11 | std::vector<int>B(M);
      |             ^~~
a.cc:13:10: error: 'cin' is not a member of 'std'
   13 |     std::cin>>A[i];
      |          ^~~
a.cc:13:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:15: error: 'A' was not declared in this scope
   13 |     std::cin>>A[i];
      |               ^
a.cc:17:10: error: 'cin' is not a member of 'std'
   17 |     std::cin>>B[i];
      |          ^~~
a.cc:17:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:17:15: error: 'B' was not declared in this scope
   17 |     std::cin>>B[i];
      |               ^
a.cc:21:17: error: 'A' was not declared in this scope
   21 | while(i<=N&&sum+A[i]<=K){
      |                 ^
a.cc:25:17: error: 'B' was not declared in this scope
   25 | while(j<=M&&sum+B[j]<=K){
      |                 ^
a.cc:32:10: error: 'A' was not declared in this scope
   32 |     sum-=A[i];
      |          ^
a.cc:35:21: error: 'B' was not declared in this scope
   35 |     while(j<=M&&sum+B[j]<=K){
      |                     ^
Language: C++

#include<cstdio>
#include<algorithm>
int main(){

int N,M,K,ans,i,j,sum=0;

std::cin>>N>>M>>K;

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

for(int i=1;i<=M;++i){
    std::cin>>B[i];
}

i=j=1;
while(i<=N&&sum+A[i]<=K){
    sum+=A[i];
    i++;
}
while(j<=M&&sum+B[j]<=K){
    sum+=B[j];
    j++;
}
i--,j--; ans=i+j;

while(i){
    sum-=A[i];
    i--;
    j++;
    while(j<=M&&sum+B[j]<=K){
        sum+=B[j];
        j++;
    }j--;
    ans=std::max(ans,i+j);

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:6: error: 'cin' is not a member of 'std'
    7 | std::cin>>N>>M>>K;
      |      ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | int main(){
a.cc:9:6: error: 'vector' is not a member of 'std'
    9 | std::vector<int>A(N);
      |      ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<algorithm>
  +++ |+#include <vector>
    3 | int main(){
a.cc:9:13: error: expected primary-expression before 'int'
    9 | std::vector<int>A(N);
      |             ^~~
a.cc:10:6: error: 'vector' is not a member of 'std'
   10 | std::vector<int>B(M);
      |      ^~~~~~
a.cc:10:6: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:10:13: error: expected primary-expression before 'int'
   10 | std::vector<int>B(M);
      |             ^~~
a.cc:12:10: error: 'cin' is not a member of 'std'
   12 |     std::cin>>A[i];
      |          ^~~
a.cc:12:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:12:15: error: 'A' was not declared in this scope
   12 |     std::cin>>A[i];
      |               ^
a.cc:16:10: error: 'cin' is not a member of 'std'
   16 |     std::cin>>B[i];
      |          ^~~
a.cc:16:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:15: error: 'B' was not declared in this scope
   16 |     std::cin>>B[i];
      |               ^
a.cc:20:17: error: 'A' was not declared in this scope
   20 | while(i<=N&&sum+A[i]<=K){
      |                 ^
a.cc:24:17: error: 'B' was not declared in this scope
   24 | while(j<=M&&sum+B[j]<=K){
      |                 ^
a.cc:31:10: error: 'A' was not declared in this scope
   31 |     sum-=A[i];
      |          ^
a.cc:34:21: error: 'B' was not declared in this scope
   34 |     while(j<=M&&sum+B[j]<=K){
      |                     ^
Language: C++

#include<cstudio>
#include<algorithm>
int main(){

int N,M,K,ans,i,j,sum=0;

std::cin>>N>>M>>K;

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

for(int i=1;i<=M;++i){
    std::cin>>B[i];
}

i=j=1;
while(i<=N&&sum+A[i]<=K){
    sum+=A[i];
    i++;
}
while(j<=M&&sum+B[j]<=K){
    sum+=B[j];
    j++;
}
i--,j--; ans=i+j;

while(i){
    sum-=A[i];
    i--;
    j++;
    while(j<=M&&sum+B[j]<=K){
        sum+=B[j];
        j++;
    }j--;
    ans=std::max(ans,i+j);

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

Compiler output:
a.cc:1:9: fatal error: cstudio: No such file or directory
    1 | #include<cstudio>
      |         ^~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<algorithm>
int main(){

int N,M,K,ans,i,j,sum=0;

std::cin>>N>>M>>K;

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

for(int i=1;i<=M;++i){
    std::cin>>B[i];
}

i=j=1;
while(i<=N&&sum+A[i]<=K){
    sum+=A[i];
    i++;
}
while(j<=M&&sum+B[j]<=K){
    sum+=B[j];
    j++;
}
i--,j--; ans=i+j;

while(i){
    sum-=A[i];
    i--;
    j++;
    while(j<=M&&sum+B[j]<=K){
        sum+=B[j];
        j++;
    }j--;
    ans=std::max(ans,i+j);

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:6: error: 'vector' is not a member of 'std'
    9 | std::vector<int>A(N);
      |      ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<algorithm>
  +++ |+#include <vector>
    3 | int main(){
a.cc:9:13: error: expected primary-expression before 'int'
    9 | std::vector<int>A(N);
      |             ^~~
a.cc:10:6: error: 'vector' is not a member of 'std'
   10 | std::vector<int>B(M);
      |      ^~~~~~
a.cc:10:6: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:10:13: error: expected primary-expression before 'int'
   10 | std::vector<int>B(M);
      |             ^~~
a.cc:12:15: error: 'A' was not declared in this scope
   12 |     std::cin>>A[i];
      |               ^
a.cc:16:15: error: 'B' was not declared in this scope
   16 |     std::cin>>B[i];
      |               ^
a.cc:20:17: error: 'A' was not declared in this scope
   20 | while(i<=N&&sum+A[i]<=K){
      |                 ^
a.cc:24:17: error: 'B' was not declared in this scope
   24 | while(j<=M&&sum+B[j]<=K){
      |                 ^
a.cc:31:10: error: 'A' was not declared in this scope
   31 |     sum-=A[i];
      |          ^
a.cc:34:21: error: 'B' was not declared in this scope
   34 |     while(j<=M&&sum+B[j]<=K){
      |                     ^
Language: C++

// #include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define ll long long
#define pi pair<int,int>
#define vi vector<int>
void solve(){
    ll n, m, k, r=0;
    cin>>n>>m>>k;
    vector<ll>a(n), b(m);
    for(int i=0;i<n;++i) cin>>a[i];
    for(int i=1;i<n;++i) a[i]+=a[i-1];
    for(int j=0;j<m;++j) cin>>b[j];
    for(int j=1;j<m;++j) b[j]+=b[j-1];
    for(int j=m-1, i=0;i<n && a[i]<=k;++i){
      while(a[i]+b[j]>k) j--;
      r=max(r, i+j+2);
    }
    cout << r << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
} 

Compiler output:
a.cc: In function 'void solve()':
a.cc:29:12: error: no matching function for call to 'max(long long int&, int)'
   29 |       r=max(r, i+j+2);
      |         ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:29:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   29 |       r=max(r, i+j+2);
      |         ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:5:
/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:29:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   29 |       r=max(r, i+j+2);
      |         ~~~^~~~~~~~~~
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;
using P = pair<int, int>;

int main() {
   int N, M, K;
   cin >> N >> M >> K;
   vector<int> A(N);
   vector<int> B(M);
   rep(i, N) cin >> A[i];
   rep(i, M) cin >> B[i];

   ll tot = 0;
   rep(i, M) tot += B[i];

   int j = M;
   int ans = 0;
   rep(i, N+1) {
       while (j > 0 && tot > K) {
           j -= 1;
           tot -= B[j];
       }
       if (tot > K) break;
       ans = max(ans, i+j);
       if (i == N) break;
       tot += A[i];
   }
   cout << ans << endl;

}

Compiler output:
a.cc:1:26: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                          ^
a.cc: In function 'int main()':
a.cc:11:8: error: 'i' was not declared in this scope
   11 |    rep(i, N) cin >> A[i];
      |        ^
a.cc:11:4: error: 'rep' was not declared in this scope
   11 |    rep(i, N) cin >> A[i];
      |    ^~~
Language: C++

#include <bits/stdc++.h>
#define VI vector<int>  
#define PII pair<int,int>
#define MII map<int,int>
#define MP make_pair
#define PB push_back
#define REP(i,a,b) for(int i = a; i < b; ++i)
#define F for(int i = 0; i < n; ++i)
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define usual int t; cin>>t; while(t--)
#define ll long long int
#define M 1000000007
using namespace std;

int main()
 {  
    FIO
    ll n,m,k,temp; cin>>n>>m>>k;
    queue<ll> A,B; 
    F {
        cin>>temp;
        A.push(temp);
    }
    REP(i,0,m) {
        cin>>temp;
        B.push(temp);
    }

    ll count=0;
    bool flag = true;
    while(!A.empty() and !B.empty()) {
        if(k < min(A.front(),B.front())){
            flag = false;
            break;
        }

        count++;
        if(A.front() <= B.front()) {
            k -= A.front();
            A.pop();
        }
        else {
            k -= B.front();
            B.pop();
        }
    }

    if (flag)
    {
        if(A.empty()) {
            while(!B.empty() and k >= B.front()) {
                    k -= B.front();
                    B.pop();
                    count++;
            }
        }
        else if(B.empty()) {
            while(!A.empty() k >= A.front()) {
                    k -= A.front();
                    A.pop();
                    count++;
            }
        }
    }

    cout<<count;

    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:29: error: expected ')' before 'k'
   58 |             while(!A.empty() k >= A.front()) {
      |                  ~          ^~
      |                             )
a.cc:58:44: error: expected ';' before ')' token
   58 |             while(!A.empty() k >= A.front()) {
      |                                            ^
      |                                            ;
Language: C

#include<bits/stdc++.h>
using namespace std;
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL); \
    cout.tie(NULL)
#define inc(x, y, i) for (int i = x; i <= y; i++)
#define dec(x, y, i) for (int i = x; i >= y; i--)
#define repeat(n) for (int i = 0; i<n;i++)

#define ll long long
#define ld long double
#define ull unsigned long long
#define infl LONG_MAX
#define infi INT_MAX
#define nl cout<<'\n'

#define all(v) v.begin(),v.end()
#define vi vector<int>
#define pb push_back
#define pii pair<int,int>
#define mkpr make_pair
#define pq priority_queue

/*void show(auto a)  //for debugging we often need to see the array
{
    for(auto i: a) cout << i << " ";
    cout << endl; // a must be vector
}
void printAr(int a[],int n)  // print the array
{
    for(int *i = a; i!=a+n; ++i)cout << *i << " ";
    cout << endl;
}*/

const int N = 2e5+2;
//int a[N],cum[N];
int n;

int main()
{
    fastio;
    int n,m,x,k;
    cin >> n >> m >> k;
    vi v,u;
    repeat(n){cin >> x;v.push_back(x);}
    repeat(m){cin >> x;u.push_back(x);}
    vi cum_u,cum_v;
    cum_v.push_back(v[0]);
    ll t;
    for(int i = 1;i < n;i++){
        t = cum_v[i-1];
        t = t + v[i];
        if(t > 1e9+2)t = INT_MAX;
        cum_v.push_back(t);
    }
    cum_u.push_back(u[0]);
    for(int i = 1;i<m;i++){
        t = cum_u[i-1];
        t = t + u[i];
        if(t > 1e9+2)t = INT_MAX;
        cum_u.push_back(t);
    }
    show(cum_u);
    show(cum_v);
    int ans = upper_bound(all(cum_v),k)-cum_v.begin();
    int cur;
    for(int i = 0;i < m;i++){
        cur = upper_bound(all(cum_v),k-cum_u[i])-cum_v.begin();
        if(cum_u[i] <=k)
        ans = max(ans,i+1+cur);
        //cout << "i = " << i << " cur = " << cur << endl;
    }
    cout << ans << endl;
    //cout << upper_bound(all(cum_v),150)-cum_v.begin() << endl;
}


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

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

int main() {
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n, m, k, s = 0;
	queue<int> a, b;

	cin >> n >> m >> k;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		a.push(x);
	}
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		b.push(x);
	}

	while (k > 0) {
		if (*a.front() < *b.front() and k >= *a.front()) {
			k -= *a.front();
			a.pop();
		}
		else if (*a.front() < *b.front() and k >= *b.front()) {
			k -= *b.front();
			b.pop();
		}
		s++;
	}
	cout << s;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:21: error: invalid type argument of unary '*' (have '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   30 |                 if (*a.front() < *b.front() and k >= *a.front()) {
      |                     ^~~~~~~~~~
a.cc:30:34: error: invalid type argument of unary '*' (have '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   30 |                 if (*a.front() < *b.front() and k >= *a.front()) {
      |                                  ^~~~~~~~~~
a.cc:30:54: error: invalid type argument of unary '*' (have '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   30 |                 if (*a.front() < *b.front() and k >= *a.front()) {
      |                                                      ^~~~~~~~~~
a.cc:31:30: error: invalid type argument of unary '*' (have '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   31 |                         k -= *a.front();
      |                              ^~~~~~~~~~
a.cc:34:26: error: invalid type argument of unary '*' (have '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   34 |                 else if (*a.front() < *b.front() and k >= *b.front()) {
      |                          ^~~~~~~~~~
a.cc:34:39: error: invalid type argument of unary '*' (have '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   34 |                 else if (*a.front() < *b.front() and k >= *b.front()) {
      |                                       ^~~~~~~~~~
a.cc:34:59: error: invalid type argument of unary '*' (have '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   34 |                 else if (*a.front() < *b.front() and k >= *b.front()) {
      |                                                           ^~~~~~~~~~
a.cc:35:30: error: invalid type argument of unary '*' (have '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   35 |                         k -= *b.front();
      |                              ^~~~~~~~~~
Language: C++

N, M, K = map(int,input().split())

A = list(map(int, input().split()))
B = list(map(int, input().split()))

cumA = [0] * (N+1)
cumB = [0] * (M+1)

for i in range(N):
    cumA[i+1] = cumA[i] + A[i]
for i in range(M):
    cumB[i+1] = cumB[i] + B[i]

def check(X):
    res = 1e9
    for i in range(N+1):
        j = X - i
        if j < 0 or M < j: continue
        if(cumA[i] + cumB[j] < res):
            res = cumA[i] + cumB[j]
    return res <= K

ok = 0
ng = N + M + 1

while ng - ok > 1:
    mid = (ok + ng) // 2
    if(check(mid)): ok = mid
    else: ng = mid

print(ok)

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N, M, K = map(int,input().split())
      | ^
Language: C++

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

int main(){
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> a(n), b(m);
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];
  
  vector<int> b2(m);
  b2[0] = b[0];
  for(int i = 1; i < m; ++i) 
    b2[i] = b2[i - 1] + b[i];
  
  int sum = 0, ans = 0;
  for(int i = 0; i <= n; ++i) {
    int count = upper_bound(
      b2.begin(),
      b2.end(),
      k - sum
    );
    ans = max(ans, i + count);
    
    if (i < n)
      sum += a[i];
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:28: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in initialization
   19 |     int count = upper_bound(
      |                 ~~~~~~~~~~~^
      |                            |
      |                            __gnu_cxx::__normal_iterator<int*, std::vector<int> >
   20 |       b2.begin(),
      |       ~~~~~~~~~~~           
   21 |       b2.end(),
      |       ~~~~~~~~~             
   22 |       k - sum
      |       ~~~~~~~               
   23 |     );
      |     ~
Language: C++

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

int main()
{
  int n, m, k;
  cin >> n >> m >> k;
  
  vector<int> a(n);
  vector<int> b(n);
  
  rep(i, n){
    cin >> a.at(i);
  }
  
  rep(i, m){
    cin >> b.at(i);
  }
  
  int64_t t = 0;
  int j = m; 
   
  rep(i, m){
    t += b.at(i);
  }
  
  int answer = 0;
  
  rep(i, n + 1){
    while(j > 0 && t > k){
      j--;
      t -= b.at(j);
    }
    
    if(t > k)
      break;
    
    answer = max(answer, i + j)
      
    if(i == n)
      break;
    
    t += a.at(i);
  }
  
  cout << answer << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:32: error: expected ';' before 'if'
   40 |     answer = max(answer, i + j)
      |                                ^
      |                                ;
   41 | 
   42 |     if(i == n)
      |     ~~
Language: C++

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

int main()
{
  int n, m, k;
  cin >> n >> m >> k;
  
  vector<int> a(n);
  vector<int> b(n);
  
  rep(i, n){
    cin >> a.at(i);
  }
  
  rep(i, m){
    cin >> b.at(i);
  }
  
  int64_t t = 0
  int64_t j = m; 
   
  rep(i, m){
    t += b.at(i);
  }
  
  int answer = 0;
  
  rep(i, n + 1){
    while(j > 0 && t > k){
      j--;
      t -= b.at(j);
    }
    
    if(t > k)
      break;
    
    answer = max(answer, i + j)
      
    if(i == n)
      break;
    
    t += a.at(i);
  }
  
  cout << answer << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:3: error: expected ',' or ';' before 'int64_t'
   23 |   int64_t j = m;
      |   ^~~~~~~
a.cc:32:11: error: 'j' was not declared in this scope
   32 |     while(j > 0 && t > k){
      |           ^
a.cc:40:30: error: 'j' was not declared in this scope
   40 |     answer = max(answer, i + j)
      |                              ^
Language: C++

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

int main()
{
  int n, m, k;
  cin >> n >> m >> k;
  
  vector<int> a(n);
  vector<int> b(n);
  
  rep(i, n){
    cin >> a.at(i);
  }
  
  rep(i, m){
    cin >> b.at(i);
  }
  
  int64_t t = 0
  int j = m; 
   
  rep(i, m){
    t += b.at(i);
  }
  
  int answer = 0;
  rep(i, n + 1){
    while(j > 0 && t > k){
      j--;
      t -= b.at(j);
    }
    
    if(t > k)
      break;
    
    answer = max(answer, i + j)
      
    if(i == n)
      break;
    
    t += a.at(i);
  }
  
  cout << answer << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:3: error: expected ',' or ';' before 'int'
   23 |   int j = m;
      |   ^~~
a.cc:31:11: error: 'j' was not declared in this scope
   31 |     while(j > 0 && t > k){
      |           ^
a.cc:39:30: error: 'j' was not declared in this scope
   39 |     answer = max(answer, i + j)
      |                              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,m,k,l,o,p;
    cin>>n>>m>>k;
    ll a[n+1],b[m+1];
    a[0]=0;
    b[0]=0;
    for(ll i=1;i<=n;i++)
    {
        ll x,y;
        cin>>x;
        y=x+a[i-1];
        a.push_back(y);
    }
    for(ll i=1;i<=m;i++)
    {
        ll x,y;
        cin>>x;
        y=x+b[i-1];
        b.push_back(y);
    }
    ll ans=0;
    o=m;
    for(ll i=n;i>=0;i--)
    {
        for(ll j=o;j>=0;j--){
            if(a[i]+b[j]<=k){
                o=j;
                if(i+j>ans){
                    ans=i+j;
                }
                break;
            }
        }
    }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:16:11: error: request for member 'push_back' in 'a', which is of non-class type 'long long int [(n + 1)]'
   16 |         a.push_back(y);
      |           ^~~~~~~~~
a.cc:23:11: error: request for member 'push_back' in 'b', which is of non-class type 'long long int [(m + 1)]'
   23 |         b.push_back(y);
      |           ^~~~~~~~~