Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
int compare_int(const void *a, const void *b){
  return *(long int*)b - *(long int*)a; // 大きい順
}
int compare_int_small(const void *a, const void *b){
  return *(long int*)a - *(long int*)b; // 小さい順
}
// 公約数
long long int gcd(long long int a, long long int b){
  if(b == 0){
    return a;
  }else{
    return gcd(b, a % b);
  }
}
// 最小公倍数 = a * b / 最大公約数
// 公倍数
long long int lcm(long long int a, long long int b){
  return a * b / gcd(a, b);
}

#define TRUE 1
#define FALSE 0
#define MAX_NUM 100002
typedef struct pp{
  char c;
  int h;
  int w;
}P;

int top = 0;
P *Stack = NULL;
P *tmp = NULL;


void initialize(){
  Stack = (P *)calloc(MAX_NUM, sizeof(P));
  top = 0;
}

void finalize(){
  if(Stack != NULL){
    free(Stack);
    Stack = NULL;
  }
}

int isEmpty(){
  if(top <= 0){
    return TRUE;
  }else{
    return FALSE;
  }
}

int isFull(){
  if(top > MAX_NUM - 1){
    return TRUE;
  }else{
    return FALSE;
  }
}

int push(P x){
  fprintf(stderr, "pushするのは%c (h, w) = (%d, %d)\n", x.c, x.h, x.w);
  //printf("push x = %d\n",x);
  if(isFull() != FALSE){
    //    fprintf(stderr, "pushしたのは%d top = %d\n", Stack[top], top);
    printf("Error! Overfllow\n");
    return 0;
  }else{
    top++;
    if(Stack != NULL){
      Stack[top] = x;
    }
    return 0;
  }
}

P pop(){
  if(isEmpty() != FALSE){
    printf("Error! Underfllow\n");
    return *tmp;
  }else{
    top--;
    // return では取りだす値を返す
    //    fprintf(stderr, "popしたのは%d top = %d\n", Stack[top + 1], top);
    return Stack[top+1];
  }
}


  void check(int check_town1[], int root1[], int now1){
    if(now1 == n){
      for(int i = 1; i < n; i++)
      {
      	distance += sqrt((x[root1[i]] - x[root1[i-1]])^2 + (y[root1[i]] - y[root1[i-1]])^2);
      }
      return;
    }
    
    for(int i = 1; i <= n; i++)
    {
      root1[now] = i;
      now1++;
      check(check_town1, root1, now1);
      
      now1--;
      root1[now1] = 0;
    }
  }
  

// min
int main(void){
  int n = 0;
  int x[10];
  int y[10];
  int now = 0; //現在地
  int check_town[10]; //訪れたかどうか
  int root[10]; //どの順番か
  long double distance;//そこまでの距離
  double d[30500];
  double ans = 0;
  int pattern = 1;

  scanf("%d", &n);

  for(int i = 0; i < n; i++){
    scanf("%d%d", &x[i], y[i]);
  }


  
  // 距離
  //  d[0] = sqrt((x[i] - x[j])^2 + (y[i] - y[j])^2);

  // 経路の数
  for(int i = 1; i <= n; i++)
  {
  	pattern *= i;
  }
  // 経路の数で割る
  ans = distance / pattern;
  
  printf("%f", ans);

  return 0;

}


Compiler output:
main.c: In function 'check':
main.c:100:16: error: 'n' undeclared (first use in this function)
  100 |     if(now1 == n){
      |                ^
main.c:100:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:103:9: error: 'distance' undeclared (first use in this function)
  103 |         distance += sqrt((x[root1[i]] - x[root1[i-1]])^2 + (y[root1[i]] - y[root1[i-1]])^2);
      |         ^~~~~~~~
main.c:103:27: error: 'x' undeclared (first use in this function)
  103 |         distance += sqrt((x[root1[i]] - x[root1[i-1]])^2 + (y[root1[i]] - y[root1[i-1]])^2);
      |                           ^
main.c:103:61: error: 'y' undeclared (first use in this function)
  103 |         distance += sqrt((x[root1[i]] - x[root1[i-1]])^2 + (y[root1[i]] - y[root1[i-1]])^2);
      |                                                             ^
main.c:110:13: error: 'now' undeclared (first use in this function); did you mean 'now1'?
  110 |       root1[now] = i;
      |             ^~~
      |             now1