Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

h, w, n = map(int, input().split())
a_list = [0 for _ in range((w - 2) * (h - 2))]
for _ in range(n):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    for a_i in range(a - 2, a + 1):
        for b_i in range(b - 2, b + 1):
            if (0 <= a_i < h - 2) & (0 <= b_i < w - 2):
                a_list[(b_i * (h - 2)) + a_i] += 1

k = Counter(a_list)
for i in range(10):
    if i in k.keys():
        print(k[i])
    else:
        print(0)

Fixed submission:
from collections import Counter, defaultdict

ans = defaultdict(lambda: 0)
h, w, n = map(int, input().split())
for _ in range(n):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    for a_i in range(a - 2, a + 1):
        for b_i in range(b - 2, b + 1):
            if (0 <= a_i < h - 2) & (0 <= b_i < w - 2):
                ans[(a_i, b_i)] += 1

k = Counter(ans.values())
print((h - 2) * (w - 2) - sum(k.values()))
for i in range(1, 10):
    if i in k.keys():
        print(k[i])
    else:
        print(0)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

h, w, n = map(int, input().split())
a_list = [[0 for _ in range(w)] for _ in range(h)]
triangle = []
for _ in range(n):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    for a_i in range(a - 1, a + 2):
        for b_i in range(b - 1, b + 2):
            if (1 <= a_i < h - 1) & (1 <= b_i < w - 1):
                triangle.append(str(a_i) + "_" + str(b_i))
aaa = Counter(triangle).values()
dp = [0 for _ in range(10)]
total = 0
for i in aaa:
    dp[i] += 1
    total += 1
dp[0] = ((h - 2) * (w - 2)) - total
for i in dp:
    print(i)

Fixed submission:
from collections import Counter, defaultdict

ans = defaultdict(lambda: 0)
h, w, n = map(int, input().split())
for _ in range(n):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    for a_i in range(a - 2, a + 1):
        for b_i in range(b - 2, b + 1):
            if (0 <= a_i < h - 2) & (0 <= b_i < w - 2):
                ans[(a_i, b_i)] += 1

k = Counter(ans.values())
print((h - 2) * (w - 2) - sum(k.values()))
for i in range(1, 10):
    if i in k.keys():
        print(k[i])
    else:
        print(0)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

h, w, n = map(int, input().split())
a_list = [[0 for _ in range(w)] for _ in range(h)]
triangle = []
for _ in range(n):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    for a_i in range(a - 1, a + 2):
        for b_i in range(b - 1, b + 2):
            if (1 <= a_i < h - 1) & (1 <= b_i < w - 1):
                triangle.append(str(a_i) + "_" + str(b_i))
aaa = Counter(list(Counter(triangle).values()))
for i in range(10):
    if i == 0:
        print((h - 2) * (w - 2) -  sum(aaa.values()))
    elif i in aaa.keys():
        print(aaa[i])
    else:
        print(0)



Fixed submission:
from collections import Counter, defaultdict

ans = defaultdict(lambda: 0)
h, w, n = map(int, input().split())
for _ in range(n):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    for a_i in range(a - 2, a + 1):
        for b_i in range(b - 2, b + 1):
            if (0 <= a_i < h - 2) & (0 <= b_i < w - 2):
                ans[(a_i, b_i)] += 1

k = Counter(ans.values())
print((h - 2) * (w - 2) - sum(k.values()))
for i in range(1, 10):
    if i in k.keys():
        print(k[i])
    else:
        print(0)

Buggy python submission (verdict: Time Limit Exceeded):
h, w, n = map(int, input().split())
a_list = [[0 for _ in range(w)] for _ in range(h)]
for _ in range(n):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    a_list[a][b] = 1
z_list = []
for center_x in range(1, h - 1):
    for center_y in range(1, w - 1):
        temp = a_list[center_x - 1: center_x + 2]
        temp_num = 0
        for ttt in temp:
            temp_num += sum(ttt[center_y - 1: center_y + 2])
        z_list.append(temp_num)
for i in range(10):
    print(z_list.count(i))

Fixed submission:
from collections import Counter, defaultdict

ans = defaultdict(lambda: 0)
h, w, n = map(int, input().split())
for _ in range(n):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    for a_i in range(a - 2, a + 1):
        for b_i in range(b - 2, b + 1):
            if (0 <= a_i < h - 2) & (0 <= b_i < w - 2):
                ans[(a_i, b_i)] += 1

k = Counter(ans.values())
print((h - 2) * (w - 2) - sum(k.values()))
for i in range(1, 10):
    if i in k.keys():
        print(k[i])
    else:
        print(0)