node_ids
sequencelengths 4
1.4k
| edge_index
sequencelengths 1
2.22k
| text
sequencelengths 4
1.4k
| source
stringlengths 14
427k
|
---|---|---|---|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
42,
13,
0,
13,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
0,
13,
39,
2,
13,
2,
13,
17,
2,
13,
2,
13,
17,
0,
18,
13,
13,
2,
4,
18,
13,
13,
13,
17,
40,
2,
2,
40,
13,
18,
13,
17,
17,
18,
13,
17,
13,
41,
28,
13,
4,
13,
17,
4,
4,
18,
4,
13,
4,
18,
13,
13,
13,
2,
13,
17,
0,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
17,
13,
10,
39,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] | [
[
141,
2
],
[
141,
11
],
[
141,
12
],
[
123,
14
],
[
129,
19
],
[
135,
22
],
[
135,
31
],
[
34,
33
],
[
126,
38
],
[
133,
41
],
[
33,
43
],
[
136,
46
],
[
33,
48
],
[
54,
51
],
[
124,
52
],
[
127,
53
],
[
124,
57
],
[
127,
59
],
[
139,
65
],
[
127,
67
],
[
127,
71
],
[
142,
73
],
[
77,
76
],
[
124,
87
],
[
76,
91
],
[
144,
94
],
[
139,
101
],
[
142,
104
],
[
145,
108
],
[
111,
110
],
[
145,
117
],
[
110,
118
],
[
141,
121
],
[
123,
124
],
[
126,
127
],
[
129,
130
],
[
135,
133
],
[
135,
136
],
[
141,
139
],
[
141,
142
],
[
144,
145
]
] | [
"H,W,N = map(int,input().split())\nD = {}\n\nwhile N:\n N-=1\n x,y = map(int,input().split())\n \n for i in range(9):\n a = (x+i%3,y+i//3)\n D[a] = D.get(a,0)+(H>=a[0]>2<a[1]<=W)\n\nc = [list(D.values()).count(i+1) for i in range(9)]\nprint((H-2)*(W-2)-sum(c))\n\nfor i in range(9):\n print(c[i])",
"H,W,N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"D = {}",
"D",
"{}",
"while N:\n N-=1\n x,y = map(int,input().split())\n \n for i in range(9):\n a = (x+i%3,y+i//3)\n D[a] = D.get(a,0)+(H>=a[0]>2<a[1]<=W)",
"N",
"N-=1",
"N",
"1",
"x,y = map(int,input().split())",
"x",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"for i in range(9):\n a = (x+i%3,y+i//3)\n D[a] = D.get(a,0)+(H>=a[0]>2<a[1]<=W)",
"i",
"range(9)",
"range",
"9",
"a = (x+i%3,y+i//3)",
"a",
"(x+i%3,y+i//3)",
"x+i%3",
"x",
"i%3",
"i",
"3",
"y+i//3",
"y",
"i//3",
"i",
"3",
"D[a] = D.get(a,0)+(H>=a[0]>2<a[1]<=W)",
"D[a]",
"D",
"a",
"D.get(a,0)+(H>=a[0]>2<a[1]<=W)",
"D.get(a,0)",
"D.get",
"D",
"get",
"a",
"0",
"H>=a[0]>2<a[1]<=W",
"H>=a[0]>2<a[1]",
"H>=a[0]>2",
"H>=a[0]",
"H",
"a[0]",
"a",
"0",
"2",
"a[1]",
"a",
"1",
"W",
"list(D.values()).count(i+1) for i in range(9)",
"for i in range(9)",
"i",
"range(9)",
"range",
"9",
"for i in range(9)",
"list(D.values()).count(i+1)",
"(D.values()).count",
"(D.values())",
"list",
"D.values()",
"D.values",
"D",
"values",
"count",
"i+1",
"i",
"1",
"c = [list(D.values()).count(i+1) for i in range(9)]",
"c",
"[list(D.values()).count(i+1) for i in range(9)]",
"print((H-2)*(W-2)-sum(c))",
"print",
"(H-2)*(W-2)-sum(c)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(c)",
"sum",
"c",
"for i in range(9):\n print(c[i])",
"i",
"range(9)",
"range",
"9",
"print(c[i])",
"print",
"c[i]",
"c",
"i",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"D = {}",
"{}",
"D",
"a = (x+i%3,y+i//3)",
"(x+i%3,y+i//3)",
"a",
"N-=1",
"1",
"N",
"x,y = map(int,input().split())",
"map(int,input().split())",
"x",
"y = map(int,input().split())",
"map(int,input().split())",
"y",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"c = [list(D.values()).count(i+1) for i in range(9)]",
"[list(D.values()).count(i+1) for i in range(9)]",
"c"
] | H,W,N = map(int,input().split())
D = {}
while N:
N-=1
x,y = map(int,input().split())
for i in range(9):
a = (x+i%3,y+i//3)
D[a] = D.get(a,0)+(H>=a[0]>2<a[1]<=W)
c = [list(D.values()).count(i+1) for i in range(9)]
print((H-2)*(W-2)-sum(c))
for i in range(9):
print(c[i]) |
[
7,
15,
15,
15,
13,
15,
13,
15,
13,
15,
15,
13,
15,
13,
15,
15,
15,
15,
0,
13,
4,
13,
17,
12,
13,
12,
13,
12,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
13,
12,
13,
23,
13,
0,
13,
17,
0,
13,
4,
13,
13,
13,
0,
13,
39,
28,
13,
13,
4,
13,
13,
28,
13,
13,
4,
13,
39,
17,
17,
17,
39,
17,
17,
17,
14,
2,
40,
40,
17,
2,
13,
13,
2,
13,
17,
40,
40,
17,
2,
13,
13,
2,
13,
17,
0,
13,
39,
39,
2,
13,
13,
2,
13,
13,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
28,
13,
13,
4,
18,
4,
13,
13,
13,
0,
18,
13,
2,
13,
17,
17,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
12,
13,
10,
4,
13,
10,
13,
13,
10,
12,
13,
10,
12,
13,
10,
39,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
17,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
39,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13
] | [
[
269,
19
],
[
34,
33
],
[
267,
39
],
[
43,
43
],
[
47,
46
],
[
243,
52
],
[
56,
56
],
[
60,
59
],
[
231,
65
],
[
69,
69
],
[
73,
72
],
[
228,
78
],
[
82,
82
],
[
86,
85
],
[
231,
93
],
[
97,
97
],
[
101,
100
],
[
109,
109
],
[
248,
111
],
[
263,
114
],
[
243,
116
],
[
263,
117
],
[
263,
118
],
[
260,
120
],
[
258,
126
],
[
222,
127
],
[
240,
150
],
[
264,
159
],
[
233,
162
],
[
174,
173
],
[
224,
180
],
[
234,
189
],
[
261,
189
],
[
197,
192
],
[
225,
193
],
[
240,
203
],
[
264,
206
],
[
225,
210
],
[
213,
212
],
[
225,
212
],
[
212,
216
],
[
263,
222
],
[
224,
225
],
[
233,
234
],
[
263,
240
],
[
248,
249
],
[
260,
261
],
[
263,
264
],
[
269,
270
]
] | [
"from collections import defaultdict, deque, Counter\nfrom heapq import heappush, heappop, heapify\nimport math\nimport bisect\nimport random\nfrom itertools import permutations, accumulate, combinations, product\nimport sys\nimport string\nfrom bisect import bisect_left, bisect_right\nfrom math import factorial, ceil, floor\nfrom operator import mul\nfrom functools import reduce\n\n\nINF = float('inf')\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef I(): return int(sys.stdin.readline())\ndef LS(): return sys.stdin.readline().split()\ndef S(): return sys.stdin.readline().strip()\ndef IR(n): return [I() for i in range(n)]\ndef LIR(n): return [LI() for i in range(n)]\ndef SR(n): return [S() for i in range(n)]\ndef LSR(n): return [LS() for i in range(n)]\ndef SRL(n): return [list(S()) for i in range(n)]\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\nmod = 1000000007\n\n\n\nh, w, n = LI()\nA = []\nfor a, b in LIR(n):\n for i, j in product((1, 0, -1), (1, 0, -1)):\n if 2 <= a + i <= h - 1 and 2 <= b + j <= w - 1:\n A += [(a + i, b + j)]\n\n\nans = [0 for i in range(9)]\nfor k, v in Counter(A).items():\n ans[v - 1] += 1\n\n\nprint((h - 2) * (w - 2) - sum(ans))\nfor j in ans:\n print(j)",
"from collections import defaultdict, deque, Counter",
"from heapq import heappush, heappop, heapify",
"import math",
"math",
"import bisect",
"bisect",
"import random",
"random",
"from itertools import permutations, accumulate, combinations, product",
"import sys",
"sys",
"import string",
"string",
"from bisect import bisect_left, bisect_right",
"from math import factorial, ceil, floor",
"from operator import mul",
"from functools import reduce",
"INF = float('inf')",
"INF",
"float('inf')",
"float",
"'inf'",
"def LI(): return list(map(int, sys.stdin.readline().split()))",
"LI",
"def I(): return int(sys.stdin.readline())",
"I",
"def LS(): return sys.stdin.readline().split()",
"LS",
"def S(): return sys.stdin.readline().strip()",
"S",
"I() for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"I()",
"I",
"def IR(n): return [I() for i in range(n)]",
"IR",
"n",
"n",
"LI() for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"LI()",
"LI",
"def LIR(n): return [LI() for i in range(n)]",
"LIR",
"n",
"n",
"S() for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"S()",
"S",
"def SR(n): return [S() for i in range(n)]",
"SR",
"n",
"n",
"LS() for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"LS()",
"LS",
"def LSR(n): return [LS() for i in range(n)]",
"LSR",
"n",
"n",
"list(S()) for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"list(S())",
"list",
"S()",
"S",
"def SRL(n): return [list(S()) for i in range(n)]",
"SRL",
"n",
"n",
"[int(j) for j in list(S())] for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"[int(j) for j in list(S())]",
"def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]",
"MSRL",
"n",
"n",
"mod = 1000000007",
"mod",
"1000000007",
"h, w, n = LI()",
"h",
"LI()",
"LI",
"w",
"n",
"A = []",
"A",
"[]",
"for a, b in LIR(n):\n for i, j in product((1, 0, -1), (1, 0, -1)):\n if 2 <= a + i <= h - 1 and 2 <= b + j <= w - 1:\n A += [(a + i, b + j)]",
"a",
"b",
"LIR(n)",
"LIR",
"n",
"for i, j in product((1, 0, -1), (1, 0, -1)):\n if 2 <= a + i <= h - 1 and 2 <= b + j <= w - 1:\n A += [(a + i, b + j)]",
"i",
"j",
"product((1, 0, -1), (1, 0, -1))",
"product",
"(1, 0, -1)",
"1",
"0",
"-1",
"(1, 0, -1)",
"1",
"0",
"-1",
"if 2 <= a + i <= h - 1 and 2 <= b + j <= w - 1:\n A += [(a + i, b + j)]",
"2 <= a + i <= h - 1 and 2 <= b + j <= w - 1",
"2 <= a + i <= h - 1",
"2 <= a + i",
"2",
"a + i",
"a",
"i",
"h - 1",
"h",
"1",
"2 <= b + j <= w - 1",
"2 <= b + j",
"2",
"b + j",
"b",
"j",
"w - 1",
"w",
"1",
"A += [(a + i, b + j)]",
"A",
"[(a + i, b + j)]",
"(a + i, b + j)",
"a + i",
"a",
"i",
"b + j",
"b",
"j",
"0 for i in range(9)",
"for i in range(9)",
"i",
"range(9)",
"range",
"9",
"for i in range(9)",
"0",
"ans = [0 for i in range(9)]",
"ans",
"[0 for i in range(9)]",
"for k, v in Counter(A).items():\n ans[v - 1] += 1",
"k",
"v",
"Counter(A).items()",
"(A).items",
"(A)",
"Counter",
"A",
"items",
"ans[v - 1] += 1",
"ans[v - 1]",
"ans",
"v - 1",
"v",
"1",
"1",
"print((h - 2) * (w - 2) - sum(ans))",
"print",
"(h - 2) * (w - 2) - sum(ans)",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"for j in ans:\n print(j)",
"j",
"ans",
"print(j)",
"print",
"j",
"def SR(n): return [S() for i in range(n)]",
"def SR(n): return [S() for i in range(n)]",
"SR",
"n = LI()",
"LI()",
"n",
"ans = [0 for i in range(9)]",
"[0 for i in range(9)]",
"ans",
"def LS(): return sys.stdin.readline().split()",
"def LS(): return sys.stdin.readline().split()",
"LS",
"def S(): return sys.stdin.readline().strip()",
"def S(): return sys.stdin.readline().strip()",
"S",
"A += [(a + i, b + j)]",
"[(a + i, b + j)]",
"A",
"def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]",
"def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]",
"MSRL",
"h, w, n = LI()",
"LI()",
"h",
"def LI(): return list(map(int, sys.stdin.readline().split()))",
"def LI(): return list(map(int, sys.stdin.readline().split()))",
"LI",
"def IR(n): return [I() for i in range(n)]",
"def IR(n): return [I() for i in range(n)]",
"IR",
"mod = 1000000007",
"1000000007",
"mod",
"def LSR(n): return [LS() for i in range(n)]",
"def LSR(n): return [LS() for i in range(n)]",
"LSR",
"def SRL(n): return [list(S()) for i in range(n)]",
"def SRL(n): return [list(S()) for i in range(n)]",
"SRL",
"def LIR(n): return [LI() for i in range(n)]",
"def LIR(n): return [LI() for i in range(n)]",
"LIR",
"A = []",
"[]",
"A",
"w, n = LI()",
"LI()",
"w",
"def I(): return int(sys.stdin.readline())",
"def I(): return int(sys.stdin.readline())",
"I",
"INF = float('inf')",
"float('inf')",
"INF"
] | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007
h, w, n = LI()
A = []
for a, b in LIR(n):
for i, j in product((1, 0, -1), (1, 0, -1)):
if 2 <= a + i <= h - 1 and 2 <= b + j <= w - 1:
A += [(a + i, b + j)]
ans = [0 for i in range(9)]
for k, v in Counter(A).items():
ans[v - 1] += 1
print((h - 2) * (w - 2) - sum(ans))
for j in ans:
print(j) |
[
7,
15,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
0,
13,
13,
12,
13,
0,
13,
13,
28,
13,
4,
13,
2,
18,
13,
17,
17,
2,
18,
13,
17,
17,
14,
40,
40,
17,
13,
2,
13,
17,
28,
13,
4,
13,
2,
18,
13,
17,
17,
2,
18,
13,
17,
17,
14,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
39,
13,
13,
17,
29,
13,
23,
13,
23,
13,
0,
13,
4,
18,
13,
13,
12,
17,
0,
13,
13,
28,
13,
13,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
4,
18,
13,
13,
0,
13,
39,
0,
13,
17,
28,
13,
4,
13,
17,
17,
0,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
13,
0,
13,
13,
0,
13,
2,
2,
2,
13,
17,
2,
13,
17,
13,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
39,
13,
10,
2,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
12,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13
] | [
[
6,
5
],
[
5,
14
],
[
200,
16
],
[
200,
18
],
[
200,
19
],
[
23,
22
],
[
195,
25
],
[
197,
33
],
[
39,
38
],
[
94,
39
],
[
42,
41
],
[
96,
46
],
[
96,
51
],
[
41,
58
],
[
189,
60
],
[
64,
63
],
[
96,
68
],
[
96,
73
],
[
63,
80
],
[
201,
82
],
[
90,
85
],
[
38,
86
],
[
38,
92
],
[
94,
94
],
[
96,
96
],
[
206,
98
],
[
182,
106
],
[
207,
107
],
[
110,
109
],
[
198,
109
],
[
212,
112
],
[
204,
114
],
[
183,
115
],
[
213,
115
],
[
109,
116
],
[
191,
118
],
[
213,
123
],
[
183,
123
],
[
173,
126
],
[
179,
129
],
[
133,
132
],
[
185,
138
],
[
192,
141
],
[
132,
143
],
[
174,
146
],
[
186,
148
],
[
209,
150
],
[
186,
151
],
[
176,
153
],
[
201,
157
],
[
189,
160
],
[
210,
162
],
[
180,
162
],
[
177,
165
],
[
168,
167
],
[
174,
167
],
[
167,
171
],
[
173,
174
],
[
176,
177
],
[
179,
180
],
[
207,
182
],
[
182,
183
],
[
185,
186
],
[
200,
189
],
[
191,
192
],
[
200,
195
],
[
197,
198
],
[
200,
201
],
[
206,
207
],
[
186,
209
],
[
209,
210
],
[
212,
213
]
] | [
"import collections\n\nh, w, n = [int(i) for i in input().split()]\ns = [tuple(int(i) for i in input().split()) for j in range(n)]\n\ndef dictadd(d, si):\n dc = d\n for i in range(si[0]-2, si[0]+1):\n if 1 <= i <= h-2:\n for j in range(si[1]-2, si[1]+1):\n if 1 <= j <= w-2:\n dc[(i, j)] += 1\n return dc\n\n\nd = collections.defaultdict(lambda: 0)\ndc = d\n\nfor i in s:\n dc = dictadd(dc, i)\n\ndcv = list(dc.values())\nans = []\ntot = 0\n\nfor i in range(1, 10):\n x = dcv.count(i)\n ans.append(x)\n tot += x\n\nz = (w-2)*(h-2)-tot\n\nprint(z)\nfor i in ans:\n print(i)",
"import collections",
"collections",
"int(i) for i in input().split()",
"for i in input().split()",
"i",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in input().split()",
"int(i)",
"int",
"i",
"h, w, n = [int(i) for i in input().split()]",
"h",
"[int(i) for i in input().split()]",
"w",
"n",
"tuple(int(i) for i in input().split()) for j in range(n)",
"for j in range(n)",
"j",
"range(n)",
"range",
"n",
"for j in range(n)",
"tuple(int(i) for i in input().split())",
"tuple",
"int(i)",
"int",
"i",
"s = [tuple(int(i) for i in input().split()) for j in range(n)]",
"s",
"[tuple(int(i) for i in input().split()) for j in range(n)]",
"def dictadd(d, si):\n dc = d\n for i in range(si[0]-2, si[0]+1):\n if 1 <= i <= h-2:\n for j in range(si[1]-2, si[1]+1):\n if 1 <= j <= w-2:\n dc[(i, j)] += 1\n return dc",
"dictadd",
"dc = d",
"dc",
"d",
"for i in range(si[0]-2, si[0]+1):\n if 1 <= i <= h-2:\n for j in range(si[1]-2, si[1]+1):\n if 1 <= j <= w-2:\n dc[(i, j)] += 1\n ",
"i",
"range(si[0]-2, si[0]+1)",
"range",
"si[0]-2",
"si[0]",
"si",
"0",
"2",
"si[0]+1",
"si[0]",
"si",
"0",
"1",
"if 1 <= i <= h-2:\n for j in range(si[1]-2, si[1]+1):\n if 1 <= j <= w-2:\n dc[(i, j)] += 1\n ",
"1 <= i <= h-2",
"1 <= i",
"1",
"i",
"h-2",
"h",
"2",
"for j in range(si[1]-2, si[1]+1):\n if 1 <= j <= w-2:\n dc[(i, j)] += 1\n ",
"j",
"range(si[1]-2, si[1]+1)",
"range",
"si[1]-2",
"si[1]",
"si",
"1",
"2",
"si[1]+1",
"si[1]",
"si",
"1",
"1",
"if 1 <= j <= w-2:\n dc[(i, j)] += 1\n ",
"1 <= j <= w-2",
"1 <= j",
"1",
"j",
"w-2",
"w",
"2",
"dc[(i, j)] += 1",
"dc[(i, j)]",
"dc",
"(i, j)",
"i",
"j",
"1",
"return dc",
"dc",
"d",
"d",
"si",
"si",
"d = collections.defaultdict(lambda: 0)",
"d",
"collections.defaultdict(lambda: 0)",
"collections.defaultdict",
"collections",
"defaultdict",
"lambda: 0",
"0",
"dc = d",
"dc",
"d",
"for i in s:\n dc = dictadd(dc, i)",
"i",
"s",
"dc = dictadd(dc, i)",
"dc",
"dictadd(dc, i)",
"dictadd",
"dc",
"i",
"dcv = list(dc.values())",
"dcv",
"list(dc.values())",
"list",
"dc.values()",
"dc.values",
"dc",
"values",
"ans = []",
"ans",
"[]",
"tot = 0",
"tot",
"0",
"for i in range(1, 10):\n x = dcv.count(i)\n ans.append(x)\n tot += x",
"i",
"range(1, 10)",
"range",
"1",
"10",
"x = dcv.count(i)",
"x",
"dcv.count(i)",
"dcv.count",
"dcv",
"count",
"i",
"ans.append(x)",
"ans.append",
"ans",
"append",
"x",
"tot += x",
"tot",
"x",
"z = (w-2)*(h-2)-tot",
"z",
"(w-2)*(h-2)-tot",
"(w-2)*(h-2)",
"w-2",
"w",
"2",
"h-2",
"h",
"2",
"tot",
"print(z)",
"print",
"z",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"ans = []",
"[]",
"ans",
"z = (w-2)*(h-2)-tot",
"(w-2)*(h-2)-tot",
"z",
"tot = 0",
"0",
"tot",
"dc = d",
"d",
"dc",
"x = dcv.count(i)",
"dcv.count(i)",
"x",
"h, w, n = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"h",
"dcv = list(dc.values())",
"list(dc.values())",
"dcv",
"n = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"n",
"s = [tuple(int(i) for i in input().split()) for j in range(n)]",
"[tuple(int(i) for i in input().split()) for j in range(n)]",
"s",
"w, n = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"w",
"def dictadd(d, si):\n dc = d\n for i in range(si[0]-2, si[0]+1):\n if 1 <= i <= h-2:\n for j in range(si[1]-2, si[1]+1):\n if 1 <= j <= w-2:\n dc[(i, j)] += 1\n return dc",
"def dictadd(d, si):\n dc = d\n for i in range(si[0]-2, si[0]+1):\n if 1 <= i <= h-2:\n for j in range(si[1]-2, si[1]+1):\n if 1 <= j <= w-2:\n dc[(i, j)] += 1\n return dc",
"dictadd",
"d = collections.defaultdict(lambda: 0)",
"collections.defaultdict(lambda: 0)",
"d",
"tot += x",
"x",
"tot",
"dc = dictadd(dc, i)",
"dictadd(dc, i)",
"dc"
] | import collections
h, w, n = [int(i) for i in input().split()]
s = [tuple(int(i) for i in input().split()) for j in range(n)]
def dictadd(d, si):
dc = d
for i in range(si[0]-2, si[0]+1):
if 1 <= i <= h-2:
for j in range(si[1]-2, si[1]+1):
if 1 <= j <= w-2:
dc[(i, j)] += 1
return dc
d = collections.defaultdict(lambda: 0)
dc = d
for i in s:
dc = dictadd(dc, i)
dcv = list(dc.values())
ans = []
tot = 0
for i in range(1, 10):
x = dcv.count(i)
ans.append(x)
tot += x
z = (w-2)*(h-2)-tot
print(z)
for i in ans:
print(i) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
2,
13,
17,
13,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
14,
40,
2,
13,
13,
0,
18,
13,
13,
17,
14,
40,
2,
13,
18,
13,
13,
0,
18,
18,
13,
13,
13,
17,
0,
18,
18,
13,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
28,
13,
4,
18,
18,
13,
13,
13,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
18,
18,
13,
13,
13,
17,
0,
13,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
17,
17,
0,
13,
18,
13,
13,
0,
18,
13,
17,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
18,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13
] | [
[
194,
2
],
[
194,
11
],
[
194,
12
],
[
185,
14
],
[
18,
17
],
[
177,
20
],
[
197,
22
],
[
197,
31
],
[
203,
33
],
[
180,
35
],
[
204,
35
],
[
182,
37
],
[
198,
39
],
[
183,
39
],
[
43,
42
],
[
204,
46
],
[
180,
46
],
[
204,
49
],
[
180,
49
],
[
53,
52
],
[
183,
56
],
[
198,
56
],
[
183,
59
],
[
198,
59
],
[
42,
64
],
[
186,
65
],
[
70,
67
],
[
186,
68
],
[
42,
69
],
[
52,
74
],
[
67,
75
],
[
186,
76
],
[
42,
77
],
[
84,
79
],
[
67,
80
],
[
186,
81
],
[
42,
82
],
[
52,
83
],
[
91,
86
],
[
67,
87
],
[
186,
88
],
[
42,
89
],
[
52,
90
],
[
200,
93
],
[
100,
99
],
[
186,
102
],
[
106,
105
],
[
186,
109
],
[
99,
110
],
[
99,
117
],
[
195,
119
],
[
105,
124
],
[
174,
126
],
[
136,
129
],
[
201,
130
],
[
186,
133
],
[
99,
134
],
[
105,
135
],
[
191,
138
],
[
195,
141
],
[
174,
144
],
[
148,
147
],
[
188,
153
],
[
201,
155
],
[
147,
156
],
[
161,
158
],
[
201,
159
],
[
189,
161
],
[
192,
161
],
[
164,
163
],
[
201,
170
],
[
163,
171
],
[
194,
174
],
[
194,
177
],
[
197,
180
],
[
182,
183
],
[
185,
186
],
[
188,
189
],
[
191,
192
],
[
194,
195
],
[
197,
198
],
[
200,
201
],
[
203,
204
]
] | [
"H,W,N = map(int, input().split())\n\nfield = {}\nfor i in range(N):\n a,b = map(int, input().split())\n a,b = a-1,b-1\n for j in range(a-1, a+2):\n for k in range(b-1, b+2):\n if not j in field:\n field[j] = {}\n if not k in field[j]:\n field[j][k] = 0\n field[j][k] += 1\n\nans = [0] * 10\nfor kh in field.keys():\n for kw in field[kh].keys():\n if 1 <= kh <= H-2 and 1 <= kw <= W-2:\n ans[field[kh][kw]] += 1\n\ntmp = (H-2)*(W-2)\nfor i in range(1,10):\n tmp -= ans[i]\n\nans[0] = tmp\nfor i in range(10):\n print(ans[i])\n",
"H,W,N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"field = {}",
"field",
"{}",
"for i in range(N):\n a,b = map(int, input().split())\n a,b = a-1,b-1\n for j in range(a-1, a+2):\n for k in range(b-1, b+2):\n if not j in field:\n field[j] = {}\n if not k in field[j]:\n field[j][k] = 0\n field[j][k] += 1",
"i",
"range(N)",
"range",
"N",
"a,b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"a,b = a-1,b-1",
"a",
"a-1",
"a",
"1",
"b",
"b-1",
"b",
"1",
"for j in range(a-1, a+2):\n for k in range(b-1, b+2):\n if not j in field:\n field[j] = {}\n if not k in field[j]:\n field[j][k] = 0\n field[j][k] += 1",
"j",
"range(a-1, a+2)",
"range",
"a-1",
"a",
"1",
"a+2",
"a",
"2",
"for k in range(b-1, b+2):\n if not j in field:\n field[j] = {}\n if not k in field[j]:\n field[j][k] = 0\n field[j][k] += 1",
"k",
"range(b-1, b+2)",
"range",
"b-1",
"b",
"1",
"b+2",
"b",
"2",
"if not j in field:\n field[j] = {}\n ",
"not j in field",
"j in field",
"j",
"field",
"field[j] = {}",
"field[j]",
"field",
"j",
"{}",
"if not k in field[j]:\n field[j][k] = 0\n ",
"not k in field[j]",
"k in field[j]",
"k",
"field[j]",
"field",
"j",
"field[j][k] = 0",
"field[j][k]",
"[j]",
"field",
"j",
"k",
"0",
"field[j][k] += 1",
"field[j][k]",
"[j]",
"field",
"j",
"k",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for kh in field.keys():\n for kw in field[kh].keys():\n if 1 <= kh <= H-2 and 1 <= kw <= W-2:\n ans[field[kh][kw]] += 1",
"kh",
"field.keys()",
"field.keys",
"field",
"keys",
"for kw in field[kh].keys():\n if 1 <= kh <= H-2 and 1 <= kw <= W-2:\n ans[field[kh][kw]] += 1",
"kw",
"field[kh].keys()",
"[kh].keys",
"[kh]",
"field",
"kh",
"keys",
"if 1 <= kh <= H-2 and 1 <= kw <= W-2:\n ans[field[kh][kw]] += 1",
"1 <= kh <= H-2 and 1 <= kw <= W-2",
"1 <= kh <= H-2",
"1 <= kh",
"1",
"kh",
"H-2",
"H",
"2",
"1 <= kw <= W-2",
"1 <= kw",
"1",
"kw",
"W-2",
"W",
"2",
"ans[field[kh][kw]] += 1",
"ans[field[kh][kw]]",
"ans",
"field[kh][kw]",
"[kh]",
"field",
"kh",
"kw",
"1",
"tmp = (H-2)*(W-2)",
"tmp",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"for i in range(1,10):\n tmp -= ans[i]",
"i",
"range(1,10)",
"range",
"1",
"10",
"tmp -= ans[i]",
"tmp",
"ans[i]",
"ans",
"i",
"ans[0] = tmp",
"ans[0]",
"ans",
"0",
"tmp",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"W,N = map(int, input().split())",
"map(int, input().split())",
"W",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"a,b = map(int, input().split())",
"map(int, input().split())",
"a",
"b = a-1,b-1",
"b-1",
"b",
"field = {}",
"{}",
"field",
"tmp -= ans[i]",
"ans[i]",
"tmp",
"tmp = (H-2)*(W-2)",
"(H-2)*(W-2)",
"tmp",
"H,W,N = map(int, input().split())",
"map(int, input().split())",
"H",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"ans = [0] * 10",
"[0] * 10",
"ans",
"a,b = a-1,b-1",
"a-1",
"a"
] | H,W,N = map(int, input().split())
field = {}
for i in range(N):
a,b = map(int, input().split())
a,b = a-1,b-1
for j in range(a-1, a+2):
for k in range(b-1, b+2):
if not j in field:
field[j] = {}
if not k in field[j]:
field[j][k] = 0
field[j][k] += 1
ans = [0] * 10
for kh in field.keys():
for kw in field[kh].keys():
if 1 <= kh <= H-2 and 1 <= kw <= W-2:
ans[field[kh][kw]] += 1
tmp = (H-2)*(W-2)
for i in range(1,10):
tmp -= ans[i]
ans[0] = tmp
for i in range(10):
print(ans[i])
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
40,
2,
17,
2,
13,
13,
2,
13,
17,
40,
2,
17,
2,
13,
13,
2,
13,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
4,
13,
4,
18,
13,
13,
0,
13,
4,
13,
4,
18,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
13,
28,
13,
4,
13,
17,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
124,
3
],
[
124,
12
],
[
124,
13
],
[
133,
15
],
[
21,
20
],
[
122,
23
],
[
136,
25
],
[
136,
34
],
[
37,
36
],
[
42,
41
],
[
137,
51
],
[
36,
52
],
[
116,
54
],
[
131,
60
],
[
41,
61
],
[
125,
63
],
[
75,
66
],
[
134,
67
],
[
137,
70
],
[
36,
71
],
[
131,
73
],
[
41,
74
],
[
118,
77
],
[
134,
82
],
[
127,
85
],
[
119,
90
],
[
116,
97
],
[
125,
100
],
[
128,
102
],
[
105,
104
],
[
119,
112
],
[
104,
113
],
[
124,
116
],
[
118,
119
],
[
124,
122
],
[
124,
125
],
[
127,
128
],
[
136,
131
],
[
133,
134
],
[
136,
137
]
] | [
"from collections import defaultdict, Counter\nH, W, N = map(int, input().split())\nD = defaultdict(int)\n\nfor i in range(N):\n a, b = map(int, input().split())\n for y in range(3):\n for x in range(3):\n if 0 < a - y <= H - 2 and 0 < b - x <= W - 2:\n D[(a - y, b - x)] += 1\n\nC = Counter(D.values())\nSUM = sum(C.values())\n\nprint((H - 2) * (W - 2) - SUM)\nfor i in range(1, 10):\n print(C[i])",
"from collections import defaultdict, Counter",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"D = defaultdict(int)",
"D",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n a, b = map(int, input().split())\n for y in range(3):\n for x in range(3):\n if 0 < a - y <= H - 2 and 0 < b - x <= W - 2:\n D[(a - y, b - x)] += 1",
"i",
"range(N)",
"range",
"N",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for y in range(3):\n for x in range(3):\n if 0 < a - y <= H - 2 and 0 < b - x <= W - 2:\n D[(a - y, b - x)] += 1",
"y",
"range(3)",
"range",
"3",
"for x in range(3):\n if 0 < a - y <= H - 2 and 0 < b - x <= W - 2:\n D[(a - y, b - x)] += 1",
"x",
"range(3)",
"range",
"3",
"if 0 < a - y <= H - 2 and 0 < b - x <= W - 2:\n D[(a - y, b - x)] += 1",
"0 < a - y <= H - 2 and 0 < b - x <= W - 2",
"0 < a - y <= H - 2",
"0 < a - y",
"0",
"a - y",
"a",
"y",
"H - 2",
"H",
"2",
"0 < b - x <= W - 2",
"0 < b - x",
"0",
"b - x",
"b",
"x",
"W - 2",
"W",
"2",
"D[(a - y, b - x)] += 1",
"D[(a - y, b - x)]",
"D",
"(a - y, b - x)",
"a - y",
"a",
"y",
"b - x",
"b",
"x",
"1",
"C = Counter(D.values())",
"C",
"Counter(D.values())",
"Counter",
"D.values()",
"D.values",
"D",
"values",
"SUM = sum(C.values())",
"SUM",
"sum(C.values())",
"sum",
"C.values()",
"C.values",
"C",
"values",
"print((H - 2) * (W - 2) - SUM)",
"print",
"(H - 2) * (W - 2) - SUM",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"SUM",
"for i in range(1, 10):\n print(C[i])",
"i",
"range(1, 10)",
"range",
"1",
"10",
"print(C[i])",
"print",
"C[i]",
"C",
"i",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"C = Counter(D.values())",
"Counter(D.values())",
"C",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"SUM = sum(C.values())",
"sum(C.values())",
"SUM",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"D = defaultdict(int)",
"defaultdict(int)",
"D",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a"
] | from collections import defaultdict, Counter
H, W, N = map(int, input().split())
D = defaultdict(int)
for i in range(N):
a, b = map(int, input().split())
for y in range(3):
for x in range(3):
if 0 < a - y <= H - 2 and 0 < b - x <= W - 2:
D[(a - y, b - x)] += 1
C = Counter(D.values())
SUM = sum(C.values())
print((H - 2) * (W - 2) - SUM)
for i in range(1, 10):
print(C[i])
|
[
7,
15,
13,
15,
0,
13,
18,
18,
13,
13,
13,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
39,
17,
13,
0,
13,
2,
17,
17,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
2,
2,
40,
2,
13,
13,
17,
40,
2,
13,
13,
13,
40,
2,
13,
13,
17,
40,
2,
13,
13,
13,
9,
14,
2,
39,
2,
13,
13,
2,
13,
13,
13,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
28,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
18,
13,
10,
12,
13
] | [
[
173,
5
],
[
15,
14
],
[
174,
21
],
[
15,
23
],
[
15,
24
],
[
27,
26
],
[
24,
30
],
[
33,
32
],
[
38,
37
],
[
42,
41
],
[
24,
44
],
[
47,
46
],
[
174,
53
],
[
47,
55
],
[
58,
57
],
[
64,
63
],
[
46,
74
],
[
57,
75
],
[
46,
79
],
[
57,
80
],
[
14,
81
],
[
55,
84
],
[
63,
85
],
[
55,
89
],
[
63,
90
],
[
23,
91
],
[
46,
97
],
[
57,
98
],
[
55,
100
],
[
63,
101
],
[
37,
102
],
[
113,
104
],
[
37,
105
],
[
46,
108
],
[
57,
109
],
[
55,
111
],
[
63,
112
],
[
124,
115
],
[
37,
116
],
[
46,
119
],
[
57,
120
],
[
55,
122
],
[
63,
123
],
[
127,
126
],
[
133,
132
],
[
37,
135
],
[
141,
138
],
[
126,
139
],
[
132,
140
],
[
146,
143
],
[
126,
144
],
[
14,
149
],
[
23,
152
],
[
126,
157
],
[
162,
161
],
[
126,
161
],
[
161,
165
],
[
177,
171
],
[
173,
174
]
] | [
"import sys\nfrom itertools import combinations\ninput = sys.stdin.readline\n\ndef main():\n h, w, n = map(int, input().split())\n grid = [0]*n\n mod = 10**9\n judge = dict()\n for _ in range(n):\n a, b = map(int, input().split())\n for i in range(-1, 2):\n for j in range(-1, 2):\n if a+i <= 1 or a+i >= h or b+j <= 1 or b+j >= w:\n continue\n if (a+i, b+j) in judge:\n judge[(a+i, b+j)] += 1\n else:\n judge[(a+i, b+j)] = 1\n \n ans = [0]*10\n \n for v in judge.values():\n ans[v] += 1\n ans[0] = (h-2)*(w-2)-sum(ans[1:])\n \n for a in ans:\n print(a)\n\n \nif __name__ == \"__main__\":\n main()",
"import sys",
"sys",
"from itertools import combinations",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"def main():\n h, w, n = map(int, input().split())\n grid = [0]*n\n mod = 10**9\n judge = dict()\n for _ in range(n):\n a, b = map(int, input().split())\n for i in range(-1, 2):\n for j in range(-1, 2):\n if a+i <= 1 or a+i >= h or b+j <= 1 or b+j >= w:\n continue\n if (a+i, b+j) in judge:\n judge[(a+i, b+j)] += 1\n else:\n judge[(a+i, b+j)] = 1\n \n ans = [0]*10\n \n for v in judge.values():\n ans[v] += 1\n ans[0] = (h-2)*(w-2)-sum(ans[1:])\n \n for a in ans:\n print(a)\n\n ",
"main",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"grid = [0]*n",
"grid",
"[0]*n",
"[0]",
"0",
"n",
"mod = 10**9",
"mod",
"10**9",
"10",
"9",
"judge = dict()",
"judge",
"dict()",
"dict",
"for _ in range(n):\n a, b = map(int, input().split())\n for i in range(-1, 2):\n for j in range(-1, 2):\n if a+i <= 1 or a+i >= h or b+j <= 1 or b+j >= w:\n continue\n if (a+i, b+j) in judge:\n judge[(a+i, b+j)] += 1\n else:\n judge[(a+i, b+j)] = 1\n \n ",
"_",
"range(n)",
"range",
"n",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in range(-1, 2):\n for j in range(-1, 2):\n if a+i <= 1 or a+i >= h or b+j <= 1 or b+j >= w:\n continue\n if (a+i, b+j) in judge:\n judge[(a+i, b+j)] += 1\n else:\n judge[(a+i, b+j)] = 1\n \n ",
"i",
"range(-1, 2)",
"range",
"-1",
"2",
"for j in range(-1, 2):\n if a+i <= 1 or a+i >= h or b+j <= 1 or b+j >= w:\n continue\n if (a+i, b+j) in judge:\n judge[(a+i, b+j)] += 1\n else:\n judge[(a+i, b+j)] = 1\n \n ",
"j",
"range(-1, 2)",
"range",
"-1",
"2",
"if a+i <= 1 or a+i >= h or b+j <= 1 or b+j >= w:\n continue\n ",
"a+i <= 1 or a+i >= h or b+j <= 1 or b+j >= w",
"a+i <= 1 or a+i >= h or b+j <= 1",
"a+i <= 1 or a+i >= h",
"a+i <= 1",
"a+i",
"a",
"i",
"1",
"a+i >= h",
"a+i",
"a",
"i",
"h",
"b+j <= 1",
"b+j",
"b",
"j",
"1",
"b+j >= w",
"b+j",
"b",
"j",
"w",
"continue",
"if (a+i, b+j) in judge:\n judge[(a+i, b+j)] += 1\n else:\n judge[(a+i, b+j)] = 1\n \n ",
"(a+i, b+j) in judge",
"(a+i, b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"judge",
"judge[(a+i, b+j)] += 1",
"judge[(a+i, b+j)]",
"judge",
"(a+i, b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"1",
"judge[(a+i, b+j)] = 1",
"judge[(a+i, b+j)]",
"judge",
"(a+i, b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"1",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for v in judge.values():\n ans[v] += 1\n ",
"v",
"judge.values()",
"judge.values",
"judge",
"values",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"ans[0] = (h-2)*(w-2)-sum(ans[1:])",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)-sum(ans[1:])",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"for a in ans:\n print(a)\n\n ",
"a",
"ans",
"print(a)",
"print",
"a",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"def main():\n h, w, n = map(int, input().split())\n grid = [0]*n\n mod = 10**9\n judge = dict()\n for _ in range(n):\n a, b = map(int, input().split())\n for i in range(-1, 2):\n for j in range(-1, 2):\n if a+i <= 1 or a+i >= h or b+j <= 1 or b+j >= w:\n continue\n if (a+i, b+j) in judge:\n judge[(a+i, b+j)] += 1\n else:\n judge[(a+i, b+j)] = 1\n \n ans = [0]*10\n \n for v in judge.values():\n ans[v] += 1\n ans[0] = (h-2)*(w-2)-sum(ans[1:])\n \n for a in ans:\n print(a)\n\n ",
"def main():\n h, w, n = map(int, input().split())\n grid = [0]*n\n mod = 10**9\n judge = dict()\n for _ in range(n):\n a, b = map(int, input().split())\n for i in range(-1, 2):\n for j in range(-1, 2):\n if a+i <= 1 or a+i >= h or b+j <= 1 or b+j >= w:\n continue\n if (a+i, b+j) in judge:\n judge[(a+i, b+j)] += 1\n else:\n judge[(a+i, b+j)] = 1\n \n ans = [0]*10\n \n for v in judge.values():\n ans[v] += 1\n ans[0] = (h-2)*(w-2)-sum(ans[1:])\n \n for a in ans:\n print(a)\n\n ",
"main"
] | import sys
from itertools import combinations
input = sys.stdin.readline
def main():
h, w, n = map(int, input().split())
grid = [0]*n
mod = 10**9
judge = dict()
for _ in range(n):
a, b = map(int, input().split())
for i in range(-1, 2):
for j in range(-1, 2):
if a+i <= 1 or a+i >= h or b+j <= 1 or b+j >= w:
continue
if (a+i, b+j) in judge:
judge[(a+i, b+j)] += 1
else:
judge[(a+i, b+j)] = 1
ans = [0]*10
for v in judge.values():
ans[v] += 1
ans[0] = (h-2)*(w-2)-sum(ans[1:])
for a in ans:
print(a)
if __name__ == "__main__":
main()
|
[
7,
15,
13,
15,
13,
13,
15,
15,
15,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
40,
40,
40,
17,
2,
13,
13,
2,
13,
17,
40,
40,
40,
17,
2,
13,
13,
2,
13,
17,
9,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
2,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
17,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13
] | [
[
157,
11
],
[
157,
20
],
[
157,
21
],
[
166,
23
],
[
27,
26
],
[
155,
29
],
[
160,
31
],
[
160,
40
],
[
43,
42
],
[
49,
48
],
[
149,
60
],
[
42,
61
],
[
158,
63
],
[
161,
70
],
[
48,
71
],
[
152,
73
],
[
86,
77
],
[
167,
78
],
[
149,
81
],
[
42,
82
],
[
161,
84
],
[
48,
85
],
[
167,
89
],
[
149,
93
],
[
42,
94
],
[
161,
96
],
[
48,
97
],
[
163,
101
],
[
167,
111
],
[
117,
114
],
[
164,
115
],
[
122,
119
],
[
164,
120
],
[
158,
125
],
[
152,
128
],
[
164,
133
],
[
139,
138
],
[
164,
145
],
[
138,
146
],
[
160,
149
],
[
157,
152
],
[
157,
155
],
[
157,
158
],
[
160,
161
],
[
163,
164
],
[
166,
167
]
] | [
"import sys\nimport heapq, math\nfrom itertools import zip_longest, permutations, combinations, combinations_with_replacement\nfrom itertools import accumulate, dropwhile, takewhile, groupby\nfrom functools import lru_cache\nfrom copy import deepcopy\n\nH, W, N = map(int, input().split())\n\nm = {}\n\nfor i in range(N):\n a, b = map(int, input().split())\n for j in range(-2, 1):\n for k in range(-2, 1):\n if not 1 <= a + j <= H - 2 or not 1 <= b + k <= W - 2:\n continue\n m[(a + j, b + k)] = m.get((a + j, b + k), 0) + 1\n\nans = [0] * 10\n\nfor k, v in m.items():\n ans[v] += 1\n\n\nans[0] = (H - 2) * (W - 2) - sum(ans[1 : 10])\nfor i in range(10):\n print(ans[i])",
"import sys",
"sys",
"import heapq, math",
"heapq",
"math",
"from itertools import zip_longest, permutations, combinations, combinations_with_replacement",
"from itertools import accumulate, dropwhile, takewhile, groupby",
"from functools import lru_cache",
"from copy import deepcopy",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"m = {}",
"m",
"{}",
"for i in range(N):\n a, b = map(int, input().split())\n for j in range(-2, 1):\n for k in range(-2, 1):\n if not 1 <= a + j <= H - 2 or not 1 <= b + k <= W - 2:\n continue\n m[(a + j, b + k)] = m.get((a + j, b + k), 0) + 1",
"i",
"range(N)",
"range",
"N",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for j in range(-2, 1):\n for k in range(-2, 1):\n if not 1 <= a + j <= H - 2 or not 1 <= b + k <= W - 2:\n continue\n m[(a + j, b + k)] = m.get((a + j, b + k), 0) + 1",
"j",
"range(-2, 1)",
"range",
"-2",
"1",
"for k in range(-2, 1):\n if not 1 <= a + j <= H - 2 or not 1 <= b + k <= W - 2:\n continue\n m[(a + j, b + k)] = m.get((a + j, b + k), 0) + 1",
"k",
"range(-2, 1)",
"range",
"-2",
"1",
"if not 1 <= a + j <= H - 2 or not 1 <= b + k <= W - 2:\n continue\n ",
"not 1 <= a + j <= H - 2 or not 1 <= b + k <= W - 2",
"not 1 <= a + j <= H - 2",
"1 <= a + j <= H - 2",
"1 <= a + j",
"1",
"a + j",
"a",
"j",
"H - 2",
"H",
"2",
"not 1 <= b + k <= W - 2",
"1 <= b + k <= W - 2",
"1 <= b + k",
"1",
"b + k",
"b",
"k",
"W - 2",
"W",
"2",
"continue",
"m[(a + j, b + k)] = m.get((a + j, b + k), 0) + 1",
"m[(a + j, b + k)]",
"m",
"(a + j, b + k)",
"a + j",
"a",
"j",
"b + k",
"b",
"k",
"m.get((a + j, b + k), 0) + 1",
"m.get((a + j, b + k), 0)",
"m.get",
"m",
"get",
"(a + j, b + k)",
"a + j",
"a",
"j",
"b + k",
"b",
"k",
"0",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for k, v in m.items():\n ans[v] += 1",
"k",
"v",
"m.items()",
"m.items",
"m",
"items",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"ans[0] = (H - 2) * (W - 2) - sum(ans[1 : 10])",
"ans[0]",
"ans",
"0",
"(H - 2) * (W - 2) - sum(ans[1 : 10])",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(ans[1 : 10])",
"sum",
"ans[1 : 10]",
"ans",
"1 : 10",
"1",
"10",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"ans = [0] * 10",
"[0] * 10",
"ans",
"m = {}",
"{}",
"m"
] | import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy
H, W, N = map(int, input().split())
m = {}
for i in range(N):
a, b = map(int, input().split())
for j in range(-2, 1):
for k in range(-2, 1):
if not 1 <= a + j <= H - 2 or not 1 <= b + k <= W - 2:
continue
m[(a + j, b + k)] = m.get((a + j, b + k), 0) + 1
ans = [0] * 10
for k, v in m.items():
ans[v] += 1
ans[0] = (H - 2) * (W - 2) - sum(ans[1 : 10])
for i in range(10):
print(ans[i]) |
[
7,
41,
28,
13,
2,
39,
17,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
13,
15,
15,
0,
13,
2,
39,
17,
17,
0,
13,
2,
2,
13,
17,
2,
13,
17,
41,
28,
13,
13,
4,
13,
4,
13,
17,
0,
13,
17,
28,
13,
13,
13,
2,
2,
2,
2,
2,
13,
17,
2,
13,
13,
17,
2,
13,
13,
2,
13,
17,
4,
2,
2,
2,
2,
13,
13,
13,
13,
13,
28,
13,
13,
4,
18,
4,
13,
4,
18,
4,
13,
13,
13,
13,
4,
13,
13,
31,
13,
0,
13,
17,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] | [
[
4,
3
],
[
129,
20
],
[
129,
29
],
[
129,
30
],
[
132,
32
],
[
123,
37
],
[
117,
43
],
[
121,
46
],
[
130,
49
],
[
62,
61
],
[
121,
72
],
[
130,
82
],
[
130,
91
],
[
118,
110
],
[
124,
112
],
[
115,
114
],
[
117,
118
],
[
129,
121
],
[
123,
124
],
[
129,
127
],
[
129,
130
],
[
132,
133
]
] | [
"h,w,n=map(int,input().split());I=[list(map(int,input().split()))for i in[0]*n]\nfrom itertools import product as p;from collections import Counter as c;ans=[0]*9;o=(h-2)*(w-2)\nfor k,v in c(c([(a-x)*w+b-y for x,y in p(range(3),repeat=2) for a,b in I if h-1>a-x>0<b-y<w-1]).values()).items():ans[k-1]=v;o-=v\nprint(o,*ans,sep='\\n')",
"list(map(int,input().split()))for i in[0]*n",
"for i in[0]*n",
"i",
"[0]*n",
"[0]",
"0",
"n",
"for i in[0]*n",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"I=[list(map(int,input().split()))for i in[0]*n]",
"I",
"[list(map(int,input().split()))for i in[0]*n]",
"from itertools import product as p",
"from collections import Counter as c",
"ans=[0]*9",
"ans",
"[0]*9",
"[0]",
"0",
"9",
"o=(h-2)*(w-2)",
"o",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"(a-x)*w+b-y for x,y in p(range(3),repeat=2) for a,b in I if h-1>a-x>0<b-y<w-1",
"for x,y in p(range(3),repeat=2) for a,b in I if h-1>a-x>0<b-y<w-1",
"x",
"y",
"p(range(3),repeat=2)",
"p",
"range(3)",
"range",
"3",
"repeat=2",
"repeat",
"2",
"for a,b in I if h-1>a-x>0<b-y<w-1",
"a",
"b",
"I",
"h-1>a-x>0<b-y<w-1",
"h-1>a-x>0<b-y",
"h-1>a-x>0",
"h-1>a-x",
"h-1",
"h",
"1",
"a-x",
"a",
"x",
"0",
"b-y",
"b",
"y",
"w-1",
"w",
"1",
"if h-1>a-x>0<b-y<w-1",
"(a-x)*w+b-y",
"(a-x)*w+b",
"(a-x)*w",
"a-x",
"a",
"x",
"w",
"b",
"y",
"for k,v in c(c([(a-x)*w+b-y for x,y in p(range(3),repeat=2) for a,b in I if h-1>a-x>0<b-y<w-1]).values()).items():ans[k-1]=v;o-=v",
"k",
"v",
"c(c([(a-x)*w+b-y for x,y in p(range(3),repeat=2) for a,b in I if h-1>a-x>0<b-y<w-1]).values()).items()",
"(c([(a-x)*w+b-y for x,y in p(range(3),repeat=2) for a,b in I if h-1>a-x>0<b-y<w-1]).values()).items",
"(c([(a-x)*w+b-y for x,y in p(range(3),repeat=2) for a,b in I if h-1>a-x>0<b-y<w-1]).values())",
"c",
"c([(a-x)*w+b-y for x,y in p(range(3),repeat=2) for a,b in I if h-1>a-x>0<b-y<w-1]).values()",
"([(a-x)*w+b-y for x,y in p(range(3),repeat=2) for a,b in I if h-1>a-x>0<b-y<w-1]).values",
"([(a-x)*w+b-y for x,y in p(range(3),repeat=2) for a,b in I if h-1>a-x>0<b-y<w-1])",
"c",
"[(a-x)*w+b-y for x,y in p(range(3),repeat=2) for a,b in I if h-1>a-x>0<b-y<w-1]",
"values",
"items",
"print(o,*ans,sep='\\n')",
"print",
"o",
"*ans",
"ans",
"sep='\\n'",
"sep",
"'\\n'",
"o=(h-2)*(w-2)",
"(h-2)*(w-2)",
"o",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"ans=[0]*9",
"[0]*9",
"ans",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"I=[list(map(int,input().split()))for i in[0]*n]",
"[list(map(int,input().split()))for i in[0]*n]",
"I"
] | h,w,n=map(int,input().split());I=[list(map(int,input().split()))for i in[0]*n]
from itertools import product as p;from collections import Counter as c;ans=[0]*9;o=(h-2)*(w-2)
for k,v in c(c([(a-x)*w+b-y for x,y in p(range(3),repeat=2) for a,b in I if h-1>a-x>0<b-y<w-1]).values()).items():ans[k-1]=v;o-=v
print(o,*ans,sep='\n') |
[
7,
12,
13,
0,
13,
17,
28,
13,
13,
13,
0,
13,
2,
13,
17,
13,
2,
13,
17,
28,
13,
4,
13,
17,
2,
17,
17,
28,
13,
4,
13,
17,
2,
17,
17,
14,
2,
2,
2,
13,
13,
17,
40,
2,
13,
17,
2,
13,
13,
9,
14,
2,
2,
2,
13,
13,
17,
40,
2,
13,
17,
2,
13,
13,
9,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
17,
17,
0,
18,
13,
13,
17,
29,
13,
23,
13,
23,
13,
23,
13,
23,
13,
14,
2,
13,
17,
0,
13,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
13,
13,
13,
28,
13,
13,
4,
13,
13,
10,
12,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13
] | [
[
5,
4
],
[
12,
11
],
[
11,
13
],
[
16,
15
],
[
15,
17
],
[
21,
20
],
[
29,
28
],
[
11,
39
],
[
20,
40
],
[
124,
44
],
[
11,
47
],
[
20,
48
],
[
15,
54
],
[
28,
55
],
[
126,
59
],
[
15,
62
],
[
28,
63
],
[
4,
67
],
[
11,
71
],
[
20,
72
],
[
15,
74
],
[
28,
75
],
[
87,
78
],
[
4,
79
],
[
11,
82
],
[
20,
83
],
[
15,
85
],
[
28,
86
],
[
90,
89
],
[
98,
95
],
[
89,
96
],
[
124,
100
],
[
126,
103
],
[
107,
106
],
[
4,
109
],
[
115,
112
],
[
89,
113
],
[
120,
117
],
[
89,
118
],
[
106,
119
],
[
89,
122
],
[
124,
124
],
[
126,
126
],
[
128,
128
],
[
130,
130
],
[
186,
136
],
[
198,
139
],
[
198,
148
],
[
198,
149
],
[
153,
152
],
[
184,
155
],
[
187,
155
],
[
192,
163
],
[
195,
166
],
[
181,
168
],
[
190,
169
],
[
199,
170
],
[
184,
171
],
[
187,
171
],
[
193,
172
],
[
175,
174
],
[
196,
174
],
[
174,
178
],
[
198,
184
],
[
186,
187
],
[
198,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
]
] | [
"def snuke_coloring(H: int, W: int, N: int, queries: list) -> list:\n freq = {}\n for h, w in queries:\n # (h, w) を含む 9 この 3x3 行列に含まれる点の数を\n # 増やす。\n h, w = h-1, w-1\n for dh in range(-1, 1 + 1):\n for dw in range(-1, 1 + 1):\n if h + dh < 1 or H - 1 <= h + dh:\n continue\n if w + dw < 1 or W - 1 <= w + dw:\n continue\n\n freq.setdefault((h + dh, w + dw), 0)\n freq[(h + dh, w + dw)] += 1\n\n ret = [0] * 10\n # 点が 0 の 3x3 行列は freq に含まれないので、\n # (全ての 3x3 行列) - (点をもつ 3x3 行列) で求める。\n ret[0] = (H-2)*(W-2)\n for v in freq.values():\n ret[0] -= 1\n ret[v] += 1\n\n return ret\n\n\nif __name__ == \"__main__\":\n N = 0\n H, W, N = map(int, input().split())\n queries = [tuple(int(s) for s in input().split()) for _ in range(N)]\n ans = snuke_coloring(H, W, N, queries)\n for a in ans:\n print(a)",
"def snuke_coloring(H: int, W: int, N: int, queries: list) -> list:\n freq = {}\n for h, w in queries:\n # (h, w) を含む 9 この 3x3 行列に含まれる点の数を\n # 増やす。\n h, w = h-1, w-1\n for dh in range(-1, 1 + 1):\n for dw in range(-1, 1 + 1):\n if h + dh < 1 or H - 1 <= h + dh:\n continue\n if w + dw < 1 or W - 1 <= w + dw:\n continue\n\n freq.setdefault((h + dh, w + dw), 0)\n freq[(h + dh, w + dw)] += 1\n\n ret = [0] * 10\n # 点が 0 の 3x3 行列は freq に含まれないので、\n # (全ての 3x3 行列) - (点をもつ 3x3 行列) で求める。\n ret[0] = (H-2)*(W-2)\n for v in freq.values():\n ret[0] -= 1\n ret[v] += 1\n\n return ret",
"snuke_coloring",
"freq = {}",
"freq",
"{}",
"for h, w in queries:\n # (h, w) を含む 9 この 3x3 行列に含まれる点の数を\n # 増やす。\n h, w = h-1, w-1\n for dh in range(-1, 1 + 1):\n for dw in range(-1, 1 + 1):\n if h + dh < 1 or H - 1 <= h + dh:\n continue\n if w + dw < 1 or W - 1 <= w + dw:\n continue\n\n freq.setdefault((h + dh, w + dw), 0)\n freq[(h + dh, w + dw)] += 1\n\n ",
"h",
"w",
"queries",
"h, w = h-1, w-1",
"h",
"h-1",
"h",
"1",
"w",
"w-1",
"w",
"1",
"for dh in range(-1, 1 + 1):\n for dw in range(-1, 1 + 1):\n if h + dh < 1 or H - 1 <= h + dh:\n continue\n if w + dw < 1 or W - 1 <= w + dw:\n continue\n\n freq.setdefault((h + dh, w + dw), 0)\n freq[(h + dh, w + dw)] += 1\n\n ",
"dh",
"range(-1, 1 + 1)",
"range",
"-1",
"1 + 1",
"1",
"1",
"for dw in range(-1, 1 + 1):\n if h + dh < 1 or H - 1 <= h + dh:\n continue\n if w + dw < 1 or W - 1 <= w + dw:\n continue\n\n freq.setdefault((h + dh, w + dw), 0)\n freq[(h + dh, w + dw)] += 1\n\n ",
"dw",
"range(-1, 1 + 1)",
"range",
"-1",
"1 + 1",
"1",
"1",
"if h + dh < 1 or H - 1 <= h + dh:\n continue\n ",
"h + dh < 1 or H - 1 <= h + dh",
"h + dh < 1",
"h + dh",
"h",
"dh",
"1",
"H - 1 <= h + dh",
"H - 1",
"H",
"1",
"h + dh",
"h",
"dh",
"continue",
"if w + dw < 1 or W - 1 <= w + dw:\n continue\n\n ",
"w + dw < 1 or W - 1 <= w + dw",
"w + dw < 1",
"w + dw",
"w",
"dw",
"1",
"W - 1 <= w + dw",
"W - 1",
"W",
"1",
"w + dw",
"w",
"dw",
"continue",
"freq.setdefault((h + dh, w + dw), 0)",
"freq.setdefault",
"freq",
"setdefault",
"(h + dh, w + dw)",
"h + dh",
"h",
"dh",
"w + dw",
"w",
"dw",
"0",
"freq[(h + dh, w + dw)] += 1",
"freq[(h + dh, w + dw)]",
"freq",
"(h + dh, w + dw)",
"h + dh",
"h",
"dh",
"w + dw",
"w",
"dw",
"1",
"ret = [0] * 10",
"ret",
"[0] * 10",
"[0]",
"0",
"10",
"ret[0] = (H-2)*(W-2)",
"ret[0]",
"ret",
"0",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"for v in freq.values():\n ret[0] -= 1\n ret[v] += 1\n\n ",
"v",
"freq.values()",
"freq.values",
"freq",
"values",
"ret[0] -= 1",
"ret[0]",
"ret",
"0",
"1",
"ret[v] += 1",
"ret[v]",
"ret",
"v",
"1",
"return ret",
"ret",
"H: int",
"H",
"W: int",
"W",
"N: int",
"N",
"queries: list",
"queries",
"if __name__ == \"__main__\":\n N = 0\n H, W, N = map(int, input().split())\n queries = [tuple(int(s) for s in input().split()) for _ in range(N)]\n ans = snuke_coloring(H, W, N, queries)\n for a in ans:\n print(a)",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"N = 0",
"N",
"0",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"tuple(int(s) for s in input().split()) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"tuple(int(s) for s in input().split())",
"tuple",
"int(s)",
"int",
"s",
"queries = [tuple(int(s) for s in input().split()) for _ in range(N)]",
"queries",
"[tuple(int(s) for s in input().split()) for _ in range(N)]",
"ans = snuke_coloring(H, W, N, queries)",
"ans",
"snuke_coloring(H, W, N, queries)",
"snuke_coloring",
"H",
"W",
"N",
"queries",
"for a in ans:\n print(a)",
"a",
"ans",
"print(a)",
"print",
"a",
"def snuke_coloring(H: int, W: int, N: int, queries: list) -> list:\n freq = {}\n for h, w in queries:\n # (h, w) を含む 9 この 3x3 行列に含まれる点の数を\n # 増やす。\n h, w = h-1, w-1\n for dh in range(-1, 1 + 1):\n for dw in range(-1, 1 + 1):\n if h + dh < 1 or H - 1 <= h + dh:\n continue\n if w + dw < 1 or W - 1 <= w + dw:\n continue\n\n freq.setdefault((h + dh, w + dw), 0)\n freq[(h + dh, w + dw)] += 1\n\n ret = [0] * 10\n # 点が 0 の 3x3 行列は freq に含まれないので、\n # (全ての 3x3 行列) - (点をもつ 3x3 行列) で求める。\n ret[0] = (H-2)*(W-2)\n for v in freq.values():\n ret[0] -= 1\n ret[v] += 1\n\n return ret",
"def snuke_coloring(H: int, W: int, N: int, queries: list) -> list:\n freq = {}\n for h, w in queries:\n # (h, w) を含む 9 この 3x3 行列に含まれる点の数を\n # 増やす。\n h, w = h-1, w-1\n for dh in range(-1, 1 + 1):\n for dw in range(-1, 1 + 1):\n if h + dh < 1 or H - 1 <= h + dh:\n continue\n if w + dw < 1 or W - 1 <= w + dw:\n continue\n\n freq.setdefault((h + dh, w + dw), 0)\n freq[(h + dh, w + dw)] += 1\n\n ret = [0] * 10\n # 点が 0 の 3x3 行列は freq に含まれないので、\n # (全ての 3x3 行列) - (点をもつ 3x3 行列) で求める。\n ret[0] = (H-2)*(W-2)\n for v in freq.values():\n ret[0] -= 1\n ret[v] += 1\n\n return ret",
"snuke_coloring",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"N = 0",
"0",
"N",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"queries = [tuple(int(s) for s in input().split()) for _ in range(N)]",
"[tuple(int(s) for s in input().split()) for _ in range(N)]",
"queries",
"ans = snuke_coloring(H, W, N, queries)",
"snuke_coloring(H, W, N, queries)",
"ans",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W"
] | def snuke_coloring(H: int, W: int, N: int, queries: list) -> list:
freq = {}
for h, w in queries:
# (h, w) を含む 9 この 3x3 行列に含まれる点の数を
# 増やす。
h, w = h-1, w-1
for dh in range(-1, 1 + 1):
for dw in range(-1, 1 + 1):
if h + dh < 1 or H - 1 <= h + dh:
continue
if w + dw < 1 or W - 1 <= w + dw:
continue
freq.setdefault((h + dh, w + dw), 0)
freq[(h + dh, w + dw)] += 1
ret = [0] * 10
# 点が 0 の 3x3 行列は freq に含まれないので、
# (全ての 3x3 行列) - (点をもつ 3x3 行列) で求める。
ret[0] = (H-2)*(W-2)
for v in freq.values():
ret[0] -= 1
ret[v] += 1
return ret
if __name__ == "__main__":
N = 0
H, W, N = map(int, input().split())
queries = [tuple(int(s) for s in input().split()) for _ in range(N)]
ans = snuke_coloring(H, W, N, queries)
for a in ans:
print(a)
|
[
7,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
0,
13,
2,
13,
13,
13,
2,
13,
13,
14,
2,
2,
2,
2,
13,
17,
40,
13,
13,
2,
13,
17,
40,
13,
13,
9,
14,
2,
40,
2,
13,
17,
13,
40,
2,
13,
17,
13,
9,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
13,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
17,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
18,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13
] | [
[
214,
20
],
[
205,
25
],
[
232,
32
],
[
235,
41
],
[
217,
50
],
[
220,
59
],
[
220,
68
],
[
220,
69
],
[
244,
71
],
[
200,
74
],
[
221,
77
],
[
226,
80
],
[
86,
85
],
[
203,
88
],
[
223,
90
],
[
223,
99
],
[
211,
101
],
[
229,
104
],
[
108,
107
],
[
113,
112
],
[
241,
117
],
[
212,
119
],
[
224,
119
],
[
107,
120
],
[
208,
121
],
[
230,
123
],
[
197,
123
],
[
112,
124
],
[
242,
130
],
[
242,
133
],
[
200,
134
],
[
209,
136
],
[
209,
139
],
[
221,
140
],
[
242,
146
],
[
200,
148
],
[
209,
151
],
[
221,
153
],
[
161,
156
],
[
227,
157
],
[
238,
163
],
[
227,
173
],
[
179,
176
],
[
239,
177
],
[
184,
181
],
[
239,
182
],
[
245,
185
],
[
239,
188
],
[
191,
190
],
[
239,
190
],
[
190,
194
],
[
223,
197
],
[
220,
200
],
[
220,
203
],
[
205,
206
],
[
208,
209
],
[
211,
212
],
[
214,
215
],
[
217,
218
],
[
220,
221
],
[
223,
224
],
[
226,
227
],
[
229,
230
],
[
232,
233
],
[
235,
236
],
[
238,
239
],
[
241,
242
],
[
244,
245
]
] | [
"import sys\nimport itertools\n# import numpy as np\nimport time\nimport math\nimport heapq\nfrom collections import defaultdict\nsys.setrecursionlimit(10 ** 7)\n \nINF = 10 ** 18\nMOD = 10 ** 9 + 7\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n# map(int, input().split())\n\nH, W, N = map(int, input().split())\nX = (H - 2) * (W - 2)\n\nA = defaultdict(int)\nfor i in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for p in range(3):\n for q in range(3):\n k, l = a - p, b - q\n if k < 0 or k >= H or l < 0 or l >= W:\n continue\n if k + 2 >= H or l + 2 >= W:\n continue\n A[(k, l)] += 1\n\nans = [0] * 10\nfor k, v in A.items():\n ans[v] += 1\nans[0] = X - sum(ans)\n\nfor a in ans:\n print(a)",
"import sys",
"sys",
"import itertools",
"itertools",
"import time",
"time",
"import math",
"math",
"import heapq",
"heapq",
"from collections import defaultdict",
"sys.setrecursionlimit(10 ** 7)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 7",
"10",
"7",
"INF = 10 ** 18",
"INF",
"10 ** 18",
"10",
"18",
"MOD = 10 ** 9 + 7",
"MOD",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"read = sys.stdin.buffer.read",
"read",
"sys.stdin.buffer.read",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"read",
"readline = sys.stdin.buffer.readline",
"readline",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"readlines = sys.stdin.buffer.readlines",
"readlines",
"sys.stdin.buffer.readlines",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readlines",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"X = (H - 2) * (W - 2)",
"X",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"A = defaultdict(int)",
"A",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for p in range(3):\n for q in range(3):\n k, l = a - p, b - q\n if k < 0 or k >= H or l < 0 or l >= W:\n continue\n if k + 2 >= H or l + 2 >= W:\n continue\n A[(k, l)] += 1",
"i",
"range(N)",
"range",
"N",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for p in range(3):\n for q in range(3):\n k, l = a - p, b - q\n if k < 0 or k >= H or l < 0 or l >= W:\n continue\n if k + 2 >= H or l + 2 >= W:\n continue\n A[(k, l)] += 1",
"p",
"range(3)",
"range",
"3",
"for q in range(3):\n k, l = a - p, b - q\n if k < 0 or k >= H or l < 0 or l >= W:\n continue\n if k + 2 >= H or l + 2 >= W:\n continue\n A[(k, l)] += 1",
"q",
"range(3)",
"range",
"3",
"k, l = a - p, b - q",
"k",
"a - p",
"a",
"p",
"l",
"b - q",
"b",
"q",
"if k < 0 or k >= H or l < 0 or l >= W:\n continue\n ",
"k < 0 or k >= H or l < 0 or l >= W",
"k < 0 or k >= H or l < 0",
"k < 0 or k >= H",
"k < 0",
"k",
"0",
"k >= H",
"k",
"H",
"l < 0",
"l",
"0",
"l >= W",
"l",
"W",
"continue",
"if k + 2 >= H or l + 2 >= W:\n continue\n ",
"k + 2 >= H or l + 2 >= W",
"k + 2 >= H",
"k + 2",
"k",
"2",
"H",
"l + 2 >= W",
"l + 2",
"l",
"2",
"W",
"continue",
"A[(k, l)] += 1",
"A[(k, l)]",
"A",
"(k, l)",
"k",
"l",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for k, v in A.items():\n ans[v] += 1",
"k",
"v",
"A.items()",
"A.items",
"A",
"items",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"ans[0] = X - sum(ans)",
"ans[0]",
"ans",
"0",
"X - sum(ans)",
"X",
"sum(ans)",
"sum",
"ans",
"for a in ans:\n print(a)",
"a",
"ans",
"print(a)",
"print",
"a",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"l = a - p, b - q",
"b - q",
"l",
"a -= 1",
"1",
"a",
"INF = 10 ** 18",
"10 ** 18",
"INF",
"readlines = sys.stdin.buffer.readlines",
"sys.stdin.buffer.readlines",
"readlines",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"A = defaultdict(int)",
"defaultdict(int)",
"A",
"b -= 1",
"1",
"b",
"read = sys.stdin.buffer.read",
"sys.stdin.buffer.read",
"read",
"readline = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"readline",
"ans = [0] * 10",
"[0] * 10",
"ans",
"k, l = a - p, b - q",
"a - p",
"k",
"X = (H - 2) * (W - 2)",
"(H - 2) * (W - 2)",
"X"
] | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split())
H, W, N = map(int, input().split())
X = (H - 2) * (W - 2)
A = defaultdict(int)
for i in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
for p in range(3):
for q in range(3):
k, l = a - p, b - q
if k < 0 or k >= H or l < 0 or l >= W:
continue
if k + 2 >= H or l + 2 >= W:
continue
A[(k, l)] += 1
ans = [0] * 10
for k, v in A.items():
ans[v] += 1
ans[0] = X - sum(ans)
for a in ans:
print(a) |
[
7,
15,
15,
15,
13,
15,
13,
15,
13,
15,
15,
13,
15,
13,
15,
15,
15,
15,
15,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
12,
13,
12,
13,
12,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
13,
12,
13,
23,
13,
0,
13,
17,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
4,
13,
4,
13,
2,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
2,
40,
17,
13,
2,
13,
17,
2,
40,
17,
13,
2,
13,
17,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
4,
13,
4,
18,
17,
13,
4,
13,
4,
13,
13,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13
] | [
[
287,
28
],
[
43,
42
],
[
243,
48
],
[
52,
52
],
[
56,
55
],
[
261,
61
],
[
65,
65
],
[
69,
68
],
[
294,
74
],
[
78,
78
],
[
82,
81
],
[
249,
87
],
[
91,
91
],
[
95,
94
],
[
294,
102
],
[
106,
106
],
[
110,
109
],
[
118,
118
],
[
290,
120
],
[
299,
123
],
[
261,
125
],
[
299,
126
],
[
299,
127
],
[
272,
129
],
[
135,
134
],
[
252,
137
],
[
284,
139
],
[
261,
141
],
[
284,
142
],
[
275,
144
],
[
257,
147
],
[
276,
157
],
[
285,
157
],
[
276,
160
],
[
285,
160
],
[
258,
165
],
[
270,
165
],
[
258,
168
],
[
270,
168
],
[
279,
177
],
[
300,
184
],
[
192,
187
],
[
273,
188
],
[
254,
194
],
[
273,
204
],
[
210,
207
],
[
255,
208
],
[
215,
212
],
[
255,
213
],
[
279,
218
],
[
300,
221
],
[
255,
225
],
[
255,
237
],
[
299,
252
],
[
254,
255
],
[
257,
258
],
[
284,
270
],
[
272,
273
],
[
275,
276
],
[
299,
279
],
[
284,
285
],
[
287,
288
],
[
290,
291
],
[
299,
300
]
] | [
"from collections import defaultdict, deque, Counter\nfrom heapq import heappush, heappop, heapify\nimport math\nimport bisect\nimport random\nfrom itertools import permutations, accumulate, combinations, product\nimport sys\nimport string\nfrom bisect import bisect_left, bisect_right\nfrom math import factorial, ceil, floor\nfrom operator import mul\nfrom functools import reduce\nimport pprint\nsys.setrecursionlimit(10 ** 9)\n\n\nINF = 10 ** 13\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\ndef I(): return int(sys.stdin.buffer.readline())\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\ndef IR(n): return [I() for i in range(n)]\ndef LIR(n): return [LI() for i in range(n)]\ndef SR(n): return [S() for i in range(n)]\ndef LSR(n): return [LS() for i in range(n)]\ndef SRL(n): return [list(S()) for i in range(n)]\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\nmod = 1000000007\n\n\n\nh, w, n = LI()\nD = defaultdict(int)\nfor _ in range(n):\n a, b = LI()\n a -= 1; b -= 1;\n for i, j in product(range(a - 1, a + 2), range(b - 1, b + 2)):\n if 1 <= i < h - 1 and 1 <= j < w - 1:\n D[(i, j)] += 1\n\n\nans = [0] * 10\nfor k, v in D.items():\n ans[v] += 1\n\n\n\nans[0] = (h - 2) * (w - 2) - sum(ans)\nprint('\\n'.join(list(map(str, ans))))",
"from collections import defaultdict, deque, Counter",
"from heapq import heappush, heappop, heapify",
"import math",
"math",
"import bisect",
"bisect",
"import random",
"random",
"from itertools import permutations, accumulate, combinations, product",
"import sys",
"sys",
"import string",
"string",
"from bisect import bisect_left, bisect_right",
"from math import factorial, ceil, floor",
"from operator import mul",
"from functools import reduce",
"import pprint",
"pprint",
"sys.setrecursionlimit(10 ** 9)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 9",
"10",
"9",
"INF = 10 ** 13",
"INF",
"10 ** 13",
"10",
"13",
"def LI(): return list(map(int, sys.stdin.buffer.readline().split()))",
"LI",
"def I(): return int(sys.stdin.buffer.readline())",
"I",
"def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()",
"LS",
"def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')",
"S",
"I() for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"I()",
"I",
"def IR(n): return [I() for i in range(n)]",
"IR",
"n",
"n",
"LI() for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"LI()",
"LI",
"def LIR(n): return [LI() for i in range(n)]",
"LIR",
"n",
"n",
"S() for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"S()",
"S",
"def SR(n): return [S() for i in range(n)]",
"SR",
"n",
"n",
"LS() for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"LS()",
"LS",
"def LSR(n): return [LS() for i in range(n)]",
"LSR",
"n",
"n",
"list(S()) for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"list(S())",
"list",
"S()",
"S",
"def SRL(n): return [list(S()) for i in range(n)]",
"SRL",
"n",
"n",
"[int(j) for j in list(S())] for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"[int(j) for j in list(S())]",
"def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]",
"MSRL",
"n",
"n",
"mod = 1000000007",
"mod",
"1000000007",
"h, w, n = LI()",
"h",
"LI()",
"LI",
"w",
"n",
"D = defaultdict(int)",
"D",
"defaultdict(int)",
"defaultdict",
"int",
"for _ in range(n):\n a, b = LI()\n a -= 1; b -= 1;\n for i, j in product(range(a - 1, a + 2), range(b - 1, b + 2)):\n if 1 <= i < h - 1 and 1 <= j < w - 1:\n D[(i, j)] += 1",
"_",
"range(n)",
"range",
"n",
"a, b = LI()",
"a",
"LI()",
"LI",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for i, j in product(range(a - 1, a + 2), range(b - 1, b + 2)):\n if 1 <= i < h - 1 and 1 <= j < w - 1:\n D[(i, j)] += 1",
"i",
"j",
"product(range(a - 1, a + 2), range(b - 1, b + 2))",
"product",
"range(a - 1, a + 2)",
"range",
"a - 1",
"a",
"1",
"a + 2",
"a",
"2",
"range(b - 1, b + 2)",
"range",
"b - 1",
"b",
"1",
"b + 2",
"b",
"2",
"if 1 <= i < h - 1 and 1 <= j < w - 1:\n D[(i, j)] += 1",
"1 <= i < h - 1 and 1 <= j < w - 1",
"1 <= i < h - 1",
"1 <= i",
"1",
"i",
"h - 1",
"h",
"1",
"1 <= j < w - 1",
"1 <= j",
"1",
"j",
"w - 1",
"w",
"1",
"D[(i, j)] += 1",
"D[(i, j)]",
"D",
"(i, j)",
"i",
"j",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for k, v in D.items():\n ans[v] += 1",
"k",
"v",
"D.items()",
"D.items",
"D",
"items",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"ans[0] = (h - 2) * (w - 2) - sum(ans)",
"ans[0]",
"ans",
"0",
"(h - 2) * (w - 2) - sum(ans)",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"print('\\n'.join(list(map(str, ans))))",
"print",
"'\\n'.join(list(map(str, ans)))",
"'\\n'.join",
"'\\n'",
"join",
"list(map(str, ans))",
"list",
"map(str, ans)",
"map",
"str",
"ans",
"def SRL(n): return [list(S()) for i in range(n)]",
"def SRL(n): return [list(S()) for i in range(n)]",
"SRL",
"def I(): return int(sys.stdin.buffer.readline())",
"def I(): return int(sys.stdin.buffer.readline())",
"I",
"def LSR(n): return [LS() for i in range(n)]",
"def LSR(n): return [LS() for i in range(n)]",
"LSR",
"def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()",
"def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()",
"LS",
"n = LI()",
"LI()",
"n",
"ans = [0] * 10",
"[0] * 10",
"ans",
"b -= 1",
"1",
"b",
"def LI(): return list(map(int, sys.stdin.buffer.readline().split()))",
"def LI(): return list(map(int, sys.stdin.buffer.readline().split()))",
"LI",
"def SR(n): return [S() for i in range(n)]",
"def SR(n): return [S() for i in range(n)]",
"SR",
"def LIR(n): return [LI() for i in range(n)]",
"def LIR(n): return [LI() for i in range(n)]",
"LIR",
"b = LI()",
"LI()",
"b",
"D = defaultdict(int)",
"defaultdict(int)",
"D",
"a -= 1",
"1",
"a",
"h, w, n = LI()",
"LI()",
"h",
"def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]",
"def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]",
"MSRL",
"a, b = LI()",
"LI()",
"a",
"INF = 10 ** 13",
"10 ** 13",
"INF",
"mod = 1000000007",
"1000000007",
"mod",
"def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')",
"def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')",
"S",
"def IR(n): return [I() for i in range(n)]",
"def IR(n): return [I() for i in range(n)]",
"IR",
"w, n = LI()",
"LI()",
"w"
] | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007
h, w, n = LI()
D = defaultdict(int)
for _ in range(n):
a, b = LI()
a -= 1; b -= 1;
for i, j in product(range(a - 1, a + 2), range(b - 1, b + 2)):
if 1 <= i < h - 1 and 1 <= j < w - 1:
D[(i, j)] += 1
ans = [0] * 10
for k, v in D.items():
ans[v] += 1
ans[0] = (h - 2) * (w - 2) - sum(ans)
print('\n'.join(list(map(str, ans)))) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
2,
39,
17,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
17,
28,
13,
13,
13,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
14,
40,
2,
40,
40,
17,
2,
13,
13,
2,
13,
17,
40,
40,
17,
2,
13,
13,
2,
13,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
2,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
17,
17,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
4,
13,
31,
13,
0,
13,
17,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] | [
[
153,
2
],
[
153,
11
],
[
153,
12
],
[
16,
15
],
[
148,
19
],
[
141,
32
],
[
144,
35
],
[
43,
42
],
[
49,
48
],
[
42,
61
],
[
154,
63
],
[
48,
70
],
[
151,
72
],
[
84,
75
],
[
145,
76
],
[
42,
80
],
[
48,
83
],
[
145,
87
],
[
42,
92
],
[
48,
95
],
[
156,
99
],
[
106,
105
],
[
145,
108
],
[
114,
111
],
[
157,
112
],
[
105,
113
],
[
119,
116
],
[
157,
117
],
[
154,
122
],
[
151,
125
],
[
157,
130
],
[
157,
136
],
[
139,
138
],
[
141,
142
],
[
144,
145
],
[
153,
148
],
[
153,
151
],
[
153,
154
],
[
156,
157
]
] | [
"H,W,N = map(int,input().split())\nab = [list(map(int,input().split())) for _ in [0]*N]\n\nd = {}\nfor a,b in ab:\n for da in (-1,0,1):\n for db in (-1,0,1):\n if not ( 2<=a+da<=H-1 and 2<=b+db<=W-1):continue\n d[(a+da,b+db)] = d.get((a+da,b+db),0)+1\n\nans = [0]*10\nfor v in d.values():\n ans[v] += 1\nans[0] = (H-2)*(W-2) - sum(ans[1:])\nprint(*ans,sep=\"\\n\")",
"H,W,N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"list(map(int,input().split())) for _ in [0]*N",
"for _ in [0]*N",
"_",
"[0]*N",
"[0]",
"0",
"N",
"for _ in [0]*N",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ab = [list(map(int,input().split())) for _ in [0]*N]",
"ab",
"[list(map(int,input().split())) for _ in [0]*N]",
"d = {}",
"d",
"{}",
"for a,b in ab:\n for da in (-1,0,1):\n for db in (-1,0,1):\n if not ( 2<=a+da<=H-1 and 2<=b+db<=W-1):continue\n d[(a+da,b+db)] = d.get((a+da,b+db),0)+1",
"a",
"b",
"ab",
"for da in (-1,0,1):\n for db in (-1,0,1):\n if not ( 2<=a+da<=H-1 and 2<=b+db<=W-1):continue\n d[(a+da,b+db)] = d.get((a+da,b+db),0)+1",
"da",
"(-1,0,1)",
"-1",
"0",
"1",
"for db in (-1,0,1):\n if not ( 2<=a+da<=H-1 and 2<=b+db<=W-1):continue\n d[(a+da,b+db)] = d.get((a+da,b+db),0)+1",
"db",
"(-1,0,1)",
"-1",
"0",
"1",
"if not ( 2<=a+da<=H-1 and 2<=b+db<=W-1):continue\n ",
"not ( 2<=a+da<=H-1 and 2<=b+db<=W-1)",
"2<=a+da<=H-1 and 2<=b+db<=W-1",
"2<=a+da<=H-1",
"2<=a+da",
"2",
"a+da",
"a",
"da",
"H-1",
"H",
"1",
"2<=b+db<=W-1",
"2<=b+db",
"2",
"b+db",
"b",
"db",
"W-1",
"W",
"1",
"d[(a+da,b+db)] = d.get((a+da,b+db),0)+1",
"d[(a+da,b+db)]",
"d",
"(a+da,b+db)",
"a+da",
"a",
"da",
"b+db",
"b",
"db",
"d.get((a+da,b+db),0)+1",
"d.get((a+da,b+db),0)",
"d.get",
"d",
"get",
"(a+da,b+db)",
"a+da",
"a",
"da",
"b+db",
"b",
"db",
"0",
"1",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for v in d.values():\n ans[v] += 1",
"v",
"d.values()",
"d.values",
"d",
"values",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"ans[0] = (H-2)*(W-2) - sum(ans[1:])",
"ans[0]",
"ans",
"0",
"(H-2)*(W-2) - sum(ans[1:])",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"print(*ans,sep=\"\\n\")",
"print",
"*ans",
"ans",
"sep=\"\\n\"",
"sep",
"\"\\n\"",
"ab = [list(map(int,input().split())) for _ in [0]*N]",
"[list(map(int,input().split())) for _ in [0]*N]",
"ab",
"d = {}",
"{}",
"d",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"ans = [0]*10",
"[0]*10",
"ans"
] | H,W,N = map(int,input().split())
ab = [list(map(int,input().split())) for _ in [0]*N]
d = {}
for a,b in ab:
for da in (-1,0,1):
for db in (-1,0,1):
if not ( 2<=a+da<=H-1 and 2<=b+db<=W-1):continue
d[(a+da,b+db)] = d.get((a+da,b+db),0)+1
ans = [0]*10
for v in d.values():
ans[v] += 1
ans[0] = (H-2)*(W-2) - sum(ans[1:])
print(*ans,sep="\n") |
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
0,
13,
2,
13,
2,
13,
17,
14,
2,
13,
39,
17,
17,
13,
2,
13,
17,
9,
28,
13,
4,
13,
17,
0,
13,
2,
13,
2,
13,
17,
14,
2,
13,
39,
17,
17,
13,
2,
13,
17,
9,
4,
18,
13,
13,
2,
2,
2,
13,
17,
13,
13,
0,
13,
4,
18,
13,
13,
13,
0,
13,
4,
18,
13,
13,
4,
18,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
17,
14,
2,
13,
4,
18,
13,
13,
4,
13,
18,
13,
13,
10,
2,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
158,
4
],
[
158,
13
],
[
158,
14
],
[
149,
16
],
[
20,
19
],
[
147,
22
],
[
164,
24
],
[
164,
33
],
[
36,
35
],
[
143,
40
],
[
162,
42
],
[
35,
44
],
[
144,
48
],
[
159,
54
],
[
59,
58
],
[
155,
63
],
[
165,
65
],
[
58,
67
],
[
156,
71
],
[
153,
77
],
[
150,
82
],
[
144,
87
],
[
153,
89
],
[
156,
90
],
[
167,
92
],
[
150,
97
],
[
170,
99
],
[
168,
106
],
[
159,
113
],
[
153,
116
],
[
171,
122
],
[
126,
125
],
[
125,
132
],
[
171,
135
],
[
171,
140
],
[
125,
141
],
[
143,
144
],
[
158,
147
],
[
149,
150
],
[
158,
153
],
[
155,
156
],
[
158,
159
],
[
164,
162
],
[
164,
165
],
[
167,
168
],
[
170,
171
]
] | [
"import collections as cl\nh,w,n = map(int,input().split())\nl = []\nfor i in range(n):\n a,b = map(int,input().split())\n for i in range(3):\n x = a+(i-1)\n if x in [0,1,h,h+1]:\n continue\n for j in range(3):\n y = b+(j-1)\n if y in [0,1,w,w+1]:\n continue\n l.append((x-1)*w+y)\n#print(l)\np = cl.Counter(l)\nq = cl.Counter(p.values())\nprint((h-2)*(w-2)-sum(q.values()))\nfor i in range(1,10):\n if i in q.keys():\n print(q[i])\n else:print(0)",
"import collections as cl",
"collections",
"h,w,n = map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"l = []",
"l",
"[]",
"for i in range(n):\n a,b = map(int,input().split())\n for i in range(3):\n x = a+(i-1)\n if x in [0,1,h,h+1]:\n continue\n for j in range(3):\n y = b+(j-1)\n if y in [0,1,w,w+1]:\n continue\n l.append((x-1)*w+y)\n#print(l)",
"i",
"range(n)",
"range",
"n",
"a,b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in range(3):\n x = a+(i-1)\n if x in [0,1,h,h+1]:\n continue\n for j in range(3):\n y = b+(j-1)\n if y in [0,1,w,w+1]:\n continue\n l.append((x-1)*w+y)\n#print(l)",
"i",
"range(3)",
"range",
"3",
"x = a+(i-1)",
"x",
"a+(i-1)",
"a",
"i-1",
"i",
"1",
"if x in [0,1,h,h+1]:\n continue\n ",
"x in [0,1,h,h+1]",
"x",
"[0,1,h,h+1]",
"0",
"1",
"h",
"h+1",
"h",
"1",
"continue",
"for j in range(3):\n y = b+(j-1)\n if y in [0,1,w,w+1]:\n continue\n l.append((x-1)*w+y)\n#print(l)",
"j",
"range(3)",
"range",
"3",
"y = b+(j-1)",
"y",
"b+(j-1)",
"b",
"j-1",
"j",
"1",
"if y in [0,1,w,w+1]:\n continue\n ",
"y in [0,1,w,w+1]",
"y",
"[0,1,w,w+1]",
"0",
"1",
"w",
"w+1",
"w",
"1",
"continue",
"l.append((x-1)*w+y)",
"l.append",
"l",
"append",
"(x-1)*w+y",
"(x-1)*w",
"x-1",
"x",
"1",
"w",
"y",
"p = cl.Counter(l)",
"p",
"cl.Counter(l)",
"cl.Counter",
"cl",
"Counter",
"l",
"q = cl.Counter(p.values())",
"q",
"cl.Counter(p.values())",
"cl.Counter",
"cl",
"Counter",
"p.values()",
"p.values",
"p",
"values",
"print((h-2)*(w-2)-sum(q.values()))",
"print",
"(h-2)*(w-2)-sum(q.values())",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(q.values())",
"sum",
"q.values()",
"q.values",
"q",
"values",
"for i in range(1,10):\n if i in q.keys():\n print(q[i])\n else:print(0)",
"i",
"range(1,10)",
"range",
"1",
"10",
"if i in q.keys():\n print(q[i])\n else:print(0)",
"i in q.keys()",
"i",
"q.keys()",
"q.keys",
"q",
"keys",
"print(q[i])",
"print",
"q[i]",
"q",
"i",
"x = a+(i-1)",
"a+(i-1)",
"x",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"l = []",
"[]",
"l",
"w,n = map(int,input().split())",
"map(int,input().split())",
"w",
"y = b+(j-1)",
"b+(j-1)",
"y",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"p = cl.Counter(l)",
"cl.Counter(l)",
"p",
"q = cl.Counter(p.values())",
"cl.Counter(p.values())",
"q"
] | import collections as cl
h,w,n = map(int,input().split())
l = []
for i in range(n):
a,b = map(int,input().split())
for i in range(3):
x = a+(i-1)
if x in [0,1,h,h+1]:
continue
for j in range(3):
y = b+(j-1)
if y in [0,1,w,w+1]:
continue
l.append((x-1)*w+y)
#print(l)
p = cl.Counter(l)
q = cl.Counter(p.values())
print((h-2)*(w-2)-sum(q.values()))
for i in range(1,10):
if i in q.keys():
print(q[i])
else:print(0) |
[
7,
15,
12,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
18,
4,
13,
13,
0,
18,
13,
39,
4,
13,
18,
13,
17,
4,
13,
18,
13,
17,
17,
12,
13,
0,
13,
4,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
14,
2,
40,
40,
17,
13,
13,
40,
40,
17,
13,
13,
4,
18,
13,
13,
39,
13,
13,
29,
13,
23,
13,
23,
13,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
0,
13,
17,
28,
13,
13,
0,
13,
13,
13,
0,
13,
4,
13,
13,
13,
28,
13,
13,
14,
40,
13,
13,
0,
13,
13,
13,
14,
2,
2,
40,
17,
13,
13,
2,
40,
17,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
14,
2,
39,
13,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
29,
13,
14,
2,
13,
17,
0,
13,
4,
13,
28,
13,
13,
4,
13,
13,
10,
12,
13,
10,
4,
13
] | [
[
6,
5
],
[
6,
16
],
[
6,
17
],
[
20,
19
],
[
23,
22
],
[
17,
25
],
[
28,
27
],
[
47,
34
],
[
19,
35
],
[
27,
40
],
[
27,
45
],
[
52,
51
],
[
56,
55
],
[
62,
61
],
[
68,
67
],
[
98,
69
],
[
55,
70
],
[
73,
72
],
[
100,
74
],
[
61,
75
],
[
67,
81
],
[
5,
82
],
[
72,
86
],
[
16,
87
],
[
51,
90
],
[
51,
96
],
[
98,
98
],
[
100,
100
],
[
104,
103
],
[
111,
110
],
[
114,
113
],
[
117,
116
],
[
19,
116
],
[
120,
119
],
[
116,
120
],
[
120,
121
],
[
124,
123
],
[
49,
125
],
[
119,
126
],
[
136,
126
],
[
121,
127
],
[
138,
127
],
[
130,
129
],
[
123,
129
],
[
129,
133
],
[
113,
134
],
[
137,
136
],
[
129,
137
],
[
137,
138
],
[
136,
144
],
[
119,
144
],
[
5,
145
],
[
138,
149
],
[
121,
149
],
[
16,
150
],
[
153,
152
],
[
156,
155
],
[
162,
161
],
[
168,
167
],
[
136,
169
],
[
119,
169
],
[
155,
170
],
[
173,
172
],
[
138,
174
],
[
121,
174
],
[
161,
175
],
[
19,
181
],
[
184,
183
],
[
189,
186
],
[
110,
187
],
[
183,
188
],
[
152,
188
],
[
194,
191
],
[
113,
192
],
[
129,
193
],
[
199,
196
],
[
110,
197
],
[
16,
202
],
[
5,
205
],
[
110,
209
],
[
110,
211
],
[
230,
217
],
[
228,
219
],
[
222,
221
],
[
231,
221
],
[
221,
225
],
[
230,
231
]
] | [
"from collections import deque\n\n\ndef solve():\n H, W, N = list(map(int, input().split()))\n # print(H, W, N)\n\n # 座標は(y, x)\n blacks = {}\n for _ in range(N):\n pos = input().split()\n blacks[(int(pos[0]), int(pos[1]))] = 0\n\n # print(blacks)\n\n # [*][*][*]\n # [*][c][*]\n # [*][*][*]\n # ある座標から, それを中心にした9つの座標を返す\n def center_of_boxes_from_point(y, x):\n center_pos_lis = deque()\n\n for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if 1 <= cy <= H and 1 <= cx <= W:\n center_pos_lis.append((cy, cx))\n return center_pos_lis\n\n ANS_TABLE = [0 for _ in range(10)]\n\n # 探索を終了したboxを保存する\n # keyはboxの中心の座標\n done_boxes = {}\n for blk in blacks:\n # print(blk)\n y, x = blk\n boxes = center_of_boxes_from_point(y, x)\n\n # boxを探索して黒マスをカウントする\n for center_of_box in boxes:\n if center_of_box not in done_boxes:\n y, x = center_of_box\n if 2 <= y < H and 2 <= x < W:\n count = 0\n for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if (cy, cx) in blacks:\n count += 1\n # print(center_of_box, count)\n ANS_TABLE[count] += 1\n done_boxes[center_of_box] = 0\n\n # print('total boxes', (W - 2) * (H - 2))\n ANS_TABLE[0] = (W - 2) * (H - 2) - sum(ANS_TABLE)\n\n return ANS_TABLE\n\n\nif __name__ == '__main__':\n res = solve()\n for r in res:\n print(r)",
"from collections import deque",
"def solve():\n H, W, N = list(map(int, input().split()))\n # print(H, W, N)\n\n # 座標は(y, x)\n blacks = {}\n for _ in range(N):\n pos = input().split()\n blacks[(int(pos[0]), int(pos[1]))] = 0\n\n # print(blacks)\n\n # [*][*][*]\n # [*][c][*]\n # [*][*][*]\n # ある座標から, それを中心にした9つの座標を返す\n def center_of_boxes_from_point(y, x):\n center_pos_lis = deque()\n\n for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if 1 <= cy <= H and 1 <= cx <= W:\n center_pos_lis.append((cy, cx))\n return center_pos_lis\n\n ANS_TABLE = [0 for _ in range(10)]\n\n # 探索を終了したboxを保存する\n # keyはboxの中心の座標\n done_boxes = {}\n for blk in blacks:\n # print(blk)\n y, x = blk\n boxes = center_of_boxes_from_point(y, x)\n\n # boxを探索して黒マスをカウントする\n for center_of_box in boxes:\n if center_of_box not in done_boxes:\n y, x = center_of_box\n if 2 <= y < H and 2 <= x < W:\n count = 0\n for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if (cy, cx) in blacks:\n count += 1\n # print(center_of_box, count)\n ANS_TABLE[count] += 1\n done_boxes[center_of_box] = 0\n\n # print('total boxes', (W - 2) * (H - 2))\n ANS_TABLE[0] = (W - 2) * (H - 2) - sum(ANS_TABLE)\n\n return ANS_TABLE",
"solve",
"H, W, N = list(map(int, input().split()))",
"H",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"blacks = {}",
"blacks",
"{}",
"for _ in range(N):\n pos = input().split()\n blacks[(int(pos[0]), int(pos[1]))] = 0\n\n # print(blacks)\n\n # [*][*][*]\n # [*][c][*]\n # [*][*][*]\n # ある座標から, それを中心にした9つの座標を返す\n ",
"_",
"range(N)",
"range",
"N",
"pos = input().split()",
"pos",
"input().split()",
"().split",
"()",
"input",
"split",
"blacks[(int(pos[0]), int(pos[1]))] = 0",
"blacks[(int(pos[0]), int(pos[1]))]",
"blacks",
"(int(pos[0]), int(pos[1]))",
"int(pos[0])",
"int",
"pos[0]",
"pos",
"0",
"int(pos[1])",
"int",
"pos[1]",
"pos",
"1",
"0",
"def center_of_boxes_from_point(y, x):\n center_pos_lis = deque()\n\n for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if 1 <= cy <= H and 1 <= cx <= W:\n center_pos_lis.append((cy, cx))\n return center_pos_lis\n\n ",
"center_of_boxes_from_point",
"center_pos_lis = deque()",
"center_pos_lis",
"deque()",
"deque",
"for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if 1 <= cy <= H and 1 <= cx <= W:\n center_pos_lis.append((cy, cx))\n ",
"dy",
"range(-1, 2)",
"range",
"-1",
"2",
"for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if 1 <= cy <= H and 1 <= cx <= W:\n center_pos_lis.append((cy, cx))\n ",
"dx",
"range(-1, 2)",
"range",
"-1",
"2",
"cy = y + dy",
"cy",
"y + dy",
"y",
"dy",
"cx = x + dx",
"cx",
"x + dx",
"x",
"dx",
"if 1 <= cy <= H and 1 <= cx <= W:\n center_pos_lis.append((cy, cx))\n ",
"1 <= cy <= H and 1 <= cx <= W",
"1 <= cy <= H",
"1 <= cy",
"1",
"cy",
"H",
"1 <= cx <= W",
"1 <= cx",
"1",
"cx",
"W",
"center_pos_lis.append((cy, cx))",
"center_pos_lis.append",
"center_pos_lis",
"append",
"(cy, cx)",
"cy",
"cx",
"return center_pos_lis",
"center_pos_lis",
"y",
"y",
"x",
"x",
"0 for _ in range(10)",
"for _ in range(10)",
"_",
"range(10)",
"range",
"10",
"for _ in range(10)",
"0",
"ANS_TABLE = [0 for _ in range(10)]",
"ANS_TABLE",
"[0 for _ in range(10)]",
"done_boxes = {}",
"done_boxes",
"{}",
"for blk in blacks:\n # print(blk)\n y, x = blk\n boxes = center_of_boxes_from_point(y, x)\n\n # boxを探索して黒マスをカウントする\n for center_of_box in boxes:\n if center_of_box not in done_boxes:\n y, x = center_of_box\n if 2 <= y < H and 2 <= x < W:\n count = 0\n for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if (cy, cx) in blacks:\n count += 1\n # print(center_of_box, count)\n ANS_TABLE[count] += 1\n done_boxes[center_of_box] = 0\n\n # print('total boxes', (W - 2) * (H - 2))\n ",
"blk",
"blacks",
"y, x = blk",
"y",
"blk",
"x",
"boxes = center_of_boxes_from_point(y, x)",
"boxes",
"center_of_boxes_from_point(y, x)",
"center_of_boxes_from_point",
"y",
"x",
"for center_of_box in boxes:\n if center_of_box not in done_boxes:\n y, x = center_of_box\n if 2 <= y < H and 2 <= x < W:\n count = 0\n for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if (cy, cx) in blacks:\n count += 1\n # print(center_of_box, count)\n ANS_TABLE[count] += 1\n done_boxes[center_of_box] = 0\n\n # print('total boxes', (W - 2) * (H - 2))\n ",
"center_of_box",
"boxes",
"if center_of_box not in done_boxes:\n y, x = center_of_box\n if 2 <= y < H and 2 <= x < W:\n count = 0\n for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if (cy, cx) in blacks:\n count += 1\n # print(center_of_box, count)\n ANS_TABLE[count] += 1\n done_boxes[center_of_box] = 0\n\n # print('total boxes', (W - 2) * (H - 2))\n ",
"center_of_box not in done_boxes",
"center_of_box",
"done_boxes",
"y, x = center_of_box",
"y",
"center_of_box",
"x",
"if 2 <= y < H and 2 <= x < W:\n count = 0\n for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if (cy, cx) in blacks:\n count += 1\n # print(center_of_box, count)\n ANS_TABLE[count] += 1\n done_boxes[center_of_box] = 0\n\n # print('total boxes', (W - 2) * (H - 2))\n ",
"2 <= y < H and 2 <= x < W",
"2 <= y < H",
"2 <= y",
"2",
"y",
"H",
"2 <= x < W",
"2 <= x",
"2",
"x",
"W",
"count = 0",
"count",
"0",
"for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if (cy, cx) in blacks:\n count += 1\n # print(center_of_box, count)\n ",
"dy",
"range(-1, 2)",
"range",
"-1",
"2",
"for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if (cy, cx) in blacks:\n count += 1\n # print(center_of_box, count)\n ",
"dx",
"range(-1, 2)",
"range",
"-1",
"2",
"cy = y + dy",
"cy",
"y + dy",
"y",
"dy",
"cx = x + dx",
"cx",
"x + dx",
"x",
"dx",
"if (cy, cx) in blacks:\n count += 1\n # print(center_of_box, count)\n ",
"(cy, cx) in blacks",
"(cy, cx)",
"cy",
"cx",
"blacks",
"count += 1",
"count",
"1",
"ANS_TABLE[count] += 1",
"ANS_TABLE[count]",
"ANS_TABLE",
"count",
"1",
"done_boxes[center_of_box] = 0",
"done_boxes[center_of_box]",
"done_boxes",
"center_of_box",
"0",
"ANS_TABLE[0] = (W - 2) * (H - 2) - sum(ANS_TABLE)",
"ANS_TABLE[0]",
"ANS_TABLE",
"0",
"(W - 2) * (H - 2) - sum(ANS_TABLE)",
"(W - 2) * (H - 2)",
"W - 2",
"W",
"2",
"H - 2",
"H",
"2",
"sum(ANS_TABLE)",
"sum",
"ANS_TABLE",
"return ANS_TABLE",
"ANS_TABLE",
"if __name__ == '__main__':\n res = solve()\n for r in res:\n print(r)",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"res = solve()",
"res",
"solve()",
"solve",
"for r in res:\n print(r)",
"r",
"res",
"print(r)",
"print",
"r",
"def solve():\n H, W, N = list(map(int, input().split()))\n # print(H, W, N)\n\n # 座標は(y, x)\n blacks = {}\n for _ in range(N):\n pos = input().split()\n blacks[(int(pos[0]), int(pos[1]))] = 0\n\n # print(blacks)\n\n # [*][*][*]\n # [*][c][*]\n # [*][*][*]\n # ある座標から, それを中心にした9つの座標を返す\n def center_of_boxes_from_point(y, x):\n center_pos_lis = deque()\n\n for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if 1 <= cy <= H and 1 <= cx <= W:\n center_pos_lis.append((cy, cx))\n return center_pos_lis\n\n ANS_TABLE = [0 for _ in range(10)]\n\n # 探索を終了したboxを保存する\n # keyはboxの中心の座標\n done_boxes = {}\n for blk in blacks:\n # print(blk)\n y, x = blk\n boxes = center_of_boxes_from_point(y, x)\n\n # boxを探索して黒マスをカウントする\n for center_of_box in boxes:\n if center_of_box not in done_boxes:\n y, x = center_of_box\n if 2 <= y < H and 2 <= x < W:\n count = 0\n for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if (cy, cx) in blacks:\n count += 1\n # print(center_of_box, count)\n ANS_TABLE[count] += 1\n done_boxes[center_of_box] = 0\n\n # print('total boxes', (W - 2) * (H - 2))\n ANS_TABLE[0] = (W - 2) * (H - 2) - sum(ANS_TABLE)\n\n return ANS_TABLE",
"def solve():\n H, W, N = list(map(int, input().split()))\n # print(H, W, N)\n\n # 座標は(y, x)\n blacks = {}\n for _ in range(N):\n pos = input().split()\n blacks[(int(pos[0]), int(pos[1]))] = 0\n\n # print(blacks)\n\n # [*][*][*]\n # [*][c][*]\n # [*][*][*]\n # ある座標から, それを中心にした9つの座標を返す\n def center_of_boxes_from_point(y, x):\n center_pos_lis = deque()\n\n for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if 1 <= cy <= H and 1 <= cx <= W:\n center_pos_lis.append((cy, cx))\n return center_pos_lis\n\n ANS_TABLE = [0 for _ in range(10)]\n\n # 探索を終了したboxを保存する\n # keyはboxの中心の座標\n done_boxes = {}\n for blk in blacks:\n # print(blk)\n y, x = blk\n boxes = center_of_boxes_from_point(y, x)\n\n # boxを探索して黒マスをカウントする\n for center_of_box in boxes:\n if center_of_box not in done_boxes:\n y, x = center_of_box\n if 2 <= y < H and 2 <= x < W:\n count = 0\n for dy in range(-1, 2):\n for dx in range(-1, 2):\n cy = y + dy\n cx = x + dx\n if (cy, cx) in blacks:\n count += 1\n # print(center_of_box, count)\n ANS_TABLE[count] += 1\n done_boxes[center_of_box] = 0\n\n # print('total boxes', (W - 2) * (H - 2))\n ANS_TABLE[0] = (W - 2) * (H - 2) - sum(ANS_TABLE)\n\n return ANS_TABLE",
"solve",
"res = solve()",
"solve()",
"res"
] | from collections import deque
def solve():
H, W, N = list(map(int, input().split()))
# print(H, W, N)
# 座標は(y, x)
blacks = {}
for _ in range(N):
pos = input().split()
blacks[(int(pos[0]), int(pos[1]))] = 0
# print(blacks)
# [*][*][*]
# [*][c][*]
# [*][*][*]
# ある座標から, それを中心にした9つの座標を返す
def center_of_boxes_from_point(y, x):
center_pos_lis = deque()
for dy in range(-1, 2):
for dx in range(-1, 2):
cy = y + dy
cx = x + dx
if 1 <= cy <= H and 1 <= cx <= W:
center_pos_lis.append((cy, cx))
return center_pos_lis
ANS_TABLE = [0 for _ in range(10)]
# 探索を終了したboxを保存する
# keyはboxの中心の座標
done_boxes = {}
for blk in blacks:
# print(blk)
y, x = blk
boxes = center_of_boxes_from_point(y, x)
# boxを探索して黒マスをカウントする
for center_of_box in boxes:
if center_of_box not in done_boxes:
y, x = center_of_box
if 2 <= y < H and 2 <= x < W:
count = 0
for dy in range(-1, 2):
for dx in range(-1, 2):
cy = y + dy
cx = x + dx
if (cy, cx) in blacks:
count += 1
# print(center_of_box, count)
ANS_TABLE[count] += 1
done_boxes[center_of_box] = 0
# print('total boxes', (W - 2) * (H - 2))
ANS_TABLE[0] = (W - 2) * (H - 2) - sum(ANS_TABLE)
return ANS_TABLE
if __name__ == '__main__':
res = solve()
for r in res:
print(r)
|
[
7,
15,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
4,
13,
12,
4,
13,
12,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
2,
2,
2,
13,
17,
2,
13,
2,
13,
17,
2,
13,
17,
2,
13,
2,
13,
17,
14,
2,
18,
18,
13,
13,
13,
17,
0,
18,
13,
18,
18,
13,
13,
13,
17,
0,
18,
18,
13,
13,
13,
17,
0,
18,
13,
18,
18,
13,
13,
13,
17,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
18,
13,
17,
2,
13,
4,
13,
18,
13,
39,
17,
29,
13,
4,
13,
31,
4,
13,
0,
13,
17,
10,
12,
13
] | [
[
6,
5
],
[
6,
14
],
[
6,
15
],
[
18,
17
],
[
24,
23
],
[
33,
32
],
[
15,
35
],
[
38,
37
],
[
38,
46
],
[
49,
48
],
[
52,
51
],
[
55,
54
],
[
48,
58
],
[
37,
58
],
[
48,
61
],
[
37,
61
],
[
65,
64
],
[
51,
68
],
[
46,
68
],
[
51,
71
],
[
46,
71
],
[
54,
78
],
[
54,
81
],
[
5,
83
],
[
64,
86
],
[
64,
89
],
[
14,
91
],
[
111,
95
],
[
23,
97
],
[
54,
98
],
[
64,
99
],
[
109,
102
],
[
17,
103
],
[
111,
104
],
[
23,
106
],
[
54,
107
],
[
64,
108
],
[
116,
111
],
[
23,
113
],
[
54,
114
],
[
64,
115
],
[
125,
118
],
[
17,
119
],
[
111,
120
],
[
23,
122
],
[
54,
123
],
[
64,
124
],
[
128,
127
],
[
5,
130
],
[
14,
133
],
[
139,
136
],
[
17,
137
],
[
127,
140
],
[
17,
144
],
[
17,
148
],
[
159,
153
],
[
156,
155
]
] | [
"from collections import defaultdict\ndef solve():\n H, W, N = map(int, input().split())\n ans = [0]*10\n dic = defaultdict(lambda: defaultdict(lambda: 0))\n for i in range(N):\n x,y = map(int, input().split())\n x -= 1\n y -= 1\n for i in range(x-1,x+2):\n for j in range(y-1,y+2):\n if i>0 and i<H-1 and j>0 and j<W-1:\n if dic[i][j]>0:\n ans[dic[i][j]] -= 1\n dic[i][j] += 1\n ans[dic[i][j]] += 1\n total = (H-2)*(W-2)\n ans[0] = total - sum(ans[1:])\n return ans\nprint(*solve(),sep='\\n')",
"from collections import defaultdict",
"def solve():\n H, W, N = map(int, input().split())\n ans = [0]*10\n dic = defaultdict(lambda: defaultdict(lambda: 0))\n for i in range(N):\n x,y = map(int, input().split())\n x -= 1\n y -= 1\n for i in range(x-1,x+2):\n for j in range(y-1,y+2):\n if i>0 and i<H-1 and j>0 and j<W-1:\n if dic[i][j]>0:\n ans[dic[i][j]] -= 1\n dic[i][j] += 1\n ans[dic[i][j]] += 1\n total = (H-2)*(W-2)\n ans[0] = total - sum(ans[1:])\n return ans",
"solve",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"dic = defaultdict(lambda: defaultdict(lambda: 0))",
"dic",
"defaultdict(lambda: defaultdict(lambda: 0))",
"defaultdict",
"lambda: defaultdict(lambda: 0)",
"defaultdict(lambda: 0)",
"defaultdict",
"lambda: 0",
"0",
"for i in range(N):\n x,y = map(int, input().split())\n x -= 1\n y -= 1\n for i in range(x-1,x+2):\n for j in range(y-1,y+2):\n if i>0 and i<H-1 and j>0 and j<W-1:\n if dic[i][j]>0:\n ans[dic[i][j]] -= 1\n dic[i][j] += 1\n ans[dic[i][j]] += 1\n ",
"i",
"range(N)",
"range",
"N",
"x,y = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"x -= 1",
"x",
"1",
"y -= 1",
"y",
"1",
"for i in range(x-1,x+2):\n for j in range(y-1,y+2):\n if i>0 and i<H-1 and j>0 and j<W-1:\n if dic[i][j]>0:\n ans[dic[i][j]] -= 1\n dic[i][j] += 1\n ans[dic[i][j]] += 1\n ",
"i",
"range(x-1,x+2)",
"range",
"x-1",
"x",
"1",
"x+2",
"x",
"2",
"for j in range(y-1,y+2):\n if i>0 and i<H-1 and j>0 and j<W-1:\n if dic[i][j]>0:\n ans[dic[i][j]] -= 1\n dic[i][j] += 1\n ans[dic[i][j]] += 1\n ",
"j",
"range(y-1,y+2)",
"range",
"y-1",
"y",
"1",
"y+2",
"y",
"2",
"if i>0 and i<H-1 and j>0 and j<W-1:\n if dic[i][j]>0:\n ans[dic[i][j]] -= 1\n dic[i][j] += 1\n ans[dic[i][j]] += 1\n ",
"i>0 and i<H-1 and j>0 and j<W-1",
"i>0 and i<H-1 and j>0",
"i>0 and i<H-1",
"i>0",
"i",
"0",
"i<H-1",
"i",
"H-1",
"H",
"1",
"j>0",
"j",
"0",
"j<W-1",
"j",
"W-1",
"W",
"1",
"if dic[i][j]>0:\n ans[dic[i][j]] -= 1\n ",
"dic[i][j]>0",
"dic[i][j]",
"[i]",
"dic",
"i",
"j",
"0",
"ans[dic[i][j]] -= 1",
"ans[dic[i][j]]",
"ans",
"dic[i][j]",
"[i]",
"dic",
"i",
"j",
"1",
"dic[i][j] += 1",
"dic[i][j]",
"[i]",
"dic",
"i",
"j",
"1",
"ans[dic[i][j]] += 1",
"ans[dic[i][j]]",
"ans",
"dic[i][j]",
"[i]",
"dic",
"i",
"j",
"1",
"total = (H-2)*(W-2)",
"total",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"ans[0] = total - sum(ans[1:])",
"ans[0]",
"ans",
"0",
"total - sum(ans[1:])",
"total",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"return ans",
"ans",
"print(*solve(),sep='\\n')",
"print",
"*solve()",
"solve()",
"solve",
"sep='\\n'",
"sep",
"'\\n'",
"def solve():\n H, W, N = map(int, input().split())\n ans = [0]*10\n dic = defaultdict(lambda: defaultdict(lambda: 0))\n for i in range(N):\n x,y = map(int, input().split())\n x -= 1\n y -= 1\n for i in range(x-1,x+2):\n for j in range(y-1,y+2):\n if i>0 and i<H-1 and j>0 and j<W-1:\n if dic[i][j]>0:\n ans[dic[i][j]] -= 1\n dic[i][j] += 1\n ans[dic[i][j]] += 1\n total = (H-2)*(W-2)\n ans[0] = total - sum(ans[1:])\n return ans",
"def solve():\n H, W, N = map(int, input().split())\n ans = [0]*10\n dic = defaultdict(lambda: defaultdict(lambda: 0))\n for i in range(N):\n x,y = map(int, input().split())\n x -= 1\n y -= 1\n for i in range(x-1,x+2):\n for j in range(y-1,y+2):\n if i>0 and i<H-1 and j>0 and j<W-1:\n if dic[i][j]>0:\n ans[dic[i][j]] -= 1\n dic[i][j] += 1\n ans[dic[i][j]] += 1\n total = (H-2)*(W-2)\n ans[0] = total - sum(ans[1:])\n return ans",
"solve"
] | from collections import defaultdict
def solve():
H, W, N = map(int, input().split())
ans = [0]*10
dic = defaultdict(lambda: defaultdict(lambda: 0))
for i in range(N):
x,y = map(int, input().split())
x -= 1
y -= 1
for i in range(x-1,x+2):
for j in range(y-1,y+2):
if i>0 and i<H-1 and j>0 and j<W-1:
if dic[i][j]>0:
ans[dic[i][j]] -= 1
dic[i][j] += 1
ans[dic[i][j]] += 1
total = (H-2)*(W-2)
ans[0] = total - sum(ans[1:])
return ans
print(*solve(),sep='\n') |
[
7,
15,
13,
15,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
13,
31,
13,
0,
13,
39,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
0,
13,
4,
13,
28,
13,
13,
4,
13,
31,
2,
39,
4,
13,
13,
17,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
0,
13,
4,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
17,
4,
13,
18,
13,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
127,
5
],
[
127,
18
],
[
127,
19
],
[
127,
20
],
[
112,
23
],
[
121,
53
],
[
122,
70
],
[
115,
80
],
[
125,
89
],
[
128,
92
],
[
116,
98
],
[
102,
101
],
[
116,
109
],
[
101,
110
],
[
112,
113
],
[
115,
116
],
[
127,
119
],
[
121,
122
],
[
127,
125
],
[
127,
128
]
] | [
"# solution\nimport io\nfrom collections import Counter\n\nnim, mike, kite, *AB = map(int, open(0).read().split())\n\nmove = [\n (-1, -1), (-1, 0), (-1, 1),\n (0, -1), (0, 0), (0, 1),\n (1, -1), (1, 0), (1, 1),\n]\n\nC = Counter()\nfor a, b in zip(*[iter(AB)] * 2):\n C.update(\n (a - i, b - j)\n for i, j in move\n if 2 <= a - i <= nim - 1 and 2 <= b - j <= mike - 1\n )\n\nD = Counter(v for _, v in C.items())\n\nprint((nim - 2) * (mike - 2) - sum(D.values()))\nfor i in range(1, 10):\n print(D[i])",
"import io",
"io",
"from collections import Counter",
"nim, mike, kite, *AB = map(int, open(0).read().split())",
"nim",
"map(int, open(0).read().split())",
"map",
"int",
"open(0).read().split()",
"(0).read().split",
"(0).read()",
"(0).read",
"(0)",
"open",
"0",
"read",
"split",
"mike",
"kite",
"*AB",
"AB",
"move = [\n (-1, -1), (-1, 0), (-1, 1),\n (0, -1), (0, 0), (0, 1),\n (1, -1), (1, 0), (1, 1),\n]",
"move",
"[\n (-1, -1), (-1, 0), (-1, 1),\n (0, -1), (0, 0), (0, 1),\n (1, -1), (1, 0), (1, 1),\n]",
"(-1, -1)",
"-1",
"-1",
"(-1, 0)",
"-1",
"0",
"(-1, 1)",
"-1",
"1",
"(0, -1)",
"0",
"-1",
"(0, 0)",
"0",
"0",
"(0, 1)",
"0",
"1",
"(1, -1)",
"1",
"-1",
"(1, 0)",
"1",
"0",
"(1, 1)",
"1",
"1",
"C = Counter()",
"C",
"Counter()",
"Counter",
"for a, b in zip(*[iter(AB)] * 2):\n C.update(\n (a - i, b - j)\n for i, j in move\n if 2 <= a - i <= nim - 1 and 2 <= b - j <= mike - 1\n )",
"a",
"b",
"zip(*[iter(AB)] * 2)",
"zip",
"*[iter(AB)] * 2",
"[iter(AB)] * 2",
"[iter(AB)]",
"iter(AB)",
"iter",
"AB",
"2",
"C.update(\n (a - i, b - j)\n for i, j in move\n if 2 <= a - i <= nim - 1 and 2 <= b - j <= mike - 1\n )",
"C.update",
"C",
"update",
"(a - i, b - j)",
"a - i",
"a",
"i",
"b - j",
"b",
"j",
"D = Counter(v for _, v in C.items())",
"D",
"Counter(v for _, v in C.items())",
"Counter",
"v",
"print((nim - 2) * (mike - 2) - sum(D.values()))",
"print",
"(nim - 2) * (mike - 2) - sum(D.values())",
"(nim - 2) * (mike - 2)",
"nim - 2",
"nim",
"2",
"mike - 2",
"mike",
"2",
"sum(D.values())",
"sum",
"D.values()",
"D.values",
"D",
"values",
"for i in range(1, 10):\n print(D[i])",
"i",
"range(1, 10)",
"range",
"1",
"10",
"print(D[i])",
"print",
"D[i]",
"D",
"i",
"move = [\n (-1, -1), (-1, 0), (-1, 1),\n (0, -1), (0, 0), (0, 1),\n (1, -1), (1, 0), (1, 1),\n]",
"[\n (-1, -1), (-1, 0), (-1, 1),\n (0, -1), (0, 0), (0, 1),\n (1, -1), (1, 0), (1, 1),\n]",
"move",
"D = Counter(v for _, v in C.items())",
"Counter(v for _, v in C.items())",
"D",
"kite, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"kite",
"C = Counter()",
"Counter()",
"C",
"nim, mike, kite, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"nim",
"mike, kite, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"mike"
] | # solution
import io
from collections import Counter
nim, mike, kite, *AB = map(int, open(0).read().split())
move = [
(-1, -1), (-1, 0), (-1, 1),
(0, -1), (0, 0), (0, 1),
(1, -1), (1, 0), (1, 1),
]
C = Counter()
for a, b in zip(*[iter(AB)] * 2):
C.update(
(a - i, b - j)
for i, j in move
if 2 <= a - i <= nim - 1 and 2 <= b - j <= mike - 1
)
D = Counter(v for _, v in C.items())
print((nim - 2) * (mike - 2) - sum(D.values()))
for i in range(1, 10):
print(D[i])
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
2,
40,
17,
2,
13,
13,
2,
13,
17,
2,
40,
17,
2,
13,
13,
2,
13,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
2,
39,
17,
17,
0,
13,
17,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] | [
[
158,
3
],
[
158,
12
],
[
158,
13
],
[
143,
15
],
[
21,
20
],
[
153,
23
],
[
146,
25
],
[
146,
34
],
[
131,
36
],
[
134,
39
],
[
43,
42
],
[
49,
48
],
[
132,
59
],
[
129,
59
],
[
42,
60
],
[
159,
62
],
[
135,
68
],
[
147,
68
],
[
48,
69
],
[
138,
71
],
[
83,
74
],
[
144,
75
],
[
132,
78
],
[
129,
78
],
[
42,
79
],
[
135,
81
],
[
147,
81
],
[
48,
82
],
[
155,
85
],
[
149,
91
],
[
144,
98
],
[
104,
101
],
[
156,
102
],
[
140,
106
],
[
112,
109
],
[
156,
110
],
[
159,
115
],
[
138,
118
],
[
141,
120
],
[
150,
120
],
[
123,
122
],
[
156,
122
],
[
122,
126
],
[
146,
129
],
[
131,
132
],
[
134,
135
],
[
158,
138
],
[
140,
141
],
[
143,
144
],
[
146,
147
],
[
149,
150
],
[
158,
153
],
[
155,
156
],
[
158,
159
]
] | [
"from collections import Counter\nh, w, n = map(int, input().split())\nc = Counter([])\n\nfor i in range(n):\n a, b = map(int, input().split())\n a-=1; b-=1\n\n for i in range(-2, 1):\n for j in range(-2, 1):\n if 0<=a+i<h-2 and 0<=b+j<w-2:\n c[(a+i, b+j)]+=1\n\nans = [0] * 10\ntotal = 0\nfor k, v in c.items():\n ans[v]+=1\n total+=1\nans[0]=(h-2)*(w-2) - total\n\n\nfor a in ans:\n print(a) \n \n",
"from collections import Counter",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"c = Counter([])",
"c",
"Counter([])",
"Counter",
"[]",
"for i in range(n):\n a, b = map(int, input().split())\n a-=1; b-=1\n\n for i in range(-2, 1):\n for j in range(-2, 1):\n if 0<=a+i<h-2 and 0<=b+j<w-2:\n c[(a+i, b+j)]+=1",
"i",
"range(n)",
"range",
"n",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"a-=1",
"a",
"1",
"b-=1",
"b",
"1",
"for i in range(-2, 1):\n for j in range(-2, 1):\n if 0<=a+i<h-2 and 0<=b+j<w-2:\n c[(a+i, b+j)]+=1",
"i",
"range(-2, 1)",
"range",
"-2",
"1",
"for j in range(-2, 1):\n if 0<=a+i<h-2 and 0<=b+j<w-2:\n c[(a+i, b+j)]+=1",
"j",
"range(-2, 1)",
"range",
"-2",
"1",
"if 0<=a+i<h-2 and 0<=b+j<w-2:\n c[(a+i, b+j)]+=1",
"0<=a+i<h-2 and 0<=b+j<w-2",
"0<=a+i<h-2",
"0<=a+i",
"0",
"a+i",
"a",
"i",
"h-2",
"h",
"2",
"0<=b+j<w-2",
"0<=b+j",
"0",
"b+j",
"b",
"j",
"w-2",
"w",
"2",
"c[(a+i, b+j)]+=1",
"c[(a+i, b+j)]",
"c",
"(a+i, b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"total = 0",
"total",
"0",
"for k, v in c.items():\n ans[v]+=1\n total+=1",
"k",
"v",
"c.items()",
"c.items",
"c",
"items",
"ans[v]+=1",
"ans[v]",
"ans",
"v",
"1",
"total+=1",
"total",
"1",
"ans[0]=(h-2)*(w-2) - total",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2) - total",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"total",
"for a in ans:\n print(a) \n ",
"a",
"ans",
"print(a)",
"print",
"a",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"a-=1",
"1",
"a",
"b-=1",
"1",
"b",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"total+=1",
"1",
"total",
"c = Counter([])",
"Counter([])",
"c",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"total = 0",
"0",
"total",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"ans = [0] * 10",
"[0] * 10",
"ans",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h"
] | from collections import Counter
h, w, n = map(int, input().split())
c = Counter([])
for i in range(n):
a, b = map(int, input().split())
a-=1; b-=1
for i in range(-2, 1):
for j in range(-2, 1):
if 0<=a+i<h-2 and 0<=b+j<w-2:
c[(a+i, b+j)]+=1
ans = [0] * 10
total = 0
for k, v in c.items():
ans[v]+=1
total+=1
ans[0]=(h-2)*(w-2) - total
for a in ans:
print(a)
|
[
7,
15,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
0,
39,
13,
13,
4,
13,
13,
4,
18,
4,
13,
13,
4,
18,
13,
13,
39,
13,
13,
29,
39,
13,
13,
13,
13,
12,
13,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
23,
13,
23,
13,
23,
13,
12,
13,
14,
40,
40,
17,
18,
13,
17,
2,
13,
17,
14,
40,
40,
17,
18,
13,
17,
2,
13,
17,
29,
17,
29,
17,
23,
13,
23,
13,
23,
13,
12,
13,
0,
13,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
13,
4,
13,
18,
13,
17,
18,
13,
17,
13,
0,
13,
4,
18,
13,
13,
41,
28,
13,
13,
4,
13,
18,
13,
17,
13,
13,
4,
18,
13,
17,
0,
13,
13,
0,
13,
39,
0,
13,
17,
28,
13,
4,
13,
17,
17,
41,
28,
13,
13,
2,
13,
13,
4,
17,
4,
18,
13,
13,
4,
13,
13,
0,
13,
18,
13,
17,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
13,
28,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] | [
[
6,
5
],
[
6,
14
],
[
6,
15
],
[
18,
17
],
[
21,
20
],
[
15,
23
],
[
28,
25
],
[
17,
38
],
[
53,
52
],
[
59,
58
],
[
73,
64
],
[
79,
65
],
[
75,
68
],
[
52,
69
],
[
77,
71
],
[
58,
72
],
[
75,
75
],
[
77,
77
],
[
79,
79
],
[
107,
87
],
[
109,
90
],
[
107,
97
],
[
111,
100
],
[
107,
107
],
[
109,
109
],
[
111,
111
],
[
116,
115
],
[
220,
117
],
[
116,
118
],
[
116,
119
],
[
116,
120
],
[
123,
122
],
[
128,
127
],
[
120,
127
],
[
226,
130
],
[
127,
132
],
[
127,
135
],
[
122,
137
],
[
140,
139
],
[
122,
142
],
[
147,
146
],
[
139,
146
],
[
229,
149
],
[
146,
151
],
[
115,
153
],
[
118,
154
],
[
146,
157
],
[
161,
160
],
[
164,
163
],
[
167,
166
],
[
170,
169
],
[
177,
176
],
[
160,
176
],
[
139,
176
],
[
176,
179
],
[
169,
180
],
[
163,
185
],
[
192,
191
],
[
163,
193
],
[
115,
200
],
[
118,
203
],
[
191,
205
],
[
166,
205
],
[
208,
207
],
[
163,
207
],
[
207,
211
],
[
223,
217
]
] | [
"from collections import defaultdict\n\n\ndef read_input():\n h, w, n = map(int, input().split())\n alist = []\n for i in range(n):\n (px, py) = map(int, input().split())\n alist.append((px, py))\n\n return h, w, n, alist\n\n\ndef count_arround(px, py, count):\n for xx in [-2, -1, 0]:\n for yy in [-2, -1, 0]:\n count[(px+xx, py+yy)] += 1\n\n\ndef is_area(p, h, w):\n if 1 <= p[0] <= h - 2:\n if 1 <= p[1] <= w - 2:\n return True\n return False\n\n\ndef submit():\n h, w, n, alist = read_input()\n\n count = defaultdict(int)\n\n for a in alist:\n count_arround(a[0], a[1], count)\n\n counts = count.items()\n counts = [c[1] for c in counts if is_area(c[0], h, w)]\n\n result = []\n s = 0\n for i in range(1, 10):\n result.append(sum([1 for c in counts if c == i]))\n s += result[-1]\n\n print((h - 2)*(w - 2) - s)\n for r in result:\n print(r)\n\n\nif __name__ == '__main__':\n submit()",
"from collections import defaultdict",
"def read_input():\n h, w, n = map(int, input().split())\n alist = []\n for i in range(n):\n (px, py) = map(int, input().split())\n alist.append((px, py))\n\n return h, w, n, alist",
"read_input",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"alist = []",
"alist",
"[]",
"for i in range(n):\n (px, py) = map(int, input().split())\n alist.append((px, py))\n\n ",
"i",
"range(n)",
"range",
"n",
"(px, py) = map(int, input().split())",
"(px, py)",
"px",
"py",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"alist.append((px, py))",
"alist.append",
"alist",
"append",
"(px, py)",
"px",
"py",
"return h, w, n, alist",
"return h, w, n, alist",
"h",
"w",
"n",
"alist",
"def count_arround(px, py, count):\n for xx in [-2, -1, 0]:\n for yy in [-2, -1, 0]:\n count[(px+xx, py+yy)] += 1",
"count_arround",
"for xx in [-2, -1, 0]:\n for yy in [-2, -1, 0]:\n count[(px+xx, py+yy)] += 1",
"xx",
"[-2, -1, 0]",
"-2",
"-1",
"0",
"for yy in [-2, -1, 0]:\n count[(px+xx, py+yy)] += 1",
"yy",
"[-2, -1, 0]",
"-2",
"-1",
"0",
"count[(px+xx, py+yy)] += 1",
"count[(px+xx, py+yy)]",
"count",
"(px+xx, py+yy)",
"px+xx",
"px",
"xx",
"py+yy",
"py",
"yy",
"1",
"px",
"px",
"py",
"py",
"count",
"count",
"def is_area(p, h, w):\n if 1 <= p[0] <= h - 2:\n if 1 <= p[1] <= w - 2:\n return True\n return False",
"is_area",
"if 1 <= p[0] <= h - 2:\n if 1 <= p[1] <= w - 2:\n return True\n ",
"1 <= p[0] <= h - 2",
"1 <= p[0]",
"1",
"p[0]",
"p",
"0",
"h - 2",
"h",
"2",
"if 1 <= p[1] <= w - 2:\n return True\n ",
"1 <= p[1] <= w - 2",
"1 <= p[1]",
"1",
"p[1]",
"p",
"1",
"w - 2",
"w",
"2",
"return True",
"True",
"return False",
"False",
"p",
"p",
"h",
"h",
"w",
"w",
"def submit():\n h, w, n, alist = read_input()\n\n count = defaultdict(int)\n\n for a in alist:\n count_arround(a[0], a[1], count)\n\n counts = count.items()\n counts = [c[1] for c in counts if is_area(c[0], h, w)]\n\n result = []\n s = 0\n for i in range(1, 10):\n result.append(sum([1 for c in counts if c == i]))\n s += result[-1]\n\n print((h - 2)*(w - 2) - s)\n for r in result:\n print(r)",
"submit",
"h, w, n, alist = read_input()",
"h",
"read_input()",
"read_input",
"w",
"n",
"alist",
"count = defaultdict(int)",
"count",
"defaultdict(int)",
"defaultdict",
"int",
"for a in alist:\n count_arround(a[0], a[1], count)\n\n ",
"a",
"alist",
"count_arround(a[0], a[1], count)",
"count_arround",
"a[0]",
"a",
"0",
"a[1]",
"a",
"1",
"count",
"counts = count.items()",
"counts",
"count.items()",
"count.items",
"count",
"items",
"c[1] for c in counts if is_area(c[0], h, w)",
"for c in counts if is_area(c[0], h, w)",
"c",
"counts",
"is_area(c[0], h, w)",
"is_area",
"c[0]",
"c",
"0",
"h",
"w",
"if is_area(c[0], h, w)",
"c[1]",
"c",
"1",
"counts = [c[1] for c in counts if is_area(c[0], h, w)]",
"counts",
"[c[1] for c in counts if is_area(c[0], h, w)]",
"result = []",
"result",
"[]",
"s = 0",
"s",
"0",
"for i in range(1, 10):\n result.append(sum([1 for c in counts if c == i]))\n s += result[-1]\n\n ",
"i",
"range(1, 10)",
"range",
"1",
"10",
"1 for c in counts if c == i",
"for c in counts if c == i",
"c",
"counts",
"c == i",
"c",
"i",
"if c == i",
"1",
"result.append(sum([1 for c in counts if c == i]))",
"result.append",
"result",
"append",
"sum([1 for c in counts if c == i])",
"sum",
"[1 for c in counts if c == i]",
"s += result[-1]",
"s",
"result[-1]",
"result",
"-1",
"print((h - 2)*(w - 2) - s)",
"print",
"(h - 2)*(w - 2) - s",
"(h - 2)*(w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"s",
"for r in result:\n print(r)",
"r",
"result",
"print(r)",
"print",
"r",
"if __name__ == '__main__':\n submit()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"submit()",
"submit",
"def read_input():\n h, w, n = map(int, input().split())\n alist = []\n for i in range(n):\n (px, py) = map(int, input().split())\n alist.append((px, py))\n\n return h, w, n, alist",
"def read_input():\n h, w, n = map(int, input().split())\n alist = []\n for i in range(n):\n (px, py) = map(int, input().split())\n alist.append((px, py))\n\n return h, w, n, alist",
"read_input",
"def submit():\n h, w, n, alist = read_input()\n\n count = defaultdict(int)\n\n for a in alist:\n count_arround(a[0], a[1], count)\n\n counts = count.items()\n counts = [c[1] for c in counts if is_area(c[0], h, w)]\n\n result = []\n s = 0\n for i in range(1, 10):\n result.append(sum([1 for c in counts if c == i]))\n s += result[-1]\n\n print((h - 2)*(w - 2) - s)\n for r in result:\n print(r)",
"def submit():\n h, w, n, alist = read_input()\n\n count = defaultdict(int)\n\n for a in alist:\n count_arround(a[0], a[1], count)\n\n counts = count.items()\n counts = [c[1] for c in counts if is_area(c[0], h, w)]\n\n result = []\n s = 0\n for i in range(1, 10):\n result.append(sum([1 for c in counts if c == i]))\n s += result[-1]\n\n print((h - 2)*(w - 2) - s)\n for r in result:\n print(r)",
"submit",
"def count_arround(px, py, count):\n for xx in [-2, -1, 0]:\n for yy in [-2, -1, 0]:\n count[(px+xx, py+yy)] += 1",
"def count_arround(px, py, count):\n for xx in [-2, -1, 0]:\n for yy in [-2, -1, 0]:\n count[(px+xx, py+yy)] += 1",
"count_arround",
"def is_area(p, h, w):\n if 1 <= p[0] <= h - 2:\n if 1 <= p[1] <= w - 2:\n return True\n return False",
"def is_area(p, h, w):\n if 1 <= p[0] <= h - 2:\n if 1 <= p[1] <= w - 2:\n return True\n return False",
"is_area"
] | from collections import defaultdict
def read_input():
h, w, n = map(int, input().split())
alist = []
for i in range(n):
(px, py) = map(int, input().split())
alist.append((px, py))
return h, w, n, alist
def count_arround(px, py, count):
for xx in [-2, -1, 0]:
for yy in [-2, -1, 0]:
count[(px+xx, py+yy)] += 1
def is_area(p, h, w):
if 1 <= p[0] <= h - 2:
if 1 <= p[1] <= w - 2:
return True
return False
def submit():
h, w, n, alist = read_input()
count = defaultdict(int)
for a in alist:
count_arround(a[0], a[1], count)
counts = count.items()
counts = [c[1] for c in counts if is_area(c[0], h, w)]
result = []
s = 0
for i in range(1, 10):
result.append(sum([1 for c in counts if c == i]))
s += result[-1]
print((h - 2)*(w - 2) - s)
for r in result:
print(r)
if __name__ == '__main__':
submit()
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
28,
13,
13,
13,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
39,
13,
13,
17,
0,
13,
4,
13,
4,
18,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
137,
3
],
[
137,
12
],
[
137,
13
],
[
17,
16
],
[
138,
19
],
[
125,
32
],
[
131,
35
],
[
45,
44
],
[
55,
54
],
[
44,
68
],
[
123,
70
],
[
54,
75
],
[
135,
77
],
[
85,
80
],
[
132,
81
],
[
128,
87
],
[
132,
92
],
[
123,
99
],
[
135,
102
],
[
129,
108
],
[
112,
111
],
[
129,
119
],
[
111,
120
],
[
137,
123
],
[
125,
126
],
[
128,
129
],
[
131,
132
],
[
137,
135
],
[
137,
138
]
] | [
"from collections import defaultdict, Counter\n\nh, w, n = map(int, input().split())\nab = [list(map(int, input().split())) for _ in range(n)]\n\nd = defaultdict(int)\n\nfor a, b in ab:\n for hi in range(a - 2, a + 1):\n for wi in range(b - 2, b + 1):\n if 1 <= hi <= h - 2 and 1 <= wi <= w - 2:\n d[(hi, wi)] += 1\n\nc = Counter(d.values())\n\nprint((h - 2) * (w - 2) - sum(c.values()))\n\nfor i in range(1, 10):\n print(c[i])",
"from collections import defaultdict, Counter",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"list(map(int, input().split())) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ab = [list(map(int, input().split())) for _ in range(n)]",
"ab",
"[list(map(int, input().split())) for _ in range(n)]",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"for a, b in ab:\n for hi in range(a - 2, a + 1):\n for wi in range(b - 2, b + 1):\n if 1 <= hi <= h - 2 and 1 <= wi <= w - 2:\n d[(hi, wi)] += 1",
"a",
"b",
"ab",
"for hi in range(a - 2, a + 1):\n for wi in range(b - 2, b + 1):\n if 1 <= hi <= h - 2 and 1 <= wi <= w - 2:\n d[(hi, wi)] += 1",
"hi",
"range(a - 2, a + 1)",
"range",
"a - 2",
"a",
"2",
"a + 1",
"a",
"1",
"for wi in range(b - 2, b + 1):\n if 1 <= hi <= h - 2 and 1 <= wi <= w - 2:\n d[(hi, wi)] += 1",
"wi",
"range(b - 2, b + 1)",
"range",
"b - 2",
"b",
"2",
"b + 1",
"b",
"1",
"if 1 <= hi <= h - 2 and 1 <= wi <= w - 2:\n d[(hi, wi)] += 1",
"1 <= hi <= h - 2 and 1 <= wi <= w - 2",
"1 <= hi <= h - 2",
"1 <= hi",
"1",
"hi",
"h - 2",
"h",
"2",
"1 <= wi <= w - 2",
"1 <= wi",
"1",
"wi",
"w - 2",
"w",
"2",
"d[(hi, wi)] += 1",
"d[(hi, wi)]",
"d",
"(hi, wi)",
"hi",
"wi",
"1",
"c = Counter(d.values())",
"c",
"Counter(d.values())",
"Counter",
"d.values()",
"d.values",
"d",
"values",
"print((h - 2) * (w - 2) - sum(c.values()))",
"print",
"(h - 2) * (w - 2) - sum(c.values())",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"sum(c.values())",
"sum",
"c.values()",
"c.values",
"c",
"values",
"for i in range(1, 10):\n print(c[i])",
"i",
"range(1, 10)",
"range",
"1",
"10",
"print(c[i])",
"print",
"c[i]",
"c",
"i",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"ab = [list(map(int, input().split())) for _ in range(n)]",
"[list(map(int, input().split())) for _ in range(n)]",
"ab",
"c = Counter(d.values())",
"Counter(d.values())",
"c",
"d = defaultdict(int)",
"defaultdict(int)",
"d",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"n = map(int, input().split())",
"map(int, input().split())",
"n"
] | from collections import defaultdict, Counter
h, w, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
d = defaultdict(int)
for a, b in ab:
for hi in range(a - 2, a + 1):
for wi in range(b - 2, b + 1):
if 1 <= hi <= h - 2 and 1 <= wi <= w - 2:
d[(hi, wi)] += 1
c = Counter(d.values())
print((h - 2) * (w - 2) - sum(c.values()))
for i in range(1, 10):
print(c[i])
|
[
7,
15,
15,
13,
0,
13,
18,
18,
13,
13,
13,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
0,
13,
4,
13,
13,
0,
13,
39,
17,
17,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
40,
40,
17,
2,
13,
13,
2,
13,
17,
28,
13,
13,
14,
40,
40,
17,
2,
13,
13,
2,
13,
17,
0,
13,
18,
13,
39,
2,
13,
13,
2,
13,
13,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
14,
2,
40,
40,
17,
2,
13,
13,
2,
13,
17,
40,
40,
17,
2,
13,
13,
2,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
28,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
18,
13
] | [
[
177,
5
],
[
15,
14
],
[
178,
21
],
[
15,
23
],
[
15,
24
],
[
27,
26
],
[
33,
32
],
[
41,
38
],
[
32,
39
],
[
14,
43
],
[
23,
46
],
[
50,
49
],
[
55,
54
],
[
61,
60
],
[
24,
63
],
[
66,
65
],
[
178,
72
],
[
66,
74
],
[
77,
76
],
[
80,
79
],
[
83,
82
],
[
54,
82
],
[
76,
89
],
[
65,
89
],
[
82,
90
],
[
14,
92
],
[
96,
95
],
[
54,
95
],
[
79,
102
],
[
74,
102
],
[
95,
103
],
[
23,
105
],
[
109,
108
],
[
49,
110
],
[
76,
113
],
[
65,
113
],
[
82,
114
],
[
79,
116
],
[
74,
116
],
[
95,
117
],
[
128,
119
],
[
49,
120
],
[
76,
123
],
[
65,
123
],
[
82,
124
],
[
79,
126
],
[
74,
126
],
[
95,
127
],
[
76,
135
],
[
65,
135
],
[
82,
136
],
[
14,
138
],
[
79,
144
],
[
74,
144
],
[
95,
145
],
[
23,
147
],
[
153,
150
],
[
32,
151
],
[
108,
152
],
[
160,
155
],
[
32,
156
],
[
108,
158
],
[
163,
162
],
[
32,
162
],
[
162,
166
],
[
175,
172
],
[
177,
178
]
] | [
"from collections import defaultdict\nimport sys\ninput = sys.stdin.readline\n\ndef main():\n H, W, N = map(int, input().split())\n j = [0] * 10\n ans = [0] * 10\n ans[0] = (H - 2) * (W - 2)\n d = defaultdict(int)\n dt = [-1,0,1]\n for i in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in dt:\n if 0 <= a + i <= H - 1:\n for j in dt:\n if 0 <= b + j <= W - 1:\n tmp = d[(a + i, b + j)]\n d[(a + i, b + j)] += 1\n if 1 <= a + i <= H - 2 and 1 <= b + j <= W - 2:\n ans[tmp] -= 1\n ans[tmp + 1] += 1\n \n for a in ans:\n print(a)\n\n\nif __name__ == \"__main__\":\n main()",
"from collections import defaultdict",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"def main():\n H, W, N = map(int, input().split())\n j = [0] * 10\n ans = [0] * 10\n ans[0] = (H - 2) * (W - 2)\n d = defaultdict(int)\n dt = [-1,0,1]\n for i in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in dt:\n if 0 <= a + i <= H - 1:\n for j in dt:\n if 0 <= b + j <= W - 1:\n tmp = d[(a + i, b + j)]\n d[(a + i, b + j)] += 1\n if 1 <= a + i <= H - 2 and 1 <= b + j <= W - 2:\n ans[tmp] -= 1\n ans[tmp + 1] += 1\n \n for a in ans:\n print(a)",
"main",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"j = [0] * 10",
"j",
"[0] * 10",
"[0]",
"0",
"10",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"ans[0] = (H - 2) * (W - 2)",
"ans[0]",
"ans",
"0",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"dt = [-1,0,1]",
"dt",
"[-1,0,1]",
"-1",
"0",
"1",
"for i in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in dt:\n if 0 <= a + i <= H - 1:\n for j in dt:\n if 0 <= b + j <= W - 1:\n tmp = d[(a + i, b + j)]\n d[(a + i, b + j)] += 1\n if 1 <= a + i <= H - 2 and 1 <= b + j <= W - 2:\n ans[tmp] -= 1\n ans[tmp + 1] += 1\n \n ",
"i",
"range(N)",
"range",
"N",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for i in dt:\n if 0 <= a + i <= H - 1:\n for j in dt:\n if 0 <= b + j <= W - 1:\n tmp = d[(a + i, b + j)]\n d[(a + i, b + j)] += 1\n if 1 <= a + i <= H - 2 and 1 <= b + j <= W - 2:\n ans[tmp] -= 1\n ans[tmp + 1] += 1\n \n ",
"i",
"dt",
"if 0 <= a + i <= H - 1:\n for j in dt:\n if 0 <= b + j <= W - 1:\n tmp = d[(a + i, b + j)]\n d[(a + i, b + j)] += 1\n if 1 <= a + i <= H - 2 and 1 <= b + j <= W - 2:\n ans[tmp] -= 1\n ans[tmp + 1] += 1\n \n ",
"0 <= a + i <= H - 1",
"0 <= a + i",
"0",
"a + i",
"a",
"i",
"H - 1",
"H",
"1",
"for j in dt:\n if 0 <= b + j <= W - 1:\n tmp = d[(a + i, b + j)]\n d[(a + i, b + j)] += 1\n if 1 <= a + i <= H - 2 and 1 <= b + j <= W - 2:\n ans[tmp] -= 1\n ans[tmp + 1] += 1\n \n ",
"j",
"dt",
"if 0 <= b + j <= W - 1:\n tmp = d[(a + i, b + j)]\n d[(a + i, b + j)] += 1\n if 1 <= a + i <= H - 2 and 1 <= b + j <= W - 2:\n ans[tmp] -= 1\n ans[tmp + 1] += 1\n \n ",
"0 <= b + j <= W - 1",
"0 <= b + j",
"0",
"b + j",
"b",
"j",
"W - 1",
"W",
"1",
"tmp = d[(a + i, b + j)]",
"tmp",
"d[(a + i, b + j)]",
"d",
"(a + i, b + j)",
"a + i",
"a",
"i",
"b + j",
"b",
"j",
"d[(a + i, b + j)] += 1",
"d[(a + i, b + j)]",
"d",
"(a + i, b + j)",
"a + i",
"a",
"i",
"b + j",
"b",
"j",
"1",
"if 1 <= a + i <= H - 2 and 1 <= b + j <= W - 2:\n ans[tmp] -= 1\n ans[tmp + 1] += 1\n \n ",
"1 <= a + i <= H - 2 and 1 <= b + j <= W - 2",
"1 <= a + i <= H - 2",
"1 <= a + i",
"1",
"a + i",
"a",
"i",
"H - 2",
"H",
"2",
"1 <= b + j <= W - 2",
"1 <= b + j",
"1",
"b + j",
"b",
"j",
"W - 2",
"W",
"2",
"ans[tmp] -= 1",
"ans[tmp]",
"ans",
"tmp",
"1",
"ans[tmp + 1] += 1",
"ans[tmp + 1]",
"ans",
"tmp + 1",
"tmp",
"1",
"1",
"for a in ans:\n print(a)",
"a",
"ans",
"print(a)",
"print",
"a",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n H, W, N = map(int, input().split())\n j = [0] * 10\n ans = [0] * 10\n ans[0] = (H - 2) * (W - 2)\n d = defaultdict(int)\n dt = [-1,0,1]\n for i in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in dt:\n if 0 <= a + i <= H - 1:\n for j in dt:\n if 0 <= b + j <= W - 1:\n tmp = d[(a + i, b + j)]\n d[(a + i, b + j)] += 1\n if 1 <= a + i <= H - 2 and 1 <= b + j <= W - 2:\n ans[tmp] -= 1\n ans[tmp + 1] += 1\n \n for a in ans:\n print(a)",
"def main():\n H, W, N = map(int, input().split())\n j = [0] * 10\n ans = [0] * 10\n ans[0] = (H - 2) * (W - 2)\n d = defaultdict(int)\n dt = [-1,0,1]\n for i in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in dt:\n if 0 <= a + i <= H - 1:\n for j in dt:\n if 0 <= b + j <= W - 1:\n tmp = d[(a + i, b + j)]\n d[(a + i, b + j)] += 1\n if 1 <= a + i <= H - 2 and 1 <= b + j <= W - 2:\n ans[tmp] -= 1\n ans[tmp + 1] += 1\n \n for a in ans:\n print(a)",
"main",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input"
] | from collections import defaultdict
import sys
input = sys.stdin.readline
def main():
H, W, N = map(int, input().split())
j = [0] * 10
ans = [0] * 10
ans[0] = (H - 2) * (W - 2)
d = defaultdict(int)
dt = [-1,0,1]
for i in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
for i in dt:
if 0 <= a + i <= H - 1:
for j in dt:
if 0 <= b + j <= W - 1:
tmp = d[(a + i, b + j)]
d[(a + i, b + j)] += 1
if 1 <= a + i <= H - 2 and 1 <= b + j <= W - 2:
ans[tmp] -= 1
ans[tmp + 1] += 1
for a in ans:
print(a)
if __name__ == "__main__":
main() |
[
7,
15,
0,
13,
4,
13,
17,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
13,
31,
13,
0,
13,
17,
0,
13,
2,
39,
2,
2,
13,
17,
2,
13,
17,
2,
39,
17,
17,
28,
13,
13,
4,
13,
31,
2,
39,
4,
13,
13,
17,
28,
13,
13,
28,
13,
13,
14,
2,
2,
2,
2,
2,
13,
17,
2,
13,
13,
17,
2,
13,
13,
2,
13,
17,
0,
13,
2,
2,
2,
2,
13,
13,
13,
13,
13,
0,
18,
13,
13,
2,
4,
18,
13,
13,
13,
17,
17,
28,
13,
13,
4,
18,
4,
13,
4,
18,
13,
13,
13,
4,
13,
31,
13,
14,
2,
13,
17,
10,
4,
13,
10,
12,
13
] | [
[
125,
3
],
[
11,
10
],
[
11,
23
],
[
11,
24
],
[
11,
25
],
[
29,
28
],
[
32,
31
],
[
10,
36
],
[
23,
39
],
[
59,
58
],
[
126,
58
],
[
62,
61
],
[
126,
61
],
[
10,
69
],
[
61,
73
],
[
58,
77
],
[
23,
79
],
[
83,
82
],
[
61,
88
],
[
23,
89
],
[
58,
91
],
[
96,
93
],
[
28,
94
],
[
82,
95
],
[
28,
99
],
[
82,
101
],
[
28,
113
],
[
31,
119
],
[
125,
126
]
] | [
"from collections import Counter as C;r=range(3)\ndef s():\n\tH,W,N,*L=map(int,open(0).read().split());D={};M=[(H-2)*(W-2)]+[0]*9\n\tfor a,b in zip(*[iter(L)]*2):\n\t\tfor x in r:\n\t\t\tfor y in r:\n\t\t\t\tif H-1>a-y>0<b-x<W-1:\n\t\t\t\t\tt=(a-y)*W+b-x\n\t\t\t\t\tD[t]=D.get(t,0)+1\n\tfor k,v in C(D.values()).items():M[0]-=v;M[k]+=v\n\tprint(*M)\nif __name__==\"__main__\":s()",
"from collections import Counter as C",
"r=range(3)",
"r",
"range(3)",
"range",
"3",
"def s():\n\tH,W,N,*L=map(int,open(0).read().split());D={};M=[(H-2)*(W-2)]+[0]*9\n\tfor a,b in zip(*[iter(L)]*2):\n\t\tfor x in r:\n\t\t\tfor y in r:\n\t\t\t\tif H-1>a-y>0<b-x<W-1:\n\t\t\t\t\tt=(a-y)*W+b-x\n\t\t\t\t\tD[t]=D.get(t,0)+1\n\tfor k,v in C(D.values()).items():M[0]-=v;M[k]+=v\n\tprint(*M)",
"s",
"H,W,N,*L=map(int,open(0).read().split())",
"H",
"map(int,open(0).read().split())",
"map",
"int",
"open(0).read().split()",
"(0).read().split",
"(0).read()",
"(0).read",
"(0)",
"open",
"0",
"read",
"split",
"W",
"N",
"*L",
"L",
"D={}",
"D",
"{}",
"M=[(H-2)*(W-2)]+[0]*9",
"M",
"[(H-2)*(W-2)]+[0]*9",
"[(H-2)*(W-2)]",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"[0]*9",
"[0]",
"0",
"9",
"for a,b in zip(*[iter(L)]*2):\n\t\tfor x in r:\n\t\t\tfor y in r:\n\t\t\t\tif H-1>a-y>0<b-x<W-1:\n\t\t\t\t\tt=(a-y)*W+b-x\n\t\t\t\t\tD[t]=D.get(t,0)+1\n\t",
"a",
"b",
"zip(*[iter(L)]*2)",
"zip",
"*[iter(L)]*2",
"[iter(L)]*2",
"[iter(L)]",
"iter(L)",
"iter",
"L",
"2",
"for x in r:\n\t\t\tfor y in r:\n\t\t\t\tif H-1>a-y>0<b-x<W-1:\n\t\t\t\t\tt=(a-y)*W+b-x\n\t\t\t\t\tD[t]=D.get(t,0)+1\n\t",
"x",
"r",
"for y in r:\n\t\t\t\tif H-1>a-y>0<b-x<W-1:\n\t\t\t\t\tt=(a-y)*W+b-x\n\t\t\t\t\tD[t]=D.get(t,0)+1\n\t",
"y",
"r",
"if H-1>a-y>0<b-x<W-1:\n\t\t\t\t\tt=(a-y)*W+b-x\n\t\t\t\t\tD[t]=D.get(t,0)+1\n\t",
"H-1>a-y>0<b-x<W-1",
"H-1>a-y>0<b-x",
"H-1>a-y>0",
"H-1>a-y",
"H-1",
"H",
"1",
"a-y",
"a",
"y",
"0",
"b-x",
"b",
"x",
"W-1",
"W",
"1",
"t=(a-y)*W+b-x",
"t",
"(a-y)*W+b-x",
"(a-y)*W+b",
"(a-y)*W",
"a-y",
"a",
"y",
"W",
"b",
"x",
"D[t]=D.get(t,0)+1",
"D[t]",
"D",
"t",
"D.get(t,0)+1",
"D.get(t,0)",
"D.get",
"D",
"get",
"t",
"0",
"1",
"for k,v in C(D.values()).items():M[0]-=v;M[k]+=v\n\t",
"k",
"v",
"C(D.values()).items()",
"(D.values()).items",
"(D.values())",
"C",
"D.values()",
"D.values",
"D",
"values",
"items",
"print(*M)",
"print",
"*M",
"M",
"if __name__==\"__main__\":s()",
"__name__==\"__main__\"",
"__name__",
"\"__main__\"",
"r=range(3)",
"range(3)",
"r",
"def s():\n\tH,W,N,*L=map(int,open(0).read().split());D={};M=[(H-2)*(W-2)]+[0]*9\n\tfor a,b in zip(*[iter(L)]*2):\n\t\tfor x in r:\n\t\t\tfor y in r:\n\t\t\t\tif H-1>a-y>0<b-x<W-1:\n\t\t\t\t\tt=(a-y)*W+b-x\n\t\t\t\t\tD[t]=D.get(t,0)+1\n\tfor k,v in C(D.values()).items():M[0]-=v;M[k]+=v\n\tprint(*M)",
"def s():\n\tH,W,N,*L=map(int,open(0).read().split());D={};M=[(H-2)*(W-2)]+[0]*9\n\tfor a,b in zip(*[iter(L)]*2):\n\t\tfor x in r:\n\t\t\tfor y in r:\n\t\t\t\tif H-1>a-y>0<b-x<W-1:\n\t\t\t\t\tt=(a-y)*W+b-x\n\t\t\t\t\tD[t]=D.get(t,0)+1\n\tfor k,v in C(D.values()).items():M[0]-=v;M[k]+=v\n\tprint(*M)",
"s"
] | from collections import Counter as C;r=range(3)
def s():
H,W,N,*L=map(int,open(0).read().split());D={};M=[(H-2)*(W-2)]+[0]*9
for a,b in zip(*[iter(L)]*2):
for x in r:
for y in r:
if H-1>a-y>0<b-x<W-1:
t=(a-y)*W+b-x
D[t]=D.get(t,0)+1
for k,v in C(D.values()).items():M[0]-=v;M[k]+=v
print(*M)
if __name__=="__main__":s() |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
4,
18,
13,
13,
39,
2,
13,
17,
2,
13,
17,
0,
13,
4,
13,
13,
28,
13,
13,
13,
28,
13,
4,
13,
17,
17,
14,
2,
2,
2,
13,
13,
17,
40,
2,
13,
17,
2,
13,
13,
9,
28,
13,
4,
13,
17,
17,
14,
2,
2,
2,
13,
13,
17,
40,
2,
13,
17,
2,
13,
13,
9,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
13,
4,
13,
18,
13,
39,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
171,
3
],
[
171,
12
],
[
171,
13
],
[
174,
15
],
[
163,
18
],
[
166,
21
],
[
177,
24
],
[
29,
28
],
[
172,
31
],
[
168,
33
],
[
168,
42
],
[
178,
45
],
[
169,
49
],
[
157,
52
],
[
180,
55
],
[
65,
64
],
[
169,
73
],
[
64,
74
],
[
163,
78
],
[
169,
81
],
[
64,
82
],
[
86,
85
],
[
157,
94
],
[
85,
95
],
[
166,
99
],
[
157,
102
],
[
85,
103
],
[
115,
106
],
[
181,
107
],
[
169,
110
],
[
64,
111
],
[
157,
113
],
[
85,
114
],
[
159,
117
],
[
124,
123
],
[
181,
126
],
[
132,
129
],
[
160,
130
],
[
123,
131
],
[
137,
134
],
[
160,
135
],
[
175,
138
],
[
160,
142
],
[
147,
146
],
[
160,
153
],
[
146,
154
],
[
168,
157
],
[
159,
160
],
[
171,
163
],
[
171,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
],
[
180,
181
]
] | [
"from collections import defaultdict\nH,W,N=map(int,input().split())\n\nallcase=(H-2)*(W-2)\n\nabset=set()\nfor _ in range(N):\n a,b=map(int,input().split())\n abset.add((a-1,b-1))\n#print(abset)\n\nmemo=defaultdict(int)\nfor a,b in abset:\n for j in range(-2,1):\n if a+j<0 or H-2<=a+j:\n continue \n for k in range(-2,1):\n if b+k<0 or W-2<=b+k:\n continue\n memo[(a+j,b+k)]+=1\n#print(memo) \n\ncase_list=[0]*10\nfor v in memo.values():\n case_list[v]+=1\ncase_list[0]=allcase-sum(case_list[1:])\n#print(case_list)\n\nfor i in range(10):\n print(case_list[i])",
"from collections import defaultdict",
"H,W,N=map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"allcase=(H-2)*(W-2)",
"allcase",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"abset=set()",
"abset",
"set()",
"set",
"for _ in range(N):\n a,b=map(int,input().split())\n abset.add((a-1,b-1))\n#print(abset)",
"_",
"range(N)",
"range",
"N",
"a,b=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"abset.add((a-1,b-1))",
"abset.add",
"abset",
"add",
"(a-1,b-1)",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"memo=defaultdict(int)",
"memo",
"defaultdict(int)",
"defaultdict",
"int",
"for a,b in abset:\n for j in range(-2,1):\n if a+j<0 or H-2<=a+j:\n continue \n for k in range(-2,1):\n if b+k<0 or W-2<=b+k:\n continue\n memo[(a+j,b+k)]+=1\n#print(memo) ",
"a",
"b",
"abset",
"for j in range(-2,1):\n if a+j<0 or H-2<=a+j:\n continue \n for k in range(-2,1):\n if b+k<0 or W-2<=b+k:\n continue\n memo[(a+j,b+k)]+=1\n#print(memo) ",
"j",
"range(-2,1)",
"range",
"-2",
"1",
"if a+j<0 or H-2<=a+j:\n continue \n ",
"a+j<0 or H-2<=a+j",
"a+j<0",
"a+j",
"a",
"j",
"0",
"H-2<=a+j",
"H-2",
"H",
"2",
"a+j",
"a",
"j",
"continue",
"for k in range(-2,1):\n if b+k<0 or W-2<=b+k:\n continue\n memo[(a+j,b+k)]+=1\n#print(memo) ",
"k",
"range(-2,1)",
"range",
"-2",
"1",
"if b+k<0 or W-2<=b+k:\n continue\n ",
"b+k<0 or W-2<=b+k",
"b+k<0",
"b+k",
"b",
"k",
"0",
"W-2<=b+k",
"W-2",
"W",
"2",
"b+k",
"b",
"k",
"continue",
"memo[(a+j,b+k)]+=1",
"memo[(a+j,b+k)]",
"memo",
"(a+j,b+k)",
"a+j",
"a",
"j",
"b+k",
"b",
"k",
"1",
"case_list=[0]*10",
"case_list",
"[0]*10",
"[0]",
"0",
"10",
"for v in memo.values():\n case_list[v]+=1",
"v",
"memo.values()",
"memo.values",
"memo",
"values",
"case_list[v]+=1",
"case_list[v]",
"case_list",
"v",
"1",
"case_list[0]=allcase-sum(case_list[1:])",
"case_list[0]",
"case_list",
"0",
"allcase-sum(case_list[1:])",
"allcase",
"sum(case_list[1:])",
"sum",
"case_list[1:]",
"case_list",
"1:",
"1",
"for i in range(10):\n print(case_list[i])",
"i",
"range(10)",
"range",
"10",
"print(case_list[i])",
"print",
"case_list[i]",
"case_list",
"i",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"case_list=[0]*10",
"[0]*10",
"case_list",
"H,W,N=map(int,input().split())",
"map(int,input().split())",
"H",
"W,N=map(int,input().split())",
"map(int,input().split())",
"W",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"allcase=(H-2)*(W-2)",
"(H-2)*(W-2)",
"allcase",
"abset=set()",
"set()",
"abset",
"memo=defaultdict(int)",
"defaultdict(int)",
"memo"
] | from collections import defaultdict
H,W,N=map(int,input().split())
allcase=(H-2)*(W-2)
abset=set()
for _ in range(N):
a,b=map(int,input().split())
abset.add((a-1,b-1))
#print(abset)
memo=defaultdict(int)
for a,b in abset:
for j in range(-2,1):
if a+j<0 or H-2<=a+j:
continue
for k in range(-2,1):
if b+k<0 or W-2<=b+k:
continue
memo[(a+j,b+k)]+=1
#print(memo)
case_list=[0]*10
for v in memo.values():
case_list[v]+=1
case_list[0]=allcase-sum(case_list[1:])
#print(case_list)
for i in range(10):
print(case_list[i]) |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
28,
13,
13,
13,
28,
13,
4,
13,
17,
0,
13,
2,
13,
13,
14,
2,
2,
13,
17,
2,
13,
2,
13,
17,
9,
28,
13,
4,
13,
17,
0,
13,
2,
13,
13,
14,
2,
2,
13,
17,
2,
13,
2,
13,
17,
9,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
0,
13,
4,
13,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
17,
0,
13,
18,
13,
13,
0,
18,
13,
13,
13,
0,
18,
13,
17,
13,
4,
13,
31,
13,
0,
13,
17,
10,
4,
13,
10,
13,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
18,
13
] | [
[
172,
3
],
[
172,
12
],
[
172,
13
],
[
17,
16
],
[
173,
19
],
[
151,
32
],
[
148,
35
],
[
45,
44
],
[
169,
49
],
[
44,
52
],
[
170,
56
],
[
164,
59
],
[
170,
61
],
[
66,
65
],
[
157,
70
],
[
65,
73
],
[
158,
77
],
[
167,
80
],
[
158,
82
],
[
91,
86
],
[
149,
87
],
[
154,
93
],
[
102,
99
],
[
155,
100
],
[
164,
104
],
[
167,
107
],
[
160,
110
],
[
149,
117
],
[
121,
120
],
[
175,
126
],
[
161,
128
],
[
120,
129
],
[
134,
131
],
[
155,
132
],
[
120,
133
],
[
176,
134
],
[
139,
136
],
[
155,
137
],
[
176,
139
],
[
155,
143
],
[
146,
145
],
[
148,
149
],
[
151,
152
],
[
154,
155
],
[
157,
158
],
[
160,
161
],
[
172,
164
],
[
172,
167
],
[
169,
170
],
[
172,
173
],
[
175,
176
]
] | [
"from collections import defaultdict, Counter\n\nH, W, N = map(int, input().split())\nab = [list(map(int, input().split())) for i in range(N)]\n\nd = defaultdict(int)\nfor a, b in ab:\n for da in range(3):\n aa = a - da\n if aa < 1 or H < aa + 2:\n continue\n for db in range(3):\n bb = b - db\n if bb < 1 or W < bb + 2:\n continue\n \n d[(aa, bb)] += 1\n\nnum = [0] * 10\nnum[0] = (H - 2) * (W - 2)\ncount_n = Counter(list(d.values()))\nfor i in range(1, 10):\n n = count_n[i]\n num[i] += n\n num[0] -= n\n\nprint(*num, sep='\\n')",
"from collections import defaultdict, Counter",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"list(map(int, input().split())) for i in range(N)",
"for i in range(N)",
"i",
"range(N)",
"range",
"N",
"for i in range(N)",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ab = [list(map(int, input().split())) for i in range(N)]",
"ab",
"[list(map(int, input().split())) for i in range(N)]",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"for a, b in ab:\n for da in range(3):\n aa = a - da\n if aa < 1 or H < aa + 2:\n continue\n for db in range(3):\n bb = b - db\n if bb < 1 or W < bb + 2:\n continue\n \n d[(aa, bb)] += 1",
"a",
"b",
"ab",
"for da in range(3):\n aa = a - da\n if aa < 1 or H < aa + 2:\n continue\n for db in range(3):\n bb = b - db\n if bb < 1 or W < bb + 2:\n continue\n \n d[(aa, bb)] += 1",
"da",
"range(3)",
"range",
"3",
"aa = a - da",
"aa",
"a - da",
"a",
"da",
"if aa < 1 or H < aa + 2:\n continue\n ",
"aa < 1 or H < aa + 2",
"aa < 1",
"aa",
"1",
"H < aa + 2",
"H",
"aa + 2",
"aa",
"2",
"continue",
"for db in range(3):\n bb = b - db\n if bb < 1 or W < bb + 2:\n continue\n \n d[(aa, bb)] += 1",
"db",
"range(3)",
"range",
"3",
"bb = b - db",
"bb",
"b - db",
"b",
"db",
"if bb < 1 or W < bb + 2:\n continue\n \n ",
"bb < 1 or W < bb + 2",
"bb < 1",
"bb",
"1",
"W < bb + 2",
"W",
"bb + 2",
"bb",
"2",
"continue",
"d[(aa, bb)] += 1",
"d[(aa, bb)]",
"d",
"(aa, bb)",
"aa",
"bb",
"1",
"num = [0] * 10",
"num",
"[0] * 10",
"[0]",
"0",
"10",
"num[0] = (H - 2) * (W - 2)",
"num[0]",
"num",
"0",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"count_n = Counter(list(d.values()))",
"count_n",
"Counter(list(d.values()))",
"Counter",
"list(d.values())",
"list",
"d.values()",
"d.values",
"d",
"values",
"for i in range(1, 10):\n n = count_n[i]\n num[i] += n\n num[0] -= n",
"i",
"range(1, 10)",
"range",
"1",
"10",
"n = count_n[i]",
"n",
"count_n[i]",
"count_n",
"i",
"num[i] += n",
"num[i]",
"num",
"i",
"n",
"num[0] -= n",
"num[0]",
"num",
"0",
"n",
"print(*num, sep='\\n')",
"print",
"*num",
"num",
"sep='\\n'",
"sep",
"'\\n'",
"d = defaultdict(int)",
"defaultdict(int)",
"d",
"ab = [list(map(int, input().split())) for i in range(N)]",
"[list(map(int, input().split())) for i in range(N)]",
"ab",
"num = [0] * 10",
"[0] * 10",
"num",
"bb = b - db",
"b - db",
"bb",
"count_n = Counter(list(d.values()))",
"Counter(list(d.values()))",
"count_n",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"aa = a - da",
"a - da",
"aa",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"n = count_n[i]",
"count_n[i]",
"n"
] | from collections import defaultdict, Counter
H, W, N = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]
d = defaultdict(int)
for a, b in ab:
for da in range(3):
aa = a - da
if aa < 1 or H < aa + 2:
continue
for db in range(3):
bb = b - db
if bb < 1 or W < bb + 2:
continue
d[(aa, bb)] += 1
num = [0] * 10
num[0] = (H - 2) * (W - 2)
count_n = Counter(list(d.values()))
for i in range(1, 10):
n = count_n[i]
num[i] += n
num[0] -= n
print(*num, sep='\n') |
[
7,
15,
13,
15,
12,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
2,
40,
17,
2,
13,
13,
2,
13,
17,
2,
40,
17,
2,
13,
13,
2,
13,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
2,
39,
17,
17,
0,
13,
17,
28,
13,
13,
0,
18,
13,
18,
13,
13,
17,
0,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
13,
4,
13,
31,
13,
0,
13,
17,
29,
17,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
8,
7
],
[
15,
14
],
[
7,
21
],
[
15,
23
],
[
15,
24
],
[
27,
26
],
[
32,
31
],
[
24,
34
],
[
37,
36
],
[
7,
43
],
[
37,
45
],
[
48,
47
],
[
51,
50
],
[
54,
53
],
[
59,
58
],
[
47,
68
],
[
36,
68
],
[
53,
69
],
[
14,
71
],
[
50,
77
],
[
45,
77
],
[
58,
78
],
[
23,
80
],
[
92,
83
],
[
26,
84
],
[
47,
87
],
[
36,
87
],
[
53,
88
],
[
50,
90
],
[
45,
90
],
[
58,
91
],
[
95,
94
],
[
101,
100
],
[
104,
103
],
[
26,
103
],
[
111,
106
],
[
94,
107
],
[
26,
109
],
[
103,
110
],
[
114,
113
],
[
119,
116
],
[
94,
117
],
[
14,
122
],
[
23,
125
],
[
113,
127
],
[
100,
127
],
[
94,
131
],
[
134,
133
],
[
145,
142
]
] | [
"import sys\nfrom collections import defaultdict\n\ndef solve():\n input = sys.stdin.readline\n H, W, N = map(int, input().split())\n C = defaultdict(int)\n for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for h in range(3):\n for w in range(3):\n if 0 <= a-h < H - 2 and 0 <= b-w < W - 2:\n C[(a-h, b-w)] += 1\n \n ans = [0] * 10\n s = 0\n for key in C:\n ans[C[key]] += 1\n s += 1\n ans[0] = ((H - 2) * (W - 2) - s)\n print(*ans, sep=\"\\n\") \n #print(C)\n\n return 0\n\nif __name__ == \"__main__\":\n solve()",
"import sys",
"sys",
"from collections import defaultdict",
"def solve():\n input = sys.stdin.readline\n H, W, N = map(int, input().split())\n C = defaultdict(int)\n for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for h in range(3):\n for w in range(3):\n if 0 <= a-h < H - 2 and 0 <= b-w < W - 2:\n C[(a-h, b-w)] += 1\n \n ans = [0] * 10\n s = 0\n for key in C:\n ans[C[key]] += 1\n s += 1\n ans[0] = ((H - 2) * (W - 2) - s)\n print(*ans, sep=\"\\n\") \n #print(C)\n\n return 0",
"solve",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"C = defaultdict(int)",
"C",
"defaultdict(int)",
"defaultdict",
"int",
"for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for h in range(3):\n for w in range(3):\n if 0 <= a-h < H - 2 and 0 <= b-w < W - 2:\n C[(a-h, b-w)] += 1\n \n ",
"_",
"range(N)",
"range",
"N",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for h in range(3):\n for w in range(3):\n if 0 <= a-h < H - 2 and 0 <= b-w < W - 2:\n C[(a-h, b-w)] += 1\n \n ",
"h",
"range(3)",
"range",
"3",
"for w in range(3):\n if 0 <= a-h < H - 2 and 0 <= b-w < W - 2:\n C[(a-h, b-w)] += 1\n \n ",
"w",
"range(3)",
"range",
"3",
"if 0 <= a-h < H - 2 and 0 <= b-w < W - 2:\n C[(a-h, b-w)] += 1\n \n ",
"0 <= a-h < H - 2 and 0 <= b-w < W - 2",
"0 <= a-h < H - 2",
"0 <= a-h",
"0",
"a-h",
"a",
"h",
"H - 2",
"H",
"2",
"0 <= b-w < W - 2",
"0 <= b-w",
"0",
"b-w",
"b",
"w",
"W - 2",
"W",
"2",
"C[(a-h, b-w)] += 1",
"C[(a-h, b-w)]",
"C",
"(a-h, b-w)",
"a-h",
"a",
"h",
"b-w",
"b",
"w",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"s = 0",
"s",
"0",
"for key in C:\n ans[C[key]] += 1\n s += 1\n ",
"key",
"C",
"ans[C[key]] += 1",
"ans[C[key]]",
"ans",
"C[key]",
"C",
"key",
"1",
"s += 1",
"s",
"1",
"ans[0] = ((H - 2) * (W - 2) - s)",
"ans[0]",
"ans",
"0",
"(H - 2) * (W - 2) - s",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"s",
"print(*ans, sep=\"\\n\")",
"print",
"*ans",
"ans",
"sep=\"\\n\"",
"sep",
"\"\\n\"",
"return 0",
"0",
"if __name__ == \"__main__\":\n solve()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"solve()",
"solve",
"def solve():\n input = sys.stdin.readline\n H, W, N = map(int, input().split())\n C = defaultdict(int)\n for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for h in range(3):\n for w in range(3):\n if 0 <= a-h < H - 2 and 0 <= b-w < W - 2:\n C[(a-h, b-w)] += 1\n \n ans = [0] * 10\n s = 0\n for key in C:\n ans[C[key]] += 1\n s += 1\n ans[0] = ((H - 2) * (W - 2) - s)\n print(*ans, sep=\"\\n\") \n #print(C)\n\n return 0",
"def solve():\n input = sys.stdin.readline\n H, W, N = map(int, input().split())\n C = defaultdict(int)\n for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for h in range(3):\n for w in range(3):\n if 0 <= a-h < H - 2 and 0 <= b-w < W - 2:\n C[(a-h, b-w)] += 1\n \n ans = [0] * 10\n s = 0\n for key in C:\n ans[C[key]] += 1\n s += 1\n ans[0] = ((H - 2) * (W - 2) - s)\n print(*ans, sep=\"\\n\") \n #print(C)\n\n return 0",
"solve"
] | import sys
from collections import defaultdict
def solve():
input = sys.stdin.readline
H, W, N = map(int, input().split())
C = defaultdict(int)
for _ in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
for h in range(3):
for w in range(3):
if 0 <= a-h < H - 2 and 0 <= b-w < W - 2:
C[(a-h, b-w)] += 1
ans = [0] * 10
s = 0
for key in C:
ans[C[key]] += 1
s += 1
ans[0] = ((H - 2) * (W - 2) - s)
print(*ans, sep="\n")
#print(C)
return 0
if __name__ == "__main__":
solve() |
[
7,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
4,
18,
13,
13,
39,
13,
13,
0,
13,
4,
13,
0,
13,
2,
39,
17,
17,
12,
13,
0,
13,
17,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
14,
2,
39,
2,
13,
13,
2,
13,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
23,
13,
23,
13,
28,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
0,
13,
2,
13,
18,
13,
17,
0,
13,
2,
13,
18,
13,
17,
14,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
2,
13,
17,
2,
13,
2,
13,
17,
9,
14,
2,
39,
13,
13,
13,
9,
4,
18,
13,
13,
39,
13,
13,
4,
13,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
4,
13,
10,
12,
13
] | [
[
5,
4
],
[
5,
13
],
[
5,
14
],
[
17,
16
],
[
21,
20
],
[
14,
23
],
[
26,
25
],
[
26,
34
],
[
16,
37
],
[
44,
43
],
[
48,
47
],
[
56,
55
],
[
59,
58
],
[
65,
64
],
[
71,
70
],
[
58,
72
],
[
98,
73
],
[
76,
75
],
[
64,
77
],
[
100,
78
],
[
58,
83
],
[
98,
84
],
[
64,
86
],
[
100,
87
],
[
16,
88
],
[
91,
90
],
[
96,
93
],
[
47,
94
],
[
90,
95
],
[
55,
95
],
[
98,
98
],
[
100,
100
],
[
103,
102
],
[
16,
102
],
[
106,
105
],
[
112,
111
],
[
118,
117
],
[
105,
119
],
[
102,
121
],
[
125,
124
],
[
111,
126
],
[
102,
128
],
[
117,
135
],
[
124,
138
],
[
117,
141
],
[
4,
143
],
[
124,
146
],
[
13,
148
],
[
43,
156
],
[
43,
160
],
[
53,
166
],
[
117,
167
],
[
124,
168
],
[
173,
170
],
[
47,
171
],
[
4,
176
],
[
13,
179
],
[
43,
183
],
[
186,
185
],
[
47,
192
],
[
185,
193
],
[
198,
195
]
] | [
"def main():\n H, W, N = map(int, input().split())\n s = set()\n for _ in range(N):\n a, b = map(int, input().split())\n s.add((a,b))\n u = set()\n r = [0] * 10\n def search(ii, jj):\n t = 0\n for x in range(-1, 2):\n for y in range(-1, 2):\n xt = x + ii\n yt = y + jj\n if (x+ii, y+jj) in s:\n t += 1\n r[t] += 1\n for t in s:\n for x in range(-1, 2):\n for y in range(-1, 2):\n xt = x + t[0]\n yt = y + t[1]\n if xt < 2 or yt < 2 or xt > H-1 or yt > W-1:\n continue\n if (xt, yt) in u:\n continue\n u.add((xt, yt))\n search(xt, yt)\n r[0] = (H-2) * (W-2) - len(u)\n for i in range(10):\n print(r[i])\nmain()",
"def main():\n H, W, N = map(int, input().split())\n s = set()\n for _ in range(N):\n a, b = map(int, input().split())\n s.add((a,b))\n u = set()\n r = [0] * 10\n def search(ii, jj):\n t = 0\n for x in range(-1, 2):\n for y in range(-1, 2):\n xt = x + ii\n yt = y + jj\n if (x+ii, y+jj) in s:\n t += 1\n r[t] += 1\n for t in s:\n for x in range(-1, 2):\n for y in range(-1, 2):\n xt = x + t[0]\n yt = y + t[1]\n if xt < 2 or yt < 2 or xt > H-1 or yt > W-1:\n continue\n if (xt, yt) in u:\n continue\n u.add((xt, yt))\n search(xt, yt)\n r[0] = (H-2) * (W-2) - len(u)\n for i in range(10):\n print(r[i])",
"main",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"s = set()",
"s",
"set()",
"set",
"for _ in range(N):\n a, b = map(int, input().split())\n s.add((a,b))\n ",
"_",
"range(N)",
"range",
"N",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"s.add((a,b))",
"s.add",
"s",
"add",
"(a,b)",
"a",
"b",
"u = set()",
"u",
"set()",
"set",
"r = [0] * 10",
"r",
"[0] * 10",
"[0]",
"0",
"10",
"def search(ii, jj):\n t = 0\n for x in range(-1, 2):\n for y in range(-1, 2):\n xt = x + ii\n yt = y + jj\n if (x+ii, y+jj) in s:\n t += 1\n r[t] += 1\n ",
"search",
"t = 0",
"t",
"0",
"for x in range(-1, 2):\n for y in range(-1, 2):\n xt = x + ii\n yt = y + jj\n if (x+ii, y+jj) in s:\n t += 1\n ",
"x",
"range(-1, 2)",
"range",
"-1",
"2",
"for y in range(-1, 2):\n xt = x + ii\n yt = y + jj\n if (x+ii, y+jj) in s:\n t += 1\n ",
"y",
"range(-1, 2)",
"range",
"-1",
"2",
"xt = x + ii",
"xt",
"x + ii",
"x",
"ii",
"yt = y + jj",
"yt",
"y + jj",
"y",
"jj",
"if (x+ii, y+jj) in s:\n t += 1\n ",
"(x+ii, y+jj) in s",
"(x+ii, y+jj)",
"x+ii",
"x",
"ii",
"y+jj",
"y",
"jj",
"s",
"t += 1",
"t",
"1",
"r[t] += 1",
"r[t]",
"r",
"t",
"1",
"ii",
"ii",
"jj",
"jj",
"for t in s:\n for x in range(-1, 2):\n for y in range(-1, 2):\n xt = x + t[0]\n yt = y + t[1]\n if xt < 2 or yt < 2 or xt > H-1 or yt > W-1:\n continue\n if (xt, yt) in u:\n continue\n u.add((xt, yt))\n search(xt, yt)\n ",
"t",
"s",
"for x in range(-1, 2):\n for y in range(-1, 2):\n xt = x + t[0]\n yt = y + t[1]\n if xt < 2 or yt < 2 or xt > H-1 or yt > W-1:\n continue\n if (xt, yt) in u:\n continue\n u.add((xt, yt))\n search(xt, yt)\n ",
"x",
"range(-1, 2)",
"range",
"-1",
"2",
"for y in range(-1, 2):\n xt = x + t[0]\n yt = y + t[1]\n if xt < 2 or yt < 2 or xt > H-1 or yt > W-1:\n continue\n if (xt, yt) in u:\n continue\n u.add((xt, yt))\n search(xt, yt)\n ",
"y",
"range(-1, 2)",
"range",
"-1",
"2",
"xt = x + t[0]",
"xt",
"x + t[0]",
"x",
"t[0]",
"t",
"0",
"yt = y + t[1]",
"yt",
"y + t[1]",
"y",
"t[1]",
"t",
"1",
"if xt < 2 or yt < 2 or xt > H-1 or yt > W-1:\n continue\n ",
"xt < 2 or yt < 2 or xt > H-1 or yt > W-1",
"xt < 2 or yt < 2 or xt > H-1",
"xt < 2 or yt < 2",
"xt < 2",
"xt",
"2",
"yt < 2",
"yt",
"2",
"xt > H-1",
"xt",
"H-1",
"H",
"1",
"yt > W-1",
"yt",
"W-1",
"W",
"1",
"continue",
"if (xt, yt) in u:\n continue\n ",
"(xt, yt) in u",
"(xt, yt)",
"xt",
"yt",
"u",
"continue",
"u.add((xt, yt))",
"u.add",
"u",
"add",
"(xt, yt)",
"xt",
"yt",
"search(xt, yt)",
"search",
"xt",
"yt",
"r[0] = (H-2) * (W-2) - len(u)",
"r[0]",
"r",
"0",
"(H-2) * (W-2) - len(u)",
"(H-2) * (W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"len(u)",
"len",
"u",
"for i in range(10):\n print(r[i])",
"i",
"range(10)",
"range",
"10",
"print(r[i])",
"print",
"r[i]",
"r",
"i",
"main()",
"main",
"def main():\n H, W, N = map(int, input().split())\n s = set()\n for _ in range(N):\n a, b = map(int, input().split())\n s.add((a,b))\n u = set()\n r = [0] * 10\n def search(ii, jj):\n t = 0\n for x in range(-1, 2):\n for y in range(-1, 2):\n xt = x + ii\n yt = y + jj\n if (x+ii, y+jj) in s:\n t += 1\n r[t] += 1\n for t in s:\n for x in range(-1, 2):\n for y in range(-1, 2):\n xt = x + t[0]\n yt = y + t[1]\n if xt < 2 or yt < 2 or xt > H-1 or yt > W-1:\n continue\n if (xt, yt) in u:\n continue\n u.add((xt, yt))\n search(xt, yt)\n r[0] = (H-2) * (W-2) - len(u)\n for i in range(10):\n print(r[i])",
"def main():\n H, W, N = map(int, input().split())\n s = set()\n for _ in range(N):\n a, b = map(int, input().split())\n s.add((a,b))\n u = set()\n r = [0] * 10\n def search(ii, jj):\n t = 0\n for x in range(-1, 2):\n for y in range(-1, 2):\n xt = x + ii\n yt = y + jj\n if (x+ii, y+jj) in s:\n t += 1\n r[t] += 1\n for t in s:\n for x in range(-1, 2):\n for y in range(-1, 2):\n xt = x + t[0]\n yt = y + t[1]\n if xt < 2 or yt < 2 or xt > H-1 or yt > W-1:\n continue\n if (xt, yt) in u:\n continue\n u.add((xt, yt))\n search(xt, yt)\n r[0] = (H-2) * (W-2) - len(u)\n for i in range(10):\n print(r[i])",
"main"
] | def main():
H, W, N = map(int, input().split())
s = set()
for _ in range(N):
a, b = map(int, input().split())
s.add((a,b))
u = set()
r = [0] * 10
def search(ii, jj):
t = 0
for x in range(-1, 2):
for y in range(-1, 2):
xt = x + ii
yt = y + jj
if (x+ii, y+jj) in s:
t += 1
r[t] += 1
for t in s:
for x in range(-1, 2):
for y in range(-1, 2):
xt = x + t[0]
yt = y + t[1]
if xt < 2 or yt < 2 or xt > H-1 or yt > W-1:
continue
if (xt, yt) in u:
continue
u.add((xt, yt))
search(xt, yt)
r[0] = (H-2) * (W-2) - len(u)
for i in range(10):
print(r[i])
main()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
4,
13,
28,
13,
13,
0,
18,
13,
13,
17,
28,
13,
13,
13,
28,
13,
4,
13,
4,
13,
17,
2,
17,
13,
4,
13,
17,
2,
2,
13,
17,
13,
28,
13,
4,
13,
4,
13,
17,
2,
17,
13,
4,
13,
17,
2,
2,
13,
17,
13,
0,
13,
17,
28,
13,
4,
13,
2,
2,
13,
13,
17,
2,
2,
13,
13,
17,
28,
13,
4,
13,
2,
2,
13,
13,
17,
2,
2,
13,
13,
17,
14,
2,
39,
13,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
28,
13,
4,
13,
17,
17,
0,
18,
13,
13,
13,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
18,
13,
17,
2,
13,
4,
13,
18,
13,
39,
17,
28,
13,
13,
4,
13,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] | [
[
199,
2
],
[
199,
11
],
[
199,
12
],
[
16,
15
],
[
197,
18
],
[
190,
31
],
[
175,
34
],
[
178,
40
],
[
45,
44
],
[
191,
44
],
[
50,
47
],
[
179,
48
],
[
44,
49
],
[
57,
56
],
[
200,
70
],
[
75,
74
],
[
188,
88
],
[
193,
92
],
[
96,
95
],
[
56,
101
],
[
56,
106
],
[
110,
109
],
[
74,
115
],
[
74,
120
],
[
179,
127
],
[
181,
129
],
[
135,
132
],
[
176,
133
],
[
182,
134
],
[
194,
134
],
[
138,
137
],
[
146,
143
],
[
176,
144
],
[
137,
145
],
[
137,
146
],
[
184,
148
],
[
200,
151
],
[
188,
154
],
[
160,
157
],
[
176,
158
],
[
185,
161
],
[
176,
165
],
[
170,
169
],
[
176,
169
],
[
169,
173
],
[
175,
176
],
[
178,
179
],
[
181,
182
],
[
184,
185
],
[
199,
188
],
[
190,
191
],
[
193,
194
],
[
199,
197
],
[
199,
200
]
] | [
"h,w,n = map(int, input().split())\nab = [tuple(map(int, input().split())) for i in range(n)]\nJ = [0] * 10\nblack = dict()\nfor i in ab:\n black[i] = 1\nfor a,b in ab:\n for x in range(max(0,3-a),min(3,h+1-a)):\n for y in range(max(0,3-b),min(3,w+1-b)):\n j = 0\n for X in range(a+x-2,a+x+1):\n for Y in range(b+y-2,b+y+1):\n if (X,Y) in black:\n j += 1\n J[j] += 1\nfor i in range(2,10):\n J[i] //= i\nALL = (h-2) * (w-2)\nJ[0] = ALL - sum(J[1:])\nfor i in J:\n print(i)",
"h,w,n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"tuple(map(int, input().split())) for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"tuple(map(int, input().split()))",
"tuple",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ab = [tuple(map(int, input().split())) for i in range(n)]",
"ab",
"[tuple(map(int, input().split())) for i in range(n)]",
"J = [0] * 10",
"J",
"[0] * 10",
"[0]",
"0",
"10",
"black = dict()",
"black",
"dict()",
"dict",
"for i in ab:\n black[i] = 1",
"i",
"ab",
"black[i] = 1",
"black[i]",
"black",
"i",
"1",
"for a,b in ab:\n for x in range(max(0,3-a),min(3,h+1-a)):\n for y in range(max(0,3-b),min(3,w+1-b)):\n j = 0\n for X in range(a+x-2,a+x+1):\n for Y in range(b+y-2,b+y+1):\n if (X,Y) in black:\n j += 1\n J[j] += 1",
"a",
"b",
"ab",
"for x in range(max(0,3-a),min(3,h+1-a)):\n for y in range(max(0,3-b),min(3,w+1-b)):\n j = 0\n for X in range(a+x-2,a+x+1):\n for Y in range(b+y-2,b+y+1):\n if (X,Y) in black:\n j += 1\n J[j] += 1",
"x",
"range(max(0,3-a),min(3,h+1-a))",
"range",
"max(0,3-a)",
"max",
"0",
"3-a",
"3",
"a",
"min(3,h+1-a)",
"min",
"3",
"h+1-a",
"h+1",
"h",
"1",
"a",
"for y in range(max(0,3-b),min(3,w+1-b)):\n j = 0\n for X in range(a+x-2,a+x+1):\n for Y in range(b+y-2,b+y+1):\n if (X,Y) in black:\n j += 1\n J[j] += 1",
"y",
"range(max(0,3-b),min(3,w+1-b))",
"range",
"max(0,3-b)",
"max",
"0",
"3-b",
"3",
"b",
"min(3,w+1-b)",
"min",
"3",
"w+1-b",
"w+1",
"w",
"1",
"b",
"j = 0",
"j",
"0",
"for X in range(a+x-2,a+x+1):\n for Y in range(b+y-2,b+y+1):\n if (X,Y) in black:\n j += 1\n ",
"X",
"range(a+x-2,a+x+1)",
"range",
"a+x-2",
"a+x",
"a",
"x",
"2",
"a+x+1",
"a+x",
"a",
"x",
"1",
"for Y in range(b+y-2,b+y+1):\n if (X,Y) in black:\n j += 1\n ",
"Y",
"range(b+y-2,b+y+1)",
"range",
"b+y-2",
"b+y",
"b",
"y",
"2",
"b+y+1",
"b+y",
"b",
"y",
"1",
"if (X,Y) in black:\n j += 1\n ",
"(X,Y) in black",
"(X,Y)",
"X",
"Y",
"black",
"j += 1",
"j",
"1",
"J[j] += 1",
"J[j]",
"J",
"j",
"1",
"for i in range(2,10):\n J[i] //= i",
"i",
"range(2,10)",
"range",
"2",
"10",
"J[i] //= i",
"J[i]",
"J",
"i",
"i",
"ALL = (h-2) * (w-2)",
"ALL",
"(h-2) * (w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"J[0] = ALL - sum(J[1:])",
"J[0]",
"J",
"0",
"ALL - sum(J[1:])",
"ALL",
"sum(J[1:])",
"sum",
"J[1:]",
"J",
"1:",
"1",
"for i in J:\n print(i)",
"i",
"J",
"print(i)",
"print",
"i",
"J = [0] * 10",
"[0] * 10",
"J",
"black = dict()",
"dict()",
"black",
"j += 1",
"1",
"j",
"ALL = (h-2) * (w-2)",
"(h-2) * (w-2)",
"ALL",
"w,n = map(int, input().split())",
"map(int, input().split())",
"w",
"ab = [tuple(map(int, input().split())) for i in range(n)]",
"[tuple(map(int, input().split())) for i in range(n)]",
"ab",
"j = 0",
"0",
"j",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"h,w,n = map(int, input().split())",
"map(int, input().split())",
"h"
] | h,w,n = map(int, input().split())
ab = [tuple(map(int, input().split())) for i in range(n)]
J = [0] * 10
black = dict()
for i in ab:
black[i] = 1
for a,b in ab:
for x in range(max(0,3-a),min(3,h+1-a)):
for y in range(max(0,3-b),min(3,w+1-b)):
j = 0
for X in range(a+x-2,a+x+1):
for Y in range(b+y-2,b+y+1):
if (X,Y) in black:
j += 1
J[j] += 1
for i in range(2,10):
J[i] //= i
ALL = (h-2) * (w-2)
J[0] = ALL - sum(J[1:])
for i in J:
print(i) |
[
7,
12,
13,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
4,
18,
13,
13,
39,
2,
13,
17,
2,
13,
17,
0,
13,
4,
13,
28,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
2,
40,
17,
2,
18,
13,
17,
13,
2,
13,
17,
2,
40,
17,
2,
18,
13,
17,
13,
2,
13,
17,
4,
18,
13,
13,
39,
2,
18,
13,
17,
13,
2,
18,
13,
17,
13,
0,
13,
2,
39,
17,
17,
28,
13,
13,
0,
13,
4,
13,
17,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
39,
2,
18,
13,
17,
13,
2,
18,
13,
17,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
15,
13,
12,
13,
12,
13,
12,
13,
12,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
2,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13
] | [
[
5,
4
],
[
5,
7
],
[
5,
8
],
[
11,
10
],
[
15,
14
],
[
8,
17
],
[
20,
19
],
[
20,
30
],
[
10,
33
],
[
19,
37
],
[
30,
40
],
[
44,
43
],
[
48,
47
],
[
10,
47
],
[
51,
50
],
[
57,
56
],
[
47,
68
],
[
50,
70
],
[
4,
72
],
[
47,
79
],
[
56,
81
],
[
7,
83
],
[
43,
87
],
[
47,
92
],
[
50,
94
],
[
47,
97
],
[
56,
99
],
[
102,
101
],
[
108,
107
],
[
43,
107
],
[
111,
110
],
[
116,
115
],
[
122,
121
],
[
107,
131
],
[
115,
133
],
[
107,
136
],
[
121,
138
],
[
10,
139
],
[
142,
141
],
[
147,
144
],
[
101,
145
],
[
141,
146
],
[
110,
146
],
[
152,
149
],
[
101,
150
],
[
4,
155
],
[
7,
158
],
[
101,
162
],
[
165,
164
],
[
101,
164
],
[
164,
168
],
[
203,
180
],
[
209,
187
],
[
201,
192
],
[
203,
204
],
[
209,
210
]
] | [
"def examD():\n H, W, N = LI()\n ab = set()\n for _ in range(N):\n a, b = list(map(int,input().split()))\n ab.add((a-1,b-1))\n check = set()\n for c in ab:\n for i in range(-1,2):\n for j in range(-1,2):\n if 1<=c[0]+i<H-1 and 1<=c[1]+j<W-1:\n check.add((c[0]+i,c[1]+j))\n# print(check)\n# print(ab)\n ansC = [0]*10\n for c in check:\n cur = int(0)\n for i in range(-1,2):\n for j in range(-1,2):\n if (c[0]+i,c[1]+j) in ab:\n cur += 1\n ansC[cur] +=1\n ansC[0] = (H-2)*(W-2)-sum(ansC)\n for v in ansC:\n print(v)\n\n\nimport sys\ndef I(): return int(sys.stdin.readline())\ndef LI(): return list(map(int,sys.stdin.readline().split()))\ndef LS(): return sys.stdin.readline().split()\ndef S(): return sys.stdin.readline().strip()\nmod = 10**9 + 7\ninf = float('inf')\n\nexamD()",
"def examD():\n H, W, N = LI()\n ab = set()\n for _ in range(N):\n a, b = list(map(int,input().split()))\n ab.add((a-1,b-1))\n check = set()\n for c in ab:\n for i in range(-1,2):\n for j in range(-1,2):\n if 1<=c[0]+i<H-1 and 1<=c[1]+j<W-1:\n check.add((c[0]+i,c[1]+j))\n# print(check)\n# print(ab)\n ansC = [0]*10\n for c in check:\n cur = int(0)\n for i in range(-1,2):\n for j in range(-1,2):\n if (c[0]+i,c[1]+j) in ab:\n cur += 1\n ansC[cur] +=1\n ansC[0] = (H-2)*(W-2)-sum(ansC)\n for v in ansC:\n print(v)",
"examD",
"H, W, N = LI()",
"H",
"LI()",
"LI",
"W",
"N",
"ab = set()",
"ab",
"set()",
"set",
"for _ in range(N):\n a, b = list(map(int,input().split()))\n ab.add((a-1,b-1))\n ",
"_",
"range(N)",
"range",
"N",
"a, b = list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"ab.add((a-1,b-1))",
"ab.add",
"ab",
"add",
"(a-1,b-1)",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"check = set()",
"check",
"set()",
"set",
"for c in ab:\n for i in range(-1,2):\n for j in range(-1,2):\n if 1<=c[0]+i<H-1 and 1<=c[1]+j<W-1:\n check.add((c[0]+i,c[1]+j))\n# print(check)\n# print(ab)\n ",
"c",
"ab",
"for i in range(-1,2):\n for j in range(-1,2):\n if 1<=c[0]+i<H-1 and 1<=c[1]+j<W-1:\n check.add((c[0]+i,c[1]+j))\n# print(check)\n# print(ab)\n ",
"i",
"range(-1,2)",
"range",
"-1",
"2",
"for j in range(-1,2):\n if 1<=c[0]+i<H-1 and 1<=c[1]+j<W-1:\n check.add((c[0]+i,c[1]+j))\n# print(check)\n# print(ab)\n ",
"j",
"range(-1,2)",
"range",
"-1",
"2",
"if 1<=c[0]+i<H-1 and 1<=c[1]+j<W-1:\n check.add((c[0]+i,c[1]+j))\n# print(check)\n# print(ab)\n ",
"1<=c[0]+i<H-1 and 1<=c[1]+j<W-1",
"1<=c[0]+i<H-1",
"1<=c[0]+i",
"1",
"c[0]+i",
"c[0]",
"c",
"0",
"i",
"H-1",
"H",
"1",
"1<=c[1]+j<W-1",
"1<=c[1]+j",
"1",
"c[1]+j",
"c[1]",
"c",
"1",
"j",
"W-1",
"W",
"1",
"check.add((c[0]+i,c[1]+j))",
"check.add",
"check",
"add",
"(c[0]+i,c[1]+j)",
"c[0]+i",
"c[0]",
"c",
"0",
"i",
"c[1]+j",
"c[1]",
"c",
"1",
"j",
"ansC = [0]*10",
"ansC",
"[0]*10",
"[0]",
"0",
"10",
"for c in check:\n cur = int(0)\n for i in range(-1,2):\n for j in range(-1,2):\n if (c[0]+i,c[1]+j) in ab:\n cur += 1\n ansC[cur] +=1\n ",
"c",
"check",
"cur = int(0)",
"cur",
"int(0)",
"int",
"0",
"for i in range(-1,2):\n for j in range(-1,2):\n if (c[0]+i,c[1]+j) in ab:\n cur += 1\n ",
"i",
"range(-1,2)",
"range",
"-1",
"2",
"for j in range(-1,2):\n if (c[0]+i,c[1]+j) in ab:\n cur += 1\n ",
"j",
"range(-1,2)",
"range",
"-1",
"2",
"if (c[0]+i,c[1]+j) in ab:\n cur += 1\n ",
"(c[0]+i,c[1]+j) in ab",
"(c[0]+i,c[1]+j)",
"c[0]+i",
"c[0]",
"c",
"0",
"i",
"c[1]+j",
"c[1]",
"c",
"1",
"j",
"ab",
"cur += 1",
"cur",
"1",
"ansC[cur] +=1",
"ansC[cur]",
"ansC",
"cur",
"1",
"ansC[0] = (H-2)*(W-2)-sum(ansC)",
"ansC[0]",
"ansC",
"0",
"(H-2)*(W-2)-sum(ansC)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(ansC)",
"sum",
"ansC",
"for v in ansC:\n print(v)",
"v",
"ansC",
"print(v)",
"print",
"v",
"import sys",
"sys",
"def I(): return int(sys.stdin.readline())",
"I",
"def LI(): return list(map(int,sys.stdin.readline().split()))",
"LI",
"def LS(): return sys.stdin.readline().split()",
"LS",
"def S(): return sys.stdin.readline().strip()",
"S",
"mod = 10**9 + 7",
"mod",
"10**9 + 7",
"10**9",
"10",
"9",
"7",
"inf = float('inf')",
"inf",
"float('inf')",
"float",
"'inf'",
"examD()",
"examD",
"def I(): return int(sys.stdin.readline())",
"def I(): return int(sys.stdin.readline())",
"I",
"def LI(): return list(map(int,sys.stdin.readline().split()))",
"def LI(): return list(map(int,sys.stdin.readline().split()))",
"LI",
"def examD():\n H, W, N = LI()\n ab = set()\n for _ in range(N):\n a, b = list(map(int,input().split()))\n ab.add((a-1,b-1))\n check = set()\n for c in ab:\n for i in range(-1,2):\n for j in range(-1,2):\n if 1<=c[0]+i<H-1 and 1<=c[1]+j<W-1:\n check.add((c[0]+i,c[1]+j))\n# print(check)\n# print(ab)\n ansC = [0]*10\n for c in check:\n cur = int(0)\n for i in range(-1,2):\n for j in range(-1,2):\n if (c[0]+i,c[1]+j) in ab:\n cur += 1\n ansC[cur] +=1\n ansC[0] = (H-2)*(W-2)-sum(ansC)\n for v in ansC:\n print(v)",
"def examD():\n H, W, N = LI()\n ab = set()\n for _ in range(N):\n a, b = list(map(int,input().split()))\n ab.add((a-1,b-1))\n check = set()\n for c in ab:\n for i in range(-1,2):\n for j in range(-1,2):\n if 1<=c[0]+i<H-1 and 1<=c[1]+j<W-1:\n check.add((c[0]+i,c[1]+j))\n# print(check)\n# print(ab)\n ansC = [0]*10\n for c in check:\n cur = int(0)\n for i in range(-1,2):\n for j in range(-1,2):\n if (c[0]+i,c[1]+j) in ab:\n cur += 1\n ansC[cur] +=1\n ansC[0] = (H-2)*(W-2)-sum(ansC)\n for v in ansC:\n print(v)",
"examD",
"mod = 10**9 + 7",
"10**9 + 7",
"mod",
"def S(): return sys.stdin.readline().strip()",
"def S(): return sys.stdin.readline().strip()",
"S",
"inf = float('inf')",
"float('inf')",
"inf",
"def LS(): return sys.stdin.readline().split()",
"def LS(): return sys.stdin.readline().split()",
"LS"
] | def examD():
H, W, N = LI()
ab = set()
for _ in range(N):
a, b = list(map(int,input().split()))
ab.add((a-1,b-1))
check = set()
for c in ab:
for i in range(-1,2):
for j in range(-1,2):
if 1<=c[0]+i<H-1 and 1<=c[1]+j<W-1:
check.add((c[0]+i,c[1]+j))
# print(check)
# print(ab)
ansC = [0]*10
for c in check:
cur = int(0)
for i in range(-1,2):
for j in range(-1,2):
if (c[0]+i,c[1]+j) in ab:
cur += 1
ansC[cur] +=1
ansC[0] = (H-2)*(W-2)-sum(ansC)
for v in ansC:
print(v)
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')
examD()
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
39,
41,
28,
13,
4,
13,
17,
17,
4,
17,
0,
13,
13,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
12,
13,
0,
13,
17,
14,
2,
39,
2,
13,
17,
2,
13,
17,
13,
0,
13,
17,
14,
2,
39,
2,
13,
17,
13,
13,
0,
13,
17,
14,
2,
39,
2,
13,
17,
2,
13,
17,
13,
0,
13,
17,
14,
2,
39,
13,
2,
13,
17,
13,
0,
13,
17,
14,
2,
39,
13,
13,
13,
0,
13,
17,
14,
2,
39,
13,
2,
13,
17,
13,
0,
13,
17,
14,
2,
39,
2,
13,
17,
2,
13,
17,
13,
0,
13,
17,
14,
2,
39,
2,
13,
17,
13,
13,
0,
13,
17,
14,
2,
39,
2,
13,
17,
2,
13,
17,
13,
0,
13,
17,
29,
13,
23,
13,
23,
13,
28,
13,
4,
13,
17,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
14,
2,
13,
17,
14,
2,
13,
17,
0,
13,
4,
13,
2,
13,
17,
2,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
14,
2,
2,
13,
13,
17,
0,
13,
4,
13,
2,
13,
17,
13,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
14,
2,
2,
13,
17,
13,
0,
13,
4,
13,
2,
13,
17,
2,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
14,
2,
2,
13,
13,
17,
14,
2,
13,
17,
0,
13,
4,
13,
13,
2,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
14,
2,
2,
13,
13,
17,
0,
13,
4,
13,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
14,
2,
2,
13,
17,
13,
0,
13,
4,
13,
13,
2,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
14,
2,
2,
13,
17,
13,
14,
2,
13,
17,
0,
13,
4,
13,
2,
13,
17,
2,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
14,
2,
2,
13,
13,
17,
0,
13,
4,
13,
2,
13,
17,
13,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
14,
2,
2,
13,
17,
13,
0,
13,
4,
13,
2,
13,
17,
2,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
4,
18,
13,
13,
39,
13,
13,
28,
13,
4,
13,
17,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
476,
4
],
[
500,
11
],
[
477,
18
],
[
500,
20
],
[
500,
21
],
[
467,
23
],
[
30,
29
],
[
488,
37
],
[
43,
40
],
[
489,
41
],
[
495,
45
],
[
486,
48
],
[
54,
53
],
[
163,
59
],
[
165,
62
],
[
468,
64
],
[
67,
66
],
[
163,
72
],
[
468,
75
],
[
78,
77
],
[
163,
83
],
[
165,
86
],
[
468,
88
],
[
91,
90
],
[
165,
97
],
[
468,
99
],
[
102,
101
],
[
468,
108
],
[
111,
110
],
[
165,
117
],
[
468,
119
],
[
122,
121
],
[
163,
127
],
[
165,
130
],
[
468,
132
],
[
135,
134
],
[
163,
140
],
[
468,
143
],
[
146,
145
],
[
163,
151
],
[
165,
154
],
[
468,
156
],
[
159,
158
],
[
158,
161
],
[
145,
161
],
[
134,
161
],
[
121,
161
],
[
110,
161
],
[
101,
161
],
[
90,
161
],
[
77,
161
],
[
66,
161
],
[
53,
161
],
[
489,
161
],
[
163,
163
],
[
165,
165
],
[
168,
167
],
[
501,
171
],
[
461,
173
],
[
477,
180
],
[
461,
182
],
[
459,
185
],
[
462,
189
],
[
497,
192
],
[
471,
194
],
[
459,
196
],
[
462,
199
],
[
205,
202
],
[
489,
203
],
[
498,
204
],
[
474,
204
],
[
483,
204
],
[
465,
204
],
[
492,
204
],
[
456,
204
],
[
504,
204
],
[
453,
204
],
[
480,
204
],
[
212,
207
],
[
489,
208
],
[
498,
210
],
[
474,
210
],
[
483,
210
],
[
465,
210
],
[
492,
210
],
[
456,
210
],
[
504,
210
],
[
453,
210
],
[
480,
210
],
[
486,
216
],
[
462,
217
],
[
479,
220
],
[
471,
222
],
[
459,
224
],
[
462,
226
],
[
231,
228
],
[
489,
229
],
[
480,
230
],
[
498,
230
],
[
474,
230
],
[
483,
230
],
[
465,
230
],
[
492,
230
],
[
456,
230
],
[
504,
230
],
[
453,
230
],
[
238,
233
],
[
489,
234
],
[
480,
236
],
[
498,
236
],
[
474,
236
],
[
483,
236
],
[
465,
236
],
[
492,
236
],
[
456,
236
],
[
504,
236
],
[
453,
236
],
[
486,
242
],
[
462,
244
],
[
452,
246
],
[
471,
248
],
[
459,
250
],
[
462,
253
],
[
259,
256
],
[
489,
257
],
[
453,
258
],
[
480,
258
],
[
498,
258
],
[
474,
258
],
[
483,
258
],
[
465,
258
],
[
492,
258
],
[
456,
258
],
[
504,
258
],
[
266,
261
],
[
489,
262
],
[
453,
264
],
[
480,
264
],
[
498,
264
],
[
474,
264
],
[
483,
264
],
[
465,
264
],
[
492,
264
],
[
456,
264
],
[
504,
264
],
[
495,
270
],
[
459,
271
],
[
462,
275
],
[
503,
278
],
[
471,
280
],
[
459,
281
],
[
462,
283
],
[
289,
286
],
[
489,
287
],
[
504,
288
],
[
453,
288
],
[
480,
288
],
[
498,
288
],
[
474,
288
],
[
483,
288
],
[
465,
288
],
[
492,
288
],
[
456,
288
],
[
296,
291
],
[
489,
292
],
[
504,
294
],
[
453,
294
],
[
480,
294
],
[
498,
294
],
[
474,
294
],
[
483,
294
],
[
465,
294
],
[
492,
294
],
[
456,
294
],
[
486,
300
],
[
462,
301
],
[
455,
304
],
[
471,
306
],
[
459,
307
],
[
462,
308
],
[
313,
310
],
[
489,
311
],
[
456,
312
],
[
504,
312
],
[
453,
312
],
[
480,
312
],
[
498,
312
],
[
474,
312
],
[
483,
312
],
[
465,
312
],
[
492,
312
],
[
320,
315
],
[
489,
316
],
[
456,
318
],
[
504,
318
],
[
453,
318
],
[
480,
318
],
[
498,
318
],
[
474,
318
],
[
483,
318
],
[
465,
318
],
[
492,
318
],
[
486,
324
],
[
462,
326
],
[
491,
328
],
[
471,
330
],
[
459,
331
],
[
462,
333
],
[
339,
336
],
[
489,
337
],
[
492,
338
],
[
456,
338
],
[
504,
338
],
[
453,
338
],
[
480,
338
],
[
498,
338
],
[
474,
338
],
[
483,
338
],
[
465,
338
],
[
346,
341
],
[
489,
342
],
[
492,
344
],
[
456,
344
],
[
504,
344
],
[
453,
344
],
[
480,
344
],
[
498,
344
],
[
474,
344
],
[
483,
344
],
[
465,
344
],
[
495,
350
],
[
459,
352
],
[
462,
355
],
[
464,
358
],
[
471,
360
],
[
459,
362
],
[
462,
365
],
[
371,
368
],
[
489,
369
],
[
465,
370
],
[
492,
370
],
[
456,
370
],
[
504,
370
],
[
453,
370
],
[
480,
370
],
[
498,
370
],
[
474,
370
],
[
483,
370
],
[
378,
373
],
[
489,
374
],
[
465,
376
],
[
492,
376
],
[
456,
376
],
[
504,
376
],
[
453,
376
],
[
480,
376
],
[
498,
376
],
[
474,
376
],
[
483,
376
],
[
486,
382
],
[
462,
383
],
[
482,
386
],
[
471,
388
],
[
459,
390
],
[
462,
392
],
[
397,
394
],
[
489,
395
],
[
483,
396
],
[
465,
396
],
[
492,
396
],
[
456,
396
],
[
504,
396
],
[
453,
396
],
[
480,
396
],
[
498,
396
],
[
474,
396
],
[
404,
399
],
[
489,
400
],
[
483,
402
],
[
465,
402
],
[
492,
402
],
[
456,
402
],
[
504,
402
],
[
453,
402
],
[
480,
402
],
[
498,
402
],
[
474,
402
],
[
486,
408
],
[
462,
410
],
[
473,
412
],
[
471,
414
],
[
459,
416
],
[
462,
419
],
[
425,
422
],
[
489,
423
],
[
474,
424
],
[
483,
424
],
[
465,
424
],
[
492,
424
],
[
456,
424
],
[
504,
424
],
[
453,
424
],
[
480,
424
],
[
498,
424
],
[
432,
427
],
[
489,
428
],
[
474,
430
],
[
483,
430
],
[
465,
430
],
[
492,
430
],
[
456,
430
],
[
504,
430
],
[
453,
430
],
[
480,
430
],
[
498,
430
],
[
468,
435
],
[
442,
441
],
[
489,
449
],
[
441,
450
],
[
452,
453
],
[
455,
456
],
[
461,
459
],
[
461,
462
],
[
464,
465
],
[
467,
468
],
[
473,
474
],
[
476,
477
],
[
479,
480
],
[
482,
483
],
[
500,
486
],
[
488,
489
],
[
491,
492
],
[
500,
495
],
[
497,
498
],
[
500,
501
],
[
503,
504
]
] | [
"import sys\n\ninput=sys.stdin.readline\n\nH,W,N=map(int,input().split())\npoint=set([])\nans=[0 for i in range(0,10)]\nans[0]=(H-2)*(W-2)\n\ndef black(x,y):\n ans=0\n if (x-1,y-1) in point:\n ans+=1\n if (x-1,y) in point:\n ans+=1\n if (x-1,y+1) in point:\n ans+=1\n\n if (x,y-1) in point:\n ans+=1\n if (x,y) in point:\n ans+=1\n if (x,y+1) in point:\n ans+=1\n\n if (x+1,y-1) in point:\n ans+=1\n if (x+1,y) in point:\n ans+=1\n if (x+1,y+1) in point:\n ans+=1\n \n return ans\n\nfor _ in range(0,N):\n a,b=map(int,input().split())\n if a>2:\n if b>2:\n ss=black(a-1,b-1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W>b>1:\n ss=black(a-1,b)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W-1>b:\n ss=black(a-1,b+1)\n ans[ss]-=1\n ans[ss+1]+=1\n if H>a>1:\n if b>2:\n ss=black(a,b-1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W>b>1:\n ss=black(a,b)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W-1>b:\n ss=black(a,b+1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if H-1>a:\n if b>2:\n ss=black(a+1,b-1)\n ans[ss]-=1\n ans[ss+1]+=1\n if W>b>1:\n ss=black(a+1,b)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W-1>b:\n ss=black(a+1,b+1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n point.add((a,b))\n\nfor i in range(0,10):\n print(ans[i])",
"import sys",
"sys",
"input=sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"H,W,N=map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"point=set([])",
"point",
"set([])",
"set",
"[]",
"0 for i in range(0,10)",
"for i in range(0,10)",
"i",
"range(0,10)",
"range",
"0",
"10",
"for i in range(0,10)",
"0",
"ans=[0 for i in range(0,10)]",
"ans",
"[0 for i in range(0,10)]",
"ans[0]=(H-2)*(W-2)",
"ans[0]",
"ans",
"0",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"def black(x,y):\n ans=0\n if (x-1,y-1) in point:\n ans+=1\n if (x-1,y) in point:\n ans+=1\n if (x-1,y+1) in point:\n ans+=1\n\n if (x,y-1) in point:\n ans+=1\n if (x,y) in point:\n ans+=1\n if (x,y+1) in point:\n ans+=1\n\n if (x+1,y-1) in point:\n ans+=1\n if (x+1,y) in point:\n ans+=1\n if (x+1,y+1) in point:\n ans+=1\n \n return ans",
"black",
"ans=0",
"ans",
"0",
"if (x-1,y-1) in point:\n ans+=1\n ",
"(x-1,y-1) in point",
"(x-1,y-1)",
"x-1",
"x",
"1",
"y-1",
"y",
"1",
"point",
"ans+=1",
"ans",
"1",
"if (x-1,y) in point:\n ans+=1\n ",
"(x-1,y) in point",
"(x-1,y)",
"x-1",
"x",
"1",
"y",
"point",
"ans+=1",
"ans",
"1",
"if (x-1,y+1) in point:\n ans+=1\n\n ",
"(x-1,y+1) in point",
"(x-1,y+1)",
"x-1",
"x",
"1",
"y+1",
"y",
"1",
"point",
"ans+=1",
"ans",
"1",
"if (x,y-1) in point:\n ans+=1\n ",
"(x,y-1) in point",
"(x,y-1)",
"x",
"y-1",
"y",
"1",
"point",
"ans+=1",
"ans",
"1",
"if (x,y) in point:\n ans+=1\n ",
"(x,y) in point",
"(x,y)",
"x",
"y",
"point",
"ans+=1",
"ans",
"1",
"if (x,y+1) in point:\n ans+=1\n\n ",
"(x,y+1) in point",
"(x,y+1)",
"x",
"y+1",
"y",
"1",
"point",
"ans+=1",
"ans",
"1",
"if (x+1,y-1) in point:\n ans+=1\n ",
"(x+1,y-1) in point",
"(x+1,y-1)",
"x+1",
"x",
"1",
"y-1",
"y",
"1",
"point",
"ans+=1",
"ans",
"1",
"if (x+1,y) in point:\n ans+=1\n ",
"(x+1,y) in point",
"(x+1,y)",
"x+1",
"x",
"1",
"y",
"point",
"ans+=1",
"ans",
"1",
"if (x+1,y+1) in point:\n ans+=1\n \n ",
"(x+1,y+1) in point",
"(x+1,y+1)",
"x+1",
"x",
"1",
"y+1",
"y",
"1",
"point",
"ans+=1",
"ans",
"1",
"return ans",
"ans",
"x",
"x",
"y",
"y",
"for _ in range(0,N):\n a,b=map(int,input().split())\n if a>2:\n if b>2:\n ss=black(a-1,b-1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W>b>1:\n ss=black(a-1,b)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W-1>b:\n ss=black(a-1,b+1)\n ans[ss]-=1\n ans[ss+1]+=1\n if H>a>1:\n if b>2:\n ss=black(a,b-1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W>b>1:\n ss=black(a,b)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W-1>b:\n ss=black(a,b+1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if H-1>a:\n if b>2:\n ss=black(a+1,b-1)\n ans[ss]-=1\n ans[ss+1]+=1\n if W>b>1:\n ss=black(a+1,b)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W-1>b:\n ss=black(a+1,b+1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n point.add((a,b))",
"_",
"range(0,N)",
"range",
"0",
"N",
"a,b=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"if a>2:\n if b>2:\n ss=black(a-1,b-1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W>b>1:\n ss=black(a-1,b)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W-1>b:\n ss=black(a-1,b+1)\n ans[ss]-=1\n ans[ss+1]+=1\n ",
"a>2",
"a",
"2",
"if b>2:\n ss=black(a-1,b-1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n ",
"b>2",
"b",
"2",
"ss=black(a-1,b-1)",
"ss",
"black(a-1,b-1)",
"black",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"ans[ss]-=1",
"ans[ss]",
"ans",
"ss",
"1",
"ans[ss+1]+=1",
"ans[ss+1]",
"ans",
"ss+1",
"ss",
"1",
"1",
"if W>b>1:\n ss=black(a-1,b)\n ans[ss]-=1\n ans[ss+1]+=1\n\n ",
"W>b>1",
"W>b",
"W",
"b",
"1",
"ss=black(a-1,b)",
"ss",
"black(a-1,b)",
"black",
"a-1",
"a",
"1",
"b",
"ans[ss]-=1",
"ans[ss]",
"ans",
"ss",
"1",
"ans[ss+1]+=1",
"ans[ss+1]",
"ans",
"ss+1",
"ss",
"1",
"1",
"if W-1>b:\n ss=black(a-1,b+1)\n ans[ss]-=1\n ans[ss+1]+=1\n ",
"W-1>b",
"W-1",
"W",
"1",
"b",
"ss=black(a-1,b+1)",
"ss",
"black(a-1,b+1)",
"black",
"a-1",
"a",
"1",
"b+1",
"b",
"1",
"ans[ss]-=1",
"ans[ss]",
"ans",
"ss",
"1",
"ans[ss+1]+=1",
"ans[ss+1]",
"ans",
"ss+1",
"ss",
"1",
"1",
"if H>a>1:\n if b>2:\n ss=black(a,b-1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W>b>1:\n ss=black(a,b)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W-1>b:\n ss=black(a,b+1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n ",
"H>a>1",
"H>a",
"H",
"a",
"1",
"if b>2:\n ss=black(a,b-1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n ",
"b>2",
"b",
"2",
"ss=black(a,b-1)",
"ss",
"black(a,b-1)",
"black",
"a",
"b-1",
"b",
"1",
"ans[ss]-=1",
"ans[ss]",
"ans",
"ss",
"1",
"ans[ss+1]+=1",
"ans[ss+1]",
"ans",
"ss+1",
"ss",
"1",
"1",
"if W>b>1:\n ss=black(a,b)\n ans[ss]-=1\n ans[ss+1]+=1\n\n ",
"W>b>1",
"W>b",
"W",
"b",
"1",
"ss=black(a,b)",
"ss",
"black(a,b)",
"black",
"a",
"b",
"ans[ss]-=1",
"ans[ss]",
"ans",
"ss",
"1",
"ans[ss+1]+=1",
"ans[ss+1]",
"ans",
"ss+1",
"ss",
"1",
"1",
"if W-1>b:\n ss=black(a,b+1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n ",
"W-1>b",
"W-1",
"W",
"1",
"b",
"ss=black(a,b+1)",
"ss",
"black(a,b+1)",
"black",
"a",
"b+1",
"b",
"1",
"ans[ss]-=1",
"ans[ss]",
"ans",
"ss",
"1",
"ans[ss+1]+=1",
"ans[ss+1]",
"ans",
"ss+1",
"ss",
"1",
"1",
"if H-1>a:\n if b>2:\n ss=black(a+1,b-1)\n ans[ss]-=1\n ans[ss+1]+=1\n if W>b>1:\n ss=black(a+1,b)\n ans[ss]-=1\n ans[ss+1]+=1\n\n if W-1>b:\n ss=black(a+1,b+1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n ",
"H-1>a",
"H-1",
"H",
"1",
"a",
"if b>2:\n ss=black(a+1,b-1)\n ans[ss]-=1\n ans[ss+1]+=1\n ",
"b>2",
"b",
"2",
"ss=black(a+1,b-1)",
"ss",
"black(a+1,b-1)",
"black",
"a+1",
"a",
"1",
"b-1",
"b",
"1",
"ans[ss]-=1",
"ans[ss]",
"ans",
"ss",
"1",
"ans[ss+1]+=1",
"ans[ss+1]",
"ans",
"ss+1",
"ss",
"1",
"1",
"if W>b>1:\n ss=black(a+1,b)\n ans[ss]-=1\n ans[ss+1]+=1\n\n ",
"W>b>1",
"W>b",
"W",
"b",
"1",
"ss=black(a+1,b)",
"ss",
"black(a+1,b)",
"black",
"a+1",
"a",
"1",
"b",
"ans[ss]-=1",
"ans[ss]",
"ans",
"ss",
"1",
"ans[ss+1]+=1",
"ans[ss+1]",
"ans",
"ss+1",
"ss",
"1",
"1",
"if W-1>b:\n ss=black(a+1,b+1)\n ans[ss]-=1\n ans[ss+1]+=1\n\n ",
"W-1>b",
"W-1",
"W",
"1",
"b",
"ss=black(a+1,b+1)",
"ss",
"black(a+1,b+1)",
"black",
"a+1",
"a",
"1",
"b+1",
"b",
"1",
"ans[ss]-=1",
"ans[ss]",
"ans",
"ss",
"1",
"ans[ss+1]+=1",
"ans[ss+1]",
"ans",
"ss+1",
"ss",
"1",
"1",
"point.add((a,b))",
"point.add",
"point",
"add",
"(a,b)",
"a",
"b",
"for i in range(0,10):\n print(ans[i])",
"i",
"range(0,10)",
"range",
"0",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"ss=black(a-1,b+1)",
"black(a-1,b+1)",
"ss",
"ss=black(a,b)",
"black(a,b)",
"ss",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"ss=black(a+1,b-1)",
"black(a+1,b-1)",
"ss",
"point=set([])",
"set([])",
"point",
"def black(x,y):\n ans=0\n if (x-1,y-1) in point:\n ans+=1\n if (x-1,y) in point:\n ans+=1\n if (x-1,y+1) in point:\n ans+=1\n\n if (x,y-1) in point:\n ans+=1\n if (x,y) in point:\n ans+=1\n if (x,y+1) in point:\n ans+=1\n\n if (x+1,y-1) in point:\n ans+=1\n if (x+1,y) in point:\n ans+=1\n if (x+1,y+1) in point:\n ans+=1\n \n return ans",
"def black(x,y):\n ans=0\n if (x-1,y-1) in point:\n ans+=1\n if (x-1,y) in point:\n ans+=1\n if (x-1,y+1) in point:\n ans+=1\n\n if (x,y-1) in point:\n ans+=1\n if (x,y) in point:\n ans+=1\n if (x,y+1) in point:\n ans+=1\n\n if (x+1,y-1) in point:\n ans+=1\n if (x+1,y) in point:\n ans+=1\n if (x+1,y+1) in point:\n ans+=1\n \n return ans",
"black",
"ss=black(a+1,b+1)",
"black(a+1,b+1)",
"ss",
"input=sys.stdin.readline",
"sys.stdin.readline",
"input",
"ss=black(a-1,b)",
"black(a-1,b)",
"ss",
"ss=black(a+1,b)",
"black(a+1,b)",
"ss",
"W,N=map(int,input().split())",
"map(int,input().split())",
"W",
"ans=[0 for i in range(0,10)]",
"[0 for i in range(0,10)]",
"ans",
"ss=black(a,b+1)",
"black(a,b+1)",
"ss",
"H,W,N=map(int,input().split())",
"map(int,input().split())",
"H",
"ss=black(a-1,b-1)",
"black(a-1,b-1)",
"ss",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"ss=black(a,b-1)",
"black(a,b-1)",
"ss"
] | import sys
input=sys.stdin.readline
H,W,N=map(int,input().split())
point=set([])
ans=[0 for i in range(0,10)]
ans[0]=(H-2)*(W-2)
def black(x,y):
ans=0
if (x-1,y-1) in point:
ans+=1
if (x-1,y) in point:
ans+=1
if (x-1,y+1) in point:
ans+=1
if (x,y-1) in point:
ans+=1
if (x,y) in point:
ans+=1
if (x,y+1) in point:
ans+=1
if (x+1,y-1) in point:
ans+=1
if (x+1,y) in point:
ans+=1
if (x+1,y+1) in point:
ans+=1
return ans
for _ in range(0,N):
a,b=map(int,input().split())
if a>2:
if b>2:
ss=black(a-1,b-1)
ans[ss]-=1
ans[ss+1]+=1
if W>b>1:
ss=black(a-1,b)
ans[ss]-=1
ans[ss+1]+=1
if W-1>b:
ss=black(a-1,b+1)
ans[ss]-=1
ans[ss+1]+=1
if H>a>1:
if b>2:
ss=black(a,b-1)
ans[ss]-=1
ans[ss+1]+=1
if W>b>1:
ss=black(a,b)
ans[ss]-=1
ans[ss+1]+=1
if W-1>b:
ss=black(a,b+1)
ans[ss]-=1
ans[ss+1]+=1
if H-1>a:
if b>2:
ss=black(a+1,b-1)
ans[ss]-=1
ans[ss+1]+=1
if W>b>1:
ss=black(a+1,b)
ans[ss]-=1
ans[ss+1]+=1
if W-1>b:
ss=black(a+1,b+1)
ans[ss]-=1
ans[ss+1]+=1
point.add((a,b))
for i in range(0,10):
print(ans[i])
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
0,
18,
13,
13,
17,
0,
13,
4,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
39,
13,
13,
0,
13,
2,
39,
17,
17,
12,
13,
0,
13,
17,
28,
13,
4,
13,
13,
2,
13,
17,
28,
13,
4,
13,
13,
2,
13,
17,
14,
2,
2,
2,
4,
13,
13,
17,
4,
13,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
23,
13,
23,
13,
28,
13,
13,
13,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
4,
13,
13,
13,
28,
13,
4,
13,
17,
17,
0,
18,
13,
13,
2,
18,
13,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13
] | [
[
203,
2
],
[
203,
11
],
[
203,
12
],
[
206,
14
],
[
185,
17
],
[
21,
20
],
[
204,
23
],
[
188,
25
],
[
32,
29
],
[
207,
30
],
[
189,
31
],
[
197,
34
],
[
189,
40
],
[
197,
42
],
[
186,
45
],
[
209,
51
],
[
60,
59
],
[
63,
62
],
[
98,
65
],
[
98,
67
],
[
71,
70
],
[
100,
73
],
[
100,
75
],
[
62,
83
],
[
70,
87
],
[
207,
88
],
[
91,
90
],
[
96,
93
],
[
210,
94
],
[
90,
95
],
[
59,
95
],
[
98,
98
],
[
100,
100
],
[
107,
106
],
[
192,
113
],
[
195,
118
],
[
192,
121
],
[
125,
124
],
[
198,
131
],
[
183,
136
],
[
198,
139
],
[
201,
142
],
[
106,
143
],
[
124,
144
],
[
147,
146
],
[
155,
152
],
[
210,
153
],
[
146,
154
],
[
152,
156
],
[
210,
157
],
[
146,
158
],
[
146,
159
],
[
164,
161
],
[
210,
162
],
[
195,
167
],
[
183,
170
],
[
210,
174
],
[
177,
176
],
[
210,
176
],
[
176,
180
],
[
203,
183
],
[
185,
186
],
[
188,
189
],
[
197,
192
],
[
203,
195
],
[
197,
198
],
[
203,
204
],
[
206,
207
],
[
209,
210
]
] | [
"h, w, n = map(int, input().split())\n\nd = {}\nab = []\n\nfor i in range(n):\n s = input()\n d[s] = 1\n a, b = map(int, s.split())\n ab.append((a, b))\n\nmemo = [0] * 10\n\ndef check(a,b):\n cnt = 0\n for i in range(a,a+3):\n for j in range(b,b+3):\n if str(i) + ' ' + str(j) in d:\n cnt += 1\n memo[cnt] += 1\n \nfor a, b in ab:\n for i in range(max(1,a-2), min(h-1,a+1)):\n for j in range(max(1,b-2), min(w-1,b+1)):\n check(i,j)\n\nfor i in range(1, 10):\n memo[i] = memo[i] // i\n\nmemo[0] = (h-2) * (w-2) - sum(memo)\n\nfor memoi in memo:\n print(memoi)\n\n\n \n\n",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"d = {}",
"d",
"{}",
"ab = []",
"ab",
"[]",
"for i in range(n):\n s = input()\n d[s] = 1\n a, b = map(int, s.split())\n ab.append((a, b))",
"i",
"range(n)",
"range",
"n",
"s = input()",
"s",
"input()",
"input",
"d[s] = 1",
"d[s]",
"d",
"s",
"1",
"a, b = map(int, s.split())",
"a",
"map(int, s.split())",
"map",
"int",
"s.split()",
"s.split",
"s",
"split",
"b",
"ab.append((a, b))",
"ab.append",
"ab",
"append",
"(a, b)",
"a",
"b",
"memo = [0] * 10",
"memo",
"[0] * 10",
"[0]",
"0",
"10",
"def check(a,b):\n cnt = 0\n for i in range(a,a+3):\n for j in range(b,b+3):\n if str(i) + ' ' + str(j) in d:\n cnt += 1\n memo[cnt] += 1\n ",
"check",
"cnt = 0",
"cnt",
"0",
"for i in range(a,a+3):\n for j in range(b,b+3):\n if str(i) + ' ' + str(j) in d:\n cnt += 1\n ",
"i",
"range(a,a+3)",
"range",
"a",
"a+3",
"a",
"3",
"for j in range(b,b+3):\n if str(i) + ' ' + str(j) in d:\n cnt += 1\n ",
"j",
"range(b,b+3)",
"range",
"b",
"b+3",
"b",
"3",
"if str(i) + ' ' + str(j) in d:\n cnt += 1\n ",
"str(i) + ' ' + str(j) in d",
"str(i) + ' ' + str(j)",
"str(i) + ' '",
"str(i)",
"str",
"i",
"' '",
"str(j)",
"str",
"j",
"d",
"cnt += 1",
"cnt",
"1",
"memo[cnt] += 1",
"memo[cnt]",
"memo",
"cnt",
"1",
"a",
"a",
"b",
"b",
"for a, b in ab:\n for i in range(max(1,a-2), min(h-1,a+1)):\n for j in range(max(1,b-2), min(w-1,b+1)):\n check(i,j)",
"a",
"b",
"ab",
"for i in range(max(1,a-2), min(h-1,a+1)):\n for j in range(max(1,b-2), min(w-1,b+1)):\n check(i,j)",
"i",
"range(max(1,a-2), min(h-1,a+1))",
"range",
"max(1,a-2)",
"max",
"1",
"a-2",
"a",
"2",
"min(h-1,a+1)",
"min",
"h-1",
"h",
"1",
"a+1",
"a",
"1",
"for j in range(max(1,b-2), min(w-1,b+1)):\n check(i,j)",
"j",
"range(max(1,b-2), min(w-1,b+1))",
"range",
"max(1,b-2)",
"max",
"1",
"b-2",
"b",
"2",
"min(w-1,b+1)",
"min",
"w-1",
"w",
"1",
"b+1",
"b",
"1",
"check(i,j)",
"check",
"i",
"j",
"for i in range(1, 10):\n memo[i] = memo[i] // i",
"i",
"range(1, 10)",
"range",
"1",
"10",
"memo[i] = memo[i] // i",
"memo[i]",
"memo",
"i",
"memo[i] // i",
"memo[i]",
"memo",
"i",
"i",
"memo[0] = (h-2) * (w-2) - sum(memo)",
"memo[0]",
"memo",
"0",
"(h-2) * (w-2) - sum(memo)",
"(h-2) * (w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(memo)",
"sum",
"memo",
"for memoi in memo:\n print(memoi)\n\n\n ",
"memoi",
"memo",
"print(memoi)",
"print",
"memoi",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"ab = []",
"[]",
"ab",
"s = input()",
"input()",
"s",
"a, b = map(int, s.split())",
"map(int, s.split())",
"a",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"b = map(int, s.split())",
"map(int, s.split())",
"b",
"def check(a,b):\n cnt = 0\n for i in range(a,a+3):\n for j in range(b,b+3):\n if str(i) + ' ' + str(j) in d:\n cnt += 1\n memo[cnt] += 1\n ",
"def check(a,b):\n cnt = 0\n for i in range(a,a+3):\n for j in range(b,b+3):\n if str(i) + ' ' + str(j) in d:\n cnt += 1\n memo[cnt] += 1\n ",
"check",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"d = {}",
"{}",
"d",
"memo = [0] * 10",
"[0] * 10",
"memo"
] | h, w, n = map(int, input().split())
d = {}
ab = []
for i in range(n):
s = input()
d[s] = 1
a, b = map(int, s.split())
ab.append((a, b))
memo = [0] * 10
def check(a,b):
cnt = 0
for i in range(a,a+3):
for j in range(b,b+3):
if str(i) + ' ' + str(j) in d:
cnt += 1
memo[cnt] += 1
for a, b in ab:
for i in range(max(1,a-2), min(h-1,a+1)):
for j in range(max(1,b-2), min(w-1,b+1)):
check(i,j)
for i in range(1, 10):
memo[i] = memo[i] // i
memo[0] = (h-2) * (w-2) - sum(memo)
for memoi in memo:
print(memoi)
|
[
7,
15,
13,
12,
13,
29,
18,
4,
18,
18,
13,
13,
13,
39,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
17,
14,
40,
2,
2,
17,
2,
13,
13,
13,
9,
28,
13,
4,
13,
17,
17,
14,
40,
2,
2,
17,
2,
13,
13,
13,
9,
0,
13,
39,
2,
13,
13,
2,
13,
13,
14,
2,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
4,
13,
31,
13,
0,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
17,
13,
10,
39,
13
] | [
[
156,
16
],
[
160,
23
],
[
156,
25
],
[
156,
26
],
[
162,
28
],
[
32,
31
],
[
154,
34
],
[
147,
36
],
[
160,
43
],
[
147,
45
],
[
48,
47
],
[
142,
58
],
[
47,
59
],
[
157,
60
],
[
64,
63
],
[
148,
74
],
[
63,
75
],
[
145,
76
],
[
165,
79
],
[
142,
82
],
[
47,
83
],
[
148,
85
],
[
63,
86
],
[
166,
89
],
[
163,
90
],
[
95,
92
],
[
163,
93
],
[
166,
94
],
[
100,
97
],
[
163,
98
],
[
166,
99
],
[
150,
102
],
[
109,
108
],
[
163,
111
],
[
117,
114
],
[
151,
115
],
[
108,
116
],
[
122,
119
],
[
151,
120
],
[
157,
125
],
[
145,
128
],
[
151,
132
],
[
151,
136
],
[
139,
138
],
[
147,
142
],
[
156,
145
],
[
147,
148
],
[
150,
151
],
[
156,
154
],
[
156,
157
],
[
162,
163
],
[
165,
166
]
] | [
"import sys\ndef input():\n return sys.stdin.readline()[:-1]\nH,W,N=map(int,input().split())\nd={}\nfor i in range(N):\n a,b=map(int,input().split())\n for j in range(-1,2):\n if not 1<a+j<H:\n continue\n for k in range(-1,2):\n if not 1<b+k<W:\n continue\n t=(a+j,b+k)\n if t in d:\n d[t]+=1\n else:\n d[t]=1\nl=[0]*10\nfor i in d.values():\n l[i]+=1\nl[0]=(H-2)*(W-2)-sum(l)\nprint(*l,sep=\"\\n\")",
"import sys",
"sys",
"def input():\n return sys.stdin.readline()[:-1]",
"input",
"return sys.stdin.readline()[:-1]",
"sys.stdin.readline()[:-1]",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
":-1",
"-1",
"H,W,N=map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"d={}",
"d",
"{}",
"for i in range(N):\n a,b=map(int,input().split())\n for j in range(-1,2):\n if not 1<a+j<H:\n continue\n for k in range(-1,2):\n if not 1<b+k<W:\n continue\n t=(a+j,b+k)\n if t in d:\n d[t]+=1\n else:\n d[t]=1",
"i",
"range(N)",
"range",
"N",
"a,b=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for j in range(-1,2):\n if not 1<a+j<H:\n continue\n for k in range(-1,2):\n if not 1<b+k<W:\n continue\n t=(a+j,b+k)\n if t in d:\n d[t]+=1\n else:\n d[t]=1",
"j",
"range(-1,2)",
"range",
"-1",
"2",
"if not 1<a+j<H:\n continue\n ",
"not 1<a+j<H",
"1<a+j<H",
"1<a+j",
"1",
"a+j",
"a",
"j",
"H",
"continue",
"for k in range(-1,2):\n if not 1<b+k<W:\n continue\n t=(a+j,b+k)\n if t in d:\n d[t]+=1\n else:\n d[t]=1",
"k",
"range(-1,2)",
"range",
"-1",
"2",
"if not 1<b+k<W:\n continue\n ",
"not 1<b+k<W",
"1<b+k<W",
"1<b+k",
"1",
"b+k",
"b",
"k",
"W",
"continue",
"t=(a+j,b+k)",
"t",
"(a+j,b+k)",
"a+j",
"a",
"j",
"b+k",
"b",
"k",
"if t in d:\n d[t]+=1\n else:\n d[t]=1",
"t in d",
"t",
"d",
"d[t]+=1",
"d[t]",
"d",
"t",
"1",
"d[t]=1",
"d[t]",
"d",
"t",
"1",
"l=[0]*10",
"l",
"[0]*10",
"[0]",
"0",
"10",
"for i in d.values():\n l[i]+=1",
"i",
"d.values()",
"d.values",
"d",
"values",
"l[i]+=1",
"l[i]",
"l",
"i",
"1",
"l[0]=(H-2)*(W-2)-sum(l)",
"l[0]",
"l",
"0",
"(H-2)*(W-2)-sum(l)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(l)",
"sum",
"l",
"print(*l,sep=\"\\n\")",
"print",
"*l",
"l",
"sep=\"\\n\"",
"sep",
"\"\\n\"",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"W,N=map(int,input().split())",
"map(int,input().split())",
"W",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"l=[0]*10",
"[0]*10",
"l",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"H,W,N=map(int,input().split())",
"map(int,input().split())",
"H",
"def input():\n return sys.stdin.readline()[:-1]",
"def input():\n return sys.stdin.readline()[:-1]",
"input",
"d={}",
"{}",
"d",
"t=(a+j,b+k)",
"(a+j,b+k)",
"t"
] | import sys
def input():
return sys.stdin.readline()[:-1]
H,W,N=map(int,input().split())
d={}
for i in range(N):
a,b=map(int,input().split())
for j in range(-1,2):
if not 1<a+j<H:
continue
for k in range(-1,2):
if not 1<b+k<W:
continue
t=(a+j,b+k)
if t in d:
d[t]+=1
else:
d[t]=1
l=[0]*10
for i in d.values():
l[i]+=1
l[0]=(H-2)*(W-2)-sum(l)
print(*l,sep="\n") |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
17,
0,
13,
39,
17,
17,
17,
41,
28,
13,
13,
28,
13,
13,
4,
39,
13,
13,
0,
13,
13,
28,
13,
13,
13,
28,
13,
13,
13,
14,
2,
2,
13,
13,
13,
0,
13,
18,
13,
2,
13,
13,
14,
2,
2,
13,
13,
13,
0,
18,
13,
2,
13,
13,
17,
0,
18,
13,
2,
13,
13,
17,
0,
18,
13,
2,
13,
13,
17,
0,
18,
18,
13,
2,
13,
13,
2,
13,
13,
17,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
28,
13,
13,
4,
18,
13,
13,
28,
13,
13,
4,
18,
13,
13,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
13,
17,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
18,
13,
17,
2,
13,
4,
13,
18,
13,
39,
17,
28,
13,
13,
4,
13,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
18,
13,
10,
2,
13,
10,
17,
13
] | [
[
204,
2
],
[
204,
11
],
[
204,
12
],
[
16,
15
],
[
196,
18
],
[
198,
31
],
[
216,
34
],
[
189,
37
],
[
45,
44
],
[
190,
44
],
[
48,
47
],
[
190,
47
],
[
207,
54
],
[
217,
69
],
[
210,
71
],
[
217,
73
],
[
211,
82
],
[
89,
84
],
[
211,
85
],
[
96,
91
],
[
211,
92
],
[
103,
98
],
[
217,
99
],
[
114,
105
],
[
217,
107
],
[
118,
117
],
[
201,
124
],
[
217,
131
],
[
211,
138
],
[
193,
147
],
[
205,
154
],
[
160,
157
],
[
202,
158
],
[
213,
162
],
[
193,
165
],
[
205,
168
],
[
174,
171
],
[
202,
172
],
[
214,
175
],
[
202,
179
],
[
184,
183
],
[
202,
183
],
[
183,
187
],
[
189,
190
],
[
204,
193
],
[
204,
196
],
[
198,
199
],
[
201,
202
],
[
204,
205
],
[
207,
208
],
[
210,
211
],
[
213,
214
],
[
216,
217
]
] | [
"H,W,N = map(int,input().split())\nab_list = [tuple(map(int,input().split())) for _ in range(N)]\ntable_dict = {}\n\ndiffs = [-1,0,1]\ndiff_tuples = [(a,b) for a in diffs for b in diffs]\n\nfor a, b in ab_list:\n for da,db in diff_tuples:\n if a+da in table_dict:\n row = table_dict[a+da]\n if b+db in row:\n row[b+db] += 1\n else:\n row[b+db] = 1\n else:\n table_dict[a+da] = {}\n table_dict[a+da][b+db] = 1\n\ncnts = [0 for _ in range(10)]\n\nfor h,row in table_dict.items():\n for w,v in row.items():\n if 2 <= h <= H-1 and 2 <= w <= W-1:\n cnts[v] += 1\n\nsquare_3x3 = (H-2) *(W-2)\ncnts[0] = square_3x3 - sum(cnts[1:])\n\nfor cnt in cnts:\n print(cnt)",
"H,W,N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"tuple(map(int,input().split())) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"tuple(map(int,input().split()))",
"tuple",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ab_list = [tuple(map(int,input().split())) for _ in range(N)]",
"ab_list",
"[tuple(map(int,input().split())) for _ in range(N)]",
"table_dict = {}",
"table_dict",
"{}",
"diffs = [-1,0,1]",
"diffs",
"[-1,0,1]",
"-1",
"0",
"1",
"(a,b) for a in diffs for b in diffs",
"for a in diffs for b in diffs",
"a",
"diffs",
"for b in diffs",
"b",
"diffs",
"for b in diffs",
"(a,b)",
"a",
"b",
"diff_tuples = [(a,b) for a in diffs for b in diffs]",
"diff_tuples",
"[(a,b) for a in diffs for b in diffs]",
"for a, b in ab_list:\n for da,db in diff_tuples:\n if a+da in table_dict:\n row = table_dict[a+da]\n if b+db in row:\n row[b+db] += 1\n else:\n row[b+db] = 1\n else:\n table_dict[a+da] = {}\n table_dict[a+da][b+db] = 1",
"a",
"b",
"ab_list",
"for da,db in diff_tuples:\n if a+da in table_dict:\n row = table_dict[a+da]\n if b+db in row:\n row[b+db] += 1\n else:\n row[b+db] = 1\n else:\n table_dict[a+da] = {}\n table_dict[a+da][b+db] = 1",
"da",
"db",
"diff_tuples",
"if a+da in table_dict:\n row = table_dict[a+da]\n if b+db in row:\n row[b+db] += 1\n else:\n row[b+db] = 1\n else:\n table_dict[a+da] = {}\n table_dict[a+da][b+db] = 1",
"a+da in table_dict",
"a+da",
"a",
"da",
"table_dict",
"row = table_dict[a+da]",
"row",
"table_dict[a+da]",
"table_dict",
"a+da",
"a",
"da",
"if b+db in row:\n row[b+db] += 1\n else:\n row[b+db] = 1\n ",
"b+db in row",
"b+db",
"b",
"db",
"row",
"row[b+db] += 1",
"row[b+db]",
"row",
"b+db",
"b",
"db",
"1",
"row[b+db] = 1",
"row[b+db]",
"row",
"b+db",
"b",
"db",
"1",
"table_dict[a+da] = {}",
"table_dict[a+da]",
"table_dict",
"a+da",
"a",
"da",
"{}",
"table_dict[a+da][b+db] = 1",
"table_dict[a+da][b+db]",
"[a+da]",
"table_dict",
"a+da",
"a",
"da",
"b+db",
"b",
"db",
"1",
"0 for _ in range(10)",
"for _ in range(10)",
"_",
"range(10)",
"range",
"10",
"for _ in range(10)",
"0",
"cnts = [0 for _ in range(10)]",
"cnts",
"[0 for _ in range(10)]",
"for h,row in table_dict.items():\n for w,v in row.items():\n if 2 <= h <= H-1 and 2 <= w <= W-1:\n cnts[v] += 1",
"h",
"row",
"table_dict.items()",
"table_dict.items",
"table_dict",
"items",
"for w,v in row.items():\n if 2 <= h <= H-1 and 2 <= w <= W-1:\n cnts[v] += 1",
"w",
"v",
"row.items()",
"row.items",
"row",
"items",
"if 2 <= h <= H-1 and 2 <= w <= W-1:\n cnts[v] += 1",
"2 <= h <= H-1 and 2 <= w <= W-1",
"2 <= h <= H-1",
"2 <= h",
"2",
"h",
"H-1",
"H",
"1",
"2 <= w <= W-1",
"2 <= w",
"2",
"w",
"W-1",
"W",
"1",
"cnts[v] += 1",
"cnts[v]",
"cnts",
"v",
"1",
"square_3x3 = (H-2) *(W-2)",
"square_3x3",
"(H-2) *(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"cnts[0] = square_3x3 - sum(cnts[1:])",
"cnts[0]",
"cnts",
"0",
"square_3x3 - sum(cnts[1:])",
"square_3x3",
"sum(cnts[1:])",
"sum",
"cnts[1:]",
"cnts",
"1:",
"1",
"for cnt in cnts:\n print(cnt)",
"cnt",
"cnts",
"print(cnt)",
"print",
"cnt",
"diffs = [-1,0,1]",
"[-1,0,1]",
"diffs",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"ab_list = [tuple(map(int,input().split())) for _ in range(N)]",
"[tuple(map(int,input().split())) for _ in range(N)]",
"ab_list",
"cnts = [0 for _ in range(10)]",
"[0 for _ in range(10)]",
"cnts",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"diff_tuples = [(a,b) for a in diffs for b in diffs]",
"[(a,b) for a in diffs for b in diffs]",
"diff_tuples",
"row = table_dict[a+da]",
"table_dict[a+da]",
"row",
"square_3x3 = (H-2) *(W-2)",
"(H-2) *(W-2)",
"square_3x3",
"table_dict = {}",
"{}",
"table_dict"
] | H,W,N = map(int,input().split())
ab_list = [tuple(map(int,input().split())) for _ in range(N)]
table_dict = {}
diffs = [-1,0,1]
diff_tuples = [(a,b) for a in diffs for b in diffs]
for a, b in ab_list:
for da,db in diff_tuples:
if a+da in table_dict:
row = table_dict[a+da]
if b+db in row:
row[b+db] += 1
else:
row[b+db] = 1
else:
table_dict[a+da] = {}
table_dict[a+da][b+db] = 1
cnts = [0 for _ in range(10)]
for h,row in table_dict.items():
for w,v in row.items():
if 2 <= h <= H-1 and 2 <= w <= W-1:
cnts[v] += 1
square_3x3 = (H-2) *(W-2)
cnts[0] = square_3x3 - sum(cnts[1:])
for cnt in cnts:
print(cnt) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
0,
13,
17,
0,
13,
2,
39,
17,
17,
12,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
4,
18,
13,
13,
39,
13,
13,
29,
13,
23,
13,
23,
13,
28,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
4,
13,
13,
13,
14,
40,
39,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
39,
2,
2,
13,
13,
17,
2,
2,
13,
13,
17,
13,
0,
13,
17,
0,
18,
13,
39,
13,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
10,
12,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13
] | [
[
197,
2
],
[
197,
11
],
[
197,
12
],
[
16,
15
],
[
198,
18
],
[
205,
33
],
[
185,
36
],
[
45,
44
],
[
48,
47
],
[
92,
54
],
[
183,
59
],
[
92,
62
],
[
66,
65
],
[
94,
72
],
[
195,
77
],
[
94,
80
],
[
44,
84
],
[
44,
90
],
[
92,
92
],
[
94,
94
],
[
211,
100
],
[
188,
103
],
[
203,
109
],
[
212,
110
],
[
189,
111
],
[
206,
117
],
[
191,
119
],
[
123,
122
],
[
128,
127
],
[
122,
137
],
[
127,
142
],
[
200,
144
],
[
208,
146
],
[
154,
149
],
[
206,
150
],
[
209,
154
],
[
192,
154
],
[
159,
156
],
[
186,
157
],
[
209,
158
],
[
192,
158
],
[
164,
161
],
[
186,
162
],
[
183,
167
],
[
195,
170
],
[
186,
174
],
[
177,
176
],
[
186,
176
],
[
176,
180
],
[
197,
183
],
[
185,
186
],
[
188,
189
],
[
191,
192
],
[
197,
195
],
[
197,
198
],
[
205,
206
],
[
208,
209
],
[
211,
212
]
] | [
"h, w, n = map(int, input().split())\na = {tuple(map(int, input().split())) for _ in range(n)}\n\nd = {}\nc = [0] * 10\n\ndef next(x, y):\n ret = []\n for i in range(max(0, x-2), min(h-2, x+1)):\n for j in range(max(0, y-2), min(w-2, y+1)):\n ret.append((i, j))\n return ret\n\nfor x, y in a:\n x -= 1\n y -= 1\n for s, t in next(x, y):\n if (s, t) not in d:\n count = 0\n for i in range(3):\n for j in range(3):\n if (s + i + 1, t + j + 1) in a:\n count += 1\n d[(s, t)] = count\n c[count] += 1\n\nc[0] = (h-2) * (w-2) - sum(c)\n\nfor x in c:\n print(x)",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"tuple(map(int, input().split())) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"tuple(map(int, input().split()))",
"tuple",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"a = {tuple(map(int, input().split())) for _ in range(n)}",
"a",
"d = {}",
"d",
"{}",
"c = [0] * 10",
"c",
"[0] * 10",
"[0]",
"0",
"10",
"def next(x, y):\n ret = []\n for i in range(max(0, x-2), min(h-2, x+1)):\n for j in range(max(0, y-2), min(w-2, y+1)):\n ret.append((i, j))\n return ret",
"next",
"ret = []",
"ret",
"[]",
"for i in range(max(0, x-2), min(h-2, x+1)):\n for j in range(max(0, y-2), min(w-2, y+1)):\n ret.append((i, j))\n ",
"i",
"range(max(0, x-2), min(h-2, x+1))",
"range",
"max(0, x-2)",
"max",
"0",
"x-2",
"x",
"2",
"min(h-2, x+1)",
"min",
"h-2",
"h",
"2",
"x+1",
"x",
"1",
"for j in range(max(0, y-2), min(w-2, y+1)):\n ret.append((i, j))\n ",
"j",
"range(max(0, y-2), min(w-2, y+1))",
"range",
"max(0, y-2)",
"max",
"0",
"y-2",
"y",
"2",
"min(w-2, y+1)",
"min",
"w-2",
"w",
"2",
"y+1",
"y",
"1",
"ret.append((i, j))",
"ret.append",
"ret",
"append",
"(i, j)",
"i",
"j",
"return ret",
"ret",
"x",
"x",
"y",
"y",
"for x, y in a:\n x -= 1\n y -= 1\n for s, t in next(x, y):\n if (s, t) not in d:\n count = 0\n for i in range(3):\n for j in range(3):\n if (s + i + 1, t + j + 1) in a:\n count += 1\n d[(s, t)] = count\n c[count] += 1",
"x",
"y",
"a",
"x -= 1",
"x",
"1",
"y -= 1",
"y",
"1",
"for s, t in next(x, y):\n if (s, t) not in d:\n count = 0\n for i in range(3):\n for j in range(3):\n if (s + i + 1, t + j + 1) in a:\n count += 1\n d[(s, t)] = count\n c[count] += 1",
"s",
"t",
"next(x, y)",
"next",
"x",
"y",
"if (s, t) not in d:\n count = 0\n for i in range(3):\n for j in range(3):\n if (s + i + 1, t + j + 1) in a:\n count += 1\n d[(s, t)] = count\n c[count] += 1",
"(s, t) not in d",
"(s, t)",
"s",
"t",
"d",
"count = 0",
"count",
"0",
"for i in range(3):\n for j in range(3):\n if (s + i + 1, t + j + 1) in a:\n count += 1\n ",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n if (s + i + 1, t + j + 1) in a:\n count += 1\n ",
"j",
"range(3)",
"range",
"3",
"if (s + i + 1, t + j + 1) in a:\n count += 1\n ",
"(s + i + 1, t + j + 1) in a",
"(s + i + 1, t + j + 1)",
"s + i + 1",
"s + i",
"s",
"i",
"1",
"t + j + 1",
"t + j",
"t",
"j",
"1",
"a",
"count += 1",
"count",
"1",
"d[(s, t)] = count",
"d[(s, t)]",
"d",
"(s, t)",
"s",
"t",
"count",
"c[count] += 1",
"c[count]",
"c",
"count",
"1",
"c[0] = (h-2) * (w-2) - sum(c)",
"c[0]",
"c",
"0",
"(h-2) * (w-2) - sum(c)",
"(h-2) * (w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(c)",
"sum",
"c",
"for x in c:\n print(x)",
"x",
"c",
"print(x)",
"print",
"x",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"c = [0] * 10",
"[0] * 10",
"c",
"y -= 1",
"1",
"y",
"count = 0",
"0",
"count",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"a = {tuple(map(int, input().split())) for _ in range(n)}",
"a",
"def next(x, y):\n ret = []\n for i in range(max(0, x-2), min(h-2, x+1)):\n for j in range(max(0, y-2), min(w-2, y+1)):\n ret.append((i, j))\n return ret",
"def next(x, y):\n ret = []\n for i in range(max(0, x-2), min(h-2, x+1)):\n for j in range(max(0, y-2), min(w-2, y+1)):\n ret.append((i, j))\n return ret",
"next",
"d = {}",
"{}",
"d",
"count += 1",
"1",
"count",
"x -= 1",
"1",
"x"
] | h, w, n = map(int, input().split())
a = {tuple(map(int, input().split())) for _ in range(n)}
d = {}
c = [0] * 10
def next(x, y):
ret = []
for i in range(max(0, x-2), min(h-2, x+1)):
for j in range(max(0, y-2), min(w-2, y+1)):
ret.append((i, j))
return ret
for x, y in a:
x -= 1
y -= 1
for s, t in next(x, y):
if (s, t) not in d:
count = 0
for i in range(3):
for j in range(3):
if (s + i + 1, t + j + 1) in a:
count += 1
d[(s, t)] = count
c[count] += 1
c[0] = (h-2) * (w-2) - sum(c)
for x in c:
print(x) |
[
7,
15,
13,
15,
13,
15,
13,
14,
4,
18,
13,
13,
17,
0,
18,
13,
13,
4,
13,
17,
17,
4,
18,
13,
13,
17,
0,
13,
4,
13,
17,
0,
13,
2,
17,
17,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
0,
13,
13,
0,
13,
4,
13,
12,
13,
0,
13,
17,
28,
13,
13,
4,
18,
13,
13,
39,
17,
17,
17,
0,
13,
17,
0,
13,
2,
39,
2,
13,
13,
2,
13,
13,
13,
29,
13,
23,
13,
23,
13,
12,
13,
29,
2,
2,
2,
17,
13,
13,
2,
2,
17,
13,
13,
23,
13,
17,
23,
13,
17,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
13,
13,
4,
18,
13,
13,
39,
13,
13,
28,
13,
13,
4,
18,
13,
13,
39,
17,
17,
17,
0,
13,
17,
14,
40,
4,
13,
2,
13,
13,
2,
13,
13,
9,
0,
13,
4,
13,
2,
13,
13,
2,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
4,
13,
4,
18,
17,
13,
4,
13,
13,
13,
10,
2,
13,
10,
2,
13,
10,
13,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
17,
14
],
[
248,
27
],
[
224,
32
],
[
242,
37
],
[
14,
47
],
[
242,
52
],
[
242,
53
],
[
57,
56
],
[
240,
59
],
[
14,
70
],
[
230,
76
],
[
251,
79
],
[
86,
85
],
[
100,
99
],
[
103,
102
],
[
115,
106
],
[
117,
109
],
[
252,
111
],
[
102,
113
],
[
85,
113
],
[
115,
115
],
[
117,
117
],
[
133,
125
],
[
243,
126
],
[
136,
130
],
[
237,
131
],
[
134,
133
],
[
137,
136
],
[
227,
139
],
[
148,
145
],
[
228,
146
],
[
243,
150
],
[
237,
153
],
[
252,
161
],
[
179,
178
],
[
246,
183
],
[
254,
192
],
[
234,
194
],
[
205,
202
],
[
228,
203
],
[
255,
204
],
[
212,
207
],
[
228,
208
],
[
255,
210
],
[
228,
222
],
[
224,
225
],
[
227,
228
],
[
230,
231
],
[
242,
237
],
[
242,
240
],
[
242,
243
],
[
248,
249
],
[
251,
252
],
[
254,
255
]
] | [
"import itertools\nimport os\nimport sys\n\nif os.getenv(\"LOCAL\"):\n sys.stdin = open(\"_in.txt\", \"r\")\n\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nIINF = 10 ** 18\n\nH, W, N = list(map(int, sys.stdin.readline().split()))\nAB = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]\n\nhist = set()\n\n\ndef count(h, w):\n ret = 0\n for dh, dw in itertools.product([-1, 0, 1], repeat=2):\n ret += (h + dh, w + dw) in hist\n return ret\n\n\ndef ok(a=1, b=1):\n return 1 < a < H and 1 < b < W\n\n\nans = [0] * 10\nans[0] = (H - 2) * (W - 2)\nfor a, b in AB:\n hist.add((a, b))\n for dh, dw in itertools.product([-1, 0, 1], repeat=2):\n if not ok(a + dh, b + dw):\n continue\n c = count(a + dh, b + dw)\n ans[c] += 1\n ans[c - 1] -= 1\nprint('\\n'.join(map(str, ans)))",
"import itertools",
"itertools",
"import os",
"os",
"import sys",
"sys",
"if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"_in.txt\", \"r\")",
"os.getenv(\"LOCAL\")",
"os.getenv",
"os",
"getenv",
"\"LOCAL\"",
"sys.stdin = open(\"_in.txt\", \"r\")",
"sys.stdin",
"sys",
"stdin",
"open(\"_in.txt\", \"r\")",
"open",
"\"_in.txt\"",
"\"r\"",
"sys.setrecursionlimit(2147483647)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"2147483647",
"INF = float(\"inf\")",
"INF",
"float(\"inf\")",
"float",
"\"inf\"",
"IINF = 10 ** 18",
"IINF",
"10 ** 18",
"10",
"18",
"H, W, N = list(map(int, sys.stdin.readline().split()))",
"H",
"list(map(int, sys.stdin.readline().split()))",
"list",
"map(int, sys.stdin.readline().split())",
"map",
"int",
"sys.stdin.readline().split()",
"sys.stdin.readline().split",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"split",
"W",
"N",
"list(map(int, sys.stdin.readline().split())) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"list(map(int, sys.stdin.readline().split()))",
"list",
"map(int, sys.stdin.readline().split())",
"map",
"int",
"sys.stdin.readline().split()",
"sys.stdin.readline().split",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"split",
"AB = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]",
"AB",
"[list(map(int, sys.stdin.readline().split())) for _ in range(N)]",
"hist = set()",
"hist",
"set()",
"set",
"def count(h, w):\n ret = 0\n for dh, dw in itertools.product([-1, 0, 1], repeat=2):\n ret += (h + dh, w + dw) in hist\n return ret",
"count",
"ret = 0",
"ret",
"0",
"for dh, dw in itertools.product([-1, 0, 1], repeat=2):\n ret += (h + dh, w + dw) in hist\n ",
"dh",
"dw",
"itertools.product([-1, 0, 1], repeat=2)",
"itertools.product",
"itertools",
"product",
"[-1, 0, 1]",
"-1",
"0",
"1",
"repeat=2",
"repeat",
"2",
"ret += (h + dh, w + dw) in hist",
"ret",
"(h + dh, w + dw) in hist",
"(h + dh, w + dw)",
"h + dh",
"h",
"dh",
"w + dw",
"w",
"dw",
"hist",
"return ret",
"ret",
"h",
"h",
"w",
"w",
"def ok(a=1, b=1):\n return 1 < a < H and 1 < b < W",
"ok",
"return 1 < a < H and 1 < b < W",
"1 < a < H and 1 < b < W",
"1 < a < H",
"1 < a",
"1",
"a",
"H",
"1 < b < W",
"1 < b",
"1",
"b",
"W",
"a=1",
"a",
"1",
"b=1",
"b",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"ans[0] = (H - 2) * (W - 2)",
"ans[0]",
"ans",
"0",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"for a, b in AB:\n hist.add((a, b))\n for dh, dw in itertools.product([-1, 0, 1], repeat=2):\n if not ok(a + dh, b + dw):\n continue\n c = count(a + dh, b + dw)\n ans[c] += 1\n ans[c - 1] -= 1",
"a",
"b",
"AB",
"hist.add((a, b))",
"hist.add",
"hist",
"add",
"(a, b)",
"a",
"b",
"for dh, dw in itertools.product([-1, 0, 1], repeat=2):\n if not ok(a + dh, b + dw):\n continue\n c = count(a + dh, b + dw)\n ans[c] += 1\n ans[c - 1] -= 1",
"dh",
"dw",
"itertools.product([-1, 0, 1], repeat=2)",
"itertools.product",
"itertools",
"product",
"[-1, 0, 1]",
"-1",
"0",
"1",
"repeat=2",
"repeat",
"2",
"if not ok(a + dh, b + dw):\n continue\n ",
"not ok(a + dh, b + dw)",
"ok(a + dh, b + dw)",
"ok",
"a + dh",
"a",
"dh",
"b + dw",
"b",
"dw",
"continue",
"c = count(a + dh, b + dw)",
"c",
"count(a + dh, b + dw)",
"count",
"a + dh",
"a",
"dh",
"b + dw",
"b",
"dw",
"ans[c] += 1",
"ans[c]",
"ans",
"c",
"1",
"ans[c - 1] -= 1",
"ans[c - 1]",
"ans",
"c - 1",
"c",
"1",
"1",
"print('\\n'.join(map(str, ans)))",
"print",
"'\\n'.join(map(str, ans))",
"'\\n'.join",
"'\\n'",
"join",
"map(str, ans)",
"map",
"str",
"ans",
"IINF = 10 ** 18",
"10 ** 18",
"IINF",
"ans = [0] * 10",
"[0] * 10",
"ans",
"AB = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]",
"[list(map(int, sys.stdin.readline().split())) for _ in range(N)]",
"AB",
"def count(h, w):\n ret = 0\n for dh, dw in itertools.product([-1, 0, 1], repeat=2):\n ret += (h + dh, w + dw) in hist\n return ret",
"def count(h, w):\n ret = 0\n for dh, dw in itertools.product([-1, 0, 1], repeat=2):\n ret += (h + dh, w + dw) in hist\n return ret",
"count",
"W, N = list(map(int, sys.stdin.readline().split()))",
"list(map(int, sys.stdin.readline().split()))",
"W",
"N = list(map(int, sys.stdin.readline().split()))",
"list(map(int, sys.stdin.readline().split()))",
"N",
"H, W, N = list(map(int, sys.stdin.readline().split()))",
"list(map(int, sys.stdin.readline().split()))",
"H",
"def ok(a=1, b=1):\n return 1 < a < H and 1 < b < W",
"def ok(a=1, b=1):\n return 1 < a < H and 1 < b < W",
"ok",
"INF = float(\"inf\")",
"float(\"inf\")",
"INF",
"hist = set()",
"set()",
"hist",
"c = count(a + dh, b + dw)",
"count(a + dh, b + dw)",
"c"
] | import itertools
import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
H, W, N = list(map(int, sys.stdin.readline().split()))
AB = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
hist = set()
def count(h, w):
ret = 0
for dh, dw in itertools.product([-1, 0, 1], repeat=2):
ret += (h + dh, w + dw) in hist
return ret
def ok(a=1, b=1):
return 1 < a < H and 1 < b < W
ans = [0] * 10
ans[0] = (H - 2) * (W - 2)
for a, b in AB:
hist.add((a, b))
for dh, dw in itertools.product([-1, 0, 1], repeat=2):
if not ok(a + dh, b + dw):
continue
c = count(a + dh, b + dw)
ans[c] += 1
ans[c - 1] -= 1
print('\n'.join(map(str, ans)))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
2,
13,
17,
13,
2,
13,
17,
0,
13,
2,
2,
13,
17,
17,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
13,
2,
2,
13,
17,
17,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
13,
2,
2,
13,
17,
2,
13,
2,
13,
17,
0,
13,
2,
2,
13,
17,
2,
13,
2,
13,
17,
0,
13,
2,
13,
17,
0,
13,
2,
13,
17,
0,
13,
2,
13,
17,
0,
13,
2,
13,
17,
14,
13,
0,
13,
2,
13,
13,
14,
13,
0,
13,
2,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
14,
13,
0,
13,
2,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
14,
13,
0,
13,
2,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
14,
13,
0,
13,
2,
13,
13,
14,
13,
0,
13,
2,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
14,
13,
0,
13,
2,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
14,
13,
0,
13,
2,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
14,
13,
0,
13,
2,
13,
13,
14,
13,
0,
13,
2,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
14,
13,
0,
13,
2,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
14,
13,
0,
13,
2,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
17,
13,
10,
2,
13
] | [
[
420,
2
],
[
420,
11
],
[
420,
12
],
[
456,
14
],
[
18,
17
],
[
397,
20
],
[
423,
22
],
[
423,
31
],
[
441,
33
],
[
424,
35
],
[
442,
35
],
[
444,
37
],
[
388,
39
],
[
445,
39
],
[
429,
42
],
[
442,
45
],
[
424,
45
],
[
402,
49
],
[
442,
52
],
[
424,
52
],
[
406,
55
],
[
450,
58
],
[
445,
61
],
[
388,
61
],
[
390,
65
],
[
445,
68
],
[
388,
68
],
[
421,
71
],
[
393,
74
],
[
442,
77
],
[
424,
77
],
[
442,
80
],
[
424,
80
],
[
406,
82
],
[
447,
85
],
[
445,
88
],
[
388,
88
],
[
445,
91
],
[
388,
91
],
[
421,
93
],
[
435,
96
],
[
442,
98
],
[
424,
98
],
[
411,
101
],
[
442,
103
],
[
424,
103
],
[
378,
106
],
[
445,
108
],
[
388,
108
],
[
369,
111
],
[
445,
113
],
[
388,
113
],
[
459,
118
],
[
436,
120
],
[
421,
121
],
[
414,
125
],
[
460,
127
],
[
409,
127
],
[
382,
127
],
[
445,
128
],
[
388,
128
],
[
415,
131
],
[
385,
131
],
[
376,
131
],
[
454,
131
],
[
439,
131
],
[
427,
131
],
[
400,
131
],
[
433,
131
],
[
373,
131
],
[
457,
132
],
[
137,
134
],
[
457,
135
],
[
415,
136
],
[
385,
136
],
[
376,
136
],
[
454,
136
],
[
439,
136
],
[
427,
136
],
[
400,
136
],
[
433,
136
],
[
373,
136
],
[
142,
139
],
[
457,
140
],
[
415,
141
],
[
385,
141
],
[
376,
141
],
[
454,
141
],
[
439,
141
],
[
427,
141
],
[
400,
141
],
[
433,
141
],
[
373,
141
],
[
372,
146
],
[
460,
148
],
[
409,
148
],
[
382,
148
],
[
379,
149
],
[
373,
152
],
[
415,
152
],
[
385,
152
],
[
376,
152
],
[
454,
152
],
[
439,
152
],
[
427,
152
],
[
400,
152
],
[
433,
152
],
[
457,
153
],
[
158,
155
],
[
457,
156
],
[
373,
157
],
[
415,
157
],
[
385,
157
],
[
376,
157
],
[
454,
157
],
[
439,
157
],
[
427,
157
],
[
400,
157
],
[
433,
157
],
[
163,
160
],
[
457,
161
],
[
373,
162
],
[
415,
162
],
[
385,
162
],
[
376,
162
],
[
454,
162
],
[
439,
162
],
[
427,
162
],
[
400,
162
],
[
433,
162
],
[
432,
167
],
[
460,
169
],
[
409,
169
],
[
382,
169
],
[
370,
170
],
[
433,
173
],
[
373,
173
],
[
415,
173
],
[
385,
173
],
[
376,
173
],
[
454,
173
],
[
439,
173
],
[
427,
173
],
[
400,
173
],
[
457,
174
],
[
179,
176
],
[
457,
177
],
[
433,
178
],
[
373,
178
],
[
415,
178
],
[
385,
178
],
[
376,
178
],
[
454,
178
],
[
439,
178
],
[
427,
178
],
[
400,
178
],
[
184,
181
],
[
457,
182
],
[
433,
183
],
[
373,
183
],
[
415,
183
],
[
385,
183
],
[
376,
183
],
[
454,
183
],
[
439,
183
],
[
427,
183
],
[
400,
183
],
[
381,
188
],
[
412,
190
],
[
421,
191
],
[
399,
195
],
[
382,
197
],
[
460,
197
],
[
409,
197
],
[
445,
198
],
[
388,
198
],
[
400,
201
],
[
433,
201
],
[
373,
201
],
[
415,
201
],
[
385,
201
],
[
376,
201
],
[
454,
201
],
[
439,
201
],
[
427,
201
],
[
457,
202
],
[
207,
204
],
[
457,
205
],
[
400,
206
],
[
433,
206
],
[
373,
206
],
[
415,
206
],
[
385,
206
],
[
376,
206
],
[
454,
206
],
[
439,
206
],
[
427,
206
],
[
212,
209
],
[
457,
210
],
[
400,
211
],
[
433,
211
],
[
373,
211
],
[
415,
211
],
[
385,
211
],
[
376,
211
],
[
454,
211
],
[
439,
211
],
[
427,
211
],
[
426,
216
],
[
382,
218
],
[
460,
218
],
[
409,
218
],
[
379,
219
],
[
427,
222
],
[
400,
222
],
[
433,
222
],
[
373,
222
],
[
415,
222
],
[
385,
222
],
[
376,
222
],
[
454,
222
],
[
439,
222
],
[
457,
223
],
[
228,
225
],
[
457,
226
],
[
427,
227
],
[
400,
227
],
[
433,
227
],
[
373,
227
],
[
415,
227
],
[
385,
227
],
[
376,
227
],
[
454,
227
],
[
439,
227
],
[
233,
230
],
[
457,
231
],
[
427,
232
],
[
400,
232
],
[
433,
232
],
[
373,
232
],
[
415,
232
],
[
385,
232
],
[
376,
232
],
[
454,
232
],
[
439,
232
],
[
438,
237
],
[
382,
239
],
[
460,
239
],
[
409,
239
],
[
370,
240
],
[
439,
243
],
[
427,
243
],
[
400,
243
],
[
433,
243
],
[
373,
243
],
[
415,
243
],
[
385,
243
],
[
376,
243
],
[
454,
243
],
[
457,
244
],
[
249,
246
],
[
457,
247
],
[
439,
248
],
[
427,
248
],
[
400,
248
],
[
433,
248
],
[
373,
248
],
[
415,
248
],
[
385,
248
],
[
376,
248
],
[
454,
248
],
[
254,
251
],
[
457,
252
],
[
439,
253
],
[
427,
253
],
[
400,
253
],
[
433,
253
],
[
373,
253
],
[
415,
253
],
[
385,
253
],
[
376,
253
],
[
454,
253
],
[
408,
258
],
[
442,
260
],
[
424,
260
],
[
421,
261
],
[
453,
265
],
[
409,
267
],
[
382,
267
],
[
460,
267
],
[
445,
268
],
[
388,
268
],
[
454,
271
],
[
439,
271
],
[
427,
271
],
[
400,
271
],
[
433,
271
],
[
373,
271
],
[
415,
271
],
[
385,
271
],
[
376,
271
],
[
457,
272
],
[
277,
274
],
[
457,
275
],
[
454,
276
],
[
439,
276
],
[
427,
276
],
[
400,
276
],
[
433,
276
],
[
373,
276
],
[
415,
276
],
[
385,
276
],
[
376,
276
],
[
282,
279
],
[
457,
280
],
[
454,
281
],
[
439,
281
],
[
427,
281
],
[
400,
281
],
[
433,
281
],
[
373,
281
],
[
415,
281
],
[
385,
281
],
[
376,
281
],
[
375,
286
],
[
409,
288
],
[
382,
288
],
[
460,
288
],
[
379,
289
],
[
376,
292
],
[
454,
292
],
[
439,
292
],
[
427,
292
],
[
400,
292
],
[
433,
292
],
[
373,
292
],
[
415,
292
],
[
385,
292
],
[
457,
293
],
[
298,
295
],
[
457,
296
],
[
376,
297
],
[
454,
297
],
[
439,
297
],
[
427,
297
],
[
400,
297
],
[
433,
297
],
[
373,
297
],
[
415,
297
],
[
385,
297
],
[
303,
300
],
[
457,
301
],
[
376,
302
],
[
454,
302
],
[
439,
302
],
[
427,
302
],
[
400,
302
],
[
433,
302
],
[
373,
302
],
[
415,
302
],
[
385,
302
],
[
384,
307
],
[
409,
309
],
[
382,
309
],
[
460,
309
],
[
370,
310
],
[
385,
313
],
[
376,
313
],
[
454,
313
],
[
439,
313
],
[
427,
313
],
[
400,
313
],
[
433,
313
],
[
373,
313
],
[
415,
313
],
[
457,
314
],
[
319,
316
],
[
457,
317
],
[
385,
318
],
[
376,
318
],
[
454,
318
],
[
439,
318
],
[
427,
318
],
[
400,
318
],
[
433,
318
],
[
373,
318
],
[
415,
318
],
[
324,
321
],
[
457,
322
],
[
385,
323
],
[
376,
323
],
[
454,
323
],
[
439,
323
],
[
427,
323
],
[
400,
323
],
[
433,
323
],
[
373,
323
],
[
415,
323
],
[
328,
327
],
[
417,
334
],
[
338,
337
],
[
457,
340
],
[
346,
343
],
[
418,
344
],
[
337,
345
],
[
351,
348
],
[
418,
349
],
[
406,
354
],
[
421,
357
],
[
418,
361
],
[
364,
363
],
[
418,
363
],
[
363,
367
],
[
369,
370
],
[
372,
373
],
[
375,
376
],
[
378,
379
],
[
381,
382
],
[
384,
385
],
[
423,
388
],
[
390,
391
],
[
393,
394
],
[
420,
397
],
[
399,
400
],
[
402,
403
],
[
420,
406
],
[
408,
409
],
[
411,
412
],
[
414,
415
],
[
417,
418
],
[
420,
421
],
[
423,
424
],
[
426,
427
],
[
429,
430
],
[
432,
433
],
[
435,
436
],
[
438,
439
],
[
441,
442
],
[
444,
445
],
[
447,
448
],
[
450,
451
],
[
453,
454
],
[
456,
457
],
[
459,
460
]
] | [
"\nh,w,n = map(int,input().split())\nd = {}\nfor i in range(n):\n a,b = map(int,input().split())\n a,b = a-1,b-1\n\n am1_f = a-1 > 0\n ap1_f = a+1 < h-1\n bm1_f = b-1 > 0\n bp1_f = b+1 < w-1\n a_f = a > 0 and a < h-1\n b_f = b > 0 and b < w-1\n\n am1 = a-1\n ap1 = a+1\n bm1 = b-1\n bp1 = b+1\n\n if am1_f:\n baseid = am1 * w\n if b_f:\n pid = baseid + b\n\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bm1_f:\n pid = baseid + bm1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bp1_f:\n pid = baseid + bp1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if ap1_f:\n baseid = ap1*w\n if b_f:\n pid = baseid + b\n\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bm1_f:\n pid = baseid + bm1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bp1_f:\n pid = baseid + bp1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n if a_f:\n\n baseid = a * w\n if b_f:\n pid = baseid + b\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bm1_f:\n pid = baseid + bm1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bp1_f:\n pid = baseid + bp1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n # print(d)\n\nans = [0 for i in range(10)]\n\nfor val in d.values():\n ans[val] += 1\n\nans[0] = (h-2)*(w-2)-sum(ans)\n\nfor a in ans:\n print(a)",
"h,w,n = map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"d = {}",
"d",
"{}",
"for i in range(n):\n a,b = map(int,input().split())\n a,b = a-1,b-1\n\n am1_f = a-1 > 0\n ap1_f = a+1 < h-1\n bm1_f = b-1 > 0\n bp1_f = b+1 < w-1\n a_f = a > 0 and a < h-1\n b_f = b > 0 and b < w-1\n\n am1 = a-1\n ap1 = a+1\n bm1 = b-1\n bp1 = b+1\n\n if am1_f:\n baseid = am1 * w\n if b_f:\n pid = baseid + b\n\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bm1_f:\n pid = baseid + bm1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bp1_f:\n pid = baseid + bp1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if ap1_f:\n baseid = ap1*w\n if b_f:\n pid = baseid + b\n\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bm1_f:\n pid = baseid + bm1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bp1_f:\n pid = baseid + bp1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n if a_f:\n\n baseid = a * w\n if b_f:\n pid = baseid + b\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bm1_f:\n pid = baseid + bm1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bp1_f:\n pid = baseid + bp1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n # print(d)",
"i",
"range(n)",
"range",
"n",
"a,b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"a,b = a-1,b-1",
"a",
"a-1",
"a",
"1",
"b",
"b-1",
"b",
"1",
"am1_f = a-1 > 0",
"am1_f",
"a-1 > 0",
"a-1",
"a",
"1",
"0",
"ap1_f = a+1 < h-1",
"ap1_f",
"a+1 < h-1",
"a+1",
"a",
"1",
"h-1",
"h",
"1",
"bm1_f = b-1 > 0",
"bm1_f",
"b-1 > 0",
"b-1",
"b",
"1",
"0",
"bp1_f = b+1 < w-1",
"bp1_f",
"b+1 < w-1",
"b+1",
"b",
"1",
"w-1",
"w",
"1",
"a_f = a > 0 and a < h-1",
"a_f",
"a > 0 and a < h-1",
"a > 0",
"a",
"0",
"a < h-1",
"a",
"h-1",
"h",
"1",
"b_f = b > 0 and b < w-1",
"b_f",
"b > 0 and b < w-1",
"b > 0",
"b",
"0",
"b < w-1",
"b",
"w-1",
"w",
"1",
"am1 = a-1",
"am1",
"a-1",
"a",
"1",
"ap1 = a+1",
"ap1",
"a+1",
"a",
"1",
"bm1 = b-1",
"bm1",
"b-1",
"b",
"1",
"bp1 = b+1",
"bp1",
"b+1",
"b",
"1",
"if am1_f:\n baseid = am1 * w\n if b_f:\n pid = baseid + b\n\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bm1_f:\n pid = baseid + bm1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bp1_f:\n pid = baseid + bp1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"am1_f",
"baseid = am1 * w",
"baseid",
"am1 * w",
"am1",
"w",
"if b_f:\n pid = baseid + b\n\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"b_f",
"pid = baseid + b",
"pid",
"baseid + b",
"baseid",
"b",
"if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"pid not in d",
"pid",
"d",
"d[pid] = 1",
"d[pid]",
"d",
"pid",
"1",
"d[pid] += 1",
"d[pid]",
"d",
"pid",
"1",
"if bm1_f:\n pid = baseid + bm1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"bm1_f",
"pid = baseid + bm1",
"pid",
"baseid + bm1",
"baseid",
"bm1",
"if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"pid not in d",
"pid",
"d",
"d[pid] = 1",
"d[pid]",
"d",
"pid",
"1",
"d[pid] += 1",
"d[pid]",
"d",
"pid",
"1",
"if bp1_f:\n pid = baseid + bp1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"bp1_f",
"pid = baseid + bp1",
"pid",
"baseid + bp1",
"baseid",
"bp1",
"if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"pid not in d",
"pid",
"d",
"d[pid] = 1",
"d[pid]",
"d",
"pid",
"1",
"d[pid] += 1",
"d[pid]",
"d",
"pid",
"1",
"if ap1_f:\n baseid = ap1*w\n if b_f:\n pid = baseid + b\n\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bm1_f:\n pid = baseid + bm1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bp1_f:\n pid = baseid + bp1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n ",
"ap1_f",
"baseid = ap1*w",
"baseid",
"ap1*w",
"ap1",
"w",
"if b_f:\n pid = baseid + b\n\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"b_f",
"pid = baseid + b",
"pid",
"baseid + b",
"baseid",
"b",
"if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"pid not in d",
"pid",
"d",
"d[pid] = 1",
"d[pid]",
"d",
"pid",
"1",
"d[pid] += 1",
"d[pid]",
"d",
"pid",
"1",
"if bm1_f:\n pid = baseid + bm1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"bm1_f",
"pid = baseid + bm1",
"pid",
"baseid + bm1",
"baseid",
"bm1",
"if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"pid not in d",
"pid",
"d",
"d[pid] = 1",
"d[pid]",
"d",
"pid",
"1",
"d[pid] += 1",
"d[pid]",
"d",
"pid",
"1",
"if bp1_f:\n pid = baseid + bp1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n ",
"bp1_f",
"pid = baseid + bp1",
"pid",
"baseid + bp1",
"baseid",
"bp1",
"if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n ",
"pid not in d",
"pid",
"d",
"d[pid] = 1",
"d[pid]",
"d",
"pid",
"1",
"d[pid] += 1",
"d[pid]",
"d",
"pid",
"1",
"if a_f:\n\n baseid = a * w\n if b_f:\n pid = baseid + b\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bm1_f:\n pid = baseid + bm1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n if bp1_f:\n pid = baseid + bp1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n # print(d)",
"a_f",
"baseid = a * w",
"baseid",
"a * w",
"a",
"w",
"if b_f:\n pid = baseid + b\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"b_f",
"pid = baseid + b",
"pid",
"baseid + b",
"baseid",
"b",
"if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"pid not in d",
"pid",
"d",
"d[pid] = 1",
"d[pid]",
"d",
"pid",
"1",
"d[pid] += 1",
"d[pid]",
"d",
"pid",
"1",
"if bm1_f:\n pid = baseid + bm1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"bm1_f",
"pid = baseid + bm1",
"pid",
"baseid + bm1",
"baseid",
"bm1",
"if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n\n ",
"pid not in d",
"pid",
"d",
"d[pid] = 1",
"d[pid]",
"d",
"pid",
"1",
"d[pid] += 1",
"d[pid]",
"d",
"pid",
"1",
"if bp1_f:\n pid = baseid + bp1\n if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n # print(d)",
"bp1_f",
"pid = baseid + bp1",
"pid",
"baseid + bp1",
"baseid",
"bp1",
"if pid not in d:\n d[pid] = 1\n else:\n d[pid] += 1\n # print(d)",
"pid not in d",
"pid",
"d",
"d[pid] = 1",
"d[pid]",
"d",
"pid",
"1",
"d[pid] += 1",
"d[pid]",
"d",
"pid",
"1",
"0 for i in range(10)",
"for i in range(10)",
"i",
"range(10)",
"range",
"10",
"for i in range(10)",
"0",
"ans = [0 for i in range(10)]",
"ans",
"[0 for i in range(10)]",
"for val in d.values():\n ans[val] += 1",
"val",
"d.values()",
"d.values",
"d",
"values",
"ans[val] += 1",
"ans[val]",
"ans",
"val",
"1",
"ans[0] = (h-2)*(w-2)-sum(ans)",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)-sum(ans)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"for a in ans:\n print(a)",
"a",
"ans",
"print(a)",
"print",
"a",
"bp1 = b+1",
"b+1",
"bp1",
"pid = baseid + bm1",
"baseid + bm1",
"pid",
"pid = baseid + bm1",
"baseid + bm1",
"pid",
"bm1 = b-1",
"b-1",
"bm1",
"baseid = ap1*w",
"ap1*w",
"baseid",
"pid = baseid + bp1",
"baseid + bp1",
"pid",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"bp1_f = b+1 < w-1",
"b+1 < w-1",
"bp1_f",
"a_f = a > 0 and a < h-1",
"a > 0 and a < h-1",
"a_f",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"pid = baseid + b",
"baseid + b",
"pid",
"ap1_f = a+1 < h-1",
"a+1 < h-1",
"ap1_f",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h",
"baseid = a * w",
"a * w",
"baseid",
"ap1 = a+1",
"a+1",
"ap1",
"pid = baseid + b",
"baseid + b",
"pid",
"ans = [0 for i in range(10)]",
"[0 for i in range(10)]",
"ans",
"w,n = map(int,input().split())",
"map(int,input().split())",
"w",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"pid = baseid + bm1",
"baseid + bm1",
"pid",
"am1_f = a-1 > 0",
"a-1 > 0",
"am1_f",
"pid = baseid + bp1",
"baseid + bp1",
"pid",
"am1 = a-1",
"a-1",
"am1",
"pid = baseid + bp1",
"baseid + bp1",
"pid",
"a,b = a-1,b-1",
"a-1",
"a",
"b = a-1,b-1",
"b-1",
"b",
"b_f = b > 0 and b < w-1",
"b > 0 and b < w-1",
"b_f",
"bm1_f = b-1 > 0",
"b-1 > 0",
"bm1_f",
"pid = baseid + b",
"baseid + b",
"pid",
"d = {}",
"{}",
"d",
"baseid = am1 * w",
"am1 * w",
"baseid"
] |
h,w,n = map(int,input().split())
d = {}
for i in range(n):
a,b = map(int,input().split())
a,b = a-1,b-1
am1_f = a-1 > 0
ap1_f = a+1 < h-1
bm1_f = b-1 > 0
bp1_f = b+1 < w-1
a_f = a > 0 and a < h-1
b_f = b > 0 and b < w-1
am1 = a-1
ap1 = a+1
bm1 = b-1
bp1 = b+1
if am1_f:
baseid = am1 * w
if b_f:
pid = baseid + b
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if bm1_f:
pid = baseid + bm1
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if bp1_f:
pid = baseid + bp1
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if ap1_f:
baseid = ap1*w
if b_f:
pid = baseid + b
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if bm1_f:
pid = baseid + bm1
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if bp1_f:
pid = baseid + bp1
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if a_f:
baseid = a * w
if b_f:
pid = baseid + b
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if bm1_f:
pid = baseid + bm1
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
if bp1_f:
pid = baseid + bp1
if pid not in d:
d[pid] = 1
else:
d[pid] += 1
# print(d)
ans = [0 for i in range(10)]
for val in d.values():
ans[val] += 1
ans[0] = (h-2)*(w-2)-sum(ans)
for a in ans:
print(a)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
0,
13,
2,
39,
17,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
0,
13,
2,
13,
13,
13,
2,
13,
13,
14,
2,
2,
2,
17,
13,
13,
2,
2,
17,
13,
13,
0,
13,
2,
2,
13,
13,
13,
14,
40,
2,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
17,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
2,
18,
13,
13,
17,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13
] | [
[
152,
2
],
[
152,
11
],
[
152,
12
],
[
161,
14
],
[
140,
18
],
[
25,
24
],
[
153,
27
],
[
155,
29
],
[
155,
38
],
[
41,
40
],
[
47,
46
],
[
146,
52
],
[
156,
54
],
[
40,
55
],
[
164,
56
],
[
150,
58
],
[
46,
59
],
[
147,
65
],
[
138,
66
],
[
165,
70
],
[
144,
71
],
[
158,
73
],
[
147,
76
],
[
144,
77
],
[
165,
78
],
[
159,
82
],
[
162,
83
],
[
88,
85
],
[
162,
86
],
[
159,
87
],
[
93,
90
],
[
141,
91
],
[
100,
95
],
[
141,
96
],
[
111,
97
],
[
85,
97
],
[
162,
98
],
[
159,
99
],
[
109,
102
],
[
141,
103
],
[
111,
105
],
[
85,
105
],
[
162,
106
],
[
159,
107
],
[
114,
111
],
[
162,
112
],
[
159,
113
],
[
119,
116
],
[
141,
117
],
[
138,
122
],
[
144,
125
],
[
141,
129
],
[
132,
131
],
[
141,
131
],
[
131,
135
],
[
152,
138
],
[
140,
141
],
[
152,
144
],
[
146,
147
],
[
155,
150
],
[
152,
153
],
[
155,
156
],
[
158,
159
],
[
161,
162
],
[
164,
165
]
] | [
"h, w, n = map(int, input().split())\nd = dict()\nans = [0] * 10\nfor _ in range(n):\n a, b = map(int, input().split())\n for i in range(-1, 2):\n for j in range(-1, 2):\n x, y = a + i, b + j\n if 1 < x < h and 1 < y < w:\n k = x * w + y\n if not k in d:\n d[k] = 1\n ans[1] += 1\n else:\n ans[d[k]] -= 1\n ans[d[k] + 1] += 1\n d[k] += 1\nans[0] = (h - 2) * (w - 2) - sum(ans)\nfor i in ans:\n print(i)",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"d = dict()",
"d",
"dict()",
"dict",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for _ in range(n):\n a, b = map(int, input().split())\n for i in range(-1, 2):\n for j in range(-1, 2):\n x, y = a + i, b + j\n if 1 < x < h and 1 < y < w:\n k = x * w + y\n if not k in d:\n d[k] = 1\n ans[1] += 1\n else:\n ans[d[k]] -= 1\n ans[d[k] + 1] += 1\n d[k] += 1",
"_",
"range(n)",
"range",
"n",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in range(-1, 2):\n for j in range(-1, 2):\n x, y = a + i, b + j\n if 1 < x < h and 1 < y < w:\n k = x * w + y\n if not k in d:\n d[k] = 1\n ans[1] += 1\n else:\n ans[d[k]] -= 1\n ans[d[k] + 1] += 1\n d[k] += 1",
"i",
"range(-1, 2)",
"range",
"-1",
"2",
"for j in range(-1, 2):\n x, y = a + i, b + j\n if 1 < x < h and 1 < y < w:\n k = x * w + y\n if not k in d:\n d[k] = 1\n ans[1] += 1\n else:\n ans[d[k]] -= 1\n ans[d[k] + 1] += 1\n d[k] += 1",
"j",
"range(-1, 2)",
"range",
"-1",
"2",
"x, y = a + i, b + j",
"x",
"a + i",
"a",
"i",
"y",
"b + j",
"b",
"j",
"if 1 < x < h and 1 < y < w:\n k = x * w + y\n if not k in d:\n d[k] = 1\n ans[1] += 1\n else:\n ans[d[k]] -= 1\n ans[d[k] + 1] += 1\n d[k] += 1",
"1 < x < h and 1 < y < w",
"1 < x < h",
"1 < x",
"1",
"x",
"h",
"1 < y < w",
"1 < y",
"1",
"y",
"w",
"k = x * w + y",
"k",
"x * w + y",
"x * w",
"x",
"w",
"y",
"if not k in d:\n d[k] = 1\n ans[1] += 1\n else:\n ans[d[k]] -= 1\n ans[d[k] + 1] += 1\n d[k] += 1",
"not k in d",
"k in d",
"k",
"d",
"d[k] = 1",
"d[k]",
"d",
"k",
"1",
"ans[1] += 1",
"ans[1]",
"ans",
"1",
"1",
"ans[d[k]] -= 1",
"ans[d[k]]",
"ans",
"d[k]",
"d",
"k",
"1",
"ans[d[k] + 1] += 1",
"ans[d[k] + 1]",
"ans",
"d[k] + 1",
"d[k]",
"d",
"k",
"1",
"1",
"d[k] += 1",
"d[k]",
"d",
"k",
"1",
"ans[0] = (h - 2) * (w - 2) - sum(ans)",
"ans[0]",
"ans",
"0",
"(h - 2) * (w - 2) - sum(ans)",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"ans = [0] * 10",
"[0] * 10",
"ans",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"x, y = a + i, b + j",
"a + i",
"x",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"k = x * w + y",
"x * w + y",
"k",
"d = dict()",
"dict()",
"d",
"y = a + i, b + j",
"b + j",
"y"
] | h, w, n = map(int, input().split())
d = dict()
ans = [0] * 10
for _ in range(n):
a, b = map(int, input().split())
for i in range(-1, 2):
for j in range(-1, 2):
x, y = a + i, b + j
if 1 < x < h and 1 < y < w:
k = x * w + y
if not k in d:
d[k] = 1
ans[1] += 1
else:
ans[d[k]] -= 1
ans[d[k] + 1] += 1
d[k] += 1
ans[0] = (h - 2) * (w - 2) - sum(ans)
for i in ans:
print(i) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
15,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
2,
2,
17,
2,
13,
13,
2,
13,
17,
2,
2,
17,
2,
13,
13,
2,
13,
17,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
4,
18,
13,
13,
0,
13,
2,
39,
17,
17,
28,
13,
4,
13,
17,
17,
0,
18,
13,
13,
4,
18,
13,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
148,
2
],
[
148,
11
],
[
148,
12
],
[
145,
15
],
[
19,
18
],
[
149,
21
],
[
154,
23
],
[
154,
32
],
[
35,
34
],
[
40,
39
],
[
152,
49
],
[
34,
50
],
[
137,
52
],
[
155,
58
],
[
39,
59
],
[
131,
61
],
[
146,
65
],
[
152,
69
],
[
34,
70
],
[
155,
72
],
[
39,
73
],
[
133,
75
],
[
146,
78
],
[
142,
80
],
[
134,
85
],
[
139,
88
],
[
95,
94
],
[
103,
100
],
[
140,
101
],
[
94,
102
],
[
143,
105
],
[
94,
107
],
[
112,
109
],
[
140,
110
],
[
137,
115
],
[
131,
118
],
[
140,
122
],
[
125,
124
],
[
140,
124
],
[
124,
128
],
[
148,
131
],
[
133,
134
],
[
148,
137
],
[
139,
140
],
[
142,
143
],
[
145,
146
],
[
148,
149
],
[
154,
152
],
[
154,
155
]
] | [
"h,w,n = map(int, input().split())\n\nfrom collections import Counter\nd = []\n\nfor _ in range(n):\n a,b = map(int,input().split())\n for k in range(3):\n for l in range(3):\n if 0 < a-k < h-1 and 0 < b-l < w-1:\n d.append((a-k,b-l))\n\ndd = Counter(d)\nddd = list(dd.values())\n\nans = [0]*10\n\nfor i in range(1,10):\n ans[i] = ddd.count(i)\n\nans[0] = (h-2)*(w-2) - sum(ans)\n\nfor x in ans:\n print(x)",
"h,w,n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"from collections import Counter",
"d = []",
"d",
"[]",
"for _ in range(n):\n a,b = map(int,input().split())\n for k in range(3):\n for l in range(3):\n if 0 < a-k < h-1 and 0 < b-l < w-1:\n d.append((a-k,b-l))",
"_",
"range(n)",
"range",
"n",
"a,b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for k in range(3):\n for l in range(3):\n if 0 < a-k < h-1 and 0 < b-l < w-1:\n d.append((a-k,b-l))",
"k",
"range(3)",
"range",
"3",
"for l in range(3):\n if 0 < a-k < h-1 and 0 < b-l < w-1:\n d.append((a-k,b-l))",
"l",
"range(3)",
"range",
"3",
"if 0 < a-k < h-1 and 0 < b-l < w-1:\n d.append((a-k,b-l))",
"0 < a-k < h-1 and 0 < b-l < w-1",
"0 < a-k < h-1",
"0 < a-k",
"0",
"a-k",
"a",
"k",
"h-1",
"h",
"1",
"0 < b-l < w-1",
"0 < b-l",
"0",
"b-l",
"b",
"l",
"w-1",
"w",
"1",
"d.append((a-k,b-l))",
"d.append",
"d",
"append",
"(a-k,b-l)",
"a-k",
"a",
"k",
"b-l",
"b",
"l",
"dd = Counter(d)",
"dd",
"Counter(d)",
"Counter",
"d",
"ddd = list(dd.values())",
"ddd",
"list(dd.values())",
"list",
"dd.values()",
"dd.values",
"dd",
"values",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for i in range(1,10):\n ans[i] = ddd.count(i)",
"i",
"range(1,10)",
"range",
"1",
"10",
"ans[i] = ddd.count(i)",
"ans[i]",
"ans",
"i",
"ddd.count(i)",
"ddd.count",
"ddd",
"count",
"i",
"ans[0] = (h-2)*(w-2) - sum(ans)",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2) - sum(ans)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"for x in ans:\n print(x)",
"x",
"ans",
"print(x)",
"print",
"x",
"w,n = map(int, input().split())",
"map(int, input().split())",
"w",
"dd = Counter(d)",
"Counter(d)",
"dd",
"h,w,n = map(int, input().split())",
"map(int, input().split())",
"h",
"ans = [0]*10",
"[0]*10",
"ans",
"ddd = list(dd.values())",
"list(dd.values())",
"ddd",
"d = []",
"[]",
"d",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"b = map(int,input().split())",
"map(int,input().split())",
"b"
] | h,w,n = map(int, input().split())
from collections import Counter
d = []
for _ in range(n):
a,b = map(int,input().split())
for k in range(3):
for l in range(3):
if 0 < a-k < h-1 and 0 < b-l < w-1:
d.append((a-k,b-l))
dd = Counter(d)
ddd = list(dd.values())
ans = [0]*10
for i in range(1,10):
ans[i] = ddd.count(i)
ans[0] = (h-2)*(w-2) - sum(ans)
for x in ans:
print(x) |
[
7,
15,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
28,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
0,
18,
13,
2,
2,
13,
17,
2,
13,
17,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
13,
14,
2,
2,
2,
17,
13,
2,
13,
17,
2,
2,
17,
13,
2,
13,
17,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
4,
13,
31,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] | [
[
141,
3
],
[
141,
14
],
[
141,
15
],
[
19,
18
],
[
133,
21
],
[
129,
34
],
[
135,
37
],
[
123,
46
],
[
120,
49
],
[
53,
52
],
[
66,
57
],
[
136,
58
],
[
124,
61
],
[
52,
64
],
[
138,
68
],
[
121,
82
],
[
142,
84
],
[
124,
89
],
[
127,
91
],
[
99,
94
],
[
139,
95
],
[
136,
97
],
[
124,
98
],
[
104,
101
],
[
139,
102
],
[
127,
107
],
[
142,
110
],
[
139,
114
],
[
139,
118
],
[
120,
121
],
[
123,
124
],
[
141,
127
],
[
129,
130
],
[
141,
133
],
[
135,
136
],
[
138,
139
],
[
141,
142
]
] | [
"from collections import defaultdict\n\nH, W, N = list(map(int, input().split()))\nYX = [list(map(int, input().split())) for _ in range(N)]\n\nmemo = defaultdict(int)\nfor y, x in YX:\n y -= 1; x -= 1\n for i in range(9):\n memo[y - 1 + i//3, x - 1 + i%3] += 1\n\nans = [0] * 10\nfor y, x in memo:\n if 0 < x < W-1 and 0 < y < H-1:\n ans[memo[y, x]] += 1\nans[0] = (H - 2) * (W - 2) - sum(ans)\nprint(*ans)",
"from collections import defaultdict",
"H, W, N = list(map(int, input().split()))",
"H",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"list(map(int, input().split())) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"YX = [list(map(int, input().split())) for _ in range(N)]",
"YX",
"[list(map(int, input().split())) for _ in range(N)]",
"memo = defaultdict(int)",
"memo",
"defaultdict(int)",
"defaultdict",
"int",
"for y, x in YX:\n y -= 1; x -= 1\n for i in range(9):\n memo[y - 1 + i//3, x - 1 + i%3] += 1",
"y",
"x",
"YX",
"y -= 1",
"y",
"1",
"x -= 1",
"x",
"1",
"for i in range(9):\n memo[y - 1 + i//3, x - 1 + i%3] += 1",
"i",
"range(9)",
"range",
"9",
"memo[y - 1 + i//3, x - 1 + i%3] += 1",
"memo[y - 1 + i//3, x - 1 + i%3]",
"memo",
"y - 1 + i//3",
"y - 1",
"y",
"1",
"i//3",
"i",
"3",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for y, x in memo:\n if 0 < x < W-1 and 0 < y < H-1:\n ans[memo[y, x]] += 1",
"y",
"x",
"memo",
"if 0 < x < W-1 and 0 < y < H-1:\n ans[memo[y, x]] += 1",
"0 < x < W-1 and 0 < y < H-1",
"0 < x < W-1",
"0 < x",
"0",
"x",
"W-1",
"W",
"1",
"0 < y < H-1",
"0 < y",
"0",
"y",
"H-1",
"H",
"1",
"ans[memo[y, x]] += 1",
"ans[memo[y, x]]",
"ans",
"memo[y, x]",
"memo",
"y",
"1",
"ans[0] = (H - 2) * (W - 2) - sum(ans)",
"ans[0]",
"ans",
"0",
"(H - 2) * (W - 2) - sum(ans)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(ans)",
"sum",
"ans",
"print(*ans)",
"print",
"*ans",
"ans",
"x -= 1",
"1",
"x",
"y -= 1",
"1",
"y",
"H, W, N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"H",
"YX = [list(map(int, input().split())) for _ in range(N)]",
"[list(map(int, input().split())) for _ in range(N)]",
"YX",
"N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"N",
"memo = defaultdict(int)",
"defaultdict(int)",
"memo",
"ans = [0] * 10",
"[0] * 10",
"ans",
"W, N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"W"
] | from collections import defaultdict
H, W, N = list(map(int, input().split()))
YX = [list(map(int, input().split())) for _ in range(N)]
memo = defaultdict(int)
for y, x in YX:
y -= 1; x -= 1
for i in range(9):
memo[y - 1 + i//3, x - 1 + i%3] += 1
ans = [0] * 10
for y, x in memo:
if 0 < x < W-1 and 0 < y < H-1:
ans[memo[y, x]] += 1
ans[0] = (H - 2) * (W - 2) - sum(ans)
print(*ans) |
[
7,
15,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
13,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
13,
0,
18,
13,
39,
13,
13,
17,
0,
13,
4,
13,
4,
18,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
126,
4
],
[
126,
13
],
[
126,
14
],
[
129,
16
],
[
135,
22
],
[
28,
27
],
[
124,
30
],
[
138,
32
],
[
138,
41
],
[
44,
43
],
[
139,
50
],
[
139,
55
],
[
127,
57
],
[
60,
59
],
[
133,
66
],
[
133,
71
],
[
118,
73
],
[
80,
75
],
[
136,
76
],
[
120,
82
],
[
136,
87
],
[
127,
94
],
[
118,
97
],
[
121,
103
],
[
139,
103
],
[
107,
106
],
[
121,
114
],
[
139,
114
],
[
106,
115
],
[
126,
118
],
[
120,
121
],
[
126,
124
],
[
126,
127
],
[
129,
130
],
[
138,
133
],
[
135,
136
],
[
138,
139
]
] | [
"from collections import defaultdict as de\nfrom collections import Counter as C\nh,w,n=map(int,input().split())\ns=[0]*10\nc=de(int)\nfor i in range(n):\n a,b=map(int,input().split())\n for j in range(max(2,a-1),min(a+2,h)):\n for q in range(max(2,b-1),min(b+2,w)):\n c[(j,q)]+=1\na=C(c.values())\nprint((h-2)*(w-2)-sum(a.values()))\nfor i in range(1,10):\n print(a[i])",
"from collections import defaultdict as de",
"from collections import Counter as C",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"s=[0]*10",
"s",
"[0]*10",
"[0]",
"0",
"10",
"c=de(int)",
"c",
"de(int)",
"de",
"int",
"for i in range(n):\n a,b=map(int,input().split())\n for j in range(max(2,a-1),min(a+2,h)):\n for q in range(max(2,b-1),min(b+2,w)):\n c[(j,q)]+=1",
"i",
"range(n)",
"range",
"n",
"a,b=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for j in range(max(2,a-1),min(a+2,h)):\n for q in range(max(2,b-1),min(b+2,w)):\n c[(j,q)]+=1",
"j",
"range(max(2,a-1),min(a+2,h))",
"range",
"max(2,a-1)",
"max",
"2",
"a-1",
"a",
"1",
"min(a+2,h)",
"min",
"a+2",
"a",
"2",
"h",
"for q in range(max(2,b-1),min(b+2,w)):\n c[(j,q)]+=1",
"q",
"range(max(2,b-1),min(b+2,w))",
"range",
"max(2,b-1)",
"max",
"2",
"b-1",
"b",
"1",
"min(b+2,w)",
"min",
"b+2",
"b",
"2",
"w",
"c[(j,q)]+=1",
"c[(j,q)]",
"c",
"(j,q)",
"j",
"q",
"1",
"a=C(c.values())",
"a",
"C(c.values())",
"C",
"c.values()",
"c.values",
"c",
"values",
"print((h-2)*(w-2)-sum(a.values()))",
"print",
"(h-2)*(w-2)-sum(a.values())",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(a.values())",
"sum",
"a.values()",
"a.values",
"a",
"values",
"for i in range(1,10):\n print(a[i])",
"i",
"range(1,10)",
"range",
"1",
"10",
"print(a[i])",
"print",
"a[i]",
"a",
"i",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"a=C(c.values())",
"C(c.values())",
"a",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"s=[0]*10",
"[0]*10",
"s",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"c=de(int)",
"de(int)",
"c",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a"
] | from collections import defaultdict as de
from collections import Counter as C
h,w,n=map(int,input().split())
s=[0]*10
c=de(int)
for i in range(n):
a,b=map(int,input().split())
for j in range(max(2,a-1),min(a+2,h)):
for q in range(max(2,b-1),min(b+2,w)):
c[(j,q)]+=1
a=C(c.values())
print((h-2)*(w-2)-sum(a.values()))
for i in range(1,10):
print(a[i]) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
15,
15,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
4,
18,
13,
13,
39,
13,
13,
4,
18,
13,
13,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
0,
13,
17,
28,
13,
13,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
0,
13,
2,
18,
13,
17,
13,
0,
13,
2,
18,
13,
17,
13,
14,
2,
2,
2,
2,
13,
17,
2,
13,
17,
40,
2,
13,
17,
13,
40,
2,
13,
17,
13,
9,
0,
13,
2,
2,
4,
13,
13,
17,
4,
13,
13,
38,
5,
0,
13,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
13,
17,
0,
18,
13,
17,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
39,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
2,
13,
10,
17,
13,
10,
2,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13
] | [
[
202,
2
],
[
202,
11
],
[
202,
12
],
[
166,
16
],
[
20,
19
],
[
164,
22
],
[
196,
24
],
[
196,
33
],
[
184,
35
],
[
175,
38
],
[
167,
42
],
[
167,
49
],
[
54,
53
],
[
190,
60
],
[
169,
63
],
[
67,
66
],
[
167,
66
],
[
70,
69
],
[
76,
75
],
[
178,
81
],
[
66,
84
],
[
69,
86
],
[
187,
88
],
[
66,
91
],
[
75,
93
],
[
179,
99
],
[
188,
102
],
[
179,
106
],
[
194,
108
],
[
188,
111
],
[
203,
113
],
[
205,
116
],
[
179,
121
],
[
188,
125
],
[
181,
129
],
[
194,
132
],
[
203,
135
],
[
139,
138
],
[
170,
141
],
[
147,
144
],
[
191,
145
],
[
138,
146
],
[
199,
149
],
[
155,
152
],
[
191,
153
],
[
200,
155
],
[
182,
155
],
[
158,
157
],
[
191,
157
],
[
157,
161
],
[
202,
164
],
[
166,
167
],
[
169,
170
],
[
196,
173
],
[
175,
176
],
[
178,
179
],
[
181,
182
],
[
184,
185
],
[
187,
188
],
[
190,
191
],
[
202,
194
],
[
196,
197
],
[
199,
200
],
[
202,
203
],
[
205,
206
]
] | [
"H, W , N = map(int,input().split())\nfrom bisect import bisect_left\nfrom bisect import bisect_right\nmatrix = []\nfor _ in range(N):\n x,y = map(int,input().split())\n x -= 1\n y -= 1\n matrix.append([x,y])\nmatrix.sort()\nans = [0 for _ in range(10)]\ncand = {}\nfor l in matrix:\n for x_r in [-2, -1 , 0]:\n for y_r in [-2, -1 , 0]:\n nowx = l[0] + x_r\n nowy = l[1] + y_r\n if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:\n continue\n #ここで起点(左上)nowx, nowy として 9マスに着目する\n name = str(nowx) + 'sakoda' +str(nowy)\n try: cand[name] += 1\n except: cand[name] = 1\ntmp = ((H - 2) * (W - 2))\nfor x in cand.values():\n ans[x] += 1\n tmp -= 1\nans[0] = tmp\nfor x in ans:\n print(x)",
"H, W , N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"from bisect import bisect_left",
"from bisect import bisect_right",
"matrix = []",
"matrix",
"[]",
"for _ in range(N):\n x,y = map(int,input().split())\n x -= 1\n y -= 1\n matrix.append([x,y])",
"_",
"range(N)",
"range",
"N",
"x,y = map(int,input().split())",
"x",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"x -= 1",
"x",
"1",
"y -= 1",
"y",
"1",
"matrix.append([x,y])",
"matrix.append",
"matrix",
"append",
"[x,y]",
"x",
"y",
"matrix.sort()",
"matrix.sort",
"matrix",
"sort",
"0 for _ in range(10)",
"for _ in range(10)",
"_",
"range(10)",
"range",
"10",
"for _ in range(10)",
"0",
"ans = [0 for _ in range(10)]",
"ans",
"[0 for _ in range(10)]",
"cand = {}",
"cand",
"{}",
"for l in matrix:\n for x_r in [-2, -1 , 0]:\n for y_r in [-2, -1 , 0]:\n nowx = l[0] + x_r\n nowy = l[1] + y_r\n if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:\n continue\n #ここで起点(左上)nowx, nowy として 9マスに着目する\n name = str(nowx) + 'sakoda' +str(nowy)\n try: cand[name] += 1\n except: cand[name] = 1",
"l",
"matrix",
"for x_r in [-2, -1 , 0]:\n for y_r in [-2, -1 , 0]:\n nowx = l[0] + x_r\n nowy = l[1] + y_r\n if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:\n continue\n #ここで起点(左上)nowx, nowy として 9マスに着目する\n name = str(nowx) + 'sakoda' +str(nowy)\n try: cand[name] += 1\n except: cand[name] = 1",
"x_r",
"[-2, -1 , 0]",
"-2",
"-1",
"0",
"for y_r in [-2, -1 , 0]:\n nowx = l[0] + x_r\n nowy = l[1] + y_r\n if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:\n continue\n #ここで起点(左上)nowx, nowy として 9マスに着目する\n name = str(nowx) + 'sakoda' +str(nowy)\n try: cand[name] += 1\n except: cand[name] = 1",
"y_r",
"[-2, -1 , 0]",
"-2",
"-1",
"0",
"nowx = l[0] + x_r",
"nowx",
"l[0] + x_r",
"l[0]",
"l",
"0",
"x_r",
"nowy = l[1] + y_r",
"nowy",
"l[1] + y_r",
"l[1]",
"l",
"1",
"y_r",
"if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:\n continue\n #ここで起点(左上)nowx, nowy として 9マスに着目する\n ",
"nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W",
"nowx < 0 or nowy < 0 or nowx + 2>= H",
"nowx < 0 or nowy < 0",
"nowx < 0",
"nowx",
"0",
"nowy < 0",
"nowy",
"0",
"nowx + 2>= H",
"nowx + 2",
"nowx",
"2",
"H",
"nowy+ 2 >= W",
"nowy+ 2",
"nowy",
"2",
"W",
"continue",
"name = str(nowx) + 'sakoda' +str(nowy)",
"name",
"str(nowx) + 'sakoda' +str(nowy)",
"str(nowx) + 'sakoda'",
"str(nowx)",
"str",
"nowx",
"'sakoda'",
"str(nowy)",
"str",
"nowy",
"try: cand[name] += 1\n except: cand[name] = 1",
"except: ca",
"tmp = ((H - 2) * (W - 2))",
"tmp",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"for x in cand.values():\n ans[x] += 1\n tmp -= 1",
"x",
"cand.values()",
"cand.values",
"cand",
"values",
"ans[x] += 1",
"ans[x]",
"ans",
"x",
"1",
"tmp -= 1",
"tmp",
"1",
"ans[0] = tmp",
"ans[0]",
"ans",
"0",
"tmp",
"for x in ans:\n print(x)",
"x",
"ans",
"print(x)",
"print",
"x",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"matrix = []",
"[]",
"matrix",
"cand = {}",
"{}",
"cand",
"x,y = map(int,input().split())",
"map(int,input().split())",
"x",
"y -= 1",
"1",
"y",
"nowx = l[0] + x_r",
"l[0] + x_r",
"nowx",
"tmp = ((H - 2) * (W - 2))",
"(H - 2) * (W - 2)",
"tmp",
"x -= 1",
"1",
"x",
"nowy = l[1] + y_r",
"l[1] + y_r",
"nowy",
"ans = [0 for _ in range(10)]",
"[0 for _ in range(10)]",
"ans",
"H, W , N = map(int,input().split())",
"map(int,input().split())",
"H",
"y = map(int,input().split())",
"map(int,input().split())",
"y",
"tmp -= 1",
"1",
"tmp",
"W , N = map(int,input().split())",
"map(int,input().split())",
"W",
"name = str(nowx) + 'sakoda' +str(nowy)",
"str(nowx) + 'sakoda' +str(nowy)",
"name"
] | H, W , N = map(int,input().split())
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
x,y = map(int,input().split())
x -= 1
y -= 1
matrix.append([x,y])
matrix.sort()
ans = [0 for _ in range(10)]
cand = {}
for l in matrix:
for x_r in [-2, -1 , 0]:
for y_r in [-2, -1 , 0]:
nowx = l[0] + x_r
nowy = l[1] + y_r
if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:
continue
#ここで起点(左上)nowx, nowy として 9マスに着目する
name = str(nowx) + 'sakoda' +str(nowy)
try: cand[name] += 1
except: cand[name] = 1
tmp = ((H - 2) * (W - 2))
for x in cand.values():
ans[x] += 1
tmp -= 1
ans[0] = tmp
for x in ans:
print(x)
|
[
7,
17,
15,
13,
13,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
12,
13,
12,
13,
12,
13,
12,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
4,
13,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
2,
40,
17,
2,
13,
13,
2,
13,
17,
2,
40,
17,
2,
13,
13,
2,
13,
17,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
0,
13,
4,
13,
13,
0,
13,
2,
39,
17,
17,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
12,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
39,
13,
10,
4,
13,
10,
17,
13,
10,
12,
13,
10,
2,
13,
10,
4,
13
] | [
[
177,
31
],
[
195,
36
],
[
198,
43
],
[
169,
45
],
[
198,
46
],
[
198,
47
],
[
183,
49
],
[
53,
52
],
[
187,
55
],
[
174,
57
],
[
169,
59
],
[
174,
60
],
[
189,
62
],
[
180,
65
],
[
69,
68
],
[
74,
73
],
[
190,
83
],
[
175,
83
],
[
68,
84
],
[
163,
86
],
[
181,
92
],
[
154,
92
],
[
73,
93
],
[
199,
95
],
[
184,
99
],
[
190,
103
],
[
175,
103
],
[
68,
104
],
[
181,
106
],
[
154,
106
],
[
73,
107
],
[
165,
109
],
[
184,
112
],
[
159,
114
],
[
166,
124
],
[
130,
127
],
[
160,
128
],
[
135,
132
],
[
160,
133
],
[
163,
138
],
[
199,
141
],
[
166,
145
],
[
148,
147
],
[
160,
147
],
[
147,
151
],
[
174,
154
],
[
159,
160
],
[
198,
163
],
[
165,
166
],
[
174,
175
],
[
177,
178
],
[
180,
181
],
[
183,
184
],
[
198,
187
],
[
189,
190
],
[
195,
196
],
[
198,
199
]
] | [
"# -*- coding: utf-8 -*-\n\n\"\"\"\n参考:http://arc061.contest.atcoder.jp/data/arc/061/editorial.pdf\n・各点が影響を与える9か所の正方形をメモしておく。\n\"\"\"\n\nimport sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import sqrt, hypot, factorial, pi, sin, cos, radians\nfrom heapq import heappop, heappush, heapify, heappushpop\nfrom bisect import bisect_left, bisect_right\nfrom itertools import permutations, combinations, product\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom functools import reduce, partial\nfrom fractions import Fraction\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(): return list(map(int, input().split()))\nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\nH, W, N = MAP()\n# その黒い点が含まれる正方形の左上座標を持っておく\nxy = []\nfor i in range(N):\n a, b = MAP()\n a -= 1\n b -= 1\n for j in range(3):\n for k in range(3):\n # 3*3の正方形を作れない座標は除く\n if 0 <= a-j < H-2 and 0 <= b-k < W-2:\n xy.append((a-j, b-k))\n# 各座標の出現数を集計\nc = Counter(xy)\n# 0以外はこの集計結果から集められる\nans = [0] * 10\nfor k, v in c.items():\n ans[v] += 1\n# 黒い点が0個の正方形の数 = 候補となりうる全正方形の数 - 黒い点が1個でも出現した正方形の数\nans[0] = (H-2)*(W-2) - len(c)\n\nfor num in ans:\n print(num)",
"\"\"\"\n参考:http://arc061.contest.atcoder.jp/data/arc/061/editorial.pdf\n・各点が影響を与える9か所の正方形をメモしておく。\n\"\"\"",
"import sys, re",
"sys",
"re",
"from collections import deque, defaultdict, Counter",
"from math import sqrt, hypot, factorial, pi, sin, cos, radians",
"from heapq import heappop, heappush, heapify, heappushpop",
"from bisect import bisect_left, bisect_right",
"from itertools import permutations, combinations, product",
"from operator import itemgetter, mul",
"from copy import deepcopy",
"from functools import reduce, partial",
"from fractions import Fraction",
"from string import ascii_lowercase, ascii_uppercase, digits",
"def input(): return sys.stdin.readline().strip()",
"input",
"def INT(): return int(input())",
"INT",
"def MAP(): return map(int, input().split())",
"MAP",
"def LIST(): return list(map(int, input().split()))",
"LIST",
"sys.setrecursionlimit(10 ** 9)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 9",
"10",
"9",
"INF = float('inf')",
"INF",
"float('inf')",
"float",
"'inf'",
"MOD = 10 ** 9 + 7",
"MOD",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"H, W, N = MAP()",
"H",
"MAP()",
"MAP",
"W",
"N",
"xy = []",
"xy",
"[]",
"for i in range(N):\n a, b = MAP()\n a -= 1\n b -= 1\n for j in range(3):\n for k in range(3):\n # 3*3の正方形を作れない座標は除く\n if 0 <= a-j < H-2 and 0 <= b-k < W-2:\n xy.append((a-j, b-k))\n# 各座標の出現数を集計",
"i",
"range(N)",
"range",
"N",
"a, b = MAP()",
"a",
"MAP()",
"MAP",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for j in range(3):\n for k in range(3):\n # 3*3の正方形を作れない座標は除く\n if 0 <= a-j < H-2 and 0 <= b-k < W-2:\n xy.append((a-j, b-k))\n# 各座標の出現数を集計",
"j",
"range(3)",
"range",
"3",
"for k in range(3):\n # 3*3の正方形を作れない座標は除く\n if 0 <= a-j < H-2 and 0 <= b-k < W-2:\n xy.append((a-j, b-k))\n# 各座標の出現数を集計",
"k",
"range(3)",
"range",
"3",
"if 0 <= a-j < H-2 and 0 <= b-k < W-2:\n xy.append((a-j, b-k))\n# 各座標の出現数を集計",
"0 <= a-j < H-2 and 0 <= b-k < W-2",
"0 <= a-j < H-2",
"0 <= a-j",
"0",
"a-j",
"a",
"j",
"H-2",
"H",
"2",
"0 <= b-k < W-2",
"0 <= b-k",
"0",
"b-k",
"b",
"k",
"W-2",
"W",
"2",
"xy.append((a-j, b-k))",
"xy.append",
"xy",
"append",
"(a-j, b-k)",
"a-j",
"a",
"j",
"b-k",
"b",
"k",
"c = Counter(xy)",
"c",
"Counter(xy)",
"Counter",
"xy",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for k, v in c.items():\n ans[v] += 1\n# 黒い点が0個の正方形の数 = 候補となりうる全正方形の数 - 黒い点が1個でも出現した正方形の数",
"k",
"v",
"c.items()",
"c.items",
"c",
"items",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"ans[0] = (H-2)*(W-2) - len(c)",
"ans[0]",
"ans",
"0",
"(H-2)*(W-2) - len(c)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"len(c)",
"len",
"c",
"for num in ans:\n print(num)",
"num",
"ans",
"print(num)",
"print",
"num",
"b = MAP()",
"MAP()",
"b",
"def INT(): return int(input())",
"def INT(): return int(input())",
"INT",
"ans = [0] * 10",
"[0] * 10",
"ans",
"H, W, N = MAP()",
"MAP()",
"H",
"c = Counter(xy)",
"Counter(xy)",
"c",
"def MAP(): return map(int, input().split())",
"def MAP(): return map(int, input().split())",
"MAP",
"def LIST(): return list(map(int, input().split()))",
"def LIST(): return list(map(int, input().split()))",
"LIST",
"a, b = MAP()",
"MAP()",
"a",
"INF = float('inf')",
"float('inf')",
"INF",
"b -= 1",
"1",
"b",
"xy = []",
"[]",
"xy",
"N = MAP()",
"MAP()",
"N",
"a -= 1",
"1",
"a",
"def input(): return sys.stdin.readline().strip()",
"def input(): return sys.stdin.readline().strip()",
"input",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"W, N = MAP()",
"MAP()",
"W"
] | # -*- coding: utf-8 -*-
"""
参考:http://arc061.contest.atcoder.jp/data/arc/061/editorial.pdf
・各点が影響を与える9か所の正方形をメモしておく。
"""
import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
H, W, N = MAP()
# その黒い点が含まれる正方形の左上座標を持っておく
xy = []
for i in range(N):
a, b = MAP()
a -= 1
b -= 1
for j in range(3):
for k in range(3):
# 3*3の正方形を作れない座標は除く
if 0 <= a-j < H-2 and 0 <= b-k < W-2:
xy.append((a-j, b-k))
# 各座標の出現数を集計
c = Counter(xy)
# 0以外はこの集計結果から集められる
ans = [0] * 10
for k, v in c.items():
ans[v] += 1
# 黒い点が0個の正方形の数 = 候補となりうる全正方形の数 - 黒い点が1個でも出現した正方形の数
ans[0] = (H-2)*(W-2) - len(c)
for num in ans:
print(num)
|
[
7,
15,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
13,
0,
13,
13,
0,
13,
17,
28,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
4,
18,
13,
13,
4,
13,
2,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
2,
13,
4,
13,
2,
13,
17,
2,
13,
4,
13,
2,
13,
17,
0,
18,
13,
2,
13,
2,
13,
13,
2,
4,
18,
13,
13,
2,
13,
2,
13,
13,
17,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
41,
28,
13,
13,
4,
4,
13,
13,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
2,
13,
10,
17,
13
] | [
[
6,
5
],
[
5,
14
],
[
158,
16
],
[
158,
18
],
[
158,
19
],
[
23,
22
],
[
156,
25
],
[
161,
29
],
[
167,
32
],
[
149,
39
],
[
152,
42
],
[
150,
54
],
[
150,
57
],
[
153,
62
],
[
153,
65
],
[
159,
74
],
[
147,
81
],
[
91,
84
],
[
168,
85
],
[
159,
89
],
[
168,
94
],
[
159,
99
],
[
164,
104
],
[
168,
114
],
[
120,
117
],
[
165,
118
],
[
125,
122
],
[
165,
123
],
[
159,
128
],
[
147,
131
],
[
165,
135
],
[
139,
138
],
[
165,
138
],
[
138,
143
],
[
158,
147
],
[
149,
150
],
[
152,
153
],
[
158,
156
],
[
158,
159
],
[
161,
162
],
[
164,
165
],
[
167,
168
]
] | [
"import itertools\nH, W, N = [int(_) for _ in input().split()]\nAB = [[int(_) for _ in input().split()] for _ in range(N)]\n\nmemo = {}\nfor a, b in AB:\n #0-indexed\n a -= 1\n b -= 1\n for na, nb in itertools.product(range(a - 2, a + 1), range(b - 2, b + 1)):\n if na in range(H - 2) and nb in range(W - 2):\n memo[na + H * nb] = memo.get(na + H * nb, 0) + 1\nresult = [0] * 10\nfor k, v in memo.items():\n result[v] += 1\nresult[0] = (H - 2) * (W - 2) - sum(result)\n[print(_) for _ in result]",
"import itertools",
"itertools",
"int(_) for _ in input().split()",
"for _ in input().split()",
"_",
"input().split()",
"().split",
"()",
"input",
"split",
"for _ in input().split()",
"int(_)",
"int",
"_",
"H, W, N = [int(_) for _ in input().split()]",
"H",
"[int(_) for _ in input().split()]",
"W",
"N",
"[int(_) for _ in input().split()] for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"[int(_) for _ in input().split()]",
"AB = [[int(_) for _ in input().split()] for _ in range(N)]",
"AB",
"[[int(_) for _ in input().split()] for _ in range(N)]",
"memo = {}",
"memo",
"{}",
"for a, b in AB:\n #0-indexed\n a -= 1\n b -= 1\n for na, nb in itertools.product(range(a - 2, a + 1), range(b - 2, b + 1)):\n if na in range(H - 2) and nb in range(W - 2):\n memo[na + H * nb] = memo.get(na + H * nb, 0) + 1",
"a",
"b",
"AB",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for na, nb in itertools.product(range(a - 2, a + 1), range(b - 2, b + 1)):\n if na in range(H - 2) and nb in range(W - 2):\n memo[na + H * nb] = memo.get(na + H * nb, 0) + 1",
"na",
"nb",
"itertools.product(range(a - 2, a + 1), range(b - 2, b + 1))",
"itertools.product",
"itertools",
"product",
"range(a - 2, a + 1)",
"range",
"a - 2",
"a",
"2",
"a + 1",
"a",
"1",
"range(b - 2, b + 1)",
"range",
"b - 2",
"b",
"2",
"b + 1",
"b",
"1",
"if na in range(H - 2) and nb in range(W - 2):\n memo[na + H * nb] = memo.get(na + H * nb, 0) + 1",
"na in range(H - 2) and nb in range(W - 2)",
"na in range(H - 2)",
"na",
"range(H - 2)",
"range",
"H - 2",
"H",
"2",
"nb in range(W - 2)",
"nb",
"range(W - 2)",
"range",
"W - 2",
"W",
"2",
"memo[na + H * nb] = memo.get(na + H * nb, 0) + 1",
"memo[na + H * nb]",
"memo",
"na + H * nb",
"na",
"H * nb",
"H",
"nb",
"memo.get(na + H * nb, 0) + 1",
"memo.get(na + H * nb, 0)",
"memo.get",
"memo",
"get",
"na + H * nb",
"na",
"H * nb",
"H",
"nb",
"0",
"1",
"result = [0] * 10",
"result",
"[0] * 10",
"[0]",
"0",
"10",
"for k, v in memo.items():\n result[v] += 1",
"k",
"v",
"memo.items()",
"memo.items",
"memo",
"items",
"result[v] += 1",
"result[v]",
"result",
"v",
"1",
"result[0] = (H - 2) * (W - 2) - sum(result)",
"result[0]",
"result",
"0",
"(H - 2) * (W - 2) - sum(result)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(result)",
"sum",
"result",
"print(_) for _ in result",
"for _ in result",
"_",
"result",
"for _ in result",
"print(_)",
"print",
"_",
"[print(_) for _ in result]",
"W, N = [int(_) for _ in input().split()]",
"[int(_) for _ in input().split()]",
"W",
"a -= 1",
"1",
"a",
"b -= 1",
"1",
"b",
"N = [int(_) for _ in input().split()]",
"[int(_) for _ in input().split()]",
"N",
"H, W, N = [int(_) for _ in input().split()]",
"[int(_) for _ in input().split()]",
"H",
"AB = [[int(_) for _ in input().split()] for _ in range(N)]",
"[[int(_) for _ in input().split()] for _ in range(N)]",
"AB",
"result = [0] * 10",
"[0] * 10",
"result",
"memo = {}",
"{}",
"memo"
] | import itertools
H, W, N = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for _ in range(N)]
memo = {}
for a, b in AB:
#0-indexed
a -= 1
b -= 1
for na, nb in itertools.product(range(a - 2, a + 1), range(b - 2, b + 1)):
if na in range(H - 2) and nb in range(W - 2):
memo[na + H * nb] = memo.get(na + H * nb, 0) + 1
result = [0] * 10
for k, v in memo.items():
result[v] += 1
result[0] = (H - 2) * (W - 2) - sum(result)
[print(_) for _ in result]
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
0,
13,
2,
17,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
2,
4,
13,
2,
13,
17,
2,
13,
17,
17,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
2,
4,
13,
2,
13,
17,
2,
13,
17,
17,
14,
2,
2,
2,
13,
13,
13,
13,
0,
18,
13,
2,
2,
13,
13,
13,
17,
0,
18,
13,
2,
2,
13,
13,
13,
17,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
13,
0,
18,
13,
17,
17,
0,
18,
13,
18,
13,
13,
17,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
160,
2
],
[
160,
11
],
[
160,
12
],
[
148,
14
],
[
145,
17
],
[
23,
22
],
[
143,
25
],
[
163,
27
],
[
163,
36
],
[
39,
38
],
[
164,
45
],
[
161,
51
],
[
164,
54
],
[
59,
58
],
[
158,
65
],
[
155,
71
],
[
158,
74
],
[
38,
81
],
[
146,
82
],
[
58,
83
],
[
149,
84
],
[
93,
86
],
[
149,
87
],
[
38,
90
],
[
146,
91
],
[
58,
92
],
[
102,
95
],
[
149,
96
],
[
38,
99
],
[
146,
100
],
[
58,
101
],
[
151,
104
],
[
113,
110
],
[
152,
111
],
[
155,
115
],
[
161,
118
],
[
122,
121
],
[
149,
121
],
[
127,
124
],
[
152,
125
],
[
134,
129
],
[
152,
130
],
[
149,
132
],
[
121,
133
],
[
137,
136
],
[
152,
136
],
[
136,
140
],
[
160,
143
],
[
145,
146
],
[
148,
149
],
[
151,
152
],
[
160,
155
],
[
163,
158
],
[
160,
161
],
[
163,
164
]
] | [
"h,w,n=map(int,input().split())\ndic={}\nINF=10**10\nfor i in range(n):\n y,x=map(int,input().split())\n for j in range(max(2,x-1),min(w-1,x+1)+1):\n for k in range(max(2,y-1),min(h-1,y+1)+1):\n if j*INF+k in dic:\n dic[j*INF+k]+=1\n else:\n dic[j*INF+k]=1\nans=[0]*10\nans[0]=(h-2)*(w-2)\nfor i in dic:\n ans[0]-=1\n ans[dic[i]]+=1\nfor i in ans:\n print(i)",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"dic={}",
"dic",
"{}",
"INF=10**10",
"INF",
"10**10",
"10",
"10",
"for i in range(n):\n y,x=map(int,input().split())\n for j in range(max(2,x-1),min(w-1,x+1)+1):\n for k in range(max(2,y-1),min(h-1,y+1)+1):\n if j*INF+k in dic:\n dic[j*INF+k]+=1\n else:\n dic[j*INF+k]=1",
"i",
"range(n)",
"range",
"n",
"y,x=map(int,input().split())",
"y",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"x",
"for j in range(max(2,x-1),min(w-1,x+1)+1):\n for k in range(max(2,y-1),min(h-1,y+1)+1):\n if j*INF+k in dic:\n dic[j*INF+k]+=1\n else:\n dic[j*INF+k]=1",
"j",
"range(max(2,x-1),min(w-1,x+1)+1)",
"range",
"max(2,x-1)",
"max",
"2",
"x-1",
"x",
"1",
"min(w-1,x+1)+1",
"min(w-1,x+1)",
"min",
"w-1",
"w",
"1",
"x+1",
"x",
"1",
"1",
"for k in range(max(2,y-1),min(h-1,y+1)+1):\n if j*INF+k in dic:\n dic[j*INF+k]+=1\n else:\n dic[j*INF+k]=1",
"k",
"range(max(2,y-1),min(h-1,y+1)+1)",
"range",
"max(2,y-1)",
"max",
"2",
"y-1",
"y",
"1",
"min(h-1,y+1)+1",
"min(h-1,y+1)",
"min",
"h-1",
"h",
"1",
"y+1",
"y",
"1",
"1",
"if j*INF+k in dic:\n dic[j*INF+k]+=1\n else:\n dic[j*INF+k]=1",
"j*INF+k in dic",
"j*INF+k",
"j*INF",
"j",
"INF",
"k",
"dic",
"dic[j*INF+k]+=1",
"dic[j*INF+k]",
"dic",
"j*INF+k",
"j*INF",
"j",
"INF",
"k",
"1",
"dic[j*INF+k]=1",
"dic[j*INF+k]",
"dic",
"j*INF+k",
"j*INF",
"j",
"INF",
"k",
"1",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"ans[0]=(h-2)*(w-2)",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"for i in dic:\n ans[0]-=1\n ans[dic[i]]+=1",
"i",
"dic",
"ans[0]-=1",
"ans[0]",
"ans",
"0",
"1",
"ans[dic[i]]+=1",
"ans[dic[i]]",
"ans",
"dic[i]",
"dic",
"i",
"1",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"INF=10**10",
"10**10",
"INF",
"dic={}",
"{}",
"dic",
"ans=[0]*10",
"[0]*10",
"ans",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"y,x=map(int,input().split())",
"map(int,input().split())",
"y",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"x=map(int,input().split())",
"map(int,input().split())",
"x"
] | h,w,n=map(int,input().split())
dic={}
INF=10**10
for i in range(n):
y,x=map(int,input().split())
for j in range(max(2,x-1),min(w-1,x+1)+1):
for k in range(max(2,y-1),min(h-1,y+1)+1):
if j*INF+k in dic:
dic[j*INF+k]+=1
else:
dic[j*INF+k]=1
ans=[0]*10
ans[0]=(h-2)*(w-2)
for i in dic:
ans[0]-=1
ans[dic[i]]+=1
for i in ans:
print(i)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
0,
13,
2,
2,
13,
17,
13,
0,
13,
2,
2,
13,
17,
13,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
0,
13,
2,
2,
4,
13,
13,
17,
4,
13,
13,
14,
2,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] | [
[
164,
2
],
[
164,
11
],
[
164,
12
],
[
146,
14
],
[
19,
18
],
[
162,
21
],
[
167,
23
],
[
167,
32
],
[
35,
34
],
[
41,
40
],
[
155,
46
],
[
150,
49
],
[
34,
51
],
[
143,
53
],
[
168,
56
],
[
40,
58
],
[
156,
64
],
[
165,
66
],
[
144,
71
],
[
159,
73
],
[
170,
76
],
[
156,
81
],
[
144,
85
],
[
171,
88
],
[
147,
89
],
[
94,
91
],
[
147,
92
],
[
171,
93
],
[
99,
96
],
[
147,
97
],
[
171,
98
],
[
152,
101
],
[
108,
107
],
[
147,
110
],
[
116,
113
],
[
153,
114
],
[
107,
115
],
[
121,
118
],
[
153,
119
],
[
165,
124
],
[
159,
127
],
[
153,
131
],
[
134,
133
],
[
153,
140
],
[
133,
141
],
[
143,
144
],
[
146,
147
],
[
167,
150
],
[
152,
153
],
[
155,
156
],
[
164,
159
],
[
164,
162
],
[
164,
165
],
[
167,
168
],
[
170,
171
]
] | [
"h, w, n = map(int,input().split())\n \nxy_pos = dict()\n \nfor i in range(n):\n a, b = map(int, input().split())\n for k in range(-2,1):\n for l in range(-2,1):\n x = (a-1) + k\n y = (b-1) + l\n if (0 <= x <= h-3 and 0 <= y <= w-3):\n xy = str(x) + \"x\" + str(y)\n if xy in xy_pos:\n xy_pos[xy] += 1\n else:\n xy_pos[xy] = 1\n \nans = [0]*10 \nfor v in xy_pos.values():\n ans[v] += 1\nans[0] = (h-2)*(w-2) - sum(ans)\nfor i in range(10):\n print(ans[i])",
"h, w, n = map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"xy_pos = dict()",
"xy_pos",
"dict()",
"dict",
"for i in range(n):\n a, b = map(int, input().split())\n for k in range(-2,1):\n for l in range(-2,1):\n x = (a-1) + k\n y = (b-1) + l\n if (0 <= x <= h-3 and 0 <= y <= w-3):\n xy = str(x) + \"x\" + str(y)\n if xy in xy_pos:\n xy_pos[xy] += 1\n else:\n xy_pos[xy] = 1\n ",
"i",
"range(n)",
"range",
"n",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for k in range(-2,1):\n for l in range(-2,1):\n x = (a-1) + k\n y = (b-1) + l\n if (0 <= x <= h-3 and 0 <= y <= w-3):\n xy = str(x) + \"x\" + str(y)\n if xy in xy_pos:\n xy_pos[xy] += 1\n else:\n xy_pos[xy] = 1\n ",
"k",
"range(-2,1)",
"range",
"-2",
"1",
"for l in range(-2,1):\n x = (a-1) + k\n y = (b-1) + l\n if (0 <= x <= h-3 and 0 <= y <= w-3):\n xy = str(x) + \"x\" + str(y)\n if xy in xy_pos:\n xy_pos[xy] += 1\n else:\n xy_pos[xy] = 1\n ",
"l",
"range(-2,1)",
"range",
"-2",
"1",
"x = (a-1) + k",
"x",
"(a-1) + k",
"a-1",
"a",
"1",
"k",
"y = (b-1) + l",
"y",
"(b-1) + l",
"b-1",
"b",
"1",
"l",
"if (0 <= x <= h-3 and 0 <= y <= w-3):\n xy = str(x) + \"x\" + str(y)\n if xy in xy_pos:\n xy_pos[xy] += 1\n else:\n xy_pos[xy] = 1\n ",
"0 <= x <= h-3 and 0 <= y <= w-3",
"0 <= x <= h-3",
"0 <= x",
"0",
"x",
"h-3",
"h",
"3",
"0 <= y <= w-3",
"0 <= y",
"0",
"y",
"w-3",
"w",
"3",
"xy = str(x) + \"x\" + str(y)",
"xy",
"str(x) + \"x\" + str(y)",
"str(x) + \"x\"",
"str(x)",
"str",
"x",
"\"x\"",
"str(y)",
"str",
"y",
"if xy in xy_pos:\n xy_pos[xy] += 1\n else:\n xy_pos[xy] = 1\n ",
"xy in xy_pos",
"xy",
"xy_pos",
"xy_pos[xy] += 1",
"xy_pos[xy]",
"xy_pos",
"xy",
"1",
"xy_pos[xy] = 1",
"xy_pos[xy]",
"xy_pos",
"xy",
"1",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for v in xy_pos.values():\n ans[v] += 1",
"v",
"xy_pos.values()",
"xy_pos.values",
"xy_pos",
"values",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"ans[0] = (h-2)*(w-2) - sum(ans)",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2) - sum(ans)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"y = (b-1) + l",
"(b-1) + l",
"y",
"xy_pos = dict()",
"dict()",
"xy_pos",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"ans = [0]*10",
"[0]*10",
"ans",
"x = (a-1) + k",
"(a-1) + k",
"x",
"w, n = map(int,input().split())",
"map(int,input().split())",
"w",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"h, w, n = map(int,input().split())",
"map(int,input().split())",
"h",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"xy = str(x) + \"x\" + str(y)",
"str(x) + \"x\" + str(y)",
"xy"
] | h, w, n = map(int,input().split())
xy_pos = dict()
for i in range(n):
a, b = map(int, input().split())
for k in range(-2,1):
for l in range(-2,1):
x = (a-1) + k
y = (b-1) + l
if (0 <= x <= h-3 and 0 <= y <= w-3):
xy = str(x) + "x" + str(y)
if xy in xy_pos:
xy_pos[xy] += 1
else:
xy_pos[xy] = 1
ans = [0]*10
for v in xy_pos.values():
ans[v] += 1
ans[0] = (h-2)*(w-2) - sum(ans)
for i in range(10):
print(ans[i]) |
[
7,
15,
0,
13,
39,
17,
17,
17,
0,
13,
4,
13,
12,
17,
12,
13,
28,
13,
13,
28,
13,
13,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
23,
13,
23,
13,
23,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
4,
13,
13,
13,
13,
0,
13,
4,
13,
12,
17,
28,
13,
13,
4,
18,
13,
13,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
18,
13,
39,
13,
13,
17,
0,
13,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
17,
0,
13,
18,
13,
13,
0,
18,
13,
17,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13
] | [
[
172,
3
],
[
160,
9
],
[
18,
17
],
[
173,
17
],
[
21,
20
],
[
173,
20
],
[
32,
23
],
[
34,
24
],
[
36,
27
],
[
17,
28
],
[
38,
30
],
[
20,
31
],
[
34,
34
],
[
36,
36
],
[
38,
38
],
[
169,
40
],
[
169,
49
],
[
169,
50
],
[
53,
52
],
[
164,
55
],
[
154,
57
],
[
154,
66
],
[
167,
68
],
[
161,
69
],
[
155,
70
],
[
149,
71
],
[
157,
73
],
[
161,
83
],
[
170,
92
],
[
146,
99
],
[
109,
102
],
[
158,
103
],
[
161,
105
],
[
175,
111
],
[
170,
114
],
[
146,
117
],
[
121,
120
],
[
151,
125
],
[
158,
127
],
[
120,
128
],
[
133,
130
],
[
158,
131
],
[
152,
133
],
[
176,
133
],
[
136,
135
],
[
158,
142
],
[
135,
143
],
[
169,
146
],
[
154,
149
],
[
151,
152
],
[
154,
155
],
[
157,
158
],
[
160,
161
],
[
169,
164
],
[
169,
170
],
[
172,
173
],
[
175,
176
]
] | [
"from collections import defaultdict\nDelta = [-1,0,1]\nd = defaultdict(lambda:0)\ndef paint(d,x,y):\n for dx in Delta:\n for dy in Delta:\n d[(x+dx,y+dy)] += 1\nH,W,N = map(int,input().split())\nfor i in range(N):\n a,b = map(int,input().split())\n paint(d,a,b)\nans = defaultdict(lambda:0)\nfor x,y in d.keys():\n if 2<=x<=H-1 and 2<=y<=W-1:\n ans[d[(x,y)]] += 1\nans0 = (H-2)*(W-2)\nfor i in range(10):\n ans0 -= ans[i]\nans[0] = ans0\nfor i in range(10):\n print(ans[i])",
"from collections import defaultdict",
"Delta = [-1,0,1]",
"Delta",
"[-1,0,1]",
"-1",
"0",
"1",
"d = defaultdict(lambda:0)",
"d",
"defaultdict(lambda:0)",
"defaultdict",
"lambda:0",
"0",
"def paint(d,x,y):\n for dx in Delta:\n for dy in Delta:\n d[(x+dx,y+dy)] += 1",
"paint",
"for dx in Delta:\n for dy in Delta:\n d[(x+dx,y+dy)] += 1",
"dx",
"Delta",
"for dy in Delta:\n d[(x+dx,y+dy)] += 1",
"dy",
"Delta",
"d[(x+dx,y+dy)] += 1",
"d[(x+dx,y+dy)]",
"d",
"(x+dx,y+dy)",
"x+dx",
"x",
"dx",
"y+dy",
"y",
"dy",
"1",
"d",
"d",
"x",
"x",
"y",
"y",
"H,W,N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"for i in range(N):\n a,b = map(int,input().split())\n paint(d,a,b)",
"i",
"range(N)",
"range",
"N",
"a,b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"paint(d,a,b)",
"paint",
"d",
"a",
"b",
"ans = defaultdict(lambda:0)",
"ans",
"defaultdict(lambda:0)",
"defaultdict",
"lambda:0",
"0",
"for x,y in d.keys():\n if 2<=x<=H-1 and 2<=y<=W-1:\n ans[d[(x,y)]] += 1",
"x",
"y",
"d.keys()",
"d.keys",
"d",
"keys",
"if 2<=x<=H-1 and 2<=y<=W-1:\n ans[d[(x,y)]] += 1",
"2<=x<=H-1 and 2<=y<=W-1",
"2<=x<=H-1",
"2<=x",
"2",
"x",
"H-1",
"H",
"1",
"2<=y<=W-1",
"2<=y",
"2",
"y",
"W-1",
"W",
"1",
"ans[d[(x,y)]] += 1",
"ans[d[(x,y)]]",
"ans",
"d[(x,y)]",
"d",
"(x,y)",
"x",
"y",
"1",
"ans0 = (H-2)*(W-2)",
"ans0",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"for i in range(10):\n ans0 -= ans[i]",
"i",
"range(10)",
"range",
"10",
"ans0 -= ans[i]",
"ans0",
"ans[i]",
"ans",
"i",
"ans[0] = ans0",
"ans[0]",
"ans",
"0",
"ans0",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"ans0 -= ans[i]",
"ans[i]",
"ans0",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"ans = defaultdict(lambda:0)",
"defaultdict(lambda:0)",
"ans",
"d = defaultdict(lambda:0)",
"defaultdict(lambda:0)",
"d",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"def paint(d,x,y):\n for dx in Delta:\n for dy in Delta:\n d[(x+dx,y+dy)] += 1",
"def paint(d,x,y):\n for dx in Delta:\n for dy in Delta:\n d[(x+dx,y+dy)] += 1",
"paint",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"Delta = [-1,0,1]",
"[-1,0,1]",
"Delta",
"ans0 = (H-2)*(W-2)",
"(H-2)*(W-2)",
"ans0"
] | from collections import defaultdict
Delta = [-1,0,1]
d = defaultdict(lambda:0)
def paint(d,x,y):
for dx in Delta:
for dy in Delta:
d[(x+dx,y+dy)] += 1
H,W,N = map(int,input().split())
for i in range(N):
a,b = map(int,input().split())
paint(d,a,b)
ans = defaultdict(lambda:0)
for x,y in d.keys():
if 2<=x<=H-1 and 2<=y<=W-1:
ans[d[(x,y)]] += 1
ans0 = (H-2)*(W-2)
for i in range(10):
ans0 -= ans[i]
ans[0] = ans0
for i in range(10):
print(ans[i]) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
0,
13,
2,
2,
13,
17,
13,
0,
13,
2,
2,
13,
17,
13,
14,
2,
2,
40,
17,
13,
2,
13,
17,
2,
40,
17,
13,
2,
13,
17,
0,
13,
2,
2,
4,
13,
13,
17,
4,
13,
13,
14,
2,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] | [
[
170,
2
],
[
170,
11
],
[
170,
12
],
[
143,
14
],
[
19,
18
],
[
159,
21
],
[
164,
23
],
[
164,
34
],
[
37,
36
],
[
42,
41
],
[
149,
46
],
[
165,
49
],
[
36,
51
],
[
152,
53
],
[
147,
56
],
[
41,
58
],
[
150,
64
],
[
156,
66
],
[
153,
71
],
[
171,
73
],
[
167,
76
],
[
150,
81
],
[
153,
85
],
[
168,
88
],
[
144,
89
],
[
94,
91
],
[
144,
92
],
[
168,
93
],
[
99,
96
],
[
144,
97
],
[
168,
98
],
[
161,
101
],
[
108,
107
],
[
144,
110
],
[
116,
113
],
[
162,
114
],
[
107,
115
],
[
121,
118
],
[
162,
119
],
[
156,
124
],
[
171,
127
],
[
162,
131
],
[
134,
133
],
[
113,
139
],
[
162,
140
],
[
133,
141
],
[
143,
144
],
[
164,
147
],
[
149,
150
],
[
152,
153
],
[
170,
156
],
[
170,
159
],
[
161,
162
],
[
164,
165
],
[
167,
168
],
[
170,
171
]
] | [
"H, W, N = map(int, input().split())\nAB = dict()\nfor i in range(N):\n a, b = list(map(int, input().split()))\n for i in range(3):\n for j in range(3):\n x = (a - 1) - i\n y = (b - 1) - j\n if (0 <= x < H - 2) and (0 <= y < W - 2):\n ab = str(x) + \"ab\" + str(y)\n if ab in AB:\n AB[ab] += 1\n else:\n AB[ab] = 1\n#print(AB) \n\nans = [0] * 10\nfor i in AB.values():\n ans[i] += 1\nans[0] = (H - 2) * (W - 2) - sum(ans)\nfor i in range(10):\n print(ans[i])",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"AB = dict()",
"AB",
"dict()",
"dict",
"for i in range(N):\n a, b = list(map(int, input().split()))\n for i in range(3):\n for j in range(3):\n x = (a - 1) - i\n y = (b - 1) - j\n if (0 <= x < H - 2) and (0 <= y < W - 2):\n ab = str(x) + \"ab\" + str(y)\n if ab in AB:\n AB[ab] += 1\n else:\n AB[ab] = 1\n#print(AB) ",
"i",
"range(N)",
"range",
"N",
"a, b = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in range(3):\n for j in range(3):\n x = (a - 1) - i\n y = (b - 1) - j\n if (0 <= x < H - 2) and (0 <= y < W - 2):\n ab = str(x) + \"ab\" + str(y)\n if ab in AB:\n AB[ab] += 1\n else:\n AB[ab] = 1\n#print(AB) ",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n x = (a - 1) - i\n y = (b - 1) - j\n if (0 <= x < H - 2) and (0 <= y < W - 2):\n ab = str(x) + \"ab\" + str(y)\n if ab in AB:\n AB[ab] += 1\n else:\n AB[ab] = 1\n#print(AB) ",
"j",
"range(3)",
"range",
"3",
"x = (a - 1) - i",
"x",
"(a - 1) - i",
"a - 1",
"a",
"1",
"i",
"y = (b - 1) - j",
"y",
"(b - 1) - j",
"b - 1",
"b",
"1",
"j",
"if (0 <= x < H - 2) and (0 <= y < W - 2):\n ab = str(x) + \"ab\" + str(y)\n if ab in AB:\n AB[ab] += 1\n else:\n AB[ab] = 1\n#print(AB) ",
"(0 <= x < H - 2) and (0 <= y < W - 2)",
"0 <= x < H - 2",
"0 <= x",
"0",
"x",
"H - 2",
"H",
"2",
"0 <= y < W - 2",
"0 <= y",
"0",
"y",
"W - 2",
"W",
"2",
"ab = str(x) + \"ab\" + str(y)",
"ab",
"str(x) + \"ab\" + str(y)",
"str(x) + \"ab\"",
"str(x)",
"str",
"x",
"\"ab\"",
"str(y)",
"str",
"y",
"if ab in AB:\n AB[ab] += 1\n else:\n AB[ab] = 1\n#print(AB) ",
"ab in AB",
"ab",
"AB",
"AB[ab] += 1",
"AB[ab]",
"AB",
"ab",
"1",
"AB[ab] = 1",
"AB[ab]",
"AB",
"ab",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for i in AB.values():\n ans[i] += 1",
"i",
"AB.values()",
"AB.values",
"AB",
"values",
"ans[i] += 1",
"ans[i]",
"ans",
"i",
"1",
"ans[0] = (H - 2) * (W - 2) - sum(ans)",
"ans[0]",
"ans",
"0",
"(H - 2) * (W - 2) - sum(ans)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(ans)",
"sum",
"ans",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"AB = dict()",
"dict()",
"AB",
"b = list(map(int, input().split()))",
"list(map(int, input().split()))",
"b",
"x = (a - 1) - i",
"(a - 1) - i",
"x",
"y = (b - 1) - j",
"(b - 1) - j",
"y",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"ans = [0] * 10",
"[0] * 10",
"ans",
"a, b = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"ab = str(x) + \"ab\" + str(y)",
"str(x) + \"ab\" + str(y)",
"ab",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W"
] | H, W, N = map(int, input().split())
AB = dict()
for i in range(N):
a, b = list(map(int, input().split()))
for i in range(3):
for j in range(3):
x = (a - 1) - i
y = (b - 1) - j
if (0 <= x < H - 2) and (0 <= y < W - 2):
ab = str(x) + "ab" + str(y)
if ab in AB:
AB[ab] += 1
else:
AB[ab] = 1
#print(AB)
ans = [0] * 10
for i in AB.values():
ans[i] += 1
ans[0] = (H - 2) * (W - 2) - sum(ans)
for i in range(10):
print(ans[i]) |
[
7,
15,
13,
0,
13,
12,
2,
4,
13,
13,
17,
23,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
39,
17,
17,
17,
0,
13,
4,
13,
0,
13,
2,
39,
17,
17,
28,
13,
13,
13,
28,
13,
13,
4,
18,
13,
13,
13,
0,
13,
17,
14,
40,
2,
2,
40,
17,
2,
13,
13,
2,
13,
17,
2,
40,
17,
2,
13,
13,
2,
13,
17,
9,
14,
2,
39,
2,
13,
13,
2,
13,
13,
13,
9,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
0,
13,
17,
28,
13,
13,
4,
18,
13,
13,
13,
0,
13,
17,
14,
2,
39,
2,
2,
13,
13,
13,
2,
2,
13,
13,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
28,
13,
13,
4,
13,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
39,
13
] | [
[
174,
4
],
[
192,
13
],
[
192,
22
],
[
192,
23
],
[
198,
25
],
[
175,
32
],
[
201,
39
],
[
177,
45
],
[
195,
49
],
[
202,
65
],
[
68,
67
],
[
187,
79
],
[
193,
88
],
[
178,
100
],
[
178,
104
],
[
189,
114
],
[
202,
123
],
[
126,
125
],
[
199,
140
],
[
183,
142
],
[
148,
145
],
[
196,
146
],
[
184,
147
],
[
190,
147
],
[
153,
150
],
[
196,
151
],
[
187,
156
],
[
193,
159
],
[
196,
164
],
[
169,
168
],
[
196,
168
],
[
168,
172
],
[
174,
175
],
[
177,
178
],
[
192,
181
],
[
183,
184
],
[
192,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
],
[
201,
202
]
] | [
"import itertools\n\nint1 = lambda x: int(x) - 1\n\nH, W, N = map(int, input().split())\nB = set(tuple(map(int1, input().split())) for _ in range(N))\n\nadj = (-1, 0, 1)\nvisited = set()\nans = [0] * 10\nfor a, b in B:\n for dy, dx in itertools.product(adj, repeat=2):\n if not (1 <= a + dy < H - 1 and 1 <= b + dx < W - 1):\n continue\n elif (a + dy, b + dx) in visited:\n continue\n visited.add((a + dy, b + dx))\n c = 0\n for ddy, ddx in itertools.product(adj, repeat=2):\n if (a + dy + ddy, b + dx + ddx) in B:\n c += 1\n ans[c] += 1\nans[0] = (H - 2) * (W - 2) - sum(ans[1:])\nfor x in ans:\n print(x)",
"import itertools",
"itertools",
"int1 = lambda x: int(x) - 1",
"int1",
"lambda x: int(x) - 1",
"int(x) - 1",
"int(x)",
"int",
"x",
"1",
"x",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"B = set(tuple(map(int1, input().split())) for _ in range(N))",
"B",
"set(tuple(map(int1, input().split())) for _ in range(N))",
"set",
"tuple(map(int1, input().split()))",
"tuple",
"map(int1, input().split())",
"map",
"int1",
"input().split()",
"().split",
"()",
"input",
"split",
"adj = (-1, 0, 1)",
"adj",
"(-1, 0, 1)",
"-1",
"0",
"1",
"visited = set()",
"visited",
"set()",
"set",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for a, b in B:\n for dy, dx in itertools.product(adj, repeat=2):\n if not (1 <= a + dy < H - 1 and 1 <= b + dx < W - 1):\n continue\n elif (a + dy, b + dx) in visited:\n continue\n visited.add((a + dy, b + dx))\n c = 0\n for ddy, ddx in itertools.product(adj, repeat=2):\n if (a + dy + ddy, b + dx + ddx) in B:\n c += 1\n ans[c] += 1",
"a",
"b",
"B",
"for dy, dx in itertools.product(adj, repeat=2):\n if not (1 <= a + dy < H - 1 and 1 <= b + dx < W - 1):\n continue\n elif (a + dy, b + dx) in visited:\n continue\n visited.add((a + dy, b + dx))\n c = 0\n for ddy, ddx in itertools.product(adj, repeat=2):\n if (a + dy + ddy, b + dx + ddx) in B:\n c += 1\n ans[c] += 1",
"dy",
"dx",
"itertools.product(adj, repeat=2)",
"itertools.product",
"itertools",
"product",
"adj",
"repeat=2",
"repeat",
"2",
"if not (1 <= a + dy < H - 1 and 1 <= b + dx < W - 1):\n continue\n elif (a + dy, b + dx) in visited:\n continue\n ",
"not (1 <= a + dy < H - 1 and 1 <= b + dx < W - 1)",
"1 <= a + dy < H - 1 and 1 <= b + dx < W - 1",
"1 <= a + dy < H - 1",
"1 <= a + dy",
"1",
"a + dy",
"a",
"dy",
"H - 1",
"H",
"1",
"1 <= b + dx < W - 1",
"1 <= b + dx",
"1",
"b + dx",
"b",
"dx",
"W - 1",
"W",
"1",
"continue",
"elif (a + dy, b + dx) in visited:\n continue\n ",
"(a + dy, b + dx) in visited",
"(a + dy, b + dx)",
"a + dy",
"a",
"dy",
"b + dx",
"b",
"dx",
"visited",
"continue",
"visited.add((a + dy, b + dx))",
"visited.add",
"visited",
"add",
"(a + dy, b + dx)",
"a + dy",
"a",
"dy",
"b + dx",
"b",
"dx",
"c = 0",
"c",
"0",
"for ddy, ddx in itertools.product(adj, repeat=2):\n if (a + dy + ddy, b + dx + ddx) in B:\n c += 1\n ",
"ddy",
"ddx",
"itertools.product(adj, repeat=2)",
"itertools.product",
"itertools",
"product",
"adj",
"repeat=2",
"repeat",
"2",
"if (a + dy + ddy, b + dx + ddx) in B:\n c += 1\n ",
"(a + dy + ddy, b + dx + ddx) in B",
"(a + dy + ddy, b + dx + ddx)",
"a + dy + ddy",
"a + dy",
"a",
"dy",
"ddy",
"b + dx + ddx",
"b + dx",
"b",
"dx",
"ddx",
"B",
"c += 1",
"c",
"1",
"ans[c] += 1",
"ans[c]",
"ans",
"c",
"1",
"ans[0] = (H - 2) * (W - 2) - sum(ans[1:])",
"ans[0]",
"ans",
"0",
"(H - 2) * (W - 2) - sum(ans[1:])",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"for x in ans:\n print(x)",
"x",
"ans",
"print(x)",
"print",
"x",
"int1 = lambda x: int(x) - 1",
"lambda x: int(x) - 1",
"int1",
"visited = set()",
"set()",
"visited",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"c += 1",
"1",
"c",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"c = 0",
"0",
"c",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"ans = [0] * 10",
"[0] * 10",
"ans",
"B = set(tuple(map(int1, input().split())) for _ in range(N))",
"set(tuple(map(int1, input().split())) for _ in range(N))",
"B",
"adj = (-1, 0, 1)",
"(-1, 0, 1)",
"adj"
] | import itertools
int1 = lambda x: int(x) - 1
H, W, N = map(int, input().split())
B = set(tuple(map(int1, input().split())) for _ in range(N))
adj = (-1, 0, 1)
visited = set()
ans = [0] * 10
for a, b in B:
for dy, dx in itertools.product(adj, repeat=2):
if not (1 <= a + dy < H - 1 and 1 <= b + dx < W - 1):
continue
elif (a + dy, b + dx) in visited:
continue
visited.add((a + dy, b + dx))
c = 0
for ddy, ddx in itertools.product(adj, repeat=2):
if (a + dy + ddy, b + dx + ddx) in B:
c += 1
ans[c] += 1
ans[0] = (H - 2) * (W - 2) - sum(ans[1:])
for x in ans:
print(x)
|
[
7,
17,
0,
13,
4,
18,
4,
13,
13,
17,
0,
13,
4,
13,
18,
13,
17,
0,
13,
4,
13,
18,
13,
17,
0,
13,
4,
13,
18,
13,
17,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
18,
4,
13,
13,
17,
0,
13,
4,
13,
18,
13,
17,
0,
13,
4,
13,
18,
13,
17,
28,
13,
4,
13,
17,
14,
2,
2,
2,
13,
13,
17,
2,
2,
13,
13,
2,
13,
17,
9,
28,
13,
4,
13,
17,
14,
2,
2,
2,
13,
13,
17,
2,
2,
13,
13,
2,
13,
17,
9,
14,
2,
39,
2,
13,
13,
2,
13,
13,
13,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
13,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
186,
3
],
[
177,
11
],
[
187,
15
],
[
195,
18
],
[
187,
22
],
[
198,
25
],
[
187,
29
],
[
192,
32
],
[
37,
36
],
[
199,
39
],
[
180,
41
],
[
183,
49
],
[
181,
53
],
[
187,
53
],
[
201,
56
],
[
181,
60
],
[
187,
60
],
[
64,
63
],
[
202,
71
],
[
63,
72
],
[
202,
76
],
[
63,
77
],
[
196,
79
],
[
84,
83
],
[
184,
91
],
[
83,
92
],
[
184,
96
],
[
83,
97
],
[
178,
99
],
[
184,
106
],
[
83,
107
],
[
202,
109
],
[
63,
110
],
[
193,
111
],
[
122,
113
],
[
193,
114
],
[
184,
117
],
[
83,
118
],
[
202,
120
],
[
63,
121
],
[
133,
124
],
[
193,
125
],
[
184,
128
],
[
83,
129
],
[
202,
131
],
[
63,
132
],
[
189,
135
],
[
144,
141
],
[
190,
142
],
[
196,
146
],
[
178,
149
],
[
153,
152
],
[
193,
152
],
[
160,
155
],
[
190,
156
],
[
193,
158
],
[
152,
159
],
[
165,
162
],
[
190,
163
],
[
168,
167
],
[
190,
174
],
[
167,
175
],
[
177,
178
],
[
180,
181
],
[
183,
184
],
[
186,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
],
[
201,
202
]
] | [
"\"\"\"\nl = input().split(\" \")\nw = int(l[0])\nh = int(l[1])\nn = int(l[2])\n\narray = [[0 for i in range(h)] for j in range(w)]\n\nfor i in range(n):\n\tl = input().split(\" \")\n\tx = int(l[0]) - 1\n\ty = int(l[1]) - 1\n\tfor i in range(3):\n\t\tfor j in range(3):\n\t\t\tif x+j-1 >=0 and x+j-1<w and y+i-1 >=0 and y+i-1<h:\n\t\t\t\tarray[x+j-1][y+i-1] += 1\n\nans = [0 for i in range(10)]\n\nfor i in range(h-2):\n\tfor j in range(w-2):\n\t\tans[array[j+1][i+1]] += 1\n\nfor a in ans:\n\tprint(a)\n\n\"\"\"\n\nl = input().split(\" \")\nw = int(l[0])\nh = int(l[1])\nn = int(l[2])\n\narray = dict()\n\nfor i in range(n):\n\tl = input().split(\" \")\n\tx = int(l[0])\n\ty = int(l[1])\n\tfor i in range(3):\n\t\tif y-i < 1 or y-i > h-2:\n\t\t\tcontinue\n\t\tfor j in range(3):\n\t\t\tif x-j < 1 or x-j > w-2:\n\t\t\t\tcontinue\n\t\t\tif (x-j, y-i) in array:\n\t\t\t\tarray[(x-j, y-i)] +=1\n\t\t\telse:\n\t\t\t\tarray[(x-j, y-i)] = 1\n\nans = [0] * 10\nans[0] = (h-2) * (w-2)\n \nfor i in array:\n ans[array[i]] += 1\n ans[0] -= 1\n\nfor i in range(10):\n print(ans[i])",
"\"\"\"\nl = input().split(\" \")\nw = int(l[0])\nh = int(l[1])\nn = int(l[2])\n\narray = [[0 for i in range(h)] for j in range(w)]\n\nfor i in range(n):\n\tl = input().split(\" \")\n\tx = int(l[0]) - 1\n\ty = int(l[1]) - 1\n\tfor i in range(3):\n\t\tfor j in range(3):\n\t\t\tif x+j-1 >=0 and x+j-1<w and y+i-1 >=0 and y+i-1<h:\n\t\t\t\tarray[x+j-1][y+i-1] += 1\n\nans = [0 for i in range(10)]\n\nfor i in range(h-2):\n\tfor j in range(w-2):\n\t\tans[array[j+1][i+1]] += 1\n\nfor a in ans:\n\tprint(a)\n\n\"\"\"",
"l = input().split(\" \")",
"l",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"w = int(l[0])",
"w",
"int(l[0])",
"int",
"l[0]",
"l",
"0",
"h = int(l[1])",
"h",
"int(l[1])",
"int",
"l[1]",
"l",
"1",
"n = int(l[2])",
"n",
"int(l[2])",
"int",
"l[2]",
"l",
"2",
"array = dict()",
"array",
"dict()",
"dict",
"for i in range(n):\n\tl = input().split(\" \")\n\tx = int(l[0])\n\ty = int(l[1])\n\tfor i in range(3):\n\t\tif y-i < 1 or y-i > h-2:\n\t\t\tcontinue\n\t\tfor j in range(3):\n\t\t\tif x-j < 1 or x-j > w-2:\n\t\t\t\tcontinue\n\t\t\tif (x-j, y-i) in array:\n\t\t\t\tarray[(x-j, y-i)] +=1\n\t\t\telse:\n\t\t\t\tarray[(x-j, y-i)] = 1",
"i",
"range(n)",
"range",
"n",
"l = input().split(\" \")",
"l",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"x = int(l[0])",
"x",
"int(l[0])",
"int",
"l[0]",
"l",
"0",
"y = int(l[1])",
"y",
"int(l[1])",
"int",
"l[1]",
"l",
"1",
"for i in range(3):\n\t\tif y-i < 1 or y-i > h-2:\n\t\t\tcontinue\n\t\tfor j in range(3):\n\t\t\tif x-j < 1 or x-j > w-2:\n\t\t\t\tcontinue\n\t\t\tif (x-j, y-i) in array:\n\t\t\t\tarray[(x-j, y-i)] +=1\n\t\t\telse:\n\t\t\t\tarray[(x-j, y-i)] = 1",
"i",
"range(3)",
"range",
"3",
"if y-i < 1 or y-i > h-2:\n\t\t\tcontinue\n\t\t",
"y-i < 1 or y-i > h-2",
"y-i < 1",
"y-i",
"y",
"i",
"1",
"y-i > h-2",
"y-i",
"y",
"i",
"h-2",
"h",
"2",
"continue",
"for j in range(3):\n\t\t\tif x-j < 1 or x-j > w-2:\n\t\t\t\tcontinue\n\t\t\tif (x-j, y-i) in array:\n\t\t\t\tarray[(x-j, y-i)] +=1\n\t\t\telse:\n\t\t\t\tarray[(x-j, y-i)] = 1",
"j",
"range(3)",
"range",
"3",
"if x-j < 1 or x-j > w-2:\n\t\t\t\tcontinue\n\t\t\t",
"x-j < 1 or x-j > w-2",
"x-j < 1",
"x-j",
"x",
"j",
"1",
"x-j > w-2",
"x-j",
"x",
"j",
"w-2",
"w",
"2",
"continue",
"if (x-j, y-i) in array:\n\t\t\t\tarray[(x-j, y-i)] +=1\n\t\t\telse:\n\t\t\t\tarray[(x-j, y-i)] = 1",
"(x-j, y-i) in array",
"(x-j, y-i)",
"x-j",
"x",
"j",
"y-i",
"y",
"i",
"array",
"array[(x-j, y-i)] +=1",
"array[(x-j, y-i)]",
"array",
"(x-j, y-i)",
"x-j",
"x",
"j",
"y-i",
"y",
"i",
"1",
"array[(x-j, y-i)] = 1",
"array[(x-j, y-i)]",
"array",
"(x-j, y-i)",
"x-j",
"x",
"j",
"y-i",
"y",
"i",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"ans[0] = (h-2) * (w-2)",
"ans[0]",
"ans",
"0",
"(h-2) * (w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"for i in array:\n ans[array[i]] += 1\n ans[0] -= 1",
"i",
"array",
"ans[array[i]] += 1",
"ans[array[i]]",
"ans",
"array[i]",
"array",
"i",
"1",
"ans[0] -= 1",
"ans[0]",
"ans",
"0",
"1",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"w = int(l[0])",
"int(l[0])",
"w",
"l = input().split(\" \")",
"input().split(\" \")",
"l",
"x = int(l[0])",
"int(l[0])",
"x",
"l = input().split(\" \")",
"input().split(\" \")",
"l",
"ans = [0] * 10",
"[0] * 10",
"ans",
"array = dict()",
"dict()",
"array",
"h = int(l[1])",
"int(l[1])",
"h",
"n = int(l[2])",
"int(l[2])",
"n",
"y = int(l[1])",
"int(l[1])",
"y"
] | """
l = input().split(" ")
w = int(l[0])
h = int(l[1])
n = int(l[2])
array = [[0 for i in range(h)] for j in range(w)]
for i in range(n):
l = input().split(" ")
x = int(l[0]) - 1
y = int(l[1]) - 1
for i in range(3):
for j in range(3):
if x+j-1 >=0 and x+j-1<w and y+i-1 >=0 and y+i-1<h:
array[x+j-1][y+i-1] += 1
ans = [0 for i in range(10)]
for i in range(h-2):
for j in range(w-2):
ans[array[j+1][i+1]] += 1
for a in ans:
print(a)
"""
l = input().split(" ")
w = int(l[0])
h = int(l[1])
n = int(l[2])
array = dict()
for i in range(n):
l = input().split(" ")
x = int(l[0])
y = int(l[1])
for i in range(3):
if y-i < 1 or y-i > h-2:
continue
for j in range(3):
if x-j < 1 or x-j > w-2:
continue
if (x-j, y-i) in array:
array[(x-j, y-i)] +=1
else:
array[(x-j, y-i)] = 1
ans = [0] * 10
ans[0] = (h-2) * (w-2)
for i in array:
ans[array[i]] += 1
ans[0] -= 1
for i in range(10):
print(ans[i]) |
[
7,
15,
13,
15,
13,
15,
13,
0,
13,
18,
18,
13,
13,
13,
12,
13,
0,
13,
39,
28,
13,
4,
13,
17,
2,
4,
13,
2,
13,
17,
17,
14,
2,
2,
13,
13,
17,
4,
18,
13,
13,
13,
14,
40,
13,
2,
13,
13,
4,
18,
13,
13,
2,
13,
13,
29,
13,
23,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
17,
0,
13,
13,
0,
13,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
2,
13,
17,
0,
13,
2,
13,
17,
29,
13,
23,
13,
23,
13,
12,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
18,
13,
13,
2,
17,
13,
29,
13,
23,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
39,
18,
13,
13,
13,
0,
13,
13,
4,
18,
13,
13,
0,
13,
12,
18,
13,
17,
23,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
17,
2,
13,
17,
4,
18,
13,
13,
0,
13,
12,
18,
13,
17,
23,
41,
28,
13,
4,
13,
4,
13,
13,
4,
18,
18,
13,
13,
17,
0,
13,
13,
29,
13,
23,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
17,
0,
13,
13,
0,
13,
13,
28,
13,
4,
13,
13,
0,
18,
13,
2,
2,
13,
13,
17,
2,
13,
17,
0,
13,
2,
13,
17,
29,
13,
23,
13,
23,
13,
12,
13,
14,
40,
13,
17,
41,
28,
13,
4,
13,
13,
4,
17,
29,
13,
41,
28,
13,
4,
13,
13,
4,
13,
29,
13,
23,
13,
23,
13,
6,
13,
12,
13,
0,
18,
13,
13,
13,
0,
18,
13,
13,
2,
39,
17,
2,
13,
17,
23,
13,
23,
13,
12,
13,
0,
13,
17,
42,
2,
13,
17,
0,
13,
18,
18,
13,
13,
13,
0,
13,
2,
13,
40,
13,
29,
13,
23,
13,
23,
13,
12,
13,
42,
40,
13,
18,
13,
13,
0,
18,
18,
13,
13,
13,
13,
0,
13,
2,
13,
40,
13,
23,
13,
23,
13,
23,
13,
17,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
4,
18,
13,
13,
39,
2,
2,
18,
13,
17,
17,
13,
2,
2,
18,
13,
17,
17,
13,
4,
18,
13,
13,
0,
13,
12,
18,
13,
17,
23,
4,
18,
13,
13,
0,
13,
12,
18,
13,
17,
23,
0,
13,
39,
28,
13,
13,
14,
2,
2,
2,
40,
18,
13,
17,
17,
2,
18,
13,
17,
2,
13,
17,
40,
18,
13,
17,
17,
2,
18,
13,
17,
2,
13,
17,
4,
18,
13,
13,
13,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
0,
13,
17,
14,
2,
4,
13,
13,
17,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
0,
13,
2,
13,
17,
14,
2,
2,
18,
18,
13,
13,
17,
18,
13,
17,
2,
18,
18,
13,
13,
17,
18,
13,
17,
0,
13,
17,
0,
18,
13,
13,
17,
0,
13,
17,
0,
18,
13,
17,
18,
13,
13,
18,
13,
17,
14,
2,
4,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
28,
13,
13,
4,
13,
13,
10,
12,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13,
10,
18,
13,
10,
18,
13,
10,
12,
13,
10,
17,
13,
10,
6,
13,
10,
4,
13,
10,
17,
13,
10,
12,
13,
10,
4,
13,
10,
39,
13,
10,
39,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
13,
13,
10,
4,
13
] | [
[
602,
8
],
[
18,
17
],
[
21,
20
],
[
58,
28
],
[
58,
34
],
[
20,
35
],
[
17,
39
],
[
20,
41
],
[
20,
44
],
[
58,
46
],
[
20,
47
],
[
17,
50
],
[
58,
53
],
[
20,
54
],
[
17,
56
],
[
58,
58
],
[
64,
63
],
[
97,
66
],
[
71,
70
],
[
74,
73
],
[
95,
74
],
[
77,
76
],
[
97,
79
],
[
84,
81
],
[
70,
82
],
[
76,
83
],
[
73,
85
],
[
88,
85
],
[
89,
88
],
[
73,
90
],
[
88,
90
],
[
70,
93
],
[
95,
95
],
[
97,
97
],
[
102,
101
],
[
125,
104
],
[
107,
106
],
[
110,
109
],
[
101,
112
],
[
115,
114
],
[
125,
117
],
[
109,
118
],
[
109,
121
],
[
114,
123
],
[
106,
123
],
[
125,
125
],
[
131,
130
],
[
199,
137
],
[
130,
138
],
[
142,
141
],
[
141,
145
],
[
149,
148
],
[
156,
155
],
[
165,
160
],
[
141,
162
],
[
155,
163
],
[
155,
166
],
[
141,
170
],
[
174,
173
],
[
182,
181
],
[
199,
186
],
[
141,
190
],
[
181,
191
],
[
195,
194
],
[
194,
197
],
[
199,
199
],
[
205,
204
],
[
242,
207
],
[
212,
211
],
[
215,
214
],
[
240,
215
],
[
218,
217
],
[
242,
220
],
[
229,
222
],
[
211,
223
],
[
242,
226
],
[
217,
227
],
[
214,
230
],
[
233,
230
],
[
234,
233
],
[
214,
235
],
[
233,
235
],
[
211,
238
],
[
240,
240
],
[
242,
242
],
[
272,
247
],
[
252,
251
],
[
270,
254
],
[
262,
261
],
[
270,
264
],
[
270,
270
],
[
272,
272
],
[
281,
278
],
[
293,
279
],
[
295,
281
],
[
286,
283
],
[
293,
284
],
[
295,
290
],
[
293,
293
],
[
295,
295
],
[
300,
299
],
[
323,
303
],
[
313,
303
],
[
307,
306
],
[
321,
309
],
[
323,
311
],
[
313,
311
],
[
314,
313
],
[
323,
315
],
[
313,
315
],
[
323,
317
],
[
313,
317
],
[
306,
319
],
[
299,
319
],
[
321,
321
],
[
323,
323
],
[
348,
328
],
[
340,
328
],
[
346,
330
],
[
338,
333
],
[
346,
335
],
[
348,
337
],
[
340,
337
],
[
350,
338
],
[
341,
340
],
[
348,
342
],
[
340,
342
],
[
348,
344
],
[
340,
344
],
[
346,
346
],
[
348,
348
],
[
350,
350
],
[
650,
353
],
[
603,
362
],
[
650,
364
],
[
650,
365
],
[
629,
367
],
[
371,
370
],
[
651,
373
],
[
617,
375
],
[
603,
384
],
[
388,
387
],
[
393,
392
],
[
630,
398
],
[
618,
404
],
[
387,
407
],
[
618,
411
],
[
392,
414
],
[
630,
417
],
[
421,
420
],
[
630,
428
],
[
432,
431
],
[
632,
438
],
[
442,
441
],
[
630,
441
],
[
441,
449
],
[
441,
454
],
[
627,
457
],
[
441,
461
],
[
441,
466
],
[
636,
469
],
[
633,
473
],
[
441,
475
],
[
479,
478
],
[
647,
485
],
[
593,
488
],
[
633,
494
],
[
605,
497
],
[
633,
499
],
[
611,
502
],
[
506,
505
],
[
633,
511
],
[
596,
514
],
[
505,
516
],
[
633,
523
],
[
597,
524
],
[
606,
527
],
[
633,
532
],
[
597,
533
],
[
606,
536
],
[
620,
539
],
[
545,
542
],
[
648,
543
],
[
612,
544
],
[
594,
544
],
[
600,
544
],
[
621,
544
],
[
599,
547
],
[
553,
550
],
[
606,
551
],
[
633,
554
],
[
597,
555
],
[
553,
556
],
[
606,
557
],
[
633,
563
],
[
569,
566
],
[
648,
567
],
[
627,
572
],
[
636,
575
],
[
297,
578
],
[
648,
580
],
[
585,
584
],
[
648,
584
],
[
584,
588
],
[
593,
594
],
[
596,
597
],
[
599,
600
],
[
602,
603
],
[
605,
606
],
[
611,
612
],
[
617,
618
],
[
620,
621
],
[
650,
627
],
[
629,
630
],
[
632,
633
],
[
650,
636
],
[
647,
648
],
[
650,
651
]
] | [
"import math\nimport fractions\nimport sys\ninput = sys.stdin.readline\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n # divisors.sort()\n return divisors\n\ndef ValueToBits(x,digit):\n res = [0 for i in range(digit)]\n now = x\n for i in range(digit):\n res[i]=now%2\n now = now >> 1\n return res\n\ndef BitsToValue(arr):\n n = len(arr)\n ans = 0\n for i in range(n):\n ans+= arr[i] * 2**i\n return ans\n\ndef ZipArray(a):\n aa = [[a[i],i]for i in range(n)]\n\n aa.sort(key = lambda x : x[0])\n for i in range(n):\n aa[i][0]=i+1\n aa.sort(key = lambda x : x[1])\n b=[aa[i][0] for i in range(len(a))]\n return b\n\ndef ValueToArray10(x, digit):\n ans = [0 for i in range(digit)]\n now = x\n for i in range(digit):\n ans[digit-i-1] = now%10\n now = now //10\n return ans\n\ndef Zeros(a,b):\n if(b<=-1):\n return [0 for i in range(a)]\n else:\n return [[0 for i in range(b)] for i in range(a)]\n\nclass Bit:\n def __init__(self, n):\n self.size = n\n self.tree = [0] * (n + 1)\n \n def sum(self, i):\n s = 0\n while i > 0:\n s += self.tree[i]\n i -= i & -i\n return s\n \n def add(self, i, x):\n while i <= self.size:\n self.tree[i] += x\n i += i & -i\n \n'''\ndef cmb(n, r, p):\n if (r < 0) or (n < r):\n return 0\n r = min(r, n - r)\n return fact[n] * factinv[r] * factinv[n-r] % p\n\np = 2\nN = 10 ** 6 + 2\nfact = [1, 1] # fact[n] = (n! mod p)\nfactinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)\ninv = [0, 1] # factinv 計算用\n\nfor i in range(2, N + 1):\n fact.append((fact[-1] * i) % p)\n inv.append((-inv[p % i] * (p // i)) % p)\n factinv.append((factinv[-1] * inv[-1]) % p)\n\n'''\n\n#a = list(map(int, input().split()))\n\n#################################################\n#################################################\n#################################################\n#################################################\n\n\nh,w,n = list(map(int, input().split()))\npainted = []\nfor i in range(n):\n t = list(map(int, input().split()))\n for j in range(3):\n for k in range(3):\n painted.append([t[0]-2+j, t[1]-2+k])\n \npainted.sort(key = lambda x : x[1])\npainted.sort(key = lambda x : x[0])\n\np2 = []\n\nfor i in painted:\n if(i[0]>=1 and i[0]<h-1 and i[1]>=1 and i[1]<w-1):\n p2.append(i)\n\n#print(p2)\nans = [0 for i in range(10)]\nchain=0\nif(len(p2)>0):\n before = p2[0]\n chain = 1\nfor ii in range(len(p2)-1):\n i = ii+1\n if(p2[i][0] == before[0] and p2[i][1] == before[1]):\n chain += 1\n else:\n ans[chain]+=1\n chain=1\n before[0],before[1] = p2[i]\nif(len(p2)>0): ans[chain]+=1\n\nans[0] = (h-2)*(w-2) - sum(ans[1:])\nfor i in ans:\n print(i)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
"import math",
"math",
"import fractions",
"fractions",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"def make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n # divisors.sort()\n return divisors",
"make_divisors",
"divisors = []",
"divisors",
"[]",
"for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n # divisors.sort()\n ",
"i",
"range(1, int(n**0.5)+1)",
"range",
"1",
"int(n**0.5)+1",
"int(n**0.5)",
"int",
"n**0.5",
"n",
"0.5",
"1",
"if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n # divisors.sort()\n ",
"n % i == 0",
"n % i",
"n",
"i",
"0",
"divisors.append(i)",
"divisors.append",
"divisors",
"append",
"i",
"if i != n // i:\n divisors.append(n//i)\n\n # divisors.sort()\n ",
"i != n // i",
"i",
"n // i",
"n",
"i",
"divisors.append(n//i)",
"divisors.append",
"divisors",
"append",
"n//i",
"n",
"i",
"return divisors",
"divisors",
"n",
"n",
"def ValueToBits(x,digit):\n res = [0 for i in range(digit)]\n now = x\n for i in range(digit):\n res[i]=now%2\n now = now >> 1\n return res",
"ValueToBits",
"0 for i in range(digit)",
"for i in range(digit)",
"i",
"range(digit)",
"range",
"digit",
"for i in range(digit)",
"0",
"res = [0 for i in range(digit)]",
"res",
"[0 for i in range(digit)]",
"now = x",
"now",
"x",
"for i in range(digit):\n res[i]=now%2\n now = now >> 1\n ",
"i",
"range(digit)",
"range",
"digit",
"res[i]=now%2",
"res[i]",
"res",
"i",
"now%2",
"now",
"2",
"now = now >> 1",
"now",
"now >> 1",
"now",
"1",
"return res",
"res",
"x",
"x",
"digit",
"digit",
"def BitsToValue(arr):\n n = len(arr)\n ans = 0\n for i in range(n):\n ans+= arr[i] * 2**i\n return ans",
"BitsToValue",
"n = len(arr)",
"n",
"len(arr)",
"len",
"arr",
"ans = 0",
"ans",
"0",
"for i in range(n):\n ans+= arr[i] * 2**i\n ",
"i",
"range(n)",
"range",
"n",
"ans+= arr[i] * 2**i",
"ans",
"arr[i] * 2**i",
"arr[i]",
"arr",
"i",
"2**i",
"2",
"i",
"return ans",
"ans",
"arr",
"arr",
"def ZipArray(a):\n aa = [[a[i],i]for i in range(n)]\n\n aa.sort(key = lambda x : x[0])\n for i in range(n):\n aa[i][0]=i+1\n aa.sort(key = lambda x : x[1])\n b=[aa[i][0] for i in range(len(a))]\n return b",
"ZipArray",
"[a[i],i]for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"[a[i],i]",
"a[i]",
"a",
"i",
"i",
"aa = [[a[i],i]for i in range(n)]",
"aa",
"[[a[i],i]for i in range(n)]",
"aa.sort(key = lambda x : x[0])",
"aa.sort",
"aa",
"sort",
"key = lambda x : x[0]",
"key",
"lambda x : x[0]",
"x[0]",
"x",
"0",
"x",
"for i in range(n):\n aa[i][0]=i+1\n ",
"i",
"range(n)",
"range",
"n",
"aa[i][0]=i+1",
"aa[i][0]",
"[i]",
"aa",
"i",
"0",
"i+1",
"i",
"1",
"aa.sort(key = lambda x : x[1])",
"aa.sort",
"aa",
"sort",
"key = lambda x : x[1]",
"key",
"lambda x : x[1]",
"x[1]",
"x",
"1",
"x",
"aa[i][0] for i in range(len(a))",
"for i in range(len(a))",
"i",
"range(len(a))",
"range",
"len(a)",
"len",
"a",
"for i in range(len(a))",
"aa[i][0]",
"[i]",
"aa",
"i",
"0",
"b=[aa[i][0] for i in range(len(a))]",
"b",
"[aa[i][0] for i in range(len(a))]",
"return b",
"b",
"a",
"a",
"def ValueToArray10(x, digit):\n ans = [0 for i in range(digit)]\n now = x\n for i in range(digit):\n ans[digit-i-1] = now%10\n now = now //10\n return ans",
"ValueToArray10",
"0 for i in range(digit)",
"for i in range(digit)",
"i",
"range(digit)",
"range",
"digit",
"for i in range(digit)",
"0",
"ans = [0 for i in range(digit)]",
"ans",
"[0 for i in range(digit)]",
"now = x",
"now",
"x",
"for i in range(digit):\n ans[digit-i-1] = now%10\n now = now //10\n ",
"i",
"range(digit)",
"range",
"digit",
"ans[digit-i-1] = now%10",
"ans[digit-i-1]",
"ans",
"digit-i-1",
"digit-i",
"digit",
"i",
"1",
"now%10",
"now",
"10",
"now = now //10",
"now",
"now //10",
"now",
"10",
"return ans",
"ans",
"x",
"x",
"digit",
"digit",
"def Zeros(a,b):\n if(b<=-1):\n return [0 for i in range(a)]\n else:\n return [[0 for i in range(b)] for i in range(a)]",
"Zeros",
"if(b<=-1):\n return [0 for i in range(a)]\n else:\n return [[0 for i in range(b)] for i in range(a)]",
"b<=-1",
"b",
"-1",
"0 for i in range(a)",
"for i in range(a)",
"i",
"range(a)",
"range",
"a",
"for i in range(a)",
"0",
"return [0 for i in range(a)]",
"[0 for i in range(a)]",
"[0 for i in range(b)] for i in range(a)",
"for i in range(a)",
"i",
"range(a)",
"range",
"a",
"for i in range(a)",
"[0 for i in range(b)]",
"return [[0 for i in range(b)] for i in range(a)]",
"[[0 for i in range(b)] for i in range(a)]",
"a",
"a",
"b",
"b",
"class Bit:\n def __init__(self, n):\n self.size = n\n self.tree = [0] * (n + 1)\n \n def sum(self, i):\n s = 0\n while i > 0:\n s += self.tree[i]\n i -= i & -i\n return s\n \n def add(self, i, x):\n while i <= self.size:\n self.tree[i] += x\n i += i & -i\n ",
"Bit",
"def __init__(self, n):\n self.size = n\n self.tree = [0] * (n + 1)\n \n ",
"__init__",
"self.size = n",
"self.size",
"self",
"size",
"n",
"self.tree = [0] * (n + 1)",
"self.tree",
"self",
"tree",
"[0] * (n + 1)",
"[0]",
"0",
"n + 1",
"n",
"1",
"self",
"self",
"n",
"n",
"def sum(self, i):\n s = 0\n while i > 0:\n s += self.tree[i]\n i -= i & -i\n return s\n \n ",
"sum",
"s = 0",
"s",
"0",
"while i > 0:\n s += self.tree[i]\n i -= i & -i\n ",
"i > 0",
"i",
"0",
"s += self.tree[i]",
"s",
"self.tree[i]",
"self.tree",
"self",
"tree",
"i",
"i -= i & -i",
"i",
"i & -i",
"i",
"-i",
"i",
"return s",
"s",
"self",
"self",
"i",
"i",
"def add(self, i, x):\n while i <= self.size:\n self.tree[i] += x\n i += i & -i\n ",
"add",
"while i <= self.size:\n self.tree[i] += x\n i += i & -i\n ",
"i <= self.size",
"i",
"self.size",
"self",
"size",
"self.tree[i] += x",
"self.tree[i]",
"self.tree",
"self",
"tree",
"i",
"x",
"i += i & -i",
"i",
"i & -i",
"i",
"-i",
"i",
"self",
"self",
"i",
"i",
"x",
"x",
"'''\ndef cmb(n, r, p):\n if (r < 0) or (n < r):\n return 0\n r = min(r, n - r)\n return fact[n] * factinv[r] * factinv[n-r] % p\n\np = 2\nN = 10 ** 6 + 2\nfact = [1, 1] # fact[n] = (n! mod p)\nfactinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)\ninv = [0, 1] # factinv 計算用\n\nfor i in range(2, N + 1):\n fact.append((fact[-1] * i) % p)\n inv.append((-inv[p % i] * (p // i)) % p)\n factinv.append((factinv[-1] * inv[-1]) % p)\n\n'''",
"h,w,n = list(map(int, input().split()))",
"h",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"painted = []",
"painted",
"[]",
"for i in range(n):\n t = list(map(int, input().split()))\n for j in range(3):\n for k in range(3):\n painted.append([t[0]-2+j, t[1]-2+k])\n ",
"i",
"range(n)",
"range",
"n",
"t = list(map(int, input().split()))",
"t",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"for j in range(3):\n for k in range(3):\n painted.append([t[0]-2+j, t[1]-2+k])\n ",
"j",
"range(3)",
"range",
"3",
"for k in range(3):\n painted.append([t[0]-2+j, t[1]-2+k])\n ",
"k",
"range(3)",
"range",
"3",
"painted.append([t[0]-2+j, t[1]-2+k])",
"painted.append",
"painted",
"append",
"[t[0]-2+j, t[1]-2+k]",
"t[0]-2+j",
"t[0]-2",
"t[0]",
"t",
"0",
"2",
"j",
"t[1]-2+k",
"t[1]-2",
"t[1]",
"t",
"1",
"2",
"k",
"painted.sort(key = lambda x : x[1])",
"painted.sort",
"painted",
"sort",
"key = lambda x : x[1]",
"key",
"lambda x : x[1]",
"x[1]",
"x",
"1",
"x",
"painted.sort(key = lambda x : x[0])",
"painted.sort",
"painted",
"sort",
"key = lambda x : x[0]",
"key",
"lambda x : x[0]",
"x[0]",
"x",
"0",
"x",
"p2 = []",
"p2",
"[]",
"for i in painted:\n if(i[0]>=1 and i[0]<h-1 and i[1]>=1 and i[1]<w-1):\n p2.append(i)\n\n#print(p2)",
"i",
"painted",
"if(i[0]>=1 and i[0]<h-1 and i[1]>=1 and i[1]<w-1):\n p2.append(i)\n\n#print(p2)",
"i[0]>=1 and i[0]<h-1 and i[1]>=1 and i[1]<w-1",
"i[0]>=1 and i[0]<h-1 and i[1]>=1",
"i[0]>=1 and i[0]<h-1",
"i[0]>=1",
"i[0]",
"i",
"0",
"1",
"i[0]<h-1",
"i[0]",
"i",
"0",
"h-1",
"h",
"1",
"i[1]>=1",
"i[1]",
"i",
"1",
"1",
"i[1]<w-1",
"i[1]",
"i",
"1",
"w-1",
"w",
"1",
"p2.append(i)",
"p2.append",
"p2",
"append",
"i",
"0 for i in range(10)",
"for i in range(10)",
"i",
"range(10)",
"range",
"10",
"for i in range(10)",
"0",
"ans = [0 for i in range(10)]",
"ans",
"[0 for i in range(10)]",
"chain=0",
"chain",
"0",
"if(len(p2)>0):\n before = p2[0]\n chain = 1",
"len(p2)>0",
"len(p2)",
"len",
"p2",
"0",
"before = p2[0]",
"before",
"p2[0]",
"p2",
"0",
"chain = 1",
"chain",
"1",
"for ii in range(len(p2)-1):\n i = ii+1\n if(p2[i][0] == before[0] and p2[i][1] == before[1]):\n chain += 1\n else:\n ans[chain]+=1\n chain=1\n before[0],before[1] = p2[i]",
"ii",
"range(len(p2)-1)",
"range",
"len(p2)-1",
"len(p2)",
"len",
"p2",
"1",
"i = ii+1",
"i",
"ii+1",
"ii",
"1",
"if(p2[i][0] == before[0] and p2[i][1] == before[1]):\n chain += 1\n else:\n ans[chain]+=1\n chain=1\n before[0],before[1] = p2[i]",
"p2[i][0] == before[0] and p2[i][1] == before[1]",
"p2[i][0] == before[0]",
"p2[i][0]",
"[i]",
"p2",
"i",
"0",
"before[0]",
"before",
"0",
"p2[i][1] == before[1]",
"p2[i][1]",
"[i]",
"p2",
"i",
"1",
"before[1]",
"before",
"1",
"chain += 1",
"chain",
"1",
"ans[chain]+=1",
"ans[chain]",
"ans",
"chain",
"1",
"chain=1",
"chain",
"1",
"before[0],before[1] = p2[i]",
"before[0]",
"before",
"0",
"p2[i]",
"p2",
"i",
"before[1]",
"before",
"1",
"if(len(p2)>0): ans[chain]+=1",
"len(p2)>0",
"len(p2)",
"len",
"p2",
"0",
"ans[0] = (h-2)*(w-2) - sum(ans[1:])",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2) - sum(ans[1:])",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"def Zeros(a,b):\n if(b<=-1):\n return [0 for i in range(a)]\n else:\n return [[0 for i in range(b)] for i in range(a)]",
"def Zeros(a,b):\n if(b<=-1):\n return [0 for i in range(a)]\n else:\n return [[0 for i in range(b)] for i in range(a)]",
"Zeros",
"chain=0",
"0",
"chain",
"i = ii+1",
"ii+1",
"i",
"chain=1",
"1",
"chain",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"before = p2[0]",
"p2[0]",
"before",
"def ValueToBits(x,digit):\n res = [0 for i in range(digit)]\n now = x\n for i in range(digit):\n res[i]=now%2\n now = now >> 1\n return res",
"def ValueToBits(x,digit):\n res = [0 for i in range(digit)]\n now = x\n for i in range(digit):\n res[i]=now%2\n now = now >> 1\n return res",
"ValueToBits",
"chain = 1",
"1",
"chain",
"class Bit:\n def __init__(self, n):\n self.size = n\n self.tree = [0] * (n + 1)\n \n def sum(self, i):\n s = 0\n while i > 0:\n s += self.tree[i]\n i -= i & -i\n return s\n \n def add(self, i, x):\n while i <= self.size:\n self.tree[i] += x\n i += i & -i\n ",
"class Bit:\n def __init__(self, n):\n self.size = n\n self.tree = [0] * (n + 1)\n \n def sum(self, i):\n s = 0\n while i > 0:\n s += self.tree[i]\n i -= i & -i\n return s\n \n def add(self, i, x):\n while i <= self.size:\n self.tree[i] += x\n i += i & -i\n ",
"Bit",
"t = list(map(int, input().split()))",
"list(map(int, input().split()))",
"t",
"chain += 1",
"1",
"chain",
"def BitsToValue(arr):\n n = len(arr)\n ans = 0\n for i in range(n):\n ans+= arr[i] * 2**i\n return ans",
"def BitsToValue(arr):\n n = len(arr)\n ans = 0\n for i in range(n):\n ans+= arr[i] * 2**i\n return ans",
"BitsToValue",
"h,w,n = list(map(int, input().split()))",
"list(map(int, input().split()))",
"h",
"painted = []",
"[]",
"painted",
"p2 = []",
"[]",
"p2",
"w,n = list(map(int, input().split()))",
"list(map(int, input().split()))",
"w",
"def ValueToArray10(x, digit):\n ans = [0 for i in range(digit)]\n now = x\n for i in range(digit):\n ans[digit-i-1] = now%10\n now = now //10\n return ans",
"def ValueToArray10(x, digit):\n ans = [0 for i in range(digit)]\n now = x\n for i in range(digit):\n ans[digit-i-1] = now%10\n now = now //10\n return ans",
"ValueToArray10",
"def ZipArray(a):\n aa = [[a[i],i]for i in range(n)]\n\n aa.sort(key = lambda x : x[0])\n for i in range(n):\n aa[i][0]=i+1\n aa.sort(key = lambda x : x[1])\n b=[aa[i][0] for i in range(len(a))]\n return b",
"def ZipArray(a):\n aa = [[a[i],i]for i in range(n)]\n\n aa.sort(key = lambda x : x[0])\n for i in range(n):\n aa[i][0]=i+1\n aa.sort(key = lambda x : x[1])\n b=[aa[i][0] for i in range(len(a))]\n return b",
"ZipArray",
"def make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n # divisors.sort()\n return divisors",
"def make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n # divisors.sort()\n return divisors",
"make_divisors",
"ans = [0 for i in range(10)]",
"[0 for i in range(10)]",
"ans",
"n = list(map(int, input().split()))",
"list(map(int, input().split()))",
"n"
] | import math
import fractions
import sys
input = sys.stdin.readline
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
# divisors.sort()
return divisors
def ValueToBits(x,digit):
res = [0 for i in range(digit)]
now = x
for i in range(digit):
res[i]=now%2
now = now >> 1
return res
def BitsToValue(arr):
n = len(arr)
ans = 0
for i in range(n):
ans+= arr[i] * 2**i
return ans
def ZipArray(a):
aa = [[a[i],i]for i in range(n)]
aa.sort(key = lambda x : x[0])
for i in range(n):
aa[i][0]=i+1
aa.sort(key = lambda x : x[1])
b=[aa[i][0] for i in range(len(a))]
return b
def ValueToArray10(x, digit):
ans = [0 for i in range(digit)]
now = x
for i in range(digit):
ans[digit-i-1] = now%10
now = now //10
return ans
def Zeros(a,b):
if(b<=-1):
return [0 for i in range(a)]
else:
return [[0 for i in range(b)] for i in range(a)]
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(self, i, x):
while i <= self.size:
self.tree[i] += x
i += i & -i
'''
def cmb(n, r, p):
if (r < 0) or (n < r):
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n-r] % p
p = 2
N = 10 ** 6 + 2
fact = [1, 1] # fact[n] = (n! mod p)
factinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1] # factinv 計算用
for i in range(2, N + 1):
fact.append((fact[-1] * i) % p)
inv.append((-inv[p % i] * (p // i)) % p)
factinv.append((factinv[-1] * inv[-1]) % p)
'''
#a = list(map(int, input().split()))
#################################################
#################################################
#################################################
#################################################
h,w,n = list(map(int, input().split()))
painted = []
for i in range(n):
t = list(map(int, input().split()))
for j in range(3):
for k in range(3):
painted.append([t[0]-2+j, t[1]-2+k])
painted.sort(key = lambda x : x[1])
painted.sort(key = lambda x : x[0])
p2 = []
for i in painted:
if(i[0]>=1 and i[0]<h-1 and i[1]>=1 and i[1]<w-1):
p2.append(i)
#print(p2)
ans = [0 for i in range(10)]
chain=0
if(len(p2)>0):
before = p2[0]
chain = 1
for ii in range(len(p2)-1):
i = ii+1
if(p2[i][0] == before[0] and p2[i][1] == before[1]):
chain += 1
else:
ans[chain]+=1
chain=1
before[0],before[1] = p2[i]
if(len(p2)>0): ans[chain]+=1
ans[0] = (h-2)*(w-2) - sum(ans[1:])
for i in ans:
print(i)
|
[
7,
15,
15,
15,
13,
15,
13,
15,
13,
15,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
17,
0,
13,
13,
28,
13,
4,
13,
13,
29,
13,
23,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
17,
0,
13,
13,
28,
13,
4,
13,
13,
29,
13,
23,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
17,
0,
13,
13,
28,
13,
4,
13,
13,
29,
13,
23,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
17,
0,
13,
13,
28,
13,
4,
13,
13,
29,
13,
23,
13,
0,
13,
17,
0,
13,
4,
13,
13,
13,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
14,
2,
2,
2,
17,
2,
13,
13,
2,
13,
17,
2,
2,
17,
2,
13,
13,
2,
13,
17,
0,
18,
13,
2,
2,
2,
2,
13,
13,
13,
13,
13,
17,
0,
18,
13,
18,
13,
2,
2,
2,
2,
13,
13,
13,
13,
13,
17,
0,
18,
13,
2,
18,
13,
2,
2,
2,
2,
13,
13,
13,
13,
13,
17,
17,
28,
13,
13,
4,
13,
13,
10,
17,
13,
10,
12,
13,
10,
17,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
13,
13
] | [
[
24,
23
],
[
40,
26
],
[
31,
30
],
[
34,
33
],
[
40,
36
],
[
30,
38
],
[
40,
40
],
[
46,
45
],
[
62,
48
],
[
53,
52
],
[
56,
55
],
[
62,
58
],
[
52,
60
],
[
62,
62
],
[
68,
67
],
[
84,
70
],
[
75,
74
],
[
78,
77
],
[
84,
80
],
[
74,
82
],
[
84,
84
],
[
90,
89
],
[
106,
92
],
[
97,
96
],
[
100,
99
],
[
106,
102
],
[
96,
104
],
[
106,
106
],
[
243,
108
],
[
282,
111
],
[
292,
113
],
[
282,
114
],
[
282,
115
],
[
119,
118
],
[
294,
125
],
[
131,
128
],
[
295,
129
],
[
262,
133
],
[
256,
136
],
[
285,
139
],
[
145,
144
],
[
283,
147
],
[
279,
149
],
[
292,
151
],
[
279,
152
],
[
276,
154
],
[
249,
157
],
[
161,
160
],
[
167,
166
],
[
277,
177
],
[
280,
177
],
[
160,
178
],
[
262,
180
],
[
250,
186
],
[
265,
186
],
[
166,
187
],
[
256,
189
],
[
203,
192
],
[
286,
193
],
[
277,
198
],
[
280,
198
],
[
160,
199
],
[
256,
200
],
[
250,
201
],
[
265,
201
],
[
166,
202
],
[
218,
205
],
[
295,
206
],
[
286,
208
],
[
277,
213
],
[
280,
213
],
[
160,
214
],
[
256,
215
],
[
250,
216
],
[
265,
216
],
[
166,
217
],
[
235,
220
],
[
295,
221
],
[
286,
224
],
[
277,
229
],
[
280,
229
],
[
160,
230
],
[
256,
231
],
[
250,
232
],
[
265,
232
],
[
166,
233
],
[
238,
237
],
[
295,
237
],
[
237,
241
],
[
243,
244
],
[
249,
250
],
[
282,
256
],
[
282,
262
],
[
279,
265
],
[
276,
277
],
[
279,
280
],
[
282,
283
],
[
285,
286
],
[
294,
295
]
] | [
"#!usr/bin/env python3\nfrom collections import defaultdict\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef I(): return int(sys.stdin.readline())\ndef LS():return list(map(list, sys.stdin.readline().split()))\ndef S(): return list(sys.stdin.readline())[:-1]\ndef IR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = I()\n return l\ndef LIR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = LI()\n return l\ndef SR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = S()\n return l\ndef LSR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = SR()\n return l\nmod = 1000000007\n\n#A\n\n#B\n\n#C\n\n#D\nh,w,n = LI()\ndp = [0 for i in range(10)]\ndp[0] = (h-2)*(w-2)\nq = defaultdict(int)\nfor i in range(n):\n a,b = LI()\n a -= 1\n b -= 1\n for i in [-1,0,1]:\n for j in [-1,0,1]:\n if 0 < a+i < h-1 and 0 < b+j < w-1:\n q[(a+i)*w+b+j] += 1\n dp[q[(a+i)*w+b+j]] += 1\n dp[q[(a+i)*w+b+j]-1] -= 1\nfor i in dp:\n print(i)\n#E\n\n#F\n\n#G\n\n#H\n\n#I\n\n#J\n\n#K\n\n#L\n\n#M\n\n#N\n\n#O\n\n#P\n\n#Q\n\n#R\n\n#S\n\n#T",
"from collections import defaultdict",
"from heapq import heappush, heappop",
"import sys",
"sys",
"import math",
"math",
"import bisect",
"bisect",
"import random",
"random",
"def LI(): return list(map(int, sys.stdin.readline().split()))",
"LI",
"def I(): return int(sys.stdin.readline())",
"I",
"def LS():return list(map(list, sys.stdin.readline().split()))",
"LS",
"def S(): return list(sys.stdin.readline())[:-1]",
"S",
"def IR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = I()\n return l",
"IR",
"None for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"None",
"l = [None for i in range(n)]",
"l",
"[None for i in range(n)]",
"for i in range(n):l[i] = I()\n ",
"i",
"range(n)",
"range",
"n",
"return l",
"l",
"n",
"n",
"def LIR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = LI()\n return l",
"LIR",
"None for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"None",
"l = [None for i in range(n)]",
"l",
"[None for i in range(n)]",
"for i in range(n):l[i] = LI()\n ",
"i",
"range(n)",
"range",
"n",
"return l",
"l",
"n",
"n",
"def SR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = S()\n return l",
"SR",
"None for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"None",
"l = [None for i in range(n)]",
"l",
"[None for i in range(n)]",
"for i in range(n):l[i] = S()\n ",
"i",
"range(n)",
"range",
"n",
"return l",
"l",
"n",
"n",
"def LSR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = SR()\n return l",
"LSR",
"None for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"None",
"l = [None for i in range(n)]",
"l",
"[None for i in range(n)]",
"for i in range(n):l[i] = SR()\n ",
"i",
"range(n)",
"range",
"n",
"return l",
"l",
"n",
"n",
"mod = 1000000007",
"mod",
"1000000007",
"h,w,n = LI()",
"h",
"LI()",
"LI",
"w",
"n",
"0 for i in range(10)",
"for i in range(10)",
"i",
"range(10)",
"range",
"10",
"for i in range(10)",
"0",
"dp = [0 for i in range(10)]",
"dp",
"[0 for i in range(10)]",
"dp[0] = (h-2)*(w-2)",
"dp[0]",
"dp",
"0",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"q = defaultdict(int)",
"q",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(n):\n a,b = LI()\n a -= 1\n b -= 1\n for i in [-1,0,1]:\n for j in [-1,0,1]:\n if 0 < a+i < h-1 and 0 < b+j < w-1:\n q[(a+i)*w+b+j] += 1\n dp[q[(a+i)*w+b+j]] += 1\n dp[q[(a+i)*w+b+j]-1] -= 1",
"i",
"range(n)",
"range",
"n",
"a,b = LI()",
"a",
"LI()",
"LI",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for i in [-1,0,1]:\n for j in [-1,0,1]:\n if 0 < a+i < h-1 and 0 < b+j < w-1:\n q[(a+i)*w+b+j] += 1\n dp[q[(a+i)*w+b+j]] += 1\n dp[q[(a+i)*w+b+j]-1] -= 1",
"i",
"[-1,0,1]",
"-1",
"0",
"1",
"for j in [-1,0,1]:\n if 0 < a+i < h-1 and 0 < b+j < w-1:\n q[(a+i)*w+b+j] += 1\n dp[q[(a+i)*w+b+j]] += 1\n dp[q[(a+i)*w+b+j]-1] -= 1",
"j",
"[-1,0,1]",
"-1",
"0",
"1",
"if 0 < a+i < h-1 and 0 < b+j < w-1:\n q[(a+i)*w+b+j] += 1\n dp[q[(a+i)*w+b+j]] += 1\n dp[q[(a+i)*w+b+j]-1] -= 1",
"0 < a+i < h-1 and 0 < b+j < w-1",
"0 < a+i < h-1",
"0 < a+i",
"0",
"a+i",
"a",
"i",
"h-1",
"h",
"1",
"0 < b+j < w-1",
"0 < b+j",
"0",
"b+j",
"b",
"j",
"w-1",
"w",
"1",
"q[(a+i)*w+b+j] += 1",
"q[(a+i)*w+b+j]",
"q",
"(a+i)*w+b+j",
"(a+i)*w+b",
"(a+i)*w",
"a+i",
"a",
"i",
"w",
"b",
"j",
"1",
"dp[q[(a+i)*w+b+j]] += 1",
"dp[q[(a+i)*w+b+j]]",
"dp",
"q[(a+i)*w+b+j]",
"q",
"(a+i)*w+b+j",
"(a+i)*w+b",
"(a+i)*w",
"a+i",
"a",
"i",
"w",
"b",
"j",
"1",
"dp[q[(a+i)*w+b+j]-1] -= 1",
"dp[q[(a+i)*w+b+j]-1]",
"dp",
"q[(a+i)*w+b+j]-1",
"q[(a+i)*w+b+j]",
"q",
"(a+i)*w+b+j",
"(a+i)*w+b",
"(a+i)*w",
"a+i",
"a",
"i",
"w",
"b",
"j",
"1",
"1",
"for i in dp:\n print(i)\n#E\n\n#F\n\n#G\n\n#H\n\n#I\n\n#J\n\n#K\n\n#L\n\n#M\n\n#N\n\n#O\n\n#P\n\n#Q\n\n#R\n\n#S\n\n#T",
"i",
"dp",
"print(i)",
"print",
"i",
"mod = 1000000007",
"1000000007",
"mod",
"def LIR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = LI()\n return l",
"def LIR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = LI()\n return l",
"LIR",
"b -= 1",
"1",
"b",
"def LSR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = SR()\n return l",
"def LSR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = SR()\n return l",
"LSR",
"w,n = LI()",
"LI()",
"w",
"def SR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = S()\n return l",
"def SR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = S()\n return l",
"SR",
"h,w,n = LI()",
"LI()",
"h",
"b = LI()",
"LI()",
"b",
"def IR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = I()\n return l",
"def IR(n):\n l = [None for i in range(n)]\n for i in range(n):l[i] = I()\n return l",
"IR",
"def I(): return int(sys.stdin.readline())",
"def I(): return int(sys.stdin.readline())",
"I",
"def LS():return list(map(list, sys.stdin.readline().split()))",
"def LS():return list(map(list, sys.stdin.readline().split()))",
"LS",
"a -= 1",
"1",
"a",
"a,b = LI()",
"LI()",
"a",
"n = LI()",
"LI()",
"n",
"q = defaultdict(int)",
"defaultdict(int)",
"q",
"def S(): return list(sys.stdin.readline())[:-1]",
"def S(): return list(sys.stdin.readline())[:-1]",
"S",
"def LI(): return list(map(int, sys.stdin.readline().split()))",
"def LI(): return list(map(int, sys.stdin.readline().split()))",
"LI",
"dp = [0 for i in range(10)]",
"[0 for i in range(10)]",
"dp"
] | #!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
l = [None for i in range(n)]
for i in range(n):l[i] = I()
return l
def LIR(n):
l = [None for i in range(n)]
for i in range(n):l[i] = LI()
return l
def SR(n):
l = [None for i in range(n)]
for i in range(n):l[i] = S()
return l
def LSR(n):
l = [None for i in range(n)]
for i in range(n):l[i] = SR()
return l
mod = 1000000007
#A
#B
#C
#D
h,w,n = LI()
dp = [0 for i in range(10)]
dp[0] = (h-2)*(w-2)
q = defaultdict(int)
for i in range(n):
a,b = LI()
a -= 1
b -= 1
for i in [-1,0,1]:
for j in [-1,0,1]:
if 0 < a+i < h-1 and 0 < b+j < w-1:
q[(a+i)*w+b+j] += 1
dp[q[(a+i)*w+b+j]] += 1
dp[q[(a+i)*w+b+j]-1] -= 1
for i in dp:
print(i)
#E
#F
#G
#H
#I
#J
#K
#L
#M
#N
#O
#P
#Q
#R
#S
#T
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
0,
13,
2,
2,
13,
17,
13,
13,
2,
2,
13,
17,
13,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
14,
40,
2,
13,
4,
18,
13,
13,
0,
18,
13,
13,
21,
22,
13,
17,
14,
40,
2,
13,
4,
18,
18,
13,
13,
13,
0,
18,
18,
13,
13,
13,
17,
0,
18,
18,
13,
13,
13,
17,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
0,
13,
17,
28,
13,
13,
4,
18,
13,
13,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
13,
28,
13,
13,
4,
13,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13
] | [
[
195,
2
],
[
195,
11
],
[
195,
12
],
[
201,
14
],
[
18,
17
],
[
193,
20
],
[
183,
22
],
[
183,
33
],
[
36,
35
],
[
42,
41
],
[
198,
47
],
[
184,
50
],
[
35,
52
],
[
171,
53
],
[
178,
56
],
[
41,
58
],
[
199,
64
],
[
196,
66
],
[
172,
71
],
[
187,
73
],
[
199,
78
],
[
202,
81
],
[
87,
84
],
[
202,
85
],
[
199,
86
],
[
172,
94
],
[
84,
97
],
[
202,
98
],
[
199,
99
],
[
107,
102
],
[
84,
103
],
[
202,
104
],
[
199,
105
],
[
172,
106
],
[
114,
109
],
[
84,
110
],
[
202,
111
],
[
199,
112
],
[
172,
113
],
[
118,
117
],
[
189,
124
],
[
174,
127
],
[
202,
134
],
[
147,
144
],
[
190,
145
],
[
180,
149
],
[
155,
152
],
[
190,
153
],
[
196,
158
],
[
187,
161
],
[
181,
163
],
[
175,
163
],
[
166,
165
],
[
190,
165
],
[
165,
169
],
[
171,
172
],
[
174,
175
],
[
183,
178
],
[
180,
181
],
[
183,
184
],
[
195,
187
],
[
189,
190
],
[
195,
193
],
[
195,
196
],
[
198,
199
],
[
201,
202
]
] | [
"H, W, N = map(int, input().split())\n\n\ngraph = {}\nfor _ in range(N):\n a, b = list(map(int, input().split()))\n for i in [-1, 0, 1]:\n for j in [-1, 0, 1]:\n na, nb = a-1+i, b-1+j\n if 1 <= na <= H-2 and 1 <= nb <= W-2:\n if not na in graph.keys():\n graph[na] = {nb: 1}\n elif not nb in graph[na].keys():\n graph[na][nb] = 1\n else:\n graph[na][nb] += 1\n#print(graph)\nans = [0 for _ in range(10)]\nS = 0\nfor a, v_graph in graph.items():\n for b, v in v_graph.items():\n ans[v] += 1\n S += 1\nans[0] = (H-2)*(W-2) - S\nfor a in ans:\n print(a)",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"graph = {}",
"graph",
"{}",
"for _ in range(N):\n a, b = list(map(int, input().split()))\n for i in [-1, 0, 1]:\n for j in [-1, 0, 1]:\n na, nb = a-1+i, b-1+j\n if 1 <= na <= H-2 and 1 <= nb <= W-2:\n if not na in graph.keys():\n graph[na] = {nb: 1}\n elif not nb in graph[na].keys():\n graph[na][nb] = 1\n else:\n graph[na][nb] += 1\n#print(graph)",
"_",
"range(N)",
"range",
"N",
"a, b = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in [-1, 0, 1]:\n for j in [-1, 0, 1]:\n na, nb = a-1+i, b-1+j\n if 1 <= na <= H-2 and 1 <= nb <= W-2:\n if not na in graph.keys():\n graph[na] = {nb: 1}\n elif not nb in graph[na].keys():\n graph[na][nb] = 1\n else:\n graph[na][nb] += 1\n#print(graph)",
"i",
"[-1, 0, 1]",
"-1",
"0",
"1",
"for j in [-1, 0, 1]:\n na, nb = a-1+i, b-1+j\n if 1 <= na <= H-2 and 1 <= nb <= W-2:\n if not na in graph.keys():\n graph[na] = {nb: 1}\n elif not nb in graph[na].keys():\n graph[na][nb] = 1\n else:\n graph[na][nb] += 1\n#print(graph)",
"j",
"[-1, 0, 1]",
"-1",
"0",
"1",
"na, nb = a-1+i, b-1+j",
"na",
"a-1+i",
"a-1",
"a",
"1",
"i",
"nb",
"b-1+j",
"b-1",
"b",
"1",
"j",
"if 1 <= na <= H-2 and 1 <= nb <= W-2:\n if not na in graph.keys():\n graph[na] = {nb: 1}\n elif not nb in graph[na].keys():\n graph[na][nb] = 1\n else:\n graph[na][nb] += 1\n#print(graph)",
"1 <= na <= H-2 and 1 <= nb <= W-2",
"1 <= na <= H-2",
"1 <= na",
"1",
"na",
"H-2",
"H",
"2",
"1 <= nb <= W-2",
"1 <= nb",
"1",
"nb",
"W-2",
"W",
"2",
"if not na in graph.keys():\n graph[na] = {nb: 1}\n elif not nb in graph[na].keys():\n graph[na][nb] = 1\n else:\n graph[na][nb] += 1\n#print(graph)",
"not na in graph.keys()",
"na in graph.keys()",
"na",
"graph.keys()",
"graph.keys",
"graph",
"keys",
"graph[na] = {nb: 1}",
"graph[na]",
"graph",
"na",
"{nb: 1}",
"nb",
"nb",
"1",
"elif not nb in graph[na].keys():\n graph[na][nb] = 1\n ",
"not nb in graph[na].keys()",
"nb in graph[na].keys()",
"nb",
"graph[na].keys()",
"[na].keys",
"[na]",
"graph",
"na",
"keys",
"graph[na][nb] = 1",
"graph[na][nb]",
"[na]",
"graph",
"na",
"nb",
"1",
"graph[na][nb] += 1",
"graph[na][nb]",
"[na]",
"graph",
"na",
"nb",
"1",
"0 for _ in range(10)",
"for _ in range(10)",
"_",
"range(10)",
"range",
"10",
"for _ in range(10)",
"0",
"ans = [0 for _ in range(10)]",
"ans",
"[0 for _ in range(10)]",
"S = 0",
"S",
"0",
"for a, v_graph in graph.items():\n for b, v in v_graph.items():\n ans[v] += 1\n S += 1",
"a",
"v_graph",
"graph.items()",
"graph.items",
"graph",
"items",
"for b, v in v_graph.items():\n ans[v] += 1\n S += 1",
"b",
"v",
"v_graph.items()",
"v_graph.items",
"v_graph",
"items",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"S += 1",
"S",
"1",
"ans[0] = (H-2)*(W-2) - S",
"ans[0]",
"ans",
"0",
"(H-2)*(W-2) - S",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"S",
"for a in ans:\n print(a)",
"a",
"ans",
"print(a)",
"print",
"a",
"nb = a-1+i, b-1+j",
"b-1+j",
"nb",
"S = 0",
"0",
"S",
"b = list(map(int, input().split()))",
"list(map(int, input().split()))",
"b",
"S += 1",
"1",
"S",
"a, b = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"ans = [0 for _ in range(10)]",
"[0 for _ in range(10)]",
"ans",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"na, nb = a-1+i, b-1+j",
"a-1+i",
"na",
"graph = {}",
"{}",
"graph"
] | H, W, N = map(int, input().split())
graph = {}
for _ in range(N):
a, b = list(map(int, input().split()))
for i in [-1, 0, 1]:
for j in [-1, 0, 1]:
na, nb = a-1+i, b-1+j
if 1 <= na <= H-2 and 1 <= nb <= W-2:
if not na in graph.keys():
graph[na] = {nb: 1}
elif not nb in graph[na].keys():
graph[na][nb] = 1
else:
graph[na][nb] += 1
#print(graph)
ans = [0 for _ in range(10)]
S = 0
for a, v_graph in graph.items():
for b, v in v_graph.items():
ans[v] += 1
S += 1
ans[0] = (H-2)*(W-2) - S
for a in ans:
print(a) |
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
15,
0,
13,
17,
0,
13,
2,
39,
17,
17,
0,
13,
4,
13,
4,
13,
39,
17,
17,
17,
0,
13,
17,
28,
13,
13,
13,
28,
13,
13,
13,
0,
13,
2,
2,
13,
13,
17,
0,
13,
2,
2,
13,
13,
17,
14,
2,
2,
2,
40,
13,
17,
40,
2,
13,
17,
13,
40,
13,
17,
40,
2,
13,
17,
13,
9,
0,
18,
13,
39,
13,
13,
2,
4,
18,
13,
13,
39,
13,
13,
17,
17,
0,
18,
13,
18,
13,
39,
13,
13,
17,
0,
18,
13,
2,
18,
13,
39,
13,
13,
17,
17,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
28,
13,
18,
13,
39,
17,
4,
13,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
2,
13
] | [
[
184,
2
],
[
184,
13
],
[
184,
14
],
[
18,
17
],
[
179,
20
],
[
181,
33
],
[
175,
37
],
[
172,
40
],
[
169,
46
],
[
57,
56
],
[
187,
67
],
[
166,
74
],
[
188,
85
],
[
164,
89
],
[
188,
91
],
[
167,
93
],
[
185,
97
],
[
167,
99
],
[
107,
102
],
[
176,
103
],
[
176,
110
],
[
125,
118
],
[
173,
119
],
[
176,
121
],
[
136,
127
],
[
173,
128
],
[
176,
131
],
[
164,
142
],
[
185,
145
],
[
173,
150
],
[
155,
154
],
[
173,
156
],
[
154,
161
],
[
184,
164
],
[
166,
167
],
[
169,
170
],
[
172,
173
],
[
175,
176
],
[
184,
179
],
[
181,
182
],
[
184,
185
],
[
187,
188
]
] | [
"H, W, N = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for _ in range(N)]\n\nfrom itertools import product\n\n# S = [set() for _ in range(10)]\n# S[i]: set(黒いマスをi個こ含む3*3マスの中心セル)\n\nmemo = {}\nans = [0]*10\n\nP = list(product([-1,0,1], repeat=2))\n\nfor a,b in AB:\n for x,y in P:\n X = a+x-1\n Y = b+y-1\n #print(a,b,x,y,X,Y, ans)\n if X<=0 or H-1<=X or Y<=0 or W-1<=Y:\n continue\n memo[(X,Y)] = memo.get((X,Y),0) + 1\n ans[memo[(X,Y)]] += 1\n ans[memo[(X,Y)]-1] -= 1\n \n#print(memo)\n\nprint((H-2)*(W-2) - sum(ans[1:]))\n\nfor n in ans[1:]:\n print(n)",
"H, W, N = list(map(int, input().split()))",
"H",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"list(map(int, input().split())) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"AB = [list(map(int, input().split())) for _ in range(N)]",
"AB",
"[list(map(int, input().split())) for _ in range(N)]",
"from itertools import product",
"memo = {}",
"memo",
"{}",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"P = list(product([-1,0,1], repeat=2))",
"P",
"list(product([-1,0,1], repeat=2))",
"list",
"product([-1,0,1], repeat=2)",
"product",
"[-1,0,1]",
"-1",
"0",
"1",
"repeat=2",
"repeat",
"2",
"for a,b in AB:\n for x,y in P:\n X = a+x-1\n Y = b+y-1\n #print(a,b,x,y,X,Y, ans)\n if X<=0 or H-1<=X or Y<=0 or W-1<=Y:\n continue\n memo[(X,Y)] = memo.get((X,Y),0) + 1\n ans[memo[(X,Y)]] += 1\n ans[memo[(X,Y)]-1] -= 1\n \n#print(memo)",
"a",
"b",
"AB",
"for x,y in P:\n X = a+x-1\n Y = b+y-1\n #print(a,b,x,y,X,Y, ans)\n if X<=0 or H-1<=X or Y<=0 or W-1<=Y:\n continue\n memo[(X,Y)] = memo.get((X,Y),0) + 1\n ans[memo[(X,Y)]] += 1\n ans[memo[(X,Y)]-1] -= 1\n \n#print(memo)",
"x",
"y",
"P",
"X = a+x-1",
"X",
"a+x-1",
"a+x",
"a",
"x",
"1",
"Y = b+y-1",
"Y",
"b+y-1",
"b+y",
"b",
"y",
"1",
"if X<=0 or H-1<=X or Y<=0 or W-1<=Y:\n continue\n ",
"X<=0 or H-1<=X or Y<=0 or W-1<=Y",
"X<=0 or H-1<=X or Y<=0",
"X<=0 or H-1<=X",
"X<=0",
"X",
"0",
"H-1<=X",
"H-1",
"H",
"1",
"X",
"Y<=0",
"Y",
"0",
"W-1<=Y",
"W-1",
"W",
"1",
"Y",
"continue",
"memo[(X,Y)] = memo.get((X,Y),0) + 1",
"memo[(X,Y)]",
"memo",
"(X,Y)",
"X",
"Y",
"memo.get((X,Y),0) + 1",
"memo.get((X,Y),0)",
"memo.get",
"memo",
"get",
"(X,Y)",
"X",
"Y",
"0",
"1",
"ans[memo[(X,Y)]] += 1",
"ans[memo[(X,Y)]]",
"ans",
"memo[(X,Y)]",
"memo",
"(X,Y)",
"X",
"Y",
"1",
"ans[memo[(X,Y)]-1] -= 1",
"ans[memo[(X,Y)]-1]",
"ans",
"memo[(X,Y)]-1",
"memo[(X,Y)]",
"memo",
"(X,Y)",
"X",
"Y",
"1",
"1",
"print((H-2)*(W-2) - sum(ans[1:]))",
"print",
"(H-2)*(W-2) - sum(ans[1:])",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"for n in ans[1:]:\n print(n)",
"n",
"ans[1:]",
"ans",
"1:",
"1",
"print(n)",
"print",
"n",
"H, W, N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"H",
"Y = b+y-1",
"b+y-1",
"Y",
"P = list(product([-1,0,1], repeat=2))",
"list(product([-1,0,1], repeat=2))",
"P",
"ans = [0]*10",
"[0]*10",
"ans",
"memo = {}",
"{}",
"memo",
"N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"N",
"AB = [list(map(int, input().split())) for _ in range(N)]",
"[list(map(int, input().split())) for _ in range(N)]",
"AB",
"W, N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"W",
"X = a+x-1",
"a+x-1",
"X"
] | H, W, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
from itertools import product
# S = [set() for _ in range(10)]
# S[i]: set(黒いマスをi個こ含む3*3マスの中心セル)
memo = {}
ans = [0]*10
P = list(product([-1,0,1], repeat=2))
for a,b in AB:
for x,y in P:
X = a+x-1
Y = b+y-1
#print(a,b,x,y,X,Y, ans)
if X<=0 or H-1<=X or Y<=0 or W-1<=Y:
continue
memo[(X,Y)] = memo.get((X,Y),0) + 1
ans[memo[(X,Y)]] += 1
ans[memo[(X,Y)]-1] -= 1
#print(memo)
print((H-2)*(W-2) - sum(ans[1:]))
for n in ans[1:]:
print(n) |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
13,
31,
13,
0,
13,
17,
28,
13,
13,
4,
13,
31,
2,
39,
4,
13,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
2,
2,
2,
17,
13,
40,
2,
13,
17,
13,
2,
17,
13,
40,
2,
13,
17,
13,
0,
18,
13,
2,
2,
13,
13,
13,
2,
4,
18,
13,
13,
2,
2,
13,
13,
13,
17,
17,
0,
13,
4,
13,
4,
18,
13,
13,
0,
13,
2,
39,
2,
2,
13,
17,
2,
13,
17,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
17,
18,
13,
13,
4,
13,
4,
18,
17,
13,
4,
13,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] | [
[
161,
3
],
[
161,
16
],
[
161,
17
],
[
161,
18
],
[
164,
21
],
[
37,
36
],
[
47,
46
],
[
36,
61
],
[
36,
64
],
[
162,
66
],
[
46,
69
],
[
46,
72
],
[
156,
74
],
[
83,
76
],
[
165,
77
],
[
36,
80
],
[
156,
81
],
[
46,
82
],
[
165,
86
],
[
36,
90
],
[
156,
91
],
[
46,
92
],
[
152,
96
],
[
165,
101
],
[
149,
104
],
[
162,
109
],
[
156,
112
],
[
120,
119
],
[
153,
122
],
[
128,
125
],
[
150,
126
],
[
119,
127
],
[
153,
129
],
[
119,
130
],
[
135,
132
],
[
150,
133
],
[
153,
136
],
[
119,
137
],
[
150,
147
],
[
149,
150
],
[
152,
153
],
[
161,
156
],
[
161,
159
],
[
161,
162
],
[
164,
165
]
] | [
"from collections import Counter\nH, W, N, *L = map(int, open(0).read().split())\ndic = {}\nfor a, b in zip(*[iter(L)]*2):\n for i in range(a-2,a+1):\n for j in range(b-2,b+1):\n if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[i*W+j] = dic.get(i*W+j,0)+1\nc = Counter(dic.values())\nans = [(H-2)*(W-2)]+[0]*9\nfor k in c.keys():\n ans[k] = c[k]\n ans[0] -= c[k]\nprint('\\n'.join(map(str,ans)))",
"from collections import Counter",
"H, W, N, *L = map(int, open(0).read().split())",
"H",
"map(int, open(0).read().split())",
"map",
"int",
"open(0).read().split()",
"(0).read().split",
"(0).read()",
"(0).read",
"(0)",
"open",
"0",
"read",
"split",
"W",
"N",
"*L",
"L",
"dic = {}",
"dic",
"{}",
"for a, b in zip(*[iter(L)]*2):\n for i in range(a-2,a+1):\n for j in range(b-2,b+1):\n if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[i*W+j] = dic.get(i*W+j,0)+1",
"a",
"b",
"zip(*[iter(L)]*2)",
"zip",
"*[iter(L)]*2",
"[iter(L)]*2",
"[iter(L)]",
"iter(L)",
"iter",
"L",
"2",
"for i in range(a-2,a+1):\n for j in range(b-2,b+1):\n if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[i*W+j] = dic.get(i*W+j,0)+1",
"i",
"range(a-2,a+1)",
"range",
"a-2",
"a",
"2",
"a+1",
"a",
"1",
"for j in range(b-2,b+1):\n if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[i*W+j] = dic.get(i*W+j,0)+1",
"j",
"range(b-2,b+1)",
"range",
"b-2",
"b",
"2",
"b+1",
"b",
"1",
"if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[i*W+j] = dic.get(i*W+j,0)+1",
"0<i and i+2<=H and 0<j and j+2<=W",
"0<i and i+2<=H and 0<j",
"0<i and i+2<=H",
"0<i",
"0",
"i",
"i+2<=H",
"i+2",
"i",
"2",
"H",
"0<j",
"0",
"j",
"j+2<=W",
"j+2",
"j",
"2",
"W",
"dic[i*W+j] = dic.get(i*W+j,0)+1",
"dic[i*W+j]",
"dic",
"i*W+j",
"i*W",
"i",
"W",
"j",
"dic.get(i*W+j,0)+1",
"dic.get(i*W+j,0)",
"dic.get",
"dic",
"get",
"i*W+j",
"i*W",
"i",
"W",
"j",
"0",
"1",
"c = Counter(dic.values())",
"c",
"Counter(dic.values())",
"Counter",
"dic.values()",
"dic.values",
"dic",
"values",
"ans = [(H-2)*(W-2)]+[0]*9",
"ans",
"[(H-2)*(W-2)]+[0]*9",
"[(H-2)*(W-2)]",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"[0]*9",
"[0]",
"0",
"9",
"for k in c.keys():\n ans[k] = c[k]\n ans[0] -= c[k]",
"k",
"c.keys()",
"c.keys",
"c",
"keys",
"ans[k] = c[k]",
"ans[k]",
"ans",
"k",
"c[k]",
"c",
"k",
"ans[0] -= c[k]",
"ans[0]",
"ans",
"0",
"c[k]",
"c",
"k",
"print('\\n'.join(map(str,ans)))",
"print",
"'\\n'.join(map(str,ans))",
"'\\n'.join",
"'\\n'",
"join",
"map(str,ans)",
"map",
"str",
"ans",
"ans = [(H-2)*(W-2)]+[0]*9",
"[(H-2)*(W-2)]+[0]*9",
"ans",
"c = Counter(dic.values())",
"Counter(dic.values())",
"c",
"W, N, *L = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"W",
"N, *L = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"N",
"H, W, N, *L = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"H",
"dic = {}",
"{}",
"dic"
] | from collections import Counter
H, W, N, *L = map(int, open(0).read().split())
dic = {}
for a, b in zip(*[iter(L)]*2):
for i in range(a-2,a+1):
for j in range(b-2,b+1):
if 0<i and i+2<=H and 0<j and j+2<=W:
dic[i*W+j] = dic.get(i*W+j,0)+1
c = Counter(dic.values())
ans = [(H-2)*(W-2)]+[0]*9
for k in c.keys():
ans[k] = c[k]
ans[0] -= c[k]
print('\n'.join(map(str,ans))) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
2,
2,
40,
2,
13,
13,
17,
40,
2,
13,
13,
2,
13,
17,
40,
2,
13,
13,
17,
40,
2,
13,
13,
2,
13,
17,
9,
14,
2,
39,
2,
13,
13,
2,
13,
13,
13,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13
] | [
[
175,
2
],
[
175,
11
],
[
175,
12
],
[
157,
14
],
[
18,
17
],
[
176,
20
],
[
166,
22
],
[
166,
31
],
[
172,
33
],
[
169,
36
],
[
40,
39
],
[
46,
45
],
[
173,
56
],
[
164,
56
],
[
39,
57
],
[
173,
61
],
[
164,
61
],
[
39,
62
],
[
161,
64
],
[
170,
68
],
[
167,
68
],
[
45,
69
],
[
170,
73
],
[
167,
73
],
[
45,
74
],
[
155,
76
],
[
173,
83
],
[
164,
83
],
[
39,
84
],
[
170,
86
],
[
167,
86
],
[
45,
87
],
[
158,
88
],
[
99,
90
],
[
158,
91
],
[
173,
94
],
[
164,
94
],
[
39,
95
],
[
170,
97
],
[
167,
97
],
[
45,
98
],
[
110,
101
],
[
158,
102
],
[
173,
105
],
[
164,
105
],
[
39,
106
],
[
170,
108
],
[
167,
108
],
[
45,
109
],
[
178,
112
],
[
119,
118
],
[
158,
121
],
[
127,
124
],
[
179,
125
],
[
118,
126
],
[
132,
129
],
[
179,
130
],
[
161,
135
],
[
155,
138
],
[
179,
142
],
[
145,
144
],
[
124,
150
],
[
179,
151
],
[
144,
152
],
[
175,
155
],
[
157,
158
],
[
175,
161
],
[
166,
164
],
[
166,
167
],
[
169,
170
],
[
172,
173
],
[
175,
176
],
[
178,
179
]
] | [
"h, w, n = map(int, input().split())\n\ndic = {}\n\nfor i in range(n):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in range(-1, 2):\n for j in range(-1, 2):\n if a + i <= 0 or a + i >= h - 1 or b + j <= 0 or b + j >= w - 1:\n continue\n if (a+i, b+j) in dic:\n dic[(a+i, b+j)] += 1\n else:\n dic[(a+i, b+j)] = 1\n\ncount = [0]*10\nfor i in dic.values():\n count[i] += 1\ncount[0] = (h-2)*(w-2)-sum(count)\nfor i in range(10):\n print(count[i])",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"dic = {}",
"dic",
"{}",
"for i in range(n):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in range(-1, 2):\n for j in range(-1, 2):\n if a + i <= 0 or a + i >= h - 1 or b + j <= 0 or b + j >= w - 1:\n continue\n if (a+i, b+j) in dic:\n dic[(a+i, b+j)] += 1\n else:\n dic[(a+i, b+j)] = 1",
"i",
"range(n)",
"range",
"n",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for i in range(-1, 2):\n for j in range(-1, 2):\n if a + i <= 0 or a + i >= h - 1 or b + j <= 0 or b + j >= w - 1:\n continue\n if (a+i, b+j) in dic:\n dic[(a+i, b+j)] += 1\n else:\n dic[(a+i, b+j)] = 1",
"i",
"range(-1, 2)",
"range",
"-1",
"2",
"for j in range(-1, 2):\n if a + i <= 0 or a + i >= h - 1 or b + j <= 0 or b + j >= w - 1:\n continue\n if (a+i, b+j) in dic:\n dic[(a+i, b+j)] += 1\n else:\n dic[(a+i, b+j)] = 1",
"j",
"range(-1, 2)",
"range",
"-1",
"2",
"if a + i <= 0 or a + i >= h - 1 or b + j <= 0 or b + j >= w - 1:\n continue\n ",
"a + i <= 0 or a + i >= h - 1 or b + j <= 0 or b + j >= w - 1",
"a + i <= 0 or a + i >= h - 1 or b + j <= 0",
"a + i <= 0 or a + i >= h - 1",
"a + i <= 0",
"a + i",
"a",
"i",
"0",
"a + i >= h - 1",
"a + i",
"a",
"i",
"h - 1",
"h",
"1",
"b + j <= 0",
"b + j",
"b",
"j",
"0",
"b + j >= w - 1",
"b + j",
"b",
"j",
"w - 1",
"w",
"1",
"continue",
"if (a+i, b+j) in dic:\n dic[(a+i, b+j)] += 1\n else:\n dic[(a+i, b+j)] = 1",
"(a+i, b+j) in dic",
"(a+i, b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"dic",
"dic[(a+i, b+j)] += 1",
"dic[(a+i, b+j)]",
"dic",
"(a+i, b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"1",
"dic[(a+i, b+j)] = 1",
"dic[(a+i, b+j)]",
"dic",
"(a+i, b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"1",
"count = [0]*10",
"count",
"[0]*10",
"[0]",
"0",
"10",
"for i in dic.values():\n count[i] += 1",
"i",
"dic.values()",
"dic.values",
"dic",
"values",
"count[i] += 1",
"count[i]",
"count",
"i",
"1",
"count[0] = (h-2)*(w-2)-sum(count)",
"count[0]",
"count",
"0",
"(h-2)*(w-2)-sum(count)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(count)",
"sum",
"count",
"for i in range(10):\n print(count[i])",
"i",
"range(10)",
"range",
"10",
"print(count[i])",
"print",
"count[i]",
"count",
"i",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"dic = {}",
"{}",
"dic",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"b -= 1",
"1",
"b",
"a -= 1",
"1",
"a",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"count = [0]*10",
"[0]*10",
"count"
] | h, w, n = map(int, input().split())
dic = {}
for i in range(n):
a, b = map(int, input().split())
a -= 1
b -= 1
for i in range(-1, 2):
for j in range(-1, 2):
if a + i <= 0 or a + i >= h - 1 or b + j <= 0 or b + j >= w - 1:
continue
if (a+i, b+j) in dic:
dic[(a+i, b+j)] += 1
else:
dic[(a+i, b+j)] = 1
count = [0]*10
for i in dic.values():
count[i] += 1
count[0] = (h-2)*(w-2)-sum(count)
for i in range(10):
print(count[i])
|
[
7,
15,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
13,
31,
13,
0,
13,
4,
13,
13,
42,
13,
0,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
28,
13,
39,
2,
13,
17,
2,
13,
17,
13,
14,
40,
40,
17,
13,
2,
13,
17,
28,
13,
39,
2,
13,
17,
2,
13,
17,
13,
14,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
39,
13,
13,
17,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
0,
13,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
17,
4,
13,
4,
18,
13,
13,
13,
17,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
6,
5
],
[
6,
18
],
[
6,
19
],
[
6,
20
],
[
24,
23
],
[
31,
30
],
[
36,
35
],
[
42,
41
],
[
35,
44
],
[
35,
47
],
[
41,
54
],
[
5,
56
],
[
60,
59
],
[
30,
62
],
[
30,
65
],
[
59,
72
],
[
18,
74
],
[
82,
77
],
[
23,
78
],
[
5,
88
],
[
18,
91
],
[
23,
95
],
[
98,
97
],
[
23,
102
],
[
106,
105
],
[
97,
114
],
[
105,
116
],
[
126,
123
]
] | [
"from collections import defaultdict, Counter\n\ndef main():\n H, W, N, *A = map(int,open(0).read().split())\n D = defaultdict(int)\n\n while A:\n b, a = A.pop(), A.pop()\n for i in [a - 2, a - 1, a]:\n if 1 <= i <= H - 2:\n for j in [b - 2, b - 1, b]:\n if 1 <= j <= W - 2:\n D[(i, j)] += 1\n\n print((H - 2) * (W - 2) - len(D))\n\n c = Counter(D.values())\n for i in range(1, 10):\n print(c.get(i, 0))\n\nif __name__ == '__main__':\n main()",
"from collections import defaultdict, Counter",
"def main():\n H, W, N, *A = map(int,open(0).read().split())\n D = defaultdict(int)\n\n while A:\n b, a = A.pop(), A.pop()\n for i in [a - 2, a - 1, a]:\n if 1 <= i <= H - 2:\n for j in [b - 2, b - 1, b]:\n if 1 <= j <= W - 2:\n D[(i, j)] += 1\n\n print((H - 2) * (W - 2) - len(D))\n\n c = Counter(D.values())\n for i in range(1, 10):\n print(c.get(i, 0))",
"main",
"H, W, N, *A = map(int,open(0).read().split())",
"H",
"map(int,open(0).read().split())",
"map",
"int",
"open(0).read().split()",
"(0).read().split",
"(0).read()",
"(0).read",
"(0)",
"open",
"0",
"read",
"split",
"W",
"N",
"*A",
"A",
"D = defaultdict(int)",
"D",
"defaultdict(int)",
"defaultdict",
"int",
"while A:\n b, a = A.pop(), A.pop()\n for i in [a - 2, a - 1, a]:\n if 1 <= i <= H - 2:\n for j in [b - 2, b - 1, b]:\n if 1 <= j <= W - 2:\n D[(i, j)] += 1\n\n ",
"A",
"b, a = A.pop(), A.pop()",
"b",
"A.pop()",
"A.pop",
"A",
"pop",
"a",
"A.pop()",
"A.pop",
"A",
"pop",
"for i in [a - 2, a - 1, a]:\n if 1 <= i <= H - 2:\n for j in [b - 2, b - 1, b]:\n if 1 <= j <= W - 2:\n D[(i, j)] += 1\n\n ",
"i",
"[a - 2, a - 1, a]",
"a - 2",
"a",
"2",
"a - 1",
"a",
"1",
"a",
"if 1 <= i <= H - 2:\n for j in [b - 2, b - 1, b]:\n if 1 <= j <= W - 2:\n D[(i, j)] += 1\n\n ",
"1 <= i <= H - 2",
"1 <= i",
"1",
"i",
"H - 2",
"H",
"2",
"for j in [b - 2, b - 1, b]:\n if 1 <= j <= W - 2:\n D[(i, j)] += 1\n\n ",
"j",
"[b - 2, b - 1, b]",
"b - 2",
"b",
"2",
"b - 1",
"b",
"1",
"b",
"if 1 <= j <= W - 2:\n D[(i, j)] += 1\n\n ",
"1 <= j <= W - 2",
"1 <= j",
"1",
"j",
"W - 2",
"W",
"2",
"D[(i, j)] += 1",
"D[(i, j)]",
"D",
"(i, j)",
"i",
"j",
"1",
"print((H - 2) * (W - 2) - len(D))",
"print",
"(H - 2) * (W - 2) - len(D)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"len(D)",
"len",
"D",
"c = Counter(D.values())",
"c",
"Counter(D.values())",
"Counter",
"D.values()",
"D.values",
"D",
"values",
"for i in range(1, 10):\n print(c.get(i, 0))",
"i",
"range(1, 10)",
"range",
"1",
"10",
"print(c.get(i, 0))",
"print",
"c.get(i, 0)",
"c.get",
"c",
"get",
"i",
"0",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n H, W, N, *A = map(int,open(0).read().split())\n D = defaultdict(int)\n\n while A:\n b, a = A.pop(), A.pop()\n for i in [a - 2, a - 1, a]:\n if 1 <= i <= H - 2:\n for j in [b - 2, b - 1, b]:\n if 1 <= j <= W - 2:\n D[(i, j)] += 1\n\n print((H - 2) * (W - 2) - len(D))\n\n c = Counter(D.values())\n for i in range(1, 10):\n print(c.get(i, 0))",
"def main():\n H, W, N, *A = map(int,open(0).read().split())\n D = defaultdict(int)\n\n while A:\n b, a = A.pop(), A.pop()\n for i in [a - 2, a - 1, a]:\n if 1 <= i <= H - 2:\n for j in [b - 2, b - 1, b]:\n if 1 <= j <= W - 2:\n D[(i, j)] += 1\n\n print((H - 2) * (W - 2) - len(D))\n\n c = Counter(D.values())\n for i in range(1, 10):\n print(c.get(i, 0))",
"main"
] | from collections import defaultdict, Counter
def main():
H, W, N, *A = map(int,open(0).read().split())
D = defaultdict(int)
while A:
b, a = A.pop(), A.pop()
for i in [a - 2, a - 1, a]:
if 1 <= i <= H - 2:
for j in [b - 2, b - 1, b]:
if 1 <= j <= W - 2:
D[(i, j)] += 1
print((H - 2) * (W - 2) - len(D))
c = Counter(D.values())
for i in range(1, 10):
print(c.get(i, 0))
if __name__ == '__main__':
main() |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
12,
13,
0,
13,
13,
13,
14,
2,
2,
13,
17,
2,
13,
2,
13,
17,
29,
17,
14,
2,
2,
13,
17,
2,
13,
2,
13,
17,
29,
17,
29,
17,
23,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
2,
13,
17,
13,
2,
13,
17,
14,
40,
13,
17,
14,
40,
13,
17,
0,
18,
13,
39,
2,
13,
17,
2,
13,
17,
17,
14,
2,
13,
2,
13,
17,
0,
18,
13,
39,
2,
13,
17,
2,
13,
17,
17,
0,
18,
13,
39,
2,
13,
17,
13,
17,
14,
2,
13,
2,
13,
17,
14,
40,
13,
17,
0,
18,
13,
39,
2,
13,
17,
2,
13,
17,
17,
14,
2,
13,
2,
13,
17,
0,
18,
13,
39,
2,
13,
17,
2,
13,
17,
17,
0,
18,
13,
39,
2,
13,
17,
13,
17,
14,
40,
13,
17,
0,
18,
13,
39,
13,
2,
13,
17,
17,
14,
2,
13,
2,
13,
17,
0,
18,
13,
39,
13,
2,
13,
17,
17,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
14,
4,
13,
13,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13
] | [
[
271,
3
],
[
271,
12
],
[
271,
13
],
[
262,
15
],
[
23,
22
],
[
52,
23
],
[
23,
24
],
[
22,
28
],
[
22,
31
],
[
251,
33
],
[
24,
40
],
[
24,
43
],
[
254,
45
],
[
52,
52
],
[
55,
54
],
[
272,
57
],
[
268,
59
],
[
268,
68
],
[
259,
70
],
[
257,
72
],
[
260,
72
],
[
247,
74
],
[
269,
76
],
[
248,
76
],
[
260,
80
],
[
257,
80
],
[
248,
84
],
[
269,
84
],
[
96,
87
],
[
263,
88
],
[
260,
91
],
[
257,
91
],
[
248,
94
],
[
269,
94
],
[
248,
99
],
[
269,
99
],
[
254,
101
],
[
113,
104
],
[
263,
105
],
[
260,
108
],
[
257,
108
],
[
248,
111
],
[
269,
111
],
[
122,
115
],
[
263,
116
],
[
260,
119
],
[
257,
119
],
[
260,
125
],
[
257,
125
],
[
251,
127
],
[
248,
131
],
[
269,
131
],
[
143,
134
],
[
263,
135
],
[
260,
138
],
[
257,
138
],
[
248,
141
],
[
269,
141
],
[
248,
146
],
[
269,
146
],
[
254,
148
],
[
160,
151
],
[
263,
152
],
[
260,
155
],
[
257,
155
],
[
248,
158
],
[
269,
158
],
[
169,
162
],
[
263,
163
],
[
260,
166
],
[
257,
166
],
[
248,
172
],
[
269,
172
],
[
182,
175
],
[
263,
176
],
[
248,
180
],
[
269,
180
],
[
248,
185
],
[
269,
185
],
[
254,
187
],
[
197,
190
],
[
263,
191
],
[
248,
195
],
[
269,
195
],
[
204,
199
],
[
263,
200
],
[
265,
206
],
[
213,
212
],
[
263,
212
],
[
275,
216
],
[
212,
217
],
[
224,
219
],
[
266,
220
],
[
263,
222
],
[
212,
223
],
[
229,
226
],
[
266,
227
],
[
251,
232
],
[
254,
235
],
[
266,
239
],
[
242,
241
],
[
266,
241
],
[
241,
245
],
[
247,
248
],
[
271,
251
],
[
271,
254
],
[
268,
257
],
[
259,
260
],
[
262,
263
],
[
265,
266
],
[
268,
269
],
[
271,
272
]
] | [
"from collections import defaultdict\nH, W, N = map( int, input().split())\nD = defaultdict( int)\ndef check(t):\n a, b = t\n if a == 0 or a == H-1:\n return False\n if b == 0 or b == W-1:\n return False\n return True\nfor _ in range(N):\n a, b = map( int, input().split())\n a, b = a-1, b-1\n if a >= 1:\n if b >= 1:\n D[(a-1,b-1)] += 1\n if b < W-1:\n D[(a-1,b+1)] += 1\n D[(a-1,b)] += 1\n if a < H-1:\n if b >= 1:\n D[(a+1,b-1)] += 1\n if b < W-1:\n D[(a+1,b+1)] += 1\n D[(a+1,b)] += 1\n if b >= 1:\n D[(a,b-1)] += 1\n if b < W-1:\n D[(a,b+1)] += 1\n D[(a,b)] += 1\nANS = [0]*10\nfor c in D:\n if check(c):\n ANS[D[c]] += 1\nANS[0] = (H-2)*(W-2)- sum(ANS)\nfor ans in ANS:\n print(ans)",
"from collections import defaultdict",
"H, W, N = map( int, input().split())",
"H",
"map( int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"D = defaultdict( int)",
"D",
"defaultdict( int)",
"defaultdict",
"int",
"def check(t):\n a, b = t\n if a == 0 or a == H-1:\n return False\n if b == 0 or b == W-1:\n return False\n return True",
"check",
"a, b = t",
"a",
"t",
"b",
"if a == 0 or a == H-1:\n return False\n ",
"a == 0 or a == H-1",
"a == 0",
"a",
"0",
"a == H-1",
"a",
"H-1",
"H",
"1",
"return False",
"False",
"if b == 0 or b == W-1:\n return False\n ",
"b == 0 or b == W-1",
"b == 0",
"b",
"0",
"b == W-1",
"b",
"W-1",
"W",
"1",
"return False",
"False",
"return True",
"True",
"t",
"t",
"for _ in range(N):\n a, b = map( int, input().split())\n a, b = a-1, b-1\n if a >= 1:\n if b >= 1:\n D[(a-1,b-1)] += 1\n if b < W-1:\n D[(a-1,b+1)] += 1\n D[(a-1,b)] += 1\n if a < H-1:\n if b >= 1:\n D[(a+1,b-1)] += 1\n if b < W-1:\n D[(a+1,b+1)] += 1\n D[(a+1,b)] += 1\n if b >= 1:\n D[(a,b-1)] += 1\n if b < W-1:\n D[(a,b+1)] += 1\n D[(a,b)] += 1",
"_",
"range(N)",
"range",
"N",
"a, b = map( int, input().split())",
"a",
"map( int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"a, b = a-1, b-1",
"a",
"a-1",
"a",
"1",
"b",
"b-1",
"b",
"1",
"if a >= 1:\n if b >= 1:\n D[(a-1,b-1)] += 1\n if b < W-1:\n D[(a-1,b+1)] += 1\n D[(a-1,b)] += 1\n ",
"a >= 1",
"a",
"1",
"if b >= 1:\n D[(a-1,b-1)] += 1\n ",
"b >= 1",
"b",
"1",
"D[(a-1,b-1)] += 1",
"D[(a-1,b-1)]",
"D",
"(a-1,b-1)",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"1",
"if b < W-1:\n D[(a-1,b+1)] += 1\n ",
"b < W-1",
"b",
"W-1",
"W",
"1",
"D[(a-1,b+1)] += 1",
"D[(a-1,b+1)]",
"D",
"(a-1,b+1)",
"a-1",
"a",
"1",
"b+1",
"b",
"1",
"1",
"D[(a-1,b)] += 1",
"D[(a-1,b)]",
"D",
"(a-1,b)",
"a-1",
"a",
"1",
"b",
"1",
"if a < H-1:\n if b >= 1:\n D[(a+1,b-1)] += 1\n if b < W-1:\n D[(a+1,b+1)] += 1\n D[(a+1,b)] += 1\n ",
"a < H-1",
"a",
"H-1",
"H",
"1",
"if b >= 1:\n D[(a+1,b-1)] += 1\n ",
"b >= 1",
"b",
"1",
"D[(a+1,b-1)] += 1",
"D[(a+1,b-1)]",
"D",
"(a+1,b-1)",
"a+1",
"a",
"1",
"b-1",
"b",
"1",
"1",
"if b < W-1:\n D[(a+1,b+1)] += 1\n ",
"b < W-1",
"b",
"W-1",
"W",
"1",
"D[(a+1,b+1)] += 1",
"D[(a+1,b+1)]",
"D",
"(a+1,b+1)",
"a+1",
"a",
"1",
"b+1",
"b",
"1",
"1",
"D[(a+1,b)] += 1",
"D[(a+1,b)]",
"D",
"(a+1,b)",
"a+1",
"a",
"1",
"b",
"1",
"if b >= 1:\n D[(a,b-1)] += 1\n ",
"b >= 1",
"b",
"1",
"D[(a,b-1)] += 1",
"D[(a,b-1)]",
"D",
"(a,b-1)",
"a",
"b-1",
"b",
"1",
"1",
"if b < W-1:\n D[(a,b+1)] += 1\n ",
"b < W-1",
"b",
"W-1",
"W",
"1",
"D[(a,b+1)] += 1",
"D[(a,b+1)]",
"D",
"(a,b+1)",
"a",
"b+1",
"b",
"1",
"1",
"D[(a,b)] += 1",
"D[(a,b)]",
"D",
"(a,b)",
"a",
"b",
"1",
"ANS = [0]*10",
"ANS",
"[0]*10",
"[0]",
"0",
"10",
"for c in D:\n if check(c):\n ANS[D[c]] += 1",
"c",
"D",
"if check(c):\n ANS[D[c]] += 1",
"check(c)",
"check",
"c",
"ANS[D[c]] += 1",
"ANS[D[c]]",
"ANS",
"D[c]",
"D",
"c",
"1",
"ANS[0] = (H-2)*(W-2)- sum(ANS)",
"ANS[0]",
"ANS",
"0",
"(H-2)*(W-2)- sum(ANS)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(ANS)",
"sum",
"ANS",
"for ans in ANS:\n print(ans)",
"ans",
"ANS",
"print(ans)",
"print",
"ans",
"b = a-1, b-1",
"b-1",
"b",
"H, W, N = map( int, input().split())",
"map( int, input().split())",
"H",
"W, N = map( int, input().split())",
"map( int, input().split())",
"W",
"a, b = map( int, input().split())",
"map( int, input().split())",
"a",
"a, b = a-1, b-1",
"a-1",
"a",
"D = defaultdict( int)",
"defaultdict( int)",
"D",
"ANS = [0]*10",
"[0]*10",
"ANS",
"b = map( int, input().split())",
"map( int, input().split())",
"b",
"N = map( int, input().split())",
"map( int, input().split())",
"N",
"def check(t):\n a, b = t\n if a == 0 or a == H-1:\n return False\n if b == 0 or b == W-1:\n return False\n return True",
"def check(t):\n a, b = t\n if a == 0 or a == H-1:\n return False\n if b == 0 or b == W-1:\n return False\n return True",
"check"
] | from collections import defaultdict
H, W, N = map( int, input().split())
D = defaultdict( int)
def check(t):
a, b = t
if a == 0 or a == H-1:
return False
if b == 0 or b == W-1:
return False
return True
for _ in range(N):
a, b = map( int, input().split())
a, b = a-1, b-1
if a >= 1:
if b >= 1:
D[(a-1,b-1)] += 1
if b < W-1:
D[(a-1,b+1)] += 1
D[(a-1,b)] += 1
if a < H-1:
if b >= 1:
D[(a+1,b-1)] += 1
if b < W-1:
D[(a+1,b+1)] += 1
D[(a+1,b)] += 1
if b >= 1:
D[(a,b-1)] += 1
if b < W-1:
D[(a,b+1)] += 1
D[(a,b)] += 1
ANS = [0]*10
for c in D:
if check(c):
ANS[D[c]] += 1
ANS[0] = (H-2)*(W-2)- sum(ANS)
for ans in ANS:
print(ans) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
0,
13,
2,
2,
4,
13,
13,
17,
4,
13,
13,
14,
2,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
13,
2,
39,
17,
17,
0,
13,
4,
13,
4,
18,
13,
13,
28,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
174,
2
],
[
174,
11
],
[
174,
12
],
[
156,
14
],
[
19,
18
],
[
172,
21
],
[
162,
23
],
[
162,
32
],
[
35,
34
],
[
41,
40
],
[
147,
46
],
[
163,
48
],
[
34,
49
],
[
153,
51
],
[
151,
53
],
[
40,
54
],
[
148,
60
],
[
169,
62
],
[
154,
67
],
[
175,
69
],
[
159,
72
],
[
148,
77
],
[
154,
81
],
[
160,
84
],
[
157,
85
],
[
90,
87
],
[
157,
88
],
[
160,
89
],
[
95,
92
],
[
157,
93
],
[
160,
94
],
[
144,
97
],
[
165,
103
],
[
157,
108
],
[
112,
111
],
[
166,
111
],
[
117,
114
],
[
145,
115
],
[
111,
116
],
[
122,
119
],
[
145,
120
],
[
169,
125
],
[
175,
128
],
[
145,
132
],
[
135,
134
],
[
145,
141
],
[
134,
142
],
[
144,
145
],
[
147,
148
],
[
162,
151
],
[
153,
154
],
[
156,
157
],
[
159,
160
],
[
162,
163
],
[
165,
166
],
[
174,
169
],
[
174,
172
],
[
174,
175
]
] | [
"h,w,n=map(int,input().split())\nD=dict()\nfor i in range(n):\n a,b=map(int,input().split())\n for p in range(-1,2):\n for q in range(-1,2):\n aa=a+p\n bb=b+q\n if 2<=aa<=h-1 and 2<=bb<=w-1:\n aabb=str(aa)+\"_\"+str(bb)\n if aabb in D:\n D[aabb]+=1\n else:\n D[aabb]=1\nans=[0]*10\nV=list(D.values())\nfor v in V:\n ans[v]+=1\nans[0]=(h-2)*(w-2)-sum(ans)\nfor i in range(10):\n print(ans[i])",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"D=dict()",
"D",
"dict()",
"dict",
"for i in range(n):\n a,b=map(int,input().split())\n for p in range(-1,2):\n for q in range(-1,2):\n aa=a+p\n bb=b+q\n if 2<=aa<=h-1 and 2<=bb<=w-1:\n aabb=str(aa)+\"_\"+str(bb)\n if aabb in D:\n D[aabb]+=1\n else:\n D[aabb]=1",
"i",
"range(n)",
"range",
"n",
"a,b=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for p in range(-1,2):\n for q in range(-1,2):\n aa=a+p\n bb=b+q\n if 2<=aa<=h-1 and 2<=bb<=w-1:\n aabb=str(aa)+\"_\"+str(bb)\n if aabb in D:\n D[aabb]+=1\n else:\n D[aabb]=1",
"p",
"range(-1,2)",
"range",
"-1",
"2",
"for q in range(-1,2):\n aa=a+p\n bb=b+q\n if 2<=aa<=h-1 and 2<=bb<=w-1:\n aabb=str(aa)+\"_\"+str(bb)\n if aabb in D:\n D[aabb]+=1\n else:\n D[aabb]=1",
"q",
"range(-1,2)",
"range",
"-1",
"2",
"aa=a+p",
"aa",
"a+p",
"a",
"p",
"bb=b+q",
"bb",
"b+q",
"b",
"q",
"if 2<=aa<=h-1 and 2<=bb<=w-1:\n aabb=str(aa)+\"_\"+str(bb)\n if aabb in D:\n D[aabb]+=1\n else:\n D[aabb]=1",
"2<=aa<=h-1 and 2<=bb<=w-1",
"2<=aa<=h-1",
"2<=aa",
"2",
"aa",
"h-1",
"h",
"1",
"2<=bb<=w-1",
"2<=bb",
"2",
"bb",
"w-1",
"w",
"1",
"aabb=str(aa)+\"_\"+str(bb)",
"aabb",
"str(aa)+\"_\"+str(bb)",
"str(aa)+\"_\"",
"str(aa)",
"str",
"aa",
"\"_\"",
"str(bb)",
"str",
"bb",
"if aabb in D:\n D[aabb]+=1\n else:\n D[aabb]=1",
"aabb in D",
"aabb",
"D",
"D[aabb]+=1",
"D[aabb]",
"D",
"aabb",
"1",
"D[aabb]=1",
"D[aabb]",
"D",
"aabb",
"1",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"V=list(D.values())",
"V",
"list(D.values())",
"list",
"D.values()",
"D.values",
"D",
"values",
"for v in V:\n ans[v]+=1",
"v",
"V",
"ans[v]+=1",
"ans[v]",
"ans",
"v",
"1",
"ans[0]=(h-2)*(w-2)-sum(ans)",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)-sum(ans)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"ans=[0]*10",
"[0]*10",
"ans",
"aa=a+p",
"a+p",
"aa",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"bb=b+q",
"b+q",
"bb",
"D=dict()",
"dict()",
"D",
"aabb=str(aa)+\"_\"+str(bb)",
"str(aa)+\"_\"+str(bb)",
"aabb",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"V=list(D.values())",
"list(D.values())",
"V",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w"
] | h,w,n=map(int,input().split())
D=dict()
for i in range(n):
a,b=map(int,input().split())
for p in range(-1,2):
for q in range(-1,2):
aa=a+p
bb=b+q
if 2<=aa<=h-1 and 2<=bb<=w-1:
aabb=str(aa)+"_"+str(bb)
if aabb in D:
D[aabb]+=1
else:
D[aabb]=1
ans=[0]*10
V=list(D.values())
for v in V:
ans[v]+=1
ans[0]=(h-2)*(w-2)-sum(ans)
for i in range(10):
print(ans[i]) |
[
7,
12,
13,
14,
2,
4,
13,
13,
17,
29,
2,
39,
2,
2,
13,
17,
2,
13,
17,
2,
39,
17,
17,
0,
13,
39,
28,
13,
39,
13,
13,
4,
13,
13,
0,
13,
4,
13,
17,
2,
13,
17,
0,
13,
4,
13,
17,
2,
13,
17,
28,
13,
4,
13,
13,
13,
14,
40,
2,
13,
17,
13,
9,
28,
13,
4,
13,
13,
13,
14,
40,
2,
13,
17,
13,
9,
4,
18,
13,
13,
2,
2,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
13,
0,
13,
17,
0,
13,
13,
14,
2,
13,
17,
4,
13,
13,
0,
18,
13,
2,
13,
17,
17,
0,
13,
17,
0,
18,
13,
2,
13,
17,
17,
29,
2,
39,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
13,
23,
13,
23,
13,
23,
13,
23,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
13,
13,
13,
28,
13,
13,
4,
13,
13,
10,
12,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
168,
7
],
[
162,
14
],
[
164,
17
],
[
25,
24
],
[
168,
33
],
[
36,
35
],
[
44,
43
],
[
52,
51
],
[
43,
54
],
[
51,
59
],
[
162,
61
],
[
65,
64
],
[
35,
67
],
[
64,
72
],
[
164,
74
],
[
24,
78
],
[
51,
82
],
[
164,
83
],
[
64,
84
],
[
87,
86
],
[
24,
89
],
[
92,
91
],
[
24,
94
],
[
97,
96
],
[
103,
102
],
[
91,
104
],
[
24,
104
],
[
108,
107
],
[
111,
110
],
[
91,
110
],
[
24,
110
],
[
110,
114
],
[
102,
115
],
[
120,
115
],
[
118,
117
],
[
121,
120
],
[
110,
121
],
[
107,
124
],
[
137,
124
],
[
117,
124
],
[
110,
128
],
[
135,
130
],
[
96,
131
],
[
117,
133
],
[
107,
133
],
[
137,
133
],
[
138,
137
],
[
145,
140
],
[
96,
141
],
[
137,
143
],
[
117,
143
],
[
107,
143
],
[
162,
152
],
[
164,
155
],
[
86,
159
],
[
96,
160
],
[
162,
162
],
[
164,
164
],
[
166,
166
],
[
168,
168
],
[
235,
174
],
[
235,
183
],
[
235,
184
],
[
188,
187
],
[
233,
190
],
[
226,
203
],
[
223,
206
],
[
221,
208
],
[
236,
209
],
[
230,
210
],
[
233,
211
],
[
227,
212
],
[
215,
214
],
[
224,
214
],
[
214,
218
],
[
223,
224
],
[
226,
227
],
[
235,
230
],
[
235,
233
],
[
235,
236
]
] | [
"def solve(h,w,n,black_list):\n if len(black_list) == 0:\n return [(h-2)*(w-2)]+[0]*9\n idx_list = []\n for idx, (a,b) in enumerate(black_list):\n left = max(0, b-3)\n top = max(0, a-3)\n for row in range(top, a):\n if row+2 >= h:\n continue\n for col in range(left, b):\n if col+2 >= w:\n continue\n idx_list.append(row*w+col)\n\n set_count = set(idx_list)\n idx_list = sorted(idx_list)\n\n ans = [0]*9\n now = idx_list[0]\n count = 0\n for item in idx_list:\n if item == now:\n count += 1\n else:\n now = item\n if count == 10:\n print(item)\n ans[count-1] += 1\n count = 1\n ans[count-1] += 1\n return [(h-2)*(w-2)-len(set_count)]+ans\n\n\nif __name__ == \"__main__\":\n h,w,n = map(int,input().split())\n black_list = [tuple(map(int,input().split())) for _ in range(n)]\n ret = solve(h,w,n,black_list)\n for i in ret:\n print(i)",
"def solve(h,w,n,black_list):\n if len(black_list) == 0:\n return [(h-2)*(w-2)]+[0]*9\n idx_list = []\n for idx, (a,b) in enumerate(black_list):\n left = max(0, b-3)\n top = max(0, a-3)\n for row in range(top, a):\n if row+2 >= h:\n continue\n for col in range(left, b):\n if col+2 >= w:\n continue\n idx_list.append(row*w+col)\n\n set_count = set(idx_list)\n idx_list = sorted(idx_list)\n\n ans = [0]*9\n now = idx_list[0]\n count = 0\n for item in idx_list:\n if item == now:\n count += 1\n else:\n now = item\n if count == 10:\n print(item)\n ans[count-1] += 1\n count = 1\n ans[count-1] += 1\n return [(h-2)*(w-2)-len(set_count)]+ans",
"solve",
"if len(black_list) == 0:\n return [(h-2)*(w-2)]+[0]*9\n ",
"len(black_list) == 0",
"len(black_list)",
"len",
"black_list",
"0",
"return [(h-2)*(w-2)]+[0]*9",
"[(h-2)*(w-2)]+[0]*9",
"[(h-2)*(w-2)]",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"[0]*9",
"[0]",
"0",
"9",
"idx_list = []",
"idx_list",
"[]",
"for idx, (a,b) in enumerate(black_list):\n left = max(0, b-3)\n top = max(0, a-3)\n for row in range(top, a):\n if row+2 >= h:\n continue\n for col in range(left, b):\n if col+2 >= w:\n continue\n idx_list.append(row*w+col)\n\n ",
"idx",
"(a,b)",
"a",
"b",
"enumerate(black_list)",
"enumerate",
"black_list",
"left = max(0, b-3)",
"left",
"max(0, b-3)",
"max",
"0",
"b-3",
"b",
"3",
"top = max(0, a-3)",
"top",
"max(0, a-3)",
"max",
"0",
"a-3",
"a",
"3",
"for row in range(top, a):\n if row+2 >= h:\n continue\n for col in range(left, b):\n if col+2 >= w:\n continue\n idx_list.append(row*w+col)\n\n ",
"row",
"range(top, a)",
"range",
"top",
"a",
"if row+2 >= h:\n continue\n ",
"row+2 >= h",
"row+2",
"row",
"2",
"h",
"continue",
"for col in range(left, b):\n if col+2 >= w:\n continue\n idx_list.append(row*w+col)\n\n ",
"col",
"range(left, b)",
"range",
"left",
"b",
"if col+2 >= w:\n continue\n ",
"col+2 >= w",
"col+2",
"col",
"2",
"w",
"continue",
"idx_list.append(row*w+col)",
"idx_list.append",
"idx_list",
"append",
"row*w+col",
"row*w",
"row",
"w",
"col",
"set_count = set(idx_list)",
"set_count",
"set(idx_list)",
"set",
"idx_list",
"idx_list = sorted(idx_list)",
"idx_list",
"sorted(idx_list)",
"sorted",
"idx_list",
"ans = [0]*9",
"ans",
"[0]*9",
"[0]",
"0",
"9",
"now = idx_list[0]",
"now",
"idx_list[0]",
"idx_list",
"0",
"count = 0",
"count",
"0",
"for item in idx_list:\n if item == now:\n count += 1\n else:\n now = item\n if count == 10:\n print(item)\n ans[count-1] += 1\n count = 1\n ",
"item",
"idx_list",
"if item == now:\n count += 1\n else:\n now = item\n if count == 10:\n print(item)\n ans[count-1] += 1\n count = 1\n ",
"item == now",
"item",
"now",
"count += 1",
"count",
"1",
"now = item",
"now",
"item",
"if count == 10:\n print(item)\n ",
"count == 10",
"count",
"10",
"print(item)",
"print",
"item",
"ans[count-1] += 1",
"ans[count-1]",
"ans",
"count-1",
"count",
"1",
"1",
"count = 1",
"count",
"1",
"ans[count-1] += 1",
"ans[count-1]",
"ans",
"count-1",
"count",
"1",
"1",
"return [(h-2)*(w-2)-len(set_count)]+ans",
"[(h-2)*(w-2)-len(set_count)]+ans",
"[(h-2)*(w-2)-len(set_count)]",
"(h-2)*(w-2)-len(set_count)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"len(set_count)",
"len",
"set_count",
"ans",
"h",
"h",
"w",
"w",
"n",
"n",
"black_list",
"black_list",
"if __name__ == \"__main__\":\n h,w,n = map(int,input().split())\n black_list = [tuple(map(int,input().split())) for _ in range(n)]\n ret = solve(h,w,n,black_list)\n for i in ret:\n print(i)",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"h,w,n = map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"tuple(map(int,input().split())) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"tuple(map(int,input().split()))",
"tuple",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"black_list = [tuple(map(int,input().split())) for _ in range(n)]",
"black_list",
"[tuple(map(int,input().split())) for _ in range(n)]",
"ret = solve(h,w,n,black_list)",
"ret",
"solve(h,w,n,black_list)",
"solve",
"h",
"w",
"n",
"black_list",
"for i in ret:\n print(i)",
"i",
"ret",
"print(i)",
"print",
"i",
"def solve(h,w,n,black_list):\n if len(black_list) == 0:\n return [(h-2)*(w-2)]+[0]*9\n idx_list = []\n for idx, (a,b) in enumerate(black_list):\n left = max(0, b-3)\n top = max(0, a-3)\n for row in range(top, a):\n if row+2 >= h:\n continue\n for col in range(left, b):\n if col+2 >= w:\n continue\n idx_list.append(row*w+col)\n\n set_count = set(idx_list)\n idx_list = sorted(idx_list)\n\n ans = [0]*9\n now = idx_list[0]\n count = 0\n for item in idx_list:\n if item == now:\n count += 1\n else:\n now = item\n if count == 10:\n print(item)\n ans[count-1] += 1\n count = 1\n ans[count-1] += 1\n return [(h-2)*(w-2)-len(set_count)]+ans",
"def solve(h,w,n,black_list):\n if len(black_list) == 0:\n return [(h-2)*(w-2)]+[0]*9\n idx_list = []\n for idx, (a,b) in enumerate(black_list):\n left = max(0, b-3)\n top = max(0, a-3)\n for row in range(top, a):\n if row+2 >= h:\n continue\n for col in range(left, b):\n if col+2 >= w:\n continue\n idx_list.append(row*w+col)\n\n set_count = set(idx_list)\n idx_list = sorted(idx_list)\n\n ans = [0]*9\n now = idx_list[0]\n count = 0\n for item in idx_list:\n if item == now:\n count += 1\n else:\n now = item\n if count == 10:\n print(item)\n ans[count-1] += 1\n count = 1\n ans[count-1] += 1\n return [(h-2)*(w-2)-len(set_count)]+ans",
"solve",
"ret = solve(h,w,n,black_list)",
"solve(h,w,n,black_list)",
"ret",
"black_list = [tuple(map(int,input().split())) for _ in range(n)]",
"[tuple(map(int,input().split())) for _ in range(n)]",
"black_list",
"w,n = map(int,input().split())",
"map(int,input().split())",
"w",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h"
] | def solve(h,w,n,black_list):
if len(black_list) == 0:
return [(h-2)*(w-2)]+[0]*9
idx_list = []
for idx, (a,b) in enumerate(black_list):
left = max(0, b-3)
top = max(0, a-3)
for row in range(top, a):
if row+2 >= h:
continue
for col in range(left, b):
if col+2 >= w:
continue
idx_list.append(row*w+col)
set_count = set(idx_list)
idx_list = sorted(idx_list)
ans = [0]*9
now = idx_list[0]
count = 0
for item in idx_list:
if item == now:
count += 1
else:
now = item
if count == 10:
print(item)
ans[count-1] += 1
count = 1
ans[count-1] += 1
return [(h-2)*(w-2)-len(set_count)]+ans
if __name__ == "__main__":
h,w,n = map(int,input().split())
black_list = [tuple(map(int,input().split())) for _ in range(n)]
ret = solve(h,w,n,black_list)
for i in ret:
print(i)
|
[
7,
15,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
39,
17,
17,
17,
17,
17,
17,
17,
17,
17,
0,
13,
39,
17,
17,
17,
17,
17,
17,
17,
17,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
0,
13,
2,
13,
18,
13,
13,
0,
13,
2,
13,
18,
13,
13,
14,
2,
2,
2,
40,
13,
17,
40,
13,
17,
2,
13,
2,
13,
17,
2,
13,
2,
13,
17,
9,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
18,
13,
10,
2,
13,
10,
2,
13
] | [
[
180,
5
],
[
171,
12
],
[
181,
19
],
[
171,
21
],
[
171,
22
],
[
153,
24
],
[
156,
29
],
[
168,
41
],
[
54,
53
],
[
163,
56
],
[
174,
58
],
[
181,
65
],
[
174,
67
],
[
70,
69
],
[
183,
74
],
[
160,
76
],
[
157,
78
],
[
69,
79
],
[
177,
81
],
[
175,
83
],
[
169,
85
],
[
69,
86
],
[
184,
92
],
[
178,
95
],
[
184,
98
],
[
172,
100
],
[
178,
103
],
[
166,
105
],
[
114,
109
],
[
154,
110
],
[
186,
116
],
[
123,
122
],
[
154,
122
],
[
130,
125
],
[
187,
126
],
[
154,
128
],
[
122,
129
],
[
135,
132
],
[
187,
133
],
[
172,
138
],
[
166,
141
],
[
187,
145
],
[
148,
147
],
[
187,
147
],
[
147,
151
],
[
153,
154
],
[
156,
157
],
[
174,
160
],
[
171,
163
],
[
171,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
],
[
180,
181
],
[
183,
184
],
[
186,
187
]
] | [
"from collections import defaultdict\nimport sys\ninput = sys.stdin.readline\n\nh, w, n = map(int, input().split())\nd = defaultdict(int)\ndx = [1, 1, 1, 0, 0, 0, -1, -1, -1]\ndy = [1, 0, -1, 1, 0, -1, 1, 0, -1]\nfor i in range(n):\n a, b = map(int, input().split())\n for k in range(9):\n na = a+dx[k]\n nb = b+dy[k]\n if na <= 1 or nb <= 1 or na > h-1 or nb > w-1:\n continue\n d[(na, nb)] += 1\n\nans = [0] * 10\nfor key in d:\n ans[d[key]] += 1\nans[0] = (h-2) * (w-2) - sum(ans)\n\nfor ans_i in ans:\n print(ans_i)",
"from collections import defaultdict",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"dx = [1, 1, 1, 0, 0, 0, -1, -1, -1]",
"dx",
"[1, 1, 1, 0, 0, 0, -1, -1, -1]",
"1",
"1",
"1",
"0",
"0",
"0",
"-1",
"-1",
"-1",
"dy = [1, 0, -1, 1, 0, -1, 1, 0, -1]",
"dy",
"[1, 0, -1, 1, 0, -1, 1, 0, -1]",
"1",
"0",
"-1",
"1",
"0",
"-1",
"1",
"0",
"-1",
"for i in range(n):\n a, b = map(int, input().split())\n for k in range(9):\n na = a+dx[k]\n nb = b+dy[k]\n if na <= 1 or nb <= 1 or na > h-1 or nb > w-1:\n continue\n d[(na, nb)] += 1",
"i",
"range(n)",
"range",
"n",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for k in range(9):\n na = a+dx[k]\n nb = b+dy[k]\n if na <= 1 or nb <= 1 or na > h-1 or nb > w-1:\n continue\n d[(na, nb)] += 1",
"k",
"range(9)",
"range",
"9",
"na = a+dx[k]",
"na",
"a+dx[k]",
"a",
"dx[k]",
"dx",
"k",
"nb = b+dy[k]",
"nb",
"b+dy[k]",
"b",
"dy[k]",
"dy",
"k",
"if na <= 1 or nb <= 1 or na > h-1 or nb > w-1:\n continue\n ",
"na <= 1 or nb <= 1 or na > h-1 or nb > w-1",
"na <= 1 or nb <= 1 or na > h-1",
"na <= 1 or nb <= 1",
"na <= 1",
"na",
"1",
"nb <= 1",
"nb",
"1",
"na > h-1",
"na",
"h-1",
"h",
"1",
"nb > w-1",
"nb",
"w-1",
"w",
"1",
"continue",
"d[(na, nb)] += 1",
"d[(na, nb)]",
"d",
"(na, nb)",
"na",
"nb",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for key in d:\n ans[d[key]] += 1",
"key",
"d",
"ans[d[key]] += 1",
"ans[d[key]]",
"ans",
"d[key]",
"d",
"key",
"1",
"ans[0] = (h-2) * (w-2) - sum(ans)",
"ans[0]",
"ans",
"0",
"(h-2) * (w-2) - sum(ans)",
"(h-2) * (w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"for ans_i in ans:\n print(ans_i)",
"ans_i",
"ans",
"print(ans_i)",
"print",
"ans_i",
"d = defaultdict(int)",
"defaultdict(int)",
"d",
"dx = [1, 1, 1, 0, 0, 0, -1, -1, -1]",
"[1, 1, 1, 0, 0, 0, -1, -1, -1]",
"dx",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"dy = [1, 0, -1, 1, 0, -1, 1, 0, -1]",
"[1, 0, -1, 1, 0, -1, 1, 0, -1]",
"dy",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"nb = b+dy[k]",
"b+dy[k]",
"nb",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"na = a+dx[k]",
"a+dx[k]",
"na",
"ans = [0] * 10",
"[0] * 10",
"ans"
] | from collections import defaultdict
import sys
input = sys.stdin.readline
h, w, n = map(int, input().split())
d = defaultdict(int)
dx = [1, 1, 1, 0, 0, 0, -1, -1, -1]
dy = [1, 0, -1, 1, 0, -1, 1, 0, -1]
for i in range(n):
a, b = map(int, input().split())
for k in range(9):
na = a+dx[k]
nb = b+dy[k]
if na <= 1 or nb <= 1 or na > h-1 or nb > w-1:
continue
d[(na, nb)] += 1
ans = [0] * 10
for key in d:
ans[d[key]] += 1
ans[0] = (h-2) * (w-2) - sum(ans)
for ans_i in ans:
print(ans_i)
|
[
7,
15,
13,
12,
13,
0,
13,
4,
13,
13,
13,
15,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
2,
4,
13,
13,
2,
13,
17,
17,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
2,
4,
13,
13,
2,
13,
17,
17,
0,
18,
13,
39,
13,
13,
17,
0,
13,
4,
13,
4,
13,
4,
18,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
126,
6
],
[
121,
8
],
[
126,
9
],
[
126,
10
],
[
117,
13
],
[
19,
18
],
[
127,
21
],
[
129,
23
],
[
121,
25
],
[
129,
26
],
[
29,
28
],
[
130,
35
],
[
130,
40
],
[
124,
42
],
[
47,
46
],
[
109,
53
],
[
109,
58
],
[
112,
60
],
[
69,
64
],
[
118,
65
],
[
114,
71
],
[
118,
78
],
[
124,
85
],
[
112,
88
],
[
115,
94
],
[
98,
97
],
[
115,
105
],
[
97,
106
],
[
129,
109
],
[
126,
112
],
[
114,
115
],
[
117,
118
],
[
126,
124
],
[
126,
127
],
[
129,
130
]
] | [
"import sys\ndef MI(): return map(int,sys.stdin.readline().rstrip().split())\n\nH,W,N = MI()\n\nfrom collections import defaultdict,Counter\n\nd = defaultdict(int) # d[(i,j)] = [i,i+2]×[j,j+2] に黒いマスが何個あるか\nfor i in range(N):\n a,b = MI()\n for j in range(max(1,a-2),min(a,H-2)+1):\n for k in range(max(1,b-2),min(b,W-2)+1):\n d[(j,k)] += 1\n\nc = Counter(list(d.values()))\nprint((H-2)*(W-2)-sum(c.values()))\nfor i in range(1,10):\n print(c[i])",
"import sys",
"sys",
"def MI(): return map(int,sys.stdin.readline().rstrip().split())",
"MI",
"H,W,N = MI()",
"H",
"MI()",
"MI",
"W",
"N",
"from collections import defaultdict,Counter",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n a,b = MI()\n for j in range(max(1,a-2),min(a,H-2)+1):\n for k in range(max(1,b-2),min(b,W-2)+1):\n d[(j,k)] += 1",
"i",
"range(N)",
"range",
"N",
"a,b = MI()",
"a",
"MI()",
"MI",
"b",
"for j in range(max(1,a-2),min(a,H-2)+1):\n for k in range(max(1,b-2),min(b,W-2)+1):\n d[(j,k)] += 1",
"j",
"range(max(1,a-2),min(a,H-2)+1)",
"range",
"max(1,a-2)",
"max",
"1",
"a-2",
"a",
"2",
"min(a,H-2)+1",
"min(a,H-2)",
"min",
"a",
"H-2",
"H",
"2",
"1",
"for k in range(max(1,b-2),min(b,W-2)+1):\n d[(j,k)] += 1",
"k",
"range(max(1,b-2),min(b,W-2)+1)",
"range",
"max(1,b-2)",
"max",
"1",
"b-2",
"b",
"2",
"min(b,W-2)+1",
"min(b,W-2)",
"min",
"b",
"W-2",
"W",
"2",
"1",
"d[(j,k)] += 1",
"d[(j,k)]",
"d",
"(j,k)",
"j",
"k",
"1",
"c = Counter(list(d.values()))",
"c",
"Counter(list(d.values()))",
"Counter",
"list(d.values())",
"list",
"d.values()",
"d.values",
"d",
"values",
"print((H-2)*(W-2)-sum(c.values()))",
"print",
"(H-2)*(W-2)-sum(c.values())",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(c.values())",
"sum",
"c.values()",
"c.values",
"c",
"values",
"for i in range(1,10):\n print(c[i])",
"i",
"range(1,10)",
"range",
"1",
"10",
"print(c[i])",
"print",
"c[i]",
"c",
"i",
"b = MI()",
"MI()",
"b",
"W,N = MI()",
"MI()",
"W",
"c = Counter(list(d.values()))",
"Counter(list(d.values()))",
"c",
"d = defaultdict(int)",
"defaultdict(int)",
"d",
"def MI(): return map(int,sys.stdin.readline().rstrip().split())",
"def MI(): return map(int,sys.stdin.readline().rstrip().split())",
"MI",
"H,W,N = MI()",
"MI()",
"H",
"N = MI()",
"MI()",
"N",
"a,b = MI()",
"MI()",
"a"
] | import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
H,W,N = MI()
from collections import defaultdict,Counter
d = defaultdict(int) # d[(i,j)] = [i,i+2]×[j,j+2] に黒いマスが何個あるか
for i in range(N):
a,b = MI()
for j in range(max(1,a-2),min(a,H-2)+1):
for k in range(max(1,b-2),min(b,W-2)+1):
d[(j,k)] += 1
c = Counter(list(d.values()))
print((H-2)*(W-2)-sum(c.values()))
for i in range(1,10):
print(c[i])
|
[
7,
15,
13,
15,
0,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
4,
13,
12,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
4,
13,
31,
13,
0,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13
] | [
[
144,
5
],
[
132,
14
],
[
150,
20
],
[
145,
27
],
[
150,
29
],
[
150,
30
],
[
33,
32
],
[
130,
35
],
[
138,
37
],
[
145,
44
],
[
138,
46
],
[
49,
48
],
[
136,
52
],
[
136,
55
],
[
59,
58
],
[
139,
62
],
[
139,
65
],
[
48,
72
],
[
151,
74
],
[
58,
79
],
[
148,
81
],
[
87,
84
],
[
133,
85
],
[
48,
86
],
[
141,
89
],
[
133,
99
],
[
105,
102
],
[
142,
103
],
[
110,
107
],
[
142,
108
],
[
151,
113
],
[
148,
116
],
[
142,
120
],
[
142,
124
],
[
127,
126
],
[
150,
130
],
[
132,
133
],
[
138,
136
],
[
138,
139
],
[
141,
142
],
[
144,
145
],
[
150,
148
],
[
150,
151
]
] | [
"import sys\nfrom collections import defaultdict\ninput = sys.stdin.buffer.readline\n\ncount = defaultdict(lambda: 0)\n\nH, W, N = map(int, input().split())\nfor _ in range(N):\n a, b = map(int, input().split())\n for a_2 in range(a-1, a+2):\n for b_2 in range(b-1, b+2):\n if 2 <= a_2 <= H-1 and 2 <= b_2 <= W-1:\n count[a_2, b_2] += 1\n\nans = [0] * 10\nfor _, v in count.items():\n ans[v] += 1\n\nans[0] = (H-2) * (W-2) - sum(ans)\n\nprint(*ans, sep = '\\n')",
"import sys",
"sys",
"from collections import defaultdict",
"input = sys.stdin.buffer.readline",
"input",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"count = defaultdict(lambda: 0)",
"count",
"defaultdict(lambda: 0)",
"defaultdict",
"lambda: 0",
"0",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"for _ in range(N):\n a, b = map(int, input().split())\n for a_2 in range(a-1, a+2):\n for b_2 in range(b-1, b+2):\n if 2 <= a_2 <= H-1 and 2 <= b_2 <= W-1:\n count[a_2, b_2] += 1",
"_",
"range(N)",
"range",
"N",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for a_2 in range(a-1, a+2):\n for b_2 in range(b-1, b+2):\n if 2 <= a_2 <= H-1 and 2 <= b_2 <= W-1:\n count[a_2, b_2] += 1",
"a_2",
"range(a-1, a+2)",
"range",
"a-1",
"a",
"1",
"a+2",
"a",
"2",
"for b_2 in range(b-1, b+2):\n if 2 <= a_2 <= H-1 and 2 <= b_2 <= W-1:\n count[a_2, b_2] += 1",
"b_2",
"range(b-1, b+2)",
"range",
"b-1",
"b",
"1",
"b+2",
"b",
"2",
"if 2 <= a_2 <= H-1 and 2 <= b_2 <= W-1:\n count[a_2, b_2] += 1",
"2 <= a_2 <= H-1 and 2 <= b_2 <= W-1",
"2 <= a_2 <= H-1",
"2 <= a_2",
"2",
"a_2",
"H-1",
"H",
"1",
"2 <= b_2 <= W-1",
"2 <= b_2",
"2",
"b_2",
"W-1",
"W",
"1",
"count[a_2, b_2] += 1",
"count[a_2, b_2]",
"count",
"a_2",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for _, v in count.items():\n ans[v] += 1",
"_",
"v",
"count.items()",
"count.items",
"count",
"items",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"ans[0] = (H-2) * (W-2) - sum(ans)",
"ans[0]",
"ans",
"0",
"(H-2) * (W-2) - sum(ans)",
"(H-2) * (W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(ans)",
"sum",
"ans",
"print(*ans, sep = '\\n')",
"print",
"*ans",
"ans",
"sep = '\\n'",
"sep",
"'\\n'",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"count = defaultdict(lambda: 0)",
"defaultdict(lambda: 0)",
"count",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"ans = [0] * 10",
"[0] * 10",
"ans",
"input = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"input",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H"
] | import sys
from collections import defaultdict
input = sys.stdin.buffer.readline
count = defaultdict(lambda: 0)
H, W, N = map(int, input().split())
for _ in range(N):
a, b = map(int, input().split())
for a_2 in range(a-1, a+2):
for b_2 in range(b-1, b+2):
if 2 <= a_2 <= H-1 and 2 <= b_2 <= W-1:
count[a_2, b_2] += 1
ans = [0] * 10
for _, v in count.items():
ans[v] += 1
ans[0] = (H-2) * (W-2) - sum(ans)
print(*ans, sep = '\n') |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
0,
13,
2,
39,
17,
17,
28,
13,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
39,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
0,
13,
2,
13,
13,
13,
2,
13,
13,
14,
2,
40,
40,
17,
2,
13,
13,
13,
40,
40,
17,
2,
13,
13,
13,
14,
2,
39,
2,
13,
13,
2,
13,
13,
13,
0,
13,
17,
0,
13,
17,
3,
14,
13,
0,
18,
13,
13,
17,
28,
13,
4,
13,
17,
17,
0,
18,
13,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
28,
13,
13,
4,
13,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
13,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] | [
[
210,
2
],
[
210,
11
],
[
210,
12
],
[
16,
15
],
[
187,
18
],
[
195,
31
],
[
189,
34
],
[
196,
37
],
[
192,
39
],
[
50,
49
],
[
55,
54
],
[
213,
59
],
[
180,
62
],
[
198,
96
],
[
49,
99
],
[
183,
100
],
[
54,
103
],
[
199,
111
],
[
205,
112
],
[
184,
118
],
[
211,
119
],
[
199,
125
],
[
184,
128
],
[
190,
129
],
[
207,
131
],
[
201,
134
],
[
143,
140
],
[
193,
141
],
[
208,
142
],
[
214,
142
],
[
146,
145
],
[
154,
151
],
[
193,
152
],
[
145,
153
],
[
145,
154
],
[
159,
156
],
[
193,
157
],
[
205,
162
],
[
211,
165
],
[
193,
170
],
[
175,
174
],
[
193,
174
],
[
174,
178
],
[
180,
181
],
[
183,
184
],
[
210,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
],
[
201,
202
],
[
210,
205
],
[
207,
208
],
[
210,
211
],
[
213,
214
]
] | [
"h,w,n=map(int,input().split())\nblack=[tuple(map(int,input().split())) for _ in range(n)]\nsblack=set(black)\nans=[0]*10\nfor a,b in black:\n for x in range(3):\n for y in range(3):\n cnt=0\n ok=True\n for nx,ny in [(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]:\n dx,dy=nx-x,ny-y\n if 1<=a-dx<=h and 1<=b-dy<=w:\n if (a-dx,b-dy) in sblack:\n cnt+=1\n else:\n ok=False\n break\n if ok:\n ans[cnt]+=1\nfor i in range(1,10):\n ans[i]//=i\nans[0]=(h-2)*(w-2)-sum(ans[1:])\nfor num in ans:\n print(num)",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"tuple(map(int,input().split())) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"tuple(map(int,input().split()))",
"tuple",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"black=[tuple(map(int,input().split())) for _ in range(n)]",
"black",
"[tuple(map(int,input().split())) for _ in range(n)]",
"sblack=set(black)",
"sblack",
"set(black)",
"set",
"black",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for a,b in black:\n for x in range(3):\n for y in range(3):\n cnt=0\n ok=True\n for nx,ny in [(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]:\n dx,dy=nx-x,ny-y\n if 1<=a-dx<=h and 1<=b-dy<=w:\n if (a-dx,b-dy) in sblack:\n cnt+=1\n else:\n ok=False\n break\n if ok:\n ans[cnt]+=1",
"a",
"b",
"black",
"for x in range(3):\n for y in range(3):\n cnt=0\n ok=True\n for nx,ny in [(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]:\n dx,dy=nx-x,ny-y\n if 1<=a-dx<=h and 1<=b-dy<=w:\n if (a-dx,b-dy) in sblack:\n cnt+=1\n else:\n ok=False\n break\n if ok:\n ans[cnt]+=1",
"x",
"range(3)",
"range",
"3",
"for y in range(3):\n cnt=0\n ok=True\n for nx,ny in [(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]:\n dx,dy=nx-x,ny-y\n if 1<=a-dx<=h and 1<=b-dy<=w:\n if (a-dx,b-dy) in sblack:\n cnt+=1\n else:\n ok=False\n break\n if ok:\n ans[cnt]+=1",
"y",
"range(3)",
"range",
"3",
"cnt=0",
"cnt",
"0",
"ok=True",
"ok",
"True",
"for nx,ny in [(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]:\n dx,dy=nx-x,ny-y\n if 1<=a-dx<=h and 1<=b-dy<=w:\n if (a-dx,b-dy) in sblack:\n cnt+=1\n else:\n ok=False\n break\n ",
"nx",
"ny",
"[(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]",
"(0,0)",
"0",
"0",
"(0,1)",
"0",
"1",
"(0,2)",
"0",
"2",
"(1,0)",
"1",
"0",
"(1,1)",
"1",
"1",
"(1,2)",
"1",
"2",
"(2,0)",
"2",
"0",
"(2,1)",
"2",
"1",
"(2,2)",
"2",
"2",
"dx,dy=nx-x,ny-y",
"dx",
"nx-x",
"nx",
"x",
"dy",
"ny-y",
"ny",
"y",
"if 1<=a-dx<=h and 1<=b-dy<=w:\n if (a-dx,b-dy) in sblack:\n cnt+=1\n else:\n ok=False\n break\n ",
"1<=a-dx<=h and 1<=b-dy<=w",
"1<=a-dx<=h",
"1<=a-dx",
"1",
"a-dx",
"a",
"dx",
"h",
"1<=b-dy<=w",
"1<=b-dy",
"1",
"b-dy",
"b",
"dy",
"w",
"if (a-dx,b-dy) in sblack:\n cnt+=1\n ",
"(a-dx,b-dy) in sblack",
"(a-dx,b-dy)",
"a-dx",
"a",
"dx",
"b-dy",
"b",
"dy",
"sblack",
"cnt+=1",
"cnt",
"1",
"ok=False",
"ok",
"False",
"break",
"if ok:\n ans[cnt]+=1",
"ok",
"ans[cnt]+=1",
"ans[cnt]",
"ans",
"cnt",
"1",
"for i in range(1,10):\n ans[i]//=i",
"i",
"range(1,10)",
"range",
"1",
"10",
"ans[i]//=i",
"ans[i]",
"ans",
"i",
"i",
"ans[0]=(h-2)*(w-2)-sum(ans[1:])",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)-sum(ans[1:])",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"for num in ans:\n print(num)",
"num",
"ans",
"print(num)",
"print",
"num",
"ok=True",
"True",
"ok",
"dy=nx-x,ny-y",
"ny-y",
"dy",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"sblack=set(black)",
"set(black)",
"sblack",
"ans=[0]*10",
"[0]*10",
"ans",
"black=[tuple(map(int,input().split())) for _ in range(n)]",
"[tuple(map(int,input().split())) for _ in range(n)]",
"black",
"dx,dy=nx-x,ny-y",
"nx-x",
"dx",
"ok=False",
"False",
"ok",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"cnt+=1",
"1",
"cnt",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"cnt=0",
"0",
"cnt"
] | h,w,n=map(int,input().split())
black=[tuple(map(int,input().split())) for _ in range(n)]
sblack=set(black)
ans=[0]*10
for a,b in black:
for x in range(3):
for y in range(3):
cnt=0
ok=True
for nx,ny in [(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]:
dx,dy=nx-x,ny-y
if 1<=a-dx<=h and 1<=b-dy<=w:
if (a-dx,b-dy) in sblack:
cnt+=1
else:
ok=False
break
if ok:
ans[cnt]+=1
for i in range(1,10):
ans[i]//=i
ans[0]=(h-2)*(w-2)-sum(ans[1:])
for num in ans:
print(num) |
[
7,
15,
0,
13,
39,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
2,
2,
2,
2,
2,
13,
17,
13,
17,
2,
2,
2,
13,
17,
13,
2,
13,
17,
2,
2,
2,
13,
17,
13,
17,
2,
2,
2,
13,
17,
13,
2,
13,
17,
17,
4,
18,
13,
13,
39,
2,
2,
13,
17,
13,
2,
2,
13,
17,
13,
0,
13,
4,
13,
13,
0,
13,
2,
39,
17,
17,
42,
13,
0,
18,
13,
18,
4,
18,
13,
13,
17,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] | [
[
146,
3
],
[
155,
6
],
[
155,
15
],
[
155,
16
],
[
19,
18
],
[
153,
21
],
[
161,
23
],
[
161,
32
],
[
35,
34
],
[
40,
39
],
[
162,
50
],
[
34,
52
],
[
162,
57
],
[
34,
59
],
[
156,
61
],
[
150,
66
],
[
39,
68
],
[
150,
73
],
[
39,
75
],
[
144,
77
],
[
147,
82
],
[
162,
87
],
[
34,
89
],
[
150,
92
],
[
39,
94
],
[
158,
96
],
[
147,
99
],
[
164,
101
],
[
117,
109
],
[
165,
110
],
[
159,
114
],
[
122,
119
],
[
165,
120
],
[
156,
125
],
[
144,
128
],
[
165,
133
],
[
138,
137
],
[
165,
137
],
[
137,
141
],
[
155,
144
],
[
146,
147
],
[
161,
150
],
[
155,
153
],
[
155,
156
],
[
158,
159
],
[
161,
162
],
[
164,
165
]
] | [
"from collections import Counter\nq=[]\nh,w,n=map(int,input().split())\nfor i in range(n):\n x,y=map(int,input().split())\n for j in range(3):\n for k in range(3):\n if (x-2+j)<1 or (x-2+j)>h-2 or (y-2+k)<1 or (y-2+k)>w-2:\n 0\n else:\n q.append((x-2+j,y-2+k))\nc=Counter(q)\nans=[0]*10\nwhile c:\n ans[c.popitem()[1]]+=1\nans[0]=(h-2)*(w-2)-sum(ans[1:])\nfor i in ans:\n print(i)",
"from collections import Counter",
"q=[]",
"q",
"[]",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"for i in range(n):\n x,y=map(int,input().split())\n for j in range(3):\n for k in range(3):\n if (x-2+j)<1 or (x-2+j)>h-2 or (y-2+k)<1 or (y-2+k)>w-2:\n 0\n else:\n q.append((x-2+j,y-2+k))",
"i",
"range(n)",
"range",
"n",
"x,y=map(int,input().split())",
"x",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"for j in range(3):\n for k in range(3):\n if (x-2+j)<1 or (x-2+j)>h-2 or (y-2+k)<1 or (y-2+k)>w-2:\n 0\n else:\n q.append((x-2+j,y-2+k))",
"j",
"range(3)",
"range",
"3",
"for k in range(3):\n if (x-2+j)<1 or (x-2+j)>h-2 or (y-2+k)<1 or (y-2+k)>w-2:\n 0\n else:\n q.append((x-2+j,y-2+k))",
"k",
"range(3)",
"range",
"3",
"if (x-2+j)<1 or (x-2+j)>h-2 or (y-2+k)<1 or (y-2+k)>w-2:\n 0\n else:\n q.append((x-2+j,y-2+k))",
"(x-2+j)<1 or (x-2+j)>h-2 or (y-2+k)<1 or (y-2+k)>w-2",
"(x-2+j)<1 or (x-2+j)>h-2 or (y-2+k)<1",
"(x-2+j)<1 or (x-2+j)>h-2",
"(x-2+j)<1",
"x-2+j",
"x-2",
"x",
"2",
"j",
"1",
"(x-2+j)>h-2",
"x-2+j",
"x-2",
"x",
"2",
"j",
"h-2",
"h",
"2",
"(y-2+k)<1",
"y-2+k",
"y-2",
"y",
"2",
"k",
"1",
"(y-2+k)>w-2",
"y-2+k",
"y-2",
"y",
"2",
"k",
"w-2",
"w",
"2",
"0",
"q.append((x-2+j,y-2+k))",
"q.append",
"q",
"append",
"(x-2+j,y-2+k)",
"x-2+j",
"x-2",
"x",
"2",
"j",
"y-2+k",
"y-2",
"y",
"2",
"k",
"c=Counter(q)",
"c",
"Counter(q)",
"Counter",
"q",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"while c:\n ans[c.popitem()[1]]+=1",
"c",
"ans[c.popitem()[1]]+=1",
"ans[c.popitem()[1]]",
"ans",
"c.popitem()[1]",
"c.popitem()",
"c.popitem",
"c",
"popitem",
"1",
"1",
"ans[0]=(h-2)*(w-2)-sum(ans[1:])",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)-sum(ans[1:])",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"q=[]",
"[]",
"q",
"y=map(int,input().split())",
"map(int,input().split())",
"y",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"c=Counter(q)",
"Counter(q)",
"c",
"x,y=map(int,input().split())",
"map(int,input().split())",
"x",
"ans=[0]*10",
"[0]*10",
"ans"
] | from collections import Counter
q=[]
h,w,n=map(int,input().split())
for i in range(n):
x,y=map(int,input().split())
for j in range(3):
for k in range(3):
if (x-2+j)<1 or (x-2+j)>h-2 or (y-2+k)<1 or (y-2+k)>w-2:
0
else:
q.append((x-2+j,y-2+k))
c=Counter(q)
ans=[0]*10
while c:
ans[c.popitem()[1]]+=1
ans[0]=(h-2)*(w-2)-sum(ans[1:])
for i in ans:
print(i) |
[
7,
15,
12,
13,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
13,
17,
28,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
14,
2,
2,
2,
17,
2,
13,
13,
2,
13,
17,
2,
2,
17,
2,
13,
13,
2,
13,
17,
0,
13,
39,
2,
13,
13,
2,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
41,
28,
13,
4,
18,
13,
13,
4,
13,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
17,
17,
4,
8,
2,
13,
13,
18,
13,
13,
17,
0,
13,
2,
39,
2,
13,
4,
13,
13,
13,
41,
28,
13,
13,
4,
4,
13,
13,
29,
4,
18,
17,
13,
13,
23,
13,
23,
13,
23,
13,
23,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
0,
13,
13,
4,
13,
4,
13,
13,
13,
13,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
13,
13
] | [
[
6,
5
],
[
136,
8
],
[
138,
11
],
[
15,
14
],
[
22,
21
],
[
25,
24
],
[
28,
27
],
[
34,
33
],
[
21,
44
],
[
27,
45
],
[
136,
47
],
[
24,
53
],
[
33,
54
],
[
138,
56
],
[
60,
59
],
[
21,
62
],
[
27,
63
],
[
24,
65
],
[
33,
66
],
[
59,
69
],
[
14,
70
],
[
75,
72
],
[
14,
73
],
[
59,
74
],
[
80,
77
],
[
14,
78
],
[
59,
79
],
[
84,
83
],
[
14,
86
],
[
83,
89
],
[
92,
91
],
[
98,
97
],
[
97,
105
],
[
91,
106
],
[
91,
108
],
[
97,
109
],
[
113,
112
],
[
5,
116
],
[
14,
119
],
[
124,
123
],
[
112,
123
],
[
123,
128
],
[
136,
136
],
[
138,
138
],
[
140,
140
],
[
142,
142
],
[
199,
148
],
[
199,
158
],
[
199,
159
],
[
163,
162
],
[
191,
165
],
[
202,
179
],
[
197,
184
],
[
200,
185
],
[
194,
186
],
[
191,
187
],
[
203,
188
],
[
199,
191
],
[
199,
194
],
[
199,
200
],
[
202,
203
]
] | [
"from collections import Counter\n\n\ndef solve(H, W, N, ABs):\n total = (H - 2) * (W - 2)\n points = {}\n for a, b in ABs:\n a -= 1\n b -= 1\n for i in [-1, 0, 1]:\n for j in [-1, 0, 1]:\n if 0 < a + i < H - 1 and 0 < b + j < W - 1:\n d = (a + i, b + j)\n if d not in points:\n points[d] = 0\n points[d] += 1\n c = Counter([v for v in points.values()])\n ans = [total - len(points)] + [c[f] if f in c else 0 for f in range(1, 10)]\n return \"\\n\".join([str(a) for a in ans])\n\nif __name__ == \"__main__\":\n H, W, N = map(int, input().split(\" \"))\n ABs = [tuple(map(int, input().split(\" \"))) for _ in range(N)]\n print(solve(H, W, N, ABs))",
"from collections import Counter",
"def solve(H, W, N, ABs):\n total = (H - 2) * (W - 2)\n points = {}\n for a, b in ABs:\n a -= 1\n b -= 1\n for i in [-1, 0, 1]:\n for j in [-1, 0, 1]:\n if 0 < a + i < H - 1 and 0 < b + j < W - 1:\n d = (a + i, b + j)\n if d not in points:\n points[d] = 0\n points[d] += 1\n c = Counter([v for v in points.values()])\n ans = [total - len(points)] + [c[f] if f in c else 0 for f in range(1, 10)]\n return \"\\n\".join([str(a) for a in ans])",
"solve",
"total = (H - 2) * (W - 2)",
"total",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"points = {}",
"points",
"{}",
"for a, b in ABs:\n a -= 1\n b -= 1\n for i in [-1, 0, 1]:\n for j in [-1, 0, 1]:\n if 0 < a + i < H - 1 and 0 < b + j < W - 1:\n d = (a + i, b + j)\n if d not in points:\n points[d] = 0\n points[d] += 1\n ",
"a",
"b",
"ABs",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for i in [-1, 0, 1]:\n for j in [-1, 0, 1]:\n if 0 < a + i < H - 1 and 0 < b + j < W - 1:\n d = (a + i, b + j)\n if d not in points:\n points[d] = 0\n points[d] += 1\n ",
"i",
"[-1, 0, 1]",
"-1",
"0",
"1",
"for j in [-1, 0, 1]:\n if 0 < a + i < H - 1 and 0 < b + j < W - 1:\n d = (a + i, b + j)\n if d not in points:\n points[d] = 0\n points[d] += 1\n ",
"j",
"[-1, 0, 1]",
"-1",
"0",
"1",
"if 0 < a + i < H - 1 and 0 < b + j < W - 1:\n d = (a + i, b + j)\n if d not in points:\n points[d] = 0\n points[d] += 1\n ",
"0 < a + i < H - 1 and 0 < b + j < W - 1",
"0 < a + i < H - 1",
"0 < a + i",
"0",
"a + i",
"a",
"i",
"H - 1",
"H",
"1",
"0 < b + j < W - 1",
"0 < b + j",
"0",
"b + j",
"b",
"j",
"W - 1",
"W",
"1",
"d = (a + i, b + j)",
"d",
"(a + i, b + j)",
"a + i",
"a",
"i",
"b + j",
"b",
"j",
"if d not in points:\n points[d] = 0\n ",
"d not in points",
"d",
"points",
"points[d] = 0",
"points[d]",
"points",
"d",
"0",
"points[d] += 1",
"points[d]",
"points",
"d",
"1",
"v for v in points.values()",
"for v in points.values()",
"v",
"points.values()",
"points.values",
"points",
"values",
"for v in points.values()",
"v",
"c = Counter([v for v in points.values()])",
"c",
"Counter([v for v in points.values()])",
"Counter",
"[v for v in points.values()]",
"c[f] if f in c else 0 for f in range(1, 10)",
"for f in range(1, 10)",
"f",
"range(1, 10)",
"range",
"1",
"10",
"for f in range(1, 10)",
"c[f] if f in c else 0",
"f in c",
"f",
"c",
"c[f]",
"c",
"f",
"0",
"ans = [total - len(points)] + [c[f] if f in c else 0 for f in range(1, 10)]",
"ans",
"[total - len(points)] + [c[f] if f in c else 0 for f in range(1, 10)]",
"[total - len(points)]",
"total - len(points)",
"total",
"len(points)",
"len",
"points",
"[c[f] if f in c else 0 for f in range(1, 10)]",
"str(a) for a in ans",
"for a in ans",
"a",
"ans",
"for a in ans",
"str(a)",
"str",
"a",
"return \"\\n\".join([str(a) for a in ans])",
"\"\\n\".join([str(a) for a in ans])",
"\"\\n\".join",
"\"\\n\"",
"join",
"[str(a) for a in ans]",
"H",
"H",
"W",
"W",
"N",
"N",
"ABs",
"ABs",
"if __name__ == \"__main__\":\n H, W, N = map(int, input().split(\" \"))\n ABs = [tuple(map(int, input().split(\" \"))) for _ in range(N)]\n print(solve(H, W, N, ABs))",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"H, W, N = map(int, input().split(\" \"))",
"H",
"map(int, input().split(\" \"))",
"map",
"int",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"W",
"N",
"tuple(map(int, input().split(\" \"))) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"tuple(map(int, input().split(\" \")))",
"tuple",
"map(int, input().split(\" \"))",
"map",
"int",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"ABs = [tuple(map(int, input().split(\" \"))) for _ in range(N)]",
"ABs",
"[tuple(map(int, input().split(\" \"))) for _ in range(N)]",
"print(solve(H, W, N, ABs))",
"print",
"solve(H, W, N, ABs)",
"solve",
"H",
"W",
"N",
"ABs",
"N = map(int, input().split(\" \"))",
"map(int, input().split(\" \"))",
"N",
"W, N = map(int, input().split(\" \"))",
"map(int, input().split(\" \"))",
"W",
"def solve(H, W, N, ABs):\n total = (H - 2) * (W - 2)\n points = {}\n for a, b in ABs:\n a -= 1\n b -= 1\n for i in [-1, 0, 1]:\n for j in [-1, 0, 1]:\n if 0 < a + i < H - 1 and 0 < b + j < W - 1:\n d = (a + i, b + j)\n if d not in points:\n points[d] = 0\n points[d] += 1\n c = Counter([v for v in points.values()])\n ans = [total - len(points)] + [c[f] if f in c else 0 for f in range(1, 10)]\n return \"\\n\".join([str(a) for a in ans])",
"def solve(H, W, N, ABs):\n total = (H - 2) * (W - 2)\n points = {}\n for a, b in ABs:\n a -= 1\n b -= 1\n for i in [-1, 0, 1]:\n for j in [-1, 0, 1]:\n if 0 < a + i < H - 1 and 0 < b + j < W - 1:\n d = (a + i, b + j)\n if d not in points:\n points[d] = 0\n points[d] += 1\n c = Counter([v for v in points.values()])\n ans = [total - len(points)] + [c[f] if f in c else 0 for f in range(1, 10)]\n return \"\\n\".join([str(a) for a in ans])",
"solve",
"H, W, N = map(int, input().split(\" \"))",
"map(int, input().split(\" \"))",
"H",
"ABs = [tuple(map(int, input().split(\" \"))) for _ in range(N)]",
"[tuple(map(int, input().split(\" \"))) for _ in range(N)]",
"ABs"
] | from collections import Counter
def solve(H, W, N, ABs):
total = (H - 2) * (W - 2)
points = {}
for a, b in ABs:
a -= 1
b -= 1
for i in [-1, 0, 1]:
for j in [-1, 0, 1]:
if 0 < a + i < H - 1 and 0 < b + j < W - 1:
d = (a + i, b + j)
if d not in points:
points[d] = 0
points[d] += 1
c = Counter([v for v in points.values()])
ans = [total - len(points)] + [c[f] if f in c else 0 for f in range(1, 10)]
return "\n".join([str(a) for a in ans])
if __name__ == "__main__":
H, W, N = map(int, input().split(" "))
ABs = [tuple(map(int, input().split(" "))) for _ in range(N)]
print(solve(H, W, N, ABs))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
2,
39,
17,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
41,
28,
13,
13,
13,
4,
2,
2,
2,
13,
2,
17,
17,
13,
17,
0,
13,
41,
28,
13,
4,
13,
17,
4,
4,
13,
0,
13,
13,
28,
13,
13,
13,
41,
28,
13,
2,
39,
17,
17,
4,
17,
0,
13,
13,
28,
13,
4,
13,
17,
0,
13,
2,
13,
17,
13,
2,
13,
17,
14,
2,
40,
2,
17,
2,
2,
13,
13,
17,
13,
40,
2,
17,
2,
2,
13,
13,
17,
13,
14,
2,
2,
2,
2,
2,
2,
2,
13,
13,
17,
2,
17,
17,
13,
13,
17,
13,
0,
18,
13,
2,
2,
13,
17,
13,
17,
0,
18,
13,
2,
2,
13,
17,
13,
17,
28,
13,
4,
13,
17,
0,
13,
2,
13,
17,
13,
2,
13,
17,
41,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
4,
18,
13,
2,
2,
2,
2,
13,
13,
17,
13,
13,
0,
13,
13,
14,
40,
17,
13,
4,
18,
18,
13,
2,
4,
13,
13,
17,
13,
2,
2,
2,
2,
2,
2,
13,
13,
17,
2,
17,
17,
13,
13,
17,
41,
28,
13,
4,
13,
17,
4,
4,
13,
18,
13,
13,
0,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
13,
13,
10,
2,
13,
10,
13,
13,
10,
4,
13,
10,
13,
10,
2,
13,
10,
13,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13
] | [
[
285,
2
],
[
285,
11
],
[
285,
12
],
[
16,
15
],
[
263,
19
],
[
270,
32
],
[
54,
53
],
[
253,
61
],
[
70,
69
],
[
282,
77
],
[
81,
80
],
[
267,
85
],
[
80,
87
],
[
256,
89
],
[
80,
91
],
[
268,
101
],
[
274,
101
],
[
286,
103
],
[
257,
110
],
[
277,
110
],
[
280,
112
],
[
268,
122
],
[
274,
122
],
[
257,
128
],
[
277,
128
],
[
265,
130
],
[
139,
132
],
[
283,
133
],
[
268,
136
],
[
274,
136
],
[
257,
138
],
[
277,
138
],
[
148,
141
],
[
283,
142
],
[
268,
145
],
[
274,
145
],
[
257,
147
],
[
277,
147
],
[
151,
150
],
[
273,
155
],
[
150,
157
],
[
276,
159
],
[
150,
161
],
[
166,
165
],
[
171,
170
],
[
283,
176
],
[
274,
181
],
[
268,
181
],
[
165,
182
],
[
277,
184
],
[
257,
184
],
[
170,
185
],
[
288,
187
],
[
289,
192
],
[
254,
196
],
[
289,
200
],
[
274,
210
],
[
268,
210
],
[
277,
216
],
[
257,
216
],
[
221,
220
],
[
254,
228
],
[
220,
229
],
[
259,
231
],
[
286,
238
],
[
280,
241
],
[
260,
245
],
[
254,
245
],
[
248,
247
],
[
260,
247
],
[
254,
247
],
[
247,
251
],
[
253,
254
],
[
256,
257
],
[
259,
260
],
[
285,
263
],
[
267,
268
],
[
270,
271
],
[
273,
274
],
[
276,
277
],
[
285,
280
],
[
282,
283
],
[
285,
286
],
[
288,
289
]
] | [
"h,w,n=map(int,input().split())\nab=[list(map(int,input().split())) for _ in [0]*n]\nab_d={a*(10**9)+b-1 for a,b in ab}\n\nans=[set() for _ in range(9)]\nfor a,b in ab:\n temp=[None for _ in [0]*25]\n for p in range(25):\n i,j=p//5,p%5\n if 0<a+i-2<=h and 0<b+j-2<=w:\n if (a+i-2)*(10**9)+b+j-3 in ab_d:\n temp[i*5+j]=1\n else:\n temp[i*5+j]=0\n for p in range(9):\n i,j=p//3,p%3\n cnt=[temp[(i+k)*5+j+l] for k in range(3) for l in range(3)]\n if None not in cnt:\n ans[sum(cnt)-1].add((a+i-2)*(10**9)+b+j-3)\n \nans=[len(ans[i]) for i in range(9)]\n\nprint((h-2)*(w-2)-sum(ans))\nfor i in ans:\n print(i)",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"list(map(int,input().split())) for _ in [0]*n",
"for _ in [0]*n",
"_",
"[0]*n",
"[0]",
"0",
"n",
"for _ in [0]*n",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ab=[list(map(int,input().split())) for _ in [0]*n]",
"ab",
"[list(map(int,input().split())) for _ in [0]*n]",
"a*(10**9)+b-1 for a,b in ab",
"for a,b in ab",
"a",
"b",
"ab",
"for a,b in ab",
"a*(10**9)+b-1",
"a*(10**9)+b",
"a*(10**9)",
"a",
"10**9",
"10",
"9",
"b",
"1",
"ab_d={a*(10**9)+b-1 for a,b in ab}",
"ab_d",
"set() for _ in range(9)",
"for _ in range(9)",
"_",
"range(9)",
"range",
"9",
"for _ in range(9)",
"set()",
"set",
"ans=[set() for _ in range(9)]",
"ans",
"[set() for _ in range(9)]",
"for a,b in ab:\n temp=[None for _ in [0]*25]\n for p in range(25):\n i,j=p//5,p%5\n if 0<a+i-2<=h and 0<b+j-2<=w:\n if (a+i-2)*(10**9)+b+j-3 in ab_d:\n temp[i*5+j]=1\n else:\n temp[i*5+j]=0\n for p in range(9):\n i,j=p//3,p%3\n cnt=[temp[(i+k)*5+j+l] for k in range(3) for l in range(3)]\n if None not in cnt:\n ans[sum(cnt)-1].add((a+i-2)*(10**9)+b+j-3)\n ",
"a",
"b",
"ab",
"None for _ in [0]*25",
"for _ in [0]*25",
"_",
"[0]*25",
"[0]",
"0",
"25",
"for _ in [0]*25",
"None",
"temp=[None for _ in [0]*25]",
"temp",
"[None for _ in [0]*25]",
"for p in range(25):\n i,j=p//5,p%5\n if 0<a+i-2<=h and 0<b+j-2<=w:\n if (a+i-2)*(10**9)+b+j-3 in ab_d:\n temp[i*5+j]=1\n else:\n temp[i*5+j]=0\n ",
"p",
"range(25)",
"range",
"25",
"i,j=p//5,p%5",
"i",
"p//5",
"p",
"5",
"j",
"p%5",
"p",
"5",
"if 0<a+i-2<=h and 0<b+j-2<=w:\n if (a+i-2)*(10**9)+b+j-3 in ab_d:\n temp[i*5+j]=1\n else:\n temp[i*5+j]=0\n ",
"0<a+i-2<=h and 0<b+j-2<=w",
"0<a+i-2<=h",
"0<a+i-2",
"0",
"a+i-2",
"a+i",
"a",
"i",
"2",
"h",
"0<b+j-2<=w",
"0<b+j-2",
"0",
"b+j-2",
"b+j",
"b",
"j",
"2",
"w",
"if (a+i-2)*(10**9)+b+j-3 in ab_d:\n temp[i*5+j]=1\n else:\n temp[i*5+j]=0\n ",
"(a+i-2)*(10**9)+b+j-3 in ab_d",
"(a+i-2)*(10**9)+b+j-3",
"(a+i-2)*(10**9)+b+j",
"(a+i-2)*(10**9)+b",
"(a+i-2)*(10**9)",
"a+i-2",
"a+i",
"a",
"i",
"2",
"10**9",
"10",
"9",
"b",
"j",
"3",
"ab_d",
"temp[i*5+j]=1",
"temp[i*5+j]",
"temp",
"i*5+j",
"i*5",
"i",
"5",
"j",
"1",
"temp[i*5+j]=0",
"temp[i*5+j]",
"temp",
"i*5+j",
"i*5",
"i",
"5",
"j",
"0",
"for p in range(9):\n i,j=p//3,p%3\n cnt=[temp[(i+k)*5+j+l] for k in range(3) for l in range(3)]\n if None not in cnt:\n ans[sum(cnt)-1].add((a+i-2)*(10**9)+b+j-3)\n ",
"p",
"range(9)",
"range",
"9",
"i,j=p//3,p%3",
"i",
"p//3",
"p",
"3",
"j",
"p%3",
"p",
"3",
"temp[(i+k)*5+j+l] for k in range(3) for l in range(3)",
"for k in range(3) for l in range(3)",
"k",
"range(3)",
"range",
"3",
"for l in range(3)",
"l",
"range(3)",
"range",
"3",
"for l in range(3)",
"temp[(i+k)*5+j+l]",
"temp",
"(i+k)*5+j+l",
"(i+k)*5+j",
"(i+k)*5",
"i+k",
"i",
"k",
"5",
"j",
"l",
"cnt=[temp[(i+k)*5+j+l] for k in range(3) for l in range(3)]",
"cnt",
"[temp[(i+k)*5+j+l] for k in range(3) for l in range(3)]",
"if None not in cnt:\n ans[sum(cnt)-1].add((a+i-2)*(10**9)+b+j-3)\n ",
"None not in cnt",
"None",
"cnt",
"ans[sum(cnt)-1].add((a+i-2)*(10**9)+b+j-3)",
"[sum(cnt)-1].add",
"[sum(cnt)-1]",
"ans",
"sum(cnt)-1",
"sum(cnt)",
"sum",
"cnt",
"1",
"add",
"(a+i-2)*(10**9)+b+j-3",
"(a+i-2)*(10**9)+b+j",
"(a+i-2)*(10**9)+b",
"(a+i-2)*(10**9)",
"a+i-2",
"a+i",
"a",
"i",
"2",
"10**9",
"10",
"9",
"b",
"j",
"3",
"len(ans[i]) for i in range(9)",
"for i in range(9)",
"i",
"range(9)",
"range",
"9",
"for i in range(9)",
"len(ans[i])",
"len",
"ans[i]",
"ans",
"i",
"ans=[len(ans[i]) for i in range(9)]",
"ans",
"[len(ans[i]) for i in range(9)]",
"print((h-2)*(w-2)-sum(ans))",
"print",
"(h-2)*(w-2)-sum(ans)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"ans=[set() for _ in range(9)]",
"[set() for _ in range(9)]",
"ans",
"j=p//5,p%5",
"p%5",
"j",
"ans=[len(ans[i]) for i in range(9)]",
"[len(ans[i]) for i in range(9)]",
"ans",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"ab_d={a*(10**9)+b-1 for a,b in ab}",
"ab_d",
"i,j=p//5,p%5",
"p//5",
"i",
"ab=[list(map(int,input().split())) for _ in [0]*n]",
"[list(map(int,input().split())) for _ in [0]*n]",
"ab",
"i,j=p//3,p%3",
"p//3",
"i",
"j=p//3,p%3",
"p%3",
"j",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"temp=[None for _ in [0]*25]",
"[None for _ in [0]*25]",
"temp",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"cnt=[temp[(i+k)*5+j+l] for k in range(3) for l in range(3)]",
"[temp[(i+k)*5+j+l] for k in range(3) for l in range(3)]",
"cnt"
] | h,w,n=map(int,input().split())
ab=[list(map(int,input().split())) for _ in [0]*n]
ab_d={a*(10**9)+b-1 for a,b in ab}
ans=[set() for _ in range(9)]
for a,b in ab:
temp=[None for _ in [0]*25]
for p in range(25):
i,j=p//5,p%5
if 0<a+i-2<=h and 0<b+j-2<=w:
if (a+i-2)*(10**9)+b+j-3 in ab_d:
temp[i*5+j]=1
else:
temp[i*5+j]=0
for p in range(9):
i,j=p//3,p%3
cnt=[temp[(i+k)*5+j+l] for k in range(3) for l in range(3)]
if None not in cnt:
ans[sum(cnt)-1].add((a+i-2)*(10**9)+b+j-3)
ans=[len(ans[i]) for i in range(9)]
print((h-2)*(w-2)-sum(ans))
for i in ans:
print(i) |
[
7,
0,
13,
39,
17,
17,
17,
17,
17,
17,
17,
17,
17,
0,
13,
39,
17,
17,
17,
17,
17,
17,
17,
17,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
15,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
0,
13,
2,
13,
18,
13,
13,
0,
13,
2,
13,
18,
13,
13,
0,
13,
17,
14,
40,
40,
17,
13,
2,
13,
17,
14,
40,
40,
17,
13,
2,
13,
17,
0,
13,
17,
14,
2,
13,
17,
0,
18,
13,
39,
13,
13,
17,
0,
13,
17,
0,
13,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
17,
0,
13,
18,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13,
10,
4,
13
] | [
[
169,
2
],
[
193,
14
],
[
178,
26
],
[
178,
35
],
[
178,
36
],
[
190,
39
],
[
45,
44
],
[
179,
47
],
[
199,
49
],
[
199,
58
],
[
61,
60
],
[
196,
65
],
[
182,
67
],
[
194,
69
],
[
60,
70
],
[
166,
72
],
[
200,
74
],
[
170,
76
],
[
60,
77
],
[
160,
79
],
[
197,
85
],
[
158,
87
],
[
167,
93
],
[
164,
95
],
[
184,
98
],
[
185,
102
],
[
161,
102
],
[
110,
105
],
[
191,
106
],
[
187,
112
],
[
172,
115
],
[
191,
120
],
[
124,
123
],
[
175,
129
],
[
173,
131
],
[
123,
132
],
[
137,
134
],
[
173,
135
],
[
158,
140
],
[
164,
143
],
[
176,
145
],
[
188,
145
],
[
148,
147
],
[
173,
154
],
[
147,
155
],
[
178,
158
],
[
160,
161
],
[
178,
164
],
[
166,
167
],
[
169,
170
],
[
172,
173
],
[
175,
176
],
[
178,
179
],
[
199,
182
],
[
184,
185
],
[
187,
188
],
[
190,
191
],
[
193,
194
],
[
196,
197
],
[
199,
200
]
] | [
"dx = [-1,-1,-1,0,0,1,1,1,0]\ndy = [-1,0,1,-1,1,-1,0,1,0]\nH,W,N = map(int,input().split())\nfrom collections import defaultdict, Counter\nd = defaultdict(int)\nfor i in range(N):\n a,b = map(int,input().split())\n for j in range(9):\n A = a + dy[j]\n B = b + dx[j]\n f = 0\n if 2 <= A <= H-1:\n if 2 <= B <= W-1:\n f = 1\n if f == 1:\n d[(A,B)] += 1\ns = 0\nc = Counter(d.values())\nfor i in range(1,10):\n s += c[i]\nc[0] = (H-2)*(W-2) - s\nfor i in range(10):\n print(c[i])",
"dx = [-1,-1,-1,0,0,1,1,1,0]",
"dx",
"[-1,-1,-1,0,0,1,1,1,0]",
"-1",
"-1",
"-1",
"0",
"0",
"1",
"1",
"1",
"0",
"dy = [-1,0,1,-1,1,-1,0,1,0]",
"dy",
"[-1,0,1,-1,1,-1,0,1,0]",
"-1",
"0",
"1",
"-1",
"1",
"-1",
"0",
"1",
"0",
"H,W,N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"from collections import defaultdict, Counter",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n a,b = map(int,input().split())\n for j in range(9):\n A = a + dy[j]\n B = b + dx[j]\n f = 0\n if 2 <= A <= H-1:\n if 2 <= B <= W-1:\n f = 1\n if f == 1:\n d[(A,B)] += 1",
"i",
"range(N)",
"range",
"N",
"a,b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for j in range(9):\n A = a + dy[j]\n B = b + dx[j]\n f = 0\n if 2 <= A <= H-1:\n if 2 <= B <= W-1:\n f = 1\n if f == 1:\n d[(A,B)] += 1",
"j",
"range(9)",
"range",
"9",
"A = a + dy[j]",
"A",
"a + dy[j]",
"a",
"dy[j]",
"dy",
"j",
"B = b + dx[j]",
"B",
"b + dx[j]",
"b",
"dx[j]",
"dx",
"j",
"f = 0",
"f",
"0",
"if 2 <= A <= H-1:\n if 2 <= B <= W-1:\n f = 1\n ",
"2 <= A <= H-1",
"2 <= A",
"2",
"A",
"H-1",
"H",
"1",
"if 2 <= B <= W-1:\n f = 1\n ",
"2 <= B <= W-1",
"2 <= B",
"2",
"B",
"W-1",
"W",
"1",
"f = 1",
"f",
"1",
"if f == 1:\n d[(A,B)] += 1",
"f == 1",
"f",
"1",
"d[(A,B)] += 1",
"d[(A,B)]",
"d",
"(A,B)",
"A",
"B",
"1",
"s = 0",
"s",
"0",
"c = Counter(d.values())",
"c",
"Counter(d.values())",
"Counter",
"d.values()",
"d.values",
"d",
"values",
"for i in range(1,10):\n s += c[i]",
"i",
"range(1,10)",
"range",
"1",
"10",
"s += c[i]",
"s",
"c[i]",
"c",
"i",
"c[0] = (H-2)*(W-2) - s",
"c[0]",
"c",
"0",
"(H-2)*(W-2) - s",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"s",
"for i in range(10):\n print(c[i])",
"i",
"range(10)",
"range",
"10",
"print(c[i])",
"print",
"c[i]",
"c",
"i",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"f = 0",
"0",
"f",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"B = b + dx[j]",
"b + dx[j]",
"B",
"dx = [-1,-1,-1,0,0,1,1,1,0]",
"[-1,-1,-1,0,0,1,1,1,0]",
"dx",
"c = Counter(d.values())",
"Counter(d.values())",
"c",
"s += c[i]",
"c[i]",
"s",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"f = 1",
"1",
"f",
"s = 0",
"0",
"s",
"d = defaultdict(int)",
"defaultdict(int)",
"d",
"dy = [-1,0,1,-1,1,-1,0,1,0]",
"[-1,0,1,-1,1,-1,0,1,0]",
"dy",
"A = a + dy[j]",
"a + dy[j]",
"A",
"b = map(int,input().split())",
"map(int,input().split())",
"b"
] | dx = [-1,-1,-1,0,0,1,1,1,0]
dy = [-1,0,1,-1,1,-1,0,1,0]
H,W,N = map(int,input().split())
from collections import defaultdict, Counter
d = defaultdict(int)
for i in range(N):
a,b = map(int,input().split())
for j in range(9):
A = a + dy[j]
B = b + dx[j]
f = 0
if 2 <= A <= H-1:
if 2 <= B <= W-1:
f = 1
if f == 1:
d[(A,B)] += 1
s = 0
c = Counter(d.values())
for i in range(1,10):
s += c[i]
c[0] = (H-2)*(W-2) - s
for i in range(10):
print(c[i]) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
2,
4,
13,
13,
17,
0,
13,
13,
13,
28,
13,
4,
13,
13,
2,
13,
17,
28,
13,
4,
13,
13,
2,
13,
17,
14,
2,
2,
2,
40,
17,
2,
13,
17,
2,
13,
13,
40,
17,
2,
13,
17,
2,
13,
13,
0,
18,
13,
2,
2,
2,
17,
17,
13,
13,
2,
4,
18,
13,
13,
2,
2,
2,
17,
17,
13,
13,
17,
17,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
28,
13,
13,
4,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13
] | [
[
153,
2
],
[
153,
11
],
[
153,
12
],
[
159,
14
],
[
18,
17
],
[
154,
20
],
[
24,
23
],
[
23,
33
],
[
156,
36
],
[
156,
38
],
[
41,
40
],
[
157,
43
],
[
157,
45
],
[
49,
48
],
[
151,
51
],
[
151,
53
],
[
40,
62
],
[
40,
65
],
[
145,
66
],
[
48,
70
],
[
48,
73
],
[
148,
74
],
[
85,
76
],
[
160,
77
],
[
40,
83
],
[
48,
84
],
[
160,
88
],
[
40,
95
],
[
48,
96
],
[
141,
100
],
[
107,
106
],
[
160,
109
],
[
115,
112
],
[
142,
113
],
[
106,
114
],
[
120,
117
],
[
142,
118
],
[
145,
123
],
[
148,
126
],
[
142,
131
],
[
136,
135
],
[
142,
135
],
[
135,
139
],
[
141,
142
],
[
153,
145
],
[
153,
148
],
[
156,
151
],
[
153,
154
],
[
156,
157
],
[
159,
160
]
] | [
"H,W,N = map(int,input().split())\ndic={}\nfor _ in range(N):\n a,b = [int(x)-1 for x in input().split()]\n for h in range(a,a+3):\n for w in range(b,b+3):\n if 0<=h-2 and h<H and 0<=w-2 and w<W:\n dic[10**10*h+w] = dic.get(10**10*h+w,0)+1\nans = [0]*10\nfor x in dic.values():\n ans[x] += 1\nans[0] = (H-2)*(W-2)-sum(ans[1:])\nfor x in ans:\n print(x)\n ",
"H,W,N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"dic={}",
"dic",
"{}",
"for _ in range(N):\n a,b = [int(x)-1 for x in input().split()]\n for h in range(a,a+3):\n for w in range(b,b+3):\n if 0<=h-2 and h<H and 0<=w-2 and w<W:\n dic[10**10*h+w] = dic.get(10**10*h+w,0)+1",
"_",
"range(N)",
"range",
"N",
"int(x)-1 for x in input().split()",
"for x in input().split()",
"x",
"input().split()",
"().split",
"()",
"input",
"split",
"for x in input().split()",
"int(x)-1",
"int(x)",
"int",
"x",
"1",
"a,b = [int(x)-1 for x in input().split()]",
"a",
"[int(x)-1 for x in input().split()]",
"b",
"for h in range(a,a+3):\n for w in range(b,b+3):\n if 0<=h-2 and h<H and 0<=w-2 and w<W:\n dic[10**10*h+w] = dic.get(10**10*h+w,0)+1",
"h",
"range(a,a+3)",
"range",
"a",
"a+3",
"a",
"3",
"for w in range(b,b+3):\n if 0<=h-2 and h<H and 0<=w-2 and w<W:\n dic[10**10*h+w] = dic.get(10**10*h+w,0)+1",
"w",
"range(b,b+3)",
"range",
"b",
"b+3",
"b",
"3",
"if 0<=h-2 and h<H and 0<=w-2 and w<W:\n dic[10**10*h+w] = dic.get(10**10*h+w,0)+1",
"0<=h-2 and h<H and 0<=w-2 and w<W",
"0<=h-2 and h<H and 0<=w-2",
"0<=h-2 and h<H",
"0<=h-2",
"0",
"h-2",
"h",
"2",
"h<H",
"h",
"H",
"0<=w-2",
"0",
"w-2",
"w",
"2",
"w<W",
"w",
"W",
"dic[10**10*h+w] = dic.get(10**10*h+w,0)+1",
"dic[10**10*h+w]",
"dic",
"10**10*h+w",
"10**10*h",
"10**10",
"10",
"10",
"h",
"w",
"dic.get(10**10*h+w,0)+1",
"dic.get(10**10*h+w,0)",
"dic.get",
"dic",
"get",
"10**10*h+w",
"10**10*h",
"10**10",
"10",
"10",
"h",
"w",
"0",
"1",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for x in dic.values():\n ans[x] += 1",
"x",
"dic.values()",
"dic.values",
"dic",
"values",
"ans[x] += 1",
"ans[x]",
"ans",
"x",
"1",
"ans[0] = (H-2)*(W-2)-sum(ans[1:])",
"ans[0]",
"ans",
"0",
"(H-2)*(W-2)-sum(ans[1:])",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"for x in ans:\n print(x)\n ",
"x",
"ans",
"print(x)",
"print",
"x",
"ans = [0]*10",
"[0]*10",
"ans",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"b = [int(x)-1 for x in input().split()]",
"[int(x)-1 for x in input().split()]",
"b",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"a,b = [int(x)-1 for x in input().split()]",
"[int(x)-1 for x in input().split()]",
"a",
"dic={}",
"{}",
"dic"
] | H,W,N = map(int,input().split())
dic={}
for _ in range(N):
a,b = [int(x)-1 for x in input().split()]
for h in range(a,a+3):
for w in range(b,b+3):
if 0<=h-2 and h<H and 0<=w-2 and w<W:
dic[10**10*h+w] = dic.get(10**10*h+w,0)+1
ans = [0]*10
for x in dic.values():
ans[x] += 1
ans[0] = (H-2)*(W-2)-sum(ans[1:])
for x in ans:
print(x)
|
[
7,
15,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
13,
4,
13,
39,
17,
17,
17,
0,
13,
17,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
13,
17,
0,
13,
4,
13,
4,
18,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] | [
[
137,
4
],
[
137,
13
],
[
137,
14
],
[
134,
16
],
[
22,
21
],
[
117,
24
],
[
131,
26
],
[
131,
35
],
[
47,
46
],
[
140,
49
],
[
129,
51
],
[
125,
54
],
[
132,
56
],
[
141,
63
],
[
138,
65
],
[
126,
70
],
[
123,
72
],
[
78,
75
],
[
135,
76
],
[
141,
77
],
[
119,
80
],
[
135,
85
],
[
91,
88
],
[
120,
89
],
[
138,
94
],
[
123,
97
],
[
120,
103
],
[
107,
106
],
[
120,
113
],
[
106,
114
],
[
137,
117
],
[
119,
120
],
[
137,
123
],
[
125,
126
],
[
131,
129
],
[
131,
132
],
[
134,
135
],
[
137,
138
],
[
140,
141
]
] | [
"from itertools import product\nfrom collections import defaultdict,Counter\n\nh,w,n = map(int,input().split())\n\ndic = defaultdict(int)\n\nfor _ in range(n):\n y,x= map(int,input().split())\n for i,j in product([-1,0,1],repeat=2):\n nx = x+i\n ny = y+j\n if 2 <= nx <= w-1 and 2 <= ny <= h-1:\n dic[nx,ny] += 1\n\nc = Counter(dic.values())\nc[0] = (w-2)*(h-2)-sum(c.values())\n\nfor i in range(10):\n print(c[i])",
"from itertools import product",
"from collections import defaultdict,Counter",
"h,w,n = map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"dic = defaultdict(int)",
"dic",
"defaultdict(int)",
"defaultdict",
"int",
"for _ in range(n):\n y,x= map(int,input().split())\n for i,j in product([-1,0,1],repeat=2):\n nx = x+i\n ny = y+j\n if 2 <= nx <= w-1 and 2 <= ny <= h-1:\n dic[nx,ny] += 1",
"_",
"range(n)",
"range",
"n",
"y,x= map(int,input().split())",
"y",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"x",
"for i,j in product([-1,0,1],repeat=2):\n nx = x+i\n ny = y+j\n if 2 <= nx <= w-1 and 2 <= ny <= h-1:\n dic[nx,ny] += 1",
"i",
"j",
"product([-1,0,1],repeat=2)",
"product",
"[-1,0,1]",
"-1",
"0",
"1",
"repeat=2",
"repeat",
"2",
"nx = x+i",
"nx",
"x+i",
"x",
"i",
"ny = y+j",
"ny",
"y+j",
"y",
"j",
"if 2 <= nx <= w-1 and 2 <= ny <= h-1:\n dic[nx,ny] += 1",
"2 <= nx <= w-1 and 2 <= ny <= h-1",
"2 <= nx <= w-1",
"2 <= nx",
"2",
"nx",
"w-1",
"w",
"1",
"2 <= ny <= h-1",
"2 <= ny",
"2",
"ny",
"h-1",
"h",
"1",
"dic[nx,ny] += 1",
"dic[nx,ny]",
"dic",
"nx",
"1",
"c = Counter(dic.values())",
"c",
"Counter(dic.values())",
"Counter",
"dic.values()",
"dic.values",
"dic",
"values",
"c[0] = (w-2)*(h-2)-sum(c.values())",
"c[0]",
"c",
"0",
"(w-2)*(h-2)-sum(c.values())",
"(w-2)*(h-2)",
"w-2",
"w",
"2",
"h-2",
"h",
"2",
"sum(c.values())",
"sum",
"c.values()",
"c.values",
"c",
"values",
"for i in range(10):\n print(c[i])",
"i",
"range(10)",
"range",
"10",
"print(c[i])",
"print",
"c[i]",
"c",
"i",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"c = Counter(dic.values())",
"Counter(dic.values())",
"c",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h",
"ny = y+j",
"y+j",
"ny",
"x= map(int,input().split())",
"map(int,input().split())",
"x",
"y,x= map(int,input().split())",
"map(int,input().split())",
"y",
"dic = defaultdict(int)",
"defaultdict(int)",
"dic",
"w,n = map(int,input().split())",
"map(int,input().split())",
"w",
"nx = x+i",
"x+i",
"nx"
] | from itertools import product
from collections import defaultdict,Counter
h,w,n = map(int,input().split())
dic = defaultdict(int)
for _ in range(n):
y,x= map(int,input().split())
for i,j in product([-1,0,1],repeat=2):
nx = x+i
ny = y+j
if 2 <= nx <= w-1 and 2 <= ny <= h-1:
dic[nx,ny] += 1
c = Counter(dic.values())
c[0] = (w-2)*(h-2)-sum(c.values())
for i in range(10):
print(c[i]) |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
2,
39,
2,
2,
13,
17,
2,
13,
17,
13,
28,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
40,
40,
17,
2,
13,
13,
2,
13,
17,
40,
40,
17,
2,
13,
13,
2,
13,
17,
0,
18,
13,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
18,
13,
2,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
28,
13,
13,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
2,
13
] | [
[
162,
3
],
[
162,
12
],
[
162,
13
],
[
17,
16
],
[
163,
19
],
[
165,
32
],
[
150,
35
],
[
42,
41
],
[
168,
48
],
[
157,
53
],
[
160,
56
],
[
147,
64
],
[
153,
67
],
[
71,
70
],
[
77,
76
],
[
148,
87
],
[
70,
88
],
[
157,
90
],
[
154,
96
],
[
76,
97
],
[
160,
99
],
[
113,
102
],
[
169,
103
],
[
151,
105
],
[
148,
108
],
[
70,
109
],
[
154,
111
],
[
76,
112
],
[
128,
115
],
[
169,
116
],
[
151,
119
],
[
148,
122
],
[
70,
123
],
[
154,
125
],
[
76,
126
],
[
139,
130
],
[
151,
131
],
[
148,
134
],
[
70,
135
],
[
154,
137
],
[
76,
138
],
[
142,
141
],
[
169,
141
],
[
141,
145
],
[
147,
148
],
[
150,
151
],
[
153,
154
],
[
162,
157
],
[
162,
160
],
[
162,
163
],
[
165,
166
],
[
168,
169
]
] | [
"from collections import defaultdict\n\nH,W,N = map(int,input().split())\nAB = [list(map(int,input().split())) for _ in range(N)]\n\nCells = defaultdict(int)\nCount = [(H-2)*(W-2)] + [0 for _ in range(9)]\n\nfor a,b in AB:\n a -= 1\n b -= 1\n for i in range(-1,2):\n for j in range(-1,2):\n if 1 <= a+i <= H-2 and 1 <= b+j <= W-2:\n Count[Cells[(a+i,b+j)]] -= 1\n Count[Cells[(a+i,b+j)]+1] += 1\n Cells[(a+i,b+j)] += 1\nfor c in Count:\n print(c)",
"from collections import defaultdict",
"H,W,N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"list(map(int,input().split())) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"AB = [list(map(int,input().split())) for _ in range(N)]",
"AB",
"[list(map(int,input().split())) for _ in range(N)]",
"Cells = defaultdict(int)",
"Cells",
"defaultdict(int)",
"defaultdict",
"int",
"0 for _ in range(9)",
"for _ in range(9)",
"_",
"range(9)",
"range",
"9",
"for _ in range(9)",
"0",
"Count = [(H-2)*(W-2)] + [0 for _ in range(9)]",
"Count",
"[(H-2)*(W-2)] + [0 for _ in range(9)]",
"[(H-2)*(W-2)]",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"[0 for _ in range(9)]",
"for a,b in AB:\n a -= 1\n b -= 1\n for i in range(-1,2):\n for j in range(-1,2):\n if 1 <= a+i <= H-2 and 1 <= b+j <= W-2:\n Count[Cells[(a+i,b+j)]] -= 1\n Count[Cells[(a+i,b+j)]+1] += 1\n Cells[(a+i,b+j)] += 1",
"a",
"b",
"AB",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for i in range(-1,2):\n for j in range(-1,2):\n if 1 <= a+i <= H-2 and 1 <= b+j <= W-2:\n Count[Cells[(a+i,b+j)]] -= 1\n Count[Cells[(a+i,b+j)]+1] += 1\n Cells[(a+i,b+j)] += 1",
"i",
"range(-1,2)",
"range",
"-1",
"2",
"for j in range(-1,2):\n if 1 <= a+i <= H-2 and 1 <= b+j <= W-2:\n Count[Cells[(a+i,b+j)]] -= 1\n Count[Cells[(a+i,b+j)]+1] += 1\n Cells[(a+i,b+j)] += 1",
"j",
"range(-1,2)",
"range",
"-1",
"2",
"if 1 <= a+i <= H-2 and 1 <= b+j <= W-2:\n Count[Cells[(a+i,b+j)]] -= 1\n Count[Cells[(a+i,b+j)]+1] += 1\n ",
"1 <= a+i <= H-2 and 1 <= b+j <= W-2",
"1 <= a+i <= H-2",
"1 <= a+i",
"1",
"a+i",
"a",
"i",
"H-2",
"H",
"2",
"1 <= b+j <= W-2",
"1 <= b+j",
"1",
"b+j",
"b",
"j",
"W-2",
"W",
"2",
"Count[Cells[(a+i,b+j)]] -= 1",
"Count[Cells[(a+i,b+j)]]",
"Count",
"Cells[(a+i,b+j)]",
"Cells",
"(a+i,b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"1",
"Count[Cells[(a+i,b+j)]+1] += 1",
"Count[Cells[(a+i,b+j)]+1]",
"Count",
"Cells[(a+i,b+j)]+1",
"Cells[(a+i,b+j)]",
"Cells",
"(a+i,b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"1",
"1",
"Cells[(a+i,b+j)] += 1",
"Cells[(a+i,b+j)]",
"Cells",
"(a+i,b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"1",
"for c in Count:\n print(c)",
"c",
"Count",
"print(c)",
"print",
"c",
"a -= 1",
"1",
"a",
"Cells = defaultdict(int)",
"defaultdict(int)",
"Cells",
"b -= 1",
"1",
"b",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"AB = [list(map(int,input().split())) for _ in range(N)]",
"[list(map(int,input().split())) for _ in range(N)]",
"AB",
"Count = [(H-2)*(W-2)] + [0 for _ in range(9)]",
"[(H-2)*(W-2)] + [0 for _ in range(9)]",
"Count"
] | 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) |
[
7,
15,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
0,
13,
2,
39,
17,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
39,
2,
13,
13,
2,
13,
13,
13,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
28,
13,
13,
4,
18,
13,
13,
14,
2,
2,
2,
17,
18,
13,
17,
2,
13,
17,
2,
2,
17,
18,
13,
17,
2,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
162,
5
],
[
168,
12
],
[
163,
19
],
[
168,
21
],
[
168,
22
],
[
174,
24
],
[
171,
28
],
[
35,
34
],
[
169,
37
],
[
180,
39
],
[
163,
46
],
[
180,
48
],
[
165,
50
],
[
159,
53
],
[
57,
56
],
[
63,
62
],
[
166,
71
],
[
181,
71
],
[
56,
72
],
[
160,
74
],
[
178,
74
],
[
62,
75
],
[
175,
76
],
[
87,
78
],
[
175,
79
],
[
166,
82
],
[
181,
82
],
[
56,
83
],
[
160,
85
],
[
178,
85
],
[
62,
86
],
[
98,
89
],
[
175,
90
],
[
166,
93
],
[
181,
93
],
[
56,
94
],
[
160,
96
],
[
178,
96
],
[
62,
97
],
[
175,
104
],
[
154,
115
],
[
157,
124
],
[
130,
127
],
[
172,
128
],
[
135,
132
],
[
172,
133
],
[
154,
138
],
[
157,
141
],
[
172,
145
],
[
148,
147
],
[
172,
147
],
[
147,
151
],
[
168,
154
],
[
168,
157
],
[
159,
160
],
[
162,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
180,
178
],
[
180,
181
]
] | [
"from collections import defaultdict\nimport sys\n\ninput = sys.stdin.readline\n\nh,w,n = map(int,input().split())\nd = defaultdict()\nans = [0]*10\n\nfor k in range(n):\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n for i in range(-1,2):\n for j in range(-1,2):\n if (a+i,b+j) in d:\n d[(a+i,b+j)] += 1\n else:\n d[(a+i,b+j)] = 1\n\nfor k,v in d.items():\n if 0 < k[0] < h-1 and 0 < k[1] < w-1:\n ans[v] += 1\n\nans[0] = (h-2) * (w-2) - sum(ans)\n\nfor i in ans:\n print(i)",
"from collections import defaultdict",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"h,w,n = map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"d = defaultdict()",
"d",
"defaultdict()",
"defaultdict",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for k in range(n):\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n for i in range(-1,2):\n for j in range(-1,2):\n if (a+i,b+j) in d:\n d[(a+i,b+j)] += 1\n else:\n d[(a+i,b+j)] = 1",
"k",
"range(n)",
"range",
"n",
"a,b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for i in range(-1,2):\n for j in range(-1,2):\n if (a+i,b+j) in d:\n d[(a+i,b+j)] += 1\n else:\n d[(a+i,b+j)] = 1",
"i",
"range(-1,2)",
"range",
"-1",
"2",
"for j in range(-1,2):\n if (a+i,b+j) in d:\n d[(a+i,b+j)] += 1\n else:\n d[(a+i,b+j)] = 1",
"j",
"range(-1,2)",
"range",
"-1",
"2",
"if (a+i,b+j) in d:\n d[(a+i,b+j)] += 1\n else:\n d[(a+i,b+j)] = 1",
"(a+i,b+j) in d",
"(a+i,b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"d",
"d[(a+i,b+j)] += 1",
"d[(a+i,b+j)]",
"d",
"(a+i,b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"1",
"d[(a+i,b+j)] = 1",
"d[(a+i,b+j)]",
"d",
"(a+i,b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"1",
"for k,v in d.items():\n if 0 < k[0] < h-1 and 0 < k[1] < w-1:\n ans[v] += 1",
"k",
"v",
"d.items()",
"d.items",
"d",
"items",
"if 0 < k[0] < h-1 and 0 < k[1] < w-1:\n ans[v] += 1",
"0 < k[0] < h-1 and 0 < k[1] < w-1",
"0 < k[0] < h-1",
"0 < k[0]",
"0",
"k[0]",
"k",
"0",
"h-1",
"h",
"1",
"0 < k[1] < w-1",
"0 < k[1]",
"0",
"k[1]",
"k",
"1",
"w-1",
"w",
"1",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"ans[0] = (h-2) * (w-2) - sum(ans)",
"ans[0]",
"ans",
"0",
"(h-2) * (w-2) - sum(ans)",
"(h-2) * (w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h",
"w,n = map(int,input().split())",
"map(int,input().split())",
"w",
"b -= 1",
"1",
"b",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"a -= 1",
"1",
"a",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"ans = [0]*10",
"[0]*10",
"ans",
"d = defaultdict()",
"defaultdict()",
"d",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a"
] | from collections import defaultdict
import sys
input = sys.stdin.readline
h,w,n = map(int,input().split())
d = defaultdict()
ans = [0]*10
for k in range(n):
a,b = map(int,input().split())
a -= 1
b -= 1
for i in range(-1,2):
for j in range(-1,2):
if (a+i,b+j) in d:
d[(a+i,b+j)] += 1
else:
d[(a+i,b+j)] = 1
for k,v in d.items():
if 0 < k[0] < h-1 and 0 < k[1] < w-1:
ans[v] += 1
ans[0] = (h-2) * (w-2) - sum(ans)
for i in ans:
print(i)
|
[
7,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
13,
2,
13,
17,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
13,
2,
13,
17,
0,
18,
13,
39,
13,
13,
2,
4,
18,
13,
13,
39,
13,
13,
17,
17,
0,
13,
4,
13,
4,
18,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
4,
13,
17,
17,
4,
13,
4,
18,
13,
13,
13,
4,
13,
10,
12,
13
] | [
[
5,
4
],
[
5,
13
],
[
5,
14
],
[
17,
16
],
[
20,
19
],
[
14,
22
],
[
25,
24
],
[
25,
33
],
[
36,
35
],
[
24,
42
],
[
4,
46
],
[
24,
48
],
[
52,
51
],
[
33,
58
],
[
13,
62
],
[
33,
64
],
[
72,
67
],
[
16,
68
],
[
16,
75
],
[
84,
83
],
[
16,
88
],
[
4,
95
],
[
13,
98
],
[
16,
102
],
[
105,
104
],
[
83,
113
],
[
104,
115
],
[
120,
117
]
] | [
"def main():\n H, W, N = map(int, input().split())\n C = {}\n for _ in range(N):\n a, b = map(int, input().split())\n for x in range(max(2, a - 1), min(H, a + 2)):\n for y in range(max(2, b - 1), min(W, b + 2)):\n C[(x, y)] = C.get((x, y), 0) + 1\n D = list(C.values())\n print((H - 2) * (W - 2) - len(C))\n for j in range(1, 10):\n print(D.count(j))\n\nmain()",
"def main():\n H, W, N = map(int, input().split())\n C = {}\n for _ in range(N):\n a, b = map(int, input().split())\n for x in range(max(2, a - 1), min(H, a + 2)):\n for y in range(max(2, b - 1), min(W, b + 2)):\n C[(x, y)] = C.get((x, y), 0) + 1\n D = list(C.values())\n print((H - 2) * (W - 2) - len(C))\n for j in range(1, 10):\n print(D.count(j))",
"main",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"C = {}",
"C",
"{}",
"for _ in range(N):\n a, b = map(int, input().split())\n for x in range(max(2, a - 1), min(H, a + 2)):\n for y in range(max(2, b - 1), min(W, b + 2)):\n C[(x, y)] = C.get((x, y), 0) + 1\n ",
"_",
"range(N)",
"range",
"N",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for x in range(max(2, a - 1), min(H, a + 2)):\n for y in range(max(2, b - 1), min(W, b + 2)):\n C[(x, y)] = C.get((x, y), 0) + 1\n ",
"x",
"range(max(2, a - 1), min(H, a + 2))",
"range",
"max(2, a - 1)",
"max",
"2",
"a - 1",
"a",
"1",
"min(H, a + 2)",
"min",
"H",
"a + 2",
"a",
"2",
"for y in range(max(2, b - 1), min(W, b + 2)):\n C[(x, y)] = C.get((x, y), 0) + 1\n ",
"y",
"range(max(2, b - 1), min(W, b + 2))",
"range",
"max(2, b - 1)",
"max",
"2",
"b - 1",
"b",
"1",
"min(W, b + 2)",
"min",
"W",
"b + 2",
"b",
"2",
"C[(x, y)] = C.get((x, y), 0) + 1",
"C[(x, y)]",
"C",
"(x, y)",
"x",
"y",
"C.get((x, y), 0) + 1",
"C.get((x, y), 0)",
"C.get",
"C",
"get",
"(x, y)",
"x",
"y",
"0",
"1",
"D = list(C.values())",
"D",
"list(C.values())",
"list",
"C.values()",
"C.values",
"C",
"values",
"print((H - 2) * (W - 2) - len(C))",
"print",
"(H - 2) * (W - 2) - len(C)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"len(C)",
"len",
"C",
"for j in range(1, 10):\n print(D.count(j))",
"j",
"range(1, 10)",
"range",
"1",
"10",
"print(D.count(j))",
"print",
"D.count(j)",
"D.count",
"D",
"count",
"j",
"main()",
"main",
"def main():\n H, W, N = map(int, input().split())\n C = {}\n for _ in range(N):\n a, b = map(int, input().split())\n for x in range(max(2, a - 1), min(H, a + 2)):\n for y in range(max(2, b - 1), min(W, b + 2)):\n C[(x, y)] = C.get((x, y), 0) + 1\n D = list(C.values())\n print((H - 2) * (W - 2) - len(C))\n for j in range(1, 10):\n print(D.count(j))",
"def main():\n H, W, N = map(int, input().split())\n C = {}\n for _ in range(N):\n a, b = map(int, input().split())\n for x in range(max(2, a - 1), min(H, a + 2)):\n for y in range(max(2, b - 1), min(W, b + 2)):\n C[(x, y)] = C.get((x, y), 0) + 1\n D = list(C.values())\n print((H - 2) * (W - 2) - len(C))\n for j in range(1, 10):\n print(D.count(j))",
"main"
] | def main():
H, W, N = map(int, input().split())
C = {}
for _ in range(N):
a, b = map(int, input().split())
for x in range(max(2, a - 1), min(H, a + 2)):
for y in range(max(2, b - 1), min(W, b + 2)):
C[(x, y)] = C.get((x, y), 0) + 1
D = list(C.values())
print((H - 2) * (W - 2) - len(C))
for j in range(1, 10):
print(D.count(j))
main()
|
[
7,
15,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
17,
0,
13,
2,
2,
17,
17,
17,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
4,
13,
4,
13,
4,
13,
12,
2,
4,
13,
13,
17,
23,
4,
18,
4,
13,
13,
0,
13,
39,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
0,
13,
4,
13,
0,
13,
2,
39,
17,
17,
28,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
13,
0,
13,
2,
13,
13,
13,
2,
13,
13,
14,
2,
2,
2,
2,
13,
17,
40,
13,
13,
2,
13,
17,
40,
13,
13,
0,
13,
17,
14,
2,
39,
13,
13,
13,
0,
13,
17,
14,
40,
39,
13,
13,
13,
4,
18,
13,
13,
39,
13,
13,
14,
13,
0,
18,
13,
13,
17,
28,
13,
13,
13,
0,
13,
17,
28,
13,
13,
13,
0,
13,
2,
13,
13,
13,
2,
13,
13,
14,
2,
2,
2,
2,
13,
17,
40,
13,
13,
2,
13,
17,
40,
13,
13,
3,
14,
2,
39,
13,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
18,
13,
17,
2,
13,
4,
13,
13,
4,
13,
31,
13,
0,
13,
17,
14,
2,
13,
17,
4,
13,
10,
18,
13,
10,
2,
13,
10,
12,
13,
10,
4,
13
] | [
[
259,
11
],
[
268,
18
],
[
262,
23
],
[
33,
32
],
[
260,
39
],
[
33,
41
],
[
33,
42
],
[
45,
44
],
[
260,
63
],
[
67,
66
],
[
97,
96
],
[
101,
100
],
[
111,
110
],
[
114,
113
],
[
121,
120
],
[
125,
124
],
[
120,
133
],
[
120,
136
],
[
32,
137
],
[
124,
139
],
[
124,
142
],
[
41,
143
],
[
146,
145
],
[
44,
152
],
[
155,
154
],
[
44,
161
],
[
96,
164
],
[
175,
172
],
[
100,
173
],
[
154,
174
],
[
110,
174
],
[
182,
181
],
[
189,
188
],
[
193,
192
],
[
188,
201
],
[
120,
201
],
[
188,
204
],
[
120,
204
],
[
32,
205
],
[
192,
207
],
[
124,
207
],
[
192,
210
],
[
124,
210
],
[
41,
211
],
[
44,
218
],
[
221,
220
],
[
226,
223
],
[
100,
224
],
[
220,
225
],
[
181,
225
],
[
154,
225
],
[
110,
225
],
[
229,
228
],
[
32,
231
],
[
41,
234
],
[
240,
237
],
[
100,
238
],
[
228,
241
],
[
100,
244
],
[
100,
248
],
[
251,
250
],
[
266,
257
],
[
259,
260
],
[
262,
263
],
[
268,
269
]
] | [
"import sys\n\nsys.setrecursionlimit(10 ** 7)\ninput = sys.stdin.readline\nf_inf = float('inf')\nmod = 10 ** 9 + 7\n\n\ndef resolve():\n H, W, n = map(int, input().split())\n AB = set(tuple(tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(n)))\n\n d = ((1, 1), (1, 0), (1, -1), (0, 1), (0, 0), (0, -1), (-1, 1), (-1, 0), (-1, -1))\n target = set()\n res = [0] * 10\n for h, w in AB:\n cnt = 0\n flg = True\n for dh, dw in d:\n next_h, next_w = h + dh, w + dw\n if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:\n flg = False\n if (next_h, next_w) in AB:\n cnt += 1\n else:\n if (next_h, next_w) not in AB:\n target.add((next_h, next_w))\n if flg:\n res[cnt] += 1\n\n for h, w in target:\n cnt = 0\n for dh, dw in d:\n next_h, next_w = h + dh, w + dw\n if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:\n break\n if (next_h, next_w) in AB:\n cnt += 1\n else:\n res[cnt] += 1\n\n total = (H - 2) * (W - 2)\n res[0] = total - sum(res)\n print(*res, sep=\"\\n\")\n\n\nif __name__ == '__main__':\n resolve()",
"import sys",
"sys",
"sys.setrecursionlimit(10 ** 7)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 7",
"10",
"7",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"f_inf = float('inf')",
"f_inf",
"float('inf')",
"float",
"'inf'",
"mod = 10 ** 9 + 7",
"mod",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"def resolve():\n H, W, n = map(int, input().split())\n AB = set(tuple(tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(n)))\n\n d = ((1, 1), (1, 0), (1, -1), (0, 1), (0, 0), (0, -1), (-1, 1), (-1, 0), (-1, -1))\n target = set()\n res = [0] * 10\n for h, w in AB:\n cnt = 0\n flg = True\n for dh, dw in d:\n next_h, next_w = h + dh, w + dw\n if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:\n flg = False\n if (next_h, next_w) in AB:\n cnt += 1\n else:\n if (next_h, next_w) not in AB:\n target.add((next_h, next_w))\n if flg:\n res[cnt] += 1\n\n for h, w in target:\n cnt = 0\n for dh, dw in d:\n next_h, next_w = h + dh, w + dw\n if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:\n break\n if (next_h, next_w) in AB:\n cnt += 1\n else:\n res[cnt] += 1\n\n total = (H - 2) * (W - 2)\n res[0] = total - sum(res)\n print(*res, sep=\"\\n\")",
"resolve",
"H, W, n = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"n",
"AB = set(tuple(tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(n)))",
"AB",
"set(tuple(tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(n)))",
"set",
"tuple(tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(n))",
"tuple",
"tuple(map(lambda x: int(x) - 1, input().split()))",
"tuple",
"map(lambda x: int(x) - 1, input().split())",
"map",
"lambda x: int(x) - 1",
"int(x) - 1",
"int(x)",
"int",
"x",
"1",
"x",
"input().split()",
"().split",
"()",
"input",
"split",
"d = ((1, 1), (1, 0), (1, -1), (0, 1), (0, 0), (0, -1), (-1, 1), (-1, 0), (-1, -1))",
"d",
"((1, 1), (1, 0), (1, -1), (0, 1), (0, 0), (0, -1), (-1, 1), (-1, 0), (-1, -1))",
"(1, 1)",
"1",
"1",
"(1, 0)",
"1",
"0",
"(1, -1)",
"1",
"-1",
"(0, 1)",
"0",
"1",
"(0, 0)",
"0",
"0",
"(0, -1)",
"0",
"-1",
"(-1, 1)",
"-1",
"1",
"(-1, 0)",
"-1",
"0",
"(-1, -1)",
"-1",
"-1",
"target = set()",
"target",
"set()",
"set",
"res = [0] * 10",
"res",
"[0] * 10",
"[0]",
"0",
"10",
"for h, w in AB:\n cnt = 0\n flg = True\n for dh, dw in d:\n next_h, next_w = h + dh, w + dw\n if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:\n flg = False\n if (next_h, next_w) in AB:\n cnt += 1\n else:\n if (next_h, next_w) not in AB:\n target.add((next_h, next_w))\n if flg:\n res[cnt] += 1\n\n ",
"h",
"w",
"AB",
"cnt = 0",
"cnt",
"0",
"flg = True",
"flg",
"True",
"for dh, dw in d:\n next_h, next_w = h + dh, w + dw\n if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:\n flg = False\n if (next_h, next_w) in AB:\n cnt += 1\n else:\n if (next_h, next_w) not in AB:\n target.add((next_h, next_w))\n ",
"dh",
"dw",
"d",
"next_h, next_w = h + dh, w + dw",
"next_h",
"h + dh",
"h",
"dh",
"next_w",
"w + dw",
"w",
"dw",
"if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:\n flg = False\n ",
"next_h < 0 or next_h >= H or next_w < 0 or next_w >= W",
"next_h < 0 or next_h >= H or next_w < 0",
"next_h < 0 or next_h >= H",
"next_h < 0",
"next_h",
"0",
"next_h >= H",
"next_h",
"H",
"next_w < 0",
"next_w",
"0",
"next_w >= W",
"next_w",
"W",
"flg = False",
"flg",
"False",
"if (next_h, next_w) in AB:\n cnt += 1\n else:\n if (next_h, next_w) not in AB:\n target.add((next_h, next_w))\n ",
"(next_h, next_w) in AB",
"(next_h, next_w)",
"next_h",
"next_w",
"AB",
"cnt += 1",
"cnt",
"1",
"if (next_h, next_w) not in AB:\n target.add((next_h, next_w))\n ",
"(next_h, next_w) not in AB",
"(next_h, next_w)",
"next_h",
"next_w",
"AB",
"target.add((next_h, next_w))",
"target.add",
"target",
"add",
"(next_h, next_w)",
"next_h",
"next_w",
"if flg:\n res[cnt] += 1\n\n ",
"flg",
"res[cnt] += 1",
"res[cnt]",
"res",
"cnt",
"1",
"for h, w in target:\n cnt = 0\n for dh, dw in d:\n next_h, next_w = h + dh, w + dw\n if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:\n break\n if (next_h, next_w) in AB:\n cnt += 1\n else:\n res[cnt] += 1\n\n ",
"h",
"w",
"target",
"cnt = 0",
"cnt",
"0",
"for dh, dw in d:\n next_h, next_w = h + dh, w + dw\n if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:\n break\n if (next_h, next_w) in AB:\n cnt += 1\n else:\n res[cnt] += 1\n\n ",
"dh",
"dw",
"d",
"next_h, next_w = h + dh, w + dw",
"next_h",
"h + dh",
"h",
"dh",
"next_w",
"w + dw",
"w",
"dw",
"if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:\n break\n ",
"next_h < 0 or next_h >= H or next_w < 0 or next_w >= W",
"next_h < 0 or next_h >= H or next_w < 0",
"next_h < 0 or next_h >= H",
"next_h < 0",
"next_h",
"0",
"next_h >= H",
"next_h",
"H",
"next_w < 0",
"next_w",
"0",
"next_w >= W",
"next_w",
"W",
"break",
"if (next_h, next_w) in AB:\n cnt += 1\n ",
"(next_h, next_w) in AB",
"(next_h, next_w)",
"next_h",
"next_w",
"AB",
"cnt += 1",
"cnt",
"1",
"res[cnt] += 1",
"res[cnt]",
"res",
"cnt",
"1",
"total = (H - 2) * (W - 2)",
"total",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"res[0] = total - sum(res)",
"res[0]",
"res",
"0",
"total - sum(res)",
"total",
"sum(res)",
"sum",
"res",
"print(*res, sep=\"\\n\")",
"print",
"*res",
"res",
"sep=\"\\n\"",
"sep",
"\"\\n\"",
"if __name__ == '__main__':\n resolve()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"resolve()",
"resolve",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"mod = 10 ** 9 + 7",
"10 ** 9 + 7",
"mod",
"def resolve():\n H, W, n = map(int, input().split())\n AB = set(tuple(tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(n)))\n\n d = ((1, 1), (1, 0), (1, -1), (0, 1), (0, 0), (0, -1), (-1, 1), (-1, 0), (-1, -1))\n target = set()\n res = [0] * 10\n for h, w in AB:\n cnt = 0\n flg = True\n for dh, dw in d:\n next_h, next_w = h + dh, w + dw\n if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:\n flg = False\n if (next_h, next_w) in AB:\n cnt += 1\n else:\n if (next_h, next_w) not in AB:\n target.add((next_h, next_w))\n if flg:\n res[cnt] += 1\n\n for h, w in target:\n cnt = 0\n for dh, dw in d:\n next_h, next_w = h + dh, w + dw\n if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:\n break\n if (next_h, next_w) in AB:\n cnt += 1\n else:\n res[cnt] += 1\n\n total = (H - 2) * (W - 2)\n res[0] = total - sum(res)\n print(*res, sep=\"\\n\")",
"def resolve():\n H, W, n = map(int, input().split())\n AB = set(tuple(tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(n)))\n\n d = ((1, 1), (1, 0), (1, -1), (0, 1), (0, 0), (0, -1), (-1, 1), (-1, 0), (-1, -1))\n target = set()\n res = [0] * 10\n for h, w in AB:\n cnt = 0\n flg = True\n for dh, dw in d:\n next_h, next_w = h + dh, w + dw\n if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:\n flg = False\n if (next_h, next_w) in AB:\n cnt += 1\n else:\n if (next_h, next_w) not in AB:\n target.add((next_h, next_w))\n if flg:\n res[cnt] += 1\n\n for h, w in target:\n cnt = 0\n for dh, dw in d:\n next_h, next_w = h + dh, w + dw\n if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:\n break\n if (next_h, next_w) in AB:\n cnt += 1\n else:\n res[cnt] += 1\n\n total = (H - 2) * (W - 2)\n res[0] = total - sum(res)\n print(*res, sep=\"\\n\")",
"resolve",
"f_inf = float('inf')",
"float('inf')",
"f_inf"
] | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
H, W, n = map(int, input().split())
AB = set(tuple(tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(n)))
d = ((1, 1), (1, 0), (1, -1), (0, 1), (0, 0), (0, -1), (-1, 1), (-1, 0), (-1, -1))
target = set()
res = [0] * 10
for h, w in AB:
cnt = 0
flg = True
for dh, dw in d:
next_h, next_w = h + dh, w + dw
if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:
flg = False
if (next_h, next_w) in AB:
cnt += 1
else:
if (next_h, next_w) not in AB:
target.add((next_h, next_w))
if flg:
res[cnt] += 1
for h, w in target:
cnt = 0
for dh, dw in d:
next_h, next_w = h + dh, w + dw
if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:
break
if (next_h, next_w) in AB:
cnt += 1
else:
res[cnt] += 1
total = (H - 2) * (W - 2)
res[0] = total - sum(res)
print(*res, sep="\n")
if __name__ == '__main__':
resolve()
|
[
7,
15,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
39,
17,
17,
17,
0,
13,
17,
0,
13,
4,
13,
0,
13,
4,
13,
28,
13,
13,
13,
28,
13,
13,
13,
14,
2,
40,
40,
17,
2,
13,
13,
2,
13,
17,
40,
40,
17,
2,
13,
13,
2,
13,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
4,
13,
31,
13,
0,
13,
17,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
158,
4
],
[
158,
13
],
[
158,
14
],
[
18,
17
],
[
144,
20
],
[
155,
33
],
[
149,
38
],
[
49,
48
],
[
152,
51
],
[
146,
55
],
[
138,
75
],
[
159,
84
],
[
96,
87
],
[
147,
88
],
[
140,
98
],
[
105,
104
],
[
147,
107
],
[
113,
110
],
[
141,
111
],
[
104,
112
],
[
118,
115
],
[
141,
116
],
[
138,
121
],
[
159,
124
],
[
141,
128
],
[
141,
132
],
[
135,
134
],
[
158,
138
],
[
140,
141
],
[
158,
144
],
[
146,
147
],
[
149,
150
],
[
152,
153
],
[
155,
156
],
[
158,
159
]
] | [
"from itertools import product\nfrom collections import Counter\n\nH, W, N = map(int, input().split())\nV = set([tuple(map(int, input().split())) for _ in range(N)])\nD = tuple(product((-1, 0, 1), repeat=2))\n\nA = set()\ncnt = Counter()\nfor a, b in V:\n for h, w in D:\n if 2 <= a + h <= H - 1 and 2 <= b + w <= W - 1:\n cnt[(a + h, b + w)] += 1\n\nans = [0] * 10\nfor c in cnt.values():\n ans[c] += 1\n\nans[0] = (H - 2) * (W - 2) - sum(ans)\nprint(*ans, sep='\\n')",
"from itertools import product",
"from collections import Counter",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"tuple(map(int, input().split())) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"tuple(map(int, input().split()))",
"tuple",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"V = set([tuple(map(int, input().split())) for _ in range(N)])",
"V",
"set([tuple(map(int, input().split())) for _ in range(N)])",
"set",
"[tuple(map(int, input().split())) for _ in range(N)]",
"D = tuple(product((-1, 0, 1), repeat=2))",
"D",
"tuple(product((-1, 0, 1), repeat=2))",
"tuple",
"product((-1, 0, 1), repeat=2)",
"product",
"(-1, 0, 1)",
"-1",
"0",
"1",
"repeat=2",
"repeat",
"2",
"A = set()",
"A",
"set()",
"set",
"cnt = Counter()",
"cnt",
"Counter()",
"Counter",
"for a, b in V:\n for h, w in D:\n if 2 <= a + h <= H - 1 and 2 <= b + w <= W - 1:\n cnt[(a + h, b + w)] += 1",
"a",
"b",
"V",
"for h, w in D:\n if 2 <= a + h <= H - 1 and 2 <= b + w <= W - 1:\n cnt[(a + h, b + w)] += 1",
"h",
"w",
"D",
"if 2 <= a + h <= H - 1 and 2 <= b + w <= W - 1:\n cnt[(a + h, b + w)] += 1",
"2 <= a + h <= H - 1 and 2 <= b + w <= W - 1",
"2 <= a + h <= H - 1",
"2 <= a + h",
"2",
"a + h",
"a",
"h",
"H - 1",
"H",
"1",
"2 <= b + w <= W - 1",
"2 <= b + w",
"2",
"b + w",
"b",
"w",
"W - 1",
"W",
"1",
"cnt[(a + h, b + w)] += 1",
"cnt[(a + h, b + w)]",
"cnt",
"(a + h, b + w)",
"a + h",
"a",
"h",
"b + w",
"b",
"w",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for c in cnt.values():\n ans[c] += 1",
"c",
"cnt.values()",
"cnt.values",
"cnt",
"values",
"ans[c] += 1",
"ans[c]",
"ans",
"c",
"1",
"ans[0] = (H - 2) * (W - 2) - sum(ans)",
"ans[0]",
"ans",
"0",
"(H - 2) * (W - 2) - sum(ans)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(ans)",
"sum",
"ans",
"print(*ans, sep='\\n')",
"print",
"*ans",
"ans",
"sep='\\n'",
"sep",
"'\\n'",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"ans = [0] * 10",
"[0] * 10",
"ans",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"cnt = Counter()",
"Counter()",
"cnt",
"D = tuple(product((-1, 0, 1), repeat=2))",
"tuple(product((-1, 0, 1), repeat=2))",
"D",
"A = set()",
"set()",
"A",
"V = set([tuple(map(int, input().split())) for _ in range(N)])",
"set([tuple(map(int, input().split())) for _ in range(N)])",
"V",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W"
] | from itertools import product
from collections import Counter
H, W, N = map(int, input().split())
V = set([tuple(map(int, input().split())) for _ in range(N)])
D = tuple(product((-1, 0, 1), repeat=2))
A = set()
cnt = Counter()
for a, b in V:
for h, w in D:
if 2 <= a + h <= H - 1 and 2 <= b + w <= W - 1:
cnt[(a + h, b + w)] += 1
ans = [0] * 10
for c in cnt.values():
ans[c] += 1
ans[0] = (H - 2) * (W - 2) - sum(ans)
print(*ans, sep='\n')
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
39,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
4,
18,
13,
13,
39,
13,
13,
41,
28,
13,
4,
13,
17,
4,
2,
39,
17,
17,
0,
13,
13,
0,
13,
2,
39,
17,
17,
28,
13,
13,
0,
13,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
0,
13,
2,
13,
13,
13,
2,
13,
13,
14,
2,
40,
40,
17,
13,
13,
40,
40,
17,
13,
13,
14,
2,
39,
13,
13,
13,
0,
18,
18,
13,
2,
13,
17,
2,
13,
17,
17,
0,
18,
18,
13,
2,
13,
17,
2,
13,
17,
17,
0,
18,
18,
13,
2,
13,
17,
2,
13,
17,
17,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
0,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
0,
13,
18,
18,
13,
2,
2,
13,
17,
13,
2,
2,
13,
17,
13,
14,
40,
13,
17,
0,
18,
13,
13,
17,
28,
13,
18,
4,
13,
17,
17,
39,
17,
0,
18,
13,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
13,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
13,
13,
10,
2,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13
] | [
[
273,
2
],
[
273,
11
],
[
273,
12
],
[
240,
14
],
[
264,
21
],
[
279,
24
],
[
29,
28
],
[
247,
31
],
[
261,
33
],
[
261,
42
],
[
280,
45
],
[
53,
52
],
[
267,
62
],
[
249,
65
],
[
72,
71
],
[
280,
71
],
[
276,
74
],
[
71,
75
],
[
276,
76
],
[
79,
78
],
[
85,
84
],
[
237,
90
],
[
277,
92
],
[
262,
92
],
[
78,
93
],
[
270,
94
],
[
235,
96
],
[
244,
96
],
[
84,
97
],
[
238,
103
],
[
274,
104
],
[
271,
108
],
[
256,
109
],
[
280,
115
],
[
126,
117
],
[
268,
119
],
[
78,
121
],
[
84,
124
],
[
137,
128
],
[
268,
130
],
[
78,
132
],
[
84,
135
],
[
148,
139
],
[
268,
141
],
[
78,
143
],
[
84,
146
],
[
151,
150
],
[
157,
156
],
[
258,
162
],
[
166,
165
],
[
171,
170
],
[
252,
175
],
[
268,
178
],
[
150,
181
],
[
165,
183
],
[
156,
186
],
[
170,
188
],
[
253,
191
],
[
259,
191
],
[
197,
194
],
[
250,
195
],
[
253,
196
],
[
259,
196
],
[
200,
199
],
[
211,
208
],
[
250,
209
],
[
199,
210
],
[
199,
211
],
[
216,
213
],
[
250,
214
],
[
256,
219
],
[
274,
222
],
[
250,
226
],
[
229,
228
],
[
250,
228
],
[
228,
232
],
[
71,
234
],
[
276,
235
],
[
237,
238
],
[
240,
241
],
[
261,
244
],
[
273,
247
],
[
249,
250
],
[
252,
253
],
[
273,
256
],
[
258,
259
],
[
261,
262
],
[
264,
265
],
[
267,
268
],
[
270,
271
],
[
273,
274
],
[
71,
276
],
[
276,
277
],
[
279,
280
]
] | [
"H, W, N = map(int, input().split())\nd = 10**9+1\nL = []\nS = set()\nfor _ in range(N):\n a, b = map(int, input().split())\n S.add((a, b))\nMap =[[0]*5 for _ in range(5)]\nans = [0]*10\nfor i in S:\n a, b = i\n for i in range(-2, 3):\n for j in range(-2, 3):\n a1, b1 = a+i, b+j\n\n if (1<=a1<=H) and (1<=b1<=W):\n if (a1, b1) in S:\n Map[i+2][j+2] = 1\n else:\n Map[i+2][j+2] = 0\n else:\n Map[i+2][j+2] = -100\n for i in range(-1, 2):\n for j in range(-1, 2):\n res = 0\n for k in range(3):\n for l in range(3):\n res+=Map[i+1+k][j+1+l]\n if res>=0:\n ans[res]+=1\nfor i in range(1, 10)[::-1]:\n ans[i] //=i\nans[0] = (W-2)*(H-2)-sum(ans)\nfor i in ans:\n print(i)",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"d = 10**9+1",
"d",
"10**9+1",
"10**9",
"10",
"9",
"1",
"L = []",
"L",
"[]",
"S = set()",
"S",
"set()",
"set",
"for _ in range(N):\n a, b = map(int, input().split())\n S.add((a, b))",
"_",
"range(N)",
"range",
"N",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"S.add((a, b))",
"S.add",
"S",
"add",
"(a, b)",
"a",
"b",
"[0]*5 for _ in range(5)",
"for _ in range(5)",
"_",
"range(5)",
"range",
"5",
"for _ in range(5)",
"[0]*5",
"[0]",
"0",
"5",
"Map =[[0]*5 for _ in range(5)]",
"Map",
"[[0]*5 for _ in range(5)]",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for i in S:\n a, b = i\n for i in range(-2, 3):\n for j in range(-2, 3):\n a1, b1 = a+i, b+j\n\n if (1<=a1<=H) and (1<=b1<=W):\n if (a1, b1) in S:\n Map[i+2][j+2] = 1\n else:\n Map[i+2][j+2] = 0\n else:\n Map[i+2][j+2] = -100\n for i in range(-1, 2):\n for j in range(-1, 2):\n res = 0\n for k in range(3):\n for l in range(3):\n res+=Map[i+1+k][j+1+l]\n if res>=0:\n ans[res]+=1",
"i",
"S",
"a, b = i",
"a",
"i",
"b",
"for i in range(-2, 3):\n for j in range(-2, 3):\n a1, b1 = a+i, b+j\n\n if (1<=a1<=H) and (1<=b1<=W):\n if (a1, b1) in S:\n Map[i+2][j+2] = 1\n else:\n Map[i+2][j+2] = 0\n else:\n Map[i+2][j+2] = -100\n ",
"i",
"range(-2, 3)",
"range",
"-2",
"3",
"for j in range(-2, 3):\n a1, b1 = a+i, b+j\n\n if (1<=a1<=H) and (1<=b1<=W):\n if (a1, b1) in S:\n Map[i+2][j+2] = 1\n else:\n Map[i+2][j+2] = 0\n else:\n Map[i+2][j+2] = -100\n ",
"j",
"range(-2, 3)",
"range",
"-2",
"3",
"a1, b1 = a+i, b+j",
"a1",
"a+i",
"a",
"i",
"b1",
"b+j",
"b",
"j",
"if (1<=a1<=H) and (1<=b1<=W):\n if (a1, b1) in S:\n Map[i+2][j+2] = 1\n else:\n Map[i+2][j+2] = 0\n else:\n Map[i+2][j+2] = -100\n ",
"(1<=a1<=H) and (1<=b1<=W)",
"1<=a1<=H",
"1<=a1",
"1",
"a1",
"H",
"1<=b1<=W",
"1<=b1",
"1",
"b1",
"W",
"if (a1, b1) in S:\n Map[i+2][j+2] = 1\n else:\n Map[i+2][j+2] = 0\n ",
"(a1, b1) in S",
"(a1, b1)",
"a1",
"b1",
"S",
"Map[i+2][j+2] = 1",
"Map[i+2][j+2]",
"[i+2]",
"Map",
"i+2",
"i",
"2",
"j+2",
"j",
"2",
"1",
"Map[i+2][j+2] = 0",
"Map[i+2][j+2]",
"[i+2]",
"Map",
"i+2",
"i",
"2",
"j+2",
"j",
"2",
"0",
"Map[i+2][j+2] = -100",
"Map[i+2][j+2]",
"[i+2]",
"Map",
"i+2",
"i",
"2",
"j+2",
"j",
"2",
"-100",
"for i in range(-1, 2):\n for j in range(-1, 2):\n res = 0\n for k in range(3):\n for l in range(3):\n res+=Map[i+1+k][j+1+l]\n if res>=0:\n ans[res]+=1",
"i",
"range(-1, 2)",
"range",
"-1",
"2",
"for j in range(-1, 2):\n res = 0\n for k in range(3):\n for l in range(3):\n res+=Map[i+1+k][j+1+l]\n if res>=0:\n ans[res]+=1",
"j",
"range(-1, 2)",
"range",
"-1",
"2",
"res = 0",
"res",
"0",
"for k in range(3):\n for l in range(3):\n res+=Map[i+1+k][j+1+l]\n ",
"k",
"range(3)",
"range",
"3",
"for l in range(3):\n res+=Map[i+1+k][j+1+l]\n ",
"l",
"range(3)",
"range",
"3",
"res+=Map[i+1+k][j+1+l]",
"res",
"Map[i+1+k][j+1+l]",
"[i+1+k]",
"Map",
"i+1+k",
"i+1",
"i",
"1",
"k",
"j+1+l",
"j+1",
"j",
"1",
"l",
"if res>=0:\n ans[res]+=1",
"res>=0",
"res",
"0",
"ans[res]+=1",
"ans[res]",
"ans",
"res",
"1",
"for i in range(1, 10)[::-1]:\n ans[i] //=i",
"i",
"range(1, 10)[::-1]",
"(1, 10)",
"range",
"1",
"10",
"::-1",
"-1",
"ans[i] //=i",
"ans[i]",
"ans",
"i",
"i",
"ans[0] = (W-2)*(H-2)-sum(ans)",
"ans[0]",
"ans",
"0",
"(W-2)*(H-2)-sum(ans)",
"(W-2)*(H-2)",
"W-2",
"W",
"2",
"H-2",
"H",
"2",
"sum(ans)",
"sum",
"ans",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"b = i",
"i",
"b",
"a1, b1 = a+i, b+j",
"a+i",
"a1",
"d = 10**9+1",
"10**9+1",
"d",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"ans = [0]*10",
"[0]*10",
"ans",
"res+=Map[i+1+k][j+1+l]",
"Map[i+1+k][j+1+l]",
"res",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"res = 0",
"0",
"res",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"L = []",
"[]",
"L",
"Map =[[0]*5 for _ in range(5)]",
"[[0]*5 for _ in range(5)]",
"Map",
"b1 = a+i, b+j",
"b+j",
"b1",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"a, b = i",
"i",
"a",
"S = set()",
"set()",
"S"
] | H, W, N = map(int, input().split())
d = 10**9+1
L = []
S = set()
for _ in range(N):
a, b = map(int, input().split())
S.add((a, b))
Map =[[0]*5 for _ in range(5)]
ans = [0]*10
for i in S:
a, b = i
for i in range(-2, 3):
for j in range(-2, 3):
a1, b1 = a+i, b+j
if (1<=a1<=H) and (1<=b1<=W):
if (a1, b1) in S:
Map[i+2][j+2] = 1
else:
Map[i+2][j+2] = 0
else:
Map[i+2][j+2] = -100
for i in range(-1, 2):
for j in range(-1, 2):
res = 0
for k in range(3):
for l in range(3):
res+=Map[i+1+k][j+1+l]
if res>=0:
ans[res]+=1
for i in range(1, 10)[::-1]:
ans[i] //=i
ans[0] = (W-2)*(H-2)-sum(ans)
for i in ans:
print(i) |
[
7,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
13,
13,
14,
2,
13,
17,
4,
13,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
17,
4,
13,
17,
4,
13,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
40,
2,
17,
2,
18,
13,
17,
13,
2,
13,
17,
40,
2,
17,
2,
18,
13,
17,
13,
2,
13,
17,
4,
18,
13,
13,
39,
2,
18,
13,
17,
13,
2,
18,
13,
17,
13,
0,
13,
2,
39,
17,
17,
0,
13,
4,
13,
13,
28,
13,
13,
4,
13,
13,
14,
40,
13,
0,
13,
17,
0,
13,
13,
9,
14,
2,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
0,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
5,
4
],
[
5,
14
],
[
5,
15
],
[
15,
18
],
[
4,
24
],
[
14,
27
],
[
31,
30
],
[
41,
40
],
[
44,
43
],
[
15,
46
],
[
49,
48
],
[
62,
61
],
[
67,
66
],
[
48,
77
],
[
61,
79
],
[
4,
81
],
[
48,
88
],
[
66,
90
],
[
14,
92
],
[
40,
96
],
[
48,
101
],
[
61,
103
],
[
48,
106
],
[
66,
108
],
[
111,
110
],
[
117,
116
],
[
40,
119
],
[
116,
125
],
[
15,
128
],
[
131,
130
],
[
134,
133
],
[
133,
138
],
[
149,
138
],
[
142,
141
],
[
147,
144
],
[
110,
145
],
[
130,
146
],
[
152,
146
],
[
141,
146
],
[
150,
149
],
[
153,
152
],
[
158,
155
],
[
110,
156
],
[
152,
157
],
[
141,
157
],
[
130,
157
],
[
4,
164
],
[
14,
167
],
[
110,
171
],
[
174,
173
],
[
110,
173
],
[
173,
177
],
[
186,
183
]
] | [
"def main():\n h,w,n=map(int,input().split(' '))\n if n==0:\n print((h-2)*(w-2))\n for i in range(9):\n print(0)\n exit()\n draw_list=[]\n for i in range(n):\n draw=tuple(map(int,input().split(' ')))\n for j in range(3):\n for k in range(3):\n if 0<draw[0]-j<=h-2 and 0<draw[1]-k<=w-2:\n draw_list.append((draw[0]-j,draw[1]-k))\n ans = [0]*9\n sorted_draw = sorted(draw_list)\n for n,i in enumerate(sorted_draw):\n if not n:\n ans_num=0\n tmp = i\n continue\n if tmp == i:\n ans_num+=1\n else:\n ans[ans_num] += 1\n tmp = i\n ans_num = 0\n ans[ans_num] += 1\n print((h-2)*(w-2)-sum(ans))\n for i in ans:\n print(i)\n\n\n\nif __name__ == '__main__':\n main()",
"def main():\n h,w,n=map(int,input().split(' '))\n if n==0:\n print((h-2)*(w-2))\n for i in range(9):\n print(0)\n exit()\n draw_list=[]\n for i in range(n):\n draw=tuple(map(int,input().split(' ')))\n for j in range(3):\n for k in range(3):\n if 0<draw[0]-j<=h-2 and 0<draw[1]-k<=w-2:\n draw_list.append((draw[0]-j,draw[1]-k))\n ans = [0]*9\n sorted_draw = sorted(draw_list)\n for n,i in enumerate(sorted_draw):\n if not n:\n ans_num=0\n tmp = i\n continue\n if tmp == i:\n ans_num+=1\n else:\n ans[ans_num] += 1\n tmp = i\n ans_num = 0\n ans[ans_num] += 1\n print((h-2)*(w-2)-sum(ans))\n for i in ans:\n print(i)",
"main",
"h,w,n=map(int,input().split(' '))",
"h",
"map(int,input().split(' '))",
"map",
"int",
"input().split(' ')",
"().split",
"()",
"input",
"split",
"' '",
"w",
"n",
"if n==0:\n print((h-2)*(w-2))\n for i in range(9):\n print(0)\n exit()\n ",
"n==0",
"n",
"0",
"print((h-2)*(w-2))",
"print",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"for i in range(9):\n print(0)\n ",
"i",
"range(9)",
"range",
"9",
"print(0)",
"print",
"0",
"exit()",
"exit",
"draw_list=[]",
"draw_list",
"[]",
"for i in range(n):\n draw=tuple(map(int,input().split(' ')))\n for j in range(3):\n for k in range(3):\n if 0<draw[0]-j<=h-2 and 0<draw[1]-k<=w-2:\n draw_list.append((draw[0]-j,draw[1]-k))\n ",
"i",
"range(n)",
"range",
"n",
"draw=tuple(map(int,input().split(' ')))",
"draw",
"tuple(map(int,input().split(' ')))",
"tuple",
"map(int,input().split(' '))",
"map",
"int",
"input().split(' ')",
"().split",
"()",
"input",
"split",
"' '",
"for j in range(3):\n for k in range(3):\n if 0<draw[0]-j<=h-2 and 0<draw[1]-k<=w-2:\n draw_list.append((draw[0]-j,draw[1]-k))\n ",
"j",
"range(3)",
"range",
"3",
"for k in range(3):\n if 0<draw[0]-j<=h-2 and 0<draw[1]-k<=w-2:\n draw_list.append((draw[0]-j,draw[1]-k))\n ",
"k",
"range(3)",
"range",
"3",
"if 0<draw[0]-j<=h-2 and 0<draw[1]-k<=w-2:\n draw_list.append((draw[0]-j,draw[1]-k))\n ",
"0<draw[0]-j<=h-2 and 0<draw[1]-k<=w-2",
"0<draw[0]-j<=h-2",
"0<draw[0]-j",
"0",
"draw[0]-j",
"draw[0]",
"draw",
"0",
"j",
"h-2",
"h",
"2",
"0<draw[1]-k<=w-2",
"0<draw[1]-k",
"0",
"draw[1]-k",
"draw[1]",
"draw",
"1",
"k",
"w-2",
"w",
"2",
"draw_list.append((draw[0]-j,draw[1]-k))",
"draw_list.append",
"draw_list",
"append",
"(draw[0]-j,draw[1]-k)",
"draw[0]-j",
"draw[0]",
"draw",
"0",
"j",
"draw[1]-k",
"draw[1]",
"draw",
"1",
"k",
"ans = [0]*9",
"ans",
"[0]*9",
"[0]",
"0",
"9",
"sorted_draw = sorted(draw_list)",
"sorted_draw",
"sorted(draw_list)",
"sorted",
"draw_list",
"for n,i in enumerate(sorted_draw):\n if not n:\n ans_num=0\n tmp = i\n continue\n if tmp == i:\n ans_num+=1\n else:\n ans[ans_num] += 1\n tmp = i\n ans_num = 0\n ",
"n",
"i",
"enumerate(sorted_draw)",
"enumerate",
"sorted_draw",
"if not n:\n ans_num=0\n tmp = i\n continue\n ",
"not n",
"n",
"ans_num=0",
"ans_num",
"0",
"tmp = i",
"tmp",
"i",
"continue",
"if tmp == i:\n ans_num+=1\n else:\n ans[ans_num] += 1\n tmp = i\n ans_num = 0\n ",
"tmp == i",
"tmp",
"i",
"ans_num+=1",
"ans_num",
"1",
"ans[ans_num] += 1",
"ans[ans_num]",
"ans",
"ans_num",
"1",
"tmp = i",
"tmp",
"i",
"ans_num = 0",
"ans_num",
"0",
"ans[ans_num] += 1",
"ans[ans_num]",
"ans",
"ans_num",
"1",
"print((h-2)*(w-2)-sum(ans))",
"print",
"(h-2)*(w-2)-sum(ans)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n h,w,n=map(int,input().split(' '))\n if n==0:\n print((h-2)*(w-2))\n for i in range(9):\n print(0)\n exit()\n draw_list=[]\n for i in range(n):\n draw=tuple(map(int,input().split(' ')))\n for j in range(3):\n for k in range(3):\n if 0<draw[0]-j<=h-2 and 0<draw[1]-k<=w-2:\n draw_list.append((draw[0]-j,draw[1]-k))\n ans = [0]*9\n sorted_draw = sorted(draw_list)\n for n,i in enumerate(sorted_draw):\n if not n:\n ans_num=0\n tmp = i\n continue\n if tmp == i:\n ans_num+=1\n else:\n ans[ans_num] += 1\n tmp = i\n ans_num = 0\n ans[ans_num] += 1\n print((h-2)*(w-2)-sum(ans))\n for i in ans:\n print(i)",
"def main():\n h,w,n=map(int,input().split(' '))\n if n==0:\n print((h-2)*(w-2))\n for i in range(9):\n print(0)\n exit()\n draw_list=[]\n for i in range(n):\n draw=tuple(map(int,input().split(' ')))\n for j in range(3):\n for k in range(3):\n if 0<draw[0]-j<=h-2 and 0<draw[1]-k<=w-2:\n draw_list.append((draw[0]-j,draw[1]-k))\n ans = [0]*9\n sorted_draw = sorted(draw_list)\n for n,i in enumerate(sorted_draw):\n if not n:\n ans_num=0\n tmp = i\n continue\n if tmp == i:\n ans_num+=1\n else:\n ans[ans_num] += 1\n tmp = i\n ans_num = 0\n ans[ans_num] += 1\n print((h-2)*(w-2)-sum(ans))\n for i in ans:\n print(i)",
"main"
] | def main():
h,w,n=map(int,input().split(' '))
if n==0:
print((h-2)*(w-2))
for i in range(9):
print(0)
exit()
draw_list=[]
for i in range(n):
draw=tuple(map(int,input().split(' ')))
for j in range(3):
for k in range(3):
if 0<draw[0]-j<=h-2 and 0<draw[1]-k<=w-2:
draw_list.append((draw[0]-j,draw[1]-k))
ans = [0]*9
sorted_draw = sorted(draw_list)
for n,i in enumerate(sorted_draw):
if not n:
ans_num=0
tmp = i
continue
if tmp == i:
ans_num+=1
else:
ans[ans_num] += 1
tmp = i
ans_num = 0
ans[ans_num] += 1
print((h-2)*(w-2)-sum(ans))
for i in ans:
print(i)
if __name__ == '__main__':
main()
|
[
7,
15,
13,
18,
18,
13,
13,
13,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
39,
17,
17,
17,
17,
17,
17,
17,
17,
17,
0,
13,
39,
17,
17,
17,
17,
17,
17,
17,
17,
17,
0,
13,
4,
13,
4,
13,
13,
13,
0,
13,
17,
28,
13,
13,
13,
28,
13,
13,
13,
0,
13,
39,
2,
13,
13,
2,
13,
13,
4,
18,
13,
13,
13,
17,
0,
18,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
39,
13,
13,
13,
4,
18,
13,
13,
14,
2,
2,
2,
17,
13,
13,
2,
2,
17,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
4,
13,
31,
13,
0,
13,
17,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
12,
11
],
[
12,
20
],
[
12,
21
],
[
25,
24
],
[
21,
27
],
[
41,
40
],
[
44,
43
],
[
56,
55
],
[
68,
67
],
[
43,
72
],
[
55,
73
],
[
76,
75
],
[
87,
86
],
[
75,
96
],
[
86,
98
],
[
104,
101
],
[
75,
102
],
[
86,
103
],
[
107,
106
],
[
75,
118
],
[
11,
126
],
[
20,
131
],
[
136,
133
],
[
106,
134
],
[
141,
138
],
[
106,
139
],
[
11,
144
],
[
20,
147
],
[
106,
152
],
[
106,
158
],
[
161,
160
],
[
170,
167
]
] | [
"import sys\nsys.stdin.readline\n\ndef main():\n H, W, N = map(int, input().split())\n AB = [tuple(map(int, input().split())) for _ in range(N)]\n X = [-1, -1, -1, 0, 0, 0, 1, 1, 1]\n Y = [-1, 0, 1, -1, 0, 1, -1, 0, 1]\n XY = list(zip(X, Y))\n S = {}\n for a, b in AB:\n for x, y in XY:\n k = (a+x, b+y)\n S.setdefault(k, 0)\n S[k] += 1\n ans = [0] * 10\n for (x, y), v in S.items():\n if 1 < x < H and 1 < y < W:\n ans[v] += 1\n ans[0] = (H-2)*(W-2)-sum(ans[1:])\n print(*ans, sep=\"\\n\")\n\nif __name__ == \"__main__\":\n main()",
"import sys",
"sys",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"def main():\n H, W, N = map(int, input().split())\n AB = [tuple(map(int, input().split())) for _ in range(N)]\n X = [-1, -1, -1, 0, 0, 0, 1, 1, 1]\n Y = [-1, 0, 1, -1, 0, 1, -1, 0, 1]\n XY = list(zip(X, Y))\n S = {}\n for a, b in AB:\n for x, y in XY:\n k = (a+x, b+y)\n S.setdefault(k, 0)\n S[k] += 1\n ans = [0] * 10\n for (x, y), v in S.items():\n if 1 < x < H and 1 < y < W:\n ans[v] += 1\n ans[0] = (H-2)*(W-2)-sum(ans[1:])\n print(*ans, sep=\"\\n\")",
"main",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"tuple(map(int, input().split())) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"tuple(map(int, input().split()))",
"tuple",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"AB = [tuple(map(int, input().split())) for _ in range(N)]",
"AB",
"[tuple(map(int, input().split())) for _ in range(N)]",
"X = [-1, -1, -1, 0, 0, 0, 1, 1, 1]",
"X",
"[-1, -1, -1, 0, 0, 0, 1, 1, 1]",
"-1",
"-1",
"-1",
"0",
"0",
"0",
"1",
"1",
"1",
"Y = [-1, 0, 1, -1, 0, 1, -1, 0, 1]",
"Y",
"[-1, 0, 1, -1, 0, 1, -1, 0, 1]",
"-1",
"0",
"1",
"-1",
"0",
"1",
"-1",
"0",
"1",
"XY = list(zip(X, Y))",
"XY",
"list(zip(X, Y))",
"list",
"zip(X, Y)",
"zip",
"X",
"Y",
"S = {}",
"S",
"{}",
"for a, b in AB:\n for x, y in XY:\n k = (a+x, b+y)\n S.setdefault(k, 0)\n S[k] += 1\n ",
"a",
"b",
"AB",
"for x, y in XY:\n k = (a+x, b+y)\n S.setdefault(k, 0)\n S[k] += 1\n ",
"x",
"y",
"XY",
"k = (a+x, b+y)",
"k",
"(a+x, b+y)",
"a+x",
"a",
"x",
"b+y",
"b",
"y",
"S.setdefault(k, 0)",
"S.setdefault",
"S",
"setdefault",
"k",
"0",
"S[k] += 1",
"S[k]",
"S",
"k",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for (x, y), v in S.items():\n if 1 < x < H and 1 < y < W:\n ans[v] += 1\n ",
"(x, y)",
"x",
"y",
"v",
"S.items()",
"S.items",
"S",
"items",
"if 1 < x < H and 1 < y < W:\n ans[v] += 1\n ",
"1 < x < H and 1 < y < W",
"1 < x < H",
"1 < x",
"1",
"x",
"H",
"1 < y < W",
"1 < y",
"1",
"y",
"W",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"ans[0] = (H-2)*(W-2)-sum(ans[1:])",
"ans[0]",
"ans",
"0",
"(H-2)*(W-2)-sum(ans[1:])",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"print(*ans, sep=\"\\n\")",
"print",
"*ans",
"ans",
"sep=\"\\n\"",
"sep",
"\"\\n\"",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n H, W, N = map(int, input().split())\n AB = [tuple(map(int, input().split())) for _ in range(N)]\n X = [-1, -1, -1, 0, 0, 0, 1, 1, 1]\n Y = [-1, 0, 1, -1, 0, 1, -1, 0, 1]\n XY = list(zip(X, Y))\n S = {}\n for a, b in AB:\n for x, y in XY:\n k = (a+x, b+y)\n S.setdefault(k, 0)\n S[k] += 1\n ans = [0] * 10\n for (x, y), v in S.items():\n if 1 < x < H and 1 < y < W:\n ans[v] += 1\n ans[0] = (H-2)*(W-2)-sum(ans[1:])\n print(*ans, sep=\"\\n\")",
"def main():\n H, W, N = map(int, input().split())\n AB = [tuple(map(int, input().split())) for _ in range(N)]\n X = [-1, -1, -1, 0, 0, 0, 1, 1, 1]\n Y = [-1, 0, 1, -1, 0, 1, -1, 0, 1]\n XY = list(zip(X, Y))\n S = {}\n for a, b in AB:\n for x, y in XY:\n k = (a+x, b+y)\n S.setdefault(k, 0)\n S[k] += 1\n ans = [0] * 10\n for (x, y), v in S.items():\n if 1 < x < H and 1 < y < W:\n ans[v] += 1\n ans[0] = (H-2)*(W-2)-sum(ans[1:])\n print(*ans, sep=\"\\n\")",
"main"
] | import sys
sys.stdin.readline
def main():
H, W, N = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
X = [-1, -1, -1, 0, 0, 0, 1, 1, 1]
Y = [-1, 0, 1, -1, 0, 1, -1, 0, 1]
XY = list(zip(X, Y))
S = {}
for a, b in AB:
for x, y in XY:
k = (a+x, b+y)
S.setdefault(k, 0)
S[k] += 1
ans = [0] * 10
for (x, y), v in S.items():
if 1 < x < H and 1 < y < W:
ans[v] += 1
ans[0] = (H-2)*(W-2)-sum(ans[1:])
print(*ans, sep="\n")
if __name__ == "__main__":
main() |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
2,
2,
17,
2,
13,
13,
13,
2,
2,
17,
2,
13,
13,
13,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
131,
3
],
[
131,
12
],
[
131,
13
],
[
119,
15
],
[
21,
20
],
[
123,
23
],
[
128,
25
],
[
128,
34
],
[
37,
36
],
[
43,
42
],
[
117,
53
],
[
36,
54
],
[
132,
55
],
[
129,
60
],
[
42,
61
],
[
114,
62
],
[
73,
64
],
[
120,
65
],
[
117,
68
],
[
36,
69
],
[
129,
71
],
[
42,
72
],
[
125,
75
],
[
82,
81
],
[
120,
84
],
[
90,
87
],
[
126,
88
],
[
81,
89
],
[
95,
92
],
[
126,
93
],
[
132,
98
],
[
114,
101
],
[
126,
105
],
[
108,
107
],
[
126,
107
],
[
107,
111
],
[
131,
114
],
[
128,
117
],
[
119,
120
],
[
131,
123
],
[
125,
126
],
[
128,
129
],
[
131,
132
]
] | [
"from collections import defaultdict\n\nh,w,n = map(int,input().split())\n\nd = defaultdict(int)\n\nfor _ in range(n):\n a,b = map(int,input().split())\n\n for i in range(-1,2):\n for j in range(-1,2):\n if 1 < a+i < h and 1 < b+j < w:\n d[(a+i,b+j)] += 1\n\nans = [0]*10\n\nfor i in d.values():\n ans[i] += 1\n\nans[0] = (h-2)*(w-2)-sum(ans)\nfor i in ans:\n print(i)",
"from collections import defaultdict",
"h,w,n = map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"for _ in range(n):\n a,b = map(int,input().split())\n\n for i in range(-1,2):\n for j in range(-1,2):\n if 1 < a+i < h and 1 < b+j < w:\n d[(a+i,b+j)] += 1",
"_",
"range(n)",
"range",
"n",
"a,b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in range(-1,2):\n for j in range(-1,2):\n if 1 < a+i < h and 1 < b+j < w:\n d[(a+i,b+j)] += 1",
"i",
"range(-1,2)",
"range",
"-1",
"2",
"for j in range(-1,2):\n if 1 < a+i < h and 1 < b+j < w:\n d[(a+i,b+j)] += 1",
"j",
"range(-1,2)",
"range",
"-1",
"2",
"if 1 < a+i < h and 1 < b+j < w:\n d[(a+i,b+j)] += 1",
"1 < a+i < h and 1 < b+j < w",
"1 < a+i < h",
"1 < a+i",
"1",
"a+i",
"a",
"i",
"h",
"1 < b+j < w",
"1 < b+j",
"1",
"b+j",
"b",
"j",
"w",
"d[(a+i,b+j)] += 1",
"d[(a+i,b+j)]",
"d",
"(a+i,b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"1",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for i in d.values():\n ans[i] += 1",
"i",
"d.values()",
"d.values",
"d",
"values",
"ans[i] += 1",
"ans[i]",
"ans",
"i",
"1",
"ans[0] = (h-2)*(w-2)-sum(ans)",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)-sum(ans)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"w,n = map(int,input().split())",
"map(int,input().split())",
"w",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"d = defaultdict(int)",
"defaultdict(int)",
"d",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"ans = [0]*10",
"[0]*10",
"ans",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h"
] | from collections import defaultdict
h,w,n = map(int,input().split())
d = defaultdict(int)
for _ in range(n):
a,b = map(int,input().split())
for i in range(-1,2):
for j in range(-1,2):
if 1 < a+i < h and 1 < b+j < w:
d[(a+i,b+j)] += 1
ans = [0]*10
for i in d.values():
ans[i] += 1
ans[0] = (h-2)*(w-2)-sum(ans)
for i in ans:
print(i) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
15,
0,
13,
4,
13,
12,
17,
41,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
2,
2,
40,
17,
2,
13,
13,
2,
13,
17,
2,
40,
17,
2,
13,
13,
2,
13,
17,
4,
39,
2,
13,
13,
2,
13,
13,
0,
13,
12,
13,
23,
23,
28,
13,
13,
13,
28,
13,
13,
4,
13,
2,
13,
17,
2,
13,
17,
0,
18,
13,
13,
17,
41,
28,
13,
4,
13,
17,
17,
4,
4,
13,
2,
13,
13,
0,
13,
2,
39,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
13,
13,
10,
12,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
158,
2
],
[
158,
11
],
[
158,
12
],
[
16,
15
],
[
159,
18
],
[
143,
31
],
[
140,
35
],
[
43,
42
],
[
48,
47
],
[
42,
57
],
[
150,
59
],
[
47,
66
],
[
156,
68
],
[
42,
74
],
[
47,
77
],
[
146,
79
],
[
147,
92
],
[
103,
100
],
[
141,
101
],
[
107,
106
],
[
106,
116
],
[
152,
118
],
[
150,
124
],
[
156,
127
],
[
141,
131
],
[
135,
134
],
[
153,
134
],
[
134,
138
],
[
140,
141
],
[
143,
144
],
[
146,
147
],
[
158,
150
],
[
152,
153
],
[
158,
156
],
[
158,
159
]
] | [
"H, W, N = map(int, input().split())\nDraw = [tuple(map(int, input().split())) for _ in range(N)]\nfrom collections import defaultdict as dd\nSq = dd(lambda:0) #3*3正方形を左上のマスの座標で区別。値は正方形内の黒塗りの個数\nIn = lambda x,y:[(x-i,y-j) for i in range(3) for j in range(3) if 0<=x-i<H-2 and 0<=y-j<W-2] #塗りつぶしたマスを含む正方形の座標のリストを返す関数\nfor a,b in Draw:\n for x,y in In(a-1,b-1): \n Sq[x,y] += 1 #Sqの更新\nAns = [(H-2)*(W-2)-len(Sq)] + [sum(v==i for v in Sq.values()) for i in range(1,10)] \nfor ans in Ans:\n print(ans)",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"tuple(map(int, input().split())) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"tuple(map(int, input().split()))",
"tuple",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"Draw = [tuple(map(int, input().split())) for _ in range(N)]",
"Draw",
"[tuple(map(int, input().split())) for _ in range(N)]",
"from collections import defaultdict as dd",
"Sq = dd(lambda:0)",
"Sq",
"dd(lambda:0)",
"dd",
"lambda:0",
"0",
"(x-i,y-j) for i in range(3) for j in range(3) if 0<=x-i<H-2 and 0<=y-j<W-2",
"for i in range(3) for j in range(3) if 0<=x-i<H-2 and 0<=y-j<W-2",
"i",
"range(3)",
"range",
"3",
"for j in range(3) if 0<=x-i<H-2 and 0<=y-j<W-2",
"j",
"range(3)",
"range",
"3",
"0<=x-i<H-2 and 0<=y-j<W-2",
"0<=x-i<H-2",
"0<=x-i",
"0",
"x-i",
"x",
"i",
"H-2",
"H",
"2",
"0<=y-j<W-2",
"0<=y-j",
"0",
"y-j",
"y",
"j",
"W-2",
"W",
"2",
"if 0<=x-i<H-2 and 0<=y-j<W-2",
"(x-i,y-j)",
"x-i",
"x",
"i",
"y-j",
"y",
"j",
"In = lambda x,y:[(x-i,y-j) for i in range(3) for j in range(3) if 0<=x-i<H-2 and 0<=y-j<W-2]",
"In",
"lambda x,y:[(x-i,y-j) for i in range(3) for j in range(3) if 0<=x-i<H-2 and 0<=y-j<W-2]",
"[(x-i,y-j) for i in range(3) for j in range(3) if 0<=x-i<H-2 and 0<=y-j<W-2]",
"x",
"y",
"for a,b in Draw:\n for x,y in In(a-1,b-1): \n Sq[x,y] += 1 #Sqの更新",
"a",
"b",
"Draw",
"for x,y in In(a-1,b-1): \n Sq[x,y] += 1 #Sqの更新",
"x",
"y",
"In(a-1,b-1)",
"In",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"Sq[x,y] += 1",
"Sq[x,y]",
"Sq",
"x",
"1",
"sum(v==i for v in Sq.values()) for i in range(1,10)",
"for i in range(1,10)",
"i",
"range(1,10)",
"range",
"1",
"10",
"for i in range(1,10)",
"sum(v==i for v in Sq.values())",
"sum",
"v==i",
"v",
"i",
"Ans = [(H-2)*(W-2)-len(Sq)] + [sum(v==i for v in Sq.values()) for i in range(1,10)]",
"Ans",
"[(H-2)*(W-2)-len(Sq)] + [sum(v==i for v in Sq.values()) for i in range(1,10)]",
"[(H-2)*(W-2)-len(Sq)]",
"(H-2)*(W-2)-len(Sq)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"len(Sq)",
"len",
"Sq",
"[sum(v==i for v in Sq.values()) for i in range(1,10)]",
"for ans in Ans:\n print(ans)",
"ans",
"Ans",
"print(ans)",
"print",
"ans",
"Sq = dd(lambda:0)",
"dd(lambda:0)",
"Sq",
"Draw = [tuple(map(int, input().split())) for _ in range(N)]",
"[tuple(map(int, input().split())) for _ in range(N)]",
"Draw",
"In = lambda x,y:[(x-i,y-j) for i in range(3) for j in range(3) if 0<=x-i<H-2 and 0<=y-j<W-2]",
"lambda x,y:[(x-i,y-j) for i in range(3) for j in range(3) if 0<=x-i<H-2 and 0<=y-j<W-2]",
"In",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"Ans = [(H-2)*(W-2)-len(Sq)] + [sum(v==i for v in Sq.values()) for i in range(1,10)]",
"[(H-2)*(W-2)-len(Sq)] + [sum(v==i for v in Sq.values()) for i in range(1,10)]",
"Ans",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"N = map(int, input().split())",
"map(int, input().split())",
"N"
] | H, W, N = map(int, input().split())
Draw = [tuple(map(int, input().split())) for _ in range(N)]
from collections import defaultdict as dd
Sq = dd(lambda:0) #3*3正方形を左上のマスの座標で区別。値は正方形内の黒塗りの個数
In = lambda x,y:[(x-i,y-j) for i in range(3) for j in range(3) if 0<=x-i<H-2 and 0<=y-j<W-2] #塗りつぶしたマスを含む正方形の座標のリストを返す関数
for a,b in Draw:
for x,y in In(a-1,b-1):
Sq[x,y] += 1 #Sqの更新
Ans = [(H-2)*(W-2)-len(Sq)] + [sum(v==i for v in Sq.values()) for i in range(1,10)]
for ans in Ans:
print(ans) |
[
7,
15,
15,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
28,
13,
13,
13,
28,
13,
13,
4,
13,
4,
13,
4,
13,
2,
13,
17,
2,
13,
17,
4,
13,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
39,
13,
13,
17,
0,
13,
4,
13,
4,
18,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
13,
13,
10,
4,
13
] | [
[
149,
6
],
[
155,
13
],
[
150,
20
],
[
155,
22
],
[
155,
23
],
[
27,
26
],
[
156,
29
],
[
150,
39
],
[
152,
42
],
[
146,
45
],
[
138,
85
],
[
144,
92
],
[
100,
95
],
[
147,
96
],
[
140,
102
],
[
147,
107
],
[
138,
114
],
[
144,
117
],
[
141,
123
],
[
127,
126
],
[
141,
134
],
[
126,
135
],
[
155,
138
],
[
140,
141
],
[
155,
144
],
[
146,
147
],
[
149,
150
],
[
152,
153
],
[
155,
156
]
] | [
"from itertools import product\nfrom collections import defaultdict, Counter\nimport sys\ninput = sys.stdin.readline\nh,w,n = map(int,input().split())\na = [list(map(int,input().split())) for i in range(n)]\npls = defaultdict(int)\nfor x,y in a:\n for arx,ary in product(list(range(x-1,x+2)),list(range(y-1,y+2))):\n if 2<=arx<=h-1 and 2<=ary<=w-1:\n pls[(arx,ary)] += 1\nc = Counter(pls.values())\nprint((h-2)*(w-2)-sum(c.values()))\nfor i in range(1,10):\n print(c[i])",
"from itertools import product",
"from collections import defaultdict, Counter",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"h,w,n = map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"list(map(int,input().split())) for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"a = [list(map(int,input().split())) for i in range(n)]",
"a",
"[list(map(int,input().split())) for i in range(n)]",
"pls = defaultdict(int)",
"pls",
"defaultdict(int)",
"defaultdict",
"int",
"for x,y in a:\n for arx,ary in product(list(range(x-1,x+2)),list(range(y-1,y+2))):\n if 2<=arx<=h-1 and 2<=ary<=w-1:\n pls[(arx,ary)] += 1",
"x",
"y",
"a",
"for arx,ary in product(list(range(x-1,x+2)),list(range(y-1,y+2))):\n if 2<=arx<=h-1 and 2<=ary<=w-1:\n pls[(arx,ary)] += 1",
"arx",
"ary",
"product(list(range(x-1,x+2)),list(range(y-1,y+2)))",
"product",
"list(range(x-1,x+2))",
"list",
"range(x-1,x+2)",
"range",
"x-1",
"x",
"1",
"x+2",
"x",
"2",
"list(range(y-1,y+2))",
"list",
"range(y-1,y+2)",
"range",
"y-1",
"y",
"1",
"y+2",
"y",
"2",
"if 2<=arx<=h-1 and 2<=ary<=w-1:\n pls[(arx,ary)] += 1",
"2<=arx<=h-1 and 2<=ary<=w-1",
"2<=arx<=h-1",
"2<=arx",
"2",
"arx",
"h-1",
"h",
"1",
"2<=ary<=w-1",
"2<=ary",
"2",
"ary",
"w-1",
"w",
"1",
"pls[(arx,ary)] += 1",
"pls[(arx,ary)]",
"pls",
"(arx,ary)",
"arx",
"ary",
"1",
"c = Counter(pls.values())",
"c",
"Counter(pls.values())",
"Counter",
"pls.values()",
"pls.values",
"pls",
"values",
"print((h-2)*(w-2)-sum(c.values()))",
"print",
"(h-2)*(w-2)-sum(c.values())",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(c.values())",
"sum",
"c.values()",
"c.values",
"c",
"values",
"for i in range(1,10):\n print(c[i])",
"i",
"range(1,10)",
"range",
"1",
"10",
"print(c[i])",
"print",
"c[i]",
"c",
"i",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h",
"c = Counter(pls.values())",
"Counter(pls.values())",
"c",
"w,n = map(int,input().split())",
"map(int,input().split())",
"w",
"pls = defaultdict(int)",
"defaultdict(int)",
"pls",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"a = [list(map(int,input().split())) for i in range(n)]",
"[list(map(int,input().split())) for i in range(n)]",
"a",
"n = map(int,input().split())",
"map(int,input().split())",
"n"
] | from itertools import product
from collections import defaultdict, Counter
import sys
input = sys.stdin.readline
h,w,n = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
pls = defaultdict(int)
for x,y in a:
for arx,ary in product(list(range(x-1,x+2)),list(range(y-1,y+2))):
if 2<=arx<=h-1 and 2<=ary<=w-1:
pls[(arx,ary)] += 1
c = Counter(pls.values())
print((h-2)*(w-2)-sum(c.values()))
for i in range(1,10):
print(c[i])
|
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
2,
2,
17,
2,
18,
18,
13,
13,
17,
13,
2,
13,
17,
2,
2,
17,
2,
18,
18,
13,
13,
17,
13,
2,
13,
17,
4,
18,
13,
13,
2,
2,
2,
2,
2,
2,
18,
18,
13,
13,
17,
13,
17,
2,
17,
17,
18,
18,
13,
13,
17,
13,
17,
0,
13,
4,
18,
13,
13,
13,
0,
13,
4,
13,
4,
18,
13,
13,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
28,
13,
4,
13,
4,
13,
13,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] | [
[
189,
4
],
[
189,
13
],
[
189,
14
],
[
18,
17
],
[
190,
20
],
[
177,
33
],
[
183,
36
],
[
40,
39
],
[
190,
42
],
[
45,
44
],
[
50,
49
],
[
178,
61
],
[
39,
62
],
[
44,
64
],
[
187,
66
],
[
178,
74
],
[
39,
75
],
[
49,
77
],
[
175,
79
],
[
184,
83
],
[
178,
93
],
[
39,
94
],
[
44,
96
],
[
178,
103
],
[
39,
104
],
[
49,
106
],
[
180,
109
],
[
184,
114
],
[
192,
116
],
[
181,
121
],
[
184,
121
],
[
126,
125
],
[
195,
132
],
[
136,
135
],
[
193,
140
],
[
147,
142
],
[
196,
143
],
[
193,
145
],
[
135,
146
],
[
152,
149
],
[
196,
150
],
[
187,
155
],
[
175,
158
],
[
193,
162
],
[
165,
164
],
[
196,
171
],
[
164,
172
],
[
189,
175
],
[
177,
178
],
[
180,
181
],
[
183,
184
],
[
189,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
]
] | [
"import collections\nh,w,n=map(int,input().split())\nl=[list(map(int,input().split())) for i in range(n)]\nL=[]\nfor i in range(n):\n for j in range(3):\n for k in range(3):\n if 0<l[i][0]-j<h-1 and 0<l[i][1]-k<w-1:\n L.append((l[i][0]-j-1)*10**9+l[i][1]-k-1)\nL=collections.Counter(L)\nL2=list(L.values())\nans=[0 for i in range(10)]\nfor i in range(len(L2)):\n ans[L2[i]]+=1\nans[0]=(h-2)*(w-2)-len(L2)\nfor i in range(10):\n print(ans[i])",
"import collections",
"collections",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"list(map(int,input().split())) for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"l=[list(map(int,input().split())) for i in range(n)]",
"l",
"[list(map(int,input().split())) for i in range(n)]",
"L=[]",
"L",
"[]",
"for i in range(n):\n for j in range(3):\n for k in range(3):\n if 0<l[i][0]-j<h-1 and 0<l[i][1]-k<w-1:\n L.append((l[i][0]-j-1)*10**9+l[i][1]-k-1)",
"i",
"range(n)",
"range",
"n",
"for j in range(3):\n for k in range(3):\n if 0<l[i][0]-j<h-1 and 0<l[i][1]-k<w-1:\n L.append((l[i][0]-j-1)*10**9+l[i][1]-k-1)",
"j",
"range(3)",
"range",
"3",
"for k in range(3):\n if 0<l[i][0]-j<h-1 and 0<l[i][1]-k<w-1:\n L.append((l[i][0]-j-1)*10**9+l[i][1]-k-1)",
"k",
"range(3)",
"range",
"3",
"if 0<l[i][0]-j<h-1 and 0<l[i][1]-k<w-1:\n L.append((l[i][0]-j-1)*10**9+l[i][1]-k-1)",
"0<l[i][0]-j<h-1 and 0<l[i][1]-k<w-1",
"0<l[i][0]-j<h-1",
"0<l[i][0]-j",
"0",
"l[i][0]-j",
"l[i][0]",
"[i]",
"l",
"i",
"0",
"j",
"h-1",
"h",
"1",
"0<l[i][1]-k<w-1",
"0<l[i][1]-k",
"0",
"l[i][1]-k",
"l[i][1]",
"[i]",
"l",
"i",
"1",
"k",
"w-1",
"w",
"1",
"L.append((l[i][0]-j-1)*10**9+l[i][1]-k-1)",
"L.append",
"L",
"append",
"(l[i][0]-j-1)*10**9+l[i][1]-k-1",
"(l[i][0]-j-1)*10**9+l[i][1]-k",
"(l[i][0]-j-1)*10**9+l[i][1]",
"(l[i][0]-j-1)*10**9",
"l[i][0]-j-1",
"l[i][0]-j",
"l[i][0]",
"[i]",
"l",
"i",
"0",
"j",
"1",
"10**9",
"10",
"9",
"l[i][1]",
"[i]",
"l",
"i",
"1",
"k",
"1",
"L=collections.Counter(L)",
"L",
"collections.Counter(L)",
"collections.Counter",
"collections",
"Counter",
"L",
"L2=list(L.values())",
"L2",
"list(L.values())",
"list",
"L.values()",
"L.values",
"L",
"values",
"0 for i in range(10)",
"for i in range(10)",
"i",
"range(10)",
"range",
"10",
"for i in range(10)",
"0",
"ans=[0 for i in range(10)]",
"ans",
"[0 for i in range(10)]",
"for i in range(len(L2)):\n ans[L2[i]]+=1",
"i",
"range(len(L2))",
"range",
"len(L2)",
"len",
"L2",
"ans[L2[i]]+=1",
"ans[L2[i]]",
"ans",
"L2[i]",
"L2",
"i",
"1",
"ans[0]=(h-2)*(w-2)-len(L2)",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)-len(L2)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"len(L2)",
"len",
"L2",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"l=[list(map(int,input().split())) for i in range(n)]",
"[list(map(int,input().split())) for i in range(n)]",
"l",
"L=collections.Counter(L)",
"collections.Counter(L)",
"L",
"L=[]",
"[]",
"L",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"L2=list(L.values())",
"list(L.values())",
"L2",
"ans=[0 for i in range(10)]",
"[0 for i in range(10)]",
"ans"
] | import collections
h,w,n=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
L=[]
for i in range(n):
for j in range(3):
for k in range(3):
if 0<l[i][0]-j<h-1 and 0<l[i][1]-k<w-1:
L.append((l[i][0]-j-1)*10**9+l[i][1]-k-1)
L=collections.Counter(L)
L2=list(L.values())
ans=[0 for i in range(10)]
for i in range(len(L2)):
ans[L2[i]]+=1
ans[0]=(h-2)*(w-2)-len(L2)
for i in range(10):
print(ans[i]) |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
13,
31,
13,
0,
13,
4,
13,
13,
28,
13,
13,
4,
13,
31,
2,
39,
4,
13,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
2,
2,
2,
17,
13,
40,
2,
13,
17,
13,
2,
17,
13,
40,
2,
13,
17,
13,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
17,
4,
13,
31,
13,
0,
13,
17,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
139,
3
],
[
139,
16
],
[
139,
17
],
[
139,
18
],
[
127,
21
],
[
39,
38
],
[
49,
48
],
[
38,
63
],
[
38,
66
],
[
137,
68
],
[
48,
71
],
[
48,
74
],
[
140,
76
],
[
83,
78
],
[
128,
79
],
[
133,
85
],
[
94,
91
],
[
134,
92
],
[
140,
96
],
[
137,
99
],
[
103,
102
],
[
128,
105
],
[
113,
108
],
[
134,
109
],
[
128,
111
],
[
102,
112
],
[
118,
115
],
[
134,
116
],
[
134,
122
],
[
125,
124
],
[
127,
128
],
[
139,
131
],
[
133,
134
],
[
139,
137
],
[
139,
140
]
] | [
"from collections import defaultdict\nH, W, N, *L = map(int, open(0).read().split())\ndic = defaultdict(int)\nfor a, b in zip(*[iter(L)]*2):\n for i in range(a-2,a+1):\n for j in range(b-2,b+1):\n if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[(i,j)] += 1\nans = [0]*10\nans[0] = (W-2)*(H-2)\nfor k in dic.keys():\n ans[dic[k]] += 1\n ans[0] -= 1\nprint(*ans,sep='\\n')",
"from collections import defaultdict",
"H, W, N, *L = map(int, open(0).read().split())",
"H",
"map(int, open(0).read().split())",
"map",
"int",
"open(0).read().split()",
"(0).read().split",
"(0).read()",
"(0).read",
"(0)",
"open",
"0",
"read",
"split",
"W",
"N",
"*L",
"L",
"dic = defaultdict(int)",
"dic",
"defaultdict(int)",
"defaultdict",
"int",
"for a, b in zip(*[iter(L)]*2):\n for i in range(a-2,a+1):\n for j in range(b-2,b+1):\n if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[(i,j)] += 1",
"a",
"b",
"zip(*[iter(L)]*2)",
"zip",
"*[iter(L)]*2",
"[iter(L)]*2",
"[iter(L)]",
"iter(L)",
"iter",
"L",
"2",
"for i in range(a-2,a+1):\n for j in range(b-2,b+1):\n if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[(i,j)] += 1",
"i",
"range(a-2,a+1)",
"range",
"a-2",
"a",
"2",
"a+1",
"a",
"1",
"for j in range(b-2,b+1):\n if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[(i,j)] += 1",
"j",
"range(b-2,b+1)",
"range",
"b-2",
"b",
"2",
"b+1",
"b",
"1",
"if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[(i,j)] += 1",
"0<i and i+2<=H and 0<j and j+2<=W",
"0<i and i+2<=H and 0<j",
"0<i and i+2<=H",
"0<i",
"0",
"i",
"i+2<=H",
"i+2",
"i",
"2",
"H",
"0<j",
"0",
"j",
"j+2<=W",
"j+2",
"j",
"2",
"W",
"dic[(i,j)] += 1",
"dic[(i,j)]",
"dic",
"(i,j)",
"i",
"j",
"1",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"ans[0] = (W-2)*(H-2)",
"ans[0]",
"ans",
"0",
"(W-2)*(H-2)",
"W-2",
"W",
"2",
"H-2",
"H",
"2",
"for k in dic.keys():\n ans[dic[k]] += 1\n ans[0] -= 1",
"k",
"dic.keys()",
"dic.keys",
"dic",
"keys",
"ans[dic[k]] += 1",
"ans[dic[k]]",
"ans",
"dic[k]",
"dic",
"k",
"1",
"ans[0] -= 1",
"ans[0]",
"ans",
"0",
"1",
"print(*ans,sep='\\n')",
"print",
"*ans",
"ans",
"sep='\\n'",
"sep",
"'\\n'",
"dic = defaultdict(int)",
"defaultdict(int)",
"dic",
"N, *L = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"N",
"ans = [0]*10",
"[0]*10",
"ans",
"H, W, N, *L = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"H",
"W, N, *L = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"W"
] | from collections import defaultdict
H, W, N, *L = map(int, open(0).read().split())
dic = defaultdict(int)
for a, b in zip(*[iter(L)]*2):
for i in range(a-2,a+1):
for j in range(b-2,b+1):
if 0<i and i+2<=H and 0<j and j+2<=W:
dic[(i,j)] += 1
ans = [0]*10
ans[0] = (W-2)*(H-2)
for k in dic.keys():
ans[dic[k]] += 1
ans[0] -= 1
print(*ans,sep='\n') |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
0,
13,
4,
13,
13,
0,
13,
4,
13,
28,
13,
13,
0,
13,
13,
13,
0,
13,
4,
13,
17,
2,
13,
17,
0,
13,
2,
4,
13,
13,
2,
13,
17,
17,
0,
13,
4,
13,
17,
2,
13,
17,
0,
13,
2,
4,
13,
13,
2,
13,
17,
17,
28,
13,
4,
13,
13,
13,
28,
13,
4,
13,
13,
13,
14,
2,
39,
13,
13,
13,
9,
0,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
0,
13,
2,
39,
2,
13,
13,
2,
13,
13,
13,
0,
18,
13,
17,
17,
0,
18,
13,
13,
17,
4,
18,
13,
13,
39,
13,
13,
4,
13,
4,
18,
17,
13,
4,
13,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
18,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] | [
[
203,
4
],
[
224,
11
],
[
204,
18
],
[
224,
20
],
[
224,
21
],
[
25,
24
],
[
213,
27
],
[
204,
37
],
[
209,
40
],
[
200,
43
],
[
52,
49
],
[
201,
50
],
[
225,
54
],
[
195,
57
],
[
215,
60
],
[
210,
63
],
[
221,
65
],
[
70,
69
],
[
210,
69
],
[
227,
72
],
[
69,
73
],
[
219,
73
],
[
186,
73
],
[
227,
74
],
[
182,
76
],
[
207,
81
],
[
197,
84
],
[
225,
88
],
[
207,
90
],
[
188,
94
],
[
228,
99
],
[
191,
102
],
[
195,
106
],
[
228,
108
],
[
113,
112
],
[
189,
115
],
[
192,
116
],
[
119,
118
],
[
183,
121
],
[
198,
122
],
[
222,
128
],
[
185,
131
],
[
135,
134
],
[
140,
139
],
[
218,
144
],
[
118,
148
],
[
139,
149
],
[
112,
151
],
[
134,
152
],
[
216,
153
],
[
158,
155
],
[
201,
156
],
[
163,
160
],
[
201,
161
],
[
219,
162
],
[
186,
162
],
[
69,
162
],
[
222,
166
],
[
201,
180
],
[
182,
183
],
[
185,
186
],
[
188,
189
],
[
191,
192
],
[
224,
195
],
[
197,
198
],
[
200,
201
],
[
203,
204
],
[
69,
206
],
[
219,
206
],
[
186,
206
],
[
227,
207
],
[
209,
210
],
[
224,
213
],
[
215,
216
],
[
218,
219
],
[
221,
222
],
[
224,
225
],
[
69,
227
],
[
219,
227
],
[
186,
227
],
[
227,
228
]
] | [
"import sys\ninput = sys.stdin.readline\n\nh,w,n = map(int,input().split())\nab = [tuple(map(int,input().split())) for _ in range(n)]\n\nans = [0] * 10\nans[0] = (h-2)*(w-2)\n\nblack = set(ab)\nchecked = set()\n\nfor tmp in ab:\n a,b = tmp\n y0 = max(1,a-2)\n y1 = min(h,a+2)-1\n x0 = max(1,b-2)\n x1 = min(w,b+2)-1\n for i in range(x0,x1):\n for j in range(y0,y1):\n if ((j,i) in checked):\n continue\n tmp = 0\n for x in range(3):\n for y in range(3):\n tmp += ((j+y,i+x) in black)\n ans[0] -= 1\n ans[tmp] += 1\n checked.add((j,i))\n\nprint('\\n'.join(map(str,ans)))",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"h,w,n = map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"tuple(map(int,input().split())) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"tuple(map(int,input().split()))",
"tuple",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ab = [tuple(map(int,input().split())) for _ in range(n)]",
"ab",
"[tuple(map(int,input().split())) for _ in range(n)]",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"ans[0] = (h-2)*(w-2)",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"black = set(ab)",
"black",
"set(ab)",
"set",
"ab",
"checked = set()",
"checked",
"set()",
"set",
"for tmp in ab:\n a,b = tmp\n y0 = max(1,a-2)\n y1 = min(h,a+2)-1\n x0 = max(1,b-2)\n x1 = min(w,b+2)-1\n for i in range(x0,x1):\n for j in range(y0,y1):\n if ((j,i) in checked):\n continue\n tmp = 0\n for x in range(3):\n for y in range(3):\n tmp += ((j+y,i+x) in black)\n ans[0] -= 1\n ans[tmp] += 1\n checked.add((j,i))",
"tmp",
"ab",
"a,b = tmp",
"a",
"tmp",
"b",
"y0 = max(1,a-2)",
"y0",
"max(1,a-2)",
"max",
"1",
"a-2",
"a",
"2",
"y1 = min(h,a+2)-1",
"y1",
"min(h,a+2)-1",
"min(h,a+2)",
"min",
"h",
"a+2",
"a",
"2",
"1",
"x0 = max(1,b-2)",
"x0",
"max(1,b-2)",
"max",
"1",
"b-2",
"b",
"2",
"x1 = min(w,b+2)-1",
"x1",
"min(w,b+2)-1",
"min(w,b+2)",
"min",
"w",
"b+2",
"b",
"2",
"1",
"for i in range(x0,x1):\n for j in range(y0,y1):\n if ((j,i) in checked):\n continue\n tmp = 0\n for x in range(3):\n for y in range(3):\n tmp += ((j+y,i+x) in black)\n ans[0] -= 1\n ans[tmp] += 1\n checked.add((j,i))",
"i",
"range(x0,x1)",
"range",
"x0",
"x1",
"for j in range(y0,y1):\n if ((j,i) in checked):\n continue\n tmp = 0\n for x in range(3):\n for y in range(3):\n tmp += ((j+y,i+x) in black)\n ans[0] -= 1\n ans[tmp] += 1\n checked.add((j,i))",
"j",
"range(y0,y1)",
"range",
"y0",
"y1",
"if ((j,i) in checked):\n continue\n ",
"(j,i) in checked",
"(j,i)",
"j",
"i",
"checked",
"continue",
"tmp = 0",
"tmp",
"0",
"for x in range(3):\n for y in range(3):\n tmp += ((j+y,i+x) in black)\n ",
"x",
"range(3)",
"range",
"3",
"for y in range(3):\n tmp += ((j+y,i+x) in black)\n ",
"y",
"range(3)",
"range",
"3",
"tmp += ((j+y,i+x) in black)",
"tmp",
"(j+y,i+x) in black",
"(j+y,i+x)",
"j+y",
"j",
"y",
"i+x",
"i",
"x",
"black",
"ans[0] -= 1",
"ans[0]",
"ans",
"0",
"1",
"ans[tmp] += 1",
"ans[tmp]",
"ans",
"tmp",
"1",
"checked.add((j,i))",
"checked.add",
"checked",
"add",
"(j,i)",
"j",
"i",
"print('\\n'.join(map(str,ans)))",
"print",
"'\\n'.join(map(str,ans))",
"'\\n'.join",
"'\\n'",
"join",
"map(str,ans)",
"map",
"str",
"ans",
"y0 = max(1,a-2)",
"max(1,a-2)",
"y0",
"tmp = 0",
"0",
"tmp",
"x0 = max(1,b-2)",
"max(1,b-2)",
"x0",
"x1 = min(w,b+2)-1",
"min(w,b+2)-1",
"x1",
"w,n = map(int,input().split())",
"map(int,input().split())",
"w",
"y1 = min(h,a+2)-1",
"min(h,a+2)-1",
"y1",
"ans = [0] * 10",
"[0] * 10",
"ans",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"a,b = tmp",
"tmp",
"a",
"ab = [tuple(map(int,input().split())) for _ in range(n)]",
"[tuple(map(int,input().split())) for _ in range(n)]",
"ab",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"black = set(ab)",
"set(ab)",
"black",
"tmp += ((j+y,i+x) in black)",
"(j+y,i+x) in black",
"tmp",
"checked = set()",
"set()",
"checked",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h",
"b = tmp",
"tmp",
"b"
] | import sys
input = sys.stdin.readline
h,w,n = map(int,input().split())
ab = [tuple(map(int,input().split())) for _ in range(n)]
ans = [0] * 10
ans[0] = (h-2)*(w-2)
black = set(ab)
checked = set()
for tmp in ab:
a,b = tmp
y0 = max(1,a-2)
y1 = min(h,a+2)-1
x0 = max(1,b-2)
x1 = min(w,b+2)-1
for i in range(x0,x1):
for j in range(y0,y1):
if ((j,i) in checked):
continue
tmp = 0
for x in range(3):
for y in range(3):
tmp += ((j+y,i+x) in black)
ans[0] -= 1
ans[tmp] += 1
checked.add((j,i))
print('\n'.join(map(str,ans))) |
[
7,
15,
13,
15,
13,
15,
13,
15,
13,
15,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
14,
2,
40,
2,
2,
13,
13,
17,
17,
40,
2,
2,
13,
13,
17,
13,
28,
13,
4,
13,
17,
14,
2,
40,
2,
2,
13,
13,
17,
17,
40,
2,
2,
13,
13,
17,
13,
4,
18,
13,
13,
39,
2,
2,
13,
13,
17,
2,
2,
13,
13,
17,
4,
18,
13,
13,
0,
13,
4,
13,
13,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
4,
13,
4,
18,
17,
13,
4,
13,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13
] | [
[
173,
13
],
[
173,
22
],
[
173,
23
],
[
170,
25
],
[
29,
28
],
[
159,
31
],
[
176,
33
],
[
176,
42
],
[
45,
44
],
[
177,
53
],
[
44,
54
],
[
177,
60
],
[
44,
61
],
[
156,
63
],
[
66,
65
],
[
162,
74
],
[
65,
75
],
[
162,
81
],
[
65,
82
],
[
174,
84
],
[
171,
87
],
[
177,
92
],
[
44,
93
],
[
162,
97
],
[
65,
98
],
[
171,
102
],
[
164,
105
],
[
171,
108
],
[
167,
110
],
[
117,
116
],
[
165,
119
],
[
125,
122
],
[
168,
123
],
[
116,
124
],
[
130,
127
],
[
168,
128
],
[
156,
133
],
[
174,
136
],
[
168,
141
],
[
168,
153
],
[
173,
156
],
[
173,
159
],
[
176,
162
],
[
164,
165
],
[
167,
168
],
[
170,
171
],
[
173,
174
],
[
176,
177
]
] | [
"#coding: utf-8\nimport math\nimport heapq\nimport bisect\nimport numpy as np\nfrom collections import Counter, deque\nimport itertools\n#from scipy.misc import comb\n\nH,W,N = map(int, input().split())\n\nL = []\nfor _ in range(N):\n a,b = map(int, input().split())\n for i in range(3):\n if a+i-1 <= 1 or a+i-1 >= H: continue\n for j in range(3):\n if b+j-1 <= 1 or b+j-1 >= W: continue\n L.append((a+i-1, b+j-1))\nL.sort()\nC = Counter(L)\n\nans = [0]*10\nfor value in C.values():\n ans[value] += 1\nans[0] = (H-2)*(W-2) - sum(ans[1:])\n\nprint('\\n'.join(map(str, ans)))",
"import math",
"math",
"import heapq",
"heapq",
"import bisect",
"bisect",
"import numpy as np",
"numpy",
"from collections import Counter, deque",
"import itertools",
"itertools",
"H,W,N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"L = []",
"L",
"[]",
"for _ in range(N):\n a,b = map(int, input().split())\n for i in range(3):\n if a+i-1 <= 1 or a+i-1 >= H: continue\n for j in range(3):\n if b+j-1 <= 1 or b+j-1 >= W: continue\n L.append((a+i-1, b+j-1))",
"_",
"range(N)",
"range",
"N",
"a,b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in range(3):\n if a+i-1 <= 1 or a+i-1 >= H: continue\n for j in range(3):\n if b+j-1 <= 1 or b+j-1 >= W: continue\n L.append((a+i-1, b+j-1))",
"i",
"range(3)",
"range",
"3",
"if a+i-1 <= 1 or a+i-1 >= H: continue\n ",
"a+i-1 <= 1 or a+i-1 >= H",
"a+i-1 <= 1",
"a+i-1",
"a+i",
"a",
"i",
"1",
"1",
"a+i-1 >= H",
"a+i-1",
"a+i",
"a",
"i",
"1",
"H",
"for j in range(3):\n if b+j-1 <= 1 or b+j-1 >= W: continue\n L.append((a+i-1, b+j-1))",
"j",
"range(3)",
"range",
"3",
"if b+j-1 <= 1 or b+j-1 >= W: continue\n ",
"b+j-1 <= 1 or b+j-1 >= W",
"b+j-1 <= 1",
"b+j-1",
"b+j",
"b",
"j",
"1",
"1",
"b+j-1 >= W",
"b+j-1",
"b+j",
"b",
"j",
"1",
"W",
"L.append((a+i-1, b+j-1))",
"L.append",
"L",
"append",
"(a+i-1, b+j-1)",
"a+i-1",
"a+i",
"a",
"i",
"1",
"b+j-1",
"b+j",
"b",
"j",
"1",
"L.sort()",
"L.sort",
"L",
"sort",
"C = Counter(L)",
"C",
"Counter(L)",
"Counter",
"L",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for value in C.values():\n ans[value] += 1",
"value",
"C.values()",
"C.values",
"C",
"values",
"ans[value] += 1",
"ans[value]",
"ans",
"value",
"1",
"ans[0] = (H-2)*(W-2) - sum(ans[1:])",
"ans[0]",
"ans",
"0",
"(H-2)*(W-2) - sum(ans[1:])",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"print('\\n'.join(map(str, ans)))",
"print",
"'\\n'.join(map(str, ans))",
"'\\n'.join",
"'\\n'",
"join",
"map(str, ans)",
"map",
"str",
"ans",
"H,W,N = map(int, input().split())",
"map(int, input().split())",
"H",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"C = Counter(L)",
"Counter(L)",
"C",
"ans = [0]*10",
"[0]*10",
"ans",
"L = []",
"[]",
"L",
"W,N = map(int, input().split())",
"map(int, input().split())",
"W",
"a,b = map(int, input().split())",
"map(int, input().split())",
"a"
] | #coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
import itertools
#from scipy.misc import comb
H,W,N = map(int, input().split())
L = []
for _ in range(N):
a,b = map(int, input().split())
for i in range(3):
if a+i-1 <= 1 or a+i-1 >= H: continue
for j in range(3):
if b+j-1 <= 1 or b+j-1 >= W: continue
L.append((a+i-1, b+j-1))
L.sort()
C = Counter(L)
ans = [0]*10
for value in C.values():
ans[value] += 1
ans[0] = (H-2)*(W-2) - sum(ans[1:])
print('\n'.join(map(str, ans))) |
[
7,
17,
15,
13,
15,
12,
13,
29,
4,
18,
4,
18,
18,
13,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
39,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
13,
13,
0,
13,
2,
2,
13,
13,
17,
0,
13,
2,
2,
13,
13,
17,
14,
2,
2,
2,
17,
13,
2,
13,
17,
2,
2,
17,
13,
2,
13,
17,
0,
18,
13,
39,
13,
13,
17,
0,
13,
4,
13,
4,
18,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13
] | [
[
182,
18
],
[
171,
25
],
[
182,
27
],
[
182,
28
],
[
176,
30
],
[
167,
35
],
[
66,
65
],
[
183,
68
],
[
179,
70
],
[
171,
77
],
[
179,
79
],
[
185,
85
],
[
180,
88
],
[
188,
92
],
[
159,
95
],
[
186,
103
],
[
174,
105
],
[
189,
110
],
[
165,
112
],
[
120,
115
],
[
177,
116
],
[
161,
122
],
[
177,
127
],
[
133,
130
],
[
162,
131
],
[
174,
136
],
[
165,
139
],
[
162,
145
],
[
149,
148
],
[
162,
155
],
[
148,
156
],
[
179,
159
],
[
161,
162
],
[
182,
165
],
[
167,
168
],
[
182,
174
],
[
176,
177
],
[
179,
180
],
[
182,
183
],
[
185,
186
],
[
188,
189
]
] | [
"\"\"\"\n参考(神様)\nhttps://atcoder.jp/contests/abc045/submissions/6046010\n\"\"\"\n\n###かぶるやつを考える.例えばあるマスのかぶり値が9だとしたら,\n###周囲はすべて黒->j=9のが1つとカウントしてよい,他の値についても同様.\n\nimport sys\nfrom collections import defaultdict,Counter\n\ndef input():\n return sys.stdin.readline().strip()\n\nH,W,N = map(int,input().split())\n\ncovered = defaultdict(int)\nvector = [(0,0),(0,1),(0,-1),(1,0),(-1,0),(1,1),(-1,-1),(1,-1),(-1,1)]\n\nfor _ in range(N):\n a,b = map(int,input().split())\n\n for i,j in vector:\n x = a+i-1\n y = b+j-1\n\n if 0 < x < H-1 and 0 < y < W-1:\n covered[(x,y)] += 1\n\nnum = Counter(covered.values())\n##print(num)\nnum[0] = (H-2)*(W-2)-sum(num.values())\n\nfor i in range(10):\n print(num[i])",
"\"\"\"\n参考(神様)\nhttps://atcoder.jp/contests/abc045/submissions/6046010\n\"\"\"",
"import sys",
"sys",
"from collections import defaultdict,Counter",
"def input():\n return sys.stdin.readline().strip()",
"input",
"return sys.stdin.readline().strip()",
"sys.stdin.readline().strip()",
"sys.stdin.readline().strip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"strip",
"H,W,N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"covered = defaultdict(int)",
"covered",
"defaultdict(int)",
"defaultdict",
"int",
"vector = [(0,0),(0,1),(0,-1),(1,0),(-1,0),(1,1),(-1,-1),(1,-1),(-1,1)]",
"vector",
"[(0,0),(0,1),(0,-1),(1,0),(-1,0),(1,1),(-1,-1),(1,-1),(-1,1)]",
"(0,0)",
"0",
"0",
"(0,1)",
"0",
"1",
"(0,-1)",
"0",
"-1",
"(1,0)",
"1",
"0",
"(-1,0)",
"-1",
"0",
"(1,1)",
"1",
"1",
"(-1,-1)",
"-1",
"-1",
"(1,-1)",
"1",
"-1",
"(-1,1)",
"-1",
"1",
"for _ in range(N):\n a,b = map(int,input().split())\n\n for i,j in vector:\n x = a+i-1\n y = b+j-1\n\n if 0 < x < H-1 and 0 < y < W-1:\n covered[(x,y)] += 1",
"_",
"range(N)",
"range",
"N",
"a,b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i,j in vector:\n x = a+i-1\n y = b+j-1\n\n if 0 < x < H-1 and 0 < y < W-1:\n covered[(x,y)] += 1",
"i",
"j",
"vector",
"x = a+i-1",
"x",
"a+i-1",
"a+i",
"a",
"i",
"1",
"y = b+j-1",
"y",
"b+j-1",
"b+j",
"b",
"j",
"1",
"if 0 < x < H-1 and 0 < y < W-1:\n covered[(x,y)] += 1",
"0 < x < H-1 and 0 < y < W-1",
"0 < x < H-1",
"0 < x",
"0",
"x",
"H-1",
"H",
"1",
"0 < y < W-1",
"0 < y",
"0",
"y",
"W-1",
"W",
"1",
"covered[(x,y)] += 1",
"covered[(x,y)]",
"covered",
"(x,y)",
"x",
"y",
"1",
"num = Counter(covered.values())",
"num",
"Counter(covered.values())",
"Counter",
"covered.values()",
"covered.values",
"covered",
"values",
"num[0] = (H-2)*(W-2)-sum(num.values())",
"num[0]",
"num",
"0",
"(H-2)*(W-2)-sum(num.values())",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(num.values())",
"sum",
"num.values()",
"num.values",
"num",
"values",
"for i in range(10):\n print(num[i])",
"i",
"range(10)",
"range",
"10",
"print(num[i])",
"print",
"num[i]",
"num",
"i",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"num = Counter(covered.values())",
"Counter(covered.values())",
"num",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"vector = [(0,0),(0,1),(0,-1),(1,0),(-1,0),(1,1),(-1,-1),(1,-1),(-1,1)]",
"[(0,0),(0,1),(0,-1),(1,0),(-1,0),(1,1),(-1,-1),(1,-1),(-1,1)]",
"vector",
"def input():\n return sys.stdin.readline().strip()",
"def input():\n return sys.stdin.readline().strip()",
"input",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"covered = defaultdict(int)",
"defaultdict(int)",
"covered",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"x = a+i-1",
"a+i-1",
"x",
"y = b+j-1",
"b+j-1",
"y"
] | """
参考(神様)
https://atcoder.jp/contests/abc045/submissions/6046010
"""
###かぶるやつを考える.例えばあるマスのかぶり値が9だとしたら,
###周囲はすべて黒->j=9のが1つとカウントしてよい,他の値についても同様.
import sys
from collections import defaultdict,Counter
def input():
return sys.stdin.readline().strip()
H,W,N = map(int,input().split())
covered = defaultdict(int)
vector = [(0,0),(0,1),(0,-1),(1,0),(-1,0),(1,1),(-1,-1),(1,-1),(-1,1)]
for _ in range(N):
a,b = map(int,input().split())
for i,j in vector:
x = a+i-1
y = b+j-1
if 0 < x < H-1 and 0 < y < W-1:
covered[(x,y)] += 1
num = Counter(covered.values())
##print(num)
num[0] = (H-2)*(W-2)-sum(num.values())
for i in range(10):
print(num[i]) |
[
7,
15,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
4,
39,
13,
13,
0,
13,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
13,
14,
2,
2,
2,
13,
18,
13,
17,
17,
2,
2,
13,
17,
2,
13,
18,
13,
17,
9,
14,
2,
2,
2,
13,
18,
13,
17,
17,
2,
2,
13,
17,
2,
13,
18,
13,
17,
9,
0,
18,
13,
39,
2,
2,
13,
17,
18,
13,
17,
2,
2,
13,
17,
18,
13,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
6,
5
],
[
6,
14
],
[
6,
15
],
[
19,
18
],
[
25,
24
],
[
35,
34
],
[
38,
37
],
[
46,
43
],
[
37,
44
],
[
5,
48
],
[
14,
51
],
[
55,
54
],
[
60,
59
],
[
15,
62
],
[
65,
64
],
[
65,
73
],
[
76,
75
],
[
34,
75
],
[
64,
81
],
[
75,
83
],
[
5,
88
],
[
64,
91
],
[
75,
93
],
[
73,
100
],
[
75,
102
],
[
14,
107
],
[
73,
110
],
[
75,
112
],
[
133,
116
],
[
54,
117
],
[
64,
121
],
[
75,
124
],
[
73,
128
],
[
75,
131
],
[
136,
135
],
[
54,
138
],
[
144,
141
],
[
37,
142
],
[
135,
143
],
[
149,
146
],
[
37,
147
],
[
152,
151
],
[
37,
158
],
[
151,
159
],
[
168,
165
]
] | [
"from collections import defaultdict\ndef main():\n\tH, W, N = map(int, input().split())\n\toffset = [[i, j] for i in range(-1, 2) for j in range(-1, 2)]\n\tans = [0]*10\n\tans[0] = (H-2)*(W-2)\n\tmemo = defaultdict(int)\n\tfor i in range(N):\n\t\ta, b = map(int, input().split())\n\t\tfor o in offset:\n\t\t\tif a+o[0] < 2 or H-1 < a+o[0]:\n\t\t\t\tcontinue\n\t\t\tif b+o[1] < 2 or W-1 < b+o[1]:\n\t\t\t\tcontinue\n\t\t\tmemo[(a-1+o[0], b-1+o[1])] += 1\n\tfor v in memo.values():\n\t\tans[v] += 1\n\t\tans[0] -= 1\n\n\tfor i in range(10):\n\t\tprint(ans[i])\n\n\nif __name__ == '__main__':\n\tmain()",
"from collections import defaultdict",
"def main():\n\tH, W, N = map(int, input().split())\n\toffset = [[i, j] for i in range(-1, 2) for j in range(-1, 2)]\n\tans = [0]*10\n\tans[0] = (H-2)*(W-2)\n\tmemo = defaultdict(int)\n\tfor i in range(N):\n\t\ta, b = map(int, input().split())\n\t\tfor o in offset:\n\t\t\tif a+o[0] < 2 or H-1 < a+o[0]:\n\t\t\t\tcontinue\n\t\t\tif b+o[1] < 2 or W-1 < b+o[1]:\n\t\t\t\tcontinue\n\t\t\tmemo[(a-1+o[0], b-1+o[1])] += 1\n\tfor v in memo.values():\n\t\tans[v] += 1\n\t\tans[0] -= 1\n\n\tfor i in range(10):\n\t\tprint(ans[i])",
"main",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"[i, j] for i in range(-1, 2) for j in range(-1, 2)",
"for i in range(-1, 2) for j in range(-1, 2)",
"i",
"range(-1, 2)",
"range",
"-1",
"2",
"for j in range(-1, 2)",
"j",
"range(-1, 2)",
"range",
"-1",
"2",
"for j in range(-1, 2)",
"[i, j]",
"i",
"j",
"offset = [[i, j] for i in range(-1, 2) for j in range(-1, 2)]",
"offset",
"[[i, j] for i in range(-1, 2) for j in range(-1, 2)]",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"ans[0] = (H-2)*(W-2)",
"ans[0]",
"ans",
"0",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"memo = defaultdict(int)",
"memo",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n\t\ta, b = map(int, input().split())\n\t\tfor o in offset:\n\t\t\tif a+o[0] < 2 or H-1 < a+o[0]:\n\t\t\t\tcontinue\n\t\t\tif b+o[1] < 2 or W-1 < b+o[1]:\n\t\t\t\tcontinue\n\t\t\tmemo[(a-1+o[0], b-1+o[1])] += 1\n\t",
"i",
"range(N)",
"range",
"N",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for o in offset:\n\t\t\tif a+o[0] < 2 or H-1 < a+o[0]:\n\t\t\t\tcontinue\n\t\t\tif b+o[1] < 2 or W-1 < b+o[1]:\n\t\t\t\tcontinue\n\t\t\tmemo[(a-1+o[0], b-1+o[1])] += 1\n\t",
"o",
"offset",
"if a+o[0] < 2 or H-1 < a+o[0]:\n\t\t\t\tcontinue\n\t\t\t",
"a+o[0] < 2 or H-1 < a+o[0]",
"a+o[0] < 2",
"a+o[0]",
"a",
"o[0]",
"o",
"0",
"2",
"H-1 < a+o[0]",
"H-1",
"H",
"1",
"a+o[0]",
"a",
"o[0]",
"o",
"0",
"continue",
"if b+o[1] < 2 or W-1 < b+o[1]:\n\t\t\t\tcontinue\n\t\t\t",
"b+o[1] < 2 or W-1 < b+o[1]",
"b+o[1] < 2",
"b+o[1]",
"b",
"o[1]",
"o",
"1",
"2",
"W-1 < b+o[1]",
"W-1",
"W",
"1",
"b+o[1]",
"b",
"o[1]",
"o",
"1",
"continue",
"memo[(a-1+o[0], b-1+o[1])] += 1",
"memo[(a-1+o[0], b-1+o[1])]",
"memo",
"(a-1+o[0], b-1+o[1])",
"a-1+o[0]",
"a-1",
"a",
"1",
"o[0]",
"o",
"0",
"b-1+o[1]",
"b-1",
"b",
"1",
"o[1]",
"o",
"1",
"1",
"for v in memo.values():\n\t\tans[v] += 1\n\t\tans[0] -= 1\n\n\t",
"v",
"memo.values()",
"memo.values",
"memo",
"values",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"ans[0] -= 1",
"ans[0]",
"ans",
"0",
"1",
"for i in range(10):\n\t\tprint(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"if __name__ == '__main__':\n\tmain()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n\tH, W, N = map(int, input().split())\n\toffset = [[i, j] for i in range(-1, 2) for j in range(-1, 2)]\n\tans = [0]*10\n\tans[0] = (H-2)*(W-2)\n\tmemo = defaultdict(int)\n\tfor i in range(N):\n\t\ta, b = map(int, input().split())\n\t\tfor o in offset:\n\t\t\tif a+o[0] < 2 or H-1 < a+o[0]:\n\t\t\t\tcontinue\n\t\t\tif b+o[1] < 2 or W-1 < b+o[1]:\n\t\t\t\tcontinue\n\t\t\tmemo[(a-1+o[0], b-1+o[1])] += 1\n\tfor v in memo.values():\n\t\tans[v] += 1\n\t\tans[0] -= 1\n\n\tfor i in range(10):\n\t\tprint(ans[i])",
"def main():\n\tH, W, N = map(int, input().split())\n\toffset = [[i, j] for i in range(-1, 2) for j in range(-1, 2)]\n\tans = [0]*10\n\tans[0] = (H-2)*(W-2)\n\tmemo = defaultdict(int)\n\tfor i in range(N):\n\t\ta, b = map(int, input().split())\n\t\tfor o in offset:\n\t\t\tif a+o[0] < 2 or H-1 < a+o[0]:\n\t\t\t\tcontinue\n\t\t\tif b+o[1] < 2 or W-1 < b+o[1]:\n\t\t\t\tcontinue\n\t\t\tmemo[(a-1+o[0], b-1+o[1])] += 1\n\tfor v in memo.values():\n\t\tans[v] += 1\n\t\tans[0] -= 1\n\n\tfor i in range(10):\n\t\tprint(ans[i])",
"main"
] | from collections import defaultdict
def main():
H, W, N = map(int, input().split())
offset = [[i, j] for i in range(-1, 2) for j in range(-1, 2)]
ans = [0]*10
ans[0] = (H-2)*(W-2)
memo = defaultdict(int)
for i in range(N):
a, b = map(int, input().split())
for o in offset:
if a+o[0] < 2 or H-1 < a+o[0]:
continue
if b+o[1] < 2 or W-1 < b+o[1]:
continue
memo[(a-1+o[0], b-1+o[1])] += 1
for v in memo.values():
ans[v] += 1
ans[0] -= 1
for i in range(10):
print(ans[i])
if __name__ == '__main__':
main() |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
14,
2,
2,
2,
2,
13,
13,
17,
17,
2,
2,
2,
13,
13,
17,
2,
13,
17,
9,
28,
13,
4,
13,
17,
14,
2,
2,
2,
2,
13,
17,
13,
17,
2,
2,
2,
13,
17,
13,
2,
13,
17,
9,
0,
18,
13,
39,
2,
2,
13,
17,
13,
2,
2,
13,
17,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
4,
13,
31,
13,
0,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] | [
[
157,
3
],
[
157,
12
],
[
157,
13
],
[
154,
15
],
[
21,
20
],
[
158,
23
],
[
145,
25
],
[
145,
34
],
[
37,
36
],
[
146,
45
],
[
36,
46
],
[
146,
52
],
[
36,
53
],
[
149,
56
],
[
61,
60
],
[
143,
69
],
[
60,
71
],
[
143,
76
],
[
60,
78
],
[
152,
80
],
[
97,
84
],
[
155,
85
],
[
146,
89
],
[
36,
91
],
[
143,
94
],
[
60,
96
],
[
160,
99
],
[
155,
109
],
[
115,
112
],
[
161,
113
],
[
120,
117
],
[
161,
118
],
[
149,
123
],
[
152,
126
],
[
161,
131
],
[
161,
137
],
[
140,
139
],
[
145,
143
],
[
145,
146
],
[
157,
149
],
[
157,
152
],
[
154,
155
],
[
157,
158
],
[
160,
161
]
] | [
"from collections import defaultdict\n\nh, w, n = map(int, input().split())\ncount = defaultdict(int)\n# 3*3の左上の位置でカウント\nfor i in range(n):\n a, b = map(int, input().split())\n for s in range(3):\n if a + s - 2 < 1 or a + s - 2 > h - 2:\n continue\n for t in range(3):\n if b - 2 + t < 1 or b - 2 + t > w - 2:\n continue\n count[(a - 2 + s, b - 2 + t)] += 1\nans = [0] * 10\nfor key, val in count.items():\n ans[val] += 1\nans[0] = (h - 2) * (w - 2) - sum(ans[1:])\nprint(*ans, sep=\"\\n\")",
"from collections import defaultdict",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"count = defaultdict(int)",
"count",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(n):\n a, b = map(int, input().split())\n for s in range(3):\n if a + s - 2 < 1 or a + s - 2 > h - 2:\n continue\n for t in range(3):\n if b - 2 + t < 1 or b - 2 + t > w - 2:\n continue\n count[(a - 2 + s, b - 2 + t)] += 1",
"i",
"range(n)",
"range",
"n",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for s in range(3):\n if a + s - 2 < 1 or a + s - 2 > h - 2:\n continue\n for t in range(3):\n if b - 2 + t < 1 or b - 2 + t > w - 2:\n continue\n count[(a - 2 + s, b - 2 + t)] += 1",
"s",
"range(3)",
"range",
"3",
"if a + s - 2 < 1 or a + s - 2 > h - 2:\n continue\n ",
"a + s - 2 < 1 or a + s - 2 > h - 2",
"a + s - 2 < 1",
"a + s - 2",
"a + s",
"a",
"s",
"2",
"1",
"a + s - 2 > h - 2",
"a + s - 2",
"a + s",
"a",
"s",
"2",
"h - 2",
"h",
"2",
"continue",
"for t in range(3):\n if b - 2 + t < 1 or b - 2 + t > w - 2:\n continue\n count[(a - 2 + s, b - 2 + t)] += 1",
"t",
"range(3)",
"range",
"3",
"if b - 2 + t < 1 or b - 2 + t > w - 2:\n continue\n ",
"b - 2 + t < 1 or b - 2 + t > w - 2",
"b - 2 + t < 1",
"b - 2 + t",
"b - 2",
"b",
"2",
"t",
"1",
"b - 2 + t > w - 2",
"b - 2 + t",
"b - 2",
"b",
"2",
"t",
"w - 2",
"w",
"2",
"continue",
"count[(a - 2 + s, b - 2 + t)] += 1",
"count[(a - 2 + s, b - 2 + t)]",
"count",
"(a - 2 + s, b - 2 + t)",
"a - 2 + s",
"a - 2",
"a",
"2",
"s",
"b - 2 + t",
"b - 2",
"b",
"2",
"t",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for key, val in count.items():\n ans[val] += 1",
"key",
"val",
"count.items()",
"count.items",
"count",
"items",
"ans[val] += 1",
"ans[val]",
"ans",
"val",
"1",
"ans[0] = (h - 2) * (w - 2) - sum(ans[1:])",
"ans[0]",
"ans",
"0",
"(h - 2) * (w - 2) - sum(ans[1:])",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"print(*ans, sep=\"\\n\")",
"print",
"*ans",
"ans",
"sep=\"\\n\"",
"sep",
"\"\\n\"",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"count = defaultdict(int)",
"defaultdict(int)",
"count",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"ans = [0] * 10",
"[0] * 10",
"ans"
] | from collections import defaultdict
h, w, n = map(int, input().split())
count = defaultdict(int)
# 3*3の左上の位置でカウント
for i in range(n):
a, b = map(int, input().split())
for s in range(3):
if a + s - 2 < 1 or a + s - 2 > h - 2:
continue
for t in range(3):
if b - 2 + t < 1 or b - 2 + t > w - 2:
continue
count[(a - 2 + s, b - 2 + t)] += 1
ans = [0] * 10
for key, val in count.items():
ans[val] += 1
ans[0] = (h - 2) * (w - 2) - sum(ans[1:])
print(*ans, sep="\n")
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
15,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
17,
4,
13,
17,
0,
13,
13,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
4,
13,
17,
2,
13,
17,
0,
13,
4,
13,
2,
13,
17,
13,
0,
13,
4,
13,
17,
2,
13,
17,
0,
13,
4,
13,
2,
13,
17,
13,
28,
13,
4,
13,
13,
2,
13,
17,
28,
13,
4,
13,
13,
2,
13,
17,
0,
18,
13,
18,
13,
39,
13,
13,
17,
0,
18,
13,
39,
13,
13,
17,
0,
18,
13,
18,
13,
39,
13,
13,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
186,
2
],
[
186,
11
],
[
186,
12
],
[
16,
15
],
[
160,
18
],
[
168,
31
],
[
156,
35
],
[
42,
41
],
[
41,
46
],
[
180,
49
],
[
55,
52
],
[
181,
53
],
[
175,
57
],
[
187,
60
],
[
171,
67
],
[
177,
70
],
[
162,
73
],
[
172,
78
],
[
189,
81
],
[
175,
85
],
[
172,
87
],
[
165,
89
],
[
178,
94
],
[
183,
97
],
[
187,
101
],
[
178,
103
],
[
106,
105
],
[
163,
108
],
[
190,
110
],
[
114,
113
],
[
166,
116
],
[
184,
118
],
[
128,
121
],
[
181,
122
],
[
157,
124
],
[
135,
130
],
[
157,
131
],
[
144,
137
],
[
181,
138
],
[
157,
140
],
[
147,
146
],
[
181,
153
],
[
146,
154
],
[
156,
157
],
[
186,
160
],
[
162,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
],
[
186,
175
],
[
177,
178
],
[
180,
181
],
[
183,
184
],
[
186,
187
],
[
189,
190
]
] | [
"h,w,n=map(int,input().split())\nab=[list(map(int,input().split())) for _ in range(n)]\nfrom collections import defaultdict\ndct=defaultdict(int)\nans={i:0 for i in range(10)}\nans[0]=(h-2)*(w-2)\nfor a,b in ab:\n a-=1\n b-=1\n u=max(0,a-2)\n d=min(h-3,a)\n l=max(0,b-2)\n r=min(w-3,b)\n for i in range(u,d+1):\n for j in range(l,r+1):\n ans[dct[(i,j)]]-=1\n dct[(i,j)]+=1\n ans[dct[(i,j)]]+=1\nfor i in range(10):\n print(ans[i])",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"list(map(int,input().split())) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ab=[list(map(int,input().split())) for _ in range(n)]",
"ab",
"[list(map(int,input().split())) for _ in range(n)]",
"from collections import defaultdict",
"dct=defaultdict(int)",
"dct",
"defaultdict(int)",
"defaultdict",
"int",
"i:0 for i in range(10)",
"for i in range(10)",
"i",
"range(10)",
"range",
"10",
"for i in range(10)",
"i",
"0",
"ans={i:0 for i in range(10)}",
"ans",
"{i:0 for i in range(10)}",
"ans[0]=(h-2)*(w-2)",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"for a,b in ab:\n a-=1\n b-=1\n u=max(0,a-2)\n d=min(h-3,a)\n l=max(0,b-2)\n r=min(w-3,b)\n for i in range(u,d+1):\n for j in range(l,r+1):\n ans[dct[(i,j)]]-=1\n dct[(i,j)]+=1\n ans[dct[(i,j)]]+=1",
"a",
"b",
"ab",
"a-=1",
"a",
"1",
"b-=1",
"b",
"1",
"u=max(0,a-2)",
"u",
"max(0,a-2)",
"max",
"0",
"a-2",
"a",
"2",
"d=min(h-3,a)",
"d",
"min(h-3,a)",
"min",
"h-3",
"h",
"3",
"a",
"l=max(0,b-2)",
"l",
"max(0,b-2)",
"max",
"0",
"b-2",
"b",
"2",
"r=min(w-3,b)",
"r",
"min(w-3,b)",
"min",
"w-3",
"w",
"3",
"b",
"for i in range(u,d+1):\n for j in range(l,r+1):\n ans[dct[(i,j)]]-=1\n dct[(i,j)]+=1\n ans[dct[(i,j)]]+=1",
"i",
"range(u,d+1)",
"range",
"u",
"d+1",
"d",
"1",
"for j in range(l,r+1):\n ans[dct[(i,j)]]-=1\n dct[(i,j)]+=1\n ans[dct[(i,j)]]+=1",
"j",
"range(l,r+1)",
"range",
"l",
"r+1",
"r",
"1",
"ans[dct[(i,j)]]-=1",
"ans[dct[(i,j)]]",
"ans",
"dct[(i,j)]",
"dct",
"(i,j)",
"i",
"j",
"1",
"dct[(i,j)]+=1",
"dct[(i,j)]",
"dct",
"(i,j)",
"i",
"j",
"1",
"ans[dct[(i,j)]]+=1",
"ans[dct[(i,j)]]",
"ans",
"dct[(i,j)]",
"dct",
"(i,j)",
"i",
"j",
"1",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"dct=defaultdict(int)",
"defaultdict(int)",
"dct",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"u=max(0,a-2)",
"max(0,a-2)",
"u",
"l=max(0,b-2)",
"max(0,b-2)",
"l",
"ab=[list(map(int,input().split())) for _ in range(n)]",
"[list(map(int,input().split())) for _ in range(n)]",
"ab",
"a-=1",
"1",
"a",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"b-=1",
"1",
"b",
"ans={i:0 for i in range(10)}",
"{i:0 for i in range(10)}",
"ans",
"r=min(w-3,b)",
"min(w-3,b)",
"r",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"d=min(h-3,a)",
"min(h-3,a)",
"d"
] | h,w,n=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
from collections import defaultdict
dct=defaultdict(int)
ans={i:0 for i in range(10)}
ans[0]=(h-2)*(w-2)
for a,b in ab:
a-=1
b-=1
u=max(0,a-2)
d=min(h-3,a)
l=max(0,b-2)
r=min(w-3,b)
for i in range(u,d+1):
for j in range(l,r+1):
ans[dct[(i,j)]]-=1
dct[(i,j)]+=1
ans[dct[(i,j)]]+=1
for i in range(10):
print(ans[i])
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
2,
4,
13,
13,
2,
13,
17,
17,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
2,
4,
13,
13,
2,
13,
17,
17,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
4,
18,
13,
13,
14,
2,
40,
40,
17,
18,
13,
17,
2,
13,
17,
40,
40,
17,
18,
13,
17,
2,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
156,
3
],
[
156,
12
],
[
156,
13
],
[
153,
15
],
[
21,
20
],
[
157,
23
],
[
144,
25
],
[
144,
34
],
[
37,
36
],
[
139,
43
],
[
142,
48
],
[
139,
50
],
[
55,
54
],
[
145,
61
],
[
151,
66
],
[
145,
68
],
[
77,
72
],
[
154,
73
],
[
147,
79
],
[
154,
89
],
[
142,
100
],
[
151,
109
],
[
115,
112
],
[
148,
113
],
[
120,
117
],
[
148,
118
],
[
142,
123
],
[
151,
126
],
[
148,
130
],
[
133,
132
],
[
148,
132
],
[
132,
136
],
[
144,
139
],
[
156,
142
],
[
144,
145
],
[
147,
148
],
[
156,
151
],
[
153,
154
],
[
156,
157
]
] | [
"from collections import defaultdict\n\nH, W, N = map(int, input().split())\n\nmem = defaultdict(int)\nfor _ in range(N) :\n a, b = map(int, input().split())\n for i in range(max(1, a-1), min(H, a+1)+1) :\n for j in range(max(1, b-1), min(W, b+1)+1) :\n mem[(i, j)] += 1\n \nret = [0] * 10\nfor k, v in mem.items() :\n if 2 <= k[0] <= H - 1 and 2 <= k[1] <= W - 1 :\n ret[v] += 1\n\nret[0] = (H - 2) * (W - 2) - sum(ret)\n \nfor r in ret :\n print(r)",
"from collections import defaultdict",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"mem = defaultdict(int)",
"mem",
"defaultdict(int)",
"defaultdict",
"int",
"for _ in range(N) :\n a, b = map(int, input().split())\n for i in range(max(1, a-1), min(H, a+1)+1) :\n for j in range(max(1, b-1), min(W, b+1)+1) :\n mem[(i, j)] += 1\n ",
"_",
"range(N)",
"range",
"N",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in range(max(1, a-1), min(H, a+1)+1) :\n for j in range(max(1, b-1), min(W, b+1)+1) :\n mem[(i, j)] += 1\n ",
"i",
"range(max(1, a-1), min(H, a+1)+1)",
"range",
"max(1, a-1)",
"max",
"1",
"a-1",
"a",
"1",
"min(H, a+1)+1",
"min(H, a+1)",
"min",
"H",
"a+1",
"a",
"1",
"1",
"for j in range(max(1, b-1), min(W, b+1)+1) :\n mem[(i, j)] += 1\n ",
"j",
"range(max(1, b-1), min(W, b+1)+1)",
"range",
"max(1, b-1)",
"max",
"1",
"b-1",
"b",
"1",
"min(W, b+1)+1",
"min(W, b+1)",
"min",
"W",
"b+1",
"b",
"1",
"1",
"mem[(i, j)] += 1",
"mem[(i, j)]",
"mem",
"(i, j)",
"i",
"j",
"1",
"ret = [0] * 10",
"ret",
"[0] * 10",
"[0]",
"0",
"10",
"for k, v in mem.items() :\n if 2 <= k[0] <= H - 1 and 2 <= k[1] <= W - 1 :\n ret[v] += 1",
"k",
"v",
"mem.items()",
"mem.items",
"mem",
"items",
"if 2 <= k[0] <= H - 1 and 2 <= k[1] <= W - 1 :\n ret[v] += 1",
"2 <= k[0] <= H - 1 and 2 <= k[1] <= W - 1",
"2 <= k[0] <= H - 1",
"2 <= k[0]",
"2",
"k[0]",
"k",
"0",
"H - 1",
"H",
"1",
"2 <= k[1] <= W - 1",
"2 <= k[1]",
"2",
"k[1]",
"k",
"1",
"W - 1",
"W",
"1",
"ret[v] += 1",
"ret[v]",
"ret",
"v",
"1",
"ret[0] = (H - 2) * (W - 2) - sum(ret)",
"ret[0]",
"ret",
"0",
"(H - 2) * (W - 2) - sum(ret)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(ret)",
"sum",
"ret",
"for r in ret :\n print(r)",
"r",
"ret",
"print(r)",
"print",
"r",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"ret = [0] * 10",
"[0] * 10",
"ret",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"mem = defaultdict(int)",
"defaultdict(int)",
"mem",
"N = map(int, input().split())",
"map(int, input().split())",
"N"
] | from collections import defaultdict
H, W, N = map(int, input().split())
mem = defaultdict(int)
for _ in range(N) :
a, b = map(int, input().split())
for i in range(max(1, a-1), min(H, a+1)+1) :
for j in range(max(1, b-1), min(W, b+1)+1) :
mem[(i, j)] += 1
ret = [0] * 10
for k, v in mem.items() :
if 2 <= k[0] <= H - 1 and 2 <= k[1] <= W - 1 :
ret[v] += 1
ret[0] = (H - 2) * (W - 2) - sum(ret)
for r in ret :
print(r)
|
[
7,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
13,
2,
13,
17,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
13,
2,
13,
17,
14,
2,
39,
13,
13,
13,
0,
18,
13,
39,
13,
13,
17,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
0,
13,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
5,
4
],
[
5,
13
],
[
5,
14
],
[
17,
16
],
[
20,
19
],
[
14,
22
],
[
25,
24
],
[
25,
33
],
[
36,
35
],
[
24,
42
],
[
4,
46
],
[
24,
48
],
[
52,
51
],
[
33,
58
],
[
13,
62
],
[
33,
64
],
[
16,
71
],
[
78,
73
],
[
16,
74
],
[
85,
80
],
[
16,
81
],
[
88,
87
],
[
94,
93
],
[
97,
96
],
[
16,
99
],
[
105,
102
],
[
87,
103
],
[
96,
104
],
[
108,
107
],
[
113,
110
],
[
87,
111
],
[
4,
116
],
[
13,
119
],
[
107,
121
],
[
93,
121
],
[
124,
123
],
[
87,
130
],
[
123,
131
],
[
140,
137
]
] | [
"def main():\n h, w, n = map(int, input().split())\n dic = {}\n for _ in range(n):\n a, b = map(int, input().split())\n for i in range(max(2, a-1), min(h, a+2)):\n for j in range(max(2, b-1), min(w, b+2)):\n if (i, j) in dic:\n dic[(i, j)] += 1\n else:\n dic[(i, j)] = 1\n ans = [0]*10\n cnt = 0\n for v in dic.values():\n ans[v] += 1\n cnt += 1\n ans[0] = (h-2)*(w-2) - cnt\n for i in range(10):\n print(ans[i])\n\nif __name__ == \"__main__\":\n main()",
"def main():\n h, w, n = map(int, input().split())\n dic = {}\n for _ in range(n):\n a, b = map(int, input().split())\n for i in range(max(2, a-1), min(h, a+2)):\n for j in range(max(2, b-1), min(w, b+2)):\n if (i, j) in dic:\n dic[(i, j)] += 1\n else:\n dic[(i, j)] = 1\n ans = [0]*10\n cnt = 0\n for v in dic.values():\n ans[v] += 1\n cnt += 1\n ans[0] = (h-2)*(w-2) - cnt\n for i in range(10):\n print(ans[i])",
"main",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"dic = {}",
"dic",
"{}",
"for _ in range(n):\n a, b = map(int, input().split())\n for i in range(max(2, a-1), min(h, a+2)):\n for j in range(max(2, b-1), min(w, b+2)):\n if (i, j) in dic:\n dic[(i, j)] += 1\n else:\n dic[(i, j)] = 1\n ",
"_",
"range(n)",
"range",
"n",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in range(max(2, a-1), min(h, a+2)):\n for j in range(max(2, b-1), min(w, b+2)):\n if (i, j) in dic:\n dic[(i, j)] += 1\n else:\n dic[(i, j)] = 1\n ",
"i",
"range(max(2, a-1), min(h, a+2))",
"range",
"max(2, a-1)",
"max",
"2",
"a-1",
"a",
"1",
"min(h, a+2)",
"min",
"h",
"a+2",
"a",
"2",
"for j in range(max(2, b-1), min(w, b+2)):\n if (i, j) in dic:\n dic[(i, j)] += 1\n else:\n dic[(i, j)] = 1\n ",
"j",
"range(max(2, b-1), min(w, b+2))",
"range",
"max(2, b-1)",
"max",
"2",
"b-1",
"b",
"1",
"min(w, b+2)",
"min",
"w",
"b+2",
"b",
"2",
"if (i, j) in dic:\n dic[(i, j)] += 1\n else:\n dic[(i, j)] = 1\n ",
"(i, j) in dic",
"(i, j)",
"i",
"j",
"dic",
"dic[(i, j)] += 1",
"dic[(i, j)]",
"dic",
"(i, j)",
"i",
"j",
"1",
"dic[(i, j)] = 1",
"dic[(i, j)]",
"dic",
"(i, j)",
"i",
"j",
"1",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"cnt = 0",
"cnt",
"0",
"for v in dic.values():\n ans[v] += 1\n cnt += 1\n ",
"v",
"dic.values()",
"dic.values",
"dic",
"values",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"cnt += 1",
"cnt",
"1",
"ans[0] = (h-2)*(w-2) - cnt",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2) - cnt",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"cnt",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n h, w, n = map(int, input().split())\n dic = {}\n for _ in range(n):\n a, b = map(int, input().split())\n for i in range(max(2, a-1), min(h, a+2)):\n for j in range(max(2, b-1), min(w, b+2)):\n if (i, j) in dic:\n dic[(i, j)] += 1\n else:\n dic[(i, j)] = 1\n ans = [0]*10\n cnt = 0\n for v in dic.values():\n ans[v] += 1\n cnt += 1\n ans[0] = (h-2)*(w-2) - cnt\n for i in range(10):\n print(ans[i])",
"def main():\n h, w, n = map(int, input().split())\n dic = {}\n for _ in range(n):\n a, b = map(int, input().split())\n for i in range(max(2, a-1), min(h, a+2)):\n for j in range(max(2, b-1), min(w, b+2)):\n if (i, j) in dic:\n dic[(i, j)] += 1\n else:\n dic[(i, j)] = 1\n ans = [0]*10\n cnt = 0\n for v in dic.values():\n ans[v] += 1\n cnt += 1\n ans[0] = (h-2)*(w-2) - cnt\n for i in range(10):\n print(ans[i])",
"main"
] | def main():
h, w, n = map(int, input().split())
dic = {}
for _ in range(n):
a, b = map(int, input().split())
for i in range(max(2, a-1), min(h, a+2)):
for j in range(max(2, b-1), min(w, b+2)):
if (i, j) in dic:
dic[(i, j)] += 1
else:
dic[(i, j)] = 1
ans = [0]*10
cnt = 0
for v in dic.values():
ans[v] += 1
cnt += 1
ans[0] = (h-2)*(w-2) - cnt
for i in range(10):
print(ans[i])
if __name__ == "__main__":
main() |
[
7,
15,
15,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
12,
2,
4,
13,
13,
17,
23,
0,
13,
12,
4,
13,
31,
13,
0,
13,
17,
23,
12,
13,
12,
13,
12,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
12,
13,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
0,
18,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
4,
13,
31,
13,
0,
13,
17,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13
] | [
[
167,
12
],
[
173,
21
],
[
29,
28
],
[
42,
41
],
[
153,
47
],
[
51,
51
],
[
185,
55
],
[
177,
57
],
[
185,
58
],
[
185,
59
],
[
191,
61
],
[
67,
66
],
[
186,
69
],
[
164,
71
],
[
180,
73
],
[
164,
74
],
[
77,
76
],
[
165,
83
],
[
162,
88
],
[
165,
91
],
[
95,
94
],
[
156,
101
],
[
183,
106
],
[
156,
109
],
[
115,
112
],
[
192,
113
],
[
76,
114
],
[
170,
117
],
[
192,
127
],
[
133,
130
],
[
171,
131
],
[
162,
136
],
[
183,
139
],
[
171,
143
],
[
171,
147
],
[
150,
149
],
[
164,
156
],
[
185,
162
],
[
164,
165
],
[
167,
168
],
[
170,
171
],
[
173,
174
],
[
185,
183
],
[
185,
186
],
[
191,
192
]
] | [
"from collections import defaultdict\nimport sys\n\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\np2D = lambda x: print(*x, sep=\"\\n\")\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\ndef MI1(): return map(int1, sys.stdin.readline().split())\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef SI(): return sys.stdin.readline()[:-1]\n\nh,w,n=MI()\nsq=defaultdict(int)\nfor _ in range(n):\n a,b=MI1()\n for i in range(max(0,a-2),min(h-2,a+1)):\n for j in range(max(0,b-2),min(w-2,b+1)):\n sq[i,j]+=1\ncnt=[0]*10\nfor k,v in sq.items():cnt[v]+=1\ncnt[0]=(h-2)*(w-2)-sum(cnt)\nprint(*cnt,sep=\"\\n\")",
"from collections import defaultdict",
"import sys",
"sys",
"sys.setrecursionlimit(10 ** 6)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 6",
"10",
"6",
"int1 = lambda x: int(x) - 1",
"int1",
"lambda x: int(x) - 1",
"int(x) - 1",
"int(x)",
"int",
"x",
"1",
"x",
"p2D = lambda x: print(*x, sep=\"\\n\")",
"p2D",
"lambda x: print(*x, sep=\"\\n\")",
"print(*x, sep=\"\\n\")",
"print",
"*x",
"x",
"sep=\"\\n\"",
"sep",
"\"\\n\"",
"x",
"def II(): return int(sys.stdin.readline())",
"II",
"def MI(): return map(int, sys.stdin.readline().split())",
"MI",
"def MI1(): return map(int1, sys.stdin.readline().split())",
"MI1",
"def LI(): return list(map(int, sys.stdin.readline().split()))",
"LI",
"LI() for _ in range(rows_number)",
"for _ in range(rows_number)",
"_",
"range(rows_number)",
"range",
"rows_number",
"for _ in range(rows_number)",
"LI()",
"LI",
"def LLI(rows_number): return [LI() for _ in range(rows_number)]",
"LLI",
"rows_number",
"rows_number",
"def SI(): return sys.stdin.readline()[:-1]",
"SI",
"h,w,n=MI()",
"h",
"MI()",
"MI",
"w",
"n",
"sq=defaultdict(int)",
"sq",
"defaultdict(int)",
"defaultdict",
"int",
"for _ in range(n):\n a,b=MI1()\n for i in range(max(0,a-2),min(h-2,a+1)):\n for j in range(max(0,b-2),min(w-2,b+1)):\n sq[i,j]+=1",
"_",
"range(n)",
"range",
"n",
"a,b=MI1()",
"a",
"MI1()",
"MI1",
"b",
"for i in range(max(0,a-2),min(h-2,a+1)):\n for j in range(max(0,b-2),min(w-2,b+1)):\n sq[i,j]+=1",
"i",
"range(max(0,a-2),min(h-2,a+1))",
"range",
"max(0,a-2)",
"max",
"0",
"a-2",
"a",
"2",
"min(h-2,a+1)",
"min",
"h-2",
"h",
"2",
"a+1",
"a",
"1",
"for j in range(max(0,b-2),min(w-2,b+1)):\n sq[i,j]+=1",
"j",
"range(max(0,b-2),min(w-2,b+1))",
"range",
"max(0,b-2)",
"max",
"0",
"b-2",
"b",
"2",
"min(w-2,b+1)",
"min",
"w-2",
"w",
"2",
"b+1",
"b",
"1",
"sq[i,j]+=1",
"sq[i,j]",
"sq",
"i",
"1",
"cnt=[0]*10",
"cnt",
"[0]*10",
"[0]",
"0",
"10",
"for k,v in sq.items():cnt[v]+=1",
"k",
"v",
"sq.items()",
"sq.items",
"sq",
"items",
"cnt[0]=(h-2)*(w-2)-sum(cnt)",
"cnt[0]",
"cnt",
"0",
"(h-2)*(w-2)-sum(cnt)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(cnt)",
"sum",
"cnt",
"print(*cnt,sep=\"\\n\")",
"print",
"*cnt",
"cnt",
"sep=\"\\n\"",
"sep",
"\"\\n\"",
"def LI(): return list(map(int, sys.stdin.readline().split()))",
"def LI(): return list(map(int, sys.stdin.readline().split()))",
"LI",
"b=MI1()",
"MI1()",
"b",
"def LLI(rows_number): return [LI() for _ in range(rows_number)]",
"def LLI(rows_number): return [LI() for _ in range(rows_number)]",
"LLI",
"h,w,n=MI()",
"MI()",
"h",
"a,b=MI1()",
"MI1()",
"a",
"int1 = lambda x: int(x) - 1",
"lambda x: int(x) - 1",
"int1",
"cnt=[0]*10",
"[0]*10",
"cnt",
"p2D = lambda x: print(*x, sep=\"\\n\")",
"lambda x: print(*x, sep=\"\\n\")",
"p2D",
"def MI(): return map(int, sys.stdin.readline().split())",
"def MI(): return map(int, sys.stdin.readline().split())",
"MI",
"def MI1(): return map(int1, sys.stdin.readline().split())",
"def MI1(): return map(int1, sys.stdin.readline().split())",
"MI1",
"w,n=MI()",
"MI()",
"w",
"n=MI()",
"MI()",
"n",
"def II(): return int(sys.stdin.readline())",
"def II(): return int(sys.stdin.readline())",
"II",
"sq=defaultdict(int)",
"defaultdict(int)",
"sq",
"def SI(): return sys.stdin.readline()[:-1]",
"def SI(): return sys.stdin.readline()[:-1]",
"SI"
] | from collections import defaultdict
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]
h,w,n=MI()
sq=defaultdict(int)
for _ in range(n):
a,b=MI1()
for i in range(max(0,a-2),min(h-2,a+1)):
for j in range(max(0,b-2),min(w-2,b+1)):
sq[i,j]+=1
cnt=[0]*10
for k,v in sq.items():cnt[v]+=1
cnt[0]=(h-2)*(w-2)-sum(cnt)
print(*cnt,sep="\n")
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
41,
28,
13,
4,
13,
13,
4,
13,
0,
13,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
14,
40,
13,
17,
42,
2,
13,
13,
0,
13,
4,
18,
4,
13,
13,
0,
18,
13,
13,
39,
4,
13,
18,
13,
17,
4,
13,
18,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
18,
13,
17,
17,
0,
13,
17,
0,
13,
2,
18,
13,
17,
17,
14,
2,
18,
13,
17,
2,
13,
17,
0,
13,
2,
13,
17,
0,
13,
18,
13,
17,
14,
2,
18,
13,
17,
17,
0,
13,
17,
0,
13,
2,
18,
13,
17,
17,
14,
2,
18,
13,
17,
2,
13,
17,
0,
13,
2,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
13,
13,
28,
13,
4,
13,
13,
13,
0,
13,
2,
2,
4,
13,
13,
17,
4,
13,
13,
14,
2,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
17,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
13,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
17,
13
] | [
[
241,
2
],
[
241,
11
],
[
241,
12
],
[
262,
14
],
[
19,
18
],
[
242,
21
],
[
214,
25
],
[
253,
28
],
[
37,
34
],
[
254,
35
],
[
233,
39
],
[
212,
42
],
[
242,
46
],
[
263,
50
],
[
224,
50
],
[
242,
51
],
[
244,
53
],
[
63,
60
],
[
215,
61
],
[
263,
62
],
[
224,
62
],
[
245,
67
],
[
245,
72
],
[
223,
75
],
[
247,
78
],
[
82,
81
],
[
215,
81
],
[
81,
86
],
[
226,
90
],
[
259,
93
],
[
81,
96
],
[
81,
102
],
[
233,
105
],
[
229,
108
],
[
233,
110
],
[
217,
113
],
[
81,
115
],
[
81,
120
],
[
220,
124
],
[
238,
127
],
[
81,
130
],
[
81,
136
],
[
212,
139
],
[
256,
142
],
[
212,
144
],
[
250,
147
],
[
81,
149
],
[
153,
152
],
[
260,
155
],
[
227,
155
],
[
218,
156
],
[
230,
156
],
[
159,
158
],
[
239,
161
],
[
221,
161
],
[
251,
162
],
[
257,
162
],
[
235,
164
],
[
152,
169
],
[
158,
173
],
[
236,
176
],
[
248,
177
],
[
182,
179
],
[
248,
180
],
[
236,
181
],
[
187,
184
],
[
248,
185
],
[
236,
186
],
[
190,
189
],
[
248,
192
],
[
198,
195
],
[
254,
196
],
[
189,
197
],
[
203,
200
],
[
254,
201
],
[
206,
205
],
[
254,
205
],
[
205,
209
],
[
241,
212
],
[
214,
215
],
[
217,
218
],
[
220,
221
],
[
223,
224
],
[
226,
227
],
[
229,
230
],
[
241,
233
],
[
235,
236
],
[
238,
239
],
[
241,
242
],
[
244,
245
],
[
247,
248
],
[
250,
251
],
[
253,
254
],
[
256,
257
],
[
259,
260
],
[
262,
263
]
] | [
"#in1 = '4 5 8'\n#in2 = ['1 1', '1 4', '1 5', '2 3', '3 1', '3 2', '3 4', '4 4']\n#in1 = '10 10 20'\n#in2 = ['1 1', '1 4', '1 9', '2 5', '3 10', '4 2', '4 7', '5 9', '6 4', '6 6', '6 7', '7 1', '7 3', '7 7', '8 1', '8 5', '8 10', '9 2', '10 4', '10 9']\n#in1 = '1000000000 1000000000 0'\n#h, w, n = map(int, in1.split())\nh, w, n = map(int, input().split())\n\nidx1 = 0\nab = [[0 for i in range(2)] for j in range(n)]\n\nblack_cnt = [0] * 10\nblack_cnt[0] = (h - 2) * (w - 2)\n\nif n != 0:\n while idx1 < n:\n x = input().split()\n #x = in2[idx1].split()\n ab[idx1] = [int(x[0]), int(x[1])]\n idx1 += 1\n\n myDict = {}\n for abitem in ab:\n if abitem[0] < 3:\n sr = 0\n else:\n sr = abitem[0] - 3\n if abitem[0] > h - 3:\n lr = h - 2\n else:\n lr = abitem[0]\n if abitem[1] < 3:\n sc = 0\n else:\n sc = abitem[1] - 3\n if abitem[1] > w - 3:\n lc = w - 2\n else:\n lc = abitem[1]\n\n for nowRow in range(sr, lr):\n for nowCol in range(sc, lc):\n key = str(nowRow) + ',' + str(nowCol)\n if key in myDict:\n myDict[key] += 1\n else:\n myDict[key] = 1\n\n for bcnt in myDict.values():\n black_cnt[bcnt] += 1\n black_cnt[0] -= 1\n\nfor item in black_cnt:\n print(item)",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"idx1 = 0",
"idx1",
"0",
"[0 for i in range(2)] for j in range(n)",
"for j in range(n)",
"j",
"range(n)",
"range",
"n",
"for j in range(n)",
"[0 for i in range(2)]",
"ab = [[0 for i in range(2)] for j in range(n)]",
"ab",
"[[0 for i in range(2)] for j in range(n)]",
"black_cnt = [0] * 10",
"black_cnt",
"[0] * 10",
"[0]",
"0",
"10",
"black_cnt[0] = (h - 2) * (w - 2)",
"black_cnt[0]",
"black_cnt",
"0",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"if n != 0:\n while idx1 < n:\n x = input().split()\n #x = in2[idx1].split()\n ab[idx1] = [int(x[0]), int(x[1])]\n idx1 += 1\n\n myDict = {}\n for abitem in ab:\n if abitem[0] < 3:\n sr = 0\n else:\n sr = abitem[0] - 3\n if abitem[0] > h - 3:\n lr = h - 2\n else:\n lr = abitem[0]\n if abitem[1] < 3:\n sc = 0\n else:\n sc = abitem[1] - 3\n if abitem[1] > w - 3:\n lc = w - 2\n else:\n lc = abitem[1]\n\n for nowRow in range(sr, lr):\n for nowCol in range(sc, lc):\n key = str(nowRow) + ',' + str(nowCol)\n if key in myDict:\n myDict[key] += 1\n else:\n myDict[key] = 1\n\n for bcnt in myDict.values():\n black_cnt[bcnt] += 1\n black_cnt[0] -= 1",
"n != 0",
"n",
"0",
"while idx1 < n:\n x = input().split()\n #x = in2[idx1].split()\n ab[idx1] = [int(x[0]), int(x[1])]\n idx1 += 1\n\n ",
"idx1 < n",
"idx1",
"n",
"x = input().split()",
"x",
"input().split()",
"().split",
"()",
"input",
"split",
"ab[idx1] = [int(x[0]), int(x[1])]",
"ab[idx1]",
"ab",
"idx1",
"[int(x[0]), int(x[1])]",
"int(x[0])",
"int",
"x[0]",
"x",
"0",
"int(x[1])",
"int",
"x[1]",
"x",
"1",
"idx1 += 1",
"idx1",
"1",
"myDict = {}",
"myDict",
"{}",
"for abitem in ab:\n if abitem[0] < 3:\n sr = 0\n else:\n sr = abitem[0] - 3\n if abitem[0] > h - 3:\n lr = h - 2\n else:\n lr = abitem[0]\n if abitem[1] < 3:\n sc = 0\n else:\n sc = abitem[1] - 3\n if abitem[1] > w - 3:\n lc = w - 2\n else:\n lc = abitem[1]\n\n for nowRow in range(sr, lr):\n for nowCol in range(sc, lc):\n key = str(nowRow) + ',' + str(nowCol)\n if key in myDict:\n myDict[key] += 1\n else:\n myDict[key] = 1\n\n ",
"abitem",
"ab",
"if abitem[0] < 3:\n sr = 0\n else:\n sr = abitem[0] - 3\n ",
"abitem[0] < 3",
"abitem[0]",
"abitem",
"0",
"3",
"sr = 0",
"sr",
"0",
"sr = abitem[0] - 3",
"sr",
"abitem[0] - 3",
"abitem[0]",
"abitem",
"0",
"3",
"if abitem[0] > h - 3:\n lr = h - 2\n else:\n lr = abitem[0]\n ",
"abitem[0] > h - 3",
"abitem[0]",
"abitem",
"0",
"h - 3",
"h",
"3",
"lr = h - 2",
"lr",
"h - 2",
"h",
"2",
"lr = abitem[0]",
"lr",
"abitem[0]",
"abitem",
"0",
"if abitem[1] < 3:\n sc = 0\n else:\n sc = abitem[1] - 3\n ",
"abitem[1] < 3",
"abitem[1]",
"abitem",
"1",
"3",
"sc = 0",
"sc",
"0",
"sc = abitem[1] - 3",
"sc",
"abitem[1] - 3",
"abitem[1]",
"abitem",
"1",
"3",
"if abitem[1] > w - 3:\n lc = w - 2\n else:\n lc = abitem[1]\n\n ",
"abitem[1] > w - 3",
"abitem[1]",
"abitem",
"1",
"w - 3",
"w",
"3",
"lc = w - 2",
"lc",
"w - 2",
"w",
"2",
"lc = abitem[1]",
"lc",
"abitem[1]",
"abitem",
"1",
"for nowRow in range(sr, lr):\n for nowCol in range(sc, lc):\n key = str(nowRow) + ',' + str(nowCol)\n if key in myDict:\n myDict[key] += 1\n else:\n myDict[key] = 1\n\n ",
"nowRow",
"range(sr, lr)",
"range",
"sr",
"lr",
"for nowCol in range(sc, lc):\n key = str(nowRow) + ',' + str(nowCol)\n if key in myDict:\n myDict[key] += 1\n else:\n myDict[key] = 1\n\n ",
"nowCol",
"range(sc, lc)",
"range",
"sc",
"lc",
"key = str(nowRow) + ',' + str(nowCol)",
"key",
"str(nowRow) + ',' + str(nowCol)",
"str(nowRow) + ','",
"str(nowRow)",
"str",
"nowRow",
"','",
"str(nowCol)",
"str",
"nowCol",
"if key in myDict:\n myDict[key] += 1\n else:\n myDict[key] = 1\n\n ",
"key in myDict",
"key",
"myDict",
"myDict[key] += 1",
"myDict[key]",
"myDict",
"key",
"1",
"myDict[key] = 1",
"myDict[key]",
"myDict",
"key",
"1",
"for bcnt in myDict.values():\n black_cnt[bcnt] += 1\n black_cnt[0] -= 1",
"bcnt",
"myDict.values()",
"myDict.values",
"myDict",
"values",
"black_cnt[bcnt] += 1",
"black_cnt[bcnt]",
"black_cnt",
"bcnt",
"1",
"black_cnt[0] -= 1",
"black_cnt[0]",
"black_cnt",
"0",
"1",
"for item in black_cnt:\n print(item)",
"item",
"black_cnt",
"print(item)",
"print",
"item",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"ab = [[0 for i in range(2)] for j in range(n)]",
"[[0 for i in range(2)] for j in range(n)]",
"ab",
"lr = abitem[0]",
"abitem[0]",
"lr",
"sc = 0",
"0",
"sc",
"idx1 += 1",
"1",
"idx1",
"sr = 0",
"0",
"sr",
"lr = h - 2",
"h - 2",
"lr",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"key = str(nowRow) + ',' + str(nowCol)",
"str(nowRow) + ',' + str(nowCol)",
"key",
"sc = abitem[1] - 3",
"abitem[1] - 3",
"sc",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"x = input().split()",
"input().split()",
"x",
"myDict = {}",
"{}",
"myDict",
"lc = abitem[1]",
"abitem[1]",
"lc",
"black_cnt = [0] * 10",
"[0] * 10",
"black_cnt",
"lc = w - 2",
"w - 2",
"lc",
"sr = abitem[0] - 3",
"abitem[0] - 3",
"sr",
"idx1 = 0",
"0",
"idx1"
] | #in1 = '4 5 8'
#in2 = ['1 1', '1 4', '1 5', '2 3', '3 1', '3 2', '3 4', '4 4']
#in1 = '10 10 20'
#in2 = ['1 1', '1 4', '1 9', '2 5', '3 10', '4 2', '4 7', '5 9', '6 4', '6 6', '6 7', '7 1', '7 3', '7 7', '8 1', '8 5', '8 10', '9 2', '10 4', '10 9']
#in1 = '1000000000 1000000000 0'
#h, w, n = map(int, in1.split())
h, w, n = map(int, input().split())
idx1 = 0
ab = [[0 for i in range(2)] for j in range(n)]
black_cnt = [0] * 10
black_cnt[0] = (h - 2) * (w - 2)
if n != 0:
while idx1 < n:
x = input().split()
#x = in2[idx1].split()
ab[idx1] = [int(x[0]), int(x[1])]
idx1 += 1
myDict = {}
for abitem in ab:
if abitem[0] < 3:
sr = 0
else:
sr = abitem[0] - 3
if abitem[0] > h - 3:
lr = h - 2
else:
lr = abitem[0]
if abitem[1] < 3:
sc = 0
else:
sc = abitem[1] - 3
if abitem[1] > w - 3:
lc = w - 2
else:
lc = abitem[1]
for nowRow in range(sr, lr):
for nowCol in range(sc, lc):
key = str(nowRow) + ',' + str(nowCol)
if key in myDict:
myDict[key] += 1
else:
myDict[key] = 1
for bcnt in myDict.values():
black_cnt[bcnt] += 1
black_cnt[0] -= 1
for item in black_cnt:
print(item)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
4,
18,
13,
13,
39,
2,
13,
17,
2,
13,
17,
0,
13,
17,
12,
13,
14,
2,
39,
13,
13,
13,
29,
18,
13,
39,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
39,
2,
13,
13,
2,
13,
13,
13,
0,
13,
17,
0,
18,
13,
39,
13,
13,
13,
29,
13,
23,
13,
23,
13,
0,
13,
2,
39,
17,
17,
28,
13,
13,
13,
28,
13,
4,
13,
17,
14,
2,
2,
2,
13,
13,
17,
40,
2,
13,
17,
2,
13,
13,
9,
28,
13,
4,
13,
17,
14,
2,
2,
2,
13,
13,
17,
40,
2,
13,
17,
2,
13,
13,
9,
4,
13,
2,
13,
13,
2,
13,
13,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
13,
4,
13,
18,
13,
39,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
234,
2
],
[
234,
11
],
[
234,
12
],
[
225,
14
],
[
223,
17
],
[
235,
20
],
[
231,
23
],
[
28,
27
],
[
217,
30
],
[
237,
32
],
[
237,
41
],
[
232,
44
],
[
211,
48
],
[
238,
51
],
[
219,
54
],
[
220,
63
],
[
220,
66
],
[
72,
71
],
[
75,
74
],
[
80,
79
],
[
106,
87
],
[
74,
88
],
[
108,
90
],
[
79,
91
],
[
232,
92
],
[
95,
94
],
[
102,
97
],
[
220,
98
],
[
94,
102
],
[
71,
102
],
[
94,
104
],
[
71,
104
],
[
106,
106
],
[
108,
108
],
[
207,
110
],
[
121,
120
],
[
211,
128
],
[
120,
129
],
[
223,
133
],
[
211,
136
],
[
120,
137
],
[
141,
140
],
[
238,
148
],
[
140,
149
],
[
235,
153
],
[
238,
156
],
[
140,
157
],
[
229,
160
],
[
211,
162
],
[
120,
163
],
[
238,
165
],
[
140,
166
],
[
213,
168
],
[
175,
174
],
[
220,
177
],
[
183,
180
],
[
214,
181
],
[
208,
181
],
[
174,
182
],
[
188,
185
],
[
214,
186
],
[
208,
186
],
[
226,
189
],
[
214,
193
],
[
208,
193
],
[
198,
197
],
[
214,
204
],
[
208,
204
],
[
197,
205
],
[
207,
208
],
[
237,
211
],
[
213,
214
],
[
234,
217
],
[
219,
220
],
[
234,
223
],
[
225,
226
],
[
231,
232
],
[
234,
235
],
[
237,
238
]
] | [
"H,W,N=map(int,input().split())\n\nallcase=(H-2)*(W-2)\n\nabset=set()\nfor _ in range(N):\n a,b=map(int,input().split())\n abset.add((a-1,b-1))\n#print(abset)\n\nmemo={}\ndef count_black(x,y):\n if (x,y) in memo:\n return memo[(x,y)]\n \n num_black=0\n for ii in range(3):\n for jj in range(3):\n if (x+ii,y+jj) in abset:\n num_black+=1\n \n memo[(x,y)]=num_black\n return num_black\n\ncase_list=[0]*10\nfor a,b in abset:\n for j in range(3):\n if a-j<0 or H-2<=a-j:\n continue \n for k in range(3):\n if b-k<0 or W-2<=b-k:\n continue\n count_black(a-j,b-k)\n#print(memo) \n\ncase_list=[0]*10\nfor v in memo.values():\n case_list[v]+=1\ncase_list[0]=allcase-sum(case_list[1:])\n#print(case_list)\n\nfor i in range(10):\n print(case_list[i])",
"H,W,N=map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"allcase=(H-2)*(W-2)",
"allcase",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"abset=set()",
"abset",
"set()",
"set",
"for _ in range(N):\n a,b=map(int,input().split())\n abset.add((a-1,b-1))\n#print(abset)",
"_",
"range(N)",
"range",
"N",
"a,b=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"abset.add((a-1,b-1))",
"abset.add",
"abset",
"add",
"(a-1,b-1)",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"memo={}",
"memo",
"{}",
"def count_black(x,y):\n if (x,y) in memo:\n return memo[(x,y)]\n \n num_black=0\n for ii in range(3):\n for jj in range(3):\n if (x+ii,y+jj) in abset:\n num_black+=1\n \n memo[(x,y)]=num_black\n return num_black",
"count_black",
"if (x,y) in memo:\n return memo[(x,y)]\n \n ",
"(x,y) in memo",
"(x,y)",
"x",
"y",
"memo",
"return memo[(x,y)]",
"memo[(x,y)]",
"memo",
"(x,y)",
"x",
"y",
"num_black=0",
"num_black",
"0",
"for ii in range(3):\n for jj in range(3):\n if (x+ii,y+jj) in abset:\n num_black+=1\n \n ",
"ii",
"range(3)",
"range",
"3",
"for jj in range(3):\n if (x+ii,y+jj) in abset:\n num_black+=1\n \n ",
"jj",
"range(3)",
"range",
"3",
"if (x+ii,y+jj) in abset:\n num_black+=1\n \n ",
"(x+ii,y+jj) in abset",
"(x+ii,y+jj)",
"x+ii",
"x",
"ii",
"y+jj",
"y",
"jj",
"abset",
"num_black+=1",
"num_black",
"1",
"memo[(x,y)]=num_black",
"memo[(x,y)]",
"memo",
"(x,y)",
"x",
"y",
"num_black",
"return num_black",
"num_black",
"x",
"x",
"y",
"y",
"case_list=[0]*10",
"case_list",
"[0]*10",
"[0]",
"0",
"10",
"for a,b in abset:\n for j in range(3):\n if a-j<0 or H-2<=a-j:\n continue \n for k in range(3):\n if b-k<0 or W-2<=b-k:\n continue\n count_black(a-j,b-k)\n#print(memo) ",
"a",
"b",
"abset",
"for j in range(3):\n if a-j<0 or H-2<=a-j:\n continue \n for k in range(3):\n if b-k<0 or W-2<=b-k:\n continue\n count_black(a-j,b-k)\n#print(memo) ",
"j",
"range(3)",
"range",
"3",
"if a-j<0 or H-2<=a-j:\n continue \n ",
"a-j<0 or H-2<=a-j",
"a-j<0",
"a-j",
"a",
"j",
"0",
"H-2<=a-j",
"H-2",
"H",
"2",
"a-j",
"a",
"j",
"continue",
"for k in range(3):\n if b-k<0 or W-2<=b-k:\n continue\n count_black(a-j,b-k)\n#print(memo) ",
"k",
"range(3)",
"range",
"3",
"if b-k<0 or W-2<=b-k:\n continue\n ",
"b-k<0 or W-2<=b-k",
"b-k<0",
"b-k",
"b",
"k",
"0",
"W-2<=b-k",
"W-2",
"W",
"2",
"b-k",
"b",
"k",
"continue",
"count_black(a-j,b-k)",
"count_black",
"a-j",
"a",
"j",
"b-k",
"b",
"k",
"case_list=[0]*10",
"case_list",
"[0]*10",
"[0]",
"0",
"10",
"for v in memo.values():\n case_list[v]+=1",
"v",
"memo.values()",
"memo.values",
"memo",
"values",
"case_list[v]+=1",
"case_list[v]",
"case_list",
"v",
"1",
"case_list[0]=allcase-sum(case_list[1:])",
"case_list[0]",
"case_list",
"0",
"allcase-sum(case_list[1:])",
"allcase",
"sum(case_list[1:])",
"sum",
"case_list[1:]",
"case_list",
"1:",
"1",
"for i in range(10):\n print(case_list[i])",
"i",
"range(10)",
"range",
"10",
"print(case_list[i])",
"print",
"case_list[i]",
"case_list",
"i",
"case_list=[0]*10",
"[0]*10",
"case_list",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"case_list=[0]*10",
"[0]*10",
"case_list",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"memo={}",
"{}",
"memo",
"H,W,N=map(int,input().split())",
"map(int,input().split())",
"H",
"allcase=(H-2)*(W-2)",
"(H-2)*(W-2)",
"allcase",
"def count_black(x,y):\n if (x,y) in memo:\n return memo[(x,y)]\n \n num_black=0\n for ii in range(3):\n for jj in range(3):\n if (x+ii,y+jj) in abset:\n num_black+=1\n \n memo[(x,y)]=num_black\n return num_black",
"def count_black(x,y):\n if (x,y) in memo:\n return memo[(x,y)]\n \n num_black=0\n for ii in range(3):\n for jj in range(3):\n if (x+ii,y+jj) in abset:\n num_black+=1\n \n memo[(x,y)]=num_black\n return num_black",
"count_black",
"abset=set()",
"set()",
"abset",
"W,N=map(int,input().split())",
"map(int,input().split())",
"W",
"b=map(int,input().split())",
"map(int,input().split())",
"b"
] | H,W,N=map(int,input().split())
allcase=(H-2)*(W-2)
abset=set()
for _ in range(N):
a,b=map(int,input().split())
abset.add((a-1,b-1))
#print(abset)
memo={}
def count_black(x,y):
if (x,y) in memo:
return memo[(x,y)]
num_black=0
for ii in range(3):
for jj in range(3):
if (x+ii,y+jj) in abset:
num_black+=1
memo[(x,y)]=num_black
return num_black
case_list=[0]*10
for a,b in abset:
for j in range(3):
if a-j<0 or H-2<=a-j:
continue
for k in range(3):
if b-k<0 or W-2<=b-k:
continue
count_black(a-j,b-k)
#print(memo)
case_list=[0]*10
for v in memo.values():
case_list[v]+=1
case_list[0]=allcase-sum(case_list[1:])
#print(case_list)
for i in range(10):
print(case_list[i]) |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
2,
39,
17,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
39,
2,
13,
17,
13,
2,
13,
17,
28,
13,
39,
2,
13,
17,
13,
2,
13,
17,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
13,
0,
13,
13,
13,
14,
2,
2,
2,
17,
13,
13,
2,
2,
17,
13,
13,
28,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13
] | [
[
117,
3
],
[
117,
12
],
[
117,
13
],
[
99,
15
],
[
21,
20
],
[
118,
24
],
[
120,
26
],
[
120,
35
],
[
38,
37
],
[
103,
40
],
[
103,
44
],
[
48,
47
],
[
121,
50
],
[
121,
54
],
[
96,
57
],
[
66,
63
],
[
97,
64
],
[
109,
68
],
[
112,
71
],
[
75,
74
],
[
100,
74
],
[
114,
77
],
[
74,
78
],
[
114,
79
],
[
115,
85
],
[
103,
85
],
[
112,
86
],
[
106,
90
],
[
121,
90
],
[
109,
91
],
[
94,
93
],
[
97,
93
],
[
96,
97
],
[
99,
100
],
[
120,
103
],
[
74,
105
],
[
114,
106
],
[
117,
109
],
[
117,
112
],
[
74,
114
],
[
114,
115
],
[
117,
118
],
[
120,
121
]
] | [
"from collections import*\nh,w,n=map(int,input().split())\nd=defaultdict(int)\nfor x in[0]*n:\n a,b=map(int,input().split())\n for i in[a-1,a,a+1]:\n for j in[b-1,b,b+1]:d[(i,j)]+=1\nc=[0]*10;c[0]=(w-2)*(h-2)\nfor i in d:\n a,b=i\n if 1<a<h and 1<b<w:c[d[i]]+=1;c[0]-=1\nfor i in c:print(i)",
"from collections import*",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"d=defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"for x in[0]*n:\n a,b=map(int,input().split())\n for i in[a-1,a,a+1]:\n for j in[b-1,b,b+1]:d[(i,j)]+=1",
"x",
"[0]*n",
"[0]",
"0",
"n",
"a,b=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in[a-1,a,a+1]:\n for j in[b-1,b,b+1]:d[(i,j)]+=1",
"i",
"[a-1,a,a+1]",
"a-1",
"a",
"1",
"a",
"a+1",
"a",
"1",
"for j in[b-1,b,b+1]:d[(i,j)",
"j",
"[b-1,b,b+1]",
"b-1",
"b",
"1",
"b",
"b+1",
"b",
"1",
"c=[0]*10",
"c",
"[0]*10",
"[0]",
"0",
"10",
"c[0]=(w-2)*(h-2)",
"c[0]",
"c",
"0",
"(w-2)*(h-2)",
"w-2",
"w",
"2",
"h-2",
"h",
"2",
"for i in d:\n a,b=i\n if 1<a<h and 1<b<w:c[d[i]]+=1;c[0]-=1",
"i",
"d",
"a,b=i",
"a",
"i",
"b",
"if 1<a<h and 1<b<w:c[d[i]]+=1;c[0]-",
"1<a<h and 1<b<w",
"1<a<h",
"1<a",
"1",
"a",
"h",
"1<b<w",
"1<b",
"1",
"b",
"w",
"for i in c:print(i)",
"i",
"c",
"c=[0]*10",
"[0]*10",
"c",
"d=defaultdict(int)",
"defaultdict(int)",
"d",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"b=i",
"i",
"b",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"a,b=i",
"i",
"a",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"b=map(int,input().split())",
"map(int,input().split())",
"b"
] | from collections import*
h,w,n=map(int,input().split())
d=defaultdict(int)
for x in[0]*n:
a,b=map(int,input().split())
for i in[a-1,a,a+1]:
for j in[b-1,b,b+1]:d[(i,j)]+=1
c=[0]*10;c[0]=(w-2)*(h-2)
for i in d:
a,b=i
if 1<a<h and 1<b<w:c[d[i]]+=1;c[0]-=1
for i in c:print(i) |
[
7,
15,
13,
15,
13,
0,
13,
12,
4,
18,
4,
18,
18,
13,
13,
13,
13,
0,
13,
12,
4,
13,
4,
13,
0,
13,
12,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
13,
0,
13,
39,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
28,
13,
13,
0,
13,
2,
2,
13,
18,
13,
17,
17,
0,
13,
2,
2,
13,
18,
13,
17,
17,
14,
2,
2,
13,
17,
2,
13,
2,
13,
17,
9,
14,
2,
2,
13,
17,
2,
13,
2,
13,
17,
9,
4,
18,
13,
13,
39,
2,
13,
17,
2,
13,
17,
14,
2,
4,
13,
13,
17,
4,
13,
2,
2,
13,
17,
2,
13,
17,
41,
28,
13,
4,
13,
17,
4,
4,
13,
17,
13,
4,
13,
17,
4,
18,
13,
13,
41,
28,
13,
4,
13,
17,
4,
13,
17,
0,
13,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
18,
13,
39,
17,
14,
2,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
0,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
13,
13,
28,
13,
4,
18,
13,
13,
4,
13,
13,
10,
12,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
13,
13,
10,
39,
13,
10,
4,
13,
10,
39,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13
] | [
[
277,
6
],
[
280,
18
],
[
278,
23
],
[
250,
25
],
[
278,
35
],
[
289,
38
],
[
251,
40
],
[
289,
41
],
[
289,
42
],
[
274,
44
],
[
268,
74
],
[
78,
77
],
[
263,
80
],
[
271,
82
],
[
251,
84
],
[
271,
85
],
[
88,
87
],
[
275,
87
],
[
286,
90
],
[
257,
93
],
[
87,
95
],
[
259,
99
],
[
272,
102
],
[
87,
104
],
[
287,
110
],
[
287,
113
],
[
290,
115
],
[
260,
121
],
[
260,
124
],
[
284,
126
],
[
269,
131
],
[
287,
135
],
[
260,
138
],
[
269,
144
],
[
290,
150
],
[
284,
153
],
[
158,
157
],
[
269,
171
],
[
176,
175
],
[
175,
180
],
[
265,
183
],
[
292,
186
],
[
269,
188
],
[
253,
191
],
[
195,
194
],
[
269,
196
],
[
293,
201
],
[
302,
201
],
[
194,
202
],
[
295,
204
],
[
210,
207
],
[
266,
208
],
[
254,
209
],
[
299,
209
],
[
296,
209
],
[
301,
212
],
[
194,
213
],
[
298,
215
],
[
221,
218
],
[
266,
219
],
[
299,
220
],
[
296,
220
],
[
254,
220
],
[
226,
223
],
[
266,
224
],
[
290,
229
],
[
284,
232
],
[
266,
238
],
[
242,
241
],
[
266,
244
],
[
241,
248
],
[
250,
251
],
[
253,
254
],
[
271,
257
],
[
259,
260
],
[
289,
263
],
[
265,
266
],
[
268,
269
],
[
271,
272
],
[
274,
275
],
[
277,
278
],
[
280,
281
],
[
289,
284
],
[
286,
287
],
[
289,
290
],
[
292,
293
],
[
295,
296
],
[
298,
299
],
[
194,
301
],
[
301,
302
]
] | [
"import sys\nimport numpy as np\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\nH, W, N = lr()\nshift = ((0, 0), (0, 1), (1, 0), (0, -1), (-1, 0), (1, 1), (-1, -1), (-1, 1), (1, -1))\n\nl = []\n\nfor n in range(N):\n a, b = lr()\n for s in shift:\n aa = a + s[0] - 1\n bb = b + s[1] - 1\n if aa < 1 or aa > H-2:\n continue\n if bb < 1 or bb > W-2:\n continue\n l.append((aa-1, bb-1))\nif len(l) == 0:\n print((H-2) * (W-2))\n [print(0) for _ in range(9)]\n exit(0)\nl.sort()\nm = {i: 0 for i in range(10)}\npre = l[0]\nc = 1\nfor ll in l[1:]:\n if pre == ll:\n c += 1\n else:\n m[c] += 1\n pre = ll\n c = 1\nm[c] += 1\nm[0] = (H-2) * (W-2) - sum(m.values())\nfor v in m.values():\n print(v)",
"import sys",
"sys",
"import numpy as np",
"numpy",
"sr = lambda: sys.stdin.readline().rstrip()",
"sr",
"lambda: sys.stdin.readline().rstrip()",
"sys.stdin.readline().rstrip()",
"sys.stdin.readline().rstrip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"rstrip",
"ir = lambda: int(sr())",
"ir",
"lambda: int(sr())",
"int(sr())",
"int",
"sr()",
"sr",
"lr = lambda: list(map(int, sr().split()))",
"lr",
"lambda: list(map(int, sr().split()))",
"list(map(int, sr().split()))",
"list",
"map(int, sr().split())",
"map",
"int",
"sr().split()",
"().split",
"()",
"sr",
"split",
"H, W, N = lr()",
"H",
"lr()",
"lr",
"W",
"N",
"shift = ((0, 0), (0, 1), (1, 0), (0, -1), (-1, 0), (1, 1), (-1, -1), (-1, 1), (1, -1))",
"shift",
"((0, 0), (0, 1), (1, 0), (0, -1), (-1, 0), (1, 1), (-1, -1), (-1, 1), (1, -1))",
"(0, 0)",
"0",
"0",
"(0, 1)",
"0",
"1",
"(1, 0)",
"1",
"0",
"(0, -1)",
"0",
"-1",
"(-1, 0)",
"-1",
"0",
"(1, 1)",
"1",
"1",
"(-1, -1)",
"-1",
"-1",
"(-1, 1)",
"-1",
"1",
"(1, -1)",
"1",
"-1",
"l = []",
"l",
"[]",
"for n in range(N):\n a, b = lr()\n for s in shift:\n aa = a + s[0] - 1\n bb = b + s[1] - 1\n if aa < 1 or aa > H-2:\n continue\n if bb < 1 or bb > W-2:\n continue\n l.append((aa-1, bb-1))",
"n",
"range(N)",
"range",
"N",
"a, b = lr()",
"a",
"lr()",
"lr",
"b",
"for s in shift:\n aa = a + s[0] - 1\n bb = b + s[1] - 1\n if aa < 1 or aa > H-2:\n continue\n if bb < 1 or bb > W-2:\n continue\n l.append((aa-1, bb-1))",
"s",
"shift",
"aa = a + s[0] - 1",
"aa",
"a + s[0] - 1",
"a + s[0]",
"a",
"s[0]",
"s",
"0",
"1",
"bb = b + s[1] - 1",
"bb",
"b + s[1] - 1",
"b + s[1]",
"b",
"s[1]",
"s",
"1",
"1",
"if aa < 1 or aa > H-2:\n continue\n ",
"aa < 1 or aa > H-2",
"aa < 1",
"aa",
"1",
"aa > H-2",
"aa",
"H-2",
"H",
"2",
"continue",
"if bb < 1 or bb > W-2:\n continue\n ",
"bb < 1 or bb > W-2",
"bb < 1",
"bb",
"1",
"bb > W-2",
"bb",
"W-2",
"W",
"2",
"continue",
"l.append((aa-1, bb-1))",
"l.append",
"l",
"append",
"(aa-1, bb-1)",
"aa-1",
"aa",
"1",
"bb-1",
"bb",
"1",
"if len(l) == 0:\n print((H-2) * (W-2))\n [print(0) for _ in range(9)]\n exit(0)",
"len(l) == 0",
"len(l)",
"len",
"l",
"0",
"print((H-2) * (W-2))",
"print",
"(H-2) * (W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"print(0) for _ in range(9)",
"for _ in range(9)",
"_",
"range(9)",
"range",
"9",
"for _ in range(9)",
"print(0)",
"print",
"0",
"[print(0) for _ in range(9)]",
"exit(0)",
"exit",
"0",
"l.sort()",
"l.sort",
"l",
"sort",
"i: 0 for i in range(10)",
"for i in range(10)",
"i",
"range(10)",
"range",
"10",
"for i in range(10)",
"i",
"0",
"m = {i: 0 for i in range(10)}",
"m",
"{i: 0 for i in range(10)}",
"pre = l[0]",
"pre",
"l[0]",
"l",
"0",
"c = 1",
"c",
"1",
"for ll in l[1:]:\n if pre == ll:\n c += 1\n else:\n m[c] += 1\n pre = ll\n c = 1",
"ll",
"l[1:]",
"l",
"1:",
"1",
"if pre == ll:\n c += 1\n else:\n m[c] += 1\n pre = ll\n c = 1",
"pre == ll",
"pre",
"ll",
"c += 1",
"c",
"1",
"m[c] += 1",
"m[c]",
"m",
"c",
"1",
"pre = ll",
"pre",
"ll",
"c = 1",
"c",
"1",
"m[c] += 1",
"m[c]",
"m",
"c",
"1",
"m[0] = (H-2) * (W-2) - sum(m.values())",
"m[0]",
"m",
"0",
"(H-2) * (W-2) - sum(m.values())",
"(H-2) * (W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(m.values())",
"sum",
"m.values()",
"m.values",
"m",
"values",
"for v in m.values():\n print(v)",
"v",
"m.values()",
"m.values",
"m",
"values",
"print(v)",
"print",
"v",
"lr = lambda: list(map(int, sr().split()))",
"lambda: list(map(int, sr().split()))",
"lr",
"c = 1",
"1",
"c",
"a, b = lr()",
"lr()",
"a",
"bb = b + s[1] - 1",
"b + s[1] - 1",
"bb",
"N = lr()",
"lr()",
"N",
"m = {i: 0 for i in range(10)}",
"{i: 0 for i in range(10)}",
"m",
"l = []",
"[]",
"l",
"b = lr()",
"lr()",
"b",
"shift = ((0, 0), (0, 1), (1, 0), (0, -1), (-1, 0), (1, 1), (-1, -1), (-1, 1), (1, -1))",
"((0, 0), (0, 1), (1, 0), (0, -1), (-1, 0), (1, 1), (-1, -1), (-1, 1), (1, -1))",
"shift",
"sr = lambda: sys.stdin.readline().rstrip()",
"lambda: sys.stdin.readline().rstrip()",
"sr",
"ir = lambda: int(sr())",
"lambda: int(sr())",
"ir",
"W, N = lr()",
"lr()",
"W",
"aa = a + s[0] - 1",
"a + s[0] - 1",
"aa",
"H, W, N = lr()",
"lr()",
"H",
"pre = l[0]",
"l[0]",
"pre",
"c += 1",
"1",
"c",
"c = 1",
"1",
"c",
"pre = ll",
"ll",
"pre"
] | import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
H, W, N = lr()
shift = ((0, 0), (0, 1), (1, 0), (0, -1), (-1, 0), (1, 1), (-1, -1), (-1, 1), (1, -1))
l = []
for n in range(N):
a, b = lr()
for s in shift:
aa = a + s[0] - 1
bb = b + s[1] - 1
if aa < 1 or aa > H-2:
continue
if bb < 1 or bb > W-2:
continue
l.append((aa-1, bb-1))
if len(l) == 0:
print((H-2) * (W-2))
[print(0) for _ in range(9)]
exit(0)
l.sort()
m = {i: 0 for i in range(10)}
pre = l[0]
c = 1
for ll in l[1:]:
if pre == ll:
c += 1
else:
m[c] += 1
pre = ll
c = 1
m[c] += 1
m[0] = (H-2) * (W-2) - sum(m.values())
for v in m.values():
print(v)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
2,
17,
13,
4,
17,
0,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
2,
40,
17,
2,
2,
13,
17,
13,
2,
13,
17,
2,
40,
17,
2,
2,
13,
17,
13,
2,
13,
17,
0,
18,
13,
13,
2,
2,
2,
13,
13,
13,
2,
13,
13,
0,
13,
17,
24,
18,
13,
39,
13,
15,
13,
0,
13,
4,
18,
13,
13,
13,
0,
13,
4,
13,
4,
18,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
13,
13,
28,
13,
4,
13,
17,
17,
4,
13,
4,
18,
13,
13,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] | [
[
160,
2
],
[
160,
11
],
[
160,
12
],
[
16,
15
],
[
155,
20
],
[
151,
24
],
[
163,
27
],
[
31,
30
],
[
155,
33
],
[
175,
35
],
[
175,
44
],
[
47,
46
],
[
53,
52
],
[
173,
64
],
[
52,
66
],
[
161,
68
],
[
176,
75
],
[
46,
77
],
[
158,
79
],
[
85,
82
],
[
152,
83
],
[
164,
84
],
[
170,
84
],
[
176,
88
],
[
46,
89
],
[
161,
90
],
[
173,
92
],
[
52,
93
],
[
169,
95
],
[
152,
99
],
[
166,
105
],
[
152,
110
],
[
148,
112
],
[
167,
117
],
[
161,
124
],
[
158,
127
],
[
152,
133
],
[
136,
135
],
[
149,
144
],
[
135,
146
],
[
148,
149
],
[
151,
152
],
[
160,
155
],
[
160,
158
],
[
160,
161
],
[
163,
164
],
[
166,
167
],
[
169,
170
],
[
175,
173
],
[
175,
176
]
] | [
"H,W,N = map(int,input().split())\nNli=[0 for j in range(9*N)]\nq=0\nfor k in range(N):\n a,b=map(int,input().split())\n for n in range(-1,2):\n for m in range(-1,2):\n if 0<=a-2-m<H-2 and 0<=b-2-n<W-2:\n Nli[q]=(b-n)*(H)+(a-m)\n q+=1\ndel Nli[q:]\nimport collections\ns = collections.Counter(Nli)\nv = list(s.values())\nprint((H-2)*(W-2)-len(set(Nli)))\nfor k in range(1,10):\n print(v.count(k))",
"H,W,N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"0 for j in range(9*N)",
"for j in range(9*N)",
"j",
"range(9*N)",
"range",
"9*N",
"9",
"N",
"for j in range(9*N)",
"0",
"Nli=[0 for j in range(9*N)]",
"Nli",
"[0 for j in range(9*N)]",
"q=0",
"q",
"0",
"for k in range(N):\n a,b=map(int,input().split())\n for n in range(-1,2):\n for m in range(-1,2):\n if 0<=a-2-m<H-2 and 0<=b-2-n<W-2:\n Nli[q]=(b-n)*(H)+(a-m)\n q+=1",
"k",
"range(N)",
"range",
"N",
"a,b=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for n in range(-1,2):\n for m in range(-1,2):\n if 0<=a-2-m<H-2 and 0<=b-2-n<W-2:\n Nli[q]=(b-n)*(H)+(a-m)\n q+=1",
"n",
"range(-1,2)",
"range",
"-1",
"2",
"for m in range(-1,2):\n if 0<=a-2-m<H-2 and 0<=b-2-n<W-2:\n Nli[q]=(b-n)*(H)+(a-m)\n q+=1",
"m",
"range(-1,2)",
"range",
"-1",
"2",
"if 0<=a-2-m<H-2 and 0<=b-2-n<W-2:\n Nli[q]=(b-n)*(H)+(a-m)\n q+=1",
"0<=a-2-m<H-2 and 0<=b-2-n<W-2",
"0<=a-2-m<H-2",
"0<=a-2-m",
"0",
"a-2-m",
"a-2",
"a",
"2",
"m",
"H-2",
"H",
"2",
"0<=b-2-n<W-2",
"0<=b-2-n",
"0",
"b-2-n",
"b-2",
"b",
"2",
"n",
"W-2",
"W",
"2",
"Nli[q]=(b-n)*(H)+(a-m)",
"Nli[q]",
"Nli",
"q",
"(b-n)*(H)+(a-m)",
"(b-n)*(H)",
"b-n",
"b",
"n",
"H",
"a-m",
"a",
"m",
"q+=1",
"q",
"1",
"del Nli[q:]",
"Nli[q:]",
"Nli",
"q:",
"q",
"import collections",
"collections",
"s = collections.Counter(Nli)",
"s",
"collections.Counter(Nli)",
"collections.Counter",
"collections",
"Counter",
"Nli",
"v = list(s.values())",
"v",
"list(s.values())",
"list",
"s.values()",
"s.values",
"s",
"values",
"print((H-2)*(W-2)-len(set(Nli)))",
"print",
"(H-2)*(W-2)-len(set(Nli))",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"len(set(Nli))",
"len",
"set(Nli)",
"set",
"Nli",
"for k in range(1,10):\n print(v.count(k))",
"k",
"range(1,10)",
"range",
"1",
"10",
"print(v.count(k))",
"print",
"v.count(k)",
"v.count",
"v",
"count",
"k",
"v = list(s.values())",
"list(s.values())",
"v",
"Nli=[0 for j in range(9*N)]",
"[0 for j in range(9*N)]",
"Nli",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"q=0",
"0",
"q",
"s = collections.Counter(Nli)",
"collections.Counter(Nli)",
"s",
"q+=1",
"1",
"q",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"b=map(int,input().split())",
"map(int,input().split())",
"b"
] | H,W,N = map(int,input().split())
Nli=[0 for j in range(9*N)]
q=0
for k in range(N):
a,b=map(int,input().split())
for n in range(-1,2):
for m in range(-1,2):
if 0<=a-2-m<H-2 and 0<=b-2-n<W-2:
Nli[q]=(b-n)*(H)+(a-m)
q+=1
del Nli[q:]
import collections
s = collections.Counter(Nli)
v = list(s.values())
print((H-2)*(W-2)-len(set(Nli)))
for k in range(1,10):
print(v.count(k)) |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
17,
17,
0,
13,
4,
13,
12,
13,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
29,
17,
17,
23,
13,
23,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
14,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
2,
2,
2,
2,
13,
17,
13,
13,
17,
13,
0,
18,
13,
2,
2,
2,
2,
13,
17,
13,
13,
17,
17,
0,
18,
13,
2,
2,
2,
2,
13,
17,
13,
13,
17,
17,
14,
4,
13,
2,
13,
17,
13,
14,
2,
2,
2,
2,
13,
17,
13,
13,
13,
0,
18,
13,
2,
2,
2,
13,
17,
13,
13,
17,
0,
18,
13,
2,
2,
2,
13,
17,
13,
13,
17,
14,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
2,
2,
2,
2,
13,
17,
13,
13,
17,
13,
0,
18,
13,
2,
2,
2,
2,
13,
17,
13,
13,
17,
17,
0,
18,
13,
2,
2,
2,
2,
13,
17,
13,
13,
17,
17,
14,
4,
13,
13,
2,
13,
17,
14,
2,
2,
2,
2,
13,
13,
13,
17,
13,
0,
18,
13,
2,
2,
2,
13,
13,
13,
17,
17,
0,
18,
13,
2,
2,
2,
13,
13,
13,
17,
17,
14,
4,
13,
13,
13,
14,
2,
2,
2,
13,
13,
13,
13,
0,
18,
13,
2,
2,
13,
13,
13,
17,
0,
18,
13,
2,
2,
13,
13,
13,
17,
14,
4,
13,
13,
2,
13,
17,
14,
2,
2,
2,
2,
13,
13,
13,
17,
13,
0,
18,
13,
2,
2,
2,
13,
13,
13,
17,
17,
0,
18,
13,
2,
2,
2,
13,
13,
13,
17,
17,
14,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
2,
2,
2,
2,
13,
17,
13,
13,
17,
13,
0,
18,
13,
2,
2,
2,
2,
13,
17,
13,
13,
17,
17,
0,
18,
13,
2,
2,
2,
2,
13,
17,
13,
13,
17,
17,
14,
4,
13,
2,
13,
17,
13,
14,
2,
2,
2,
2,
13,
17,
13,
13,
13,
0,
18,
13,
2,
2,
2,
13,
17,
13,
13,
17,
0,
18,
13,
2,
2,
2,
13,
17,
13,
13,
17,
14,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
2,
2,
2,
2,
13,
17,
13,
13,
17,
13,
0,
18,
13,
2,
2,
2,
2,
13,
17,
13,
13,
17,
17,
0,
18,
13,
2,
2,
2,
2,
13,
17,
13,
13,
17,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
18,
13
] | [
[
496,
4
],
[
14,
13
],
[
497,
20
],
[
14,
22
],
[
14,
23
],
[
26,
25
],
[
31,
30
],
[
55,
40
],
[
13,
42
],
[
57,
47
],
[
22,
49
],
[
55,
55
],
[
57,
57
],
[
60,
59
],
[
23,
62
],
[
65,
64
],
[
497,
71
],
[
65,
73
],
[
34,
76
],
[
64,
78
],
[
73,
81
],
[
64,
89
],
[
25,
91
],
[
73,
92
],
[
30,
94
],
[
107,
96
],
[
30,
97
],
[
64,
102
],
[
25,
104
],
[
73,
105
],
[
120,
109
],
[
30,
110
],
[
64,
115
],
[
25,
117
],
[
73,
118
],
[
34,
123
],
[
64,
125
],
[
73,
127
],
[
64,
133
],
[
25,
135
],
[
73,
136
],
[
30,
137
],
[
148,
139
],
[
30,
140
],
[
64,
144
],
[
25,
146
],
[
73,
147
],
[
159,
150
],
[
30,
151
],
[
64,
155
],
[
25,
157
],
[
73,
158
],
[
34,
162
],
[
64,
164
],
[
73,
167
],
[
64,
175
],
[
25,
177
],
[
73,
178
],
[
30,
180
],
[
193,
182
],
[
30,
183
],
[
64,
188
],
[
25,
190
],
[
73,
191
],
[
206,
195
],
[
30,
196
],
[
64,
201
],
[
25,
203
],
[
73,
204
],
[
34,
209
],
[
64,
210
],
[
73,
212
],
[
64,
219
],
[
25,
220
],
[
73,
221
],
[
30,
223
],
[
234,
225
],
[
30,
226
],
[
64,
230
],
[
25,
231
],
[
73,
232
],
[
245,
236
],
[
30,
237
],
[
64,
241
],
[
25,
242
],
[
73,
243
],
[
34,
248
],
[
64,
249
],
[
73,
250
],
[
64,
255
],
[
25,
256
],
[
73,
257
],
[
30,
258
],
[
267,
260
],
[
30,
261
],
[
64,
264
],
[
25,
265
],
[
73,
266
],
[
276,
269
],
[
30,
270
],
[
64,
273
],
[
25,
274
],
[
73,
275
],
[
34,
279
],
[
64,
280
],
[
73,
282
],
[
64,
289
],
[
25,
290
],
[
73,
291
],
[
30,
293
],
[
304,
295
],
[
30,
296
],
[
64,
300
],
[
25,
301
],
[
73,
302
],
[
315,
306
],
[
30,
307
],
[
64,
311
],
[
25,
312
],
[
73,
313
],
[
34,
318
],
[
64,
320
],
[
73,
323
],
[
64,
331
],
[
25,
333
],
[
73,
334
],
[
30,
336
],
[
349,
338
],
[
30,
339
],
[
64,
344
],
[
25,
346
],
[
73,
347
],
[
362,
351
],
[
30,
352
],
[
64,
357
],
[
25,
359
],
[
73,
360
],
[
34,
365
],
[
64,
367
],
[
73,
369
],
[
64,
375
],
[
25,
377
],
[
73,
378
],
[
30,
379
],
[
390,
381
],
[
30,
382
],
[
64,
386
],
[
25,
388
],
[
73,
389
],
[
401,
392
],
[
30,
393
],
[
64,
397
],
[
25,
399
],
[
73,
400
],
[
34,
404
],
[
64,
406
],
[
73,
409
],
[
64,
417
],
[
25,
419
],
[
73,
420
],
[
30,
422
],
[
435,
424
],
[
30,
425
],
[
64,
430
],
[
25,
432
],
[
73,
433
],
[
448,
437
],
[
30,
438
],
[
64,
443
],
[
25,
445
],
[
73,
446
],
[
451,
450
],
[
457,
456
],
[
30,
456
],
[
464,
459
],
[
450,
460
],
[
30,
462
],
[
456,
463
],
[
469,
466
],
[
450,
467
],
[
13,
472
],
[
22,
475
],
[
450,
479
],
[
482,
481
],
[
450,
481
],
[
481,
485
],
[
494,
491
],
[
496,
497
]
] | [
"import sys\ninput = sys.stdin.readline\n\ndef main():\n h,w,n = map(int,input().split())\n dg = 10**10\n d = dict()\n\n def f(x,y):\n if 2 <= x <= h-1 and 2 <= y <= w-1:\n return True\n else:\n False\n\n for i in range(n):\n a,b = map(int,input().split())\n \n if f((a-1),b-1):\n if (a-1)*dg + b-1 in d:\n d[(a-1)*dg + b-1] += 1\n else:\n d[(a-1)*dg + b-1] = 1\n \n if f((a-1),b):\n if (a-1)*dg + b in d:\n d[(a-1)*dg + b] += 1\n else:\n d[(a-1)*dg + b] = 1\n \n if f((a-1),b+1):\n if (a-1)*dg + b+1 in d:\n d[(a-1)*dg + b+1] += 1\n else:\n d[(a-1)*dg + b+1] = 1\n\n if f((a),b-1):\n if (a)*dg + b-1 in d:\n d[(a)*dg + b-1] += 1\n else:\n d[(a)*dg + b-1] = 1\n \n if f(a,b):\n if a*dg + b in d:\n d[a*dg + b] += 1\n else:\n d[a*dg + b] = 1\n \n if f((a),b+1):\n if (a)*dg + b+1 in d:\n d[(a)*dg + b+1] += 1\n else:\n d[(a)*dg + b+1] = 1\n \n if f((a+1),b+1):\n if (a+1)*dg + b+1 in d:\n d[(a+1)*dg + b+1] += 1\n else:\n d[(a+1)*dg + b+1] = 1\n \n if f((a+1),b):\n if (a+1)*dg + b in d:\n d[(a+1)*dg + b] += 1\n else:\n d[(a+1)*dg + b] = 1\n \n if f((a+1),b-1):\n if (a+1)*dg + b-1 in d:\n d[(a+1)*dg + b-1] += 1\n else:\n d[(a+1)*dg + b-1] = 1\n \n \n \n \n res = [0]*10\n \n for e in d:\n res[d[e]] += 1\n \n res[0] = (h-2)*(w-2)-sum(res)\n \n for e in res:\n print(e)\n \nif __name__ == \"__main__\":\n main()",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"def main():\n h,w,n = map(int,input().split())\n dg = 10**10\n d = dict()\n\n def f(x,y):\n if 2 <= x <= h-1 and 2 <= y <= w-1:\n return True\n else:\n False\n\n for i in range(n):\n a,b = map(int,input().split())\n \n if f((a-1),b-1):\n if (a-1)*dg + b-1 in d:\n d[(a-1)*dg + b-1] += 1\n else:\n d[(a-1)*dg + b-1] = 1\n \n if f((a-1),b):\n if (a-1)*dg + b in d:\n d[(a-1)*dg + b] += 1\n else:\n d[(a-1)*dg + b] = 1\n \n if f((a-1),b+1):\n if (a-1)*dg + b+1 in d:\n d[(a-1)*dg + b+1] += 1\n else:\n d[(a-1)*dg + b+1] = 1\n\n if f((a),b-1):\n if (a)*dg + b-1 in d:\n d[(a)*dg + b-1] += 1\n else:\n d[(a)*dg + b-1] = 1\n \n if f(a,b):\n if a*dg + b in d:\n d[a*dg + b] += 1\n else:\n d[a*dg + b] = 1\n \n if f((a),b+1):\n if (a)*dg + b+1 in d:\n d[(a)*dg + b+1] += 1\n else:\n d[(a)*dg + b+1] = 1\n \n if f((a+1),b+1):\n if (a+1)*dg + b+1 in d:\n d[(a+1)*dg + b+1] += 1\n else:\n d[(a+1)*dg + b+1] = 1\n \n if f((a+1),b):\n if (a+1)*dg + b in d:\n d[(a+1)*dg + b] += 1\n else:\n d[(a+1)*dg + b] = 1\n \n if f((a+1),b-1):\n if (a+1)*dg + b-1 in d:\n d[(a+1)*dg + b-1] += 1\n else:\n d[(a+1)*dg + b-1] = 1\n \n \n \n \n res = [0]*10\n \n for e in d:\n res[d[e]] += 1\n \n res[0] = (h-2)*(w-2)-sum(res)\n \n for e in res:\n print(e)\n ",
"main",
"h,w,n = map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"dg = 10**10",
"dg",
"10**10",
"10",
"10",
"d = dict()",
"d",
"dict()",
"dict",
"def f(x,y):\n if 2 <= x <= h-1 and 2 <= y <= w-1:\n return True\n else:\n False\n\n ",
"f",
"if 2 <= x <= h-1 and 2 <= y <= w-1:\n return True\n else:\n False\n\n ",
"2 <= x <= h-1 and 2 <= y <= w-1",
"2 <= x <= h-1",
"2 <= x",
"2",
"x",
"h-1",
"h",
"1",
"2 <= y <= w-1",
"2 <= y",
"2",
"y",
"w-1",
"w",
"1",
"return True",
"True",
"False",
"x",
"x",
"y",
"y",
"for i in range(n):\n a,b = map(int,input().split())\n \n if f((a-1),b-1):\n if (a-1)*dg + b-1 in d:\n d[(a-1)*dg + b-1] += 1\n else:\n d[(a-1)*dg + b-1] = 1\n \n if f((a-1),b):\n if (a-1)*dg + b in d:\n d[(a-1)*dg + b] += 1\n else:\n d[(a-1)*dg + b] = 1\n \n if f((a-1),b+1):\n if (a-1)*dg + b+1 in d:\n d[(a-1)*dg + b+1] += 1\n else:\n d[(a-1)*dg + b+1] = 1\n\n if f((a),b-1):\n if (a)*dg + b-1 in d:\n d[(a)*dg + b-1] += 1\n else:\n d[(a)*dg + b-1] = 1\n \n if f(a,b):\n if a*dg + b in d:\n d[a*dg + b] += 1\n else:\n d[a*dg + b] = 1\n \n if f((a),b+1):\n if (a)*dg + b+1 in d:\n d[(a)*dg + b+1] += 1\n else:\n d[(a)*dg + b+1] = 1\n \n if f((a+1),b+1):\n if (a+1)*dg + b+1 in d:\n d[(a+1)*dg + b+1] += 1\n else:\n d[(a+1)*dg + b+1] = 1\n \n if f((a+1),b):\n if (a+1)*dg + b in d:\n d[(a+1)*dg + b] += 1\n else:\n d[(a+1)*dg + b] = 1\n \n if f((a+1),b-1):\n if (a+1)*dg + b-1 in d:\n d[(a+1)*dg + b-1] += 1\n else:\n d[(a+1)*dg + b-1] = 1\n \n \n \n \n ",
"i",
"range(n)",
"range",
"n",
"a,b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"if f((a-1),b-1):\n if (a-1)*dg + b-1 in d:\n d[(a-1)*dg + b-1] += 1\n else:\n d[(a-1)*dg + b-1] = 1\n \n ",
"f((a-1),b-1)",
"f",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"if (a-1)*dg + b-1 in d:\n d[(a-1)*dg + b-1] += 1\n else:\n d[(a-1)*dg + b-1] = 1\n \n ",
"(a-1)*dg + b-1 in d",
"(a-1)*dg + b-1",
"(a-1)*dg + b",
"(a-1)*dg",
"a-1",
"a",
"1",
"dg",
"b",
"1",
"d",
"d[(a-1)*dg + b-1] += 1",
"d[(a-1)*dg + b-1]",
"d",
"(a-1)*dg + b-1",
"(a-1)*dg + b",
"(a-1)*dg",
"a-1",
"a",
"1",
"dg",
"b",
"1",
"1",
"d[(a-1)*dg + b-1] = 1",
"d[(a-1)*dg + b-1]",
"d",
"(a-1)*dg + b-1",
"(a-1)*dg + b",
"(a-1)*dg",
"a-1",
"a",
"1",
"dg",
"b",
"1",
"1",
"if f((a-1),b):\n if (a-1)*dg + b in d:\n d[(a-1)*dg + b] += 1\n else:\n d[(a-1)*dg + b] = 1\n \n ",
"f((a-1),b)",
"f",
"a-1",
"a",
"1",
"b",
"if (a-1)*dg + b in d:\n d[(a-1)*dg + b] += 1\n else:\n d[(a-1)*dg + b] = 1\n \n ",
"(a-1)*dg + b in d",
"(a-1)*dg + b",
"(a-1)*dg",
"a-1",
"a",
"1",
"dg",
"b",
"d",
"d[(a-1)*dg + b] += 1",
"d[(a-1)*dg + b]",
"d",
"(a-1)*dg + b",
"(a-1)*dg",
"a-1",
"a",
"1",
"dg",
"b",
"1",
"d[(a-1)*dg + b] = 1",
"d[(a-1)*dg + b]",
"d",
"(a-1)*dg + b",
"(a-1)*dg",
"a-1",
"a",
"1",
"dg",
"b",
"1",
"if f((a-1),b+1):\n if (a-1)*dg + b+1 in d:\n d[(a-1)*dg + b+1] += 1\n else:\n d[(a-1)*dg + b+1] = 1\n\n ",
"f((a-1),b+1)",
"f",
"a-1",
"a",
"1",
"b+1",
"b",
"1",
"if (a-1)*dg + b+1 in d:\n d[(a-1)*dg + b+1] += 1\n else:\n d[(a-1)*dg + b+1] = 1\n\n ",
"(a-1)*dg + b+1 in d",
"(a-1)*dg + b+1",
"(a-1)*dg + b",
"(a-1)*dg",
"a-1",
"a",
"1",
"dg",
"b",
"1",
"d",
"d[(a-1)*dg + b+1] += 1",
"d[(a-1)*dg + b+1]",
"d",
"(a-1)*dg + b+1",
"(a-1)*dg + b",
"(a-1)*dg",
"a-1",
"a",
"1",
"dg",
"b",
"1",
"1",
"d[(a-1)*dg + b+1] = 1",
"d[(a-1)*dg + b+1]",
"d",
"(a-1)*dg + b+1",
"(a-1)*dg + b",
"(a-1)*dg",
"a-1",
"a",
"1",
"dg",
"b",
"1",
"1",
"if f((a),b-1):\n if (a)*dg + b-1 in d:\n d[(a)*dg + b-1] += 1\n else:\n d[(a)*dg + b-1] = 1\n \n ",
"f((a),b-1)",
"f",
"a",
"b-1",
"b",
"1",
"if (a)*dg + b-1 in d:\n d[(a)*dg + b-1] += 1\n else:\n d[(a)*dg + b-1] = 1\n \n ",
"(a)*dg + b-1 in d",
"(a)*dg + b-1",
"(a)*dg + b",
"(a)*dg",
"a",
"dg",
"b",
"1",
"d",
"d[(a)*dg + b-1] += 1",
"d[(a)*dg + b-1]",
"d",
"(a)*dg + b-1",
"(a)*dg + b",
"(a)*dg",
"a",
"dg",
"b",
"1",
"1",
"d[(a)*dg + b-1] = 1",
"d[(a)*dg + b-1]",
"d",
"(a)*dg + b-1",
"(a)*dg + b",
"(a)*dg",
"a",
"dg",
"b",
"1",
"1",
"if f(a,b):\n if a*dg + b in d:\n d[a*dg + b] += 1\n else:\n d[a*dg + b] = 1\n \n ",
"f(a,b)",
"f",
"a",
"b",
"if a*dg + b in d:\n d[a*dg + b] += 1\n else:\n d[a*dg + b] = 1\n \n ",
"a*dg + b in d",
"a*dg + b",
"a*dg",
"a",
"dg",
"b",
"d",
"d[a*dg + b] += 1",
"d[a*dg + b]",
"d",
"a*dg + b",
"a*dg",
"a",
"dg",
"b",
"1",
"d[a*dg + b] = 1",
"d[a*dg + b]",
"d",
"a*dg + b",
"a*dg",
"a",
"dg",
"b",
"1",
"if f((a),b+1):\n if (a)*dg + b+1 in d:\n d[(a)*dg + b+1] += 1\n else:\n d[(a)*dg + b+1] = 1\n \n ",
"f((a),b+1)",
"f",
"a",
"b+1",
"b",
"1",
"if (a)*dg + b+1 in d:\n d[(a)*dg + b+1] += 1\n else:\n d[(a)*dg + b+1] = 1\n \n ",
"(a)*dg + b+1 in d",
"(a)*dg + b+1",
"(a)*dg + b",
"(a)*dg",
"a",
"dg",
"b",
"1",
"d",
"d[(a)*dg + b+1] += 1",
"d[(a)*dg + b+1]",
"d",
"(a)*dg + b+1",
"(a)*dg + b",
"(a)*dg",
"a",
"dg",
"b",
"1",
"1",
"d[(a)*dg + b+1] = 1",
"d[(a)*dg + b+1]",
"d",
"(a)*dg + b+1",
"(a)*dg + b",
"(a)*dg",
"a",
"dg",
"b",
"1",
"1",
"if f((a+1),b+1):\n if (a+1)*dg + b+1 in d:\n d[(a+1)*dg + b+1] += 1\n else:\n d[(a+1)*dg + b+1] = 1\n \n ",
"f((a+1),b+1)",
"f",
"a+1",
"a",
"1",
"b+1",
"b",
"1",
"if (a+1)*dg + b+1 in d:\n d[(a+1)*dg + b+1] += 1\n else:\n d[(a+1)*dg + b+1] = 1\n \n ",
"(a+1)*dg + b+1 in d",
"(a+1)*dg + b+1",
"(a+1)*dg + b",
"(a+1)*dg",
"a+1",
"a",
"1",
"dg",
"b",
"1",
"d",
"d[(a+1)*dg + b+1] += 1",
"d[(a+1)*dg + b+1]",
"d",
"(a+1)*dg + b+1",
"(a+1)*dg + b",
"(a+1)*dg",
"a+1",
"a",
"1",
"dg",
"b",
"1",
"1",
"d[(a+1)*dg + b+1] = 1",
"d[(a+1)*dg + b+1]",
"d",
"(a+1)*dg + b+1",
"(a+1)*dg + b",
"(a+1)*dg",
"a+1",
"a",
"1",
"dg",
"b",
"1",
"1",
"if f((a+1),b):\n if (a+1)*dg + b in d:\n d[(a+1)*dg + b] += 1\n else:\n d[(a+1)*dg + b] = 1\n \n ",
"f((a+1),b)",
"f",
"a+1",
"a",
"1",
"b",
"if (a+1)*dg + b in d:\n d[(a+1)*dg + b] += 1\n else:\n d[(a+1)*dg + b] = 1\n \n ",
"(a+1)*dg + b in d",
"(a+1)*dg + b",
"(a+1)*dg",
"a+1",
"a",
"1",
"dg",
"b",
"d",
"d[(a+1)*dg + b] += 1",
"d[(a+1)*dg + b]",
"d",
"(a+1)*dg + b",
"(a+1)*dg",
"a+1",
"a",
"1",
"dg",
"b",
"1",
"d[(a+1)*dg + b] = 1",
"d[(a+1)*dg + b]",
"d",
"(a+1)*dg + b",
"(a+1)*dg",
"a+1",
"a",
"1",
"dg",
"b",
"1",
"if f((a+1),b-1):\n if (a+1)*dg + b-1 in d:\n d[(a+1)*dg + b-1] += 1\n else:\n d[(a+1)*dg + b-1] = 1\n \n \n \n \n ",
"f((a+1),b-1)",
"f",
"a+1",
"a",
"1",
"b-1",
"b",
"1",
"if (a+1)*dg + b-1 in d:\n d[(a+1)*dg + b-1] += 1\n else:\n d[(a+1)*dg + b-1] = 1\n \n \n \n \n ",
"(a+1)*dg + b-1 in d",
"(a+1)*dg + b-1",
"(a+1)*dg + b",
"(a+1)*dg",
"a+1",
"a",
"1",
"dg",
"b",
"1",
"d",
"d[(a+1)*dg + b-1] += 1",
"d[(a+1)*dg + b-1]",
"d",
"(a+1)*dg + b-1",
"(a+1)*dg + b",
"(a+1)*dg",
"a+1",
"a",
"1",
"dg",
"b",
"1",
"1",
"d[(a+1)*dg + b-1] = 1",
"d[(a+1)*dg + b-1]",
"d",
"(a+1)*dg + b-1",
"(a+1)*dg + b",
"(a+1)*dg",
"a+1",
"a",
"1",
"dg",
"b",
"1",
"1",
"res = [0]*10",
"res",
"[0]*10",
"[0]",
"0",
"10",
"for e in d:\n res[d[e]] += 1\n \n ",
"e",
"d",
"res[d[e]] += 1",
"res[d[e]]",
"res",
"d[e]",
"d",
"e",
"1",
"res[0] = (h-2)*(w-2)-sum(res)",
"res[0]",
"res",
"0",
"(h-2)*(w-2)-sum(res)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(res)",
"sum",
"res",
"for e in res:\n print(e)\n ",
"e",
"res",
"print(e)",
"print",
"e",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n h,w,n = map(int,input().split())\n dg = 10**10\n d = dict()\n\n def f(x,y):\n if 2 <= x <= h-1 and 2 <= y <= w-1:\n return True\n else:\n False\n\n for i in range(n):\n a,b = map(int,input().split())\n \n if f((a-1),b-1):\n if (a-1)*dg + b-1 in d:\n d[(a-1)*dg + b-1] += 1\n else:\n d[(a-1)*dg + b-1] = 1\n \n if f((a-1),b):\n if (a-1)*dg + b in d:\n d[(a-1)*dg + b] += 1\n else:\n d[(a-1)*dg + b] = 1\n \n if f((a-1),b+1):\n if (a-1)*dg + b+1 in d:\n d[(a-1)*dg + b+1] += 1\n else:\n d[(a-1)*dg + b+1] = 1\n\n if f((a),b-1):\n if (a)*dg + b-1 in d:\n d[(a)*dg + b-1] += 1\n else:\n d[(a)*dg + b-1] = 1\n \n if f(a,b):\n if a*dg + b in d:\n d[a*dg + b] += 1\n else:\n d[a*dg + b] = 1\n \n if f((a),b+1):\n if (a)*dg + b+1 in d:\n d[(a)*dg + b+1] += 1\n else:\n d[(a)*dg + b+1] = 1\n \n if f((a+1),b+1):\n if (a+1)*dg + b+1 in d:\n d[(a+1)*dg + b+1] += 1\n else:\n d[(a+1)*dg + b+1] = 1\n \n if f((a+1),b):\n if (a+1)*dg + b in d:\n d[(a+1)*dg + b] += 1\n else:\n d[(a+1)*dg + b] = 1\n \n if f((a+1),b-1):\n if (a+1)*dg + b-1 in d:\n d[(a+1)*dg + b-1] += 1\n else:\n d[(a+1)*dg + b-1] = 1\n \n \n \n \n res = [0]*10\n \n for e in d:\n res[d[e]] += 1\n \n res[0] = (h-2)*(w-2)-sum(res)\n \n for e in res:\n print(e)\n ",
"def main():\n h,w,n = map(int,input().split())\n dg = 10**10\n d = dict()\n\n def f(x,y):\n if 2 <= x <= h-1 and 2 <= y <= w-1:\n return True\n else:\n False\n\n for i in range(n):\n a,b = map(int,input().split())\n \n if f((a-1),b-1):\n if (a-1)*dg + b-1 in d:\n d[(a-1)*dg + b-1] += 1\n else:\n d[(a-1)*dg + b-1] = 1\n \n if f((a-1),b):\n if (a-1)*dg + b in d:\n d[(a-1)*dg + b] += 1\n else:\n d[(a-1)*dg + b] = 1\n \n if f((a-1),b+1):\n if (a-1)*dg + b+1 in d:\n d[(a-1)*dg + b+1] += 1\n else:\n d[(a-1)*dg + b+1] = 1\n\n if f((a),b-1):\n if (a)*dg + b-1 in d:\n d[(a)*dg + b-1] += 1\n else:\n d[(a)*dg + b-1] = 1\n \n if f(a,b):\n if a*dg + b in d:\n d[a*dg + b] += 1\n else:\n d[a*dg + b] = 1\n \n if f((a),b+1):\n if (a)*dg + b+1 in d:\n d[(a)*dg + b+1] += 1\n else:\n d[(a)*dg + b+1] = 1\n \n if f((a+1),b+1):\n if (a+1)*dg + b+1 in d:\n d[(a+1)*dg + b+1] += 1\n else:\n d[(a+1)*dg + b+1] = 1\n \n if f((a+1),b):\n if (a+1)*dg + b in d:\n d[(a+1)*dg + b] += 1\n else:\n d[(a+1)*dg + b] = 1\n \n if f((a+1),b-1):\n if (a+1)*dg + b-1 in d:\n d[(a+1)*dg + b-1] += 1\n else:\n d[(a+1)*dg + b-1] = 1\n \n \n \n \n res = [0]*10\n \n for e in d:\n res[d[e]] += 1\n \n res[0] = (h-2)*(w-2)-sum(res)\n \n for e in res:\n print(e)\n ",
"main",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input"
] | import sys
input = sys.stdin.readline
def main():
h,w,n = map(int,input().split())
dg = 10**10
d = dict()
def f(x,y):
if 2 <= x <= h-1 and 2 <= y <= w-1:
return True
else:
False
for i in range(n):
a,b = map(int,input().split())
if f((a-1),b-1):
if (a-1)*dg + b-1 in d:
d[(a-1)*dg + b-1] += 1
else:
d[(a-1)*dg + b-1] = 1
if f((a-1),b):
if (a-1)*dg + b in d:
d[(a-1)*dg + b] += 1
else:
d[(a-1)*dg + b] = 1
if f((a-1),b+1):
if (a-1)*dg + b+1 in d:
d[(a-1)*dg + b+1] += 1
else:
d[(a-1)*dg + b+1] = 1
if f((a),b-1):
if (a)*dg + b-1 in d:
d[(a)*dg + b-1] += 1
else:
d[(a)*dg + b-1] = 1
if f(a,b):
if a*dg + b in d:
d[a*dg + b] += 1
else:
d[a*dg + b] = 1
if f((a),b+1):
if (a)*dg + b+1 in d:
d[(a)*dg + b+1] += 1
else:
d[(a)*dg + b+1] = 1
if f((a+1),b+1):
if (a+1)*dg + b+1 in d:
d[(a+1)*dg + b+1] += 1
else:
d[(a+1)*dg + b+1] = 1
if f((a+1),b):
if (a+1)*dg + b in d:
d[(a+1)*dg + b] += 1
else:
d[(a+1)*dg + b] = 1
if f((a+1),b-1):
if (a+1)*dg + b-1 in d:
d[(a+1)*dg + b-1] += 1
else:
d[(a+1)*dg + b-1] = 1
res = [0]*10
for e in d:
res[d[e]] += 1
res[0] = (h-2)*(w-2)-sum(res)
for e in res:
print(e)
if __name__ == "__main__":
main()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
14,
2,
2,
40,
17,
2,
13,
13,
2,
13,
17,
2,
40,
17,
2,
13,
13,
2,
13,
17,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
38,
5,
0,
18,
13,
13,
4,
13,
0,
18,
18,
13,
13,
13,
17,
0,
18,
18,
13,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
13,
0,
13,
17,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
38,
5,
9,
14,
2,
18,
18,
13,
2,
13,
13,
2,
13,
13,
17,
0,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
28,
13,
13,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] | [
[
211,
2
],
[
211,
11
],
[
211,
12
],
[
205,
14
],
[
202,
18
],
[
23,
22
],
[
212,
25
],
[
208,
27
],
[
208,
36
],
[
199,
38
],
[
196,
41
],
[
45,
44
],
[
51,
50
],
[
200,
61
],
[
185,
61
],
[
50,
62
],
[
191,
64
],
[
197,
70
],
[
209,
70
],
[
44,
71
],
[
194,
73
],
[
203,
77
],
[
200,
81
],
[
185,
81
],
[
50,
82
],
[
197,
84
],
[
209,
84
],
[
44,
85
],
[
92,
89
],
[
206,
90
],
[
200,
91
],
[
185,
91
],
[
100,
95
],
[
89,
96
],
[
206,
97
],
[
200,
98
],
[
185,
98
],
[
197,
99
],
[
209,
99
],
[
107,
102
],
[
89,
103
],
[
206,
104
],
[
200,
105
],
[
185,
105
],
[
197,
106
],
[
209,
106
],
[
187,
109
],
[
181,
119
],
[
123,
122
],
[
129,
128
],
[
206,
140
],
[
200,
142
],
[
185,
142
],
[
122,
143
],
[
197,
145
],
[
209,
145
],
[
128,
146
],
[
214,
149
],
[
155,
152
],
[
188,
153
],
[
215,
154
],
[
182,
154
],
[
160,
157
],
[
188,
158
],
[
191,
163
],
[
194,
166
],
[
188,
171
],
[
176,
175
],
[
188,
175
],
[
175,
179
],
[
181,
182
],
[
208,
185
],
[
187,
188
],
[
211,
191
],
[
211,
194
],
[
196,
197
],
[
199,
200
],
[
202,
203
],
[
205,
206
],
[
208,
209
],
[
211,
212
],
[
214,
215
]
] | [
"h,w,n = map(int, input().split())\n\n# 黒マス black[y座標] = [x1,x2,...]\nblack = dict()\n\n# 周囲に黒マスがあるマス\nsearch = set()\n\nfor i in range(n):\n a,b = map(int, input().split())\n a-=1\n b-=1\n for x in [-1,0,1]:\n for y in [-1,0,1]:\n if 1<=a+y<h-1 and 1<=b+x<w-1:\n search.add((a+y,b+x)) # タプル。set()内にリストは格納できない。\n try:\n black[a][b]=1\n except:\n black[a]=dict()\n black[a][b]=1\n\n\nans = [0]*10\n# 探索すべき全マスに対して、周囲の黒マスの数を数える。\nfor a,b in search:\n p = 0\n for y in [-1,0,1]:\n for x in [-1,0,1]:\n try:\n if black[a+y][b+x]==1:\n p+=1\n except:\n continue\n ans[p]+=1\nans[0]=(h-2)*(w-2)-sum(ans[1:])\n\nfor a in ans:\n print(a)",
"h,w,n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"black = dict()",
"black",
"dict()",
"dict",
"search = set()",
"search",
"set()",
"set",
"for i in range(n):\n a,b = map(int, input().split())\n a-=1\n b-=1\n for x in [-1,0,1]:\n for y in [-1,0,1]:\n if 1<=a+y<h-1 and 1<=b+x<w-1:\n search.add((a+y,b+x)) # タプル。set()内にリストは格納できない。\n try:\n black[a][b]=1\n except:\n black[a]=dict()\n black[a][b]=1",
"i",
"range(n)",
"range",
"n",
"a,b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"a-=1",
"a",
"1",
"b-=1",
"b",
"1",
"for x in [-1,0,1]:\n for y in [-1,0,1]:\n if 1<=a+y<h-1 and 1<=b+x<w-1:\n search.add((a+y,b+x)) # タプル。set()内にリストは格納できない。\n ",
"x",
"[-1,0,1]",
"-1",
"0",
"1",
"for y in [-1,0,1]:\n if 1<=a+y<h-1 and 1<=b+x<w-1:\n search.add((a+y,b+x)) # タプル。set()内にリストは格納できない。\n ",
"y",
"[-1,0,1]",
"-1",
"0",
"1",
"if 1<=a+y<h-1 and 1<=b+x<w-1:\n search.add((a+y,b+x)) # タプル。set()内にリストは格納できない。\n ",
"1<=a+y<h-1 and 1<=b+x<w-1",
"1<=a+y<h-1",
"1<=a+y",
"1",
"a+y",
"a",
"y",
"h-1",
"h",
"1",
"1<=b+x<w-1",
"1<=b+x",
"1",
"b+x",
"b",
"x",
"w-1",
"w",
"1",
"search.add((a+y,b+x))",
"search.add",
"search",
"add",
"(a+y,b+x)",
"a+y",
"a",
"y",
"b+x",
"b",
"x",
"try:\n black[a][b]=1\n except:\n black[a]=dict()\n black[a][b]=1",
"except:\n black[a]=dict()\n black[a][b]=1",
"black[a]=dict()",
"black[a]",
"black",
"a",
"dict()",
"dict",
"black[a][b]=1",
"black[a][b]",
"[a]",
"black",
"a",
"b",
"1",
"black[a][b]=1",
"black[a][b]",
"[a]",
"black",
"a",
"b",
"1",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for a,b in search:\n p = 0\n for y in [-1,0,1]:\n for x in [-1,0,1]:\n try:\n if black[a+y][b+x]==1:\n p+=1\n except:\n continue\n ans[p]+=1",
"a",
"b",
"search",
"p = 0",
"p",
"0",
"for y in [-1,0,1]:\n for x in [-1,0,1]:\n try:\n if black[a+y][b+x]==1:\n p+=1\n except:\n continue\n ",
"y",
"[-1,0,1]",
"-1",
"0",
"1",
"for x in [-1,0,1]:\n try:\n if black[a+y][b+x]==1:\n p+=1\n except:\n continue\n ",
"x",
"[-1,0,1]",
"-1",
"0",
"1",
"try:\n if black[a+y][b+x]==1:\n p+=1\n except:\n continue\n ",
"except:\n continue\n ",
"continue",
"if black[a+y][b+x]==1:\n p+=1\n ",
"black[a+y][b+x]==1",
"black[a+y][b+x]",
"[a+y]",
"black",
"a+y",
"a",
"y",
"b+x",
"b",
"x",
"1",
"p+=1",
"p",
"1",
"ans[p]+=1",
"ans[p]",
"ans",
"p",
"1",
"ans[0]=(h-2)*(w-2)-sum(ans[1:])",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)-sum(ans[1:])",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"for a in ans:\n print(a)",
"a",
"ans",
"print(a)",
"print",
"a",
"p = 0",
"0",
"p",
"a,b = map(int, input().split())",
"map(int, input().split())",
"a",
"ans = [0]*10",
"[0]*10",
"ans",
"h,w,n = map(int, input().split())",
"map(int, input().split())",
"h",
"w,n = map(int, input().split())",
"map(int, input().split())",
"w",
"b-=1",
"1",
"b",
"a-=1",
"1",
"a",
"search = set()",
"set()",
"search",
"black = dict()",
"dict()",
"black",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"p+=1",
"1",
"p"
] | h,w,n = map(int, input().split())
# 黒マス black[y座標] = [x1,x2,...]
black = dict()
# 周囲に黒マスがあるマス
search = set()
for i in range(n):
a,b = map(int, input().split())
a-=1
b-=1
for x in [-1,0,1]:
for y in [-1,0,1]:
if 1<=a+y<h-1 and 1<=b+x<w-1:
search.add((a+y,b+x)) # タプル。set()内にリストは格納できない。
try:
black[a][b]=1
except:
black[a]=dict()
black[a][b]=1
ans = [0]*10
# 探索すべき全マスに対して、周囲の黒マスの数を数える。
for a,b in search:
p = 0
for y in [-1,0,1]:
for x in [-1,0,1]:
try:
if black[a+y][b+x]==1:
p+=1
except:
continue
ans[p]+=1
ans[0]=(h-2)*(w-2)-sum(ans[1:])
for a in ans:
print(a) |
[
7,
15,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
4,
18,
13,
13,
0,
13,
2,
39,
17,
17,
28,
13,
4,
13,
13,
0,
13,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
13,
28,
13,
13,
13,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
2,
4,
13,
2,
13,
17,
13,
17,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
2,
4,
13,
2,
13,
17,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
0,
13,
2,
4,
13,
18,
13,
2,
13,
13,
2,
13,
17,
4,
13,
18,
13,
2,
13,
13,
13,
0,
18,
13,
13,
17,
28,
13,
4,
13,
17,
17,
0,
18,
13,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
18,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
13,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] | [
[
209,
4
],
[
209,
13
],
[
209,
14
],
[
203,
16
],
[
23,
22
],
[
195,
25
],
[
200,
38
],
[
201,
42
],
[
206,
45
],
[
52,
51
],
[
195,
54
],
[
197,
56
],
[
201,
58
],
[
51,
59
],
[
197,
60
],
[
204,
64
],
[
183,
65
],
[
198,
67
],
[
74,
73
],
[
183,
80
],
[
210,
86
],
[
183,
88
],
[
92,
91
],
[
198,
98
],
[
192,
104
],
[
198,
106
],
[
185,
109
],
[
113,
112
],
[
188,
117
],
[
204,
122
],
[
73,
124
],
[
112,
125
],
[
91,
127
],
[
204,
132
],
[
73,
134
],
[
112,
135
],
[
91,
136
],
[
141,
138
],
[
207,
139
],
[
189,
140
],
[
186,
140
],
[
144,
143
],
[
152,
149
],
[
207,
150
],
[
143,
151
],
[
143,
152
],
[
157,
154
],
[
207,
155
],
[
192,
160
],
[
210,
163
],
[
207,
168
],
[
173,
172
],
[
149,
178
],
[
207,
179
],
[
172,
180
],
[
197,
183
],
[
185,
186
],
[
188,
189
],
[
209,
192
],
[
209,
195
],
[
197,
198
],
[
200,
201
],
[
203,
204
],
[
206,
207
],
[
209,
210
]
] | [
"from collections import defaultdict\nfrom bisect import *\nh, w, n = map(int, input().split())\n\nd = defaultdict(list)\nq = [list(map(int, input().split())) for i in range(n)]\nq.sort()\nans = [0]*10\nfor i in range(n):\n a, b = q[i]\n d[a].append(b)\n\nfor a, b in q:\n for i in range(max(1, a-2), min(h-2, a)+1):\n for j in range(max(1, b-2), min(w-2, b)+1):\n count = 0\n for k in range(3):\n count += bisect_right(d[i+k], j+2) - bisect_left(d[i+k], j)\n ans[count] += 1\n\n\nfor i in range(1, 10):\n ans[i] //= i\n\nans[0] = (w-2)*(h-2) - sum(ans[1:])\nfor i in range(10):\n print(ans[i])",
"from collections import defaultdict",
"from bisect import *",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"d = defaultdict(list)",
"d",
"defaultdict(list)",
"defaultdict",
"list",
"list(map(int, input().split())) for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"q = [list(map(int, input().split())) for i in range(n)]",
"q",
"[list(map(int, input().split())) for i in range(n)]",
"q.sort()",
"q.sort",
"q",
"sort",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for i in range(n):\n a, b = q[i]\n d[a].append(b)",
"i",
"range(n)",
"range",
"n",
"a, b = q[i]",
"a",
"q[i]",
"q",
"i",
"b",
"d[a].append(b)",
"[a].append",
"[a]",
"d",
"a",
"append",
"b",
"for a, b in q:\n for i in range(max(1, a-2), min(h-2, a)+1):\n for j in range(max(1, b-2), min(w-2, b)+1):\n count = 0\n for k in range(3):\n count += bisect_right(d[i+k], j+2) - bisect_left(d[i+k], j)\n ans[count] += 1",
"a",
"b",
"q",
"for i in range(max(1, a-2), min(h-2, a)+1):\n for j in range(max(1, b-2), min(w-2, b)+1):\n count = 0\n for k in range(3):\n count += bisect_right(d[i+k], j+2) - bisect_left(d[i+k], j)\n ans[count] += 1",
"i",
"range(max(1, a-2), min(h-2, a)+1)",
"range",
"max(1, a-2)",
"max",
"1",
"a-2",
"a",
"2",
"min(h-2, a)+1",
"min(h-2, a)",
"min",
"h-2",
"h",
"2",
"a",
"1",
"for j in range(max(1, b-2), min(w-2, b)+1):\n count = 0\n for k in range(3):\n count += bisect_right(d[i+k], j+2) - bisect_left(d[i+k], j)\n ans[count] += 1",
"j",
"range(max(1, b-2), min(w-2, b)+1)",
"range",
"max(1, b-2)",
"max",
"1",
"b-2",
"b",
"2",
"min(w-2, b)+1",
"min(w-2, b)",
"min",
"w-2",
"w",
"2",
"b",
"1",
"count = 0",
"count",
"0",
"for k in range(3):\n count += bisect_right(d[i+k], j+2) - bisect_left(d[i+k], j)\n ",
"k",
"range(3)",
"range",
"3",
"count += bisect_right(d[i+k], j+2) - bisect_left(d[i+k], j)",
"count",
"bisect_right(d[i+k], j+2) - bisect_left(d[i+k], j)",
"bisect_right(d[i+k], j+2)",
"bisect_right",
"d[i+k]",
"d",
"i+k",
"i",
"k",
"j+2",
"j",
"2",
"bisect_left(d[i+k], j)",
"bisect_left",
"d[i+k]",
"d",
"i+k",
"i",
"k",
"j",
"ans[count] += 1",
"ans[count]",
"ans",
"count",
"1",
"for i in range(1, 10):\n ans[i] //= i",
"i",
"range(1, 10)",
"range",
"1",
"10",
"ans[i] //= i",
"ans[i]",
"ans",
"i",
"i",
"ans[0] = (w-2)*(h-2) - sum(ans[1:])",
"ans[0]",
"ans",
"0",
"(w-2)*(h-2) - sum(ans[1:])",
"(w-2)*(h-2)",
"w-2",
"w",
"2",
"h-2",
"h",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"a, b = q[i]",
"q[i]",
"a",
"count = 0",
"0",
"count",
"count += bisect_right(d[i+k], j+2) - bisect_left(d[i+k], j)",
"bisect_right(d[i+k], j+2) - bisect_left(d[i+k], j)",
"count",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"b = q[i]",
"q[i]",
"b",
"q = [list(map(int, input().split())) for i in range(n)]",
"[list(map(int, input().split())) for i in range(n)]",
"q",
"d = defaultdict(list)",
"defaultdict(list)",
"d",
"ans = [0]*10",
"[0]*10",
"ans",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h"
] | from collections import defaultdict
from bisect import *
h, w, n = map(int, input().split())
d = defaultdict(list)
q = [list(map(int, input().split())) for i in range(n)]
q.sort()
ans = [0]*10
for i in range(n):
a, b = q[i]
d[a].append(b)
for a, b in q:
for i in range(max(1, a-2), min(h-2, a)+1):
for j in range(max(1, b-2), min(w-2, b)+1):
count = 0
for k in range(3):
count += bisect_right(d[i+k], j+2) - bisect_left(d[i+k], j)
ans[count] += 1
for i in range(1, 10):
ans[i] //= i
ans[0] = (w-2)*(h-2) - sum(ans[1:])
for i in range(10):
print(ans[i])
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
40,
2,
17,
2,
13,
13,
2,
13,
17,
40,
2,
17,
2,
13,
13,
2,
13,
17,
14,
40,
39,
2,
13,
13,
2,
13,
13,
4,
18,
13,
13,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
2,
39,
17,
17,
0,
13,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] | [
[
146,
2
],
[
146,
11
],
[
146,
12
],
[
158,
14
],
[
18,
17
],
[
147,
20
],
[
164,
22
],
[
164,
31
],
[
34,
33
],
[
39,
38
],
[
162,
48
],
[
33,
49
],
[
144,
51
],
[
165,
57
],
[
38,
58
],
[
141,
60
],
[
162,
66
],
[
33,
67
],
[
165,
69
],
[
38,
70
],
[
159,
73
],
[
85,
76
],
[
159,
77
],
[
162,
80
],
[
33,
81
],
[
165,
83
],
[
38,
84
],
[
96,
87
],
[
159,
88
],
[
162,
91
],
[
33,
92
],
[
165,
94
],
[
38,
95
],
[
155,
98
],
[
149,
104
],
[
108,
107
],
[
159,
110
],
[
116,
113
],
[
156,
114
],
[
107,
115
],
[
152,
118
],
[
124,
121
],
[
156,
122
],
[
144,
127
],
[
141,
130
],
[
153,
132
],
[
150,
132
],
[
135,
134
],
[
156,
134
],
[
134,
138
],
[
146,
141
],
[
146,
144
],
[
146,
147
],
[
149,
150
],
[
152,
153
],
[
155,
156
],
[
158,
159
],
[
164,
162
],
[
164,
165
]
] | [
"H,W,N = map(int,input().split())\ndic = {}\nfor i in range(N):\n a,b = map(int,input().split())\n for dh in range(3):\n for dw in range(3):\n if 0<a-dh<=H-2 and 0<b-dw<=W-2:\n if (a-dh,b-dw) not in dic.keys():\n dic[(a-dh,b-dw)] = 1\n else:\n dic[(a-dh,b-dw)] += 1\n\nAns = [0]*10\ntotal = 0\nfor v in dic.values():\n Ans[v] += 1\n total += 1\n\nAns[0] = (H-2)*(W-2) - total\n\nfor ans in Ans:\n print(ans)\n",
"H,W,N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"dic = {}",
"dic",
"{}",
"for i in range(N):\n a,b = map(int,input().split())\n for dh in range(3):\n for dw in range(3):\n if 0<a-dh<=H-2 and 0<b-dw<=W-2:\n if (a-dh,b-dw) not in dic.keys():\n dic[(a-dh,b-dw)] = 1\n else:\n dic[(a-dh,b-dw)] += 1",
"i",
"range(N)",
"range",
"N",
"a,b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for dh in range(3):\n for dw in range(3):\n if 0<a-dh<=H-2 and 0<b-dw<=W-2:\n if (a-dh,b-dw) not in dic.keys():\n dic[(a-dh,b-dw)] = 1\n else:\n dic[(a-dh,b-dw)] += 1",
"dh",
"range(3)",
"range",
"3",
"for dw in range(3):\n if 0<a-dh<=H-2 and 0<b-dw<=W-2:\n if (a-dh,b-dw) not in dic.keys():\n dic[(a-dh,b-dw)] = 1\n else:\n dic[(a-dh,b-dw)] += 1",
"dw",
"range(3)",
"range",
"3",
"if 0<a-dh<=H-2 and 0<b-dw<=W-2:\n if (a-dh,b-dw) not in dic.keys():\n dic[(a-dh,b-dw)] = 1\n else:\n dic[(a-dh,b-dw)] += 1",
"0<a-dh<=H-2 and 0<b-dw<=W-2",
"0<a-dh<=H-2",
"0<a-dh",
"0",
"a-dh",
"a",
"dh",
"H-2",
"H",
"2",
"0<b-dw<=W-2",
"0<b-dw",
"0",
"b-dw",
"b",
"dw",
"W-2",
"W",
"2",
"if (a-dh,b-dw) not in dic.keys():\n dic[(a-dh,b-dw)] = 1\n else:\n dic[(a-dh,b-dw)] += 1",
"(a-dh,b-dw) not in dic.keys()",
"(a-dh,b-dw)",
"a-dh",
"a",
"dh",
"b-dw",
"b",
"dw",
"dic.keys()",
"dic.keys",
"dic",
"keys",
"dic[(a-dh,b-dw)] = 1",
"dic[(a-dh,b-dw)]",
"dic",
"(a-dh,b-dw)",
"a-dh",
"a",
"dh",
"b-dw",
"b",
"dw",
"1",
"dic[(a-dh,b-dw)] += 1",
"dic[(a-dh,b-dw)]",
"dic",
"(a-dh,b-dw)",
"a-dh",
"a",
"dh",
"b-dw",
"b",
"dw",
"1",
"Ans = [0]*10",
"Ans",
"[0]*10",
"[0]",
"0",
"10",
"total = 0",
"total",
"0",
"for v in dic.values():\n Ans[v] += 1\n total += 1",
"v",
"dic.values()",
"dic.values",
"dic",
"values",
"Ans[v] += 1",
"Ans[v]",
"Ans",
"v",
"1",
"total += 1",
"total",
"1",
"Ans[0] = (H-2)*(W-2) - total",
"Ans[0]",
"Ans",
"0",
"(H-2)*(W-2) - total",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"total",
"for ans in Ans:\n print(ans)",
"ans",
"Ans",
"print(ans)",
"print",
"ans",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"total = 0",
"0",
"total",
"total += 1",
"1",
"total",
"Ans = [0]*10",
"[0]*10",
"Ans",
"dic = {}",
"{}",
"dic",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"b = map(int,input().split())",
"map(int,input().split())",
"b"
] | H,W,N = map(int,input().split())
dic = {}
for i in range(N):
a,b = map(int,input().split())
for dh in range(3):
for dw in range(3):
if 0<a-dh<=H-2 and 0<b-dw<=W-2:
if (a-dh,b-dw) not in dic.keys():
dic[(a-dh,b-dw)] = 1
else:
dic[(a-dh,b-dw)] += 1
Ans = [0]*10
total = 0
for v in dic.values():
Ans[v] += 1
total += 1
Ans[0] = (H-2)*(W-2) - total
for ans in Ans:
print(ans)
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
39,
2,
2,
13,
17,
2,
13,
17,
2,
39,
17,
17,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
14,
2,
2,
40,
17,
2,
13,
13,
13,
2,
40,
17,
2,
13,
13,
13,
0,
18,
13,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
18,
13,
2,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
28,
13,
4,
13,
17,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
138,
3
],
[
138,
12
],
[
138,
13
],
[
129,
15
],
[
139,
20
],
[
127,
23
],
[
132,
30
],
[
36,
35
],
[
136,
38
],
[
141,
40
],
[
141,
49
],
[
52,
51
],
[
58,
57
],
[
142,
68
],
[
51,
69
],
[
139,
70
],
[
124,
75
],
[
57,
76
],
[
127,
77
],
[
90,
79
],
[
130,
80
],
[
133,
82
],
[
142,
85
],
[
51,
86
],
[
124,
88
],
[
57,
89
],
[
105,
92
],
[
130,
93
],
[
133,
96
],
[
142,
99
],
[
51,
100
],
[
124,
102
],
[
57,
103
],
[
116,
107
],
[
133,
108
],
[
142,
111
],
[
51,
112
],
[
124,
114
],
[
57,
115
],
[
119,
118
],
[
141,
124
],
[
138,
127
],
[
129,
130
],
[
132,
133
],
[
138,
136
],
[
138,
139
],
[
141,
142
]
] | [
"from collections import defaultdict\n\nH, W, N = map(int,input().split())\n \nans =[(H-2)*(W-2)]+[0]*9\nblacks = defaultdict(int)\nfor i in range(N):\n a, b = map(int,input().split())\n for dx in [-1,0,1]:\n for dy in [-1,0,1]:\n if 2 <= a+dx <H and 2 <= b+dy <W:\n ans[blacks[(a+dx,b+dy)]]-=1\n ans[blacks[(a+dx,b+dy)]+1]+=1\n blacks[(a+dx,b+dy)]+=1\n \nfor i in range(10): print(ans[i])",
"from collections import defaultdict",
"H, W, N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"ans =[(H-2)*(W-2)]+[0]*9",
"ans",
"[(H-2)*(W-2)]+[0]*9",
"[(H-2)*(W-2)]",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"[0]*9",
"[0]",
"0",
"9",
"blacks = defaultdict(int)",
"blacks",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n a, b = map(int,input().split())\n for dx in [-1,0,1]:\n for dy in [-1,0,1]:\n if 2 <= a+dx <H and 2 <= b+dy <W:\n ans[blacks[(a+dx,b+dy)]]-=1\n ans[blacks[(a+dx,b+dy)]+1]+=1\n blacks[(a+dx,b+dy)]+=1\n ",
"i",
"range(N)",
"range",
"N",
"a, b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for dx in [-1,0,1]:\n for dy in [-1,0,1]:\n if 2 <= a+dx <H and 2 <= b+dy <W:\n ans[blacks[(a+dx,b+dy)]]-=1\n ans[blacks[(a+dx,b+dy)]+1]+=1\n blacks[(a+dx,b+dy)]+=1\n ",
"dx",
"[-1,0,1]",
"-1",
"0",
"1",
"for dy in [-1,0,1]:\n if 2 <= a+dx <H and 2 <= b+dy <W:\n ans[blacks[(a+dx,b+dy)]]-=1\n ans[blacks[(a+dx,b+dy)]+1]+=1\n blacks[(a+dx,b+dy)]+=1\n ",
"dy",
"[-1,0,1]",
"-1",
"0",
"1",
"if 2 <= a+dx <H and 2 <= b+dy <W:\n ans[blacks[(a+dx,b+dy)]]-=1\n ans[blacks[(a+dx,b+dy)]+1]+=1\n ",
"2 <= a+dx <H and 2 <= b+dy <W",
"2 <= a+dx <H",
"2 <= a+dx",
"2",
"a+dx",
"a",
"dx",
"H",
"2 <= b+dy <W",
"2 <= b+dy",
"2",
"b+dy",
"b",
"dy",
"W",
"ans[blacks[(a+dx,b+dy)]]-=1",
"ans[blacks[(a+dx,b+dy)]]",
"ans",
"blacks[(a+dx,b+dy)]",
"blacks",
"(a+dx,b+dy)",
"a+dx",
"a",
"dx",
"b+dy",
"b",
"dy",
"1",
"ans[blacks[(a+dx,b+dy)]+1]+=1",
"ans[blacks[(a+dx,b+dy)]+1]",
"ans",
"blacks[(a+dx,b+dy)]+1",
"blacks[(a+dx,b+dy)]",
"blacks",
"(a+dx,b+dy)",
"a+dx",
"a",
"dx",
"b+dy",
"b",
"dy",
"1",
"1",
"blacks[(a+dx,b+dy)]+=1",
"blacks[(a+dx,b+dy)]",
"blacks",
"(a+dx,b+dy)",
"a+dx",
"a",
"dx",
"b+dy",
"b",
"dy",
"1",
"for i in range(10): print(ans[i])",
"i",
"range(10)",
"range",
"10",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"W, N = map(int,input().split())",
"map(int,input().split())",
"W",
"ans =[(H-2)*(W-2)]+[0]*9",
"[(H-2)*(W-2)]+[0]*9",
"ans",
"blacks = defaultdict(int)",
"defaultdict(int)",
"blacks",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"H, W, N = map(int,input().split())",
"map(int,input().split())",
"H",
"a, b = map(int,input().split())",
"map(int,input().split())",
"a"
] | from collections import defaultdict
H, W, N = map(int,input().split())
ans =[(H-2)*(W-2)]+[0]*9
blacks = defaultdict(int)
for i in range(N):
a, b = map(int,input().split())
for dx in [-1,0,1]:
for dy in [-1,0,1]:
if 2 <= a+dx <H and 2 <= b+dy <W:
ans[blacks[(a+dx,b+dy)]]-=1
ans[blacks[(a+dx,b+dy)]+1]+=1
blacks[(a+dx,b+dy)]+=1
for i in range(10): print(ans[i])
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
2,
40,
17,
2,
13,
13,
2,
13,
17,
2,
40,
17,
2,
13,
13,
2,
13,
17,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
0,
13,
4,
13,
13,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
143,
3
],
[
143,
12
],
[
143,
13
],
[
146,
15
],
[
19,
18
],
[
144,
21
],
[
155,
23
],
[
155,
32
],
[
131,
34
],
[
137,
37
],
[
41,
40
],
[
47,
46
],
[
132,
57
],
[
156,
57
],
[
40,
58
],
[
141,
60
],
[
138,
66
],
[
150,
66
],
[
46,
67
],
[
135,
69
],
[
147,
73
],
[
132,
77
],
[
156,
77
],
[
40,
78
],
[
138,
80
],
[
150,
80
],
[
46,
81
],
[
152,
83
],
[
92,
89
],
[
153,
90
],
[
141,
94
],
[
135,
97
],
[
158,
100
],
[
147,
103
],
[
106,
105
],
[
159,
108
],
[
114,
111
],
[
153,
112
],
[
105,
113
],
[
119,
116
],
[
153,
117
],
[
122,
121
],
[
111,
127
],
[
153,
128
],
[
121,
129
],
[
131,
132
],
[
143,
135
],
[
137,
138
],
[
143,
141
],
[
143,
144
],
[
146,
147
],
[
155,
150
],
[
152,
153
],
[
155,
156
],
[
158,
159
]
] | [
"from collections import Counter\n\nh,w,N=map(int,input().split())\nrec=[]\nfor i in range(N):\n a,b=map(int,input().split())\n a-=1\n b-=1\n for i in range(-2,1):\n for j in range(-2,1):\n if 0<=a+i<h-2 and 0<=b+j<w-2:\n rec.append((a+i,b+j))\n\nans=[0]*10\nans[0]=(h-2)*(w-2)\nc=Counter(rec)\nfor i in c.values():\n ans[i]+=1\n ans[0]-=1\nfor i in range(10):\n print(ans[i])",
"from collections import Counter",
"h,w,N=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"N",
"rec=[]",
"rec",
"[]",
"for i in range(N):\n a,b=map(int,input().split())\n a-=1\n b-=1\n for i in range(-2,1):\n for j in range(-2,1):\n if 0<=a+i<h-2 and 0<=b+j<w-2:\n rec.append((a+i,b+j))",
"i",
"range(N)",
"range",
"N",
"a,b=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"a-=1",
"a",
"1",
"b-=1",
"b",
"1",
"for i in range(-2,1):\n for j in range(-2,1):\n if 0<=a+i<h-2 and 0<=b+j<w-2:\n rec.append((a+i,b+j))",
"i",
"range(-2,1)",
"range",
"-2",
"1",
"for j in range(-2,1):\n if 0<=a+i<h-2 and 0<=b+j<w-2:\n rec.append((a+i,b+j))",
"j",
"range(-2,1)",
"range",
"-2",
"1",
"if 0<=a+i<h-2 and 0<=b+j<w-2:\n rec.append((a+i,b+j))",
"0<=a+i<h-2 and 0<=b+j<w-2",
"0<=a+i<h-2",
"0<=a+i",
"0",
"a+i",
"a",
"i",
"h-2",
"h",
"2",
"0<=b+j<w-2",
"0<=b+j",
"0",
"b+j",
"b",
"j",
"w-2",
"w",
"2",
"rec.append((a+i,b+j))",
"rec.append",
"rec",
"append",
"(a+i,b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"ans[0]=(h-2)*(w-2)",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"c=Counter(rec)",
"c",
"Counter(rec)",
"Counter",
"rec",
"for i in c.values():\n ans[i]+=1\n ans[0]-=1",
"i",
"c.values()",
"c.values",
"c",
"values",
"ans[i]+=1",
"ans[i]",
"ans",
"i",
"1",
"ans[0]-=1",
"ans[0]",
"ans",
"0",
"1",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"a-=1",
"1",
"a",
"w,N=map(int,input().split())",
"map(int,input().split())",
"w",
"b-=1",
"1",
"b",
"h,w,N=map(int,input().split())",
"map(int,input().split())",
"h",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"rec=[]",
"[]",
"rec",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"ans=[0]*10",
"[0]*10",
"ans",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"c=Counter(rec)",
"Counter(rec)",
"c"
] | from collections import Counter
h,w,N=map(int,input().split())
rec=[]
for i in range(N):
a,b=map(int,input().split())
a-=1
b-=1
for i in range(-2,1):
for j in range(-2,1):
if 0<=a+i<h-2 and 0<=b+j<w-2:
rec.append((a+i,b+j))
ans=[0]*10
ans[0]=(h-2)*(w-2)
c=Counter(rec)
for i in c.values():
ans[i]+=1
ans[0]-=1
for i in range(10):
print(ans[i]) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.