semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct bacteria
{
       int have;
       int add;
}a[11][11];
int main()
{
    int m,n,i,j,l,k;
    memset(a,0,sizeof(struct bacteria)*121);
    scanf("%d%d",&a[5][5].have,&n);
    for(m=1;m<=n;m++)
    {
                     for(i=5-n;i<=5+n;i++)
                     {
                                      for(j=5-n;j<=5+n;j++)
                                      {
                                                       for(k=-1;k<=1;k++)
                                                       {
                                                                         for(l=-1;l<=1;l++)
                                                                         {
                                                                                           a[i][j].add+=a[i+l][j+k].have;
                                                                         }
                                                       }
                                      }
					 }
					 for(i=5-n;i<=5+n;i++)
                     {
                                      for(j=5-n;j<=5+n;j++)
                                      {
                                                           a[i][j].have+=a[i][j].add;
                                                           a[i][j].add=0;
                                      }
                     }
    }
    for(i=1;i<10;i++)
    {
                     printf("%d",a[i][1].have);
                     for(j=2;j<10;j++)
                     {
                                      printf(" %d",a[i][j].have);
                     }
                     printf("\n");
    }
    return 0;
}
int  a[10][10]={0},b[10][10]={0},n;
void t(int);
int main()
{
	int m ,i,j;
	cin >> m >> n;
	a[4][4]=m;
	t(1);
	for(i=0;i<9;i++)
		for(j=0;j<9;j++)
		{
			cout <<a[i][j];
			if(j==8)
				cout <<endl;
			else cout << " ";
		}
		return 0;
}
void t(int m)
{
	int i, j,l;
	if(m==n+1)
		return;
	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)
			{
				l=b[i][j];
				a[i][j]+=2*l;
				a[i-1][j]+=l;
				a[i+1][j]+=l;
				a[i][j-1]+=l;
				a[i][j+1]+=l;
				
				a[i+1][j+1]+=l;
				a[i+1][j-1]+=l;
				a[i-1][j-1]+=l;
				a[i-1][j+1]+=l;
			}
		}
	for(i=0;i<9;i++)
		for(j=0;j<9;j++)
		a[i][j]-=b[i][j];
		t(m+1);
}
int main()
{
	int a[9][9]={0},b[9][9]={0};
	char s[9][9]={0};
	int m,n;
	int i,j,t,p,q;
	cin>> m >> n;
	a[4][4]=m;
	for(t=1;t<=n;t++)
	{
		for(i=1;i<8;i++)
		{
			for(j=1;j<8;j++)
			{
				if(a[i][j]!=0)
				{
					b[i][j]=b[i][j]+a[i][j]*2;
					b[i-1][j]=b[i-1][j]+a[i][j];
					b[i+1][j]=b[i+1][j]+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-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];
				}
			}
		}
		for(i=0;i<9;i++)
		{
			for(j=0;j<9;j++)
			{
				a[i][j]=b[i][j];b[i][j]=0;
			}
		}
	}
	for(i=0;i<9;i++)
	{
		for(j=0;j<8;j++)
		{
			cout<<a[i][j]<<' ';
		}
		cout<<a[i][8]<<endl;
	}
    return 0;
}
int num[10][10] , newnum[10][10] ;
void change(int , int);
int main()
{
	int m , n , i , j , k;
	cin >> m >> n ;
	memset(num,0,sizeof(num));
	num[5][5] = m ;
	for ( i = 1 ; i <= n ; i++ )
	{
		memset(newnum,0,sizeof(newnum));
		for ( j = 1 ; j <= 9 ; j++ )
			for (k = 1 ; k <= 9 ; k++ )
				change(j,k);
		for ( j = 1 ; j <= 9 ; j++ )
			for (k = 1 ; k <= 9 ; k++ )
				num[j][k] += newnum[j][k] ;
	}
	for ( i = 1 ; i <= 9 ; i++ )
	{
		for ( j = 1 ; j <= 9 ; j++ )
		{
			if ( j == 1 ) cout << num[i][j] ;
			else cout << " " << num[i][j] ;
		}
		cout << endl ;
	}
	return 0 ;
}
void change(int a , int b)
{
	int i , j ;
	for ( i = a-1 ; i <= a+1 ; i++ )
		for ( j = b-1 ; j <= b+1 ; j++ )
			newnum[a][b] += num[i][j] ;
}
int main(int argc, char* argv[])
{
	int a[9][9],b[10][10],i,j,k,m,n;
	scanf("%d%d",&m,&n);
	for (i=0;i<9;i++)
	{
		for (j=0;j<9;j++)
		{
			a[i][j]=0;
		}
	}
	a[4][4]=m;
	for (i=0;i<10;i++)
	{
		for (j=0;j<10;j++)
		{
			b[i][j]=0;
		}
	}
	for (k=0;k<n;k++)
	{
		for (i=0;i<9;i++)
		{
			for (j=0;j<9;j++)
			{
				b[i][j]+=a[i][j];
				b[i][j+1]+=a[i][j];
				b[i][j+2]+=a[i][j];
				b[i+1][j]+=a[i][j];
				b[i+1][j+2]+=a[i][j];
				b[i+2][j]+=a[i][j];
				b[i+2][j+1]+=a[i][j];
				b[i+2][j+2]+=a[i][j];
                                    b[i+1][j+1]+=a[i][j]*2;
			}
		}
		for (i=0;i<9;i++)
		{
			for (j=0;j<9;j++)
			{
				a[i][j]=b[i+1][j+1];
				b[i+1][j+1]=0;
			}
		}
	}
	for (i=0;i<9;i++)
	{
		for (j=0;j<9;j++)
		{
			if (j==8)
			{
				printf("%d\n",a[i][j]);
			}
			else 
			{
				printf("%d ",a[i][j]);
			}
		}
	}
	return 0;


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

		}
	}
	k=0;
	for(i=1;i<10;i++)
	{
		for(j=1;j<10;j++)
		{
			cout<<a[i][j];
			k++;
			if(k%9!=0)
				cout<<" ";
			else
				cout<<endl;
		}
	}

	return 0;
}
main()
{
    int a[11][11],b[11][11];
    for(int i=0;i<11;i++)
    {
        for(int j=0;j<11;j++)
        {
            a[i][j]=0;
            b[i][j]=0;
        }
    }
    int m,n;
    scanf("%d %d",&m,&n);
    a[5][5]=b[5][5]=m;
    for(int k=0;k<n;k++)
    {
        for(int i=1;i<10;i++)
        {
            for(int j=1;j<10;j++)
            {
                a[i][j]=2*b[i][j]+b[i][j-1]+b[i][j+1]+b[i-1][j-1]+b[i-1][j]+b[i-1][j+1]+b[i+1][j-1]+b[i+1][j]+b[i+1][j+1];
            }
        }
        for(int i=1;i<10;i++)
        {
            for(int j=1;j<10;j++)
            {
                b[i][j]=a[i][j];
            }

        }
    }
    for(int i=1;i<10;i++)
    {
        for(int j=1;j<10;j++)
        {
            if(j%9==0)
            printf("%d\n",a[i][j]);
            else
            printf("%d ",a[i][j]);
        }
    }
}
void fanzhi(int x,int y,int n);//??????????????
int a[9][9];
int add[9][9];

int main()
{
	
	int i,j=0;
	//???
	for (i=0;i<9;i++)
		for (j=0;j<9;j++)
			a[i][j]=0;
	
	for (i=0;i<9;i++)
		for (j=0;j<9;j++)
			add[i][j]=0;

	int m=0,n=0;
	cin>>m>>n;
	a[4][4]=m;
	int k=0;

	for (k=1;k<=n;k++)
	{
	for (i=0;i<9;i++)
		for (j=0;j<9;j++)
			add[i][j]=0;

		for (i=0;i<9;i++)
			for (j=0;j<9;j++)
				fanzhi(i,j,a[i][j]);//??????????

		for (i=0;i<9;i++)
			for (j=0;j<9;j++)
				a[i][j]=add[i][j];
	}


	for (i=0;i<9;i++)
		for (j=0;j<9;j++)
		{
			cout<<a[i][j];
			if (j!=8)
				cout<<" ";
			else if (i!=8)
				cout<<endl;
		}




	return 0;
}

void fanzhi(int x,int y,int n)
{
	add[x-1][y]+=n;
	add[x+1][y]+=n;
	add[x][y-1]+=n;
	add[x][y+1]+=n;
	add[x][y]+=n*2;
	add[x-1][y-1]+=n;
	add[x-1][y+1]+=n;
	add[x+1][y-1]+=n;
	add[x+1][y+1]+=n;

}
int ch[9][9], ch2[9][9];

int main()
{
    int m, day;
    void d(int);
    
    memset(ch, 0, sizeof ch);
    cin >> m >> day;
    ch[4][4] = m;
    
    d(day);
    
    return 0;
}

void d(int day)
{
    int i, j;
    memset(ch2, 0, sizeof ch2);
    
    if(day == 0)
    {
        for(i = 0; i < 9; i++)
        {
            for(j = 0; j < 8; j++)
            {
                cout << ch[i][j] << " ";
            }
            
            cout << ch[i][j] << endl;
        }
    }
    else
    {
        for(i = 0; i < 9; i++)
        {
            for(j = 0; j < 9; j++)
            {
                if(ch[i][j] != 0)
                {
                    ch2[i][j] = ch[i][j];
                    ch[i][j] *= 2;
                }
            }
        }
        
        for(i = 0; i < 9; i++)
        {
            for(j = 0; j < 9; j++)
            {
                if(ch2[i][j])
                {
                    if(i > 0) ch[i - 1][j] += ch2[i][j];
                    if(i < 8) ch[i + 1][j] += ch2[i][j];
                    if(j > 0) ch[i][j - 1] += ch2[i][j];
                    if(j < 8) ch[i][j + 1] += ch2[i][j];
                    if(i > 0 && j > 0) ch[i - 1][j - 1] += ch2[i][j];
                    if(i > 0 && j < 8) ch[i - 1][j + 1] += ch2[i][j];
                    if(i < 8 && j > 0) ch[i + 1][j - 1] += ch2[i][j];
                    if(i < 8 && j < 8) ch[i + 1][j + 1] += ch2[i][j];
                }
            }
        }
        d(day - 1);
    }
}
int main()
{
    int m,n,i,j;
    scanf("%d %d",&m,&n);
    int a[11][11]={0};
    int b[11][11]={0};
    a[5][5]=m;
    b[5][5]=m;
    while(n>0)
    {
        for(i=1;i<=9;i++)
        {
            for(j=1;j<=9;j++){
                if(a[i][j]!=0)
                {
                     b[i][j]=b[i][j]+a[i][j];
                     b[i-1][j]+=a[i][j];
                     b[i-1][j-1]+=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]+=a[i][j];
                     b[i+1][j-1]+=a[i][j];
                     b[i+1][j+1]+=a[i][j];
                 }
             }
         }
        for(i=1;i<=9;i++)
        {
            for(j=1;j<=9;j++)
            {
                 a[i][j]=b[i][j];
             }
         }
     n--;
     }
     for(i=1;i<=9;i++)
     {
         for(j=1;j<=9;j++)
         {
             if(j!=9)
             { printf("%d ",a[i][j]);}
             else
             {printf("%d\n",a[i][j]); }
          }
       }
return 0;
}
int f(int x, int y, int n)                       //??????????
{
	if(n==0)
	{
		if(x==5&&y==5)                          //?????
			return 1;
		else
			return 0;
	}
	else                                            //??????????
		return f(x-1, y-1, n-1)+f(x-1, y, n-1)+f(x-1, y+1, n-1)+f(x, y-1, n-1)+ 
		f(x, y+1, n-1)+f(x+1, y-1, n-1)+f(x+1, y, n-1)+f(x+1, y+1, n-1)+2*f(x, y, n-1);
};
int main()
{
	int i, j, m, n;
	cin >> m >> n;
	for(i=1; i<10; i++)                          //??????
		for(j=1; j<10; j++)
		{
			if(j==9)
				cout << m*f(i, j, n) << endl;
			else
				cout << m*f(i, j, n) << " ";
		}
	return 0;
}
int num[9][9]={0};
int t[9][9]={0};
int main()
{
	int n,m;
	cin>>m>>n;
	num[4][4]+=m;
	t[4][4]+=m;
	do
	{
		for(int i=1;i<8;i++)
		{
			for(int j=1;j<8;j++)
			{
				int temp=t[i][j];
				for(int k=i-1;k<i+2;k++)
				{
					for(int p=j-1;p<j+2;p++)
					{
						num[k][p]+=temp;
					}
				}
			}
		}
				for(int i=1;i<8;i++)
				{
					for(int j=1;j<8;j++)
					{
						t[i][j]=num[i][j];
					}
				}
				n--;
			}while(n>0);




			for(int i=0;i<9;i++)
			{
				for(int j=0;j<9;j++)
				{
					cout<<num[i][j];
					if(j<8) cout<<" ";
					else cout<<endl;
				}
			}
			return 0;
		}
int main()
{
	int m, n, i, j, days, left[9][9], seperate[9][9];
	cin >> m >> n;
	int a[9][9] = {0};
	a[4][4] = m;
	for (days = 0; days < n; days++)
	{
		for (i = 0; i < 9; i++)
			for (j = 0; j < 9; j++)
			{
				left[i][j] = a[i][j] * 2;
				a[i][j] *= 10;
				seperate[i][j] = (a[i][j] - left[i][j]) / 8;
				a[i][j] = left[i][j];
			}
		for (i = 0; i < 9; i++)
			for (j = 0; j < 9; j++)
			{
				a[i + 1][j] += seperate[i][j]; 
				a[i - 1][j] += seperate[i][j]; 
				a[i + 1][j + 1] += seperate[i][j]; 
				a[i - 1][j - 1] += seperate[i][j];
				a[i + 1][j - 1] += seperate[i][j];
				a[i - 1][j + 1] += seperate[i][j];
				a[i][j + 1] += seperate[i][j];
				a[i][j - 1] += seperate[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 main()
{
	int i, j, a[9][9], m, n, p, q, u, t[9][9];
	for(i=0; i<9; i++)
	{
		for(j=0; j<9; j++)
			a[i][j]=0;
	}
	scanf("%d %d", &m, &n);
	a[4][4]=m;
	for(u=0; u<n; u++)
	{
		for(i=4-u; i<=4+u; i++)
		{
			for(j=4-u; j<=4+u; j++)
			{
				t[i][j]=a[i][j];
			}
		}
		for(i=4-u; i<=4+u; i++)
		{
			for(j=4-u; j<=4+u; j++)
			{
				for(p=i-1; p<=i+1; p++)
					{
						for(q=j-1;q<=j+1; q++)
							a[p][q]=a[p][q]+t[i][j];
					}
			}
		}
				
			
		

	}
	for(i=0; i<9; i++)
	{
		for(j=0; j<8; j++)
			printf("%d ", a[i][j]);
		if(j=8)
			printf("%d\n", a[i][j]);
	}

	return 0;
}
main()
{
int i,j,m,n,k;
int a[9][9];
int b[9][9];
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=1;i<8;i++)
        for(j=1;j<8;j++)
        a[i][j]=b[i-1][j-1]+b[i-1][j]+b[i-1][j+1]+b[i][j-1]+b[i][j+1]+b[i+1][j-1]+b[i+1][j]+b[i+1][j+1]+2*b[i][j];
        for(i=1;i<8;i++)
        {
          a[i][0]=b[i-1][0]+b[i+1][0]+b[i-1][1]+b[i][1]+b[i+1][1]+2*b[i][0];
          a[i][8]=a[i][0];
        }
        for(j=1;j<8;j++)
        {
          a[0][j]=a[j][0];
          a[8][j]=a[0][j];              
        }
        a[0][0]=b[0][1]+b[1][0]+b[1][1];
        a[0][8]=a[0][0];
        a[8][0]=a[0][0];
        a[8][8]=a[0][0];
        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<8;j++) 
          printf("%d ",a[i][j]);
          printf("%d\n",a[i][8]);
     } 
getchar();getchar();getchar();getchar(); 
}
main(){
int a[9][9],c[9][9];
int i,j,k,m,n;
for(i=0;i<9;i++){
for(j=0;j<9;j++){
a[i][j]=0;
c[i][j]=0;
}
}

scanf("%d %d",&n,&m);
a[4][4]=n;




for(k=0;k<m;k++){
for(i=0;i<9;i++){
for(j=0;j<9;j++){
if(a[i][j]!=0){
c[i][j]=c[i][j]+2*a[i][j];
c[i-1][j]=c[i-1][j]+a[i][j];
c[i+1][j]=c[i+1][j]+a[i][j];
c[i+1][j+1]=c[i+1][j+1]+a[i][j];
c[i+1][j-1]=c[i+1][j-1]+a[i][j];
c[i-1][j+1]=c[i-1][j+1]+a[i][j];
c[i-1][j-1]=c[i-1][j-1]+a[i][j];
c[i][j+1]=c[i][j+1]+a[i][j];
c[i][j-1]=c[i][j-1]+a[i][j];
}
}
}
for(i=0;i<9;i++){
for(j=0;j<9;j++){
a[i][j]=c[i][j];
c[i][j]=0;
}
}



}


for(i=0;i<9;i++){
for(j=0;j<9;j++){
if(j==8)
printf("%d\n",a[i][j]);
else
printf("%d ",a[i][j]);
}
}

}
int main()
{
	int a[10][10],b[10][10];
	int m,n;
	int i,j,d;
	for(i=0;i<10;i++)
	{
		for(j=0;j<10;j++)
		{
			a[i][j]=0;
			b[i][j]=0;
		}
	}
	scanf("%d %d",&m,&n);
	a[5][5]=m;
	for(d=0;d<n;d++)
	{
		for(i=1;i<10;i++)
		{
			for(j=1;j<10;j++)
			b[i][j]=a[i][j];
		}
		for(i=5-d;i<=5+d;i++)
		{
			for(j=5-d;j<=5+d;j++)
			{
				a[i][j]=b[i][j]*2+a[i][j]-b[i][j];
				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][j-1]=b[i][j]+a[i][j-1];
				a[i][j+1]=b[i][j]+a[i][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];
			}
		}
	}
	for(i=1;i<10;i++)
	{
		for(j=1;j<9;j++)
		printf("%d ",a[i][j]);
		printf("%d\n",a[i][9]);
	}
	return 0;
}
main()
{
      int a[5][11][11];
      int i,j,k,day;
      for(i=0;i<=4;i++)
      {
          for (j=0;j<=10;j++)
          {
              for (k=0;k<=10;k++)
              {
                  a[i][j][k]=0;
              }
          }
      }
      scanf("%d %d",&a[0][5][5],&day);
      for (i=1;i<=day;i++)
      {
          for (j=1;j<=9;j++)
          {
              for (k=1;k<=9;k++)
              {
                  a[i][j][k]=a[i-1][j][k]*2+a[i-1][j-1][k-1]+a[i-1][j-1][k]+a[i-1][j-1][k+1]+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];
              }
          }
      }
      for (j=1;j<=9;j++)
      {
          for (k=1;k<=9;k++)
          {
              if (k==1) printf("%d",a[day][j][k]);
              else printf(" %d",a[day][j][k]);
          }
          printf("\n");
      }
      getchar();
      getchar();
}
int main()
{
	int m,n;
	int i=0,j=0,k=0;
	int a[9][9];
	int tmp[9][9];
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			a[i][j]=0;
			tmp[i][j]=0;
		}
	}
	cin>>m>>n;
	a[4][4]=m;
	for(k=0;k<n;k++)
	{
		for(i=0;i<9;i++)
		{
			for(j=0;j<9;j++)
			{
				if(a[i][j]!=0)
				{
					tmp[i][j]=tmp[i][j]+a[i][j]*2;
					tmp[i+1][j]=tmp[i+1][j]+a[i][j];
					tmp[i-1][j]=tmp[i-1][j]+a[i][j];
					tmp[i][j+1]=tmp[i][j+1]+a[i][j];
					tmp[i][j-1]=tmp[i][j-1]+a[i][j];
					tmp[i+1][j+1]=tmp[i+1][j+1]+a[i][j];
					tmp[i-1][j-1]=tmp[i-1][j-1]+a[i][j];
					tmp[i+1][j-1]=tmp[i+1][j-1]+a[i][j];
					tmp[i-1][j+1]=tmp[i-1][j+1]+a[i][j];
				}
			}
		}
		for(i=0;i<9;i++)
		{
			for(j=0;j<9;j++)
			{
				a[i][j]=tmp[i][j];
				tmp[i][j]=0;
			}
		}
	}
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			if(j==8)cout<<a[i][j]<<endl;
			else cout<<a[i][j]<<" ";
		}
	}
	return 0;
}
int i, j, a[10][10] = {0}, b[10][10] = {0}, c, k, l;
void f(int n)
{
	if (n == 0)
	{
		for (j = 1; j <= 9; j++)
		{
			cout << a[j][1];
			for (l = 2; l <= 9; l++)
			{
				cout << " " << a[j][l];
			}
			cout << endl ;
		}
		return;
	}
	for (i = 0; i <= 80 ;i++)
	{
		if (b[i/9+1][i%9+1] != 0)
		{
			c = b[i/9+1][i%9+1];
			a[i/9+2][i%9+2] += c;
			a[i/9+2][i%9+1] += c;
			a[i/9+1][i%9+2] += c;
			a[i/9][i%9] += c;
			a[i/9+2][i%9] += c;
			a[i/9][i%9+2] += c;
			a[i/9+1][i%9] += c;
			a[i/9][i%9+1] += c;
			a[i/9+1][i%9+1] += b[i/9+1][i%9+1];
		}
	}
	for (k = 0; k <= 99; k++)
	{
		b[k/10][k%10] = a[k/10][k%10];
	}
		f(n-1);
}
int main()
{
	int d;
	cin >> a[5][5] >>d;
	b[5][5] = a[5][5];
	f(d);
	return 0;
}
int main()
{
	int i,j,t,m,n,r,s,a[9][9],b[9][9];
	scanf("%d %d",&m,&n);
	for(j=0;j<9;j++)
	{
		for(i=0;i<9;i++)
		{
			a[j][i]=0;
			b[j][i]=0;
		}
	}
	a[4][4]=m;
	b[4][4]=m;
	for(t=1;t<=n;t++)
	{
		for(r=4-t;r<=2+t;r++)
		{
			for(s=4-t;s<=2+t;s++)
			{
				for(j=0;j<=2;j++)
				{
					for(i=0;i<=2;i++)
					{
						a[r+j][s+i]+=b[r+1][s+1];
					}
				}
			}
		}
            for(j=0;j<9;j++)
				{
					for(i=0;i<9;i++)
					{
						b[j][i]=a[j][i];
						//a[j][i]=0;
					}
				}	
			
	}
	for(j=0;j<9;j++)
	{
		for(i=0;i<8;i++)
		{
			printf("%d ",b[j][i]);
		}
		printf("%d\n",b[j][8]);
	}


	
	return 0;
}
int m=0,n=0,a[9][9]={0},b[9][9]={0};
void f(int day)
{
	if(day>n)
	{
	}
	else
	{
		for(int i=1;i<=7;i++)
		{
			for(int j=1;j<=7;j++)
			{
				a[i][j]+=b[i][j];
				a[i-1][j]+=b[i][j];
				a[i+1][j]+=b[i][j];
				a[i][j-1]+=b[i][j];
				a[i][j+1]+=b[i][j];
				a[i-1][j-1]+=b[i][j];
				a[i+1][j+1]+=b[i][j];
				a[i-1][j+1]+=b[i][j];
				a[i+1][j-1]+=b[i][j];
			}
		}
		for(int x=0;x<=8;x++)
		{
			for(int y=0;y<=8;y++)
			{
				b[x][y]=a[x][y];
			}
		}
		f(day+1);
	}
}
int main()
{
	cin>>m>>n;
	a[4][4]=m;
	b[4][4]=m;
	f(1);
	for(int p=0;p<=8;p++)
	{
		cout<<a[p][0];
		for(int q=1;q<=8;q++)
		{
			cout<<" "<<a[p][q];
		}
		cout<<endl;
	}		
	return 0;
}
void spread (int [9][9]);
int main()
{
	int a[9][9];
	int m,n;
	int i,j;
	cin>>m>>n;
	for (i=0;i<9;i++)
		for (j=0;j<9;j++)
			a[i][j]=0;
	a[4][4]=m;
	for (i=0;i<n;i++)
		spread(a);
	for(i=0;i<9;i++)
	{
		cout<<a[i][0];
		for (j=1;j<9;j++)
			cout<<" "<<a[i][j];
		cout<<endl;
	}
	return 0;
}
void spread(int a[9][9])
{
	int b[9][9];
	int i,j;
	int p,q;
	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 (b[i][j]!=0)
			{
				for (p=i-1;p<=i+1;p++)
					for (q=j-1;q<=j+1;q++)
						a[p][q]+=b[i][j];
			}
		}
	}
}
int main(){
    int i,j,k,m,n;
    int set[20][20],ad[20][20]={0};
    scanf("%d %d",&m,&n);
    for(i=0;i<11;i++){
                     for(j=0;j<11;j++){
                                      set[i][j]=0;
                                      }
                     }
    set[5][5]=m;



 for(k=1;k<=n;k++){  
           for(i=1;i<=9;i++){
                    for(j=1;j<=9;j++){
                          if(set[i][j]!=0){
                                    ad[i][j]=set[i][j];       
                                           }
                                     }
                            }                       
    
   
   
   
   
   
   
    for(i=1;i<=9;i++){
                    for(j=1;j<=9;j++){
                         if(ad[i][j]!=0){             
    set[i][j-1]+=ad[i][j];
    set[i-1][j]+=ad[i][j];
    set[i-1][j-1]+=ad[i][j];
    set[i-1][j+1]+=ad[i][j];
    set[i][j]=set[i][j]+ad[i][j];
    set[i+1][j]+=ad[i][j];
    set[i][j+1]+=ad[i][j];
    set[i+1][j-1]+=ad[i][j];
    set[i+1][j+1]+=ad[i][j];
}
}
}
for(i=0;i<11;i++){
                     for(j=0;j<11;j++){
                                      ad[i][j]=0;
                                      }
                     }

}
   
    for(i=1;i<=9;i++){
                     for(j=1;j<=8;j++){
    printf("%d ",set[i][j]);
}
printf("%d",set[i][9]);
printf("\n");
}

return 0;
}
// ??????
// ??? 1100012820
// 20111123
//******************
int sqr[9][9] = {0};
void printsqr(int a[9][9])
{
	int i, j;
	for (i = 0; i <= 8; i++)
	{
		for (j = 0; j <= 7; j++)
			cout << a[i][j] << " ";
		cout << a[i][8] << endl;
	}
}
void addv()
{
	int adsqr[9][9] = {0};
	int i, j, m, n;
	for (i = 0; i < 9; i++)
	{
		for (j = 0; j < 9; j++)
		{
			for(m = i - 1; m <= i + 1; m++)
			{
				for(n = j - 1; n <= j + 1; n++)
				{
					if ((m >= 0) && (m <= 8) && (n >= 0) && (n <= 8))
						adsqr[m][n] += sqr[i][j];
				}
			}
		}
	}
	for (i = 0; i < 9; i++)
	{
		for (j = 0; j < 9; j++)
		{
			sqr[i][j] += adsqr[i][j];
		}
	}
	return;
}
void grow(int days)
{
	if (days)
	{
		addv();
		grow(days - 1);
	}
	return;
}
int main()
{
	int num, day;
	cin >> num >> day;
	sqr[4][4] += num;
	grow(day);
	printsqr(sqr);
	return 0;
}
int m , n ;	
int i , j ;
int a[11][11] = {{0}}, b[11][11] = {{0}};
void fz(int);
int main ()
{
	cin >> m >> n ;
	a[5][5] = m ;
	fz(0);
	return 0 ;
}


void fz(int x )
{
	if ( x == n )
	{
		for (i = 1;i < 10;i ++)
		{
			cout << a[i][1];
			for (j = 2;j < 10; j++)
			{
				cout << " " << a[i][j];
			}
			cout << endl ;
		}
	}
	else
	{
		for (i = 4 - x ;i <= 6 + x;i ++)
		{
			for (j = 4 - x;j <= 6 + x;j ++)
			{
				b[i][j] = a[i+1][j+1]+a[i][j]+ a[i+1][j-1]+ a[i-1][j+1]+ a[i+1][j] + a[i-1][j] + a[i][j+1]+ a[i][j-1]+ a[i-1][j-1];
			}
		}
		for (i = 4 - x ;i <= 6 + x;i ++)
		{
			for (j = 4 - x;j <= 6 + x;j ++)
			{
				a[i][j] += b[i][j];
				b[i][j] = 0 ;
			}
		}
		fz(x+1);
	}
}
int main()
{
	int bat[5][11][11] = {0};
	int days;
	cin >> bat[0][5][5] >> days;
	for (int i = 1; i <= days ; i++)
	{
		for (int row = 1 ; row <= 9 ; row++)
		{
			for (int col = 1 ; col <= 9 ; col++)
			{
				if (bat[i-1][col][row] != 0)
				{
					bat[i][col][row] += 2 * bat[i-1][col][row];
					bat[i][col-1][row-1] += bat[i-1][col][row];
					bat[i][col-1][row] += bat[i-1][col][row];
					bat[i][col-1][row+1] += bat[i-1][col][row];
					bat[i][col][row-1] += bat[i-1][col][row];
					bat[i][col][row+1] += bat[i-1][col][row];
					bat[i][col+1][row-1] += bat[i-1][col][row];
					bat[i][col+1][row] += bat[i-1][col][row];
					bat[i][col+1][row+1] += bat[i-1][col][row];
				}
			}
		}
	}
	for (int i = 1 ; i <= 9 ; i++)
	{
		cout << bat[days][i][1];
		for(int j = 2; j <= 9 ; j++)
			cout << ' ' << bat[days][i][j];
		cout << endl;
	}
	return 0;
}
int a[9][9] = {0};                              //???????

void exp(int n)
{
	int i = 0, j = 0, k = 0, b[9][9] = {0}, c[9][9] = {0};
	
	for(i = 0; i < 9; i ++)
		for(j = 0; j < 9; j ++)
			if(a[i][j] != 0)
				b[i][j] = 1;                    //??????
	

	for(i = 0; i < 9; i ++)
	{
		for(j = 0; j < 9; j ++)
		{
			if((a[i][j] != 0) && (b[i][j] == 1))
			{
				if((i - 1 >= 0) && (j - 1 >= 0))
					c[i - 1][j - 1] = c[i - 1][j - 1] + a[i][j];
				if((i - 1 >= 0) && (j + 1 >= 0))
					c[i - 1][j + 1] = c[i - 1][j + 1] + a[i][j];
				if((i + 1 <= 8) && (j - 1 >= 0))
					c[i + 1][j - 1] = c[i + 1][j - 1] + a[i][j];
				if((i + 1 <= 8) && (j + 1 <= 8))
					c[i + 1][j + 1] = c[i + 1][j + 1] + a[i][j];
				if(i - 1 >= 0)
					c[i - 1][j] = c[i - 1][j] + a[i][j];
				if(i + 1 <= 8)
					c[i + 1][j] = c[i + 1][j] + a[i][j];
				if(j - 1 >= 0)
					c[i][j - 1] = c[i][j - 1] + a[i][j];
				if(j + 1 <= 8)
					c[i][j + 1] = c[i][j + 1] + a[i][j];
				c[i][j] = c[i][j] + a[i][j] * 2;
			}
		}
	}
	for(i = 0; i < 9; i ++)
	{
		for(j = 0; j < 9; j ++)
		{
			a[i][j] = c[i][j];
		}
	}

	if(n > 1)
		exp(n -1);
}
 
int main ()
{
	int m = 0, n = 0, i = 0, j = 0;             //m????????n???
	cin >> m >> n;
	a[4][4] = m;                                //?????
	exp(n);                                     //??????
	for(i = 0; i < 9; i ++)
	{
		cout << a[i][0];
		for(j = 1; j < 9; j ++)
			cout << ' ' << a[i][j];
		cout << endl;
	}
	return 0;
}