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

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

int main(){
    ll n,m,k;
    cin>>n>>m>>k;
    vector<ll> a(n),b(m);
    ll sum1=0;
    ll sum2=0;
    rep(i,n){
        cin>>a[i];
        sum1+=a[i];
    }
    rep(i,m){
        cin>>b[i];
        sum2+=b[i];
    }
    
    ll ans=n+m;
    if(sum1+sum2<=k){
        cout<<ans<<"\n";
        return 0;
    }
    
    ll t=0;
    ll i=0;
    ll j=0;
    bool exit=true;
    while(exit){
        if(i==n && j==m){
            break;
        }else if(i<n && j<m){
            if(a[i]<b[j]){
                t+=a[i];
                i++;
            }
            else{
                t+=b[j];
                j++;
            }
        }else if(j>=m){
                t+=a[i];
                i++;
        }else if(i>=n){
            t+=b[j];
            j++;
        }
        if(t>=k) exit=false;
    }
    if(t>k) cout<<i+j-1<<"\n";
    else cout<<i+j<<"\n";
    return 0;
}

Compiler output:
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:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define rep(i,n) for(int i=0;i<(n);i++)
a.cc:8:5: error: 'vector' was not declared in this scope
    8 |     vector<ll> a(n),b(m);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | #define rep(i,n) for(int i=0;i<(n);i++)
a.cc:8:14: error: expected primary-expression before '>' token
    8 |     vector<ll> a(n),b(m);
      |              ^
a.cc:8:16: error: 'a' was not declared in this scope
    8 |     vector<ll> a(n),b(m);
      |                ^
a.cc:8:21: error: 'b' was not declared in this scope
    8 |     vector<ll> a(n),b(m);
      |                     ^
a.cc:22:9: error: 'cout' was not declared in this scope
   22 |         cout<<ans<<"\n";
      |         ^~~~
a.cc:22:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:51:13: error: 'cout' was not declared in this scope
   51 |     if(t>k) cout<<i+j-1<<"\n";
      |             ^~~~
a.cc:51:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:52:10: error: 'cout' was not declared in this scope
   52 |     else cout<<i+j<<"\n";
      |          ^~~~
a.cc:52:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

ll INF = 1ll << 60;

void chmin(int &a, int b){
  if(a > b)
    a = b;
}
void chmax(int &a, int b){
  if(a < b)
    a = b;
}

void llchmin(ll &a, ll b){
  if(a > b)
    a = b;
}
void llchmax(ll &a, ll b){
  if(a < b)
    a = b;
}

int main(){
  int n, m, k;
  cin >> n >> m >> k;
  vl a(0), b(0);
  ll asum = 0, bsum = 0;
  rep(i, 0, n){
    if(asum > k){
      int t; cin >> t;
      continue;
    }
    int ai;
    cin >> ai;
    asum += ai;
    a.push_back(asum);
  }
  rep(i, 0, m){
    if(asum > k){
      int t; cin >> t;
      continue;
    }
    int bi;
    cin >> bi;
    bsum += bi;
    b.push_back(bsum);
    if(bsum > k)
      break;
  }
  
  ll mx = 0;
  
  for(int i = a.size()-1; i >= 0; i--){
    for(int j = b.size()-1; j >= 0; j--){
      if(a[i] + b[j] <= k){
        chmax(mx, i+j+2);
        break;
      }
    }
  }
  /*
  rep(i, 0, a.size()){
    rep(j, 0, b.size()){
      if(a[i] + b[j] <= k)
        chmax(mx, i+j+2);
      else
        break;
    }
  }
  */
  cout << mx << endl;
  
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:15: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'll' {aka 'long long int'}
   65 |         chmax(mx, i+j+2);
      |               ^~
a.cc:18:17: note:   initializing argument 1 of 'void chmax(int&, int)'
   18 | void chmax(int &a, int b){
      |            ~~~~~^
Language: Java


import java.util.Scanner;

public class C {

    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        long k = sc.nextLong();
        long[] a = new long[n];
        long[] b = new long[m];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
        }
        for (int i = 0; i < m; i++) {
            b[i] = sc.nextLong();
        }
        long[][] dp = new long[n + 1][m + 1];
        int max = 0;
        for (int i = 0; i <= n; i++) {
            inside:
            for (int j = 0; j <= m; j++) {
                if (i == 0 && j == 0) {
                    dp[i][j] = k;
                    continue;
                }
                if (j == 0 && i > 0) {
                    dp[i][j] = dp[i - 1][j] - a[i - 1];
                } else {
                    dp[i][j] = dp[i][j - 1] - b[j - 1];
                }
                if (dp[i][j] >= 0) {
                    max = Math.max(max, i + j);
                } else {
                    break inside;
                }
            }
        }
        System.out.println(max);
    }
}

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

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

int main() {
  int64_t N, M; 
  int64_t a2, b1, b2, K, r, r2;
  cin >> N;
  cin >> M;
  cin >> K;
  vector<int64_t> vec(N);
  vector<int64_t> vec2(M);
  for ( int64_t i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  for (int64_t i = 0; i< M; i++){
    cin >> vec2.at(i);
  }
  b1 = 0;
  r = 0;
  r2 = 0;
  for ( int64_t i = 0; i < M + N; i++){
    a2 = vec.at(r);
    b2 = vec2.at(r)
    if ( K >= a2 || K >= b2){
      K = K - min(a2, b2);
      b1 = b1 + 1;
      if ( min(a2, b2) == a2){
        r++
      }
      else if ( min(a2, b2) == b2){
        r2++
      }
    }
    else{
      break;
    }
  }
  cout << b1 << endl;
  

  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:20: error: expected ';' before 'if'
   23 |     b2 = vec2.at(r)
      |                    ^
      |                    ;
   24 |     if ( K >= a2 || K >= b2){
      |     ~~              
a.cc:34:5: error: 'else' without a previous 'if'
   34 |     else{
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std ;
typedef  long long int ll ;
#define inf ll(1e9)
#define mod 1000000007
#define mod1 998244353
#define mod2 999983
ll power(ll a,ll n,ll m) ;
ll power(ll a,ll n,ll m)
{  if(n==0)
   return 1 ;
   ll x=power(a,n/2,m) ;
   if(n%2!=0)
    return (((a*x)%m)*(x)%m)%m ;
    else return (x*x)%m ;
}
int sieve [10000001] ;
double PI=3.14159265357 ;
int32_t main()
{ ll n,i,j,x,y,m,k,t,sum,count,cnt,b,c,d,j1,z,a,temp;
  ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
  cin>>n>>m>>k ;
  ll arr[n],brr[m] ;
  for(i=0;i<n;i++) cin>>arr[i] ;
  for(j=0;j<m;j++) cin>>brr[j] ;
  for(i=1;i<n;i++) arr[i]+=arr[i-1] ;
  for(j=1;j<m;j++) brr[j]+=brr[j-1] ;
  z=0 ;
  for(i=0;i<n;i++)
  {
      if(arr[i]>k)
        break ;
        x=arr[i] ;
     ll l,r,mid ;
     l=0 ;
     r=m-1 ;
     y=-1 ;
     while(l<=r)
     {
         mid=(l+r)/2 ;
         if(brr[mid]+x<=k)
         {
             y=mid ;
             l=mid+1 ;
         }
         else r=mid-1 ;
     }
     if(y==-1)
        {
            z=max(z,i+1) ;
           // break ;
        }
        z=max(z,i+1+y+1) ;
  }
  for(i=0;i<m;i++)
  {
      if(brr[i]>k)
        break ;
        x=brr[i] ;
     ll l,r,mid ;
     l=0 ;
     r=n-1 ;
     y=-1 ;
     while(l<=r)
     {
         mid=(l+r)/2 ;
         if(arr[mid]+x<=k)
         {
             y=mid ;
             l=mid+1 ;
         }
         else r=mid-1 ;
     }
     if(y==-1)
       { z=max(z,i+1) ;
     //   break ; } }
        z=max(z,i+1+y+1) ;
  }
  cout<<z ;
  return 0; }


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:80:14: error: expected '}' at end of input
   80 |   return 0; }
      |              ^
a.cc:20:1: note: to match this '{'
   20 | { ll n,i,j,x,y,m,k,t,sum,count,cnt,b,c,d,j1,z,a,temp;
      | ^
Language: C++

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

void solve(){
    ll n, m, t, cnt = 0;
    cin >> n >> m >> t;
    ll a[n], b[m];
    for(ll i = 0; i < n; i++) cin >> a[i];
    for(ll i = 0; i < m; i++) cin >> b[i];
    sort(a, a+n);
    fort(b, b+m);
    ll i = 0, j = 0;
    while(i < n && j < m){
        if(a[i] <= b[j]){
            if(t < a[i]) break;
            t-=a[i];
            ++cnt;
            ++i;
        } else {
            if(t < b[j]) break;
            t-=b[j];
            ++cnt;
            ++j;
        }
    }
    cout << i << " " << j << " " << cnt << " " << t << endl;
    while(i < n && a[i] <= t) t-=a[i], ++cnt, ++i;
    while(j < m && b[j] <= t) t-=b[j], ++cnt, ++j;
    cout << cnt << endl;
}


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //int t;cin>>t;while(t--)
  solve();
  return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:12:5: error: 'fort' was not declared in this scope; did you mean 'fork'?
   12 |     fort(b, b+m);
      |     ^~~~
      |     fork
Language: C++

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

int main () {
  int N, M, K;
  cin >> N >> M >> K;
  
  vector<int> A(N);
  vector<int> B(M);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int j = 0; j < M; j++) {
    cin >> B.at(i);
  }
  
  reverse(A.begin(), A.end());
  reverse(B.begin(), B.end());
  
  int a = 0;
  while (a < K) {
    if (A.at(N - 1) > K || B.at(M - 1) > K) {
      break;
    }
    else if (A.at(N - 1) < B.at(M - 1)) {
      a += A.at(N - 1);
      A.pop_back();
      N--;
    }
    else if (A.at(N - 1) > B.at(M - 1)) {
      a += B.at(M - 1);
      B.pop_back();
      M--;
    }

  cout << a << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: 'i' was not declared in this scope
   14 |     cin >> B.at(i);
      |                 ^
a.cc:38:2: error: expected '}' at end of input
   38 | }
      |  ^
a.cc:4:13: note: to match this '{'
    4 | int main () {
      |             ^
Language: C++

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

long N,M,K;
long long A[200000],B[200000];

int main()
{
    cin >> N;
    cin >> M;
    cin >> K;
    for(int i=0;i<N;i++)
        cin >> A[i];
    for(int i=0;i<M;i++)
        cin >> B[i];
    int total = 0;
    int tmp = 0;
    for(int i= N-1,j=M-1; i >=0 and j>=0;){
        if (A[i]>B[j]and K-A[i] >= 0) {
            total ++;
            K = K - A[i];
            i -- ;
        }
        else if(A[i]<B[j]and K-B[j] >=0){
            total ++ ;
            K = K - B[j];
            j -- ;
        }
        if K
    }
    cout << total <<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:12: error: expected '(' before 'K'
   30 |         if K
      |            ^
      |            (
Language: C++

#define rep_one(i, n) for(int i=1; i<n; i++)
using namespace std;
typedef long long ll;


int main(){
    int n, m, k; cin >> n >> m >> k;
    ll a[n+1], b[m+1];
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    a[n] = 1000000005;
    b[m] = 1000000005;
    ll anow=0, bnow=0, time=0;
    while(time+min(a[anow], b[bnow]) <= k){
        // cout << time << endl;
        if(a[anow] > b[bnow]){
            time += b[bnow];
            bnow++;
        }else{
            time += a[anow];
            anow++;
        }
    }
    // cout << anow << " " << bnow << " " << time << endl;
    cout << anow+bnow << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: 'cin' was not declared in this scope
    7 |     int n, m, k; cin >> n >> m >> k;
      |                  ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define rep_one(i, n) for(int i=1; i<n; i++)
a.cc:9:9: error: 'i' was not declared in this scope
    9 |     rep(i, n) cin >> a[i];
      |         ^
a.cc:9:5: error: 'rep' was not declared in this scope
    9 |     rep(i, n) cin >> a[i];
      |     ^~~
a.cc:14:16: error: 'min' was not declared in this scope; did you mean 'main'?
   14 |     while(time+min(a[anow], b[bnow]) <= k){
      |                ^~~
      |                main
a.cc:25:5: error: 'cout' was not declared in this scope
   25 |     cout << anow+bnow << endl;
      |     ^~~~
a.cc:25:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:26: error: 'endl' was not declared in this scope
   25 |     cout << anow+bnow << endl;
      |                          ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define rep_one(i, n) for(int i=1; i<n; i++)
Language: C++

#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 61;
const lli INF = 1e18;
const lli MOD = 13;
const double EPS=1e-4;

bool m[N];
vi primes(1,2);
void sieve(){
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
}

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}

// ---- コーディングはここから！ ('-')7


int main(){_
	lli a,b,d;
	cin>>a>>b>>d;
	vl u(a),v(b);
	fore(i,0,a)cin>>u[i];
	fore(i,0,b)cin>>v[i];
	vl s1(1,0),s2(1,0);
	fore(i,0,a){
		if(s1.back()+u[i]<=d)s1.pb(s1.back()+u[i]);
		else break;
	}
	fore(i,0,b){
		if(s2.back()+v[i]<=d)s2.pb(s2.back()+v[i]);
		else break
	}
	int mx = 0;
	fore(i,0,sz(s1)){
		int x= upper_bound(all(s2),d-s1[i])-s2.begin();
		if(x>0)x--;
		mx = max(mx,x+i);
	}
	fore(i,0,sz(s2)){
		int x= upper_bound(all(s1),d-s2[i])-s1.begin();
		if(x>0)x--;
		mx = max(mx,x+i);
	}
	cout<<mx<<ENDL;



}


Compiler output:
a.cc: In function 'int main()':
a.cc:89:27: error: expected ';' before '}' token
   89 |                 else break
      |                           ^
      |                           ;
   90 |         }
      |         ~
Language: C++

#include <iostream>
using namespace std;
int main() {
  int n,m
  long long int k;
  long long int a[200000];
  long long int b[200000];
  int i,j;
  cin >> n >> m >> k;
  for (i=0; i<n; i++) cin >> a[i];
  for (j=0; j<m; j++) cin >> b[j];

  long long int sum = 0;
  int s = 0;
  i = j = 0;
  while ((i < n) || (j < m)) {
    if ((i < n) && (j < m)) {
      if (a[i] <= b[j]) {
        if (sum + a[i] > k) break;
        sum += a[i];
        i++;
      } else {
        if (sum + b[j] > k) break;
        sum += b[j];
        j++;
      }
    } else if (i < n) {
      if (sum + a[i] > k) break;
      sum += a[i];
      i++;
    } else {
      if (sum + b[j] > k) break;
      sum += b[j];
      j++;
    }
    s++;
  }
  cout << s;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: expected initializer before 'long'
    5 |   long long int k;
      |   ^~~~
a.cc:9:15: error: 'm' was not declared in this scope
    9 |   cin >> n >> m >> k;
      |               ^
a.cc:9:20: error: 'k' was not declared in this scope
    9 |   cin >> n >> m >> k;
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(),v.end()

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

}



Compiler output:
a.cc: In function 'int main()':
a.cc:29:30: error: lvalue required as left operand of assignment
   29 |                 if(i+j>max){i+j=max;}
      |                             ~^~
Language: C++

for(int i=1;i<=n;i++){
   		if(a[i]>k){
   			break;
   		}
   		int l=1,r=m,mid,ans=-1;
   		while(l<=r){
   			mid=(l+r)>>1;
   			if(b[mid]+a[i]<=k){
   				ans=mid;
   				l=mid+1;
   			}else{
   				r=mid-1;
   			}
   		}
   		if(ans!=-1){
   			res=max(res,ans+i);
   		}
   	}

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'for'
    1 | for(int i=1;i<=n;i++){
      | ^~~
a.cc:1:13: error: 'i' does not name a type
    1 | for(int i=1;i<=n;i++){
      |             ^
a.cc:1:18: error: 'i' does not name a type
    1 | for(int i=1;i<=n;i++){
      |                  ^
Language: C++

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

long long main() {
  long long N, M, K;
  cin >> N >> M >> K;
  vector<long long> a(N);
  for(long long i=0;i<N;i++){
    cin >> a.at(i);
  }
vector<long long> b(M);
  for(long long i=0;i<M;i++){
    cin >> b.at(i);
  }
  long long ans =0;
  long long i = 1;
  long long j = 1;
  while(K>=0){
    if(a[i]>=b[j]){
      K -= a[i];
      i++;
      ans++;
    }
    else{
      K -= b[j];
      j++;
      ans++;
    }
  }
cout << ans << endl;
  return 0;
}


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

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

using namespace std;

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int x =n+m;
  int a[x], 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){
   a[n+i] = b[i];
 }
 sort(a);
   
  int count =0, out=0;
  for(int l=0;count <= k;l++){
    count += a[l];
    out++;
}
  cout << out <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:6: error: no matching function for call to 'sort(int [x])'
   25 |  sort(a);
      |  ~~~~^~~
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:1:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 1 provided
Language: C++

//I am so vegetable
//#define err
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = acos(-1.0);
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){x=1;y=0;return;}
    exgcd(b,a%b,x,y);
    ll X=x;
    x=y; y=X-a/b*y;
}
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }
#define int ll
const int N = 2e5+5;
ll a[N],b[N];
unsigned main() {
	//ofstream cout("E:\\acm dream\\out.txt",ios::out);
	FIO;
    #ifdef err
	double be = clock();
    #endif
    int n,m,k;cin>>n>>m>>k;
    _for(i,0,n){
        int x;cin>>x;
        a[i+1]=a[i]+x;
    }
    _for(i,0,m){
        int x;cin>>x;
        b[i+1]=b[i]+x;
    }
    int ans = 0;
    ll res;
    _for(i,1,n+1){
        res = k-a[i];
        if(res<0){
            if(i==1){
                int y = lower_bound(b,b+m+1,k)-b;
                if(y==m+1)y=m;
                else if(b[y]>k)--y;
                ans = max(ans,y);
                break;
            }
            else break;
        }else{
            int y = lower_bound(b,b+m+1,res)-b;
            if(y==m+1)y=m;
            else if(b[y]>res)--y;
            ans = max(ans,y+i);
        }
    }
    cout<<ans;
    #ifdef err
	double en = clock();
    cout<<"time: "<<fixed<<setprecision(8)<<en-be;
    #endif
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
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 K = sc.nextLong();
		long time = 0;
		int[] A = new int[N];
		int[] B = new int[M];
		int count = 0;
		int countA = 0;
		int countB = 0;
		for(int i = 0;i < N;i++){
			A[i] = sc.nextInt();
		}
		for(int i = 0;i < M;i++){
			B[i] = sc.nextInt();
		}
		while(time < K){
			if(countA < N && countB < M){
				if(A[countA] < B[countB]){
					time += A[countA];
					countA++;
				}else if(A[countA] > B[countB]){
					time += B[countB];
					countB++;
				}else{
					subcountA = countA;
					subcountB = countB;
					boolean flg = true; 
					while(flg)
						if(subcountA < N && subcountB < M){
							if(A[subcountA + 1] < B[subcountB + 1]){
								time += A[countA];
								countA++;
								flg = false;
							}else if(A[subcountA + 1] > B[subcountB + 1]){
								time += B[countB];
								countB++;
								flg = false;
							}else{
								subcountA++;
								subcountB++;
							}
						}else if(subcountA == N){
							if(A[subcountA] < B[subcountB + 1]){
								time += A[countA];
								countA++;
								flg = false;
							}else if(A[subcountA] > B[subcountB + 1]){
								time += B[countB];
								countB++;
								flg = false;
							}else{
								subcountB++;
							}
						}else if(subcountB == M){
							if(A[subcountA + 1] < B[subcountB]){
								time += A[countA];
								countA++;
								flg = false;
							}else if(A[subcountA + 1] > B[subcountB]){
								time += B[countB];
								countB++;
								flg = false;
							}else{
								subcountA++;
							}
						}
					}
				}
			}else if(countA == N && countB == M){
				break;
			}else if(countA == N){
				time += B[countB];
				countB++;
			}else{
				time += A[countA];
				countA++;
			}
			count++;
		}
		if(time > K){
			count--;
		}
		System.out.println(count);
	}
}

Compiler output:
Main.java:73: error: 'else' without 'if'
			}else if(countA == N && countB == M){
			 ^
Main.java:84: error: illegal start of type
		if(time > K){
		^
Main.java:84: error: <identifier> expected
		if(time > K){
		       ^
Main.java:84: error: <identifier> expected
		if(time > K){
		           ^
Main.java:87: error: <identifier> expected
		System.out.println(count);
		                  ^
Main.java:87: error: <identifier> expected
		System.out.println(count);
		                        ^
Main.java:89: error: class, interface, enum, or record expected
}
^
7 errors
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>
#include <iomanip>
#include <stdio.h>
#include <bitset>

typedef long long ll;

constexpr long long INFLL = 1e18;

using namespace std;

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

    vector<int> a(n);
    vector<int> b(m);
    int temp;
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i);
    }
    for (int i = 0; i < m; i++)
    {
        cin >> b.at(i);
    }

    vector<ll> c(n);
    vector<ll> d(m);

    c.at(0) = a.at(0);
    for (int i = 1; i < n; i++)
    {
        c.at(i) = c.at(i - 1) + a.at(i);
    }

    //cout << " ddddddddddddddddddddddddddddddddddddddd" << endl;

    d.at(0) = b.at(0);
    for (int i = 1; i < m; i++)
    {
        d.at(i) = d.at(i - 1) + b.at(i);
    }

    map<ll, int> ma;

    ll temp;

    for (int i = 0; i < n; i++)
    {
        for (int l = 0; l < m; l++)
        {
            //cout << ma[c.at(i) + d.at(l)] << endl;
            temp = c.at(i) + d.at(l);
            if (temp > k)
            {
                break;
            }
            if (ma[temp])
            {
                if (ma[temp] < i + l + 2)
                {
                    ma[temp] = i + l + 2;
                }
            }
            else
            {
                ma[temp] = i + l + 2;
            }
        }
    }

    while (1)
    {
        //cout << k << endl;
        if (ma[k] > 0)
        {
            cout << ma[k] << endl;
            return 0;
        }
        k--;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:8: error: conflicting declaration 'll temp'
   55 |     ll temp;
      |        ^~~~
a.cc:26:9: note: previous declaration as 'int temp'
   26 |     int temp;
      |         ^~~~
Language: C++

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

long long main() {
  long long N, M, K;
  cin >> N >> M >> K;
  vector<long long> a(N);
  for(long long i=0;i<N;i++){
    cin >> a.at(i);
  }
vector<long long> b(M);
  for(long long i=0;i<M;i++){
    cin >> b.at(i);
  }
  int ans =0;
  int i = 1;
  int j = 1;
  while(K>=0){
    if(a[i]>=b[j]){
      K -= a[i];
      i++;
      ans++;
    }
    else{
      K -= b[j];
      j++;
      ans++;
    }
  }
cout << ans << endl;
}


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

#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vs vector<string>
#define pb push_back
using namespace std;
/* void showstack(stack <int> s)
{
    while (!s.empty())
    {
        cout << '\t' << s.top();
        s.pop();
    }
    cout << '\n';
}

void insert_at_bottom(stack<int> &st,int x)
{

    if(st.size() == 0)
    st.push(x);

    else
    {
        int a = st.top();
        st.pop();
        insert_at_bottom(st,x);
        st.push(a);
    }
}

void reverse1(stack<int> &st)
{
    if(st.size()>0)
    {

        int x = st.top();
        st.pop();
        reverse1(st);
        insert_at_bottom(st,x);
    }
}
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m,k,c=0;
    cin>>n>>m>>k;
    stack<int>A;
    stack <int>B;
    for(int i=0;i<n;i++)
        {
            int x;
            cin>>x;
            A.push(x);
        }

    for(int i=0;i<m;i++)
        {
            int x;
            cin>>x;
            B.push(x);
        }
    reverse1(A);
    reverse1(B);
     //  showstack(A);
       // showstack(B);

    while(k>0){

    if(!A.empty() && !B.empty())
    {
        if(A.top()>k && B.top()>k )
        {
            k-=A.top();
        }
        else if(A.top()<B.top())
        {
            c++;
            k-=A.top();
            A.pop();
        }
        else
            {
                c++;
                k-=B.top();
                B.pop();
            }

    }
    else if(A.empty())
    {
            if(B.top()<=k)
              c++;
            k-=B.top();
            B.pop();
    }
    else
    {
                if(A.top()<=k)
                c++;
                k-=A.top();
                A.pop();
    }
        }
        cout<<c;
    return 0;
}


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

//I am so vegetable
//#define err
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = acos(-1.0);
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){x=1;y=0;return;}
    exgcd(b,a%b,x,y);
    ll X=x;
    x=y; y=X-a/b*y;
}
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }
#define int ll
const int N = 2e5+5;
ll a[N],b[N];
int main() {
	//ofstream cout("E:\\acm dream\\out.txt",ios::out);
	FIO;
    #ifdef err
	double be = clock();
    #endif
    int n,m,k;cin>>n>>m>>k;
    _for(i,0,n){
        int x;cin>>x;
        a[i+1]=a[i]+x;
    }
    _for(i,0,m){
        int x;cin>>x;
        b[i+1]=b[i]+x;
    }
    int ans = 0;
    ll res;
    _for(i,1,n+1){
        res = k-a[i];
        if(res<0){
            if(i==1){
                int y = lower_bound(b,b+m+1,k)-b;
                if(y==m+1)y=m;
                else if(b[y]>k)--y;
                ans = max(ans,y);
                break;
            }
            else break;
        }else{
            int y = lower_bound(b,b+m+1,res)-b;
            if(y==m+1)y=m;
            else if(b[y]>res)--y;
            ans = max(ans,y+i);
        }
    }
    cout<<ans;
    #ifdef err
	double en = clock();
    cout<<"time: "<<fixed<<setprecision(8)<<en-be;
    #endif
	return 0;
}

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

#include<bits/stdc++.h>
int r=1e9;
int main()
{
  int N,M,K;
  int a[r],b[r],i;
  int sum=0;
  int count=0;
  cin>>N >>M >>K;
  for(i=0;i<N;i++)
  {
    cin>>a[i];
  }
  for(i=0;i<M;i++)
  {
  cin>>b[i];
  }
  for(i=0;(i<N)&&(i<M);i++)
  {
   if(a[i]<K)
   {
     if((sum+a[i])<K)
     {
     sum=sum+a[i];
       count++;
     }
   }
     if(b[i]<K)
   {
     if((sum+b[i])<K)
     {
     sum=sum+b[i];
       count++;
     }
   }
  }
  cout<<count;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |   cin>>N >>M >>K;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:37:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   37 |   cout<<count;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <numeric>

int main(){
   int N, M, K;
   std::cin >> N >> M >> K;
   std::vector<int> A;
   std::vector<int> B;
   for (int i=0; i<N; i++){
      std::cin >> A.at(i)
   }
   for (int i=0; i<M; i++){
      std::cin >> B.at(i);
   }
   long long int sum_A = std::accumurate(A.begin(), A.end(), 0L);
   long long int sum_B = std::accumurate(B.begin(), B.end(), 0L);
   if (sum_A+sum_B <= K){
      std::cout << N+M << std::endl;
      return 0;
   }

   int cnt = 0;
   int flag = false;
   int a_ptr = 0;
   int b_ptr = 0;
   long long int sum = 0;
   for (int i=0; i<N+M; i++){
      if ((a_ptr > N-1) && (b_ptr > M-1)){
         break;
      } else if (a_ptr > N-1){
	 sum = sum + B.at(b_ptr);
	 b_ptr++;
      } else if (b_ptr > M-1){
	 sum = sum + A.at(a_ptr);
	 a_ptr++;
      } else if (A.at(a_ptr) <= B.at(b_ptr)){
	 sum = sum + A.at(a_ptr);
	 a_ptr++;
      } else{
	 sum = sum + B.at(b_ptr);
	 b_ptr++;
      }
      std::cerr << i << " " << sum << std::endl;
      if (sum > K){
         cnt = a_ptr + b_ptr;
	 break;
      }
   }
   std::cout << cnt << std::endl;



Compiler output:
a.cc: In function 'int main()':
a.cc:11:26: error: expected ';' before '}' token
   11 |       std::cin >> A.at(i)
      |                          ^
      |                          ;
   12 |    }
      |    ~                      
a.cc:16:31: error: 'accumurate' is not a member of 'std'; did you mean 'accumulate'?
   16 |    long long int sum_A = std::accumurate(A.begin(), A.end(), 0L);
      |                               ^~~~~~~~~~
      |                               accumulate
a.cc:17:31: error: 'accumurate' is not a member of 'std'; did you mean 'accumulate'?
   17 |    long long int sum_B = std::accumurate(B.begin(), B.end(), 0L);
      |                               ^~~~~~~~~~
      |                               accumulate
a.cc:50:34: error: expected '}' at end of input
   50 |    std::cout << cnt << std::endl;
      |                                  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
int a[200010],b[200010],sa[200010],sb[200010];
signed main()
{
	int n,m,k,i,maxv=0;
	cin>>n>>m>>k;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		sa[i]=sa[i-1]+a[i];
	}
	for(i=1;i<=m;i++)
	{
		cin>>b[i];
		sb[i]=sb[i-1]+b[i];
	}
	for(i=1;i<=n;i++)
	{
		if(sa[i]>k)
			break;
		maxv=max(maxv,(int)(i+min(upper_bound(sb+1,sb+m+1,k-sa[i])-sb,m)-1));
	}
	cout<<maxv;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:42: error: no matching function for call to 'min(long int, long long int&)'
   23 |                 maxv=max(maxv,(int)(i+min(upper_bound(sb+1,sb+m+1,k-sa[i])-sb,m)-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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:23:42: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   23 |                 maxv=max(maxv,(int)(i+min(upper_bound(sb+1,sb+m+1,k-sa[i])-sb,m)-1));
      |                                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:23:42: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   23 |                 maxv=max(maxv,(int)(i+min(upper_bound(sb+1,sb+m+1,k-sa[i])-sb,m)-1));
      |                                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++>
int r=1e9;
int main()
{
  int N,M,K;
  int a[r],b[r],i;
  int sum=0;
  int count=0;
  cin>>N >>M >>K;
  for(i=0;i<N;i++)
  {
    cin>>a[i];
  }
  for(i=0;i<M;i++)
  {
  cin>>b[i];
  }
  for(i=0;(i<N)&&(i<M);i++)
  {
   if(a[i]<K)
   {
     if((sum+a[i])<K)
     {
     sum=sum+a[i];
       count++;
     }
   }
     if(b[i]<K)
   {
     if((sum+b[i])<K)
     {
     sum=sum+b[i];
       count++;
     }
   }
  }
  cout<<count;
  return 0;
}

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

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

long long main() {
  long long N, M, K;
  cin >> N >> M >> K;
  vector<long long> a(N);
  for(long long i=0;i<N;i++){
    cin >> a.at(i);
  }
vector<long long> b(M);
  for(long long i=0;i<M;i++){
    cin >> b.at(i);
  }
  int a =0;
  int i = 1;
  int j = 1;
  while(K>=0){
    if(a[i]>=b[j]){
      K -= a[i];
      i++;
      ans++;
    }
    else{
      K -= b[j];
      j++;
      ans++;
    }
  }
cout << ans << endl;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:15:7: error: conflicting declaration 'int a'
   15 |   int a =0;
      |       ^
a.cc:7:21: note: previous declaration as 'std::vector<long long int> a'
    7 |   vector<long long> a(N);
      |                     ^
a.cc:22:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |       ans++;
      |       ^~~
      |       abs
a.cc:27:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |       ans++;
      |       ^~~
      |       abs
a.cc:30:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 | cout << ans << endl;
      |         ^~~
      |         abs
Language: C++

#include<iostream>

#define ll long long
#define MAX 200000

using namespace std;

int main(void){
  ll N,M,K,A[MAX],B[MAX],costs=0,ans=0;
  
  cin >> N >> M >> K;
  
  for(int i=0;i < N;i++){
    cin >> A[i];
  }
  for(int i=0;i < M;i++){
    cin >> B[i];
  }
  
  for(int i=0;i < N;i++){
    if(costs > K){
      break;
    }else{
      costs += A[i];
      ans++;
    }
  }
  
  for(int i=0;i < M;i++){
    if(costs > K){
      break;
    }else{
      conts += B[i];
      ans++;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:7: error: 'conts' was not declared in this scope; did you mean 'costs'?
   33 |       conts += B[i];
      |       ^~~~~
      |       costs
Language: C++

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

unsigned long long int m,i,n,k,j,p,ans=0,sum=0;
cin >> n>>m>>k;

unsigned long long int  arr[n];
unsigned long long int  brr[m];

for(i,n)
{
cin >> arr[i];

}
for(i,m)
{
cin >> brr[i];
}

i=0;j=0;

while(sum <= k)
{

if(arr[i]<=brr[j])
{

sum += arr[i];
i++;
ans ++;


}

else (arr[i]>brr[j])
{
sum += brr[j];
j++;
ans ++;
}






}

if(ans-1 <= n +m) cout << ans -1<<endl;
else cout << n+m;




return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:21: error: expected ';' before '{' token
   39 | else (arr[i]>brr[j])
      |                     ^
      |                     ;
   40 | {
      | ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  vector<int> honna(a), honnb(b);
    for (int i = 0; i < a; i++) {
      cin >> honna.at(i);
    }
  for (int j = 0; j < b; j++) {
    cin >> honnb.at(j);
  }
  int kaunto = 0;
  int anoyatu = 0;
  int bnoyatu = 0;
  
  for (int i = 0; i < 200000; i++) {
    if (anoyatu >= a || bnoyatu >= b) {
      break;
    }
    if (c < 0) {
            kaunto -= 1;
            break;
    }
  if (honna.at(anoyatu) < honnb.at(bnoyatu)) {
    kaunto += 1;
    anoyatu += 1;
  }
    if (c < 0) {
            kaunto -= 1;
            break;
    }
    if (anoyatu >= a || bnoyatu >= b) {
      break;
    }
    if (c < 0) {
            kaunto -= 1;
            break;
    }
      if (honna.at(anoyatu) > honnb.at(bnoyatu)) {
        kaunto += 1;
        bnoyatu += 1;
      }
    if (c < 0) {
            kaunto -= 1;
            break;
    }
      if (honna.at(anoyatu) == honnb.at(bnoyatu)) {
        if (honna.at(anoyatu + 1) > honnb.at(bnoyatu + 1)) {
          bnoyatu += 1;
          kaunto += 1
        }
            else {
              anoyatu += 1;
              kaunto += 1;
            }
    }
       if (anoyatu >= a || bnoyatu >= b) {
      break;
    }     
    if (anoyatu >= a || bnoyatu >= b) {
      break;
    }
          if (c < 0) {
            kaunto -= 1;
            break;
          }
          }
          cout << kaunto << endl;
          }

Compiler output:
a.cc: In function 'int main()':
a.cc:52:22: error: expected ';' before '}' token
   52 |           kaunto += 1
      |                      ^
      |                      ;
   53 |         }
      |         ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  long int n,m,k,at=0,an=-1,bt=0,bn=-1;//
  cin>>n>>m>>k;
  vector<long int> a(n),b(m);
  for(int i=0;i<n;i++){
    cin>>a.at(i);
    at+=a.at(i);
    if(at>k){
      if(i!=0)an=i-1; 
      else an=0;
    }
  }
  for(int i=0;i<m;i++){
    cin>>b.at(i);
    bt+=b.at(i);
    if(bt>k){
      if(i!=0)bn=i-1; 
      else bn=0;
    }
    
  }
  long int sumt=at+bt,sumn=an+bn;
  if(sumt<=k)cout<<sumn<<endl;
  else{
    long int sumth=sumt;
    for(int i=0;i<=an;i++){
      long int sumtn=sumth-a.at(an-i),sumnn=sumn-1;
      while(sumtn<=k){
        int j=1;
        sumtn+=b.at(bn+j);
        j++;
        sumnn++;
      }
      if(sumnn>sumn)sumn=sumnn;
    }
    long int sumth2=sumt2;
    for(int i=0;i<=bn;i++){
      long int sumtn2=sumth2-b.at(bn-i),sumnn2=sumn-1;
      while(sumtn2<=k){
        int j=1;
        sumtn2+=a.at(bn+j);
        j++;
        sumnn2++;
      }
      if(sumnn2>sumn)sumn=sumnn2;
    }
    cout<<sumn<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:21: error: 'sumt2' was not declared in this scope; did you mean 'sumth2'?
   38 |     long int sumth2=sumt2;
      |                     ^~~~~
      |                     sumth2
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5+5;
ll a[N], b[N], suma[N], sumb[N];
int main()
{
	int n,m,k;cin>>n>>m>>k;
	for (int i = 1; i <= n; i++) {
		scanf("%lld", a+i);
		suma[i] = suma[i-1] + a[i];
	}
	for (int i = 1; i <= m; i++) {
		scanf("%lld", b+i);
		sumb[i] = sumb[i-1] + b[i];
	}
	int ans = 0;
	ll sum = 0;
	for (int i = 0; i <= n; i++) {
		if (k < suma[i]) break;
		auto it = upper_bound(sumb+1, sumb+1+m, k-suma[i]);
		it--;
		if (it != sumb+1+m) ans = max(1LL*ans, i+(it-sumb));
		else break;
	}
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:46: error: no matching function for call to 'max(long long int, long int)'
   23 |                 if (it != sumb+1+m) ans = max(1LL*ans, i+(it-sumb));
      |                                           ~~~^~~~~~~~~~~~~~~~~~~~~~
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:23:46: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
   23 |                 if (it != sumb+1+m) ans = max(1LL*ans, i+(it-sumb));
      |                                           ~~~^~~~~~~~~~~~~~~~~~~~~~
/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:23:46: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   23 |                 if (it != sumb+1+m) ans = max(1LL*ans, i+(it-sumb));
      |                                           ~~~^~~~~~~~~~~~~~~~~~~~~~