Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
 
void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}
 
int main(){
  ll N;
  cin>>N;
  ll A[100010];
  ll B[100010];
  
  rep(i,N+1){
    cin>>A[i];
  }
  rep(i,N){
    cin>>B[i];
  }
  
  ll count=0;
  
  rep(i,N){
    if((A[i]+A[i+1])>=B[i]&&B[i]>A[i]){
      count+=B[i];
      A[i+1]=A[i+1]+A[i]-B[i];
    }
    else if(B[i]>(A[i]+A[i+1])){
      count+=A[i]+A[i+1];
      A[i+1]=0;
    }
    else(B[i]<=A[i]){
      count+=B[i];
    }
  }
  cout<<count<<endl;
}#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
 
void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}
 
int main(){
  ll N;
  cin>>N;
  ll A[100010];
  ll B[100010];
  
  rep(i,N+1){
    cin>>A[i];
  }
  rep(i,N){
    cin>>B[i];
  }
  
  ll count=0;
  
  rep(i,N){
    if((A[i]+A[i+1])>=B[i]&&B[i]>A[i]){
      count+=B[i];
      A[i+1]=A[i+1]+A[i]-B[i];
    }
    else if(B[i]>(A[i]+A[i+1])){
      count+=A[i]+A[i+1];
      A[i+1]=0;
    }
    else(B[i]<=A[i]){
      count+=B[i];
    }
  }
  cout<<count<<endl;
}

Compiler output:
a.cc:82:2: error: stray '#' in program
   82 | }#include<iostream>
      |  ^
a.cc: In function 'int main()':
a.cc:77:21: error: expected ';' before '{' token
   77 |     else(B[i]<=A[i]){
      |                     ^
      |                     ;
a.cc: At global scope:
a.cc:82:3: error: 'include' does not name a type
   82 | }#include<iostream>
      |   ^~~~~~~
a.cc:103:10: error: redefinition of 'const ll mod'
  103 | const ll mod = 1000000007;
      |          ^~~
a.cc:22:10: note: 'const ll mod' previously defined here
   22 | const ll mod = 1000000007;
      |          ^~~
a.cc:105:10: error: redefinition of 'const ll INF'
  105 | const ll INF = 1e+14;
      |          ^~~
a.cc:24:10: note: 'const ll INF' previously defined here
   24 | const ll INF = 1e+14;
      |          ^~~
a.cc:115:10: error: redefinition of 'const ld eps'
  115 | const ld eps = 1e-8;
      |          ^~~
a.cc:34:10: note: 'const ld eps' previously defined here
   34 | const ld eps = 1e-8;
      |          ^~~
a.cc:116:10: error: redefinition of 'const ld pi'
  116 | const ld pi = acos(-1.0);
      |          ^~
a.cc:35:10: note: 'const ld pi' previously defined here
   35 | const ld pi = acos(-1.0);
      |          ^~
a.cc:124:6: error: redefinition of 'void Yes()'
  124 | void Yes(){
      |      ^~~
a.cc:43:6: note: 'void Yes()' previously defined here
   43 | void Yes(){
      |      ^~~
a.cc:129:6: error: redefinition of 'void No()'
  129 | void No(){
      |      ^~
a.cc:48:6: note: 'void No()' previously defined here
   48 | void No(){
      |      ^~
a.cc:134:5: error: redefinition of 'int main()'
  134 | int main(){
      |     ^~~~
a.cc:53:5: note: 'int main()' previously defined here
   53 | int main(){
      |     ^~~~
a.cc: In function 'int main()':
a.cc:158:21: error: expected ';' before '{' token
  158 |     else(B[i]<=A[i]){
      |                     ^
      |                     ;