Buggy python submission (verdict: Time Limit Exceeded):
import math

H, W, N = map(int, input().split())
count = [0]*10
count[0] = (H-2)*(W-2)
rectmap=[]

#print(board)
for i in range(0,N):
    a, b = input().split()
    a = int(a)
    b = int(b)
    al = max(a-1, 2)
    au = min(a+2, H)
    bl = max(b-1, 2)
    bu = min(b+2, W)

    for j in range(al, au):
        for k in range(bl, bu):
            rectmap.append([j-1, k-1])
##    for j in range(a-1, a+2):
##        for k in range(b-1, b+2):
##            if j>1 and j<H and k>1 and k<W:
##                rectmap.append([j-1, k-1])
#print(rectmap)
rectmap.sort()
while len(rectmap)!=0 :
    c = rectmap.count(rectmap[0])
    del rectmap[:c]
    count[c]+=1
    count[0]-=1
for i in range(0, 10):
    print(count[i])    
#print(H,W,N)
#print(ab)


Fixed submission:
import math

H, W, N = map(int, input().split())
count = [0]*10
count[0] = (H-2)*(W-2)
rectmap={}

#print(board)
for i in range(0,N):
    a, b = input().split()
    a = int(a)
    b = int(b)
    ab = (a, b)
    al = max(a-1, 2)
    au = min(a+2, H)
    bl = max(b-1, 2)
    bu = min(b+2, W)

    for j in range(al, au):
        for k in range(bl, bu):
            if (j,k) in rectmap:
                rectmap[(j,k)] +=1
            else:
                rectmap[(j,k)] = 1
#            print(rectmap)
##    for j in range(a-1, a+2):
##        for k in range(b-1, b+2):
##            if j>1 and j<H and k>1 and k<W:
##                rectmap.append([j-1, k-1])
#print(rectmap)
for i in rectmap.values():
    count[i]+=1
    count[0]-=1
for c in count:
    print(c)
#print(H,W,N)
#print(ab)

Buggy python submission (verdict: Time Limit Exceeded):
import math

H, W, N = map(int, input().split())
count = [0]*10
count[0] = (H-2)*(W-2)
rectmap=[]

#print(board)
for i in range(0,N):
    a, b = input().split()
    a = int(a)
    b = int(b)
    al = max(a-1, 2)
    au = min(a+2, H)
    bl = max(b-1, 2)
    bu = min(b+2, W)

    for j in range(al, au):
        for k in range(bl, bu):
            rectmap.append([j-1, k-1])
##    for j in range(a-1, a+2):
##        for k in range(b-1, b+2):
##            if j>1 and j<H and k>1 and k<W:
##                rectmap.append([j-1, k-1])
#print(rectmap)
rectmap.sort()
rectmap.append([])
while len(rectmap)!=1 :
#    print(rectmap[0])
#    print(rectmap)
    c=0
#    print(rectmap)
    while rectmap[0]==rectmap[1]:
        c+=1
        rectmap.pop(0)
    c+=1
    rectmap.pop(0)
#    print(rectmap)
#    input()
    count[c]+=1
    count[0]-=1
for i in range(0, 10):
    print(count[i])    
#print(H,W,N)
#print(ab)


Fixed submission:
import math

H, W, N = map(int, input().split())
count = [0]*10
count[0] = (H-2)*(W-2)
rectmap={}

#print(board)
for i in range(0,N):
    a, b = input().split()
    a = int(a)
    b = int(b)
    ab = (a, b)
    al = max(a-1, 2)
    au = min(a+2, H)
    bl = max(b-1, 2)
    bu = min(b+2, W)

    for j in range(al, au):
        for k in range(bl, bu):
            if (j,k) in rectmap:
                rectmap[(j,k)] +=1
            else:
                rectmap[(j,k)] = 1
#            print(rectmap)
##    for j in range(a-1, a+2):
##        for k in range(b-1, b+2):
##            if j>1 and j<H and k>1 and k<W:
##                rectmap.append([j-1, k-1])
#print(rectmap)
for i in rectmap.values():
    count[i]+=1
    count[0]-=1
for c in count:
    print(c)
#print(H,W,N)
#print(ab)

Buggy python submission (verdict: Time Limit Exceeded):
import math

H, W, N = map(int, input().split())
count = [0]*10
count[0] = (H-2)*(W-2)
rectmap=[]

#print(board)
for i in range(0,N):
    a, b = list(map(int, input().split()))
    for j in range(a-1, a+2):
        for k in range(b-1, b+2):
            if j>1 and j<H and k>1 and k<W:
                rectmap.append([j-1, k-1])
#print(rectmap)
rectmap.sort()
rectmap.append([])
while len(rectmap)!=1 :
#    print(rectmap[0])
#    print(rectmap)
    c=0
#    print(rectmap)
    while rectmap[0]==rectmap[1]:
        c+=1
        rectmap.pop(0)
    c+=1
    rectmap.pop(0)
#    print(rectmap)
#    input()
    count[c]+=1
    count[0]-=1
for i in range(0, 10):
    print(count[i])    
#print(H,W,N)
#print(ab)


Fixed submission:
import math

H, W, N = map(int, input().split())
count = [0]*10
count[0] = (H-2)*(W-2)
rectmap={}

#print(board)
for i in range(0,N):
    a, b = input().split()
    a = int(a)
    b = int(b)
    ab = (a, b)
    al = max(a-1, 2)
    au = min(a+2, H)
    bl = max(b-1, 2)
    bu = min(b+2, W)

    for j in range(al, au):
        for k in range(bl, bu):
            if (j,k) in rectmap:
                rectmap[(j,k)] +=1
            else:
                rectmap[(j,k)] = 1
#            print(rectmap)
##    for j in range(a-1, a+2):
##        for k in range(b-1, b+2):
##            if j>1 and j<H and k>1 and k<W:
##                rectmap.append([j-1, k-1])
#print(rectmap)
for i in rectmap.values():
    count[i]+=1
    count[0]-=1
for c in count:
    print(c)
#print(H,W,N)
#print(ab)

Buggy python submission (verdict: Time Limit Exceeded):
import math

H, W, N = map(int, input().split())
count = [0]*10
count[0] = (H-2)*(W-2)
rectmap=[]

#print(board)
for i in range(0,N):
    a, b = list(map(int, input().split()))
    for j in range(a-1, a+2):
        for k in range(b-1, b+2):
            if j>1 and j<H and k>1 and k<W:
                rectmap.append([j-1, k-1])
#    print(rectmap)
rectmap.sort()
while rectmap!=[] :
#    print(rectmap[0])
#    print(rectmap)
    count[rectmap.count(rectmap[0])]+=1
    count[0]-=1
    del rectmap[:rectmap.count(rectmap[0])]
for i in range(0, 10):
    print(count[i])    
#print(H,W,N)
#print(ab)


Fixed submission:
import math

H, W, N = map(int, input().split())
count = [0]*10
count[0] = (H-2)*(W-2)
rectmap={}

#print(board)
for i in range(0,N):
    a, b = input().split()
    a = int(a)
    b = int(b)
    ab = (a, b)
    al = max(a-1, 2)
    au = min(a+2, H)
    bl = max(b-1, 2)
    bu = min(b+2, W)

    for j in range(al, au):
        for k in range(bl, bu):
            if (j,k) in rectmap:
                rectmap[(j,k)] +=1
            else:
                rectmap[(j,k)] = 1
#            print(rectmap)
##    for j in range(a-1, a+2):
##        for k in range(b-1, b+2):
##            if j>1 and j<H and k>1 and k<W:
##                rectmap.append([j-1, k-1])
#print(rectmap)
for i in rectmap.values():
    count[i]+=1
    count[0]-=1
for c in count:
    print(c)
#print(H,W,N)
#print(ab)

Buggy python submission (verdict: Time Limit Exceeded):
import math

H, W, N = map(int, input().split())
board = [[0 for i in range(W+4)] for j in range(H+4)]
ab = [0]*N
count = [0]*10
count[0] = (H-2)*(W-2)
#print(board)
for i in range(0,N):
    ab[i] = list(map(int, input().split()))
    a=ab[i][0]
    b=ab[i][1]
    for j in range(a-1, a+2):
        for k in range(b-1, b+2):
            c=0
            if j>1 and j<H and k>1 and k<W:
#                print(j, k)
                for l in range(j, j+3):
                    for m in range(k, k+3):
                            c+=board[l][m]
#            print(c)
                count[c]-=1
                count[c+1]+=1            
    board[a+1][b+1]=1
#    print(count)
#    print(board)
for i in range(0, 10):
    print(count[i])    
#print(H,W,N)
#print(ab)


Fixed submission:
import math

H, W, N = map(int, input().split())
count = [0]*10
count[0] = (H-2)*(W-2)
rectmap={}

#print(board)
for i in range(0,N):
    a, b = input().split()
    a = int(a)
    b = int(b)
    ab = (a, b)
    al = max(a-1, 2)
    au = min(a+2, H)
    bl = max(b-1, 2)
    bu = min(b+2, W)

    for j in range(al, au):
        for k in range(bl, bu):
            if (j,k) in rectmap:
                rectmap[(j,k)] +=1
            else:
                rectmap[(j,k)] = 1
#            print(rectmap)
##    for j in range(a-1, a+2):
##        for k in range(b-1, b+2):
##            if j>1 and j<H and k>1 and k<W:
##                rectmap.append([j-1, k-1])
#print(rectmap)
for i in rectmap.values():
    count[i]+=1
    count[0]-=1
for c in count:
    print(c)
#print(H,W,N)
#print(ab)