Language: C++

int main()
{
	int N,n;
	std::vector<int> A,B,C;
	long total=0;
    std::cin>>N;

	A.resize(N);
	B.resize(N);
	C.resize(N-1);

	for (int i = 0; i < N; i++)
	{
		std::cin >> n;

		A.at(i) = n;
	}

	for (int i = 0; i < N; i++)
	{
		std::cin >> n;

		B.at(i) = n;
	}
	
	for (int i = 0; i < N-1; i++)
	{
		std::cin >> n;

		C.at(i) = n;
	}

	for (size_t i = 0; i < N-1; i++)
	{

		
		total += B.at(i);

		if (A.at(i) + 1 == A.at(i+1))
		{
			total += C.at(i);
		}
	}

	std::cout << total + B.at(A.at(N-1)) << std::endl;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:14: error: 'vector' is not a member of 'std'
    4 |         std::vector<int> A,B,C;
      |              ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | int main()
a.cc:4:21: error: expected primary-expression before 'int'
    4 |         std::vector<int> A,B,C;
      |                     ^~~
a.cc:6:10: error: 'cin' is not a member of 'std'
    6 |     std::cin>>N;
      |          ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | int main()
a.cc:8:9: error: 'A' was not declared in this scope
    8 |         A.resize(N);
      |         ^
a.cc:9:9: error: 'B' was not declared in this scope
    9 |         B.resize(N);
      |         ^
a.cc:10:9: error: 'C' was not declared in this scope
   10 |         C.resize(N-1);
      |         ^
a.cc:14:22: error: 'cin' is not a member of 'std'
   14 |                 std::cin >> n;
      |                      ^~~
a.cc:14:22: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:22: error: 'cin' is not a member of 'std'
   21 |                 std::cin >> n;
      |                      ^~~
a.cc:21:22: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:28:22: error: 'cin' is not a member of 'std'
   28 |                 std::cin >> n;
      |                      ^~~
a.cc:28:22: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:33:14: error: 'size_t' was not declared in this scope
   33 |         for (size_t i = 0; i < N-1; i++)
      |              ^~~~~~
a.cc:1:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | int main()
a.cc:33:28: error: 'i' was not declared in this scope
   33 |         for (size_t i = 0; i < N-1; i++)
      |                            ^
a.cc:45:14: error: 'cout' is not a member of 'std'
   45 |         std::cout << total + B.at(A.at(N-1)) << std::endl;
      |              ^~~~
a.cc:45:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:45:54: error: 'endl' is not a member of 'std'
   45 |         std::cout << total + B.at(A.at(N-1)) << std::endl;
      |                                                      ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | int main()