semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int c[2][11][11] = {0}, i, j, k;
	int m, n;
	cin >> m >> n;
	c[0][5][5] = m;
	for (k = 0; k <= n - 1; k++)
	{
		memset(c[(k+1)%2], 0, 11*11*4);
	    for (i = 1; i <= 9; i++)
		{
		    for (j = 1; j <= 9; j++)
			{
			    if (c[k%2][i][j] != 0)
				{
					c[(k+1)%2][i][j] += 2 * c[k%2][i][j];
					c[(k+1)%2][i+1][j] += c[k%2][i][j];
						c[(k+1)%2][i-1][j] += c[k%2][i][j];
						c[(k+1)%2][i][j+1] += c[k%2][i][j];
						c[(k+1)%2][i][j-1] += c[k%2][i][j];
						c[(k+1)%2][i+1][j+1] += c[k%2][i][j];
						c[(k+1)%2][i-1][j-1] += c[k%2][i][j];
						c[(k+1)%2][i+1][j-1] += c[k%2][i][j];
						c[(k+1)%2][i-1][j+1] += c[k%2][i][j];
				}
			}
		}
	}
	for (i = 1; i <= 9; i++)
	{
		for (j = 1; j <= 9; j++)
		{
			cout << c[n%2][i][j];
			
			if (j == 9)
			{
				cout << endl;
			}
			else
			{
				cout << " ";
			}
		}
	
	}
	return 0;
}
int main()
{
    int a[9][9]={{0}};
    int b[9][9];
    int m,n,w,i,j,c;
    scanf("%d %d",&m,&n);
    a[4][4]=m;
    for(w=1;w<=n;w++)
    {
        for(i=1;i<=9;i++)
        for(j=1;j<=9;j++)
        b[i-1][j-1]=0;
        for(i=1;i<=9;i++)
        for(j=1;j<=9;j++)
        {
            c=a[i-1][j-1];
            if(c!=0)
            {
                b[i-2][j-2]=b[i-2][j-2]+c;
                b[i-2][j-1]=b[i-2][j-1]+c;
                b[i-2][j]=b[i-2][j]+c;
                b[i-1][j-2]=b[i-1][j-2]+c;
                b[i-1][j]=b[i-1][j]+c;
                b[i][j-2]=b[i][j-2]+c;
                b[i][j-1]=b[i][j-1]+c;
                b[i][j]=b[i][j]+c;
                b[i-1][j-1]=b[i-1][j-1]+c;
            }
        }
        for(i=1;i<=9;i++)
        for(j=1;j<=9;j++)
        a[i-1][j-1]=a[i-1][j-1]+b[i-1][j-1];
    }
    for(i=1;i<=9;i++)
    {
        for(j=1;j<=8;j++)
        printf("%d ",a[i-1][j-1]);
        printf("%d\n",a[i-1][8]);
    }
    return 0;
}
/************************************
1.cpp
???2011-11-23
??(11.8) ????????
?? 1100012886
************************************/

//??????????????????
int main()
{
	int i, j, i1, j1, n, n1 = 0, m;
	int sperm[9][9] = {0}, temp[9][9]; //??????????????????????????????????
	cin >> m >> n;
	sperm[4][4] = m;
	do
	{
		n1++; //n1?????
		for (i = 0; i <= 8; i++)
		{
			for (j = 0; j <= 8; j++)
			{
				temp[i][j] = 0;
			}
		} //?temp????
		for (i = 5 - n1; i <= 3 + n1; i++)
		{
			for (j = 5 - n1; j <= 3 + n1; j++)
			{
				//?????????????n1??????
				for (i1 = i - 1; i1 <= i + 1; i1++)
				{
					for (j1 = j - 1; j1 <= j + 1; j1++)
					{
						temp[i1][j1] = temp[i1][j1] + sperm[i][j]; //?????????temp
					}
				}
			}
		}
		for (i = 0; i <= 8; i++)
		{
			for (j = 0; j <= 8; j++)
			{
				sperm[i][j] = sperm[i][j] + temp[i][j];
			}
		} //??
	} while (n1 < n);
	for (i = 0; i <= 8; i++)
	{
		for (j = 0; j <= 8; j++)
		{
			cout << sperm[i][j];
			if (j < 8) cout << " ";
		}
		cout << endl;
	} //??
	return 0;
}
//*************************************************
//*3ìDò?oàyìa(11.8) &#207;&#184;&#190;ú?&#196;·±&#214;3ó&#235;à&#169;é?              *
//*D&#213;&#195;&#251;?oo&#206;&#212;&#198;&#198;e                                   *
//*&#209;§o&#197;?o1300012888                               *
//*è&#213;&#198;ú?o2013.12.9                                *
//*************************************************

void change(int a,int area[][11],int area0[][11])
{
	int i, j;
	if(a == 0)
		return;
	else
	{
		for(i = 1;i <= 9;i ++)
		{
	    	for(j = 1;j <= 9;j ++)
		    	area0[i][j] = area[i][j];
		}
		for(i = 1;i <= 9;i ++)
		{
	    	for(j = 1;j <= 9;j ++)
			{
		    	area0[i][j] += area[i][j];
				area0[i - 1][j] += area[i][j];
				area0[i + 1][j] += area[i][j];
				area0[i][j - 1] += area[i][j];
				area0[i][j + 1] += area[i][j];
				area0[i + 1][j + 1] += area[i][j];
				area0[i - 1][j - 1] += area[i][j];
				area0[i + 1][j - 1] += area[i][j];
				area0[i - 1][j + 1] += area[i][j];
			}
		}
		for(i = 1;i <= 9;i ++)
		{
	    	for(j = 1;j <= 9;j ++)
		    	area[i][j] = area0[i][j];
		}
		change(a - 1,area,area0);
	}
}

int main()
{
	int area[11][11], area0[11][11], i, j;
	int num, day;

	cin >> num >> day;
	memset(area, 0, sizeof(area));
	memset(area0, 0, sizeof(area0));
	area[5][5] = num;
	change(day, area, area0);
	for(i = 1;i <= 9;i ++)
	{
		for(j = 1;j <= 9;j ++)
		{
			if(j == 1)
				cout << area[i][j];
			else
			    cout << " " << area[i][j];
		}
		cout << endl;
	}

	return 0;
}
int main()
{
	int m, n, i, j, a[10][10] = {0}, k, b[10][10] = {0};
	cin >> m >> n;
	a[5][5] = m;
	for (k = 1; k <= n; k++)
	{
		for (i = 1; i <= 9; i++)
		{
			for (j = 1; 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] += 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 + 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];
		memset(b, 0, sizeof(b));
	}
	for (i = 1; i <= 9; i++)
	{
		for (j = 1; j <= 8; j++)
			cout << a[i][j] << ' ';
		cout << a[i][9] << endl;
	}
    return 0;
}
main()
{
      int i,j,m,n,d;
      scanf("%d %d",&m,&n);
      int a[11][11][6];
      for(d=0;d<=n;d++)
      {
      for(i=0;i<11;i++)
      {
      for(j=0;j<11;j++)
      {
                       a[i][j][d]=0;
      }
      }
      }
      a[5][5][0]=m;
      for(d=1;d<=n;d++)
      {
                       for(i=1;i<=9;i++)
                       {
                       for(j=1;j<=9;j++)
                       {
                       a[i][j][d]=2*a[i][j][d-1]+
                       a[i-1][j-1][d-1]+a[i-1][j][d-1]+
                       a[i-1][j+1][d-1]+a[i][j-1][d-1]+
                       a[i][j+1][d-1]+a[i+1][j-1][d-1]+
                       a[i+1][j][d-1]+a[i+1][j+1][d-1];
                       }
                       }
      }
      for(i=1;i<=9;i++)
      {
      for(j=1;j<9;j++)
      printf("%d ",a[i][j][n]);
      printf("%d\n",a[i][9][n]);
      }
      getchar();
      getchar();
      }
main()
{
     int n,m,i,j,l,k;
     int s[10][10];
     int a[10][10];
     scanf("%d %d",&n,&k);
    
     for (i=1;i<=9;i++)
     for (j=1;j<=9;j++)
     {
     a[i][j]=0;
     s[i][j]=0;
     }
      s[5][5]=n;a[5][5]=n;
     for (l=1;l<=k;l++)
     {
     for (i=1;i<=9;i++)
     for (j=1;j<=9;j++)
      if (s[i][j]>0) 
      {
       a[i][j]+=s[i][j];
       a[i-1][j-1]+=s[i][j];
       a[i][j-1]+=s[i][j];
       a[i-1][j]+=s[i][j];
       a[i+1][j-1]+=s[i][j];
       a[i-1][j+1]+=s[i][j];
       a[i+1][j]+=s[i][j];
       a[i][j+1]+=s[i][j];
       a[i+1][j+1]+=s[i][j];
       }
     for (i=1;i<=9;i++)
     for (j=1;j<=9;j++)
     s[i][j]=a[i][j];  
     }
     for (i=1;i<=9;i++)
     {
     for (j=1;j<=8;j++)
     printf("%d ",a[i][j]);
     printf("%d\n",a[i][9]);
     }
  
}
//*******************************************
//** ???Dec 3, 2013 - ????????  **
//** ?????? 1300012719               **
//** ???2013.12.06                      **
//*******************************************
int bacnum(int x, int y, int day, int bacteria[9][9])    //??????????????????,?????????=??????????*2+???????????
{
	int temp = 0;
	if (day == 0)                                        //???0????????????,?????????
		return bacteria[x][y];
	temp = temp + 2 * bacnum(x,y,day-1,bacteria);        //???????????????????+????(?????????)???????
	if (x > 0 && y > 0)
		temp = temp + bacnum(x-1,y-1,day-1,bacteria);
	if (x > 0 && y < 8)
		temp = temp + bacnum(x-1,y+1,day-1,bacteria);
	if (x < 8 && y > 0)
		temp = temp + bacnum(x+1,y-1,day-1,bacteria);
	if (x < 8 && y < 8)
		temp = temp + bacnum(x+1,y+1,day-1,bacteria);
	if (x > 0)
		temp = temp + bacnum(x-1,y,day-1,bacteria);
	if (x < 8)
		temp = temp + bacnum(x+1,y,day-1,bacteria);
	if (y > 0)
		temp = temp + bacnum(x,y-1,day-1,bacteria);
	if (y < 8)
		temp = temp + bacnum(x,y+1,day-1,bacteria);
	return temp;                                         //???????????
}
int main()
{
	int bacteria[9][9], day, i, j;                       //bacteria????????????,day?????
	for (i = 0; i < 9; i++)
	for (j = 0; j < 9; j++)
		bacteria[i][j] = 0;
	cin >> bacteria[4][4] >> day;                        //???????,??????????????
	for (i = 0; i < 9; i++)
	{
		for (j = 0; j < 9; j++)
		{
			cout << bacnum(i,j,day,bacteria);            //???day?????????????
			if (j < 8)
				cout << " ";
			else
				cout << endl;
		}
	}
	return 0;
}
int main()
{
	int shu[9][9], qi[9][9], i, j, k, m, n;
	cin >> m >> n;
	memset(shu, 0, sizeof(shu));
	shu[4][4] = m;
	for( i = 1; i <= n; i++ )
	{
		memset(qi, 0, sizeof(qi));
		for( j = 0; j < 9; j++ )
		{
			for( k = 0; k < 9; k++ )
			{
				if( shu[j][k] != 0)
				{
					qi[j][k + 1] = qi[j][k + 1] + shu[j][k];
                    qi[j][k - 1] = qi[j][k - 1] + shu[j][k];
                    qi[j - 1][k] = qi[j - 1][k] + shu[j][k];
                    qi[j + 1][k] = qi[j + 1][k] + shu[j][k];
					qi[j + 1][k + 1] = qi[j + 1][k + 1] + shu[j][k];
					qi[j + 1][k - 1] = qi[j + 1][k - 1] + shu[j][k];
					qi[j - 1][k + 1] = qi[j - 1][k + 1] + shu[j][k];
					qi[j - 1][k - 1] = qi[j - 1][k - 1] + shu[j][k];
					shu[j][k] = shu[j][k] * 2;
				}
			}
		}
		for( j = 0; j < 9; j++ )
		{
			for( k = 0; k < 9; k++ )
			{
				shu[j][k] = shu[j][k] + qi[j][k];
			}
		}
	}
	for( i = 0; i < 9; i++ )
	{
		for( j = 0; j < 9; j++ )
		{
			if( j == 8)
				cout << shu[i][j] << endl;
			else
				cout << shu[i][j] << " ";
		}
	}
	return 0;
}
int main ()
{
	int a[10][11][11]={0};
	int m,n,j=0,k=0,i=0;
	cin>>m>>n;
	a[0][5][5]=m;
	for(j=1;j<n+1;j++)
		for(k=1;k<10;k++)
			for(i=1;i<10;i++)
			{
				a[j][k][i]=a[j-1][k-1][i-1]+a[j-1][k-1][i]+a[j-1][k-1][i+1]+a[j-1][k][i-1]+a[j-1][k][i+1]+a[j-1][k+1][i-1]+a[j-1][k+1][i]+a[j-1][k+1][i+1]+2*a[j-1][k][i];
			}
	for(j=1;j<10;j++)
		for(k=1;k<10;k++)
		{
			if(k==9)
				cout<<a[n][j][k]<<'\n';
			else
				cout<<a[n][j][k]<<' ';
		}
	return 0;
}
//********************************
//*??  ???????      *****
//*????? 1300012753     ***** 
//*???2013.11.19          *****   
//********************************
void cal(int a[][9][9], int step)
{
	for(int i = 4 - step; i <= 4 + step; i++)
	{
		for(int j = 4 - step; j <= 4 + step; j++)
		{
			a[step+1][i-1][j-1] += a[step][i][j];
			a[step+1][i-1][j] += a[step][i][j];
			a[step+1][i-1][j+1] += a[step][i][j];
			a[step+1][i][j-1] += a[step][i][j];
			a[step+1][i][j+1] += a[step][i][j];
			a[step+1][i+1][j-1] += a[step][i][j];
			a[step+1][i+1][j] += a[step][i][j];
			a[step+1][i+1][j+1] += a[step][i][j];
			a[step+1][i][j] += 2 * a[step][i][j];
		}
	}
}
int main()
{
	int m, n;
	cin >> m >> n;
	int a[5][9][9];
	memset(a,0,sizeof(a));
	a[0][4][4] = 1;
	for(int i = 0; i < n; i++)
	cal(a,i);
	for(int i = 0; i < 9; i++)
	{
		for(int j = 0; j < 9; j++)
		{
			if(j == 0)
			cout << a[n][i][j] * m;
			else
			cout << ' ' << a[n][i][j] * m;
		}
		cout << endl;
	}
	return 0;	
}
int main()
{
	int num[11][11][11]={0};
	int days,pi,pj,n,m,i,j,k,a,b;
	scanf("%d%d",&m,&days);
	num[5][5][1]=m;
	for(n=2;n<=days+1;n++)
		for(i=1;i<=9;i++)
			for(j=1;j<=9;j++)
				if(num[i][j][n-1]>0) 

				{b=num[i][j][n-1];
	num[i][j][n]=num[i][j][n]+b;
	for(pi=1;pi<=3;pi++)
		for(pj=1;pj<=3;pj++)			
			num[i-2+pi][j-2+pj][n]=num[i-2+pi][j-2+pj][n]+b;
				}
					
					
					
		for(i=1;i<=9;i++)
		{
		for(j=1;j<=8;j++)
			printf("%d ",num[i][j][days+1]);
		printf("%d\n",num[i][9][days+1]);}
								

}
// * * * * * * * * * * * * * * *
// *???????????     *
// *??????  1300013011   *
// *???2013.12.5            *
// * * * * * * * * * * * * * * *
int s (int a[9][9], int i, int j)
{
	if ((i < 0) || (i >= 8) || (j < 0) || (j >= 8) || (a[i][j] == 0))
		return 0;
	else
		return a[i][j] / 2;
}
void chart (int n, int a[9][9])
{
	int i, j, k, h, w1, w2, l1, l2;
    if(n == 0)
	{
		for (i = 0; i < 9; i++)
		{
			for(j = 0; j < 9; j++)
            {
				if (j == 0)
                    cout << a[i][j];
                else
                    cout << " " << a[i][j];
			}
			cout << endl;
		}
	}
    else
	{
		int b[9][9] = {0};
		for (k = 0; k < 9; k++)
            for(h = 0; h < 9; h++)
			{ 
				if (a[k][h] != 0)
					a[h][k] *= 2;
			}
		
		for (k = 0; k < 9; k++)
            for(h = 0; h < 9; h++)
				b[k][h] = s(a, k - 1, h - 1) + s(a, k, h - 1)
    		   		        + s(a, k - 1, h) + s(a, k - 1, h + 1)
           				  + s(a, k + 1, h) + s(a, k, h + 1)
						  + s(a, k + 1, h - 1) + s(a, k + 1, h + 1);
		for (i = 0; i < 9; i++)
			for (j = 0; j < 9; j++)
				a[i][j] += b[i][j];
		chart (n - 1, a);
	}
}
int main()
{
    int  m, n, a[9][9] = {0};
    cin >> m >> n;
    a[4][4] = m;
    chart (n, a);
    return 0;
}
//??? ??? 1000010334 
//???????????????????? 
//??????????? 
int main()
{
    int end[11][11];  //???????
    int start[11][11];  //???????? 
    int b[5][11][11];
    int m=0;    //?????????
    int n=0;  //????
    
    for(int i=0;i<11;i++)
    {
       for(int j=0;j<11;j++)
       {
          start[i][j]=0;
          end[i][j]=0;
          for(int k=0;k<5;k++)
          {
             b[k][i][j]=0;
          }   
       }
    }     
    cin>>m>>n;
    start[5][5]=m;
    b[0][5][5]=m;
    for(int k=1;k<=n;k++)
    {
        for(int i=1;i<=9;i++)
        {
            for(int j=1;j<=9;j++)
            {
               for(int p=i-1;p<=i+1;p++)
               {
                  for(int q=j-1;q<=j+1;q++)
                  {
                      if(p==i&&q==j)
                      {
                         b[k][p][q]=b[k][p][q]+b[k-1][p][q]*2;
                      }
                      else
                      { 
                         b[k][i][j]=b[k][i][j]+b[k-1][p][q];
                      }
                      
                  }
               }
            }
        }
        /*
        for(int i=1;i<=9;i++)
        {
         for(int j=1;j<=9;j++)
         {
            if(j==1)  cout<<b[k-1][i][j];
            else   cout<<" "<<b[k-1][i][j];
         }
         cout<<endl;
       }
       */
    }
    for(int i=1;i<=9;i++)
    {
        for(int j=1;j<=9;j++)
        {
           end[i][j]=b[n][i][j];
        }
    }
    for(int i=1;i<=9;i++)
    {
      for(int j=1;j<=9;j++)
      {
          if(j==1)  cout<<end[i][j];
          else   cout<<" "<<end[i][j];
      }
      cout<<endl;
    }

    return 0; 
}
/*
 * ????main.cpp
 * ??????
 * ?????2013-01-11
 * ???????9???????????????m?????????????????????10???????10??????????????????????????????????????????n(1?n?4)????????????????
 */

int main ()
{
	int day,
		d,i,j,k,di,dj,
		a[9][9] = {0},aa[9][9],
		direction[8][2] = {{1,0},{-1,0},{0,1},{0,-1},{-1,-1},{-1,1},{1,1},{1,-1}};
	cin >> a[4][4] >> day;
	for ( d = 0; d < day; d++ )
	{
		memset(aa,0,sizeof(aa));
		for ( i = 0; i < 9; i++ )
			for ( j = 0; j < 9; j++ )
			{
				if ( aa[i][j] == a[i][j] )
					continue;
				for ( k = 0; k < 8; k++ )
				{
					di = direction[k][0];
					dj = direction[k][1];
					if ( i + di < 9 && i + di >= 0 && j + dj < 9 && j + dj >= 0 )
					{
						a[i+di][j+dj] += (a[i][j] - aa[i][j]);
						aa[i+di][j+dj] += (a[i][j] - aa[i][j]);
					}
				}
				a[i][j] += (a[i][j] - aa[i][j]);
			}
	}
	for ( i = 0; i < 9; i++ )
	{
		cout << a[i][0];
		for ( j = 1; j < 9; j++ )
			cout << ' ' << a[i][j];
		cout << endl;
	}
	return 0;
}
int b[9][9];			//????
int a[9][9];			//???
void f()				//??
{
	int i,j;
	for(i=0;i<9;i++)
		for(j=0;j<9;j++)
			if(a[i][j]!=0)
			{
				b[i][j]+=2*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][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];//??????
				a[i][j]=0;	//??????
			}
	for(i=0;i<9;i++)
		for(j=0;j<9;j++)
			a[i][j]+=b[i][j];
}

int main()
{
	int m,n;
	int i,j;
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	cin>>m>>n;
	a[4][4]=m;
	for(i=0;i<n;i++)	//n???????
	{
		f();
		memset(b,0,sizeof(b));
	}
	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 field[11][11];
	int field1[11][11];
    memset(field,0,sizeof(field));
	memset(field1,0,sizeof(field1));
	int n=0,m=0,i=0,j=0,k=0,count=1;
	cin>>m>>n;
	field1[5][5]=m;
	while(count<=n)
	{
		for(i=1;i<10;i++)
			for(j=1;j<10;j++)
				field[i][j]=2*field1[i][j]+field1[i-1][j]+field1[i+1][j]+field1[i][j+1]+field1[i][j-1]+field1[i-1][j-1]+field1[i-1][j+1]+field1[i+1][j+1]+field1[i+1][j-1];
		for(i=1;i<10;i++)
			for(j=1;j<10;j++)
				field1[i][j]=field[i][j];
		count++;
	}
	for(i=1;i<10;i++)
	{
		cout<<field[i][1];
		for(j=2;j<10;j++)
			cout<<" "<<field[i][j];
		cout<<endl;
	}
	return 0;
}
int main()
{
	int n,q,i,j,a[9][9],m,c[9][9],k,b[9][9];
	cin>>n>>m;
	for(i=0;i<=8;i++)
	{
		for(j=0;j<=8;j++)
		{
			a[i][j]=0;
			c[i][j]=0;
		}
	}
	a[4][4]=n;
	for(k=1;k<=m;k++)
	{
		for(i=0;i<=8;i++)
	{
		for(j=0;j<=8;j++)
		{	b[i][j]=0;
			if(a[i][j]!=0)
			{
				c[i][j]=1;
			
			}
		}
	}
	for(i=0;i<=8;i++)
	{
		for(j=0;j<=8;j++)
		{
			if(a[i][j]!=0&&c[i][j]==1)
			{
				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];
				b[i][j]=b[i][j]+2*a[i][j];
				a[i][j]=0;
				c[i][j]=0;
			}
		}
	}
		for(i=0;i<=8;i++)
	{
		for(j=0;j<=8;j++)
		{
			a[i][j]=a[i][j]+b[i][j];
		}
	}
	}
	for(i=0;i<=8;i++)
	{
		for(j=0;j<=7;j++)
		{
			cout<<a[i][j]<<" ";
		}
		cout<<a[i][8];
		cout<<endl;
	}
    cin>>q;
    return 0;
}
main()
{
      int p[9][9];
      int q[9][9];
      int m,n,i,j,k;
      scanf("%d %d",&m,&n);
      for(i=0;i<9;i++)
         for(j=0;j<9;j++)
         {
            p[i][j]=0;
            q[i][j]=0;
         }
      p[4][4]=m;
      for(k=0;k<n;k++)
      {
      for(i=0;i<9;i++)
         for(j=0;j<9;j++)
         {
            if(p[i][j]!=0)
            {
               q[i][j]+=2*p[i][j];
               q[i-1][j-1]+=p[i][j];
               q[i-1][j]+=p[i][j];
               q[i-1][j+1]+=p[i][j];
               q[i][j-1]+=p[i][j];
               q[i][j+1]+=p[i][j];
               q[i+1][j-1]+=p[i][j];
               q[i+1][j]+=p[i][j];
               q[i+1][j+1]+=p[i][j];
            }
         }
      for(i=0;i<9;i++)
         for(j=0;j<9;j++)
         {
            p[i][j]=q[i][j];
            q[i][j]=0;
         }
      }
      for(i=0;i<9;i++)
         for(j=0;j<9;j++)
         {
            if((j+1)%9!=0)printf("%d ",p[i][j]);
            else printf("%d\n",p[i][j]);
         }

}
int a[9][9]={0},b[9][9];
void fanzhi(int i,int j)
{
    int x,y;
	for(x=i-1;x<=i+1;x++)
	{
		for(y=j-1;y<=j+1;y++)
		{
			b[x][y]=b[x][y]+a[i][j];
		}
	}
	b[i][j]=b[i][j]+a[i][j];
}
main()
{
	int m,n,k,i,j;
	scanf("%d %d",&m,&n);
	a[4][4]=m;
	for(k=1;k<=n;k++)  //???k????? 
	{
		memset(b,0,sizeof(b));
		for(i=4-k+1;i<=4+k-1;i++)
		{
			for(j=4-k+1;j<=4+k-1;j++)
			{
				fanzhi(i,j);
			}
		}
		for(i=4-k;i<=4+k;i++)
		{
			for(j=4-k;j<=4+k;j++)
			{
				a[i][j]=b[i][j];
			}
		}
	}
	for(i=0;i<=8;i++)
	{
		for(j=0;j<=7;j++)
		{
			printf("%d ",a[i][j]);
		}
		printf("%d\n",a[i][8]);
	}
}
//****************************
//**Title:????????  **
//**Author:?? 1300012732  **//Std: '56 280 728 1232 1456 1232 728 280 56'
                              // Out: '56 204 494 760 904 760 494 204 56'

                               //  Input of in case 0:
                                 //    14 4
//**Date?2013.11.4         **
//**File?2.cpp             **
//****************************
int dish[11][11];
int die[11][11];
int increase[11][11];

void breed (int day, int count)
{
	int i, j;
	if (count > day)
	{
		for (i = 1; i < 10; i++)
		{
			for (j = 1; j < 9; j++)
				cout << dish[i][j] << ' ';
			cout << dish[i][9] << endl;
		}
		return;
	}
	else 
	{
		for (i = 1; i < 10; i++)
			for (j = 1; j < 10; j++)
			{
				if (dish[i][j] != 0)
				{
					increase[i][j] += 2 * dish[i][j];
					increase[i][j + 1] += dish[i][j];
					increase[i][j - 1] += dish[i][j];
					increase[i - 1][j] += dish[i][j];
					increase[i + 1][j] += dish[i][j];
					increase[i + 1][j - 1] += dish[i][j];
					increase[i + 1][j + 1] += dish[i][j];
					increase[i - 1][j - 1] += dish[i][j];
					increase[i - 1][j + 1] += dish[i][j];
				}
			}
		for (i = 1; i < 10; i++)
			for (j = 1; j < 10; j++)
			{
				dish[i][j] += increase[i][j];
				dish[i][j] -= die[i][j];
			}
		for (i = 1; i < 10; i++)
			for (j = 1; j < 10; j++)
			{
				die[i][j] = increase[i][j];
				increase[i][j] = 0;
			}
     	breed (day, count + 1);
	}
}

int main()
{
	int num, day, i, j;
	cin >> num >> day;
	for (i = 0 ; i < 11; i++)
		for (j = 0; j < 11; j++)
			dish[i][j] = die[i][j] = 0;
	dish[5][5] = die[5][5] = num;
	breed (day, 1);
	return 0;
}
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];
            if(i==0||i==8||i==72||i==80)//???????????????3???????
            {
                 if(i==0)
                 {
                     p[k+1][0]+=2*add;
                     p[k+1][1]+=add;
                     p[k+1][9]+=add;
                     p[k+1][10]+=add;
                 }
                 if(i==8)
                 {
                     p[k+1][8]+=2*add;
                     p[k+1][7]+=add;
                     p[k+1][16]+=add;
                     p[k+1][17]+=add;
                 }
                 if(i==72)
                 {
                     p[k+1][72]+=2*add;
                     p[k+1][63]+=add;
                     p[k+1][64]+=add;
                     p[k+1][73]+=add;
                 }
                 if(i==80)
                 {
                     p[k+1][80]+=2*add;
                     p[k+1][70]+=add;
                     p[k+1][71]+=add;
                     p[k+1][79]+=add;
                 }

            }
            if(i%9==0&&i!=0&&i!=72)
            {
                p[k+1][i]+=2*add;
                p[k+1][i-9]+=add;
                p[k+1][i-8]+=add;
                p[k+1][i+1]+=add;
                p[k+1][i+9]+=add;
                p[k+1][i+10]+=add;
            }
            else if((i+1)%9==0)
            {
                p[k+1][i]+=2*add;
                p[k+1][i-9]+=add;
                p[k+1][i-10]+=add;
                p[k+1][i-1]+=add;
                p[k+1][i+8]+=add;
                p[k+1][i+9]+=add;
            }
            else if(i>0&&i<8)
            {
                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;
            }
            else if(i>72&&i<80)
            {
                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;
            }
            else
            {
                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");
        }
    }
  
}