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

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

int main(){
  long long N,sum; cin >> N;
  sum=0;
  vector<long long> vec(N+1);
  vector<long long> vek(N);
  
  for(long long i=0;i<N+1;i++){
    cin >> vec.at(i);//kijyuu
  }
  for(long long i=0;i<N;i++){
    cin >> vek.at(i);//yuusya
  }
  for(long long i=0;i<N-1;i++){
    if(vek(i)-vec(i)>=0){
      if(vec(i+1)-vek(i)+vec(i)>=0){
        vec(i+1)=vec(i+1)-vek(i)+vec(i);
        sum=sum+vek(i)-vec(i);
      }
      else{
        sum=sum+vec(i+1);
        vec(i+1)=0;
      }
    }
    else{
      sum=sum+vec(i)-vek(i);
    }
  }
  cout << sum << endl;
}
      
      


Compiler output:
a.cc: In function 'int main()':
a.cc:17:11: error: no match for call to '(std::vector<long long int>) (long long int&)'
   17 |     if(vek(i)-vec(i)>=0){
      |        ~~~^~~
a.cc:17:18: error: no match for call to '(std::vector<long long int>) (long long int&)'
   17 |     if(vek(i)-vec(i)>=0){
      |               ~~~^~~
a.cc:18:13: error: no match for call to '(std::vector<long long int>) (long long int)'
   18 |       if(vec(i+1)-vek(i)+vec(i)>=0){
      |          ~~~^~~~~
a.cc:18:22: error: no match for call to '(std::vector<long long int>) (long long int&)'
   18 |       if(vec(i+1)-vek(i)+vec(i)>=0){
      |                   ~~~^~~
a.cc:18:29: error: no match for call to '(std::vector<long long int>) (long long int&)'
   18 |       if(vec(i+1)-vek(i)+vec(i)>=0){
      |                          ~~~^~~
a.cc:19:12: error: no match for call to '(std::vector<long long int>) (long long int)'
   19 |         vec(i+1)=vec(i+1)-vek(i)+vec(i);
      |         ~~~^~~~~
a.cc:19:21: error: no match for call to '(std::vector<long long int>) (long long int)'
   19 |         vec(i+1)=vec(i+1)-vek(i)+vec(i);
      |                  ~~~^~~~~
a.cc:19:30: error: no match for call to '(std::vector<long long int>) (long long int&)'
   19 |         vec(i+1)=vec(i+1)-vek(i)+vec(i);
      |                           ~~~^~~
a.cc:19:37: error: no match for call to '(std::vector<long long int>) (long long int&)'
   19 |         vec(i+1)=vec(i+1)-vek(i)+vec(i);
      |                                  ~~~^~~
a.cc:20:20: error: no match for call to '(std::vector<long long int>) (long long int&)'
   20 |         sum=sum+vek(i)-vec(i);
      |                 ~~~^~~
a.cc:20:27: error: no match for call to '(std::vector<long long int>) (long long int&)'
   20 |         sum=sum+vek(i)-vec(i);
      |                        ~~~^~~
a.cc:23:20: error: no match for call to '(std::vector<long long int>) (long long int)'
   23 |         sum=sum+vec(i+1);
      |                 ~~~^~~~~
a.cc:24:12: error: no match for call to '(std::vector<long long int>) (long long int)'
   24 |         vec(i+1)=0;
      |         ~~~^~~~~
a.cc:28:18: error: no match for call to '(std::vector<long long int>) (long long int&)'
   28 |       sum=sum+vec(i)-vek(i);
      |               ~~~^~~
a.cc:28:25: error: no match for call to '(std::vector<long long int>) (long long int&)'
   28 |       sum=sum+vec(i)-vek(i);
      |                      ~~~^~~
Language: C++

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

int main(){
  int N,gam,sum,gif; cin >> N;
  sum=0;gam=0;
  vector<int> vec(N+1);
  vector<int> vek(N);
  
  for(int i=0;i<N+1;i++){
    cin >> vec.at(i);
  }
  for(int i=0,i<N;i++){
    cin >> vek.at(i);
  }
  for(int i=0;i<N-1;i++){
    gif=vek.at(i)-vec.at(i);
    if(gif>=0){
      vek.at(i+1)=vek.at(i+1)+gif;
    }
    else{
      sum=sum-gif;
    }
  }
  if(vek.at(N-1)>=vec.at(N-1)){
    sum=sum+vec.at(N)-vek.at(N-1)+vec.at(N-1);
  }
  else{
    sum=sum+vec.at(N)+vec.at(N-1)-vek.at(N-1);
  }
  for(int i=0;i<N+1;i++){
    gam=gam+vec.at(i);
  }
  cout << gam-sum << endl;
}
  
      
      

Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: expected ';' before '<' token
   13 |   for(int i=0,i<N;i++){
      |                ^
      |                ;
a.cc:13:16: error: expected primary-expression before '<' token
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
using namespace std;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

int main(){
  long long L,R;
  cin >> L >> R;
  if(R >= L+2019){
    cout<<0<<endl;
  }
  long long m=0, min1 =2018;
  for(long long i =L; i<R ;i++){
    for(long long j = i+1; j <R+1; j++){
      m =(i*j)%2019;
      min1 =min(min1,m)
    }
  }
  cout <<min1 <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:24: error: expected ';' before '}' token
   27 |       min1 =min(min1,m)
      |                        ^
      |                        ;
   28 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
using namespace std;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

int main(){
  int L,R;
  cin >> L >> R;
  if(R >= L+2019){
    R = L+ 2019;
  }
  long long m=0;
  int min1 =2018,min2 =2020;
  for(int i =L; i<R ;i++){
    for(int j = i+1; j <R+1; j++){
      m =(i*j)%2019;
      min1 = min(m,min1);
    }
  }
  cout <<min1 <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: no matching function for call to 'min(long long int&, int&)'
   28 |       min1 = min(m,min1);
      |              ~~~^~~~~~~~
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:28:17: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   28 |       min1 = min(m,min1);
      |              ~~~^~~~~~~~
/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:28:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   28 |       min1 = min(m,min1);
      |              ~~~^~~~~~~~
Language: Java

import java.util.Scanner;

public class A003Ans {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] A = new long[N+1];
		long[] B = new long[N];
		for(int i = 0; i < N+1; i++) A[i]=sc.nextLong();
		for(int i = 0; i < N; i++) B[i]=sc.nextLong();
		sc.close();
      
		long ans = 0;
      	for(int i = 0; i < N; i++){
			long d1 = Math.min(A[i], B[i]);
			ans += d1;
			A[i] -= d1;
			B[i] -= d1;
			long d2 = Math.min(A[i+1], B[i]);
			ans += d2;
			A[i+1] -= d2;
			B[i] -= d2;
		}
		System.out.println(ans);
	}
}

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

N = int(input())
L = list(map(int,input().split()))
M = list(map(int,input().split()))
begin = sum(L)
for i in range(N):
    if M[i] > L[i]:
        L[i+1] -= M[i] - L[i]
        L[i] = 0
        L[i+1] = max(L[i+1],0)
    else:
        L[i] -= M[i]
end = sum(L)
print(begin - end)


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

#include <iostream>
#include <vector>
using namespace std;
int main() 
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> va;
    int n;
    int ans=0;
    cin >> n;
    for (int i = 0; i < n+1; i++)
    {
        int a;
        cin >> a;
        va.push_back(a);
    }
    for (int i = 0; i < n; i++)
    {
        int b=0;
        cin >> b;
        if (va[i] >= b) {
            va[i] -= b;
            ans += b;
            b = 0
        } else {
            ans += va[i];
            b -= va[i];
            va[i] = 0;
            if (va[i+1] >= b) {
                va[i+1] -= b;
                ans += b;
            } else {
                ans += va[i+1];
                b -= va[i+1];
                va[i+1] = 0;
            }        
        }
    }

    cout << ans << "\n";
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:18: error: expected ';' before '}' token
   25 |             b = 0
      |                  ^
      |                  ;
   26 |         } else {
      |         ~
Language: C++

#include <iostream>
#include <algorithm>
#define MAX_N 100000
typedef long long ll;

using namespace std;

int n;
ll a[MAX_N + 1], b[MAX_N];

void solve()
{
    int res = 0, tmp = 0;
    for (int i = 0; i < n; i++)
    {
        // i番目の勇者が余力を残さないとき
        if (a[i] >= (b[i] + tmp))
        {
            res += b[i] + tmp;
            tmp = 0; // i+1番目に助太刀できない
        }
        else
        {
            res += a[i];
            tmp = min(a[i + 1], b[i] + tmp - a[i]); //最大でa[i+1]助太刀できる
        }
    }
    // n+1番目の街はn番目の勇者の余力で倒す
    res += tmp;

    cout << res << endl;
}

int main()
{
    cin >> n;
    for (int i = 0; i <= n; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++)
    {
        cin >> b[i];
    }

    solve();
}
#include <iostream>
#include <algorithm>
#include <memory.h>
#define MAX_N 50

using namespace std;

int n;
int p[MAX_N], p_copy[MAX_N];

void solve()
{
    int count = 0;
    memcpy(p_copy, p, sizeof(p));
    sort(p, p + n);
    for (int i = 0; i < n; i++)
    {
        if (p[i] != p_copy[i])
            count++;
    }
    if (count == 0 || count == 2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
    }

    solve();
}


Compiler output:
a.cc:51:9: warning: "MAX_N" redefined
   51 | #define MAX_N 50
      |         ^~~~~
a.cc:3:9: note: this is the location of the previous definition
    3 | #define MAX_N 100000
      |         ^~~~~
a.cc:55:5: error: redefinition of 'int n'
   55 | int n;
      |     ^
a.cc:8:5: note: 'int n' previously declared here
    8 | int n;
      |     ^
a.cc:58:6: error: redefinition of 'void solve()'
   58 | void solve()
      |      ^~~~~
a.cc:11:6: note: 'void solve()' previously defined here
   11 | void solve()
      |      ^~~~~
a.cc:74:5: error: redefinition of 'int main()'
   74 | int main()
      |     ^~~~
a.cc:34:5: note: 'int main()' previously defined here
   34 | int main()
      |     ^~~~
Language: C++

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n+1);
    vector<int> b(n);
    for(int i = 0; i < n+1; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    long long last = 0;
    long long sum = 0;
    if(b[0] > a[0]){
        last = b[0] - a[0];
        sum += a[0];
    }else{
        sum += b[0];
    }
    for(int i = 1; i < n; i++){
        last += b[i];
        if(last > a[i]){
            last -= a[i];
            sum += a[i];
        }else{
            sum += last;
            last = 0;
        }
    }
    sum += min(last, a[n]);
    cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:15: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   29 |     sum += min(last, a[n]);
      |            ~~~^~~~~~~~~~~~
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:29:15: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   29 |     sum += min(last, a[n]);
      |            ~~~^~~~~~~~~~~~
/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:29:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   29 |     sum += min(last, a[n]);
      |            ~~~^~~~~~~~~~~~
Language: C++

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

int main() {
 int n,en=0;cin>>n;
  int a[n+1],b[n];
for(int i=0;i<n+1;i++) cin>>a[i];
  for(int i=0;i<n;i++) cin>>b[i];

  int i=0,j=0;
  repeat:
  while(i<n+1 && j <n){
    while(j-i!=1 && i-j!=2){
      cout<<en<<endl;
      cout<<"i,j "<<i<<" "<<j<<endl;
      cout<<"a[i],b[j] "<<a[i]<<" "<<b[j]<<endl;//
    
    if(a[i]>b[j]){
       
       en+=b[j]; a[i] += -b[j]; b[j]=0;  j++; goto repeat;
    }
      
      
      if(a[i]==b[j]){
      en+=b[j]; a[i]=b[j]=0; i++ ; j++;goto repeat;
      }
      
      if(a[i]<b[j]){
        en+=a[i];b[j] += -a[i];i++;goto repeat;;
      }
    }
    if(j>i) i++;
    if(i>j) j++;
    goto repeat;
  }       
       


cout<<en<<endl;





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

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
 
    string S; cin >> S;
    int N = sz(S);
    ll dp[N+1][13];
    F0R(i, N+1) {
        F0R(j, 13) {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;
 
    F0R(i, N) {
        F0R(j, 10) {
            int nxt = S[i] - '0';
            if (S[i] == '?') {
                nxt = j;
            }
            F0R(k, 13) {
                int rem = (10*k + nxt) % 13;
                dp[i+1][rem] += dp[i][k];
                dp[i+1][rem] %= MOD;
            }
            if (S[i] != '?') break;
        }
    }
 
 
    F0R(i, N+1) {
        F0R(j, 13) {
            //cout << i << " " << j << "  " << dp[i][j] << endl;
        }
    }
    cout << dp[N][5] << endl;
 
    return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:4:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::__cxx11::basic_string<char>::_Alloc_hider::~_Alloc_hider()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = char]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:186:14: note: called from here
  186 |       struct _Alloc_hider : allocator_type // TODO check __is_final
      |              ^~~~~~~~~~~~
Language: C++

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

int main(){
  int n, left, right;
  long sum;
  cin >> n;
  vector<int> city(n+1), hero(n);
  rep(i, n+1, 0) cin >> city[i];
  rep(i, n, 0) cin >> hero[i];
  
  sum = 0;
  for(int i=0; i<n; i++){
    left = min(city[i], hero[i]);
	city[i] -= left;
	hero[i] -= left;
	sum += left;
	
	right = min(city[i+1], hero[i]);
	city[i+1] -= right;
	hero[i] -= right;
	sum += right;
  }
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   rep(i, n+1, 0) cin >> city[i];
      |       ^
a.cc:9:3: error: 'rep' was not declared in this scope
    9 |   rep(i, n+1, 0) cin >> city[i];
      |   ^~~
Language: C++

#include<bits/stdc++.h>

#define ll long long
#define vi vector<int>
#define vc vector<char>
#define vt vector<string>
#define si set<int>
#define sc set<char>
#define st set<string>
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back;

using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<long long> m(n),h(n);
    for(int i=0;i<=n;i++)
        cin>>m[i];
    for(int i=0;i<n;i++)
        cin>>h[i];
    int ans=0;
    for(int i=0;i<n;i++)
    {
        if(h[i]<=m[i])
            ans+=h[i];
        else
        {
            ans+=m[i];
            h[i]-=m[i];
            ans+=min(h[i],m[i+1]);
            m[i+1]=max(0,m[i+1]-h[i]);

        }
    }
    cout<<ans;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:35:23: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   35 |             m[i+1]=max(0,m[i+1]-h[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:35:23: 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'})
   35 |             m[i+1]=max(0,m[i+1]-h[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:35:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   35 |             m[i+1]=max(0,m[i+1]-h[i]);
      |                    ~~~^~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>

#define ll long long
#define vi vector<int>
#define vc vector<char>
#define vt vector<string>
#define si set<int>
#define sc set<char>
#define st set<string>
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back;

using namespace std;
int main()
{
    int n;
    cin>>n;
    vi m(n),h(n);
    for(int i=0;i<=n;i++)
        cin>>m[i];
    for(int i=0;i<n;i++)
        cin>>h[i];
    int ans=0;
    for(int i=0;i<n;i++)
    {
        if(h[i]<=m[i])
            ans+=h[i];
        else
        {
            if(h[i]-m[i]<=m[i+1])
            {
                ans+=m[i+1]-(h[i]-m[i])
                m[i+1]-=h[i]-m[i];
            }
            else
            {
                ans+=m[i+1];
                m[i+1]=0;
            }
        }
    }
    cout<<ans;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:34:40: error: expected ';' before 'm'
   34 |                 ans+=m[i+1]-(h[i]-m[i])
      |                                        ^
      |                                        ;
   35 |                 m[i+1]-=h[i]-m[i];
      |                 ~
Language: C++

#include <bits/stdc++.h>

using namespace std;



int main() {

  int N ;cin >> N;
  int A[N+1],B{N];
  int ans = 0;
  for (int i = 0;i<=N;i++){
    cin >> A[i]
  }
  for (int i = 0;i<N;i++){
    cin >> B[i]
  }
               
  for (int i=0;i<N;i++){
    if (A[i]-B[i]>=0){
      ans += B[i];
      A[i] = A[i] - B[i];
      B[i] = 0;
    }else{
      
      ans += A[i];
      
      B[i] = B[i] -A[i};
      A[i] = 0;
    }
    
    if(A[i+1]-B[i]>=0){
      ans += B[i];
      A[i] = A[i] - B[i];
      B[i] = 0;
    }else{
      ans += A[i+1];
      
      B[i] = B[i] -A[i+1};
      A[i] = 0;
    }
    
    
  }
  cout << ans;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: expected '}' before ']' token
   10 |   int A[N+1],B{N];
      |               ~ ^
a.cc:10:17: error: expected ',' or ';' before ']' token
a.cc:13:16: error: expected ';' before '}' token
   13 |     cin >> A[i]
      |                ^
      |                ;
   14 |   }
      |   ~             
a.cc:16:13: error: invalid types 'int[int]' for array subscript
   16 |     cin >> B[i]
      |             ^
a.cc:20:15: error: invalid types 'int[int]' for array subscript
   20 |     if (A[i]-B[i]>=0){
      |               ^
a.cc:21:15: error: invalid types 'int[int]' for array subscript
   21 |       ans += B[i];
      |               ^
a.cc:22:22: error: invalid types 'int[int]' for array subscript
   22 |       A[i] = A[i] - B[i];
      |                      ^
a.cc:23:8: error: invalid types 'int[int]' for array subscript
   23 |       B[i] = 0;
      |        ^
a.cc:28:8: error: invalid types 'int[int]' for array subscript
   28 |       B[i] = B[i] -A[i};
      |        ^
a.cc:28:15: error: invalid types 'int[int]' for array subscript
   28 |       B[i] = B[i] -A[i};
      |               ^
a.cc:28:23: error: expected ']' before '}' token
   28 |       B[i] = B[i] -A[i};
      |                       ^
      |                       ]
a.cc:32:10: error: 'i' was not declared in this scope
   32 |     if(A[i+1]-B[i]>=0){
      |          ^
a.cc:39:25: error: expected ']' before '}' token
   39 |       B[i] = B[i] -A[i+1};
      |                         ^
      |                         ]
a.cc:40:9: error: 'i' was not declared in this scope
   40 |       A[i] = 0;
      |         ^
a.cc: At global scope:
a.cc:44:3: error: expected declaration before '}' token
   44 |   }
      |   ^
a.cc:45:3: error: 'cout' does not name a type
   45 |   cout << ans;
      |   ^~~~
a.cc:46:1: error: expected declaration before '}' token
   46 | }
      | ^
Language: C++

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N+1),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);
  }
 int count=0;
for (int i = 0; i < N-1; i++) {
if(b.at(0)>a.at(0)){
count+=a.at(0);
}
else{
count+=b.at(0);
}
if(b.at(i+1)>a.at(i+1)&&b.at(i)<=a.at(i)){
        count+=a.at(i+1)-;
      }
if(b.at(i+1)>a.at(i+1)&&b.at(i)>a.at(i)){
        count+=a.at(i+1)-(b.at(i)-a.at(i));
      }
if(b.at(i+1)<=a.at(i+1)&&b.at(i)<=a.at(i)){
        count+=b.at(i+1);
      }
if(b.at(i+1)<=a.at(i+1)&&b.at(i)>a.at(i)&&a.at(i+1)-b.at(i+1)-b.at(i)+a.at(i)>0){
        count+=b.at(i+1);
     }
if(b.at(i+1)<=a.at(i+1)&&b.at(i)>a.at(i)&&a.at(i+1)-b.at(i+1)-b.at(i)+a.at(i)<=0){
         count+=a.at(i+1)-b.at(i+1)+a.at(i);
}
   }
if(b.at(N)>a.at(N)&&a.at(N+1)-b.at(N)+a.at(N)>=0){
count+=b.at(N)-a.at(N);
}
if(b.at(N)>a.at(N)&&a.at(N+1)-b.at(N)+a.at(N)<0){
count+=a.at(N+1);
}
cout<<count;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:26: error: expected primary-expression before ';' token
   23 |         count+=a.at(i+1)-;
      |                          ^
Language: C++

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);  
	int n;
  int ans = 0;
  cin >> n;
  vector<ll> monster(n+1), hero(n);
  for(int i = 0; i <= n; i++){
		cin >> monster[i];  	
  }
  for(int i = 0; i < n; i++){
  	cin >> hero[i];
  	ans += min(hero[i], monster[i] + monster[i+1]);
  	monster[i+1] -= min(monster[i+1], max(hero[i] - monster[i], 0)); 
  }
  cout << ans << endl;
  return 0;
}

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

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

int main(){
  int n;
  int ans = 0;
  cin >> n;
  vector<int> monster(n+1), hero(n);
  for(int i = 0; i <= n; i++){
		cin >> monster[i];  	
  }
  for(int i = 0; i < n; i++){
  	cin >> hero[i];
  	ans += min(hero[i], monster[i] + monster[i+1]);
  	monster[i+1] -= min(monster[i+1],(hero[i]-monster[i]); 
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:62: error: expected ')' before ';' token
   15 |         monster[i+1] -= min(monster[i+1],(hero[i]-monster[i]);
      |                            ~                                 ^
      |                                                              )
Language: C++

#include <cstdio>
#include <algorithm>
using namespace std;

int N, monster[100001];

int main()
{
  scanf("%d", &N);
  for (int i=0; i<N+1; i++)
    scanf("%d", &monster[i]);

  int ret=0;
  int tmp=0;
  int x;
  for (int i=0; i<N; i++) {
    scanf("%d", &x):
    tmp = min(monster[i], x);
    ret += tmp;
    x -= tmp;
    if (x) {
      tmp = min(monster[i+1], x);
      ret += tmp;
    }
  }
  printf("%d\n", ret);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: expected ';' before ':' token
   17 |     scanf("%d", &x):
      |                    ^
      |                    ;
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
 
using namespace std;
using ll = long long;
int main(void){
 
 
  int n;
  cin>>n;
	vector<ll> a(n + 1), b(n);
  for(int i=0;i<n+1;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
  }
  ll ans=0;
  ll m=0;
  
  for(int i=0;i<n;i++){
    m=min(a[i],b[i]);
    ans+=m;
    a[i]-=m;
    b[i]-=m;
    m=min(a[i+1],b[i]);
    ans+=m;
    a[i+1]-=m;
    b[i]-=m;
  }
  cout<<ans<<endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:33:19: error: expected '}' at end of input
   33 |   cout<<ans<<endl;
      |                   ^
a.cc:8:15: note: to match this '{'
    8 | int main(void){
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int>a(n+1),b(n);
  for(int i=0;i<n+1;i++)cin>>a[i];
  for(int i=0;i<n;i++)cin>>b[i];
  long long sum=0;
  for(int i=0;i<n+1;i++)sum+=a[i];
  for(int i=0;i<n;i++){
    int left=min(a[i],b[i]);
    a[i]-=left;
    b[i]-=left;
    a[i+1]-=b[i];
    if(a[i+1]<0)a[i+1]=0;
}
  long long sum1=0;
  for(int i=0;i<n+1;i++)sum1+=a[i];
  cout<<sum-sum1<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:20:24: error: expected '}' at end of input
   20 |   cout<<sum-sum1<<endl;
      |                        ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: Java

import java.util.*;
 
public class Main {
  public static void main (String[] arg) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    long A[] = new int[N+1];
    long B[] = new int[N];
    long Kc = 0;

    for (int i = 0; i < N+1; i++){
      A[i] = scan.nextLong();
    }

    for (int i = 0; i < N; i++){
      B[i] = scan.nextLong();
    }
    
    for(int i = 0; i < N; i++){
      if(B[i] > A[i]){
        B[i] -= A[i];
        Kc += A[i];
        if(B[i] > A[i+1]){
          Kc += A[i+1];
          A[i+1] = 0;
        } else {
          Kc += B[i];
          A[i+1] -= B[i];
        }
      } else {
        Kc += B[i];
      }
    }
    System.out.println(Kc);
  }
}

Compiler output:
Main.java:7: error: incompatible types: int[] cannot be converted to long[]
    long A[] = new int[N+1];
               ^
Main.java:8: error: incompatible types: int[] cannot be converted to long[]
    long B[] = new int[N];
               ^
2 errors
Language: C++

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;

int main()
{
    int N;
    cin >> N;
    int A[N], B{N};

    for (int i = 1; i <= N + 1; i++)
        cin >> A[i];
    for (int i = 1; i <= N; i++)
        cin >> B[i];

    long long int count = 0;

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

        int disc2 = A[i + 1] - B[i];
        if (flag == 0)
        {
            if (disc2 >= 0)
            {
                count += B[i];
                A[i + 1] -= B[i];
            }
            else
            {
                count += A[i + 1];
                A[i + 1] = 0;
            }
        }
    }

    OP(count)

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: invalid types 'int[int]' for array subscript
   19 |         cin >> B[i];
      |                 ^
a.cc:26:29: error: invalid types 'int[int]' for array subscript
   26 |         int disc1 = A[i] - B[i];
      |                             ^
a.cc:29:23: error: invalid types 'int[int]' for array subscript
   29 |             count += B[i];
      |                       ^
a.cc:35:14: error: invalid types 'int[int]' for array subscript
   35 |             B[i] -= A[i];
      |              ^
a.cc:38:33: error: invalid types 'int[int]' for array subscript
   38 |         int disc2 = A[i + 1] - B[i];
      |                                 ^
a.cc:43:27: error: invalid types 'int[int]' for array subscript
   43 |                 count += B[i];
      |                           ^
a.cc:44:30: error: invalid types 'int[int]' for array subscript
   44 |                 A[i + 1] -= B[i];
      |                              ^
Language: C++

n = int(input())
a_lis = list(map(int,input().split()))
b_lis = list(map(int,input().split()))

ans = 0

for i in range(n):
	if b_lis[i] <= a_lis[i]:
		ans += b_lis[i]
	else:                                     
		ans += a_lis[i]
		b_lis[i] -= a_lis[i]
		if b_lis[i] <= a_lis[i+1]:
			ans += b_lis[i]
			a_lis[i+1] -= b_lis[i]
		else:
			ans +=  a_lis[i+1]
			a_lis[i+1] = 0
print(ans)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

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


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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:16: error: 'll' was not declared in this scope
   10 |         vector<ll> a(n + 1), b(n);
      |                ^~
a.cc:10:18: error: template argument 1 is invalid
   10 |         vector<ll> a(n + 1), b(n);
      |                  ^
a.cc:10:18: error: template argument 2 is invalid
a.cc:12:25: error: invalid types 'int[int]' for array subscript
   12 |                 cin >> a[i];
      |                         ^
a.cc:16:25: error: invalid types 'int[int]' for array subscript
   16 |                 cin >> b[i];
      |                         ^
a.cc:19:11: error: expected ';' before 'ans'
   19 |         ll ans = 0;
      |           ^~~~
      |           ;
a.cc:20:11: error: expected ';' before 'tmp'
   20 |         ll tmp = 0;
      |           ^~~~
      |           ;
a.cc:23:17: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   23 |                 tmp = min(a[i], b[i]);
      |                 ^~~
      |                 tm
a.cc:23:28: error: invalid types 'int[int]' for array subscript
   23 |                 tmp = min(a[i], b[i]);
      |                            ^
a.cc:23:34: error: invalid types 'int[int]' for array subscript
   23 |                 tmp = min(a[i], b[i]);
      |                                  ^
a.cc:24:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |                 ans += tmp;
      |                 ^~~
      |                 abs
a.cc:25:18: error: invalid types 'int[int]' for array subscript
   25 |                 a[i] -= tmp;
      |                  ^
a.cc:26:18: error: invalid types 'int[int]' for array subscript
   26 |                 b[i] -= tmp;
      |                  ^
a.cc:28:28: error: invalid types 'int[int]' for array subscript
   28 |                 tmp = min(a[i + 1], b[i]);
      |                            ^
a.cc:28:38: error: invalid types 'int[int]' for array subscript
   28 |                 tmp = min(a[i + 1], b[i]);
      |                                      ^
a.cc:30:18: error: invalid types 'int[int]' for array subscript
   30 |                 a[i + 1] -= tmp;
      |                  ^
a.cc:31:18: error: invalid types 'int[int]' for array subscript
   31 |                 b[i] -= tmp;
      |                  ^
a.cc:34:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   34 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

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


int main() {
	
	int n;
	cin >> n;
	
	vector<int> a(n+1);
    vector<int> b(n);
	for(int i = 0; i < n + 1; ++i) {
		cin >> a[i];
	}
	
	for(int i = 0; i < n; ++i) {
		cin >> b[i];
	}
	
	ll ans = 0;
	ll tmp = 0;
	for(int i = 0; i < n; ++i) {
		
		tmp = min(a[i], b[i]);
		ans += tmp;
		a[i] -= tmp;
		b[i] -= tmp;
		
		tmp = min(a[i + 1], b[i]);
		ans += tmp;
		a[i + 1] -= tmp;
		b[i] -= tmp;
	}
	
	cout << ans << endl;
	

}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'll' was not declared in this scope
   20 |         ll ans = 0;
      |         ^~
a.cc:21:11: error: expected ';' before 'tmp'
   21 |         ll tmp = 0;
      |           ^~~~
      |           ;
a.cc:24:17: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   24 |                 tmp = min(a[i], b[i]);
      |                 ^~~
      |                 tm
a.cc:25:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |                 ans += tmp;
      |                 ^~~
      |                 abs
a.cc:35:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){


  int n;
  cin>>n;
  vector<int> a(n+1);
  vector<int> b(n);
  for(int i=0;i<n+1;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
  }
  int ans=0;
  int m=0;
  
  for(int i=0;i<n;i++){
    m=min(a[i],b[i]);
    ans+=m;
    a[i]-=m;
    b[i]-=m;
    m=min(a[i+1],b[i]);
    ans+=m;
    a[i+1]-=m;
    b[i]-=m
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:12: error: expected ';' before '}' token
   27 |     b[i]-=m
      |            ^
      |            ;
   28 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int n;
int a[100005];
int b[100005];

int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for(int i = 1; i <= n; i++)
    cin >> a[i];
  for(int i = 1; i <= n - 1; i++)
    cin >> b[i];
  long long ans = 0;
  for(int i = 1; i <= n; i++) {
    if(i > 1) {
      int kill = min(a[i], b[i - 1]);
      a[i] -= kill;
      b[i - 1] -= kill;
      ans += kill;
    }
    int kill = min(a[i], b[i]);
    a[i] -= kill;
    b[i] -= kill;
    ans += kill;
}


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

#include <bits/stdc++.h> 

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define int ll

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

  int N;
  cin>>N;
  vector<int>A(N+1),B(N);
  for(int i=0;i<N+1;i++)cin>>A[i];
  for(int i=0;i<N;i++)cin>>B[i];
  int c=0;
  for(int i=0;i<N;i++){
    c+=min(A[i],B[i]);
    c+=min(B[i]-min(A[i],B[i]),A[i+1]);
    A[i+1]=max(A[i+1]-(B[i]-min(A[i],B[i])),0);
  }
  cout<<c<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:15: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)'
   27 |     A[i+1]=max(A[i+1]-(B[i]-min(A[i],B[i])),0);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:27:15: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   27 |     A[i+1]=max(A[i+1]-(B[i]-min(A[i],B[i])),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
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:27:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   27 |     A[i+1]=max(A[i+1]-(B[i]-min(A[i],B[i])),0);
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;

using namespace std;

int main(){
    int n;cin>>n;
    vector<int> avec(n+1);
    vector<int> bvec(n);
    for(int i=0;i<=n;i++) cin >> avec[i];
    rep(i,n) cin >> bvec[i];
    int ans=0;
    int tmp1 = min(avec[0],bvec[0]);
    ans += tmp1
    bvec[0] -= tmp1;
    int tmp2 =  min(avec[1],bvec[0]);
    ans += tmp2;
    avec[1] -= tmp2;
    for(int i=1;i<n;i++){
        int tmp3=min(bvec[i],avec[i]);
        ans += tmp3
        bvec[i] -= tmp3;
        int tmp4 = min(bvec[i],avec[i+1]);
        ans += tmp4;
        bvec[i] -= tmp4;
    }
    cout << ans << endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:16: error: expected ';' before 'bvec'
   17 |     ans += tmp1
      |                ^
      |                ;
   18 |     bvec[0] -= tmp1;
      |     ~~~~        
a.cc:24:20: error: expected ';' before 'bvec'
   24 |         ans += tmp3
      |                    ^
      |                    ;
   25 |         bvec[i] -= tmp3;
      |         ~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
 
int main() {
int n;
  cin >> n;
  vector<int> a,b;
  rep(i,n+1){
    int x;
    cin >> x;
    a.push_back(x);
  }
  rep(i,n){
    int x;
    cin >> x;
    b.push_back(x);
  }
  int num,ans=0;
  rep(i,n){
    
      num=min(a[i],b[i]);
      b[i]-=num;
      ans+=num;
    
    
      num=min(a[i+1],b[i]);
      a[i+1]-=num;
      ans+=num;
    
  }
  cout << d;
    
  
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:11: error: 'd' was not declared in this scope
   43 |   cout << d;
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
 
int main() {
int n;
  cin >> n;
  vector<int> a,b;
  rep(i,n+1){
    int x;
    cin >> x;
    a.push_back(x);
  }
  rep(i,n){
    int x;
    cin >> x;
    b.push_back(x);
  }
  int num,ans=0;
  rep(i,n){
    
      num=min(as[i],bs[i]);
      as[i]-=num;
      bs[i]-=num;
      ans+=num;
    
    
      num=min(as[i+1],bs[i]);
      as[i+1]-=num;
      bs[i]-=num;
      ans+=num;
    
  }
  cout << d;
    
  
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:15: error: 'as' was not declared in this scope; did you mean 'ans'?
   33 |       num=min(as[i],bs[i]);
      |               ^~
      |               ans
a.cc:33:21: error: 'bs' was not declared in this scope; did you mean 'b'?
   33 |       num=min(as[i],bs[i]);
      |                     ^~
      |                     b
a.cc:45:11: error: 'd' was not declared in this scope
   45 |   cout << d;
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
 
int main() {
int n;
  cin >> n;
  vector<int> a(n+1),b(n);
  rep(i,n+1){
    cin >> a[i];
  }
  rep(i,n){
    cin >> b[i];
  }
  int c,d=0,f;
  rep(i,n){
    c = min(a[i],b[i]);
    d += c;
    b[i] -= c
    f = min(a[i+1], b[i]);
    d += f;
    a[i+1] -= f;
    
  }
  cout << d;
    
  
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: expected ';' before 'f'
   30 |     b[i] -= c
      |              ^
      |              ;
   31 |     f = min(a[i+1], b[i]);
      |     ~