semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
/*
 * ???.cpp
 *
 *  Created on: 2012-10-19
 *      Author: ??
 */
int main()
{
	int z,q,s,l;
	for(z=10;z<=50;z=z+10)
		for(q=10;q<=50;q=q+10)
			for(s=10;s<=50;s=s+10)
				for(l=10;l<=50;l=l+10)
					if((z+q==s+l)&&((z+l)>(s+q))&&((z+s)<q)&&(z!=q)&&(z!=s)&&(z!=l)&&(q!=s)&&(q!=l)&&(s!=l))//????
					{
						if(z==50)cout<<"z "<<z<<endl;
						if(q==50)cout<<"q "<<q<<endl;
						if(s==50)cout<<"s "<<s<<endl;
						if(l==50)cout<<"l "<<l<<endl;
						if(z==40)cout<<"z "<<z<<endl;
						if(q==40)cout<<"q "<<q<<endl;
						if(s==40)cout<<"s "<<s<<endl;
						if(l==40)cout<<"l "<<l<<endl;
						if(z==30)cout<<"z "<<z<<endl;
						if(q==30)cout<<"q "<<q<<endl;
						if(s==30)cout<<"s "<<s<<endl;
						if(l==30)cout<<"l "<<l<<endl;
						if(z==20)cout<<"z "<<z<<endl;
						if(q==20)cout<<"q "<<q<<endl;
						if(s==20)cout<<"s "<<s<<endl;
						if(l==20)cout<<"l "<<l<<endl;
						if(z==10)cout<<"z "<<z<<endl;
						if(q==10)cout<<"q "<<q<<endl;
						if(s==10)cout<<"s "<<s<<endl;
						if(l==10)cout<<"l "<<l<<endl;//??????
					}
	return 0;
}
int main()
{
	int w[4], i, j, flag = 0;
	char n[]={'z','q','s','l'};
	for(w[0] = 1; w[0] <= 5; w[0] ++)
	{
		for(w[1] = 1; w[1] <= 5; w[1] ++)
		{
			for(w[2] = 1; w[2] <= 5; w[2] ++)
			{
				for(w[3] = 1; w[3] <= 5; w[3] ++)
				{
				//	for(i = 0; i < 4; i++)
				//		for (j = i + 1; j < 4;j ++)
				//			if(w[i] == w[j]) flag = 1;
				//	if(flag == 1)
				//			continue;
					if((w[0] + w[1] == w[2] + w [3]) && (w[0] + w[3] > w[1] + w[2]) && (w[0] + w[2] < w[1]))
					{
						//cout << w[0] << w[1] << w[2] << w[3];
						for(i = 5; i >= 1;i--)
						{
							for (j = 0; j < 4; j++)
							{
								if(w[j] == i)
								cout << n[j] << ' ' << w[j] *10 << endl;
							}
						}
					}
				}
			}
		}
	}
	return 0;
}
//**********************************
//*???.cpp                      *
//*??????                    *
//*???2011-10-04                * 
//**********************************


int main()
{
    int m[4];                 //??m[4]???????????? 
    int i;
    int z;
    int q;
    int s;
    int l;
    for (z = 10; z <= 50; z = z + 10)
    {
        for (q = 10; q <= 50; q = q + 10)
        {
            if (z == q) continue;
            for (s = 10; s <= 50; s = s + 10)
            {
                if (z == s || s == q) continue;
                for(l = 10; l <= 50; l = l + 10)
                {
                    if (z == l || s == l || q == l) continue;
                    if ((z + q == s + l) && (z + l > s + q) && (z + s < q))
                    {
                        m[0] = z;
                        m[1] = q;
                        m[2] = s;
                        m[3] = l;
                    }
                }
            }
        }
    }
    //??????????????????????????????????????????? 
    for(i = 1; i <= 4; i++)
    {
        if ((m[0] > m[1]) &&(m[0] > m[2]) &&(m[0] > m[3]))
        {
            cout << "z " << m[0] << endl;
            m[0] = 0;
        }
        if ((m[1] > m[0]) &&(m[1] > m[2]) &&(m[1] > m[3]))
        {
            cout << "q " << m[1] << endl;
            m[1] = 0;
        }
        if ((m[2] > m[0]) &&(m[2] > m[1]) &&(m[2] > m[3]))
        {
            cout << "s " << m[2] << endl;
            m[2] = 0;
        }
        if ((m[3] > m[0]) &&(m[3] > m[1]) &&(m[3] > m[2]))
        {
            cout << "l " << m[3] << endl;
            m[3] = 0;
        }
    }
    return 0;
}
int main(){
	int z,q,s,l,a[4],i,j,b[4];
	char c[4];
	for(z=1;z<=5;z++)
		{for(q=1;q<=5;q++)
			{for(s=1;s<=5;s++)
			    {for(l=1;l<=5;l++)
			    {if((z!=q)+(z!=s)+(z!=l)+(q!=s)+(q!=l)+(s!=l)+(z+q==s+l)+(z+l>s+q)+(z+s<q)==9)
			    {a[1]=z*10;a[2]=q*10;a[3]=s*10;a[4]=l*10;
			    for(i=1;i<=4;i++)
			        	b[i]=a[i];
			        c[1]='z';c[2]='q';c[3]='s';c[4]='l';
			    	for(i=1;i<=3;i++)
			        	{for(j=1;j<=4-i;j++)
			        		{if(a[j]<a[j+1])
			        			{int temp=a[j];a[j]=a[j+1];a[j+1]=temp;}
			        		}
			        	}
			        for(i=1;i<=4;i++)
			        	{for(j=1;j<=4;j++)
			        	    {if(a[i]==b[j])
			        	    	cout<<c[j]<<" "<<b[j]<<endl;
			        	    }
			        	}
			    }
			    }
			    }
			}
		}
    return 0;
    	}
int wakaka(int z,int q,int s,int l)
{int i;
for(i=50;i>=10;i-=10)
{
if(z==i)printf("z %d\n",z);
if(q==i)printf("q %d\n",q);
if(s==i)printf("s %d\n",s);
if(l==i)printf("l %d\n",l);
}
return 1;
}

int ohyeah()
{int z,q,s,l;
for(z=10;z<=50;z+=10)
for(q=10;q<=50;q+=10)
for(s=10;s<=50;s+=10)
for(l=10;l<=50;l+=10)
if(z!=q&&z!=s&&z!=l&&q!=s&&q!=l&&s!=l)
if((z+q==s+l)&&(z+l>s+q)&&(z+s<q))
{wakaka(z,q,s,l);return 1;}
}

int main()
{ohyeah();}
int main ()
{
	int i, z, q, s, l, CC1, CC2, CC3;
	char str[6];
	for ( z = 1; z <= 5; z++ )
	{
		for ( q = 1; q <= 5; q++ )
		{
			for ( s = 1; s <= 5; s++ )
			{
				for ( l = 0; l <= 5; l++ )
				{
					CC1 = ( ( z + q ) == ( s + l ) );
					CC2 = ( ( z + l ) > ( s + q ) );
					CC3 = ( ( z + s ) < q );
					if ( ( CC1 + CC2 + CC3 == 3) && ( z != q) && ( z != s ) && ( z != l ) && ( q != s) && ( q != l ) && ( s != l) )
					{
						str[ 6 - z ] = 'z';
						str[ 6 - q ] = 'q';
						str[ 6 - s ] = 's';
						str[ 6 - l ] = 'l';
					}	
				}
			}
		}
	}
	for ( i = 1; i <= 6; i++ )
	{
		if ( str[i] == 'z' || str[i] == 'q' || str[i] == 's' || str[i] == 'l' )
			cout << str[i] << " " << ( 6 - i ) * 10 << endl;
	}
	return 0;
}
/* title:???  *
 * author:???*
 * time:2011.9.28*/

   


int main()
{
	int z, q, s, l, i, j, t, k, m = 1;
	char n;
	int a[5];
	char b[5];
	for(z = 1; z <= 5; z++)
		for(q = 1; q <= 5; q++)
			for(s = 1; s <= 5; s++)
                for(l = 1; l <= 5; l++)
				{
					if(z + q == s + l && z + l > s + q && z + s < q)
					{
						a[1] = z;
						a[2] = q;
						a[3] = s;
						a[4] = l;
						b[1] = 'z';
						b[2] = 'q';
						b[3] = 's';
						b[4] = 'l';
					}
				}
				for(i = 1; i <= 4; i++)
				{
					for(j = 1; j <= 4 - i; j++)
					{
						if(a[j] < a[j + 1])
						{
						        t = a[j];
								a[j] = a[j + 1];
								a[j + 1] = t;
								n = b[j];
								b[j] = b[j + 1];
								b[j + 1] = n;
						}
					}
				}
				for(k = 1; k <= 4 ; k++)
				{
                    cout << b[k] << " " << a[k] * 10 << endl;
				}
	return 0;
}
int main()
{
	char z,q,s,l,ch[4];//z,q,s,l????????????,ch[4]?????????
	int a,b,c,d,c1,c2,c3,n[4],i,j,temp=0;//a,b,c,d????????????????c1,c2,c3????????,n[4]??????????
	a=b=c=d=1;
	for(a=1;a<6;a++)
	{
		for(b=1;b<6;b++)
		{
			if(a==b)
				continue;
			for(c=1;c<6;c++)
			{
				if(c==b||c==a)
				continue;
				for(d=1;d<6;d++)
				{
					if(d==a||d==c||d==b)
				      continue;
				    c1=((a+b)==(c+d));
				    c2=(a+d>b+c);
				    c3=(a+c<b);
				    if(c1+c2+c3==3)//??????????????????
				    {
					    n[0]=a*10;
					    n[1]=b*10;
					    n[2]=c*10;
					    n[3]=d*10;
				    }
				}
			}
		}
	}
    ch[0]='z';
	ch[1]='q';
	ch[2]='s';
	ch[3]='l';
	for(j=0;j<3;j++)
    {
		for(i=0;i<3-j;i++)
			{
				if(n[i]<n[i+1])
		        {
			    temp=n[i];
			    n[i]=n[i+1];
			    n[i+1]=temp;
			    temp=ch[i];
			    ch[i]=ch[i+1];
			    ch[i+1]=temp;}//??????
		   }
	}
	for(i=0;i<4;i++)
	{
		cout<<ch[i]<<" "<<n[i]<<endl;
	}
	return 0;
}
int main()
{int x[4];
char x1[4]={'z','q','s','l'};
int i,j;
for(x[0]=10;x[0]<=50;x[0]=x[0]+10)
{for(x[1]=10;x[1]<=50;x[1]=x[1]+10)
{if(x[1]==x[0])
continue;
for(x[2]=10;x[2]<=50;x[2]=x[2]+10)
{if(x[2]==x[0]||x[2]==x[1])
continue;
                      for(x[3]=10;x[3]<=50;x[3]=x[3]+10)
{if(x[3]==x[0]||x[3]==x[1]||x[3]==x[2])
continue;
if((x[0]+x[1])==(x[2]+x[3])&&(x[0]+x[3])>(x[2]+x[1])&&(x[0]+x[2])<x[1])
{for(i=10;i<=50;i=i+10)
{for(j=0;j<4;j++)
{if(x[j]==60-i)
{cout<<x1[j]<<" "<<60-i<<endl;}}
                       }
                            }
                      }


}}}
return 0;
    }
int main()
{
	int i,z,q ,s, l,word[3];
	char weit[6]={0,0,0,0,0,0};
	for(z=1;z<=5;z++)
		for(q=1;q<=5;q++)
		{ if(q==z) continue;
	        for(s=1;s<=5;s++)
		     { if(s==z||s==q) continue;
			     for(l=1;l<=5;l++)
		            { if(l==z||l==q||l==s) continue;
				 //cout<<z<<q<<s<<l<<endl;
                       word[0]=(z+q==s+l);
					   word[1]=(z+l>s+q);
					   word[2]=(z+s<q);
					  // cout<<word[0]<<word[1]<<word[2]<<endl;
                       if(word[0]+word[1]+word[2]==3)
					   {
						   weit[z]='z';
						   weit[q]='q';
						   weit[s]='s';
						   weit[l]='l';
						   for(i=5;i>0;i--)
						   {
							   if(weit[i]!=0)
							   cout<<weit[i]<<" "<<i*10<<endl;
						   }
					   }




				 }}}
	return 0;
}
/*
 * ???.cpp
 *  Created on: 2012-10-18
 *      Author: ??? 1200012899
 */
int main()
{
	int a,b,c,d;//?a,b,c,d?????????
	for(a=1;a<=5;a++)
		for(b=1;b<=5;b++)
			for(c=1;c<=5;c++)
				for(d=1;d<=5;d++)//?????????a?b?c?d???1?2?3?4
				{
					if((a+b==c+d)//????????????????????????;
							&&(a+d>b+c)//??????????????????????
							&&(a+c<b))//???????????????????
					{
						if(a!=b&&a!=c&&a!=d&&b!=c&&b!=d&&c!=d)//????????
						{
							cout<<"l"<<" "<<d*10<<endl;
							cout<<"q"<<" "<<b*10<<endl;

					     cout<<"z"<<" "<<a*10<<endl;
						 cout<<"s"<<" "<<c*10<<endl;//??????????
						}
					}
				}
	return 0;
}
/*
 * weight.cpp
 *
 *  Created on: 2013-10-25
 *      Author: Mac
 */



int main ()
{
	int z,q,s,l;//define ????  and output sequence
	for ( z = 10; z <= 50; z +=10)
		for ( q = 10; q <= 50; q += 10)
			if (q != z )
				for (s = 10; s <= 50; s += 10)
					if (s != q && s != z)
						for (l = 10; l <= 50; l += 10)
							if (l != z && l != q && l != s)
							{
							//	cout << "test" << endl;
								if
								(( z + q == s + l) + ( z + l > s + q) + ( z + s < q) == 3)
								{
									z = 10000*z + 'z';
									q = 10000*q + 'q';
									s = 10000 *s + 's';
									l = 10000*l + 'l';

									//cout <<z<<' '<<q<<' '<<s<<' '<<l<<endl;
									
										int a[5],i;
									a[1]=z;
									a[2]=q;
									a[3]=s;
									a[4]=l;

									//for (i = 1; i <= 4; i++)
									//cout << a[i]<<' ' ;
									//cout << endl;

									sort(a+1, a+5);
									for (i = 4; i > 0; i--)
									cout << (char)(a[i] % 10000 ) << ' '<<a[i]/10000<< endl;
									
								}


							}
	return 0;
}
int main()
{
	int i=0,j=0,k=0,q=0;int p=0;
	char name[6]={0};
	for(i=1;i<6;i++)
	{
		for(j=1;j<6;j++)
		{
			if(j==i)continue;
			for(k=1;k<6;k++)
			{
				if((k==i)||(k==j))continue;
				for(q=1;q<6;q++)
				{
					if((q==i)||(q==j)||(q==k))continue;
					if((i+j==k+q)&&(i+q>k+j)&&(i+k<j))
					{
						name[i]='z'; name[j]='q'; name[k]='s'; name[q]='l';
						for(p=5;p>0;p--)
						{
							if(name[p]!=0)
							{
								cout<<name[p]<<" "<<p*10<<endl;
							}
						}
					}
				}
			}
		}
	}
    return 0;
}
/*
 * b.cpp
 *
 *  Created on: 2012-10-22
 *      Author: user
 */

int main()
{
	int z,q,s,l;
	for (z=1;z<=5;z++){
		for (q=1;q<=5;q++){
			for (s=1;s<=5;s++){
				for (l=1;l<=5;l++){
					if(z+q==s+l&&z+l>s+q&&z+s<q) break;}
			    if(z+q==s+l&&z+l>s+q&&z+s<q) break;}
			if(z+q==s+l&&z+l>s+q&&z+s<q) break;}
		if(z+q==s+l&&z+l>s+q&&z+s<q) break;}
int a[4],i,j,t;char b[5],u;
a[1]=z;a[2]=q;a[3]=s;a[4]=l;
b[1]='z';b[2]='q';b[3]='s';b[4]='l';
for(j=1;j<4;j++)
	for(i=0;i<4-j;i++)
		if(a[i]>a[i+1])
		{t=a[i];a[i]=a[i+1];a[i+1]=t;
		u=b[i];b[i]=b[i+1];b[i+1]=u;}
cout<<b[4]<<" "<<10*a[4]<<endl<<b[3]<<" "<<10*a[3]<<endl<<b[2]<<" "<<10*a[2]<<endl<<b[1]<<" "<<10*a[1];
return 0;

}
/*
 * ????chengtizhong.cpp
 * ??????????????????????????????????????
 * ????: 2012-11-5
 * ?? : ? ?
 */



int main()
{
	int z = 0, q = 0, s = 0, l = 0;
	for (z = 1; z <= 5; z++)
	{
		for (q = 1; q <= 5; q++)
		{
			for (s = 1; s <= 5; s++)
			{
				for (l = 1; l <= 5; l++)
				{
					if ( ((z+q)==(s+l)) && ((z+l)>(s+q)) && ((z+s)<q)
						&& (z!=q) && (q!=s) && (s!=l) && (l!=z) )
					{
						cout << 'l' << ' ' << (l*10) << endl;
						cout << 'q' << ' ' << (q*10) << endl;
						cout << 'z' << ' ' << (z*10) << endl;
						cout << 's' << ' ' << (s*10) << endl;
					}

				}
			}
		}
	}
	return 0;
}
int main()
{
    int z,q,s,l,sum,i;
    char a[5];
    for(i=1;i<=5;i++)
    a[i]=0;
    for(z=1;z<=5;z++)
    {
        for(q=1;q<=5;q++)
        {
             for(s=1;s<=5;s++)
             {
                  for(l=1;l<=5;l++)
                  {
                        sum=(z+q==s+l)+(z+l>s+q)+(z+s<q);
                        if(sum==3)
                        {
                            a[z]='z';
                            a[q]='q';
                            a[s]='s';
                            a[l]='l';
                            for(i=5;i>=1;i--)
                            {if(a[i]==0)
                             {continue;}
                             else;
                             {cout<<a[i]<<" "<<i<<"0"<<endl;} 
                            } 
                            break;
                        }
                  }
             }
        }
    }
    return 0;
}
int main()
{
	int z, q, s, l;
	int a[4];//a[]????
	char b[4] = {'z', 'q', 's', 'l'};
	int m = 0;//m????????
	int i, j;
	int ti;
	char tc;
	for (z = 1; z <= 5; z++)
		{
			for (q = 1; q <= 5; q++)
			if (q != z)
			{
				for (s = 1; s <= 5; s++)
				if (s != q)
				{
					for (l = 1; l <= 5; l++)
					if (l != s)
					{
						if ((z + q == s + l) && (z + l > s + q) && (z + s < q))
							{
								a[0] = z;
								a[1] = q;
								a[2] = s;
								a[3] = l;
								for (i = 0; i < 3; i++)
									for (j = 0; j < 3 - i; j++)
										if (a[j] < a[j+1])
											{
											ti = a[j];
											a[j] = a[j+1];
											a[j+1] = ti;
											tc = b[j];
											b[j] = b[j+1];
											b[j+1] = tc;
											}
								m++;
								break;
							}					
					}
					if (m != 0)
						break;
				}
				if (m != 0)
					break;
			}
			if (m != 0)
				break;
		}
		for (i = 0; i < 4; i++)
		{
			cout << b[i] << " " << 10*a[i] <<endl;
		}
		return 0;
}
int main()
{
    int z, q, s, l;
	for(z = 10; z <= 40; z = z + 10)
		for(q = 10; q <= 50; q = q + 10)
			for(s = 10; s <= 40; s = s + 10)
				for(l = 10; l <= 50; l = l + 10)
					if((((z + q) == (s + l))&&((z + l) > (s+ q))&&((z + s) < q)) == 1)
					{
						if(z > s)
							cout << "l " << l << endl << "q " << q << endl << "z " << z << endl << "s " << s << endl;
						else
							cout << "l " << l << endl << "q " << q << endl << "s " << s << endl << "z " << z << endl;
					}
	return 0;
}
int main()
{
	int z=0,q=0,s=0,l=0;
	for(z=10;z<=50;z=z+10)
		for(q=10;q<=50;q=q+10)
			for(s=10;s<=50;s=s+10)
				for(l=10;l<=50;l=l+10)
				{
					if((((z+q)==(s+l))+((z+l)>(s+q))+((z+s)<q))==3)
						{int i,j,t,a[5]={0,z,q,s,l};//
						char u,name[5]={'x','z','q','s','l'};
						for(j=1;j<=3;j++)
							for(i=1;i<=4-j;i++)
								if(a[i]>a[i+1])
								{t=a[i];a[i]=a[i+1];a[i+1]=t;
								 u=name[i];name[i]=name[i+1];name[i+1]=u;}//?????????????
								cout<<name[4]<<' '<<a[4]<<'\n';
								cout<<name[3]<<' '<<a[3]<<'\n';
								cout<<name[2]<<' '<<a[2]<<'\n';
								cout<<name[1]<<' '<<a[1]<<'\n';



						}

				}

}
/*
 * 1.cpp
 *  use??????????????????????????
 *  Created on: 2012-11-5
 *      Author: lyx
 */

int main()
{
	int z=0,q=0,s=0,l=0,i,j,a1,b1;                     //????
	int a[6];
    char b[6];
	for (z=1;z<=5;z++)               //????????
		for (q=1;q<=5;q++)
			for (s=1;s<=5;s++)
				for (l=1;l<=5;l++)
					{if((z+q)==(s+l)&&(z+l)>(s+q)&&(z+s)<q)        //???????????
				     {


                        a[1]=z;                             //??????????????
                        a[2]=q;
                        a[3]=s;
                        a[4]=l;
                        b[1]='z';                           //??????????
                        b[2]='q';
                        b[3]='s';
                        b[4]='l';

                     for (i=1;i<=4;i++)                     //????????????????
                     {
    	                 for (j=1;j<=4-i;j++)
    	                 {
    		                  if (a[j]<a[j+1])
    		                  {
    			                  a1=a[j];                  //????????????????????????
    			                  a[j]=a[j+1];
    			                  a[j+1]=a1;
    			                  b1=b[j];
    			                  b[j]=b[j+1];
    			                  b[j+1]=b1;
    		                  }
    	                 }
                     }


                     for (i=1;i<=4;i++)
                     {
	                     cout<<b[i]<<" "<<a[i]*10<<endl;
                     }
					 }
					}


	return 0;
}
struct data;
typedef struct data *pdata; 
struct data
{
    int x;
	pdata next;
};


pdata create()/*??head*/
{
	pdata p;
	p=(pdata)malloc(sizeof(struct data));
	p->next=NULL;
	return p;
}

void sort(pdata head,int n)/*head???????n???*/
{
	pdata p=NULL,q=NULL,s=NULL;
    int i;
	for (i=1;i<=n;i++)
	{
	s=(pdata)malloc(sizeof(struct data));
	scanf("%d",s->x);
    q=head;
	p=head->next;
	while (p)
	{
        if (p->x>=s->x)
			break;
		q=p;
		p=p->next;
	}
	q->next=s;
	s->next=p;
	}
	
}

void outputdata(pdata p)/*??head*/
{
    p=p->next;
	while(p->next)
	{
      printf("%d ",p->x);
	  p=p->next;
    }
	printf("%d",p->x);
}


pdata inputdata(int n)/*??head?????n???*/
{
	pdata q=NULL,p=NULL,head=NULL;
	int i;
	head=create();
	q=head;
	for (i=1;i<=n;i++)
	{p=(pdata)malloc(sizeof(struct data));
	if (p!=NULL)
	 {
	 scanf("%d",&p->x);
     p->next=NULL;
	 q->next=p;
	 q=p;
	}
	}
	return head;
}

void del(pdata p,int k)/*??head??k???*/
{
	pdata q=NULL;
	q=p;
	p=p->next;
	while(p)
		if (p->x==k)
		{
			q->next=p->next;
			free(p);
			p=q->next;
		}
		else
		{q=p;p=p->next;}
}

pdata rinputdata(int n)/*??head,????n???*/
{
	pdata q=NULL,p=NULL,head=NULL;
    int i;
	head=create();
	for (i=1;i<=n;i++)
	{
		p=(pdata)malloc(sizeof(struct data));
		if (p!=NULL)
		{
			scanf("%d",&p->x);
			p->next=q;
			q=p;
		}
	}
    head->next=q;
    return head;
}

void outputk(pdata p,int k)/*???k???*/
{
	int i=1;
    p=p->next;
	while(p)
	{
      if (i==k)
		 printf("%d",p->x);
	  p=p->next;
      i++;
	}
}

void change(pdata p,int n,int m)/*?head?n?????m???????*/
{
	int i=1;
	pdata q=NULL,s=NULL,head=NULL;
	q=p;
	head=p;
	p=p->next;
	while(p)
	{
		if (i==n-m+1)
			break;
		i++;
		q=p;
		p=p->next;
	}
	s=head;
	while(s->next)
		s=s->next;
	q->next=NULL;
	s->next=head->next;
	head->next=p;
}


int main()
{
printf("l 50\nq 40\nz 20\ns 10");
}
int main()
{
	int z,q,s,l,a[4],i,t,j;
	for (z=10;z<=50;z=z+10)
	{
		for (q=10;q<=50;q=q+10)
		{
			for (s=10;s<=50;s=s+10)
			{
				for (l=10;l<=50;l=l+10)
				{
					if (z!=q&&z!=s&&z!=l&&q!=s&&q!=l&&s!=l&&z+q==s+l && z+l > s+q && z+s < q)
					{
						a[0]=z;a[1]=q;a[2]=s;a[3]=l;
						for (j=2;j>=0;j=j-1)
						{
						for (i=0;i<=j;i++)
						{
							if (a[i]<a[i+1])
							{
								t=a[i];
								a[i]=a[i+1];
								a[i+1]=t;
							}
						}
						}
						for (i=0;i<=3;i++)
						{
						if (a[i]==z)
							cout<<"z "<<z<<endl;
						if (a[i]==q)
							cout<<"q "<<q<<endl;
						if (a[i]==s)
							cout<<"s "<<s<<endl;
						if (a[i]==l)
							cout<<"l "<<l<<endl;

						}
					}
				}
			}
		}
	}


	return 0 ;
}
int main()
{
	int z,q,s,l;
	for(z=10;z<=50;z+=10)
		for(q=10;q<=50;q+=10)
			for(s=10;s<=50;s+=10)
				for(l=10;l<=50;l+=10)
				{
					if(z+q==s+l&&z+l>q+s&&z+s<q)
						
						cout<<'l'<<' '<<l<<'\n'<<'q'<<' '<<q<<'\n'<<'z'<<' '<<z<<'\n'<<'s'<<' '<<s;
				}
				return 0;
}
int f(int a[])
{
	int i,k=0,max=a[0];
	for(i=0;i<4;i++)
	{
		if(max<a[i])
		{
			max=a[i];
			k=i;
		}
	}
	return k;
}
int main()
{
	int a[4],c[4],d[4];
	int i,j,s,t,l,n=0,g=0,z=0;
	char b[4]={'z','q','s','l'};
	for(i=1;i<6;i++)
	{
		a[0]=i*10;
		d[0]=a[0];
		for(j=1;j<6;j++)
		{
			a[1]=j*10;
			d[1]=a[1];
			for(s=1;s<6;s++)
			{
				a[2]=s*10;
				d[2]=a[2];
				for(t=1;t<6;t++)
				{
					a[3]=t*10;
					d[3]=a[3];
					if( (a[0]+a[1]==a[2]+a[3]) && (a[0]+a[3]>a[1]+a[2]) && (a[0]+a[2]<a[1]) )
					{
						c[0]=f(a);
						a[c[0]]=0;
						c[1]=f(a);
						a[c[1]]=0;
						c[2]=f(a);
						a[c[2]]=0;
						c[3]=f(a);
						for(l=0;l<4;l++)
						cout << b[c[l]] << " " << d[c[l]] << endl;
						n=1;
						break;
					}
				}
				if(n==1)
				{
					g=1;
					break;
				}
			}
			if(g==1)
			{
				z=1;
				break;
			}
		}
		if(z==1)
			break;
	}
	return 0;
}
int main()
{
    int sum=0,m=0,a[4];
    char n,b[4];
    b[0]='z';
    b[1]='q';
    b[2]='s';
    b[3]='l';
    memset( a, 0,sizeof(a) );
    for(int A=1;A<6;A++)
    {
      for(int B=1;B<6;B++)
      {
         for(int C=1;C<6;C++)
         {
            for(int D=1;D<6;D++)
            {
               if((C!=A)&&(C!=B)&&(A!=B)&&(D!=A)&&(D!=B)&&(D!=C))
               {
                 sum=((A+B)==(C+D))+((A+D)>(B+C))+((A+C)<B);
                 if(sum==3)
                 {
                   a[0]=10*A;
                   a[1]=10*B;
                   a[2]=10*C;
                   a[3]=10*D;
                   for(int j=1;j<=3;j++)
                   {
                     for(int i=0;i<=3-j;i++)
                     {
                       if(a[i]<a[i+1])
                       {
                         m=a[i];
                         a[i]=a[i+1];
                         a[i+1]=m;
                         n=b[i];
                         b[i]=b[i+1];
                         b[i+1]=n;
                       }
                     }
                   }
                   cout<<b[0]<<" "<<a[0]<<endl;
                   cout<<b[1]<<" "<<a[1]<<endl;
                   cout<<b[2]<<" "<<a[2]<<endl;
                   cout<<b[3]<<" "<<a[3]<<endl;
                 }
               }
            } 
         }
      }                                
    }
    return 0;
}
//****************************
//**???????          **
//**?????? 1100012914 **
//**???2011?10?26?    **
//****************************


int main()
{
	int z, q, s, l, i,a[4];
	
	for (z = 10; z <= 50; z = z + 10)
	{
		for (q = 10; q <= 50; q = q + 10)
		{
			for (s = 10; s <= 50; s = s + 10)
			{
				for (l = 10; l <= 50; l = l + 10)
				{
					if (z + q == s + l && z + l > s + q && z + s < q)
					{a[0] = z; a[1] = q; a[2] = s; a[3] = l;}
				}
			}
		}
	}
	for ( i = 50; i >=10; i = i - 10)
	{
		if (a[0] == i)
			cout << "z" << " " << a[0] << endl;
		if (a[1] == i)
			cout << "q" << " " <<a[1] << endl;
		if (a[2] == i)
			cout << "s" << " " <<a[2] << endl;
		if (a[3] == i)
			cout << "l" << " " <<a[3] << endl;
	}
	cin >> i;
	return 0;
}
int main()
{
	struct weight
	{
		char name;
		int wei;
	};
	struct weight a1,a2,a3,a4;
	a1.name='z';
	a2.name='q';
	a3.name='s';
	a4.name='l';
	for(a1.wei=1;a1.wei<=5;a1.wei++)
		for(a2.wei=1;a2.wei<=5;a2.wei++)
		{
			if(a2.wei==a1.wei)
				continue;
			for(a3.wei=1;a3.wei<=5;a3.wei++)
			{
				if(a3.wei==a2.wei||a3.wei==a1.wei)
					continue;
				for(a4.wei=1;a4.wei<=5;a4.wei++)
				{
					if(a4.wei==a3.wei||a4.wei==a2.wei||a4.wei==a1.wei)
						continue;
					if(a1.wei+a2.wei==a3.wei+a4.wei&&a1.wei+a3.wei<a2.wei&&a1.wei+a4.wei>a2.wei+a3.wei)
					{
						for(int i=5;i>=1;i--)
						{
							if(a1.wei==i)
								cout<<a1.name<<" "<<(a1.wei*10)<<endl;
							if(a2.wei==i)
								cout<<a2.name<<" "<<(a2.wei*10)<<endl;
							if(a3.wei==i)
								cout<<a3.name<<" "<<(a3.wei*10)<<endl;
							if(a4.wei==i)
								cout<<a4.name <<" "<<(a4.wei*10)<<endl;
						}
					}
				}
			}
		}
		return 0;
}
/*
 * 9.29?????.cpp
 *
 *  Created on: 2013-9-29
 *      Author: Administrator
 */
int main ()
{int a[4],v,i,j,flag=0;
char c[4]={'z','q','s','l'},cv;
for(a[0]=1;a[0]<=5;a[0]++)
{
	for(a[1]=1;a[1]<=5;a[1]++)
		if(a[1]!=a[0])
		{
			for(a[2]=1;a[2]<=5;a[2]++)
			{
				if((a[2]!=a[1])&&(a[2]!=a[0]))
				{
					for(a[3]=1;a[3]<=5;a[3]++)
						if((a[3]!=a[2])&&(a[3]!=a[1])&&(a[3]!=a[0]&&a[0]+a[1]==a[2]+a[3])&&(a[0]+a[3]>a[1]+a[2])&&(a[0]+a[2]<a[1]))
						{
							flag=1;
							break;
						}
				}
				if(flag)
					break;
			}
			if(flag)
				break;
		}
	if(flag)
		break;
}
for(j=0;j<=2;j++)
	for(i=0;i<=2-j;i++)
		if(a[i+1]>a[i])
		{
			v=a[i]; a[i]=a[i+1]; a[i+1]=v;
			cv=c[i]; c[i]=c[i+1]; c[i+1]=cv;
		}
for(i=0;i<=3;i++)
{cout<<c[i]<<' '<<a[i]*10<<endl;}
return 0;
}