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

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        long[] a = new long[100005];
        long[] b = new long[100005];
        for(int i = 0; i < n + 1; ++i){
            a[i] = input.nextLong()
        }
        for(int i = 0; i < n; ++i){
            b[i] = input.nextLong();
        }
        long sum = 0;
        for(int i = 0; i < n; ++i){
            if(a[i] <= b[i]){
                sum += a[i];
                b[i] -= a[i];
            }
            else{
                sum += b[i];
                b[i] = 0;
            }
            if(a[i + 1] <= b[i]){
                sum += a[i + 1];
                b[i] -= a[i + 1];
            }
            else{
                sum += b[i];
                b[i] = 0;
            }
        }
        System.out.println(sum);
    }
}


Compiler output:
Main.java:10: error: ';' expected
            a[i] = input.nextLong()
                                   ^
1 error
Language: Java

public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] a = new int[100005];
        int[] b = new int[100005];
        for(int i = 0; i < n + 1; ++i){
            a[i] = input.nextInt();
        }
        for(int i = 0; i < n; ++i){
            b[i] = input.nextInt();
        }
        long sum = 0;
        for(int i = 0; i < n + 1; ++i){
            if(i == 0){
                if(b[i] > a[i]){
                    sum += a[i];
                    b[i] -= a[i];
                }
                else{
                    sum += b[i];
                    b[i] = 0;
                }
            }
            else{
                if(b[i - 1] > a[i]){
                    sum += a[i];
                    b[i - 1] -= a[i];
                }
                else{
                    a[i] -= b[i - 1];
                    sum += b[i - 1];
                    b[i - 1] = 0;
                }
                if(b[i] > a[i]){
                    sum += a[i];
                    b[i] -= a[i];
                }
                else{
                    sum += b[i];
                    b[i] = 0;
                }
            }
        }
        System.out.println(sum);
    }

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) {
              ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: Java

import java.util.Scanner;

public class C {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] a = new int[100005];
        int[] b = new int[100005];
        for(int i = 0; i < n + 1; ++i){
            a[i] = input.nextInt();
        }
        for(int i = 0; i < n; ++i){
            b[i] = input.nextInt();
        }
        long sum = 0;
        for(int i = 0; i < n + 1; ++i){
            if(i == 0){
                if(b[i] > a[i]){
                    sum += a[i];
                    b[i] -= a[i];
                }
                else{
                    sum += b[i];
                    b[i] = 0;
                }
            }
            else{
                if(b[i - 1] > a[i]){
                    sum += a[i];
                    b[i - 1] -= a[i];
                }
                else{
                    a[i] -= b[i - 1];
                    sum += b[i - 1];
                    b[i - 1] = 0;
                }
                if(b[i] > a[i]){
                    sum += a[i];
                    b[i] -= a[i];
                }
                else{
                    sum += b[i];
                    b[i] = 0;
                }
            }
        }
        System.out.println(sum);
    }
}


Compiler output:
Main.java:3: 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;
#define rep(i,n) for (int i = 0; i < (n); ++i)
int main(){
    int n;
    cin >>n;
    vector<int> a(n+1);
    vector<int> b(n);
    rep(i,n+1) cin >>a[i];
    rep(i,n) cin >>b[i];
    long long ans=0;
    rep(i,n){
        ans += min(a[i],b[i]);
        b[i]-=min(a[i],b[i]);
        ans+= min(a[i+1],b[i]);
        a[i+1]-= min[a[i+1],b[i]];
    }

    cout << ans <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:27: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   16 |         a[i+1]-= min[a[i+1],b[i]];
      |                           ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
a.cc:16:21: error: invalid types '<unresolved overloaded function type>[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   16 |         a[i+1]-= min[a[i+1],b[i]];
      |                     ^
Language: C++

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

int main(){
    long long N;
    cin >> N;
    long long A[N+1],B[N+1];
    for(long long i=0; i<N+1; i++){
        cin >> A[i];
    }
    for(long long i=0; i<N; i++){
        cin >> B[i];
    }
    B[N]=0;

    long long ans=0;
    long long p=0;
    for(long long i=0; i<N+1; i++){
        A[i] -= p;
        ans += p;
        ans += min(A[i],B[i]);
        //cout << "i Bp ans " << i << " " << Bp << " " << ans << endl;
        Bp = max(B[i]-A[i],0LL);
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'Bp' was not declared in this scope; did you mean 'p'?
   23 |         Bp = max(B[i]-A[i],0LL);
      |         ^~
      |         p
Language: C++

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

int main() {
    ll n;
    cin >> n;
    ll a[n+1];
    rep(i, n+1) cin >> a[i];

    ll ans = 0;
    ll pre = 0;
    rep(i, n+1) {
        ll b;
        cin >> b;
        ll rest = a[i] - (pre + b);
        if (rest < 0) {
            pre = max(0, b - (a[i] - pre));
            ans += a[i];
        } else {
            ans += pre + b];
            pre = 0;
        }
    }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:19:22: error: no matching function for call to 'max(int, ll)'
   19 |             pre = max(0, b - (a[i] - pre));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~
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:19:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   19 |             pre = max(0, b - (a[i] - pre));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~
/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:19:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   19 |             pre = max(0, b - (a[i] - pre));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:22:27: error: expected ';' before ']' token
   22 |             ans += pre + b];
      |                           ^
      |                           ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  long int N,B,S=0;cin>>N;long int A[N+1];
  for(long int i=0;i<=N;i++)cin>>A[i];
  for(long int i=0;i<N;i++){
    cin>>B;
    if(A[i]<B){
      if(A[i]+A[i+1]<B){S+=A[i]+A[i+1];A[i+1]=0;}
      else{S+=B;A[i+1]+=A[i]-B;{
    }
    else S+=B;
  }
  cout<<S<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: expected '}' before 'else'
   12 |     else S+=B;
      |     ^~~~
a.cc:10:11: note: to match this '{'
   10 |       else{S+=B;A[i+1]+=A[i]-B;{
      |           ^
a.cc:12:5: error: expected '}' before 'else'
   12 |     else S+=B;
      |     ^~~~
a.cc:8:15: note: to match this '{'
    8 |     if(A[i]<B){
      |               ^
Language: C++

#include <iostream>
#include <vector>
#include <cmath>

int main() {
  int N;
  std::cin >> N;
  std::vector<int> A(N+1, 0);
  for (int i=0; i<N+1; ++i) std::cin >> A.at(i);
  std::vector<int> B(N+1, 0);
  for (int i=0; i<N; ++i) std::cin >> B.at(i);
  
  long long answer = 0, carry = 0;
  for (int i=0; i<N+1; ++i) {
    answer += std::min(A.at(i), carry);
    A.at(i) = A.at(i) >= carry ? A.at(i) - carry : 0;
    answer += std::min(A.at(i), B.at(i));
    carry = B.at(i) >= A.at(i) ? B.at(i) - A.at(i) : 0;
  }
  std::cout << answer << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:23: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, long long int&)'
   15 |     answer += std::min(A.at(i), carry);
      |               ~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: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:15:23: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   15 |     answer += std::min(A.at(i), carry);
      |               ~~~~~~~~^~~~~~~~~~~~~~~~
/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
Language: C++

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep1(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep1は「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=n;i>=(long long)(s);i--)
//reprは「nからsまで」の繰り返し

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;


int main() {
    ll n,sum=0;
    cin>>n;

    vector<ll>a(n+1);
    rep(i,n+1){
        cin>>a[i];
        sum+=a[i];
    }

    rep(i,n){
        ll b;
        cin>>b;
        a[i]-=b;
        if(a[i]<0){
            a[i+1]+=a[i];
            a[i]=0;
        }
        sum-=a[i];
    }
    
    if(a[n]<0)a[n]=0;
    sum-=a[n];
    cout<<sum<<endl;
    }
}



Compiler output:
a.cc:43:1: error: expected declaration before '}' token
   43 | }
      | ^
Language: C++

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep1(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep1は「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=n;i>=(long long)(s);i--)
//reprは「nからsまで」の繰り返し

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;


int main() {
    ll n,sum=0;
    cin>>n;

    vector<ll>a(n+1);
    rep(i,n+1){
        cin>>a[i];
        sum+=a[i];
    }

    rep(i,n){
        ll b;
        cin>>b;
        a[i]-=b;
        if(a[i]<0){
            a[i+1]+=a[i];
            a[i]=0;
        }
        sum-=a[i];
    }
    sum-=__max(a[n],0);
    cout<<sum<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:38:10: error: '__max' was not declared in this scope
   38 |     sum-=__max(a[n],0);
      |          ^~~~~
Language: C++

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep1(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep1は「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=n;i>=(long long)(s);i--)
//reprは「nからsまで」の繰り返し

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;


int main() {
    ll n,sum=0;
    cin>>n;

    vector<ll>a(n+1);
    rep(i,n+1){
        cin>>a[i];
        sum+=a[i];
    }

    rep(i,n){
        int b;
        cin>>b;
        a[i]-=b;
        if(a[i]<0){
            a[i+1]+=a[i];
            a[i]=0;
        }
        sum-=a[i];
    }
    sum-=__max(a[n],0);
    cout<<sum<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:38:10: error: '__max' was not declared in this scope
   38 |     sum-=__max(a[n],0);
      |          ^~~~~
Language: C++

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

int main(){
    int A;
    int B  = 0;
    cin >> A;
    vector<long long int> T(A+1);
    vector<int> K(A);
    for(int i = 0; i < A+1; i++){
       cin >> T.at(i);
    }
    for(int i = 0; i < A; i++){
        cin >> K.at(i);
    }
    for(int i = 0; i < A; i++){
       if(T.at(i) - K.at(i) >= 0){ // １体も頃せない
           B += K.at(i);
       }
       else if(T.at(i+1) + (T.at(i) - K.at(i)) <= 0){ // ２たいともころせる
            B = B + T.at(i) + T.at(i+1);
            T.at(i+1) = 0;
        }
        else { // 1たいしかころせない
           B ＋= K.at(i);
           T.at(i+1) += (T.at(i) - K.at(i));       
        }
    }
    cout << B << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:13: error: expected ';' before '\U0000ff0b'
   25 |            B ＋= K.at(i);
      |             ^~~
      |             ;
Language: C++

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

int main(){
    int A;
    int B  = 0;
    cin >> A;
    vector<long long int> T(A+1);
    vector<int> K(A);
    for(int i = 0; i < A+1; i++){
       cin >> T.at(i);
    }
    for(int i = 0; i < A; i++){
        cin >> K.at(i);
    }
    for(int i = 0; i < A; i++){
       if(T.at(i) - K.at(i) >= 0){ // １体も頃せない
           B += K.at(i);
       }
       else if(T.at(i+1) + (T.at(i) - K.at(i)) <= 0){ // ２たいともころせる
            B = B + T.at(i) + T.at(i+1);
            T.at(i+1) = 0;
        }
        else { // 1たいしかころせない
           B ＋= K.at(i));
           T.at(i+1) += (T.at(i) - K.at(i));       
        }
    }
    cout << B << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:13: error: expected ';' before '\U0000ff0b'
   25 |            B ＋= K.at(i));
      |             ^~~
      |             ;
Language: C++

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

int main(){
    int N;
    cin >> N;
    vector<long long> A(N+1);
    vector<long long> B(N);
    for(int i = 0; i < N+1; i++){
        cin >> A.at(i);
    }
    for(int i = 0; i < N; i++){
        cin >> B.at(i);
    }
    
    long long int count = 0;

    for(int i = 0; i < N; i++){
        if(A.at(i) - B.at(i) >= 0){ //一つも殺せない
            count += B.at(i);
        }
        else if(B.at(i) - A.at(i) - A.at(i+1) <= 0){ //二つとも殺せる
            count += A.at(i) + A.at(i+1);
            A.at(i+1) = 0;
        }
        else { //一つ目は殺せるが二つ目が殺せない
            count -= B.at(i));
            A.at(i+1) -= B.at(i) - A.at(i);
        }
    }

    cout << count << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:29: error: expected ';' before ')' token
   27 |             count -= B.at(i));
      |                             ^
      |                             ;
Language: C++

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

int main() {
  int64_t n, s = 0;
  cin >> n;
  vector<int> a(n+1), b(n);
  rep(i, n+1) cin >> a[i];
  rep(i, n) cin >> b[i];
  rep(i, n){
    if(a[i] < b[i]){
      a[i+1] -= b[i] - a[i];
      b[i] = min(a[i] + a[i+1], b[i]);
    s += b[i];
  }
  cout << s << endl;
  return 0;
}

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

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

using namespace std;
typedef long long ll;

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

int main()
{
  int N;
  cin >> N;
  
  vector<ll> A(N+1);
  for(int i=0; i<N+1; i++)
    cin >> A[i];

  vector<ll> B(N);
  for(int i=0; i<N; i++)
    cin >> B[i];

  int count=0;
  for(int i=0; i<N; i++)
    {
      if(B[i]<A[i])
	{
	  A[i]-=B[i];
	  count += B[i];
	  B[i]=0;
	}
      else
	{
	  B[i]-=A[i];
	  count += A[i];
	}
      
      if(B[i]<A[i+1])
	{
	  A[i+1]-=B[i];
	  count += B[i];
	}
      else
	{
	  count += A[i+1];
	  A[i+1]=0;
	}
    }

  cout << count << endl;

  

  return 0;
}


//cout << setprecision(13);
//next_permutation(v.begin(), v.end());



Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | h#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'h' does not name a type
    1 | h#include <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:13:3: error: 'cin' was not declared in this scope
   13 |   cin >> N;
      |   ^~~
a.cc:15:3: error: 'vector' was not declared in this scope
   15 |   vector<ll> A(N+1);
      |   ^~~~~~
a.cc:15:12: error: expected primary-expression before '>' token
   15 |   vector<ll> A(N+1);
      |            ^
a.cc:15:14: error: 'A' was not declared in this scope
   15 |   vector<ll> A(N+1);
      |              ^
a.cc:19:12: error: expected primary-expression before '>' token
   19 |   vector<ll> B(N);
      |            ^
a.cc:19:14: error: 'B' was not declared in this scope
   19 |   vector<ll> B(N);
      |              ^
a.cc:50:3: error: 'cout' was not declared in this scope; did you mean 'count'?
   50 |   cout << count << endl;
      |   ^~~~
      |   count
a.cc:50:20: error: 'endl' was not declared in this scope
   50 |   cout << count << endl;
      |                    ^~~~
Language: C++

// ========================================================================================================
// Library
// ========================================================================================================
#define _CRT_SECURE_NO_WARNINGS

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

// competitive macro
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i ,n) for (int i = (n) - 1; i >= 0; i--)
#define LL long long
#define ULL unsigned long long

void fastIOS()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}
// ========================================================================================================
// ========================================================================================================

int main()
{
	fastIOS();

	int n; cin >> n;
    int a[n+1] , b[n];
    REP(i,n+1)
    {
        cin >> a[i];
    }
    REP(i,n)
    {
        cin >> b[i];
    }
    
    int max = 0;
    for(int i = 0 ; i<n ; i++)
    {
        if(b[i] > a[i])
        {
            max += a[i];
            b[i] -= a[i];
            
            if(b[i] >=a[i+1])
            {
                max += a[i+1]
            }
            else{
                max += b[i];
                a[i+1] -= b[i];
            }
        }
        else if(b[i] == a[i])
        {
            max += a[i];
        }
        else{
            max += b[i];
        }
    }
    
    cout << max << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:30: error: expected ';' before '}' token
   50 |                 max += a[i+1]
      |                              ^
      |                              ;
   51 |             }
      |             ~
Language: C

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

int main(){
    int n;
    cin >> n;
    int a[n+1], b[n];
    rep(i, 0, n+1) cin >> a[i];
    rep(i, 0, n) cin >> b[i];

    ll ans = 0;
    rep(i, 0, n){
        int left = min(a[i], b[i]);
        ans += left;        
        a[i] -= left;
        b[i] -= left;

        int right = min(a[i+1], b[i]);
        ans += right;
        a[i+1] -= right;
        b[i] -= right;
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
main.c:1:10: 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;

typedef long long ll;
#define pa pair<int, int> 
#define pal pair<long long, long long>
#define pad pair<double, double>
#define pb push_back
#define mp make_pair
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}

typedef vector<bool> bvec;
typedef vector<int> ivec;
typedef vector<long long> lvec;
typedef vector<double> dvec;
typedef vector<pa> pvec;

typedef vector< vector<bool> > bmat;
typedef vector< vector<int> > imat;
typedef vector<string> svec;
typedef vector< vector<string> > smat;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    lvec a(n+1), b(n);
    ll sum=0;
    for (int i=0; i<n+1; i++) cin >> a[i];
    for (int i=0; i<n; i++) cin >> b[i];
    b.push_back(0);
    sum += fmin(a[0], b[0]);
    b[0] = fmax(b[0] - a[0], 0);
    int i;

    for (i=1; i<n; i++) {
        sum += fmin(a[i], b[i-1]);
        ll aa = fmax(a[i]-b[i-1], 0);
        sum += fmin(aa, b[i]);
        b[i] = fmax(b[i]-aa, 0);
    }
    sum +=fmin(a[i], b[i-1])
    cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:29: error: expected ';' before 'cout'
   43 |     sum +=fmin(a[i], b[i-1])
      |                             ^
      |                             ;
   44 |     cout << sum << endl;
      |     ~~~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
//max=({});
//条件式が真ならwhileの中身を回し続ける

bool flag[1050000];

int main() {
	int n;
	cin >> n;
	vector<ll>A(n + 1);
	rep(i, n + 1) {
		cin >> A[i];
	}
	vector<ll>B(n);
	rep(i, n) {
		cin >> B[i];
	}
	ll ans = 0;
	for (int i = n - 1;i >= 0;--i) {
		ans += min(B[i], A[i + 1]);
		ans += min(A[i], B[i] - A[i + 1]);
		A[i] = max(0, A[i] - max(0, B[i] - A[i + 1]));
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:41: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   26 |                 A[i] = max(0, A[i] - max(0, B[i] - A[i + 1]));
      |                                      ~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:26:41: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   26 |                 A[i] = max(0, A[i] - max(0, B[i] - A[i + 1]));
      |                                      ~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/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:26:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   26 |                 A[i] = max(0, A[i] - max(0, B[i] - A[i + 1]));
      |                                      ~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define popcnt(a) __builtin_popcount(a)
#define FastIO() ios::sync_with_stdio(false), cin.tie(0);
#define IO() freopen("palindrome.in","rw",stdin)
#define error(args...)                       \
{                                            \
    cerr<<"LINE "<<__LINE__;                 \
    string _s = #args;                       \
    replace(_s.begin(), _s.end(), ',', ' '); \
    stringstream _ss(_s);                    \
    istream_iterator<string> _it(_ss);       \
    err(_it, args);                          \
    cerr<<endl;                              \
}
void err(istream_iterator<string> it)
{
} 
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
  cerr<<' '<< *it << " = " << a ;
  err(++it, args...);
} 
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e6+9, M = (1<<31), OO = 0x3f3f3f3f;
LL a[N],b[N];
int main()
{
  int n;
  LL ans=0;
  scanf("%d",&n);
  for(int i=0;i<=n;++i) scanf("%lld",a+i);
  for(int i=0;i<n;++i)  scanf("%lld",b+i);

  int l=0;
  for(int i=0;i<=n;++i)
  {
    if((i-l)>1) l++;
    if(b[l]>=a[i])
    {
      if(b[l]==a[i]) ans+=b[l];
      else ans+=a[i];
      b[l]-=a[i];
      a[i]=0;
    }
    else if(b[l]!=0 && a[i]>b[l])
    {
      ans+=b[l];
      a[i]-=b[l];
      b[l]=0;
    }
    if(b[l]==0) l++;
  }
  printf("%lld\n",ans);
  #ifdef _LOCAL_DEFINE
  cerr << (double)clock() * 1.0 / CLOCKS_PER_SEC << endl;
  #endif
  return 0; 
}
s

Compiler output:
a.cc:62:1: error: 's' does not name a type
   62 | s
      | ^
Language: C++

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

int main(){
  int n;
  cin >> n;
  
  rep(i,0,n)cin >> a[i];
  rep(i,0,n-1)cin >> b[i];
  
  rep(i,0,n-1){
  	if(b[i]==0)continue;
	
    if(b[i] <= a[i]){
      ans += b[i];
      continue;
    }
    
    if(b[i] <= a[i] + a[i+1]){
      ans += b[i];
      b[i] -= a[i];
      a[i+1] -= b[i];
      continue;
    }
    
    ans += a[i] + a[i+1];
    a[i+1] = 0;
    
  }
  
  cout << ans << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:20: error: 'a' was not declared in this scope
   10 |   rep(i,0,n)cin >> a[i];
      |                    ^
a.cc:11:22: error: 'b' was not declared in this scope
   11 |   rep(i,0,n-1)cin >> b[i];
      |                      ^
a.cc:14:12: error: 'b' was not declared in this scope
   14 |         if(b[i]==0)continue;
      |            ^
a.cc:16:8: error: 'b' was not declared in this scope
   16 |     if(b[i] <= a[i]){
      |        ^
a.cc:16:16: error: 'a' was not declared in this scope
   16 |     if(b[i] <= a[i]){
      |                ^
a.cc:17:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |       ans += b[i];
      |       ^~~
      |       abs
a.cc:21:8: error: 'b' was not declared in this scope
   21 |     if(b[i] <= a[i] + a[i+1]){
      |        ^
a.cc:21:16: error: 'a' was not declared in this scope
   21 |     if(b[i] <= a[i] + a[i+1]){
      |                ^
a.cc:22:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |       ans += b[i];
      |       ^~~
      |       abs
a.cc:28:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |     ans += a[i] + a[i+1];
      |     ^~~
      |     abs
a.cc:28:12: error: 'a' was not declared in this scope
   28 |     ans += a[i] + a[i+1];
      |            ^
a.cc:33:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   33 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

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

const int N = 100005;;
int n, a[N], b[N];
int main() {
  cin >> n;
  for(int i=0; i<=n; i++) cin >> a[i];
  for(int i=0; i<n; i++) cin >> b[i];
  
  LL ans = 0;
  for(int i=0; i<n; i++) {
  	ans += min(a[i],b[i]);
    b[i]=max(0,b[i]-a[i]);
    ans += min(a[i+1], b[i]);
    a[i+1]=max(0,a[i+1]-b[i]);
  }
  cout << ans << endl;
  return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'LL' was not declared in this scope
   11 |   LL ans = 0;
      |   ^~
a.cc:13:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |         ans += min(a[i],b[i]);
      |         ^~~
      |         abs
a.cc:18:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

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

int main()
{
  int n;
  cin >> n;
  vector<long> a;
  vector<long> b;
  for(int i = 0; i < n + 1; i++){
    long x;
    cin >> x;
    a.push_back(x);
  }
  for(int i = 0; i < n; i++){
    long x;
    cin >> x;
    b.push_back(x);
  }
  long ans = 0;
  long rest = 0;
  for(int i = 0; i < n; i++){
    long enemy = max(a[i] - rest, 0);
    ans1 += min(enemy, b[i]) + a[i] - enemy;
    rest = b[i] - min(enemy, b[i]);
    if (rest < 0) rest = 0;
  }
  ans += min(a[n], rest);
  
  cout << ans;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:21: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type, int)'
   24 |     long enemy = max(a[i] - rest, 0);
      |                  ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:24:21: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   24 |     long enemy = max(a[i] - rest, 0);
      |                  ~~~^~~~~~~~~~~~~~~~
/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
a.cc:25:5: error: 'ans1' was not declared in this scope; did you mean 'ans'?
   25 |     ans1 += min(enemy, b[i]) + a[i] - enemy;
      |     ^~~~
      |     ans
Language: C++

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

int main(void) {
  llong N, before=0, after=0, ans=0;
  cin >> N;

  vector<llong> A(N+1);
  vector<llong> B(N);

  for(llong i=0;i<N+1;i++) {
    cin >> A.at(i);
    before += A.at(i);
  }

  for(llong i=0;i<N;i++) {
    cin >> B.at(i);
  }

  for(llong i=0;i<N;i++) {
    if(A.at(i)<=B.at(i)) {
      A.at(i+1) = max(0, A.at(i+1)-(B.at(i)-A.at(i)));
      A.at(i) = 0;
    }
    else { 
      A.at(i) = A.at(i) - B.at(i);
    }
  }

  for(llong i=0;i<N+1;i++) {
    after += A.at(i);
  }

  ans = before - after;
  cout << ans << endl;

  return (0);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:22: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   23 |       A.at(i+1) = max(0, A.at(i+1)-(B.at(i)-A.at(i)));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:23:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   23 |       A.at(i+1) = max(0, A.at(i+1)-(B.at(i)-A.at(i)));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:23:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   23 |       A.at(i+1) = max(0, A.at(i+1)-(B.at(i)-A.at(i)));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
    long long n;
    std::cin >> n;

    long long before = 0;
    std::vector<long long> a(n + 1);
    for(long long i = 0; i < n + 1; ++i){
        std::cin >> a.at(i);
        before += a.at(i);
    }

    long long b, after = 0;
    for(long long i = 0; i < n; ++i){
        std::cin >> b;
        long long min = std::min(a.at(i), b);
        b -= min;
        a.at(i) -= min;
        a.at(i + 1) -= std::min(a.at(i + 1), b);
        after += a.at(i);
    }
    
    after += a.at(i + 1);

    std::cout << before - after << std::endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:19: error: 'i' was not declared in this scope
   26 |     after += a.at(i + 1);
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    using ll = long long;
    int n; cin >>n;
    vector<ll> a(n+1);
    vector<ll> b(n);

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

    ll sum = 0;

    for(int i=0; i<n; i++){
        if(b.at(i) >= a.at(i)){
            sum += a.at(i);
            b.at(i) -= a.at(i);
            sum += min(a.at(i+1), b.at(i));
            a.at(i+1) = max(0,a.at(i+1)-b.at(i));
        }else{
            sum += b.at(i);
        }
    }

    cout << sum << endl;


}


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

// starter code
# include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  long int A[n+1],B[n+1];
  B[n] = 0;
  // monsters array
	for(int i = 0; i < n+1; i++){
     	cin >> A[i];
	}
  // heros array
	for(int i = 0; i < n; i++){
     	cin >> B[i];
	}  
	long int ul_pow = 0, res=0;
	for(int i = 0; i < n+1; i++){
		if(ul_pow > A[i]){
        	res += A[i];
            ul_pow = B[i];
        }
        else{
        	res += min(ul_pow+B[i], A[i]);
            ul_pow = max(0,B[i]+ul_pow-A[i]);
        }
    }
    cout << res<<'\n';

	return 0;
}

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

// starter code
# include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  long int A[n+1],B[n];
  // monsters array
	for(int i = 0; i < n+1; i++){
     	cin >> A[i];
	}
  // heros array
	for(int i = 0; i < n; i++){
     	cin >> B[i];
	}  
	long int ul_pow = 0, res=0;
	for(int i = 0; i < n+1; i++){
    	res += min(ul_pow+B[i],A[i]);
        ul_pow = B[i] + min(0,ul_pow-A[i]);
    }
    cout << res<<'\n';

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:28: error: no matching function for call to 'min(int, long int)'
   19 |         ul_pow = B[i] + min(0,ul_pow-A[i]);
      |                         ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/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:19:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   19 |         ul_pow = B[i] + min(0,ul_pow-A[i]);
      |                         ~~~^~~~~~~~~~~~~~~
/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:19:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   19 |         ul_pow = B[i] + min(0,ul_pow-A[i]);
      |                         ~~~^~~~~~~~~~~~~~~
Language: C++

// starter code
# include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  long int A[n+1],B[n];
  // monsters array
	for(int i = 0; i < n+1; i++){
     	cin >> A[i];
	}
  // heros array
	for(int i = 0; i < n; i++){
     	cin >> B[i];
	}  
  long int res = 0;
  int prev_pow = 0;
  // more rakshas
  if(A[0] > B[0]) {
  	res = B[0];
    }
  else{
  	res = A[0];
    prev_pow = B[0] - A[0];
  }
  long int curr_pow=0;
  for(int i = 1; i < n+1; i++){
  	curr_pow = prev_pow+B[i];
    if(A[i] > curr_pow){
    	prev_pow = 0;
        res += curr_pow;
    }
    else{
    	res += A[i];
        prev_pow = min(0,B[i-1]-A[i])+B[i];
    }
  }
  cout << res<<'\n';

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:23: error: no matching function for call to 'min(int, long int)'
   35 |         prev_pow = min(0,B[i-1]-A[i])+B[i];
      |                    ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/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:35:23: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   35 |         prev_pow = min(0,B[i-1]-A[i])+B[i];
      |                    ~~~^~~~~~~~~~~~~~~
/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:35:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   35 |         prev_pow = min(0,B[i-1]-A[i])+B[i];
      |                    ~~~^~~~~~~~~~~~~~~
Language: Java

import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] a = new int[N+1];
   int[] b = new int[N];  
   for(int i = 0; i<N+1 ; i++){
   a[i] = sc.nextInt();
   }
   for(int i = 0; i<N ; i++){
   b[i] = sc.nextInt();
   }
   int tmpa1 = 0;
   int tmpa2 = 0;
   int tmpb1 = 0;
   int total = 0;
 for(int i=0;i<N;i++){
   if(i==0){
   tmpa1 = a[i];
   tmpa2 = a[i+1];
   tmpb1 = b[i];
   }else{
   tmpa1 = tmpa2;
   tmpa2 = a[i+1];
   tmpb1 = b[i];
   }
   if(tmpa1 >=tmpb1){
    total+=tmpb1; 
   }else{
     tmpb1 = tmpb1 - tmpa1 ;
     total+=tmpa1 ;
     if(tmpb1>=tmpa2){
      total+=tmpa2;
       tmpa2=0;
     }else{
      total +=tmpb1;
      tmpa2 -=tmpb1;
   }
   }
  }
   System.out.println(total);
 }

Compiler output:
Main.java:43: error: reached end of file while parsing
 }
  ^
1 error