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

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    vector<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];
    int ans = 0;
    for(int i = 1; i <= n; i++){
        if(a[i] > k)    break;
        ans = max(ans, i+upper_bound(b.begin(),b.end(),k-a[i])-1);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: no matching function for call to 'max(int&, __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >)'
   16 |         ans = max(ans, i+upper_bound(b.begin(),b.end(),k-a[i])-1);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc: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:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >')
   16 |         ans = max(ans, i+upper_bound(b.begin(),b.end(),k-a[i])-1);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/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:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |         ans = max(ans, i+upper_bound(b.begin(),b.end(),k-a[i])-1);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
  long N,M,K;cin>>N>>M>>K;
  vector<long> A(N+1),B(M+1);
  A.at(0)=0;
  for(long i=1;i<=N;i++){
    long X;cin>>X;
    A.at(i)=X+A.at(i-1);
  }
  B.at(0)=0;
  for(long i=1;i<=M;i++){
    long X;cin>>X;
    B.at(i)=X+B.at(i-1);
  }
  long best;
  for(long i=M;i>=0;i--){
    if(B.at(i)<=K){
      best=i;
      break;
    }
  }
  priority_queue<long> ans;
  ans.push(best);
  long read;
  for(long i=1;i<=N;i++){
    if(A.at(i)>K) break;
    for(long j=best;j>=0;j--){
      if(A.at(i)+B.at(j)<=K){
        read=i+j;
        best=j;
        break;
      }
    }
    ans.push(read);
  }
  cout<<A.top()<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:11: error: 'class std::vector<long int>' has no member named 'top'
   38 |   cout<<A.top()<<endl;
      |           ^~~
Language: C++

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


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

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

    cin >> N >> M >> K;
    
    A_SUM.push_back(0);
    B_SUM.push_back(0);

    long long sum = 0;
    for(int i=0; i < N; ++i){
        long long tmp;
        cin >> tmp;
        sum += tmp;
        //A.push_back(tmp);
        A_SUM.push_back(sum);
    }

    sum = 0;
    for(int i=0; i < M; ++i){
        long long tmp;
        cin >> tmp;
        sum += tmp;
        //B.push_back(tmp);
        B_SUM.push_back(sum);
    }
    long long ans = 0;
    
    long long B2=M;
    for(int i=0; i <= N; ++i ){
        long long left = K-A_SUM[i];
        //cout << "left=" << left << endl;
        if(left <= 0){
            break;
        }
        chmax(ans, i);
        for(int j=B2; j >= 0; --j){
            B2=j;
            if(B_SUM[j] <= left){
                chmax(ans, (j+ i));
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

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

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

    queue<ll> q1, q2;

    while(n--){ ll x; cin>>x; q1.push(x);}
    while(m--){ ll x; cin>>x; q2.push(x);}

    ll s=0, c=0;
    bool b=false, b2=false;
    while(1){
        if( !q1.empty( ) && !q2.empty() && q1.front()<=q2.front()){
            if(s+q1.front()> k) b=true;
            s+=q1.front(); q1.pop(); c++;
        }
        else if(!q1.empty( ) && !q2.empty() && q1.front()>q2.front()) {
            if(s+q2.front()> k)  b2=true;
            s+=q2.front(); q2.pop();  c++;
        }

        if(b2 || q1.empty()) {
            if(s+q2.front()> k) break;
            s+=q2.front(); q2.pop();  c++;
        }
        else if(b || q2.empty()) {
            if(s+q1.front()> k) break;
            s+=q1.front(); q1.pop();  c++;
        }
        
        if( b && b1) break;
        if(q1.empty() && q2.empty() && k<=s) break;
    }
    cout<<c<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:18: error: 'b1' was not declared in this scope; did you mean 'b2'?
   35 |         if( b && b1) break;
      |                  ^~
      |                  b2
Language: C++

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

int main() {
  int64_t N, M, K, ans = 0;
  cin >> N >> M >> K;
  vector<int64_t> vn(N+1,0), vm(M+1,0);
  for(int i = 0; i < N; i++) {
    cin >> vn.at(i+1);
    vn.at(i+1) += vn.at(i);
  }
  for(int i = 0; i < M; i++) {
    cin >> vm.at(i+1);
    vm.at(i+1) += vm.at(i);
  }
  for(int i = 0; i <= N; i++) {
    if(vn.at(i)>K)
      break;
    for(int j = 0; j <= M; j++) {
      if(vm.at(j)>K)
        break;
      else if(vn.at(i)+vm.at(j)<=K) {
        int a = i+j
        if(a>ans)
          ans = a;
      }
      else 
        break;
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: expected ',' or ';' before 'if'
   24 |         if(a>ans)
      |         ^~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <numeric>
#include <cmath>
#include <iomanip> //cout << fixed << setprecision(15) << << endl;
#include <cassert>
#include "atcoder/segtree"

using namespace std;
using namespace atcoder;

#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define P pair<int,int>

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;


int main(){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    int n, m; ll k;
    cin >> n >> m >> k;
    vector<ll> a(n), b(m),A(n+1);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];
    rep(i,n-1) a[i+1] += a[i];
    rep(i,m-1) b[i+1] += b[i];
    a.insert(a.begin(),0);

    int ans = 0;
    for(int i = 0; i < n+1; ++i){
        if(k-a[i] < 0) break;

        auto itr = lower_bound(b.begin(),b.end(), k-a[i]);
        int cnt = distance(b.begin(),itr);
        if(*itr == k-a[i]) cnt++;
        ans = max(ans, cnt + i);
    }

    cout << ans << endl;
}



Compiler output:
a.cc:22:10: fatal error: atcoder/segtree: No such file or directory
   22 | #include "atcoder/segtree"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

# Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
# }}} End Header
# _________コーディングはここから！！___________
n, m, k = map(int, input().split())
A = list(accumulate(map(int, input().split())))
B = list(accumulate(map(int, input().split())))
A=[0]+A
B=[0]+B
ans = []
for i in range(n+1):
    c = bisect_right(B, k-A[i])-1
    if c!=-1:
        ans.append(c+i)
print(max(ans))


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #Begin
    1 | # Begin Header {{{
      |   ^~~~~
a.cc:7:3: error: invalid preprocessing directive #}
    7 | # }}} End Header
      |   ^
a.cc:8:3: error: invalid preprocessing directive #_________\U000030b3\U000030fc\U000030c7\U000030a3\U000030f3\U000030b0\U0000306f\U00003053\U00003053\U0000304b\U00003089\U0000ff01\U0000ff01___________
    8 | # _________コーディングはここから！！___________
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:2:1: error: 'from' does not name a type
    2 | from math import gcd
      | ^~~~
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define rep(i,s,e) for (int64_t i=s; i<e; i++)
#define pi 3.14159265358979323846264338327950L
using namespace std;

int main() {
  int64_t N, M, K;
  cin >> N >> M >> K;
  vector<int64_t> A(N);
  vector<int64_t> B(M);
  rep(i,0,N) {
    cin >> A[i];
  }
  rep(i,0,M) {
    cin >> B[i];
  }
  vector<int64_t> a(N);
  a[0]=A[0];
  if (N>1) {
    rep(i,1,N) {
      a[i]=a[i-1]+A[i];
    }
  }
  vector<int64_t> C(N);
  rep(i,0,N) {
    if (a[i]>=K) {
      C[i]=0;
    }
    else {
      C[i]=i+1;
    }
  }
  rep(i,0,N) {
    rep(j,0,M) {
      a[i]+=B[j];
      if (a[i]>K) {
        break;
      }
      else {
        C[i]++;
      }
    }
  }
  sort(C.begin(),C.end());
  cout << C[N-1] << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:60:26: error: expected '}' at end of input
   60 |   cout << C[N-1] << endl;
      |                          ^
a.cc:21:12: note: to match this '{'
   21 | int main() {
      |            ^
Language: C++

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

int main() {
    ll N, M, K;
    cin >> N >> M >> K;
    vector<ll> acc_A;
    vector<ll> acc_B;
    acc_A.push_back(0);
    acc_B.push_back(0);
    ll sum_a = 0;
    for(int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        sum_a += a;
        acc_A.push_back(sum_a);
    }
    ll sum_b = 0;
    for(int i = 0; i < M; ++i) {
        int b;
        cin >> b;
        sum_b += b;
        acc_B.push_back(sum_b);
    }
    vector<ll> long_ar, short_ar; 

    if(N >= M) {
        long_ar = acc_A;
        short_ar = acc_B;
    } else {
        long_ar = acc_B;
        short_ar = acc_A;
    }
    ll ans = 0;
    for(ll i = 0; i <= short_ar.size(); ++i) {
        for(ll j = ans-i; j <= long_ar.size(); ++j) {
            if(short_ar[i] + long_ar[j] <= K) {
                ans = max(ans, i+j);
            }
            else break;
        }
    }

    cout << ans << endl;

    return 0;


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

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

int main() {
    ll N, M, K;
    cin >> N >> M >> K;
    vector<ll> acc_A;
    vector<ll> acc_B;
    ll sum_a = 0;
    for(int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        sum_a += a;
        acc_A.push_back(sum_a);
    }
    ll sum_b = 0;
    for(int i = 0; i < M; ++i) {
        int b;
        cin >> b;
        sum_b += b;
        acc_B.push_back(sum_b);
    }

    ll ans = 0;
    for(ll i = 0; i < N; ++i) {
        for(ll j = 0; j < M; ++j) {
            if(acc_A[i] + acc_B[j] <= K) {
                ans = max(ans, i+j+2);
            }
            else break;
        }
    }

    cout << ans << endl;

    return 0;


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

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

ll main(){
 ll N, M, K, sum_time=0, count=0;
  
 cin >> N >> M >> K;
 vector<ll> a(N);
 vector<ll> b(N);
  
 ll i=0, j=0;
  while(sum_time<=K){
    if(a(i)<b(j)){
     sum_time += a(i);
     i++;
     count++;
    }else{
     sum_time += b(i);
     j++;
     count++;
    }
   }
  
  cout << count-1 << endl;
}
    
    


Compiler output:
a.cc:6:1: error: '::main' must return 'int'
    6 | ll main(){
      | ^~
a.cc: In function 'int main()':
a.cc:15:9: error: no match for call to '(std::vector<long long int>) (ll&)'
   15 |     if(a(i)<b(j)){
      |        ~^~~
a.cc:15:14: error: no match for call to '(std::vector<long long int>) (ll&)'
   15 |     if(a(i)<b(j)){
      |             ~^~~
a.cc:16:19: error: no match for call to '(std::vector<long long int>) (ll&)'
   16 |      sum_time += a(i);
      |                  ~^~~
a.cc:20:19: error: no match for call to '(std::vector<long long int>) (ll&)'
   20 |      sum_time += b(i);
      |                  ~^~~
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, sum_time=0, count=0;
  
 cin >> N >> M >> K;
 vector<ll> a(N);
 vector<ll> b(N);
  
 ll i=0, j=0;
  while(sum_time<=K){
    if(a(i)<b(j)){
     sum_time += a(i);
     i++;
     count++;
    }else{
     sum_time += b(i);
     j++;
     count++;
    }
   }
  
  cout << count-1 << endl;
}
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: no match for call to '(std::vector<long long int>) (ll&)'
   15 |     if(a(i)<b(j)){
      |        ~^~~
a.cc:15:14: error: no match for call to '(std::vector<long long int>) (ll&)'
   15 |     if(a(i)<b(j)){
      |             ~^~~
a.cc:16:19: error: no match for call to '(std::vector<long long int>) (ll&)'
   16 |      sum_time += a(i);
      |                  ~^~~
a.cc:20:19: error: no match for call to '(std::vector<long long int>) (ll&)'
   20 |      sum_time += b(i);
      |                  ~^~~
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, sum_time=0, count=0;
  
 cin >> N >> M >> K;
 vector<ll> a(N);
 vector<ll> b(N);
  
 ll i=0, j=0;
  while(sum_time<=K){
    if(a(i)<b(j)){
     sum_time += a(i);
    i++;
    count++;
    }else{
     sum_time += b(i);
     j++;
     count++;
    }
   }
  
  cout << count-1 << endl;
}
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: no match for call to '(std::vector<long long int>) (ll&)'
   15 |     if(a(i)<b(j)){
      |        ~^~~
a.cc:15:14: error: no match for call to '(std::vector<long long int>) (ll&)'
   15 |     if(a(i)<b(j)){
      |             ~^~~
a.cc:16:19: error: no match for call to '(std::vector<long long int>) (ll&)'
   16 |      sum_time += a(i);
      |                  ~^~~
a.cc:20:19: error: no match for call to '(std::vector<long long int>) (ll&)'
   20 |      sum_time += b(i);
      |                  ~^~~
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, sum_time=0, count=0;
  
 cin >> N >> M >> K;
 vector<ll> a(N);
 vector<ll> b(N);
  
 ll i=0, j=0;
  while(sum<=K){
    if(a(i)<b(j)){
     sum_time += a(i);
    i++;
    count++;
    }else{
     sum_time += b(i);
     j++;
     count++;
    }
   }
  
  cout << count-1 << endl;
}
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'sum' was not declared in this scope
   14 |   while(sum<=K){
      |         ^~~
a.cc:15:9: error: no match for call to '(std::vector<long long int>) (ll&)'
   15 |     if(a(i)<b(j)){
      |        ~^~~
a.cc:15:14: error: no match for call to '(std::vector<long long int>) (ll&)'
   15 |     if(a(i)<b(j)){
      |             ~^~~
a.cc:16:19: error: no match for call to '(std::vector<long long int>) (ll&)'
   16 |      sum_time += a(i);
      |                  ~^~~
a.cc:20:19: error: no match for call to '(std::vector<long long int>) (ll&)'
   20 |      sum_time += b(i);
      |                  ~^~~
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 sum_time=0, count=0;
  
 cin >> N >> M >> K;
 vector<ll> a(N);
 vector<ll> b(N);
  
 ll i=0, j=0;
  while(sum<=K){
    if(a(i)<b(j)){
     sum_time += a(i);
    i++;
    count++;
    }else{
     sum_time += b(i);
     j++;
     count++;
    }
   }
  
  cout << count-1 << endl;
}
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: expected initializer before 'sum_time'
    7 |  ll N, M, K sum_time=0, count=0;
      |             ^~~~~~~~
a.cc:9:19: error: 'K' was not declared in this scope
    9 |  cin >> N >> M >> K;
      |                   ^
a.cc:14:9: error: 'sum' was not declared in this scope
   14 |   while(sum<=K){
      |         ^~~
a.cc:15:9: error: no match for call to '(std::vector<long long int>) (ll&)'
   15 |     if(a(i)<b(j)){
      |        ~^~~
a.cc:15:14: error: no match for call to '(std::vector<long long int>) (ll&)'
   15 |     if(a(i)<b(j)){
      |             ~^~~
a.cc:16:6: error: 'sum_time' was not declared in this scope
   16 |      sum_time += a(i);
      |      ^~~~~~~~
a.cc:16:19: error: no match for call to '(std::vector<long long int>) (ll&)'
   16 |      sum_time += a(i);
      |                  ~^~~
a.cc:18:10: error: no post-increment operator for type
   18 |     count++;
      |          ^~
a.cc:20:6: error: 'sum_time' was not declared in this scope
   20 |      sum_time += b(i);
      |      ^~~~~~~~
a.cc:20:19: error: no match for call to '(std::vector<long long int>) (ll&)'
   20 |      sum_time += b(i);
      |                  ~^~~
a.cc:22:11: error: no post-increment operator for type
   22 |      count++;
      |           ^~
a.cc:26:16: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   26 |   cout << count-1 << endl;
      |           ~~~~~^~
Language: C++

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

using namespace std;
int main() {
  long long int a,b,c,tmp,ans=0;
  cin >> a >> b >> c;
  long long int d[a+1],e[b+1];
  d[0]=0,e[0]=0;
  for(int i = 1;i<a+1;i++){
    cin >> tmp;
    if((d[i-1]+tmp)<=c)d[i]=d[i-1]+tmp;
    else d[i] = c;
  }
  for(int i = 1;i<b+1;i++){
    cin >> tmp;
    if((e[i-1]+tmp)<=c)e[i]=e[i-1]+tmp;
    else e[i] = c+1;
  }
  if((d[a-1]+e[b-1])<=c) cout <<  a+b;
  else {
    for(int i = 0;i<a;i++){
    int sum = 0;
    tmp = d[i];
    if(tmp>c) break;
    for(int j=ans-i;j<b;j++){
    if((tmp+e[j])<=c){
      sum = i+j;
    }
     else break;
    }
    ans = max(ans,sum);
    }
  cout << ans;
  }
}

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

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

using namespace std;
int main() {
  long long int a,b,c,tmp,ans=0;
  cin >> a >> b >> c;
  long long int d[a+1],e[b+1];
  d[0]=0,e[0]=0;
  for(int i = 1;i<a+1;i++){
    cin >> tmp;
    if((d[i-1]+tmp)<=c)d[i]=d[i-1]+tmp;
    else d[i] = c;
  }
  for(int i = 1;i<b+1;i++){
    cin >> tmp;
    if((e[i-1]+tmp)<=c)e[i]=e[i-1]+tmp;
    else e[i] = c+1;
  }
  if((d[a-1]+e[b-1])<=c) cout <<  a+b;
  else {
    for(int i = 0;i<a;i++){
    int sum = 0
    tmp = d[i];
    if(tmp>c) break;
    for(int j=ans-i;j<b;j++){
    if((tmp+e[j])<=c){
      sum = i+j;
    }
     else break;
    }
    ans = max(ans,sum);
    }
  cout << ans;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: expected ',' or ';' before 'tmp'
   26 |     tmp = d[i];
      |     ^~~
a.cc:34:14: error: no matching function for call to 'max(long long int&, int&)'
   34 |     ans = max(ans,sum);
      |           ~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc: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:34:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |     ans = max(ans,sum);
      |           ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/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:34:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |     ans = max(ans,sum);
      |           ~~~^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){ 
  ll n,m,k;
  cin >> n>>m>>k;
  vector<ll> a(n),b(m);
  ll sum=0,ans=n;
  rep(i,n){
    cin >> a.at(i);
    sum+=a.at(i);
  }
  rep(i,m){
    cin >> b.at(i);
  }
  reverse(a.begin(),a.end());
  ll j=0;
  bool is=true;
  ll maxi=0;
  for(ll i=0;i<m;i++){
    while(sum>k){
      sum-=a.at(j);
      j++;
      ans--;
      if(j>=n){
        is=false;
        break;
      }
    }
    sum+=b.at(i);
    ans++;
    maxi=max(maxi,ans);
    if(is==false && sum>k){
      maxi--;
      break;
    }
  }
  if(sum>k&& i==m){
    maxi--;
  }
  cout << maxi;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:14: error: 'i' was not declared in this scope; did you mean 'is'?
   39 |   if(sum>k&& i==m){
      |              ^
      |              is
Language: C++

#include <iostream>
#include<vector>

long long int ans;

int main() {
	int N, M, K;
	std::cin >> N >> M >> K;
	std::vector<long long int> A(N), B(M),Asum(N),Bsum(M);

	for (int i = 0; i < N;i++){
		std::cin >> A[i];
		for (int j = i; j < N;j++){
			Asum[j] += A[i];
		}
	}

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

	int j;

	for (int i = 0; i < N;i++){
		j = M-1;
		if(Asum[i]>K){
			break;
		}
		while((Bsum[j]+Asum[i])>K){
			j--;
		}
		ans = std::max(ans, i + j+2);
	}

	std::cout << ans << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:31: error: no matching function for call to 'max(long long int&, int)'
   35 |                 ans = std::max(ans, i + j+2);
      |                       ~~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc: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:31: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   35 |                 ans = std::max(ans, i + j+2);
      |                       ~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
	
int main(){
	int n,m,k;
	cin>>n>>m>>k;
	ll a,b,sa[n+1],sb[m+1];
	sa[0]=0;
	sb[0]=0;
	rep(i,n){
		cin>>a;
		sa[i+1]=sa[i]+a;
	}
	rep(i,m){
		cin>>b;
		sb[i+1]=sb[i]+b;
	}
	int pb=0;
    ll sum=0;
	ll rest=0;
	rep(i,n+1){
		rest=k-sa[i];
		pb=upper_bound(sb,sb+m+1,rest)-sb-1;
		if(pb<0)continue;
		sum=max(sum,i+pb);
	}
	cout<<sum;
	return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n, m, k, res = 0;
	cin >> n >> m >> k
	vector<int>arr1(n), arr2(m);
	for (int& i : arr1) cin >> i;
	for (int& i : arr2) cin >> i;
	reverse(arr1.begin(),arr1.end());
	reverse(arr2.begin(),arr2.end());
	while (k > 0 && (arr1.size() || arr2.size())) {
		if (arr1.size() && arr2.size()) {
			if (arr1.back() > arr2.back()) {
				res++;
				k-= arr2.back();
				arr2.pop_back();
			} else {
				res++;
				k -= arr1.back();
				arr1.pop_back();
			}
		} else {
			if (arr1.size()) {
				res++;
				k-=arr1.back();
				arr1.pop_back();
			} else {
				res++;
				k -= arr2.back();
				arr2.pop_back();
			}
		}
	}
	cout << res;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:27: error: expected ';' before 'vector'
    5 |         cin >> n >> m >> k
      |                           ^
      |                           ;
    6 |         vector<int>arr1(n), arr2(m);
      |         ~~~~~~             
a.cc:7:23: error: 'arr1' was not declared in this scope
    7 |         for (int& i : arr1) cin >> i;
      |                       ^~~~
a.cc:8:23: error: 'arr2' was not declared in this scope
    8 |         for (int& i : arr2) cin >> i;
      |                       ^~~~
a.cc:9:17: error: 'arr1' was not declared in this scope
    9 |         reverse(arr1.begin(),arr1.end());
      |                 ^~~~
a.cc:10:17: error: 'arr2' was not declared in this scope
   10 |         reverse(arr2.begin(),arr2.end());
      |                 ^~~~
Language: Java

import java.util.*;

public class Main2 {

    public static void main(String args []) {

        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        int m = scan.nextInt();
        int k = scan.nextInt();

        int a[] = new int[n];
        int b[] = new int[m];
        long asum[] = new long[n];
        long bsum[] = new long[m];

        for (int i=0; i<n; i++) {
            a[i] = scan.nextInt();

            if (i==0) {
                asum[i] = a[i];
            } else {
                asum[i] = asum[i-1] + a[i];
            }
        }
        for (int i = 0; i<m; i++) {
            b[i] = scan.nextInt();

            if (i==0) {
                bsum[i] = b[i];
            } else {
                bsum[i] = bsum[i-1] + b[i];
            }
        }

        int sum = 0;
        int j = m-1;

        for (int i=0; i<n; i++) {

            if (a[i] > k) {
                continue;
            }

            while (b[j] > k - a[i]) {
                j--;
            }
            sum = Math.max(sum, i + j +2);
        }

        System.out.println(sum);

    }
}


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

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

#define ms(s,n) memset(s,n,sizeof(s))
#define all(a) a.begin(),a.end()
#define present(t, x) (t.find(x) != t.end())
#define sz(a) int((a).size())
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;

const int MOD = (int) 1e9+7;
const int INF = (int) 1e9+1;
inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int n,mk;

int inp(){
	cin>>n>>m>>k;
	int a[n],b[m];
	FOR(i,0,n)
		cin>>a[i];
	FOR(i,0,m)
		cin>>b[i];
	int cnt=0;
	int i=0,j=0;
	while(i<n&&j<m){
		int tmp=min(a[i],b[j]);
		if(k>=tmp){
			cnt++;
			k-=tmp;
		}
		else{
			return cnt;
		}
		if(tmp==a[i])
			i++;
		else
			j++;
	}
	while(i<n){
		if(k>=a[i]){
			k-=a[i];cnt++;
			i++;
		}
		else{
			return cnt;
		}
	}
	while(j<m){
		if(k>=b[j]){
			k-=b[j];
			cnt++;
			j++;
		}
		else{
			return cnt;
		}
	}
	return cnt;
}

int main(){
	cout<<inp()<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int inp()':
a.cc:31:17: error: 'm' was not declared in this scope; did you mean 'tm'?
   31 |         cin>>n>>m>>k;
      |                 ^
      |                 tm
a.cc:31:20: error: 'k' was not declared in this scope
   31 |         cin>>n>>m>>k;
      |                    ^
a.cc:36:22: error: 'b' was not declared in this scope
   36 |                 cin>>b[i];
      |                      ^
a.cc:40:34: error: 'b' was not declared in this scope
   40 |                 int tmp=min(a[i],b[j]);
      |                                  ^
a.cc:63:23: error: 'b' was not declared in this scope
   63 |                 if(k>=b[j]){
      |                       ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

using llong = long long int;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int MOD = 1000000007;
const static int INF = 1<<30;
const static int dx[4] = {1, 0, -1, 0};
const static int dy[4] = {0, 1, 0, -1};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    llong k;
    cin >> n >> m >> k;
    vector<llong> A(n + 1), B(m), cumB(m + 1);
    A[0] = 0;
    cumB[0] = 0;
    rep(i, n) cin >> A[i + 1];
    rep(i, m) {
        cin >> B[i];
        cumB[i + 1] = cumB[i] + B[i];
    }

    int ans1 = 0;
    llong t = 0;
    rep(i, n + 1) {
        t += A[i];
        if (t >= k) continue;
        ans = max(ans, static_cast<int>(lower_bound(all(cumB), k - t) - cumB.begin()) - 1 + i);
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:38:9: error: 'ans' was not declared in this scope; did you mean 'ans1'?
   38 |         ans = max(ans, static_cast<int>(lower_bound(all(cumB), k - t) - cumB.begin()) - 1 + i);
      |         ^~~
      |         ans1
a.cc:41:13: error: 'ans' was not declared in this scope; did you mean 'ans1'?
   41 |     cout << ans << endl;
      |             ^~~
      |             ans1
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,x,n) for (int i = x; i < n; i++)
using ll = long long int;
int main() {
    ll N,M,K;
    cin >> N >> M >> K;
    vector<ll> A(N),B(M);
    rep(i,N) cin >> A.at(i);
    rep(i,M) cin >> B.at(i);
    ll i=0,j=0,ans=0,T=0;
    while(T<K) {
        if(i<N && j<M) {
            if(A.at(i)<B.at(j)) {
                T += A.at(i);
                i++;
                if(T<=K) ans++;
            }
            else if(A.at(i)==B.at(j)) {
                if(i<N-1 && j<M-1) {
                    rep2(k,i+1,N) {
                        rep2(l,j+1,M) {
                            if(A.at(k)<B.at(l)) {
                                T += A.at(i);
                                i++;
                                if(T<=K) ans++;
                                break;
                            }
                            else if(A.at(k)==B.at(l)) continue;
                            else if(A.at(k)>B.at(l)) {
                                T += B.at(j);
                                j++;
                                if(T<=K) ans++;
                                break;
                            }
                        }
                    }
            }
            else if(A.at(i)>B.at(j)) {
                T += B.at(j);
                j++;
                if(T<=K) ans++;
            }
        }
        else if(i==N && j!=M) {
            T += B.at(j);
            j++;
            if(T<=K) ans++;
        }
        else if(i!=N && j==M) {
            T += A.at(i);
            i++;
            if(T<=K) ans++;
        }
        else if(i==N && j==M) break; 
    }
    cout << ans << endl;
    return 0;
}

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

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

//Ai分かかる本の列(1<=i<=N)とBi分かかる本の列(1<=i<=M)がある
//それぞれにおいて上(インデックスの小さいもの)から順に読める
//列を選びつつ読んでK分を超えない最大冊数を求める

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

    long long int sum=0;
    int index=N-1;

    //Aから条件の範囲内で本をとる
    for(int i=0:i<N;++i){
        sum=sum+A[i];
        if(sum>K){
            sum=sum-A[i];
            index=i-1;
            break;
        }
    }

    //Aの本を減らしてBの本をとる
    int j=0;//Bのインデクス
    //Aが全部入る場合を考慮して、Bの追加を最初に行う
    while(true){
        if(j>=M){
            break;
        }
        if(sum+B[j] > K){
            break;
        }
        sum=sum+B[j];
        ++j;
    }
    int max=index+1+j;//最大冊数
    for(int i=index;i>=0;--i){
        sum=sum-A[i];//Aの本を減らす

        //Bの本をできるだけとる
        while(true){
            if(j>=M){
                break;
            }
            if(sum+B[j] > K){
                break;
            }
            sum=sum+B[j];
            ++j;
        }

        //この時点で、Aはi-1番目まで、Bはj-1番目まで入っている(0スタート)
        if(i+j > max){
            max=i+j;
        }
    }

    cout << max << endl;
    delete[] A;
    delete[] B;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:33: error: cannot convert 'int*' to 'long long int*' in initialization
   14 |     long long int* A = new int[N];
      |                                 ^
      |                                 |
      |                                 int*
a.cc:15:33: error: cannot convert 'int*' to 'long long int*' in initialization
   15 |     long long int* B = new int[M];
      |                                 ^
      |                                 |
      |                                 int*
a.cc:27:14: error: initializer in range-based 'for' loop
   27 |     for(int i=0:i<N;++i){
      |              ^
a.cc:27:20: error: expected ')' before ';' token
   27 |     for(int i=0:i<N;++i){
      |        ~           ^
      |                    )
a.cc:27:23: error: 'i' was not declared in this scope
   27 |     for(int i=0:i<N;++i){
      |                       ^
Language: C++

#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
int n, m, k;
long long int A[N], B[N], cs[N], sum; 
int main(){
    cin >> n >> m >> k;
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }
    for(int i = 0; i < m; i++){
        cin >> B[i];
        cs[i + 1] = cs[i] + B[i];
    }
    int answer = upper_bound(cs, cs + m + 1, k) - cs - 1;
    for(int i = 0; i < n; i++){
        sum += A[i];
        if(sum > k)break;
        int value = upper_bound(cs, cs + m + 1, k - sum) - cs - 1;
        answer = max(answer, (i + 1) + value);
    }
    cout << answer << endl;
    return 0;
}

Compiler output:
a.cc:12:17: error: 'N' was not declared in this scope
   12 | long long int A[N], B[N], cs[N], sum;
      |                 ^
a.cc:12:23: error: 'N' was not declared in this scope
   12 | long long int A[N], B[N], cs[N], sum;
      |                       ^
a.cc:12:30: error: 'N' was not declared in this scope
   12 | long long int A[N], B[N], cs[N], sum;
      |                              ^
a.cc: In function 'int main()':
a.cc:16:16: error: 'A' was not declared in this scope
   16 |         cin >> A[i];
      |                ^
a.cc:19:16: error: 'B' was not declared in this scope
   19 |         cin >> B[i];
      |                ^
a.cc:20:9: error: 'cs' was not declared in this scope; did you mean 'cos'?
   20 |         cs[i + 1] = cs[i] + B[i];
      |         ^~
      |         cos
a.cc:22:30: error: 'cs' was not declared in this scope; did you mean 'cos'?
   22 |     int answer = upper_bound(cs, cs + m + 1, k) - cs - 1;
      |                              ^~
      |                              cos
a.cc:24:16: error: 'A' was not declared in this scope
   24 |         sum += A[i];
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N = 3e5 + 1;
int n, m, k;
long long int A[N], B[N], cs[N], sum; 
int main(){
    cin >> n >> m >> k;
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }
    for(int i = 0; i < m; i++){
        cin >> B[i];
        cs[i + 1] = cs[i] + B[i];
    }
    long long int answer = upper_bound(cs, cs + m + 1, k) - cs - 1;
    for(int i = 0; i < n; i++){
        sum += A[i];
        answer = max(answer, (i + 1) + upper_bound(cs, cs + m + 1, k - sum) - cs - 1);
    }
    cout << answer << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: no matching function for call to 'max(long long int&, long int)'
   18 |         answer = max(answer, (i + 1) + upper_bound(cs, cs + m + 1, k - sum) - cs - 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:18:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
   18 |         answer = max(answer, (i + 1) + upper_bound(cs, cs + m + 1, k - sum) - cs - 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:18:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |         answer = max(answer, (i + 1) + upper_bound(cs, cs + m + 1, k - sum) - cs - 1);
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~