semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int a[11][11][5];
main()
{
      int x(int i,int j,int k);
      int i,j,m,n,q;
      int p=0;
      for(i=0;i<11;i++)
      {
         for(j=0;j<11;j++)
         {
            for(p=0;p<5;p++)
            a[i][j][p]=0;
         }
      }
      scanf("%d %d",&m,&n);
      a[5][5][0]=m;
      for(q=0;q<n;q++)
      {
              for(i=1;i<10;i++)
                for(j=1;j<10;j++)
                a[i][j][q+1]=x(i,j,q);
      }
      for(i=1;i<10;i++)
      {
         for(j=1;j<9;j++)
         printf("%d ",a[i][j][n]);
         printf("%d\n",a[i][9][n]);
      }
}
int x(int i,int j,int k)
{
    int b=0,l;
    for(l=-1;l<2;l++)
    b=b+a[i+l][j][k]+a[i+l][j-1][k]+a[i+l][j+1][k];
    return(b+a[i][j][k]);
}
main()
{
      int a[9][9];
      int b[9][9];
      int m,n,i,j,k;
      for(i=0;i<9;i++)
      {
                      for(j=0;j<9;j++)
                      {
                                      a[i][j]=0;
                                      b[i][j]=0;
                                      }
                                      }
      scanf("%d %d",&m,&n);
      a[4][4]=m;
      b[4][4]=m;
      for(k=0;k<n;k++)
      {
                      for(i=0;i<9;i++)
                      {
                                      for(j=0;j<9;j++)
                                      {
                                                      b[i][j]=a[i][j];}} 
      
      for(i=4-k;i<=4+k;i++)
      {
                      for(j=4-k;j<=4+k;j++)
                      {
                      a[i-1][j]=b[i][j]+a[i-1][j];
                      a[i-1][j-1]=b[i][j]+a[i-1][j-1];
                      a[i-1][j+1]=b[i][j]+a[i-1][j+1];
                      a[i+1][j]=b[i][j]+a[i+1][j];  
                      a[i+1][j+1]=b[i][j]+a[i+1][j+1];
                      a[i+1][j-1]=b[i][j]+a[i+1][j-1];
                      a[i][j-1]=b[i][j]+a[i][j-1];
                      a[i][j+1]=b[i][j]+a[i][j+1];
                      a[i][j]=a[i][j]+b[i][j];                
                      }
      }
      }
      for(i=0;i<9;i++)
      {
                      for(j=0;j<9;j++)
                      {
                                      if(j<8)
                                      printf("%d ",a[i][j]);
                                      if(j==8)
                                      printf("%d\n",a[i][j]);
                      }
      }
      
}
int m,n;
int a[9][9]={0},b[9][9]={0};
void xijunfanzhi (int day)
{
    int i ,j;
    if (day == n+1)
    {
        return;
    }
    else
    {
        for (i=0;i<9;i++)
        {
            for (j=0;j<9;j++)
            {
                if (a[i][j]!=0)
                {
                    b[i+1][j]=b[i+1][j]+a[i][j];
                    b[i-1][j]=b[i-1][j]+a[i][j];
                    b[i+1][j+1]=b[i+1][j+1]+a[i][j];
                    b[i+1][j-1]=b[i+1][j-1]+a[i][j];
                    b[i-1][j+1]=b[i-1][j+1]+a[i][j];
                    b[i-1][j-1]=b[i-1][j-1]+a[i][j];
                    b[i][j+1]=b[i][j+1]+a[i][j];
                    b[i][j-1]=b[i][j-1]+a[i][j];
                    b[i][j]=b[i][j]+a[i][j];

                }

            }
        }
        for (i=0;i<9;i++)
        {
            for (j=0;j<9;j++)
            {
                a[i][j]=a[i][j]+b[i][j];
                b[i][j]=0;
            }
        }
        xijunfanzhi(day+1);

    }
}
int main()
{
    int i,j;
    cin >> m >> n;a[4][4]=m;
    xijunfanzhi(1);
    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;
}
void change(int a[], int, int, int);
int main()
{
	int a[9][9], b[9][9];
	int m, n, g = 0;
	cin >> m >> n;
	for(int i = 0; i <= 8; i ++)
		for(int j = 0; j <= 8; j ++)
		{
			b[i][j] = 0;
			a[i][j] = 0;
		}
	a[4][4] = m;
	for(int i = 1; i <= (n + 1) / 2; i ++)
	{
		for(int i = 0; i <= 8; i ++)
			for(int j = 0; j <= 8; j ++)
			{
				b[i][j] = 0;
			}
		for(int j = 0; j <= 8; j ++)
			for(int k = 0; k <= 8; k ++)
			{
				if(a[j][k] > 0)
				{
					b[j - 1][k] = a[j][k] + b[j - 1][k];
					b[j][k - 1] = a[j][k] + b[j][k - 1];
					b[j + 1][k] = a[j][k] + b[j + 1][k];
					b[j][k + 1] = a[j][k] + b[j][k + 1];
					b[j - 1][k - 1] = a[j][k] + b[j - 1][k - 1];
					b[j - 1][k + 1] = a[j][k] + b[j - 1][k + 1];
					b[j + 1][k - 1] = a[j][k] + b[j + 1][k - 1];
					b[j + 1][k + 1] = a[j][k] + b[j + 1][k + 1];
					b[j][k] = 2 * a[j][k] + b[j][k];
				}
				g ++;
			}
		if(g == n)
			break;
		for(int i = 0; i <= 8; i ++)
			for(int j = 0; j <= 8; j ++)
			{
				a[i][j] = 0;
			}
		for(int j = 0; j <= 8; j ++)
			for(int k = 0; k <= 8; k ++)
			{
				if(b[j][k] > 0)
				{
					a[j - 1][k] = b[j][k] + a[j - 1][k];
					a[j][k - 1] = b[j][k] + a[j][k - 1];
					a[j + 1][k] = b[j][k] + a[j + 1][k];
					a[j][k + 1] = b[j][k] + a[j][k + 1];
					a[j - 1][k - 1] = b[j][k] + a[j - 1][k - 1];
					a[j - 1][k + 1] = b[j][k] + a[j - 1][k + 1];
					a[j + 1][k - 1] = b[j][k] + a[j + 1][k - 1];
					a[j + 1][k + 1] = b[j][k] + a[j + 1][k + 1];
					a[j][k] = 2 * b[j][k] + a[j][k];
				}
				g ++;
			}
	}
	if(n % 2 == 0)
	{
		for(int i = 0; i <= 8; i ++)
		{
			cout << a[i][0];
			for(int j = 1; j <= 8; j ++)
				cout << " " << a[i][j];
			cout << endl;
		}
	}
	else
	{
		for(int i = 0; i <= 8; i ++)
		{
			cout << b[i][0];
			for(int j = 1; j <= 8; j ++)
				cout << " " << b[i][j];
			cout << endl;
		}
	}
	return 0;
}
//????????????????????????
int main()
{
    int m,n;
    int a[11][11];//a????????
    int b[11][11];//b????????
    int i,j,k,p,q;
    for(i=0;i<11;i++)//???????
       for(j=0;j<11;j++)
         a[i][j]=0;
    for(i=0;i<11;i++)
       for(j=0;j<11;j++)
         b[i][j]=0;
    cin>>m>>n;
    a[5][5]=m;//???????m
    for(k=1;k<=n;k++)//???n?
    {
        for(i=1;i<=9;i++)//????????
           for(j=1;j<=9;j++)
              {
                  for(p=i-1;p<=i+1;p++)
                     for(q=j-1;q<=j+1;q++)
                         b[i][j]+=a[p][q];
                  b[i][j]+=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++)//??n??????
       {
           for(j=1;j<9;j++)
               cout<<a[i][j]<<' ';
            cout<<a[i][9]<<endl;
       }


    return 0;
}
main()
{
   int m,n,k,i,j,t,g,f;  
   int a[9][9]={0};
   int b[9][9]={0};
   scanf("%d %d",&n,&m);
   a[4][4]=n;
   b[4][4]=n;
   for(k=0;k<m;k++)
   {
     for(i=4-k;i<=4+k;i++)
     {
       for(j=4-k;j<=4+k;j++)
       {
        for(t=i-1;t<=i+1;t++)
        {
          for(g=j-1;g<=j+1;g++)
          {
            a[t][g]+=b[i][j];                                                                             
          }
         }  
       }
     }  
     for(i=0;i<9;i++) 
     {
       for(j=0;j<9;j++) 
       {
         b[i][j]=a[i][j];
       }
     } 
    }
   for(i=0;i<9;i++) 
   {
     for(j=0;j<9;j++) 
     {
        if(j)printf(" ");              
        printf("%d",a[i][j]);
     }
     printf("\n");
   }
  getchar();
  getchar();
  getchar();
}
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
  int a[11][11], b[11][11], m, n, i, j, k;
  scanf("%d%d", &m, &n);
  memset(a, 0, sizeof a);
  a[5][5] = m;
  while (n--) {
    memset(b, 0, sizeof b);
    for (i = 1; i <= 9; ++i)
      for (j = 1; j <= 9; ++j) {
        b[i][j] += a[i][j] * 2;
        for (k = 0; k < 8; ++k)
          b[i + dx[k]][j + dy[k]] += a[i][j];
      }
    memcpy(a, b, sizeof b);
  }
  for (i = 1; i <= 9; ++i) {
    for (j = 1; j < 9; ++j) printf("%d ", a[i][j]);
    printf("%d\n", a[i][9]);
  }
  return 0;
}
int bac0[10][10];
int bac1[10][10];
int m,n;
void init1(){
	for(int i = 1;i<10;i++){
		for(int j = 1;j<10;j++){
			bac0[i][j]=0;
			}
		}
	bac0[5][5]=m;
	return;
	}
void init2(){
	for(int i = 1;i<10;i++){
		for(int j = 1;j<10;j++){
			bac1[i][j]=0;
			}
		}
	return;
	}
void born(int a,int b){
	bac1[a][b]+=(bac0[a][b]*2);
	if(a-1>=1){
		bac1[a-1][b]+=bac0[a][b];
		if(b-1>=1) bac1[a-1][b-1]+=bac0[a][b];
		if(b+1<=9) bac1[a-1][b+1]+=bac0[a][b]; 
		}
	if(a+1<=9){
		bac1[a+1][b]+=bac0[a][b];
		if(b-1>=1) bac1[a+1][b-1]+=bac0[a][b];
		if(b+1<=9) bac1[a+1][b+1]+=bac0[a][b];
		}
	if(b-1>=1) bac1[a][b-1]+=bac0[a][b];
	if(b+1<=9) bac1[a][b+1]+=bac0[a][b];
	return;
	}
void update(){
	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			bac0[i][j]=bac1[i][j];
			}
		}
	return;
	}
void day(){
	init2();
	for(int i=1;i<10;i++){
		for(int j = 1;j<10;j++){
			if(bac0[i][j]!=0){
				born(i,j);
				}
			}
		}
	update();
	return;
	}
void Print(){
	for(int i=1;i<=9;i++){
		cout<<bac0[i][1];
		for(int j=2;j<=9;j++){
			cout<<" "<<bac0[i][j];
			}
		cout<<endl;
		}
	return;
	}
int main(){
	cin>>m>>n;
	init1();
	for(int i=0;i<n;i++){
		day();
		}
	Print();
	return 0;
	}
int m;
int num(int, int, int);
int main(void)
{
    int n, i, j;
    cin >> m >> n;
    for( i = 1 ; i < 10 ; i++ )
    {
        for( j = 1 ; j < 9 ; j++ )
            cout << num(n, i, j) << " ";
        cout << num(n, i, 9) << endl;
    }
    return 0;
}
int num(int a, int x, int y)
{
    if( a == 0 )
    {
        if( x == 5 && y == 5 )
            return m;
        else
            return 0;
    }
    else
        return num(a - 1, x, y) * 2 + num(a - 1, x - 1, y - 1) + num(a - 1, x - 1, y) + num(a - 1, x - 1, y + 1) + num(a - 1, x, y - 1) + num(a - 1, x, y + 1) + num(a - 1, x + 1, y - 1) + num(a - 1, x + 1, y) + num(a - 1, x + 1, y + 1);
}
int main()
{
     int a[11][11][5];int m,n,i,j,k;
     scanf("%d%d",&m,&n);
     for(i=0;i<11;i++)
     {
                      for(j=0;j<11;j++)
                      
                      {
                           for(k=0;k<5;k++)
                           a[i][j][k]=0;
                      }
     }
     
     a[5][5][0]=m;

     for(k=0;k<n;k++)
          {for(i=5-k;i<=5+k;i++)
          {
               for(j=5-k;j<=5+k;j++)
               {
                    a[i][j][k+1]+=2*a[i][j][k];
                    a[i-1][j-1][k+1]+=a[i][j][k];
                    a[i][j-1][k+1]+=a[i][j][k];
                    a[i-1][j][k+1]+=a[i][j][k];
                    a[i-1][j+1][k+1]+=a[i][j][k];
                    a[i+1][j-1][k+1]+=a[i][j][k];
                    a[i][j+1][k+1]+=a[i][j][k];
                    a[i+1][j][k+1]+=a[i][j][k];
                    a[i+1][j+1][k+1]+=a[i][j][k];
               }
          }
          }
     for(i=1;i<10;i++)
     {
          for(j=1;j<10;j++)
          {
               if(j!=9)
               {
               printf("%d ",a[i][j][n]);}
               else{printf("%d\n",a[i][j][n]);}
          }
     }
     
     return 0;
}
main()
{
     int i,j,k,n,m,d;
     int a[11][11]={0},b[11][11]={0};
     scanf("%d %d",&m,&d);
     a[5][5]=m;
     for(k=1;k<=d;k++)
     {
     for(i=1;i<10;i++)
     for(j=1;j<10;j++)
     {
                      b[i][j]=2*a[i][j]+a[i-1][j]+a[i-1][j-1]+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=0;i<11;i++)
                      for(j=0;j<11;j++)
                      a[i][j]=b[i][j];
                     }
                     for(i=1;i<10;i++)
                     {
                      for(j=1;j<10;j++)
                      {
                                      if(j==1)
                                      printf("%d",a[i][j]);
                                      else
                      printf(" %d",a[i][j]);
                      if(j==9)
                      printf("\n");
                      }
                      }
     
}
int a[9][9],b[9][9];

void work(int x,int y,char s)
{
	int i,j,q;
	q=(s=='b')?a[x][y]:b[x][y];
	for (i=x-1;i<=x+1;i++)
		for (j=y-1;j<=y+1;j++)
			if (s=='a')
				a[i][j]+=q;
			else 
				b[i][j]+=q;
}

int main()
{
	int m,n,k,i,j;
	scanf("%d %d",&m,&n);
    a[4][4]=m;
    for (k=1;k<=n;k++)
		if (k%2==1)
		{
			for (i=0;i<9;i++)
				for (j=0;j<9;j++)
					b[i][j]=a[i][j];
			for (i=0;i<9;i++)
				for (j=0;j<9;j++)
					if (a[i][j]>0)
						work(i,j,'b');
		}
		else 
		{
			for (i=0;i<9;i++)
				for (j=0;j<9;j++)
					a[i][j]=b[i][j];
			for (i=0;i<9;i++)
				for (j=0;j<9;j++)
					if (b[i][j]>0)
						work(i,j,'a');
		}
    if (n%2==1)
		for (i=0;i<9;i++)
		{
			for (j=0;j<8;j++)
				printf("%d ",b[i][j]);
			printf("%d\n",b[i][j]);
		}
	else
		for (i=0;i<9;i++)
		{
			for (j=0;j<8;j++)
				printf("%d ",a[i][j]);
			printf("%d\n",a[i][j]);
		}

    return 0;
}
int bac[11][11],tp[11][11],n,m;
void mul(int x)
{
	if (x==n) return;
	else{
		for(int i=0;i<11;i++){
			for(int j=0;j<11;j++){
				tp[i][j]=0;}}
		for(int i=1;i<=9;i++){
			for(int j=1;j<=9;j++){
				tp[i-1][j]+=bac[i][j];
				tp[i+1][j]+=bac[i][j];
				tp[i-1][j-1]+=bac[i][j];
				tp[i+1][j-1]+=bac[i][j];
				tp[i-1][j+1]+=bac[i][j];
				tp[i+1][j+1]+=bac[i][j];
				tp[i][j-1]+=bac[i][j];
				tp[i][j+1]+=bac[i][j];
				tp[i][j]+=2*bac[i][j];}}
		for(int i=1;i<=9;i++){
			for(int j=1;j<=9;j++){
				bac[i][j]=tp[i][j];}}
		mul(x+1);}
}
int main()
{
	for(int i=0;i<11;i++){
		for(int j=0;j<11;j++){
			bac[i][j]=0;}}
	cin>>m>>n;
	bac[5][5]=m;
	mul(0);
	for(int i=1;i<=9;i++){
		cout<<bac[i][1];
		for(int j=2;j<=9;j++){
			cout<<" "<<bac[i][j];}
		cout<<endl;}
	return 0;
}
int main()
{
	int a[11][11]={0},b[11][11]={0},i=1,j=1,t=1,number,time;
	cin>>number>>time;
	a[5][5]=number;
	for(i=1;i<=time;i++)
	{
		for(j=1;j<=9;j++)
		{
			for(t=1;t<=9;t++)
			{
				if(a[j][t]!=0)
				{
					b[j][t]+=2*a[j][t];
					b[j+1][t]+=a[j][t];
					b[j-1][t]+=a[j][t];
					b[j+1][t+1]+=a[j][t];
					b[j-1][t+1]+=a[j][t];
					b[j+1][t-1]+=a[j][t];
					b[j-1][t-1]+=a[j][t];
					b[j][t+1]+=a[j][t];
					b[j][t-1]+=a[j][t];
				}
			}
		}
		for(j=1;j<=9;j++)
		{
			for(t=1;t<=9;t++)
			{
				a[j][t]=b[j][t];
				b[j][t]=0;
			}
		}
	}
	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 m,n,i,j,k;
    scanf("%d %d",&m,&n);
    int a[5][11][11]={{0},{0},{0}};
    a[0][5][5]=m;
    for (i=1;i<=n;i++)
    {
        for (j=1;j<10;j++)
        {
            for(k=1;k<10;k++)
            {
                a[i][j][k]=2*a[i-1][j][k]+a[i-1][j-1][k-1]+a[i-1][j-1][k]+a[i-1][j-1][k+1]+a[i-1][j][k-1]+a[i-1][j][k+1]+a[i-1][j+1][k-1]+a[i-1][j+1][k]+a[i-1][j+1][k+1];
            }
        }
    }
    for (j=1;j<10;j++)
    {
        for (k=1;k<10;k++)
        {
            printf("%d",a[n][j][k]);
            if ((k==9)&&(j!=9))  {printf("\n");}
            else if (k!=9) {printf(" ");}
            
        }
    }
    getchar();
    getchar();
    getchar();
    return 0;
}
int main(int argc, char* argv[])
{
	int m,n,a;
	scanf("%d""%d",&m,&n);
	int num[5][9][9];
	int i,j,k;
	for(i=0;i<5;i++)
	{
		for(j=0;j<9;j++)
		{
			for(k=0;k<9;k++)
			{
				num[i][j][k]=0;
			}
		}
	}
	num[0][4][4]=m;
	for(i=0;i<n;i++)
	{
		for(j=0;j<9;j++)
		{
			for(k=0;k<9;k++)
			{
				if(num[i][j][k]!=0)
				{
					a=num[i][j][k];
					num[i+1][j][k+1]=num[i+1][j][k+1]+a;
                    num[i+1][j][k-1]=num[i+1][j][k-1]+a;
                    num[i+1][j][k]=num[i+1][j][k]+2*a;
					num[i+1][j+1][k-1]=num[i+1][j+1][k-1]+a;
                    num[i+1][j+1][k+1]=num[i+1][j+1][k+1]+a;
                    num[i+1][j+1][k]=num[i+1][j+1][k]+a;
					num[i+1][j-1][k+1]=num[i+1][j-1][k+1]+a;
                    num[i+1][j-1][k-1]=num[i+1][j-1][k-1]+a;
                    num[i+1][j-1][k]=num[i+1][j-1][k]+a;
				}
			}
		}
	}
	for(j=0;j<9;j++)
	{
		for(k=0;k<8;k++)
		{
			printf("%d ",num[n][j][k]);
		}
		printf("%d\n",num[n][j][8]);
	}
	return 0;
}
main()
{
    int p[5][81];//?????????
    int m,n;//m??????????? n???????
    scanf("%d %d",&m,&n);

    int i,j,k;//??????
    for(i=0;i<=n;i++)
    {
        for(j=0;j<81;j++)
        {
                         p[i][j]=0;
        }

        //??????????????
    }
    p[0][40]=m;//??????????????
    int add;//??
    for(k=0;k<n;k++)
    {
        for(i=0;i<81;i++)
        {
            add=p[k][i];

                p[k+1][i]+=2*add;
                p[k+1][i-1]+=add;
                p[k+1][i+1]+=add;
                p[k+1][i-8]+=add;
                p[k+1][i-9]+=add;
                p[k+1][i-10]+=add;
                p[k+1][i+8]+=add;
                p[k+1][i+9]+=add;
                p[k+1][i+10]+=add;


        }
    }
    for(i=0;i<9;i++)
    {
        for(j=0;j<9;j++)
        {
            printf("%d",p[n][i*9+j]);
            if(j<8) printf(" ");
            else printf("\n");
        }
    }
}
int map[10][10],add[10][10],m,n;
//???? 
void Generate(int x,int y){
	int v = map[x][y];
	for(int i = -1;i<=1;i++){
		for(int j = -1;j<=1;j++){
			if(i==0&&j==0) add[x+i][y+j]+=v*2;
			else add[x+i][y+j]+=v;
			}
		}
	return;
	}
int main(){
	cin>>m>>n;
	memset(map,0,sizeof(map));
	map[5][5] = m;
	for(int k = 0;k<n;k++){
		memset(add,0,sizeof(add));
		for(int i = 1;i<10;i++){
			for(int j = 1;j<10;j++){
				if(map[i][j]!=0) Generate(i,j);
				}
			}
		for(int i = 1;i<10;i++){
			for(int j = 1;j<10;j++){
				map[i][j]=add[i][j];
				}
		}
		}
	for(int i = 1;i<10;i++){
		for(int j = 1;j<10;j++){
			if(j!=1) cout<<" "<<map[i][j];
			else cout<<map[i][j];
			}
		cout<<endl;
		}
	return 0;
	}
int a[11][11] = {0};
int n;
int tian;
void ff(int a[][11], int k)
{
     int aa[11][11];
     for(int i = 1; i <= 9; ++i)
        for(int j = 1; j <= 9; ++j)
        aa[i][j] = 0;
     for(int i = 1; i <= 9; ++i)
        for(int j = 1; j <= 9; ++j)
        {
                if(a[i][j] != 0)
                {
                    aa[i][j]+=2*a[i][j];
                    aa[i+1][j]+=a[i][j];
                    aa[i-1][j]+=a[i][j];
                    aa[i][j+1]+=a[i][j];
                    aa[i][j-1]+=a[i][j];
                    aa[i+1][j+1]+=a[i][j];
                    aa[i+1][j-1]+=a[i][j];
                    aa[i-1][j+1]+=a[i][j];
                    aa[i-1][j-1]+=a[i][j];
                }
        }
     for(int i = 1; i <= 9; ++i)
        for(int j = 1; j <= 9; ++j)
        a[i][j] = aa[i][j];
     if(k == tian)
     {
          for(int i = 1; i <= 9; ++i)
          {
              cout << a[i][1];
              for(int j = 2; j <= 9; ++j)
              {
                      cout << " " << a[i][j];
              }
              cout << endl;
          }             
     }
     else ff(a,k+1);
}
int main()
{
    cin >> n >> tian;
    a[5][5] = n;
    ff(a,1);
    //while(1);
    return 0;
}
//????????


int x[9][9] = {0}, y[9][9] = {0};

void scan()
{
	int i, j;
	for(i = 0; i < 9; i++)
		for(j = 0; j < 9; j++)
		{
			if(x[i][j] != 0)
			{
				y[i][j] += x[i][j] * 2;
				y[i-1][j] += x[i][j];
				y[i+1][j] += x[i][j];
				y[i-1][j-1] += x[i][j];
				y[i-1][j+1] += x[i][j];
				y[i+1][j-1] += x[i][j];
				y[i+1][j+1] += x[i][j];
				y[i][j-1] += x[i][j];
				y[i][j+1] += x[i][j];
			}
		}

}

int main()
{
	int m, n, i, j;
	cin >> m >> n;
	x[4][4] = m;
	while(n--)
	{
		scan();
		for(i = 0; i < 9; i++)
			for(j = 0; j < 9; j++)
			{
				x[i][j] = y[i][j];
				y[i][j] = 0;
			}
	}
	for(i = 0; i < 9; i++)
		for(j = 0; j < 9; j++)
		{
			cout << x[i][j];
			if(j == 8)
				cout << endl;
			else
				cout << " ";
		}
	return 0;
}
int pymbg[11][11]={0},pymed[11][11]={0};
void peiyang(int n)
{
	int i,j;
	if(n!=0)
	{
		for (i=1;i<10;i++)for(j=1;j<10;j++)
		{
			pymed[i][j]=pymed[i][j]+pymbg[i][j];
			pymed[i][j-1]=pymed[i][j-1]+pymbg[i][j];
			pymed[i][j+1]=pymed[i][j+1]+pymbg[i][j];
			pymed[i+1][j]=pymed[i+1][j]+pymbg[i][j];
			pymed[i+1][j-1]=pymed[i+1][j-1]+pymbg[i][j];
			pymed[i+1][j+1]=pymed[i+1][j+1]+pymbg[i][j];
			pymed[i-1][j]=pymed[i-1][j]+pymbg[i][j];
			pymed[i-1][j-1]=pymed[i-1][j-1]+pymbg[i][j];
			pymed[i-1][j+1]=pymed[i-1][j+1]+pymbg[i][j];
		}
		for (i=1;i<10;i++)for(j=1;j<10;j++) pymbg[i][j]=pymed[i][j];
		n--;
		peiyang(n);
	}
}
int main( )
{
	int m,n,i,j;
	cin>>m>>n;
	pymbg[5][5]=m;
	pymed[5][5]=m;
	peiyang(n);
	for (i=1;i<10;i++) 
	{
		for (j=1;j<9;j++) cout<<pymbg[i][j]<<' ';
		cout<<pymbg[i][9];
		cout<<'\n';
	}
	return 0;
}
int main()
{
    int m,n,a[82],b[82],i,j;
    scanf("%d %d",&m,&n);
    for(i=0;i<81;i++)
    {
        a[i]=0;
    }
    a[40]=m;
    for(i=0;i<n;i++)
    {
        for(j=0;j<81;j++)
        {  
           if(j==0)
           b[j]=2*a[j]+a[j+1]+a[j+9]+a[j+10];
           if(j==8)
           b[j]=2*a[j]+a[j-1]+a[j+8]+a[j+9];
           if(j==72)
           b[j]=2*a[j]+a[j-9]+a[j-8]+a[j+1];
           if(j==80)
           b[j]=2*a[j]+a[j-10]+a[j-9]+a[j-1];
           if((j<8)&&(j>0))
           b[j]=2*a[j]+a[j-1]+a[j+1]+a[j+8]+a[j+9]+a[j+10];
           if((j<80)&&(j>72))
           b[j]=2*a[j]+a[j-10]+a[j-9]+a[j-8]+a[j-1]+a[j+1];
           if((j%9==0)&&(j!=0)&&(j!=72))
           b[j]=2*a[j]+a[j-9]+a[j-8]+a[j+1]+a[j+9]+a[j+10];
           if((j%9==8)&&(j!=8)&&(j!=80))
            b[j]=2*a[j]+a[j-10]+a[j-9]+a[j-1]+a[j+8]+a[j+9];
            if((j>9)&&(j<71)&&(j%9!=0)&&(j%9!=8))
           b[j]=2*a[j]+a[j-10]+a[j-9]+a[j-8]+a[j-1]+a[j+1]+a[j+8]+a[j+9]+a[j+10];
        }
        for(j=0;j<81;j++)
        {
           a[j]=b[j];
        }
    }
    for(i=0;i<9;i++)
    {
       for(j=0;j<8;j++)
       {
           printf("%d ",a[9*i+j]);
       }
       printf("%d\n",a[9*i+8]);
    }
    //getchar();
    //getchar();
    return 0;
}
int main(){
	int m,n,i,j,k,a[11][11],b[11][11];
	for(m=0;m<11;m++){
		for(n=0;n<11;n++){
			a[m][n]=0;
			b[m][n]=0;
		}
	}
	scanf("%d%d",&m,&n);
	a[5][5]=m;
	b[5][5]=m;
	for(i=0;i<n;i++){
		for(k=1;k<10;k++){
			for(j=1;j<10;j++){
				b[k][j]=2*a[k][j]+a[k-1][j-1]+a[k-1][j]+a[k-1][j+1]+a[k][j-1]+a[k][j+1]+a[k+1][j-1]+a[k+1][j]+a[k+1][j+1];
			}
		}
		for(k=0;k<11;k++){
			for(j=0;j<11;j++){
				a[k][j]=b[k][j];
			}
		}
	}
	for(k=1;k<10;k++){
		printf("%d",a[k][1]);
		for(j=2;j<10;j++){
			printf(" %d",a[k][j]);
		}
		if(k<9){
			printf("\n");
		}
	}
	scanf("%d",&n);
	return 0;
}
int main()
{int i,j,k;
int s[9][9][5];
int m,n;
cin>>m>>n; 
for(i=0;i<9;i++)
for(j=0;j<9;j++)
for(k=0;k<5;k++)    
{s[i][j][k]=0;}    
s[4][4][0]=m;
for(k=1;k<n+1;k++)
for(i=0;i<9;i++)
for(j=0;j<9;j++)
{if(i==0&&j==0)
s[i][j][k]=s[i+1][j][k-1]+s[i][j+1][k-1]+2*s[i][j][k-1]+s[i+1][j+1][k-1];
if(i==0&&j==8)
s[i][j][k]=s[i+1][j][k-1]+s[i][j-1][k-1]+2*s[i][j][k-1]+s[i+1][j-1][k-1];
if(i==8&&j==0)
s[i][j][k]=s[i-1][j][k-1]+s[i][j+1][k-1]+2*s[i][j][k-1]+s[i-1][j+1][k-1];
if(i==8&&j==8)
s[i][j][k]=s[i-1][j][k-1]+s[i][j-1][k-1]+2*s[i][j][k-1]+s[i-1][j-1][k-1];
if(i==0&&j!=0&&j!=8)
s[i][j][k]=s[i+1][j][k-1]+s[i][j+1][k-1]+s[i][j-1][k-1]+2*s[i][j][k-1]+s[i+1][j-1][k-1]+s[i+1][j+1][k-1];
if(i==8&&j!=0&&j!=8)
s[i][j][k]=s[i-1][j][k-1]+s[i][j+1][k-1]+s[i][j-1][k-1]+2*s[i][j][k-1]+s[i-1][j-1][k-1]+s[i-1][j+1][k-1];
if(j==8&&i!=0&&i!=8)
s[i][j][k]=s[i-1][j][k-1]+s[i+1][j][k-1]+s[i][j-1][k-1]+2*s[i][j][k-1]+s[i+1][j-1][k-1]+s[i-1][j-1][k-1];
if(j==0&&i!=0&&i!=8)
s[i][j][k]=s[i-1][j][k-1]+s[i+1][j][k-1]+s[i][j+1][k-1]+2*s[i][j][k-1]+s[i+1][j+1][k-1]+s[i-1][j+1][k-1];
if(i!=0&&j!=0&&i!=8&&j!=8)
s[i][j][k]=s[i-1][j][k-1]+s[i+1][j][k-1]+s[i][j-1][k-1]+s[i][j+1][k-1]+2*s[i][j][k-1]+s[i+1][j-1][k-1]+s[i+1][j+1][k-1]+s[i-1][j-1][k-1]+s[i-1][j+1][k-1];
}

for(i=0;i<9;i++)
{for(j=0;j<8;j++)
{cout<<s[i][j][n]<<" ";}
cout<<s[i][8][n]<<endl;}
return 0;                
    }
void reproduce(int n, int (*a)[9])
{
	if(n == 0)
		return;
	int temp[9][9] = {0};
	for(int i = 0; i < 9; i++)
		for(int j = 0; j < 9; j++)
			if(a[i][j])
			{
				temp[i][j] += 2 * a[i][j];
				if(i > 0)
				{
					temp[i - 1][j] += a[i][j];
					if(j > 0)
					{
						temp[i - 1][j - 1] += a[i][j];
						temp[i][j - 1] += a[i][j];
						if(i < 8)
						{
							temp[i + 1][j - 1] += a[i][j];
							temp[i + 1][j] += a[i][j];
						}
					}
					if(j < 8)
					{
						temp[i - 1][j + 1] += a[i][j];
						temp[i][j + 1] += a[i][j];
						if(i < 8)
							temp[i + 1][j + 1] += a[i][j];
					}
				}
			}
	for(int i = 0; i < 9; i++)
		for(int j = 0; j < 9; j++)
			a[i][j] = temp[i][j];
	return reproduce(n - 1, a);
}

int main()
{
	int m, n;
	int a[9][9] = {0};
	cin >> m >> n;
	a[4][4] = m;
	reproduce(n, a);
	for(int i = 0; i < 9; i++)
		for(int j = 0; j < 9; j++)
		{
			cout << a[i][j];
			if(j == 8)
				cout << endl;
			else
				cout << " ";
		}
	return 0;
}