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

package atCorder;

import java.util.Scanner;

public class Tsundoku {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int conbo = n + m;
		long max = scan.nextInt();
		long[] books = new long[n + m];
		long ans = 0;
		for (int i = 0; i < n + m; i++) {
			books[i] = scan.nextInt();
		}

		//全探索が必要な要素要素（conbo）の２条分のループ(on-off全探索)
		for (int bit = 0; bit < 1 << conbo; bit++) {

			long sum = 0;
			int count = 0;

			//要素分のループ
			for (int i = 0; i < books.length; i++) {

				//その要素が今回onになっているかチェック
				if ((1 & bit >> i) == 1) {

					sum = sum + books[i];
					count++;
				}
			}

			if (sum <= max) {
				if (ans < count) {
					ans = count;
				}
			}

		}

		System.out.println(ans);

	}

}


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

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int f(int a[], int b[], int n, int m, int i, int j, ll k) {
  if(dp.count({{i, j}, k})) {
    return dp[{{i, j}, k}];
  }
  if(i == n && j == m) {
    dp[{{i, j}, k}] = 0;
    return 0;
  } 
  int answer = 0;
  if(i < n && j < m && a[i] <= k && b[j] <= k) {
    answer = 1 + max(f(a, b, n, m, i + 1, j, k - a[i]), f(a, b, n, m, i, j + 1, k - b[j]));    
  } else if(i < n && a[i] <= k) {
    answer = 1 + f(a, b, n, m, i + 1, j, k - a[i]);
  } else if(j < m && b[j] <= k) {
    answer = 1 + f(a, b, n, m, i, j + 1, k - b[j]);
  }
  dp[{{i, j}, k}] = answer;
  return answer;
}
int main() {
  int n, m; ll k;
  cin >> n >> m >> k;
  int a[n], b[m];
  for(int i = 0; i < n; ++i) cin >> a[i];
  for(int i = 0; i < m; ++i) cin >> b[i];  
  long long pre_b[m], pre_a[n];
  pre_b[0] = b[0];
  pre_a[0] = a[0];
  for(int i = 1; i < m; ++i) {
    pre_b[i] = (ll)pre_b[i - 1] + (ll)b[i];
  }
  for(int i = 1; i < n; ++i) {
    pre_a[i] = (ll)pre_a[i - 1] + (ll)a[i];
  }  
  int answer = 0;
  for(int count = 0; count <= n; ++count) {
    long long check = (count == 0 ? 0 : pre_a[count - 1]);
    if(k >= check) {
      long long left = k - check;
      //find max number of books u can read with k == left;
      int pos = 0;
      if(pre_b[0] > left) {        
      } else if(pre_b[m - 1] <= left) {
        pos = m;
      } else {
        int L = 0;
        int R = m - 1;
        while(L <= R) {
          int mid = (L + R) / 2;          
          if(pre_b[mid] <= left) {
            if(mid < (m - 1) && pre_b[mid + 1] > left) {
              pos = mid + 1;
            }
            L = mid + 1;
          } else {
            if(mid > 0 && pre_b[mid - 1] <= left) {
              pos = mid;
            }
            R = mid - 1;
          }
        }
      }
      pos += count;
      answer = max(answer, pos);
    }
  }
  cout << answer << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int f(int*, int*, int, int, int, int, ll)':
a.cc:7:6: error: 'dp' was not declared in this scope; did you mean 'dup'?
    7 |   if(dp.count({{i, j}, k})) {
      |      ^~
      |      dup
a.cc:11:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
   11 |     dp[{{i, j}, k}] = 0;
      |     ^~
      |     dup
a.cc:22:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
   22 |   dp[{{i, j}, k}] = answer;
      |   ^~
      |   dup
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
	ll n,m,k;
	cin>>n>>m>>k;
	ll a[n];
	ll b[m];
	for(ll i=0;i<n;i++)
	cin>>a[i];
	for(ll i=0;i<m;i++)
	cin>>b[i];
	ll prea[n];
	ll preb[m];0
	prea[0]=a[0];
	preb[0]=b[0];
	for(ll i=1;i<n;i++)
	prea[i]=prea[i-1]+a[i];
	for(ll i=1;i<m;i++)
	preb[i]=preb[i-1]+b[i];
	ll ans=0;
	for(ll i=0;i<n;i++)
	{
	    ll left=k-prea[i];
	    if(left>0){
	    ll find=upper_bound(preb,preb+m,left)-preb;
	    if(find>0)
	    ans=max(ans,find+i+1);
	    else
	    ans=max(ans,i+1);}
	}
	cout<<ans<<endl;
	return 0;
}
	

Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: expected ';' before 'prea'
   14 |         ll preb[m];0
      |                     ^
      |                     ;
   15 |         prea[0]=a[0];
      |         ~~~~
Language: C++

#include<bits/std++.h>
using namespace std;
using Long = long long;

int main(){
  
  int n , m;
  cin >> n >> m;
  
  int k;
  cin >> k;
  
  vector<int> v(n) , w(m);
  for( int i = 0 ; i < n ; ++i ) cin >> v[i];
  
  for( int j = 0 ; j < m ; ++j) cin >> w[j];
  
  int tot = 0;
  int i = 0 , j = 0;
  
  while( ( i < n || j < m ) ){
    if( i >= n ){
      if( tot + w[j] > m ) break;
      else {
        tot += w[j];
        j++;
      }
    }
    else if( j >= m ){
      if( tot + v[i] > m ) break;
      else {
        tot += v[i];
        i++;
      }
    } 
    else {
      if( v[i] < w[j] && tot + v[i] <= m ){
        tot += v[i];
        i++;
      } else if( tot + w[j] <= m ){
        tot += w[j];
        j++;
      } else break;
    }
    cout << tot << endl;
  }
  return 0;
}
    

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

        ng = mid;a


Compiler output:
a.cc:1:9: error: 'ng' does not name a type; did you mean 'long'?
    1 |         ng = mid;a
      |         ^~
      |         long
a.cc:1:18: error: 'a' does not name a type
    1 |         ng = mid;a
      |                  ^
Language: C++

#include <iostream>
using namespace std;
int main(){
  int n,m,k;
  cin >> n >> m >> k;
  int a[n];
  int b[m];
  for(int i=0;i<n;++i){
    cin >> a[i];
  }
  for(int i=0;i<m;++i){
    cin >> b[i];
  }
  int p=0;int q=0;int sum=0;int count=0;
  while(p!=n-1 || q!=m-1 || sum!=k){
    if(sum!=k){
      sum = sum + a[p];
      count++;
    }
    if(sum!=k){
      sum = sum + b[q];
      count++;
    }
    p++;q++;
  }
  
  cout << count << endl;
  return 0;
}
#include <iostream>
using namespace std;
int main(){
  int n,m,k;
  cin >> n >> m >> k;
  int a[n];
  int b[m];
  for(int i=0;i<n;++i){
    cin >> a[i];
  }
  for(int i=0;i<m;++i){
    cin >> b[i];
  }
  int p=0;int q=0;int sum=0;int count=0;
  while(p!=n-1 || q!=m-1 || sum!=k){
    if(sum!=k){
      sum = sum + a[p];
      count++;
    }
    if(sum!=k){
      sum = sum + b[q];
      count++;
    }
    p++;q++;
  }
  if(p==n-1 && sum!=k){
    while(q!=m-1 || sum!=k){
      sum = sum + b[q];
      q++;
      count++;
    }
  }
  if(q==m-1 && sum!=k){
    while(p!=n-1 || sum!=k){
      sum = sum + a[p];
      p++;
      count++;
    }
  }
  cout << count << endl;
  return 0;
}

Compiler output:
a.cc:32:5: error: redefinition of 'int main()'
   32 | 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()
{long long int n,m,k;
 cin>>n>>m>>k;
 long long int p=n,q=m;
 vector<long long int>vec1;
 vector<long long int>vec2;
 for(long long int i=0;i<n;i++)
 {long long int u;
  cin>>u;
  vec1[i+1]=vec1[i]+u;
  if(vec1[i+1]>k)
  {p=i;
   break;}}
 for(long long int i=0;i<m;i++)
 {long long int u;
  cin>>u;
  vec2[i+1]=vec2[i]+u;
  if(vec2[i+1]>k)
  {q=i;
   break;}
 }
 for(long long int i=0;i<=p;i++)
 {while(q>=0)
 {if(vec1[i]+vec2[q])
 {sum=max(sum,q+i);
  break;}
  else
    q--;}
 }
 cout<<sum;}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:3: error: 'sum' was not declared in this scope
   27 |  {sum=max(sum,q+i);
      |   ^~~
a.cc:32:8: error: 'sum' was not declared in this scope
   32 |  cout<<sum;}
      |        ^~~
Language: C++

using namespace std;
using ll = long long;

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 t = 0;
    rep(i,m) t += b[i];

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> n >> m >> k;
      |     ^~~
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:7:5: error: 'vector' was not declared in this scope
    7 |     vector<int> a(n);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:7:12: error: expected primary-expression before 'int'
    7 |     vector<int> a(n);
      |            ^~~
a.cc:8:12: error: expected primary-expression before 'int'
    8 |     vector<int> b(m);
      |            ^~~
a.cc:9:9: error: 'i' was not declared in this scope
    9 |     rep(i,n) cin >> a[i];
      |         ^
a.cc:9:5: error: 'rep' was not declared in this scope
    9 |     rep(i,n) cin >> a[i];
      |     ^~~
a.cc:27:5: error: 'cout' was not declared in this scope
   27 |     cout << ans << endl;
      |     ^~~~
a.cc:27:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:20: error: 'endl' was not declared in this scope
   27 |     cout << ans << 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 <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;

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];

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:29:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   29 |     cout << cnt << endl;
      |             ^~~
      |             int
Language: C++

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

int main(){
    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];

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:20:18: error: expected ')' before '$$'
   20 |         while(j>0 $$ t>k){
      |              ~   ^~~
      |                  )
a.cc:20:19: error: '$$' was not declared in this scope
   20 |         while(j>0 $$ t>k){
      |                   ^~
a.cc:25:23: error: 'i' was not declared in this scope
   25 |         ans = max(ans,i+j);
      |                       ^
a.cc:29:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   29 |     cout << cnt << endl;
      |             ^~~
      |             int
Language: C++

#include <stdio.h>
using namespace std;
using ll = long long;

int main() {
	int N, M
	ll K;
	scanf("%d%d%lld", &N, &M, &K);
	ll A[200000];
	int cnt, ca, cb;
	cnt = ca = cb = 0;
	ll s = 0;
	for (int i = 0; i < N; i++) {
		ll a;
		scanf("%lld", &a);
		if (s + a <= K) {
			A[i] = a;
			ca++;
			s += a;
		}
	}

	cnt = ca;
	for (int i = 0; i < M; i++) {
		ll b;
		scanf("%lld", &b);
		while (s + b > K && ca > 0) {
			s -= A[--ca];
		}
		if (s + b > K) {
			break;
		}
		s += b;
		if (ca + ++cb > cnt) {
			cnt = ca + cb;
		}
	}

	printf("%d\n", cnt);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: expected initializer before 'll'
    7 |         ll K;
      |         ^~
a.cc:8:32: error: 'M' was not declared in this scope
    8 |         scanf("%d%d%lld", &N, &M, &K);
      |                                ^
a.cc:8:36: error: 'K' was not declared in this scope
    8 |         scanf("%d%d%lld", &N, &M, &K);
      |                                    ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>

int main(){
  int n,m,k;std:cin>>n>>m>>k;
  std::vector<long long> a(n+1),b(m);
  for(int i=1;i<=n;i++){
    std::cin>>a[i];
  }
  for(int i=0;i<m;i++){
    std::cin>>b[i];
  }
  for(int i=1;i<n;i++){
    a[i]+=a[i-1];
  }
  
  int ans=0;
  for(int i=0;i<m;i++){
    long long amarizikan=k-b[i];
    if(k-b[i]<0){
      continue;
    }
    int res=upper_bound(a.begin(),a.end(),amarizikan)-a.begin();
    ans=std::min(ans,res-1);
  }
  std::cout<<ans<<std::endl;
  
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   int n,m,k;std:cin>>n>>m>>k;
      |                 ^~~
      |                 std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
Language: C++

#pragma GCC optimize("Ofast")
#include  "bits/stdc++.h"
using namespace std;
#define I_AM_SPEED  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define printclock  cerr <<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<" sec\n";
#define mp(a , b)   make_pair(a , b)
#define eb(a)       emplace_back(a)
#define anal         '\n'
#define mod 1000000007
#define fst first
#define sec second
//const double PI = acos(-1.0);
typedef long long ll;
typedef unsigned long long ull;

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-

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

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      
int main(){
I_AM_SPEED;
#ifndef ONLINE_JUDGE  
      freopen("input.in", "r", stdin);
      freopen("output.in", "w", stdout);
#endif 

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


//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
//printclock; 
return  0 ;      
}        



   

Compiler output:
a.cc: In function 'int main()':
a.cc:39:20: error: 'i' was not declared in this scope
   39 |           cin >> b[i + 1];
      |                    ^
Language: C++

#pragma GCC optimize("Ofast")
#include  "bits/stdc++.h"
using namespace std;
#define I_AM_SPEED  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define printclock  cerr <<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<" sec\n";
#define mp(a , b)   make_pair(a , b)
#define eb(a)       emplace_back(a)
#define anal         '\n'
#define mod 1000000007
#define fst first
#define sec second
//const double PI = acos(-1.0);
typedef long long ll;
typedef unsigned long long ull;

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-

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

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      
int main(){
I_AM_SPEED;
#ifndef ONLINE_JUDGE  
      freopen("input.in", "r", stdin);
      freopen("output.in", "w", stdout);
#endif 

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


//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
//printclock; 
return  0 ;      
}        



   

Compiler output:
a.cc: In function 'int main()':
a.cc:39:20: error: 'i' was not declared in this scope
   39 |           cin >> b[i + 1];
      |                    ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
    int N,M,K,T=0;
    cin >> N >> M >> K;
  vector<int>Ai;
  for(int i=0;i<N;i++){
  cin >> Ai.at(i);}
  vector<int>Bi;
  for(int h=0;h<M;h++){
  cin >> Bi.at(h);}
  for(int i=0;i<N;i++){
   for(int h=0;h<M;h++){
   if(K>0){
     K-Ai.at(i);
   T++;
    if(K>0){
    K-Bi.at(h);
    T++;}
   }
   cout <<T; 
   }}
    
  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int>Ai;
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int>Ai;
      |          ^~~
a.cc:9:10: error: 'Ai' was not declared in this scope; did you mean 'i'?
    9 |   cin >> Ai.at(i);}
      |          ^~
      |          i
a.cc:10:10: error: expected primary-expression before 'int'
   10 |   vector<int>Bi;
      |          ^~~
a.cc:12:10: error: 'Bi' was not declared in this scope
   12 |   cin >> Bi.at(h);}
      |          ^~
a.cc:16:8: error: 'Ai' was not declared in this scope; did you mean 'i'?
   16 |      K-Ai.at(i);
      |        ^~
      |        i
a.cc:19:7: error: 'Bi' was not declared in this scope; did you mean 'i'?
   19 |     K-Bi.at(h);
      |       ^~
      |       i
Language: C++

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

int main(){
    int n,m,k;
    cin>>n>>m>>k;
    vector<ll> a(n+1);
    vector<ll> b(m);
    //それぞれで累積和をとる
  	a[0]=0
    rep(i,n){
        int x;
        cin>>x;
        a[i]=a[i-1]+x;
    }
    rep(i,m){
        int y;
        cin>>y;
        if(i==0) b[i]=y;
        else b[i]=b[i-1]+y;
    }
    int ans=0;
    //aでどこまでよむか
    for(int s=0;s<n+1;s++){
        //最初にaで読む本分引いておく、残り時間でbから読む
        if(a[s]>k) break;
        int tmp=k-a[s];
        //二分探索
        int left=0;
        int right=m-1;
        while(right<=left){
            int mid=(right+left)/2;
            if(tmp<b[mid]) right=mid-1;
            else left=mid+1;
        }
        ans=max(ans,s+left);
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: expected ';' before 'for'
   12 |         a[0]=0
      |               ^
      |               ;
a.cc:13:9: error: 'i' was not declared in this scope
   13 |     rep(i,n){
      |         ^
a.cc:3:30: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(int i=0;i<n;i++)
      |                              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5;

int n, m, k;
int a[MAX_N + 5], b[MAX_N + 5];
int sa[MAX_N + 5], sb[MAX_N + 5];
int ans = 0;

int main()
{
	//ios_base::sync_with_stdio(0);
	//cin.tie(0); cout.tie(0);
	scanf("%d %d %d", &n, &m, &k);
	sa[0] = sb[0] = 0;
	for (int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        sa[i] = sa[i-1]+a[i];
    }
    for (int i = 1; i <= m; i++)
    {
        scanf("%d", &b[i]);
        sb[i] = sb[i-1]+b[i];
    }
    for (int i = 1; i <= n && sa[i] <= k; i++)
    {
        ans = max(ans, upper_bound(sb, sb+1+m, k-sa[i])-1-sb+i);
        //cout << "#" << i << " " << ans << endl;
    }
    printf("%d\n", ans);
    return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
//二分探索かしゃくとり法
int main(){
    int n,m,k;
    vector<int> a(n);
    vector<int> b(m);
    rep(i,n) cin>>a[i];
    rep(i,m) cin>>b[i];
    ll t=0;
    rep(i,m) t+=b[i];
    int j=m;
    int ans=0;
    rep(i,n+1){
        while(j>0 && t>k){
            --j;
            t-=b[j];
        }
        if(t>k) break;
        ans=max(ans,i+j);
        if(i==n)break;
        t+=a[i];
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'vector' was not declared in this scope
    6 |     vector<int> a(n);
      |     ^~~~~~
a.cc:6:12: error: expected primary-expression before 'int'
    6 |     vector<int> a(n);
      |            ^~~
a.cc:7:12: error: expected primary-expression before 'int'
    7 |     vector<int> b(m);
      |            ^~~
a.cc:8:14: error: 'cin' was not declared in this scope
    8 |     rep(i,n) cin>>a[i];
      |              ^~~
a.cc:8:19: error: 'a' was not declared in this scope
    8 |     rep(i,n) cin>>a[i];
      |                   ^
a.cc:9:14: error: 'cin' was not declared in this scope
    9 |     rep(i,m) cin>>b[i];
      |              ^~~
a.cc:9:19: error: 'b' was not declared in this scope
    9 |     rep(i,m) cin>>b[i];
      |                   ^
a.cc:11:17: error: 'b' was not declared in this scope
   11 |     rep(i,m) t+=b[i];
      |                 ^
a.cc:17:16: error: 'b' was not declared in this scope
   17 |             t-=b[j];
      |                ^
a.cc:20:13: error: 'max' was not declared in this scope
   20 |         ans=max(ans,i+j);
      |             ^~~
a.cc:22:12: error: 'a' was not declared in this scope
   22 |         t+=a[i];
      |            ^
a.cc:24:5: error: 'cout' was not declared in this scope
   24 |     cout<<ans<<endl;
      |     ^~~~
a.cc:24:16: error: 'endl' was not declared in this scope
   24 |     cout<<ans<<endl;
      |                ^~~~
Language: C++

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

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

using System;
using static System.Console;
using static System.Math;
using System.Numerics;
using System.Collections.Generic;


namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var s = ReadLine().Split(' ');
            long n, m, k;
            long ans;
            n = long.Parse(s[0]);
            m = long.Parse(s[1]);
            k = long.Parse(s[2]);
            var a = ReadLine().Split(' ');
            var b = ReadLine().Split(' ');
            long[] A = new long[n];
            long[] B = new long[m];
            for (int i = 0; i < n; i++)
            {
                A[i] = long.Parse(a[i]);
            }
            for (int i = 0; i < m; i++)
            {
                B[i] = long.Parse(b[i]);
            }

            long ai = 0;
            long aCount = maxCount(A, k);
            if (aCount == 0)
            { ans = maxCount(B, k); }
            else
            {
                ans = aCount;
                for (int i = 0; i < aCount; i++)
                {
                    ai += A[i];
                    long count = maxCount(B, k - ai);
                    count += i + 1;
                    if (count > ans)
                    { ans = count; }
                }
            }
            long count = maxCount(B, k);
            if (count > ans)
            { ans = count; }


            WriteLine(ans);
            Out.Flush();
        }

        public static long maxCount(long[] array, long max)
        {
            long time = max;
            long resut = 0;
            long num = array.Length;
            while (time > 0 && result < num)
            {
                time -= array[resut];
                if (time < 0)
                { break; }
                resut++;
            }
            return resut;
        }

    }

}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'static'
    2 | using static System.Console;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'static'
    3 | using static System.Math;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Numerics;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:10:5: error: expected unqualified-id before 'public'
   10 |     public class Program
      |     ^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

using Graph = vector<vector<long long>>;

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

    vector<long long> A;
    vector<long long> B;
    vector<long long> Sa(N+1);
    vector<long long> Sb(M+1);
    int a,b;
    int amax, bmax;
    int result = 0;
    for(int i = 1 ;i <= N;i++){
        cin >> a;
        A.push_back(a);
        Sa[i] = Sa[i-1] + a;
        if(Sa[i] > K) {
            amax = i - 1;
        }
    }
    for(int i = 1 ;i <= M;i++){
        cin >> b;
        B.push_back(b);
        Sb[i] = Sb[i-1] + b;
        if(Sb[i] > K) {
            bmax = i - 1;
        }
    }
    int t = *max_element(Sb.begin(),Sb.end());
    int j = M;
    for(int i = 0; i < n +1; i++) {
        while(j > 0 && t > K){
            j--;
            t -= B[j];
        }
        if(t> K){
            break;
        }
        result = max(result,i+j);
        if(i == N) {
            break;
        }
        t += A[i];
    }
        
    cout << result << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:24: error: 'n' was not declared in this scope
   37 |     for(int i = 0; i < n +1; i++) {
      |                        ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

using Graph = vector<vector<long long>>;

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

    vector<long long> A;
    vector<long long> B;
    vector<long long> Sa(N+1);
    vector<long long> Sb(M+1);
    int a,b;
    int amax, bmax;
    int result = 0;
    for(int i = 1 ;i <= N;i++){
        cin >> a;
        A.push_back(a);
        Sa[i] = Sa[i-1] + a;
        if(Sa[i] > K) {
            amax = i - 1;
        }
    }
    for(int i = 1 ;i <= M;i++){
        cin >> b;
        B.push_back(b);
        Sb[i] = Sb[i-1] + b;
        if(Sb[i] > K) {
            bmax = i - 1;
        }
    }
    int t = *max_element(Sb.begin(),Sb.end());
    for(int i = 0; i <= amax; i++) {
        while(j > 0 && t > K){
            j--;
            t -= B[j];
        }
        if(t> K){
            break;
        }
        result = max(result,i+j);
        it(i == n) {
            break;
        }
        t += A[i];
    }
        
    cout << result << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:15: error: 'j' was not declared in this scope
   37 |         while(j > 0 && t > K){
      |               ^
a.cc:44:31: error: 'j' was not declared in this scope
   44 |         result = max(result,i+j);
      |                               ^
a.cc:45:17: error: 'n' was not declared in this scope
   45 |         it(i == n) {
      |                 ^
a.cc:45:9: error: 'it' was not declared in this scope; did you mean 'i'?
   45 |         it(i == n) {
      |         ^~
      |         i
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n,m,k,ans=0;
    cin>>n>>m>>k;
    ll a[n+1]={0},b[m+1]={0};
    for(ll i=1;i<=n;i++) cin>>a[i],a[i]+=a[i-1];
    for(ll i=1;i<=m;i++) cin>>b[i],b[i]+=b[i-1];
    for(ll i=0;i<=n;i++) if(k>=a[i]) ans=max(ans,i+upper_bound(b+1,b+1+m,k-a[i])-b-1);
    cout<<ans;
}


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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n,m,ans=0;
    ll k;
    cin>>n>>m>>k;
    ll a[n+1]={0},b[m+1]={0};
    for(int i=1;i<=n;i++) cin>>a[i],a[i]+=a[i-1];
    for(int i=1;i<=m;i++) cin>>b[i],b[i]+=b[i-1];
    for(int i=0;i<=n;i++) if(k>=a[i]) ans=max(ans,i+upper_bound(b+1,b+1+m,k-a[i])-b-1);
    cout<<ans;
}


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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n,m,k,ans=0;
    cin>>n>>m>>k;
    int a[n+1]={0},b[m+1]={0};
    for(int i=1;i<=n;i++) cin>>a[i],a[i]+=a[i-1];
    for(int i=1;i<=m;i++) cin>>b[i],b[i]+=b[i-1];
    for(int i=0;i<=n;i++) if(k>=a[i]) ans=max(ans,i+upper_bound(b+1,b+1+m,k-a[i])-b-1);
    cout<<ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:46: error: no matching function for call to 'max(int&, long int)'
   10 |     for(int i=0;i<=n;i++) if(k>=a[i]) ans=max(ans,i+upper_bound(b+1,b+1+m,k-a[i])-b-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:10:46: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   10 |     for(int i=0;i<=n;i++) if(k>=a[i]) ans=max(ans,i+upper_bound(b+1,b+1+m,k-a[i])-b-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:10:46: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   10 |     for(int i=0;i<=n;i++) if(k>=a[i]) ans=max(ans,i+upper_bound(b+1,b+1+m,k-a[i])-b-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],b[m];
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<m;i++)cin>>b[i];
    long long A[n],B[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];
    long long M=0;
    for(int i=0;i<n;i++){
        if(A[i]>k)break;
        M=max(M,i+1+upper_bound(B,B+m,k-A[i])-B);
    }
    cout<<M<<endl;
    return 0;
}

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

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

int Exp(long long int exp_n,long long int exp_e, long long exp_mod);


int main(){
  long long int N,M,K;
  cin >> N >> M >> K;
  long long int A[N+1], B[M+1];
  A[0]=0;
  B[0]=0;
  long long int C=N;
  
  for(long long int i=1;i<N+1;i++){
    cin >> A[i];
    A[i] = A[i]+A[i-1];
    if(C==N && A[i]>K){
      C = i-1;
    }
  }

  for(long long int i=1;i<M+1;i++){
    cin >> B[i];
    B[i] = B[i]+B[i-1];
  }
  long long int D=0;
  while(A[C] + B[D+1]<=K && D<M){
    D++;
  }
  //cout << C << ":" << D << endl;
  long long int Max = C+D;
  for(long long int i=1;i<C+1;i++){
    while(A[C-i]+B[D+1]<=K){
      if(D==M){
        break;
      }
      D++;
    }
    //cout << C-i << ":" << D << endl;
    Max = max(Max, C-i+D)
  }
cout << Max <<endl;
  return 0;
}


int Exp(long long int exp_n,long long int exp_e, long long int exp_mod){
  long long int exp_o = 1;
  long long int exp_x=exp_n;
  long long int exp_tmp;
  
  while(0<exp_e){
    exp_tmp = exp_e/2;
    if(exp_e - exp_tmp*2 == 1){
      exp_o = exp_o*exp_x;
      if(exp_o>exp_mod){
        exp_o=exp_o%exp_mod;
      }
    }
    
    exp_x = exp_x*exp_x;
    if(exp_x>exp_mod){
      exp_x=exp_x%exp_mod;
    }
    exp_e = exp_tmp;
  }
  return exp_o;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:26: error: expected ';' before '}' token
   41 |     Max = max(Max, C-i+D)
      |                          ^
      |                          ;
   42 |   }
      |   ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define mod 1000000007
#define inf 1e18
const int N = 300005;

/*******************************************************************/


int32_t main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  // int t = 1, z = 1;
  // cin >> t;
  // cin.ignore();
  // while (t--) {

  // }
  int n, m, k; cin >> n >> m >> k;
  vector<int> a(n), 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, r = 0, i = 0, j = 0;
  while (i < n && (r + a[i]) <= k) {
    r += a[i++];
  }
  while (j < m && (r + b[j]) <= k) {
    r += b[j++];
  }
  ans = max(ans, i + j);
  if (i > 0) i--;
  if (j > 0) j--;
  while (1) {
    if(i==0) beak;
    r-=a[i];
    while(j<m && r+b[j]<=k)
      r+=b[j++];
    ans=max(ans,i+j);
    
    i--;
    
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:41:14: error: 'beak' was not declared in this scope
   41 |     if(i==0) beak;
      |              ^~~~
Language: C++

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

int main(){
    int n,m,k;
    cin >> n >> m >> k;
    vll a(n),b(m),a_(n+1,0),b_(m+1,0);
    int amax = n;
    bool flag = false;
    for(int ix=0;ix<n;ix++){
        cin >> a.at(ix);
        a_.at(ix+1) = a.at(ix) + a_.at(ix);
    }
    sum = 0;
    for(int ix=0;ix<m;ix++){
        cin >> b.at(ix);
        b_.at(ix+1) = b.at(ix) + b_.at(ix);
    }
    int cnt = 0,ixx = m;
    for(int ix=0;ix<=n;ix++){
        if(a_.at(ix) > k) break;
        while(ixx >= 0 && b_.at(ixx) + a_.at(ix) > k){
            ixx--;
        }
        cnt = max(cnt, ix+ixx);
    }
    cout << cnt << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'sum' was not declared in this scope
   16 |     sum = 0;
      |     ^~~
Language: C++

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

typedef long long ll;
typedef unsigned long long ull;

#define int long long
#define endl "\n"
#define all(x) x.begin(), x.end()
#define deb(x) cout << #x << " --> " << (x) << endl
#define pb push_back
#define mod 1000000007  // 1e9 + 7
#define prec(x, y) fixed << setprecision(y) << x
#define print(v)                       \
    for (auto x : v) cout << x << " "; \
    cout << endl

void solve() {
    int i, j, n, k, m;
    cin >> n >> m >> k;
    list<int> a(n), b(m);
    for (auto &x : a) cin >> x;
    for (auto &x : b) cin >> x;
    int cnt = 0;
    while (k > 0 && !a.empty() && !b.empty()) {
        if (k < min(a.front(), b.front())) break;
        if (a.front() <= b.front()) {
            k -= a.front();
            a.pop_front();
        } else {
            k -= b.front();
            b.pop_front();
        }
        ++cnt;
    }
    while (k > 0 && !a.empty()) {
        if (k < a.front()) break;
        a.pop_front();
        ++cnt;
    }
    while (k > 0 && !b.empty()) {
        if (k < b.front()) break;
        b.pop_front();
        ++cnt;
    }
    cout << cnt << endl;
}

//Fuck Ratings
//Once a Charas always a Charas

int32_t main() 
    // ios::sync_with_stdio(0);
    // cout.tie(0);
    // cin.tie(0);
    int _t = 1;
    // cin >> _t;
    while (_t--)
        solve();
}

Compiler output:
a.cc:7:13: error: expected initializer before 'long'
    7 | #define int long long
      |             ^~~~
a.cc:56:5: note: in expansion of macro 'int'
   56 |     int _t = 1;
      |     ^~~
a.cc:58:5: error: expected unqualified-id before 'while'
   58 |     while (_t--)
      |     ^~~~~
a.cc:60:1: error: expected declaration before '}' token
   60 | }
      | ^