semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
main()
{
      int n;
      scanf("%d",&n);
      int a[n];
      int i;
      for (i=0;i<n;i++)
       scanf("%d",&a[i]);
      int k,j,t;
      int f=0;
      scanf("%d",&k);
      j=n;
      i=0;
      while (i<n)
      {
          i++;
          if (a[f]==k)
          {
              j--;
              for (t=f;t<=j;t++)
                a[t]=a[t+1];
          }
          else f++;
      }
      printf("%d",a[0]);
      for (i=1;i<j;i++)
       printf(" %d",a[i]);
      getchar();
      getchar();
      getchar();
}
int a[100000];
int n;
void del_a(int x)
{
	for(int i=x;i<n-1;i++)
	{
		a[i]=a[i+1];
	}
	a[n-1]=0;
	n=n-1;

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

}
int t ;
cin>>t;
for(int i=0;i<n;i++)
{
if(a[i]==t)
{
del_a(i);
i=i-1;
}
}
for(int i=0;i<n-1;i++)
{
cout<<a[i]<<" ";
}
cout<<a[n-1];
return 0;
}
int main()
{
	int n;
	int a[100001];
	int k;
	int i;
	int sum;
	sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{scanf("%d",&a[i]);}
	scanf("%d",&k);
	for(i=0;i<n;i++)
	{
		if(a[i]==k)
				sum=sum+1;
		if(i==0)
		{
			if(a[i]!=k)
				printf("%d",a[i]);

		}
		if(i!=0)
		{

			if(a[i]!=k)
			{
				if(i!=sum)
					printf(" %d",a[i]);

				if(i==sum)
					printf("%d",a[i]);}
		}
		
	}
    



	



	return 0;
}
main()
{
      int n,i,j=0;
      scanf("%d",&n);
      long a[n],k;
      int mark[n];
      for(i=0;i<n;i++)
         scanf("%ld",&a[i]);
      scanf("%ld",&k);
      for(i=0;i<n;i++)
      {
                      if(k!=a[i])
                      {
                              mark[j]=a[i];
                              j++;  
                      }
      }
      for(i=0;i<j-1;i++)
         printf("%ld ",mark[i]);
      printf("%ld",mark[j-1]);
}
void main(){
	long int n,i,j,c=0;
	int a[100000],k;
	scanf("%ld",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	scanf("%d",&k);
	for(i=0;i<n-c;)
	{
		if(a[i]==k)
		{
			c++;
			for(j=i+1;j<n;j++)
			{
				a[j-1]=a[j];
			}
		}
		else i++;
	}
	for(i=0;i<n-c;i++)
	{
		printf("%d",a[i]);
		if(i!=n-c-1) printf(" ");
	}
}
/**
????2.cpp
?  ?????
?  ??11.01
?  ??????????
*/


int main()
{
	int n, i, j, k, cnt = 0;           // ??????n?????i,j???????k
	int a[100001];                     // ?????????????100001???
   
	cin >> n;        
    for(i = 0;i < n;i++)               // ?????????
	{
		cin >> a[i];
	} 
    cin >> k;                 
    
    for(i = 0;i < n;i++)               // ??????????
	{
		if(a[i] == k)
			cnt++;
	}

	for(i = 0;i < n;i++)              
	{  // ?????????????????????????????????????

		if(a[i] == k && a[i + 1] != k)
		{
			for(j = i + 1;j < n;j++)
		       a[j - 1] = a[j];
		}
	// ?????????????????????????????????????????????

		else if(a[i] == k && a[i + 1] == k)
		{   
			int cnt2 = 0;             // ??cnt2???a[i]?????????????
			for(j = i;j < n;j++)      
			{
				if(a[j] == k)
					cnt2++;
				else
					break;            // ???????????????????
			}
            for(j = i + cnt2;j < n;j++)
		       a[j - cnt2] = a[j];    // ?????????cnt?
					 
        }

	} 

	
	 
		  for(i = 0;i < n - cnt - 1;i++)    // ?????????
		
	    	cout << a[i] << " ";
	    // ???????????????????
	      cout << a[n - cnt - 1] << endl;
	    
	return 0;
}
/*
 * 1.cpp
 *????????
 *  Created on: 2012-11-6
 *      Author: ???
*/
int main()
{
	int N,k,i,j=0,i1,s=0;
	cin>>N;
	const int n=N;
	int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];
	cin>>k;
	for(i=0;i<n;i++)
		if(a[i]==k)
			s++;
       for(i=0;i<n; )
				{
    	   if(j<s)
			{if(a[i]==k)
				{for(i1=i;i1<n-1;i1++)
				a[i1]=a[i1+1];
				a[n-1]=k;
				j++;}
			else i++;
				}
    	   else break;
				}
	cout<<a[0];
	for(i=1;i<n-s;i++)
    cout<<" "<<a[i];

}
struct num
{
	int a;
	struct num * next;
};
int main()
{
	int n,k,i,t=0;
	struct num * head,* p1,* p2;
	p1=p2=( struct num * ) malloc(LEN);
	head=NULL;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{ 
	  scanf("%d",&p1->a);
      if (i==0)head=p1;
	  else p2->next=p1;
	  p2=p1;
	  p1=( struct num * ) malloc(LEN);
	}
	p2->next=NULL;
	scanf("%d",&k);
	p1=head;
    p2=p1;
	for(i=0;i<n;i++)
	{
		if(p1->a!=k)
		{   
			p2=p1;
			p1=p1->next;
        }
		else 
		{
			if(p1==head)
			{
				head=p1->next;
			    p1=p1->next;
				p2=p1;
			}
			else
			{
				p2->next=p1->next;
				p1=p1->next;
			}
		}
	}
	p1=head;
	while(p1!=NULL)
	{
		if(t==0)
		{
			printf("%d",p1->a);
			t=1;
		}
		else printf(" %d",p1->a);
		p1=p1->next;
	}
    return 0;
}
//**********************************
//*  ????????              *
//*  ??????                  *
//*  ?????2011?10?23?      *
//**********************************
int main()
{
	int n , a[100001] , x , k , sum;
	int i , j;
	cin >> n;//n??????????
	sum = 0;//sum??????????,??????0
	for(i = 1;i <= n;i ++)
	{
		cin >> x;
		a[i] = x;
	}//????????????
	cin >> k;//??????????
	for(i = 1;i <= n - sum;i ++)
	{
		if(a[i] == k)//???????????????
		{
			for(j = i + 1;j <= n - sum;j ++)
				a[j - 1] = a[j];//????????????
			sum = sum + 1;//?????????1
			i --;//?????1,????????????
		}
	}
	for(i = 1;i <= n - sum;i ++)
	{
		if(i < n - sum)
			cout << a[i] << " ";//???n-sum?????
		else
			cout << a[i] << endl;//??????
	}
	return 0;
}
//**********************************************
//**???????????**********************
//**?????? 1000012741*********************
//**???2010?10?29?************************
//**********************************************
int main()  //???
{
	int a[100000], n, k, num = 0, q, p;  //????a,????????n,???????k,??num,??????q?p
    cin >> n;  //??????????n
    for (int i = 0; i < n; i++)  //??????
		cin >> a[i];  //??????
        cin >> k;  //?????????k
		for (p = 0, q = 0; p < n; p++)  //??????
		{
			if (a[p] != k)  //??????????????
				a[q++] = a[p];  //??????????
			else  //?????????????
				num++;  //???1
        }
		cout << a[0];  //??????????
		for (int t = 1; t < (n-num); t++)  //??????               
			cout << " "<< a[t];  //??????????              

		return 0;  //?????
}
//**********************************************
main()
{
  int n,k,i,j,a[100000],*p,b;
  scanf("%d",&n);
  p=a;
  for(i=0;i<n;i++)
    scanf("%d",p++);
  p=a;
  scanf("%d",&k);
  for(i=0;i<n;i++)
  {
    if(*(p+i)!=k)  {printf("%d",*(p+i)); b=i;break;}  
  }
  for(i=b+1;i<n;i++)
  {
    if(*(p+i)!=k)  {printf(" %d",*(p+i));}  
  }
}
int main ()
{
	int a[100002] = {0}, n, k, i, m, num = 0, d = 1;
	cin >> n;  //??????????
	for (i = 0; i <= n - 1; i++)
	{
		cin >> a[i];
	}
	cin >> k;  //??????
	i = 0;
	for (i = 0; i <= n - 1; i++)
	{
		if (a[i] == k)  //?????????
		{
			num++;
			for (m = i; m <= n; m++)
			{
				if (a[m + d] == k)
				{
					num++;
					continue;
				}
				a[m - num + 1] = a[m + 1];
			}
			break;
		}

	}
	for (i = 0; i <= n - 2 - num; i++)
		cout << a[i] << " " ;
	cout << a[n - 1 - num] << endl;
	return 0;
}
/**
* @file 1.cpp
* @author ???
* @date 2011-10?14
* @description
* ??????:??????
*/
int main()
{
	int n, a[100000], i, j, k, l, dn, ct;
	cin >> n;
	ct = n;
	for (i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	cin >> dn;
	for (j = n-1 ; j >= 0; j--)
	{
		if (a[j] == dn)
		{
			ct--;
			for (l = j; l < n; l++)
			{
				a[l]=a[l + 1];
			}
		}
	}
	for (k = 0; k<ct ; k++)
	{
		if (k != (ct - 1))
			cout << a[k] <<' ';
		else
			cout << a[k];
	}
	return 0;
}
int main(){
	int n,k,sz1[100000],sz2[100000],i,j,x;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&sz1[i]);
	}
	scanf("%d",&k);
	x=0;
	for(i=0;i<n;i++){
		if(sz1[i]==k)
			x++;
		if(sz1[i]!=k){
			j=i-x;
			sz2[j]=sz1[i];
		}
	}
	for(j=0;j<n-x-1;j++){
		printf("%d ",sz2[j]);
	}
	if(j==(n-x-1))
		printf("%d\n",sz2[j]);
return 0; 
}
//**************************
//*?? ????????  **
//*?? ??? 1100016602 ** 
//*?? 2011?10?21?    **
//************************** 


int main() 
{
    int a[100002] , n , i , k , p , j ;       //????a???????100000????????????n,k?????i,j?????????p 
    cin >> n ;                                //??n 
    for (i = 1 ; i <= n ; i ++ )              //?????? 
        cin >> a[i] ; 
    cin >> k ;                                //??k 
    for (i = 1 , p = n ; i <= p ; i ++ )      //?????????????k,???????????p? 
    {
        if (k == a[i])                        //?????a[i]?k 
        {
              p -- ;                          //?????1 
              for (j = i ; j <= p ; j ++ )    //?????????????????j??i?p 
                  a[j] = a[j + 1] ;           //????????????????? 
              i -- ;                          //????????????????????????????????i-1 
                  }
                  }
    for (i = 1 , p -- ; i <= p ; i ++ )       //???p-1???????????????? 
        cout << a[i] << ' ' ; 
    cout << a[i] << endl ;                    //???????????????? 
    return 0 ; 
}
//============================================================================
// Name        : 5.1.cpp
// Author      : Zhang Yu
// Version     :
// Copyright   : Your copyright notice
// Description : ????????
//============================================================================



int main() {
	int N;
	cin >>N;
	const int n=N;
	int a[n];
	for (int i=0;i<=n-1;++i)
	{
		cin >>a[i];
	}
	int deletenum;
	cin >>deletenum;
	int ignore=0;

	for (int i=0;i<=n-1-ignore;++i)//when i encounters the number to be ignored, break the loop
	{

		if (a[i]==deletenum)
		{


			for (int j=i;j<=n-2;++j)
			{
				a[j]=a[j+1];
			}
			--i;//when the transformation is done, i-- is used to check whether a[i] is to be deleted
			++ignore;

		}


	}


	for (int i=0;i<=n-1-ignore;++i)
	{
		if (i==0)
			cout <<a[i];
		else
			cout <<" "<<a[i];
	}

	return 0;
}
void main()
{ 
	int a[100000];
	int i,n,m,k,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	scanf("%d",&m);
	for(k=0,i=0;i<n-k;)
	{
		if(a[i]==m)
		{
			for(j=i;j<n-k-1;j++)
				a[j]=a[j+1];
			k++;
		}
		else i++;
	}
	for(i=0;i<n-k-1;i++)
		printf("%d ",a[i]);
	printf("%d",a[n-k-1]);
}
void main()
{
	int n,k,i,t,j,c,r;
	int a[100000];
	scanf("%d\n",&n);
	for(c=0;c<n;c++)
           scanf("%d",&a[c]);
        scanf("\n");
	scanf("%d",&k);
	int s=0,u=0;
	while(u<n)
	    {
	    	if(a[u]!=k)
		s=s+1;
	    u=u+1;
	    }
	for(i=0;i<n;i++)
	{
		if(a[i]==k)
		{
			j=1;
			while(a[i+j]==k)
			   j=j+1;
		t=i;
		while(t<n)
		{
		a[t]=a[t+j];
		t++;
		}
		}
	}
	
	for(r=0;r<s-1;r++)
      	printf("%d ",a[r]);
	printf("%d",a[s-1]);
}
/*
 * homework1105.cpp
 *
 *  Created on: 2012-11-5
 *      Author: wangyinzhi
 */


int main(){
	int n,i,a[100001],k,c;//????
	cin>>n;
	for (i=0;i<=n-1;i++){
		cin>>a[i];//?????????
	}
	cin>>k;
	c=0;
	for(i=0;i<=n-1;i++){
		if(k!=a[i]){
		    c=c+1;
		    if(c==1)
			cout<<a[i];
		else cout<<" "<<a[i];}//???????k????

	}
	return 0;
}
main()
{
  int a=1,n,k,i[100001];
  scanf("%d",&n);
  for(a=1;a<=n;a++) scanf("%d ",&i[a]);
  scanf("%d",&k);
  for(a=1;a<=n;)
  {
         while(i[a]==k)
         {a++;
          if(i[a]!=k) break;
          }
         printf("%d",i[a]);
         a=a+1;
         for(;a<=n;a++)
         if(i[a]!=k) printf(" %d",i[a]);
  }
  return(0);
}
/*
 * homework1.cpp
 * ??:???
 * ????: 2012-11-2
 * ??:??????????????????????????????????? 
 *     ????????????????????????????
 */
int main(){
	int n,k,num,i,p=0;//????
	cin>>n;//???????
	int a[n];
	for(i=0;i<n;i++)
		{
		cin>>num;
		a[i]=num;//????
		}
	cin>>k;//???????
	for(i=0;i<n;i++){
		if(a[i]!=k){
			if(p==1)cout<<" ";
			cout<<a[i];
			p=1;//????
		}
	}
	return 0;//????
}
int main()
{
int a[100000],i,n,k,b;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
scanf("%d",&k);
for(i=0;i<n;i++) {
if(a[i]!=k){
b=a[0];
a[0]=a[i];
a[i]=b;
break;
}
}
printf("%d",a[0]);
for(i=1;i<n;i++) if(a[i]!=k)printf(" %d",a[i]);
return 0;
}
int main ()
{
	int n = 0, k = 0, a[100000],i = 0, x = 0;
	cin >> n;
	for ( i = 0; i <= n - 1; i ++ ) cin >> a[i];//????
	cin >> k;
	for ( i = 0; i <= n - 1; i ++ )
	{
		if( a[i] != k )//?????k???
			if( x != 1 )//????????????????
			{
				cout << a[i];
				x = 1;//?x??1
			}
			else cout << " " << a[i];//??????????
	}
	return 0;
}
void main()
{
	int del(int *x,int n,int m);
int a[100000];
int *p;
p=a;
int n,m,i,k;

scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",p+i);
scanf("%d",&m);
k=del(p,n,m);
for(i=0;i<n-k-1;i++)
printf("%d ",*(p+i));
printf("%d",*(p+n-k-1));
}
	int del(int *x,int n,int m)
	{int i,j,k=0;
	for(i=0;i<n;i++)
	{if(*(x+i)==m)
	{	for(j=i;j<n-k;j++)
	*(x+j)=*(x+j+1);
	k++;
	i--;
	}
	
	
	}
	return k;
	}
int main()
{
	int a[100001]={0};
 int i,n,k,num=0;
 cin>>n;
 for(i=1;i<=n;i++)
 {
  cin>>a[i];
 }
 cin>>k;
 for(i=1;i<=n-num;i++)
 {
	 int j;
 if(a[i]==k)
 {
	 j=i;
	 while(j<n-num)
	 {
	  a[j]=a[j+1];j++;
	 }
	 num++;
	 i--;                      //??????????
 }
  }
 i=1;
 while(i<=n-num)             //????????a?1???????????????????
 { 
	 if(i==1)
		 cout<<a[1];
	 else
  cout<<" "<<a[i];
	 i++;
 }
 return 0;
}
int main()
{
    int n,i,j,k;            
    cin>>n;                //??????n 
    int a[n];             
    for(i=0;i<n;i++)        //????a[n] 
    cin>>a[i];
    cin>>k;                 //????????k 
    for(i=0;i<n;i++)        //????????????????????a[i]?????k 
    {
        if(a[i]==k)         //???i????k 
        {
            n=n-1;           //??????????? 
            for(j=i;j<n;j++)  //???? 
            {
                a[j]=a[j+1];
            }
            i=i-1;           //i-1,????i++????i???????????????????????i?????? 
        }
    }
    for(i=0;i<n-1;i++)       //???n-1????? 
    cout<<a[i]<<' ';
    if(a[i]!=k)              //???n?????k????? 
    cout<<a[i];
    return 0;
}
/*
 *6001.cpp
 *??????????????????????????????????????
?????????????????????????????
 *Created on: 2012-10-28
 *Author: ??
 */
int n=0,i=0,k=0,j=0,mid=0,p=0,t=0;//????
int shuru[100000];//????
int main ()
{
	cin>>n;
	for(i=0;i<n;i++)//????
		cin>>shuru[i];
	cin>>k;
	i=0;
	p=n;
	while(n--){
		if(shuru[i]!=k)
		{
			i++;
			t++;
		}
		else{
			for(j=(i+1);j<p;j++)
			{//??????
				mid=shuru[i];
				shuru[j-1]=shuru[j];
			}
			shuru[p-1]=mid;
		}
	}
	cout<<shuru[0];
	for(i=1;i<t;i++)
	{//?????
		if(shuru[i]!=k)
			cout<<' '<<shuru[i];
		else
			break;
		}
	return 0;
}
int main(){
    int n,l[100000],k,c=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
            scanf("%d",&l[i]);
            }
    scanf("%d",&k);
    for(int i=0;i<n-c;i++){
            if(l[i]==k){
              for(int j=i;j<n-c;j++){
                      l[j]=l[j+1];
                      }
              c++;
              i--;
              }
            }
    for(int i=0;i<n-c;i++){
            if(i==n-c-1)
            printf("%d",l[i]);
            else
            printf("%d ",l[i]);
            }
    return 0;
}
int main()
{
	int n, k;
	int i, j, m, t, l, count = 0;
	int a[100000] = {0};
	cin >> n;
	for (i = 0; i <= n - 1; i++)
	{
		cin >> a[i];
	}
	cin >> k;

	for (j = 0; j <= n - 1 - count; j++)
	{
		if (a[j] == k)
		{
			for (l = 1; ;l++)
			{
				for (m = j; m <= n - 1 - count; m++)
				{
					a[m] = a[m + 1];
				}
				count++;
				if (a[j] != k)
				break;
			}
		}
	}
	
	cout << a[0];
	for (t = 1; t <= n - 1 - count; t++)
		cout <<" " << a[t];
	return 0;
}
main()
{
 int a[100001],n,i,k,x,j,h;
 scanf("%d",&n);
 for(i=1;i<=n;i++)
 {scanf("%d",&a[i]);}
 scanf("%d",&k);
 x=n;
 i=1;
  while(i<=x)
        {
             //for(h=1;h<=n;h++)
                // {
                 if(a[i]==k)
                      {
                            for(j=i;j<=(x-1);j++)
                                a[j]=a[j+1];
                            x=x-1;
                            }
                 else i++;           
                // }
                
             }
  printf("%d",a[1]);
  for(i=2;i<=x;i++)
  {printf(" %d",a[i]);}  

}
int main()
{
long int k,i,j,n,a[100000],m=0;
long int *p=a,*px; 
scanf("%ld\n",&n);
for(i=0;i<n;i++)scanf("%ld",p++);
scanf("\n%ld\n",&k);
for(p=a;p<a+n;p++)
{
	if(*p==k&&p<a+n-1)
	{
		m++;
		for(px=p;px<a+n;px++)*px=*(px+1);
		p--;
	}
	else if(*p==k&&p==a+n-1)
	{*p=0;
	m++;
	}
}
for(p=a;p<a+n-m-1;p++)printf("%ld ",*p);

printf("%ld\n",*(a+n-m-1));
}
/*
 * ????????????.cpp
 * ?????1200012840
 * ?????2012-11-02
 * ??????????????????????????????????????
                ?????????????????????????????
 */



int main()
{
	int n,i,j;//????
	long k;//????
	long a[1000000];//????
	cin>>n;//??
	for(i=1;i<=n;i++)
		cin>>a[i];//????
	cin>>k;//??
	i=1;
	while(i<=n)//?i<=n?
	{
		if(a[i]==k)//?????????????
		{
			for(j=i;j<=n-1;j++)//????????????
				a[j]=a[j+1];
				n=n-1;//????????1
				i=i-1;//????????????1
		}
		i=i+1;//i??
	}
	for(i=1;i<=n-1;i++)
		cout<<a[i]<<' ';
	cout<<a[n]<<endl;//????????
	return 0;//????
}
//********************************
//*???????????
//*??? ?? 1300012814  **
//*???2013.10,30  **
//********************************
int main()
{
	int  n, num = 0,a[100000], b;
	cin >> n;
   
	for (int i = 0; i < n; i++)
	{
	cin >> a[i];
	}
	cin >> b;
	int i = 0;
	while ( i < n - num )
	{
	if (a[i] == b)
	{
	for(int j = i; j <= n - 2 - num; j++)
	{
	a[j] = a[j+1];
	}
		num++;
	}
	else i++;
	}
	cout << a[0];
	for (int i = 1; i <= n - 1 - num; i++)
		cout << " " << a[i];

	return 0;
}
/*
 * 1.cpp
 *
 *  Created on: 2013-10-20
 *      Author: ??
 */
int main(){
	      int n,k,i,j,c=0,a[100000];
	      cin>>n;
	      for(i=0;i<n;i++){
	         cin>>a[i];
	      }
	      cin>>k;
	      for(i=0;i<n;i++){
	         if(a[i]==k){
	        	 for(j=i;j<n-1;j++) a[j]=a[j+1];
	             c+=1;
	             if(i==n-c) break;
	             i--;
	         }
	      }
	      cout<<a[0];
	      for(i=1;i<n-c;i++) cout<<" "<<a[i];
	      return 0;
}
main()
{
   long n,k,i,j,m=0,t;
   long a[100000];
   scanf("%ld",&n);
   for(i=0;i<n;i++)
      scanf("%ld",&a[i]);
   scanf("%ld",&k);
   for(i=0;i<n;i++)
      if(a[i]==k)
         m++;
   if(a[0]==k);
   for(i=0;i<n;i++)
   {
      if(a[i]==k)
      {
         for(j=0;j<=i;j++)
         {
            t=a[0];
            a[0]=a[j];
            a[j]=t;
         }
      }
   }
   for(i=m;i<n-1;i++)
      printf("%ld ",a[i]);
   printf("%ld",a[n-1]);
}
void main ()
{
	int n,a[100000],m,i,k=0;
	int *p,*q;
	scanf ("%d",&n);
	for (i=0;i<n;i++)
	scanf ("%d",&a[i]);
	scanf ("%d",&m);
	for (p=a;p<a+n-k;p++)
	{
		if (*p==m)
		{
			k++;
			for (q=p;q<a+n-k;q++)
			{
				*q=*(q+1);
			}
			p--;
		}
	}
         p=a;
	for (i=0;i<n-k-1;i++)
	{
		printf ("%d ",*(p+i));
	}
	printf ("%d",*(p+i));
}
int main(){
    int x,n,i,j,k,sz[100000];
    scanf("%d",&n);
    for(i=0;i<n;i++){
            scanf("%d",&sz[i]);
    }
    scanf("%d",&x);
    k=0;
    for(i=0;i<n;i++){
           if(sz[i]==x){
                 for(j=i;j<n-1;j++){
                        sz[j]=sz[j+1];
                 }      
                 sz[n-1]=x-1;
           k++;
           i--; 
           }
    } 
    for(i=0;i<n-k;i++){
           if(i==n-k-1) printf("%d",sz[i]);
           else printf("%d ",sz[i]);
    }
    scanf("%d",&n);
    return 0;
}
int main()
{
	signed n=0,k=0,sum=0; signed a[100000]={0};int i=0,j=0;
	cin>>n;
	sum=n;
	for(i=0;i<n;i++)
		cin>>a[i];
	cin>>k;
	for(i=0;i<sum;i++)
	{
		if(a[i]==k)
		{
			for(j=i;j<sum;j++)
			{
				a[j]=a[j+1];
			}
			sum--;
			i--;
		}
	}
	for(i=0;i<sum;i++)
	{
		cout<<a[i];
		if(i==sum-1)
		{
			cout<<endl;
			break;
		}
		cout<<" ";
	}
	return 0;
}
int main()
{
    int n,i,k;
	scanf("%d",&n);
	int sz[100000];
	for(i=0;i<n;i++)
	{
		scanf("%d",&sz[i]);
	}
	scanf("%d",&k);
	int sum=0,N=n;
	for(i=0;i<N;i++)
	{
		if(sz[i]==k)
		{
			while(sz[i]==k)
			{
			    for(int j=i;j<n;j++)
				{
				    int c;
				    c=sz[j+1];
				    sz[j+1]=sz[j];
				    sz[j]=c;
				}
			    sum++;
			    N--;
			}
		}
	}
	for(i=0;i<n-sum;i++)
	{
		if(i==0)
		{
		    printf("%d",sz[i]);
		}
		else
		{
			printf(" %d",sz[i]);
		}
	}
	return 0;
}
int main()
{
    int n,i,j,del,s;
    s=0; 
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    scanf("%d",&del);
    for(i=0;i<n;i++)
    {
        if(a[i]==del)
        {
            for(j=i;j>s;j--)
            {
                a[j]=a[j-1];                
            }
            s++;
        }
    } 
    for(i=s;i<n;i++)
    {
        printf("%d",a[i]);
        if(i<n-1) printf(" ");
    }
    return 0;
    }
struct number
{
	int num;
	struct number *next;
}*p1,*p2,*head;
void main()
{
	int n,k,i;
	scanf("%d\n",&n);
	p1=p2=(struct number *)malloc(sizeof(struct number));
	head=NULL;
	for(i=0;i<n;i++)
	{
		scanf("%d",&p1->num);
		if(i==0)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct number *)malloc(sizeof(struct number));		
	}
	p2->next=NULL;
	scanf("%d",&k);
	p2=p1=head;
	while(p1!=NULL)
	{	
		if(k!=p1->num)	{p2=p1;p1=p1->next;}
		else
		{	if(p1==head){head=p1->next;free(p1);p1=head;}
		else {p2->next=p1->next;	
		free(p1);
		p1=p2->next;}
		}
	}
	for(p1=head;p1->next!=NULL;p1=p1->next)
		printf("%d ",p1->num);
	printf("%d\n",p1->num);
}
/*
 * 1000012858_25.cpp
 *
 *  Created on: 2010-11-3
 *      Author: Administrator
 */
int main(){
	int n,i,num,k;                   //????n??????????num????????
	cin>>n;                          //??n
	k=0;                             //?k????n-1
	int a[n];                        //??????a[n]
	for(i=0;i<n;i++)                 //????????
		cin>>a[i];
	cin>>num;                        //??num??
	for(i=n-1;i>=0;i--){                //??????num????,??????
		if(a[i]==num){                 //???i???num???i??????
					for(;i<n-1-k;i++){
						a[i]=a[i+1];}
					k=k+1;            //??k??????????
	         }
			}
	        cout<<a[0];
	        for(i=1;i<=n-1-k;i++)
			cout<<' '<<a[i];
			return 0;
}
int main()
{
	int n,i,k,j,cnt=0,t;
	int a[100002];
	cin >> n;//?????????
	for(i = 0; i < n; i++)
		cin >> a[i];//??????????
	cin >> k;
	i = 0;
	while(i < n)
	{
		if(a[i] == k)//????k??
		{
			cnt=cnt+1;
			if(i==n-cnt)
				break;
			else
			{
				for(j = i + 1; j < n; j++)
					a[j-1] = a[j];//?????????????
				
			}//????k?????
			
		}
		else
			i++;
		
	}

	for(t=0;t<(n-cnt-1);t++)
		cout<<a[t]<<" ";
	cout<<a[n-cnt-1];
	
	

	return 0;
}
int main()
{int i,j,n,k,a[100000],m;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	scanf("%d",&m);
	i=0;
	j=n;
	while(i<j)
	{	if(a[i]==m)
		{	j--;
                       
			for(k=i;k<j;k++)
				a[k]=a[k+1];
i--;
		}
		i++;	
	}
	for(i=0;i<j-1;i++)
	{	printf("%d ",a[i]);
	}
		printf("%d",a[j-1]);
	return 0;
}
//*****************************************
//* ??????????? **
//* ?????? 1300012741 **
//* ???2013.10.30 **
//*****************************************


int main()
{
	int list[100000];
	int i, num, target; // ????????????????????
	int space_check = 0; // ????????

	cin >> num;

	for ( i = 0; i < num; i++ ) // ????
		cin >> list[i];

	cin >> target;

	for ( i = 0; i < num; i++ ) // ??????
	{
		if ( target != list[i] ) // ?????
		{
			if ( space_check ) // ????
				cout << " ";
			else
				space_check = 1; 
			cout << list[i];
		}
	}

	return 0;
}
/**
* @file 1000012800_2.cpp
* @author ??
* @date 2010-10-27
* @description
* ??????:????
*/

int main()
{
	int n, i = 0, m;
	cin >> n;
	int num[100000];
	for (; i < n; i ++)
	{
		cin >> num[i];
	}
	cin >> m;
	for (i = 0; i < n; i ++)
	{
		if ( m == num[i])
		{
			int j = i;
			for (; j < n - 1; j ++)
			{
				num[j] = num[j + 1];
			}
			n --;
			i --;
		}
	}

	cout << num[0];
	for (i = 1; i <= (n - 1); i ++)
		cout << " " << num[i];
	cout << endl;
	return 0;
}
int main()
{
	int n , a[ 100001 ] = { 0 } , d , i , j = 1 ;

	cin >> n ;

	for( i = 1 ; i <= n ; i ++ )
		cin >> a[ i ] ;

	cin >> d ;

	for( i = 1 ; i <= n ; i ++ )
		if( a[ i ] != d )
			a[ j ++ ] = a[ i ] ;

	cout << a[ 1 ] ;

	for( i = 2 ; i <= j - 1 ; i ++ )
		cout << ' ' << a[ i ] ;

	return 0 ;
}
int main ()
{
    int n,j,i,k;
    int a[100000];
    cin >>n;
    for (i=0;i<n;i++)    
    {
        cin >>a[i];
    }
    cin >>k;
    j=0;
    for (i=0;i<n;i++)
    {
        if(a[i]!=k)
        j++;
    }
    if (j==1)
    {
        for (i=0;i<n;i++)
        {
           if (a[i]!=k)
           {cout<<a[i] <<endl;
           break;
           }       
        }         
    }
    else
    {
    for(i=0;i<n;i++)
    {
        if(a[i]!=k)
        {cout <<a[i]<<' ';
        j--;
        }
        if (j==1) break;
        
    }
    for (i=n-1;i>=0;i--)
    {
        if (a[i]!=k)
        {cout <<a[i] <<endl;
        break;}    
    }
    }
    return(0);
}