Buggy python submission (verdict: Time Limit Exceeded):
import itertools
from collections import defaultdict
H,W,N=map(int, raw_input().split())

d=[-1,0,1]
D=list(itertools.product(d,d))

C=set()	#Center
A=defaultdict(lambda: 0)
for i in range(N):
	a,b=map(int, raw_input().split())
	A[(a,b)]=1
	for dx,dy in D:
		cx=a+dx
		cy=b+dy
		if cx>=2 and cx<=H-1 and cy>=2 and cy<=W-1:
			C.add( (cx,cy) )

l=defaultdict(lambda: 0)

for x,y in C:
	cnt=0
	for i,j in D:
		if A[(x+i,y+j)]==1:
			cnt+=1
	l[cnt]+=1



for i in range(10):
	if i==0:
		print (H-2)*(W-2)-sum(l.values())
	else:
		print l[i]




Fixed submission:
import itertools
from collections import defaultdict
from collections import Counter
H,W,N=map(int, raw_input().split())

d=[-1,0,1]
D=list(itertools.product(d,d))

A=defaultdict(lambda: 0)
for i in range(N):
	a,b=map(int, raw_input().split())
	for dx,dy in D:
		cx=a+dx
		cy=b+dy
		if cx>=2 and cx<=H-1 and cy>=2 and cy<=W-1:
			A[(cx,cy)]+=1

C=Counter(A.values())


for i in range(10):
	if i==0:
		print (H-2)*(W-2)-sum(C.values())
	else:
		print C[i]

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
from collections import defaultdict
H,W,N=map(int, raw_input().split())

d=[-1,0,1]
D=list(itertools.product(d,d))

C=set()	#Center
A=[]
for i in range(N):
	a,b=map(int, raw_input().split())
	A.append((a,b))
	for dx,dy in D:
		cx=a+dx
		cy=b+dy
		if cx>=2 and cx<=H-1 and cy>=2 and cy<=W-1:
			C.add( (cx,cy) )



l=defaultdict(lambda: 0)

for x,y in C:
	cnt=0
	for i,j in D:
		#print x+i,y+j,A[x+i][y+j]
		if (x+i, y+j) in A:
			cnt+=1
	l[cnt]+=1



for i in range(10):
	if i==0:
		print (H-2)*(W-2)-sum(l.values())
	else:
		print l[i]




Fixed submission:
import itertools
from collections import defaultdict
from collections import Counter
H,W,N=map(int, raw_input().split())

d=[-1,0,1]
D=list(itertools.product(d,d))

A=defaultdict(lambda: 0)
for i in range(N):
	a,b=map(int, raw_input().split())
	for dx,dy in D:
		cx=a+dx
		cy=b+dy
		if cx>=2 and cx<=H-1 and cy>=2 and cy<=W-1:
			A[(cx,cy)]+=1

C=Counter(A.values())


for i in range(10):
	if i==0:
		print (H-2)*(W-2)-sum(C.values())
	else:
		print C[i]

Buggy python submission (verdict: Runtime Error):
import itertools
from collections import defaultdict
H,W,N=map(int, raw_input().split())

A=[ [None for i in range(W+1) ] for j in range(H+1)]
for i in range(N):
	a,b=map(int, raw_input().split())
	A[a][b]=1

d=[-1,0,1]
D=list(itertools.product(d,d))

l=defaultdict(lambda: 0)

for x in range(2,H):
	for y in range(2,W):
		cnt=0
		for i,j in D:
			#print x+i,y+j,A[x+i][y+j]
			if A[x+i][y+j]==1:
				cnt+=1
		l[cnt]+=1


for i in range(10):
	print l[i]


Fixed submission:
import itertools
from collections import defaultdict
from collections import Counter
H,W,N=map(int, raw_input().split())

d=[-1,0,1]
D=list(itertools.product(d,d))

A=defaultdict(lambda: 0)
for i in range(N):
	a,b=map(int, raw_input().split())
	for dx,dy in D:
		cx=a+dx
		cy=b+dy
		if cx>=2 and cx<=H-1 and cy>=2 and cy<=W-1:
			A[(cx,cy)]+=1

C=Counter(A.values())


for i in range(10):
	if i==0:
		print (H-2)*(W-2)-sum(C.values())
	else:
		print C[i]

Buggy python submission (verdict: Runtime Error):
import itertools
from collections import defaultdict
H,W,N=map(int, raw_input().split())

A=[ [None for i in range(W+1) ] for j in range(H+1)]
for i in range(N):
	a,b=map(int, raw_input().split())
	A[a][b]=1

d=[-1,0,1]
D=list(itertools.product(d,d))

l=defaultdict(lambda: 0)

for x in range(2,H):
	for y in range(2,W):
		cnt=0
		for i,j in D:
			#print x+i,y+j,A[x+i][y+j]
			if A[x+i][y+j]==1:
				cnt+=1
		l[cnt]+=1

print l

for i in range(10):
	print l[i]


Fixed submission:
import itertools
from collections import defaultdict
from collections import Counter
H,W,N=map(int, raw_input().split())

d=[-1,0,1]
D=list(itertools.product(d,d))

A=defaultdict(lambda: 0)
for i in range(N):
	a,b=map(int, raw_input().split())
	for dx,dy in D:
		cx=a+dx
		cy=b+dy
		if cx>=2 and cx<=H-1 and cy>=2 and cy<=W-1:
			A[(cx,cy)]+=1

C=Counter(A.values())


for i in range(10):
	if i==0:
		print (H-2)*(W-2)-sum(C.values())
	else:
		print C[i]