Buggy python submission (verdict: Time Limit Exceeded):
H,W,N = map(int,input().split())
if N == 0:
  print((H-2)*(W-2))
  for i in range(9):
    print(0)
  exit()

AB = [list(map(int,input().split())) for _ in range(N)]

Board = [[0 for _ in range(W)] for _ in range(H)]
Cell = []
Count = [0 for _ in range(10)]

for a,b in AB:
  a -= 1
  b -= 1
  Board[a][b] = 1
  for i in range(-1,2):
    for j in range(-1,2):
      if 1 <= a+i <= H-2 and 1 <= b+j <= W-2:
        Cell.append([a+i,b+j])
Cell.sort(key=lambda x:(x[0],x[1]))
#print(Board)
#print(Cell)
prea = 0
preb = 0
for a,b in Cell:
  if a == prea and b == preb:
    continue
  c = 0
  for k in range(-1,2):
    for l in range(-1,2):
      c += Board[a+k][b+l]
  Count[c] += 1
  prea = a
  preb = b

Count[0] = (H-2)*(W-2)-sum(Count[1:])
for c in Count:
  print(c)

Fixed submission:
from collections import defaultdict

H,W,N = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]

Cells = defaultdict(int)
Count = [(H-2)*(W-2)] + [0 for _ in range(9)]

for a,b in AB:
  a -= 1
  b -= 1
  for i in range(-1,2):
    for j in range(-1,2):
      if 1 <= a+i <= H-2 and 1 <= b+j <= W-2:
        Count[Cells[(a+i,b+j)]] -= 1
        Count[Cells[(a+i,b+j)]+1] += 1
      Cells[(a+i,b+j)] += 1
for c in Count:
  print(c)

Buggy python submission (verdict: Time Limit Exceeded):
H,W,N = map(int,input().split())
if N == 0:
  print((H-2)*(W-2))
  for i in range(9):
    print(0)
  exit()

AB = [list(map(int,input().split())) for _ in range(N)]

Board = [[0 for _ in range(W)] for _ in range(H)]
Cell = set()
Count = [0 for _ in range(10)]


for a,b in AB:
  a -= 1
  b -= 1
  Board[a][b] = 1
  for i in range(-1,2):
    for j in range(-1,2):
      if 1 <= a+i <= H-2 and 1 <= b+j <= W-2:
        Cell.add((a+i,b+j))
#print(Board)
#print(Cell)
for a,b in Cell:
  c = 0
  for k in range(-1,2):
    for l in range(-1,2):
      c += Board[a+k][b+l]
  Count[c] += 1
Count[0] = (H-2)*(W-2)-sum(Count[1:])
for c in Count:
  print(c)

Fixed submission:
from collections import defaultdict

H,W,N = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]

Cells = defaultdict(int)
Count = [(H-2)*(W-2)] + [0 for _ in range(9)]

for a,b in AB:
  a -= 1
  b -= 1
  for i in range(-1,2):
    for j in range(-1,2):
      if 1 <= a+i <= H-2 and 1 <= b+j <= W-2:
        Count[Cells[(a+i,b+j)]] -= 1
        Count[Cells[(a+i,b+j)]+1] += 1
      Cells[(a+i,b+j)] += 1
for c in Count:
  print(c)

Buggy python submission (verdict: Time Limit Exceeded):
H,W,N = map(int,input().split())
if N == 0:
  print((H-2)*(W-2))
  for i in range(9):
    print(0)
  exit()

AB = [list(map(int,input().split())) for _ in range(N)]

Board = [[0 for _ in range(W)] for _ in range(H)]
Done = [[0 for _ in range(W)] for _ in range(H)]
Count = [0 for _ in range(10)]

for a,b in AB:
  Board[a-1][b-1] = 1
for a,b in AB:
  a -= 1
  b -= 1
  for i in range(-1,2):
    for j in range(-1,2):
      if 1 <= a+i <= H-2 and 1 <= b+j <= W-2:
        if Done[a+i][b+j] == 1:
          continue
        c = 0
        for k in range(-1,2):
          for l in range(-1,2):
            c += Board[a+i+k][b+j+l]
        Count[c] += 1
        Done[a+i][b+j] = 1
Count[0] = (H-2)*(W-2)-sum(Count[1:])
for c in Count:
  print(c)

Fixed submission:
from collections import defaultdict

H,W,N = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]

Cells = defaultdict(int)
Count = [(H-2)*(W-2)] + [0 for _ in range(9)]

for a,b in AB:
  a -= 1
  b -= 1
  for i in range(-1,2):
    for j in range(-1,2):
      if 1 <= a+i <= H-2 and 1 <= b+j <= W-2:
        Count[Cells[(a+i,b+j)]] -= 1
        Count[Cells[(a+i,b+j)]+1] += 1
      Cells[(a+i,b+j)] += 1
for c in Count:
  print(c)

Buggy python submission (verdict: Time Limit Exceeded):
H,W,N = map(int,input().split())
if N == 0:
  print((H-2)*(W-2))
  for i in range(9):
    print(0)
  exit()

AB = [list(map(int,input().split())) for _ in range(N)]

Board = [[0 for _ in range(W)] for _ in range(H)]
Done = [[0 for _ in range(W)] for _ in range(H)]
Count = [0 for _ in range(10)]

for a,b in AB:
  Board[a-1][b-1] = 1
for a,b in AB:
  a -= 1
  b -= 1
  for i in range(-1,2):
    for j in range(-1,2):
      if 1 <= a+i <= H-2 and 1 <= b+j <= W-2:
        if Done[a+i][b+j] == 1:
          continue
        c = 0
        for k in range(-1,2):
          for l in range(-1,2):
            c += Board[a+i+k][b+j+l]
        Count[c] += 1
        Done[a+i][b+j] = 1
Count[0] = (H-2)*(W-2)-sum(Count[1:])
for c in Count:
  print(c)

Fixed submission:
from collections import defaultdict

H,W,N = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]

Cells = defaultdict(int)
Count = [(H-2)*(W-2)] + [0 for _ in range(9)]

for a,b in AB:
  a -= 1
  b -= 1
  for i in range(-1,2):
    for j in range(-1,2):
      if 1 <= a+i <= H-2 and 1 <= b+j <= W-2:
        Count[Cells[(a+i,b+j)]] -= 1
        Count[Cells[(a+i,b+j)]+1] += 1
      Cells[(a+i,b+j)] += 1
for c in Count:
  print(c)