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

#include <iostream>
using namespace std;
int N,M,R;
long long d[201][201];
static const long long MAX = 1LL<<21;
void wf() {
    int i,j,k;

    for (k =1; k <= N; k++) {
        for (i = 1; i <= N; i++) {
            for (j = 1; j <= N; j++) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }

}

int main() {
    int i,j,A,B;
    long long C;
    int r[8];
    cin >> N >> M >> R;

    for (i = 0; i < R; i++) {
        cin >> r[i];
    }

    for (i = 1; i <= N; i++) {
        for (j = 1; j <= N; j++) {
            d[i][j] = MAX;
        }
        d[i][i]=0;
    }

    for (i = 0; i < M; i++) {
        cin >> A >> B >> C;
        d[A][B] = C;
        d[B][A] = C;
    }

    wf();
    
    long long mind = MAX;
    do {
        long long tmp = 0;
        for (j = 0; j < R-1; j++) {
            
           tmp += d[r[j] ][r[j+1] ];
        }
        mind = min(mind, tmp);
    } while ( next_permutation(r,r+R) );

    cout << mind << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:15: error: 'next_permutation' was not declared in this scope
   52 |     } while ( next_permutation(r,r+R) );
      |               ^~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;
int N,M,R;
long long d[201][201];
static const long long MAX = 1LL<<21;
#define INF 100000000
void wf() {
    int i,j,k;

    for (k =1; k <= N; k++) {
        for (i = 1; i <= N; i++) {
            for (j = 1; j <= N; j++) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }

}

int main() {
    int i,j,A,B;
    long long C;
    int r[8];
    cin >> N >> M >> R;

    for (i = 0; i < R; i++) {
        cin >> r[i];
    }

    for (i = 1; i <= N; i++) {
        for (j = 1; j <= N; j++) {
            d[i][j] = INF;
        }
        d[i][i]=0;
    }

    for (i = 0; i < M; i++) {
        cin >> A >> B >> C;
        d[A][B] = C;
        d[B][A] = C;
    }

    wf();
    
    long long mind = MAX;
    do {
        long long tmp = 0;
        for (j = 0; j < R; j++) {
            
           tmp += d[r[j] ][r[j+1] ];
        }
        mind = min(mind, tmp);
    } while ( next_permutation(r,r+R) );

    cout << mind << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:15: error: 'next_permutation' was not declared in this scope
   53 |     } while ( next_permutation(r,r+R) );
      |               ^~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;
int N,M,R;
long long d[201][201];
static const long long MAX = 1LL<<21;

void wf() {
    int i,j,k;
    for (i = 0; i < N; i++) {
        for (j = 0; j < N; j++) {
            for (k = 0; k < N; k++) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

int main() {
    int i,j,A,B;
    long long C;
    int r[8];
    cin >> N >> M >> R;

    for (i = 0; i < R; i++) {
        cin >> r[i];
    }


    for (i = 0; i < M; i++) {
        cin >> A >> B >> C;
        d[A][B] = C;
    }

    wf();

    long long mind = MAX;
    do {
        long long tmp = 0;
        for (j = 0; j < 7; j++) {
           tmp += d[j][j+1];
        }
        mind = min(mind, tmp);
    } while ( next_permutation(r,r+8) );

    cout << mind << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:15: error: 'next_permutation' was not declared in this scope
   43 |     } while ( next_permutation(r,r+8) );
      |               ^~~~~~~~~~~~~~~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair
#define pii pair<int,int>

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

int main(){

  llong dp[200][200];
  int n, m, r;
  int city[8];
  
  scanf("%d %d %d", &n, &m, &r);

  REP(i,r){
    int t;
    scanf("%d", &t);
    t--;
    city[i] = t;
  }

  SORT(city,r);

  fill((int*)dp, (int*)(dp + n), INF);
  REP(i,n){
    dp[i][i] = 0;
  }

  REP(i,m){
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    a--; b--;
    dp[a][b] = c; dp[b][a] = c;
  }

  REP(i,n){
    REP(j,n){
      REP(k,n){
        dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
      }
    }
  }

  llong res = LLONG_MAX;
  do{
    llong sum = 0;
    REP(i,r - 1){
      sum += dp[city[i]][city[i + 1]];
    }
    if(res > sum){
      res = sum;
    }
  }while(next_permutation(city,city + r));

  printf("%lld\n", res);

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:73:15: error: 'LLONG_MAX' was not declared in this scope
   73 |   llong res = LLONG_MAX;
      |               ^~~~~~~~~
a.cc:13:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   12 | #include <iostream>
  +++ |+#include <climits>
   13 | #include <string>
Language: C++

#include <iostream>
using namespace std;
int N, M, R;
int d[201][201];
int r[9];
int INF = 1 << 29;
int res = INF;
bool used[9];
void dfs(int c, int las, int dist) {
	if (c == R + 1) {
		if (res > dist) res = dist;
		return;
	}
	else {
		for (int i = 1; i <= N; ++i) {
			if (!used[i]) {
				used[i] = true;
				if (las == -1) dfs(c + 1, i, 0);
				else dfs(c + 1, i, d[r[las]][r[i]]);
				used[i] = false;
			}
		}
	}
}
int main(void) {
	cin >> N >> M >> R;
	memset(used, false, 9);
	for (int i = 1; i <= R; ++i) {
		cin >> r[i];
	}
	for (int i = 1; 1 <= N; ++i) {
		for (int j = 1; j <= N; ++j) {
			if (i == j) {
				d[i][j] = 0;
			}
			else {
				d[i][j] = INF;
			}
		}
	}
	for (int i = 1; i <= N; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		if (d[a][b] > c) {
			d[a][b] = c;
		}
	}
	for (int k = 1; k <= N; ++k)
		for (int i = 1; 1 <= 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];
	dfs(1, -1, 0);
	cout << res << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'memset' was not declared in this scope
   27 |         memset(used, false, 9);
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

/* 方針
 * 1. ワーシャルフロイドで全最短経路長を求める O(N^3)
 * 2. 全経路列挙 O(8!) = 40320
 * 3. 足す
*/

#include <iostream>
#include <vector>
#include <algorithm>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ALL(a) (a).begin(), (a).end()

#define INF INT_MAX

using namespace std;

int main()
{
    int N, M, R; cin >> N >> M >> R;

    vector<int> goals(R);

    vector<vector<int>> distances(N, vector<int>(N, INF));

    REP(i, R)
    {
        cin >> goals[i];
        goals[i]--;
    }

    REP(i, M)
    {
        int a, b, c; cin >> a >> b >> c;
        a--;
        b--;

        distances[a][b] = c;
        distances[b][a] = c;
    }

    REP(k, N)
    {
        REP(i, N)
        {
            REP(j, N)
            {
                if( distances[i][k] == INF || distances[k][j] == INF ) continue;
                distances[i][j] = min(distances[i][j], distances[i][k] + distances[k][j]);
            }
        }
    }

    unsigned long long distance = INF;
    do
    {
        unsigned long long current = 0;
        REP(i, R - 1)
        {
            current += distances[goals[i]][goals[i+1]];
        }
        distance = min(distance, current);

    } while(next_permutation(ALL(goals)));

    cout << distance << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: 'INT_MAX' was not declared in this scope
   19 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:29:53: note: in expansion of macro 'INF'
   29 |     vector<vector<int>> distances(N, vector<int>(N, INF));
      |                                                     ^~~
a.cc:10:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    9 | #include <algorithm>
  +++ |+#include <climits>
   10 |
Language: C++

/* 方針
 * 1. ワーシャルフロイドで全最短経路長を求める O(N^3)
 * 2. 全経路列挙 O(8!) = 40320
 * 3. 足す
*/

#include <iostream>
#include <vector>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ALL(a) (a).begin(), (a).end()

#define INF 10000

using namespace std;

int main()
{
    int N, M, R; cin >> N >> M >> R;

    vector<int> goals(R);

    vector<vector<int>> distances(N, vector<int>(N, INF));

    REP(i, R)
    {
        cin >> goals[i];
        goals[i]--;
    }

    REP(i, M)
    {
        int a, b, c; cin >> a >> b >> c;
        a--;
        b--;

        distances[a][b] = c;
        distances[b][a] = c;
    }

    REP(k, N)
    {
        REP(i, N)
        {
            REP(j, N)
            {
                if( distances[i][k] == INF || distances[k][j] == INF ) continue;
                distances[i][j] = min(distances[i][j], distances[i][k] + distances[k][j]);
            }
        }
    }

    int distance = INF;
    do
    {
        int current = 0;
        REP(i, R - 1)
        {
            current += distances[goals[i]][goals[i+1]];
        }
        distance = min(distance, current);

    } while(next_permutation(ALL(goals)));

    cout << distance << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:13: error: 'next_permutation' was not declared in this scope
   68 |     } while(next_permutation(ALL(goals)));
      |             ^~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int n,m,r,ans=10000000;
    cin>>n>>m>>r;
    vector<int> perm(r),node(r);
    vector<vector<int>> cost(n,vector<int>(n,10000000));
    for(int i=0;i<r;i++){
        cin>>node[i];
    }
    for(int i=0;i<m;i++){
        int a,b,c;
        cin>>a>>b>>c;
        cost[a-1][b-1]=c;
        cost[b-1][a-1]=c;
    }
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            for(int k=0;k<n;k++)
                if(cost[j][k]>cost[j][i]+cost[i][k]){
                    cost[j][k]=cost[j][i]+cost[i][k];
                    cost[k][j]=cost[j][i]+cost[i][k];
                }
                    
    
    iota(perm.begin(), perm.end(), 0);
    do {
        //vにnodeをどの順番で回るか。最悪8!=500kくらい
        int tmp=0;
        for(int i=0;i<r-1;i++){
            tmp+=cost[node[perm[i]]-1][node[perm[i+1]]-1];
        }
        ans=min(ans,tmp);
    } while( next_permutation(perm.begin(), perm.end()) );
    cout<<ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: 'iota' was not declared in this scope
   28 |     iota(perm.begin(), perm.end(), 0);
      |     ^~~~
Language: C

#include<stdio.h>
void fl(int M,int dp[M][M]);
int main(){
	int N,M,R;//N=街の数 M=道の数 R=訪れる街の数
	int i,j;//ループ用変数
	scanf("%d %d %d",&N,&M,&R);
	int res=0,res_tmp[100],R_ka=1;
	int R_num[R];
	int dist[M];//キョリ
	int d[N][N];//どこからどこへ？のキョリ格納用
	int a,b,tmp;//一時変数

	for(i=0;i<N+1;i++){
		for(j=1;j<N+1;j++){
			d[i][j]=65535;
		}
	}

	if(N<R)return ERROR;
	for(i=0;i<R;i++){
		scanf("%d ",&R_num[i]);
	}
	for(i=0;i<M;i++){
		scanf("%d %d %d",&a,&b,&dist[i]);
		d[a][b]=dist[i];//ex:a=1,b=2,dist=2→d[1][2]=2
	}
	for(i=1;i<N+1;i++){
		for(j=1;j<N+1;j++){
			if(d[i][j]!=65535&&d[j][i]==65535){
				d[j][i]=d[i][j];
			}
			else if(d[i][j]!=65535&&d[j][i]!=65535){
				if(d[i][j]>d[j][i]){
					d[i][j]=d[j][i];
				}else{
					d[j][i]=d[i][j];
				}
			}
		}
	}

	/*for(i=1;i<=N;i++){
		for(j=1;j<=N;j++){
			printf("%dと%dの最短距離＝%d\n",i,j,d[i][j]);
		}
	}*/
	fl(N,d);
    for(i=0;i<N+1;i++){
    	for(j=0;j<N+1;j++){
			if(d[i][j]==65535){
				d[i][j]=-1;
			}
			if(i==j){
				d[i][i]=-1;
			}
    	}
    }

    for(i=R;i!=1;i--){
    	R_ka=i*R_ka;
    }

    //printf("R!=%d\n",R_ka);
    for(j=0;j<R_ka;j++){
    	res=0;
		for(i=0;i<R-1;i++){
			res+=d[R_num[i]][R_num[i+1]];
		}
		res_tmp[j]=res;
		tmp=R_num[0];
		for(i=0;i<R;i++){
			if(i==R-1){
				R_num[i]=tmp;
			}else{
				R_num[i]=R_num[i+1];
			}
		}
    }
	/*for(i=1;i<=N;i++){
		for(j=1;j<=N;j++){
			printf("%dと%dの最短距離＝%d\n",i,j,d[i][j]);
		}
	}*/
    for(i=0;i<R_ka;i++){
    	if(res>res_tmp[i]){
    		res=res_tmp[i];
    	}
    }
    /*for(i=0;i<R_ka;i++){
    	printf("res_tmp=%d\n",res_tmp[i]);
    }*/
    printf("%d\n",res);
    return 0;
}

void fl(int M,int dp[M][M]){
	int i,j,k;
    for (k = 1; k < M+1; k++) {
      for (j = 1; j < M+1; j++) {
    	  for(i=1;i<M+1;i++){
			if (dp[i][j] > dp[i][k] + dp[k][j]){
			  dp[i][j] = dp[i][k] + dp[k][j];
			}
        }
      }
    }
}



Compiler output:
main.c: In function 'main':
main.c:19:23: error: 'ERROR' undeclared (first use in this function)
   19 |         if(N<R)return ERROR;
      |                       ^~~~~
main.c:19:23: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <climits>
#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
#include <unordered_set>
using namespace std;

struct Data_path
{
    long long pos;
    long long len;
    unordered_set<long long> flag;
};

int main()
{
    long long ans = LLONG_MAX;
    long long N, M, R;

    cin >> N >> M >> R;

    vector<long long> r;
    r.resize(R);
    vector<vector<long long>> way;
    way.resize(N);
    for (long long i = 0; i < N; i++)
    {
        way[i].resize(N);
    }

    for (long long i = 0; i < R; i++)
    {
        cin >> r[i];
        r[i] -= 1;
    }

    for (long long i = 0; i < N; i++)
    {
        for (long long j = 0; j < N; j++)
        {
            way[i][j] = LLONG_MAX;
        }
        way[i][i] = 0;
    }

    for (long long i = 0; i < M; i++)
    {
        long long A;
        long long B;
        long long C;
        cin >> A >> B >> C;
        A -= 1;
        B -= 1;
        way[A][B] = way[B][A] = C;
    }

    for (long long k = 0; k < N; k++)
    {
        for (long long i = 0; i < N; i++)
        {
            for (long long j = 0; j < N; j++)
            {
                if (way[i][k] != LLONG_MAX && way[k][j] != LLONG_MAX)
                    way[i][j] = min(way[i][j], way[i][k] + way[k][j]);
            }
        }
    }

    stack<Data_path> stack;
    for (long long i = 0; i < R; i++)
    {
        unordered_set<long long> flag = {r[i]};
        Data_path dp;
        dp.pos = r[i];
        dp.len = 0;
        dp.flag = flag;
        stack.push(dp);
    }

    while (!stack.empty())
    {
        Data_path dp = stack.top();
        stack.pop();
        if (dp.flag.size() == R)
        {
            ans = min(ans, dp.len);
            continue;
        }
        else
        {
            for (long long i = 0; i < R; i++)
            {
                if (dp.flag.find(r[i]) != dp.flag.end() || dp.len = LLONG_MAX)
                {
                    continue;
                }
                else
                {
                    unordered_set<long long> new_flag = dp.flag;
                    new_flag.insert(r[i]);
                    Data_path new_dp;
                    new_dp.pos = r[i];
                    new_dp.len = dp.len + way[dp.pos][r[i]];
                    new_dp.flag = new_flag;
                    stack.push(new_dp);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:94:57: error: lvalue required as left operand of assignment
   94 |                 if (dp.flag.find(r[i]) != dp.flag.end() || dp.len = LLONG_MAX)
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
Language: C++

#include <climits>
#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
#include <unordered_set>
using namespace std;

struct Data_path
{
    long long pos;
    long long len;
    unordered_set<long long> flag;
};

int main()
{
    long long ans = LLONG_MAX;
    long long N, M, R;

    cin >> N >> M >> R;

    vector<long long> r;
    r.resize(R);
    vector<vector<long long>> way;
    way.resize(N);
    for (long long i = 0; i < N; i++)
    {
        way[i].resize(N);
    }

    for (long long i = 0; i < R; i++)
    {
        cin >> r[i];
        r[i] -= 1;
    }

    for (long long i = 0; i < N; i++)
    {
        for (long long j = 0; j < N; j++)
        {
            way[i][j] = LLONG_MAX;
        }
        way[i][i] = 0;
    }

    for (long long i = 0; i < M; i++)
    {
        long long A;
        long long B;
        long long C;
        cin >> A >> B >> C;
        A -= 1;
        B -= 1;
        way[A][B] = way[B][A] = C;
    }

    for (long long k = 0; k < N; k++)
    {
        for (long long i = 0; i < N; i++)
        {
            for (long long j = 0; j < N; j++)
            {
                way[i][j] = min(way[i][j], way[i][k] + way[k][j]);
            }
        }
    }

    stack<Data_path> stack;
    for (long long i = 0; i < R; i++)
    {
        unordered_set<long long> flag = {r[i]};
        Data_path dp;
        dp.pos = r[i];
        dp.len = 0;
        dp.flag = flag;
        stack.push(dp);
    }

    while (!stack.empty())
    {
        Data_path dp = stack.top();
        stack.pop();
        if (dp.flag.size() == R)
        {
            ans = min(ans, dp.len);
            continue;
        }
        else
        {
            for (long long i = 0; i < R; i++)
            {
                if (dp.flag.find(r[i]) != dp.flag.end() || dp.len = LLONG_MAX)
                {
                    continue;
                }
                else
                {
                    unordered_set<long long> new_flag = dp.flag;
                    new_flag.insert(r[i]);
                    Data_path new_dp;
                    new_dp.pos = r[i];
                    new_dp.len = dp.len + way[dp.pos][r[i]];
                    new_dp.flag = new_flag;
                    stack.push(new_dp);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:93:57: error: lvalue required as left operand of assignment
   93 |                 if (dp.flag.find(r[i]) != dp.flag.end() || dp.len = LLONG_MAX)
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
Language: C++

#include <climits>
#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
#include <unordered_set>
using namespace std;

struct Data_path
{
    long long pos;
    long long len;
    unordered_set<long long> flag;
};

int main()
{
    long long ans = 100001;
    long long N, M, R;

    cin >> N >> M >> R;

    vector<long long> r;
    r.resize(R);
    vector<vector<long long>> way;
    way.resize(N);
    for (long long i = 0; i < N; i++)
    {
        way[i].resize(N);
    }

    for (long long i = 0; i < R; i++)
    {
        cin >> r[i];
        r[i] -= 1;
    }

    for (long long i = 0; i < N; i++)
    {
        for (long long j = 0; j < N; j++)
        {
            way[i][j] = 100001;
        }
        way[i][i] = 0;
    }

    for (long long i = 0; i < M; i++)
    {
        long long A;
        long long B;
        long long C;
        cin >> A >> B >> C;
        A -= 1;
        B -= 1;
        way[A][B] = way[B][A] = C;
    }

    for (long long k = 0; i < N; k++)
    {
        for (long long i = 0; j < N; i++)
        {
            for (long long j = 0; k < N; j++)
            {
                way[i][j] = min(way[i][j], way[i][k] + way[k][j]);
            }
        }
    }

    stack<Data_path> stack;
    for (long long i = 0; i < R; i++)
    {
        unordered_set<long long> flag = {r[i]};
        Data_path dp;
        dp.pos = r[i];
        dp.len = 0;
        dp.flag = flag;
        stack.push(dp);
    }

    while (!stack.empty())
    {
        Data_path dp = stack.top();
        stack.pop();
        if (dp.flag.size() == R)
        {
            ans = min(ans, dp.len);
            continue;
        }
        else
        {
            for (long long i = 0; i < R; i++)
            {
                if (dp.flag.find(r[i]) != dp.flag.end())
                {
                    continue;
                }
                else
                {
                    unordered_set<long long> new_flag = dp.flag;
                    new_flag.insert(r[i]);
                    Data_path new_dp;
                    new_dp.pos = r[i];
                    new_dp.len = dp.len + way[dp.pos][r[i]];
                    new_dp.flag = new_flag;
                    stack.push(new_dp);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:27: error: 'i' was not declared in this scope
   58 |     for (long long k = 0; i < N; k++)
      |                           ^
a.cc:60:31: error: 'j' was not declared in this scope
   60 |         for (long long i = 0; j < N; i++)
      |                               ^
Language: C++

#include <climits>
#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
#include <unordered_set>
using namespace std;

struct Data_path
{
    long long pos;
    long long len;
    unordered_set<long long> flag;
};

int main()
{
    long long ans = long long_MAX;
    long long N, M, R;

    cin >> N >> M >> R;

    vector<long long> r;
    r.resize(R);
    vector<vector<long long>> way;
    way.resize(N);
    for (long long i = 0; i < N; i++)
    {
        way[i].resize(N);
    }

    for (long long i = 0; i < R; i++)
    {
        cin >> r[i];
        r[i] -= 1;
    }

    for (long long i = 0; i < N; i++)
    {
        for (long long j = 0; j < N; j++)
        {
            way[i][j] = long long_MAX;
        }
        way[i][i] = 0;
    }

    for (long long i = 0; i < M; i++)
    {
        long long A;
        long long B;
        long long C;
        cin >> A >> B >> C;
        A -= 1;
        B -= 1;
        way[A][B] = way[B][A] = C;
    }

    for (long long i = 0; i < N; i++)
    {
        for (long long j = 0; j < N; j++)
        {
            for (long long k = 0; k < N; k++)
            {
                if (i != j && j != k && k != i)
                {
                    way[i][j] = min(way[i][j], way[i][k] + way[k][j]);
                }
            }
        }
    }

    stack<Data_path> stack;
    for (long long i = 0; i < R; i++)
    {
        unordered_set<long long> flag = {r[i]};
        Data_path dp;
        dp.pos = r[i];
        dp.len = 0;
        dp.flag = flag;
        stack.push(dp);
    }

    while (!stack.empty())
    {
        Data_path dp = stack.top();
        stack.pop();
        if (dp.flag.size() == R)
        {
            ans = min(ans, dp.len);
            continue;
        }
        else
        {
            for (long long i = 0; i < R; i++)
            {
                if (dp.flag.find(r[i]) != dp.flag.end())
                {
                    continue;
                }
                else
                {
                    unordered_set<long long> new_flag = dp.flag;
                    new_flag.insert(r[i]);
                    Data_path new_dp;
                    new_dp.pos = r[i];
                    new_dp.len = dp.len + way[dp.pos][r[i]];
                    new_dp.flag = new_flag;
                    stack.push(new_dp);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: expected primary-expression before 'long'
   18 |     long long ans = long long_MAX;
      |                     ^~~~
a.cc:42:25: error: expected primary-expression before 'long'
   42 |             way[i][j] = long long_MAX;
      |                         ^~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int n, m, r;
ll dp[210][210];
vector<int> vi;

int main() {
	rep(i, 210)rep(j, 210) {
		if (i != j)dp[i][j] = INF;
	}
	cin >> n >> m >> r;
	rep(i, r) {
		int num;
		cin >> num;
		num--;
		vi.push_back(num);
	}
	rep(i, m) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		dp[a][b] = c;
		dp[b][a] = c;
	}
	rep(k, n) {
		rep(i, n) {
			rep(j, n) {
				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
			}
		}
	}
	ll ans = INF;
	do {
		bool f = 1;
		ll num = 0;
		rep(i, r - 1) {
			num += dp[vi[i]][vi[i + 1]];
		}
		if(f)ans = min(ans, num);
	} while (next_permutation(ALL(vi)));
	cout << ans << endl;
}

Compiler output:
a.cc:31:1: error: expected ',' or ';' before 'const'
   31 | const ll MOD = 1e9 + 7;
      | ^~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = LLONG_MAX;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int n, m, r;
ll dp[210][210];
vector<int> vi;

int main() {
	rep(i, 210)rep(j, 210) {
		if (i != j)dp[i][j] = INF;
	}
	cin >> n >> m >> r;
	rep(i, r) {
		int num;
		cin >> num;
		num--;
		vi.push_back(num);
	}
	rep(i, m) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		dp[a][b] = c;
		dp[b][a] = c;
	}
	rep(k, n) {
		rep(i, n) {
			rep(j, n) {
				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
			}
		}
	}
	ll ans = INF;
	do {
		ll num = 0;
		rep(i, vi.size() - 1) {
			if (dp[vi[i]][vi[i + 1]] == INF) {
				num = INF;
				break;
			}
			num += dp[vi[i]][vi[i + 1]];
		}
		ans = min(ans, num);
	} while (next_permutation(ALL(vi)));
	cout << ans << endl;
}

Compiler output:
a.cc:30:16: error: 'LLONG_MAX' was not declared in this scope
   30 | const ll INF = LLONG_MAX;
      |                ^~~~~~~~~
a.cc:18:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   17 | #include <bitset>
  +++ |+#include <climits>
   18 | #include <time.h>
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>


using namespace std;

#define  INF (1<<29)

void warshall_floyd(int n, int **matrix) { 
    // nは頂点数,matrixにはグラフの距離を格納した2次元配列（隣接行列）
    // d[u][v]は辺e=(u,v)のコスト（辺が存在しない場合はINF、ただしd[i][i]=0）
    for (int i = 0; i < n; i++)      // 経由する頂点
      for (int j = 0; j < n; j++)    // 開始頂点
        for (int k = 0; k < n; k++)  // 終端
          matrix[j][k] = min(matrix[j][k], matrix[j][i] + matrix[i][k]);
}

int main(){
    int N,M,R;
    int r[9];
    int matrix[201][201];
    scanf("%d %d %d", &N, &M, &R);
    for(int i=0;i<R;i++) scanf("%d",&r[i]);
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
        if(i!=j) matrix[i][j] = INF; 
        else matrix[i][j] = 0;
        }
    }
    for(int i=0; i<M; i++){
        int A,B,C;
        scanf("%d %d %d",&A,&B,&C);
        if(matrix[A-1][B-1]>C) matrix[A-1][B-1] = matrix[A-1][B-1] = C;
    }

    warshall_floyd(N,&matrix);
    
    int result = INF;
    sort(r,r+R);
    do 
        int buf = 0;
        for(int i=0;i<R-1; i++) buf += matrix[r[i]][r[i+1]]; 
        if(result > buf) result = buf;
    } while(next_permutation(r, r+R));   // 次の順列を生成
    printf("%d",result);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:22: error: cannot convert 'int (*)[201][201]' to 'int**'
   38 |     warshall_floyd(N,&matrix);
      |                      ^~~~~~~
      |                      |
      |                      int (*)[201][201]
a.cc:11:34: note:   initializing argument 2 of 'void warshall_floyd(int, int**)'
   11 | void warshall_floyd(int n, int **matrix) {
      |                            ~~~~~~^~~~~~
a.cc:44:12: error: expected 'while' before '(' token
   44 |         for(int i=0;i<R-1; i++) buf += matrix[r[i]][r[i+1]];
      |            ^
a.cc:44:13: error: expected primary-expression before 'int'
   44 |         for(int i=0;i<R-1; i++) buf += matrix[r[i]][r[i+1]];
      |             ^~~
a.cc:44:13: error: expected ')' before 'int'
   44 |         for(int i=0;i<R-1; i++) buf += matrix[r[i]][r[i+1]];
      |            ~^~~
      |             )
a.cc:44:13: error: expected ';' before 'int'
   44 |         for(int i=0;i<R-1; i++) buf += matrix[r[i]][r[i+1]];
      |             ^~~
      |             ;
a.cc:44:31: error: expected ';' before ')' token
   44 |         for(int i=0;i<R-1; i++) buf += matrix[r[i]][r[i+1]];
      |                               ^
      |                               ;
a.cc:45:21: error: 'buf' was not declared in this scope
   45 |         if(result > buf) result = buf;
      |                     ^~~
a.cc: At global scope:
a.cc:46:7: error: expected unqualified-id before 'while'
   46 |     } while(next_permutation(r, r+R));   // 次の順列を生成
      |       ^~~~~
a.cc:47:11: error: expected constructor, destructor, or type conversion before '(' token
   47 |     printf("%d",result);
      |           ^
a.cc:48:1: error: expected declaration before '}' token
   48 | }
      | ^
Language: C++

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

int main() {
    int n, m, r;
    cin >> n >> m >> r;
    vector< int > r_arr(r);
    const int INF = 1000000;
    int w[n][n];

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) {
                w[i][j] = 0;
            } else {
                w[i][j] = INF;
            }
        }
    }
    for (int i = 0; i < r; i++) {
        cin >> r_arr[i];
    }
    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        w[a - 1][b - 1] = min(w[a - 1][b - 1], c);
        w[b - 1][a - 1] = min(w[b - 1][a - 1], c);
    }

    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                w[i][j] = min(w[i][j], w[i][k] + w[k][j]);
            }
        }
    }

    int min_res = INF;
    sort(r_arr.begin(), r_arr.end());
    do {
        int res = 0;
        for (int i = 0; i < r - 1; i++) {
            res += w[r_arr[i]][r_arr[i + 1]];
        }
        min_res = min(min_res, res);
    } while (next_permutation(r_arr.begin(), r_arr.end()));
    cout << min_res;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   40 |     sort(r_arr.begin(), r_arr.end());
      |     ^~~~
      |     short
a.cc:47:14: error: 'next_permutation' was not declared in this scope
   47 |     } while (next_permutation(r_arr.begin(), r_arr.end()));
      |              ^~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<set>

#define INF 1000000000


using namespace std; 

int search(set<int> perm, vector<vector<int> > dist, int last){
    int total = INF;
    if(perm.size() == 0){
        return 0;
    }
    for(auto it = perm.begin();it != perm.end();it++){
        if(last == -1){
            int start = *it;
            set<int> settemp = perm;
            settemp.erase(it);
            int temp = search(settemp,dist,start);
            total = min(total,temp);
        }else{
            int start = *it;
            set<int> settemp = perm;
            settemp.erase(it);
            int temp = search(settemp,dist,start) + dist[last][start];
            total = min(total,temp);
        }
    }
    return total;
}

int main(){
    
    int N,M,R;
    cin >> N >> M >> R;
    vector<int> rlist;
    vector<vector<int> > edge(N,vector<int>(N,INF));
    vector<vector<int> > dist(R,vector<int>(N,0));
    for(int i = 0;i < R;i++){
        int temp;
        cin >> temp;
        temp--;
        rlist.push_back(temp);
    }
    sort(rlist.begin(),rlist.end());
    for(int i = 0;i < M;i++){
        int A,B,C;
        cin >> A >> B >> C;
        dist[A-1][B-1] = C;
        dist[B-1][A-1] = C;
    }
    for(int k=0;k<N;k++){
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
               if(edge[i][j] > edge[i][k] + edge[k][j]){
                    edge[i][j] = edge[i][k] + edge[k][j];
               } 
            }
        }
    }
    cerr < "WF end" << endl;
    set<int> perm;
    for(int i=0;i<R;i++){
        perm.insert(i);
        for(int j=0;j<R;j++){
            dist[i][j] = edge[rlist[i]][rlist[j]];
            dist[j][i] = edge[rlist[j]][rlist[i]];
        }
    }
    
    cout << search(perm,dist,-1) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:63:21: error: invalid operands of types 'const char [7]' and '<unresolved overloaded function type>' to binary 'operator<<'
   63 |     cerr < "WF end" << endl;
      |            ~~~~~~~~~^~~~~~~
Language: C++

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>


#define MOD 1000000007
#define INTMAX 0x7fffffff
#define INTMIN 0x80000000
#define LLMAX 0x7fffffffffffffffLL
#define LLMIN 0x8000000000000000LL

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;
using ll = long long;


#define INF 1000000000

int e[201][201];

int main(){
    int N, M, R;
    cin >> N >> M >> R;

    vector<int> vr;

    for (int i = 0; i < R; ++i) {
        int ri;
        cin >> ri;
        ri--;
        // cout << ri << endl;
        vr.push_back(ri);
    }

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            e[i][j] = INF;
        }
    }
    for (int i = 0; i < N; ++i) {
        e[i][i] = 0;
    }
    for (int i = 0; i < M; ++i) {
        int ai, bi, ci;
        cin >> ai >> bi >> ci;
        ai--;
        bi--;

        e[ai][bi] = ci;
        e[bi][ai] = ci;
    }

    // for (int i = 0; i < N; ++i) {
    //     for (int j = 0; j < N; ++j) {
    //         if (e[i][j] == INF) {
    //             cout << ". ";
    //         } else {
    //             cout << e[i][j] << " ";
    //         }
    //     }
    //     cout << endl;
    // }

    for (int i = 0; i < N; i++)
        for (int j = 0; j < N; j++)
            for (int k = 0; k < N; k++){
                e[j][k] = min(e[j][k], e[j][i] + e[i][k]);
                e[k][j] = e[j][k]
            }
    
    // for (int i = 0; i < N; ++i) {
    //     for (int j = 0; j < N; ++j) {
    //         if (e[i][j] == INF) {
    //             cout << ". ";
    //         } else {
    //             cout << e[i][j] << " ";
    //         }
    //     }
    //     cout << endl;
    // }

    int minsum = 1000000001;
    do {
        int sum = 0;
        for (int i = 0; i < R - 1; ++i) {
            //cout << vr[i] << " -> " << vr[i+1] << " ";
            sum += e[vr[i]][vr[i + 1]];
        }
        //cout << " sum = " << sum << endl;
        if (minsum > sum) {
            minsum = sum;
        }
    } while(next_permutation(vr.begin(), vr.end()));

    cout << minsum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:71:34: error: expected ';' before '}' token
   71 |                 e[k][j] = e[j][k]
      |                                  ^
      |                                  ;
   72 |             }
      |             ~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
#define INF (1 << 29)
const lld MAXN = 201;

int main()
{
	int N,M,R;
	vector<int> r;
	int d[MAXN][MAXN] = {INF};

	cin >> N >> M >> R;
	for(int i = 0; i < R; i++)
	{
		int x;
		cin >> x;
		r.push_back(x-1);
	}
	for(int i = 0; i < M; i++)
	{
		int a,b,c;
		cin >> a >> b >> c;

		d[a-1][b-1] = c;
		d[b-1][a-1] = c;
	}

	for(int i = 0; i < N; i++)
	{
		d[i][i] = 0;
	}

	for(int k = 0; k < N; k++)
	{
		for(int i = 0; i < N; i++)
		{
			for(int j = 0; j < N; j++)
			{
				d[i][j] = min(d[i][j],d[i][k] + d[k][j]);
			}
		}
	}

	sort(r.begin(),r.end());

	int sol = INT_MAX;

	do{
		int now = 0;
		for(int i = 0; i < R-1; i++)
		{
			now += d[r[i]][r[i+1]];
		}
		sol = min(sol,now);
	}while(next_permutation(r.begin(),r.end()));

	cout << sol << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:19: error: 'INT_MAX' was not declared in this scope
   59 |         int sol = INT_MAX;
      |                   ^~~~~~~
a.cc:10:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    9 | #include <cmath>
  +++ |+#include <climits>
   10 |
Language: C++

#include <cstdio > using namespace std; #define INF (1<<29)
int N,M,R; int d[201][201]; int r[9]; int A,B,C; int res; bool used[9];
2
void dfs(int c,int las,int dist) { if(c==R+1) { if(res>dist)res=dist; return; } for(int i=1;i<=R;i++)if(!used[i]) { used[i]=true; if(las==-1)dfs(c+1,i,0); else dfs(c+1,i,dist+d[r[las]][r[i]]); used[i]=false; } }
int main() { scanf("%d%d%d",&N,&M,&R); for(int i=1;i<=N;i++)for(int j=1;j<=N;j++)if(i!=j)d[i][j]=INF; for(int i=1;i<=R;i++)scanf("%d",&r[i]); for(int i=1;i<=M;i++) { scanf("%d%d%d",&A,&B,&C); if(d[A][B]>C)d[A][B]=d[B][A]=C; } 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]; res=INF; dfs(1,-1,0); printf("%d\n",res); }


Compiler output:
a.cc:1:20: warning: extra tokens at end of #include directive
    1 | #include <cstdio > using namespace std; #define INF (1<<29)
      |                    ^~~~~
a.cc:1:10: fatal error: cstdio : No such file or directory
    1 | #include <cstdio > using namespace std; #define INF (1<<29)
      |          ^~~~~~~~~
compilation terminated.
Language: C++

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

#define REP(i, x) for (int i = 0; i < (x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

using ll = long long;

int main() {
    const ll INF = (1LL << 50);
    const int MAXN = 210;

    int N, M, R;
    cin >> N >> M >> R;

    ll dist[MAXN][MAXN];
    REP (i, N) REP(j, N) dist[i][j] = (i == j ? 0 : INF);

    vector<int> r(R);
    REP (i, R) {
        cin >> r[i];
        r[i]--;
    }
    sort(r.begin(), r.end());

    REP (i, M) {
        int A, B, C;
        cin >> A >> B >> C;
        A--; B--;
        dist[A][B] = dist[B][A] = C;
    }

    REP (k, N) {
        REP (i, N) {
            REP (j, N) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    ll ans = INF;

    do {
        ll sum = 0;
        REP (i, R - 1) {
            sum += dist[r[i]][r[i + 1]];
        }
        ans = min(ans, sum);
    } while (next_permutation(r.begin(), r.end()));

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   25 |     sort(r.begin(), r.end());
      |     ^~~~
      |     short
a.cc:50:14: error: 'next_permutation' was not declared in this scope
   50 |     } while (next_permutation(r.begin(), r.end()));
      |              ^~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define inf 1000000007
typedef long long ll;
using namespace std;
ll table[210][210];
int lis[8];
ll ans;
int n,m,k;

bool vis[8];
void DFS(int last,ll cnt){
	bool ful=true;
	lol(r,k)ful&=vis[r];
	if(ful){
		ans=min(ans,cnt);
		return;
	}
	lol(r,k){
		if(vis[r]==true)continue;
		vis[r]=true;
		ll tmp=cnt+table[lis[last]][lis[r]];
		DFS(r,tmp);
		vis[r]=false;
	}
}

int main(){
	cin>>n>>m>>k;
	lol(i,n){
		lol(j,n){
			if(i==j)table[i][j]=0;
			else table[i][j]=LONG_MAX;
		}
	}
	lol(i,k){
		cin>>lis[i];
		lis[i]--;
	}
	lol(u,m){
		int a,b;ll c;
		cin>>a>>b>>c;
		a--,b--;
		table[a][b]=min(c,table[a][b]);
		table[b][a]=min(c,table[a][b]);
	}
	lol(r,n){
		lol(i,n){
			lol(j,n){
				ll tmp=table[i][r]+table[r][j];
				if(tmp<LONG_MAX){
					table[i][j]=min(table[i][j],tmp);
				}
			}
		}
	}
	ans=LONG_MAX;
	lol(r,k)vis[r]=false;
	lol(r,k){
		vis[r]=true;
		DFS(r,0);
		vis[r]=false;
	}
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:42: error: 'LONG_MAX' was not declared in this scope
   36 |                         else table[i][j]=LONG_MAX;
      |                                          ^~~~~~~~
a.cc:5:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<queue>
  +++ |+#include <climits>
    5 | #define lol(i,n) for(int i=0;i<n;i++)
a.cc:54:40: error: 'LONG_MAX' was not declared in this scope
   54 |                                 if(tmp<LONG_MAX){
      |                                        ^~~~~~~~
a.cc:54:40: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:60:13: error: 'LONG_MAX' was not declared in this scope
   60 |         ans=LONG_MAX;
      |             ^~~~~~~~
a.cc:60:13: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<cstdio>
#include<string.h>
#include<set>

using namespace std;
#define inf 0x3f3f3f3f;
set<int>s;
int gh[1000][1000],w[2000],dis[1000][1000],pre[2000];
bool vis[20000]={0}; 
        

int main()
{
    int i,j,k,l,n,m,r,a,b,c;
    int sum;
    int sx[10000];
    cin>>n>>m>>r;
    for (i=0;i<r;i++)
       cin>>sx[i];
       
    for (i=1;i<=n;i++)
      for (j=1;j<=n;j++)
      {
        gh[i][j]=inf;
        dis[i][j]=inf;
      }
     
    for (i=1;i<=n;i++)
    {
       gh[i][i]=0;     
       dis[i][i]=0;
    } 
       
    for (i=1;i<=m;i++)
    {
        cin>>j>>k>>l;
        if (gh[j][k]>l)
        {
          gh[j][k]=l;
          gh[k][j]=l;
        }
    }
    
    for (i=1;i<=n;i++)
      for (j=1;j<=n;j++)
         for (k=1;k<=n;k++)
           if (dis[i][j]>dis[i][k]+gh[k][j])
             dis[i][j]=dis[i][k]+gh[k][j];
    sort(sx,sx+r);
    int ans=inf;
    do 
    { 
       sum=0;
       for (i=0;i<r-1;i++)
           sum=sum+dis[sx[i]][sx[i+1]];
 
       ans=min(ans,sum);
    }while (next_permutation(sx,sx+r));    
   
    cout<<ans<<endl;

    return 0;
}
        
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:52:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   52 |     sort(sx,sx+r);
      |     ^~~~
      |     short
a.cc:61:13: error: 'next_permutation' was not declared in this scope
   61 |     }while (next_permutation(sx,sx+r));
      |             ^~~~~~~~~~~~~~~~
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string.h>
#include<set>

using namespace std;
#define inf 0x3f3f3f3f;
set<int>s;
int gh[1000][1000],w[2000],dis[1000][1000],pre[2000];
bool vis[20000]={0}; 
        

int main()
{
    int i,j,k,l,n,m,r,a,b,c;
    int sum;
    int sx[10000];
    cin>>n>>m>>r;
    for (i=0;i<r;i++)
       cin>>sx[i];
       
    for (i=1;i<=n;i++)
      for (j=1;j<=n;j++)
      {
        gh[i][j]=inf;
        dis[i][j]=inf;
      }
     
    for (i=1;i<=n;i++)
    {
       gh[i][i]=0;     
       dis[i][i]=0;
    } 
       
    for (i=1;i<=m;i++)
    {
        cin>>j>>k>>l;
        if (gh[j][k]>l)
        {
          gh[j][k]=l;
          gh[k][j]=l;
        }
    }
    
    for (i=1;i<=n;i++)
      for (j=1;j<=n;j++)
         for (k=1;k<=n;k++)
           if (dis[i][j]>dis[i][k]+gh[k][j])
             dis[i][j]=dis[i][k]+gh[k][j];
    sort(sx,sx+r);
    int ans=inf;
    do 
    { 
       sum=0;
       for (i=0;i<r-1;i++)
           sum=sum+dis[sx[i]][sx[i+1]];
 
       ans=min(ans,sum);
    }while (next_permutation(sx,sx+r));    
   
    cout<<ans<<endl;

    return 0;
}
        
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:51:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   51 |     sort(sx,sx+r);
      |     ^~~~
      |     short
a.cc:60:13: error: 'next_permutation' was not declared in this scope
   60 |     }while (next_permutation(sx,sx+r));
      |             ^~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
#define INF 0x3f3f3f3f
int map[220][220];
int r[220];
int N,M,R;

void floyd()
{
	for(int k=1;k<=N;k++)
    {
        for(int i=1;i<=N;i++)
        {
            for(int j=1;j<=N;j++)
            {
               map[i][j]=min(map[i][k]+map[k][j],map[i][j]);
            }
        }
    }
}

int main()
{
	while(~scanf("%d%d%d",&N,&M,&R))
	{
		for(int i=0;i<R;++i)
			scanf("%d",&r[i]);
		//memset(map,INF,sizeof(map));
		for(int i=0;i<=N;++i)
		{
			for(int j=0;j<=N;++j)
				if(i == j)
					map[i][j] = 0;
				else
					map[i][j] = INF;
		}
 
		for(int i=0;i<M;++i)
		{
			int x,y,z;
			scanf("%d%d%d",&x,&y,&z);
			if(map[a][b]>c || map[b][a]>c)
			{
				map[x][y]=map[y][x]=z;
			}
		}
		floyd();
		int ans = INF;
		do
		{
			int sum = 0;
			for(int i=0;i<R-1;++i)
			{
				sum+=map[r[i]][r[i+1]];
			}
			ans=min(ans,sum);
		}while(next_permutation(r,r+R));
		printf("%d\n",ans);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:32: error: 'a' was not declared in this scope
   45 |                         if(map[a][b]>c || map[b][a]>c)
      |                                ^
a.cc:45:35: error: 'b' was not declared in this scope
   45 |                         if(map[a][b]>c || map[b][a]>c)
      |                                   ^
a.cc:45:38: error: 'c' was not declared in this scope
   45 |                         if(map[a][b]>c || map[b][a]>c)
      |                                      ^