<qiyuangong>695_Max_Area_of_Island_2.py
def bfs( grid, x, y):
    queue = [(x, y)]
    area = 0
    
    while queue:
        i, j = queue.pop(0)
        area += 1
        if i - 1 >= 0 and grid[i - 1][j] == 1:
            grid[i - 1][j] = 0
            queue.append((i - 1, j))
        if i + 1 < len(grid) and grid[i + 1][j] == 1:
            grid[i + 1][j] = 0
            queue.append((i + 1, j))
        if j - 1 >= 0 and grid[i][j - 1] == 1:
            grid[i][j - 1] = 0
            queue.append((i, j - 1))
        if j + 1 < len(grid[0]) and grid[i][j + 1] == 1:
            grid[i][j + 1] = 0
            queue.append((i, j + 1))
    return area
def sample_funcname ( var_0 , var_1 , var_2 ) :
    var_3 = [ ( var_1 , var_2 ) ]
    var_5 = 0
    while var_3 :
        var_7 , var_8 = var_3.pop ( 0 )
        var_5 += 1
        if var_7 - 1 >= 0 and var_0 [ var_7 - 1 ] [ var_8 ] == 1 :
            var_0 [ var_7 - 1 ] [ var_8 ] = 0
            var_3.append ( ( var_7 - 1 , var_8 ) )
        if var_7 + 1 < len ( var_0 ) and var_0 [ var_7 + 1 ] [ var_8 ] == 1 :
            var_0 [ var_7 + 1 ] [ var_8 ] = 0
            var_3.append ( ( var_7 + 1 , var_8 ) )
        if var_8 - 1 >= 0 and var_0 [ var_7 ] [ var_8 - 1 ] == 1 :
            var_0 [ var_7 ] [ var_8 - 1 ] = 0
            var_3.append ( ( var_7 , var_8 - 1 ) )
        if var_8 + 1 < len ( var_0 [ 0 ] ) and var_0 [ var_7 ] [ var_8 + 1 ] == 1 :
            var_0 [ var_7 ] [ var_8 + 1 ] = 0
            var_3.append ( ( var_7 , var_8 + 1 ) )
    return var_5
