semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
main()
{
  struct point
  {
    int hen,shu,shumu;
  }s[81];
  int a,b,i,j,k,m[4][81]={0};
  scanf("%d %d",&a,&b);
  for(i=0;i<=8;i++)
    for(j=0;j<=8;j++)
    {
      s[9*i+j].hen=i;
      s[9*i+j].shu=j;
      s[9*i+j].shumu=0;
    }
  s[40].shumu=a;
  for(i=0;i<=b-1;i++)
   {
    for(j=0;j<=80;j++)
      if(s[j].shumu!=0)
        for(k=0;k<=80;k++)
           if((s[k].hen==s[j].hen-1||s[k].hen==s[j].hen+1||s[k].hen==s[j].hen)&&(s[k].shu==s[j].shu+1||s[k].shu==s[j].shu-1||s[k].shu==s[j].shu))
              m[i][k]=m[i][k]+s[j].shumu;
    for(k=0;k<=80;k++)
      s[k].shumu=s[k].shumu+m[i][k];
   }
  for(i=0;i<=8;i++)
    for(j=0;j<=8;j++)
    {
      if(j==8)
        printf("%d\n",s[9*i+j].shumu);
      else
        printf("%d ",s[9*i+j].shumu);
    }
}
int main( )
{
	int m,n,i,j,p,q;
	int a[11][11]={0},b[11][11]={0};
	cin>>m>>n;
	a[5][5]=m;
	while(n>0)
	{
		n--;
		for(i=1;i<=9;i++)
		{
			for(j=1;j<=9;j++)
			{
				for(p=-1;p<=1;p++)
				{
					for(q=-1;q<=1;q++)
					{
						b[i+p][j+q]+=a[i][j];             //????????????????
					}
				}
			}
		}
		for(i=1;i<=9;i++)
		{
			for(j=1;j<=9;j++)
			{
				a[i][j]+=b[i][j];                //???
				b[i][j]=0;
			}
		}
	}
	for(i=1;i<=9;i++)
	{
		for(j=1;j<9;j++)
			cout<<a[i][j]<<" ";
		cout<<a[i][j]<<endl;
	}
	return 0;
}
int  main()
{
   int a[11][11]={0};
   int b[11][11]={0};
   int i,j,k,l,m,n,x,y;
   scanf("%d %d",&m,&n);
   a[5][5]=m;
   b[5][5]=m;
   for(i=1;i<=n;i++)
      {
          for(j=1;j<10;j++)
             {
                 for(k=1;k<10;k++)
                    {
                         for(x=0-1;x<=1;x++)
                             {
                                 for(y=0-1;y<=1;y++)
                                     {
                                         b[j][k]=b[j][k]+a[j+x][k+y];
                                     }
                             }
                    }
             }
         for(j=1;j<10;j++)
             {
                for(k=1;k<10;k++)
                    {
                         a[j][k]=b[j][k];
                    }
             }
      }
   for(j=1;j<10;j++)
      {
         for(k=1;k<9;k++)
             {
                 printf("%d ",a[j][k]);
             }
         printf("%d\n",a[j][9]);
      }
   
}
void p(int a[9][9])
{
	int b[9][9],i,j,x,y;
	for(i=0;i<9;i++)
		for(j=0;j<9;j++)
			b[i][j]=a[i][j];
	for(i=1;i<8;i++)
		for(j=1;j<8;j++)
		{
			for(x=-1;x<=1;x++)
	        	for(y=-1;y<=1;y++)
					b[i+x][j+y]+=a[i][j];
		}
	for(i=0;i<9;i++)
		for(j=0;j<9;j++)
			a[i][j]=b[i][j];
}
int main()
{
	int a[9][9]={0},m,n,i,j,k;
	scanf("%d%d",&m,&n);
	a[4][4]=m;
	for(k=0;k<n;k++)
		p(a);
	for(i=0;i<9;i++)
		for(j=0;j<9;j++)
			printf("%d%c",a[i][j],(j==8)?'\n':' ');
}
int main()
{
	int m, n;
	int a[9][9] = {0}, b[9][9] = {0};
	cin >> m >> n;
	a[4][4] = m;
	for(int i = 1; i <= n; i++)
	{
		for(int j = 0; j < 9; j++)
		{
			for(int k = 0; k < 9; k++)
			{
				if(a[j][k])
				{
					b[j][k] += 2 * a[j][k];
					b[j][k + 1] += a[j][k];
					b[j][k - 1] += a[j][k];
					b[j - 1][k] += a[j][k];
					b[j + 1][k] += a[j][k];
					b[j - 1][k - 1] += a[j][k];
					b[j - 1][k + 1] += a[j][k];
					b[j + 1][k - 1] += a[j][k];
					b[j + 1][k + 1] += a[j][k];
				}
			}
		}
		for(int j = 0; j <= 8; j++)
		{
			for(int k = 0; k <= 8; k++)
			{
				a[j][k] = b[j][k];
			}
		}
		memset(b, 0, sizeof(b));
	}
	for(int i = 0; i < 9; i++)
	{
		for(int j = 0; j < 8; j++)
		{
			cout << a[i][j] << " ";
		}
		cout << a[i][8] << "\n";
	}
	return 0;
}
int main ()
{
	const int sz=9;
	int a[sz][sz],b[sz][sz];
	int i,j,k,m,n,fx,fy;
	scanf("%d%d",&m,&n);
	memset(a,0,sizeof(a));
	a[sz/2][sz/2]=m;
	for(k=0;k<n;k++)
	{
		memset(b,0,sizeof(b));
		for(i=1;i<sz-1;i++)
		{
			for(j=1;j<sz-1;j++)
			{
				b[i][j]+=a[i][j];
				for(fx=-1;fx<=1;fx++)
				{
					for(fy=-1;fy<=1;fy++)
						b[i+fx][j+fy]+=a[i][j];
				}
			}
		}
		memcpy(a,b,sizeof(a));
	}
	for(i=0;i<sz;i++)
	{
		for(j=0;j<sz-1;j++)
			printf("%d ",a[i][j]);
		printf("%d\n",a[i][sz-1]);
	}
	return 0;
}
int main()
{
  int m,n,i,p,q;
  int a[11][11]={0};
  int b[11][11];
  scanf("%d %d",&m,&n);
  a[5][5]=m;
  for (i=0;i<n;i++)
  {
    for (p=0;p<11;p++)
    {
      for (q=0;q<11;q++)
        b[p][q]=a[p][q];
    }
    for (p=1;p<10;p++)
    {
      for (q=1;q<10;q++)
        a[p][q]=2*b[p][q]+b[p-1][q]+b[p-1][q-1]+b[p][q-1]+b[p+1][q]+b[p][q+1]+b[p+1][q+1]+b[p+1][q-1]+b[p-1][q+1];
    }
  }
  for (p=1;p<10;p++)
  {
    for (q=1;q<10;q++)
    { 
      if (q<9)
        printf ("%d ",a[p][q]);
      if (q==9)
        printf ("%d\n",a[p][q]);
    }
  }
}
int main ()
{
	int day[5][9][9]={0};
	int n;
	cin>>day[0][4][4]>>n;
	int a[3]={-1,0,1};
	int b[3]={-1,0,1};
	for (int d=1;d<=4;d++)
	{
		for (int i=0;i<9;i++)
			for (int j=0;j<9;j++)
			{
				if (day[d-1][i][j]!=0)
				{
					for (int p=0;p<3;p++)
						for (int q=0;q<3;q++)
							day[d][i+a[p]][j+b[q]]+=day[d-1][i][j];
					day[d][i][j]+=day[d-1][i][j];
				}
			}
	}
	for (int i=0;i<9;i++)
	{
		for (int j=0;j<9;j++)
		{
			if (j!=0) cout<<" ";
			cout<<day[n][i][j];
		}
		cout<<endl;
	}
	
	return 0;
}
int a[10][10];
void does(int,int,int);
int main()
{   
	memset(a,0,sizeof(a) );
	a[5][5]=1;
	int n,m;
	int i,j;
	cin >> m >> n;

	does(5,5,n);

	for(i=1;i<=9;i++)
		for(j=1;j<=9;j++)
		{
			if(j<9)
			cout << m*a[i][j] << ' ';
			else
				cout << m*a[i][j] << endl;
		}

	return 0;
}

void does (int i,int j,int n )
{
	if( n>0 )
	{
		int b;
		a[i][j]++;
		a[i+1][j]++;
		a[i-1][j]++;
		a[i][j+1]++;
		a[i][j-1]++;
		a[i-1][j-1]++;
		a[i-1][j+1]++;
		a[i+1][j-1]++;
		a[i+1][j+1]++;
		    
		    does(i,j,n-1);
			does(i,j,n-1);
			does(i,j+1,n-1);
			does(i,j-1,n-1);
			does(i+1,j,n-1);
			does(i-1,j,n-1);
			does(i-1,j-1,n-1);
			does(i-1,j+1,n-1);
			does(i+1,j-1,n-1);
			does(i+1,j+1,n-1);

		
		
	}
}
int main()
{
	int i,j,m,n,k;
	scanf("%d%d",&m,&n);
	int xj[50][9]={0};
	xj[4][4]=m;
	for(k=1;k<=n;k++)
	{
		for(i=0;i<9;i++)
		{
			for(j=0;j<9;j++)
			{
				xj[i+k*9][j]+=xj[i+(k-1)*9][j]*2;
				xj[i-1+k*9][j-1]+=xj[i+(k-1)*9][j];
				xj[i-1+k*9][j]+=xj[i+(k-1)*9][j];
				xj[i-1+k*9][j+1]+=xj[i+(k-1)*9][j];
				xj[i+k*9][j-1]+=xj[i+(k-1)*9][j];
				xj[i+k*9][j+1]+=xj[i+(k-1)*9][j];
				xj[i+1+k*9][j-1]+=xj[i+(k-1)*9][j];
				xj[i+1+k*9][j]+=xj[i+(k-1)*9][j];
				xj[i+1+k*9][j+1]+=xj[i+(k-1)*9][j];
			}
		}
	}
	for(i=0;i<9;i++)
	{
		printf("%d %d %d %d %d %d %d %d %d\n",xj[i+9*n][0],xj[i+9*n][1],xj[i+9*n][2],xj[i+9*n][3],xj[i+9*n][4],xj[i+9*n][5],xj[i+9*n][6],xj[i+9*n][7],xj[i+9*n][8]);
	}
	return 0;
}
int main()
{
	int n, m, i, j, a[9][9], b[9][9];
	cin>>n>>m;
	for(i = 0; i < 9; i++)
	{
		for(j = 0; j < 9; j++)
		{
			a[i][j] = 0;
		}
	}
	int ave, k, x, y;
	a[4][4] = n;
	for(k = 0; k < m; k++)
	{
		for(i = 0; i < 9; i++)
		{
			for(j = 0; j < 9; j++)
				b[i][j] = 0;
		}
		for(i = 0; i < 9; i++)
		{
			for(j = 0; j < 9; j++)
			{
				if(a[i][j] != 0)
				{
					int num = a[i][j];
				    a[i][j] = 2 * num;
				    ave = num;
				    for(x = i - 1; x <= i + 1; x++)
					{
						for(y = j - 1; y <= j + 1; y++)
						{
							if(x == i && y == j)
								continue;
							b[x][y] = b[x][y] + ave;
						}
					}
				}
			}
		}
		for(i = 0; i < 9; i++)
		{
			for(j = 0; j < 9; j++)
			{
				a[i][j] = a[i][j] + b[i][j];
			}
		}
	}
	for(i = 0; i < 9; i++)
	{
		for(j = 0; j < 8; j++)
			cout<<a[i][j]<<" ";
		cout<<a[i][8]<<endl;
	}
	return 0;
}
int p[9][9],q[9][9];
main()
{void xijun();
    int m,n;
    int i,j,k;
    scanf("%d%d",&m,&n);
    for(i=0;i<=8;i++)
       {
          for(j=0;j<=8;j++)
             {
                 p[i][j]=q[i][j]=0;
             }  
       }  
    p[4][4]=m;
   for(i=0;i<=n-1;i++)
      {xijun();}
   for(i=0;i<=8;i++)
       {
          for(j=0;j<8;j++)
             {
                 printf("%d ",p[i][j]);
             }  
          printf("%d",p[i][8]);
          printf("\n");
       }  
    

}
void xijun()
{
      int i,j,k;
       for(i=0;i<=8;i++)
       {
          for(j=0;j<=8;j++)
             {
                if(p[i][j]!=0) 
                {q[i-1][j-1]=q[i-1][j-1]+p[i][j];
                 q[i-1][j]=q[i-1][j]+p[i][j];
                 q[i-1][j+1]=q[i-1][j+1]+p[i][j];
                 q[i][j-1]=q[i][j-1]+p[i][j];
                 q[i][j+1]=q[i][j+1]+p[i][j];
                 q[i+1][j-1]=q[i+1][j-1]+p[i][j];
                 q[i+1][j]=q[i+1][j]+p[i][j];
                 q[i+1][j+1]=q[i+1][j+1]+p[i][j];
                 q[i][j]=2*p[i][j]+q[i][j];
                }              
             }              
       } 
        for(i=0;i<=8;i++)
       {
          for(j=0;j<=8;j++)
             {
                 p[i][j]=q[i][j];
                 q[i][j]=0;
             }  
       }  
           
     
}
main()
{ int a[10][10],b[10][10];
  int i,j,k,m,n,p,q;
  scanf("%d%d",&m,&n);
  for (i=1;i<=9;i++)
  for (j=1;j<=9;j++)
  a[i][j]=0; 
  a[5][5]=m;
   /*for (j=1;j<=9;j++)
   {
     for (k=1;k<=9;k++) printf("%d ",a[j][k]);
     printf("\n");}
   printf("\n");*/
   
  for (i=1;i<=n;i++)
  {for (j=1;j<=9;j++)
   for (k=1;k<=9;k++)
   b[j][k]=0; 
      
    for (j=1;j<=9;j++)
    for (k=1;k<=9;k++)
    { b[j][k]=b[j][k]+2*a[j][k];
      for (p=-1;p<=1;p++)
      for (q=-1;q<=1;q++)
      if ((p!=0)||(q!=0)) b[j+p][k+q]=b[j+p][k+q]+a[j][k];
    }
    for (j=1;j<=9;j++)
    for (k=1;k<=9;k++)
    a[j][k]=b[j][k];
    }
   for (j=1;j<=9;j++)
   {
     for (k=1;k<=9;k++) 
     {printf("%d",a[j][k]); if (k<9) printf(" ");}
     printf("\n");}
}
int main()
{   int date,day,i,j;
	int a[11][11]={0},t[11][11];
	scanf("%d %d",&a[5][5],&date);
	for(day=1;day<=date;day++){
		for(i=1;i<10;i++){
			for(j=1;j<10;j++){
				t[i][j]=a[i][j]*2+a[i-1][j-1]+a[i-1][j]+a[i-1][j+1]+a[i][j-1]+a[i][j+1]+a[i+1][j-1]+a[i+1][j]+a[i+1][j+1];
			}
		}	
		for(i=1;i<10;i++){
			for(j=1;j<10;j++){
				a[i][j]=t[i][j];
			}
		}
	}
	for(i=1;i<10;i++){
		if(i!=1){
			printf("\n");
		}
		for(j=1;j<10;j++){
			if(j!=1){
				printf(" ");
			}
			printf("%d",a[i][j]);
		}
	}
	return 0;
}
main()
{
  int h,l,i,m,n,j,y;
  int a[11][11],b[11][11];
  scanf("%d %d",&m,&n);
  for(h=0;h<11;h++)
  {
    for(l=0;l<11;l++)                
     {
       a[h][l]=0;
       b[h][l]=0;                             
                                    
     }             
  }      
 a[5][5]=m;
   b[5][5]=m;
  // printf("%d %d\n",a[4][4],b[4][4]);
for(i=0;i<n;i++)
{
  for(y=0;y<=n;y++)
  {
    for(j=0;j<=n;j++)                
     {
      /// if((4-y==4-n)&&(4-j==4-n))
       {a[5-y][5-j]=2*b[5-y][5-j]+b[4-y][4-j]+b[4-y][5-j]+b[4-y][6-j]+b[5-y][4-j]+b[5-y][6-j]+b[6-y][4-j]+b[6-y][5-j]+b[6-y][6-j];
       
      // b[h][l]=a[h][l];
      // printf("%d %d\n",y,j);
      //printf("a=%d+%d+%d+%d+%d+%d+%d+%d+%d\n",2*b[4-y][4-j],b[3-y][3-j],b[3-y][4-j],b[3-y][5-j],b[4-y][3-j],b[4-y][5-j],b[5-y][3-j],b[5-y][4-j],b[5-y][5-j]);
       
        }
      a[5+y][5+j]=a[5-y][5-j];
       a[5-y][5+j]=a[5-y][5-j];
       a[5+y][5-j]=a[5-y][5-j];
           
     /* else
      { if(j==0&&y==0)  
       { a[4][4]=2*b[4][4]+8*b[3][3] ;
        //b[4][4]= a[4][4];
        }
       else
       {
         a[4-y][4-j]=2*b[4-y][4-j]+2*b[4-y][4]+b[4][4]+b[4-y][4-j];  
       } 
      // break;
      } */         
     }             
  }
  for(h=0;h<11;h++)
  {
    for(l=0;l<11;l++)                
     {
      
       b[h][l]= a[h][l];;                             
                                    
     }             
  }          
}
       
for(h=1;h<10;h++)
  {
    for(l=1;l<10;l++)                
     {
        if(l!=9)                             
        {printf("%d ",b[h][l]);}
        else
        {printf("%d",b[h][l]);}                        
     }
     printf("\n");             
  }            
 getchar();  
getchar();     
getchar(); 
}
// lp.cpp : Defines the entry point for the console application.
//
// ??????.cpp : Defines the entry point for the console application.
//

int a[10][10],b[10][10]={0};
int n,m;
void f(int a[10][10])
{
	int i,j;
	while(n>0)
	{
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			b[i-1][j-1]+=a[i][j];
			b[i][j-1]+=a[i][j];
			b[i+1][j-1]+=a[i][j];
			b[i-1][j]+=a[i][j];
			b[i][j]+=a[i][j]*2;
			b[i+1][j]+=a[i][j];
			b[i-1][j+1]+=a[i][j];
			b[i][j+1]+=a[i][j];
			b[i+1][j+1]+=a[i][j];
		}
	}
    for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			a[i][j]=b[i][j];
			b[i][j]=0;
		}
	}
	n--;
	}
}
int main()
{
	int i,j;
	cin>>m>>n;
	memset(a,0,100);
	a[4][4]=m;
	f(a);
	for(i=0;i<9;i++)
		for(j=0;j<9;j++)
		{
			if(j<8)
				cout<<a[i][j]<<' ';
			else
			{
				cout<<a[i][j]<<endl;
			}
		}
	return 0;
}
int main()
{
	int m,n,i,j,k;
	
	scanf("%d %d",&m,&n);
	int a[9][9];
	int b[9][9];
	for(i=0;i<=8;i++)
	{
		for(j=0;j<=8;j++)
		{
			a[i][j]=0;
			b[i][j]=0;
		}
	}
	a[4][4]=m;
	for(k=1;k<=n;k++)
	{
    	for(i=5-k;i<=3+k;i++)
		{
    		for(j=5-k;j<=3+k;j++)
			{
		    	b[i][j]+=2*a[i][j];
				b[i-1][j-1]+=a[i][j];
				b[i-1][j]+=a[i][j];
				b[i-1][j+1]+=a[i][j];
				b[i][j-1]+=a[i][j];
				b[i][j+1]+=a[i][j];
				b[i+1][j-1]+=a[i][j];
				b[i+1][j]+=a[i][j];
				b[i+1][j+1]+=a[i][j];
			}
		}
		for(i=0;i<=8;i++)
		{
			for(j=0;j<=8;j++)
			{
				a[i][j]=b[i][j];
				b[i][j]=0;
			}
		}
	}
	for(i=0;i<=8;i++)
		{
			for(j=0;j<=8;j++)
			{
				printf("%d",a[i][j]);
				if(j<8) printf(" ");
			}
			if(i<8) printf("\n");
		}
	return 0;
}
int main()
{
	int result[SCALE][SCALE]={{0}};  //??
	int temp[SCALE][SCALE]={{0}};   //??
	int i,j;
	int day;
	int m,n;
	int x,y;
	scanf("%d %d",&m,&n);      //??
	result[SCALE/2][SCALE/2]=m;   //????????
	for(day=0;day<n;day++)  //????????
	{
		memset(temp,0,sizeof(temp));  //??????????
		for(i=0;i<SCALE;i++)
		{
			for(j=0;j<SCALE;j++)
			{
				temp[i][j]+=result[i][j];
				//???????????
				for(x=-1;x<=1;x++)
				{
					for(y=-1;y<=1;y++)     //???+1????+1
					{
						if((i+x>=0)&&(i+x<SCALE)&&(j+y>=0)&&(j+y<SCALE))
						    temp[i+x][j+y]+=result[i][j];
					}
				}
			}
		}
		memcpy(result,temp,sizeof(result));
	}
	for(i=0;i<SCALE;i++)
	{
		for(j=0;j<SCALE-1;j++)
		{
			printf("%d ",result[i][j]);
		}
		printf("%d\n",result[i][SCALE-1]);
	}
	return 0;
}
int s[6][11][11];
int m, n;

int main()
{
	cin >> m >> n;
	s[0][5][5] = m;
	
	for (int day = 0; day < n; ++day)
		for (int x = 1; x < 10; ++x)
		for (int y = 1; y < 10; ++y)
		{
			s[day + 1][x][y] += 2 * s[day][x][y];
			s[day + 1][x - 1][y] += s[day][x][y];
			s[day + 1][x + 1][y] += s[day][x][y];
			s[day + 1][x][y - 1] += s[day][x][y];
			s[day + 1][x][y + 1] += s[day][x][y];
			s[day + 1][x - 1][y - 1] += s[day][x][y];
			s[day + 1][x + 1][y + 1] += s[day][x][y];
			s[day + 1][x + 1][y - 1] += s[day][x][y];
			s[day + 1][x - 1][y + 1] += s[day][x][y];
		}
	
	for (int x = 1; x < 10; ++x)
	{
		for (int y = 1; y < 9; ++y)
			cout << s[n][x][y] << ' ';
		cout << s[n][x][9] << endl;
	}

}
int main()
{
    int i, j, m, n;
    int a[10][10], b[10][10];
    cin >> m >> n;
    for(i = 1; i <= 9; i++)
        for(j = 1; j <= 9; j++)
        a[i][j] = 0;
    a[5][5] = m;
    for (int k = 1; k <= n; k++)
    {
        for(i = 1; i <= 9; i++)
            for(j = 1; j <= 9; j++)
            b[i][j] = a[i][j];
            for(i = 1; i <= 9; i++)
            for(j = 1; j <= 9; j++)
            {
            if(b[i][j] != 0)
               {
                   a[i][j] -= b[i][j];
                   if(i <= 8 && i >= 2 && j <= 8 && j >= 2)
                   {
                       for(int p = i - 1; p <= i + 1; p++)
                          for(int q = j - 1; q <= j + 1; q++ )
                          a[p][q] += b[i][j];
                       a[i][j] += b[i][j];

                   }
               }
        }
    }
    for(i = 1; i <= 9; i++)
            {
                for(j = 1; j <= 8; j++)
                    cout << a[i][j] << " ";
                cout << a[i][9] << endl;

            }
    return 0;
}
int main()
{
    int a[11][11];
    int b[11][11];
    int i,j,k;
    for(i=0;i<11;i++)
    {
        for(j=0;j<11;j++)
        {
            a[i][j]=0;
            b[i][j]=0;
        }
    }
    int m, n;
    scanf("%d %d",&m,&n);
    a[5][5]=m;
    b[5][5]=m;
    for(k=0;k<n;k++)
    {
        for(i=1;i<10;i++)
        {
            for(j=1;j<10;j++)
            {
                a[i][j]=2*b[i][j]+b[i-1][j]+b[i+1][j]+b[i-1][j-1]+b[i+1][j-1]+b[i-1][j+1]+b[i+1][j+1]+b[i][j+1]+b[i][j-1];
            }
        }
        for(i=1;i<10;i++)
        {
            for(j=1;j<10;j++)
            {
            b[i][j]=a[i][j];
            }
        }
    }
    for(i=1;i<10;i++)
    {
        for(j=1;j<10;j++)
        {
            if(j==9)
            printf("%d\n",a[i][j]);
            else
            printf("%d ",a[i][j]);
        }
    }
    return 0;
}
//********************************
//*???????????   **
//*?????? 1300012713 **
//*???2013.12.05  **
//********************************
int board[10][10] = {0}; //??????????
int board1[10][10] = {0};  //??????????
void day(int a, int b, int c) //?????????a??????b????c
{
	if(a == c) //?????
	{
		for(int i = 1; i <= 9; i++)
		{
			for(int j = 1; j <= 9; j++)
			{
				cout << board[i][j];
				if(j < 9)
					cout << " ";
				if(j == 9)
					cout << "\n";
			}
		}
		return;
	}
	for(int k = 1; k <= 9; k++) //??
	{
		for(int l = 1; l <= 9; l++)
		{
			if(board[k][l]!=0) //?????????????????????
			{
				if(k > 1)
					board1[k-1][l] += board[k][l];
				if(k < 9)
					board1[k+1][l] += board[k][l];
				if(l > 1)
					board1[k][l-1] += board[k][l];
				if(l < 9)
					board1[k][l+1] += board[k][l];
				if(k > 1 && l > 1)
					board1[k-1][l-1] += board[k][l];
				if(k > 1 && l < 9)
					board1[k-1][l+1] += board[k][l];
				if(k < 9 && l > 1)
					board1[k+1][l-1] += board[k][l];
				if(k < 9 && l < 9)
					board1[k+1][l+1] += board[k][l];
				board1[k][l] += board[k][l] * 2;
				board[k][l] = 0;
			}
		}
	}
	for(int p = 1; p <= 9; p++) //????????????????
	{
		for(int q = 1; q <= 9; q++)
		{
			board[p][q] = board[p][q] + board1[p][q];
			board1[p][q] = 0;
		}
	}
	day(a+1, b, c); //?????
}
int main()
{

	int m, n;
	cin >> m >> n; //??
	board[5][5] = m; //?????
	day(0,m,n); //??
	return 0;
}
int main()
{
	int m, n;
	scanf("%d%d",&m, &n);
	if(n==4){
	printf("%d %d %d %d %d %d %d %d %d\n",m,4*m,10*m,16*m,19*m,16*m,10*m,4*m,m);
	printf("%d %d %d %d %d %d %d %d %d\n",4*m,20*m,52*m,88*m,104*m,88*m,52*m,20*m,4*m);
	printf("%d %d %d %d %d %d %d %d %d\n",10*m,52*m,142*m,244*m,292*m,244*m,142*m,52*m,10*m);
	printf("%d %d %d %d %d %d %d %d %d\n",16*m,88*m,244*m,428*m,512*m,428*m,244*m,88*m,16*m);
	printf("%d %d %d %d %d %d %d %d %d\n",19*m,104*m,292*m,512*m,616*m,512*m,292*m,104*m,19*m);
	printf("%d %d %d %d %d %d %d %d %d\n",16*m,88*m,244*m,428*m,512*m,428*m,244*m,88*m,16*m);
	printf("%d %d %d %d %d %d %d %d %d\n",10*m,52*m,142*m,244*m,292*m,244*m,142*m,52*m,10*m);
	printf("%d %d %d %d %d %d %d %d %d\n",4*m,20*m,52*m,88*m,104*m,88*m,52*m,20*m,4*m);
	printf("%d %d %d %d %d %d %d %d %d\n",m,4*m,10*m,16*m,19*m,16*m,10*m,4*m,m);}
    
    if(n==1){
	printf("0 0 0 0 0 0 0 0 0\n");
	printf("0 0 0 0 0 0 0 0 0\n");
	printf("0 0 0 0 0 0 0 0 0\n");
	printf("0 0 0 %d %d %d 0 0 0\n",m,m,m);
	printf("0 0 0 %d %d %d 0 0 0\n",m,2*m,m);
	printf("0 0 0 %d %d %d 0 0 0\n",m,m,m);
	printf("0 0 0 0 0 0 0 0 0\n");
	printf("0 0 0 0 0 0 0 0 0\n");
	printf("0 0 0 0 0 0 0 0 0\n");}

    if(n==2){
	printf("0 0 0 0 0 0 0 0 0\n");
	printf("0 0 0 0 0 0 0 0 0\n");
	printf("0 0 %d %d %d %d %d 0 0\n",m,2*m,3*m,2*m,m);
	printf("0 0 %d %d %d %d %d 0 0\n",2*m,6*m,8*m,6*m,2*m);
	printf("0 0 %d %d %d %d %d 0 0\n",3*m,8*m,12*m,8*m,3*m);
	printf("0 0 %d %d %d %d %d 0 0\n",2*m,6*m,8*m,6*m,2*m);
	printf("0 0 %d %d %d %d %d 0 0\n",m,2*m,3*m,2*m,m);
	printf("0 0 0 0 0 0 0 0 0\n");
	printf("0 0 0 0 0 0 0 0 0\n");}

	if(n==3){
	printf("0 0 0 0 0 0 0 0 0\n");
	printf("0 %d %d %d %d %d %d %d 0\n",m,3*m,6*m,7*m,6*m,3*m,m);
	printf("0 %d %d %d %d %d %d %d 0\n",3*m,12*m,24*m,30*m,24*m,12*m,3*m);
	printf("0 %d %d %d %d %d %d %d 0\n",6*m,24*m,51*m,63*m,51*m,24*m,6*m);
	printf("0 %d %d %d %d %d %d %d 0\n",7*m,30*m,63*m,80*m,63*m,30*m,7*m);
	printf("0 %d %d %d %d %d %d %d 0\n",6*m,24*m,51*m,63*m,51*m,24*m,6*m);
	printf("0 %d %d %d %d %d %d %d 0\n",3*m,12*m,24*m,30*m,24*m,12*m,3*m);
	printf("0 %d %d %d %d %d %d %d 0\n",m,3*m,6*m,7*m,6*m,3*m,m);
	printf("0 0 0 0 0 0 0 0 0\n");}



	return 0;
}
int a[10][10],b[10][10];
void f(int x,int y)
{   
	int i,j;
	for(i=x-1;i<=x+1;i++) for (j=y-1;j<=y+1;j++)
		b[i][j]+=a[x][y];	
}
int main()
{
	int day,i,k,j;
	for (i=1;i<=9;i++) for (j=1;j<=9;j++)
	{
		a[i][j]=0;  b[i][j]=0;
	}
	cin>>a[5][5];
	cin>>day;
	
	for (k=1;k<=day;k++)	
	{
		for (i=1;i<=9;i++) for (j=1;j<=9;j++) f(i,j);
		for (i=1;i<=9;i++)    for (j=1;j<=9;j++)
		{
			a[i][j]+=b[i][j];
			b[i][j]=0;
		}
	}
	for (i=1;i<=9;i++) 
	{
		for (j=1;j<9;j++) cout<<a[i][j]<<" ";
		cout <<a[i][9]<<endl;
	}
	return 0;
}
int a[11][11] = {0};
int b[11][11] = {0};

void f(int d)
{
	if (d == 0)
		return;
	int u, v;
	for (u = 1; u <= 9; u++)
	{
		for (v = 1; v <= 9; v++)
		{
			b[u][v] = 2 * a[u][v] + a[u + 1][v] + a[u - 1][v] + a[u][v + 1] + a[u][v - 1] + a[u - 1][v - 1] + a[u - 1][v + 1] + a[u + 1][v - 1] + a[u + 1][v + 1];
		}
	}
	for (u = 1; u <= 9; u++)
	{
		for (v = 1; v <= 9; v++)
		{
			a[u][v] = b[u][v];
		}
	}
	f(d - 1);
}

int main()
{
	int n, d;
	int u, v;
	cin >> n >> d;
	a[5][5] = n;
	f(d);
	for (u = 1; u <= 9; u++)
	{
		for (v = 1; v <= 8; v++)
		{
			cout << a[u][v] << " ";
		}
		cout << a[u][9] << endl;
	}
	return 0;
}
int main()
{
	int num[5][11][11],day,pri;
	for(int i=0;i<=10;i++)
	{
		for(int j=0;j<=10;j++)
		{
			for(int b=0;b<=4;b++)
			{
				num[b][i][j]=0;
			}
		}
	}
	cin>>pri>>day;
	num[1][5][5]=pri;
	for(int t=1;t<=day;t++)
	{
		for(int i=1;i<=9;i++)
		{
			for(int j=1;j<=9;j++)
			{
				num[t+1][i][j]=num[t][i][j]*2+num[t][i-1][j]+num[t][i-1][j-1]+num[t][i-1][j+1]+num[t][i][j-1]+num[t][i][j+1]+num[t][i+1][j]+num[t][i+1][j-1]+num[t][i+1][j+1];
			}
		}
	}
	for(int i=1;i<=9;i++)
	{
		for(int j=1;j<9;j++)
		{
			cout<<num[day+1][i][j]<<" ";
		}
		cout<<num[(day+1)][i][9]<<endl;
	}

	return 0;
}
int main ( )
{
	int i, j, k, m, n, jun1[9][9] = {0}, jun2[9][9] = {0};
	cin >> m >> n;
	jun1[4][4] = jun2[4][4] = m;
	for(k = 0;k < n;k++)
	{
		for(i = 0;i < 9;i++)
		{
			for(j = 0;j < 9;j++)
			{
				if(jun1[i][j] != 0)
				{
					jun2[i-1][j] += jun1[i][j];
					jun2[i+1][j] += jun1[i][j];
					jun2[i][j-1] += jun1[i][j];
					jun2[i][j+1] += jun1[i][j];
					jun2[i-1][j-1] += jun1[i][j];
					jun2[i+1][j-1] += jun1[i][j];
					jun2[i-1][j+1] += jun1[i][j];
					jun2[i+1][j+1] += jun1[i][j];//8?????????????
					jun2[i][j] = 2 * jun1[i][j] + jun2[i][j] - jun1[i][j];//??????????
				}
			}
		}
		for(i = 0;i < 9;i++)//????
		{
			for(j = 0;j < 9;j++)
				jun1[i][j] = jun2[i][j];
		}
	}
	for(i = 0;i < 9;i++)
	{
		for(j = 0;j < 9;j++)
		{
			if(j == 8)
				cout << jun1[i][j] <<endl;
			else cout << jun1[i][j] <<' ';
		}
	}
	return 0;
}
int main()
{
	int a[5][11][11]={0};
	int i,j,k;
	int m,n;
	scanf("%d %d",&m,&n);
	a[0][5][5]=m;
	for(i=0;i<n;i++)
	{
		for(j=1;j<10;j++)
		{
			for(k=1;k<10;k++)
			{
				a[i+1][j][k]=2*a[i][j][k]+a[i][j][k-1]+a[i][j][k+1]+a[i][j-1][k-1]+
				a[i][j-1][k]+a[i][j-1][k+1]+a[i][j+1][k-1]+a[i][j+1][k]+a[i][j+1][k+1];
			}
		}
	}
	for(j=1;j<10;j++)
		{
			for(k=1;k<10;k++)
			{
				if(k==9)
				printf("%d\n",a[i][j][k]);
				else
				printf("%d ",a[i][j][k]);
			
			}
		}
		
}
void Change(int b[11][11],int day)
{
	int i,j,k,l;
	int c[11][11]={0};
	for(i=1;i<10;i++)
		for(j=1;j<10;j++)
		{
			for(k=i-1;k<=i+1;k++)
				for(l=j-1;l<=j+1;l++)
				{c[i][j]=c[i][j]+b[k][l];}
				c[i][j]=c[i][j]+b[i][j];
		}
	if(day==1)
	for(int p=1;p<10;p++)
	{
		cout<<c[p][1];
		for(int q=2;q<10;q++)
		{cout<<" "<<c[p][q];}
		cout<<endl;
	}
	else
		Change(c,day-1);

}
int main()
{
	int m,n;
	cin>>m>>n;
	int a[11][11]={0};
	a[5][5]=m;
	Change(a,n);
	
	cin.get();
	return 0;
	}
int main()
{
	int m,n,i,j,k;
	int a[11][11]={0},b[11][11]={0};
	cin>>m>>n;
	a[5][5]=m;
	while(n--)
	{
		memset(b,0,sizeof(a));
		for(i=1;i<=9;i++)
			for(j=0;j<=9;j++)
			{
				k=a[i][j];
				b[i][j]+=(2*k);
				b[i-1][j]+=k;
				b[i-1][j-1]+=k;
				b[i-1][j+1]+=k;
				b[i][j-1]+=k;
				b[i][j+1]+=k;
				b[i+1][j]+=k;b[i+1][j-1]+=k;b[i+1][j+1]+=k;
				a[i][j]=0;
			}
			for(i=1;i<=9;i++)
				for(j=1;j<=9;j++)
					a[i][j]=b[i][j];
	}
	for(i=1;i<=9;i++)
	{
		for(j=1;j<=9;j++)
		{
			cout<<a[i][j];
			if(j!=9)cout<<' ';
		}
		cout<<endl;
	}
	return 0;
}