Language: C++

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

#define int long long;

void chmin(int &a, int b) {
    if (a > b) a = b;
}

const int INF = 1 << 30;


signed main() {
    int N, M, R;
    cin >> N >> M >> R;
    int r[R];
    for (int i = 0; i < R; i++) cin >> r[i];
    int A[M], B[M], C[M];
    for (int i = 0; i < M; i++) cin >> A[i] >> B[i] >> C[i];

    for (int i = 0; i < R; i++) r[i]--;
    for (int i = 0; i < M; i++) A[i]--, B[i]--;
    int dist[205][205];
    memset(dist, INF, sizeof(dist));
    for (int i = 0; i < M; i++) dist[A[i]][B[i]] = dist[B[i]][A[i]] = C[i];

    for (int k = 0; k < N; k++) {
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                chmin(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    
    int ans = INF;
    int ara[R]; for (int i = 0; i < R; i++) ara[i] = i;
    do {
        int sum = 0;
        for (int i = 1; i < R; i++) sum += dist[r[ara[i - 1]]][r[ara[i]]];
        chmin(ans, sum);
    } while (next_permutation(ara, ara + R));

    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc:4:22: error: expected ')' before ';' token
    4 | #define int long long;
      |                      ^
a.cc:6:12: note: in expansion of macro 'int'
    6 | void chmin(int &a, int b) {
      |            ^~~
a.cc:6:11: note: to match this '('
    6 | void chmin(int &a, int b) {
      |           ^
a.cc:6:18: error: expected constructor, destructor, or type conversion before ',' token
    6 | void chmin(int &a, int b) {
      |                  ^
a.cc:4:13: error: expected unqualified-id before 'long'
    4 | #define int long long;
      |             ^~~~
a.cc:6:20: note: in expansion of macro 'int'
    6 | void chmin(int &a, int b) {
      |                    ^~~
a.cc:6:24: error: 'b' does not name a type
    6 | void chmin(int &a, int b) {
      |                        ^
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:10:7: note: in expansion of macro 'int'
   10 | const int INF = 1 << 30;
      |       ^~~
a.cc:10:11: error: 'INF' does not name a type
   10 | const int INF = 1 << 30;
      |           ^~~
a.cc: In function 'int main()':
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:14:5: note: in expansion of macro 'int'
   14 |     int N, M, R;
      |     ^~~
a.cc:14:9: error: 'N' was not declared in this scope
   14 |     int N, M, R;
      |         ^
a.cc:14:12: error: 'M' was not declared in this scope
   14 |     int N, M, R;
      |            ^
a.cc:14:15: error: 'R' was not declared in this scope
   14 |     int N, M, R;
      |               ^
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:16:5: note: in expansion of macro 'int'
   16 |     int r[R];
      |     ^~~
a.cc:16:9: error: 'r' was not declared in this scope
   16 |     int r[R];
      |         ^
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:17:10: note: in expansion of macro 'int'
   17 |     for (int i = 0; i < R; i++) cin >> r[i];
      |          ^~~
a.cc:17:14: error: 'i' was not declared in this scope
   17 |     for (int i = 0; i < R; i++) cin >> r[i];
      |              ^
a.cc:17:26: error: expected ')' before ';' token
   17 |     for (int i = 0; i < R; i++) cin >> r[i];
      |         ~                ^
      |                          )
a.cc:17:28: error: 'i' was not declared in this scope
   17 |     for (int i = 0; i < R; i++) cin >> r[i];
      |                            ^
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:18:5: note: in expansion of macro 'int'
   18 |     int A[M], B[M], C[M];
      |     ^~~
a.cc:18:9: error: 'A' was not declared in this scope
   18 |     int A[M], B[M], C[M];
      |         ^
a.cc:18:15: error: 'B' was not declared in this scope
   18 |     int A[M], B[M], C[M];
      |               ^
a.cc:18:21: error: 'C' was not declared in this scope
   18 |     int A[M], B[M], C[M];
      |                     ^
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:19:10: note: in expansion of macro 'int'
   19 |     for (int i = 0; i < M; i++) cin >> A[i] >> B[i] >> C[i];
      |          ^~~
a.cc:19:26: error: expected ')' before ';' token
   19 |     for (int i = 0; i < M; i++) cin >> A[i] >> B[i] >> C[i];
      |         ~                ^
      |                          )
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:21:10: note: in expansion of macro 'int'
   21 |     for (int i = 0; i < R; i++) r[i]--;
      |          ^~~
a.cc:21:26: error: expected ')' before ';' token
   21 |     for (int i = 0; i < R; i++) r[i]--;
      |         ~                ^
      |                          )
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:22:10: note: in expansion of macro 'int'
   22 |     for (int i = 0; i < M; i++) A[i]--, B[i]--;
      |          ^~~
a.cc:22:26: error: expected ')' before ';' token
   22 |     for (int i = 0; i < M; i++) A[i]--, B[i]--;
      |         ~                ^
      |                          )
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:23:5: note: in expansion of macro 'int'
   23 |     int dist[205][205];
      |     ^~~
a.cc:23:9: error: 'dist' was not declared in this scope
   23 |     int dist[205][205];
      |         ^~~~
a.cc:24:18: error: 'INF' was not declared in this scope
   24 |     memset(dist, INF, sizeof(dist));
      |                  ^~~
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:25:10: note: in expansion of macro 'int'
   25 |     for (int i = 0; i < M; i++) dist[A[i]][B[i]] = dist[B[i]][A[i]] = C[i];
      |          ^~~
a.cc:25:26: error: expected ')' before ';' token
   25 |     for (int i = 0; i < M; i++) dist[A[i]][B[i]] = dist[B[i]][A[i]] = C[i];
      |         ~                ^
      |                          )
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:27:10: note: in expansion of macro 'int'
   27 |     for (int k = 0; k < N; k++) {
      |          ^~~
a.cc:27:14: error: 'k' was not declared in this scope
   27 |     for (int k = 0; k < N; k++) {
      |              ^
a.cc:27:26: error: expected ')' before ';' token
   27 |     for (int k = 0; k < N; k++) {
      |         ~                ^
      |                          )
a.cc:27:28: error: 'k' was not declared in this scope
   27 |     for (int k = 0; k < N; k++) {
      |                            ^
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:35:5: note: in expansion of macro 'int'
   35 |     int ans = INF;
      |     ^~~
a.cc:35:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 |     int ans = INF;
      |         ^~~
      |         abs
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:36:5: note: in expansion of macro 'int'
   36 |     int ara[R]; for (int i = 0; i < R; i++) ara[i] = i;
      |     ^~~
a.cc:36:9: error: 'ara' was not declared in this scope
   36 |     int ara[R]; for (int i = 0; i < R; i++) ara[i] = i;
      |         ^~~
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:36:22: note: in expansion of macro 'int'
   36 |     int ara[R]; for (int i = 0; i < R; i++) ara[i] = i;
      |                      ^~~
a.cc:36:38: error: expected ')' before ';' token
   36 |     int ara[R]; for (int i = 0; i < R; i++) ara[i] = i;
      |                     ~                ^
      |                                      )
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:38:9: note: in expansion of macro 'int'
   38 |         int sum = 0;
      |         ^~~
a.cc:38:13: error: 'sum' was not declared in this scope
   38 |         int sum = 0;
      |             ^~~
a.cc:4:18: error: declaration does not declare anything [-fpermissive]
    4 | #define int long long;
      |                  ^~~~
a.cc:39:14: note: in expansion of macro 'int'
   39 |         for (int i = 1; i < R; i++) sum += dist[r[ara[i - 1]]][r[ara[i]]];
      |              ^~~
a.cc:39:30: error: expected ')' before ';' token
   39 |         for (int i = 1; i < R; i++) sum += dist[r[ara[i - 1]]][r[ara[i]]];
      |             ~                ^
      |                              )