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

#include <bits/stdc++.h>

#define endl '\n'
#define PB push_back
#define PF push_front
#define MP make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

const int INF = 1e9 + 7;
const ll LINF = 1e18 + 14;

int main(){
    ios_base::sync_with_stdio(false); //cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++){
        cin >> v[i];
    }
    int sum = 0;
    for (int i = 0; i < n; i++){
        int b;
        cin >> b;
        sum += b;
    }
    for (int i = 0; i < n; i++){
        int c;
        cin >> c;
        if (i > 0 && v[i-1] = v[i] + 1)
            sum ++ c;
    }
    cout << sum;
    return 0;
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:41:19: error: lvalue required as left operand of assignment
   41 |         if (i > 0 && v[i-1] = v[i] + 1)
a.cc:42:19: error: expected ';' before 'c'
   42 |             sum ++ c;
      |                   ^~
      |                   ;
Language: C++

#include <iostream>
using namespace std;

int main(){
  int N;
  cin >> N
  int data[3][N];
  
  for(int i=0;i<3;i++){
    for(int j=0;j<N;j++){
      cin >>data[i][j];
    }
  }
  
  int count = 0;
  for (int k=0;k<N;k++){
  count += data[1][k];
    if(data[0][k] + 1 == data[0][k+1]){
      count += data[2][k];
    }
  }
  return 0;
}

  

Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: expected ';' before 'int'
    6 |   cin >> N
      |           ^
      |           ;
    7 |   int data[3][N];
      |   ~~~      
a.cc:11:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   11 |       cin >>data[i][j];
      |                 ^
a.cc:17:16: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   17 |   count += data[1][k];
      |                ^
a.cc:18:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   18 |     if(data[0][k] + 1 == data[0][k+1]){
      |            ^
a.cc:18:30: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   18 |     if(data[0][k] + 1 == data[0][k+1]){
      |                              ^
a.cc:19:20: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   19 |       count += data[2][k];
      |                    ^
Language: C++

#include <iostream>
using namespace std;

int main(){
  int N;
  cin >> N;
  int data [3][N];
  for (int i = 0;i < 3; i++){
    for (int j = 0;j < N; j++){
        cin >> data.at(i).at(j);
    }
  }
  
  int count = 0;
  for (int l = 0;l < N; l++){
    count += data[1][data[0][l]];
    if (data[0][data[0][l]] == data[0][data[0][l+1]]){
      count += data[2][l];
    }
  }
  cout << count << endl;
}

    

Compiler output:
a.cc: In function 'int main()':
a.cc:10:21: error: request for member 'at' in 'data', which is of non-class type 'int [3][N]'
   10 |         cin >> data.at(i).at(j);
      |                     ^~
Language: C

#include <iostream>
using namespace std;

int main (){
    int n;
    cin >> n;
    int i;
    int a[n],c[n-1];
    for(i=0;i<n;i++){
        cin >> a[i];
        
    }
    int x,y=0;
    for(i=0;i<n;i++){
        cin >> x;
        y+=x;
        
    }
    for(i=0;i<n-1;i++){
        cin>>c[i];
        
    }
    for(i=1;i<n;i++){
        x=a[i]-a[i-1];
         if(x == 1){
            x=a[i-1]-1;
            y+=c[x];
        }
    }
    cout << y;
    return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:28:18: error: expected '}' at end of input
   28 |         return 0;
      |                  ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

open System

let n = stdin.ReadLine() |> int
let a = stdin.ReadLine().Split(' ') |> Array.map int
let b = stdin.ReadLine().Split(' ') |> Array.map int
let c = stdin.ReadLine().Split(' ') |> Array.map int

let x = Array.sum b

(
 [1..(n-1)]
 |>List.sumBy (fun x -> if a.[x-1]+1=a.[x] then c.[a.[x-1]-1] else 0)
)
+ x
|>stdout.WriteLine

Compiler output:
a.cc:11:3: error: too many decimal points in number
   11 |  [1..(n-1)]
      |   ^~~
a.cc:1:1: error: 'open' does not name a type
    1 | open System
      | ^~~~
Language: C++

#include<iostream>

using namespace std;

int main() {
  int N,i;
  int a[20] = {0};
  int temp;
  int c[20] = {0};
  int sum = 0;
  int before=21;

  cin >> N;
  for (i=0;i<N;i++){
    cin >> a[i];
  }
  
  for (i=0;i<N;i++){
    cin >> temp;
    sum += temp
  }
  
  for (i =0;i<N;i++){
    cin >> c[i];
  }
  temp = a[0]; 
  for (i=1;i<N;i++){
    if (a[i] -temp == 1) {
      sum += c[a[i]-1];
    }
    temp = a[i];
  }
  
  cout << sum;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:16: error: expected ';' before '}' token
   20 |     sum += temp
      |                ^
      |                ;
   21 |   }
      |   ~
Language: C++

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

int main() {
  int n;
  cin >> n;
  
  vector<int> a(n);
  cin >> a.at(i);
  
  vector<int> b(n);
  cin >> b.at(i);
  
  vector<int> c(n-1);
  cin >> c.at(i);
  
  int res = a[0];
  
  for (int i=1; i<n; i++){
    res += b.at(a[i]-1);
    if (a[i-1] == a[i]+1){
      res += c.at(i-1);
    }
  }
  
  cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: 'i' was not declared in this scope
    9 |   cin >> a.at(i);
      |               ^
Language: C++

#include<iostream>
#include<vector>

int main(void){
  int N;
  std::vector<int> A, B, C;
  std::cin >> N;
  for(size_t i =0; i<N;i++ ){
  	int tmp << std::cin;
    A.push_back(tmp);
  }
  
  for(size_t i =0; i<N;i++ ){
  	int tmp << std::cin;
    B.push_back(tmp);
  }
  for(size_t i =0; i<N-1;i++ ){
  	int tmp << std::cin;
    C.push_back(tmp);
  }
  int manzoku=0;
  for(size_t i=0; i<N; i++){
  	manzoku +=B[A[i]];
    if(i>1 && A[i]==A[i-1] + 1) {
    	manzoku += C[i-1];
    }
  }
  
  std::cout<<manzoku;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: expected initializer before '<<' token
    9 |         int tmp << std::cin;
      |                 ^~
a.cc:10:17: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   10 |     A.push_back(tmp);
      |                 ^~~
      |                 tm
a.cc:14:17: error: expected initializer before '<<' token
   14 |         int tmp << std::cin;
      |                 ^~
a.cc:15:17: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   15 |     B.push_back(tmp);
      |                 ^~~
      |                 tm
a.cc:18:17: error: expected initializer before '<<' token
   18 |         int tmp << std::cin;
      |                 ^~
a.cc:19:17: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   19 |     C.push_back(tmp);
      |                 ^~~
      |                 tm
Language: C

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,j,sum;
    cin>>n;
    int a[n],b[n],c[n];
    for(i=1; i<=n; i++)
        cin>>a[i];
    for(i=1; i<=n; i++)
        cin>>b[i];
    for(i=1; i<n; i++)
        cin>>c[i];
    sum=b[a[1]];
    for(i=2; i<=n; i++)
    {
        if(a[i]>a[i-1] && (a[i]-a[i-1])==1)

            sum+=b[a[i]]+c[a[i-1]];
             else
                 sum+=b[a[i]];
    }
    cout<<sum<<endl;
    return 0;

}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<stdio.h>
int main() {
  int  i,j,num,sum,crt;
  scanf("%d",&num);
  int dish[3][num];
  for(i=0;i<num;i++){
    for(j=0;j<num;i++){
      if(i==2&&j==3) break;
      scanf("%d",&dish[i][j];
    }
  }

  sum = 0;
  for(i=0;i<num;i++){
    crt = dish[0][i]
    sum += dish[1][crt];
    if(i>1&&dish[0][crt-1]==dish[0][crt]-1)
      sum += dish[2][crt-1];
  }
  printf("%d",sum);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:29: error: expected ')' before ';' token
    9 |       scanf("%d",&dish[i][j];
      |            ~                ^
      |                             )
a.cc:15:21: error: expected ';' before 'sum'
   15 |     crt = dish[0][i]
      |                     ^
      |                     ;
   16 |     sum += dish[1][crt];
      |     ~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N),B(N),C(N-1);
  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-1;i++){
    cin >> C[i];
   }
  int cnt=0;
  for(int i=0;i<N;i++){
    cnt += B[A[i]];
    if(i>0 && A[i]==A[i-1]+1){
      cnt += C[A[i-1]];
    }
  }
  cout << cnt << endl
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:22: error: expected ';' before '}' token
   23 |   cout << cnt << endl
      |                      ^
      |                      ;
   24 | }
      | ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin>>n;
  vector<int> flow(n);
  for(int i=0;i<n;i++){
    cin>>flow.at(i);
  }
  vector<int  base(n);
  int sum = 0;
  for(int i=0;i<n;i++){
    cin>>base.at(i);
    sum+=base.at(i);
  }
  vector<int> omake(n-1);
  for(int i=0;i<n;i++){
    cin>>omake.at(i);
  }
  for(int i=0;i<n;i++){
    if(flow.at(i) +1 == flow.at(i+1))
    sum+=omake.at(flow.at(i));
  }
  cout<< sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: template argument 1 is invalid
    9 |   vector<int  base(n);
      |                     ^
a.cc:9:21: error: template argument 2 is invalid
a.cc:12:10: error: 'base' was not declared in this scope
   12 |     cin>>base.at(i);
      |          ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin>>n;
	vector<int> flow(n);
  	for(int i=0;i<n;i++){
  		cin>>frow.at(i);
    }
  	int b = 0;
    int sum = 0;
  	for(int i=0;i<n;i++){
      	cin>>b;
		sum+=b;
    }
    vector<int> omake(n-1);
  	for(int i=0;i<n;i++){
      cin>>omake.at(i);
      if(flow.at(i) +1 ==flow.at(i+1))
        sum+=omake.at(flow.at(i));
    }
  	cout<< sum << endl;
}
    	
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:22: error: 'frow' was not declared in this scope; did you mean 'flow'?
    7 |                 cin>>frow.at(i);
      |                      ^~~~
      |                      flow
a.cc: At global scope:
a.cc:24:5: error: expected declaration before '}' token
   24 |     }
      |     ^
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define MAX_N 10000000
#define MAX_M 10000000
#define ll longlong
using namespace std;

int main() {
  //入力
  int n; cin>>n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n-1);
  rep(i,n) cin>>a[i];
  rep(i,n) cin>>b[i];
  rep(i,n-1) cin>>c[i];

  int count=0,before=100;
  rep(i,n) {
    count+=b[i];
    if(before+1=a[i]) {
      count+=c[before];
    }
    before=a[i];
  }
  cout<<count<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:14: error: lvalue required as left operand of assignment
   21 |     if(before+1=a[i]) {
      |        ~~~~~~^~
Language: C++

#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    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++) {
        cin >> c[i];
    }
    int ans = b[a[0]];
    for (int i = 1; i < n; i++) {
        ans += b[a[i]];
        if (a[i - 1] + 1 == a[i]) {
            ans += c[a[i - 1]];
        }        
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector<int> a(n), b(n), c(n);
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | 
a.cc:9:12: error: expected primary-expression before 'int'
    9 |     vector<int> a(n), b(n), c(n);
      |            ^~~
a.cc:11:16: error: 'a' was not declared in this scope
   11 |         cin >> a[i];
      |                ^
a.cc:14:16: error: 'b' was not declared in this scope
   14 |         cin >> b[i];
      |                ^
a.cc:17:16: error: 'c' was not declared in this scope
   17 |         cin >> c[i];
      |                ^
a.cc:19:15: error: 'b' was not declared in this scope
   19 |     int ans = b[a[0]];
      |               ^
a.cc:19:17: error: 'a' was not declared in this scope
   19 |     int ans = b[a[0]];
      |                 ^
a.cc:23:20: error: 'c' was not declared in this scope
   23 |             ans += c[a[i - 1]];
      |                    ^
Language: C

#include <stdio.h>
#include <stdlib.h>

int main(){
    int n, i, sum = 0;
    int *a, *b, *c;
    scanf("%d", &n);
    a = (int *)malloc(n * sizeof(int));
    b = (int *)malloc(n * sizeof(int));
    c = (int *)malloc((n - 1) * sizeof(int));
    for(i = 0; i < n, i++){
        scanf("%d", &a[i]);
    };
    for(i = 0; i < n, i++){
        scanf("%d", &b[i]);
    };
    for(i = 0; i < (n - 1), i++){
        scanf("%d", &c[i]);
    };
    sum += b[a[0]];
    for(i = 1; i < n; i++){
        sum += b[a[i]];
        if(a[i] - a[i - 1] == 1){
            sum += c[i - 1];
        }
    }
    printf("%d", sum);
}

Compiler output:
main.c: In function 'main':
main.c:11:26: error: expected ';' before ')' token
   11 |     for(i = 0; i < n, i++){
      |                          ^
      |                          ;
main.c:14:26: error: expected ';' before ')' token
   14 |     for(i = 0; i < n, i++){
      |                          ^
      |                          ;
main.c:17:32: error: expected ';' before ')' token
   17 |     for(i = 0; i < (n - 1), i++){
      |                                ^
      |                                ;
Language: C++

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

int main() {
  int N;
  cin >> N;
  
  vector<int> A(N), B(N), C(N - 1);
  for (int i = 0; i < N; i++) {
    cin >> A(i);
    cin >> B(i);
  }
  for (int i = 0; i < N - 1; i++) {
    cin >> C(i);
  }
  
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += B.at(A.at(i));
    if (i >= 1 && (A.at(i) - A.at(i - 1) == 1)) {
      ans += C.at(A.at(i - 1));
    }
  }
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: no match for call to '(std::vector<int>) (int&)'
   10 |     cin >> A(i);
      |            ~^~~
a.cc:11:13: error: no match for call to '(std::vector<int>) (int&)'
   11 |     cin >> B(i);
      |            ~^~~
a.cc:14:13: error: no match for call to '(std::vector<int>) (int&)'
   14 |     cin >> C(i);
      |            ~^~~
Language: C++

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

int main() {
  int N; cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N - 1);
  int sati = 0;
  
  for (i = 0; i < N; i++) {
    cin >> A.at(i);
    A.at(i)--;
  }
  for (i = 0; i < N; i++) {
    cin >> B.at(i);
  }
  for (i = 0; i < N - 1; i++) {
    cin >> C.at(i);
  }
  for (i = 0; i < N; i++) {
    sati += B.at(A.at(i));
    if (i < N - 1 && A.at(i) + 1 == A.at(i + 1)) {
      sati += C.at(A.at(i));
    }
  }
  cout << sati << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:8: error: 'i' was not declared in this scope
   11 |   for (i = 0; i < N; i++) {
      |        ^
a.cc:15:8: error: 'i' was not declared in this scope
   15 |   for (i = 0; i < N; i++) {
      |        ^
a.cc:18:8: error: 'i' was not declared in this scope
   18 |   for (i = 0; i < N - 1; i++) {
      |        ^
a.cc:21:8: error: 'i' was not declared in this scope
   21 |   for (i = 0; i < N; i++) {
      |        ^
Language: C++

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

int main() {
  int N;
  int point;
  int sati = 0;
  vector<int> order;
  vector<int> addi;
  
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> order.at(i);
  }
  for (int i = 0; i < N; i++) {
    cin >> point;
    sati += point;
  }
  for (int i = 0; i < N - 1; i++) {
    cin >> addi.(i);
  }
  for (int i = 0; i < N - 1; i++) {
    if (order.at(i) + 1 == order.at(i + 1)) {
      sati += addi.at(i);
    }
  }
}
    
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: expected unqualified-id before '(' token
   20 |     cin >> addi.(i);
      |                 ^
Language: C++

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

int main() {
  int N;
  int point;
  int sati = 0;
  vector<int> order;
  vector<int> addi;
  
  cin >> N;
  for (i = 0; i < N; i++) {
    cin >> order.at(i);
  }
  for (i = 0; i < N; i++) {
    cin >> point;
    sati += point;
  }
  for (i = 0; i < N - 1; i++) {
    cin >> addi.(i);
  }
  for (i = 0; i < N - 1; i++) {
    if (order.at(i) + 1 == order.at(i + 1)) {
      sati += addi.at(i);
    }
  }
}
    
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: 'i' was not declared in this scope
   12 |   for (i = 0; i < N; i++) {
      |        ^
a.cc:15:8: error: 'i' was not declared in this scope
   15 |   for (i = 0; i < N; i++) {
      |        ^
a.cc:19:8: error: 'i' was not declared in this scope
   19 |   for (i = 0; i < N - 1; i++) {
      |        ^
a.cc:20:17: error: expected unqualified-id before '(' token
   20 |     cin >> addi.(i);
      |                 ^
a.cc:22:8: error: 'i' was not declared in this scope
   22 |   for (i = 0; i < N - 1; i++) {
      |        ^
Language: C++

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

int main(){
  int n;
  cin >> n;
  
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n-1);
  
  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-1;i++) cin >> c[i];
  
  int sum =0;
  
  for(int i=0;i<n;i++){
    sum +=b[a[i]];
  }
  for(int i=0;i<n-1;i++){
    if(a[i]+1==a[i+1]) sum += c[i];
  }
  
  cout << ans << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C

#include<stdio.h>
int mai(void)
{
  int n[20][20],i,n;
  scanf(%d%,&n[0][0]);
  for(i=0;i<n[0][0];i++)
  {
    scanf(%d%,&n[1][i]);
  }
   for(i=0;i<n[0][0];i++)
  {
    scanf(%d%,&n[2][i]);
  }
    for(i=0;i<(n[0][0]-1);i++)
  {
    scanf(%d%,&n[3][i]);
  }
  

Compiler output:
main.c: In function 'mai':
main.c:4:19: error: conflicting types for 'n'; have 'int'
    4 |   int n[20][20],i,n;
      |                   ^
main.c:4:7: note: previous declaration of 'n' with type 'int[20][20]'
    4 |   int n[20][20],i,n;
      |       ^
main.c:5:9: error: expected expression before '%' token
    5 |   scanf(%d%,&n[0][0]);
      |         ^
main.c:8:11: error: expected expression before '%' token
    8 |     scanf(%d%,&n[1][i]);
      |           ^
main.c:12:11: error: expected expression before '%' token
   12 |     scanf(%d%,&n[2][i]);
      |           ^
main.c:16:11: error: expected expression before '%' token
   16 |     scanf(%d%,&n[3][i]);
      |           ^
main.c:17:3: error: expected declaration or statement at end of input
   17 |   }
      |   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int>a(n+1)b(n+1);
  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-1;i++)cin>>c[i];
  int ans=0;
  for(int i=0;i<n;i++){
   ans+=b[a[i]];
    if(b[a[i]]+1==b[a[i+1]])ans+=c[i];
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:20: error: expected ',' or ';' before 'b'
    6 |   vector<int>a(n+1)b(n+1);
      |                    ^
a.cc:8:28: error: 'b' was not declared in this scope
    8 |   for(int i=0;i<n;i++)cin>>b[i];
      |                            ^
a.cc:9:30: error: 'c' was not declared in this scope
    9 |   for(int i=0;i<n-1;i++)cin>>c[i];
      |                              ^
a.cc:12:9: error: 'b' was not declared in this scope
   12 |    ans+=b[a[i]];
      |         ^
a.cc:13:34: error: 'c' was not declared in this scope
   13 |     if(b[a[i]]+1==b[a[i+1]])ans+=c[i];
      |                                  ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
  int n;
  cin >> n;
  
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n-1);
  
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  rep(i,n-1) cin >> c[i];
  
  rep(i,n) a[i]--;
  
  int ans = 0;
  
  rep(i,n){
    ans += b[a[i]];
  }
  rep(i,n-1){
    if(a[i]+1=a[i+1]) ans += c[i];
  }
  cout << ans << endl;
}
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:25:12: error: lvalue required as left operand of assignment
   25 |     if(a[i]+1=a[i+1]) ans += c[i];
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
  int n;
  cin >> n;
  
  vector<int> a(n);
  vectro<int> b(n);
  vector<int> c(n-1);
  
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  rep(i,n-1) cin >> c[i];
  
  rep(i,n) a[i]--;
  
  int ans = 0;
  
  rep(i,n){
    ans += b[a[i]];
  }
  rep(i,n-1){
    if(a[i]+1=a[i+1]) ans += c[i];
  }
  cout << ans << endl;
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'vectro' was not declared in this scope
   10 |   vectro<int> b(n);
      |   ^~~~~~
a.cc:10:10: error: expected primary-expression before 'int'
   10 |   vectro<int> b(n);
      |          ^~~
a.cc:14:19: error: 'b' was not declared in this scope
   14 |   rep(i,n) cin >> b[i];
      |                   ^
a.cc:22:12: error: 'b' was not declared in this scope
   22 |     ans += b[a[i]];
      |            ^
a.cc:25:12: error: lvalue required as left operand of assignment
   25 |     if(a[i]+1=a[i+1]) ans += c[i];
Language: C

#include<stdio.h>
int main(void){
  int i,N,A[21],B[21],C[20];
  int sum=0;
  sacnf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<N;i++){
    scanf("%d",&B[i]);
  }
  for(i=0;i<N-1;i++){
    scanf("%d",&C[i]);
  }
  for(i=0;i<N;i++){
    if(A[i+1]==A[i]+1)
      sum=sum+B[A[i]-1]+C[A[i]-1];
    else
      sum=sum+B[A[i]-1];
  }
  printf("%d",sum);
  return 0;
}
  
  


Compiler output:
main.c: In function 'main':
main.c:5:3: error: implicit declaration of function 'sacnf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    5 |   sacnf("%d",&N);
      |   ^~~~~
      |   scanf
Language: C

#include<stdio.h>
int main(void){
  int i,N,A[21],B[21],C[20];
  int sum=0;
  sacnf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<N;i++){
    scanf("%d",&B[i]);
  }
  for(i=0;i<N-1;i++){
    scanf("%d",&C[i]);
  }
  for(i=0;i<N;i++){
    if(A[i+1]==A[i]+1)
      sum=sum+B[A[i]]+C[A[i]];
    else
      sum=sum+B[A[i]];
  }
  printf("%d",sum);
  return 0;
}
  
  


Compiler output:
main.c: In function 'main':
main.c:5:3: error: implicit declaration of function 'sacnf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    5 |   sacnf("%d",&N);
      |   ^~~~~
      |   scanf
Language: C

#include<stdio.h>
int main(void){
  int i,N,A[21],B[21],C[20];
  int sum=0;
  sacnf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<N;i++){
    scanf("%d",&B[i]);
  }
  for(i=0;i<N-1;i++){
    scanf("%d",&c[i]);
  }
  for(i=0;i<N;i++){
    if(A[i+1]==A[i]+1)
      sum=sum+B[A[i]]+C[A[i]];
    else
      sum=sum+B[A[i]];
  }
  printf("%d",sum);
  return 0;
}
  
  

Compiler output:
main.c: In function 'main':
main.c:5:3: error: implicit declaration of function 'sacnf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    5 |   sacnf("%d",&N);
      |   ^~~~~
      |   scanf
main.c:13:17: error: 'c' undeclared (first use in this function)
   13 |     scanf("%d",&c[i]);
      |                 ^
main.c:13:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include "stdio.h"

int main()
{
	int N = 0;
	int A[21];
	int B[21];
	int C[21];
	int cnt;
	int sum = 0;


	printf("料理数\n");
	scanf_s("%d", &N);
	
	printf_s("料理品目\n");
	for (cnt = 0; cnt < N; cnt++) {
		scanf_s("%d", &A[cnt]);

	}
	printf_s("満足度\n");
	
	for (cnt = 0; cnt < N; cnt++) {
		scanf_s("%d", &B[cnt]);
	}
	printf_s("追加満足度\n");
	for (cnt = 0; cnt < N - 1; cnt++) {
		scanf_s("%d", &C[cnt]);
	}



	for (cnt = 1; cnt <= N; cnt++) {
		sum = sum + B[A[cnt - 1] - 1];
		if (cnt - 1 >= 1) {
			if (A[cnt - 2] == A[cnt - 1] - 1) {
				sum = sum + C[A[cnt - 1] - 2];
			}

		}
		
	}
	printf("%d", sum);
	return 0;

}


Compiler output:
main.c: In function 'main':
main.c:14:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   14 |         scanf_s("%d", &N);
      |         ^~~~~~~
      |         scanf
main.c:16:9: error: implicit declaration of function 'printf_s'; did you mean 'printf'? [-Wimplicit-function-declaration]
   16 |         printf_s("料理品目\n");
      |         ^~~~~~~~
      |         printf
Language: C++

#include <iostream>
using namespace std ;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: expected ';' before 'for'
    7 |   cin >> N
      |           ^
      |           ;
    8 | 
    9 |   for(int i=0;i<N;i++){
      |   ~~~      
a.cc:9:15: error: 'i' was not declared in this scope
    9 |   for(int i=0;i<N;i++){
      |               ^
Language: C

#include<stdio.h>
int main(void)
{
	int i,N,A[21],B[21],C[20];
	int sum=0;
	scanf("%d",&N);
	for(i=1;i<=N;i++)
	{
		scanf("%d",&A[i]);
	}
	for(i=1;i<=N;i++)
	{
		scanf("%d",&B[i]);
	}
	for(i=1;i<N;i++)
	{
		scanf("%d",&C[i]);
	}
	for(i=1;i<=N;i++)
	{
		if(A[i]==A[i+1]-1)
		sum=B[A[i]]+B[A[i+1]]C[A[i]]+sum;
		else
		sum=B[A[i]]+B[A[i]];
	}
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:22:38: error: expected ';' before 'C'
   22 |                 sum=B[A[i]]+B[A[i+1]]C[A[i]]+sum;
      |                                      ^
      |                                      ;
Language: C

#include <stdio.h>

int main(void) {
	int n; scanf("%d",&n);
	int ary[n]; for(int i=0; i<n; i++) scanf("%d",&ary[i]);
	int bry[n]; for(int i=0; i<n; i++) scanf("%d",&bry[i]);
	int cry[n]; for(int i=0; i<n; i++) scanf("%d",&cry[i]);
	int ex_dish = n;
	int satis = 0;
	for(int i=0; i<n; i++) {
		satis += b[a[i]];
		if (a[i] - 1 == ex_dish) {
			satis += c[ex_dish];
		}
		ex_dish = a[i];
	}
	printf("%d",satis);
	
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:11:26: error: 'b' undeclared (first use in this function)
   11 |                 satis += b[a[i]];
      |                          ^
main.c:11:26: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:28: error: 'a' undeclared (first use in this function)
   11 |                 satis += b[a[i]];
      |                            ^
main.c:13:34: error: 'c' undeclared (first use in this function)
   13 |                         satis += c[ex_dish];
      |                                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(int)(n); i++;)
int main() {
  int n;
  cin>>n;
  vector<int> a(n),b(n),c(n-1);
  rep(i,n){
    cin>>a.at(i);
  }
  rep(i,n){
    cin>>b.at(i);
  }
  rep(i,n-1){
    cin>>c.at(i);
  }
  int s=0;
  rep(i,n-1){
    s+=b.at(a.at(i)-1);
    if(a.at(i+1)==a.at(i)+1){
      s+=c.at(i);
    }
  }
  if(n==1){
    cout<<b.at(0);
    return 0;
  }
  else{
  cout<<s;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:46: error: expected ')' before ';' token
    3 | #define rep(i,n) for(int i=0; i<(int)(n); i++;)
      |                     ~                        ^
a.cc:8:3: note: in expansion of macro 'rep'
    8 |   rep(i,n){
      |   ^~~
a.cc:3:47: error: expected primary-expression before ')' token
    3 | #define rep(i,n) for(int i=0; i<(int)(n); i++;)
      |                                               ^
a.cc:8:3: note: in expansion of macro 'rep'
    8 |   rep(i,n){
      |   ^~~
a.cc:3:46: error: expected ')' before ';' token
    3 | #define rep(i,n) for(int i=0; i<(int)(n); i++;)
      |                     ~                        ^
a.cc:11:3: note: in expansion of macro 'rep'
   11 |   rep(i,n){
      |   ^~~
a.cc:3:47: error: expected primary-expression before ')' token
    3 | #define rep(i,n) for(int i=0; i<(int)(n); i++;)
      |                                               ^
a.cc:11:3: note: in expansion of macro 'rep'
   11 |   rep(i,n){
      |   ^~~
a.cc:3:46: error: expected ')' before ';' token
    3 | #define rep(i,n) for(int i=0; i<(int)(n); i++;)
      |                     ~                        ^
a.cc:14:3: note: in expansion of macro 'rep'
   14 |   rep(i,n-1){
      |   ^~~
a.cc:3:47: error: expected primary-expression before ')' token
    3 | #define rep(i,n) for(int i=0; i<(int)(n); i++;)
      |                                               ^
a.cc:14:3: note: in expansion of macro 'rep'
   14 |   rep(i,n-1){
      |   ^~~
a.cc:3:46: error: expected ')' before ';' token
    3 | #define rep(i,n) for(int i=0; i<(int)(n); i++;)
      |                     ~                        ^
a.cc:18:3: note: in expansion of macro 'rep'
   18 |   rep(i,n-1){
      |   ^~~
a.cc:3:47: error: expected primary-expression before ')' token
    3 | #define rep(i,n) for(int i=0; i<(int)(n); i++;)
      |                                               ^
a.cc:18:3: note: in expansion of macro 'rep'
   18 |   rep(i,n-1){
      |   ^~~
Language: C++

#include<iostream>
using namespace std;
int sum=0;
  int main()
{int n;
 int a[n];
 int b[n],c[n-1];
 cin>>n;
 cout<<"\n";
 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-1;i++)
   cin>>c[i];

 for (int i=0;i<n;i++)
 {  
    sum=sum+b[i];
 } 
 for (int i=1;i<n;i++)
   { if (a[i-1]+1==a[i])
      sum=sum+c[a[i-1]-1];
   
   else 
     continue;
 
 }
 
 
 cout<<sum;
 
 
 return 0;
 

Compiler output:
a.cc: In function 'int main()':
a.cc:34:11: error: expected '}' at end of input
   34 |  return 0;
      |           ^
a.cc:5:1: note: to match this '{'
    5 | {int n;
      | ^
Language: C++

#include<iostream>
using namespace std
  int main()
{int n;
 int a[n];
 int b[n],c[n-1];
 cin>>n;
 cout<<"\n";
 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-1;i++)
   cin>>c[i];
 int sum=0;
 for (int i=0;i<n;i++)
 { sum=sum+b[a[i]];
   if (i>=1 && a[i-1]+1==a[i])
    sum+=c[a[i-1]];
 
 }
 
 
 cout<<sum;
 
 
 return 0;
 
}

Compiler output:
a.cc:2:20: error: expected ';' before 'int'
    2 | using namespace std
      |                    ^
      |                    ;
    3 |   int main()
      |   ~~~
Language: C++

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

int main() {
  int n;

  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  
  for (int i=0; i<n; i++){
    cin >> a.at(i);
    a.at(i)--;
  }
  for (int i=0; i<n; i++){
    cin >> b.at(i);
  }
  for (int i=0; i<n-1; i++){
    cin >> c.at(i);
  }
  
  int sum=0;
  for (int i=0; i<n; i++){
    sum += b.at(a.at(i));
    if(i==0){
    }else if (a.at(i)==a.at(i-1)){
      sum += c.at(a.at(i-1))
    }
  }
  cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:29: error: expected ';' before '}' token
   28 |       sum += c.at(a.at(i-1))
      |                             ^
      |                             ;
   29 |     }
      |     ~
Language: C++

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

int main() {
  int n;

  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  
  for (int i=0; i<n; i++){
    cin >> a(i);
    a(i)--;
  }
  for (int i=0; i<n; i++){
    cin >> b(i);
  }
  for (int i=0; i<n-1; i++){
    cin >> c(i);
  }
  
  int sum=0;
  for (int i=0; i<n; i++){
    sum += b(a(i));
    if(i==0){
    }else if (a(i)==a(i-1)){
      sum += c(a(i-1))
    }
  }
  cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: no match for call to '(std::vector<int>) (int&)'
   13 |     cin >> a(i);
      |            ~^~~
a.cc:14:6: error: no match for call to '(std::vector<int>) (int&)'
   14 |     a(i)--;
      |     ~^~~
a.cc:17:13: error: no match for call to '(std::vector<int>) (int&)'
   17 |     cin >> b(i);
      |            ~^~~
a.cc:20:13: error: no match for call to '(std::vector<int>) (int&)'
   20 |     cin >> c(i);
      |            ~^~~
a.cc:25:15: error: no match for call to '(std::vector<int>) (int&)'
   25 |     sum += b(a(i));
      |              ~^~~
a.cc:27:16: error: no match for call to '(std::vector<int>) (int&)'
   27 |     }else if (a(i)==a(i-1)){
      |               ~^~~
a.cc:27:22: error: no match for call to '(std::vector<int>) (int)'
   27 |     }else if (a(i)==a(i-1)){
      |                     ~^~~~~
a.cc:28:17: error: no match for call to '(std::vector<int>) (int)'
   28 |       sum += c(a(i-1))
      |                ~^~~~~
Language: C++

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

int main() {
  int n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  
  cin >> n;
  for (int i=0; i<n; i++){
    cin >> a(i);
    a(i)--;
  }
  for (int i=0; i<n; i++){
    cin >> b(i);
  }
  for (int i=0; i<n-1; i++){
    cin >> c(i);
  }
  
  int sum=0;
  for (int i=0; i<n; i++){
    sum += b(a(i));
    if(i===0){
    }else if (a(i)==a(i-1)){
      sum += c(a(i-1))
    }
  }
  cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: no match for call to '(std::vector<int>) (int&)'
   12 |     cin >> a(i);
      |            ~^~~
a.cc:13:6: error: no match for call to '(std::vector<int>) (int&)'
   13 |     a(i)--;
      |     ~^~~
a.cc:16:13: error: no match for call to '(std::vector<int>) (int&)'
   16 |     cin >> b(i);
      |            ~^~~
a.cc:19:13: error: no match for call to '(std::vector<int>) (int&)'
   19 |     cin >> c(i);
      |            ~^~~
a.cc:24:15: error: no match for call to '(std::vector<int>) (int&)'
   24 |     sum += b(a(i));
      |              ~^~~
a.cc:25:11: error: expected primary-expression before '=' token
   25 |     if(i===0){
      |           ^
a.cc:26:16: error: no match for call to '(std::vector<int>) (int&)'
   26 |     }else if (a(i)==a(i-1)){
      |               ~^~~
a.cc:26:22: error: no match for call to '(std::vector<int>) (int)'
   26 |     }else if (a(i)==a(i-1)){
      |                     ~^~~~~
a.cc:27:17: error: no match for call to '(std::vector<int>) (int)'
   27 |       sum += c(a(i-1))
      |                ~^~~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;

int main(){
  int N,b;
  int sum=0;
  cin >> N;
  int A[N],B[N],C[N-1];
  
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  for(int i=0;i<N;i++){
    cin >> b;
    sum += b;
  }
  for(int i=0;i<N-1;i++){
    if(A[i]+1 == A[i+1]){
      sum += C[A[i]-1];
    }
  }
  cout << sum << '\n';
    

Compiler output:
a.cc: In function 'int main()':
a.cc:23:23: error: expected '}' at end of input
   23 |   cout << sum << '\n';
      |                       ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

N = int(input())

s0 = list(map(int,input().split()))

s1 = list(map(int,input().split()))

s2 = list(map(int,input().split()))

sum1 = sum(s1)

for i in range(N):
  if (s0[i]+1) == s0[i+1]:
    sum1 += s2[s0[i]-1]
  else :
    sum1=sum1

print(sum1)

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() {
intN;cin>>N;
// input
vector<int> A(N); for(inti=0;i<N;++i){
cin >> A[i];
--A[i]; }
vector<int> B(N); for(inti=0;i<N;++i){
cin >> B[i]; }
vector<int> C(N-1); for(inti=0;i<N;++i){
cin >> C[i]; }
// calc
intans=0; for(inti=0;i<N;++i){
ans += B[A[i]];
if (i > 0 && A[i] == A[i-1]+1) {
ans += C[A[i-1]]; }
}
// output
cout << ans << endl; }

Compiler output:
a.cc: In function 'int main()':
a.cc:4:1: error: 'intN' was not declared in this scope; did you mean 'int'?
    4 | intN;cin>>N;
      | ^~~~
      | int
a.cc:4:11: error: 'N' was not declared in this scope
    4 | intN;cin>>N;
      |           ^
a.cc:6:23: error: 'inti' was not declared in this scope; did you mean 'int'?
    6 | vector<int> A(N); for(inti=0;i<N;++i){
      |                       ^~~~
      |                       int
a.cc:6:30: error: 'i' was not declared in this scope
    6 | vector<int> A(N); for(inti=0;i<N;++i){
      |                              ^
a.cc:9:23: error: 'inti' was not declared in this scope; did you mean 'int'?
    9 | vector<int> B(N); for(inti=0;i<N;++i){
      |                       ^~~~
      |                       int
a.cc:9:30: error: 'i' was not declared in this scope
    9 | vector<int> B(N); for(inti=0;i<N;++i){
      |                              ^
a.cc:11:25: error: 'inti' was not declared in this scope; did you mean 'int'?
   11 | vector<int> C(N-1); for(inti=0;i<N;++i){
      |                         ^~~~
      |                         int
a.cc:11:32: error: 'i' was not declared in this scope
   11 | vector<int> C(N-1); for(inti=0;i<N;++i){
      |                                ^
a.cc:14:1: error: 'intans' was not declared in this scope
   14 | intans=0; for(inti=0;i<N;++i){
      | ^~~~~~
a.cc:14:15: error: 'inti' was not declared in this scope; did you mean 'int'?
   14 | intans=0; for(inti=0;i<N;++i){
      |               ^~~~
      |               int
a.cc:14:22: error: 'i' was not declared in this scope
   14 | intans=0; for(inti=0;i<N;++i){
      |                      ^
a.cc:15:1: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 | ans += B[A[i]];
      | ^~~
      | abs
a.cc:20:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 | cout << ans << endl; }
      |         ^~~
      |         abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector <int> A(N),B(N),C(N-1);
  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-1;i++){
    cin >> C[i];
  }
  int sum=0;
  for(int i=1; i<=N;i++){
    if(A[i]=A[i-1]+1){
      sum+=C[i-1];
    }
    else{
      sum+=B[A[i]]
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:19: error: expected ';' before '}' token
   22 |       sum+=B[A[i]]
      |                   ^
      |                   ;
   23 |     }
      |     ~
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main(void){
    int n,a[50],b[50],c[50],sum,ans,cnt;cin>>n;
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(i=0;i<n;i++){
        cin>>b[i];
        sum+=b[i];
    }
    for(i=0;i<n-1;i++){
        cin>>c[i];
    }
    
    for(i=0;i<n;i++){
        if(a[i+1]-a[i]==1){
            sum+=c[i];
        }
    }
    cout<<sum;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'i' was not declared in this scope
    6 |     for(i=0;i<n;i++){
      |         ^
a.cc:9:9: error: 'i' was not declared in this scope
    9 |     for(i=0;i<n;i++){
      |         ^
a.cc:13:9: error: 'i' was not declared in this scope
   13 |     for(i=0;i<n-1;i++){
      |         ^
a.cc:17:9: error: 'i' was not declared in this scope
   17 |     for(i=0;i<n;i++){
      |         ^
Language: Java

import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] food = new int[n];
        int[] man = new int[n];
        int[] com = new int[n-1];
        int sum = 0;
        for(int i = 0;i < n;i++){
            food[i] = sc.nextInt();
        }
        for(int i = 0;i < n;i++){
            man[i] = sc.nextInt();
            sum += man[i];
        }
        for(int i = 0;i < n-1;i++){
            com[i] = sc.nextInt();
        }

        for(int i = 1;i < n;i++){
            if(food[i-1] == food[i]-1)
            sum += com[a[food[i-1]]];
        }
        System.out.println(sum);
    }
}

Compiler output:
Main.java:24: error: cannot find symbol
            sum += com[a[food[i-1]]];
                       ^
  symbol:   variable a
  location: class Main
1 error
Language: C++

#include<iostream>
#include<vector>
#define for for(int i=1;i<=n;i++)
using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:18:7: error: expected primary-expression before 'int'
   18 |   for(int i=1;i<=n-1;i++){
      |       ^~~
a.cc:18:7: error: expected ')' before 'int'
   18 |   for(int i=1;i<=n-1;i++){
      |      ~^~~
      |       )
a.cc:18:15: error: 'i' was not declared in this scope
   18 |   for(int i=1;i<=n-1;i++){
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int i,a[51],b[51],c[51],n,ans;
int main(){
	cin>>n;
	for(i=1;i<=n;i++){
	    cin>>a[i];
 	}
	for(i=1;i<=n;++){
	    cin>>b[i];
 	}
 	for(i=1;i<n;++){
	    cin>>c[i];
 	}
	  
	for(i=1;i<=n;i++){
	    ans+=b[i];
	    if(i>0&&a[i]==a[i-1]+1){
	      	ans+=c[a[i-1]-1];
	    }
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:24: error: expected primary-expression before ')' token
    9 |         for(i=1;i<=n;++){
      |                        ^
a.cc:12:23: error: expected primary-expression before ')' token
   12 |         for(i=1;i<n;++){
      |                       ^
Language: C++

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

int main () {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N - 1);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < N; i++) {
    cin >> B.at(i);
  }
  for (int i = 0; i < N - 1; i++) {
    cin >> C.at(i);
  }
  int a;
  a = -1;
  int b;
  b = 0;
  int c;
  c = -1;
  for (int i = 0; i < N; i++) {
    a = a + 1;
    b = b + B.at(A.at(a));
    if (c + 1 = B.at(A.at(a))) {
      b = b + C.at(c);
    }
    c = b + B.at(A.at(a));
  }
  cout << b << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:11: error: lvalue required as left operand of assignment
   28 |     if (c + 1 = B.at(A.at(a))) {
      |         ~~^~~
Language: C++

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

int main () {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N - 1);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < N; i++) {
    cin >> B.at(i);
  }
  for (int i = 0; i < N - 1; i++) {
    cin >> C.at(i);
  }
  int a;
  a = -1;
  int b;
  b = 0;
  int c;
  c = -1;
  for (int i = 0; i < N; i++) {
    a = a + 1;
    b = b + B.at(A.at(a));
    if (c + 1 = b + B.at(A.at(a))) {
      b = b + C.at(c);
    }
    c = b + B.at(A.at(a));
  }
  cout << b << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:11: error: lvalue required as left operand of assignment
   28 |     if (c + 1 = b + B.at(A.at(a))) {
      |         ~~^~~
Language: C++

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

int main () {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N - 1);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < N; i++) {
    cin >> B.at(i);
  }
  for (int i = 0; i < N - 1; i++) {
    cin >> C.at(i);
  }
  int a;
  a = -1;
  int b;
  b = 0;
  int c;
  c = -1;
  for (int i = 0; i < N; i++) {
    a = a + 1;
    b = b + B.at(A.at(a));
    if (c + 1 =  b + B.at(A.at(a))) {
      b = b + C.at(c);
    }
    c = b + B.at(A.at(a));
  }
  cout << b << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:11: error: lvalue required as left operand of assignment
   28 |     if (c + 1 =  b + B.at(A.at(a))) {
      |         ~~^~~
Language: C++

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

int main () {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N - 1);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i)
  }
  for (int i = 0; i < N; i++) {
    cin >> B.at(i)
  }
  for (int i = 0; i < N - 1; i++) {
    cin >> C.at(i)
  }
  int a
  a = -1
  int b
  b = 0
  int c
  c = -1
  for (int i = 0; i < N; i++) {
    a = a + 1
    b = b + B.at(A.at(a))
    if (c + 1 =  b + B.at(A.at(a))) {
      b = b + C.at(c)
    }
    c = b + B.at(A.at(a))
  }
  cout << b << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:19: error: expected ';' before '}' token
   11 |     cin >> A.at(i)
      |                   ^
      |                   ;
   12 |   }
      |   ~                
a.cc:14:19: error: expected ';' before '}' token
   14 |     cin >> B.at(i)
      |                   ^
      |                   ;
   15 |   }
      |   ~                
a.cc:17:19: error: expected ';' before '}' token
   17 |     cin >> C.at(i)
      |                   ^
      |                   ;
   18 |   }
      |   ~                
a.cc:20:3: error: expected initializer before 'a'
   20 |   a = -1
      |   ^
a.cc:25:19: error: 'i' was not declared in this scope
   25 |   for (int i = 0; i < N; i++) {
      |                   ^
a.cc:33:11: error: 'b' was not declared in this scope
   33 |   cout << b << endl;
      |           ^
Language: C++

#include<iostream>
using namespace std ;

int main()
{
  int N ;  //N種類の料理
  int i ;   //食べた順番i
  int A[N],B[N],C[N-1] ;  /*A[i]...i番目に食べた料理
                            B[i]...料理iを食べたときの満足度
                            C[i]...料理iを食べたあとに料理i+1を食べると追加で獲得する満足度
                           */
  for(i=0;i<N;i++) cin>>A[i] ;
  for(i=0;i<N;i++) cin>>B[i] ;
  for(i=0;i<N-1;i++) cin>>C[i] ;
  
  int satis=0 ;  //満足度
  for(i=0;i<N;i++){
    satis+=B[A[i]] ;
    if(A[i]+1=A[i+1]) satis=C[A[i]] ;
  }
 
  cout<<satis<<endl ;
  
  return 0 ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: lvalue required as left operand of assignment
   19 |     if(A[i]+1=A[i+1]) satis=C[A[i]] ;
      |        ~~~~^~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'ielse' was not declared in this scope; did you mean 'sigrelse'?
   18 |     ielse
      |     ^~~~~
      |     sigrelse
Language: C

#include<stdio.h>
int main(void){
  int n,sum=0;
  int a[20],b[50],c[50];
  scanf("%d",&n);
  for(int i=0;i<=n;i++){
    scanf("%d",&a[i]);
  }
  for(int j=0;i<=n;j++){
    scanf("%d",&b[j]);
  }
  for(int k=0;i<=n;k++){
    scanf("%d",&c[k]);
  }
  sum+=b[0];
  while(n-1>0){
  if(a[n-2]+1==a[n-1]){
  	sum+=c[n-1];
  }
    sum+=b[n-1];
    n--;
  }
  printf("%d",sum);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:15: error: 'i' undeclared (first use in this function)
    9 |   for(int j=0;i<=n;j++){
      |               ^
main.c:9:15: note: each undeclared identifier is reported only once for each function it appears in