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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using Graph = vector<vector<int>>;
const int INF = 1000000007;
int main(){
  ll n,m,k;
  cin >> n >> m >> k;
  vector<ll>a(n),b(m),as(n + 1),bs(m + 1);
  rep(i,n)cin >> a[i];
  rep(i,m)cin >> b[i];
  rep(i,n)as[i + 1] += a[i] + as[i];
  rep(i,m)bs[i + 1] += b[i] + bs[i];
  int ans = 0;
  rep(i,n + 1){
    ll ok = k - as[i];
    if(ok < 0)continue;
    ans = max(ans,i + upper_bound(all(bs),ok) - bs.begin());
  }
  cout << ans - 1 << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:14: error: no matching function for call to 'max(int&, __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type)'
   21 |     ans = max(ans,i + upper_bound(all(bs),ok) - bs.begin());
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:21:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type' {aka 'long int'})
   21 |     ans = max(ans,i + upper_bound(all(bs),ok) - bs.begin());
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:21:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |     ans = max(ans,i + upper_bound(all(bs),ok) - bs.begin());
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main () {
  int N, M, K;
  cin >> N >> M >> K;
  
  vector<int> A(N);
  vector<int> B(M);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int j = 0; j < M; j++) {
    cin >> B.at(j);
  }
  
  int a = 0;
  int b = 0;
  while (a < K) {
    if (A.at(0) < B.at(0)) {
      a += A.at(0);
      A.erase(A.begin());
    }
    else if (A.at(0) > B.at(0)) {
      a += B.at(0);
      B.erase(B.begin());
    }
    else if (A.at(0) == B.at (0) && A.at(1) <= B.at(1)) {
      a += A.at(0);
      A.erase(A.begin());
    }
    else (A.at(0) == B.at(0) && A.at(1) > B.at(1)) {
      a += B.at(0);
      B.erase(B.begin());
    }
    b++;
  }
  
  cout << b - 1 << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:51: error: expected ';' before '{' token
   32 |     else (A.at(0) == B.at(0) && A.at(1) > B.at(1)) {
      |                                                   ^~
      |                                                   ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define tcase int _; cin >> _; while(_--)
const int MAX = 1e6;
 
int n, m;
ll k;
ll a[MAX], b[MAX];
 
void solve() {
	k = 0LL;
	cin >> n >> m >> k;
	for(int i=0; i<n; i++) cin >> a[i];
	for(int i=0; i<m; i++) cin >> b[i];
	int ans = 0LL;
	int i=0, j=0;
	while(i < n || j < m) {
		if(i < n && j < m) {
			if(a[i] <= b[j]) {
				k -= a[i];
				i++;
			} else {
				k -= b[j];
				j++;
			}
		} else if(i < n) {
			k -= a[i];
			i++;
		} else if(j < m) {
			k -= b[j];
			j++;
		}
		if(k < 0LL) break;
		ans++;
	}
	cout << ans << "\n";
}
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
 
 	solve();
 
  	return 0;
}

Compiler output:
a.cc:4:13: error: '::main' must return 'int'
    4 | #define int ll
      |             ^~
a.cc:41:1: note: in expansion of macro 'int'
   41 | int main() {
      | ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define tcase int _; cin >> _; while(_--)
const int MAX = 1e6;
 
int n, m;
ll k;
ll a[MAX], b[MAX];
 
void solve() {
	k = 0;
	cin >> n >> m >> k;
	for(int i=0; i<n; i++) cin >> a[i];
	for(int i=0; i<m; i++) cin >> b[i];
	int ans = 0;
	int i=0, j=0;
	while(i < n || j < m) {
		if(i < n && j < m) {
			if(a[i] <= b[j]) {
				k -= a[i];
				i++;
			} else {
				k -= b[j];
				j++;
			}
		} else if(i < n) {
			k -= a[i];
			i++;
		} else if(j < m) {
			k -= b[j];
			j++;
		}
		if(k < 0LL) break;
		ans++;
	}
	cout << ans << "\n";
}
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
 
 	solve();
 
  	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;


int main()
{
    int n,m;
    ll k;
    cin>>n>>m>>k;
    vector<ll>a(n+1),b(m+1);  
    int ans=0,N=0,M=0;
    a[0]=0;
    b[0]=0;
    rep(i,n){
        cin>>a[i+1];
        a[i+1]+=a[i];
    }
    rep(i,m){
        cin>>b[i+1];
        b[i+1]+=b[i];
    }
    int o=m;
    for(int i=0;i<=n;i++){
        while(a[o]+b[i]>k&&o>=0){
            o--;
        }
        //cout<<ans<<endl;
        if(o>=0)ans = max(ans,(ll)i+o);
        else break;
    }
    cout<<ans<<endl;
    return 0; 
}


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

// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define exf(x)	 for(auto&& tmp : x) { cout << tmp << endl; }	// 拡張for
#define PI 3.14159265358979323846264338327950288
#define testP	 cout << "------------------ test ------------------" << endl;	// 動作確認テスト
#define testX(x) cout << "testout : " << x << endl;	// テストアウト
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

// ------------------ ベクター表示 ------------------ //
void printVec(vector<int>& vec) {
	cout << "";
	for (auto it = vec.begin(); it != vec.end(); it++) cout << *it << " ";
	cout << endl;
}

// ------------------ ベクター合計 ------------------ //
int sumVec(vector<int> v) {
	int sum = 0;
	for (size_t i = 0; i < v.size(); i++) sum += v[i];
	return sum;
}

// -------------------------------------------------- //
// ------------------ ここから本編 ------------------ //
// -------------------------------------------------- //

int main(void) {

	ll N, M, K;
	cin >> N >> M >> K;

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

	ll ans = 0, best = M;
	for (ll i = 0; i <= N; i++) {
		if (A[i] > K) break;
		while (B[best] + A[i] > K) best--;
		ans = max(ans, i + best);
	}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:55:21: error: conflicting declaration 'll best'
   55 |         ll ans = 0, best = M;
      |                     ^~~~
a.cc:45:13: note: previous declaration as 'int best'
   45 |         int best = 0;
      |             ^~~~
Language: C++

#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    ll 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];
    Rep(i,1,N) A[i] += A[i-1];
    Rep(i,1,M) B[i] += B[i-1];

    ll ans = 0;
    REP(i, N){
        if(A[i]>K){
            chmax(ans, i);
            break;
        }
        int j = upper_bound(ALL(B), K-A[i])-B.begin();
        chmax(ans,(ll)i+j+1);
    }
    REP(i, M){
        if(B[i]>K){
            chmax(ans, i);
            break;
        }
        int j = upper_bound(ALL(A), K-B[i])-A.begin();
        chmax(ans,(ll)i+j+1);
    }
    pr(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:18: error: no matching function for call to 'chmax(ll&, int&)'
   46 |             chmax(ans, i);
      |             ~~~~~^~~~~~~~
a.cc:28:31: note: candidate: 'template<class T> bool chmax(T&, T)'
   28 | template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
      |                               ^~~~~
a.cc:28:31: note:   template argument deduction/substitution failed:
a.cc:46:18: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   46 |             chmax(ans, i);
      |             ~~~~~^~~~~~~~
a.cc:54:18: error: no matching function for call to 'chmax(ll&, int&)'
   54 |             chmax(ans, i);
      |             ~~~~~^~~~~~~~
a.cc:28:31: note: candidate: 'template<class T> bool chmax(T&, T)'
   28 | template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
      |                               ^~~~~
a.cc:28:31: note:   template argument deduction/substitution failed:
a.cc:54:18: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   54 |             chmax(ans, i);
      |             ~~~~~^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=1000000007;

int main() {
  ll n,m,k;
  cin >> n >> m >> k;
  vector<ll> a(n+1);
  vector<ll> b(m+1);
  a.at(0)=0;
  b.at(0)=0;
  for(ll i=1;i<=n;i++){
    cin >> a.at(i);
    a.at(i)=a.at(i-1)+a.at(i);
  }
  for(ll i=1;i<=m;i++){
    cin >> b.at(i);
    b.at(i)=b.at(i-1)+b.at(i);
  }
  ll ans=0;
  ii j=m;
  for(ll i=0;i<n;i++){
    if(a.at(i)>k)
    break;
    while(b.at(j)>k-a.at(i)){
      j-=1;
      ans=max(ans,i+j);
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:3: error: 'ii' was not declared in this scope
   22 |   ii j=m;
      |   ^~
a.cc:26:16: error: 'j' was not declared in this scope
   26 |     while(b.at(j)>k-a.at(i)){
      |                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
typedef pair<int,int> P;
struct edge{int to, id;};
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define INF 1000000000000

int main(){
    ll n,m,k;
    cin >> n >> m >> k;
    ll a[n+];
    ll b[m+];
    ll suma[n+];
    ll sumb[m+];
    rep(i,n){
        ll temp;
        cin >> temp;
        a[i] = temp;
        if(i == 0) {
            suma[i] = temp;
        }
        else{
            suma[i] = suma[i-1]+temp;
        }
    }
    rep(i,m){
        ll temp;
        cin >> temp;
        b[i] = temp;
        if(i == 0) {
            sumb[i] = temp;
        }
        else{
            sumb[i] = sumb[i-1]+temp;
        }
    }
    ll upper = m-1;
    bool ok = false;
    ll ans = -1;
    rep(i,n){
        if(suma[i] >= k) upper = 0;
        while(sumb[upper] > k-suma[i] && upper > 0){
            upper--;
        }
        //ans = max(ans,upper+i+2);
        if(suma[i]+sumb[upper] <= k){
            ok = true;
            ll temp = upper+i+2;
            if(ans < upper+i+2){
                ans = temp;
            }
        }
    }
    if(ok) cout << ans << endl;
    else cout << 0 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:12: error: expected primary-expression before ']' token
   13 |     ll a[n+];
      |            ^
a.cc:14:12: error: expected primary-expression before ']' token
   14 |     ll b[m+];
      |            ^
a.cc:15:15: error: expected primary-expression before ']' token
   15 |     ll suma[n+];
      |               ^
a.cc:16:15: error: expected primary-expression before ']' token
   16 |     ll sumb[m+];
      |               ^
a.cc:20:9: error: 'a' was not declared in this scope
   20 |         a[i] = temp;
      |         ^
a.cc:22:13: error: 'suma' was not declared in this scope
   22 |             suma[i] = temp;
      |             ^~~~
a.cc:25:13: error: 'suma' was not declared in this scope
   25 |             suma[i] = suma[i-1]+temp;
      |             ^~~~
a.cc:31:9: error: 'b' was not declared in this scope
   31 |         b[i] = temp;
      |         ^
a.cc:33:13: error: 'sumb' was not declared in this scope
   33 |             sumb[i] = temp;
      |             ^~~~
a.cc:36:13: error: 'sumb' was not declared in this scope
   36 |             sumb[i] = sumb[i-1]+temp;
      |             ^~~~
a.cc:43:12: error: 'suma' was not declared in this scope
   43 |         if(suma[i] >= k) upper = 0;
      |            ^~~~
a.cc:44:15: error: 'sumb' was not declared in this scope
   44 |         while(sumb[upper] > k-suma[i] && upper > 0){
      |               ^~~~
a.cc:44:31: error: 'suma' was not declared in this scope
   44 |         while(sumb[upper] > k-suma[i] && upper > 0){
      |                               ^~~~
a.cc:48:12: error: 'suma' was not declared in this scope
   48 |         if(suma[i]+sumb[upper] <= k){
      |            ^~~~
a.cc:48:20: error: 'sumb' was not declared in this scope
   48 |         if(suma[i]+sumb[upper] <= k){
      |                    ^~~~
Language: C++

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

int main () {
  int N, M, K;
  cin >> N >> M >> K;
  
  vector<int> A(N);
  vector<int> B(M);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int j = 0; j < M; j++) {
    cin >> B.at(j);
  }
  
  int a = 0;
  int b = 0;
  while (a < K) {
    if (A.at(0) < B.at(0)) {
      a += A.at(0);
      A.erase(A.begin());
    }
    else if (A.at(0) > B.at(0)) {
      a += B.at(0);
      B.erase(B.begin());
    }
    else if (A.at(0) == B.at (0) && A.at(1) <= B.at(1)) {
      a += A.at(0);
      A.erase(A.begin());
    }
    else if (A.at(0) == B.at(0) && A.at(1) > B.at(1)) {
      a += B.at(0);
      B.erase(B.begin())
    }
    b++;
  }
  
  cout << b - 1 << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:25: error: expected ';' before '}' token
   34 |       B.erase(B.begin())
      |                         ^
      |                         ;
   35 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;

int main() {
    int n, m;cin >> n >> m;
    ll k;cin >> k;
    ll A[n+1], B[m+1];
    A[0] = 0, B[0] = 0;
    for(int i=0; i<n; i++)cin >> A[i+1];
    for(int i=0; i<m; i++)cin >> B[i+1];

    // ll dp[n+m+5];
    // for (int i = 0; i < n+m+5; i++)dp[i] = INF;
    
    // int ai = 0;
    // for (int a_and_b = 1 ; a_and_b <= n+m && dp[a_and_b] <= k; a_and_b++)
    // {
    //     int bi = a_and_b - ai;
    //     if()
    //     if(ai == n);
    // }
    

    

    ll sum = 0;
    int fin;
    for (int i = 0; sum <= k && i < n; i++)
    {
        sum += a[i];
        fin = i;
    }
    if(sum > k){
        sum -= a[fin];
        fin--;
    }


    ll max = fin + 1;
    ll j = 0;
    for (ll i = fin; i >= 0 && j < m;)
    {
        sum -= a[i];
        i--;
        while(sum <= k && j < m){
            sum += b[j];
            j++; 
        }
        if(sum > k){
            j--;
            sum -= b[j];
        }
        // if(j == m)j--;
        if(max < i+j+2)max = i+j+2;
    }
    cout << max << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:16: error: 'a' was not declared in this scope
   32 |         sum += a[i];
      |                ^
a.cc:36:16: error: 'a' was not declared in this scope
   36 |         sum -= a[fin];
      |                ^
a.cc:45:16: error: 'a' was not declared in this scope
   45 |         sum -= a[i];
      |                ^
a.cc:48:20: error: 'b' was not declared in this scope
   48 |             sum += b[j];
      |                    ^
a.cc:53:20: error: 'b' was not declared in this scope
   53 |             sum -= b[j];
      |                    ^
Language: C++

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

int main() {
  int N, M, K;
  cin >> N >> M >> K;
  vector<long> vecA(N);
  vector<long> vecB(M);
  long A, B;
  int counter = 0;
  long Time = 0;
  for (int i = 0; i < N; i++) {
    cin >> A;
    vecA.at(N-i-1) = A;
  }
  for (int i = 0; i < M; i++) {
    cin >> B;
    vecB.at(M-i-1) = B;
  }
  for (int i = 0; i < N + M; i++) {
    int p;
    p = vecA.size();
    int q;
    q = vecB.size();
    if (vecA.at(p - 1) <= vecB.at(q - 1)) {
      Time += vecA.at(p - 1);
      counter++;
      vecA.pop_back();
      if (Time > K)
        break;
      continue;
    }
    if (vecA.at(p - 1) => vecB.at(q - 1)) {
      Time += vecB.at(q - 1);
      counter++;
      vecB.pop_back();
      if (Time > K)
        break;
      continue;
    }
  }
  cout << counter << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:25: error: expected primary-expression before '>' token
   33 |     if (vecA.at(p - 1) => vecB.at(q - 1)) {
      |                         ^
Language: C++

int main() {
    int N, M; ll K; cin >> N >> M >> K;
    vector<ll> A(N+1,0LL), B(M+1, 0LL);
    rep(i,N) {
        cin >> A[i+1];
        A[i+1] += A[i];
    }
    rep(i,M) {
        cin >> B[i+1];
        B[i+1] += B[i];
    }
    int ans = 0;
    for(int i=0; i<=N; i++){
        if(A[i] > K){
            break;
        }
        auto b_index = upper_bound(B.begin(), B.end(), K-A[i]);
        int d = int(b_index-B.begin())-1;
        ans = max(ans, i+d);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:15: error: 'll' was not declared in this scope
    2 |     int N, M; ll K; cin >> N >> M >> K;
      |               ^~
a.cc:2:21: error: 'cin' was not declared in this scope
    2 |     int N, M; ll K; cin >> N >> M >> K;
      |                     ^~~
a.cc:2:38: error: 'K' was not declared in this scope
    2 |     int N, M; ll K; cin >> N >> M >> K;
      |                                      ^
a.cc:3:5: error: 'vector' was not declared in this scope
    3 |     vector<ll> A(N+1,0LL), B(M+1, 0LL);
      |     ^~~~~~
a.cc:3:16: error: 'A' was not declared in this scope
    3 |     vector<ll> A(N+1,0LL), B(M+1, 0LL);
      |                ^
a.cc:3:28: error: 'B' was not declared in this scope
    3 |     vector<ll> A(N+1,0LL), B(M+1, 0LL);
      |                            ^
a.cc:4:9: error: 'i' was not declared in this scope
    4 |     rep(i,N) {
      |         ^
a.cc:4:5: error: 'rep' was not declared in this scope
    4 |     rep(i,N) {
      |     ^~~
a.cc:17:24: error: 'upper_bound' was not declared in this scope
   17 |         auto b_index = upper_bound(B.begin(), B.end(), K-A[i]);
      |                        ^~~~~~~~~~~
a.cc:19:15: error: 'max' was not declared in this scope
   19 |         ans = max(ans, i+d);
      |               ^~~
a.cc:21:5: error: 'cout' was not declared in this scope
   21 |     cout << ans << endl;
      |     ^~~~
a.cc:21:20: error: 'endl' was not declared in this scope
   21 |     cout << ans << endl;
      |                    ^~~~
Language: C++

#include <bits/stdc++.h>
#include <gmpxx.h>

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define MSGF(x, n) MSG(fixed << setprecision(n) << x)
#define END(x) cout << x << endl; return(0);
#define IPT(v, n) REP(i, 0, n){ cin >> v[i]; }
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<ull> vul;
typedef vector<vector<ull>> vvul;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
const static ll INF = 1LL << 30;

ll a, b, c, d, k, l, m, n, h, w, q, x, y;
string s, t;

ll ans = 0;
ll sum = 0;
ll cnt = 0;
ll cur = 0;
ll tmp = 0;
ll mini = INF;
ll maxi = 0;

double ave = 0.0;

ll mod_pow(ll base, ll power) {
    if (power == 0) return 1;
    if (power == 1) return base % MOD;
    if (power % 2 == 0) return ((mod_pow(base % MOD, (power / 2)) % MOD) * (mod_pow(base, (power / 2)) % MOD)) % MOD;
    return (base % MOD * (mod_pow(base % MOD, power - 1) % MOD)) % MOD;
}

ll mod_fact(ll number) {
    ll ret = 1;
    ll count = 1;
    while (count <= number) {
        ret *= (count % MOD);
        ret %= MOD;
        count++;
    }
    return ret % MOD;
}

ll gcd(ll a, ll b) {
    if (a < b) {
        return gcd(b, a);
    }
    ll c = a % b;
    while (c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    cin >> n >> m >> k;
    vl a(n);
    vl b(m);

    IPT(a, n)
    IPT(b, m)

    vl sum_a(n);
    vl sum_b(m);

    sum_a.at(0) = a.at(0);
    sum_b.at(0) = b.at(0);

    REP(i, 1, n) {
        sum_a[i] = sum_a.at(i - 1) + a.at(i);
    }

    REP(i, 1, m) {
        sum_b[i] = sum_b.at(i - 1) + b.at(i);
    }

    auto itr = upper_bound(ALL(sum_b), k - sum_a.at(i));
    ll count = distance(sum_b.begin(), itr);
  	ans = count;
    NREP() {
        if (sum_a.at(i) > k) {
            break;
        }

        auto b_itr = upper_bound(ALL(sum_b), k - sum_a.at(i));

        ll a_count = i + 1;
        ll b_count = distance(sum_b.begin(), b_itr);
        
        if (b_count < 0) b_count = 0;
        ans = max(ans, a_count + b_count);
    }
    MSG(ans)
}


Compiler output:
a.cc: In function 'int main()':
a.cc:106:53: error: 'i' was not declared in this scope
  106 |     auto itr = upper_bound(ALL(sum_b), k - sum_a.at(i));
      |                                                     ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define per(i,n) for(int i=(n)-1; i>=0; i--)
#define chmin(a,b) a = min(a,b)
#define chmax(a,b) a = max(a,b)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;
const int MOD = 1000000007;

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

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

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
map<int,int> data;
int main(){
    ll n,m,k;
    cin >> n>>m>>k;
    vector<int> A(n);
    vector<int> B(m);
    rep(i,0,n){
        ll a;
        cin >> a;
        if(i==0){
            A[i]=a;
        }else{
            A[i]=A[i-1]+a;
        }
        
    }
    rep(i,0,m){
        ll b;
        cin >> b;
        if(i==0){
            B[i]=b;
        }else{
            B[i]=B[i-1]+b;
        }
    }
    ll ans = 0;
    ll check = m-1;
    rep(i,0,n){
        if(A[i]>k){
            break;
        }else{
            int max_i;
            if(A[i]+B[m-1]<=k){
                max_i = i+m-1+2;
            }else{
                while(A[i]+B[check]>k){
                    check--;
                }
                max_i = i+check+2;

            }
            ans = max(ans,max_i);
        }
    }
    cout<<ans<<endl;

  return 0;
}

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

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

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

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

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

#include <cstdio>
using namespace std;

int ans;
int n,m,k;
int a[200010],b[200010];
long long psa[200010],psb[200010];

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

Compiler output:
a.cc: In function 'int main()':
a.cc:34:45: error: 'max' was not declared in this scope
   34 |                                         ans=max(cnt,ans);
      |                                             ^~~
Language: C++

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

int main() {
  long long n,m,k;
  cin >> n >> m >> k;
  vector<long long> a(n,0);
  vector<long long> b(m,0);
  vector<long long> suma(n,0);
  vector<long long> sumb(m,0);
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(i==0) suma[i]=a[i];
    else suma[i]=suma[i-1]+a[i];
  }
  for(int i=0;i<m;i++){
    cin >> b[i];
    if(i==0) sumb[i]=b[i];
    else sumb[i]=sumb[i-1]+b[i];
  }
  long long j=m-1,ans=0;
  long long l=sumb[m-1];
  for(int i=-1;i<n;i++){
    if(suma[a]>k) break;
    if(i==-1){
      while(true){
        if(l<=k) break;
        l-=b[j];
        j--;
        if(j==-1) break;
      }
    }
    else{
      while(true){
        if(l+suma[i]<=k) break;
        l-=b[j];
        j--;
        if(j==-1) break;
      }
    }
    ans=max(ans,j+i+2);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:12: error: no match for 'operator[]' (operand types are 'std::vector<long long int>' and 'std::vector<long long int>')
   24 |     if(suma[a]>k) break;
      |            ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = long long int; _Alloc = std::allocator<long long int>; reference = long long int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<long long int>::size_type' {aka 'long unsigned int'}
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = long long int; _Alloc = std::allocator<long long int>; const_reference = const long long int&; size_type = long unsigned int]'
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<long long int>::size_type' {aka 'long unsigned int'}
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
typedef pair<int,int> P;
struct edge{int to, id;};
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000000

int main(){
    ll n,m,k;
    cin >> n >> m >> k;
    ll a[n];
    ll b[m];
    ll suma[n];
    ll sumb[m];
    rep(i,n){
        ll temp;
        cin >> temp;
        a[i] = temp;
        if(i == 0) suma[i] = temp;
        else{
            suma[i] = suma[i-1]+temp;
        }
    }
    rep(i,m){
        ll temp;
        cin >> temp;
        b[i] = temp;
        if(i == 0) sumb[i] = temp;
        else{
            sumb[i] = sumb[i-1]+temp;
        }
    }
    ll upper = m-1;
    bool ok = false;
    int ans = -1;
    rep(i,n){
        while(sumb[upper] > k-suma[i] && upper >= 0){
            upper--;
        }
        ans = max(ans,upper+i+2);
        if(suma[i]+sumb[upper] <= k){
            ok = true;
        }
    }
    if(ok) cout << ans << endl;
    else cout << 0 << endl;
}

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

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

ll a[200006],b[200006];

int main(){
  ll n,m,k;
  ll i,j,t;
  scanf("%lld %lld %lld", &n, &m, &k);
  a[0] = b[0] = 0;
  for(i = 1;i <= n;i++) scanf("%lld", &a[i]);
  for(i = 1;i <= m;i++) scanf("%lld", &b[i]);
  for(i = 2;i <= n;i++) a[i] += a[i - 1];
  for(i = 2;i <= m;i++) b[i] += b[i - 1];

  t = m;
  ans = -999;
  for(i = 0;i <= n;i++){
    for(j = t;j >= 0;j--){
      if(a[i] + b[j] <= k) break;
    }

    t = j;
    ans = max(ans,i + t);
  }
  printf("%lld\n", ans);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |   ans = -999;
      |   ^~~
      |   abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

//小さい順に実装しても間に合うとは限らないよ？
int main() {
    ll n, m, k, A, B;
    cin >> n >> m >> k;
    vector<ll> a(n), b(m);
    rep1(i, n){
        cin >> A;
        if (i == 0){
            a[i] = A;continue;
        }
        a[i] += A;
    }
    rep1(i, m){
        cin >> B;
        if (i == 0){
            b[i] = B;continue;
        }
        b[i] += B;
    }
    rep1(i, m) cin >> b[i];
    ll ans = 0;
    ll j = m-1;
    rep1(i, n){
        if (a[i] > k) break;
        while (b[j] > k - a[i]){
            j--;
        }
        ans = max(ans, i+j+2)
    }


    cout << ans << endl;
}

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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:18:22: error: 'i' was not declared in this scope
   18 |   rep(j, m) cin >> b[i];
      |                      ^
Language: C++

//karna padega 
#include<bits/stdc++.h>
using namespace std;  
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n; i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
signed main(){
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
  IOS;
  int T=1;
  // cin >> T;
  while(T--){
    int n , m ,k;
    cin >> n >> m >> k;
    vector<int>dp(n),dp2(m);
    fn{
      cin>>dp[i];
      if(i)dp[i]+=dp[i-1];
    }
    fm{
      cin>>dp2[j];
      if(j)dp2[j]+=dp2[j-1];
    }
    int ans = 0;
    fn{
      int rem =k - dp[i];
      ans =max(ans,i+1);
      int pos = 0 ;
      if(rem<0)break;
      if(rem >= dp2.back()){
        ans = max(ans, i+1,m);
        continue;
      }
      pos =  upper_bound(all(dp2),rem)- dp2.begin();
      ans =max(ans, i + 1ll + pos);
    }
    cout << ans;
  
  }
  return 0;
}

Compiler output:
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:2:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:61:18:   required from here
   61 |         ans = max(ans, i+1,m);
      |               ~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

//小さい順に実装しても間に合うとは限らないよ？
int main() {
    ll n, m, k, A, B;
    cin >> n >> m >> k;
    vector<ll> a(n), b(m);
    rep1(i, n){
        cin >> A;
        if (i == 0){
            a[i] = A;continue;
        }
        a[i] += A;
    }
    rep1(i, m){
        cin >> B;
        if (i == 0){
            b[i] = B;continue;
        }
        b[i] += B;
    }
    rep1(i, m) cin >> b[i];
    ll ans = 0; j = m-1;
    rep1(i, n){
        if (a[i] > k) break;
        while (b[j] > k - a[i]){
            j--;
        }
        ans = max(ans, i+j+2)
    }


    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: 'j' was not declared in this scope
   31 |     ll ans = 0; j = m-1;
      |                 ^
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e12)
#define PI (acos(-1))
#define debug(a) cout << "["; rep(i,a.size()) cout << a[i] << ", "; cout<<"]"<< endl;

const ll mod = 1000000007;
int main() {
    int n,m;
    ll k;
    cin >> n >> m >> k;
    //a[0] = 0, a[1] = A1, ... , a[n] = An
    vector<ll> a(n+1);
    vector<ll> b(m+1);
    //asum[0] = 0, asum[1] = asum[0] + a[1], ... , asum[n] = asum[n-1] + a[n], asum[n+1] = INF
    vector<ll> asum(n+2);
    vector<ll> bsum(m+2);
    rep(i,n){
        cin >> a[i+1];
        asum[i+1] = asum[i] + a[i+1];
    }
    rep(i,m){
        cin >> b[i+1];
        bsum[i+1] = bsum[i] + b[i+1];
    }
    asum[n+1] = INF;
    bsum[m+1] = INF;

    int ans = 0;
    auto bsum_last = bsum.end();
    rep(i,n+1){
        if(asum[i] > k) break;
        int a_cnt = i;
        //bsumのなかでk - asum[i]を超えるところの左端のindexをさがす。それに-1する。
        //bsum.end()まで見ていると遅い？
        //bsum_lastを左にずらしていく
        bsum_last = upper_bound(bsum.begin(), bsum_last, k - asum[i]);
        int b_cnt = bsum_last - bsum.begin() - 1;
        ans = max(ans, a_cnt + b_cnt);
    }
    // debug(a);
    // debug(b);
    // debug(asum);
    // debug(bsum);    
    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc:39:31: error: stray '\16' in program
   39 |         if(asum[i] > k) break;<U+000E>
      |                               ^~~~~~~~