<garvit244>1020_1.py
def numEnclaves( A):
    result = 0
    queue = []
    for row in range(len(A)):
        for col in range(len(A[0])):
            result += A[row][col]
            if (row*col == 0 or row == len(A)-1 or col == len(A[0])-1) and A[row][col] == 1:
                queue.append((row, col))
                
    x_move = [-1, 0, 1, 0]
    y_move = [0, 1, 0, -1]
    
    while queue:
        x, y = queue.pop(0)
        A[x][y] = 0
        result -= 1
        
        for xm, ym in zip(x_move, y_move):
            nx = x + xm
            ny = y + ym
            
            if 0<= nx <len(A) and 0 <= ny < len(A[0]) and A[nx][ny] == 1 and (nx, ny) not in queue:
                queue.append((nx, ny))
    
    return result
def sample_funcname ( var_0 ) :
    var_2 = 0
    var_3 = [ ]
    for var_6 in range ( len ( var_0 ) ) :
        for var_7 in range ( len ( var_0 [ 0 ] ) ) :
            var_2 += var_0 [ var_6 ] [ var_7 ]
            if ( var_6 * var_7 == 0 or var_6 == len ( var_0 ) - 1 or var_7 == len ( var_0 [ 0 ] ) - 1 ) and var_0 [ var_6 ] [ var_7 ] == 1 :
                var_3.append ( ( var_6 , var_7 ) )
    var_10 = [ - 1 , 0 , 1 , 0 ]
    var_11 = [ 0 , 1 , 0 , - 1 ]
    while var_3 :
        var_13 , var_14 = var_3.pop ( 0 )
        var_0 [ var_13 ] [ var_14 ] = 0
        var_2 -= 1
        for var_16 , var_17 in zip ( var_10 , var_11 ) :
            var_18 = var_13 + var_16
            var_19 = var_14 + var_17
            if 0 <= var_18 < len ( var_0 ) and 0 <= var_19 < len ( var_0 [ 0 ] ) and var_0 [ var_18 ] [ var_19 ] == 1 and ( var_18 , var_19 ) not in var_3 :
                var_3.append ( ( var_18 , var_19 ) )
    return var_2
