Language: C++

#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
using namespace std;

int main(){
    int n,m,r;
    cin >> n >> m >> r;
    vector <int> R(r);
    vector < vector <int > >  abc(m,vector<int>(3));
    for(int i = 0 ; i < r ; i++){
        cin >> R[i];
    }

    vector < vector <int > > d(n+1,vector<int>(n+1,1000000));
    for(int i = 0 ; i < m ; i++){
        cin >> abc[i][0];
        cin >> abc[i][1];
        cin >> abc[i][2];
        d[ abc[i][0] ][ abc[i][1] ] = abc[i][2]; 
        d[ abc[i][1] ][ abc[i][0] ] = abc[i][2];        
    }
    
    for(int  k = 1 ; k <= n ;k++){
        for(int i = 1 ; i <= n ; i++){
            for(int j = 1 ; j <= n; j++){
                if(d[i][j] > d[i][k] + d[k][j]){
                    d[i][j] = d[i][k] + d[k][j];
                }
            }
        }    
    }

    int cnt = 0;
    int min;
    bool flag1 = true;
    while(cnt < pow(r,r)){
        int load = 0;
        vector<int> loadlist(r);
        vector<int> loadlistsort(r);
        for(int i = 0 ; i < r ;i++){
             loadlist[i] = R[(cnt/ max(r*i,1) )%r];
             //cout << loadlist[i] << " ";
        }
        loadlistsort = loadlist;
        sort(loadlistsort.begin(),loadlistsort.end());
        bool flag = true;

        for(int i = 1 ; i < r ;i++){
            //cout << loadlistsort[i-1] << "," << loadlistsort[i] << " ";
            if(loadlistsort[i-1] == loadlistsort[i]){
                flag = false;
                //cout << " b ";
            }
        }
        for(int i = 0 ; i < r-1 ;i++){
            load += d[loadlist[i]][loadlist[i+1]];
        }
        //cout << load << endl;
        cnt++;
        if(flag && flag1){
            min = load;
            flag1 = false;
        }
        if(load < min && flag){
            min = load;
        }
    }
    cout << min << endl;
    return 0;
}


Compiler output:
a.cc:8:1: error: extended character   is not valid in an identifier
    8 | using namespace std;
      | ^
a.cc:8:1: error: extended character   is not valid in an identifier
a.cc:10:1: error: extended character   is not valid in an identifier
   10 | int main(){
      | ^
a.cc:11:1: error: extended character   is not valid in an identifier
   11 |     int n,m,r;
      | ^
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
   12 |     cin >> n >> m >> r;
      | ^
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:11: error: extended character   is not valid in an identifier
   12 |     cin >> n >> m >> r;
      |           ^
a.cc:12:11: error: extended character   is not valid in an identifier
a.cc:12:16: error: extended character   is not valid in an identifier
   12 |     cin >> n >> m >> r;
      |                ^
a.cc:12:16: error: extended character   is not valid in an identifier
a.cc:12:21: error: extended character   is not valid in an identifier
   12 |     cin >> n >> m >> r;
      |                     ^
a.cc:13:1: error: extended character   is not valid in an identifier
   13 |     vector <int> R(r);
      | ^
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:17: error: extended character   is not valid in an identifier
   13 |     vector <int> R(r);
      |                 ^
a.cc:14:1: error: extended character   is not valid in an identifier
   14 |     vector < vector <int > >  abc(m,vector<int>(3));
      | ^
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:13: error: extended character   is not valid in an identifier
   14 |     vector < vector <int > >  abc(m,vector<int>(3));
      |             ^
a.cc:14:13: error: extended character   is not valid in an identifier
a.cc:14:22: error: extended character   is not valid in an identifier
   14 |     vector < vector <int > >  abc(m,vector<int>(3));
      |                      ^
a.cc:14:27: error: extended character   is not valid in an identifier
   14 |     vector < vector <int > >  abc(m,vector<int>(3));
      |                           ^
a.cc:14:29: error: extended character   is not valid in an identifier
   14 |     vector < vector <int > >  abc(m,vector<int>(3));
      |                             ^
a.cc:14:29: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
   15 |     for(int i = 0 ; i < r ; i++){
      | ^
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:9: error: extended character   is not valid in an identifier
   15 |     for(int i = 0 ; i < r ; i++){
      |         ^
a.cc:15:9: error: extended character   is not valid in an identifier
a.cc:15:16: error: extended character   is not valid in an identifier
   15 |     for(int i = 0 ; i < r ; i++){
      |                ^
a.cc:15:16: error: extended character   is not valid in an identifier
a.cc:15:20: error: extended character   is not valid in an identifier
   15 |     for(int i = 0 ; i < r ; i++){
      |                    ^
a.cc:15:20: error: extended character   is not valid in an identifier
a.cc:15:24: error: extended character   is not valid in an identifier
   15 |     for(int i = 0 ; i < r ; i++){
      |                        ^
a.cc:15:24: error: extended character   is not valid in an identifier
a.cc:15:28: error: extended character   is not valid in an identifier
   15 |     for(int i = 0 ; i < r ; i++){
      |                            ^
a.cc:16:1: error: extended character   is not valid in an identifier
   16 |         cin >> R[i];
      | ^
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:16:15: error: extended character   is not valid in an identifier
   16 |         cin >> R[i];
      |               ^
a.cc:17:1: error: extended character   is not valid in an identifier
   17 |     }
      | ^
a.cc:17:1: error: extended character   is not valid in an identifier
a.cc:17:1: error: extended character   is not valid in an identifier
a.cc:17:1: error: extended character   is not valid in an identifier
a.cc:19:1: error: extended character   is not valid in an identifier
   19 |     vector < vector <int > > d(n+1,vector<int>(n+1,1000000));
      | ^
a.cc:19:1: error: extended character   is not valid in an identifier
a.cc:19:1: error: extended character   is not valid in an identifier
a.cc:19:1: error: extended character   is not valid in an identifier
a.cc:19:1: error: extended character   is not valid in an identifier
a.cc:19:13: error: extended character   is not valid in an identifier
   19 |     vector < vector <int > > d(n+1,vector<int>(n+1,1000000));
      |             ^
a.cc:19:13: error: extended character   is not valid in an identifier
a.cc:19:22: error: extended character   is not valid in an identifier
   19 |     vector < vector <int > > d(n+1,vector<int>(n+1,1000000));
      |                      ^
a.cc:19:27: error: extended character   is not valid in an identifier
   19 |     vector < vector <int > > d(n+1,vector<int>(n+1,1000000));
      |                           ^
a.cc:19:29: error: extended character   is not valid in an identifier
   19 |     vector < vector <int > > d(n+1,vector<int>(n+1,1000000));
      |                             ^
a.cc:20:1: error: extended character   is not valid in an identifier
   20 |     for(int i = 0 ; i < m ; i++){
      | ^
a.cc:20:1: error: extended character   is not valid in an identifier
a.cc:20:1: error: extended character   is not valid in an identifier
a.cc:20:1: error: extended character   is not valid in an identifier
a.cc:20:9: error: extended character   is not valid in an identifier
   20 |     for(int i = 0 ; i < m ; i++){
      |         ^
a.cc:20:9: error: extended character   is not valid in an identifier
a.cc:20:16: error: extended character   is not valid in an identifier
   20 |     for(int i = 0 ; i < m ; i++){
      |                ^
a.cc:20:16: error: extended character   is not valid in an identifier
a.cc:20:20: error: extended character   is not valid in an identifier
   20 |     for(int i = 0 ; i < m ; i++){
      |                    ^
a.cc:20:20: error: extended character   is not valid in an identifier
a.cc:20:24: error: extended character   is not valid in an identifier
   20 |     for(int i = 0 ; i < m ; i++){
      |                        ^
a.cc:20:24: error: extended character   is not valid in an identifier
a.cc:20:28: error: extended character   is not valid in an identifier
   20 |     for(int i = 0 ; i < m ; i++){
      |                            ^
a.cc:21:1: error: extended character   is not valid in an identifier
   21 |         cin >> abc[i][0];
      | ^
a.cc:21:1: error: extended character   is not valid in an identifier
a.cc:21:1: error: extended character   is not valid in an identifier
a.cc:21:1: error: extended character   is not valid in an identifier
a.cc:21:1: error: extended character   is not valid in an identifier
a.cc:21:1: error: extended character   is not valid in an identifier
a.cc:21:1: error: extended character   is not valid in an identifier
a.cc:21:1: error: extended character   is not valid in an identifier
a.cc:21:1: error: extended character   is not valid in an identifier
a.cc:21:15: error: extended character   is not valid in an identifier
   21 |         cin >> abc[i][0];
      |               ^
a.cc:22:1: error: extended character   is not valid in an identifier
   22 |         cin >> abc[i][1];
      | ^
a.cc:22:1: error: extended character   is not valid in an identifier
a.cc:22:1: error: extended character   is not valid in an identifier
a.cc:22:1: error: extended character   is not valid in an identifier
a.cc:22:1: error: extended character   is not valid in an identifier
a.cc:22:1: error: extended character   is not valid in an identifier
a.cc:22:1: error: extended character   is not valid in an identifier
a.cc:22:1: error: extended character   is not valid in an identifier
a.cc:22:1: error: extended character   is not valid in an identifier
a.cc:22:15: error: extended character   is not valid in an identifier
   22 |         cin >> abc[i][1];
      |               ^
a.cc