Buggy python submission (verdict: Time Limit Exceeded):
import sys
from itertools import combinations
input = sys.stdin.readline

def main():
    h, w, n = map(int, input().split())
    grid = [0]*n
    mod = 10**9
    for i in range(n):
        a, b = map(int, input().split())
        grid[i] = a*mod+b
    
    ans = [0]*10
    already = dict()
    key = 0
    for value in combinations(grid, r=1):
        a, b = divmod(value[0], mod)
        for i in range(-1, 2):
            for j in range(-1, 2):
                if  a+i <= 1 or a+i >= h or b+j <= 1 or b+j >= w:
                    continue
                if (a+i, b+j) in already:
                    continue
                already[(a+i, b+j)] = 1
                key += 1
                count = 0
                for p in range(-1, 2):
                    for q in range(-1, 2):
                        if (a+i+p)*mod+b+j+q in grid:
                            count += 1
                ans[count] += 1
    
    for i in range(10):
        if i == 0:
            print((h-2)*(w-2)-key+ans[0])
            continue
        print(ans[i])

    
    
if __name__ == "__main__":
    main()

Fixed submission:
import sys
from itertools import combinations
input = sys.stdin.readline

def main():
    h, w, n = map(int, input().split())
    grid = [0]*n
    mod = 10**9
    judge = dict()
    for _ in range(n):
        a, b = map(int, input().split())
        for i in range(-1, 2):
            for j in range(-1, 2):
                if a+i <= 1 or a+i >= h or b+j <= 1 or b+j >= w:
                    continue
                if (a+i, b+j) in judge:
                    judge[(a+i, b+j)] += 1
                else:
                    judge[(a+i, b+j)] = 1
   
    ans = [0]*10
    
    for v in judge.values():
        ans[v] += 1
    ans[0] = (h-2)*(w-2)-sum(ans[1:])
    
    for a in ans:
        print(a)

    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from itertools import combinations
input = sys.stdin.readline

def main():
    h, w, n = map(int, input().split())
    grid = [0]*n
    mod = 10**9
    for i in range(n):
        a, b = map(int, input().split())
        grid[i] = a*mod+b
    
    ans = [0]*10
    already = dict()
    key = 0
    for value in combinations(grid, r=1):
        a, b = divmod(value[0], mod)
        for i in range(-1, 2):
            for j in range(-1, 2):
                if  a+i <= 1 or a+i >= h or b+j <= 1 or b+j >= w:
                    continue
                if (a+i, b+j) in already:
                    continue
                already[(a+i, b+j)] = 1
                key += 1
                count = 0
                for p in range(-1, 2):
                    for q in range(-1, 2):
                        if (a+i+p)*mod+b+j+q in grid:
                            count += 1
                ans[count] += 1
    
    for i in range(10):
        if i == 0:
            print((h-2)*(w-2)-key+ans[0])
            continue
        print(ans[i])

    
    
if __name__ == "__main__":
    main()

Fixed submission:
import sys
from itertools import combinations
input = sys.stdin.readline

def main():
    h, w, n = map(int, input().split())
    grid = [0]*n
    mod = 10**9
    judge = dict()
    for _ in range(n):
        a, b = map(int, input().split())
        for i in range(-1, 2):
            for j in range(-1, 2):
                if a+i <= 1 or a+i >= h or b+j <= 1 or b+j >= w:
                    continue
                if (a+i, b+j) in judge:
                    judge[(a+i, b+j)] += 1
                else:
                    judge[(a+i, b+j)] = 1
   
    ans = [0]*10
    
    for v in judge.values():
        ans[v] += 1
    ans[0] = (h-2)*(w-2)-sum(ans[1:])
    
    for a in ans:
        print(a)

    
if __name__ == "__main__":
    main()