Language: C++

#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stderr, stdin, stdout, BufWriter, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::{i64, u64, usize};
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; ( $ next : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , [ $ t : tt ] ) => { { let len = read_value ! ( $ next , usize ) ; ( 0 .. len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , bytes ) => { read_value ! ( $ next , String ) . into_bytes ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
#[allow(dead_code)]
struct Writer {
    s: String,
}
#[allow(unused_imports)]
use std::fmt::Display;
#[allow(dead_code)]
#[doc = " let mut writer = Writer::new();"]
#[doc = " writer.writeln(hoge);"]
#[doc = " writer.flush()"]
impl Writer {
    #[allow(dead_code)]
    pub fn new() -> Writer {
        Writer { s: String::new() }
    }
    #[allow(dead_code)]
    pub fn flush(&mut self) {
        print!("{}", self.s);
        self.s.clear();
    }
    pub fn write<T: Display>(&mut self, x: T) {
        self.s.push_str(&format!("{}", x));
    }
    pub fn writeln<T: Display>(&mut self, x: T) {
        self.s.push_str(&format!("{}", x));
        self.s.push('\n');
    }
    #[allow(dead_code)]
    pub fn write_vec<T: Display>(&mut self, xs: &Vec<T>) {
        if xs.len() == 0 {
            self.writeln("");
            return;
        }
        self.write(&format!("{}", xs[0]));
        for i in 1..xs.len() {
            self.write(&format!(" {}", xs[i]));
        }
        self.writeln("");
    }
}
#[allow(unused_macros)]
macro_rules ! dbg { ( $ ( $ a : expr ) ,* ) => { writeln ! ( & mut stderr ( ) , concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) . unwrap ( ) ; } }
#[allow(dead_code)]
const INF_U: u64 = 1_000_000_000_000_000;
#[allow(dead_code)]
const INF_I: i64 = 1_000_000_000_000_000;
#[allow(non_snake_case)]
#[allow(dead_code)]
fn main() {
    input! {
        n: usize,
        a: [u64; n+1],
        b: [u64; n]
    }
    let mut ans = 0;
    let mut a = a;
    let mut b = b;
    for i in 0..n {
        if a[i] >= b[i] {
            ans += b[i];
            a[i] -= b[i];
        } else {
            ans += a[i];
            b[i] -= a[i];
            if a[i+1] >= b[i] {
                ans += b[i];
                a[i+1] -= b[i];
            } else {
                ans += a[i+1];
                a[i+1] = 0;
            }
        }
    }
    println!("{}", ans);
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #[
    1 | #[allow(unused_imports)]
      |  ^
a.cc:3:2: error: invalid preprocessing directive #[
    3 | #[allow(unused_imports)]
      |  ^
a.cc:5:2: error: invalid preprocessing directive #[
    5 | #[allow(unused_imports)]
      |  ^
a.cc:7:2: error: invalid preprocessing directive #[
    7 | #[allow(unused_imports)]
      |  ^
a.cc:9:2: error: invalid preprocessing directive #[
    9 | #[allow(unused_imports)]
      |  ^
a.cc:11:2: error: invalid preprocessing directive #[
   11 | #[allow(unused_macros)]
      |  ^
a.cc:13:2: error: invalid preprocessing directive #[
   13 | #[allow(unused_macros)]
      |  ^
a.cc:15:2: error: invalid preprocessing directive #[
   15 | #[allow(unused_macros)]
      |  ^
a.cc:17:2: error: invalid preprocessing directive #[
   17 | #[allow(dead_code)]
      |  ^
a.cc:21:2: error: invalid preprocessing directive #[
   21 | #[allow(unused_imports)]
      |  ^
a.cc:23:2: error: invalid preprocessing directive #[
   23 | #[allow(dead_code)]
      |  ^
a.cc:24:2: error: invalid preprocessing directive #[
   24 | #[doc = " let mut writer = Writer::new();"]
      |  ^
a.cc:25:2: error: invalid preprocessing directive #[
   25 | #[doc = " writer.writeln(hoge);"]
      |  ^
a.cc:26:2: error: invalid preprocessing directive #[
   26 | #[doc = " writer.flush()"]
      |  ^
a.cc:28:6: error: invalid preprocessing directive #[
   28 |     #[allow(dead_code)]
      |      ^
a.cc:32:6: error: invalid preprocessing directive #[
   32 |     #[allow(dead_code)]
      |      ^
a.cc:44:6: error: invalid preprocessing directive #[
   44 |     #[allow(dead_code)]
      |      ^
a.cc:51:18: error: too many decimal points in number
   51 |         for i in 1..xs.len() {
      |                  ^~~~~~~~~
a.cc:57:2: error: invalid preprocessing directive #[
   57 | #[allow(unused_macros)]
      |  ^
a.cc:59:2: error: invalid preprocessing directive #[
   59 | #[allow(dead_code)]
      |  ^
a.cc:61:2: error: invalid preprocessing directive #[
   61 | #[allow(dead_code)]
      |  ^
a.cc:63:2: error: invalid preprocessing directive #[
   63 | #[allow(non_snake_case)]
      |  ^
a.cc:64:2: error: invalid preprocessing directive #[
   64 | #[allow(dead_code)]
      |  ^
a.cc:74:14: error: too many decimal points in number
   74 |     for i in 0..n {
      |              ^~~~
a.cc:2:1: error: 'use' does not name a type
    2 | use std::cmp::{max, min, Ordering};
      | ^~~
a.cc:4:1: error: 'use' does not name a type
    4 | use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
      | ^~~
a.cc:6:1: error: 'use' does not name a type
    6 | use std::io::{stderr, stdin, stdout, BufWriter, StdoutLock, Write};
      | ^~~
a.cc:8:1: error: 'use' does not name a type
    8 | use std::iter::FromIterator;
      | ^~~
a.cc:10:1: error: 'use' does not name a type
   10 | use std::{i64, u64, usize};
      | ^~~
a.cc:12:1: error: 'macro_rules' does not name a type
   12 | macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
      | ^~~~~~~~~~~
a.cc:14:1: error: 'macro_rules' does not name a type
   14 | macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; ( $ next : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
      | ^~~~~~~~~~~
a.cc:16:1: error: 'macro_rules' does not name a type
   16 | macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , [ $ t : tt ] ) => { { let len = read_value ! ( $ next , usize ) ; ( 0 .. len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , bytes ) => { read_value ! ( $ next , String ) . into_bytes ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
      | ^~~~~~~~~~~
a.cc:19:5: error: 's' does not name a type
   19 |     s: String,
      |     ^
a.cc:22:5: error: expected initializer before 'std'
   22 | use std::fmt::Display;
      |     ^~~
a.cc:27:1: error: 'impl' does not name a type
   27 | impl Writer {
      | ^~~~
a.cc:58:1: error: 'macro_rules' does not name a type
   58 | macro_rules ! dbg { ( $ ( $ a : expr ) ,* ) => { writeln ! ( & mut stderr ( ) , concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) . unwrap ( ) ; } }
      | ^~~~~~~~~~~
a.cc:60:12: error: found ':' in nested-name-specifier, expected '::'
   60 | const INF_U: u64 = 1_000_000_000_000_000;
      |            ^
      |            ::
a.cc:60:7: error: 'INF_U' does not name a type
   60 | const INF_U: u64 = 1_000_000_000_000_000;
      |       ^~~~~
a.cc:62:12: error: found ':' in nested-name-specifier, expected '::'
   62 | const INF_I: i64 = 1_000_000_000_000_000;
      |            ^
      |            ::
a.cc:62:7: error: 'INF_I' does not name a type
   62 | const INF_I: i64 = 1_000_000_000_000_000;
      |       ^~~~~
a.cc:65:1: error: 'fn' does not name a type
   65 | fn main() {
      | ^~