semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int i,j,k,m, n, count[9][9],temp[9][9];
	memset(count,0,sizeof(count));
	memset(temp,0,sizeof(count));
	cin >> m >> n;
	count[4][4] = m;
	for ( i = 0; i < n; i++)
	{
		for ( j = 0; j <9; j++)
			for ( k = 0; k < 9;k++)
			{
				if ( count[j][k] != 0 )
				{
					temp[j-1][k] +=count[j][k];
					temp[j+1][k]+=count[j][k];
					temp[j-1][k-1]+=count[j][k];
					temp[j-1][k+1]+=count[j][k];
					temp[j][k-1]+=count[j][k];
					temp[j][k+1]+=count[j][k];
					temp[j+1][k+1]+=count[j][k];
					temp[j+1][k-1]+=count[j][k];
					temp[j][k] += count[j][k]*2;
				}
			}
		for ( j = 0; j <9; j++)
			for ( k = 0; k < 9;k++)
				count[j][k] = temp[j][k];
		memset(temp,0,sizeof(temp));
	}
	for ( j = 0; j <9; j++)
	{
		for ( k = 0; k < 8;k++)
			cout << count[j][k] <<' ';
		cout << count[j][8] << endl;
	}
	return 0;
}
int main()
{
	int m,n;
	scanf("%d %d",&m,&n);
	int sz[6][9][9];
	int day=1;
	int i,j,e;
	for(i=0;i<9;i++)
		{
			for(j=0;j<9;j++)
			{
				sz[0][i][j]=0;
			}
		}
	sz[0][4][4]=m;
	for(day=1;day<=n;day++)
	{
		for(i=0;i<9;i++)
		{
			for(j=0;j<9;j++)
			{
				sz[day][i][j]=0;
			}
		}
		for(i=0;i<9;i++)
		{
			for(j=0;j<9;j++)
			{
				if(sz[day-1][i][j]!=0)
				{
					e=sz[day-1][i][j];
					sz[day][i-1][j-1]+=e;
					sz[day][i-1][j]+=e;
					sz[day][i-1][j+1]+=e;
					sz[day][i][j-1]+=e;
					sz[day][i][j]+=e*2;
					sz[day][i][j+1]+=e;
					sz[day][i+1][j-1]+=e;
					sz[day][i+1][j]+=e;
					sz[day][i+1][j+1]+=e;
				}
			}
		}
	}
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			if(j==8)
			{
				printf("%d\n",sz[n][i][j]);
			}
			else
			{
				printf("%d ",sz[n][i][j]);
			}
		}
	}
	return 0;
}
int main()
{
	int a[9][9]={0},b[9][9]={0};
	int m,n;
	int i,j,k,fx,fy;
	cin>>m>>n;
	a[4][4]=m;
	for(int k=0;k<n;k++)
	{
		memset(b,0,sizeof(b));
		for(i=1;i<8;i++)
			for(j=1;j<8;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<9;i++)
	{
		cout<<a[i][0];
		for(j=1;j<9;j++)
		{
			cout<<' '<<a[i][j];
		}
		cout<<endl;
	}
	return 0;
}
/* title :????????*
* author : ???*
* time : 2011.11.9 */


int a[11][11] = {0};
int b[11][11] = {0};
int m;

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

	return 0;
}
int main()
{
    int m,n;
    scanf("%d %d",&m,&n);
        struct student
    {
           int nima[9][9];
    };
    struct student stu[4];
    for(int i=1;i<=n;i++)
    { 
            for(int x=0;x<9;x++)
            {
                    for(int y=0;y<9;y++)
                    {
                         stu[i-1].nima[x][y]=0;
                    }
            }              
                   if(i==1)
                   { 
                    stu[i-1].nima[4][4]=2;stu[i-1].nima[4][3]=1;stu[i-1].nima[3][4]=1;stu[i-1].nima[3][3]=1;
                    stu[i-1].nima[5][3]=1;stu[i-1].nima[3][5]=1;stu[i-1].nima[4][5]=1;stu[i-1].nima[5][5]=1;
                    stu[i-1].nima[5][4]=1;
                   }
            else
            for(int x=4-i;x<5+i;x++)
            {
                    for(int y=4-i;y<5+i;y++)
                    {
                         stu[i-1].nima[x][y]=2*stu[i-2].nima[x][y]+stu[i-2].nima[x-1][y-1]+stu[i-2].nima[x-1][y]
                         +stu[i-2].nima[x-1][y+1]+stu[i-2].nima[x][y-1]+stu[i-2].nima[x][y+1]+stu[i-2].nima[x+1][y-1]
                         +stu[i-2].nima[x+1][y]+stu[i-2].nima[x+1][y+1];
                    }
            }    
    }
    for(int x=0;x<5;x++)
            {
                    for(int y=0;y<9;y++)
                    {   
                       if(y==8)printf("%d\n",m*stu[n-1].nima[x][y]);
                       else  printf("%d ",m*stu[n-1].nima[x][y]);
                    }
            }    
    for(int x=3;x>=0;x--)
            {
                    for(int y=0;y<9;y++)
                    {   
                       if(y==8)printf("%d\n",m*stu[n-1].nima[x][y]);
                       else  printf("%d ",m*stu[n-1].nima[x][y]);
                    }
            }    
  
}
int a[11][11],b[11][11];
int k,i,j,t,s,m,n,p,q;
main()
{
	cin>>m>>n;
	a[5][5]=m;
	for(k=0;k<n;k++)
	{
		t=n%2,s=1-t;
		for(i=1;i<10;i++)
			for(j=1;j<10;j++)
				b[i][j]=0;
		for(i=1;i<10;i++)
			for(j=1;j<10;j++)
			{
				b[i][j]+=a[i][j];
				for(p=-1;p<=1;p++)
					for(q=-1;q<=1;q++)
						b[i][j]+=a[i+p][j+q];
				}
		for(i=1;i<10;i++)
			for(j=1;j<10;j++)
				a[i][j]=b[i][j];
		}
	for(i=1;i<10;i++)
	{
		cout<<a[i][1];
		for(j=2;j<10;j++)
			cout<<' '<<a[i][j];
		cout<<endl;
		}
	}
//****************************************
//*??????????                     **
//*?????? 1100012920              **
//*???2011.11.28                    **
//****************************************
int num[11][11] = {0};
int f(int i, int j, int n);
int main()
{
	int m, n, k, i, j;
	cin >> m >> n;
	num[5][5] = m;
	{
		for(i = 1; i <= 9; i++)
		{
			for (j = 1; j < 9; j++)
			{
				k = f(i, j, n);
			    cout << k << " ";
			}
			cout << f(i, 9, n) << endl;
		}
	}
	return 0;
}
int f(int i, int j, int n)
{
	if(i == 0 || i == 10 || j == 0 || j == 10)
		return 0;

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

int main() {
	long long  m,day,a[5][10][10];
	cin>>m>>day;
	for(int z=0;z<=day;z++)
		for(int i=1;i<=9;i++)
			for(int j=1;j<=9;j++)
				a[z][i][j]=0;
	a[0][5][5]=m;
	for(int i=0;i<day;i++) {
		for(int x=1;x<=9;x++) {
			for(int y=1;y<=9;y++) {
				for(int k=0;k<8;k++) 
					a[i+1][x+dx[k]][y+dy[k]]+=a[i][x][y];
				a[i+1][x][y]+=a[i][x][y]*2;
			}
		}
	}
	for (int x=1;x<=9;x++) {
		cout<<a[day][x][1];
		for(int y=2;y<=9;y++) 
			cout<<" "<<a[day][x][y];
		cout<<endl;
	}
	return 0;
}
int main()
{
	int n, sz[number][number], sz1[number][number], k, i, l, a, b, j, mc;
	scanf("%d%d", &n, &k);
    for(i=0;i<=8;i++)
	{
		for(j=0;j<=8;j++)
		{
			sz[i][j]=0;
			sz1[i][j]=0;
		}
	}
	sz[4][4]=n;
    for(l=1;l<=k;l++)
	{
		for(i=0;i<=8;i++)
		{
			for(j=0;j<=8;j++)
			{
				if(sz[i][j]!=0)
				{
					sz1[i-1][j-1]=sz1[i-1][j-1]+sz[i][j];
					sz1[i-1][j]=sz1[i-1][j]+sz[i][j];
                    sz1[i-1][j+1]=sz1[i-1][j+1]+sz[i][j];
					sz1[i][j-1]=sz1[i][j-1]+sz[i][j];
					sz1[i][j]=sz1[i][j]+2*sz[i][j];
					sz1[i][j+1]=sz1[i][j+1]+sz[i][j];
					sz1[i+1][j-1]=sz1[i+1][j-1]+sz[i][j];
					sz1[i+1][j]=sz1[i+1][j]+sz[i][j];
					sz1[i+1][j+1]=sz1[i+1][j+1]+sz[i][j];
				}
			}
		}
	    for(i=0;i<=8;i++)
		{
	    	for(j=0;j<=8;j++)
			{
		    	sz[i][j]=sz1[i][j];
	    		sz1[i][j]=0;
			}
		}
	}
	for(i=0;i<=8;i++)
	{
		for(j=0;j<=8;j++)
		{
			if(j==8)
				printf("%d\n", sz[i][j]);
			else
				printf("%d ", sz[i][j]);
		}
	}
	return 0;
}
main()
{
    int a1[9][9],a2[9][9],m,n,i,j;
    for(i=0;i<9;i++)
    {
        for(j=0;j<9;j++)
        {
            a1[i][j]=0;
            a2[i][j]=0;
        }
    }
    scanf("%d %d",&m,&n);
    a1[4][4]=m;
    a2[4][4]=m;
    for(;n>0;n--)
    {
        for(i=0;i<9;i++)
        {
            for(j=0;j<9;j++)
            {
                if(a1[i][j]!=0)
                {
                    a2[i][j]=a2[i][j]+a1[i][j];
                    a2[i-1][j-1]=a2[i-1][j-1]+a1[i][j];
                    a2[i-1][j]=a2[i-1][j]+a1[i][j];
                    a2[i-1][j+1]=a2[i-1][j+1]+a1[i][j];
                    a2[i][j-1]=a2[i][j-1]+a1[i][j];
                    a2[i][j+1]=a2[i][j+1]+a1[i][j];
                    a2[i+1][j-1]=a2[i+1][j-1]+a1[i][j];
                    a2[i+1][j]=a2[i+1][j]+a1[i][j];
                    a2[i+1][j+1]=a2[i+1][j+1]+a1[i][j];
                }
            }
        }
        for(i=0;i<9;i++)
        {
            for(j=0;j<9;j++)
            {
                a1[i][j]=a2[i][j];
            }
        }
    }
    for(i=0;i<9;i++)
    {
        for(j=0;j<9;j++)
        {
            if(j==0)
            printf("%d",a2[i][j]);
            else if(j==8)
            printf(" %d\n",a2[i][j]);
            else
            printf(" %d",a2[i][j]);
        }
    }
}
int main(int argc, char* argv[])
{
	int s[9][9],b[9][9];
	int m,n,i,t,q,a,x,y;
	scanf("%d%d",&m,&n);
	for(i=0;i<9;i++)
	{
		for(t=0;t<9;t++)
		{
			s[i][t]=0;b[i][t]=0;
		}
	}
	s[4][4]=1;
    for(q=0;q<n;q++)
	{
		for(i=0;i<9;i++)
		{
			for(t=0;t<9;t++)
			{
				if(s[i][t]>0) 
				{
					a=s[i][t];
				    for(x=i-1;x<=i+1;x++)
					{
					    for(y=t-1;y<=t+1;y++)
						{
						b[x][y]+=a;
						}
					}
				    b[i][t]+=a;
				}
			}
		}
	    for(i=0;i<9;i++)
		{
		   for(t=0;t<9;t++)
		   {
			   s[i][t]=b[i][t];b[i][t]=0;
		   }
		}
	}
	for(i=0;i<9;i++)
	{
		for(t=0;t<9;t++)
		{
            if(t==0)printf("%d",s[i][t]*m);
				else printf(" %d",s[i][t]*m);
		}
		printf("\n");
	}
	return 0;
}
int main(void)
{
	int i,j,k;
	int num,day;
	scanf("%d%d",&num,&day);
	int a[day+1][10][10];
	for(i=0;i<=day;i++)
	{
		for(j=1;j<=9;j++)
		{
			for(k=1;k<=9;k++)
			    a[i][j][k]=0;
		}
	}
	a[0][5][5]=num;
	for(i=1;i<=day;i++)
	{
		for(j=1;j<=9;j++)
		{
			for(k=1;k<=9;k++)
			{
				if(a[i-1][j][k]!=0)
				{
					a[i][j-1][k-1]+=a[i-1][j][k];
					a[i][j-1][k]+=a[i-1][j][k];
					a[i][j-1][k+1]+=a[i-1][j][k];
					a[i][j][k-1]+=a[i-1][j][k];
					a[i][j][k+1]+=a[i-1][j][k];
					a[i][j][k]+=2*a[i-1][j][k];
					a[i][j+1][k-1]+=a[i-1][j][k];
					a[i][j+1][k]+=a[i-1][j][k];
					a[i][j+1][k+1]+=a[i-1][j][k];
				}
			}
		}
	}
	for(j=1;j<=9;j++)
	{
		for(k=1;k<=8;k++)
		{
			printf("%d ",a[day][j][k]);
		}
		printf("%d\n",a[day][j][9]);
	}
	return 0;
}
int a[9][9] , board[9][9] ;
void add( int i , int j )
{
	if ( a[i][j] > 0 )
	{
		int m ;
		m = a[i][j] ;
		a[i][j] = 0 ;
		board[i][j] = board[i][j] + m*2 ;
		board[i+1][j] = board[i+1][j] + m ;
		board[i-1][j] = board[i-1][j] + m ;
		board[i][j+1] = board[i][j+1] + m ;
		board[i][j-1] = board[i][j-1] + m ;
		board[i+1][j+1] = board[i+1][j+1] + m ;
		board[i+1][j-1] = board[i+1][j-1] + m ;
		board[i-1][j+1] = board[i-1][j+1] + m ;
		board[i-1][j-1] = board[i-1][j-1] + m ;
		add( i+1 , j ) ;
		add( i-1 , j ) ;
		add( i , j+1 ) ;
		add( i , j-1 ) ;
		add( i+1 , j+1 ) ;
		add( i-1 , j-1 ) ;
		add( i+1 , j-1 ) ;
		add( i-1 , j+1 ) ;
	}
}
int main()
{
	int i , j , m , d , sum = 0 , k ;
	cin >> m >> d ;
	for ( i = 0 ; i < 9 ; i++ )
		for ( j = 0 ; j < 9 ; j++ )
			a[i][j] = 0 ;
	a[4][4] = m ;
	for ( k = 0 ; k < d ; k++ )
	{
		for ( i = 0 ; i < 9 ; i++ )
			for ( j = 0 ; j < 9 ; j++ )
				board[i][j] = 0 ;
		add ( 4 , 4 )	;	
		for ( i = 0 ; i < 9 ; i++ )
			for ( j = 0 ; j < 9 ; j++ )
				a[i][j] = board[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 a[5][9][9],i,j,k,l,m,n;
	scanf("%d%d",&m,&n);
	for(i=0;i<=n;i++)
	{
		for(j=0;j<9;j++)
		{
			for(k=0;k<9;k++)
				a[i][j][k]=0;
		}
	}
	a[0][4][4]=m;
	for(i=0;i<n;i++)
	{
		for(j=4-i;j<=4+i;j++)
		{
			for(k=4-i;k<=4+i;k++)
			{
				l=a[i][j][k];
				a[i+1][j-1][k-1]+=l;
				a[i+1][j-1][k]+=l;
				a[i+1][j-1][k+1]+=l;
				a[i+1][j][k-1]+=l;
				a[i+1][j][k]+=2*l;
				a[i+1][j][k+1]+=l;
				a[i+1][j+1][k-1]+=l;
				a[i+1][j+1][k]+=l;
				a[i+1][j+1][k+1]+=l;
			}
		}
	}
	for(i=0;i<9;i++)
	{
		for(j=0;j<8;j++)
			printf("%d ",a[n][i][j]);
		printf("%d\n",a[n][i][8]);
	}
	return 0;
}
//#include<stdlib.h>
//#include<math.h>
int main()
{
	int n,m;
	int i,j;
	int a[11][11];
	int b[11][11];
	for(i=0;i<11;i++) {
		for(j=0;j<11;j++){
			a[i][j]=0;
			b[i][j]=0;
		}
	}
	scanf("%d %d",&m,&n);
	a[5][5]=m;
	while(n--){
		for(i=1;i<10;i++){
			for(j=1;j<10;j++){
				b[i][j]=a[i][j]*2+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];
			}
		}
		for(i=1;i<10;i++){
			for(j=1;j<10;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;
}
//**************************************
//*???????????                     
//*????? 1100012780     	        
//*???2011.11.23                     
//**************************************

int m;//?????
int day;//??
int spread[9][9] = {0};

void bac(int n)
{
	int i,j;
	int produce[9][9] = {0};
	for (i = 0;i <= 8;i++)
		for (j = 0;j <= 8;j++)
		{
			if (spread[i][j] != 0)
			{
				produce[i][j] += 2 * spread[i][j];//???????????????
				produce[i - 1][j - 1] += spread[i][j];//???????
				produce[i - 1][j] += spread[i][j];
				produce[i - 1][j + 1] += spread[i][j];
				produce[i][j + 1] += spread[i][j];
				produce[i][j - 1] += spread[i][j];
				produce[i + 1][j - 1] += spread[i][j];
				produce[i + 1][j] += spread[i][j];
				produce[i + 1][j + 1] += spread[i][j];
			}
		}
	for (i = 0;i <= 8;i++)
		for (j = 0;j <= 8;j++)
			spread[i][j] = produce[i][j];
	if (n == day)//???????????
	{
		for (i = 0;i <= 8;i++)
		{
			for (j = 0;j <= 8;j++)
			{
				if (j != 8)
					cout<<spread[i][j]<<" ";
				else
					cout<<spread[i][j];
			}
			if (i != 8)
				cout<<endl;
		}
		return;
	}
	bac(n + 1);//?????
}		

int main()
{
	cin>>m>>day;
	spread[4][4] = m;
	bac(1);
	return 0;
}
int m, n, i, j;
int xijun[11][11] = {0};
int kuosan(int i, int j, int n);
int main()
{
    cin >> m >> n;
	for(i = 1; i <= 9; i++)
	{
		for(j = 1; j <= 9; j++)
		{
	       xijun[i][j] = kuosan(i, j, n);
		   if(j == 1)
		   {
		       cout << xijun[i][j];
		   }
	       if(j >= 2 && j <= 9)
		   {
			   cout << ' ' << xijun[i][j];
		   }
		}
		if(j == 10)
		{
			cout << endl;
		}
	}
	return 0;
}
int kuosan(int i, int j, int n)
{
	if(i == 5 && j == 5 && n == 0)
	{
		return m;
	}
	if(i == 5 && j == 5 && n < 0)
	{
		return 0;
	}
	if(!(i == 5 && j == 5) && n <= 0)
	{
		return 0;
	}
	else
	{
		return (kuosan(i, j, n - 1) * 2 + kuosan(i - 1, j - 1, n - 1) + kuosan(i - 1, j, n - 1) + kuosan(i, j - 1, n - 1)
			+ kuosan(i + 1, j, n - 1) + kuosan(i + 1, j + 1, n - 1) + kuosan(i, j + 1, n - 1) + kuosan(i + 1, j - 1, n - 1) 
			+ kuosan(i - 1, j + 1, n - 1));
	}
}
int board[9][9]={0};
int temp[9][9]={0};
void spread();
void turn();
int main()
{
    int zhongxin;
    cin >> zhongxin;
    board[4][4] = zhongxin;
    int days;
    cin >> days;
    int i,j;
    for (i=1;i<=days;i++)
    {
        spread();
        turn();
    } 
    for (i=0;i<9;i++)
    {
        cout << board[i][0];
        for (j=1;j<9;j++)
        {
            cout << " " << board[i][j] ;
        }
        cout << endl;
    }
    return 0;
}

void spread()
{
     int i,j;
        for (i=0;i<9;i++)
        {
            for (j=0;j<9;j++)
            {
                temp[i][j]+=2*board[i][j];
                if (i>0)
                {
                        temp[i-1][j]+=board[i][j];
                }
                if (j>0)
                {
                        temp[i][j-1]+=board[i][j];
                }
                if (i<8)
                {
                        temp[i+1][j]+=board[i][j];
                }
                if (j<8)
                {
                        temp[i][j+1]+=board[i][j];
                }
                if (i<8&&j<8)
                {
                        temp[i+1][j+1]+=board[i][j];
                }
                if (i<8&&j>0)
                {
                        temp[i+1][j-1]+=board[i][j];
                }
                if (i>0&&j<8)
                {
                        temp[i-1][j+1]+=board[i][j];
                }
                if (i>0&&j>0)
                {
                        temp[i-1][j-1]+=board[i][j];
                }
            }
        } 
}   
void turn()
{
     int i,j;
     for (i=0;i<9;i++)
     {
         for (j=0;j<9;j++)
         {
             board[i][j] = temp[i][j];
         }
     }  
     memset(temp, 0, sizeof(temp));
}
main()
{
    int *p[6];
    int day0[81],day1[81],day2[81],day3[81],day4[81],day5[81];
    p[0]=day0;
    p[1]=day1;
    p[2]=day2;
    p[3]=day3;
    p[4]=day4;
    p[5]=day5;
    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 main()
{
	int i,j,n,m,a[11][11]={0},b[11][11]={0};
	cin >> m >> n;
	a[5][5]=m;b[5][5]=m;
	while(n)
	{
		n--;
		for(i=1;i<10;i++)
		{
			for(j=1;j<10;j++)
			{
				if(a[i][j]>0)
				{
					b[i][j]+=a[i][j];
					b[i+1][j]+=1*a[i][j];
					b[i][j+1]+=1*a[i][j];
					b[i-1][j]+=1*a[i][j];
					b[i][j-1]+=1*a[i][j];
					b[i+1][j+1]+=1*a[i][j];
					b[i+1][j-1]+=1*a[i][j];
					b[i-1][j+1]+=1*a[i][j];
					b[i-1][j-1]+=1*a[i][j];
				}
			}
		}
		for(i=1;i<10;i++)
			for(j=1;j<10;j++)
			    a[i][j]=b[i][j];
	}
	for(i=1;i<10;i++)
	{
		for(j=1;j<9;j++)
			cout << a[i][j] << " ";
		cout << a[i][9] << endl;
	}
	return 0;
}
int main()
{
    int m, n, i, j, k, a[11][11], b[11][11];  //??????????10?????
    
    cin >> m >> n;
    
    for(i = 0;i <= 10;i++)
    {
          for(j = 0;j <= 10;j++)
          {
                a[i][j] = b[i][j] = 0;
          }
    }
    
    a[5][5] = b[5][5] = m;
    
    for(i = 1;i <= n;i++)
    {
          for(j = 1;j <= 9;j++)
          {
                for(k = 1;k <= 9;k++)
                {
                      a[j][k] = b[j][k] * 2 + b[j - 1][k - 1] + b[j - 1][k] + b[j - 1][k + 1] + b[j][k - 1] + b[j][k + 1] + b[j + 1][k - 1] + b[j + 1][k] + b[j + 1][k + 1];
                }
          }
          
          for(j = 1;j <= 9;j++)
          {
                for(k = 1;k <= 9;k++)
                {
                      b[j][k] = a[j][k];
                }
          }
    }
    
    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,area[9][9]={0},area1[9][9]={0};
	scanf("%d%d",&m,&n);
	area[4][4]=m;
	int i,j;

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

}