semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(int argc, char* argv[])
{
	int i,j,k,l,n,m,num,day;
	int a[9][9]={0},b[9][9]={0};
	scanf("%d%d",&num,&day);
    a[4][4]=num;
	for(i=0;i<day;i++)
	{
		memset(b,0,sizeof(b));
		for(j=1;j<8;j++)
			for(k=1;k<8;k++)
			{
				b[j][k]+=a[j][k];
				for(l=-1;l<=1;l++)
					for(m=-1;m<=1;m++)
						b[j+l][k+m]+=a[j][k];
			}
		memcpy(a,b,sizeof(a));
	}
	for(i=0;i<9;i++)
	{
		for(j=0;j<8;j++)
			printf("%d ",a[i][j]);
		printf("%d\n",a[i][8]);
	}
	return 0;
}
main()
{
      int m,n,i,j,k;
      struct xijun
      {
           int a[9][9];  
      }s[5];
      scanf("%d %d",&m,&n);
      for(i=0;i<9;i++)
      {
            for(j=0;j<9;j++)
            {
                   if(i==4&&j==4)
                       s[0].a[i][j]=m;
                   else
                       s[0].a[i][j]=0; 
            }          
      }
      for(k=1;k<=n;k++)
      {
          for(i=1;i<8;i++)
          {
                for(j=1;j<8;j++)
                {
                     s[k].a[i][j]=2*(s[k-1].a[i][j])+s[k-1].a[i-1][j-1]+s[k-1].a[i-1][j]+s[k-1].a[i-1][j+1]+s[k-1].a[i][j-1]+s[k-1].a[i][j+1]+s[k-1].a[i+1][j-1]+s[k-1].a[i+1][j]+s[k-1].a[i+1][j+1];        
                }          
          }
          s[k].a[0][0]=s[k-1].a[0][1]+s[k-1].a[1][0]+s[k-1].a[1][1];
          s[k].a[0][8]=s[k-1].a[0][7]+s[k-1].a[1][7]+s[k-1].a[1][8];
          s[k].a[8][0]=s[k-1].a[8][1]+s[k-1].a[7][0]+s[k-1].a[7][1];
          s[k].a[8][8]=s[k-1].a[8][7]+s[k-1].a[7][7]+s[k-1].a[7][8];
          for(i=1;i<8;i++)
          {
                s[k].a[0][i]=s[k-1].a[0][i-1]+s[k-1].a[0][i+1]+s[k-1].a[1][i-1]+s[k-1].a[1][i]+s[k-1].a[1][i+1];          
          }
          for(i=1;i<8;i++)
          {
                s[k].a[i][0]=s[k-1].a[i-1][0]+s[k-1].a[i+1][0]+s[k-1].a[i-1][1]+s[k-1].a[i][1]+s[k-1].a[i+1][1];          
          }
          for(i=1;i<8;i++)
          {
                s[k].a[8][i]=s[k-1].a[8][i-1]+s[k-1].a[8][i+1]+s[k-1].a[7][i-1]+s[k-1].a[7][i]+s[k-1].a[7][i+1];          
          }
          for(i=1;i<8;i++)
          {
                s[k].a[i][8]=s[k-1].a[i-1][8]+s[k-1].a[i+1][8]+s[k-1].a[i-1][7]+s[k-1].a[i][7]+s[k-1].a[i+1][7];          
          }             
      }
      for(i=0;i<8;i++)
      {
          for(j=0;j<8;j++)
          {
                printf("%d ",s[n].a[i][j]);          
          }
          printf("%d\n",s[n].a[i][8]);            
      }
      for(i=0;i<8;i++)
      {
          printf("%d ",s[n].a[8][i]);            
      }
      printf("%d",s[n].a[8][8]);
    
}
int f(int,int);
int main()
{
	int m,n,i,j;
	cin>>m>>n;
	int a[9][9]={0,0};
	if (n==1)
		{a[4][4]=2*m;
	     a[4][3]=a[4][5]=m;
		 for (i=3;i<=5;i++)
		    a[3][i]=a[5][i]=m;}
	if (n==2)
	{   a[4][4]=12*m;
	   a[2][2]=a[2][6]=a[6][2]=a[6][6]=m;
	   a[2][3]=a[2][5]=a[3][2]=a[3][6]=a[5][2]=a[5][6]=a[6][3]=a[6][5]=2*m;
	   a[2][4]=a[4][2]=a[6][4]=a[4][6]=3*m;
	   a[3][3]=a[3][5]=a[5][3]=a[5][5]=6*m;
	   a[3][4]=a[5][4]=a[4][3]=a[4][5]=8*m;
	   a[4][4]=12*m;
	 }
	if (n==3)
	{ a[4][4]=80*m;
	a[3][3]=a[3][5]=a[5][3]=a[5][5]=51*m;
	a[4][3]=a[4][5]=a[3][4]=a[5][4]=63*m;
	a[2][2]=a[2][6]=a[6][2]=a[6][6]=12*m;
	a[3][2]=a[5][2]=a[2][3]=a[2][5]=a[3][6]=a[5][6]=a[6][3]=a[6][5]=24*m;
	a[2][4]=a[6][4]=a[4][2]=a[4][6]=30*m;
	a[1][1]=a[1][7]=a[7][1]=a[7][7]=m;
	a[1][2]=a[1][6]=a[7][2]=a[7][6]=3*m;a[1][3]=a[1][5]=a[7][3]=a[7][5]=6*m;a[1][4]=a[7][4]=7*m;
	a[2][1]=a[6][1]=a[2][7]=a[6][7]=3*m;
	a[3][1]=a[5][1]=a[3][7]=a[5][7]=6*m;
	a[4][1]=a[4][7]=7*m;
	}
	if (n==4)
	{
		a[4][4]=616*m;
		a[4][3]=a[4][5]=a[3][4]=a[5][4]=512*m;
		a[3][3]=a[3][5]=a[5][3]=a[5][5]=428*m;
		a[2][2]=a[2][6]=a[6][2]=a[6][6]=142*m;
		a[2][3]=a[2][5]=a[3][2]=a[3][6]=a[5][2]=a[5][6]=a[6][3]=a[6][5]=244*m;
		a[4][2]=a[4][6]=a[2][4]=a[6][4]=292*m;
		a[1][1]=a[1][7]=a[7][1]=a[7][7]=20*m;
		a[1][2]=a[1][6]=a[2][1]=a[5][1]=a[2][7]=a[5][7]=52*m;
		a[6][1]=a[6][7]=a[7][2]=a[7][6]=52*m;
		a[1][3]=a[1][5]=a[3][1]=a[5][1]=a[7][3]=a[7][5]=a[3][7]=a[5][7]=88*m;
		a[1][4]=a[7][4]=a[4][1]=a[4][7]=104*m;
		a[0][0]=a[0][8]=a[8][0]=a[8][8]=m;
		a[0][1]=a[0][7]=a[8][1]=a[8][7]=4*m;
		a[0][2]=a[0][6]=a[8][2]=a[8][6]=10*m;
		a[0][3]=a[0][5]=a[8][3]=a[8][5]=16*m;
		a[0][4]=a[8][4]=a[4][0]=a[4][8]=19*m;
		a[1][0]=a[1][8]=a[7][0]=a[7][8]=4*m;
		a[2][0]=a[2][8]=a[6][0]=a[6][8]=10*m;
		a[3][0]=a[5][0]=a[3][8]=a[5][8]=16*m;
	}for (i=0;i<9;i++)
		{for (j=0;j<8;j++)
			cout<<a[i][j]<<" ";
	        cout<<a[i][8]<<endl;}
return 0;
}
//****************************
//**Title: ???????? **
//**Author:???1300017687 **
//**Date?2013.12.5         **
//**File?2.cpp             **
//****************************

int first;						//????????????
int findbat(int i, int j, int days)	//????????days??i?j???????
{
	if ((i == -1) || (i == 9) || (j == -1) || (j == 9))	//??????
		return 0;				//????0
	if (days == 0)				//??days?0
	{
		if (i == 4 && j == 4)	//???????
			return first;		
		else
			return 0;
	}
	else
		return findbat(i - 1, j - 1, days - 1) + findbat(i - 1, j , days - 1) + findbat(i - 1, j + 1, days - 1)
			+  findbat(i , j - 1 , days - 1) + 2 * findbat(i , j ,days - 1) + findbat(i, j + 1,days - 1 )
			+  findbat(i + 1, j - 1, days - 1) + findbat(i + 1, j , days - 1) + findbat (i + 1, j + 1, days - 1);	//????
}
int main()
{
	int days;						//??
	cin >> first >> days;

	for (int i = 0 ; i <= 8 ; i++)		//?????????
	{
		cout << findbat(i,0,days);
		for(int j = 1; j <= 8 ; j++)
			cout << ' ' << findbat(i,j,days);
		cout << endl;
	}
	return 0;
}
int main()
{
    int t,i,j,n,k,a[5][9][9];

    scanf("%d%d",&n,&k);
    for(t=0;t<k+1;t++)
    {
         for(i=0;i<9;i++)
            {
                for(j=0;j<9;j++)
                    {
                        a[t][i][j]=0;
                    }
            }
    }
    a[0][4][4]=n;

    for(t=0;t<k;t++)
    {
          for(i=1;i<8;i++)
            {
                for(j=1;j<8;j++)
                    {
                        a[t+1][i][j]+=a[t][i][j]*2;
                        a[t+1][i+1][j]+=a[t][i][j];
                        a[t+1][i-1][j]+=a[t][i][j];
                        a[t+1][i+1][j+1]+=a[t][i][j];
                        a[t+1][i-1][j-1]+=a[t][i][j];
                        a[t+1][i][j+1]+=a[t][i][j];
                        a[t+1][i][j-1]+=a[t][i][j];
                        a[t+1][i+1][j-1]+=a[t][i][j];
                        a[t+1][i-1][j+1]+=a[t][i][j];
                    }
            }
    }

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

int main()
{
	int m;
	cin >> m >> n;
	b[5][5] = m;
	fanzhi(1);

	for (int i = 1; i < 10; i++)
	{
		cout << a[i][1];
		for (int j = 2; j < 10; j++)
		{
			cout << ' ' << a[i][j];
		}
		cout << endl;
	}
	return 0;
}

void fanzhi(int day)
{
	if (day == n + 1)
	{
		return;
	}
	else
	{
		int i, j;
		memset(a, 0, sizeof(a));
		for (i = 1; i < 10; i++)
		{
			for (j = 1; j < 10; j++)
			{
				if (b[i][j] != 0)
				{
					a[i][j] += 2 * b[i][j];
					if(i > 1 && j > 1)
						a[i - 1][j - 1] += b[i][j];
					if(i > 1)
						a[i - 1][j] += b[i][j];
					if(i > 1 && j < 9)
						a[i - 1][j + 1] += b[i][j];
					if(j < 9)
						a[i][j + 1] += b[i][j];
					if(j < 9 && i < 9)
						a[i + 1][j + 1] += b[i][j];
					if(i < 9)
						a[i + 1][j] += b[i][j];
					if(i < 9 && j > 1)
						a[i + 1][j - 1] += b[i][j];
					if(j > 1)
						a[i][j - 1] += b[i][j];
				}
			}
		}
		for (i = 1; i < 9; i++)
		{
			for (j = 1; j < 9; j++)
			{
				b[i][j] = a[i][j];
			}
		}
		fanzhi(day + 1);
	}
}
/**
 * @file   2.cpp
 * @author 3&#194;&#203;&#188;&#189;ü
 * @date   2013-12-04
 * @description
 *         &#188;&#198;&#203;&#227;&#184;&#197;&#194;&#219;×÷ò??oàyìa(11.8) &#207;&#184;&#190;ú?&#196;·±&#214;3ó&#235;à&#169;é?
 */


int a[10][10];
void func(int day);

int main()
{
	int day;
	cin >> a[5][5] >> day;

	func(day);

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

void func(int day)
{
	if (day == 0) return;
	int b[10][10] = {0};
	for (int i = 1; i <= 9; ++i)
		for (int j = 1; j <= 9; ++j)
			if (a[i][j])
			{
				b[i][j] += a[i][j];
				for (int p = i - 1; p <= i + 1; ++p)
					for (int q = j - 1; q <= j + 1; ++q)
						b[p][q] += a[i][j];
			}

	for (int i = 1; i <= 9; ++i)
		for (int j = 1; j <= 9; ++j)
			a[i][j] = b[i][j];

	func(day - 1);
}
int pool[11][11][2]={0}; //????????????????????? 

void breed(int j,int k)    //?????????????
{pool[j][k][1]+=2*pool[j][k][0];
 pool[j-1][k-1][1]+=pool[j][k][0];
 pool[j+1][k][1]+=pool[j][k][0];
 pool[j-1][k][1]+=pool[j][k][0];
 pool[j][k+1][1]+=pool[j][k][0];
 pool[j][k-1][1]+=pool[j][k][0];
 pool[j+1][k+1][1]+=pool[j][k][0];
 pool[j+1][k-1][1]+=pool[j][k][0];
 pool[j-1][k+1][1]+=pool[j][k][0];
 pool[j][k][0]=0;}


int main()
{
 int m,n,i,j,k;
 cin>>m>>n;
 pool[5][5][0]=m;
 for(i=0;i<n;i++)
     {for(j=1;j<10;j++) for(k=1;k<10;k++) breed(j,k);
      for(j=1;j<10;j++) for(k=1;k<10;k++) pool[j][k][0]=pool[j][k][1];    //???? 
      for(j=1;j<10;j++) for(k=1;k<10;k++) pool[j][k][1]=0;                //???? 
      
                 }
 for(j=1;j<10;j++) {for(k=1;k<9;k++) cout<<pool[j][k][0]<<" "; cout<<pool[j][9][0]<<endl;}
 return 0;
    }
int main()
{
   int a[12][12]={0},b[12][12]={0};
   int i,j,k,f,t,m,n;
   scanf("%d %d",&m,&n);
   a[5][5]=m;
   for(k=0;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(t=1;t<=9;t++)
       for(f=1;f<=9;f++)
       a[t][f]=b[t][f];
   }
   for(i=1;i<=9;i++)
   for(j=1;j<=9;j++)
   {
     if(j<=8)
     printf("%d ",a[i][j]);
     else
     printf("%d\n",a[i][j]);
   }
   
}
main()
{int a[9][9]={0};
 int b[9][9];
 int p,q,i,j,k,m,n,e,f,l;
 scanf("%d %d",&m,&n);
 a[4][4]=m;
for(l=0;l<n;l++)
{   for(i=0;i<9;i++)
       for(j=0;j<9;j++)
         b[i][j]=0;
    for(i=1;i<8;i++)
     {for(j=1;j<8;j++)
        {b[i][j]+=a[i][j];
           for(p=-1;p<2;p++)
             {for(q=-1;q<2;q++)
             b[i+p][j+q]+=a[i][j];}
        }
      }
   for(e=0;e<9;e++)    
     {for(f=0;f<9;f++)
      a[e][f]=b[e][f];
     }
}
 
 for(i=0;i<9;i++)
  {for(j=0;j<9;j++)
   {if(j<8) {printf("%d",a[i][j]);printf(" ");}
    else if(j==8) {printf("%d",a[i][j]);printf("\n");}
   }
  }
 
}
int main()
{
	int m,n,i,j,k;
	int now[11][11],pre[11][11];
	for(i=0;i<=10;i++)
	{
		for(j=0;j<=10;j++)
		{
			now[i][j]=0;
		}
	}
	cin>>m>>n;
	now[5][5]=m;
	for(i=1;i<=n;i++)
	{
		for(j=0;j<=10;j++)
		{
			for(k=0;k<=10;k++)
			{
				pre[j][k]=0;
			}
		}
		for(j=1;j<=9;j++)
		{
			for(k=1;k<=9;k++)
			{
				pre[j-1][k-1]+=now[j][k];
				pre[j][k-1]+=now[j][k];
				pre[j+1][k-1]+=now[j][k];
				pre[j-1][k]+=now[j][k];
				pre[j+1][k]+=now[j][k];
				pre[j-1][k+1]+=now[j][k];
				pre[j][k+1]+=now[j][k];
				pre[j+1][k+1]+=now[j][k];
				pre[j][k]+=2*now[j][k];
			}
		}
		for(j=1;j<=9;j++)
		{
			for(k=1;k<=9;k++)
			{
				now[j][k]=pre[j][k];
			}
		}
	}
	for(i=1;i<=9;i++)
	{
		for(j=1;j<=8;j++)
		{
			cout<<now[i][j]<<" ";
		}
		cout<<now[i][9]<<endl;
	}
	return 0;
}
int main()
{
	int f(int a,int k);
	int a[11][11]={0},b[11][11]={0};
	int i,j,m,n,t;
	scanf("%d %d",&m,&n);
	a[5][5]=m;
	for(t=1;t<=n;t++)
	{
		for(i=0;i<11;i++)
		{
			for(j=0;j<11;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++)
			printf("%d ",a[i][j]);
        if(j==9)
			printf("%d\n",a[i][j]);
	}
	return 0;
	
}
void main()
{
	int i,j,k,m,n;
	int p,q;
	int a[5][9][9]={0};
	scanf("%d%d",&m,&n);
	a[0][4][4]=m;
	for(i=1;i<=n;i++)
	{
		for(j=0;j<9;j++)
		{
			for(k=0;k<9;k++)
			{
				if(a[i-1][j][k]!=0)
				{
					a[i][j][k]+=a[i-1][j][k];
					for(p=j-1;p<=j+1;p++)
					{
						for(q=k-1;q<=k+1;q++)
						{
							a[i][p][q]=a[i][p][q]+a[i-1][j][k];
						}
					}
				}
			}
		}
      

	}

	for(j=0;j<9;j++)
	{
		printf("%d",a[n][j][0]);
		for(k=1;k<9;k++)
		{
			printf(" %d",a[n][j][k]);
		}
		printf("\n");
	}
}
int main(){
	static int a[10][20][20],n;
	cin>>a[0][5][5]>>n;
	//????????????????????
	for(int i=1;i<=n;i++){
		for(int x=1;x<=9;x++)
			for(int y=1;y<=9;y++){
				a[i][x+1][y+1]+=a[i-1][x][y];
				a[i][x+1][y]+=a[i-1][x][y];
				a[i][x+1][y-1]+=a[i-1][x][y];
				a[i][x-1][y+1]+=a[i-1][x][y];
				a[i][x-1][y]+=a[i-1][x][y];
				a[i][x-1][y-1]+=a[i-1][x][y];
				a[i][x][y+1]+=a[i-1][x][y];
				a[i][x][y-1]+=a[i-1][x][y];
				a[i][x][y]+=2*a[i-1][x][y];
			}
	}
	//??
	for(int x=1;x<=9;x++){
		for(int y=1;y<=9;y++){
			if(y>1)cout<<" ";
			cout<<a[n][x][y];
		}
		cout<<endl;
	}
	//cin>>n;
	return 0;
}
int num[9][9] = {0};  //????????
int m;
int f(int a, int b, int day)
{
	if ((a == 4) && (b == 4) && (day == 0))
		return m;   //??????m?	
	else if ((day == 0) && (a >= 0) && (a <= 8) && (b >= 0) && (b <= 8))
		return 0;   //???????
	else if ((a < 0) || (a > 8) || (b < 0) || (b > 8))
		return 0;   //??????
	else 
		return f(a - 1, b, day - 1) + f(a + 1, b, day - 1) + f(a, b - 1, day - 1)
				+ f(a, b + 1, day - 1) + f(a - 1, b - 1, day - 1) + f(a + 1, b - 1, day - 1)
				+f(a - 1, b + 1, day - 1) + f(a + 1, b + 1, day - 1) + 2 * f(a, b, day - 1);
	//??????!!????????????????????,??????????,?????????????????????
}
int main()
{
	int day, i, j;
	cin >> m >> day;
	for (i = 0; i < 9; i++)
	{
		for (j = 0; j < 9; j++)
		{
			num[i][j] = f(i, j, day);
		}
	}
	for (i = 0; i < 9; i++)
	{
		for (j = 0; j < 9; j++)
		{
			if (j == 8)
			{
				cout << num[i][j] << endl;
			}
			else
			{
				cout << num[i][j] << ' ';//????
			}
		}
	}
	return 0;
}
int main()
{
	int baci[5][9][9]={0};
	int count,days,i,j,k;
	cin>>count>>days;
	baci[0][4][4]=count;
	for(i=0;i<days;i++)
		for(j=0;j<9;j++)
			for(k=0;k<9;k++)
			{
				if(baci[i][j][k]!=0)
				{
					int n=baci[i][j][k];
					baci[i+1][j][k]+=2*n;
					baci[i+1][j-1][k]+=n;
					baci[i+1][j+1][k]+=n;
					baci[i+1][j][k-1]+=n;
					baci[i+1][j][k+1]+=n;
					baci[i+1][j-1][k-1]+=n;
					baci[i+1][j-1][k+1]+=n;
					baci[i+1][j+1][k-1]+=n;
					baci[i+1][j+1][k+1]+=n;				
				}
			}
	for(j=0;j<9;j++)
	{
		cout<<baci[days][j][0];
		for(k=1;k<9;k++)
			cout<<' '<<baci[days][j][k];
		cout<<endl;
	}
	return 0;
}
int a[9][9],b[9][9];
int main()
{
	int m,n,i,j,k,x,y;
	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++)
			{
				b[j][k]=0;
	             for( x=j-1;x<=j+1;x++)
					 for( y=k-1;y<=k+1;y++)
						 if(x>=0&&x<9&&y>=0&&y<9)
							 b[j][k]+=a[x][y];
				 b[j][k]+=a[j][k];
			}
		for(j=0;j<9;j++)
			for(k=0;k<9;k++)
				a[j][k]=b[j][k];
	}
	for(i=0;i<9;i++)
	{
		for(j=0;j<8;j++)
			cout<<a[i][j]<<" ";
		cout<<a[i][j]<<endl;
	}
	return 0;
}
int a[10][10][5];

int k,i,j,l,n;

int main(){
    for(i=0;i<5;i++)
    for(j=1;j<10;j++)
    for(k=1;k<10;k++)
    a[j][k][i]=0;
    
    scanf("%d%d",&n,&k);
    a[5][5][0]=n;
    
    for(l=0;l<k;l++)
    for(i=1;i<10;i++)
    for(j=1;j<10;j++){
        if(a[i][j][l]!=0){
            a[i][j][l+1]+=2*a[i][j][l];
            a[i-1][j-1][l+1]+=a[i][j][l];
            a[i-1][j][l+1]+=a[i][j][l];
            a[i-1][j+1][l+1]+=a[i][j][l];
            a[i][j-1][l+1]+=a[i][j][l];
            a[i][j+1][l+1]+=a[i][j][l];
            a[i+1][j-1][l+1]+=a[i][j][l];
            a[i+1][j][l+1]+=a[i][j][l];
            a[i+1][j+1][l+1]+=a[i][j][l];
        }
    }
    
    for(i=1;i<=9;i++){
      for(j=1;j<9;j++){
        printf("%d ",a[i][j][k]);
      }
      printf("%d\n",a[i][9][k]);
    }

    scanf("%d",&n);
return 0;
}
main()
{
	int num,day,i,j,k,p,q;
	scanf("%d %d",&num,&day);
	int min[11][11];
	int temp[11][11];
	for(i=0;i<11;i++)
	{
		for(j=0;j<11;j++) 
		min[i][j]=0;
	}	
	min[5][5]=num;
	for(k=1;k<=day;k++)
	{
	for(p=0;p<11;p++)
	{
		for(q=0;q<11;q++) 
		temp[p][q]=min[p][q];
	}	
	for(i=1;i<10;i++)
	{
		for(j=1;j<10;j++)
		min[i][j]=2*temp[i][j]+temp[i+1][j]+temp[i][j+1]+temp[i-1][j]+temp[i][j-1]+temp[i+1][j+1]+temp[i-1][j+1]+temp[i-1][j-1]+temp[i+1][j-1];
	}
	}
    for(i=1;i<10;i++)
	{
		for(j=1;j<10;j++)
		{
			if(j!=9)
			printf("%d ",min[i][j]);
			else printf("%d",min[i][j]);
		}
		printf("\n");
	}
}
/**
* @file homework.cpp
* @author ???
* @date 2010-11-24
* @description
* ??????: ????????
*/
int a[11][11] = {0}, k;
void f(int a[][11]);
int main()
{
    int m, n;
    cin >> m >> n;
    k = n;
    a[5][5] = m;
    f(a);
    return 0;
}

void f(int c[][11])
{
    int s, t, b[11][11];
    for(t = 0;t < 121;t++)
    {
        b[t / 11][t % 11] = *(*a + t);
    }
    for(s = 1;s < 10;s++)
    {
        for(t = 1;t < 10;t++)
        {
            a[s][t] = 2 * b[s][t] + b[s][t - 1] + b[s][t + 1] + 
                      b[s - 1][t] + b[s - 1][t - 1] + b[s - 1][t + 1] +
                      b[s + 1][t] + b[s + 1][t - 1] + b[s + 1][t + 1];
        }
    }
    cout << endl;
    if(k > 1)
    {
        k--;
        f(a);
    }
    if(k == 1)
    {
        for(s = 1;s < 10;s++)
        {
            for(t = 1;t < 9;t++)
            {
                cout << a[s][t] << " ";
            }
            cout << a[s][9] << endl;
        }
        k--;
    }
}
void birth(int day, int num);
int cnt = 0;
int a[10][10] = {0}, spread[10][10] = {0};
int main()
{
	int m, n;
	cin >> m >> n;                                   //??
	a[4][4] = m;
	birth(n,m);                                      //birth???????????
	for ( int y = 0; y <= 8; y++ )
	{
		for ( int o = 0; o <= 7; o++ )               //????
			cout << a[y][o] << " ";
		cout << a[y][8] << endl;
	}
	return 0;
}

void birth(int day, int num)
{
	cnt++;
	if ( cnt > day )                              //???????????
		return;

	for ( int i = 0; i <= 8; i++ )                //?????????????spread???????????
	{
		for ( int j = 0; j <= 8; j++ )
		{
			spread[i][j] = a[i][j];
			a[i][j] = a[i][j] * 2;
		}
	}
	for ( int k = 0; k <= 8; k++ )
	{
		for ( int l = 0; l <= 8; l++ )
		{
			a[k - 1][l] = a[k - 1][l] + spread[k][l];         //????8????
			a[k + 1][l] = a[k + 1][l] + spread[k][l];
			a[k][l - 1] = a[k][l - 1] + spread[k][l];
			a[k][l + 1] = a[k][l + 1] + spread[k][l];
			a[k - 1][l - 1] = a[k - 1][l - 1] + spread[k][l];
			a[k - 1][l + 1] = a[k - 1][l + 1] + spread[k][l];
			a[k + 1][l - 1] = a[k + 1][l - 1] + spread[k][l];
			a[k + 1][l + 1] = a[k + 1][l + 1] + spread[k][l];
		}
	}

	birth(day, num);                                        //??
}
int main(){
	int m,n;
	scanf("%d%d",&m,&n);
	int a[11][11]={0};
	
	a[5][5]=m;
	int r,i,j,i1,j1;
	for(r=0;r<n;r++){
		int b[11][11]={0};
		for(i=1;i<=9;i++){
			for(j=1;j<=9;j++){
				if(a[i][j]!=0){
					for(i1=i-1;i1<=i+1;i1++){
						for(j1=j-1;j1<=j+1;j1++){
							b[i1][j1]+=a[i][j];
						}
					}
				}
			}
		}
		for(i1=1;i1<=9;i1++){
			for(j1=1;j1<=9;j1++){
				a[i1][j1]+=b[i1][j1];
			}
		}
	}
	for(i=1;i<=9;i++){
		for(j=1;j<=9;j++){
			printf("%d",a[i][j]);
			if(j!=9)
				printf(" ");
			else
				printf("\n");
		}
	}
}
int vir[11][11] = {0}, m, n, b[11][11], i = 0, j = 0;

int num(int, int, int);


int main()
{
	int t;
	
	cin >> m >> n;
	vir[5][5] = m;
	for (i = 1; i < 10; i++)
	{
		for (j = 1; j < 10; j++)
		{
			b[i][j] = num(n, i ,j );
		}
	}
	for (i = 1; i < 10; i++)
	{
		for (j = 1; j < 9; j++)
		{
			cout << b[i][j] << " ";
		}
		cout << b[i][9] << endl;
	}
	cin >> i;
	return 0;
}

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

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


getchar ();getchar ();


}
int cell[15][15][2]={0};
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int sur(int x,int y){
	if (x==1 && y==1 || x==1 && y==9 || x==9 && y==1 || x==9 && y==9)
		return cell[x][y][0]*8/3;
	else if (x==1 || y==1 || x==9 || y==9)
		return cell[x][y][0]*8/5;
	else return cell[x][y][0];
}

void fer (int day){
	for (int d=1;d<=day;d++){
		for (int i=1;i<=9;i++)
			for (int j=1;j<=9;j++){
				if (cell[i][j][0] != 0){
					cell[i][j][1] += cell[i][j][0];
					for (int k=0;k<8;k++){
						int x = i + dx[k], y = j + dy[k];
						if (x>=1 && x<=9 && y>=1 && y<=9)
							cell[x][y][1] += sur(i,j);
					}
				}
			}
		for (int i=1;i<=9;i++)
			for (int j=1;j<=9;j++)
				cell[i][j][0] = cell[i][j][1];
	}
}



void draw(){
	for (int i=1;i<=9;i++){
		for (int j=1;j<=8;j++)
			cout<<cell[i][j][0]<<" ";
		cout<<cell[i][9][0]<<endl;
	}
}

int main ()
{
	int num,day;
	cin>>num>>day;
	cell[5][5][0] = num;
	cell[5][5][1] = num;
	fer(day);
	draw();
	return 0;
}
int a[9][9]={0},b[9][9]={0};
int s(int n)
{
	memset(b,0,sizeof(b));
	if(n==0)
	{
		for(int i=0;i<=8;i++)
		{
			for(int j=0;j<=8;j++)
			{
				cout<<a[i][j];
				if(j!=8)
				{
					cout<<" ";
                                       }
			}
			cout<<endl;
		}
	}
	else
	{
		for(int i=0;i<=8;i++)
		{
			for(int j=0;j<=8;j++)
			{
				if(a[i][j]!=0)
				{
					b[i][j]=b[i][j]+2*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]=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]=b[i-1][j]+a[i][j];
					b[i-1][j-1]=b[i-1][j-1]+a[i][j];
				}
			}
		}
		for(int i=0;i<=8;i++)
		{
			for(int j=0;j<=8;j++)
			{
				a[i][j]=b[i][j];
			}
		}
		return s(n-1);
	}
}
int main()
{
	int m, n;
	cin >> m >> n;
	a[4][4]=m;
	s(n);
	return 0;
}