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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:22:28: error: 'K' was not declared in this scope
   22 |         while(j > 0 && t > K){
      |                            ^
a.cc:26:14: error: 'K' was not declared in this scope
   26 |         if(t>K){
      |              ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int nibun(int x, int y){
    return x <= y;
}
int main() {
  int N, M, amount, ok, ng, mid;
  unsigned long int K, time;
  cin >> N >> M >> K;
  int n = N;
  int m = M;
  vector<int> a(N);
  vector<int> b(M);
  vector<int> c;
  time = o = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    time += a[i];
    a[i] = time;
  }
  c.push_back(n);
  time = 0;
  for (int i = 0; i < M; i++) {
    cin >> b[i];
    time += b[i];
    b[i] = time;
  }
  c.push_back(m);
  time = 0;
  for (int i = 0; i < n; i++) {
    time = K - a[i];
    amount = i + 1;
    ok = -1;
    ng = m;
    while (ng - ok > 1) {
      mid = ok + ng;
      if(nibun(b[mid],time)){
          ok = mid;
      }else{
          ng = mid;
      }
    }
    amount += ok+1;
    c.push_back(amount);
  }
  int max = 0;
  for (int i = 0; i < (int)c.size(); i++) {
    if (max <= c[i]) {
      max = c[i];
    }
  }
  cout << max << endl;
  return 0;
}


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

#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int N,M,K;
    std::cin >> N;
    std::cin >> M;
    std::cin >> K;
    int cnt= 0;
    int bookite= 0;
    int bookcnt　=0;
    int Nsum =0;
    
    //cout <<N<<M<<K;
    
    vector<int> vecN(N, 0),vecM(M, 0);
    for(int i =0;i<N;i++){
        cin >>vecN[i];
    }
    for(int i =0;i<M;i++){
        cin >>vecM[i];
    }
    
    //Nの方が小さい
    if(M<N){
        int tmp;
        tmp =N;
        N = M;
        M = tmp;
    }
    for(int i =0;i<N;i++){
        Nsum += vecN[i] + vecM[i];
    }
    if(K<Nsum){
        while(K>cnt){
            cnt += vecN[bookite];
            cnt += vecM[bookite];
            bookite++;
        }
        //cout <<cnt<<" ";
        
        //cout << bookite<< " ";
        if(K >= cnt - vecM[bookite-1]){
            bookcnt = (bookite-1)*2 +1;
        }else if(K >= cnt -vecN[bookite-1]- vecM[bookite-1]){
            bookcnt = (bookite-1)*2;
        }
    }else{
        cnt = Nsum;
        bookite = N;
        if(vecN.size() < vecM.size()){
            while(K>cnt){
                cnt += vecM[bookite];
                bookite++;
            }
        }else{
            while(K>cnt){
                cnt += vecN[bookite];
                bookite++;
            }
        }
        bookcnt =2*N + bookite - N -1;
    }
    //cout << N << " "<<bookite<<endl;
    cout << bookcnt;
    

    
    // cout <<cnt<<" ";
    // for(int i =0;i<N;i++){
    //     cout << vecN[i]<<" ";
    // }
    // for(int i =0;i<M;i++){
    //     cout << vecM[i]<<" ";
    // }
    
    //cout <<N <<" "<<M<<" "<<K;
    
    
}

Compiler output:
a.cc:12:9: error: extended character 　 is not valid in an identifier
   12 |     int bookcnt　=0;
      |         ^
a.cc: In function 'int main()':
a.cc:45:13: error: 'bookcnt' was not declared in this scope; did you mean 'bookcnt　'?
   45 |             bookcnt = (bookite-1)*2 +1;
      |             ^~~~~~~
      |             bookcnt　
a.cc:47:13: error: 'bookcnt' was not declared in this scope; did you mean 'bookcnt　'?
   47 |             bookcnt = (bookite-1)*2;
      |             ^~~~~~~
      |             bookcnt　
a.cc:63:9: error: 'bookcnt' was not declared in this scope; did you mean 'bookcnt　'?
   63 |         bookcnt =2*N + bookite - N -1;
      |         ^~~~~~~
      |         bookcnt　
a.cc:66:13: error: 'bookcnt' was not declared in this scope; did you mean 'bookcnt　'?
   66 |     cout << bookcnt;
      |             ^~~~~~~
      |             bookcnt
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main() {
    long long int n, m, k, count = 0, c = 0;
    cin >> n >> m >> k;
    vector<int> a(n);
    vector<int> b(m);
    for (long long int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (long long int i = 0; i < m; i++) {
        cin >> b[i];
    }
    long long int i = 0, j = 0;
    while (i!=n||j!=m) {
        if (i == n) {
            if (b[j] + c > k) {
                break;
            }
            else {
                count++;
                c += b[j];
                j++;
            }
        }
        else if (j == m) {
            if (a[i] + c > k) {
                break;
            }
            else {
                count++;
                c += a[i];
                i++;
            }
        }
        else if ((c + a[i]) > k && (c + b[j]) > k) {
            break;
        }
        else if (a[i] < b[j]) {
            c += a[i];
            i++;
            count++;
        }
        else {
            c += b[j];
            j++;
            count++;
        }
    }
    cout << count << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:51:27: error: expected '}' at end of input
   51 |     cout << count << endl;
      |                           ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<algorithm>
#include <bits/stdc++.h>

using namespace std;

int main(){
    int n, m;
  	ll k;
    cin >> n >> m >> k;
    ll abook, abook_time[n+1]={0};
    ll bbook, bbook_time[m+1]={0};

    for(int i=0; i<n; i++){
        cin >> abook;
        abook_time[i+1] = abook_time[i]+abook;
    }

    for(int i=0; i<m; i++){
        cin >> bbook;
        bbook_time[i+1] = bbook_time[i]+bbook;
    }

    int j=m, total=0;
    for(int i=1; i<n+1; i++){
                        if(abook_time[i] > k) break;

                        while(bbook_time[j] > k-abook_time[i]) j--;

                        total = max(total, i+j);
    }

    cout << total << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'll' was not declared in this scope
    9 |         ll k;
      |         ^~
a.cc:10:22: error: 'k' was not declared in this scope
   10 |     cin >> n >> m >> k;
      |                      ^
a.cc:11:7: error: expected ';' before 'abook'
   11 |     ll abook, abook_time[n+1]={0};
      |       ^~~~~~
      |       ;
a.cc:12:7: error: expected ';' before 'bbook'
   12 |     ll bbook, bbook_time[m+1]={0};
      |       ^~~~~~
      |       ;
a.cc:15:16: error: 'abook' was not declared in this scope
   15 |         cin >> abook;
      |                ^~~~~
a.cc:16:9: error: 'abook_time' was not declared in this scope
   16 |         abook_time[i+1] = abook_time[i]+abook;
      |         ^~~~~~~~~~
a.cc:20:16: error: 'bbook' was not declared in this scope
   20 |         cin >> bbook;
      |                ^~~~~
a.cc:21:9: error: 'bbook_time' was not declared in this scope
   21 |         bbook_time[i+1] = bbook_time[i]+bbook;
      |         ^~~~~~~~~~
a.cc:26:28: error: 'abook_time' was not declared in this scope
   26 |                         if(abook_time[i] > k) break;
      |                            ^~~~~~~~~~
a.cc:28:31: error: 'bbook_time' was not declared in this scope
   28 |                         while(bbook_time[j] > k-abook_time[i]) j--;
      |                               ^~~~~~~~~~
a.cc:28:49: error: 'abook_time' was not declared in this scope
   28 |                         while(bbook_time[j] > k-abook_time[i]) j--;
      |                                                 ^~~~~~~~~~
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int n, m;
  	ll k;
    cin >> n >> m >> k;
    ll abook, abook_time[n+1]={0};
    ll bbook, bbook_time[m+1]={0};

    for(int i=0; i<n; i++){
        cin >> abook;
        abook_time[i+1] = abook_time[i]+abook;
    }

    for(int i=0; i<m; i++){
        cin >> bbook;
        bbook_time[i+1] = bbook_time[i]+bbook;
    }

    int j=m, total=0;
    for(int i=1; i<n+1; i++){
                        if(abook_time[i] > k) break;

                        while(bbook_time[j] > k-abook_time[i]) j--;

                        total = max(total, i+j);
    }

    cout << total << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'll' was not declared in this scope
    8 |         ll k;
      |         ^~
a.cc:9:22: error: 'k' was not declared in this scope
    9 |     cin >> n >> m >> k;
      |                      ^
a.cc:10:7: error: expected ';' before 'abook'
   10 |     ll abook, abook_time[n+1]={0};
      |       ^~~~~~
      |       ;
a.cc:11:7: error: expected ';' before 'bbook'
   11 |     ll bbook, bbook_time[m+1]={0};
      |       ^~~~~~
      |       ;
a.cc:14:16: error: 'abook' was not declared in this scope
   14 |         cin >> abook;
      |                ^~~~~
a.cc:15:9: error: 'abook_time' was not declared in this scope
   15 |         abook_time[i+1] = abook_time[i]+abook;
      |         ^~~~~~~~~~
a.cc:19:16: error: 'bbook' was not declared in this scope
   19 |         cin >> bbook;
      |                ^~~~~
a.cc:20:9: error: 'bbook_time' was not declared in this scope
   20 |         bbook_time[i+1] = bbook_time[i]+bbook;
      |         ^~~~~~~~~~
a.cc:25:28: error: 'abook_time' was not declared in this scope
   25 |                         if(abook_time[i] > k) break;
      |                            ^~~~~~~~~~
a.cc:27:31: error: 'bbook_time' was not declared in this scope
   27 |                         while(bbook_time[j] > k-abook_time[i]) j--;
      |                               ^~~~~~~~~~
a.cc:27:49: error: 'abook_time' was not declared in this scope
   27 |                         while(bbook_time[j] > k-abook_time[i]) j--;
      |                                                 ^~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){
  int N, M, amount, ov;
  unsigned long int K, time;
  cin >> N >> M >> K;
  vector<int> a(N);
  vector<int> b(M);
  vector<int> c;
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  for(int j=0;j<M;j++){
    cin >> b[j];
  }
  t = s = 0;
  for(int i=0;i<N+1;i++){
    for(int j=0;j<M+1;j++){
      amount = 0;
      time = 0;
      ov = -1;
      for(int k=0;k<i;k++){
          amount++;
          time += a[k];
          if(K < time){
            ov = 1;
            break;
          }
      }
      if(ov == -1){
        for(int l=0;l<j;l++){
          amount++;
          time += b[l];
          if(K < time){
            break;
          }
        }
      }
      if(time <= K){
        c.push_back(amount);
      }
    }
  }
  int max = 0;
  for(int i=0;i<(int)c.size();i++){
    if(max <= c[i]){
      max = c[i];
    }
  }
  cout << max << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 't' was not declared in this scope
   17 |   t = s = 0;
      |   ^
a.cc:17:7: error: 's' was not declared in this scope
   17 |   t = s = 0;
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n,m,k;

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

    while(b[j]<k)++j;
    ans=max(ans,j);
    for(int i=0;i<n;++i)
    {
        while(b[j]>k-a[j])--j;
        ans=max(ans,i+j);
    }
    cout<<ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:11: error: 'j' was not declared in this scope
   19 |         b[j]+=b[j-1];
      |           ^
Language: C++

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

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

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

#include <iostream>

using namespace std;

int max_books(int n, int m, int k, int *A, int *B)
{
    if ((n == 0) || (k < A[n-1]))
        if ((m == 0) || (k < B[m-1]))
            return 0;
        else  
            return 1 + max_books(n, m-1, k - B[m-1], A, B);
    else if ((m == 0) || (k < B[m]))
        return 1 + max_books(n-1, m, k -A[n-1], A, B);
    else
        return 1 + max(max_books(n-1, m, k -A[n-1], A, B), max_books(n, m, k - B[m-1], A, B));
}

int main()
{
    long int n, m, k;
    long int A[n], B[m];
    cin >> n >> m >> k;
    for(int i = 0; i < n; i++)
        cin >> A[i];
    for(int j = 0; j < m; j++)
        cin >> B[j];
    cout << max_books(n, m, k, A, B);

}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:32: error: cannot convert 'long int*' to 'int*'
   35 |     cout << max_books(n, m, k, A, B);
      |                                ^
      |                                |
      |                                long int*
a.cc:13:41: note:   initializing argument 4 of 'int max_books(int, int, int, int*, int*)'
   13 | int max_books(int n, int m, int k, int *A, int *B)
      |                                    ~~~~~^
Language: C++

include<iostream>

using namespace std;

int main(){
    long int n, m, k;
    cin >> n >> m >> k;
    long int abook, abook_time[n+1]={0};
    long int bbook, bbook_time[m+1]={0};

    for(int i=0; i<n; i++){
        cin >> abook;
        abook_time[i+1] = abook_time[i]+abook;
    }

    for(int i=0; i<m; i++){
        cin >> bbook;
        bbook_time[i+1] = bbook_time[i]+bbook;
    }
    
    cout << k << endl;
    long int acnt=0, bcnt=0, total=-1;
    for(int i=1; i<n+1; i++){
        for(int j=1; j<m+1; j++){
            if(bbook_time[j] > k-abook_time[i] && (k-abook_time[i]) >= 0){
                acnt = i;
                bcnt=j-1;
            }
        }
        total = max(total, acnt+bcnt);
    cout << "total:" << total << endl;
    cout << "acnt+bcnt:" << acnt+bcnt << endl;
    bcnt = 0;
    }

    cout << total << endl;

    return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin >> n >> m >> k;
      |     ^~~
a.cc:21:5: error: 'cout' was not declared in this scope
   21 |     cout << k << endl;
      |     ^~~~
a.cc:21:18: error: 'endl' was not declared in this scope
   21 |     cout << k << endl;
      |                  ^~~~
a.cc:30:17: error: 'max' was not declared in this scope
   30 |         total = max(total, acnt+bcnt);
      |                 ^~~
Language: C++

// g++ -std=c++17 -Wall --pedantic-errors -o train14 train14.cpp
#include <iostream>
#include <algorithm>
#include <vector>


int main()
{
    long long  n,m,k; std::cin >> n >> m >> k;
    // long long  a[n+1], b[m+1];
    std::vector<long long>  a{n+1}, b{m+1};
    a[0]=0; b[0]=0;
    for (int i=1;i<n+1;i++)
        std::cin >> a[i];
    for (int i=1; i<m+1; i++)
        std::cin >> b[i];
    
    for (int i=1; i<n+1; i++)
        a[i]+=a[i-1];
    for (int i=1; i<m+1; i++)
        b[i]+=b[i-1];

    long long ns=0, r=m;
    for (int i=0; i<n+1; i++)
    {
        if(a[i]>k) break;
        while (a[i]+b[r]>k)
            r--;
        ans = std::max({ans, i+r});
    }
    
    std::cout << ans;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'ans' was not declared in this scope; did you mean 'ns'?
   29 |         ans = std::max({ans, i+r});
      |         ^~~
      |         ns
a.cc:29:23: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   29 |         ans = std::max({ans, i+r});
      |               ~~~~~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/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, 1 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:   template argument deduction/substitution failed:
/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:   candidate expects 2 arguments, 1 provided
a.cc:32:18: error: 'ans' was not declared in this scope; did you mean 'ns'?
   32 |     std::cout << ans;
      |                  ^~~
      |                  ns
Language: C++

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

int main(){
  long long int N,M,K,i,j,ans=0;
  cin >> N >> M >> K;
  long long int A[N],B[M],cnt=0;
  
  for(i=0;i<N;i++){
    cin >> A[i];
  }
  for(j=0;j<M;j++){
    cin >> B[j];
  }
  
  sort(A,A+N);
  sort(B,B+M);
  i=0;
  j=0;
  
  while(ans<=K){
    if(i=N||j!=M){
      ans=ans+B[j];
      j++;
    }
    else if(i!=N||j=M){
      ans=ans+A[i];
      i++;
    }
    else if(A[i]<B[j]){
      ans=ans+A[i];
      i++;
    }
    else if(A[i]>=B[j]){
      ans=ans+B[j];
      j++;
    }
    else{
      break;
    }
    cnt++;
  }
  
  cout << cnt-1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:17: error: lvalue required as left operand of assignment
   27 |     else if(i!=N||j=M){
      |             ~~~~^~~
Language: C++

#include<iostream>
using namespace std;

int main(){
  int N, M, K;
  cin >> N >> M >> K;
  
  int A[N], B[M];
  for(int i = 0; i < N; i++) cin >> A[i];
  for(int j = 0; j < M; j++) cin >> B[i];
  
  int sum = 0;
  for(int i = 0; i < N){
    for(int j = 0l j < M){
      if(sum > K){
        break;
      }
      if(A[i] > B[j]){
        sum++;
        A.erase(A.begin());
      }
      else{
        sum++;
        B.erase(B.begin());
      }
    }
  }
  
  cout << sum << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:39: error: 'i' was not declared in this scope
   10 |   for(int j = 0; j < M; j++) cin >> B[i];
      |                                       ^
a.cc:13:23: error: expected ';' before ')' token
   13 |   for(int i = 0; i < N){
      |                       ^
      |                       ;
a.cc:14:19: error: expected ';' before 'j'
   14 |     for(int j = 0l j < M){
      |                   ^~
      |                   ;
a.cc:14:25: error: expected ';' before ')' token
   14 |     for(int j = 0l j < M){
      |                         ^
      |                         ;
a.cc:20:11: error: request for member 'erase' in 'A', which is of non-class type 'int [N]'
   20 |         A.erase(A.begin());
      |           ^~~~~
a.cc:20:19: error: request for member 'begin' in 'A', which is of non-class type 'int [N]'
   20 |         A.erase(A.begin());
      |                   ^~~~~
a.cc:24:11: error: request for member 'erase' in 'B', which is of non-class type 'int [M]'
   24 |         B.erase(B.begin());
      |           ^~~~~
a.cc:24:19: error: request for member 'begin' in 'B', which is of non-class type 'int [M]'
   24 |         B.erase(B.begin());
      |                   ^~~~~
Language: C

#include<bits/stdc++.h>
#define int long long
#define ios ios_base::sync_with_stdio(0); cin.tie(0);
//#define M 32
using namespace std;
//const int N = 1e5+7;
//const int MOD = 1e9+7;
//char a[7][7];
void solve() {
    int n,m,k;
    cin>>n>>m>>k;
    vector <int> a;
    for(int i=0; i<n+m; i++) {
        int x;
        cin>>x;
        a.push_back(x);
    }
    sort(a.begin(),a.end());
    int curr_time=0,ans=0;
    for(int i=0; i<n+m; i++) {
        if(curr_time+a[i]<=k) {
            ans++;
            curr_time+=a[i];
        }
    }
    cout<<ans<<"\n";
}
int32_t main() {
    ios
    //int t;
    //cin>>t;
    solve();
    return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;

const int N=200010;
int a[N],b[N];
int n,m,k,ans=0;

int main(){
    int tmp;
    int idx1=n,idx2=m;
    scanf("%d%d%d",&n,&m,&k);
    for(int i=1;i<=n;i++) {
        scanf("%d",&a[i]);
        a[i]+=a[i-1];
    }
    for(int j=1;j<=m;j++){
        scanf("%d",&b[j]);
        b[j]+=b[j-1];
    }

    for(int i=0,j=0;i<=n||j<=m;){
        if(a[i+1]+b[j]<=k&&a[i]+b[j+1]<=k){
            if(a[i+1]<=b[j+1]&&i+1<=n) i++;
            else if(j+1<=m) j++;
            else break;
            ans=max(i+j,ans);
        }
        else if(a[i+1]+b[j]<=k&&i+1<=n) i++,ans=max(i+j,ans);
        else if(a[i]+b[j+1]<=k&&j+1<=m) j++,ans=max(i+j,ans);
        else break;
    }a

    printf("%d",ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:7: error: expected ';' before 'printf'
   37 |     }a
      |       ^
      |       ;
   38 | 
   39 |     printf("%d",ans);
      |     ~~~~~~
Language: C++

# include <bits/stdc++.h>
# define rep(i, n) for(ll i = 0; i < (n); ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define ll long long
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define P pair<int, int>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll lmax(ll a, ll b){if(a>= b) return a;return b;}
ll lmin(ll a, ll b){if(a>= b) return b;return a;}
static const ll INF = 1e18;

int main() {
  int n, m; cin >> n >> m;
  ll k; cin >> k;
  vector<ll> a(n+1, 0), b(m+1);
  rep(i, n) {
    ll x; cin >> x;
    a[i+1] = a[i] + x;
  }
  rep(j, m) {
    ll x; cin >> x;
    b[i+1] = b[i] + x;
  }

  ll best = m, ans = 0;
  rep(i, n+1) {
    if(k < a[i]) break;
    while(a[i] + b[best] > k){
      --best;
    }
    chmax(ans, i + best);
  }

  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:7: error: 'i' was not declared in this scope
   29 |     b[i+1] = b[i] + x;
      |       ^
Language: C++

# include <bits/stdc++.h>
# define rep(i, n) for(ll i = 0; i < (n); ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define ll long long
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define P pair<int, int>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll lmax(ll a, ll b){if(a>= b) return a;return b;}
ll lmin(ll a, ll b){if(a>= b) return b;return a;}
static const ll INF = 1e18;

int main() {
  int n, m; cin >> n >> m;
  ll k; cin >> k;
  vector<ll> a(n+1, 0), b(m+1);
  rep(i, n) {
    ll x; cin >> x;
    a[i+1] = a[i] + x;
  }
  rep(j, m) {
    ll x; cin >> x;
    b[i+1] = b[i] + x;
  }

  ll best = m, ans = 0;
  rep(i, n+1) {
    if(k < a[i]) break;
    while(a[i] + b[j] > k){
      --m;
    }
    chmax(ans, i + j);
  }

  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:7: error: 'i' was not declared in this scope
   29 |     b[i+1] = b[i] + x;
      |       ^
a.cc:35:20: error: 'j' was not declared in this scope
   35 |     while(a[i] + b[j] > k){
      |                    ^
a.cc:38:20: error: 'j' was not declared in this scope
   38 |     chmax(ans, i + j);
      |                    ^
Language: C++

#include <iostream>
using namespace std;
char A[200005],B[200005];
int main() {
	int M,N,K,i,j,c=0,ans=0;
	cin>>M,N,K;
	for(i=0;i<=M;i++)cin>>A[i];
	for(j=0;j<=N;j++)cin>>B[j];
	for( ; ; ){
		if(c>K)break;
		if(A[i]>B[j])c+=B[j];
		else c+=A[i];
		ans++;
	}
	cout<<ans	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: expected ';' before 'return'
   15 |         cout<<ans
      |                  ^      
      |                        ;
   16 |         return 0;
      |         ~~~~~~
Language: C++

def strToList(str,offset=0):
    res = [];
    for el in str.split(" "):
        if el!='':
            res.append(int(el)+offset)
    return res


[N,M,K] = strToList(input())
A = strToList(input())
B = strToList(input())

current_time = 0
current_value = 0
iA = 0
iB = 0

while iA<N:
    if current_time+A[iA]<=K:
        current_time+=A[iA]
        current_value+=1
        iA+=1
    else:
        break

max_value = current_value
iA-=1

while iA>=0 and iB<M:
    if current_time+B[iB]<=K:
        current_time+=B[iB]
        iB+=1
        current_value+=1
        if current_value>max_value:
            max_value=current_value
    else:
        current_time-=A[iA]
        iA-=1
        current_value-=1

print(max_value)


Compiler output:
a.cc:4:16: error: empty character constant
    4 |         if el!='':
      |                ^~
a.cc:1:1: error: 'def' does not name a type
    1 | def strToList(str,offset=0):
      | ^~~
a.cc:3:5: error: expected unqualified-id before 'for'
    3 |     for el in str.split(" "):
      |     ^~~
Language: C++

#pragma GCC optimize("O3")
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>ll(b);i--)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
#define INF 1000000000000 
#define MOD 1000000007 
#define MAXR 100000 
#define PB push_back 
#define MP make_pair 
#define F first 
#define S second 
#define Umap unordered_map
#define Uset unordered_set


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll N, M, K;
    cin >> N >> M >> K;
    vector<ll> A(N);
    vector<ll> B(M);
    REP(i, N) cin >> A[i];
    REP(i, M) cin >> B[i];

    vector<ll> accum_A(N+1);
    accum_A.at(0) = 0;
    vector<ll> accum_B(M+1);
    accum_B.at(0) = 0;
    FOR(i, 1, N+1) accum_A.at(i) = accum_A.at(i-1) + A.at(i-1);
    FOR(i, 1, M+1) accum_B.at(i) = accum_B.at(i-1) + B.at(i-1);

    // Aの最大回数
    ll max_a = 0;
    FOR(i, 1, N) {
        if (accum_A.at(i) > K) {
            max_a = i;
            break;
    } 

    ll max_sassu = 0;
    FOR(i_n, 0, max_a) {
        ll time_sum = accum_A.at(i_n);
        if (time_sum > K) {
            break;
        }
        ll sassu = i_n;

        FOR(i_m, 1, M+1) {
            ll ts = time_sum + accum_B.at(i_m);
            if (ts > K) {
                sassu += i_m-1;
                if (max_sassu < sassu) max_sassu = sassu;
                break;
            } 
            else if (i_m==M) {
                sassu += M;
                if (max_sassu < sassu) max_sassu = sassu;
                break;
            }
        }
    }

    cout << max_sassu << endl;

    return 0;
}

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

#pragma GCC optimize("O3")
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>ll(b);i--)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
#define INF 1000000000000 
#define MOD 1000000007 
#define MAXR 100000 
#define PB push_back 
#define MP make_pair 
#define F first 
#define S second 
#define Umap unordered_map
#define Uset unordered_set


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll N, M, K;
    cin >> N >> M >> K;
    vector<ll> A(N);
    vector<ll> B(M);
    REP(i, N) cin >> A[i];
    REP(i, M) cin >> B[i];

    ll max_sassu = 0;
    FOR(i_n, 0, N+1) {
        ll time_sum = 0;
        ll sassu = 0;
        REP(j, i_n) {
            time_sum += A.at(j);
            if (time_sum > K) {
                if (max_sassu < sassu) max_sassu = sassu;
                goto FLAG;
            }
            sassu++;
        }
        
        REP(i_m, M) {
            time_sum += B.at(i_m);
            if (time_sum > K) {
                if (max_sassu < sassu) max_sassu = sassu;
                break;
            }
            sassu++;
        }
    }

    if (max_sassu==0) mas_sassu = N+M;

    FLAG:
    cout << max_sassu << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:23: error: 'mas_sassu' was not declared in this scope; did you mean 'max_sassu'?
   58 |     if (max_sassu==0) mas_sassu = N+M;
      |                       ^~~~~~~~~
      |                       max_sassu
Language: C++

int main()
{
	//変数の宣言
	int ABooks, BBooks, timeLimit;
	int* ABooksTime, * BBooksTime;
	//int ABooksTime[200000] = { 0 }, BBooksTime[200000] = { 0 };
	int maxBooks = 0, maxABooks = 0, bookNum = 0, maxBooksTemp = 0, time = 0;
	int input, k = 1;

	ABooksTime = (int*)malloc(200000);
	BBooksTime = (int*)malloc(200000);

	//入力の格納
	cin >> ABooks >> BBooks >> timeLimit;
	/*while (cin >> input && k <= ABooks) {
		ABooksTime[k - 1] = input;
		k++;
	}
	k = 1;
	while (cin >> input && k <= BBooks) {
		BBooksTime[k - 1] = input;
		k++;
	}*/

	for (int i = 1; i <= ABooks; i++) {
		
		cin >> ABooksTime[i - 1];
		cout << ABooksTime[i - 1];
	}
	for (int i = 1; i <= BBooks; i++) {
		cin >> BBooksTime[i - 1];
		cout << BBooksTime[i - 1];
	}


	//Aから読んでく時の最大冊数
	bookNum = 0;
	while (time + ABooksTime[bookNum] <= timeLimit) {
		maxBooksTemp++;
		time += ABooksTime[bookNum];
		bookNum++;
	}
	maxABooks = maxBooks; //Aを優先して読んだ時のAの冊数
	bookNum = 0;
	while (time + BBooksTime[bookNum] <= timeLimit) {
		maxBooksTemp++;
		time += BBooksTime[bookNum];
		bookNum++;
	}
	maxBooks = maxBooksTemp; //暫定1位とする

	//読んでいいAの冊数を1冊ずつ制限していく
	for (int i = 1; i <= maxABooks; i++) { //i冊制限
		time = 0;
		bookNum = 0;
		maxBooksTemp = maxABooks - i;
		for (int j = 1; j <= maxABooks - i; j++) {
			time += ABooksTime[j - 1];
		}
		while (time + BBooksTime[bookNum] <= timeLimit) {
			maxBooksTemp++;
			time += BBooksTime[bookNum];
			bookNum++;
		}
		if (maxBooksTemp > maxBooks) {
			maxBooks = maxBooksTemp;
		}
	}

	cout << maxBooks;

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:28: error: 'malloc' was not declared in this scope
   10 |         ABooksTime = (int*)malloc(200000);
      |                            ^~~~~~
a.cc:1:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
  +++ |+#include <cstdlib>
    1 | int main()
a.cc:14:9: error: 'cin' was not declared in this scope
   14 |         cin >> ABooks >> BBooks >> timeLimit;
      |         ^~~
a.cc:28:17: error: 'cout' was not declared in this scope
   28 |                 cout << ABooksTime[i - 1];
      |                 ^~~~
a.cc:32:17: error: 'cout' was not declared in this scope
   32 |                 cout << BBooksTime[i - 1];
      |                 ^~~~
a.cc:70:9: error: 'cout' was not declared in this scope
   70 |         cout << maxBooks;
      |         ^~~~
Language: C++

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

using ll = long long;
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:24:29: error: expected ';' before ')' token
   24 |   for (i = 0, i < n + 1; i++) {
      |                             ^
      |                             ;
Language: C++

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

int binary_search(vector<int> &list) {
  
}

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[i];
  for (int i=0; i<M; i++) cin >> B[i];
  vector<ll> cumSumA(N+1);
  vector<ll> cumSumB(M+1);
  for (int i=1; i<N+1; i++) cumSumA[i] = cumSumA[i-1] + A[i-1];
  for (int i=1; i<M+1; i++) cumSumB[i] = cumSumB[i-1] + B[i-1];
  int n, m = 0;
  binary_search();
}


Compiler output:
a.cc: In function 'int binary_search(std::__debug::vector<int>&)':
a.cc:9:1: warning: no return statement in function returning non-void [-Wreturn-type]
    9 | }
      | ^
a.cc: In function 'int main()':
a.cc:23:16: error: no matching function for call to 'binary_search()'
   23 |   binary_search();
      |   ~~~~~~~~~~~~~^~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)'
 2194 |     binary_search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2194:5: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)'
 2228 |     binary_search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2228:5: note:   candidate expects 4 arguments, 0 provided
a.cc:7:5: note: candidate: 'int binary_search(std::__debug::vector<int>&)'
    7 | int binary_search(vector<int> &list) {
      |     ^~~~~~~~~~~~~
a.cc:7:5: note:   candidate expects 1 argument, 0 provided
Language: C++

#include <stdio.h>		// standard input output
#include <iostream>		// input output stream, cin cout( console in console out)
#include <cmath>		// circle math ( sin, con, sinh
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>		// input output manipulation

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep3(i, a, n) for(int i = (int)(a); i < (int)(n); i++)
#define ll long long

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }






int main() {
  ll N,M,K; // 変数の宣言
  cin >> N >> M >> K; // 標準入力
  ll A[N],B[M];
  rep(i,N) cin >> A[i];
  rep(i,M) cin >> B[i];
  ll a[N];
  ll b[M];
  a[0]=A[0];
  b[0]=B[0];
  rep3(i,1,N)
    a[i]=a[i-1] + A[i];
  rep3(i,1,M)
    b[i]=b[i-1] + B[i];

  ll ans =0;

  ll j=0;
  rep(i,N){
    if(a[i]>K) break;
    while(a[i] + b[j]>K){
      j++;
      ans = max(ans,i+j+2);
    }

    
     
	
  }



Compiler output:
a.cc: In function 'int main()':
a.cc:50:4: error: expected '}' at end of input
   50 |   }
      |    ^
a.cc:22:12: note: to match this '{'
   22 | int main() {
      |            ^
Language: Java


import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    long[] sa = new long[n + 1];
    long[] sb = new long[m + 1];
    for(int i = 1; i <= n; i++) {
      sa[i] = sa[i - 1] + sc.nextLong(); 
    }
    for(int i = 1; i <= m; i++) {
      sb[i] = sb[i - 1] + sc.nextLong();
    }
    int ans = 0;
    for(int i = 0; i <= n; i++) {
      if(sa[i] <= k) {
        long t = k - sa[i];
        int left = 0;
        int right = m;
        int a = 0;
        while(left < right) {
          int med = (left + right) / 2;
          if(sb[med] <= t) {
            a = med;
            left = med + 1;
          } else {
            right = med;
          }
        }
        ans = Math.max(ans, i + a);
      }
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:19: error: cannot find symbol
      if(sa[i] <= k) {
                  ^
  symbol:   variable k
  location: class Main
Main.java:20: error: cannot find symbol
        long t = k - sa[i];
                 ^
  symbol:   variable k
  location: class Main
2 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,k,c=0,d=0,i=0,j=0,e=0;
  cin>>n>>m>>k;
  int a[n],b[m],sum[n],sub[m];
  sum[0]=0,sub[0]=0;
  while(cin>>a[i]){
    sum[i+1]=sum[i]+a[i];
    c++;
    if(sum[i]<k)
      continue;
    else
      break;
i++;  }while(cin>>b[j]){
    sub[j+1]=sub[j]+b[j];
    d++;
    if(sub[i]<k)
      continue;
    else
      break;
  j++;}for(i=0;i<max(m,n);i++){
    ans[i]=sum[i+1]+sub[i+1];
    e++;
    if(ans[i]<k)
      continue;
    else
      break;
  }cout<<max(c,max(d,e));
  return 0;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |     ans[i]=sum[i+1]+sub[i+1];
      |     ^~~
      |     abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,k,sum=0,c=0;
    cin>>n>>m>>k;
  int a[n],b[m];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }for(int j=0;j<m;j++){
    cin>>b[i];
  }for(int i=0;i<m+n;i++){
    sum=sum+min(a[i],b[i]);
    c++;
    if(sum>=k)
      break;
    else
      sum=sum+max(a[i],b[i]);
    c++;
  }cout<<c;
  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n.m,k,sum=0,c=0;
    cin>>n>>m>>k;
  int a[n],b[m];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }for(int j=0;j<m;j++){
    cin>>b[i];
  }for(int i=0;i<m+n;i++){
    sum=sum+min(a[i],b[i]);
    c++;
    if(sum>=k)
      break;
    else
      sum=sum+max(a[i],b[i]);
    c++;
  }cout<<c;
  return 0;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:4:8: error: expected initializer before '.' token
    4 |   int n.m,k,sum=0,c=0;
      |        ^
a.cc:5:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |     cin>>n>>m>>k;
      |          ^
      |          yn
a.cc:5:13: error: 'm' was not declared in this scope; did you mean 'tm'?
    5 |     cin>>n>>m>>k;
      |             ^
      |             tm
a.cc:5:16: error: 'k' was not declared in this scope
    5 |     cin>>n>>m>>k;
      |                ^
a.cc:8:10: error: 'a' was not declared in this scope
    8 |     cin>>a[i];
      |          ^
a.cc:10:10: error: 'b' was not declared in this scope
   10 |     cin>>b[i];
      |          ^
a.cc:10:12: error: 'i' was not declared in this scope
   10 |     cin>>b[i];
      |            ^
a.cc:12:5: error: 'sum' was not declared in this scope
   12 |     sum=sum+min(a[i],b[i]);
      |     ^~~
a.cc:12:17: error: 'a' was not declared in this scope
   12 |     sum=sum+min(a[i],b[i]);
      |                 ^
a.cc:12:22: error: 'b' was not declared in this scope
   12 |     sum=sum+min(a[i],b[i]);
      |                      ^
a.cc:13:5: error: 'c' was not declared in this scope
   13 |     c++;
      |     ^
a.cc:19:10: error: 'c' was not declared in this scope
   19 |   }cout<<c;
      |          ^
Language: C++

#include<iostream>
using namespace std;long long N,M,K,ans,a[3e5],b[3e5];int main(){cin>>N>>M>>K;for(int i=1;i<=N;i++)cin>>a[i],a[i]=a[i-1]+a[i];for(int i=1;i<=M;i++)cin>>b[i],b[i]=b[i-1]+b[i];for(int i=0;i<=N;i++)if(K>=a[i])ans=max(ans,upper_bound(b+1,b+M+1,K-a[i])-b-1+i);cout<<ans;}

Compiler output:
a.cc:2:43: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    2 | using namespace std;long long N,M,K,ans,a[3e5],b[3e5];int main(){cin>>N>>M>>K;for(int i=1;i<=N;i++)cin>>a[i],a[i]=a[i-1]+a[i];for(int i=1;i<=M;i++)cin>>b[i],b[i]=b[i-1]+b[i];for(int i=0;i<=N;i++)if(K>=a[i])ans=max(ans,upper_bound(b+1,b+M+1,K-a[i])-b-1+i);cout<<ans;}
      |                                           ^~~
a.cc:2:43: error: could not convert '3.0e+5' from 'double' to 'long unsigned int'
    2 | using namespace std;long long N,M,K,ans,a[3e5],b[3e5];int main(){cin>>N>>M>>K;for(int i=1;i<=N;i++)cin>>a[i],a[i]=a[i-1]+a[i];for(int i=1;i<=M;i++)cin>>b[i],b[i]=b[i-1]+b[i];for(int i=0;i<=N;i++)if(K>=a[i])ans=max(ans,upper_bound(b+1,b+M+1,K-a[i])-b-1+i);cout<<ans;}
      |                                           ^~~
      |                                           |
      |                                           double
a.cc:2:43: error: size of array 'a' has non-integral type 'double'
a.cc:2:50: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    2 | using namespace std;long long N,M,K,ans,a[3e5],b[3e5];int main(){cin>>N>>M>>K;for(int i=1;i<=N;i++)cin>>a[i],a[i]=a[i-1]+a[i];for(int i=1;i<=M;i++)cin>>b[i],b[i]=b[i-1]+b[i];for(int i=0;i<=N;i++)if(K>=a[i])ans=max(ans,upper_bound(b+1,b+M+1,K-a[i])-b-1+i);cout<<ans;}
      |                                                  ^~~
a.cc:2:50: error: could not convert '3.0e+5' from 'double' to 'long unsigned int'
    2 | using namespace std;long long N,M,K,ans,a[3e5],b[3e5];int main(){cin>>N>>M>>K;for(int i=1;i<=N;i++)cin>>a[i],a[i]=a[i-1]+a[i];for(int i=1;i<=M;i++)cin>>b[i],b[i]=b[i-1]+b[i];for(int i=0;i<=N;i++)if(K>=a[i])ans=max(ans,upper_bound(b+1,b+M+1,K-a[i])-b-1+i);cout<<ans;}
      |                                                  ^~~
      |                                                  |
      |                                                  double
a.cc:2:50: error: size of array 'b' has non-integral type 'double'
a.cc: In function 'int main()':
a.cc:2:219: error: 'upper_bound' was not declared in this scope
    2 | using namespace std;long long N,M,K,ans,a[3e5],b[3e5];int main(){cin>>N>>M>>K;for(int i=1;i<=N;i++)cin>>a[i],a[i]=a[i-1]+a[i];for(int i=1;i<=M;i++)cin>>b[i],b[i]=b[i-1]+b[i];for(int i=0;i<=N;i++)if(K>=a[i])ans=max(ans,upper_bound(b+1,b+M+1,K-a[i])-b-1+i);cout<<ans;}
      |                                                                                                                                                                                                                           ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,k;
    cin>>n>>m>>k;
    vector<long long>a1(n+1), b1(m+1);
    for(int i=1;i<=n;i++){
        cin>>a1[i];
        a1[i]+=a1[i-1];
    }

    for(int i=1;i<=m;i++){
        cin>>b1[i];
        b1[i]+=b1[i-1];
    }
    int mx=0;
    for(int i=0;i<=n;i++){
        vector<long long>::iterator it=upper_bound(b1.begin(),b1.end(),(k-a1[i]));
        if(it==b1.begin())
            continue;
        it--;
        mx=max(mx,i+it-b1.begin());

    }
    cout << mx << endl;
    return 0;
}
/***
5 4 1
1000000000 1000000000 1000000000 1000000000 1000000000
1000000000 1000000000 1000000000 1000000000
3 4 730
60 90 120
80 150 80 150
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:25:15: error: no matching function for call to 'max(int&, __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type)'
   25 |         mx=max(mx,i+it-b1.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:25:15: 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'})
   25 |         mx=max(mx,i+it-b1.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:25:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   25 |         mx=max(mx,i+it-b1.begin());
      |            ~~~^~~~~~~~~~~~~~~~~~~~
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++

  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:3: error: 'N' does not name a type
    1 |   N, M, K = map(int, input().split())
      |   ^