Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import heapq as hq

def bfs(x,y,t,Map,depth):
    queue = [(depth,(x,y))]
    while len(queue) != 0:
        p = hq.heappop(queue)
        x,y = p[1]
        if p[0] < t and Map[y][x] == 0:
                Map[y][x] = 1
                dxdy = [(1,0),(-1,0),(0,1),(0,-1),(1,1),(-1,-1)]
                for dx,dy in dxdy:
                    if 0 <= x + dx < 60 and 0 <= y + dy < 60:
                        hq.heappush(queue,(p[0] + 1, (x + dx, y + dy)))

while True:
    t,n = map(int,input().split())
    if t == 0 and n == 0:
        break

    Map = [[0 for j in range(60)] for i in range(60)]
    for _ in range(n):
        x,y = map(lambda x:int(x) + 30,input().split())
        Map[y][x] = -1
    x,y = map(lambda x:int(x) + 30,input().split())
    bfs(x,y,t + 1,Map,0)

    print(sum([0 if Map[i][j] == -1 else Map[i][j] for i in range(60) for j in range(60)]))

    

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import heapq as hq

def bfs(x,y,t,Map):
    queue = []
    hq.heappush(queue,(0,(x,y)))
    while len(queue) != 0:
        p = hq.heappop(queue)
        x,y = p[1]
        if p[0] <= t and Map[y][x] == 0:
            Map[y][x] = 1
            dxdy = [(1,0),(-1,0),(0,1),(0,-1),(1,1),(-1,-1)]
            for dx,dy in dxdy:
                hq.heappush(queue,(p[0] + 1, (x + dx, y + dy)))

while True:
    t,n = map(int,input().split())
    if t == 0 and n == 0:
        break

    Map = [[0 for j in range(200)] for i in range(200)]
    for _ in range(n):
        x,y = map(lambda x:int(x) + 100,input().split())
        Map[y][x] = -1
    x,y = map(lambda x:int(x) + 100,input().split())
    bfs(x,y,t,Map)

    print(sum([0 if Map[i][j] == -1 else Map[i][j] for i in range(200) for j in range(200)]))

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import heapq as hq

def bfs(x,y,t,Map,depth):
    queue = [(depth,(x,y))]
    while len(queue) != 0:
        p = hq.heappop(queue)
        x,y = p[1]
        if p[0] < t and Map[y][x] == 0:
            Map[y][x] = 1
            dxdy = [(1,0),(-1,0),(0,1),(0,-1),(1,1),(-1,-1)]
            for dx,dy in dxdy:
                if 0 <= x + dx < 60 and 0 <= y + dy < 60:
                    hq.heappush(queue,(p[0] + 1, (x + dx, y + dy)))

while True:
    t,n = map(int,input().split())
    if t == 0 and n == 0:
        break

    Map = [[0 for j in range(60)] for i in range(60)]
    for _ in range(n):
        x,y = map(lambda x:int(x) + 30,input().split())
        Map[y][x] = -1
    x,y = map(lambda x:int(x) + 30,input().split())
    bfs(x,y,t + 1,Map,0)

    print(sum([0 if Map[i][j] == -1 else Map[i][j] for i in range(60) for j in range(60)]))

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import heapq as hq

def bfs(x,y,t,Map):
    queue = []
    hq.heappush(queue,(0,(x,y)))
    while len(queue) != 0:
        p = hq.heappop(queue)
        x,y = p[1]
        if p[0] <= t and Map[y][x] == 0:
            Map[y][x] = 1
            dxdy = [(1,0),(-1,0),(0,1),(0,-1),(1,1),(-1,-1)]
            for dx,dy in dxdy:
                hq.heappush(queue,(p[0] + 1, (x + dx, y + dy)))

while True:
    t,n = map(int,input().split())
    if t == 0 and n == 0:
        break

    Map = [[0 for j in range(200)] for i in range(200)]
    for _ in range(n):
        x,y = map(lambda x:int(x) + 100,input().split())
        Map[y][x] = -1
    x,y = map(lambda x:int(x) + 100,input().split())
    bfs(x,y,t,Map)

    print(sum([0 if Map[i][j] == -1 else Map[i][j] for i in range(200) for j in range(200)]))