semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int p[10][3],d2[10][10];
	float d[10][10];
	int i,j,k=0,n,N;

	scanf("%d",&n);
	for(i=0;i<n;i++)
		for(j=0;j<3;j++)
		scanf("%d",&p[i][j]);
	for(i=0;i<n-1;i++)
		for(j=i+1;j<n;j++)
		{
			d2[i][j]=(p[i][0]-p[j][0])*(p[i][0]-p[j][0])+(p[i][1]-p[j][1])*(p[i][1]-p[j][1])+(p[i][2]-p[j][2])*(p[i][2]-p[j][2]);
			d[i][j]=sqrt((float)d2[i][j]);
		}
	struct {float d;int p1;int p2;}A[46];
	for(i=0;i<n-1;i++)
		for(j=i+1;j<n;j++)
		{
			A[k].d=d[i][j];
			A[k].p1=i;
			A[k].p2=j;
			k++;
		}
	N=k;
	for(k=0;k<N;k++)
		for(j=0;j<N-1-k;j++)
			if(A[j].d<A[j+1].d)
			{
				A[45]=A[j];
				A[j]=A[j+1];
				A[j+1]=A[45];
			}
	for(k=0;k<N;k++)
		printf("(%d,%d,%d)-(%d,%d,%d)=%.2f\n",p[A[k].p1][0],p[A[k].p1][1],p[A[k].p1][2],p[A[k].p2][0],p[A[k].p2][1],p[A[k].p2][2],A[k].d);
	return 0;
}
int main() {


	int n,m=0,a=0;
	float l=0;
	float D[50];
	int X[11],Y[11],Z[11],p[50],q[50];
	cin>>n;
	for(int i=0;i<n;i++)
	{cin>>X[i];
	cin>>Y[i];
	cin>>Z[i];//?x,y,z??????
	}
	for(int i=0;i<n;i++)
		for(int j=i+1;j<n;j++)
		{
			D[m]=sqrt((X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j])+(Z[i]-Z[j])*(Z[i]-Z[j]));//???????????????D?
	        p[m]=i;//
	        q[m]=j;//???????????????????
	        m++;
		}
	for(int i=m-1;i>0;i--)
		for(int j=0;j<i;j++)
		{
			if(D[j]<D[j+1])
			{
			    l=D[j];
			    D[j]=D[j+1];
			    D[j+1]=l;

			    a=p[j];
			    p[j]=p[j+1];
			    p[j+1]=a;

			    a=q[j];
			    q[j]=q[j+1];
			    q[j+1]=a;
			}//?????????,???????????????????

		}
	for(int k=0;k<m;k++)//????????????

  printf("(%d,%d,%d)-(%d,%d,%d)=%.2f\n",X[p[k]],Y[p[k]],Z[p[k]],X[q[k]],Y[q[k]],Z[q[k]],D[k]);

	return 0;
}
int main()
{
    float a[100][9],b[20][4],max=0;//1-3???????4-5??????7???
    int n,i,j,k=1;
    cin>>n;
    for (i=1;i<=n;i++)
      {for(j=1;j<=3;j++){
          cin>>b[i][j];
          }}
    
    for (i=1;i<=n-1;i++)
       {for (j=i+1;j<=n;j++)
         {a[k][1]=b[i][1];
          a[k][2]=b[i][2];
          a[k][3]=b[i][3];
          a[k][4]=b[j][1];
          a[k][5]=b[j][2];
          a[k][6]=b[j][3];
          a[k][7]=sqrt(pow((a[k][1]-a[k][4]),2)+pow((a[k][2]-a[k][5]),2)+pow((a[k][3]-a[k][6]),2));
          a[k][8]=0; //??????
          k++;
          }
       }
   
   for(i = 1;i <= (n*n-n)/2;i++){
   for (k=1;k<=(n*n-n)/2;k++)
   {
       if (a[k][7]>max&&a[k][8]==0)
       max=a[k][7];
   }
   for (k=1;k<=(n*n-n)/2;k++)
   {if (max==a[k][7]&&a[k][8]==0){
   printf("(%.0f,%.0f,%.0f)-(%.0f,%.0f,%.0f)=%.2f\n",a[k][1],a[k][2],a[k][3],a[k][4],a[k][5],a[k][6],a[k][7]);
   a[k][8]=1;
   max=0;
   }}
   }
   return 0;  
}
/*
 *  Name:distance.cpp
 *
 *  Created on: 2012-11-05
 *  Author: ??
 *  Function?????
 */


int main()
{
	int n, i, j, count, temp=0;
	float sum;
	cin >> n;
	count=n*(n-1)/2;
	int point[3][n];
	float distance[count];
	float distance_temp;
	int ptp[2][count], ptp_temp;
	for (i=0;i<n;i++){
		for (j=0;j<3;j++){
			cin >> point[j][i];
		}
	}
	for (i=0;i<n-1;i++){
		for (j=i+1;j<n;j++){
			sum=(float)(point[0][i]-point[0][j])*(point[0][i]-point[0][j])+(point[1][i]-point[1][j])*(point[1][i]-point[1][j])+(point[2][i]-point[2][j])*(point[2][i]-point[2][j]);
			distance[temp]=sqrt(sum);
			ptp[0][temp]=i;
			ptp[1][temp]=j;
			temp++;
		}
	}
	for (i=0;i<count-1;i++){
		for (j=0;j<count-1-i;j++){
			if (distance[j]<distance[j+1]){
				distance_temp=distance[j];
				distance[j]=distance[j+1];
				distance[j+1]=distance_temp;
				ptp_temp=ptp[0][j+1];
				ptp[0][j+1]=ptp[0][j];
				ptp[0][j]=ptp_temp;
				ptp_temp=ptp[1][j+1];
				ptp[1][j+1]=ptp[1][j];
				ptp[1][j]=ptp_temp;
			}
		}
	}
	for (i=0;i<count;i++){
		cout << '(' << point[0][ptp[0][i]] << ',' << point[1][ptp[0][i]] << ',' << point[2][ptp[0][i]] << ")-(";
		cout << point[0][ptp[1][i]] << ',' << point[1][ptp[1][i]] << ',' << point[2][ptp[1][i]] << ")=";
		cout << fixed << setprecision(2) << distance[i] << endl;
	}
	return 0;
}
typedef struct point{
    int x, y, z;
} P;

typedef struct len{
    double real;
    P *a, *b;
} L;

P points[10];
L len[1000];
int lencount=0;

int cmp(const void *a, const void *b){
    double k;
    L *aa=(L*)a, *bb=(L*)b;
    if((k=aa->real - bb->real)) return k<0;
    return aa->a - bb->a;
}
int main()
{
    int n, i, j;
    double tmp;
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%d", &(points[i].x));
        scanf("%d", &(points[i].y));
        scanf("%d", &(points[i].z));
    }
    for(i=0; i<n-1; i++){
        for(j=i+1; j<n; j++){
            tmp=0;
            tmp+=pow(points[i].x-points[j].x, 2);
            tmp+=pow(points[i].y-points[j].y, 2);
            tmp+=pow(points[i].z-points[j].z, 2);
            len[lencount].real=pow(tmp, 0.5);
            len[lencount].a=&points[i];
            len[lencount].b=&points[j];
            lencount++;
        }
    }
    qsort(len, lencount, sizeof(L), cmp);
    for(i=0; i<lencount; i++){
        printf("(%d,%d,%d)-(%d,%d,%d)=%.2lf\n",
        (len[i].a)->x, (len[i].a)->y, (len[i].a)->z,
        (len[i].b)->x, (len[i].b)->y, (len[i].b)->z,
        len[i].real);
    }

    return 0;
}
int main ()
{
   struct distance
   {
       int point1[3];
       int point2[3];
       double dis;
   };
  struct distance d[100],middle;
  int i,j,k,n,point[100][3];
  cin >> n;
  for (i=0;i<n;i++)
  {
      for (j=0;j<3;j++)
	  {
          cin >> point[i][j];
	  }
  }
  j=0;
  k=1;
  for (i=0;i<n*(n-1)/2;i++)
  {
      d[i].point1[0]=point[j][0];
	  d[i].point1[1]=point[j][1];
	  d[i].point1[2]=point[j][2];
	  d[i].point2[0]=point[k][0];
	  d[i].point2[1]=point[k][1];
	  d[i].point2[2]=point[k][2];
	  d[i].dis=sqrt((d[i].point2[0]-d[i].point1[0])*(d[i].point2[0]-d[i].point1[0])+
		  (d[i].point2[1]-d[i].point1[1])*(d[i].point2[1]-d[i].point1[1])
		  +(d[i].point2[2]-d[i].point1[2])*(d[i].point2[2]-d[i].point1[2]));
	  k++;
	  if (k==n)
	  {
		  j=j+1;
		  k=j+1;
	  }
  }
  for (i=0;i<n*(n-1)/2;i++)
  {
	  for (j=n*(n-1)/2-1;j>i;j--)
	  {
		  if (d[j].dis>d[j-1].dis)
		  {
			  middle=d[j];
			  d[j]=d[j-1];
			  d[j-1]=middle;
		  }
	  }
  }
  for (i=0;i<n*(n-1)/2;i++)
	  cout << fixed << setprecision(2) << "(" << d[i].point1[0] << "," << d[i].point1[1] << "," << d[i].point1[2] << ")-("
	  << d[i].point2[0] << "," << d[i].point2[1] << "," << d[i].point2[2] << ")=" << d[i].dis << endl;
  return 0;
}
//????????
struct point{
		int x;
		int y;
		int z;
	}input[10]={0};
struct point u;
struct point v;
struct total{
	struct point u;
	struct point v;
	double result;
	}output[45]={0};
//???????????
double distance(struct point a,struct point b)
{
	return(sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)+(a.z-b.z)*(a.z-b.z)));
}
void sort(struct total c[],int d)
{
	int m,n;
	struct total temp;
	for(m=1;m<d;m++)
		for(n=0;n<d-m;n++)
			if(c[n].result<c[n+1].result){
				temp=c[n];
				c[n]=c[n+1];
				c[n+1]=temp;
			}
}
//???
void main()
{
	int n,i,j,p;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d%d%d",&input[i].x,&input[i].y,&input[i].z);
	p=-1;
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n;j++){
			p++;
			output[p].u=input[i];
			output[p].v=input[j];
			output[p].result=distance(output[p].u,output[p].v);
		}
	}
	sort(output,p+1);
	for(i=0;i<=p;i++)
		printf("(%d,%d,%d)-(%d,%d,%d)=%.2lf\n",output[i].u.x,output[i].u.y,output[i].u.z,output[i].v.x,output[i].v.y,output[i].v.z,output[i].result);
}
typedef struct point {
    int x,y,z;
}POINT;

typedef struct disdence {
    POINT a,b;
    double dst;
}PD;

double Squ(double num) {
    return num * num;
}

double Distance(POINT a,POINT b) {
    return sqrt(Squ(a.x - b.x) + Squ(a.y - b.y) + Squ(a.z - b.z));
}

int main() {
    POINT pt[10];
    PD tmp,dst[45];
    int i,j,k,n,N;
    //printf("???? : ");
    scanf("%d",&n);
    if(n > 10) n = 10;
    N = n*(n - 1)/2;
    for(i = 0;i < n;i++) {
        //printf("?%d : ",i + 1);
        scanf("%d %d %d",&pt[i].x,&pt[i].y,&pt[i].z);
    }
    k = 0;
    for(i = 0;i < n - 1;i++) {  /*???????*/
        for(j = i + 1;j < n;j++) {
            dst[k].a = pt[i];
            dst[k].b = pt[j];
            dst[k].dst = Distance(pt[i],pt[j]);
            k++;
        }
    }
	for(i = 0;i < N- 1;i++)
		for(j = 0;j < N -i -1;j++ )
			if(dst[j].dst < dst[j + 1].dst){
				tmp = dst[j];
				dst[j] = dst[j +1];
				dst[j + 1] = tmp;
			}

	//cout << N << endl;
      /* for(i = 0;i < N - 1;i++) {//?????????
        k = i;
        for(j = i + 1;j < N;j++) {
            if(dst[k].dst <= dst[j].dst)
                k = j;
        }
        if(k != i) {
            tmp = dst[k];
            dst[k] = dst[i];
            dst[i] = tmp;
        }
    }*/
	      
    for(i = 0; i < N; i++) {
        printf("(%d,%d,%d)-",dst[i].a.x,dst[i].a.y,dst[i].a.z);
        printf("(%d,%d,%d)=",dst[i].b.x,dst[i].b.y,dst[i].b.z);
        printf("%.2lf\n",dst[i].dst);
    }
       return 0;
}
int main()
{
	struct address
	{
		int x;
	    int y;
		int z;
	}point[10];
	int n,i,j,k;
	double d[45],t;
	cin>>n;
	for(i=0;i<n;i++)
		cin>>point[i].x>>point[i].y>>point[i].z;
	for(i=0;i<n-1;i++)
	{
		for(j=i+1;j<n;j++)
			d[(2*n-1-i)*i/2+j-i-1]=sqrt((point[i].x-point[j].x)*(point[i].x-point[j].x)+(point[i].y-point[j].y)*(point[i].y-point[j].y)+(point[i].z-point[j].z)*(point[i].z-point[j].z));
	}
	for(i=0;i<n*(n-1)/2-1;i++)
	{
		for(j=i+1;j<n*(n-1)/2;j++)
		{
			if(d[j]>d[i])
			{t=d[i];d[i]=d[j];d[j]=t;}
		}
	}
	for(i=0;i<n*(n-1)/2;)
	{
		for(j=0;j<n-1;j++)
		{
			for(k=j+1;k<n;k++)
			{
				if(sqrt((point[k].x-point[j].x)*(point[k].x-point[j].x)+(point[k].y-point[j].y)*(point[k].y-point[j].y)+(point[k].z-point[j].z)*(point[k].z-point[j].z))==d[i])
                {cout<<"("<<point[j].x<<","<<point[j].y<<","<<point[j].z<<")-("<<point[k].x<<","<<point[k].y<<","<<point[k].z<<")=";
				 cout<<(fixed)<<setprecision(2)<<d[i]<<endl;}
			}
		}
		for(j=i+1;j<n*(n-1)/2;j++)
		{
			if(d[j]!=d[i]) break;
		}
		i=j;
	}
	return 0;
}
int main(){
	int i,a[1000][3],n,e,j,k=0,h;
	double m[3000][3],r,p,q;
	scanf("%d",&n);
    h=n*(n-1)/2;
	for(i=0;i<n;i++)
	{
		scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);
	}
	for(i=0;i<n;i++)
    {
		for(j=i+1;j<n;j++)
		{
			m[k][0]=i;
			m[k][1]=j;
			m[k][2]=sqrt((double) ((a[i][0]-a[j][0])*(a[i][0]-a[j][0])+(a[i][1]-a[j][1])*(a[i][1]-a[j][1])+(a[i][2]-a[j][2])*(a[i][2]-a[j][2])));
			k++;
		}
	}
	for(i=1;i<h;i++)
    {
      for(k=0;k<h-i;k++)
	  {
		if(m[k][2]<m[k+1][2])
		{
            r=m[k][0];
            m[k][0]=m[k+1][0];
            m[k+1][0]=r;
			p=m[k][1];
            m[k][1]=m[k+1][1];
            m[k+1][1]=p;
			q=m[k][2];
            m[k][2]=m[k+1][2];
            m[k+1][2]=q;
		}
	  }
	}
	for(i=0;i<h;i++)
	printf("(%d,%d,%d)-(%d,%d,%d)=%.2lf\n",a[(int)m[i][0]][0],a[(int)m[i][0]][1],a[(int)m[i][0]][2],a[(int)m[i][1]][0],a[(int)m[i][1]][1],a[(int)m[i][1]][2],m[i][2]);
    return 0;
}
int main(){
   int i,j,n,k,l,r;
   int  x[10],y[10],z[10];
   double s[100]={0.0},e;


   scanf("%d\n",&n);
   for(i=0;i<n;i++){
    scanf("%d %d %d",&x[i],&y[i],&z[i]); 
 }
 l=0;
 
    for(i=0;i<n-1;i++){
      for(k=i+1;k<n;k++){ 
   r=(x[i]-x[k])*(x[i]-x[k])+(y[i]-y[k])*(y[i]-y[k])+(z[i]-z[k])*(z[i]-z[k]);
       s[l]=sqrt(1.0*r);
 
  l++; 
 
   }}
  for(i=1;i<=l;i++){
        for(j=0;j<=l-i;j++){
             if(s[j]<s[j+1]){
    e=s[j+1];
s[j+1]=s[j];
s[j]=e;}}}
           
 for(i=0;i<n*(n-1)/2;i++){
    for(j=0;j<n;j++){
  for(k=j+1;k<n;k++){
     r=(x[j]-x[k])*(x[j]-x[k])+(y[j]-y[k])*(y[j]-y[k])+(z[j]-z[k])*(z[j]-z[k]);
 

    if(s[i]!=s[i+1]){
 if(s[i]==sqrt(1.0*r)){
   printf("(%d,%d,%d)-(%d,%d,%d)=%.2lf\n",x[j],y[j],z[j],x[k],y[k],z[k],s[i]);}
   }else{continue;}
    }}}
return 0;
}
int row(int a,int n)
{
	int i=n-1;
	while(a>i)
	{
		a-=i;
		i-=1;
	}
	return(n-1-i);
}
int col(int a,int n)
{
	int i=n-1;
	while(a>i)
	{
		a-=i;
		i-=1;
	}return(n-1-i+a);
}
int main()
{
	struct spot
	{int x;
	int y;
	int z;
	}a[11];
	int n,i,j,l=0,c[55],temp,h,g;
	double b[55];
	scanf("%d",&n);
	for(i=0;i<55;i++)
		c[i]=i;
	for(i=0;i<n;i++)
	{
		scanf("%d %d %d",&a[i].x,&a[i].y,&a[i].z);
	}
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
		b[l]=(double)sqrt((a[i].x-a[j].x)*(a[i].x-a[j].x)+(a[i].y-a[j].y)*(a[i].y-a[j].y)+(a[i].z-a[j].z)*(a[i].z-a[j].z));
		l++;
		}
	}
	for(i=0;i<l-1;i++)
	{
		for(j=0;j<l-i-1;j++)
		{
			if(b[c[j]]<b[c[j+1]])
			{
				temp=c[j];
				c[j]=c[j+1];
				c[j+1]=temp;
			}
		}
	}
	for(i=0;i<n*(n-1)/2;i++)
	{h=col(c[i]+1,n);
	g=row(c[i]+1,n);
		printf("(%d,%d,%d)-(%d,%d,%d)=%.2lf\n",a[g].x,a[g].y,a[g].z,a[h].x,a[h].y,a[h].z,b[c[i]]);
	}
		return 0;
}
//***************************
//*????????			*
//*?  ???? 1100062709	*
//*?  ??2011.12.11		*
//***************************
int main()
{
	int n, i, j, k = 0;
	cin >> n;												//????
	int num = n * (n - 1) / 2;								//?????????
	int a[10][3];											//????????
	int *p2 = *a;											//????????p2?????????
	for ( i = 0; i < n; i++)
		for ( j = 0; j < 3; j++)
			cin >> *p2++;									//????
	double b[10][10];
	double c[45];											//????????????
	double *p1 = c;
	for ( i = 0; i < n - 1; i++)
		for ( j = i + 1; j < n; j++)
			{
				double len1, len2, len3;					//?????i???j????
				len1 = pow(a[i][0] - a[j][0], 2.0);
				len2 = pow(a[i][1] - a[j][1], 2.0);
				len3 = pow(a[i][2] - a[j][2], 2.0);
				b[i][j] = sqrt(len1 + len2 + len3);			//?i,j??????????b?
				*p1++ = b[i][j];							//?i,j??????????c?
			}
	p1 = c;													//??p1????c?????
	double temp;
	for(i = 0; i < num - 1; i++)							//?????c????
		for (j = 0; j < num - 1 - i; j++)
		{
			if (*(p1 + j) < *(p1 + j + 1) )
			{
				temp = *(p1 + j);
				*(p1 + j) = *(p1 + j + 1);
				*(p1 + j + 1) = temp;
			}
		}
	for (k = 0; k < num; k++)
	{
		if (k == 0)											//k=0??c[k]??????
		{
			for ( i = 0; i < n; i++)
				for ( j = i + 1; j < n; j++)
					if (fabs(b[i][j] - c[k]) < 1e-9)		//??b[i][j]?c[k]????????????
					{
						cout << fixed;
						cout << "(" << a[i][0] << "," << a[i][1] << "," << a[i][2] << ")" << "-";
						cout << "(" << a[j][0] << "," << a[j][1] << "," << a[j][2] << ")";
						cout << "=" << setprecision(2) << b[i][j] << endl;
					}
		}
		else												//?c[k]???????
		{
			while (fabs(c[k] - c[k - 1]) < 1e-9)			//??????
				k++;
			for ( i = 0; i < n; i++)
				for ( j = i + 1; j < n; j++)
					if (fabs(b[i][j] - c[k]) < 1e-9)		//???????????????
					{
						cout << fixed;
						cout << "(" << a[i][0] << "," << a[i][1] << "," << a[i][2] << ")" << "-";
						cout << "(" << a[j][0] << "," << a[j][1] << "," << a[j][2] << ")";
						cout << "=" << setprecision(2) << b[i][j] << endl;
					}
		}
    }
	return 0;
}