semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
    int a[10][10],t[10][10];
    int time=0,i=0,j=0,k=0;
    for(i=1;i<10;i++)
       for(j=1;j<10;j++)
       a[i][j]=0;
    cin>>a[5][5]>>time;
    for(i=0;i<time;i++)
      {
          for(j=5-i;j<=5+i;j++)
            for(k=5-i;k<=5+i;k++)
            t[j][k]=a[j][k];
          for(j=5-i;j<=5+i;j++)
            for(k=5-i;k<=5+i;k++)
            {
               a[j-1][k-1]=a[j-1][k-1]+t[j][k];
               a[j-1][k]=a[j-1][k]+t[j][k];
               a[j-1][k+1]=a[j-1][k+1]+t[j][k];
               a[j][k-1]=a[j][k-1]+t[j][k];
               a[j][k]=a[j][k]+t[j][k];
               a[j][k+1]=a[j][k+1]+t[j][k]; 
               a[j+1][k-1]=a[j+1][k-1]+t[j][k]; 
               a[j+1][k]=a[j+1][k]+t[j][k]; 
               a[j+1][k+1]=a[j+1][k+1]+t[j][k]; 
                      
            }
      }
    for(i=1;i<10;i++)
       {
             for(j=1;j<=8;j++)
                cout<<a[i][j]<<" ";
             cout<<a[i][9]<<endl;
       }
       cin.get();cin.get();cin.get();cin.get();
       return 0;
}
int main(){
	int a[11][11],b[11][11];	
	int i,j;
	int mushi,nichi,n;
	
	scanf("%d%d",&mushi,&nichi);
	
    for(i=0;i<11;i++){
		for(j=0;j<11;j++){
		    a[i][j]=0;
			b[i][j]=0;
		}
	}
    a[5][5]=mushi;
    b[5][5]=mushi;
	for(n=0;n<nichi;n++){
	for(i=0;i<10;i++){
		for(j=0;j<10;j++){
		    b[i][j]+=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]+a[i][j];
		}
	}
	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<9;j++){
		    printf("%d ",a[i][j]);
		}
            printf("%d\n",a[i][9]);
	}
	
		

return 0;
}
int A[11][11], tmp[11][11];
int N;
int main()
{
	scanf ("%d %d", &A[5][5], &N);
	for (int i = 0; i < N; i ++)
	{
		memset(tmp, 0, sizeof(tmp));
		for (int l = 1; l <= 9; l ++)
			for (int r = 1; r <= 9; r ++)
			{
				tmp[l][r] += 2 * A[l][r];
				tmp[l - 1][r] += A[l][r];
				tmp[l + 1][r] += A[l][r];
				tmp[l][r - 1] += A[l][r];
				tmp[l][r + 1] += A[l][r];
				tmp[l - 1][r - 1] += A[l][r];
				tmp[l - 1][r + 1] += A[l][r];
				tmp[l + 1][r - 1] += A[l][r];
				tmp[l + 1][r + 1] += A[l][r];
			}
		memcpy(A, tmp, sizeof(tmp));	
	}
	for (int i = 1; i < 10; i ++)
	{
		for (int j = 1; j < 9; j ++)
			printf ("%d ", A[i][j]);
		printf ("%d\n", A[i][9]);
	}
	return 0;
}
//****************************************
//*???????????               **
//*????? 1100012873                **
//*???2011.11.23                     **
//****************************************
int s[11][11] = {0};
void ct (int, int);
int main()
{
	int a, b, p, q;
	cin >> a >> b;
	ct (a, b);
	for (p = 1;p < 10;p++)
		for (q = 1;q < 10;q++)//????????????
		{
			if (q == 1)
				cout << s[p][q];
			else if (q == 9)
				cout << ' ' << s[p][q] << endl;
			else if (q >= 0 && q <= 9)
				cout << ' ' << s[p][q];
		}
    return 0;
}
void ct (int m, int n)
{
	int i,j,z[11][11];
	if (n == 0)
		s[5][5] = m;//?????????????
	else
	{
		ct (m, n - 1);
		for (i = 1;i < 10;i++)
			for (j = 1;j < 10;j++)
				z[i][j] = 2 * s[i][j] + s[i - 1][j] + s[i + 1][j] + s[i][j + 1] + s[i][j - 1] + s[i + 1][j + 1] + s[i - 1][j - 1] + s[i + 1][j - 1] + s[i - 1][j + 1];
        for (i = 1;i < 10;i++)
			for (j = 1;j < 10;j++)
				s[i][j] = z[i][j];//z??????????????
	}
}
/*
?? ?????07????????1
??
????9???????????????m?????????????????????10???????10??????????????????????????????????????????n(1?n?4)????????????????

????
?????????????m????????????2?m?30???????n????????1?m?4??

????
??????????????????????????????n???????????????

????
2 1

????
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 2 2 2 0 0 0
0 0 0 2 4 2 0 0 0
0 0 0 2 2 2 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 
*/


int temp[9][9],a[9][9];

void proliferation(int ds,int dd)
{
	int m,n,j,k;
	if (dd==ds)
	{
		for (j=0;j<=8;j++)
		{
			for (k=0;k<=8;k++)
			{
				if (k==0)  cout<<a[j][k];
				else cout<<" "<<a[j][k];
			}
			cout<<endl;
		}
	}
	else if (dd<ds)
	{
		for (m=4-dd;m<=4+dd;m++)
		{
			for (n=4-dd;n<=4+dd;n++)
			{
			    for (j=m-1;j<=m+1;j++)
			    {
				    for (k=n-1;k<=n+1;k++)
					{
					    temp[j][k]+=a[m][n];
				    }
				}
			}
		}

		dd++;

		for (j=4-dd;j<=4+dd;j++)
		{
			for (k=4-dd;k<=4+dd;k++)
			{
				a[j][k]=temp[j][k];
			}
		}

		proliferation(ds,dd);
	}
}

int main()
{
	int ds,m;
	cin>>m>>ds;

	memset(temp,0,sizeof(temp));
	memset(a,0,sizeof(a));

	a[4][4]=m;
	temp[4][4]=m;
	proliferation(ds,0);

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

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

int a[9][9];

void birth(int i,int j,int m,int n)
{
	if (n==0)
	{
		a[i][j]+=m;
		return;
	}
	else
	{
		int k,l;
		for (k = i - 1;k < i + 2;k++)
			for(l = j - 1;l < j + 2;l++)
				if (k>=0 && k<9 && l>=0 && l<9) //????????
				{
					if (k==i && l==j)
						birth(k,l,2*m,n-1);
					else
						birth(k,l,m,n-1);
				}

	}
}

int main()
{
	int m,n,i,j;
	cin>>m>>n;
	
	for (i = 0;i < 9; i++)
		for(j = 0;j < 9; j++)
			a[i][j]=0;
	birth(4,4,m,n);
	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 a[11][11] = {0}, b[11][11] = {0};

void multiply(int d)
{
	int i, j;
	if (d != 0)
	{
		for (i = 1; i <= 9; i++)
			for (j = 1; j <= 9; j++)
			{
				b[i][j] += a[i][j] * 2;
				b[i - 1][j] += a[i][j];
				b[i + 1][j] += 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 + 1] += 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];
				b[i][j] = 0;
			}
		multiply(d - 1);
	}
}

int main()
{
	int m, n, d;
	int i, j;
	cin >> m >> n;
	a[5][5] = m;
	multiply(n);

	for (i = 1; i <= 9; i++)
		for (j = 1; j <= 9; j++)
		{
			if (j == 1)
			cout << a[i][j];
			else
			{
				cout << " " << a[i][j];
			}
			if (j == 9)
				cout << endl;
		}
	return 0;
}
//********************************
//*??:????**
//*????? 1300012839 **
//*???2013.12.6**
//********************************                                        //??????????
int main()
{
	int bac[5][13][13] = {0},m ,n ,day ,i ,j ,k ,l;                       //????????????????????
	cin >> m >> n;                                                        //m????5?5????????n???
	bac[0][5][5] = m;
	for(day = 1;day <= n;day++)                                          //????
	{
		for(int i = 1;i <= 9;i++)
		{
			for(j = 1;j <= 9;j++)
			{
				bac[day][i][j] = bac[day - 1][i - 1][j - 1] + bac[day - 1][i - 1][j]+bac[day - 1][i - 1][j + 1] +   
				                 bac[day - 1][i][j - 1] + bac[day - 1][i][j + 1] +
							     bac[day - 1][i + 1][j - 1] + bac[day - 1][i + 1][j] + bac[day - 1][i + 1][j + 1] +
							     2 * bac[day - 1][i][j];                 //??????n??????????
			}
		}
	}
	for(i = 1;i <= 9;i++)                                              //????
	{
		for(j = 1;j <= 8;j++)
			cout << bac[n][i][j] << ' ';
			cout << bac[n][i][9] << endl;
	}
	return 0;
}
void bat(int n,int (*p)[11],int (*q)[11],int t) ;
int main ( )
{
	int m,n ;                   //m?????????n?????
	int i,j ;
	int a[11][11] = {0} ;       //??????????????????
    int b[11][11] ;             //??????????????????? 
	cin >> m >> n ;
	a[5][5] = m ;
	for( i = 0 ; i <= 10 ; i++ )
	{
		for( j = 0 ; j <= 10 ; j++ )
		{
			b[i][j] = a[i][j] ; //????????????????????????
		}
	}
	bat(n,a,b,0) ;              //??bat??????????0????0???
	return 0 ;
}
void bat(int n,int (*p)[11],int (*q)[11],int t)
{
	int i,j ;
	if( t == n )                //????????????
	{
		for( i=1;i<=9;i++)
		{ 
			for(j=1;j<=9;j++)
			{
				if(j!=9)
					cout << *(*(p+i)+j) << " " ;
				else
					cout << *(*(p+i)+j) ;
				                 //????????????????  
			}
			cout << endl ;
		}
		return ;
	}
	                             //??????????????
	for( i = 1 ; i <= 9 ; i++ )
	{
		for( j = 1 ; j <= 9 ; j++ )
		{
			(*(*(p+i)+j)) = (*(*(q+i)+j))*2 + (*(*(q+i+1)+j)) + 
				            (*(*(q+i-1)+j)) + (*(*(q+i)+j+1)) +  
							(*(*(q+i)+j-1)) + (*(*(q+i+1)+j+1)) + 
							(*(*(q+i-1)+j-1)) + (*(*(q+i-1)+j+1)) + 
							(*(*(q+i+1)+j-1)) ;
			                     //????????
			                     //?????????????????2?
			                     //???????????????????
		}
	}
	for( i = 0 ; i <= 10 ; i++ )
	{
		for( j = 0 ; j <= 10 ; j++ )
		{
			(*(*(q+i)+j)) = (*(*(p+i)+j)) ;
		}
	}                            //??(*q)[]??b[][]????????????????????
	t++ ;                        //???1
	bat(n,p,q,t) ;               //????bat??
}
int now[9][9]={0},add[9][9]={0};
void getadd()
{
	for(int i=0;i<9;i++) for(int j=0;j<9;j++) add[i][j]=0;
	for(int i=1;i<8;i++)
	{
		for(int j=1;j<8;j++)
		{
			add[i-1][j-1]+=now[i][j];
			add[i][j-1]+=now[i][j];
			add[i+1][j-1]+=now[i][j];
			add[i-1][j+1]+=now[i][j];
			add[i][j+1]+=now[i][j];
			add[i+1][j+1]+=now[i][j];
			add[i+1][j]+=now[i][j];
			add[i-1][j]+=now[i][j];


		}
	}
}
int main()
{
	int m,n;
	cin>>m>>n;now[4][4]=m;
	for(int k=0;k<n;k++)
	{
		getadd();
		for(int i=0;i<9;i++)
		{
			for(int j=0;j<9;j++)
			{
				now[i][j]=2*now[i][j]+add[i][j];
			}
		}

	}

	for(int i=0;i<9;i++)
	{
		if(i) cout<<endl;
		for(int j=0;j<9;j++)
		{
			if(j) cout<<" ";
			cout<<now[i][j];
		}
	}
	

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


}
int main()
{
	int a[100][11][11]={0};
	int n,t;
	int i,j,k;
	for(i=0;i<100;i++)
	  for(j=0;j<=10;j++)
		  for(k=0;k<=10;k++)
			  a[i][j][k]=0;

	cin>>n>>t;
	for(i=0;i<t;i++)
	{
		a[0][5][5]=n;
		for(j=1;j<=9;j++)
			for(k=1;k<=9;k++)
			{
				a[i+1][j][k]=2*a[i][j][k]+a[i][j-1][k]+a[i][j+1][k]+a[i][j][k-1]+a[i][j][k+1]+a[i][j-1][k-1]+a[i][j+1][k+1]+a[i][j-1][k+1]+a[i][j+1][k-1];
			}
	}
	for(i=1;i<=9;i++)
	{
		for(j=1;j<=9;j++)
		{
			if(j==1)
				cout<<a[t][i][j];
			else if(j>0&&j<9)
				cout<<' '<<a[t][i][j];
			else if(j==9)
				cout<<' '<<a[t][i][j]<<endl;
		}
	}


	return 0;
}
int a[9][9]={0},b[9][9]={0};
void copy()
{
	for(int i=0;i<9;i++)
		for(int j=0;j<9;j++)
			a[i][j]=b[i][j];
}
void guil()
{
	for(int i=0;i<9;i++)
		for(int j=0;j<9;j++)
			b[i][j]=0;
}


int main()
{
	int m,n;
	cin>>m>>n;
	a[4][4]=m;
	for(int k=1;k<=n;k++)
	{
		guil();
		for(int i=0;i<9;i++)
		{
			for(int j=0;j<9;j++)
			{
				if(a[i][j]!=0)
				{
					
						b[i][j]+=2*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];
						b[i+1][j-1]+=a[i][j];
						b[i+1][j]+=a[i][j];
						b[i+1][j+1]+=a[i][j];
					
				}
			}
		}
		copy();
	}

	for(int i=0;i<9;i++)
	{
		for(int j=0;j<8;j++)
			cout<<b[i][j]<<" ";
		cout<<a[i][8]<<endl;
	}
	return 0;
}
main()
{
    int m,n,i,j,k,s[11][11]={0},s1[11][11]={0};
    scanf("%d %d",&m,&n);
    s1[5][5]=s[5][5]=m;
    for(k=1;k<=n;k++)
    {
        for(i=5-k;i<=5+k;i++)
        {
            for(j=5-k;j<=5+k;j++)
            {
                s[i][j]=2*s1[i][j]+s1[i-1][j-1]+s1[i-1][j]+s1[i-1][j+1]+s1[i][j-1]+s1[i][j+1]+s1[i+1][j-1]+s1[i+1][j]+s1[i+1][j+1];
            }
        }
        if(k!=n)
        {
            for(i=5-k;i<=5+k;i++)
        {
            for(j=5-k;j<=5+k;j++)
            {
                s1[i][j]=s[i][j];
            }
        }
        }
    }
    for(i=1;i<=9;i++)
    {
        for(j=1;j<=9;j++)
        {
            if(j==1)printf("%d",s[i][j]);
            else printf(" %d",s[i][j]);
        }
        printf("\n");
    }
}
int main()
{
	int a[9][9]={0},m,n,i,j,k,num[9][9];
	cin>>m>>n;
	a[4][4]=m;
	for(i=0;i<n;i++)
	{
		for(j=0;j<9;j++)
		for(k=0;k<9;k++)
			num[j][k]=0;
		for(j=0;j<9;j++)
		for(k=0;k<9;k++)
			if(a[j][k]!=0)//????????
			{
				num[j+1][k]=num[j+1][k]+a[j][k];
				num[j-1][k]=num[j-1][k]+a[j][k];
				num[j][k+1]=num[j][k+1]+a[j][k];
				num[j][k-1]=num[j][k-1]+a[j][k];
				num[j-1][k-1]=num[j-1][k-1]+a[j][k];
				num[j-1][k+1]=num[j-1][k+1]+a[j][k];
				num[j+1][k-1]=num[j+1][k-1]+a[j][k];
				num[j+1][k+1]=num[j+1][k+1]+a[j][k];
			}
		for(j=0;j<9;j++)
		for(k=0;k<9;k++)
			if(a[j][k]!=0)//???????
			{
				a[j][k]=a[j][k]*2;
			}
		for(j=0;j<9;j++)//????????
		for(k=0;k<9;k++)
			a[j][k]=a[j][k]+num[j][k];
	}
	for(j=0;j<9;j++)//????
	{
		for(k=0;k<9;k++)
		{
			if(k==0) cout<<a[j][k];
			else cout<<' '<<a[j][k];
		}
		cout<<endl;
	}
	return 0;
}
int main()
{
    int m,n,a[12][12],b[12][12],i,j,k;
	scanf("%d %d",&m,&n);
    for(j=0;j<=10;j++){
			for(k=0;k<=10;k++){
				b[j][k]=0;
				a[j][k]=0;
			}
	}
    b[5][5]=m;
	for(i=0;i<n-1;i++){
		for(j=1;j<=9;j++){
			for(k=1;k<=9;k++){
				a[j][k]+=2*b[j][k]+b[j-1][k]+b[j][k-1]+b[j+1][k]+b[j][k+1]+b[j-1][k-1]+b[j+1][k+1]+b[j+1][k-1]+b[j-1][k+1];
			}
		}
        for(j=1;j<=9;j++){
			for(k=1;k<=9;k++){
				b[j][k]=a[j][k];
				a[j][k]=0;
			}
		}
	}
    for(j=1;j<=9;j++){
			for(k=1;k<=9;k++){
				a[j][k]+=2*b[j][k]+b[j-1][k]+b[j][k-1]+b[j+1][k]+b[j][k+1]+b[j-1][k-1]+b[j+1][k+1]+b[j+1][k-1]+b[j-1][k+1];
			}
		}
    for(j=1;j<=9;j++){
		for(k=1;k<9;k++){
			printf("%d ",a[j][k]);
		}
		printf("%d\n",a[j][9]);
	}
	return 0;

}
//????(???)


int chess[15][15][5];
int d;

int f(int i,int j,int k)
{
	if(i<1||i>9||j<1||j>9) return 0;
	if(chess[i][j][k]!=-1) return chess[i][j][k];
	chess[i][j][k]=f(i,j,k-1)*2+f(i,j-1,k-1)+f(i,j+1,k-1)+f(i+1,j,k-1)+f(i-1,j,k-1)+f(i-1,j-1,k-1)+f(i-1,j+1,k-1)+f(i+1,j-1,k-1)+f(i+1,j+1,k-1);
	return chess[i][j][k];
}

int main()
{
	int i,j,k,s,t;
	for(i=1;i<=9;i++)
	{
		for(j=1;j<=9;j++)
		{
			chess[i][j][0]=0;
			for(t=1;t<=4;t++)
				chess[i][j][t]=-1;
		}
	}
	cin>>chess[5][5][0]>>d;

	for(i=1;i<=9;i++)
	{
		cout<<f(i,1,d);
		for(j=2;j<=9;j++)
		{
			cout<<" "<<f(i,j,d);
		}
		cout<<endl;
	}
	return 0;
}
int main()
{
	int sum=0,day=0,a[11][11],b[11][11],i=0,j=0,p=0; //???????sum,????day,?????a[11][11],??????b[11][11],??????i,j
	cin>>sum>>day;
	for(i=0;i<11;i++)  //?????
	{
		for(j=0;j<11;j++)
		{
			a[i][j]=0;
		}
	}
	a[5][5]=sum;      //????????????????
	for(i=0;i<11;i++)
	{
		for(j=0;j<11;j++)
		{
			b[i][j]=a[i][j];
		}
	}
	for(p=0;p<day;p++)
	{
		for(i=0;i<11;i++)
		{
			for(j=0;j<11;j++)      //???????a[i][j]?????b[i][j]
			{
				b[i][j]=a[i][j];
			}
		}
		for(i=1;i<=9;i++)
		{
			for(j=1;j<=9;j++)
			{
				a[i][j]=2*b[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]; //???????
			}
		}
	}
	for(i=1;i<=9;i++)   
	{
		for(j=1;j<9;j++)
		{
			cout<<a[i][j]<<" ";  //????????
		}
		cout<<a[i][9]<<endl;
	}
		return 0;
}
int m, n;
int s[9][9];
struct NUM
{
	int x;
	int y;
	int temp;
}ex[81];
void zhou(int,int,int);
int main()
{
	cin >> m >> n;
	for (int i = 0; i < 9; i++)
		for (int j = 0; j < 9; j++)
			s[i][j] = 0;
	s[4][4] = m;
	int p = 0;
	for (int t = 1; t <= n; t++)
	{
		for (int i = 0; i < 9; i++)
			for (int j = 0; j < 9 ;j++)
			{
				if (s[i][j] != 0)
				{
					int temp = s[i][j] * 8;
					s[i][j] = 2 * s[i][j];
					ex[p].x = i;
					ex[p].y = j;
					ex[p].temp = temp;
					p++;					
				}
			}
	
			for (int i = 0 ; i < p; i++)
			{
				zhou(ex[i].x,ex[i].y,ex[i].temp);
			}
			p = 0;
	}
	for (int i =0; i < 9; i++)
	{
		for (int j = 0; j < 9 ; j++)
		{
			if (j == 0)
				cout << s[i][j];
			else
				cout << " " << s[i][j];
		}
		cout << endl;
	}
	return 0;
}
void zhou(int x, int y,int num)
{
	int xd[8] = {0,0,1,-1,-1,1,1,-1};
	int yd[8] = {1,-1,0,0,-1,1,-1,1};
	int sum = 0;
	for (int i = 0; i < 8 ;i++)
	{
		int nx = x + xd[i];
		int ny = y + yd[i];
		if (nx >= 0 &&nx < 9 && ny >= 0 && ny < 9)
			sum++;
	}
	for (int i = 0; i < 8 ;i++)
	{
		int nx = x + xd[i];
		int ny = y + yd[i];
		if (nx >= 0 &&nx < 9 && ny >= 0 && ny < 9)
			s[nx][ny] += num / sum;
	}
}
int main()
{
	int m, n;
	int bac[9][9] = {{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0}};
	scanf("%d %d",&m,&n);
	int i = 1;
	bac[4][4] = m;
	int p = 0,q = 0;
	while(i<=n)
	{
		q = 0;
		int a[9][9] = {{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0}};
		while(q<9)
		{
			p = 0;
			while(p<9)
			{
				if(bac[p][q]!=0)
				{
					a[p][q] = a[p][q] + 2 * bac[p][q];
					a[p-1][q] += bac[p][q];
					a[p+1][q] += bac[p][q];
					a[p][q-1] += bac[p][q];
					a[p][q+1] += bac[p][q];
					a[p-1][q-1] += bac[p][q];
					a[p-1][q+1] += bac[p][q];
					a[p+1][q-1] += bac[p][q];
					a[p+1][q+1] += bac[p][q];
				}
				p++;
			}
			q++;
		}
		p = 0;
		q = 0;
		while(q<9)
		{
			p = 0;
			while(p<9)
			{
				bac[p][q] = a[p][q];
				p++;
			}
			q++;
		}
		i++;
	}
	p = 0;
	q = 0;
	while(q<9)
	{
		p = 0;
		while(p<8)
		{
			printf("%d ",bac[p][q]);
			p++;
		}
		printf("%d\n",bac[p][q]);
		q++;
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int sz[9][9][5],n,m,i,j,k,p,q;
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			for(k=0;k<5;k++)
			{
				sz[i][j][k]=0;
			}
		}
	}
	scanf("%d %d",&n,&m);
	sz[4][4][0]=n;
	for(k=0;k<m;k++)
	{
		for(i=1;i<8;i++)
		{
			for(j=1;j<8;j++)
			{
				if(sz[i][j][k]!=0)
				{
					sz[i-1][j-1][k+1]+=sz[i][j][k];
					sz[i-1][j][k+1]+=sz[i][j][k];
					sz[i-1][j+1][k+1]+=sz[i][j][k];
					sz[i][j-1][k+1]+=sz[i][j][k];
					sz[i][j][k+1]+=sz[i][j][k]*2;
					sz[i][j+1][k+1]+=sz[i][j][k];
					sz[i+1][j-1][k+1]+=sz[i][j][k];
					sz[i+1][j][k+1]+=sz[i][j][k];
					sz[i+1][j+1][k+1]+=sz[i][j][k];
				}
			}
		}
	}
	for(i=0;i<9;i++)
	{
		printf("%d",sz[i][0][m]);
		for(j=1;j<9;j++)
		{
			printf(" %d",sz[i][j][m]);
		}
		printf("\n");
	}
	return 0;

}
int main()
{
	int m,n;
	int a[9][9]={0},t[9][9];
	int i,j,k;
	scanf("%d %d",&m,&n);
	a[4][4]=1;
	for(i=1;i<=n;i++)
	{
		for(j=0;j<=8;j++)
			for(k=0;k<=8;k++)
				t[j][k]=a[j][k];
		for(j=5-i;j<=3+i;j++)
			for(k=5-i;k<=3+i;k++)
				a[j][k]=a[j][k]+t[j][k];
		for(j=5-i;j<=3+i;j++)
			for(k=5-i;k<=3+i;k++)
			{
				a[j-1][k-1]+=t[j][k];
				a[j-1][k]+=t[j][k];
				a[j-1][k+1]+=t[j][k];
				a[j][k-1]+=t[j][k];
				a[j][k+1]+=t[j][k];
				a[j+1][k-1]+=t[j][k];
				a[j+1][k]+=t[j][k];
				a[j+1][k+1]+=t[j][k];
			}
	}
	for(i=0;i<=8;i++)
	{
		for(j=0;j<=8;j++)
		{
			if(j==0)
				printf("%d",m*a[i][j]);
			else
				printf(" %d",m*a[i][j]);
		}
		printf("\n");
	}
	return 0;
}
//****************************************
//*???????????                       
//*?????? 1100012789      
//*???2011.11.25                       
//****************************************

int Multi(int x, int y, int day);
int n;
int main()
{
	int day, i, j;
	cin >> n >> day;
	for (i = 1; i < 10; i++) // ?????
	{
		cout << Multi(i, 1, day);
		for (j = 2; j < 10; j++)
			cout << " " << Multi(i, j, day);
		cout << endl;
	}
	return 0;
}
int Multi(int x, int y, int day)
{
	if (day == 0)
		if (x == 5 && y == 5)
			return n;
		else return 0;
	return (Multi(x, y, day - 1) * 2 + Multi(x - 1, y - 1, day - 1) + Multi(x - 1, y, day - 1) 
		+ Multi(x - 1, y + 1, day - 1) + Multi(x, y - 1, day - 1) + Multi(x, y + 1, day - 1) +
		Multi(x + 1, y - 1, day - 1) + Multi(x + 1, y, day - 1) + Multi(x + 1, y + 1, day - 1));
	

}
int a[10][10],b[10][10];
int dx[]={1,1,1,0,0,0,-1,-1,-1};
int dy[]={-1,0,1,-1,0,1,-1,0,1};
void change()
{
	for(int i=1;i<=9;++i)
		for(int j=1;j<=9;++j)
			b[i][j]=a[i][j];
	for(int i=1;i<=9;++i)
		for(int j=1;j<=9;++j)
		{
			if(b[i][j]!=0)
			{
				
				for(int k=0;k<9;++k)
				{
					a[i+dx[k]][j+dy[k]]+=b[i][j];
				}
			}
		}
}
int main()
{
	int m,n;
	cin>>m>>n;
	a[5][5]=m;
	for(int i=0;i<n;++i)
	{change();}
	for(int i=1;i<=9;++i)
	{
		for(int j=1;j<=9;++j)
		{
			if(j!=9)cout<<a[i][j]<<" ";
		else cout<<a[i][j]<<endl;
		}
	}
}