semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int n,day,i,j;
	int day0[9][9],day1[9][9], day2[9][9],day3[9][9],day4[9][9];
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			day0[i][j]=0;
		}
	}
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			day1[i][j]=0;
		}
	}
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			day2[i][j]=0;
		}
	}
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			day3[i][j]=0;
		}
	}
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			day4[i][j]=0;
		}
	}


	scanf("%d %d",&n,&day);	
	day0[4][4]=n;
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			if(day0[i][j]!=0)
			{
				day1[i-1][j-1]=1*day0[i][j];
				day1[i-1][j-0]=1*day0[i][j];
				day1[i-1][j+1]=1*day0[i][j];
				day1[i-0][j-1]=1*day0[i][j];
				day1[i-0][j+1]=1*day0[i][j];
				day1[i+1][j-1]=1*day0[i][j];
				day1[i+1][j-0]=1*day0[i][j];
				day1[i+1][j+1]=1*day0[i][j];
				day1[i][j]=2*day0[i][j];
			}
		}
	}
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			if(day1[i][j]!=0)
			{
				day2[i-1][j-1]=1*day1[i][j]+day2[i-1][j-1];
				day2[i-1][j-0]=1*day1[i][j]+day2[i-1][j-0];
				day2[i-1][j+1]=1*day1[i][j]+day2[i-1][j+1];
				day2[i-0][j-1]=1*day1[i][j]+day2[i-0][j-1];
				day2[i-0][j+1]=1*day1[i][j]+day2[i-0][j+1];
				day2[i+1][j-1]=1*day1[i][j]+day2[i+1][j-1];
				day2[i+1][j-0]=1*day1[i][j]+day2[i+1][j-0];
				day2[i+1][j+1]=1*day1[i][j]+day2[i+1][j+1];
				day2[i][j]=2*day1[i][j]+day2[i][j];
			}
		}
	}
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			if(day2[i][j]!=0)
			{
				day3[i-1][j-1]=1*day2[i][j]+day3[i-1][j-1];
				day3[i-1][j-0]=1*day2[i][j]+day3[i-1][j-0];
				day3[i-1][j+1]=1*day2[i][j]+day3[i-1][j+1];
				day3[i-0][j-1]=1*day2[i][j]+day3[i-0][j-1];
				day3[i-0][j+1]=1*day2[i][j]+day3[i-0][j+1];
				day3[i+1][j-1]=1*day2[i][j]+day3[i+1][j-1];
				day3[i+1][j-0]=1*day2[i][j]+day3[i+1][j-0];
				day3[i+1][j+1]=1*day2[i][j]+day3[i+1][j+1];
				day3[i][j]=2*day2[i][j]+day3[i][j];
			}
		}
	}
	for(i=0;i<9;i++)
	{
		for(j=0;j<9;j++)
		{
			if(day3[i][j]!=0)
			{
				day4[i-1][j-1]=1*day3[i][j]+day4[i-1][j-1];
				day4[i-1][j-0]=1*day3[i][j]+day4[i-1][j-0];
				day4[i-1][j+1]=1*day3[i][j]+day4[i-1][j+1];
				day4[i-0][j-1]=1*day3[i][j]+day4[i-0][j-1];
				day4[i-0][j+1]=1*day3[i][j]+day4[i-0][j+1];
				day4[i+1][j-1]=1*day3[i][j]+day4[i+1][j-1];
				day4[i+1][j-0]=1*day3[i][j]+day4[i+1][j-0];
				day4[i+1][j+1]=1*day3[i][j]+day4[i+1][j+1];
				day4[i][j]=2*day3[i][j]+day4[i][j];
			}
		}
	}
	if(day==1)
	{
		for(i=0;i<9;i++)
		{
			for(j=0;j<8;j++)
			{
				printf("%d ", day1[i][j]);
			}
			printf("%d\n",day1[i][8]);
		}
	}
		if(day==2)
	{
		for(i=0;i<9;i++)
		{
			for(j=0;j<8;j++)
			{
				printf("%d ", day2[i][j]);
			}
			printf("%d\n",day2[i][8]);
		}
	}
			if(day==3)
	{
		for(i=0;i<9;i++)
		{
			for(j=0;j<8;j++)
			{
				printf("%d ", day3[i][j]);
			}
			printf("%d\n",day3[i][8]);
		}
	}
				if(day==4)
	{
		for(i=0;i<9;i++)
		{
			for(j=0;j<8;j++)
			{
				printf("%d ", day4[i][j]);
			}
			printf("%d\n",day4[i][8]);
		}
	}
				return 0;
				}
int main()
{
	int board[9][9],temp[9][9];
	int n;
	memset(board,0,81*sizeof(int));
	cin>>board[4][4]>>n;
	while(n--)
	{
		memset(temp,0,81*sizeof(int));
		for(int i=1;i<8;i++)
		{
			for(int j=1;j<8;j++)
			{
				if(board[i][j]>0)
				{
					temp[i][j]+=(2*board[i][j]);
					temp[i-1][j-1]+=board[i][j];
					temp[i-1][j]+=board[i][j];
					temp[i-1][j+1]+=board[i][j];
					temp[i][j-1]+=board[i][j];
					temp[i][j+1]+=board[i][j];
					temp[i+1][j-1]+=board[i][j];
					temp[i+1][j]+=board[i][j];
					temp[i+1][j+1]+=board[i][j];
				}
			}
		}
		for(int i=0;i<9;i++)
		{
			for(int j=0;j<9;j++)
			{
				board[i][j]=temp[i][j];
			}
		}
	}
	for(int i=0;i<9;i++)
	{
		cout<<board[i][0];
		for(int j=1;j<9;j++)
		{
			cout<<' '<<board[i][j];
		}
		cout<<endl;
	}
	return 0;
}
int main()
{
	int num1[11][11],num2[11][11],m,day,t,j,i,k;
	scanf("%d%d",&m,&day);
	for(i=0;i<11;i++)
	{
		for(j=0;j<11;j++)
		{
			num1[i][j]=0;
			num2[i][j]=0;
		}
	}
	num1[5][5]=m;
	for(k=1;k<=day;k++)
	{
		for(i=5-k;i<=5+k;i++)
		{
			for(j=5-k;j<=5+k;j++)
			{
				num2[i][j]=num2[i][j]+num1[i-1][j]+num1[i-1][j-1]+num1[i-1][j+1]+num1[i+1][j]+num1[i+1][j-1]+num1[i+1][j+1]+num1[i][j-1]+num1[i][j+1];
				num2[i][j]=num2[i][j]+2*num1[i][j];
			}
		}
	    for(i=0;i<11;i++)
		{
			for(j=0;j<11;j++)
			{
				num1[i][j]=num2[i][j];
			}
		}
		for(i=0;i<11;i++)
		{
			for(j=0;j<11;j++)
			{
				num2[i][j]=0;
			}
		}
	}
	for(i=1;i<10;i++)
	{
		for(j=1;j<9;j++)
		{
			printf("%d ",num1[i][j]);
		}
		printf("%d\n",num1[i][9]);
	}
	return 0;
}
void change(int, int[][10]);
void print(int[][10]);
int m, n;

int main()
{
	int i, j, fb[10][10];
	cin >> m >> n;
	for(i = 1; i <= 9; i++)
		for(j = 1; j <= 9; j++)
			fb[i][j] = 0;
	fb[5][5] = m;
	change(1, fb);
	return 0;
}

void change(int day, int temp[][10])
{
	int i, j, t[10][10];
	if(day == n + 1)
	{
		print(temp);
		return;
	}
	for(i = 1; i <= 9; i++)
		for(j = 1; j <= 9; j++)
			t[i][j] = 0;
	for(i = 1; i <= 9; i++)
		for(j = 1; j <= 9; j++)
			if(temp[i][j] != 0)
			{
				t[i][j] = t[i][j] + temp[i][j];
				t[i + 1][j] = t[i + 1][j] + temp[i][j];
				t[i + 1][j + 1] = t[i + 1][j + 1] + temp[i][j];
				t[i + 1][j - 1] = t[i + 1][j - 1] + temp[i][j];
				t[i][j + 1] = t[i][j + 1] + temp[i][j];
				t[i][j - 1] = t[i][j - 1] + temp[i][j];
				t[i - 1][j] = t[i - 1][j] + temp[i][j];
				t[i - 1][j + 1] = t[i - 1][j + 1] + temp[i][j];
				t[i - 1][j - 1] = t[i - 1][j - 1] + temp[i][j];
			}
	for(i = 1; i <= 9; i++)
		for(j = 1; j <= 9; j++)
			temp[i][j] = temp[i][j] + t[i][j];
	change(day + 1, temp);
}

void print(int array[][10])
{
	int i = 1, j;
	while(1)
	{
		for(j = 1; j <= 8; j++)
			cout << array[i][j] << " ";
		cout << array[i][9] << endl;
		if(i == 9)
			break;
		i++;
	}
}
int j, k, bec[9][9] = {0}, tempbec[9][9] = {0};
void increase(int bec[][9])
{
	bec[j - 1][k] += tempbec[j][k];
	bec[j - 1][k - 1] += tempbec[j][k];
	bec[j - 1][k + 1] += tempbec[j][k];
	bec[j][k - 1] += tempbec[j][k];
	bec[j][k + 1] += tempbec[j][k];
	bec[j + 1][k - 1] += tempbec[j][k];
	bec[j + 1][k] += tempbec[j][k];
	bec[j + 1][k + 1] += tempbec[j][k];
}



int main()
{
	int m, n, i = 0, num = 1;
	cin >> m >> n;
	bec[4][4] = m;
	for (i = 0; i < n; i++)
	{
		for(j = 0; j < 9; j++)
			for(k = 0; k < 9; k++)
			{
				tempbec[j][k] = bec[j][k];
				bec[j][k] = bec[j][k] * 2;
				
			}
		for (j = 1; j < 8; j++)
			for(k = 1; k < 8; k++)
				increase (bec);
	}
	for (j = 0; j < 9; j++)
			for (k = 0; k < 9; k++)
			{
				if(num % 9 == 1)
					cout << bec[j][k];
				if(num % 9 == 0)
					cout << " " << bec[j][k] << "\n";
				if(num % 9 != 0 && num % 9 != 1)
					cout << " " << bec[j][k];
				num++;
				
			}
	

	return 0;
}
int a[11][11],b[11][11];

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

}
int main()
{
	int a[9][9]={0},b[9][9]={0};
	int m,n;
	cin>>m>>n;
	int i,j,k,l;
	a[4][4]=m;
	for(i=1;i<=n;i++)
	{
		for(j=0;j<9;j++)
		{
			for(k=0;k<9;k++)
			{
				if(a[j][k]!=0)
				{
					b[j][k-1]=b[j][k-1]+a[j][k];
					b[j][k+1]=b[j][k+1]+a[j][k];
					b[j-1][k]=b[j-1][k]+a[j][k];
					b[j+1][k]=b[j+1][k]+a[j][k];
					b[j-1][k-1]=b[j-1][k-1]+a[j][k];
					b[j+1][k+1]=b[j+1][k+1]+a[j][k];
					b[j+1][k-1]=b[j+1][k-1]+a[j][k];
					b[j-1][k+1]=b[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]+a[j][k];
			}
		}
		for(j=0;j<9;j++)
		{
			for(k=0;k<9;k++)
				a[j][k]=a[j][k]+b[j][k];
		}
		for(j=0;j<9;j++)
		{
			for(k=0;k<9;k++)
				b[j][k]=0;
		}
	}
	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 main()
{
	int a[11][11] = {0}, i, j, t[11][11] = {0}, m, n;
	const int move[8][2]= {-1, 0, 1, 0, 0, 1, 0, -1, -1, -1, 1, -1, 1, 1, -1, 1};
	cin >> m >> n;
	a[5][5] = m;
	while (n--)
	{
        memset(t, 0, sizeof(t));
		for (i = 1; i < 10; i++)
		{
			for (j = 1; j < 10; j++)
			{
				for (int k = 0; k < 8; k++)
				{
					t[i + move[k][0]][j + move[k][1]] += a[i][j];
				}
				t[i][j] += a[i][j];
			}
		}
		for (i = 1; i < 10; i++)
		{
			for (j = 1; j < 10; j++)
			{
				a[i][j] += t[i][j];
			}
		}
	}
	for (i = 1; i < 10; i++)
	{
		for (j = 1; j < 10; j++)
		{
			if (j > 1)
			{
				cout << " ";
			}
			cout << a[i][j];
		}
		cout << endl;
	}
	return 0;
}
//****************************************
//*???????????                               **
//*?????? 1100012760**
//*???2011.11.26                          **
//****************************************
int main()
{
	int mat[10][10] = {0} , New[10][10];
	int i , j , l , m , n;
	cin >> m >> n;
	mat[5][5] = m;
	for(i = 1 ; i <= n ; i++)
	{
		for (j = 1 ; j <= 9 ; j++)
		{
			for (l = 1 ; l <= 9 ; l++)
			{
				New[j][l] = 0;
			}
		}
		for (j = 1 ; j <= 9 ; j++)
		{
			for (l = 1 ; l <= 9 ; l++)
			{
				New[j][l] += 2 * mat [j][l];
				New[j - 1][l - 1] += mat [j][l];
				New[j + 1][l - 1] += mat [j][l];
				New[j - 1][l + 1] += mat [j][l];
				New[j + 1][l + 1] += mat [j][l];
				New[j][l - 1] += mat [j][l];
				New[j - 1][l] += mat [j][l];
				New[j + 1][l] += mat [j][l];
				New[j][l + 1] += mat [j][l];
			}
		}
		for (j = 1 ; j <= 9 ; j++)
		{
			for (l = 1 ; l <= 9 ; l++)
			{
				mat[j][l] = New[j][l];
			}
		} 
	}
	for (j = 1 ; j <= 9 ; j++)
	{
		cout << mat[j][1];
		for (l = 2 ; l <= 9 ; l++)
		{
			cout << ' ' << mat[j][l];
		}
		cout << endl;
	}
	return 0;
}
main()
{
      int a[11][11],b[11][11];
      int i,j,k,l,m,n;
      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;
      for(k=0;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-1]+a[i+1][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<10;j++)
           {
                            if(j==9)
                            printf("%d\n",a[i][9]);
                            else
                            printf("%d ",a[i][j]);
                            }
                            }
                            getchar();
                            getchar();
}
int main(){
int n,m,i,j,k;
int a[10][10][10];
scanf ("%d %d",&m,&n);
 for (k=0;k<11;k++){
  for (j=0;j<11;j++){
a[0][k][j]=0;
a[1][k][j]=0;
a[2][k][j]=0;
a[3][k][j]=0;
a[4][k][j]=0;
  }
 }
a[0][5][5]=m;
for (i=1;i<n+1;i++){
 for (k=1;k<10;k++){
  for (j=1;j<10;j++){
      a[i][k][j]=2*a[i-1][k][j]+a[i-1][k][j-1]+a[i-1][k][j+1]+a[i-1][k+1][j-1]+a[i-1][k+1][j]+a[i-1][k+1][j+1]+ a[i-1][k-1][j-1]+a[i-1][k-1][j]+a[i-1][k-1][j+1];
   }
  }
}
 for (k=1;k<10;k++){
  for (j=1;j<9;j++){
printf("%d ",a[n][k][j]) ;
  }
printf("%d\n",a[n][k][9]) ;
}
return 0;
}
int main()
{
	int a[11][11],b[11][11];//??????????????????????????????
	int n,m,i,k,j,l,x;
	cin>>m>>n;
	for(i=0;i<11;i++)//???
		for(j=0;j<11;j++)
		{
			a[i][j]=0;
			b[i][j]=0;
		}
	b[5][5]=m;
	for(x=1;x<=n;x++)//??n????????????
	{
		for(i=0;i<11;i++)
			for(j=0;j<11;j++)
			{
				a[i][j]=0;
			}
		for(i=1;i<10;i++)
			for(j=1;j<10;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=0;i<10;i++)
			for(j=1;j<10;j++)
			{
				b[i][j]=a[i][j];	
			}
	}
	for(i=1;i<10;i++)
	{
		for(j=1;j<9;j++)
		{
			cout<<a[i][j];
			cout<<" ";
		}
		cout<<a[i][9]<<endl;
	}
	return 0;
}
int main()
{
	int a[11][11],b[11][11];
	int i,j,k,m,n;
	cin>>m>>n;
	for(i=0;i<11;i++)
	{
		for(j=0;j<11;j++)
		{
			a[i][j]=0;
			b[i][j]=0;
		}
	}
	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];
			}
		}
		
		for(i=1;i<10;i++)
		{
			for(j=1;j<10;j++)
			{
				if(b[i][j]!=0)
				{
					a[i][j]=a[i][j]+b[i][j];
					a[i][j+1]+=b[i][j];
					a[i][j-1]+=b[i][j];
					a[i+1][j]+=b[i][j];
					a[i-1][j]+=b[i][j];
					a[i+1][j+1]+=b[i][j];
					a[i-1][j-1]+=b[i][j];
					a[i+1][j-1]+=b[i][j];
					a[i-1][j+1]+=b[i][j];
				}
				
			}
		}
	}
	k=0;
	for(i=1;i<10;i++)
	{
		for(j=1;j<10;j++)
		{
			cout<<a[i][j];
			k++;
			if(k%9!=0)
				cout<<" ";
			else
				cout<<endl;
		}
	}
	return 0;
}
int m, n;	
int i, j;
int a[10][10] = {0}, b[10][10] = {0};

void zuo(int x)
{
	if(x == n)
	{
		for(i = 1; i <= 9; i++)
		{
			for(j = 1; j < 9; j++)
				cout << a[i][j] << " ";
			cout << a[i][9] << endl;
		}
	}
	else
	{
		for(i = 1; i <= 9; i++)
		{
			for(j = 1; j <= 9; j++)
				b[i][j] = a[i + 1][j + 1] + a[i][j] + a[i + 1][j - 1] + a[i - 1][j + 1] + a[i + 1][j]
						+ a[i - 1][j] + a[i][j + 1] + a[i][j - 1]+ a[i - 1][j - 1];
		}
		
		for (i = 1; i <= 9; i++)
		{
			for (j = 1; j <= 9; j++)
			{
				a[i][j] += b[i][j];
				b[i][j] = 0;
			}
		}
		zuo(x + 1);
	}
}
int main ()
{
	cin >> m >> n;
	a[5][5] = m;
	zuo(0);
	return 0;
}
int q[9][9]={0},mark[9][9]={0},a[9][9]={0};//????
int d[8][2]={{-1,0},{0,-1},{1,0},{0,1},{-1,-1},{-1,1},{1,-1},{1,1}};//??????
void kuosan(int i,int n)//????
{
	if(i==n+1)//????n?
	{
		for(int k=0;k<9;k++)
		{
			for(int l=0;l<9;l++)
			{
				if(l==0)cout<<q[k][0];
				else cout<<' '<<q[k][l];
			}
			cout<<endl;
		}
	}//????
	else
	{
		for(int j=0;j<9;j++)
			for(int k=0;k<9;k++)
				a[j][k]=q[j][k];//???q?????a?
		for(int j=0;j<9;j++)
			for(int k=0;k<9;k++)
				if(mark[j][k]>0&&mark[j][k]<=i)
				{
					a[j][k]=a[j][k]+2*q[j][k];
					for(int p=0;p<8;p++)
					{
						a[j+d[p][0]][k+d[p][1]]=a[j+d[p][0]][k+d[p][1]]+q[j][k];
						if(mark[j+d[p][0]][k+d[p][1]]==0)mark[j+d[p][0]][k+d[p][1]]=i+1;
					}
				}//????
	    for(int j=0;j<9;j++)
			for(int k=0;k<9;k++)
				q[j][k]=a[j][k]-q[j][k];//??????
		kuosan(i+1,n);//??????
	}
}
int main()
{
	int m,n;
	cin>>m>>n;//??m,n
	q[4][4]=m;mark[4][4]=1;//???
	kuosan(1,n);
	return 0;
}
//******************************
//???:2.cpp
//??: ??? 1300012754
//??:2013.12.06
//??:???????? (???????????????????
//******************************

int m, n;        // m:?????????,n:?????
int map[10][10]; // ???
int Breed(int, int, int); // ????

int main()
{
	memset(map, 0, sizeof(map)); // ?????
	cin >> m >> n; // ??????????,?????
	// ??1???9?
	for (int i = 1; i <= 9; i++)
	{
		cout << Breed(i, 1, n); // ??n????i????????
		for (int j = 2; j <= 9; j++)
		{
			cout << " " << Breed(i, j, n); // ???i???8?????,???????
		}
		cout << endl; // ?????
	}
	return 0;
}

// ????,x,y????,p??????
int Breed(int x, int y, int p)
{
	if (p == 0) // ????????0?
	{
		if (x == 5 && y == 5) // ??????,????m
			return m;
		else
			return 0; // ???????0
	}
	else
	{
		return Breed(x + 1, y, p - 1) + Breed(x + 1, y + 1, p - 1) +
			Breed(x, y + 1, p - 1) + Breed(x - 1, y + 1, p - 1) +
			Breed(x - 1, y, p - 1) + Breed(x - 1, y - 1, p - 1) +
			Breed(x, y - 1, p - 1) + Breed(x + 1, y - 1, p - 1) +
			2 * Breed(x, y, p - 1); // ???????, ???????????????????????????2???????????
	}
}
//*********************************************
//** ??????????? **
//** ?????? 1300012722 **
//** ???2013.12.06 **
//*********************************************
int b[9][9], old[9][9];                  //????b??????????????old??????????????
void mul(int k, const int day);          //?????day????????k??????
void pam(int x, int y);                  //x?y???????????
int main()
{
	int m, n, i, j;                      //m????????????n???????
	memset(b, 0, sizeof(b));             //b????
	cin >> m >> n;                  
	b[4][4] = m;                         //????????
	mul(0, n);                           //??????n??????????????
	for(i = 0; i <= 8; i++)
	{
		for(j = 0; j < 8; j++)
			cout << b[i][j] << " ";
		cout << b[i][8] << endl;
	}                                    //?????
	return 0;
}
void mul(int k, const int day)
{
	int i, j;
	for(i = 4 - k; i <= 4 + k; i++)
		for(j = 4 - k; j <= 4 + k; j++)
		old[i][j] = b[i][j];             //??????????????
	for(i = 4 - k; i <= 4 + k; i++)
		for(j = 4 - k; j <= 4 + k; j++)
			pam(i, j);                   //????????????????
	k++;
	if(k < day)
		mul(k, day);                     //???????????????
	else
		return;
}
void pam(int x, int y)                   //?????????10????????????????????????????????????????
{
	int i, j;
	for(i = x - 1; i <= x + 1; i++)
		for(j = y - 1; j <= y + 1; j++)
			b[i][j] = b[i][j] + old[x][y];     //????????????????????
	return;
}
int main()
{
	int container[10][10]={0};
	int temp[10][10]={0};
	int m,day;
	int i,j,k;
	cin>>m>>day;
	container[5][5]=m;
	for(i=1;i<=day;i++)	//?i?
	{
		for(j=1;j<=9;j++)
		{	for(k=1;k<=9;k++)	//???????????0??
			{
				if(container[j][k]!=0)
				{
					temp[j][k]+=container[j][k]*2;	//???2
					temp[j-1][k]+=container[j][k];
					temp[j+1][k]+=container[j][k];
					temp[j][k-1]+=container[j][k];
					temp[j][k+1]+=container[j][k];
					temp[j-1][k+1]+=container[j][k];
					temp[j-1][k-1]+=container[j][k];
					temp[j+1][k-1]+=container[j][k];
					temp[j+1][k+1]+=container[j][k];	//????????1
				}
	
			}
		}

		for(j=1;j<=9;j++)
		{	for(k=1;k<=9;k++)
			{
				container[j][k]=temp[j][k];	//?????????????container
			}
		}
		for(j=1;j<=9;j++)
			for(k=1;k<=9;k++)
				temp[j][k]=0;
	}
	//?????????
	for(i=1;i<=9;i++)
	{	for(j=1;j<=8;j++)
		{
			cout<<container[i][j]<<" ";
		}
		cout<<container[i][9]<<endl;
	}
	return 0;
}
int main()
{
	int i,j,d,m,n,a[20][20][20]={0};
	scanf("%d%d",&m,&n);
	a[1][5][5]=m;
	for(d=1;d<=n;d++)
	{
		for(i=1;i<=9;i++)
		{
			for(j=1;j<=9;j++)
			{
				if(a[d][i][j]!=0)
				{
					a[d+1][i-1][j-1]=a[d+1][i-1][j-1]+a[d][i][j];
					a[d+1][i-1][j]=a[d+1][i-1][j]+a[d][i][j];
					a[d+1][i-1][j+1]=a[d+1][i-1][j+1]+a[d][i][j];
					a[d+1][i][j-1]=a[d+1][i][j-1]+a[d][i][j];
					a[d+1][i][j+1]=a[d+1][i][j+1]+a[d][i][j];
					a[d+1][i+1][j-1]=a[d+1][i+1][j-1]+a[d][i][j];
					a[d+1][i+1][j]=a[d+1][i+1][j]+a[d][i][j];
					a[d+1][i+1][j+1]=a[d+1][i+1][j+1]+a[d][i][j];
					a[d+1][i][j]=a[d+1][i][j]+a[d][i][j]*2;
				}
			}
		}
	}
	for(i=1;i<=9;i++)
	{
		printf("%d %d %d %d %d %d %d %d %d\n",a[n+1][i][1],a[n+1][i][2],a[n+1][i][3],a[n+1][i][4],a[n+1][i][5],a[n+1][i][6],a[n+1][i][7],a[n+1][i][8],a[n+1][i][9]);
	}
	return 0;

}
int main()
{
	int m,n,i,j,k;
	int juzhen1[11][11];
	int juzhen2[11][11];	
	scanf("%d %d",&m,&n);
	for(i=0;i<11;i++)
	{
	  for(j=0;j<11;j++)
	  {
	    juzhen1[i][j]=0;
	    juzhen2[i][j]=0;

	  }
	}
	juzhen1[5][5]=m;
	for(k=1;k<n+1;k++)
	{
	  for(i=1;i<10;i++)
	  {
	    for(j=1;j<10;j++)
		{
		  if(k%2!=0)
		  {
		    if(juzhen1[i][j]>0)
		    {
		      juzhen2[i][j]=juzhen2[i][j]+2*(juzhen1[i][j]);
			  juzhen2[i-1][j-1]=juzhen2[i-1][j-1]+juzhen1[i][j];
			  juzhen2[i-1][j]=juzhen2[i-1][j]+juzhen1[i][j];
			  juzhen2[i-1][j+1]=juzhen2[i-1][j+1]+juzhen1[i][j];
		      juzhen2[i][j-1]=juzhen2[i][j-1]+juzhen1[i][j];
			  juzhen2[i][j+1]=juzhen2[i][j+1]+juzhen1[i][j];
		      juzhen2[i+1][j-1]=juzhen2[i+1][j-1]+juzhen1[i][j];
			  juzhen2[i+1][j]=juzhen2[i+1][j]+juzhen1[i][j];
			  juzhen2[i+1][j+1]=juzhen2[i+1][j+1]+juzhen1[i][j];
			  //juzhen1[i][j]=0;
		    }
		  }
		  if(k%2==0)
		  {
		    if(juzhen2[i][j]>0)
		    {
		      juzhen1[i][j]=juzhen1[i][j]+2*(juzhen2[i][j]);
			  juzhen1[i-1][j-1]=juzhen1[i-1][j-1]+juzhen2[i][j];
			  juzhen1[i-1][j]=juzhen1[i-1][j]+juzhen2[i][j];
			  juzhen1[i-1][j+1]=juzhen1[i-1][j+1]+juzhen2[i][j];
		      juzhen1[i][j-1]=juzhen1[i][j-1]+juzhen2[i][j];
			  juzhen1[i][j+1]=juzhen1[i][j+1]+juzhen2[i][j];
		      juzhen1[i+1][j-1]=juzhen1[i+1][j-1]+juzhen2[i][j];
			  juzhen1[i+1][j]=juzhen1[i+1][j]+juzhen2[i][j];
			  juzhen1[i+1][j+1]=juzhen1[i+1][j+1]+juzhen2[i][j];
			  //juzhen2[i][j]=0;
		    }
		  }
		}
	  }
	  if(k%2!=0)
	  {
	    for(i=1;i<10;i++)
		{
		  for(j=1;j<10;j++)
		  {
		    juzhen1[i][j]=0;
		  }
		}
	  }
	  if(k%2==0)
	  {
	    for(i=1;i<10;i++)
		{
		  for(j=1;j<10;j++)
		  {
		    juzhen2[i][j]=0;
		  }
		}
	  }
	}
	if(k%2==0)
	{
	  for(i=1;i<10;i++)
	  {
	    printf("%d %d %d %d %d %d %d %d %d\n",juzhen2[i][1],juzhen2[i][2],juzhen2[i][3],juzhen2[i][4],juzhen2[i][5],juzhen2[i][6],juzhen2[i][7],juzhen2[i][8],juzhen2[i][9]);
	  }
	}
	if(k%2!=0)
	{
	  for(i=1;i<10;i++)
	  {
	    printf("%d %d %d %d %d %d %d %d %d\n",juzhen1[i][1],juzhen1[i][2],juzhen1[i][3],juzhen1[i][4],juzhen1[i][5],juzhen1[i][6],juzhen1[i][7],juzhen1[i][8],juzhen1[i][9]);
	  }
	}
	return 0;
}
//***************************
//???????				*
//?????? 1100012895	*
//???2011-11-23			*
//***************************


int main()
{
	int Ground[5][11][11] = {0}; // ??????????????????
	cin >> Ground[0][5][5]; // ?????????????

	int n; // n??????
	cin >> n;

	// ????????????????????????
	int day, j, k;
	for (day = 1; day <= n; day++)
		for (j = 5 - day; j <= 5 + day; j++)
			for (k = 5 - day; k <= 5 + day; k++)
				// ?????????????????????????
				Ground[day][j][k] = Ground[day - 1][j][k]*2 + Ground[day - 1][j - 1][k - 1]
				+ Ground[day - 1][j - 1][k] + Ground[day - 1][j - 1][k + 1] + Ground[day - 1][j][k - 1] + Ground[day - 1][j][k + 1]
				+ Ground[day - 1][j + 1][k - 1] + Ground[day - 1][j + 1][k] + Ground[day - 1][j + 1][k + 1];

	for (j = 1; j <= 9; j++)
	{
		cout << Ground[n][j][1];
		for (k = 2; k <= 9; k++)
			cout << ' ' << Ground[n][j][k];
		cout << endl;
	}

	return 0;
}
void fanzhi(int a[11][11],int n)
{
	int i,j;
	int b[11][11]={0};
	if(n==0)
		return;
	else
	{
		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-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];
				}
		for(i=1;i<=9;i++)
			for(j=1;j<=9;j++)
			{
				a[i][j]=b[i][j];
				b[i][j]=0;
			}
		fanzhi(a,n-1);
	}
}
int main()
{
	int m,n;
	int a[11][11]={0};
	cin>>m>>n;
	a[5][5]=m;
	fanzhi(a,n);
	int i,j;
	for(i=1;i<=9;i++)
	{
		for(j=1;j<=9;j++)
		{
			if(j!=1)
				cout<<" ";
			cout<<a[i][j];
		}
		cout<<endl;
	}
	return 0;
}
int a[11][11];
int backup_a[11][11];
int b[11][11];
void backup1()
{
	for(int i=1;i<9;i++)
	{
		for(int j=0;j<9;j++)
		{
			backup_a[i][j]=a[i][j];
			b[i][j]=a[i][j];
		}
	}

}
void cal1()
{
	for(int i=1;i<10;i++)
	{
		for(int j=1;j<10;j++)
		{
			if(i>0&&i<10&&j<10&&j>0)
			{
				a[i][j]=b[i-1][j-1]+b[i-1][j+1]+b[i+1][j-1]+b[i+1][j+1]+b[i-1][j]+b[i+1][j]+b[i][j-1]+b[i][j+1]+2*b[i][j];
			}
		}
	}
}

int main()
{
	int n=0;
	int d;
	cin>>d;
	cin>>n;
	
	memset(a,0,sizeof(a));
	a[5][5]=d;
	backup1();
	
	for(int i=0;i<n;i++)
	{
		cal1();
		backup1();
	}
	for(int i=1;i<10;i++)
	{
		for(int j=1;j<10;j++)
		{
			if(i>0&&i<10&&j<10&&j>0)
			{	
			if(j!=9)	cout<<a[i][j]<<" ";
			else if(j==9)cout<<a[i][j]<<endl;
			}
		}
	}

	return 0;

}