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

#include <stdio.h>
#include <math.h>
    
double man_dis(int abvalue[],int n){
  int i;
  double dis=0;
    
  for(i=0;i<n;i++)  dis+=abvalue[i];
     
  return dis;
}
    
double euc_dis(int abvalue[],int n){
  int i,sq=0;
  double dis;
      
  for(i=0;i<n;i++)  sq+=pow(abvalue[i],2);
  dis=sqrt(sq);
    
  return dis;
}
    
double cube_dis(int abvalue[],int n){
  int i,cube=0;
  double dis;
    
  for(i=0;i<n;i++)  cube+=pow(abvalue[i],3);
  dis=cbrt(sq);
    
  return dis;
}
    
double cheby_dis(int abvalue[],int n){
  int i;
  double dis=0;
    
  for(i=0;i<n;i++){
    if(abvalue[i]>dis)  dis=abvalue[i];
  }
      
  return dis;
}
    
void calc_dis(int avec[],int bvec[],int n){
  int i,abvalue[100];
  double ans;
    
  for(i=0;i<n;i++){
    abvalue[i]=avec[i]-bvec[i];
    if(abvalue[i]<0)  abvalue[i]*=-1;
  }
    
  printf("%f\n",man_dis(abvalue,n));
  printf("%f\n",euc_dis(abvalue,n));
  printf("%f\n",cube_dis(abvalue,n));
  printf("%f\n",cheby_dis(abvalue,n));
}  
    
int main(void){
  int n,avec[100],bvec[100],i;
    
  scanf("%d",&n);
  for(i=0;i<n;i++)  scanf("%d",&avec[i]);
  for(i=0;i<n;i++)  scanf("%d",&bvec[i]);
    
  calc_dis(avec,bvec,n);
    
  return 0;
}

Compiler output:
main.c: In function 'cube_dis':
main.c:28:12: error: 'sq' undeclared (first use in this function)
   28 |   dis=cbrt(sq);
      |            ^~
main.c:28:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

int main(void){
  int n,avec[100],bvec[100];
  double abvalue,dis1=0,dis2=0,dis3=0,dis=0;

  scanf("%d",&n);
  for(i=0;i<n;i++)  scanf("%d",&avec[i]);
  for(i=0;i<n;i++)  scanf("%d",&bvec[i]);

  for(i=0;i<n;i++){
    abvalue=fab(avec[i]-bvec[i]);
    dis1+=abvalue;
    dis2+=pow(abvalue,2);
    dis3+=pow(abvalue,3);
    if(abvalue<dis)  dis=abvalue;
  }
  dis2=sqrt(dis2);  dis3=cbrt(dis3);

  printf("%f\n%f\n%f\n%f\n",dis1,dis2,dis3,dis);

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:7: error: 'i' undeclared (first use in this function)
    9 |   for(i=0;i<n;i++)  scanf("%d",&avec[i]);
      |       ^
main.c:9:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:13: error: implicit declaration of function 'fab'; did you mean 'fabs'? [-Wimplicit-function-declaration]
   13 |     abvalue=fab(avec[i]-bvec[i]);
      |             ^~~
      |             fabs
Language: C

#include <stdio.h>
#include <math.h>
 
int main(void){
  int n,avec[100],bvec[100],i;
  double abvalue,dis1=0,dis2=0,dis3=0,dis=0;
 
  scanf("%d",&n);
  for(i=0;i<n;i++)  scanf("%d",&avec[i]);
  for(i=0;i<n;i++)  scanf("%d",&bvec[i]);
 
  for(i=0;i<n;i++){
    abvalue=fab(avec[i]-bvec[i]);
    dis1+=abvalue;
    dis2+=pow(abvalue,2);
    dis3+=pow(abvalue,3);
    if(abvalue<dis)  dis=abvalue;
  }
  dis2=sqrt(dis2);  dis3=cbrt(dis3);
 
  printf("%f\n%f\n%f\n%f\n",dis1,dis2,dis3,dis);
 
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:13: error: implicit declaration of function 'fab'; did you mean 'fabs'? [-Wimplicit-function-declaration]
   13 |     abvalue=fab(avec[i]-bvec[i]);
      |             ^~~
      |             fabs
Language: C

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

int main (void)
{
	int kazu;
	double x[100],y[100];
	int a;
	double an1=0,at1,an2,at2=0,an3,at3,az3,go3=0,anm,sa[100];
	

	scanf("%d",&kazu);

	for(a=0;a<100;a++)//?????????
	{
		x[a]=0;
		y[a]=0;
		sa[a]=0;
	}

	for(a=0;a<kazu;a++)//x?????\???
	{
		scanf("%lf",&x[a]);
	}
	for(a=0;a<kazu;a++)//y?????\???
	{
		scanf("%lf",&y[a]);
	}
	

	for(a=0;a<kazu;a++)//??????????????????
	{
		at1= x[a]-y[a];
		if(at1<0)
		{
			at1=-1*at1;
		}

		an1= an1 + at1;
		
	}

	for(a=0;a<kazu;a++)//??????????????????
	{
		at2=(x[a]-y[a])*(x[a]-y[a])+at2;
		an2=sqrt(at2);
	}

	for(a=0;a<kazu;a++)//??????????????????
	{
		at3=x[a] - y[a];
		if(at3 < 0)
		{
			at3 = -1*at3;
		}

		az3=pow(at3,3);
		go3=go3+az3;
	}
		an3=pow(go3,1.0/3.0);


	 
	for(a=0;a<kazu;a++)//???????????????
	{
		sa[a]=x[a]-y[a];
		
		if(sa[a]<0)
		{
			sa[a]=-1*sa[a];
		}
		printf("%f\n",sa[a]);
	}
		
	anm = sa[0];
	for(a=0;a<kazu;a++)
	{
		printf("%f\n",anm);
		if(anm<sa[a])
		{
			anm=sa[a];
		}
		else
		{
			anm = anm;
		}

	}
	

Compiler output:
main.c: In function 'main':
main.c:88:9: error: expected declaration or statement at end of input
   88 |         }
      |         ^
Language: C

#include <stdio.h>
int main(void)
{
	int n,m,t,i,j;

	scanf("%d %d",&n,&m);
	
	int a[n][m] ,b[m] ,ans[n];

	for(i=0;i<n;i++)
	{
		for(j = 0;j<m;j++)
		{
			scnaf("%d",&a[i][j]);
		}
	}



	for(i=0;i<m;i++)
	{
		scanf("%d",&b[i]);
	}

	for(i=0;i<n;i++)
	{
		t = 0;
		
		for(j=0;j<m;j++)
		{
			t+=(a[i][j]*b[j]);
			
		}

		ans[i] = t;
		
		}

	for(i=0;i<n;i++)
	{
		printf("%d\n",ans[i]);
	}


	
	return 0;

}

Compiler output:
main.c: In function 'main':
main.c:14:25: error: implicit declaration of function 'scnaf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   14 |                         scnaf("%d",&a[i][j]);
      |                         ^~~~~
      |                         scanf
Language: C

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

int main(void)
{	
	int n, x[1000], y[1000],i;
	double p1 = 0, p2 = 0, p3 = 0, p = 0;

	scanf("%d",&n);

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

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

	for(i=0; i<n; i++)
	{
		if(x[i] < y[i])
		{
			p1 = p1 + y[i] - x[i];
			p3 = p3 + (y[i] - x[i]) * (y[i] - x[i]) * (y[i] - x[i]);
		}
		if(x[i] > y[i])
		{
			p1 = p1 + x[i] - y[i];
			p3 = p3 + (x[i] - y[i]) * (x[i] - y[i]) * (x[i] - y[i]);
		}

		p2 = 2p + (x[i] - y[i]) * (x[i] - y[i]);

		if(x[i] < y[i])
		{
			if(p < y[i] - x[i])
			{
				p = y[i] - x[i];
			}
		}
		if(x[i] > y[i])
		{
			if(p < x[i] - y[i])
			{
				p = x[i] - y[i];
			}
		}
	}

	printf("%f\n%f\n%f\n%f\n", p1, sqrt(p2), pow(p3, 1/3), p);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:34:22: error: invalid suffix "p" on integer constant
   34 |                 p2 = 2p + (x[i] - y[i]) * (x[i] - y[i]);
      |                      ^~
Language: C

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

int main(void)
{
	int x[100], y[100],n;
	double p;
/*?°???\??¨???*/
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &x[i]);
	}
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &y[i]);
	}
/*??????????????????????????¢*/
	for (p = 1; p < 4; p++)
	{
		double minkohu = 0;
		for (int a; a < n; a++)
		{
			minkohu = minkohu + pow(fabs(x[a] - y[a]), p);
		}
		printf("%lf\n", minkohu);
		minkohu = 0;
	}
/*?????§????????§????????¢*/
	double distance,num;
	distance = myabs(x[0] - y[0]);
	for (int j = 1; j < n; j++)
	{
		num = myabs(x[j] - y[j]);
		if (num > distance)distance = num;
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:31:20: error: implicit declaration of function 'myabs' [-Wimplicit-function-declaration]
   31 |         distance = myabs(x[0] - y[0]);
      |                    ^~~~~
Language: C

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

int main()
{
	int x[100], y[100],n;
	double p;
/*?°???\??¨???*/
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &x[i]);
	}
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &y[i]);
	}
/*??????????????????????????¢*/
	for (p = 1; p < 4; p++)
	{
		double minkohu = 0;
		for (int a=0; a < n; a++)
		{
			minkohu = minkohu + pow(fabs(x[a] - y[a]), p);
		}
		minkohu = pow(minkohu, 1 / p);
		printf("%lf\n", minkohu);
		minkohu = 0;
	}
/*?????§????????§????????¢*/
	double distance,num;
	distance = fabs(x[0] - y[0]);
	for (int j = 1; j < n; j++)
	{
		num = fabs(x[j] - y[j]);
		if (num > distance)
		{
			distance = num;
		}
	}
	printf("%lf\n", distance);
	return 0;
}

Compiler output:
/usr/bin/ld: /tmp/ccSC0REW.o: in function `main':
main.c:(.text+0x115): undefined reference to `pow'
/usr/bin/ld: main.c:(.text+0x151): undefined reference to `pow'
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
 
int main(void)
{
    double Ans1=0,Ans2=0,Ans3=0,x[101],y[101],Ans4=0,temp=0;
    int n,i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%lf",&x[i]);
    }
    for(i=0;i<n;i++){
        scanf("%lf",&y[i]);
    }
    for(i=0;i<n;i++){
        Ans1+=abs(x[i]-y[i]);
        Ans2+=(x[i]-y[i])*(x[i]-y[i]);
        Ans3+=(abs(x[i]-y[i]))*(abs(x[i]-y[i]))*(abs(x[i]-y[i]));
    }
    Ans2=sqrt(Ans2);
    Ans3=pow(Ans3,1.0/3.0);
    Ans4=abs(x[0]-y[0]);
    for(i=0;i<n;i++){
        if(Ans4>=abs(x[i]-y[i]))     Ans4=Ans4;
        else if(Ans4<abs(x[i]-y[i])) Ans4=abs(x[i]-y[i]);
    }
    printf("%lf\n",Ans1);
    printf("%lf\n",Ans2);
    printf("%lf\n",Ans3);
    printf("%lf\n",Ans4);
    return 0;
}
Ans4=abs(x[i]-y[i]);
    }
    printf("%lf\n",Ans1);
    printf("%lf\n",Ans2);
    printf("%lf\n",Ans3);
    printf("%lf\n",Ans4);
    return 0;
}

Compiler output:
main.c:34:1: warning: data definition has no type or storage class
   34 | Ans4=abs(x[i]-y[i]);
      | ^~~~
main.c:34:1: error: type defaults to 'int' in declaration of 'Ans4' [-Wimplicit-int]
main.c:34:10: error: 'x' undeclared here (not in a function)
   34 | Ans4=abs(x[i]-y[i]);
      |          ^
main.c:34:12: error: 'i' undeclared here (not in a function)
   34 | Ans4=abs(x[i]-y[i]);
      |            ^
main.c:34:15: error: 'y' undeclared here (not in a function); did you mean 'yn'?
   34 | Ans4=abs(x[i]-y[i]);
      |               ^
      |               yn
main.c:35:5: error: expected identifier or '(' before '}' token
   35 |     }
      |     ^
main.c:36:12: error: expected declaration specifiers or '...' before string constant
   36 |     printf("%lf\n",Ans1);
      |            ^~~~~~~
main.c:36:20: error: unknown type name 'Ans1'
   36 |     printf("%lf\n",Ans1);
      |                    ^~~~
main.c:37:12: error: expected declaration specifiers or '...' before string constant
   37 |     printf("%lf\n",Ans2);
      |            ^~~~~~~
main.c:37:20: error: unknown type name 'Ans2'
   37 |     printf("%lf\n",Ans2);
      |                    ^~~~
main.c:38:12: error: expected declaration specifiers or '...' before string constant
   38 |     printf("%lf\n",Ans3);
      |            ^~~~~~~
main.c:38:20: error: unknown type name 'Ans3'
   38 |     printf("%lf\n",Ans3);
      |                    ^~~~
main.c:39:12: error: expected declaration specifiers or '...' before string constant
   39 |     printf("%lf\n",Ans4);
      |            ^~~~~~~
main.c:39:20: error: expected declaration specifiers or '...' before 'Ans4'
   39 |     printf("%lf\n",Ans4);
      |                    ^~~~
main.c:40:5: error: expected identifier or '(' before 'return'
   40 |     return 0;
      |     ^~~~~~
main.c:41:1: error: expected identifier or '(' before '}' token
   41 | }
      | ^
Language: C

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

#define sqr(x)  ((x) * (x))
#define sqr2(x)  ((x) * (x) * (x))

int main(void)
{
  int n;
  int x[1001] = {0};
  int y[1001] = {0};
  int i;
  int sum1 = 0;
  int sum2 = 0;
  int sum3 = 0;
  int summ = 0;
  double D1 = 0;
  double D2 = 0;
  double D3 = 0;
  double Dm = 0;

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

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

  for(i = 0; i < n; i++){
    sum1 = abs(x[i]-y[i]);
    sum2 = sqr(abs(x[i]-y[i]));
    sum3 = sqr2(abs(x[i]-y[i]));
    summ = max(abs(x[i]-y[i]));
  }
  
  D1 = sqrt((double)(sum));
  D2 = sqrt((double)(sum2) / 2);
  D3 = sqrt((double)(sum3) / 3);
  Dm = sqrt((double)(summ));

  printf("%f\n%f\n%f\n%f\n", D1, D2, D3, Dm);

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:31:12: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   31 |     sum1 = abs(x[i]-y[i]);
      |            ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | 
main.c:34:12: error: implicit declaration of function 'max'; did you mean 'fmax'? [-Wimplicit-function-declaration]
   34 |     summ = max(abs(x[i]-y[i]));
      |            ^~~
      |            fmax
main.c:37:22: error: 'sum' undeclared (first use in this function); did you mean 'summ'?
   37 |   D1 = sqrt((double)(sum));
      |                      ^~~
      |                      summ
main.c:37:22: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

#define sqr(x)  ((x) * (x))
#define sqr2(x)  ((x) * (x) * (x))

int main(void)
{
  int n;
  int x[1001] = {0};
  int y[1001] = {0};
  int i;
  int sum1 = 0;
  int sum2 = 0;
  int sum3 = 0;
  int summ = 0;
  double D1 = 0;
  double D2 = 0;
  double D3 = 0;
  double Dm = 0;

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

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

  for(i = 0; i < n; i++){
    sum1 = abs(x[i]-y[i]);
    sum2 = sqr(abs(x[i]-y[i]));
    sum3 = sqr2(abs(x[i]-y[i]));
    summ = max(abs(x[i]-y[i]));
  }
  
  D1 = sqrt((double)(sum1));
  D2 = sqrt((double)(sum2) / 2);
  D3 = sqrt((double)(sum3) / 3);
  Dm = sqrt((double)(summ));

  printf("%f\n%f\n%f\n%f\n", D1, D2, D3, Dm);

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:31:12: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   31 |     sum1 = abs(x[i]-y[i]);
      |            ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | 
main.c:34:12: error: implicit declaration of function 'max'; did you mean 'fmax'? [-Wimplicit-function-declaration]
   34 |     summ = max(abs(x[i]-y[i]));
      |            ^~~
      |            fmax
Language: C

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

#define NUM 100

double Manhattan(double x[NUM], double y[NUM], int n);
double Euclidean(double x[NUM], double y[NUM], int n);
double MinkowskiP3(double x[NUM], double y[NUM], int n);
double Chebyshev(double x[NUM], double y[NUM], int n);

int a;

int main(void)
{
	int i ;
	int j = 0;
	int  n ;
	double ans1,ans2,ans3,ans4;
	double x[NUM];
	double y[NUM];

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

	ans1 = Manhattan(x, y, n);
	ans2 = Euclidean(x, y, n);
	ans3 = MinkowskiP3(x, y, n);
	ans4 = Chebyshev(x, y, n);

	printf("%lf\n%lf\n%lf\n%lf\n", ans1,ans2,ans3,ans4);

	return 0;
}

double Manhattan(double x[NUM], double y[NUM], int n){
	
	double z[NUM];
	double p1 = 0;

	for (a = 0; a < n; a++){
		z[a] = x[a] - y[a];
		p1 += abs(z[a]);
	}

	return p1;
}

double Euclidean(double x[NUM], double y[NUM], int n){

	double z[NUM];
	double s[NUM];
	double p2 = 0;

	for (a = 0; a < n; a++){
		z[a] = x[a] - y[a];
		s[a] = abs(z[a])*abs(z[a]);
		p2 += s[a];
	}

	return sqrt(p2);
}

double MinkowskiP3(double x[NUM], double y[NUM], int n){
	double z[NUM];
	double s[NUM];
	double p3 = 0;

	for (a = 0; a < n; a++){
		z[a] = x[a] - y[a];
		s[a] = abs(z[a])*abs(z[a])*abs(z[a]);
		p3 += s[a];
	}

	return pow(p3,1.0/3.0);
}

double Chebyshev(double x[NUM], double y[NUM], int n){

	double z[NUM];
	double s[NUM];
	double p4 = 0;

	for (a = 0; a < n; a++){
		z[a] = x[a] - y[a];
		s[a] = abs(z[a]);
		p4 = max(s[a - 1], s[a]);
	}
	
	return p4;
}

Compiler output:
main.c: In function 'Chebyshev':
main.c:92:22: error: implicit declaration of function 'max'; did you mean 'fmax'? [-Wimplicit-function-declaration]
   92 |                 p4 = max(s[a - 1], s[a]);
      |                      ^~~
      |                      fmax
Language: C

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

#define NUM 100

double Manhattan(double x[NUM], double y[NUM], int n);
double Euclidean(double x[NUM], double y[NUM], int n);
double MinkowskiP3(double x[NUM], double y[NUM], int n);
double Chebyshev(double x[NUM], double y[NUM], int n);

int a;

int main(void)
{
	int i ;
	int j = 0;
	int  n ;
	double ans1,ans2,ans3,ans4;
	double x[NUM];
	double y[NUM];

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

	ans1 = Manhattan(x, y, n);
	ans2 = Euclidean(x, y, n);
	ans3 = MinkowskiP3(x, y, n);
	ans4 = Chebyshev(x, y, n);

	printf("%lf\n%lf\n%lf\n%lf\n", ans1,ans2,ans3,ans4);

	return 0;
}

double Manhattan(double x[NUM], double y[NUM], int n){
	
	double z[NUM];
	double p1 = 0;

	for (a = 0; a < n; a++){
		z[a] = x[a] - y[a];
		p1 += abs(z[a]);
	}

	return p1;
}

double Euclidean(double x[NUM], double y[NUM], int n){

	double z[NUM];
	double s[NUM];
	double p2 = 0;

	for (a = 0; a < n; a++){
		z[a] = x[a] - y[a];
		s[a] = abs(z[a])*abs(z[a]);
		p2 += s[a];
	}

	return sqrt(p2);
}

double MinkowskiP3(double x[NUM], double y[NUM], int n){
	double z[NUM];
	double s[NUM];
	double p3 = 0;

	for (a = 0; a < n; a++){
		z[a] = x[a] - y[a];
		s[a] = abs(z[a])*abs(z[a])*abs(z[a]);
		p3 += s[a];
	}

	return pow(p3,1.0/3.0);
}

double Chebyshev(double x[NUM], double y[NUM], int n){

	double z[NUM];
	double s[NUM];
	double p4 = 0;

	for (a = 0; a < n; a++){
		z[a] = x[a] - y[a];
		s[a] = abs(z[a]);
		p4 = max(s[a], s[a + 1]);
	}
	
	return p4;
}

Compiler output:
main.c: In function 'Chebyshev':
main.c:92:22: error: implicit declaration of function 'max'; did you mean 'fmax'? [-Wimplicit-function-declaration]
   92 |                 p4 = max(s[a], s[a + 1]);
      |                      ^~~
      |                      fmax
Language: C

#include<stdio.h>
  
int main(void){

    scanf("%d",&num);
    for(i=0;i<num;i++)
        scanf("%d",&line[i]);
    for(i=0;i<num;i++)
        scanf("%d",&line1[i]);
    for(i=1;i<5;i++)
        printf("%lf\n",d(i));

    return 0;
}

int num,line[105],line1[105],i;
  
double d(int p){

    int i;
    double D;

    for(D=0.0,i=0;i<num;i++){
        if(p==4)D=D>abs(line[i]-line1[i])?D:abs(line[i]-line1[i]);
        else D+=pow(abs(line[i]-line1[i]),p);
    }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:17: error: 'num' undeclared (first use in this function)
    5 |     scanf("%d",&num);
      |                 ^~~
main.c:5:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:9: error: 'i' undeclared (first use in this function)
    6 |     for(i=0;i<num;i++)
      |         ^
main.c:7:21: error: 'line' undeclared (first use in this function)
    7 |         scanf("%d",&line[i]);
      |                     ^~~~
main.c:9:21: error: 'line1' undeclared (first use in this function)
    9 |         scanf("%d",&line1[i]);
      |                     ^~~~~
main.c:11:24: error: implicit declaration of function 'd' [-Wimplicit-function-declaration]
   11 |         printf("%lf\n",d(i));
      |                        ^
main.c: At top level:
main.c:18:8: error: conflicting types for 'd'; have 'double(int)'
   18 | double d(int p){
      |        ^
main.c:11:24: note: previous implicit declaration of 'd' with type 'int()'
   11 |         printf("%lf\n",d(i));
      |                        ^
main.c: In function 'd':
main.c:24:21: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   24 |         if(p==4)D=D>abs(line[i]-line1[i])?D:abs(line[i]-line1[i]);
      |                     ^~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    1 | #include<stdio.h>
  +++ |+#include <stdlib.h>
    2 | 
main.c:25:17: error: implicit declaration of function 'pow' [-Wimplicit-function-declaration]
   25 |         else D+=pow(abs(line[i]-line1[i]),p);
      |                 ^~~
main.c:2:1: note: include '<math.h>' or provide a declaration of 'pow'
    1 | #include<stdio.h>
  +++ |+#include <math.h>
    2 | 
main.c:25:17: warning: incompatible implicit declaration of built-in function 'pow' [-Wbuiltin-declaration-mismatch]
   25 |         else D+=pow(abs(line[i]-line1[i]),p);
      |                 ^~~
main.c:25:17: note: include '<math.h>' or provide a declaration of 'pow'
Language: C

#include<stdio.h>
  
int main(void){

    scanf("%d",&num);
    for(i=0;i<num;i++)
        scanf("%d",&line[i]);
    for(i=0;i<num;i++)
        scanf("%d",&line1[i]);
    for(i=1;i<5;i++)
        printf("%lf\n",d(i));

    return 0;
}

int num,line[105],line1[105],i;
  
double d(int p){

    int i;
    double D;

    for(D=0.0,i=0;i<num;i++){
        if(p==4)D=D>abs(line[i]-line1[i])?D:abs(line[i]-line1[i]);
        else D+=pow(abs(line[i]-line1[i]),p);
    }
    return p==4?D:pow((double)D,1.0/p);
}

Compiler output:
main.c: In function 'main':
main.c:5:17: error: 'num' undeclared (first use in this function)
    5 |     scanf("%d",&num);
      |                 ^~~
main.c:5:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:9: error: 'i' undeclared (first use in this function)
    6 |     for(i=0;i<num;i++)
      |         ^
main.c:7:21: error: 'line' undeclared (first use in this function)
    7 |         scanf("%d",&line[i]);
      |                     ^~~~
main.c:9:21: error: 'line1' undeclared (first use in this function)
    9 |         scanf("%d",&line1[i]);
      |                     ^~~~~
main.c:11:24: error: implicit declaration of function 'd' [-Wimplicit-function-declaration]
   11 |         printf("%lf\n",d(i));
      |                        ^
main.c: At top level:
main.c:18:8: error: conflicting types for 'd'; have 'double(int)'
   18 | double d(int p){
      |        ^
main.c:11:24: note: previous implicit declaration of 'd' with type 'int()'
   11 |         printf("%lf\n",d(i));
      |                        ^
main.c: In function 'd':
main.c:24:21: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   24 |         if(p==4)D=D>abs(line[i]-line1[i])?D:abs(line[i]-line1[i]);
      |                     ^~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    1 | #include<stdio.h>
  +++ |+#include <stdlib.h>
    2 | 
main.c:25:17: error: implicit declaration of function 'pow' [-Wimplicit-function-declaration]
   25 |         else D+=pow(abs(line[i]-line1[i]),p);
      |                 ^~~
main.c:2:1: note: include '<math.h>' or provide a declaration of 'pow'
    1 | #include<stdio.h>
  +++ |+#include <math.h>
    2 | 
main.c:25:17: warning: incompatible implicit declaration of built-in function 'pow' [-Wbuiltin-declaration-mismatch]
   25 |         else D+=pow(abs(line[i]-line1[i]),p);
      |                 ^~~
main.c:25:17: note: include '<math.h>' or provide a declaration of 'pow'
main.c:27:19: warning: incompatible implicit declaration of built-in function 'pow' [-Wbuiltin-declaration-mismatch]
   27 |     return p==4?D:pow((double)D,1.0/p);
      |                   ^~~
main.c:27:19: note: include '<math.h>' or provide a declaration of 'pow'
Language: C

#include <stdio.h>
#include <math.h>
 
int main()
{
    int i;
 
    int n;
    scanf("%d", &n);
    int x[n], y[n];
    for( i = 0; i < n; ++i )
        scanf("%d", &x[i]);
    for( i = 0; i < n; ++i )
        scanf("%d", &y[i]);
 
    int p;
    double D;
    for( p = 1; p < 4; ++p ){
        D = 0;
        for( i = 0; i < n; ++i )
            D += (double)(pow(fabs(x[i] - y[i]), p));
        D = (double)pow(D, 1.0/p);
        printf("%lf\n", D);
    }
 
    D = 0;
    for( i = 0; i < n; ++i ){
        double tmp = (double)(fabs(x[i] - y[i]));
        D = D < tmp ? tmp : D;
    }
    printf("%lf\n", D);
 
    return 0;

Compiler output:
main.c: In function 'main':
main.c:33:5: error: expected declaration or statement at end of input
   33 |     return 0;
      |     ^~~~~~
Language: C

#include <math.h>
int i,n,x[1000],y[1000];
double t;
double D(int p){
    int i;
    for(t=0,0,i=0;i<n;i++){
        if(p==4)t=t>abs(x[i]-y[i])?t:abs(x[i]-y[i]);
        else t+=pow(1.0*abs(x[i]-y[i]),p);
    }
    return p==4?t:pow(t,1.0/p);
}
main(){
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&x[i]);
    for(i=0;i<n;i++)scanf("%d",&y[i]);
    for(i=1;i<5;i++)printf("%lf\n",d(i));
}

Compiler output:
main.c: In function 'D':
main.c:7:21: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
    7 |         if(p==4)t=t>abs(x[i]-y[i])?t:abs(x[i]-y[i]);
      |                     ^~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    1 | #include <math.h>
  +++ |+#include <stdlib.h>
    2 | int i,n,x[1000],y[1000];
main.c: At top level:
main.c:12:1: error: return type defaults to 'int' [-Wimplicit-int]
   12 | main(){
      | ^~~~
main.c: In function 'main':
main.c:13:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   13 |     scanf("%d",&n);
      |     ^~~~~
main.c:2:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    1 | #include <math.h>
  +++ |+#include <stdio.h>
    2 | int i,n,x[1000],y[1000];
main.c:13:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   13 |     scanf("%d",&n);
      |     ^~~~~
main.c:13:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:16:21: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   16 |     for(i=1;i<5;i++)printf("%lf\n",d(i));
      |                     ^~~~~~
main.c:16:21: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:16:21: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:16:21: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:16:36: error: implicit declaration of function 'd' [-Wimplicit-function-declaration]
   16 |     for(i=1;i<5;i++)printf("%lf\n",d(i));
      |                                    ^
Language: C

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

double minkowski_dis(double x[], double y[], int n, double p);
double chebyshev_dis(double x[], double y[], int n);

int main(void) {
	int n;
	double *x, *y;

	scanf("%d", &n);
	x = calloc(n, sizeof(double));
	y = calloc(n, sizeof(double));

	if (x == NULL || y == NULL) puts("??±???????????????");
	else {
		int i;
		for (i = 0; i < n; i++) scanf("%d", &x[i]);
		for (i = 0; i < n; i++) scanf("%d", &y[i]);

		printf("%f\n", minkowski_dis(x, y, n, 1.0));
		printf("%f\n", minkowski_dis(x, y, n, 2.0));
		printf("%f\n", minkowski_dis(x, y, n, 3.0));
		printf("%f\n", chebyshev_dis(x,y,n));
	}

	free(x);
	free(y);
		return 0;
}

double minkowski_dis(double x[], double y[], int n, double p) {
	double sum = 0;
	int i;

	for (i = 0; i < n; i++) {
		sum += powf(fabs(x[i] - y[i]), p);
	}
	sum = powf(sum, 1 / p);

	return sum;
}

double chebyshev_dis(double x[], double y[], int n, int n) {
	int i;
	double sum = fabs(x[0] - y[0]);

	for (i = 1; i < n; i++) {
		if (sum < fabs(x[i] - y[i])) sum = fabs(x[i] - y[i]);
	}
	return sum;
}

Compiler output:
main.c:45:57: error: redefinition of parameter 'n'
   45 | double chebyshev_dis(double x[], double y[], int n, int n) {
      |                                                     ~~~~^
main.c:45:50: note: previous definition of 'n' with type 'int'
   45 | double chebyshev_dis(double x[], double y[], int n, int n) {
      |                                              ~~~~^
main.c:45:8: error: conflicting types for 'chebyshev_dis'; have 'double(double *, double *, int,  int)'
   45 | double chebyshev_dis(double x[], double y[], int n, int n) {
      |        ^~~~~~~~~~~~~
main.c:6:8: note: previous declaration of 'chebyshev_dis' with type 'double(double *, double *, int)'
    6 | double chebyshev_dis(double x[], double y[], int n);
      |        ^~~~~~~~~~~~~
Language: C

#include <stdio.h>
#include <math.h>
int main(){
 
  int n,x[100],y[100],i,pp[100];
  double p,p1=0,p2=0,p3=0,sub=0,sub2=0;
   
  scanf("%d",&n);
 
  //scan
  for(i = 0; i < n; i++){
 
    scanf("%d",&x[i]);
 
  }
 
  for(i = 0; i < n; i++){
     
    scanf("%d",&y[i]);
     
  }
   
  //p1
  for(i = 0; i < n; i++){
 
    p=x[i]-y[i];
 
    if(p < 0) p *= -1;
 
    p1 += p;
 
  }
 
  printf("%.5lf\n",p1);
 
  //p2
  for(i = 0; i < n; i++){
     
    p=x[i]-y[i];
     
    sub += pow(p,2);
 
  }
   
  printf("%.5lf\n",pow(sub,0.5));
 
  //p3
 
  for(i = 0; i < n; i++){
     
    p=x[i]-y[i];
 
    if(p < 0) p *= -1;
     
    sub2 += pow(p,3);
     
  }
 
  printf("%.5lf\n",pow(sub2,1.0/3.0));
 
  //pMAX
  for(i = 0; i < n; i++){
 
    pp[i]=x[i]-y[i];
 
    if(pp[i] < 0) pp[i] *= -1;
     
  }
 
 // for(i = 1; i < n; i++){
 
    if(pp[i-1] > pp[i]){
 
      pp[i]=pp[i-1];
 
    }
 
  }
 
  printf("%d\n",pp[n-1]);
 
  return 0;


Compiler output:
main.c:80:10: error: expected declaration specifiers or '...' before string constant
   80 |   printf("%d\n",pp[n-1]);
      |          ^~~~~~
main.c:80:17: error: unknown type name 'pp'
   80 |   printf("%d\n",pp[n-1]);
      |                 ^~
main.c:82:3: error: expected identifier or '(' before 'return'
   82 |   return 0;
      |   ^~~~~~
Language: C

include <stdio.h>
#include <math.h>
int main(){
 
  int n,x[100],y[100],i,pp[100];
  double p,p1=0,p2=0,p3=0,sub=0,sub2=0;
   
  scanf("%d",&n);
 
  //scan
  for(i = 0; i < n; i++){
 
    scanf("%d",&x[i]);
 
  }
 
  for(i = 0; i < n; i++){
     
    scanf("%d",&y[i]);
     
  }
   
  //p1
  for(i = 0; i < n; i++){
 
    p=x[i]-y[i];
 
    if(p < 0) p *= -1;
 
    p1 += p;
 
  }
 
  printf("%.5lf\n",p1);
 
  //p2
  for(i = 0; i < n; i++){
     
    p=x[i]-y[i];
     
    sub += pow(p,2);
 
  }
   
  printf("%.5lf\n",pow(sub,0.5));
 
  //p3
 
  for(i = 0; i < n; i++){
     
    p=x[i]-y[i];
 
    if(p < 0) p *= -1;
     
    sub2 += pow(p,3);
     
  }
 
  printf("%.5lf\n",pow(sub2,1.0/3.0));
 
  //pMAX
  for(i = 0; i < n; i++){
 
    pp[i]=x[i]-y[i];
 
    if(pp[i] < 0) pp[i] *= -1;
     
  }
 
  //for(i = 1; i < n; i++){
 
   // if(pp[i-1] > pp[i]){
 
     // pp[i]=pp[i-1];
 
   // }
 
//  }
 
  printf("%d\n",pp[n-1]);
 
  return 0;



Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:8:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    8 |   scanf("%d",&n);
      |   ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    2 | #include <math.h>
  +++ |+#include <stdio.h>
    3 | int main(){
main.c:8:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    8 |   scanf("%d",&n);
      |   ^~~~~
main.c:8:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:34:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   34 |   printf("%.5lf\n",p1);
      |   ^~~~~~
main.c:34:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:34:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:34:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:82:3: error: expected declaration or statement at end of input
   82 |   return 0;
      |   ^~~~~~
Language: C

#include <stdio.h>
#include <math.h>
int main(void){
    int n,x[100],y[100],i,t;
    double d1=0,d2=0,d3=0,di=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&x[i]);
    }
    for(i=0;i<n;i++){
        scanf("%d",&y[i]);
    }
    for(i=0;i<n;i++){
        t=x[i]-y[i];
        if(t<0)
            t=-t;
        d1+=t;
        d2+=t*t;
        d3+=t*t*t;
        if(di<t) di=t;
    }
    d2=pow(d2,1./2);
    d3=pow(d3,1./3);
    printf("%.6f\n%.6f\n%.6f\n%.6f\n",d1,d2,d3,di);
    return 0;



Compiler output:
main.c: In function 'main':
main.c:25:5: error: expected declaration or statement at end of input
   25 |     return 0;
      |     ^~~~~~
Language: C

#include <stdio.h>
#include <math.h>
 
double mx, d1, d2, d3;
    
int main(void)
{
double x[100], y;
int n, i;
    
scanf("%d", &n);
    
for (i = 0; i < n; i++) {
scanf("%lf", &x[i]);
}
    
for (i = 0; i < n; i++) {
scanf("%lf", &y);
x[i] = x[i] - y;
if (x[i] < 0) x[i] = -x[i];
if (x[i] > max) max = x[i];
}
    
for (i = 0; i < n; i++) {
D1 += y = x[i];
D2 += y *= y;
D3 += x[i] * y;
}
printf("%lf\n", d1);
printf("%lf\n", sqrt(d2));
printf("%lf\n", cbrt(d3));
printf("%lf\n", mx);
    
return 0;
}



Compiler output:
main.c: In function 'main':
main.c:21:12: error: 'max' undeclared (first use in this function); did you mean 'mx'?
   21 | if (x[i] > max) max = x[i];
      |            ^~~
      |            mx
main.c:21:12: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:1: error: 'D1' undeclared (first use in this function); did you mean 'd1'?
   25 | D1 += y = x[i];
      | ^~
      | d1
main.c:26:1: error: 'D2' undeclared (first use in this function); did you mean 'd2'?
   26 | D2 += y *= y;
      | ^~
      | d2
main.c:27:1: error: 'D3' undeclared (first use in this function); did you mean 'd3'?
   27 | D3 += x[i] * y;
      | ^~
      | d3
Language: C

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

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

    int n,i;
    double x[100],y[100];
    double p1,p2,p22,p3,p33,p4;
    
    scanf("%d", &n);
    
    for(i=0; i<n; i++) scanf("%lf",&x[i]);
    for(i=0; i<n; i++) scanf("%lf",&y[i]);
    
    p1=0;
    for(i=0; i<n; i++) p1 += fabs(x[i]-y[i]);
    
    p2=0;
    for(i=0; i<n; i++) p2 += pow(fabs(x[i]-y[i]),2);
    
    p3=0;
    for(i=0; i<n; i++) p3 += pow(fabs(x[i]-y[i]),3);
    
    p4=0;
    for(i=0; i<n; i++) {
        double a = fabs(x[i]-y[i]);
        if(a>p4) p4=a;
    }
    
    
    p22 = sqrt(p2);
    p33 = pow(p3, 1.0/3.0);

    
    printf("%lf\n%lf\n%lf\n%lf\n", p1, p22, p33 , p4);
    return 0;



Compiler output:
main.c: In function 'main':
main.c:36:5: error: expected declaration or statement at end of input
   36 |     return 0;
      |     ^~~~~~
Language: C++


#include <stdio.h>
#include <math.h>
int main() {
    int n;
    long double s;
    int x[1001];
    int y[1001];
    std::cin >> n; 
    for (int i = 1; i <= 2; i++){
        for (int j = 0; j < n; j++) {
            if(i==1) {
                scanf("%d",&x[j]);
            }
            else {
                scanf("%d",&y[j]);
            }
        }
    }
    for(int p = 1; p <= 100; p++) {
        s = 0;
        for(int k = 0; k < n; k++) {
            s += pow(abs(x[k] - y[k]), p);
        }
        if (p <= 3){
            printf("%Lf\n",pow(s, 1.0/p));
        }
        if(p == 100) {
            printf("%Lf\n",pow(s, 1.0/p));
        }
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:10: error: 'cin' is not a member of 'std'
    9 |     std::cin >> n;
      |          ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <math.h>
  +++ |+#include <iostream>
    4 | int main() {
Language: C++

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main() {
    int n;
    long double s;
    int x[1001];
    int y[1001];
    int z[1001];
    scanf(" %d",&n); 
    #include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main() {
    int n;
    long double s;
    int x[1001];
    int y[1001];
    int z[1001];
    scanf(" %d",&n); 
   
    for(int j = 0;j < n; j++) {
        z[j] = abs(x[j]-y[j]);
    }
    for(int i=0; i<n; ++i)
        scanf(" %d", &x[i]); 
    for(int i=0; i<n; ++i)
        scanf(" %d", &y[i]);
    for(int p = 1; p <= 3; p++) {
        s = 0;
        for(int k = 0; k < n; k++) {
            s += pow(abs(x[k] - y[k]), p);
        }
        printf("%lf\n",pow(s, double(1.0/p)));     
    } 
    int max = z[0];

    for(int t = 1; t < n; t++){
        if(max < z[t]){
            max = z[t];
        }
    }
    printf("%lf\n",(long double)max);
    return 0;
}






    for(int j = 0;j < n; j++) {
        z[j] = abs(x[j]-y[j]);
    }
    for(int p = 1; p <= 3; p++) {
        s = 0;
        for(int k = 0; k < n; k++) {
            s += pow(abs(x[k] - y[k]), p);
        }
        printf("%lf\n",pow(s, double(1.0/p)));     
    } 
    int max = z[0];

    for(int t = 1; t < n; t++){
        if(max < z[t]){
            max = z[t];
        }
    }
    printf("%lf\n",(long double)max);
    return 0;
}







Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   14 | int main() {
      |         ^~
a.cc:14:9: note: remove parentheses to default-initialize a variable
   14 | int main() {
      |         ^~
      |         --
a.cc:14:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:14:12: error: a function-definition is not allowed here before '{' token
   14 | int main() {
      |            ^
Language: C++

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

double dist_Minkowski(const vector<double> &x, const vector<double> &y, int p){
    if(p == 0){
        double temp = 1e5;
        for(int i = 0; i < (int)x.size(); i++){
            if(abs(x[i] - y[i]) > temp) temp = abs(x[i] - y[i]);
        }
        return temp;
    }
    double temp = 0;
    for(int i = 0; i < (int) x.size(); i++){
        temp += pow(abs(x[i] - y[i]), (double)p);
    }
    return pow(temp, 1 / (double)p);
}
int main(){
    int n; cin >> n;
    vector<double> a(n), b(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    printf("%.10f\n", dist_Minkowski(a, b, 1))
    printf("%.10f\n", dist_Minkowski(a, b, 2))
    printf("%.10f\n", dist_Minkowski(a, b, 3))
    printf("%.10f\n", dist_Minkowski(a, b, 0))
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:47: error: expected ';' before 'printf'
   23 |     printf("%.10f\n", dist_Minkowski(a, b, 1))
      |                                               ^
      |                                               ;
   24 |     printf("%.10f\n", dist_Minkowski(a, b, 2))
      |     ~~~~~~
Language: C++

#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

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

 double D_1 = 0.0;
 for(int i = 0; i < n; i++){
   D_1 += 1.0 * Abs(x[i] - y[i]);
 }
 printf("%f\n", D_1);

 double D_2 = 0.0;
 for(int i = 0; i < n; i++){
   D_2 += 1.0 * (x[i] - y[i])* (x[i] - y[i]);
 }
 printf("%f\n", D_2);

 double D_3 = 0.0;
 for(int i = 0; i < n; i++){
   D_3 += 1.0 * Abs( Pow(x[i] - y[i], 3) );
 }
 printf("%f\n", D_3);

 double D_4 = 0.0;
 for(int i = 0; i < n; i++){
   if(Abs(x[i] - y[i]) > D_4) D_4 = Abs(x[i] - y[i]);
 }
 printf("%f\n", D_4);
}
 
 


Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: 'Abs' was not declared in this scope; did you mean 'abs'?
   19 |    D_1 += 1.0 * Abs(x[i] - y[i]);
      |                 ^~~
      |                 abs
a.cc:31:22: error: 'Pow' was not declared in this scope; did you mean 'pow'?
   31 |    D_3 += 1.0 * Abs( Pow(x[i] - y[i], 3) );
      |                      ^~~
      |                      pow
a.cc:31:17: error: 'Abs' was not declared in this scope; did you mean 'abs'?
   31 |    D_3 += 1.0 * Abs( Pow(x[i] - y[i], 3) );
      |                 ^~~
      |                 abs
a.cc:37:7: error: 'Abs' was not declared in this scope; did you mean 'abs'?
   37 |    if(Abs(x[i] - y[i]) > D_4) D_4 = Abs(x[i] - y[i]);
      |       ^~~
      |       abs
Language: C++

#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

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

 double D_1 = 0.0;
 for(int i = 0; i < n; i++){
   D_1 += 1.0 * Abs(x[i] - y[i]);
 }
 printf("%f\n", D_1);

 double D_2 = 0.0;
 for(int i = 0; i < n; i++){
   D_2 += 1.0 * (x[i] - y[i])* (x[i] - y[i]);
 }
 printf("%f\n", D_2);

 double D_3 = 0.0;
 for(int i = 0; i < n; i++){
   D_3 += 1.0 *abs( pow(x[i] - y[i], 3) );
 }
 printf("%f\n", D_3);

 double D_4 = 0.0;
 for(int i = 0; i < n; i++){
   if(abs(x[i] - y[i]) > D_4) D_4 = abs(x[i] - y[i]);
 }
 printf("%f\n", D_4);
}
 


Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: 'Abs' was not declared in this scope; did you mean 'abs'?
   19 |    D_1 += 1.0 * Abs(x[i] - y[i]);
      |                 ^~~
      |                 abs
Language: C++

#include<iostream>
#include<stdio.h>
#include<cmath>
using namespace std;

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

 double D_1 = 0.0;
 for(int i = 0; i < n; i++){
   D_1 += 1.0 * abs(x[i] - y[i]);
 }
 printf("%f\n", D_1);

 double D_2 = 0.0;
 for(int i = 0; i < n; i++){
   D_2 += 1.0 * pow(x[i] - y[i], 2);
 }
 printf("%f\n", sqrt(D_2));

 double D_3 = 0.0;
 for(int i = 0; i < n; i++){
   D_3 += 1.0 * pow(abs(x[i] - y[i]), 3) );
 }
 printf("%f\n", pow(D_3, 1.0 / 3.0));

 double D_4 = 0.0;
 for(int i = 0; i < n; i++){
   if(abs(x[i] - y[i]) > D_4) D_4 = abs(x[i] - y[i]);
 }
 printf("%f\n", D_4);
}
 


Compiler output:
a.cc: In function 'int main()':
a.cc:31:41: error: expected ';' before ')' token
   31 |    D_3 += 1.0 * pow(abs(x[i] - y[i]), 3) );
      |                                         ^~
      |                                         ;
Language: C++

#include <iostream>
#include <math.h>
using namespace std;

int main(){
  int n,i,j;
  cin >> n;
  double x[n];
  double y[n];
  double d1,d2,d3,di;
  for(i = 0; i < 2; i++){
    for(j = 0; j < n; j++){
      if(i == 0) cin >> x[j];
      if(i == 1) cin >> y[j];
    }
  }
  for(i = 0; i < n; i++){
    d1 += pow(fabs(x[i] - y[i]), 1);
  }
  for(i = 0; i < n; i++){
    d2 += pow(fabs(x[i] - y[i]), 2);
  }
  for(i = 0; i < n; i++){
    d3 += pow(fabs(x[i] - y[i]), 3);
  }
  for(i = 0; i < n-1; i++){
    di = max(x[i] - y[i], x[i+1] - y[i+1]);
  }

  cout << fixed << setprecision(16) << pow(d1,1.0/1)   << endl;
  cout << fixed << setprecision(16) <<pow(d2,1.0/2)   << endl;
  cout << fixed << setprecision(16) <<pow(d3,1.0/3)   << endl;
  cout << fixed << setprecision(16) << di << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:30:20: error: 'setprecision' was not declared in this scope
   30 |   cout << fixed << setprecision(16) << pow(d1,1.0/1)   << endl;
      |                    ^~~~~~~~~~~~
a.cc:3:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    2 | #include <math.h>
  +++ |+#include <iomanip>
    3 | using namespace std;
Language: C++

#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

int main(){
  int n,i,j;
  cin >> n;
  double x[n];
  double y[n];
  double d1,d2,d3,di;
  for(i = 0; i < 2; i++){
    for(j = 0; j < n; j++){
      if(i == 0) cin >> x[j];
      if(i == 1) cin >> y[j];
    }
  }
  for(i = 0; i < n; i++){
    d1 += pow(fabs(x[i] - y[i]), 1);
  }
  for(i = 0; i < n; i++){
    d2 += pow(fabs(x[i] - y[i]), 2);
  }
  for(i = 0; i < n; i++){
    d3 += pow(fabs(x[i] - y[i]), 3);
  }
  for(i = 0; i < n-1; i++){
    di = max(abs(x[i] - y[I]), abs(x[i+1] - y[I+1]));
  }

  cout << fixed << setprecision(16) << pow(d1,1.0/1)   << endl;
  cout << fixed << setprecision(16) <<pow(d2,1.0/2)   << endl;
  cout << fixed << setprecision(16) <<pow(d3,1.0/3)   << endl;
  cout << fixed << setprecision(16) << di << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:28:27: error: 'I' was not declared in this scope
   28 |     di = max(abs(x[i] - y[I]), abs(x[i+1] - y[I+1]));
      |                           ^
Language: C++

#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

int main(){
  int n,i,j;
  cin >> n;
  double x[n];
  double y[n];
  double d1,d2,d3,di;
  for(i = 0; i < 2; i++){
    for(j = 0; j < n; j++){
      if(i == 0) cin >> x[j];
      if(i == 1) cin >> y[j];
    }
  }
  for(i = 0; i < n; i++){
    d1 += pow(fabs(x[i] - y[i]), 1);
  }
  for(i = 0; i < n; i++){
    d2 += pow(fabs(x[i] - y[i]), 2);
  }
  for(i = 0; i < n; i++){
    d3 += pow(fabs(x[i] - y[i]), 3);
  }
  for(i = 0; i < n-1; i++){
    di = max(abs(x[i] - y[i]), abs(x[i+1] - y[i+1]);
    cout<< x[i] - y[i]<<endl;
  }

  cout << fixed << setprecision(8) << pow(d1,1.0/1)   << endl;
  cout << fixed << setprecision(8) <<pow(d2,1.0/2)   << endl;
  cout << fixed << setprecision(8) <<pow(d3,1.0/3)   << endl;
  cout << fixed << setprecision(8) << di << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:28:52: error: expected ')' before ';' token
   28 |     di = max(abs(x[i] - y[i]), abs(x[i+1] - y[i+1]);
      |             ~                                      ^
      |                                                    )
Language: C++

#include <iostream>
#incldue <stdio.h>
#include <cmath>
using namespace std;
int main(){
    int n;
    double a=0,b=0,c=0,d=0;
    cin>>n;
    double x[n]={};
    double y[n]={};
    for(int i=0;i<n;i++){
        cin>>x[i];
    }
    for(int i=0;i<n;i++){
        cin>>y[i];
    }
    for(int i=0;i<n;i++){
        if(x[i]>=y[i]){
            a+=x[i]-y[i];
        }
        else if(x[i]<y[i]){
            a+=y[i]-x[i];
        }
    }
    printf("%.8lf\n", a);
    for(int i=0;i<n;i++){
        b+=(x[i]-y[i])*(x[i]-y[i]);
    }
    printf("%.8lf\n",sqrt(b));
    for(int i=0;i<n;i++){
        if(x[i]>=y[i]){
            c[i]=x[i]-y[i];
            if(c[i]>=c[i-1]){
                d=c[i];
            }
        }
        else{
            c[i]=y[i]-x[i];
            if(c[i]>=c[i-1]){
                d=c[i];
            }
        }
    }
    printf("%.8lf\n",d);
return 0;
}


Compiler output:
a.cc:2:2: error: invalid preprocessing directive #incldue; did you mean #include?
    2 | #incldue <stdio.h>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:32:14: error: invalid types 'double[int]' for array subscript
   32 |             c[i]=x[i]-y[i];
      |              ^
a.cc:33:17: error: invalid types 'double[int]' for array subscript
   33 |             if(c[i]>=c[i-1]){
      |                 ^
a.cc:33:23: error: invalid types 'double[int]' for array subscript
   33 |             if(c[i]>=c[i-1]){
      |                       ^
a.cc:34:20: error: invalid types 'double[int]' for array subscript
   34 |                 d=c[i];
      |                    ^
a.cc:38:14: error: invalid types 'double[int]' for array subscript
   38 |             c[i]=y[i]-x[i];
      |              ^
a.cc:39:17: error: invalid types 'double[int]' for array subscript
   39 |             if(c[i]>=c[i-1]){
      |                 ^
a.cc:39:23: error: invalid types 'double[int]' for array subscript
   39 |             if(c[i]>=c[i-1]){
      |                       ^
a.cc:40:20: error: invalid types 'double[int]' for array subscript
   40 |                 d=c[i];
      |                    ^