Language: C++

#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
long long a[11],vis[12],n,s,c,ans=111111111;
long long dis[205][205],visit[11];
void search(int step){
	if(step==c+1){
		int minn=0;
		dis[0][a[1]]=0;
		for(int i=1;i<=c;i++)
			minn+=dis[a[i-1]][a[i]];
		ans=min(minn,ans);
	}
	else {
		for(int i=1;i<=c;i++){
			if(vis[i]==0&&(step==1||dis[a[step-1]][visit[i]]!=111111111)){
				a[step]=visit[i];
				vis[i]=1;
				search(step+1);
				vis[i]=0;
			}
		}
	}
}
int main(){
	memset(a,0,sizeof(a));
	memset(vis,0,sizeof(vis));
	memset(visit,0,sizeof(visit));
	memset(dis,0,sizeof(dis));
	cin>>n>>s>>c;
	int x,y,z;
	for(int i=1;i<=200;i++){
		for(int j=1;j<=200;j++)
			dis[i][j]=111111111;
		dis[i][i]=0;
	}
	for(int i=1;i<=c;i++)
		cin>>visit[i];
	for(int i=1;i<=s;i++){
		scanf("%d%d%d",&x,&y,&z);
		if(dis[x][y]>z)
			dis[x][y]=z;
		dis[y][x]=dis[x][y];
	}
	for(int k=1;k<=n;k++)
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++)
				dis[i][j]=dis[j][i]=min(dis[i][j],dis[i][k]+dis[k][j]);
	search(1);
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'void search(int)':
a.cc:15:24: error: no matching function for call to 'min(int&, long long int&)'
   15 |                 ans=min(minn,ans);
      |                     ~~~^~~~~~~~~~
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:15:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   15 |                 ans=min(minn,ans);
      |                     ~~~^~~~~~~~~~
/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:2:
/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:15:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   15 |                 ans=min(minn,ans);
      |                     ~~~^~~~~~~~~~