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

#include<iostream>
using namespace std;
bool vis[10];
int n;
double dis = 0;
double res = 0;
struct queue{
	double x;
	double y;
}q[10];
void bfs(double x, double y, int i,int cnt) {
	if (cnt == n) {
		res += dis;
		return;
	}
		
	vis[i] = 1;
	for (int j = 1; j <= n; j++) {
		if (vis[j] == 0) {
			double dis1;
			dis1 = dis;
			dis += sqrt((x - q[j].x)*(x-q[j].x) + (y - q[j].y)*(y-q[j].y));
			vis[j] = 1;
			bfs(q[j].x, q[j].y, j,cnt+1);
			dis = dis1;
			vis[j] = 0;
		}
		
	}
	vis[i] = 0;
	return;
}
int main() {
	
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> q[i].x >> q[i].y;
	}

	for (int i = 1; i <= n; i++) {
		bfs(q[i].x, q[i].y, i,1);
	}
	for (int i = 1; i <= n; i++) {
		res /= i;
	}
	printf("%.10lf", res);
	return 0;
}

Compiler output:
a.cc: In function 'void bfs(double, double, int, int)':
a.cc:22:32: error: 'sqrt' was not declared in this scope
   22 |                         dis += sqrt((x - q[j].x)*(x-q[j].x) + (y - q[j].y)*(y-q[j].y));
      |                                ^~~~
Language: C++

#include<iostream>
using namespace std;
int fact(int x)
{
  int f=1;
  while(x>0)
  {
    f=f*x;
    x--;
  }
  return f;
}
int main()
{
  int n;
  cin>>n;
  int mu=2*fact(n-1);
  int av=(mu/2)*n;
  int a[n],b[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i]>>b[i];
  }
  double sum=0;
  for(int i=0;i<n;i++)
  {
    for(int j=i;j<n;j++)
    {
      sum+=(mu*sqrt((a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j]));
    }
  }
  sum=sum/av;
  cout<<sum;
 return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:16: error: 'sqrt' was not declared in this scope
   29 |       sum+=(mu*sqrt((a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j]));
      |                ^~~~
a.cc:29:69: error: expected ')' before ';' token
   29 |       sum+=(mu*sqrt((a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j]));
      |            ~                                                        ^
      |                                                                     )
Language: C++

#include<iostream>
using namespace std;
int fact(int x)
{
  int f=1;
  while(x>0)
  {
    f=f*x;
    x--;
  }
  return f;
}
int main()
{
  int n;
  cin>>n;
  int mu=2*fact(n-1);
  int av=(mu/2)*n;
  int a[n],b[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i]>>b[i];
  }
  double sum=0
  for(int i=0;i<n;i++)
  {
    for(int j=i;j<n;j++)
    {
      sum+=(mu*sqrt((a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j]));
    }
  }
  sum=sum/av;
  cout<<sum;
 return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:3: error: expected ',' or ';' before 'for'
   25 |   for(int i=0;i<n;i++)
      |   ^~~
a.cc:25:15: error: 'i' was not declared in this scope
   25 |   for(int i=0;i<n;i++)
      |               ^
Language: C++

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

int main(){
  int N;
  cin >> N;
  vector<int> x(N);
  vector<int> y(N);
  for (int i = 0; i < N; i++){
    cin >> x.at(i);
    cin >> y.at(i);
  }
  int count = 1;
  for (int i = 1; i < N; i++){
    count *= i;
  }
  count *= 2;
  
  double ans;
  for (int i = 0; i < N; i++){
    for (int j = i + 1; j < N; j++){
      ans += sqrt((x.at(i) - x.at(j)) * (x.at(i) - x.at(j)) + (y.at(i) - y.at(j)) * (y.at(i) - y.at(j));
    }
  }
  cout << count * ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:104: error: expected ')' before ';' token
   22 |       ans += sqrt((x.at(i) - x.at(j)) * (x.at(i) - x.at(j)) + (y.at(i) - y.at(j)) * (y.at(i) - y.at(j));
      |                  ~                                                                                     ^
      |                                                                                                        )
Language: C++

#include <math.h>
using namespace std;

int main(void){
    // Your code here!
    int N;
    int x[8];
    int y[8];
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>x[i]>>y[i];
    }
    int NnoKaiJo=0;
    NnoKaiJo=N;
    for(int j=N-1;j<1;j--){
        NnoKaiJo*=j;
    }
    double average=0;
    for(int k=0;k<N;k++){
        for(int l=0;l<N;l++){
            double a= ((x[l]-x[k])*(x[l]-x[k]))+((y[l]-y[k])*(y[l]-y[k]));
            average+=sqrtf(a);
        }
    }
    cout<<average/NnoKaiJo<<endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin>>N;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <math.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:25:5: error: 'cout' was not declared in this scope
   25 |     cout<<average/NnoKaiJo<<endl;
      |     ^~~~
a.cc:25:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:29: error: 'endl' was not declared in this scope
   25 |     cout<<average/NnoKaiJo<<endl;
      |                             ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <math.h>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
double a[50009],b[50009];
double k;
double g;
double permute(string s, int l, int r)
{
    if (l == r)
    {
        for(int i=1; i<s.size(); i++)
        {
            int j=s[i]-'0';
            int x=s[i-1]-'0';
            k=k+sqrt(((ar[j]-ar[x])*(ar[j]-ar[x]))+((br[j]-br[x])*(br[j]-br[x])));
        }
        g=g+1.0;
    }
    else
    {
        for (int i = l; i <= r; i++)
        {
            swap(s[l], s[i]);
            permute(s, l+1, r);
            swap(s[l], s[i]);
        }
    }
    return k;
}
int main()
{
    int a;
    double z,y;
    cout<<fixed<<setprecision(12);
    string str = "";
    cin>>a;
    for(int i=1; i<=a; i++)
    {
        cin>>a[i]>>b[i];
        str+=(i+'0');
    }
    int n = str.size();
    z=permute(str, 0, n-1);
    cout<<(z/g)<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'double permute(std::string, int, int)':
a.cc:15:24: error: 'ar' was not declared in this scope; did you mean 'r'?
   15 |             k=k+sqrt(((ar[j]-ar[x])*(ar[j]-ar[x]))+((br[j]-br[x])*(br[j]-br[x])));
      |                        ^~
      |                        r
a.cc:15:54: error: 'br' was not declared in this scope; did you mean 'r'?
   15 |             k=k+sqrt(((ar[j]-ar[x])*(ar[j]-ar[x]))+((br[j]-br[x])*(br[j]-br[x])));
      |                                                      ^~
      |                                                      r
a.cc: In function 'int main()':
a.cc:39:15: error: invalid types 'int[int]' for array subscript
   39 |         cin>>a[i]>>b[i];
      |               ^
Language: C

#include <stdio.h>
#include <math.h>

int main()
{
  int i, j, N, x[8], y[8], k;
  double d[28], avg;
  k = scanf("%d", &N);
  for ( i=0;i<N;i++ )
    k = scanf("%d %d",&(x[i]), &(y[i]));
  k = 0;
  for ( i=0;i<N-1;i++ ) {
    for ( j=i+1;j<N;j++ ) {
      d[k] = sqrt( (double)((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])) );
      k++;
    }
  }
  avg = d[0];
  for ( i=1;i<k;i++ )
    avg += d[i];
  avg = (avg + avg) / (double)N;
  pritnf("%lf", avg);
}

Compiler output:
main.c: In function 'main':
main.c:22:3: error: implicit declaration of function 'pritnf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   22 |   pritnf("%lf", avg);
      |   ^~~~~~
      |   printf
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n;
const int jc[11]= {1,1,2,6,24,120,720,5040,40320,362880,3628800};
int x[10],y[10],dis[100];
float sum;
bool flag[10];
int main()
{
  cin>>n;
  for (int i=1; i<=n; ++i) cin>>x[i]>>y[i];
  for (int i=1; i<=n; ++i)
    for (int j=1; j<=n; ++j)
      if (i!=j)
        sum+=(jc[n]-1)*sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
  cout<<precision(10);
  cout<<sum;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'precision' was not declared in this scope
   16 |   cout<<precision(10);
      |         ^~~~~~~~~
Language: C++

from math import hypot
import sys as sy

a=int(input())
pts = []
for i in range(a):
    x,y=map(int,sy.stdin.readline().split())
    pts.append((x,y))


ptdiff = lambda p1, p2: (p1[0]-p2[0], p1[1]-p2[1])

diffs = (ptdiff(p1, p2) for p1, p2 in zip (pts, pts[1:]))
path = sum(hypot(*d) for d in  diffs)
print(path)

Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from math import hypot
      | ^~~~
Language: C++

#include <bits/stdc++.h>

double length(int x1, int y1, int x2, int y2)
{
    return sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
}

int main()
{
    int n;
    std::cin >> n;
    std::vector<int> p(n);
    for (int i = 0; i < n; i++) { p[i] = i+1; }
    std::vector<int> x(n);
    std::vector<int> y(n);
    for (int i = 0; i < n; i++) { std::cin >> x[i] >> y[i]; }

    std::vector<double> len;
    do {
        // for (int i = 0; i < n; i++) { std::cout << p[i]; } std::cout << std::endl;
        double l = 0;
        for (int i = 1; i < n; i++) {
            int now = p[i]-1;
            int prev = p[i-1]-1;
            l += length(x[prev], y[prev], x[now], y[now]);
        }
        len.push_back(l);
    } while (std::next_permutation(p.begin(), p.end()));

    double ans = 0;
    for (size_t i = 0; i < len.size(); i++) {
        // std::cout << len[i] << std::endl;
        ans += len[i];
    }

    std::cout << ans / len.size() << std::endl;
    return 0;
}
jjjjj

Compiler output:
a.cc:39:1: error: 'jjjjj' does not name a type
   39 | jjjjj
      | ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n;
const int jc[11]= {1,1,2,6,24,120,720,5040,40320,362880,3628800};
int x[10],y[10],dis[100];
float sum;
bool flag[10];
int main()
{
  cin>>n;
  for (int i=1; i<=n; ++i) cin>>x[i]>>y[i];
  for (int i=1; i<=n; ++i)
    for (int j=1; j<=n; ++j)
      if (i!=j)
        sum+=(jc(n)-1)*sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
  cout<<sum;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'jc' cannot be used as a function
   15 |         sum+=(jc(n)-1)*sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
      |               ~~^~~
Language: C

#include<iostream>
#include<algorithm>//next_permutation
#include<cmath>
using namespace std;

int main(){
	int N;
	double sum = 0.0;
	int num = 0;
	int i;
	scanf("%d",&N);

	int arrange[2][N];
	int array[N];

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

	for(i=0;i<N;i++){
		scanf("%d %d",&arrange[0][i],&arrange[1][i]);
	}

    do{
		 double temp = 0;
        for(int i=0; i<N-1; i++){
			temp = sqrt(pow(arrange[0][array[i]]-arrange[0][array[i+1]],2.0)+pow(arrange[1][array[i]]-arrange[1][array[i+1]],2.0));
            sum += temp;
        }
		num++;

    }while(next_permutation(array,array+N));
	printf("%.8f",sum/num);
    return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

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

double pou(double jk, double jd, double dk, double dd){
  double hk=sqrt(pow(jk-jd,2.0)+pow(dk-dd,2.0));
  return hk;
}

int main(){
  int n;
  cin>>n;
  double x[n], y[n];
  for(int i=0;i<n;i++){
    cin>>x[i]>>y[i];
  }
  double sel=n*(n-1)/2;
  
  
  double dist=0;
  for(int r=0;r<n;r++){
    for(int q=0;q<n;q++){
      dist+=pou(x[r],x[q],y[r],y[q]);
    }
  }
  dist=dist/sel;
  cout<<dist<<endl;


  
      
  
    
  
    
                 
  

Compiler output:
a.cc: In function 'int main()':
a.cc:26:20: error: expected '}' at end of input
   26 |   cout<<dist<<endl;
      |                    ^
a.cc:9:11: note: to match this '{'
    9 | int main(){
      |           ^
Language: C

#include<stdio.h>
#include<math.h>

int main(){
   int n,m,ka;
   scanf("%d", &n);
   ka = n + n-2;
   char in[20];
   double aa[n][2], pp, sum=0;
   for(int i=0;i<n;i++){
   	fgets(in,sizeof(in),stdin);
    sscanf(in,"%lf %lf", &aa[i][0],&aa[i][1]);
   }
    int m=n-1,ave=1;
	while(m>0){
      for(int i=0;i<m-1;i++){
        pp = (aa[m][0]-aa[i][0])*(aa[m][0]-aa[i][0]) 
          + (aa[m][1]-aa[i][1])*(aa[m][1]-aa[i][1]);
        sqrt(pp);
        sum += pp*(double)ka;
      }
      m--;
      ave = m*ave;
    }
    printf("%d", sum/(ave*n));
   return 0;
 
}

Compiler output:
main.c: In function 'main':
main.c:14:9: error: redeclaration of 'm' with no linkage
   14 |     int m=n-1,ave=1;
      |         ^
main.c:5:10: note: previous declaration of 'm' with type 'int'
    5 |    int n,m,ka;
      |          ^
Language: C++

#include <bits/stdc++.h>
#include <cmath>
using namespace std;
 
int main() {
  int n;
  cin>>n;
  
  vector<int> x(n);
  vector<int> y(n);
  for (int i = 0; i < n; i++) {
    cin >> x.at(i)>>y.at(i);}
  
  vector<int> kai(n+1);//nまでの階乗
  kai.at(0)=1;
  for(int i=0; i<n;i++){
    kai.at(i+1)=(i+1)*kai.at(i);}

  long double sum=0;
  long double length=0;
  
  for(int i=0;i<n;i++){
    for(int j=0;j<i;j++){
      length=sqrt((x.at(i)-x.at(j))*(x.at(i)-x.at(j))
                  +(y.at(i)-y.at(j))*(y.at(i)-y.at(j)));
      sum+=length;
    }
  }
  
  cout<<sum*2*kai(n)/n<<endl;
}
  

    

Compiler output:
a.cc: In function 'int main()':
a.cc:30:18: error: no match for call to '(std::vector<int>) (int&)'
   30 |   cout<<sum*2*kai(n)/n<<endl;
      |               ~~~^~~
Language: C++

#define NDEBUG

#include <unordered_map>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <utility>
#include <string>
#include <vector>
#include <queue>
#include <tuple>
#include <set>
#include <map>

// [0, max)
#define FOR0(var, max) for (sl (var) = 0; (var) < (max); ++(var))
// [min, max)
#define FORi(var, min, max) for (sl (var) = (min); (var) < (max); ++(var))
// [min, max)
#define FORi_INV(var, min, max) for (sl (var) = (max) - 1; (var) + 1 > (min); --(var))
#define FORITER(var, iter) for (auto (iter) = (var).begin(); (iter) != (var).end(); (iter)++)
#define FORITER_INV(var, iter) for (auto (iter) = (var).rbegin(); (iter) != (var).rend(); (iter)++)

// a < b < c
#define LTLT(a, b, c) (((a) < (b)) && ((b) < (c)))
// a <= b < c
#define LELT(a, b, c) (((a) <= (b)) && ((b) < (c)))
// a < b <= c
#define LTLE(a, b, c) (((a) < (b)) && ((b) <= (c)))
// a <= b <= c
#define LELE(a, b, c) (((a) <= (b)) && ((b) <= (c)))

#ifndef NDEBUG
#  define MASSERT(cond) m_assert(cond, __LINE__, #cond);
#else
#  define MASSERT(...)
#endif

using namespace std;

using uc = unsigned char;
using ui = unsigned int;
using ul = unsigned long long int;

using sc = signed char;
using si = signed int;
using sl = signed long long int;

using ld = long double;

void m_assert(const bool& cond, const sl& line, const char *condstr) {
  if (!cond) {
    cerr << "Assertion Failed: " << condstr << " at line " << line << endl;
    exit(1);
  }
}

const static si NMAX = 8;
const static si XiMAX = 1000;
const static si YiMAX = 1000;

static si N;
static si Xi[NMAX];
static si Yi[NMAX];

inline ld distance(ld x1, ld y1, ld x2, ld y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

void solve(void) {
  ld res = 0;
  FOR0(i, N) {
    FOR0(j, N) {
      res += abs(distance(Xi[i], Yi[i], Xi[j], Yi[j]) / N);
    }
  }
  cout << setprecision(20) << res << endl;
}

int main(void) {
  cin >> N;
  FOR0(i, N) {
    cin >> Xi[i] >> Yi[i];
  }
  solve();
  return 0;
}

Compiler output:
a.cc: In function 'ld distance(ld, ld, ld, ld)':
a.cc:70:10: error: 'sqrt' was not declared in this scope
   70 |   return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
      |          ^~~~
Language: C++

#include<bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
  int N;
  vector<int> X(N);
  vector<int> Y(N);
  cin >> N;
  for(int i = 0; i < N; i ++){
    cin >> X[i] >> Y[i];
  }
  
  int a, b, x, y;
  double c, d, ans;
    a = X[0] - X[1];
  	b = Y[0] - Y[1];
    x = pow(a, 2.0);
    y = pow(b, 2.0);
  	c = a + b
    d = pow( c, 0.5);
    ans = c/2;
  cout << ans << endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:19:18: error: expected ';' before 'd'
   19 |         c = a + b
      |                  ^
      |                  ;
   20 |     d = pow( c, 0.5);
      |     ~
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

#define _GLIBCXX_DEBUG
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

double length(pair<int, int> a, pair<int, int> b){
    int aa = (b.first - a.first) * (b.first - a.first);
    int bb = (b.second - a.second) * (b.second - a.second);
    return sqrt(aa + bb);
}

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int n, x, y;
    cin >> n;
    vector<pair<int, int>> v(n);
    for(int i=0; i<n; i++){
        cin >> x >> y;
        v.at(i) = make_pair(x, y);
    }
    double res = 0;
    for(int i=0; i<n-1; i++){
        for(int j=i+1; j<n; j++){
            res += length(v.at(i), v.at(j));
        }
    }
    res = res * 2 / n;
    cout << std::setprecision(15) << res << endl;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:42:18: error: 'setprecision' is not a member of 'std'
   42 |     cout << std::setprecision(15) << res << endl;
      |                  ^~~~~~~~~~~~
a.cc:11:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
   10 | #include <stack>
  +++ |+#include <iomanip>
   11 |
Language: C++



#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

typedef unsigned long long ULLONG;
typedef long long LLONG;

template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}
template <class _T> static _T tp_pow(int base, int exp)
{
	_T ans = 1;

	for (int i = 0; i < exp; i++) {
		ans *= base;
	}
	return ans;
}
static const long long MOD_NUM = 1000000007LL;

template <class _T> _T nexp(_T N) {
	_T num = N;
	_T ans = 1;
	while (N) {
		ans *= N;
		N--;
	}
	return ans;
}

static void C_task();

int main()
{
	C_task();
	fflush(stdout);
	return 0;
}

static double C_calc(int N, const std::pair<int, int>* town, std::vector<int>& root)
{
	double dist = 0;
	for (int i = 1; i < N; i++) {
		dist += sqrt(tp_pow<LLONG>((town[root[i]].first - town[root[i - 1]].first), 2) 
				+ tp_pow<LLONG>((town[root[i]].second - town[root[i - 1]].second), 2));
	}
	return dist;
}

static double dfs(int N, int now, const std::pair<int, int>* town, std::vector<int> root, std::vector<bool> flag)
{
	double dist = 0;

	if (now == N) {
		return C_calc(N, town, root);
	}

	for (int i = 0; i < N; i++) {
		if (flag[i] == false) {
			flag[i] = true;
			root[now] = i;
			dist += dfs(N, now + 1, town, root, flag);
			flag[i] = false;
		}
	}
	return dist;
}

static void C_task()
{
	int N;
	get1int(N);

	std::pair<int, int> town[8];

	for (int i = 0; i < N; i++) {
		int x, y;
		get2int(x, y);
		town[i].first = x;
		town[i].second = y;
	}
	std::vector<bool> flag(N, 0);
	std::vector<int> root(N, 0);

	double ans = dfs(N, 0, town, root, flag) / (double)(nexp(N));

	printf("%.8lf\n", ans);
}


Compiler output:
a.cc: In function 'double C_calc(int, const std::pair<int, int>*, std::vector<int>&)':
a.cc:94:25: error: 'sqrt' was not declared in this scope
   94 |                 dist += sqrt(tp_pow<LLONG>((town[root[i]].first - town[root[i - 1]].first), 2)
      |                         ^~~~
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

#define _GLIBCXX_DEBUG
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

double length(pair<int, int> a, pair<int, int> b){
    int aa = (b.first - a.first) * (b.first - a.first);
    int bb = (b.second - a.second) * (b.second - a.second);
    return sqrt(aa + bb);
}

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int n, x, y;
    cin >> n;
    vector<pair<int, int>> v(n);
    for(int i=0; i<n; i++){
        cin >> x >> y;
        v.at(i) = make_pair(x, y);
    }
    double res = 0;
    for(int i=0; i<n-1; i++){
        for(int j=i+1; j<n; j++){
            res += length(v.at(i), v.at(j));
        }
    }
    res = res * 2 / n;
    cout << setprecision(15) << res << endl;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:42:13: error: 'setprecision' was not declared in this scope
   42 |     cout << setprecision(15) << res << endl;
      |             ^~~~~~~~~~~~
a.cc:11:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
   10 | #include <stack>
  +++ |+#include <iomanip>
   11 |
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
//#include <queue>

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;

using namespace std;

typedef long long ll;

const long long int INF = 1 << 30; //10^10
const ll MOD = 998244353;

inline void maxch(int& a, int b) { if (a < b) a = b; }



int main() {
	int n;
	cin >> n;
	
	vector<int> x(n), y(n);
	rep(i,n) cin >> x[i] >> y[i];

	long double ans = 0;
	vector<int> perm(n);
	rep(i,n) perm[i] = i;
	do {
	  rep(i,n-1) ans += sqrt(pow(x[perm[i]] - x[perm[i+1]],2) + pow(y[perm[i]] - y[perm[i + 1]], 2));
	}while(next_permutation(perm.begin(),perm.end()));

	int a = 1;
	rep(i,n) a *= i+1;

	printf("%f",ans / (long double) a);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:34: error: 'pow' was not declared in this scope
   31 |           rep(i,n-1) ans += sqrt(pow(x[perm[i]] - x[perm[i+1]],2) + pow(y[perm[i]] - y[perm[i + 1]], 2));
      |                                  ^~~
a.cc:31:29: error: 'sqrt' was not declared in this scope
   31 |           rep(i,n-1) ans += sqrt(pow(x[perm[i]] - x[perm[i+1]],2) + pow(y[perm[i]] - y[perm[i + 1]], 2));
      |                             ^~~~
Language: C++

import sys
from collections import *
from heapq import *
from fractions import gcd
import itertools
import math

sys.setrecursionlimit(10**6)

def InMap(): return list(map(int, input().split(' ')))
def In(): return int(input())
def InS(): return input()

N = In()
pos = []
for i in range(N):
    pos.append(InMap())

Res = 0
for v in itertools.permutations(pos, N):
    tmp = 0
    for i in range(N - 1):
        tmp += math.sqrt((v[i][0] - v[i+1][0])**2 + (v[i][1] - v[i+1][1])**2)
    Res += tmp
print(Res / float(math.factorial(N)))
exit()


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main(){
  double n;
  cin >> n;
  vector<pair<double,double>> p(n);
  for(int i=0;i<n;i++){
    double x,y;
    cin >> x >> y;
    p[i].first=x;
    p[i].second=y;
  }
  //(n-1)!を求める
  dobule s=1;
  for(int i=0;i<n-1;i++){
    s*=i+1;
  }
  //距離の合計を求める
  double d=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      double a=p[i].first-p[j].first;
      double b=p[i].second-p[j].second;
      double t=sqrt(a*a+b*b);
      d += t*s;
    }
  }
  cout << fixed << setprecision(20);
  cout << d/(s*n) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'dobule' was not declared in this scope; did you mean 'double'?
   17 |   dobule s=1;
      |   ^~~~~~
      |   double
a.cc:19:5: error: 's' was not declared in this scope
   19 |     s*=i+1;
      |     ^
a.cc:28:14: error: 's' was not declared in this scope
   28 |       d += t*s;
      |              ^
a.cc:32:14: error: 's' was not declared in this scope
   32 |   cout << d/(s*n) << endl;
      |              ^
Language: C++

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

int n;
double x[8], y[8], t = 0;

int main()
{	

	cin >> n;

	for (int i = 0; i < n; i++)
		cin >> x[i] >> y[i];
	
	for (int i = 0; i < n - 1; i++)
		for (int j = i + 1; j < n; j++)
			t += sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));

	t *= 2;
	t /= n;

	cout << setprecision(12) << t << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:30: error: 'sqrt' was not declared in this scope
   18 |                         t += sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
      |                              ^~~~
Language: C++

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

int main() {

  int N;
  cin >> N;
  vector<int> X(N);
  vector<int> Y(N);
  for (int i = 0; i < N; i++) {
    cin >> X.at(i) >> Y.at(i);
  }
  double sumd = 2.0 - 2.0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      sumd += sqrt((X.at(i) - X.at(j)) * (X.at(i) - X.at(j)) + (Y.at(i) - Y.at(j)) * ((Y.at(i) - Y.at(j)));
    }
  }
  cout << sumd * (N - 1) / N << endl;
                   
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:107: error: expected ')' before ';' token
   16 |       sumd += sqrt((X.at(i) - X.at(j)) * (X.at(i) - X.at(j)) + (Y.at(i) - Y.at(j)) * ((Y.at(i) - Y.at(j)));
      |                   ~                                                                                       ^
      |                                                                                                           )
Language: C++

#include<stdio.h>
#include<algorithm>
#include<math.h>

using namespace std;

int x[10], y[10];
int order[10];

int main() {
  int n;
  
  scanf("%d", &n);
  
  for(int i=0; i<n; i++) scanf("%d%d", &x[i],&y[i]);
  for(int i=0; i<n; i++) order[i] = i;
  
  double allsum = 0.0;
  int count = 0;
  
  do {
    double curSum = 0.0;
    for(int i=1; i<n; i++) {
      int curX = x[order[i]] - x[order[i-1]];
      int curY = y[order[i]] - y[order[i-1]];
      double dist = sqrt( curX*curX + curY*curY);
      curSum += dist;
    }
    allSum += curSum;
    count++;
  } while(next_permutation(order,order+n));
  printf("%.10lf\n", allSum / (double)count);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:5: error: 'allSum' was not declared in this scope; did you mean 'allsum'?
   29 |     allSum += curSum;
      |     ^~~~~~
      |     allsum
a.cc:32:22: error: 'allSum' was not declared in this scope; did you mean 'allsum'?
   32 |   printf("%.10lf\n", allSum / (double)count);
      |                      ^~~~~~
      |                      allsum
Language: C++

#include<stdio.h>
#include<algorithm>

using namespace std;

int x[10], y[10];
int order[10];

int main() {
  int n;
  
  scanf("%d", &n);
  
  for(int i=0; i<n; i++) scanf("%d%d", &x[i],&y[i]);
  for(int i=0; i<n; i++) order[i] = i;
  
  double allsum = 0.0;
  int count = 0;
  
  do {
    double curSum = 0.0;
    for(int i=1; i<n; i++) {
      int curX = x[order[i]] - x[order[i-1]];
      int curY = y[order[i]] - y[order[i-1]];
      double dist = sqrt( curX*curX + curY*curY);
      curSum += dist;
    }
    allSum += curSum;
    count++;
  } while(next_permutation(order,order+n));
  printf("%.10lf\n", allSum / (double)count);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:21: error: 'sqrt' was not declared in this scope
   25 |       double dist = sqrt( curX*curX + curY*curY);
      |                     ^~~~
a.cc:28:5: error: 'allSum' was not declared in this scope; did you mean 'allsum'?
   28 |     allSum += curSum;
      |     ^~~~~~
      |     allsum
a.cc:31:22: error: 'allSum' was not declared in this scope; did you mean 'allsum'?
   31 |   printf("%.10lf\n", allSum / (double)count);
      |                      ^~~~~~
      |                      allsum
Language: C++

#include<stdio.h>
#include<algorithm>

using namespace std;

int x[10], y[10];
int order[10];

int main() {
  int n;
  
  scanf("%d", &n);
  
  for(int i=0; i<n; i++) scanf("%d%d", &x[i],&y[i]);
  for(int i=0; i<n; i++) order[i] = i;
  
  double allsum = 0.0;
  int count = 0;
  
  do {
    double curSum = 0.0;
    for(int i=1; i<n; i++) {
      int curX = x[order[i]] - x[order[i-1]];
      int curY = y[order[i]] - y[order[i-1]];
      double dist = sqrt( curX*curX + curY*curY);
      curSum += dist;
    }
    allSum += curSum;
    count++;
  } while(next_permutation(order,order+n));
  printf("%.10lf\n, allSum / (double)count);
  return 0;
}

Compiler output:
a.cc:31:10: warning: missing terminating " character
   31 |   printf("%.10lf\n, allSum / (double)count);
      |          ^
a.cc:31:10: error: missing terminating " character
   31 |   printf("%.10lf\n, allSum / (double)count);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:25:21: error: 'sqrt' was not declared in this scope
   25 |       double dist = sqrt( curX*curX + curY*curY);
      |                     ^~~~
a.cc:28:5: error: 'allSum' was not declared in this scope; did you mean 'allsum'?
   28 |     allSum += curSum;
      |     ^~~~~~
      |     allsum
a.cc:32:3: error: expected primary-expression before 'return'
   32 |   return 0;
      |   ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typdef long long int ll;
int main()
{
  int n;
  cin>>n;
  pair<int,int>a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i].first>>a[i].second;
  }
  vector<int>v;
  for(int i=0;i<n;i++)
    v.push_back(i);
    double sum=0.0;
  do {

        for(int i=0;i<n-1;i++)
        {
          double x=pow(a[v[i]].first-a[v[i+1]].first,2);
          double y=pow(a[v[i]].second-a[v[i+1]].second,2);
          x=x+y;
          double z=(double)sqrt(x);
          sum=sum+z;
        }
    } while (next_permutation(v.begin(),v.end()));
  ll fact=1;
  for(int i=2;i<=n;i++)
    fact=fact*i;
  double ans=sum/(double)fact;
  cout<<fixed<<setprecision(12)<<ans<<"\n";
  return 0;
}

Compiler output:
a.cc:3:1: error: 'typdef' does not name a type; did you mean 'typedef'?
    3 | typdef long long int ll;
      | ^~~~~~
      | typedef
a.cc: In function 'int main()':
a.cc:28:3: error: 'll' was not declared in this scope
   28 |   ll fact=1;
      |   ^~
a.cc:30:5: error: 'fact' was not declared in this scope
   30 |     fact=fact*i;
      |     ^~~~
a.cc:31:26: error: 'fact' was not declared in this scope
   31 |   double ans=sum/(double)fact;
      |                          ^~~~
Language: C++

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

const int N = 8;

int n;
pair <int, int> P[N];

void input() {
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> P[i].first >> P[i].second;
    return;
}

double dis(pair <int, int> p, pair <int, int> q) {
    double d1 = p.first - q.first, d2 = p.second - q.second;
    return sqrt(d1 * d1 + d2 * d2);
}

void solve() {
    cout.precision(10);
    double sum = 0.0;

    int fact = 1;
    for (int i = 1; i <= n; i++)
        fact *= i;

    for (int i = 0; i < fact; i++) {
        double cor = 0.0;
        for (int i = 0; i < n - 1; i++)
            cor += dis(P[i], P[i + 1]);
        //cerr << " ** " << cor << endl;
        sum += cor;

        next_permutation(P, P + n);
    }

    cout << sum / fact << fixed << endl;
    return;
}

int main() {
    input();
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'double dis(std::pair<int, int>, std::pair<int, int>)':
a.cc:19:12: error: 'sqrt' was not declared in this scope
   19 |     return sqrt(d1 * d1 + d2 * d2);
      |            ^~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9+7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
long long sum = 0;

typedef pair<int, int> Pa;
typedef long long ll;

bool visited[8] = {false};
double sums = 0;
int f = 1;
int index = 0;
int x[8], y[8];
double range(int i, int j){
    return sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
}

void bfs(int i, double sum){
    visited[i] = true;
    rep(j, N){
        if(!visited[j]) bfs(j, sum+range(i, j)); 
    }
    bool flag = false;
    rep(j, N){
        flag |= !visited[j];
    }
    if(!flag) sums += sum/f;
    visited[i] = false;
}

int main() {
    cin >> N;
    rep(i, N){
        cin >> x[i] >> y[i];
    }
    rep(i, N){
        f *= (i+1);
    }
    rep(i, N){
        bfs(i, 0);
    }
    cout << setprecision(16) <<sums;
}


Compiler output:
a.cc:16:5: error: 'int index' redeclared as different kind of entity
   16 | int index = 0;
      |     ^~~~~
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
double nx[15],ny[15],dis[15][15],ans;
int sum=1,sum2,n,pos[15];
inline double sqr(double x){
    return x*x;
} 
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i){
        scanf("%lf%lf",&nx[i],&ny[i]);
        pos[i]=i;
        sum*=i;
    }
    sum2=sum;
    for(int i=1;i<=n;++i)
        for(int j=i+1;j<=n;++j)
            dis[i][j]=dis[j][i]=sqrt(sqr(nx[i]-nx[j])+sqr(ny[i]-ny[j]));
    do{
        for(int i=1;i<n;++i){
            ans+=dis[pos[i]][pos[i+1]];
            //cout<<pos[i]<<" "<<pos[i+1]<<" "<<dis[pos[i]][pos[i+1]]<<endl;
        }
        next_permutation(pos+1,pos+n+1);
    }while(--sum);
    printf("%.10lf",ans/sum2);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:33: error: 'sqrt' was not declared in this scope; did you mean 'sqr'?
   20 |             dis[i][j]=dis[j][i]=sqrt(sqr(nx[i]-nx[j])+sqr(ny[i]-ny[j]));
      |                                 ^~~~
      |                                 sqr
Language: C++

#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
typedef long long ll;
#define PB	push_back
#define FOR(n)			for(int i = 0; i < n; ++i)
#define RFOR(n)			for(int i = n; i >= 0; --i)
#define FORR(start,end) for(int i = start; i < end; ++i)
#define COUT(n)			cout << n << " " << flush
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define mii(m)			map<int, int> m
#define msi(m)			map<string, int, less<>> m
#define mmsi(m)			multimap<string, int, less<>> m
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
#define PI 3.141592
#define MOD 1e9+7
using namespace std;

typedef struct {
	double x;
	double y;
}point;

double len(point p1, point p2) {
	double dx = p1.x - p2.x;
	double dy = p1.y - p2.y;
	return sqrt((dx * dx) + (dy * dy));
}

int main() {
	int n;
	point p[8];
	double sum = 0;
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> p[i].x >> p[i].y;

	for (int i = 0; i < n - 1; ++i) {
		for (int j = i + 1; j < n; ++j) {
			sum += len(p[i], p[j]);
		}
	}

	printf("%.10f\n", (2*sum) / n);

	return 0;
}

Compiler output:
a.cc: In function 'double len(point, point)':
a.cc:31:16: error: 'sqrt' was not declared in this scope
   31 |         return sqrt((dx * dx) + (dy * dy));
      |                ^~~~
Language: C++

#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <math.h>
typedef long long ll;

int main(int argc, char *argv[])
{
	int n;

	cin >> n;
	vector<double> x(n);
	vector<double> y(n);
	for (int i=0; i<n; i++)
	{
		cin >> x[i]>>y[i];
	}
	double d=0;
	for (int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			d+=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
		}
	}


	cout <<std::setprecision(10)<< (d*2/n) << endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:31:21: error: 'setprecision' is not a member of 'std'
   31 |         cout <<std::setprecision(10)<< (d*2/n) << endl;
      |                     ^~~~~~~~~~~~
a.cc:8:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    7 | #include <math.h>
  +++ |+#include <iomanip>
    8 | typedef long long ll;
Language: C++

#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
typedef long long ll;
#define PB	push_back
#define FOR(n)			for(int i = 0; i < n; ++i)
#define RFOR(n)			for(int i = n; i >= 0; --i)
#define FORR(start,end) for(int i = start; i < end; ++i)
#define COUT(n)			cout << n << " " << flush
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define mii(m)			map<int, int> m
#define msi(m)			map<string, int, less<>> m
#define mmsi(m)			multimap<string, int, less<>> m
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
#define PI 3.141592
#define MOD 1e9+7
using namespace std;

typedef struct {
	long double x;
	long double y;
}point;

long double len(point p1, point p2) {
	long double dx = p1.x - p2.x;
	long double dy = p1.y - p2.y;
	return sqrt((dx * dx) + (dy * dy));
}

int main() {
	int n;
	point p[8];
	long double sum = 0;
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> p[i].x >> p[i].y;

	for (int i = 0; i < n - 1; ++i) {
		for (int j = i + 1; j < n; ++j) {
			sum += len(p[i], p[j]);
		}
	}

	printf("%.10lf\n", (2*sum) / n);

	return 0;
}

Compiler output:
a.cc: In function 'long double len(point, point)':
a.cc:31:16: error: 'sqrt' was not declared in this scope
   31 |         return sqrt((dx * dx) + (dy * dy));
      |                ^~~~
Language: C++

#include <iostream>
#include <numeric>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <iomanip>

using namespace std;
typedef long long ll;

double distance(double xi, double yi, double xj, double yj) {
    return sqrt((xi - xj) * (xi - xj) + (yi - yj) * (yi - yj));
}

int main() {
    int N;
    vector<double> X(N), Y(N);
    cin >> N;
    vector<int> range_n(N);
    iota(range_n.begin(), range_n.end(), 0);
    for (int i = 0; i< N; i++) {
        cin >> X[i] >> Y[i];
    }

    double ans = 0; int c = 0;
    do {
        c++;
        for (int i = 1; i < N; i++) {
            int city1 = range_n[i-1];
            int city2 = range_n[i];
            ans += distance(X[city1], Y[city1], X[city2], Y[city2]);
        }
    } while (next_permutation(range_n.begin(), range_n.end()));
    cout << std::setprecision(12) << ans / c << endl;
}

Compiler output:
a.cc: In function 'double distance(double, double, double, double)':
a.cc:13:12: error: 'sqrt' was not declared in this scope
   13 |     return sqrt((xi - xj) * (xi - xj) + (yi - yj) * (yi - yj));
      |            ^~~~
Language: C++

#include<iostream>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cstdio>
#include<sstream>
#include<vector>
#include<algorithm>
#include<unordered_map>

using namespace std;
#define read(x) scanf("%d",&x)
#define Read(x,y) scanf("%d%d",&x,&y)
#define gc(x)  scanf(" %c",&x);
#define mmt(x,y)  memset(x,y,sizeof x)
#define write(x) printf("%d\n",x)
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define ll long long
#define mod  998244353
const int N = 1e6 + 5;
const int M = 1e6 + 5;
double x[10],y[10];
int main(){
    int n;
    double sum = 0;
    cin>>n;
    for(int i =  1;i <= n;++i) cin>>x[i]>>y[i];
    int a[] = {0,1,2,3,4,5,6,7,8,9};
    int num = 0;
    do{
        num ++;
        for(int i = 2;i <= n;++i){
            sum += sqrt((x[a[i]] - x[a[i - 1]])*(x[a[i]] - x[a[i - 1]]) + (y[a[i]] - y[a[i - 1]]) *(y[a[i]] - y[a[i - 1]]));
        }
    }while(next_permutation(a + 1,a + n + 1));
    printf("%.10lf",sum / num);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:20: error: 'sqrt' was not declared in this scope
   36 |             sum += sqrt((x[a[i]] - x[a[i - 1]])*(x[a[i]] - x[a[i - 1]]) + (y[a[i]] - y[a[i - 1]]) *(y[a[i]] - y[a[i - 1]]));
      |                    ^~~~
Language: C++

#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
typedef long long ll;
#define PB	push_back
#define FOR(n)			for(int i = 0; i < n; ++i)
#define RFOR(n)			for(int i = n; i >= 0; --i)
#define FORR(start,end) for(int i = start; i < end; ++i)
#define COUT(n)			cout << n << " " << flush
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define mii(m)			map<int, int> m
#define msi(m)			map<string, int, less<>> m
#define mmsi(m)			multimap<string, int, less<>> m
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
#define PI 3.141592
#define MOD 1e9+7
using namespace std;

typedef struct {
	long double x;
	long double y;
}point;

long double len(point p1, point p2) {
	long double dx = p1.x - p2.x;
	long double dy = p1.y - p2.y;
	return sqrt((dx * dx) + (dy * dy));
}

int main() {
	int n;
	point p[8];
	long double sum = 0;
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> p[i].x >> p[i].y;

	for (int i = 0; i < n - 1; ++i) {
		for (int j = i + 1; j < n; ++j) {
			sum += len(p[i], p[j]);
		}
	}

	printf("%.10f\n", (2*sum) / n);

	return 0;
}

Compiler output:
a.cc: In function 'long double len(point, point)':
a.cc:31:16: error: 'sqrt' was not declared in this scope
   31 |         return sqrt((dx * dx) + (dy * dy));
      |                ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <functional>
#include <numeric>
#include <array>
	using namespace std;
	#define ll long long


int main() {
	int n, x[10], y[10];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
	}
	vector<int> v(n);
	double ans = 0;
	ll count = 0;
	iota(v.begin(), v.end(), 0);
	do {
		for (int i = 1; i < n; i++) {
			double hoge = (x[v[i]] - x[v[i - 1]]) * (x[v[i]] - x[v[i - 1]]) + (y[v[i]] - y[v[i - 1]]) * (y[v[i]] - y[v[i - 1]]);
			hoge = pow(hoge, 0.5);
			ans += hoge;
		}
		count++;
	} while (next_permutation(v.begin(), v.end()));
	ans = ans / count;
	printf("%8lf\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:32: error: 'pow' was not declared in this scope
   29 |                         hoge = pow(hoge, 0.5);
      |                                ^~~
Language: C++

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

using namespace  std;
int x[8];
int y[8];
double dist(int i, int j);

int main()
{
	int n; cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x[i] >> y[i];
	}
	vector<int> pathPoints;
	for (int i = 0; i < n; i++)
	{
		pathPoints.push_back(i);
	}

	int counter = 0;
	double length = 0;
	do
	{
		for (int i = 0; i < n - 1; i++)
		{
			length += dist(pathPoints[i], pathPoints[i + 1]);
		}
		counter++;
	} while (next_permutation(pathPoints.begin(), pathPoints.end()));
	cout << length / counter;
}

double dist(int i, int j)
{
	double xDiff = x[j] - x[i];
	double yDiff = y[j] - y[i];
	return sqrt(xDiff * xDiff + yDiff * yDiff);
}

Compiler output:
a.cc: In function 'double dist(int, int)':
a.cc:41:16: error: 'sqrt' was not declared in this scope
   41 |         return sqrt(xDiff * xDiff + yDiff * yDiff);
      |                ^~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace  std;
int x[8];
int y[8];
double diff(int i, int j);
int main()
{
	int n; cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x[i] >> y[i];
	}
	vector<int> pathPoints;
	for (int i = 0; i < n; i++)
	{
		pathPoints.push_back(i);
	}

	int counter = 0;
	double length = 0;
	do
	{
		for (int i = 0; i < n - 1; i++)
		{
			length += diff(pathPoints[i], pathPoints[i + 1]);
		}
		counter++;
	} while (next_permutation(pathPoints.begin(), pathPoints.end()));
	cout << length / counter;
}

double dist(int i, int j)
{
	double xDiff = x[j] - x[i];
	double yDiff = y[j] - y[i];
	return sqrt(xDiff * xDiff + yDiff * yDiff);
}

Compiler output:
/usr/bin/ld: /tmp/ccu8xXyh.o: in function `main':
a.cc:(.text+0x10c): undefined reference to `diff(int, int)'
collect2: error: ld returned 1 exit status
Language: C++

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

int li[10];
int n;
double x[10], y[10];

double sq(double a){
  return a*a;
}

double jarak(int a, int b){
  return sqrt(sq(x[a]-x[b]) + sq(y[a]-y[b]));
}

double compute(){
  double ret = 0;
  for(int i=2;i<=n;i++){
    ret += jarak(i,i-1);
  }
  return ret;
}

int main(){
  scanf("%d",&n);
  for(int i=1;i<=n;i++){
    scanf("%lf%lf",&x[i],&y[i]);
    li[i] = i;
  }
  double ans = 0;
  do{
    ans+=compute();
  } while(next_permutation(li+1,li+n+1);
  for(int i=1;i<=n;i++) ans/=(double)i;
  printf("%.9lf\n",ans);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:40: error: expected ')' before ';' token
   33 |   } while(next_permutation(li+1,li+n+1);
      |          ~                             ^
      |                                        )
Language: C++

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

#define FOR(i,m,M) for(int i = m;i<M;i++)

using namespace std;

int N;
double add = 0;
vector<double> x(8), y(8);

int fact(int n)
{
	if (n <= 1)
		return 1;
	else return n * fact(n - 1);
}

void sum(int i)
{
	
	FOR(k, 0, N)
	{
		double xdis = x[i] - x[k],ydis = y[i] - y[k];
		add += std::sqrt(xdis * xdis + ydis * ydis);
	}
}

int main()
{
	cin >> N;
	FOR(i, 0, N)
	{
		cin >> x[i] >> y[i];
	}
	FOR(i, 0, N)
	{
		sum(i); //すべての(i,j)に対しての距離を足す
	}
	cout<<setprecision(20) << add / N;
}



Compiler output:
a.cc: In function 'void sum(int)':
a.cc:27:29: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
   27 |                 add += std::sqrt(xdis * xdis + ydis * ydis);
      |                             ^~~~
      |                             sort
Language: C++

//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(0);

double fact(double n) {
  double ans = 1;

  for (size_t i = 1; i <= n; i++) {
    ans *= i;
  }
  return ans;
}


double dist(pair<double, double> p1, pair<double, double> p2) {

  double A = (p1.first - p2.first);
  A *= A;

  double B = (p1.second - p2.second);

  B *= B;

  A += B;

  return sqrt(A);



}
int main()
{

    int n;
    cin >> n;
    double arr[n];
    for (size_t i = 0; i < n; i++) {
      arr[i] = i;
    }

    pair<double, double> P[n];

    for (size_t i = 0; i < n; i++) {
       cin >> P[i].first >> P[i].second;
    }

    double sum = 0;

    do {

      double sum1 = 0;

      for (size_t i = 1; i < n; i++) {
         int A = arr[i - 1];
         int B = arr[i];

         sum1 += dist(P[A], P[B]);
      }

      sum += sum1;





    } while(next_permutation(arr, arr + n));

    //cout << fact(n) << "\n";

    cout << fixed << setprecision(7) << sum / fact(n);
}

// g++ -std=c++11


Compiler output:
a.cc: In function 'int main()':
a.cc:70:13: error: 'next_permutation' was not declared in this scope
   70 |     } while(next_permutation(arr, arr + n));
      |             ^~~~~~~~~~~~~~~~