human
Can you provide a the Python program you requested given the following:
I am working on the file "04_BFS.ipynb".
The first task is:
Zombie in Matrix

Given a 2D grid, each cell is either a wall 2, a zombie 1 or people 0 (the number zero, one, two).Zombies can turn the nearest people(up/down/left/right) into zombies every day, but can not through wall. How long will it take to turn all people into zombies? Return -1 if can not turn all people into zombies.
Example
Given a matrix:
0 1 2 0 0
1 0 0 2 1
0 1 0 0 0
return 2
http://www.lintcode.com/en/problem/zombie-in-matrix/
Can you write Python program for it?
assistant
#Here is the Python program you requested.

class Solution:
    # @param {int[][]} grid  a 2D integer grid
    # @return {int} an integer
    def zombie(self, grid):
        # Write your code here
        if grid is None or len(grid) == 0 or len(grid[0]) == 0:
            return -1
        
        m, n = len(grid), len(grid[0])
        day, people, zombies = -1, 0, []
        di = [0, 0, 1, -1]
        dj = [1, -1, 0, 0]
        
        for i in range(m):
            for j in range(n):
                if grid[i][j] == 0:
                    people += 1
                elif grid[i][j] == 1:
                    zombies.append([i, j])
        
        while zombies:
            new_zombies = []
            for i, j in zombies:
                for k in range(4):
                    zi, zj = i + di[k], j + dj[k]
                    if 0 <= zi < m and 0 <= zj < n and grid[zi][zj] == 0:
                        new_zombies.append([zi, zj])
                        grid[zi][zj] = 1
                        people -= 1
            day += 1
            zombies = new_zombies
            # print day, zombies
        
        return -1 if people > 0 else day