Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
        int n,m;
        cin>>n>>m;
        vector<double> l(n),a(n),b(n);
        for(int i=0;i<n;i++) cin>>l[i]>>a[i]>>b[i];
        double res=0;
        int comb=(1<<m)-1;
        while(comb<1<<n){
                double sum=0;
                vector<int> use;
                for(int i=0;i<n;i++){
                        if(comb & 1<<i){
                                use.push_back(i);
                        }
                }
                for(int i=0;i<use.size();i++)
                        for(int j=i+1;j<use.size();j++){
                                int lef=use[i];
                                int rig=use[j];
                                double ldis=l[lef]-l[rig];
                                ldis*=ldis;
                                double adis=a[lef]-a[rig];
                                adis*=adis;
                                double bdis=b[lef]-b[rig];
                                bdis*=bdis;
                                sum+=ldis+adis+bdis;
                        }
                res=max(res,sum);
#include<bits/stdc++.h>
using namespace std;

int main(){
        int n,m;
        cin>>n>>m;
        vector<double> l(n),a(n),b(n);
        for(int i=0;i<n;i++) cin>>l[i]>>a[i]>>b[i];
        double res=0;
        int comb=(1<<m)-1;
        while(comb<1<<n){
                double sum=0;
                vector<int> use;
                for(int i=0;i<n;i++){
                        if(comb & 1<<i){
                                use.push_back(i);
                        }
                }
                for(int i=0;i<use.size();i++)
                        for(int j=i+1;j<use.size();j++){
                                int lef=use[i];
                                int rig=use[j];
                                double ldis=l[lef]-l[rig];
                                ldis*=ldis;
                                double adis=a[lef]-a[rig];
                                adis*=adis;
                                double bdis=b[lef]-b[rig];
                                bdis*=bdis;
                                sum+=ldis+adis+bdis;
                        }
                res=max(res,sum);
        int x=comb&-comb,y=comb+x;
                comb=((comb & ~y) /x>>1)|y;
        }
        cout<<fixed<<setprecision(10);
        cout<<res<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   35 | int main(){
      |         ^~
a.cc:35:9: note: remove parentheses to default-initialize a variable
   35 | int main(){
      |         ^~
      |         --
a.cc:35:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:35:11: error: a function-definition is not allowed here before '{' token
   35 | int main(){
      |           ^
a.cc:68:2: error: expected '}' at end of input
   68 | }
      |  ^
a.cc:11:25: note: to match this '{'
   11 |         while(comb<1<<n){
      |                         ^
a.cc:68:2: error: expected '}' at end of input
   68 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^