Language: C++

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
//#define ll __int64
#define ll long long
int n,m,r;
int G[500][500];
int d[500][500];

vector<int>visit;
ll ans;
 
const ll INF=1000000000;
 
int main(){
cin>>n>>m>>r;
 
ll a,b,c;
visit.resize(r);
rep(i,r){
	cin>>a;
	a--;
	visit[i]=a;
}
 
rep(i,n){
	rep(j,n){
		if(i==j)d[i][j]=0;
		else d[i][j]=INF;
	}
}
 
rep(i,m){
	cin>>a>>b>>c;
	a--;b--;
	//cout<<i<<endl;
	
	d[a][b]=min(d[a][b],c);
      d[b][a]=d[a][b];

}
 
rep(k,n){
	rep(i,n){
		rep(j,n)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	}
}
 
ans=100000000000000000;

do{
	ll tmp=0;
	for(int i=1;i<r;i++)tmp+=d[visit[i-1]][visit[i]];
	ans=min(ans,tmp);
}while(next_permutation(visit.begin(),visit.end()));
 
cout<<ans<<endl;
 
 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:20: error: no matching function for call to 'min(int&, long long int&)'
   50 |         d[a][b]=min(d[a][b],c);
      |                 ~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:50:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   50 |         d[a][b]=min(d[a][b],c);
      |                 ~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:50:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   50 |         d[a][b]=min(d[a][b],c);
      |                 ~~~^~~~~~~~~~~