Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
typedef long long ll

using namespace std;

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

  ll ans = 0;
  ll tmp = min(A.at(0), B.at(0));
  A.at(0) -= tmp;
  B.at(0) -= tmp;
  ans += tmp;
  for(int i = 1; i < N+1; i++){
    tmp = min(A.at(i), B.at(i-1));
    A.at(i) -= tmp;
    B.at(i-1) -= tmp;
    ans += tmp;
    tmp = min(A.at(i), B.at(i));
    A.at(i) -= tmp;
    B.at(i) -= tmp;
    ans += tmp;
  }
  cout << ans << endl;
}


Compiler output:
a.cc:7:1: error: expected initializer before 'using'
    7 | using namespace std;
      | ^~~~~
a.cc: In function 'int main()':
a.cc:11:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   11 |   cin >> N;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:12:3: error: 'vector' was not declared in this scope
   12 |   vector<ll> A(N+1);
      |   ^~~~~~
a.cc:12:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:12:10: error: 'll' was not declared in this scope
   12 |   vector<ll> A(N+1);
      |          ^~
a.cc:12:14: error: 'A' was not declared in this scope
   12 |   vector<ll> A(N+1);
      |              ^
a.cc:13:14: error: 'B' was not declared in this scope
   13 |   vector<ll> B(N+1);
      |              ^
a.cc:21:5: error: expected ';' before 'ans'
   21 |   ll ans = 0;
      |     ^~~~
      |     ;
a.cc:22:5: error: expected ';' before 'tmp'
   22 |   ll tmp = min(A.at(0), B.at(0));
      |     ^~~~
      |     ;
a.cc:23:14: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   23 |   A.at(0) -= tmp;
      |              ^~~
      |              tm
a.cc:25:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |   ans += tmp;
      |   ^~~
      |   abs
a.cc:27:11: error: 'min' was not declared in this scope; did you mean 'std::min'?
   27 |     tmp = min(A.at(i), B.at(i-1));
      |           ^~~
      |           std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:36:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   36 |   cout << ans << endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:36:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   36 |   cout << ans << endl;
      |                  ^~~~
      |                  std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~