Language: C++

#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
struct node
{
	double x,y,z;
};
struct node x[21];
vector<double>a;
int b[25],i,n,m,j;
double d[21][21],max=0,ans;

double dis(int i,int j)
{
 return 
((x[i].x-x[j].x)*(x[i].x-x[j].x)+(x[i].y-x[j].y)*(x[i].y-x[j].y)+(x[i].z-x[j].z)*(x[i].z-x[j].z));
}
void dfs(int v,int k)
{
	int x,i,j,t;
 b[v]=1;
 if(k==m)
 {
	ans=0;
	for(i=0;i<a.size();i++)
	{
		x=a[i];
		for(j=0;j<a.size();j++)
			if(j!=i)
			{
				t=a[j];
				ans=ans+d[x][t];
			}
	}
	if(ans/2>max)max=ans/2;
	return;
 }
 a.push_back(v); k++;
 if(v+1<=n)dfs(v+1,k);
 a.pop_back(); k--;
 if(v+1<=n)dfs(v+1,k);
 b[v]=0;
}
int main()
{
    scanf("%d%d",&n,&m);
	for(i=0;i<n;i++)
		scanf("%lf%lf%lf",&x[i].x,&x[i].y,&x[i].z);
    for(i=0;i<n;i++)
		for(j=0;j<n;j++)
			d[i][j]=dis(i,j);
	dfs(0,0);
	printf("%lf\n",max);
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:37:18: error: reference to 'max' is ambiguous
   37 |         if(ans/2>max)max=ans/2;
      |                  ^~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:                 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
In file included from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:                 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:13:18: note:                 'double max'
   13 | double d[21][21],max=0,ans;
      |                  ^~~
a.cc:37:22: error: reference to 'max' is ambiguous
   37 |         if(ans/2>max)max=ans/2;
      |                      ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:                 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:                 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:13:18: note:                 'double max'
   13 | double d[21][21],max=0,ans;
      |                  ^~~
a.cc: In function 'int main()':
a.cc:55:24: error: reference to 'max' is ambiguous
   55 |         printf("%lf\n",max);
      |                        ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:                 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:                 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:13:18: note:                 'double max'
   13 | double d[21][21],max=0,ans;
      |                  ^~~