Buggy python submission (verdict: Time Limit Exceeded):
H,W,N = map(int,input().split())

from collections import defaultdict
t =defaultdict(int)
L = defaultdict(int)

for i in range(N):
    a,b = map(int,input().split())
    t[(a-1,b-1)] = 1
    for p in [-1,0,1]:
        for q in [-1,0,1]:
            if a+p < 2 or b+q < 2 or a+p >H-1 or b+q >W-1:
                continue
            L[(a+p-1,b+q-1)] = 1



ans = [0]*10
for k in L.keys():
    a,b = k[0],k[1]
    if a < 1 or b < 1 or a >H-2 or b >W-2:
        continue

    c = 0
    for p in [-1,0,1]:
        for q in [-1,0,1]:
            c +=t[(a+p,b+q)]

    ans[c] += 1

ans[0] = (H-2)*(W-2) - sum(ans)
for i in range(10):
    print(ans[i])


Fixed submission:
H,W,N = map(int,input().split())

from collections import defaultdict
t =defaultdict(int)
L = defaultdict(int)

for i in range(N):
    a,b = map(int,input().split())
    t[(a-1,b-1)] = 1
    for p in [-1,0,1]:
        for q in [-1,0,1]:
            if a+p < 2 or b+q < 2 or a+p >H-1 or b+q >W-1:
                continue
            L[(a+p-1,b+q-1)] += 1
ans = [0]*10
for v in L.values():
    ans[v] += 1

ans[0] = (H-2)*(W-2) - sum(ans)
for i in range(10):
    print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
H,W,N = map(int,input().split())

from collections import defaultdict
t =defaultdict(int)
L = defaultdict(int)

for i in range(N):
    a,b = map(int,input().split())
    t[(a-1,b-1)] = 1
    for p in [-1,0,1]:
        for q in [-1,0,1]:
            L[(a+p-1,b+q-1)] = 1



ans = [0]*10
for k in L.keys():
    a,b = k[0],k[1]
    if a < 1 or b < 1 or a >H-2 or b >W-2:
        continue

    c = 0
    for p in [-1,0,1]:
        for q in [-1,0,1]:
            c +=t[(a+p,b+q)]

    ans[c] += 1

ans[0] = (H-2)*(W-2) - sum(ans)
for i in range(10):
    print(ans[i])


Fixed submission:
H,W,N = map(int,input().split())

from collections import defaultdict
t =defaultdict(int)
L = defaultdict(int)

for i in range(N):
    a,b = map(int,input().split())
    t[(a-1,b-1)] = 1
    for p in [-1,0,1]:
        for q in [-1,0,1]:
            if a+p < 2 or b+q < 2 or a+p >H-1 or b+q >W-1:
                continue
            L[(a+p-1,b+q-1)] += 1
ans = [0]*10
for v in L.values():
    ans[v] += 1

ans[0] = (H-2)*(W-2) - sum(ans)
for i in range(10):
    print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
H,W,N = map(int,input().split())

from collections import defaultdict, Counter
t =defaultdict(int)

L = {}
for i in range(N):
    a,b = map(int,input().split())
    #t[a-1][b-1] = 1
    t[(a-1,b-1)] = 1
    for p in [-1,0,1]:
        for q in [-1,0,1]:
            if a+p-1 not in L:
                L[a+p-1] = []
            L[a+p-1].append(b+q-1)

ans = [0]*10
for k in L.keys():
    ll = set(L[k])
    for v in ll:
        a,b = k,v
        if a < 1 or b < 1 or a >H-2 or b >W-2:
            continue

        c = 0
        for p in [-1,0,1]:
            for q in [-1,0,1]:
                c +=t[(a+p,b+q)]

        ans[c] += 1

ans[0] = (H-2)*(W-2) - sum(ans)
for i in range(10):
    print(ans[i])



Fixed submission:
H,W,N = map(int,input().split())

from collections import defaultdict
t =defaultdict(int)
L = defaultdict(int)

for i in range(N):
    a,b = map(int,input().split())
    t[(a-1,b-1)] = 1
    for p in [-1,0,1]:
        for q in [-1,0,1]:
            if a+p < 2 or b+q < 2 or a+p >H-1 or b+q >W-1:
                continue
            L[(a+p-1,b+q-1)] += 1
ans = [0]*10
for v in L.values():
    ans[v] += 1

ans[0] = (H-2)*(W-2) - sum(ans)
for i in range(10):
    print(ans[i])