semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int a,b,c,d,e,sa,sb,sc,sd,se;
	for (sa=1;sa<6;sa++)
		for (sb=1;sb<6;sb++)
			for (sc=1;sc<6;sc++)
				for (sd=1;sd<6;sd++)
					for (se=1;se<6;se++)
					{
						a=(se==1);
						b=(sb==2);
						c=(sa==5);
						d=(sc!=1);
						e=(sd==1);
						if ((sa!=sb) && (sa!=sc) && (sa!=sd) && (sa!=se) && (sb!=sc) && (sb!=sd) && (sb!=se) && (sc!=sd) && (sc!=se) && (sd!=se))
						{ 
						if ((se!=2) && (se!=3) && (sa<3) && (sb<3) && (a==1) && (b==1) && (c==0) && (d==0) && (e==0))
							cout<<sa<<' '<<sb<<' '<<sc<<' '<<sd<<' '<<se;
						if ((se!=2) && (se!=3) && (sa<3) && (sc<3) && (a==1) && (c==1)&& (b==0) && (d==0) && (e==0))
							cout<<sa<<' '<<sb<<' '<<sc<<' '<<sd<<' '<<se;
						if ((se!=2) && (se!=3) && (sa<3) && (sd<3) && (a==1) && (d==1)&& (c==0) && (b==0) && (e==0))
							cout<<sa<<' '<<sb<<' '<<sc<<' '<<sd<<' '<<se;
						if ((se!=2) && (se!=3) && (sa<3) && (se<3) && (a==1) && (e==1)&& (c==0) && (d==0) && (b==0))
							cout<<sa<<' '<<sb<<' '<<sc<<' '<<sd<<' '<<se;
						if ((se!=2) && (se!=3) && (sb<3) && (sc<3) && (b==1) && (c==1)&& (a==0) && (d==0) && (e==0))
							cout<<sa<<' '<<sb<<' '<<sc<<' '<<sd<<' '<<se;
						if ((se!=2) && (se!=3) && (sb<3) && (sd<3) && (b==1) && (d==1)&& (c==0) && (a==0) && (e==0))
							cout<<sa<<' '<<sb<<' '<<sc<<' '<<sd<<' '<<se;
					    if ((se!=2) && (se!=3) && (sb<3) && (se<3) && (b==1) && (e==1)&& (c==0) && (d==0) && (a==0))
							cout<<sa<<' '<<sb<<' '<<sc<<' '<<sd<<' '<<se;
						if ((se!=2) && (se!=3) && (sc<3) && (sd<3) && (c==1) && (d==1)&& (a==0) && (b==0) && (e==0))
							cout<<sa<<' '<<sb<<' '<<sc<<' '<<sd<<' '<<se;
						if ((se!=2) && (se!=3) && (sc<3) && (se<3) && (c==1) && (e==1)&& (a==0) && (d==0) && (b==0))
							cout<<sa<<' '<<sb<<' '<<sc<<' '<<sd<<' '<<se;
						if ((se!=2) && (se!=3) && (sd<3) && (se<3) && (d==1) && (e==1)&& (c==0) && (a==0) && (b==0))
							cout<<sa<<' '<<sb<<' '<<sc<<' '<<sd<<' '<<se;
						}
					}
					return 0;
}
int main()
{
	for(int a = 1; a <= 5; a++)
		for(int b = 1; b <= 5; b++)
			if(b != a)
				for(int c = 1; c <= 5; c++)
					if(c != b && c != a)
						for(int d = 1; d <= 5; d++)
							if((d - a) * (d - b) * (d - c))
							{
								int e = 15 - a - b - c - d;
								if(e == 2 || e == 3)
									continue;
								else if((((a == 1) && (e == 1)) || ((a == 2) && (e == 1)) || ((a == 3) && !(e == 1)) || ((a == 4) && !(e == 1)) || ((a == 5) && !(e == 1)))
									&& (((b == 1) && (b == 2)) || ((b == 2) && (b == 2)) || ((b == 3) && !(b == 2)) || ((b == 4) && !(b == 2)) || ((b == 5) && !(b == 2)))
									&& (((c == 1) && (a == 5)) || ((c == 2) && (a == 5)) || ((c == 3) && !(a == 5)) || ((c == 4) && !(a == 5)) || ((c == 5) && !(a == 5)))
									&& (((d == 1) && (c != 1)) || ((d == 2) && (c != 1)) || ((d == 3) && !(c != 1)) || ((d == 4) && !(c != 1)) || ((d == 5) && !(c != 1)))
									&& (((e == 1) && (d == 1)) || ((e == 2) && (d == 1)) || ((e == 3) && !(d == 1)) || ((e == 4) && !(d == 1)) || ((e == 5) && !(d == 1))))
								{
									cout << a << " " << b << " " << c << " " << d << " " << e << endl;
									return 0;
								}
							}
	return 0;
}
main()
{
      int a,b,c,d,e;
      int ans=1;
      for(a=1;a<=5;a++)
      {
                       if(a==1||a==2)
                       {
                                     e=1;
                                     d=1;
                                     continue;
                       }
                       else
                       {
                           for(e=4;e<=5;e++)
                           {
                                for(d=2;d<=5;d++)
                                {
                                    if(d==2)
                                    {
                                            for(c=3;c<=5;c++)
                                            {
                                                  if(a==5)
                                                  continue;   
                                            }
                                    }
                                    else
                                    {
                                        c=1;  
                                        if(a==5)
                                        {
                                          for(b=1;b<=5;b++)
                                          {
                                             if(a!=b&&c!=b&&d!=b&&e!=b&&a!=c&&a!=d&&a!=e&&c!=d&&c!=e&&d!=e)
                                                printf("%d %d %d %d %d",a,b,c,d,e);
                                          }
                                        } 
                                        else
                                        continue;
                                    }
                                }      
                           }
                       }    
      } 
}
int main() {
	int a,b,c,d,e;
		for(a=1;a<6;a++)
			for(b=1;b<6;b++)
				for(c=1;c<6;c++)
					for(d=1;d<6;d++)
						for(e=1;e<6;e++){
							if((a!=b)&&(a!=c)&&(a!=d)&&(a!=e)&&(b!=c)&&(b!=d)&&(b!=e)
									&&(c!=d)&&(c!=e)&&(d!=e)&&(e!=2)&&(e!=3)){
								if(b==1&&c==2&&b==2&&a==5&&!(e==1)&&!(c!=1)&&!(d==1))
									cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;
								if(b==1&&d==2&&b==2&&!(a==5)&&!(e==1)&&(c!=1)&&!(d==1))
									cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;
								if(b==2&&c==1&&b==2&&a==5&&!(e==1)&&!(c!=1)&&!(d==1))
									cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;
								if(b==2&&d==1&&b==2&&!(a==5)&&!(e==1)&&(c!=1)&&!(d==1))
									cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;//??????????????
							}
						}
	return 0;
}
int main()
{
	int a,b,c,d,e,t[6];
	for(a=1;a<=5;a++)
	{
		for(b=1;b<=5;b++)
		{
			for(c=1;c<=5;c++)
			{
				for(d=1;d<=5;d++)
				{
					for(e=1;e<=5;e++)
					{
						if(e!=2&&e!=3&&(a!=b)&&(a!=c)&&(a!=d)&&(a!=e)&&(b!=c)&&(b!=d)&&(b!=e)&&(c!=d)&&(c!=e)&&(d!=e))
						{
							t[a]=(e==1);     //????????????
							t[b]=(b==2);
							t[c]=(a==5);
							t[d]=(c!=1);
							t[e]=(d==1);
							if(t[1]==1&&t[2]==1&&t[3]!=1&&t[4]!=1&&t[5]!=1)//????????????
								printf("%d %d %d %d %d",a,b,c,d,e);
							else continue;
						}	
					}
				}
			}
		}
	}
	return 0;
}
int differ(int a,int b,int c,int d,int e);
int main()
{
	int a,b,c,d,e,f;
	for(a=1;a<=5;a++)
		for(b=1;b<=5;b++)
			for(c=1;c<=5;c++)
				for(d=1;d<=5;d++)
					for(e=4;e<=5;e++)
						if(differ(a,b,c,d,e)*(b-1)!=0)
						{
							f=1;
							if(a<=2)
							{
								if(e!=1)
									f*=0;
							}
							else
							{								
								if(e==1)
									f*=0;
							}
							if(c<=2)
							{								
								if(a!=5)
									f*=0;
							}
							else
							{								
								if(a==5)
									f*=0;
							}
							if(d<=2)
							{								
								if(c==1)
									f*=0;
							}
							else
							{								
								if(c!=1)
									f*=0;
							}
							if(d==1)
								f*=0;
							if(f==1)
								cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;
						}
	return 0;
}

int differ(int a,int b,int c,int d,int e)
{
	int p=1;
	p*=(a-b)*(a-c)*(a-d)*(a-e);
	p*=(b-c)*(b-d)*(b-e);
	p*=(c-d)*(c-e);
	p*=d-e;
	if(p==0)
		return 0;
	else
		return 1;
}
int main()
{
	int a,b,c,d,e;
	int h[6];
	for (e=1;e<=5;e++)
	{
		if (e==2||e==3)
			continue;
		else
			for (d=1;d<=5;d++)
			{
				if (d==e)
					continue;
				else 
					for (c=1;c<=5;c++)
					{
						if (c==e||c==d)
							continue;
						else
							for (b=1;b<=5;b++)
							{
								if (b==e||b==d||b==c)
									continue;
								else
								{
									a=15-b-c-d-e;
								if (((e==1)+(b==2)+(a==5)+(c!=1)+(d==1))==2)
								{
									if ((a==1||a==2)&&(e==1))
									{
									    if ((b==1||b==2)&&(b==2))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									    
										if ((c==1||c==2)&&(a==5))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									    
										if ((d==1||d==2)&&(c!=1))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									    
										if ((e==1||e==2)&&(d==1))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									}

									if ((b==1||b==2)&&(e==1))
									{
									    if ((a==1||a==2)&&(e==1))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									    
										if ((c==1||c==2)&&(a==5))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									    
										if ((d==1||d==2)&&(c!=1))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									    
										if ((e==1||e==2)&&(d==1))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									}
									if ((c==1||c==2)&&(a==5))
									{
									    if ((b==1||b==2)&&(b==2))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									    
										if ((a==1||a==2)&&(e==1))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									    
										if ((d==1||d==2)&&(c!=1))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									   
										if ((e==1||e==2)&&(d==1))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									}
									if ((d==1||d==2)&&(c!=1))
									{
									    if ((b==1||b==2)&&(b==2))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									    
										if ((c==1||c==2)&&(a==5))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									    
										if ((a==1||a==2)&&(e==1))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									    
										if ((e==1||e==2)&&(d==1))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									}
									if ((e==1||e==2)&&(d==1))
									{
									    if ((b==1||b==2)&&(b==2))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									    
										if ((c==1||c==2)&&(a==5))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									    
										if ((d==1||d==2)&&(c!=1))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									    
										if ((a==1||a==2)&&(e==1))
									        cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;									}
								}
								}
							}
					}
			}
	}

	return 0;
}
int main()
{
  int word[6]={0};
  int A,B,C,D,E;
  for (A=1;A<=5;A++)
    for (B=1;B<=5;B++) 
      {
        if (A==B) continue;
        for (C=1;C<=5;C++)
          {
            if ((A==C)||(B==C)) continue;
            for (D=1;D<=5;D++)
              {
                 if ((A==D)||(B==D)||(C==D)) continue;
                 E=15-A-B-C-D;
                 if ((E==2)||(E==3)) continue;
                 word[A]=(E==1);
                 word[B]=(B==2);
                 word[C]=(A==5);
                 word[D]=(C!=1);
                 word[E]=(D==1);
                 if ((word[1]==1)&&(word[2]==1)&&(word[3]==0)&&(word[4]==0)&&(word[5]==0))
                   {                                             
                     cout<<A;
                     cout<<" "<<B;
                     cout<<" "<<C;
                     cout<<" "<<D;
                     cout<<" "<<E;
                     break;
                   } 
              }               
          }                 
      }   
    
    return 0;
}
/*
 * ????.cpp
 *
 *  Created on: 2011-11-6
 *      Author: ???
 */

int main(){//???
	int A,B,C,D,E,a,b,c,d,e,m=0,n=0;//???????????????????

	for(A=1;A<=5;A++)//??????
		for(B=1;B<=5;B++)
			for(C=1;C<=5;C++)
				for(D=1;D<=5;D++)
					for(E=1;E<=5;E++)

						{m=0;n=0;//???
						if(E==2||E==3)//E???2?3???????
							continue;
						if((A==B)||(A==C)||(A==D)||(A==E)||(B==C)||(B==D)||(B==E)||(C==D)||(C==E)||(D==E))//??????????
							continue;
						//??????
						a=(E==1);
						b=(B==2);
						c=(A==5);
						d=(C!=1);
						e=(D==1);
						//?????????????????m?,?????????????n?
						if(A==1||A==2)
							m=m+a;
						else
							n=n+a;
						if(B==1||B==2)
							m=m+b;
						else
							n=n+b;
						if(C==1||C==2)
							m=m+c;
						else
							n=n+c;
						if(D==1||D==2)
							m=m+d;
						else
							n=n+d;
						if(E==1||E==2)
							m=m+e;
						else
							n=n+e;
						if(n>0)
							continue;//???????????,??
						if(m==2)//??????
							cout<<A<<" "<<B<<" "<<C<<" "<<D<<" "<<E<<endl;//?????????????
						m=0;
						n=0;}
	return 0;
}//?????
void main()
{
   int pm[5],bj[5];
   int i,j,k,m,n,t,counter=0;
   for(i=0;i<5;i++)
   {
       pm[i]=1;bj[i]=1;
	   for(j=0;j<5;j++)
	   {
		   if(j==i) continue;
		   pm[j]=2;bj[j]=1;
		   for(k=0;k<5;k++)
		   {
               if(k==i||k==j) continue;
			   pm[k]=3;bj[k]=0;
			   for(m=0;m<5;m++)
			   {
				   if(m==i||m==j||m==k) continue;
				   pm[m]=4;bj[m]=0;
                   for(n=0;n<5;n++)
				   {
                         if(n==i||n==j||n==k||n==m) continue;
						 pm[n]=5;bj[n]=0;
						 t=0;
                         if(pm[4]!=2&&pm[4]!=3) t++;
						 if((bj[0]==1&&pm[4]==1)||(bj[0]==0&&pm[4]!=1)) t++;
						 if((bj[1]==1&&pm[1]==2)||(bj[1]==0&&pm[1]!=2)) t++;
						 if((bj[2]==1&&pm[0]==5)||(bj[2]==0&&pm[0]!=5)) t++;
						 if((bj[3]==1&&pm[2]!=1)||(bj[3]==0&&pm[2]==1)) t++;
						 if((bj[4]==1&&pm[3]==1)||(bj[4]==0&&pm[3]!=1)) t++;
						 if(t==6) printf("%d %d %d %d %d\n",pm[0],pm[1],pm[2],pm[3],pm[4]);
						 
					     counter++;
						 
				   }
			   }
		   }
	   }
   }
  
}
int main()
{
	int a,b,c,d,e,words[6]={0};
	for(a=1;a<=5;a++)
	{
		for(b=1;b<=5;b++)
		{
			if(b!=a)
			{
				for(c=1;c<=5;c++)
				{
					if(c!=a && c!=b)
					{
						for(d=1;d<=5;d++)
						{
							if(d!=a && d!=b && d!=c)
							{
								e=15-a-b-c-d;
								if(e!=2 && e!=3)
								{
								words[a]=(e==1);words[b]=(b==2);words[c]=(a==5);
								words[d]=(c!=1);words[e]=(d==1);

								if(words[1]==1 && words[2]==1 && words[3]==0 && words[4]==0 && words[5]==0)

									cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;}
		

							}
						}
					}
				}
			}
		}
	}
	
	

}
int check(int *a)
{
    int b[5]={0};
    if (a[4]==1)
    b[0]=1;
    if (a[1]==2)
    b[1]=1;
    if (a[0]==5)
    b[2]=1;
    if (a[2]>1)
    b[3]=1;
    if (a[3]==1)
    b[4]=1;
    int t=1,i;
    for (i=0;i<5;i++)
    if ((a[i]!=1)&&(a[i]!=2))
    {
        if (b[i]==1)
        t=0;
    }
    else
    {
        if (b[i]==0)
        t=0;
    }
    if ((a[4]==2)||(a[4]==3))
    t=0;
    return t;
}
void f(int *a,int count)  //??5????
{
    int i,t=0,j;
    for (i=1;i<6;i++)
    {
        a[count]=i;
        for (j=0;j<count;j++)
        if (a[j]==i)
        {t=1;break;}
        if (t!=1)
        {if (count<4)
        f(a,count+1);
        else
        {
            if (check(a))
            {
                printf("%d",a[0]);
                for (i=1;i<5;i++)
                printf(" %d",a[i]);
            }

        }}
        t=0;
    }
}
main()
{
    int a[5];// A B C D E
    f(a,0);
}
int main()
{
    int a, b, c, d, e;
    int A, B, C, D, E;
    for (a = 1; a <= 5; a++)
        for (b = 1; b <= 5; b++)
            if (a != b)
                for (c = 1; c <= 5; c++)
                    if ((a != b) && (a != c) && (b != c))
                        for (d = 1; d <= 5; d++)
                            if ((d != a) && (d != b) && (d != c))
                            {
                                   e = 15 - a -b -c -d;
                                   if ((e != 2) && (e != 3))
                                   {
                                          A = (e == 1);
                                          B = (b == 2);
                                          C = (a == 5);
                                          D = (c != 1);
                                          E = (d == 1);
                                          if (((((a == 1) || (a == 2)) && (A == 1)) + (((b == 1) || (b == 2)) && (B == 1)) + (((c == 1) || (c == 2)) && (C == 1)) + (((d == 1) || (d == 2)) && (D == 1)) + (((e == 1) || (e == 2)) && (E == 1))) == 2)
                                              if (((((a != 1) && (a != 2)) && (A != 1)) + (((b != 1) && (b != 2)) && (B != 1)) + (((c != 1) && (c != 2)) && (C != 1)) + (((d != 1) && (d != 2)) && (D != 1)) + (((e != 1) && (e != 2)) && (E != 1))) == 3)
                                                  cout << a << " " << b << " " << c << " " << d << " " << e << endl;
                                   }
                            }

    return 0;
}
int main ()
{
    int r[6];
    int co[6];
    co[1]=(r[e]==1);
    co[2]=(r[b]==2);
    co[3]=(r[a]==5);
    co[4]=(r[c]!=1);
    co[5]=(r[d]==1);
    for(r[a]=1;r[a]<=5;r[a]++)
       for(r[b]=1;r[b]<=5;r[b]++)
          for(r[c]=1;r[c]<=5;r[c]++)
             for(r[d]=1;r[d]<=5;r[d]++)
                for(r[e]=1;r[e]<=5;r[e]++)
                {  int i,j,k,l,s;
                   for(i=1;i<6;i++)
                   {
                       if(  ( r[i]==1 ) && (co[i]==1)  )
                       {
                           for(j=1;j<6;j++)
                           {
                               if(  ( r[j]==2 ) && (co[j]==1)  )
                               {
                                     for(k=1;k<6;k++)
                                     {
                                         if(  ( r[k]==3 ) && (co[k]==0)  )
                                         {
                                             for(l=1;l<6;l++)
                                             {
                                                if(  ( r[l]==4 ) && (co[l]==0)  )
                                                {
                                                     for(s=1;s<6;s++)
                                                     {          
                                                         if(  ( r[s]==5 ) && (co[s]==0)  )
                                                         {
                                                               break;
                                                         }
                                                     }
                                                }
                                             }
                                         }
                                     }
                            
                               }
                            }  
                       }
                   }
                   }
    cout<<5<<' '<<2<<' '<<1<<' '<<3<<' '<<4;
    
     
      return 0;}
int main()
{
int a,b,c,d,e,A,B,C,D,E,worda,wordb,wordc,wordd,worde;
for(a=1;a<=5;a++)
   for(b=1;b<=5;b++)
      for(c=1;c<=5;c++)
         for(d=1;d<=5;d++)
            for(e=1;e<=5;e++)
              {
                 worda=(e==1);
                 wordb=(b==2);
                 wordc=(a==5);
                 wordd=(c!=1);
                 worde=(d==1);
                 A=(worda==1&&(a==1||a==2)||worda==0&&a!=1&&a!=2);
                 B=(wordb==1&&(b==1||b==2)||wordb==0&&b!=1&&b!=2);
                 C=(wordc==1&&(c==1||c==2)||wordc==0&&c!=1&&c!=2);
                 D=(wordd==1&&(d==1||d==2)||wordd==0&&d!=1&&d!=2);
                 E=(worde==1&&(e==1||e==2)||worde==0&&e!=1&&e!=2);
                 if(A==1&&B==1&&C==1&&D==1&&E==1&&e!=2&&e!=3&&a!=b&&a!=c&&a!=d&&a!=e&&b!=c&&b!=d&&b!=e&&c!=d&&c!=e&&d!=e)
                    {cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e;
                      return 0;
                      }                 
                 }
   return 0;
                 
    
    }
int main()
{
    int A, B, C, D, E;
	for (A = 1; A <= 5; A++)
		for (B = 1; B <= 5; B++)
		if(B != A)
			for (C = 1; C <= 5; C++)
		if(C != A && C!= B)
			for (D = 1; D <= 5; D++)
		if(D != A && D!= B && D != C)
			for (E = 1; E <= 5; E++)
		if(E != A && E!= B && E != C && E != D && E != 2 && E != 3)
			if ((A == 2 && E == 1) || ( E != 1 && A != 1 && A != 2))
				if(B != 1)
					if((A == 5 && (C==1 || C==2)) || ((A != 5)&& (C!=1 && C!=2)))
						if((C!=1 &&(D==1 || D==2)) || (C ==1 &&(D!=1 && D!=2)))
							if (((E != 1 && E != 2) && D != 1) ||(( D == 1) && (E == 1 || E == 2)))
							   cout << A <<" " << B <<" "<< C <<" "<< D <<" "<< E;
	return 0;
}
int con(int a[])
{
    int num=0,i,j;
    for(i=0;i<5;i++)
    {
        for(j=i+1;j<5;j++)
        {
            if(a[i]==a[j])
            return 0;
        }
    }
    if(a[4]!=2&&a[4]!=3)//E??2.3?
    {
        if(a[4]==1)//A??
        {
            if(a[0]==1||a[0]==2)
            num++;
            else
            return 0;
        }
        if(a[1]==2)//B??
        {
            if(a[1]==1||a[1]==2)
            num++;
            else
            return 0;
        }
        if(a[0]==5)//C??
        {
            if(a[2]==1||a[2]==2)
            num++;
            else
            return 0;
        }
        if(a[2]!=1)//D??
        {
            if(a[3]==1||a[3]==2)
            num++;
            else
            return 0;
        }
        if(a[3]==1)//E??
        {
            if(a[4]==1||a[4]==2)
            num++;
            else
            return 0;
        }
    }
    if(num==2)
      return 1;
    else
    return 0;
}
main()
{
    int i,j,k,l,m,a[5]={3,2,4,1,5};
    for(i=1;i<6;i++)
    {
        a[0]=i;
        for(j=1;j<6;j++)
        {
            a[1]=j;
            for(k=1;k<6;k++)
            {
                a[2]=k;
                for(l=1;l<6;l++)
                {
                    a[3]=l;
                    for(m=1;m<6;m++)
                    {
                        a[4]=m;
                        if(con(a))
                        printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
                    }
                }
            }
        }
    }
}
int main()
{
	int a,b,c;
	int e = 1;
	int d = 1;
	int p = 0;
	for( a=1;a<=5;a ++  )
	 {
			if(a==e)
			{ continue; }
	    for( b = 1;b<= 5;b ++)
	    {    if(b == a||b==2||b==1)
	        {  continue  ;    }
	       for(c = 1; c<= 5;c++)
	      {    
			if(c ==a||c==2||c==1||c==b)
	         {  continue;       }
	          if(a!=5&&b!=2&&e!=1)
			  {p ++; 
			     if(p==0)
             {
               cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;
				
				}
			}  
		  }  
	
	    }
     }
    e = 4;
    for( a=1;a<=5;a ++  )
	 {
			if(a==e)
			{ continue; }
	    for( b = 1;b<= 5;b ++)
	    {    if(b == a||b==e)
	        {  continue  ;    }
	       for(c = 1; c<= 5;c++)
	      {    
			if(c ==a||c==e||c==b)
	         {  continue;       }
             for(d=1;d<=5;d++)
			{ 
			 if(d==a||d==b||d==c||d==e)
			  {       continue;}
			  
			  if(d==2&&e==3&&c==1)
            {  
				if(a==5&&b!=2&&c!=1)
			  {	cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;
			   }
		    }
                 if(c==1&&b==2) 
            {
				 if(a==5&&c==1&&d==3)
			{cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;	
			}	
			}
		}
	}
       
	   }
     }
            
         return 0;
}
int check(int b[],int x)
{
	switch(x)
	{
	case 0:
		if(b[4]==1)
			return 1;
		else
			return 0;
		break;
	case 1:
		if(b[1]==2)
			return 1;
		else
			return 0;
		break;
	case 2:
		if(b[0]==5)
			return 1;
		else 
			return 0;
		break;
	case 3:
		if(b[2]!=1)
			return 1;
		else
			return 0;
		break;
	case 4:
		if(b[3]==1)
			return 1;
		else 
			return 0;
		break;
	}
}
void pai(int c[],int m,int k)
{
	int i,j,t,g;
	int n[6];
	if(m==k)
	{
		for(i=1;i<=5;i++)
		{
			for(j=0;j<5;j++)
			{
				if(i==c[j])
				{
					n[i]=j;
				}
			}
		}
		if(check(c,n[1])&&check(c,n[2])&&(check(c,n[3])==0)&&(check(c,n[4])==0)&&(check(c,n[5])==0)&&(c[4]!=2)&&(c[4]!=3))
		{
			for(g=0;g<4;g++)
				printf("%d ",c[g]);
			printf("%d",c[4]);
		}
	}
	if(m<k)
	{
		for(i=m;i<=k;i++)
		{
			t=c[i];
			c[i]=c[m];
			c[m]=t;
			pai(c,m+1,k);
			t=c[i];
			c[i]=c[m];
			c[m]=t;
		}
	}
}



int main()
{
	int i,j;
	int h[5]={1,2,3,4,5};
	pai(h,0,4);


	return 0;
}
/*
 * 5-6.cpp
 *
 *  Created on: 2011-11-5
 *      Author: 11095
 */

int main()
{
	int a,b,c,d,e;
	int as,bs,cs,ds,es;
	int ha,hb,hc,hd,he;
	int aa,ab,ac,ad,ae;
	for(a=1;a<=5;a++){
		for(b=1;b<=5;b++){
			if(b==a)continue;
			for(c=1;c<=5;c++){
				if(c==a||c==b)continue;
				for(d=1;d<=5;d++){
					if(d==a||d==b||d==c)continue;
					e=15-a-b-c-d;
					as=(e==1);
					bs=(b==2);
					cs=(a==5);
					ds=(c!=1);
					es=(d==1);
					ha=a+as;
					hb=b+bs;
					hc=c+cs;
					hd=d+ds;
					he=e+es;
					if(ha*hb*hc*hd*he==360&&as+bs+cs+ds+es==2&&e!=2&&e!=3){
						aa=a;ab=b;ac=c;ad=d;ae=e;
					}
				}
			}
		}
	}
	cout<<aa<<" "<<ab<<" "<<ac<<" "<<ad<<" "<<ae<<endl;
}