Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    H,W,N = map(int,input().split())
    point = [tuple(map(int,input().split())) for _ in range(N)]
    searched = set()

    ans = [0] * 10
    tot = 0
    for p,q in point:
        neighbor = [[0]*5 for _ in range(5)]
        for dy in (-2,-1,0,1,2):
            for dx in (-2,-1,0,1,2):
                if (p + dy,q + dx) in point:
                    neighbor[dy + 2][dx + 2] = 1
        
        for i in range(1,4):
            for j in range(1,4):
                if p + i - 2 <= 1 or p + i - 2 >= H:
                    continue
                if q + j - 2 <= 1 or q + j - 2 >= W:
                    continue
                if (p + i - 2,q + j - 2) in searched:
                    continue
                searched.add((p + i - 2,q + j - 2))
                cnt = 0
                for dy in (-1,0,1):
                    for dx in (-1,0,1):
                        if neighbor[i + dy][j + dx]:
                            cnt += 1
                tot += 1
                ans[cnt] += 1
    ans[0] = (H - 2)*(W - 2) - tot
    print('\n'.join(map(str,ans)))
if __name__ == '__main__':
    main()

Fixed submission:
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

from collections import deque,defaultdict,Counter
def main():
    H,W,N = map(int,input().split())
    point = [tuple(map(int,input().split())) for _ in range(N)]
    ans = [0] * 10

    dic = defaultdict(int)
    for p,q in point:
        for dy in (-1,0,1):
            for dx in (-1,0,1):
                if p + dy <= 1 or p + dy >= H:
                    continue
                if q + dx <= 1 or q + dx >= W:
                    continue
                center = (p + dy,q + dx)
                ans[dic[center]] -= 1
                dic[center] += 1
                ans[dic[center]] += 1
    ans[0] += (H - 2)*(W - 2)
    print('\n'.join(map(str,ans)))
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    H,W,N = map(int,input().split())
    point = [tuple(map(int,input().split())) for _ in range(N)]
    searched = set()

    ans = [0] * 10
    tot = 0
    for p,q in point:
        neighbor = [[0]*5 for _ in range(5)]
        for dy in (-2,-1,0,1,2):
            for dx in (-2,-1,0,1,2):
                if (p + dy,q + dx) in point:
                    neighbor[dy + 2][dx + 2] = 1
        
        for i in range(1,4):
            for j in range(1,4):
                if p + i - 2 <= 1 or p + i - 2 >= H:
                    continue
                if q + j - 2 <= 1 or q + j - 2 >= W:
                    continue
                if (p + i - 2,q + j - 2) in searched:
                    continue
                searched.add((p + i - 2,q + j - 2))
                cnt = 0
                for dy in (-1,0,1):
                    for dx in (-1,0,1):
                        if neighbor[i + dy][j + dx]:
                            cnt += 1
                tot += 1
                ans[cnt] += 1
    ans[0] = (H - 2)*(W - 2) - tot
    print('\n'.join(map(str,ans)))
if __name__ == '__main__':
    main()

Fixed submission:
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

from collections import deque,defaultdict,Counter
def main():
    H,W,N = map(int,input().split())
    point = [tuple(map(int,input().split())) for _ in range(N)]
    ans = [0] * 10

    dic = defaultdict(int)
    for p,q in point:
        for dy in (-1,0,1):
            for dx in (-1,0,1):
                if p + dy <= 1 or p + dy >= H:
                    continue
                if q + dx <= 1 or q + dx >= W:
                    continue
                center = (p + dy,q + dx)
                ans[dic[center]] -= 1
                dic[center] += 1
                ans[dic[center]] += 1
    ans[0] += (H - 2)*(W - 2)
    print('\n'.join(map(str,ans)))
if __name__ == '__main__':
    main()