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,
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,
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,
14,
2,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
17,
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,
4,
13,
17,
4,
13,
18,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13
] | [
[
179,
2
],
[
179,
11
],
[
179,
12
],
[
176,
14
],
[
18,
17
],
[
162,
20
],
[
170,
22
],
[
170,
31
],
[
164,
33
],
[
168,
35
],
[
165,
35
],
[
173,
37
],
[
171,
39
],
[
174,
39
],
[
43,
42
],
[
49,
48
],
[
165,
59
],
[
168,
59
],
[
42,
60
],
[
180,
62
],
[
174,
68
],
[
171,
68
],
[
48,
69
],
[
159,
71
],
[
177,
77
],
[
165,
81
],
[
168,
81
],
[
42,
82
],
[
174,
84
],
[
171,
84
],
[
48,
85
],
[
97,
88
],
[
177,
89
],
[
165,
92
],
[
168,
92
],
[
42,
93
],
[
174,
95
],
[
171,
95
],
[
48,
96
],
[
108,
99
],
[
177,
100
],
[
165,
103
],
[
168,
103
],
[
42,
104
],
[
174,
106
],
[
171,
106
],
[
48,
107
],
[
155,
110
],
[
117,
116
],
[
177,
119
],
[
125,
122
],
[
156,
123
],
[
116,
124
],
[
130,
127
],
[
156,
128
],
[
180,
133
],
[
159,
136
],
[
156,
141
],
[
146,
145
],
[
156,
152
],
[
145,
153
],
[
155,
156
],
[
179,
159
],
[
179,
162
],
[
164,
165
],
[
170,
168
],
[
170,
171
],
[
173,
174
],
[
176,
177
],
[
179,
180
]
] | [
"H, W, N = map(int, input().split())\nd = {}\n\nfor i in range(N):\n a, b = map(int, input().split())\n a, b = a-1, b-1\n for j in range(-1, 2):\n for k in range(-1, 2):\n if 1 <= a+j < H-1 and 1 <= b+k < W-1:\n if d.get((a+j, b+k)) is None:\n d[(a+j, b+k)] = 0\n d[(a+j, b+k)] += 1\n\n\nans = [0] * 10\nfor v in d.values():\n ans[v] += 1\nans[0] = (H-2)*(W-2)-sum(ans[1:])\n\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 = {}",
"d",
"{}",
"for i in range(N):\n a, b = map(int, input().split())\n a, b = a-1, b-1\n for j in range(-1, 2):\n for k in range(-1, 2):\n if 1 <= a+j < H-1 and 1 <= b+k < W-1:\n if d.get((a+j, b+k)) is None:\n d[(a+j, b+k)] = 0\n d[(a+j, b+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(-1, 2):\n for k in range(-1, 2):\n if 1 <= a+j < H-1 and 1 <= b+k < W-1:\n if d.get((a+j, b+k)) is None:\n d[(a+j, b+k)] = 0\n d[(a+j, b+k)] += 1",
"j",
"range(-1, 2)",
"range",
"-1",
"2",
"for k in range(-1, 2):\n if 1 <= a+j < H-1 and 1 <= b+k < W-1:\n if d.get((a+j, b+k)) is None:\n d[(a+j, b+k)] = 0\n d[(a+j, b+k)] += 1",
"k",
"range(-1, 2)",
"range",
"-1",
"2",
"if 1 <= a+j < H-1 and 1 <= b+k < W-1:\n if d.get((a+j, b+k)) is None:\n d[(a+j, b+k)] = 0\n d[(a+j, b+k)] += 1",
"1 <= a+j < H-1 and 1 <= b+k < W-1",
"1 <= a+j < H-1",
"1 <= a+j",
"1",
"a+j",
"a",
"j",
"H-1",
"H",
"1",
"1 <= b+k < W-1",
"1 <= b+k",
"1",
"b+k",
"b",
"k",
"W-1",
"W",
"1",
"if d.get((a+j, b+k)) is None:\n d[(a+j, b+k)] = 0\n ",
"d.get((a+j, b+k)) is None",
"d.get((a+j, b+k))",
"d.get",
"d",
"get",
"(a+j, b+k)",
"a+j",
"a",
"j",
"b+k",
"b",
"k",
"None",
"d[(a+j, b+k)] = 0",
"d[(a+j, b+k)]",
"d",
"(a+j, b+k)",
"a+j",
"a",
"j",
"b+k",
"b",
"k",
"0",
"d[(a+j, b+k)] += 1",
"d[(a+j, b+k)]",
"d",
"(a+j, b+k)",
"a+j",
"a",
"j",
"b+k",
"b",
"k",
"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",
"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",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"a, b = a-1, b-1",
"a-1",
"a",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"b = a-1, b-1",
"b-1",
"b",
"d = {}",
"{}",
"d",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H"
] | 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
for j in range(-1, 2):
for k in range(-1, 2):
if 1 <= a+j < H-1 and 1 <= b+k < W-1:
if d.get((a+j, b+k)) is None:
d[(a+j, b+k)] = 0
d[(a+j, b+k)] += 1
ans = [0] * 10
for v in d.values():
ans[v] += 1
ans[0] = (H-2)*(W-2)-sum(ans[1:])
for i in range(10):
print(ans[i]) |
[
7,
15,
15,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
18,
18,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
13,
0,
13,
4,
13,
13,
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,
17,
17,
28,
13,
4,
13,
17,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
14,
2,
2,
2,
2,
18,
13,
17,
17,
2,
18,
13,
17,
17,
40,
18,
13,
17,
2,
13,
17,
40,
18,
13,
17,
2,
13,
17,
9,
0,
18,
13,
18,
13,
13,
17,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
18,
13,
17,
2,
13,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
18,
13,
10,
13,
13,
10,
13,
13,
10,
2,
13,
10,
13,
13,
10,
2,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13
] | [
[
159,
12
],
[
21,
20
],
[
160,
24
],
[
20,
29
],
[
183,
31
],
[
183,
33
],
[
183,
34
],
[
180,
36
],
[
42,
41
],
[
184,
44
],
[
48,
47
],
[
160,
51
],
[
47,
57
],
[
171,
60
],
[
171,
62
],
[
65,
64
],
[
71,
70
],
[
85,
76
],
[
181,
77
],
[
172,
80
],
[
64,
81
],
[
166,
83
],
[
70,
84
],
[
168,
87
],
[
94,
93
],
[
181,
96
],
[
93,
104
],
[
93,
109
],
[
93,
114
],
[
163,
117
],
[
93,
121
],
[
178,
124
],
[
133,
128
],
[
169,
129
],
[
181,
131
],
[
93,
132
],
[
174,
135
],
[
178,
138
],
[
163,
141
],
[
147,
144
],
[
169,
145
],
[
175,
148
],
[
169,
151
],
[
154,
153
],
[
169,
153
],
[
153,
157
],
[
159,
160
],
[
183,
163
],
[
171,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
183,
178
],
[
180,
181
],
[
183,
184
]
] | [
"#!/usr/bin/env python3\nfrom collections import defaultdict\nimport sys\nsys.setrecursionlimit(10**8)\ninput = sys.stdin.readline\n \nh, w, n = [int(item) for item in input().split()]\nblk_cnt = defaultdict(int) \n \nfor i in range(n):\n a, b = [int(item) - 1 for item in input().split()]\n for j in range(-1, 2):\n for k in range(-1, 2):\n blk_cnt[(a + j, b + k)] += 1\nans = [0] * 10 \nfor key in blk_cnt.keys():\n if key[0] < 1 or key[1] < 1 or key[0] >= h-1 or key[1] >= w-1:\n continue\n ans[blk_cnt[key]] += 1\ntotal = (w - 2) * (h - 2)\nans[0] = total - sum(ans)\nfor item in ans:\n print(item)",
"from collections import defaultdict",
"import sys",
"sys",
"sys.setrecursionlimit(10**8)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**8",
"10",
"8",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"int(item) for item in input().split()",
"for item in input().split()",
"item",
"input().split()",
"().split",
"()",
"input",
"split",
"for item in input().split()",
"int(item)",
"int",
"item",
"h, w, n = [int(item) for item in input().split()]",
"h",
"[int(item) for item in input().split()]",
"w",
"n",
"blk_cnt = defaultdict(int)",
"blk_cnt",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(n):\n a, b = [int(item) - 1 for item in input().split()]\n for j in range(-1, 2):\n for k in range(-1, 2):\n blk_cnt[(a + j, b + k)] += 1",
"i",
"range(n)",
"range",
"n",
"int(item) - 1 for item in input().split()",
"for item in input().split()",
"item",
"input().split()",
"().split",
"()",
"input",
"split",
"for item in input().split()",
"int(item) - 1",
"int(item)",
"int",
"item",
"1",
"a, b = [int(item) - 1 for item in input().split()]",
"a",
"[int(item) - 1 for item in input().split()]",
"b",
"for j in range(-1, 2):\n for k in range(-1, 2):\n blk_cnt[(a + j, b + k)] += 1",
"j",
"range(-1, 2)",
"range",
"-1",
"2",
"for k in range(-1, 2):\n blk_cnt[(a + j, b + k)] += 1",
"k",
"range(-1, 2)",
"range",
"-1",
"2",
"blk_cnt[(a + j, b + k)] += 1",
"blk_cnt[(a + j, b + k)]",
"blk_cnt",
"(a + j, b + k)",
"a + j",
"a",
"j",
"b + k",
"b",
"k",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for key in blk_cnt.keys():\n if key[0] < 1 or key[1] < 1 or key[0] >= h-1 or key[1] >= w-1:\n continue\n ans[blk_cnt[key]] += 1",
"key",
"blk_cnt.keys()",
"blk_cnt.keys",
"blk_cnt",
"keys",
"if key[0] < 1 or key[1] < 1 or key[0] >= h-1 or key[1] >= w-1:\n continue\n ",
"key[0] < 1 or key[1] < 1 or key[0] >= h-1 or key[1] >= w-1",
"key[0] < 1 or key[1] < 1 or key[0] >= h-1",
"key[0] < 1 or key[1] < 1",
"key[0] < 1",
"key[0]",
"key",
"0",
"1",
"key[1] < 1",
"key[1]",
"key",
"1",
"1",
"key[0] >= h-1",
"key[0]",
"key",
"0",
"h-1",
"h",
"1",
"key[1] >= w-1",
"key[1]",
"key",
"1",
"w-1",
"w",
"1",
"continue",
"ans[blk_cnt[key]] += 1",
"ans[blk_cnt[key]]",
"ans",
"blk_cnt[key]",
"blk_cnt",
"key",
"1",
"total = (w - 2) * (h - 2)",
"total",
"(w - 2) * (h - 2)",
"w - 2",
"w",
"2",
"h - 2",
"h",
"2",
"ans[0] = total - sum(ans)",
"ans[0]",
"ans",
"0",
"total - sum(ans)",
"total",
"sum(ans)",
"sum",
"ans",
"for item in ans:\n print(item)",
"item",
"ans",
"print(item)",
"print",
"item",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"h, w, n = [int(item) for item in input().split()]",
"[int(item) for item in input().split()]",
"h",
"b = [int(item) - 1 for item in input().split()]",
"[int(item) - 1 for item in input().split()]",
"b",
"ans = [0] * 10",
"[0] * 10",
"ans",
"a, b = [int(item) - 1 for item in input().split()]",
"[int(item) - 1 for item in input().split()]",
"a",
"total = (w - 2) * (h - 2)",
"(w - 2) * (h - 2)",
"total",
"w, n = [int(item) for item in input().split()]",
"[int(item) for item in input().split()]",
"w",
"blk_cnt = defaultdict(int)",
"defaultdict(int)",
"blk_cnt",
"n = [int(item) for item in input().split()]",
"[int(item) for item in input().split()]",
"n"
] | #!/usr/bin/env python3
from collections import defaultdict
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
h, w, n = [int(item) for item in input().split()]
blk_cnt = defaultdict(int)
for i in range(n):
a, b = [int(item) - 1 for item in input().split()]
for j in range(-1, 2):
for k in range(-1, 2):
blk_cnt[(a + j, b + k)] += 1
ans = [0] * 10
for key in blk_cnt.keys():
if key[0] < 1 or key[1] < 1 or key[0] >= h-1 or key[1] >= w-1:
continue
ans[blk_cnt[key]] += 1
total = (w - 2) * (h - 2)
ans[0] = total - sum(ans)
for item in ans:
print(item) |
[
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,
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,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
28,
13,
13,
13,
28,
13,
13,
13,
0,
13,
39,
2,
13,
13,
2,
13,
13,
14,
2,
13,
13,
14,
40,
2,
2,
2,
17,
13,
13,
2,
2,
17,
13,
13,
9,
0,
18,
13,
39,
13,
13,
17,
14,
40,
2,
2,
2,
17,
2,
13,
13,
13,
2,
2,
17,
2,
13,
13,
13,
9,
0,
18,
13,
13,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
28,
13,
4,
18,
13,
13,
0,
18,
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,
13,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13
] | [
[
222,
3
],
[
222,
12
],
[
222,
13
],
[
17,
16
],
[
211,
19
],
[
213,
32
],
[
216,
35
],
[
207,
65
],
[
234,
70
],
[
237,
75
],
[
214,
78
],
[
228,
80
],
[
231,
93
],
[
232,
103
],
[
238,
104
],
[
223,
112
],
[
220,
117
],
[
125,
120
],
[
235,
121
],
[
223,
135
],
[
220,
142
],
[
148,
145
],
[
208,
146
],
[
232,
147
],
[
151,
150
],
[
208,
153
],
[
159,
156
],
[
229,
157
],
[
150,
158
],
[
162,
161
],
[
235,
164
],
[
170,
167
],
[
229,
168
],
[
161,
169
],
[
225,
172
],
[
223,
175
],
[
220,
178
],
[
182,
181
],
[
240,
187
],
[
229,
189
],
[
181,
190
],
[
195,
192
],
[
229,
193
],
[
241,
195
],
[
226,
195
],
[
198,
197
],
[
229,
204
],
[
197,
205
],
[
207,
208
],
[
222,
211
],
[
213,
214
],
[
216,
217
],
[
222,
220
],
[
222,
223
],
[
225,
226
],
[
228,
229
],
[
231,
232
],
[
234,
235
],
[
237,
238
],
[
240,
241
]
] | [
"from collections import defaultdict as dd\nH,W,N=map(int,input().split())\nab = [tuple(map(int,input().split())) for _ in range(N)]\ntpl = [(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]\nedge_WtoB = dd(int)\nedge_BtoB = dd(int)\nnode_B = set(ab)\n# node_W = set()\nres = dd(int)\n# 今見てるマスが黒\nfor a,b in ab:\n for s,t in tpl:\n tgt = (a+s,b+t)\n # 隣接マスも黒\n if tgt in node_B:\n if not (1 < a < H and 1 < b < W):\n continue\n edge_BtoB[(a,b)] += 1\n # 隣接マスは白\n else:\n if not (1 < a + s < H and 1 < b + t < W):\n continue\n edge_WtoB[tgt] += 1\n # node_W.add(tgt)\nfor val in edge_WtoB.values():\n res[val] += 1\nfor val in edge_BtoB.values():\n res[val] += 1\nzero = (H-2)*(W-2)\nfor j in range(1,10):\n zero -= res[j]\nres[0] = zero\nfor j in range(10):\n print(res[j])",
"from collections import defaultdict as dd",
"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)]",
"tpl = [(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]",
"tpl",
"[(-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",
"edge_WtoB = dd(int)",
"edge_WtoB",
"dd(int)",
"dd",
"int",
"edge_BtoB = dd(int)",
"edge_BtoB",
"dd(int)",
"dd",
"int",
"node_B = set(ab)",
"node_B",
"set(ab)",
"set",
"ab",
"res = dd(int)",
"res",
"dd(int)",
"dd",
"int",
"for a,b in ab:\n for s,t in tpl:\n tgt = (a+s,b+t)\n # 隣接マスも黒\n if tgt in node_B:\n if not (1 < a < H and 1 < b < W):\n continue\n edge_BtoB[(a,b)] += 1\n # 隣接マスは白\n else:\n if not (1 < a + s < H and 1 < b + t < W):\n continue\n edge_WtoB[tgt] += 1\n # node_W.add(tgt)",
"a",
"b",
"ab",
"for s,t in tpl:\n tgt = (a+s,b+t)\n # 隣接マスも黒\n if tgt in node_B:\n if not (1 < a < H and 1 < b < W):\n continue\n edge_BtoB[(a,b)] += 1\n # 隣接マスは白\n else:\n if not (1 < a + s < H and 1 < b + t < W):\n continue\n edge_WtoB[tgt] += 1\n # node_W.add(tgt)",
"s",
"t",
"tpl",
"tgt = (a+s,b+t)",
"tgt",
"(a+s,b+t)",
"a+s",
"a",
"s",
"b+t",
"b",
"t",
"if tgt in node_B:\n if not (1 < a < H and 1 < b < W):\n continue\n edge_BtoB[(a,b)] += 1\n # 隣接マスは白\n else:\n if not (1 < a + s < H and 1 < b + t < W):\n continue\n edge_WtoB[tgt] += 1\n # node_W.add(tgt)",
"tgt in node_B",
"tgt",
"node_B",
"if not (1 < a < H and 1 < b < W):\n continue\n ",
"not (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",
"continue",
"edge_BtoB[(a,b)] += 1",
"edge_BtoB[(a,b)]",
"edge_BtoB",
"(a,b)",
"a",
"b",
"1",
"if not (1 < a + s < H and 1 < b + t < W):\n continue\n ",
"not (1 < a + s < H and 1 < b + t < W)",
"1 < a + s < H and 1 < b + t < W",
"1 < a + s < H",
"1 < a + s",
"1",
"a + s",
"a",
"s",
"H",
"1 < b + t < W",
"1 < b + t",
"1",
"b + t",
"b",
"t",
"W",
"continue",
"edge_WtoB[tgt] += 1",
"edge_WtoB[tgt]",
"edge_WtoB",
"tgt",
"1",
"for val in edge_WtoB.values():\n res[val] += 1",
"val",
"edge_WtoB.values()",
"edge_WtoB.values",
"edge_WtoB",
"values",
"res[val] += 1",
"res[val]",
"res",
"val",
"1",
"for val in edge_BtoB.values():\n res[val] += 1",
"val",
"edge_BtoB.values()",
"edge_BtoB.values",
"edge_BtoB",
"values",
"res[val] += 1",
"res[val]",
"res",
"val",
"1",
"zero = (H-2)*(W-2)",
"zero",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"for j in range(1,10):\n zero -= res[j]",
"j",
"range(1,10)",
"range",
"1",
"10",
"zero -= res[j]",
"zero",
"res[j]",
"res",
"j",
"res[0] = zero",
"res[0]",
"res",
"0",
"zero",
"for j in range(10):\n print(res[j])",
"j",
"range(10)",
"range",
"10",
"print(res[j])",
"print",
"res[j]",
"res",
"j",
"edge_WtoB = dd(int)",
"dd(int)",
"edge_WtoB",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"ab = [tuple(map(int,input().split())) for _ in range(N)]",
"[tuple(map(int,input().split())) for _ in range(N)]",
"ab",
"tpl = [(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]",
"[(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]",
"tpl",
"W,N=map(int,input().split())",
"map(int,input().split())",
"W",
"H,W,N=map(int,input().split())",
"map(int,input().split())",
"H",
"zero = (H-2)*(W-2)",
"(H-2)*(W-2)",
"zero",
"res = dd(int)",
"dd(int)",
"res",
"tgt = (a+s,b+t)",
"(a+s,b+t)",
"tgt",
"edge_BtoB = dd(int)",
"dd(int)",
"edge_BtoB",
"node_B = set(ab)",
"set(ab)",
"node_B",
"zero -= res[j]",
"res[j]",
"zero"
] | from collections import defaultdict as dd
H,W,N=map(int,input().split())
ab = [tuple(map(int,input().split())) for _ in range(N)]
tpl = [(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]
edge_WtoB = dd(int)
edge_BtoB = dd(int)
node_B = set(ab)
# node_W = set()
res = dd(int)
# 今見てるマスが黒
for a,b in ab:
for s,t in tpl:
tgt = (a+s,b+t)
# 隣接マスも黒
if tgt in node_B:
if not (1 < a < H and 1 < b < W):
continue
edge_BtoB[(a,b)] += 1
# 隣接マスは白
else:
if not (1 < a + s < H and 1 < b + t < W):
continue
edge_WtoB[tgt] += 1
# node_W.add(tgt)
for val in edge_WtoB.values():
res[val] += 1
for val in edge_BtoB.values():
res[val] += 1
zero = (H-2)*(W-2)
for j in range(1,10):
zero -= res[j]
res[0] = zero
for j in range(10):
print(res[j]) |
[
7,
15,
13,
15,
13,
12,
13,
4,
18,
13,
13,
17,
0,
13,
18,
18,
13,
13,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
13,
17,
13,
13,
13,
0,
13,
4,
18,
13,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
13,
17,
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,
2,
2,
13,
17,
13,
17,
0,
13,
39,
28,
13,
13,
4,
18,
13,
13,
4,
18,
13,
13,
13,
0,
13,
4,
18,
13,
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,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
14,
13
],
[
21,
20
],
[
28,
27
],
[
13,
38
],
[
28,
42
],
[
28,
43
],
[
46,
45
],
[
53,
52
],
[
43,
55
],
[
58,
57
],
[
13,
68
],
[
58,
72
],
[
75,
74
],
[
81,
80
],
[
57,
92
],
[
74,
94
],
[
27,
96
],
[
72,
103
],
[
80,
105
],
[
42,
107
],
[
117,
110
],
[
45,
111
],
[
57,
114
],
[
74,
116
],
[
120,
119
],
[
45,
126
],
[
119,
130
],
[
135,
134
],
[
119,
139
],
[
27,
145
],
[
42,
148
],
[
134,
154
],
[
119,
154
],
[
158,
157
],
[
134,
165
],
[
119,
165
],
[
157,
166
],
[
175,
172
]
] | [
"import sys\nimport collections\n\n\ndef solve():\n sys.setrecursionlimit(2000)\n input = sys.stdin.readline\n mod = 10 ** 9 + 7\n h, w, n = list(map(int, input().rstrip('\\n').split()))\n d = collections.defaultdict(int)\n for _ in range(n):\n a, b = list(map(int, input().rstrip('\\n').split()))\n for i in range(-1, 2):\n for j in range(-1, 2):\n if 1 <= a-1+i < h-1 and 1 <= b-1+j < w-1:\n d[a-1+i, b-1+j] += 1\n nd = []\n for k, v in d.items():\n nd.append(v)\n nd = collections.Counter(nd)\n print((h - 2) * (w - 2) - sum(nd.values()))\n for i in range(1, 10):\n print(nd[i])\n\n\nif __name__ == '__main__':\n solve()",
"import sys",
"sys",
"import collections",
"collections",
"def solve():\n sys.setrecursionlimit(2000)\n input = sys.stdin.readline\n mod = 10 ** 9 + 7\n h, w, n = list(map(int, input().rstrip('\\n').split()))\n d = collections.defaultdict(int)\n for _ in range(n):\n a, b = list(map(int, input().rstrip('\\n').split()))\n for i in range(-1, 2):\n for j in range(-1, 2):\n if 1 <= a-1+i < h-1 and 1 <= b-1+j < w-1:\n d[a-1+i, b-1+j] += 1\n nd = []\n for k, v in d.items():\n nd.append(v)\n nd = collections.Counter(nd)\n print((h - 2) * (w - 2) - sum(nd.values()))\n for i in range(1, 10):\n print(nd[i])",
"solve",
"sys.setrecursionlimit(2000)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"2000",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"mod = 10 ** 9 + 7",
"mod",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"h, w, n = list(map(int, input().rstrip('\\n').split()))",
"h",
"list(map(int, input().rstrip('\\n').split()))",
"list",
"map(int, input().rstrip('\\n').split())",
"map",
"int",
"input().rstrip('\\n').split()",
"().rstrip('\\n').split",
"().rstrip('\\n')",
"().rstrip",
"()",
"input",
"rstrip",
"'\\n'",
"split",
"w",
"n",
"d = collections.defaultdict(int)",
"d",
"collections.defaultdict(int)",
"collections.defaultdict",
"collections",
"defaultdict",
"int",
"for _ in range(n):\n a, b = list(map(int, input().rstrip('\\n').split()))\n for i in range(-1, 2):\n for j in range(-1, 2):\n if 1 <= a-1+i < h-1 and 1 <= b-1+j < w-1:\n d[a-1+i, b-1+j] += 1\n ",
"_",
"range(n)",
"range",
"n",
"a, b = list(map(int, input().rstrip('\\n').split()))",
"a",
"list(map(int, input().rstrip('\\n').split()))",
"list",
"map(int, input().rstrip('\\n').split())",
"map",
"int",
"input().rstrip('\\n').split()",
"().rstrip('\\n').split",
"().rstrip('\\n')",
"().rstrip",
"()",
"input",
"rstrip",
"'\\n'",
"split",
"b",
"for i in range(-1, 2):\n for j in range(-1, 2):\n if 1 <= a-1+i < h-1 and 1 <= b-1+j < w-1:\n d[a-1+i, b-1+j] += 1\n ",
"i",
"range(-1, 2)",
"range",
"-1",
"2",
"for j in range(-1, 2):\n if 1 <= a-1+i < h-1 and 1 <= b-1+j < w-1:\n d[a-1+i, b-1+j] += 1\n ",
"j",
"range(-1, 2)",
"range",
"-1",
"2",
"if 1 <= a-1+i < h-1 and 1 <= b-1+j < w-1:\n d[a-1+i, b-1+j] += 1\n ",
"1 <= a-1+i < h-1 and 1 <= b-1+j < w-1",
"1 <= a-1+i < h-1",
"1 <= a-1+i",
"1",
"a-1+i",
"a-1",
"a",
"1",
"i",
"h-1",
"h",
"1",
"1 <= b-1+j < w-1",
"1 <= b-1+j",
"1",
"b-1+j",
"b-1",
"b",
"1",
"j",
"w-1",
"w",
"1",
"d[a-1+i, b-1+j] += 1",
"d[a-1+i, b-1+j]",
"d",
"a-1+i",
"a-1",
"a",
"1",
"i",
"1",
"nd = []",
"nd",
"[]",
"for k, v in d.items():\n nd.append(v)\n ",
"k",
"v",
"d.items()",
"d.items",
"d",
"items",
"nd.append(v)",
"nd.append",
"nd",
"append",
"v",
"nd = collections.Counter(nd)",
"nd",
"collections.Counter(nd)",
"collections.Counter",
"collections",
"Counter",
"nd",
"print((h - 2) * (w - 2) - sum(nd.values()))",
"print",
"(h - 2) * (w - 2) - sum(nd.values())",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"sum(nd.values())",
"sum",
"nd.values()",
"nd.values",
"nd",
"values",
"for i in range(1, 10):\n print(nd[i])",
"i",
"range(1, 10)",
"range",
"1",
"10",
"print(nd[i])",
"print",
"nd[i]",
"nd",
"i",
"if __name__ == '__main__':\n solve()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"solve()",
"solve",
"def solve():\n sys.setrecursionlimit(2000)\n input = sys.stdin.readline\n mod = 10 ** 9 + 7\n h, w, n = list(map(int, input().rstrip('\\n').split()))\n d = collections.defaultdict(int)\n for _ in range(n):\n a, b = list(map(int, input().rstrip('\\n').split()))\n for i in range(-1, 2):\n for j in range(-1, 2):\n if 1 <= a-1+i < h-1 and 1 <= b-1+j < w-1:\n d[a-1+i, b-1+j] += 1\n nd = []\n for k, v in d.items():\n nd.append(v)\n nd = collections.Counter(nd)\n print((h - 2) * (w - 2) - sum(nd.values()))\n for i in range(1, 10):\n print(nd[i])",
"def solve():\n sys.setrecursionlimit(2000)\n input = sys.stdin.readline\n mod = 10 ** 9 + 7\n h, w, n = list(map(int, input().rstrip('\\n').split()))\n d = collections.defaultdict(int)\n for _ in range(n):\n a, b = list(map(int, input().rstrip('\\n').split()))\n for i in range(-1, 2):\n for j in range(-1, 2):\n if 1 <= a-1+i < h-1 and 1 <= b-1+j < w-1:\n d[a-1+i, b-1+j] += 1\n nd = []\n for k, v in d.items():\n nd.append(v)\n nd = collections.Counter(nd)\n print((h - 2) * (w - 2) - sum(nd.values()))\n for i in range(1, 10):\n print(nd[i])",
"solve"
] | import sys
import collections
def solve():
sys.setrecursionlimit(2000)
input = sys.stdin.readline
mod = 10 ** 9 + 7
h, w, n = list(map(int, input().rstrip('\n').split()))
d = collections.defaultdict(int)
for _ in range(n):
a, b = list(map(int, input().rstrip('\n').split()))
for i in range(-1, 2):
for j in range(-1, 2):
if 1 <= a-1+i < h-1 and 1 <= b-1+j < w-1:
d[a-1+i, b-1+j] += 1
nd = []
for k, v in d.items():
nd.append(v)
nd = collections.Counter(nd)
print((h - 2) * (w - 2) - sum(nd.values()))
for i in range(1, 10):
print(nd[i])
if __name__ == '__main__':
solve()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
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,
0,
13,
2,
13,
13,
13,
2,
13,
13,
14,
2,
2,
2,
2,
40,
17,
13,
13,
2,
40,
17,
13,
13,
2,
2,
13,
17,
13,
2,
2,
13,
17,
13,
14,
2,
39,
13,
13,
13,
0,
18,
13,
39,
13,
13,
17,
0,
18,
13,
39,
13,
13,
17,
4,
18,
13,
13,
39,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
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,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
2,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] | [
[
189,
2
],
[
189,
11
],
[
189,
12
],
[
177,
14
],
[
192,
17
],
[
22,
21
],
[
190,
24
],
[
171,
26
],
[
171,
35
],
[
162,
37
],
[
165,
40
],
[
44,
43
],
[
50,
49
],
[
180,
55
],
[
163,
57
],
[
172,
57
],
[
43,
58
],
[
183,
59
],
[
166,
61
],
[
169,
61
],
[
49,
62
],
[
181,
70
],
[
157,
71
],
[
184,
75
],
[
160,
76
],
[
181,
79
],
[
157,
81
],
[
184,
84
],
[
160,
86
],
[
193,
92
],
[
99,
94
],
[
178,
95
],
[
106,
101
],
[
178,
102
],
[
193,
109
],
[
174,
115
],
[
186,
121
],
[
125,
124
],
[
178,
127
],
[
133,
130
],
[
175,
131
],
[
124,
132
],
[
138,
135
],
[
175,
136
],
[
157,
141
],
[
160,
144
],
[
193,
148
],
[
151,
150
],
[
175,
150
],
[
150,
154
],
[
189,
157
],
[
189,
160
],
[
162,
163
],
[
165,
166
],
[
171,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
],
[
180,
181
],
[
183,
184
],
[
186,
187
],
[
189,
190
],
[
192,
193
]
] | [
"h,w,n=map(int,input().split())\nd={}\ns=set()\nfor _ in range(n):\n a,b=map(int,input().split())\n a-=1\n b-=1\n for dy in [-2,-1,0]:\n for dx in [-2,-1,0]:\n ny,nx=a+dy,b+dx\n if 0<=ny<h and 0<=nx<w and ny+2<h and nx+2<w:\n if (ny,nx) in s:\n d[(ny,nx)]+=1\n else:\n d[(ny,nx)]=1\n s.add((ny,nx))\ncnt=[0]*10\nq=0\nfor v in d.values():\n cnt[v]+=1\ncnt[0]=(h-2)*(w-2)-len(s)\nfor i in cnt:\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={}",
"d",
"{}",
"s=set()",
"s",
"set()",
"set",
"for _ in range(n):\n a,b=map(int,input().split())\n a-=1\n b-=1\n for dy in [-2,-1,0]:\n for dx in [-2,-1,0]:\n ny,nx=a+dy,b+dx\n if 0<=ny<h and 0<=nx<w and ny+2<h and nx+2<w:\n if (ny,nx) in s:\n d[(ny,nx)]+=1\n else:\n d[(ny,nx)]=1\n s.add((ny,nx))",
"_",
"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 dy in [-2,-1,0]:\n for dx in [-2,-1,0]:\n ny,nx=a+dy,b+dx\n if 0<=ny<h and 0<=nx<w and ny+2<h and nx+2<w:\n if (ny,nx) in s:\n d[(ny,nx)]+=1\n else:\n d[(ny,nx)]=1\n s.add((ny,nx))",
"dy",
"[-2,-1,0]",
"-2",
"-1",
"0",
"for dx in [-2,-1,0]:\n ny,nx=a+dy,b+dx\n if 0<=ny<h and 0<=nx<w and ny+2<h and nx+2<w:\n if (ny,nx) in s:\n d[(ny,nx)]+=1\n else:\n d[(ny,nx)]=1\n s.add((ny,nx))",
"dx",
"[-2,-1,0]",
"-2",
"-1",
"0",
"ny,nx=a+dy,b+dx",
"ny",
"a+dy",
"a",
"dy",
"nx",
"b+dx",
"b",
"dx",
"if 0<=ny<h and 0<=nx<w and ny+2<h and nx+2<w:\n if (ny,nx) in s:\n d[(ny,nx)]+=1\n else:\n d[(ny,nx)]=1\n s.add((ny,nx))",
"0<=ny<h and 0<=nx<w and ny+2<h and nx+2<w",
"0<=ny<h and 0<=nx<w and ny+2<h",
"0<=ny<h and 0<=nx<w",
"0<=ny<h",
"0<=ny",
"0",
"ny",
"h",
"0<=nx<w",
"0<=nx",
"0",
"nx",
"w",
"ny+2<h",
"ny+2",
"ny",
"2",
"h",
"nx+2<w",
"nx+2",
"nx",
"2",
"w",
"if (ny,nx) in s:\n d[(ny,nx)]+=1\n else:\n d[(ny,nx)]=1\n s.add((ny,nx))",
"(ny,nx) in s",
"(ny,nx)",
"ny",
"nx",
"s",
"d[(ny,nx)]+=1",
"d[(ny,nx)]",
"d",
"(ny,nx)",
"ny",
"nx",
"1",
"d[(ny,nx)]=1",
"d[(ny,nx)]",
"d",
"(ny,nx)",
"ny",
"nx",
"1",
"s.add((ny,nx))",
"s.add",
"s",
"add",
"(ny,nx)",
"ny",
"nx",
"cnt=[0]*10",
"cnt",
"[0]*10",
"[0]",
"0",
"10",
"q=0",
"q",
"0",
"for v in d.values():\n cnt[v]+=1",
"v",
"d.values()",
"d.values",
"d",
"values",
"cnt[v]+=1",
"cnt[v]",
"cnt",
"v",
"1",
"cnt[0]=(h-2)*(w-2)-len(s)",
"cnt[0]",
"cnt",
"0",
"(h-2)*(w-2)-len(s)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"len(s)",
"len",
"s",
"for i in cnt:\n print(i)",
"i",
"cnt",
"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",
"a-=1",
"1",
"a",
"b-=1",
"1",
"b",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"cnt=[0]*10",
"[0]*10",
"cnt",
"d={}",
"{}",
"d",
"ny,nx=a+dy,b+dx",
"a+dy",
"ny",
"nx=a+dy,b+dx",
"b+dx",
"nx",
"q=0",
"0",
"q",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"s=set()",
"set()",
"s"
] | h,w,n=map(int,input().split())
d={}
s=set()
for _ in range(n):
a,b=map(int,input().split())
a-=1
b-=1
for dy in [-2,-1,0]:
for dx in [-2,-1,0]:
ny,nx=a+dy,b+dx
if 0<=ny<h and 0<=nx<w and ny+2<h and nx+2<w:
if (ny,nx) in s:
d[(ny,nx)]+=1
else:
d[(ny,nx)]=1
s.add((ny,nx))
cnt=[0]*10
q=0
for v in d.values():
cnt[v]+=1
cnt[0]=(h-2)*(w-2)-len(s)
for i in cnt:
print(i) |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
2,
2,
17,
17,
17,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
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,
40,
40,
17,
2,
13,
13,
2,
13,
17,
14,
40,
40,
17,
2,
13,
13,
2,
13,
17,
0,
13,
18,
13,
39,
2,
13,
13,
2,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
4,
13,
31,
13,
0,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
2,
13,
10,
18,
13
] | [
[
160,
4
],
[
154,
11
],
[
163,
19
],
[
161,
26
],
[
163,
28
],
[
163,
29
],
[
157,
31
],
[
166,
36
],
[
45,
42
],
[
167,
43
],
[
164,
47
],
[
143,
50
],
[
54,
53
],
[
146,
56
],
[
151,
58
],
[
161,
65
],
[
151,
67
],
[
70,
69
],
[
76,
75
],
[
152,
85
],
[
69,
86
],
[
164,
88
],
[
149,
95
],
[
75,
96
],
[
143,
98
],
[
169,
101
],
[
158,
103
],
[
152,
106
],
[
69,
107
],
[
149,
109
],
[
75,
110
],
[
115,
112
],
[
167,
113
],
[
170,
114
],
[
122,
117
],
[
167,
118
],
[
170,
120
],
[
133,
124
],
[
158,
125
],
[
152,
128
],
[
69,
129
],
[
149,
131
],
[
75,
132
],
[
167,
137
],
[
140,
139
],
[
163,
143
],
[
163,
146
],
[
151,
149
],
[
151,
152
],
[
154,
155
],
[
157,
158
],
[
160,
161
],
[
163,
164
],
[
166,
167
],
[
169,
170
]
] | [
"import sys\ninput = sys.stdin.readline\n# sys.setrecursionlimit(10 ** 9)\nMOD = 10 ** 9 + 7\n\nfrom collections import defaultdict\n\nH, W, N = map(int, input().split())\n\ndic = defaultdict(int)\nlst = [0] * (10)\nlst[0] = (H - 2) * (W - 2)\n\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 if 2 <= (a + i) <= (H - 1):\n if 2 <= (b + j) <= (W - 1):\n tmp = dic[(a + i, b + j)]\n lst[tmp] -= 1\n lst[tmp + 1] += 1\n dic[((a + i, b + j))] += 1\n\nprint (*lst, sep = '\\n')\n \n",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"MOD = 10 ** 9 + 7",
"MOD",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"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",
"dic = defaultdict(int)",
"dic",
"defaultdict(int)",
"defaultdict",
"int",
"lst = [0] * (10)",
"lst",
"[0] * (10)",
"[0]",
"0",
"10",
"lst[0] = (H - 2) * (W - 2)",
"lst[0]",
"lst",
"0",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"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 2 <= (a + i) <= (H - 1):\n if 2 <= (b + j) <= (W - 1):\n tmp = dic[(a + i, b + j)]\n lst[tmp] -= 1\n lst[tmp + 1] += 1\n dic[((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 2 <= (a + i) <= (H - 1):\n if 2 <= (b + j) <= (W - 1):\n tmp = dic[(a + i, b + j)]\n lst[tmp] -= 1\n lst[tmp + 1] += 1\n dic[((a + i, b + j))] += 1",
"i",
"range(-1, 2)",
"range",
"-1",
"2",
"for j in range(-1, 2):\n if 2 <= (a + i) <= (H - 1):\n if 2 <= (b + j) <= (W - 1):\n tmp = dic[(a + i, b + j)]\n lst[tmp] -= 1\n lst[tmp + 1] += 1\n dic[((a + i, b + j))] += 1",
"j",
"range(-1, 2)",
"range",
"-1",
"2",
"if 2 <= (a + i) <= (H - 1):\n if 2 <= (b + j) <= (W - 1):\n tmp = dic[(a + i, b + j)]\n lst[tmp] -= 1\n lst[tmp + 1] += 1\n dic[((a + i, b + j))] += 1",
"2 <= (a + i) <= (H - 1)",
"2 <= (a + i)",
"2",
"a + i",
"a",
"i",
"H - 1",
"H",
"1",
"if 2 <= (b + j) <= (W - 1):\n tmp = dic[(a + i, b + j)]\n lst[tmp] -= 1\n lst[tmp + 1] += 1\n dic[((a + i, b + j))] += 1",
"2 <= (b + j) <= (W - 1)",
"2 <= (b + j)",
"2",
"b + j",
"b",
"j",
"W - 1",
"W",
"1",
"tmp = dic[(a + i, b + j)]",
"tmp",
"dic[(a + i, b + j)]",
"dic",
"(a + i, b + j)",
"a + i",
"a",
"i",
"b + j",
"b",
"j",
"lst[tmp] -= 1",
"lst[tmp]",
"lst",
"tmp",
"1",
"lst[tmp + 1] += 1",
"lst[tmp + 1]",
"lst",
"tmp + 1",
"tmp",
"1",
"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",
"print (*lst, sep = '\\n')",
"print",
"*lst",
"lst",
"sep = '\\n'",
"sep",
"'\\n'",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"dic = defaultdict(int)",
"defaultdict(int)",
"dic",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"lst = [0] * (10)",
"[0] * (10)",
"lst",
"tmp = dic[(a + i, b + j)]",
"dic[(a + i, b + j)]",
"tmp"
] | import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
from collections import defaultdict
H, W, N = map(int, input().split())
dic = defaultdict(int)
lst = [0] * (10)
lst[0] = (H - 2) * (W - 2)
for _ in range(N):
a, b = map(int, input().split())
for i in range(-1, 2):
for j in range(-1, 2):
if 2 <= (a + i) <= (H - 1):
if 2 <= (b + j) <= (W - 1):
tmp = dic[(a + i, b + j)]
lst[tmp] -= 1
lst[tmp + 1] += 1
dic[((a + i, b + j))] += 1
print (*lst, sep = '\n')
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
2,
2,
4,
13,
4,
18,
4,
13,
13,
17,
17,
13,
17,
0,
13,
4,
13,
13,
0,
13,
2,
39,
17,
17,
15,
0,
13,
4,
13,
2,
13,
2,
13,
13,
28,
13,
13,
0,
13,
4,
13,
13,
13,
13,
0,
13,
2,
39,
17,
17,
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,
13,
2,
2,
13,
13,
13,
0,
18,
13,
2,
2,
2,
13,
13,
2,
2,
13,
13,
17,
17,
4,
13,
2,
2,
13,
13,
13,
28,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
17,
17,
0,
18,
13,
13,
2,
18,
13,
13,
13,
0,
13,
2,
18,
13,
13,
13,
0,
18,
13,
17,
13,
4,
13,
31,
13,
0,
13,
17,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13
] | [
[
223,
2
],
[
223,
11
],
[
223,
12
],
[
16,
15
],
[
200,
18
],
[
224,
31
],
[
190,
34
],
[
193,
39
],
[
187,
46
],
[
224,
52
],
[
56,
55
],
[
191,
55
],
[
211,
58
],
[
55,
61
],
[
224,
62
],
[
211,
63
],
[
202,
65
],
[
72,
71
],
[
209,
78
],
[
197,
83
],
[
209,
86
],
[
90,
89
],
[
212,
96
],
[
224,
101
],
[
212,
104
],
[
214,
107
],
[
224,
110
],
[
71,
111
],
[
89,
112
],
[
127,
114
],
[
203,
115
],
[
71,
119
],
[
209,
120
],
[
89,
123
],
[
212,
124
],
[
215,
131
],
[
191,
133
],
[
136,
135
],
[
203,
135
],
[
205,
138
],
[
220,
144
],
[
197,
147
],
[
224,
150
],
[
154,
153
],
[
162,
159
],
[
206,
160
],
[
153,
161
],
[
194,
164
],
[
153,
165
],
[
153,
166
],
[
217,
168
],
[
194,
171
],
[
153,
172
],
[
153,
173
],
[
178,
175
],
[
206,
176
],
[
218,
178
],
[
221,
178
],
[
206,
182
],
[
185,
184
],
[
187,
188
],
[
190,
191
],
[
193,
194
],
[
223,
197
],
[
223,
200
],
[
202,
203
],
[
205,
206
],
[
211,
209
],
[
211,
212
],
[
214,
215
],
[
217,
218
],
[
220,
221
],
[
223,
224
]
] | [
"h,w,n=map(int,input().split())\nspots=set([eval(input().replace(' ','*w+'))-w-1 for i in range(n)])\nanss=[0]*10\nfrom itertools import product as pr\nmoves=(tuple(x+w*y for x,y in pr(range(0,3),repeat=2)))\nfor i in spots:\n a,b=divmod(i,w)\n pre=[0]*9\n for x in range(max(0,a-2),min(h-2,a+1)):\n for y in range(max(0,b-2),min(w-2,b+1)):\n ind=w*x+y\n pre[x-a+(y-b)*3+8]+=sum(ind+m in spots for m in moves)\n for v in pre:anss[v]+=1\ntans=[0]*10\n\nans0=(h-2)*(w-2)\nfor i in range(1,10):\n tans[i]=anss[i]//i\n ans0-=anss[i]//i\ntans[0]=ans0\nprint(*tans,sep='\\n')",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"eval(input().replace(' ','*w+'))-w-1 for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"eval(input().replace(' ','*w+'))-w-1",
"eval(input().replace(' ','*w+'))-w",
"eval(input().replace(' ','*w+'))",
"eval",
"input().replace(' ','*w+')",
"().replace",
"()",
"input",
"replace",
"' '",
"'*w+'",
"w",
"1",
"spots=set([eval(input().replace(' ','*w+'))-w-1 for i in range(n)])",
"spots",
"set([eval(input().replace(' ','*w+'))-w-1 for i in range(n)])",
"set",
"[eval(input().replace(' ','*w+'))-w-1 for i in range(n)]",
"anss=[0]*10",
"anss",
"[0]*10",
"[0]",
"0",
"10",
"from itertools import product as pr",
"moves=(tuple(x+w*y for x,y in pr(range(0,3),repeat=2)))",
"moves",
"tuple(x+w*y for x,y in pr(range(0,3),repeat=2))",
"tuple",
"x+w*y",
"x",
"w*y",
"w",
"y",
"for i in spots:\n a,b=divmod(i,w)\n pre=[0]*9\n for x in range(max(0,a-2),min(h-2,a+1)):\n for y in range(max(0,b-2),min(w-2,b+1)):\n ind=w*x+y\n pre[x-a+(y-b)*3+8]+=sum(ind+m in spots for m in moves)\n for v in pre:anss[v]+=1",
"i",
"spots",
"a,b=divmod(i,w)",
"a",
"divmod(i,w)",
"divmod",
"i",
"w",
"b",
"pre=[0]*9",
"pre",
"[0]*9",
"[0]",
"0",
"9",
"for x in range(max(0,a-2),min(h-2,a+1)):\n for y in range(max(0,b-2),min(w-2,b+1)):\n ind=w*x+y\n pre[x-a+(y-b)*3+8]+=sum(ind+m in spots for m in moves)\n ",
"x",
"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 y in range(max(0,b-2),min(w-2,b+1)):\n ind=w*x+y\n pre[x-a+(y-b)*3+8]+=sum(ind+m in spots for m in moves)\n ",
"y",
"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",
"ind=w*x+y",
"ind",
"w*x+y",
"w*x",
"w",
"x",
"y",
"pre[x-a+(y-b)*3+8]+=sum(ind+m in spots for m in moves)",
"pre[x-a+(y-b)*3+8]",
"pre",
"x-a+(y-b)*3+8",
"x-a+(y-b)*3",
"x-a",
"x",
"a",
"(y-b)*3",
"y-b",
"y",
"b",
"3",
"8",
"sum(ind+m in spots for m in moves)",
"sum",
"ind+m in spots",
"ind+m",
"ind",
"m",
"spots",
"for v in pre:anss[v",
"v",
"pre",
"tans=[0]*10",
"tans",
"[0]*10",
"[0]",
"0",
"10",
"ans0=(h-2)*(w-2)",
"ans0",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"for i in range(1,10):\n tans[i]=anss[i]//i\n ans0-=anss[i]//i",
"i",
"range(1,10)",
"range",
"1",
"10",
"tans[i]=anss[i]//i",
"tans[i]",
"tans",
"i",
"anss[i]//i",
"anss[i]",
"anss",
"i",
"i",
"ans0-=anss[i]//i",
"ans0",
"anss[i]//i",
"anss[i]",
"anss",
"i",
"i",
"tans[0]=ans0",
"tans[0]",
"tans",
"0",
"ans0",
"print(*tans,sep='\\n')",
"print",
"*tans",
"tans",
"sep='\\n'",
"sep",
"'\\n'",
"moves=(tuple(x+w*y for x,y in pr(range(0,3),repeat=2)))",
"tuple(x+w*y for x,y in pr(range(0,3),repeat=2))",
"moves",
"spots=set([eval(input().replace(' ','*w+'))-w-1 for i in range(n)])",
"set([eval(input().replace(' ','*w+'))-w-1 for i in range(n)])",
"spots",
"anss=[0]*10",
"[0]*10",
"anss",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"pre=[0]*9",
"[0]*9",
"pre",
"tans=[0]*10",
"[0]*10",
"tans",
"a,b=divmod(i,w)",
"divmod(i,w)",
"a",
"b=divmod(i,w)",
"divmod(i,w)",
"b",
"ind=w*x+y",
"w*x+y",
"ind",
"ans0-=anss[i]//i",
"anss[i]//i",
"ans0",
"ans0=(h-2)*(w-2)",
"(h-2)*(w-2)",
"ans0",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w"
] | h,w,n=map(int,input().split())
spots=set([eval(input().replace(' ','*w+'))-w-1 for i in range(n)])
anss=[0]*10
from itertools import product as pr
moves=(tuple(x+w*y for x,y in pr(range(0,3),repeat=2)))
for i in spots:
a,b=divmod(i,w)
pre=[0]*9
for x in range(max(0,a-2),min(h-2,a+1)):
for y in range(max(0,b-2),min(w-2,b+1)):
ind=w*x+y
pre[x-a+(y-b)*3+8]+=sum(ind+m in spots for m in moves)
for v in pre:anss[v]+=1
tans=[0]*10
ans0=(h-2)*(w-2)
for i in range(1,10):
tans[i]=anss[i]//i
ans0-=anss[i]//i
tans[0]=ans0
print(*tans,sep='\n')
|
[
7,
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,
39,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
15,
0,
13,
4,
13,
12,
17,
12,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
2,
2,
40,
2,
13,
13,
17,
40,
2,
13,
13,
17,
40,
2,
2,
13,
17,
13,
2,
13,
17,
40,
2,
2,
13,
17,
13,
2,
13,
17,
0,
18,
13,
4,
13,
39,
2,
13,
13,
2,
13,
13,
17,
23,
13,
23,
13,
23,
13,
28,
13,
4,
13,
13,
4,
18,
13,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
4,
13,
2,
18,
18,
13,
13,
17,
17,
2,
18,
18,
13,
13,
17,
17,
13,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
17,
28,
13,
4,
13,
4,
13,
13,
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,
12,
13
] | [
[
206,
2
],
[
209,
10
],
[
207,
14
],
[
197,
17
],
[
207,
21
],
[
191,
24
],
[
207,
28
],
[
200,
31
],
[
36,
35
],
[
194,
42
],
[
48,
45
],
[
195,
46
],
[
210,
50
],
[
198,
53
],
[
203,
57
],
[
66,
65
],
[
71,
70
],
[
120,
80
],
[
65,
81
],
[
122,
85
],
[
70,
86
],
[
120,
91
],
[
65,
93
],
[
210,
95
],
[
122,
100
],
[
70,
102
],
[
198,
104
],
[
118,
107
],
[
124,
108
],
[
120,
113
],
[
65,
114
],
[
122,
116
],
[
70,
117
],
[
120,
120
],
[
122,
122
],
[
124,
124
],
[
127,
126
],
[
192,
129
],
[
201,
132
],
[
213,
146
],
[
201,
150
],
[
126,
151
],
[
201,
157
],
[
126,
158
],
[
204,
161
],
[
164,
163
],
[
204,
166
],
[
172,
169
],
[
195,
170
],
[
163,
171
],
[
177,
174
],
[
195,
175
],
[
180,
179
],
[
195,
184
],
[
169,
187
],
[
195,
188
],
[
179,
189
],
[
191,
192
],
[
194,
195
],
[
197,
198
],
[
200,
201
],
[
203,
204
],
[
206,
207
],
[
209,
210
]
] | [
"inp=input().split(\" \")\nH=int(inp[0])\nW=int(inp[1])\nN=int(inp[2])\nplot=[]\ntimes=[0 for i in range(10)]\ntimes[0]=(H-2)*(W-2)\nfrom collections import defaultdict\ncount=defaultdict(lambda:0)\ndef check(a,b,count):\n for i in range(3):\n for j in range(3):\n if a-i>=0 and b-j>=0 and a+2-i<=H-1 and b+2-j<=W-1:\n count[str([a-i,b-j])]+=1\nfor i in range(N):\n plot.append(list(map(int,input().split(\" \"))))\n check(plot[i][0]-1,plot[i][1]-1,count)\nfor i in count.values():\n times[i]+=1\n times[0]-=1\nfor i in range(len(times)):\n print(times[i])",
"inp=input().split(\" \")",
"inp",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"H=int(inp[0])",
"H",
"int(inp[0])",
"int",
"inp[0]",
"inp",
"0",
"W=int(inp[1])",
"W",
"int(inp[1])",
"int",
"inp[1]",
"inp",
"1",
"N=int(inp[2])",
"N",
"int(inp[2])",
"int",
"inp[2]",
"inp",
"2",
"plot=[]",
"plot",
"[]",
"0 for i in range(10)",
"for i in range(10)",
"i",
"range(10)",
"range",
"10",
"for i in range(10)",
"0",
"times=[0 for i in range(10)]",
"times",
"[0 for i in range(10)]",
"times[0]=(H-2)*(W-2)",
"times[0]",
"times",
"0",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"from collections import defaultdict",
"count=defaultdict(lambda:0)",
"count",
"defaultdict(lambda:0)",
"defaultdict",
"lambda:0",
"0",
"def check(a,b,count):\n for i in range(3):\n for j in range(3):\n if a-i>=0 and b-j>=0 and a+2-i<=H-1 and b+2-j<=W-1:\n count[str([a-i,b-j])]+=1",
"check",
"for i in range(3):\n for j in range(3):\n if a-i>=0 and b-j>=0 and a+2-i<=H-1 and b+2-j<=W-1:\n count[str([a-i,b-j])]+=1",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n if a-i>=0 and b-j>=0 and a+2-i<=H-1 and b+2-j<=W-1:\n count[str([a-i,b-j])]+=1",
"j",
"range(3)",
"range",
"3",
"if a-i>=0 and b-j>=0 and a+2-i<=H-1 and b+2-j<=W-1:\n count[str([a-i,b-j])]+=1",
"a-i>=0 and b-j>=0 and a+2-i<=H-1 and b+2-j<=W-1",
"a-i>=0 and b-j>=0 and a+2-i<=H-1",
"a-i>=0 and b-j>=0",
"a-i>=0",
"a-i",
"a",
"i",
"0",
"b-j>=0",
"b-j",
"b",
"j",
"0",
"a+2-i<=H-1",
"a+2-i",
"a+2",
"a",
"2",
"i",
"H-1",
"H",
"1",
"b+2-j<=W-1",
"b+2-j",
"b+2",
"b",
"2",
"j",
"W-1",
"W",
"1",
"count[str([a-i,b-j])]+=1",
"count[str([a-i,b-j])]",
"count",
"str([a-i,b-j])",
"str",
"[a-i,b-j]",
"a-i",
"a",
"i",
"b-j",
"b",
"j",
"1",
"a",
"a",
"b",
"b",
"count",
"count",
"for i in range(N):\n plot.append(list(map(int,input().split(\" \"))))\n check(plot[i][0]-1,plot[i][1]-1,count)",
"i",
"range(N)",
"range",
"N",
"plot.append(list(map(int,input().split(\" \"))))",
"plot.append",
"plot",
"append",
"list(map(int,input().split(\" \")))",
"list",
"map(int,input().split(\" \"))",
"map",
"int",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"check(plot[i][0]-1,plot[i][1]-1,count)",
"check",
"plot[i][0]-1",
"plot[i][0]",
"[i]",
"plot",
"i",
"0",
"1",
"plot[i][1]-1",
"plot[i][1]",
"[i]",
"plot",
"i",
"1",
"1",
"count",
"for i in count.values():\n times[i]+=1\n times[0]-=1",
"i",
"count.values()",
"count.values",
"count",
"values",
"times[i]+=1",
"times[i]",
"times",
"i",
"1",
"times[0]-=1",
"times[0]",
"times",
"0",
"1",
"for i in range(len(times)):\n print(times[i])",
"i",
"range(len(times))",
"range",
"len(times)",
"len",
"times",
"print(times[i])",
"print",
"times[i]",
"times",
"i",
"N=int(inp[2])",
"int(inp[2])",
"N",
"times=[0 for i in range(10)]",
"[0 for i in range(10)]",
"times",
"W=int(inp[1])",
"int(inp[1])",
"W",
"plot=[]",
"[]",
"plot",
"count=defaultdict(lambda:0)",
"defaultdict(lambda:0)",
"count",
"inp=input().split(\" \")",
"input().split(\" \")",
"inp",
"H=int(inp[0])",
"int(inp[0])",
"H",
"def check(a,b,count):\n for i in range(3):\n for j in range(3):\n if a-i>=0 and b-j>=0 and a+2-i<=H-1 and b+2-j<=W-1:\n count[str([a-i,b-j])]+=1",
"def check(a,b,count):\n for i in range(3):\n for j in range(3):\n if a-i>=0 and b-j>=0 and a+2-i<=H-1 and b+2-j<=W-1:\n count[str([a-i,b-j])]+=1",
"check"
] | inp=input().split(" ")
H=int(inp[0])
W=int(inp[1])
N=int(inp[2])
plot=[]
times=[0 for i in range(10)]
times[0]=(H-2)*(W-2)
from collections import defaultdict
count=defaultdict(lambda:0)
def check(a,b,count):
for i in range(3):
for j in range(3):
if a-i>=0 and b-j>=0 and a+2-i<=H-1 and b+2-j<=W-1:
count[str([a-i,b-j])]+=1
for i in range(N):
plot.append(list(map(int,input().split(" "))))
check(plot[i][0]-1,plot[i][1]-1,count)
for i in count.values():
times[i]+=1
times[0]-=1
for i in range(len(times)):
print(times[i]) |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
17,
4,
18,
13,
13,
2,
17,
17,
12,
13,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
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,
4,
13,
17,
13,
2,
4,
13,
2,
13,
17,
2,
13,
17,
17,
28,
13,
4,
13,
4,
13,
17,
13,
2,
4,
13,
2,
13,
17,
2,
13,
17,
17,
0,
13,
18,
13,
39,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
0,
18,
13,
39,
13,
13,
17,
4,
13,
31,
13,
0,
13,
17,
14,
2,
13,
17,
4,
13,
10,
4,
13,
10,
18,
13,
10,
2,
13,
10,
12,
13
] | [
[
170,
4
],
[
173,
11
],
[
167,
18
],
[
34,
33
],
[
171,
40
],
[
34,
42
],
[
34,
43
],
[
46,
45
],
[
51,
50
],
[
59,
56
],
[
50,
57
],
[
33,
61
],
[
42,
64
],
[
68,
67
],
[
43,
70
],
[
73,
72
],
[
171,
79
],
[
73,
81
],
[
84,
83
],
[
72,
85
],
[
83,
85
],
[
88,
87
],
[
81,
89
],
[
87,
89
],
[
93,
92
],
[
83,
98
],
[
72,
98
],
[
33,
103
],
[
83,
106
],
[
72,
106
],
[
111,
110
],
[
87,
116
],
[
81,
116
],
[
42,
121
],
[
87,
124
],
[
81,
124
],
[
129,
128
],
[
45,
130
],
[
138,
135
],
[
50,
136
],
[
128,
137
],
[
145,
140
],
[
50,
141
],
[
128,
143
],
[
152,
147
],
[
45,
148
],
[
50,
156
],
[
159,
158
],
[
177,
165
],
[
167,
168
],
[
170,
171
],
[
173,
174
]
] | [
"import sys\n\nreadline = sys.stdin.readline\nMOD = 10 ** 9 + 7\nINF = float('INF')\nsys.setrecursionlimit(10 ** 5)\n\n\ndef main():\n from collections import defaultdict\n h, w, n = map(int, readline().split())\n c = defaultdict(int)\n count = [0] * 10\n count[0] = (h - 2) * (w - 2)\n\n for _ in range(n):\n a, b = map(int, readline().split())\n a, b = a - 1, b - 1\n for row in range(max(2, a), min(h - 1, a + 2) + 1):\n for col in range(max(2, b), min(w - 1, b + 2) + 1):\n cur = c[(row, col)]\n count[cur] -= 1\n count[cur + 1] += 1\n c[(row, col)] += 1\n\n print(*count, sep=\"\\n\")\n\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"readline = sys.stdin.readline",
"readline",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"MOD = 10 ** 9 + 7",
"MOD",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"INF = float('INF')",
"INF",
"float('INF')",
"float",
"'INF'",
"sys.setrecursionlimit(10 ** 5)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 5",
"10",
"5",
"def main():\n from collections import defaultdict\n h, w, n = map(int, readline().split())\n c = defaultdict(int)\n count = [0] * 10\n count[0] = (h - 2) * (w - 2)\n\n for _ in range(n):\n a, b = map(int, readline().split())\n a, b = a - 1, b - 1\n for row in range(max(2, a), min(h - 1, a + 2) + 1):\n for col in range(max(2, b), min(w - 1, b + 2) + 1):\n cur = c[(row, col)]\n count[cur] -= 1\n count[cur + 1] += 1\n c[(row, col)] += 1\n\n print(*count, sep=\"\\n\")",
"main",
"from collections import defaultdict",
"h, w, n = map(int, readline().split())",
"h",
"map(int, readline().split())",
"map",
"int",
"readline().split()",
"().split",
"()",
"readline",
"split",
"w",
"n",
"c = defaultdict(int)",
"c",
"defaultdict(int)",
"defaultdict",
"int",
"count = [0] * 10",
"count",
"[0] * 10",
"[0]",
"0",
"10",
"count[0] = (h - 2) * (w - 2)",
"count[0]",
"count",
"0",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"for _ in range(n):\n a, b = map(int, readline().split())\n a, b = a - 1, b - 1\n for row in range(max(2, a), min(h - 1, a + 2) + 1):\n for col in range(max(2, b), min(w - 1, b + 2) + 1):\n cur = c[(row, col)]\n count[cur] -= 1\n count[cur + 1] += 1\n c[(row, col)] += 1\n\n ",
"_",
"range(n)",
"range",
"n",
"a, b = map(int, readline().split())",
"a",
"map(int, readline().split())",
"map",
"int",
"readline().split()",
"().split",
"()",
"readline",
"split",
"b",
"a, b = a - 1, b - 1",
"a",
"a - 1",
"a",
"1",
"b",
"b - 1",
"b",
"1",
"for row in range(max(2, a), min(h - 1, a + 2) + 1):\n for col in range(max(2, b), min(w - 1, b + 2) + 1):\n cur = c[(row, col)]\n count[cur] -= 1\n count[cur + 1] += 1\n c[(row, col)] += 1\n\n ",
"row",
"range(max(2, a), min(h - 1, a + 2) + 1)",
"range",
"max(2, a)",
"max",
"2",
"a",
"min(h - 1, a + 2) + 1",
"min(h - 1, a + 2)",
"min",
"h - 1",
"h",
"1",
"a + 2",
"a",
"2",
"1",
"for col in range(max(2, b), min(w - 1, b + 2) + 1):\n cur = c[(row, col)]\n count[cur] -= 1\n count[cur + 1] += 1\n c[(row, col)] += 1\n\n ",
"col",
"range(max(2, b), min(w - 1, b + 2) + 1)",
"range",
"max(2, b)",
"max",
"2",
"b",
"min(w - 1, b + 2) + 1",
"min(w - 1, b + 2)",
"min",
"w - 1",
"w",
"1",
"b + 2",
"b",
"2",
"1",
"cur = c[(row, col)]",
"cur",
"c[(row, col)]",
"c",
"(row, col)",
"row",
"col",
"count[cur] -= 1",
"count[cur]",
"count",
"cur",
"1",
"count[cur + 1] += 1",
"count[cur + 1]",
"count",
"cur + 1",
"cur",
"1",
"1",
"c[(row, col)] += 1",
"c[(row, col)]",
"c",
"(row, col)",
"row",
"col",
"1",
"print(*count, sep=\"\\n\")",
"print",
"*count",
"count",
"sep=\"\\n\"",
"sep",
"\"\\n\"",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"INF = float('INF')",
"float('INF')",
"INF",
"readline = sys.stdin.readline",
"sys.stdin.readline",
"readline",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"def main():\n from collections import defaultdict\n h, w, n = map(int, readline().split())\n c = defaultdict(int)\n count = [0] * 10\n count[0] = (h - 2) * (w - 2)\n\n for _ in range(n):\n a, b = map(int, readline().split())\n a, b = a - 1, b - 1\n for row in range(max(2, a), min(h - 1, a + 2) + 1):\n for col in range(max(2, b), min(w - 1, b + 2) + 1):\n cur = c[(row, col)]\n count[cur] -= 1\n count[cur + 1] += 1\n c[(row, col)] += 1\n\n print(*count, sep=\"\\n\")",
"def main():\n from collections import defaultdict\n h, w, n = map(int, readline().split())\n c = defaultdict(int)\n count = [0] * 10\n count[0] = (h - 2) * (w - 2)\n\n for _ in range(n):\n a, b = map(int, readline().split())\n a, b = a - 1, b - 1\n for row in range(max(2, a), min(h - 1, a + 2) + 1):\n for col in range(max(2, b), min(w - 1, b + 2) + 1):\n cur = c[(row, col)]\n count[cur] -= 1\n count[cur + 1] += 1\n c[(row, col)] += 1\n\n print(*count, sep=\"\\n\")",
"main"
] | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
from collections import defaultdict
h, w, n = map(int, readline().split())
c = defaultdict(int)
count = [0] * 10
count[0] = (h - 2) * (w - 2)
for _ in range(n):
a, b = map(int, readline().split())
a, b = a - 1, b - 1
for row in range(max(2, a), min(h - 1, a + 2) + 1):
for col in range(max(2, b), min(w - 1, b + 2) + 1):
cur = c[(row, col)]
count[cur] -= 1
count[cur + 1] += 1
c[(row, col)] += 1
print(*count, sep="\n")
if __name__ == '__main__':
main()
|
[
7,
15,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
18,
18,
13,
13,
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,
2,
39,
17,
17,
0,
13,
17,
28,
13,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
2,
2,
2,
2,
13,
13,
17,
2,
2,
13,
13,
17,
40,
2,
13,
13,
2,
13,
17,
40,
2,
13,
13,
2,
13,
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,
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,
10,
13,
13,
10,
17,
13,
10,
18,
13,
10,
13,
13,
10,
13,
13,
10,
2,
13,
10,
13,
13
] | [
[
165,
11
],
[
20,
19
],
[
166,
23
],
[
19,
28
],
[
177,
30
],
[
177,
32
],
[
177,
33
],
[
37,
36
],
[
160,
39
],
[
171,
43
],
[
174,
46
],
[
162,
52
],
[
60,
59
],
[
65,
64
],
[
59,
75
],
[
64,
80
],
[
59,
85
],
[
178,
87
],
[
64,
92
],
[
169,
94
],
[
59,
101
],
[
64,
104
],
[
163,
105
],
[
116,
107
],
[
163,
108
],
[
59,
112
],
[
64,
115
],
[
127,
118
],
[
163,
119
],
[
59,
123
],
[
64,
126
],
[
130,
129
],
[
163,
132
],
[
138,
135
],
[
175,
136
],
[
129,
137
],
[
143,
140
],
[
175,
141
],
[
178,
146
],
[
169,
149
],
[
175,
153
],
[
175,
157
],
[
177,
160
],
[
162,
163
],
[
165,
166
],
[
177,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
]
] | [
"# coding: utf-8\n# Your code here!\n\nimport sys\nsys.setrecursionlimit(10**6)\nreadline = sys.stdin.readline\n \n#n = int(input())\nh,w,n = [int(i) for i in readline().split()]\nab = [[int(i)-1 for i in readline().split()] for _ in range(n)]\n\nans = [0]*10\n\n#print(ab)\nd = {}\nfor a,b in ab:\n for i in range(3):\n for j in range(3):\n if a-i < 0 or b-j < 0 or a-i >= h-2 or b-j >= w-2: continue\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 \n#print(d)\nfor i in d.values():\n ans[i] += 1\n\n\n\n\nans[0] = (h-2)*(w-2) - sum(ans)\nprint(*ans)\n\n\n\n\n\n\n",
"import sys",
"sys",
"sys.setrecursionlimit(10**6)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**6",
"10",
"6",
"readline = sys.stdin.readline",
"readline",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"int(i) for i in readline().split()",
"for i in readline().split()",
"i",
"readline().split()",
"().split",
"()",
"readline",
"split",
"for i in readline().split()",
"int(i)",
"int",
"i",
"h,w,n = [int(i) for i in readline().split()]",
"h",
"[int(i) for i in readline().split()]",
"w",
"n",
"[int(i)-1 for i in readline().split()] for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"[int(i)-1 for i in readline().split()]",
"ab = [[int(i)-1 for i in readline().split()] for _ in range(n)]",
"ab",
"[[int(i)-1 for i in readline().split()] for _ in range(n)]",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"d = {}",
"d",
"{}",
"for a,b in ab:\n for i in range(3):\n for j in range(3):\n if a-i < 0 or b-j < 0 or a-i >= h-2 or b-j >= w-2: continue\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 \n#print(d)",
"a",
"b",
"ab",
"for i in range(3):\n for j in range(3):\n if a-i < 0 or b-j < 0 or a-i >= h-2 or b-j >= w-2: continue\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 \n#print(d)",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n if a-i < 0 or b-j < 0 or a-i >= h-2 or b-j >= w-2: continue\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 \n#print(d)",
"j",
"range(3)",
"range",
"3",
"if a-i < 0 or b-j < 0 or a-i >= h-2 or b-j >= w-2: continue\n ",
"a-i < 0 or b-j < 0 or a-i >= h-2 or b-j >= w-2",
"a-i < 0 or b-j < 0 or a-i >= h-2",
"a-i < 0 or b-j < 0",
"a-i < 0",
"a-i",
"a",
"i",
"0",
"b-j < 0",
"b-j",
"b",
"j",
"0",
"a-i >= h-2",
"a-i",
"a",
"i",
"h-2",
"h",
"2",
"b-j >= w-2",
"b-j",
"b",
"j",
"w-2",
"w",
"2",
"if (a-i,b-j) in d:\n d[(a-i,b-j)] += 1\n else:\n d[(a-i,b-j)] = 1\n \n#print(d)",
"(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 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",
"print(*ans)",
"print",
"*ans",
"ans",
"n = [int(i) for i in readline().split()]",
"[int(i) for i in readline().split()]",
"n",
"d = {}",
"{}",
"d",
"readline = sys.stdin.readline",
"sys.stdin.readline",
"readline",
"w,n = [int(i) for i in readline().split()]",
"[int(i) for i in readline().split()]",
"w",
"ab = [[int(i)-1 for i in readline().split()] for _ in range(n)]",
"[[int(i)-1 for i in readline().split()] for _ in range(n)]",
"ab",
"ans = [0]*10",
"[0]*10",
"ans",
"h,w,n = [int(i) for i in readline().split()]",
"[int(i) for i in readline().split()]",
"h"
] | # coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
#n = int(input())
h,w,n = [int(i) for i in readline().split()]
ab = [[int(i)-1 for i in readline().split()] for _ in range(n)]
ans = [0]*10
#print(ab)
d = {}
for a,b in ab:
for i in range(3):
for j in range(3):
if a-i < 0 or b-j < 0 or a-i >= h-2 or b-j >= w-2: continue
if (a-i,b-j) in d:
d[(a-i,b-j)] += 1
else:
d[(a-i,b-j)] = 1
#print(d)
for i in d.values():
ans[i] += 1
ans[0] = (h-2)*(w-2) - sum(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,
39,
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,
4,
13,
31,
13,
0,
13,
17,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13,
10,
4,
13
] | [
[
156,
2
],
[
156,
11
],
[
156,
12
],
[
165,
14
],
[
19,
18
],
[
151,
21
],
[
144,
23
],
[
144,
32
],
[
35,
34
],
[
41,
40
],
[
162,
46
],
[
145,
48
],
[
34,
49
],
[
138,
51
],
[
136,
53
],
[
40,
54
],
[
163,
60
],
[
157,
62
],
[
139,
67
],
[
154,
69
],
[
159,
72
],
[
160,
78
],
[
166,
79
],
[
84,
81
],
[
166,
82
],
[
160,
83
],
[
89,
86
],
[
166,
87
],
[
160,
88
],
[
147,
91
],
[
141,
97
],
[
166,
102
],
[
106,
105
],
[
142,
105
],
[
111,
108
],
[
148,
109
],
[
105,
110
],
[
116,
113
],
[
148,
114
],
[
157,
119
],
[
154,
122
],
[
148,
126
],
[
148,
130
],
[
133,
132
],
[
144,
136
],
[
138,
139
],
[
141,
142
],
[
144,
145
],
[
147,
148
],
[
156,
151
],
[
156,
154
],
[
156,
157
],
[
159,
160
],
[
162,
163
],
[
165,
166
]
] | [
"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 x=a+p\n y=b+q\n if 2<=x<=H-1 and 2<=y<=W-1:\n pos=(x,y)\n if pos in D:\n D[pos]+=1\n else:\n D[pos]=1\nans=[0]*10\nV=list(D.values())\nfor v in V:\n ans[v]+=1\nans[0]=(H-2)*(W-2)-sum(ans)\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",
"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 x=a+p\n y=b+q\n if 2<=x<=H-1 and 2<=y<=W-1:\n pos=(x,y)\n if pos in D:\n D[pos]+=1\n else:\n D[pos]=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 x=a+p\n y=b+q\n if 2<=x<=H-1 and 2<=y<=W-1:\n pos=(x,y)\n if pos in D:\n D[pos]+=1\n else:\n D[pos]=1",
"p",
"range(-1,2)",
"range",
"-1",
"2",
"for q in range(-1,2):\n x=a+p\n y=b+q\n if 2<=x<=H-1 and 2<=y<=W-1:\n pos=(x,y)\n if pos in D:\n D[pos]+=1\n else:\n D[pos]=1",
"q",
"range(-1,2)",
"range",
"-1",
"2",
"x=a+p",
"x",
"a+p",
"a",
"p",
"y=b+q",
"y",
"b+q",
"b",
"q",
"if 2<=x<=H-1 and 2<=y<=W-1:\n pos=(x,y)\n if pos in D:\n D[pos]+=1\n else:\n D[pos]=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",
"pos=(x,y)",
"pos",
"(x,y)",
"x",
"y",
"if pos in D:\n D[pos]+=1\n else:\n D[pos]=1",
"pos in D",
"pos",
"D",
"D[pos]+=1",
"D[pos]",
"D",
"pos",
"1",
"D[pos]=1",
"D[pos]",
"D",
"pos",
"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",
"print(*ans,sep='\\n')",
"print",
"*ans",
"ans",
"sep='\\n'",
"sep",
"'\\n'",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"y=b+q",
"b+q",
"y",
"V=list(D.values())",
"list(D.values())",
"V",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"ans=[0]*10",
"[0]*10",
"ans",
"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",
"pos=(x,y)",
"(x,y)",
"pos",
"x=a+p",
"a+p",
"x",
"D=dict()",
"dict()",
"D"
] | 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):
x=a+p
y=b+q
if 2<=x<=H-1 and 2<=y<=W-1:
pos=(x,y)
if pos in D:
D[pos]+=1
else:
D[pos]=1
ans=[0]*10
V=list(D.values())
for v in V:
ans[v]+=1
ans[0]=(H-2)*(W-2)-sum(ans)
print(*ans,sep='\n') |
[
7,
15,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
12,
4,
13,
12,
17,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
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,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
2,
2,
2,
13,
17,
40,
2,
13,
17,
13,
2,
13,
17,
40,
2,
13,
17,
13,
9,
0,
13,
18,
18,
13,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
0,
18,
18,
13,
13,
13,
2,
13,
17,
28,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
6,
5
],
[
6,
14
],
[
6,
15
],
[
18,
17
],
[
27,
26
],
[
35,
32
],
[
26,
33
],
[
5,
37
],
[
14,
40
],
[
44,
43
],
[
15,
46
],
[
49,
48
],
[
49,
57
],
[
60,
59
],
[
63,
62
],
[
66,
65
],
[
59,
69
],
[
48,
69
],
[
59,
72
],
[
48,
72
],
[
76,
75
],
[
62,
79
],
[
57,
79
],
[
62,
82
],
[
57,
82
],
[
65,
89
],
[
5,
93
],
[
65,
95
],
[
75,
97
],
[
14,
101
],
[
75,
103
],
[
107,
106
],
[
125,
107
],
[
17,
109
],
[
65,
110
],
[
75,
111
],
[
116,
113
],
[
26,
114
],
[
106,
115
],
[
123,
118
],
[
26,
119
],
[
106,
121
],
[
130,
125
],
[
17,
127
],
[
65,
128
],
[
75,
129
],
[
106,
131
],
[
135,
134
],
[
26,
134
],
[
134,
138
],
[
147,
144
]
] | [
"from collections import defaultdict\n\n\ndef main():\n H, W, N = map(int, input().split())\n cnt = defaultdict(lambda: defaultdict(lambda: 0))\n ans = [0] * 10\n ans[0] = (H-2)*(W-2)\n for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in range(a-1, a+2):\n for j in range(b-1, b+2):\n if i < 1 or H-1 <= i or j < 1 or W-1 <= j:\n continue\n c = cnt[i][j]\n ans[c] -= 1\n ans[c+1] += 1\n cnt[i][j] = c+1\n for a in ans:\n print(a)\n\nif __name__ == \"__main__\":\n main()",
"from collections import defaultdict",
"def main():\n H, W, N = map(int, input().split())\n cnt = defaultdict(lambda: defaultdict(lambda: 0))\n ans = [0] * 10\n ans[0] = (H-2)*(W-2)\n for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in range(a-1, a+2):\n for j in range(b-1, b+2):\n if i < 1 or H-1 <= i or j < 1 or W-1 <= j:\n continue\n c = cnt[i][j]\n ans[c] -= 1\n ans[c+1] += 1\n cnt[i][j] = c+1\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",
"cnt = defaultdict(lambda: defaultdict(lambda: 0))",
"cnt",
"defaultdict(lambda: defaultdict(lambda: 0))",
"defaultdict",
"lambda: defaultdict(lambda: 0)",
"defaultdict(lambda: 0)",
"defaultdict",
"lambda: 0",
"0",
"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 _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in range(a-1, a+2):\n for j in range(b-1, b+2):\n if i < 1 or H-1 <= i or j < 1 or W-1 <= j:\n continue\n c = cnt[i][j]\n ans[c] -= 1\n ans[c+1] += 1\n cnt[i][j] = c+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",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for i in range(a-1, a+2):\n for j in range(b-1, b+2):\n if i < 1 or H-1 <= i or j < 1 or W-1 <= j:\n continue\n c = cnt[i][j]\n ans[c] -= 1\n ans[c+1] += 1\n cnt[i][j] = c+1\n ",
"i",
"range(a-1, a+2)",
"range",
"a-1",
"a",
"1",
"a+2",
"a",
"2",
"for j in range(b-1, b+2):\n if i < 1 or H-1 <= i or j < 1 or W-1 <= j:\n continue\n c = cnt[i][j]\n ans[c] -= 1\n ans[c+1] += 1\n cnt[i][j] = c+1\n ",
"j",
"range(b-1, b+2)",
"range",
"b-1",
"b",
"1",
"b+2",
"b",
"2",
"if i < 1 or H-1 <= i or j < 1 or W-1 <= j:\n continue\n ",
"i < 1 or H-1 <= i or j < 1 or W-1 <= j",
"i < 1 or H-1 <= i or j < 1",
"i < 1 or H-1 <= i",
"i < 1",
"i",
"1",
"H-1 <= i",
"H-1",
"H",
"1",
"i",
"j < 1",
"j",
"1",
"W-1 <= j",
"W-1",
"W",
"1",
"j",
"continue",
"c = cnt[i][j]",
"c",
"cnt[i][j]",
"[i]",
"cnt",
"i",
"j",
"ans[c] -= 1",
"ans[c]",
"ans",
"c",
"1",
"ans[c+1] += 1",
"ans[c+1]",
"ans",
"c+1",
"c",
"1",
"1",
"cnt[i][j] = c+1",
"cnt[i][j]",
"[i]",
"cnt",
"i",
"j",
"c+1",
"c",
"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 cnt = defaultdict(lambda: defaultdict(lambda: 0))\n ans = [0] * 10\n ans[0] = (H-2)*(W-2)\n for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in range(a-1, a+2):\n for j in range(b-1, b+2):\n if i < 1 or H-1 <= i or j < 1 or W-1 <= j:\n continue\n c = cnt[i][j]\n ans[c] -= 1\n ans[c+1] += 1\n cnt[i][j] = c+1\n for a in ans:\n print(a)",
"def main():\n H, W, N = map(int, input().split())\n cnt = defaultdict(lambda: defaultdict(lambda: 0))\n ans = [0] * 10\n ans[0] = (H-2)*(W-2)\n for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in range(a-1, a+2):\n for j in range(b-1, b+2):\n if i < 1 or H-1 <= i or j < 1 or W-1 <= j:\n continue\n c = cnt[i][j]\n ans[c] -= 1\n ans[c+1] += 1\n cnt[i][j] = c+1\n for a in ans:\n print(a)",
"main"
] | from collections import defaultdict
def main():
H, W, N = map(int, input().split())
cnt = defaultdict(lambda: defaultdict(lambda: 0))
ans = [0] * 10
ans[0] = (H-2)*(W-2)
for _ in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
for i in range(a-1, a+2):
for j in range(b-1, b+2):
if i < 1 or H-1 <= i or j < 1 or W-1 <= j:
continue
c = cnt[i][j]
ans[c] -= 1
ans[c+1] += 1
cnt[i][j] = c+1
for a in ans:
print(a)
if __name__ == "__main__":
main()
|
[
7,
12,
13,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
0,
13,
4,
13,
28,
13,
4,
13,
0,
13,
4,
13,
13,
4,
18,
13,
13,
13,
0,
13,
17,
0,
13,
17,
14,
2,
13,
13,
4,
18,
18,
13,
13,
13,
13,
0,
18,
13,
13,
4,
13,
39,
13,
4,
18,
13,
13,
39,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
4,
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,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
40,
39,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
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,
4,
18,
13,
13,
39,
13,
13,
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
] | [
[
7,
6
],
[
14,
13
],
[
14,
22
],
[
14,
23
],
[
26,
25
],
[
29,
28
],
[
33,
32
],
[
6,
34
],
[
37,
36
],
[
32,
42
],
[
37,
44
],
[
47,
46
],
[
50,
49
],
[
46,
53
],
[
36,
53
],
[
25,
54
],
[
63,
57
],
[
25,
58
],
[
46,
59
],
[
36,
59
],
[
49,
61
],
[
44,
61
],
[
66,
63
],
[
25,
64
],
[
46,
65
],
[
36,
65
],
[
28,
72
],
[
79,
78
],
[
85,
84
],
[
93,
92
],
[
46,
96
],
[
36,
96
],
[
46,
99
],
[
36,
99
],
[
103,
102
],
[
49,
106
],
[
44,
106
],
[
49,
109
],
[
44,
109
],
[
92,
117
],
[
13,
119
],
[
102,
124
],
[
22,
126
],
[
84,
132
],
[
135,
134
],
[
138,
137
],
[
143,
142
],
[
148,
147
],
[
92,
149
],
[
137,
150
],
[
153,
152
],
[
102,
154
],
[
142,
155
],
[
28,
161
],
[
164,
163
],
[
169,
166
],
[
78,
167
],
[
163,
168
],
[
134,
168
],
[
84,
172
],
[
181,
178
],
[
78,
179
],
[
13,
184
],
[
22,
187
],
[
78,
192
],
[
78,
198
],
[
201,
200
],
[
210,
207
]
] | [
"def main():\n import sys\n # readline = sys.stdin.readline\n readlines = sys.stdin.readlines\n H, W, N = map(int, input().split())\n grid = {}\n P = set()\n for s in readlines():\n a, b = map(int, s.split())\n a -= 1; b -= 1\n if a in grid:\n grid[a].add(b)\n else:\n grid[a] = set([b])\n P.add((a, b))\n\n ans = [0] * 10\n done = set()\n for a, b in P:\n for oa in range(a - 2, a + 1):\n for ob in range(b - 2, b + 1):\n if 0 <= oa <= H - 3 and 0 <= ob <= W - 3 and (oa, ob) not in done:\n tmp = 0\n for i in range(3):\n for j in range(3):\n na = oa + i\n nb = ob + j\n if (na, nb) in P:\n tmp += 1\n ans[tmp] += 1\n done.add((oa, ob))\n \n ans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n\n print(*ans, sep='\\n')\n\n\nif __name__ == \"__main__\":\n main()",
"def main():\n import sys\n # readline = sys.stdin.readline\n readlines = sys.stdin.readlines\n H, W, N = map(int, input().split())\n grid = {}\n P = set()\n for s in readlines():\n a, b = map(int, s.split())\n a -= 1; b -= 1\n if a in grid:\n grid[a].add(b)\n else:\n grid[a] = set([b])\n P.add((a, b))\n\n ans = [0] * 10\n done = set()\n for a, b in P:\n for oa in range(a - 2, a + 1):\n for ob in range(b - 2, b + 1):\n if 0 <= oa <= H - 3 and 0 <= ob <= W - 3 and (oa, ob) not in done:\n tmp = 0\n for i in range(3):\n for j in range(3):\n na = oa + i\n nb = ob + j\n if (na, nb) in P:\n tmp += 1\n ans[tmp] += 1\n done.add((oa, ob))\n \n ans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n\n print(*ans, sep='\\n')",
"main",
"import sys",
"sys",
"readlines = sys.stdin.readlines",
"readlines",
"sys.stdin.readlines",
"sys.stdin",
"sys",
"stdin",
"readlines",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"grid = {}",
"grid",
"{}",
"P = set()",
"P",
"set()",
"set",
"for s in readlines():\n a, b = map(int, s.split())\n a -= 1; b -= 1\n if a in grid:\n grid[a].add(b)\n else:\n grid[a] = set([b])\n P.add((a, b))\n\n ",
"s",
"readlines()",
"readlines",
"a, b = map(int, s.split())",
"a",
"map(int, s.split())",
"map",
"int",
"s.split()",
"s.split",
"s",
"split",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"if a in grid:\n grid[a].add(b)\n else:\n grid[a] = set([b])\n ",
"a in grid",
"a",
"grid",
"grid[a].add(b)",
"[a].add",
"[a]",
"grid",
"a",
"add",
"b",
"grid[a] = set([b])",
"grid[a]",
"grid",
"a",
"set([b])",
"set",
"[b]",
"b",
"P.add((a, b))",
"P.add",
"P",
"add",
"(a, b)",
"a",
"b",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"done = set()",
"done",
"set()",
"set",
"for a, b in P:\n for oa in range(a - 2, a + 1):\n for ob in range(b - 2, b + 1):\n if 0 <= oa <= H - 3 and 0 <= ob <= W - 3 and (oa, ob) not in done:\n tmp = 0\n for i in range(3):\n for j in range(3):\n na = oa + i\n nb = ob + j\n if (na, nb) in P:\n tmp += 1\n ans[tmp] += 1\n done.add((oa, ob))\n \n ",
"a",
"b",
"P",
"for oa in range(a - 2, a + 1):\n for ob in range(b - 2, b + 1):\n if 0 <= oa <= H - 3 and 0 <= ob <= W - 3 and (oa, ob) not in done:\n tmp = 0\n for i in range(3):\n for j in range(3):\n na = oa + i\n nb = ob + j\n if (na, nb) in P:\n tmp += 1\n ans[tmp] += 1\n done.add((oa, ob))\n \n ",
"oa",
"range(a - 2, a + 1)",
"range",
"a - 2",
"a",
"2",
"a + 1",
"a",
"1",
"for ob in range(b - 2, b + 1):\n if 0 <= oa <= H - 3 and 0 <= ob <= W - 3 and (oa, ob) not in done:\n tmp = 0\n for i in range(3):\n for j in range(3):\n na = oa + i\n nb = ob + j\n if (na, nb) in P:\n tmp += 1\n ans[tmp] += 1\n done.add((oa, ob))\n \n ",
"ob",
"range(b - 2, b + 1)",
"range",
"b - 2",
"b",
"2",
"b + 1",
"b",
"1",
"if 0 <= oa <= H - 3 and 0 <= ob <= W - 3 and (oa, ob) not in done:\n tmp = 0\n for i in range(3):\n for j in range(3):\n na = oa + i\n nb = ob + j\n if (na, nb) in P:\n tmp += 1\n ans[tmp] += 1\n done.add((oa, ob))\n \n ",
"0 <= oa <= H - 3 and 0 <= ob <= W - 3 and (oa, ob) not in done",
"0 <= oa <= H - 3 and 0 <= ob <= W - 3",
"0 <= oa <= H - 3",
"0 <= oa",
"0",
"oa",
"H - 3",
"H",
"3",
"0 <= ob <= W - 3",
"0 <= ob",
"0",
"ob",
"W - 3",
"W",
"3",
"(oa, ob) not in done",
"(oa, ob)",
"oa",
"ob",
"done",
"tmp = 0",
"tmp",
"0",
"for i in range(3):\n for j in range(3):\n na = oa + i\n nb = ob + j\n if (na, nb) in P:\n tmp += 1\n ",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n na = oa + i\n nb = ob + j\n if (na, nb) in P:\n tmp += 1\n ",
"j",
"range(3)",
"range",
"3",
"na = oa + i",
"na",
"oa + i",
"oa",
"i",
"nb = ob + j",
"nb",
"ob + j",
"ob",
"j",
"if (na, nb) in P:\n tmp += 1\n ",
"(na, nb) in P",
"(na, nb)",
"na",
"nb",
"P",
"tmp += 1",
"tmp",
"1",
"ans[tmp] += 1",
"ans[tmp]",
"ans",
"tmp",
"1",
"done.add((oa, ob))",
"done.add",
"done",
"add",
"(oa, ob)",
"oa",
"ob",
"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 import sys\n # readline = sys.stdin.readline\n readlines = sys.stdin.readlines\n H, W, N = map(int, input().split())\n grid = {}\n P = set()\n for s in readlines():\n a, b = map(int, s.split())\n a -= 1; b -= 1\n if a in grid:\n grid[a].add(b)\n else:\n grid[a] = set([b])\n P.add((a, b))\n\n ans = [0] * 10\n done = set()\n for a, b in P:\n for oa in range(a - 2, a + 1):\n for ob in range(b - 2, b + 1):\n if 0 <= oa <= H - 3 and 0 <= ob <= W - 3 and (oa, ob) not in done:\n tmp = 0\n for i in range(3):\n for j in range(3):\n na = oa + i\n nb = ob + j\n if (na, nb) in P:\n tmp += 1\n ans[tmp] += 1\n done.add((oa, ob))\n \n ans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n\n print(*ans, sep='\\n')",
"def main():\n import sys\n # readline = sys.stdin.readline\n readlines = sys.stdin.readlines\n H, W, N = map(int, input().split())\n grid = {}\n P = set()\n for s in readlines():\n a, b = map(int, s.split())\n a -= 1; b -= 1\n if a in grid:\n grid[a].add(b)\n else:\n grid[a] = set([b])\n P.add((a, b))\n\n ans = [0] * 10\n done = set()\n for a, b in P:\n for oa in range(a - 2, a + 1):\n for ob in range(b - 2, b + 1):\n if 0 <= oa <= H - 3 and 0 <= ob <= W - 3 and (oa, ob) not in done:\n tmp = 0\n for i in range(3):\n for j in range(3):\n na = oa + i\n nb = ob + j\n if (na, nb) in P:\n tmp += 1\n ans[tmp] += 1\n done.add((oa, ob))\n \n ans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n\n print(*ans, sep='\\n')",
"main"
] | def main():
import sys
# readline = sys.stdin.readline
readlines = sys.stdin.readlines
H, W, N = map(int, input().split())
grid = {}
P = set()
for s in readlines():
a, b = map(int, s.split())
a -= 1; b -= 1
if a in grid:
grid[a].add(b)
else:
grid[a] = set([b])
P.add((a, b))
ans = [0] * 10
done = set()
for a, b in P:
for oa in range(a - 2, a + 1):
for ob in range(b - 2, b + 1):
if 0 <= oa <= H - 3 and 0 <= ob <= W - 3 and (oa, ob) not in done:
tmp = 0
for i in range(3):
for j in range(3):
na = oa + i
nb = ob + j
if (na, nb) in P:
tmp += 1
ans[tmp] += 1
done.add((oa, ob))
ans[0] = (H - 2) * (W - 2) - sum(ans[1:])
print(*ans, sep='\n')
if __name__ == "__main__":
main()
|
[
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,
15,
0,
13,
4,
13,
13,
28,
13,
13,
0,
13,
2,
18,
13,
17,
17,
0,
13,
2,
18,
13,
17,
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,
0,
13,
2,
2,
4,
13,
2,
13,
13,
17,
4,
13,
2,
13,
13,
0,
18,
13,
13,
17,
15,
13,
0,
13,
4,
13,
4,
18,
13,
13,
0,
13,
4,
18,
13,
13,
13,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
18,
13,
17,
18,
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,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13
] | [
[
192,
4
],
[
189,
11
],
[
193,
18
],
[
189,
20
],
[
189,
21
],
[
25,
24
],
[
190,
27
],
[
193,
37
],
[
180,
40
],
[
201,
44
],
[
50,
49
],
[
181,
49
],
[
210,
52
],
[
49,
55
],
[
195,
59
],
[
49,
62
],
[
67,
66
],
[
73,
72
],
[
196,
83
],
[
66,
84
],
[
184,
86
],
[
211,
92
],
[
72,
93
],
[
178,
95
],
[
204,
98
],
[
196,
104
],
[
66,
105
],
[
211,
110
],
[
72,
111
],
[
116,
113
],
[
202,
114
],
[
205,
115
],
[
207,
120
],
[
202,
125
],
[
186,
128
],
[
208,
133
],
[
198,
135
],
[
142,
141
],
[
187,
144
],
[
152,
147
],
[
199,
148
],
[
141,
150
],
[
141,
153
],
[
159,
156
],
[
199,
157
],
[
178,
162
],
[
184,
165
],
[
199,
169
],
[
172,
171
],
[
199,
171
],
[
171,
175
],
[
189,
178
],
[
180,
181
],
[
189,
184
],
[
186,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
],
[
201,
202
],
[
204,
205
],
[
207,
208
],
[
210,
211
]
] | [
"import sys\ninput=sys.stdin.readline\nh,w,n = map(int, input().split())\nl=[list(map(int,input().split())) for i in range(n)]\n\nfrom collections import defaultdict\nd = defaultdict(int)\nfor tmp in l:\n y=tmp[0]-1\n x=tmp[1]-1\n for i in [-1,0,1]:\n for j in [-1,0,1]:\n if 1<=x+i<w-1 and 1<=y+j <h-1:\n s = str(x+i) + \"_\" + str(y+j)\n d[s]+=1\n\nimport collections\nlis = list(d.values())\nc = collections.Counter(lis)\n\nans=[0]*10\nfor itm in c.items():\n ans[itm[0]]=itm[1]\n\nans[0]=(h-2)*(w-2)-sum(ans)\n\nfor a in ans:\n print(a)",
"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",
"l=[list(map(int,input().split())) for i in range(n)]",
"l",
"[list(map(int,input().split())) for i in range(n)]",
"from collections import defaultdict",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"for tmp in l:\n y=tmp[0]-1\n x=tmp[1]-1\n for i in [-1,0,1]:\n for j in [-1,0,1]:\n if 1<=x+i<w-1 and 1<=y+j <h-1:\n s = str(x+i) + \"_\" + str(y+j)\n d[s]+=1",
"tmp",
"l",
"y=tmp[0]-1",
"y",
"tmp[0]-1",
"tmp[0]",
"tmp",
"0",
"1",
"x=tmp[1]-1",
"x",
"tmp[1]-1",
"tmp[1]",
"tmp",
"1",
"1",
"for i in [-1,0,1]:\n for j in [-1,0,1]:\n if 1<=x+i<w-1 and 1<=y+j <h-1:\n s = str(x+i) + \"_\" + str(y+j)\n d[s]+=1",
"i",
"[-1,0,1]",
"-1",
"0",
"1",
"for j in [-1,0,1]:\n if 1<=x+i<w-1 and 1<=y+j <h-1:\n s = str(x+i) + \"_\" + str(y+j)\n d[s]+=1",
"j",
"[-1,0,1]",
"-1",
"0",
"1",
"if 1<=x+i<w-1 and 1<=y+j <h-1:\n s = str(x+i) + \"_\" + str(y+j)\n d[s]+=1",
"1<=x+i<w-1 and 1<=y+j <h-1",
"1<=x+i<w-1",
"1<=x+i",
"1",
"x+i",
"x",
"i",
"w-1",
"w",
"1",
"1<=y+j <h-1",
"1<=y+j",
"1",
"y+j",
"y",
"j",
"h-1",
"h",
"1",
"s = str(x+i) + \"_\" + str(y+j)",
"s",
"str(x+i) + \"_\" + str(y+j)",
"str(x+i) + \"_\"",
"str(x+i)",
"str",
"x+i",
"x",
"i",
"\"_\"",
"str(y+j)",
"str",
"y+j",
"y",
"j",
"d[s]+=1",
"d[s]",
"d",
"s",
"1",
"import collections",
"collections",
"lis = list(d.values())",
"lis",
"list(d.values())",
"list",
"d.values()",
"d.values",
"d",
"values",
"c = collections.Counter(lis)",
"c",
"collections.Counter(lis)",
"collections.Counter",
"collections",
"Counter",
"lis",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for itm in c.items():\n ans[itm[0]]=itm[1]",
"itm",
"c.items()",
"c.items",
"c",
"items",
"ans[itm[0]]=itm[1]",
"ans[itm[0]]",
"ans",
"itm[0]",
"itm",
"0",
"itm[1]",
"itm",
"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",
"h,w,n = map(int, input().split())",
"map(int, input().split())",
"h",
"l=[list(map(int,input().split())) for i in range(n)]",
"[list(map(int,input().split())) for i in range(n)]",
"l",
"w,n = map(int, input().split())",
"map(int, input().split())",
"w",
"c = collections.Counter(lis)",
"collections.Counter(lis)",
"c",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"input=sys.stdin.readline",
"sys.stdin.readline",
"input",
"x=tmp[1]-1",
"tmp[1]-1",
"x",
"ans=[0]*10",
"[0]*10",
"ans",
"d = defaultdict(int)",
"defaultdict(int)",
"d",
"s = str(x+i) + \"_\" + str(y+j)",
"str(x+i) + \"_\" + str(y+j)",
"s",
"lis = list(d.values())",
"list(d.values())",
"lis",
"y=tmp[0]-1",
"tmp[0]-1",
"y"
] | import sys
input=sys.stdin.readline
h,w,n = map(int, input().split())
l=[list(map(int,input().split())) for i in range(n)]
from collections import defaultdict
d = defaultdict(int)
for tmp in l:
y=tmp[0]-1
x=tmp[1]-1
for i in [-1,0,1]:
for j in [-1,0,1]:
if 1<=x+i<w-1 and 1<=y+j <h-1:
s = str(x+i) + "_" + str(y+j)
d[s]+=1
import collections
lis = list(d.values())
c = collections.Counter(lis)
ans=[0]*10
for itm in c.items():
ans[itm[0]]=itm[1]
ans[0]=(h-2)*(w-2)-sum(ans)
for a in ans:
print(a) |
[
7,
15,
13,
15,
0,
13,
4,
13,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
0,
13,
4,
13,
13,
13,
12,
13,
0,
13,
4,
13,
13,
28,
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,
18,
13,
39,
13,
13,
17,
0,
13,
4,
13,
4,
18,
13,
13,
0,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
13,
13,
27,
13,
28,
13,
4,
13,
17,
17,
14,
2,
13,
13,
27,
18,
13,
13,
27,
17,
14,
2,
13,
17,
0,
13,
4,
13,
4,
13,
31,
13,
0,
13,
17,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
172,
5
],
[
172,
18
],
[
172,
19
],
[
166,
21
],
[
163,
35
],
[
167,
38
],
[
167,
39
],
[
44,
43
],
[
53,
52
],
[
59,
58
],
[
65,
64
],
[
52,
67
],
[
70,
69
],
[
58,
72
],
[
64,
78
],
[
155,
80
],
[
69,
85
],
[
173,
87
],
[
95,
90
],
[
43,
91
],
[
98,
97
],
[
43,
102
],
[
106,
105
],
[
155,
109
],
[
173,
112
],
[
97,
118
],
[
105,
121
],
[
124,
123
],
[
123,
130
],
[
97,
131
],
[
97,
134
],
[
123,
135
],
[
169,
143
],
[
158,
145
],
[
170,
149
],
[
152,
151
],
[
172,
155
],
[
172,
161
],
[
163,
164
],
[
166,
167
],
[
169,
170
],
[
172,
173
]
] | [
"import sys\nfrom collections import defaultdict, Counter\n\nh, w, n = map(int, sys.stdin.readline().split())\nab = map(int, sys.stdin.read().split())\nab = zip(ab, ab)\n\ndef main():\n c = defaultdict(int)\n for a, b in ab:\n for da in range(-2, 1):\n for db in range(-2, 1):\n # 今見ているマスを含むrectangularの左上\n i = a + da\n j = b + db\n if 1 <= i <= h - 2 and 1 <= j <= w - 2:\n c[(i, j)] += 1\n \n res = Counter(c.values())\n cnt_0 = (h - 2) * (w - 2) - sum(res.values())\n yield cnt_0\n for i in range(1, 10):\n if i in res:\n yield res[i]\n else:\n yield 0\n\nif __name__ == '__main__':\n ans = main()\n print(*ans, sep='\\n')",
"import sys",
"sys",
"from collections import defaultdict, Counter",
"h, w, n = map(int, sys.stdin.readline().split())",
"h",
"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",
"ab = map(int, sys.stdin.read().split())",
"ab",
"map(int, sys.stdin.read().split())",
"map",
"int",
"sys.stdin.read().split()",
"sys.stdin.read().split",
"sys.stdin.read()",
"sys.stdin.read",
"sys.stdin",
"sys",
"stdin",
"read",
"split",
"ab = zip(ab, ab)",
"ab",
"zip(ab, ab)",
"zip",
"ab",
"ab",
"def main():\n c = defaultdict(int)\n for a, b in ab:\n for da in range(-2, 1):\n for db in range(-2, 1):\n # 今見ているマスを含むrectangularの左上\n i = a + da\n j = b + db\n if 1 <= i <= h - 2 and 1 <= j <= w - 2:\n c[(i, j)] += 1\n \n res = Counter(c.values())\n cnt_0 = (h - 2) * (w - 2) - sum(res.values())\n yield cnt_0\n for i in range(1, 10):\n if i in res:\n yield res[i]\n else:\n yield 0",
"main",
"c = defaultdict(int)",
"c",
"defaultdict(int)",
"defaultdict",
"int",
"for a, b in ab:\n for da in range(-2, 1):\n for db in range(-2, 1):\n # 今見ているマスを含むrectangularの左上\n i = a + da\n j = b + db\n if 1 <= i <= h - 2 and 1 <= j <= w - 2:\n c[(i, j)] += 1\n \n ",
"a",
"b",
"ab",
"for da in range(-2, 1):\n for db in range(-2, 1):\n # 今見ているマスを含むrectangularの左上\n i = a + da\n j = b + db\n if 1 <= i <= h - 2 and 1 <= j <= w - 2:\n c[(i, j)] += 1\n \n ",
"da",
"range(-2, 1)",
"range",
"-2",
"1",
"for db in range(-2, 1):\n # 今見ているマスを含むrectangularの左上\n i = a + da\n j = b + db\n if 1 <= i <= h - 2 and 1 <= j <= w - 2:\n c[(i, j)] += 1\n \n ",
"db",
"range(-2, 1)",
"range",
"-2",
"1",
"i = a + da",
"i",
"a + da",
"a",
"da",
"j = b + db",
"j",
"b + db",
"b",
"db",
"if 1 <= i <= h - 2 and 1 <= j <= w - 2:\n c[(i, j)] += 1\n \n ",
"1 <= i <= h - 2 and 1 <= j <= w - 2",
"1 <= i <= h - 2",
"1 <= i",
"1",
"i",
"h - 2",
"h",
"2",
"1 <= j <= w - 2",
"1 <= j",
"1",
"j",
"w - 2",
"w",
"2",
"c[(i, j)] += 1",
"c[(i, j)]",
"c",
"(i, j)",
"i",
"j",
"1",
"res = Counter(c.values())",
"res",
"Counter(c.values())",
"Counter",
"c.values()",
"c.values",
"c",
"values",
"cnt_0 = (h - 2) * (w - 2) - sum(res.values())",
"cnt_0",
"(h - 2) * (w - 2) - sum(res.values())",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"sum(res.values())",
"sum",
"res.values()",
"res.values",
"res",
"values",
"yield cnt_0",
"cnt_0",
"for i in range(1, 10):\n if i in res:\n yield res[i]\n else:\n yield 0",
"i",
"range(1, 10)",
"range",
"1",
"10",
"if i in res:\n yield res[i]\n else:\n yield 0",
"i in res",
"i",
"res",
"yield res[i]",
"res[i]",
"res",
"i",
"yield 0",
"0",
"if __name__ == '__main__':\n ans = main()\n print(*ans, sep='\\n')",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"ans = main()",
"ans",
"main()",
"main",
"print(*ans, sep='\\n')",
"print",
"*ans",
"ans",
"sep='\\n'",
"sep",
"'\\n'",
"h, w, n = map(int, sys.stdin.readline().split())",
"map(int, sys.stdin.readline().split())",
"h",
"def main():\n c = defaultdict(int)\n for a, b in ab:\n for da in range(-2, 1):\n for db in range(-2, 1):\n # 今見ているマスを含むrectangularの左上\n i = a + da\n j = b + db\n if 1 <= i <= h - 2 and 1 <= j <= w - 2:\n c[(i, j)] += 1\n \n res = Counter(c.values())\n cnt_0 = (h - 2) * (w - 2) - sum(res.values())\n yield cnt_0\n for i in range(1, 10):\n if i in res:\n yield res[i]\n else:\n yield 0",
"def main():\n c = defaultdict(int)\n for a, b in ab:\n for da in range(-2, 1):\n for db in range(-2, 1):\n # 今見ているマスを含むrectangularの左上\n i = a + da\n j = b + db\n if 1 <= i <= h - 2 and 1 <= j <= w - 2:\n c[(i, j)] += 1\n \n res = Counter(c.values())\n cnt_0 = (h - 2) * (w - 2) - sum(res.values())\n yield cnt_0\n for i in range(1, 10):\n if i in res:\n yield res[i]\n else:\n yield 0",
"main",
"n = map(int, sys.stdin.readline().split())",
"map(int, sys.stdin.readline().split())",
"n",
"ab = zip(ab, ab)",
"zip(ab, ab)",
"ab",
"ab = map(int, sys.stdin.read().split())",
"map(int, sys.stdin.read().split())",
"ab",
"ans = main()",
"main()",
"ans",
"w, n = map(int, sys.stdin.readline().split())",
"map(int, sys.stdin.readline().split())",
"w"
] | import sys
from collections import defaultdict, Counter
h, w, n = map(int, sys.stdin.readline().split())
ab = map(int, sys.stdin.read().split())
ab = zip(ab, ab)
def main():
c = defaultdict(int)
for a, b in ab:
for da in range(-2, 1):
for db in range(-2, 1):
# 今見ているマスを含むrectangularの左上
i = a + da
j = b + db
if 1 <= i <= h - 2 and 1 <= j <= w - 2:
c[(i, j)] += 1
res = Counter(c.values())
cnt_0 = (h - 2) * (w - 2) - sum(res.values())
yield cnt_0
for i in range(1, 10):
if i in res:
yield res[i]
else:
yield 0
if __name__ == '__main__':
ans = main()
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,
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,
40,
13,
17,
14,
40,
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,
40,
13,
13,
14,
2,
39,
2,
13,
17,
2,
13,
17,
13,
0,
13,
17,
14,
40,
13,
17,
14,
2,
39,
13,
2,
13,
17,
13,
0,
13,
17,
14,
2,
39,
13,
13,
13,
0,
13,
17,
14,
40,
13,
13,
14,
2,
39,
13,
2,
13,
17,
13,
0,
13,
17,
14,
40,
13,
13,
14,
40,
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,
40,
13,
13,
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,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13
] | [
[
529,
4
],
[
517,
11
],
[
530,
18
],
[
517,
20
],
[
517,
21
],
[
493,
23
],
[
30,
29
],
[
523,
37
],
[
43,
40
],
[
524,
41
],
[
491,
45
],
[
518,
48
],
[
54,
53
],
[
195,
57
],
[
197,
61
],
[
195,
67
],
[
197,
70
],
[
494,
72
],
[
75,
74
],
[
195,
80
],
[
494,
83
],
[
86,
85
],
[
197,
89
],
[
518,
90
],
[
195,
95
],
[
197,
98
],
[
494,
100
],
[
103,
102
],
[
197,
106
],
[
197,
113
],
[
494,
115
],
[
118,
117
],
[
494,
124
],
[
127,
126
],
[
197,
130
],
[
518,
131
],
[
197,
137
],
[
494,
139
],
[
142,
141
],
[
195,
145
],
[
491,
146
],
[
197,
149
],
[
195,
155
],
[
197,
158
],
[
494,
160
],
[
163,
162
],
[
195,
168
],
[
494,
171
],
[
174,
173
],
[
197,
177
],
[
518,
178
],
[
195,
183
],
[
197,
186
],
[
494,
188
],
[
191,
190
],
[
190,
193
],
[
173,
193
],
[
162,
193
],
[
141,
193
],
[
126,
193
],
[
117,
193
],
[
102,
193
],
[
85,
193
],
[
74,
193
],
[
53,
193
],
[
524,
193
],
[
195,
195
],
[
197,
197
],
[
200,
199
],
[
509,
203
],
[
535,
205
],
[
530,
212
],
[
535,
214
],
[
536,
217
],
[
512,
221
],
[
487,
224
],
[
503,
226
],
[
536,
228
],
[
512,
231
],
[
237,
234
],
[
524,
235
],
[
488,
236
],
[
527,
236
],
[
506,
236
],
[
515,
236
],
[
500,
236
],
[
485,
236
],
[
521,
236
],
[
533,
236
],
[
497,
236
],
[
244,
239
],
[
524,
240
],
[
488,
242
],
[
527,
242
],
[
506,
242
],
[
515,
242
],
[
500,
242
],
[
485,
242
],
[
521,
242
],
[
533,
242
],
[
497,
242
],
[
518,
248
],
[
512,
249
],
[
496,
252
],
[
503,
254
],
[
536,
256
],
[
512,
258
],
[
263,
260
],
[
524,
261
],
[
497,
262
],
[
488,
262
],
[
527,
262
],
[
506,
262
],
[
515,
262
],
[
500,
262
],
[
485,
262
],
[
521,
262
],
[
533,
262
],
[
270,
265
],
[
524,
266
],
[
497,
268
],
[
488,
268
],
[
527,
268
],
[
506,
268
],
[
515,
268
],
[
500,
268
],
[
485,
268
],
[
521,
268
],
[
533,
268
],
[
518,
274
],
[
512,
276
],
[
532,
278
],
[
503,
280
],
[
536,
282
],
[
512,
285
],
[
291,
288
],
[
524,
289
],
[
533,
290
],
[
497,
290
],
[
488,
290
],
[
527,
290
],
[
506,
290
],
[
515,
290
],
[
500,
290
],
[
485,
290
],
[
521,
290
],
[
298,
293
],
[
524,
294
],
[
533,
296
],
[
497,
296
],
[
488,
296
],
[
527,
296
],
[
506,
296
],
[
515,
296
],
[
500,
296
],
[
485,
296
],
[
521,
296
],
[
491,
302
],
[
536,
303
],
[
512,
307
],
[
520,
310
],
[
503,
312
],
[
536,
313
],
[
512,
315
],
[
321,
318
],
[
524,
319
],
[
521,
320
],
[
533,
320
],
[
497,
320
],
[
488,
320
],
[
527,
320
],
[
506,
320
],
[
515,
320
],
[
500,
320
],
[
485,
320
],
[
328,
323
],
[
524,
324
],
[
521,
326
],
[
533,
326
],
[
497,
326
],
[
488,
326
],
[
527,
326
],
[
506,
326
],
[
515,
326
],
[
500,
326
],
[
485,
326
],
[
518,
332
],
[
512,
333
],
[
484,
336
],
[
503,
338
],
[
536,
339
],
[
512,
340
],
[
345,
342
],
[
524,
343
],
[
485,
344
],
[
521,
344
],
[
533,
344
],
[
497,
344
],
[
488,
344
],
[
527,
344
],
[
506,
344
],
[
515,
344
],
[
500,
344
],
[
352,
347
],
[
524,
348
],
[
485,
350
],
[
521,
350
],
[
533,
350
],
[
497,
350
],
[
488,
350
],
[
527,
350
],
[
506,
350
],
[
515,
350
],
[
500,
350
],
[
518,
356
],
[
512,
358
],
[
499,
360
],
[
503,
362
],
[
536,
363
],
[
512,
365
],
[
371,
368
],
[
524,
369
],
[
500,
370
],
[
485,
370
],
[
521,
370
],
[
533,
370
],
[
497,
370
],
[
488,
370
],
[
527,
370
],
[
506,
370
],
[
515,
370
],
[
378,
373
],
[
524,
374
],
[
500,
376
],
[
485,
376
],
[
521,
376
],
[
533,
376
],
[
497,
376
],
[
488,
376
],
[
527,
376
],
[
506,
376
],
[
515,
376
],
[
491,
382
],
[
536,
384
],
[
512,
387
],
[
514,
390
],
[
503,
392
],
[
536,
394
],
[
512,
397
],
[
403,
400
],
[
524,
401
],
[
515,
402
],
[
500,
402
],
[
485,
402
],
[
521,
402
],
[
533,
402
],
[
497,
402
],
[
488,
402
],
[
527,
402
],
[
506,
402
],
[
410,
405
],
[
524,
406
],
[
515,
408
],
[
500,
408
],
[
485,
408
],
[
521,
408
],
[
533,
408
],
[
497,
408
],
[
488,
408
],
[
527,
408
],
[
506,
408
],
[
518,
414
],
[
512,
415
],
[
505,
418
],
[
503,
420
],
[
536,
422
],
[
512,
424
],
[
429,
426
],
[
524,
427
],
[
506,
428
],
[
515,
428
],
[
500,
428
],
[
485,
428
],
[
521,
428
],
[
533,
428
],
[
497,
428
],
[
488,
428
],
[
527,
428
],
[
436,
431
],
[
524,
432
],
[
506,
434
],
[
515,
434
],
[
500,
434
],
[
485,
434
],
[
521,
434
],
[
533,
434
],
[
497,
434
],
[
488,
434
],
[
527,
434
],
[
518,
440
],
[
512,
442
],
[
526,
444
],
[
503,
446
],
[
536,
448
],
[
512,
451
],
[
457,
454
],
[
524,
455
],
[
527,
456
],
[
506,
456
],
[
515,
456
],
[
500,
456
],
[
485,
456
],
[
521,
456
],
[
533,
456
],
[
497,
456
],
[
488,
456
],
[
464,
459
],
[
524,
460
],
[
527,
462
],
[
506,
462
],
[
515,
462
],
[
500,
462
],
[
485,
462
],
[
521,
462
],
[
533,
462
],
[
497,
462
],
[
488,
462
],
[
494,
467
],
[
474,
473
],
[
524,
481
],
[
473,
482
],
[
484,
485
],
[
487,
488
],
[
517,
491
],
[
493,
494
],
[
496,
497
],
[
499,
500
],
[
505,
506
],
[
517,
509
],
[
535,
512
],
[
514,
515
],
[
517,
518
],
[
520,
521
],
[
523,
524
],
[
526,
527
],
[
529,
530
],
[
532,
533
],
[
535,
536
]
] | [
"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:\n if y!=1:\n if (x-1,y-1) in point:\n ans+=1\n if (x-1,y) in point:\n ans+=1\n if y!=W:\n if (x-1,y+1) in point:\n ans+=1\n if y!=1:\n if (x,y-1) in point:\n ans+=1\n if (x,y) in point:\n ans+=1\n if y!=W:\n if (x,y+1) in point:\n ans+=1\n if x!=H:\n if y!=1:\n if (x+1,y-1) in point:\n ans+=1\n if (x+1,y) in point:\n ans+=1\n if y!=W:\n if (x+1,y+1) in point:\n ans+=1\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:\n if y!=1:\n if (x-1,y-1) in point:\n ans+=1\n if (x-1,y) in point:\n ans+=1\n if y!=W:\n if (x-1,y+1) in point:\n ans+=1\n if y!=1:\n if (x,y-1) in point:\n ans+=1\n if (x,y) in point:\n ans+=1\n if y!=W:\n if (x,y+1) in point:\n ans+=1\n if x!=H:\n if y!=1:\n if (x+1,y-1) in point:\n ans+=1\n if (x+1,y) in point:\n ans+=1\n if y!=W:\n if (x+1,y+1) in point:\n ans+=1\n return ans",
"black",
"ans=0",
"ans",
"0",
"if x!=1:\n if y!=1:\n if (x-1,y-1) in point:\n ans+=1\n if (x-1,y) in point:\n ans+=1\n if y!=W:\n if (x-1,y+1) in point:\n ans+=1\n ",
"x!=1",
"x",
"1",
"if y!=1:\n if (x-1,y-1) in point:\n ans+=1\n ",
"y!=1",
"y",
"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 y!=W:\n if (x-1,y+1) in point:\n ans+=1\n ",
"y!=W",
"y",
"W",
"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 y!=1:\n if (x,y-1) in point:\n ans+=1\n ",
"y!=1",
"y",
"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 y!=W:\n if (x,y+1) in point:\n ans+=1\n ",
"y!=W",
"y",
"W",
"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!=H:\n if y!=1:\n if (x+1,y-1) in point:\n ans+=1\n if (x+1,y) in point:\n ans+=1\n if y!=W:\n if (x+1,y+1) in point:\n ans+=1\n ",
"x!=H",
"x",
"H",
"if y!=1:\n if (x+1,y-1) in point:\n ans+=1\n ",
"y!=1",
"y",
"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 y!=W:\n if (x+1,y+1) in point:\n ans+=1\n ",
"y!=W",
"y",
"W",
"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",
"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,b)",
"black(a,b)",
"ss",
"ss=black(a-1,b-1)",
"black(a-1,b-1)",
"ss",
"H,W,N=map(int,input().split())",
"map(int,input().split())",
"H",
"point=set([])",
"set([])",
"point",
"ss=black(a-1,b)",
"black(a-1,b)",
"ss",
"ss=black(a,b+1)",
"black(a,b+1)",
"ss",
"def black(x,y):\n ans=0\n if x!=1:\n if y!=1:\n if (x-1,y-1) in point:\n ans+=1\n if (x-1,y) in point:\n ans+=1\n if y!=W:\n if (x-1,y+1) in point:\n ans+=1\n if y!=1:\n if (x,y-1) in point:\n ans+=1\n if (x,y) in point:\n ans+=1\n if y!=W:\n if (x,y+1) in point:\n ans+=1\n if x!=H:\n if y!=1:\n if (x+1,y-1) in point:\n ans+=1\n if (x+1,y) in point:\n ans+=1\n if y!=W:\n if (x+1,y+1) in point:\n ans+=1\n return ans",
"def black(x,y):\n ans=0\n if x!=1:\n if y!=1:\n if (x-1,y-1) in point:\n ans+=1\n if (x-1,y) in point:\n ans+=1\n if y!=W:\n if (x-1,y+1) in point:\n ans+=1\n if y!=1:\n if (x,y-1) in point:\n ans+=1\n if (x,y) in point:\n ans+=1\n if y!=W:\n if (x,y+1) in point:\n ans+=1\n if x!=H:\n if y!=1:\n if (x+1,y-1) in point:\n ans+=1\n if (x+1,y) in point:\n ans+=1\n if y!=W:\n if (x+1,y+1) in point:\n ans+=1\n return ans",
"black",
"ss=black(a+1,b)",
"black(a+1,b)",
"ss",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"ss=black(a+1,b-1)",
"black(a+1,b-1)",
"ss",
"W,N=map(int,input().split())",
"map(int,input().split())",
"W",
"ss=black(a,b-1)",
"black(a,b-1)",
"ss",
"ans=[0 for i in range(0,10)]",
"[0 for i in range(0,10)]",
"ans",
"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+1)",
"black(a-1,b+1)",
"ss",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a"
] | 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:
if y!=1:
if (x-1,y-1) in point:
ans+=1
if (x-1,y) in point:
ans+=1
if y!=W:
if (x-1,y+1) in point:
ans+=1
if y!=1:
if (x,y-1) in point:
ans+=1
if (x,y) in point:
ans+=1
if y!=W:
if (x,y+1) in point:
ans+=1
if x!=H:
if y!=1:
if (x+1,y-1) in point:
ans+=1
if (x+1,y) in point:
ans+=1
if y!=W:
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,
18,
4,
13,
13,
17,
13,
13,
0,
13,
4,
13,
13,
13,
4,
13,
13,
13,
4,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
17,
4,
4,
13,
13,
4,
18,
13,
13,
13,
15,
13,
15,
0,
13,
4,
13,
13,
28,
13,
13,
13,
28,
13,
13,
4,
18,
13,
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,
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,
2,
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
] | [
[
173,
2
],
[
173,
9
],
[
173,
10
],
[
146,
12
],
[
171,
15
],
[
164,
16
],
[
174,
19
],
[
158,
20
],
[
156,
23
],
[
167,
25
],
[
29,
28
],
[
159,
31
],
[
156,
31
],
[
35,
34
],
[
34,
44
],
[
168,
47
],
[
176,
54
],
[
75,
74
],
[
152,
77
],
[
161,
82
],
[
153,
91
],
[
147,
93
],
[
171,
93
],
[
162,
98
],
[
165,
100
],
[
174,
100
],
[
108,
103
],
[
177,
104
],
[
149,
110
],
[
177,
115
],
[
121,
118
],
[
150,
119
],
[
147,
124
],
[
171,
124
],
[
165,
127
],
[
174,
127
],
[
150,
133
],
[
137,
136
],
[
150,
143
],
[
136,
144
],
[
146,
147
],
[
149,
150
],
[
152,
153
],
[
173,
156
],
[
158,
159
],
[
161,
162
],
[
164,
165
],
[
167,
168
],
[
173,
171
],
[
173,
174
],
[
176,
177
]
] | [
"H, W, N = input().split(\" \")\nH, W, N = int(H), int(W), int(N)\nA = []\nfor i in range(N):\n A.append([int(j) for j in input().split(\" \")])\n\n\nimport itertools\nfrom collections import defaultdict, Counter\n\nc = defaultdict(int)\nfor a, b in A:\n # そのセルを含む正方形の中心を記録\n for dx,dy in itertools.product([-1,0,1],repeat = 2):\n aa = a + dx\n bb = b + dy\n if 2 <= aa <= H-1 and 2 <= bb <= W-1:\n c[(aa,bb)] += 1\n \nresult = Counter(c.values())\nresult[0] = (H-2)*(W-2) - sum(result.values())\n \nfor j in range(10):\n print(result[j])",
"H, W, N = input().split(\" \")",
"H",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"W",
"N",
"H, W, N = int(H), int(W), int(N)",
"H",
"int(H)",
"int",
"H",
"W",
"int(W)",
"int",
"W",
"N",
"int(N)",
"int",
"N",
"A = []",
"A",
"[]",
"for i in range(N):\n A.append([int(j) for j in input().split(\" \")])",
"i",
"range(N)",
"range",
"N",
"int(j) for j in input().split(\" \")",
"for j in input().split(\" \")",
"j",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"for j in input().split(\" \")",
"int(j)",
"int",
"j",
"A.append([int(j) for j in input().split(\" \")])",
"A.append",
"A",
"append",
"[int(j) for j in input().split(\" \")]",
"import itertools",
"itertools",
"from collections import defaultdict, Counter",
"c = defaultdict(int)",
"c",
"defaultdict(int)",
"defaultdict",
"int",
"for a, b in A:\n # そのセルを含む正方形の中心を記録\n for dx,dy in itertools.product([-1,0,1],repeat = 2):\n aa = a + dx\n bb = b + dy\n if 2 <= aa <= H-1 and 2 <= bb <= W-1:\n c[(aa,bb)] += 1\n ",
"a",
"b",
"A",
"for dx,dy in itertools.product([-1,0,1],repeat = 2):\n aa = a + dx\n bb = b + dy\n if 2 <= aa <= H-1 and 2 <= bb <= W-1:\n c[(aa,bb)] += 1\n ",
"dx",
"dy",
"itertools.product([-1,0,1],repeat = 2)",
"itertools.product",
"itertools",
"product",
"[-1,0,1]",
"-1",
"0",
"1",
"repeat = 2",
"repeat",
"2",
"aa = a + dx",
"aa",
"a + dx",
"a",
"dx",
"bb = b + dy",
"bb",
"b + dy",
"b",
"dy",
"if 2 <= aa <= H-1 and 2 <= bb <= W-1:\n c[(aa,bb)] += 1\n ",
"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",
"c[(aa,bb)] += 1",
"c[(aa,bb)]",
"c",
"(aa,bb)",
"aa",
"bb",
"1",
"result = Counter(c.values())",
"result",
"Counter(c.values())",
"Counter",
"c.values()",
"c.values",
"c",
"values",
"result[0] = (H-2)*(W-2) - sum(result.values())",
"result[0]",
"result",
"0",
"(H-2)*(W-2) - sum(result.values())",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(result.values())",
"sum",
"result.values()",
"result.values",
"result",
"values",
"for j in range(10):\n print(result[j])",
"j",
"range(10)",
"range",
"10",
"print(result[j])",
"print",
"result[j]",
"result",
"j",
"H, W, N = int(H), int(W), int(N)",
"int(H)",
"H",
"result = Counter(c.values())",
"Counter(c.values())",
"result",
"aa = a + dx",
"a + dx",
"aa",
"N = input().split(\" \")",
"input().split(\" \")",
"N",
"N = int(H), int(W), int(N)",
"int(N)",
"N",
"bb = b + dy",
"b + dy",
"bb",
"W, N = int(H), int(W), int(N)",
"int(W)",
"W",
"A = []",
"[]",
"A",
"H, W, N = input().split(\" \")",
"input().split(\" \")",
"H",
"W, N = input().split(\" \")",
"input().split(\" \")",
"W",
"c = defaultdict(int)",
"defaultdict(int)",
"c"
] | H, W, N = input().split(" ")
H, W, N = int(H), int(W), int(N)
A = []
for i in range(N):
A.append([int(j) for j in input().split(" ")])
import itertools
from collections import defaultdict, Counter
c = defaultdict(int)
for a, b in A:
# そのセルを含む正方形の中心を記録
for dx,dy in itertools.product([-1,0,1],repeat = 2):
aa = a + dx
bb = b + dy
if 2 <= aa <= H-1 and 2 <= bb <= W-1:
c[(aa,bb)] += 1
result = Counter(c.values())
result[0] = (H-2)*(W-2) - sum(result.values())
for j in range(10):
print(result[j]) |
[
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,
17,
13,
2,
13,
17,
2,
13,
17,
9,
28,
13,
4,
13,
17,
0,
13,
2,
13,
2,
13,
17,
14,
2,
13,
39,
17,
17,
17,
13,
2,
13,
17,
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,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
166,
4
],
[
166,
13
],
[
166,
14
],
[
169,
16
],
[
20,
19
],
[
152,
22
],
[
175,
24
],
[
175,
33
],
[
36,
35
],
[
172,
40
],
[
155,
42
],
[
35,
44
],
[
173,
48
],
[
161,
55
],
[
161,
58
],
[
63,
62
],
[
163,
67
],
[
176,
69
],
[
62,
71
],
[
164,
75
],
[
167,
82
],
[
167,
85
],
[
170,
90
],
[
173,
95
],
[
167,
97
],
[
164,
98
],
[
178,
100
],
[
170,
105
],
[
157,
107
],
[
179,
114
],
[
161,
121
],
[
167,
124
],
[
158,
130
],
[
134,
133
],
[
133,
140
],
[
158,
143
],
[
158,
148
],
[
133,
149
],
[
166,
152
],
[
175,
155
],
[
157,
158
],
[
166,
161
],
[
163,
164
],
[
166,
167
],
[
169,
170
],
[
172,
173
],
[
175,
176
],
[
178,
179
]
] | [
"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 [-1,0,1,h,h+1,h+2]:\n continue\n for j in range(3):\n y = b+(j-1)\n if y in [-1,0,1,w,w+1,w+2]:\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 [-1,0,1,h,h+1,h+2]:\n continue\n for j in range(3):\n y = b+(j-1)\n if y in [-1,0,1,w,w+1,w+2]:\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 [-1,0,1,h,h+1,h+2]:\n continue\n for j in range(3):\n y = b+(j-1)\n if y in [-1,0,1,w,w+1,w+2]:\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 [-1,0,1,h,h+1,h+2]:\n continue\n ",
"x in [-1,0,1,h,h+1,h+2]",
"x",
"[-1,0,1,h,h+1,h+2]",
"-1",
"0",
"1",
"h",
"h+1",
"h",
"1",
"h+2",
"h",
"2",
"continue",
"for j in range(3):\n y = b+(j-1)\n if y in [-1,0,1,w,w+1,w+2]:\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 [-1,0,1,w,w+1,w+2]:\n continue\n ",
"y in [-1,0,1,w,w+1,w+2]",
"y",
"[-1,0,1,w,w+1,w+2]",
"-1",
"0",
"1",
"w",
"w+1",
"w",
"1",
"w+2",
"w",
"2",
"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",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"q = cl.Counter(p.values())",
"cl.Counter(p.values())",
"q",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h",
"y = b+(j-1)",
"b+(j-1)",
"y",
"w,n = map(int,input().split())",
"map(int,input().split())",
"w",
"l = []",
"[]",
"l",
"x = a+(i-1)",
"a+(i-1)",
"x",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"p = cl.Counter(l)",
"cl.Counter(l)",
"p"
] | 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 [-1,0,1,h,h+1,h+2]:
continue
for j in range(3):
y = b+(j-1)
if y in [-1,0,1,w,w+1,w+2]:
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,
13,
0,
13,
18,
18,
13,
13,
13,
15,
13,
15,
13,
15,
13,
15,
15,
15,
15,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
17,
0,
13,
17,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
23,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
23,
13,
12,
13,
23,
13,
12,
13,
23,
13,
0,
13,
39,
12,
13,
14,
2,
4,
13,
13,
13,
14,
2,
4,
13,
13,
17,
42,
40,
4,
13,
13,
13,
29,
18,
13,
13,
23,
13,
0,
13,
39,
12,
13,
14,
2,
4,
13,
13,
13,
14,
2,
4,
13,
13,
17,
42,
40,
4,
13,
13,
13,
29,
18,
13,
13,
23,
13,
12,
13,
14,
2,
13,
13,
14,
2,
2,
13,
13,
2,
13,
17,
0,
13,
17,
0,
13,
2,
2,
13,
4,
13,
13,
13,
0,
13,
2,
2,
13,
4,
13,
13,
13,
0,
13,
2,
2,
13,
4,
13,
2,
13,
13,
13,
29,
13,
23,
13,
23,
13,
12,
13,
0,
13,
39,
0,
13,
13,
28,
13,
4,
13,
17,
2,
4,
13,
40,
2,
40,
2,
13,
17,
17,
17,
14,
2,
2,
13,
13,
17,
0,
13,
17,
42,
2,
2,
13,
13,
17,
0,
13,
17,
0,
13,
13,
4,
18,
13,
13,
39,
13,
13,
14,
40,
13,
17,
14,
2,
13,
39,
29,
13,
23,
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,
0,
13,
4,
13,
4,
18,
13,
13,
13,
41,
28,
13,
4,
13,
17,
2,
13,
17,
4,
13,
0,
13,
13,
0,
13,
39,
42,
40,
18,
13,
17,
13,
4,
18,
13,
13,
18,
13,
17,
0,
13,
18,
13,
17,
41,
28,
13,
13,
40,
2,
13,
13,
17,
4,
13,
0,
13,
13,
4,
18,
13,
13,
13,
29,
13,
23,
13,
12,
13,
42,
13,
29,
13,
23,
13,
23,
13,
12,
13,
29,
2,
2,
13,
13,
4,
13,
13,
13,
23,
13,
23,
13,
12,
13,
0,
13,
17,
42,
13,
0,
13,
2,
13,
17,
0,
13,
17,
29,
13,
23,
13,
12,
13,
14,
2,
13,
13,
29,
39,
2,
13,
13,
23,
13,
23,
13,
12,
13,
29,
4,
13,
2,
4,
13,
18,
4,
13,
13,
2,
40,
13,
17,
2,
13,
13,
23,
13,
23,
13,
12,
13,
0,
13,
17,
14,
2,
13,
13,
29,
39,
2,
13,
13,
23,
13,
23,
13,
12,
13,
0,
13,
17,
42,
40,
13,
13,
0,
13,
13,
0,
13,
17,
29,
13,
23,
13,
23,
13,
0,
13,
4,
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,
0,
13,
4,
13,
13,
28,
13,
13,
13,
28,
13,
4,
13,
17,
0,
13,
2,
13,
18,
13,
13,
13,
2,
13,
18,
13,
13,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
2,
2,
13,
13,
13,
17,
0,
13,
39,
2,
2,
13,
17,
2,
13,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
28,
13,
13,
0,
18,
13,
17,
17,
0,
18,
13,
18,
13,
13,
17,
4,
13,
31,
13,
0,
13,
17,
10,
12,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
39,
13,
10,
12,
13,
10,
18,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
2,
13,
10,
39,
13,
10,
12,
13,
10,
39,
13,
10,
12,
13,
10,
17,
13,
10,
12,
13,
10,
12,
13,
10,
39,
13,
10,
12,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
39,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] | [
[
675,
4
],
[
642,
21
],
[
657,
28
],
[
705,
33
],
[
46,
46
],
[
50,
50
],
[
54,
53
],
[
676,
66
],
[
71,
71
],
[
75,
74
],
[
676,
87
],
[
92,
92
],
[
96,
96
],
[
100,
100
],
[
714,
102
],
[
715,
110
],
[
129,
111
],
[
715,
116
],
[
715,
122
],
[
129,
123
],
[
715,
126
],
[
129,
127
],
[
129,
129
],
[
744,
131
],
[
745,
139
],
[
158,
140
],
[
745,
145
],
[
745,
151
],
[
158,
152
],
[
745,
155
],
[
158,
156
],
[
158,
158
],
[
208,
163
],
[
210,
164
],
[
208,
168
],
[
210,
169
],
[
210,
171
],
[
175,
174
],
[
178,
177
],
[
174,
180
],
[
682,
182
],
[
208,
183
],
[
643,
184
],
[
187,
186
],
[
177,
189
],
[
174,
189
],
[
733,
191
],
[
210,
192
],
[
643,
193
],
[
196,
195
],
[
186,
198
],
[
177,
198
],
[
174,
198
],
[
733,
200
],
[
208,
202
],
[
210,
203
],
[
643,
204
],
[
195,
206
],
[
186,
206
],
[
177,
206
],
[
174,
206
],
[
208,
208
],
[
210,
210
],
[
215,
214
],
[
218,
217
],
[
274,
218
],
[
221,
220
],
[
274,
231
],
[
217,
238
],
[
254,
238
],
[
220,
239
],
[
243,
242
],
[
217,
247
],
[
254,
247
],
[
220,
248
],
[
252,
251
],
[
255,
254
],
[
220,
255
],
[
214,
258
],
[
254,
265
],
[
217,
265
],
[
214,
269
],
[
214,
272
],
[
274,
274
],
[
279,
278
],
[
282,
281
],
[
319,
289
],
[
319,
295
],
[
281,
296
],
[
278,
300
],
[
281,
302
],
[
281,
305
],
[
319,
307
],
[
281,
308
],
[
278,
311
],
[
319,
314
],
[
281,
315
],
[
278,
317
],
[
319,
319
],
[
324,
323
],
[
388,
330
],
[
334,
333
],
[
388,
338
],
[
333,
341
],
[
344,
343
],
[
347,
346
],
[
343,
351
],
[
378,
351
],
[
323,
353
],
[
346,
356
],
[
343,
359
],
[
378,
359
],
[
363,
362
],
[
343,
364
],
[
378,
364
],
[
369,
368
],
[
343,
368
],
[
378,
368
],
[
368,
372
],
[
362,
373
],
[
368,
376
],
[
379,
378
],
[
346,
382
],
[
378,
384
],
[
343,
384
],
[
346,
386
],
[
388,
388
],
[
396,
394
],
[
396,
396
],
[
398,
398
],
[
411,
404
],
[
413,
405
],
[
736,
407
],
[
411,
408
],
[
413,
409
],
[
411,
411
],
[
413,
413
],
[
418,
417
],
[
423,
422
],
[
432,
424
],
[
422,
424
],
[
428,
427
],
[
427,
430
],
[
417,
430
],
[
432,
432
],
[
445,
437
],
[
447,
438
],
[
445,
442
],
[
447,
443
],
[
445,
445
],
[
447,
447
],
[
468,
459
],
[
470,
465
],
[
468,
468
],
[
470,
470
],
[
475,
474
],
[
474,
478
],
[
486,
478
],
[
488,
479
],
[
474,
483
],
[
486,
483
],
[
488,
484
],
[
486,
486
],
[
488,
488
],
[
493,
492
],
[
507,
496
],
[
499,
496
],
[
509,
497
],
[
500,
499
],
[
509,
500
],
[
503,
502
],
[
502,
505
],
[
492,
505
],
[
507,
507
],
[
509,
509
],
[
729,
511
],
[
661,
513
],
[
729,
514
],
[
729,
515
],
[
738,
517
],
[
709,
519
],
[
730,
520
],
[
699,
522
],
[
693,
534
],
[
720,
546
],
[
748,
548
],
[
556,
555
],
[
690,
560
],
[
694,
564
],
[
555,
565
],
[
723,
566
],
[
700,
570
],
[
555,
571
],
[
691,
577
],
[
685,
579
],
[
724,
584
],
[
727,
586
],
[
596,
589
],
[
721,
590
],
[
691,
593
],
[
727,
594
],
[
724,
595
],
[
669,
598
],
[
685,
602
],
[
727,
605
],
[
618,
617
],
[
721,
617
],
[
623,
620
],
[
670,
621
],
[
630,
625
],
[
670,
626
],
[
721,
628
],
[
617,
629
],
[
670,
634
],
[
637,
636
],
[
642,
643
],
[
657,
658
],
[
669,
670
],
[
675,
676
],
[
729,
685
],
[
690,
691
],
[
693,
694
],
[
699,
700
],
[
705,
706
],
[
714,
715
],
[
720,
721
],
[
723,
724
],
[
729,
727
],
[
729,
730
],
[
738,
739
],
[
744,
745
]
] | [
"# -*- coding: utf-8 -*-\n\n#############\n# Libraries #\n#############\n\nimport sys\ninput = sys.stdin.readline\n\nimport math\n#from math import gcd\nimport bisect\nimport heapq\nfrom collections import defaultdict\nfrom collections import deque\nfrom collections import Counter\nfrom functools import lru_cache\n\n#############\n# Constants #\n#############\n\nMOD = 10**9+7\nINF = float('inf')\nAZ = \"abcdefghijklmnopqrstuvwxyz\"\n\n#############\n# Functions #\n#############\n\n######INPUT######\ndef I(): return int(input().strip())\ndef S(): return input().strip()\ndef IL(): return list(map(int,input().split()))\ndef SL(): return list(map(str,input().split()))\ndef ILs(n): return list(int(input()) for _ in range(n))\ndef SLs(n): return list(input().strip() for _ in range(n))\ndef ILL(n): return [list(map(int, input().split())) for _ in range(n)]\ndef SLL(n): return [list(map(str, input().split())) for _ in range(n)]\n\n\n#####Shorten#####\ndef DD(arg): return defaultdict(arg)\n\n#####Inverse#####\ndef inv(n): return pow(n, MOD-2, MOD)\n\n######Combination######\nkaijo_memo = []\ndef kaijo(n):\n if(len(kaijo_memo) > n): return kaijo_memo[n]\n if(len(kaijo_memo) == 0): kaijo_memo.append(1)\n while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)\n return kaijo_memo[n]\n\ngyaku_kaijo_memo = []\ndef gyaku_kaijo(n):\n if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]\n if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)\n while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)\n return gyaku_kaijo_memo[n]\n\ndef nCr(n,r):\n if n == r: return 1\n if n < r or r < 0: return 0\n ret = 1\n ret = ret * kaijo(n) % MOD\n ret = ret * gyaku_kaijo(r) % MOD\n ret = ret * gyaku_kaijo(n-r) % MOD\n return ret\n\n######Factorization######\ndef factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0: \n cnt+=1 \n temp //= i\n arr.append([i, cnt])\n if temp!=1: arr.append([temp, 1])\n if arr==[]: arr.append([n, 1])\n return arr\n\n#####MakeDivisors######\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 return divisors\n\n#####MakePrimes######\ndef make_primes(N):\n max = int(math.sqrt(N))\n seachList = [i for i in range(2,N+1)]\n primeNum = []\n while seachList[0] <= max:\n primeNum.append(seachList[0])\n tmp = seachList[0]\n seachList = [i for i in seachList if i % tmp != 0]\n primeNum.extend(seachList)\n return primeNum\n\n#####GCD#####\ndef gcd(a, b):\n while b: a, b = b, a % b\n return a\n\n#####LCM#####\ndef lcm(a, b):\n return a * b // gcd (a, b)\n\n#####BitCount#####\ndef count_bit(n):\n count = 0\n while n:\n n &= n-1\n count += 1\n return count\n\n#####ChangeBase#####\ndef base_10_to_n(X, n):\n if X//n: return base_10_to_n(X//n, n)+[X%n]\n return [X%n]\n\ndef base_n_to_10(X, n):\n return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))\n\ndef base_10_to_n_without_0(X, n):\n X -= 1\n if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]\n return [X%n]\n\n#####IntLog#####\ndef int_log(n, a):\n count = 0\n while n>=a:\n n //= a\n count += 1\n return count\n\n#############\n# Main Code #\n#############\nH,W,N = IL()\ndata = ILL(N)\n\ndx = [1,1,1,0,0,0,-1,-1,-1]\ndy = [1,0,-1,1,0,-1,1,0,-1]\n\ndic = DD(int)\nfor y,x in data:\n for i in range(9):\n ny,nx = y+dy[i], x+dx[i]\n if 2<=ny<=H-1 and 2<=nx<=W-1:\n dic[ny*W+nx] += 1\n \nans = [(H-2)*(W-2),0,0,0,0,0,0,0,0,0]\nfor k in dic:\n ans[0] -= 1\n ans[dic[k]] += 1\n\nprint(*ans,sep=\"\\n\")",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"import math",
"math",
"import bisect",
"bisect",
"import heapq",
"heapq",
"from collections import defaultdict",
"from collections import deque",
"from collections import Counter",
"from functools import lru_cache",
"MOD = 10**9+7",
"MOD",
"10**9+7",
"10**9",
"10",
"9",
"7",
"INF = float('inf')",
"INF",
"float('inf')",
"float",
"'inf'",
"AZ = \"abcdefghijklmnopqrstuvwxyz\"",
"AZ",
"\"abcdefghijklmnopqrstuvwxyz\"",
"def I(): return int(input().strip())",
"I",
"def S(): return input().strip()",
"S",
"def IL(): return list(map(int,input().split()))",
"IL",
"def SL(): return list(map(str,input().split()))",
"SL",
"def ILs(n): return list(int(input()) for _ in range(n))",
"ILs",
"n",
"n",
"def SLs(n): return list(input().strip() for _ in range(n))",
"SLs",
"n",
"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",
"def ILL(n): return [list(map(int, input().split())) for _ in range(n)]",
"ILL",
"n",
"n",
"list(map(str, input().split())) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"list(map(str, input().split()))",
"list",
"map(str, input().split())",
"map",
"str",
"input().split()",
"().split",
"()",
"input",
"split",
"def SLL(n): return [list(map(str, input().split())) for _ in range(n)]\n\n\n#####Shorten#####",
"SLL",
"n",
"n",
"def DD(arg): return defaultdict(arg)\n\n#####Inverse#####",
"DD",
"arg",
"arg",
"def inv(n): return pow(n, MOD-2, MOD)\n\n######Combination######",
"inv",
"n",
"n",
"kaijo_memo = []",
"kaijo_memo",
"[]",
"def kaijo(n):\n if(len(kaijo_memo) > n): return kaijo_memo[n]\n if(len(kaijo_memo) == 0): kaijo_memo.append(1)\n while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)\n return kaijo_memo[n]",
"kaijo",
"if(len(kaijo_memo) > n): return kaijo_memo[n]\n ",
"len(kaijo_memo) > n",
"len(kaijo_memo)",
"len",
"kaijo_memo",
"n",
"if(len(kaijo_memo) == 0): kaijo_memo.append(1)\n ",
"len(kaijo_memo) == 0",
"len(kaijo_memo)",
"len",
"kaijo_memo",
"0",
"while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)\n ",
"len(kaijo_memo) <= n",
"len(kaijo_memo)",
"len",
"kaijo_memo",
"n",
"return kaijo_memo[n]",
"kaijo_memo[n]",
"kaijo_memo",
"n",
"n",
"n",
"gyaku_kaijo_memo = []",
"gyaku_kaijo_memo",
"[]",
"def gyaku_kaijo(n):\n if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]\n if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)\n while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)\n return gyaku_kaijo_memo[n]",
"gyaku_kaijo",
"if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]\n ",
"len(gyaku_kaijo_memo) > n",
"len(gyaku_kaijo_memo)",
"len",
"gyaku_kaijo_memo",
"n",
"if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)\n ",
"len(gyaku_kaijo_memo) == 0",
"len(gyaku_kaijo_memo)",
"len",
"gyaku_kaijo_memo",
"0",
"while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)\n ",
"len(gyaku_kaijo_memo) <= n",
"len(gyaku_kaijo_memo)",
"len",
"gyaku_kaijo_memo",
"n",
"return gyaku_kaijo_memo[n]",
"gyaku_kaijo_memo[n]",
"gyaku_kaijo_memo",
"n",
"n",
"n",
"def nCr(n,r):\n if n == r: return 1\n if n < r or r < 0: return 0\n ret = 1\n ret = ret * kaijo(n) % MOD\n ret = ret * gyaku_kaijo(r) % MOD\n ret = ret * gyaku_kaijo(n-r) % MOD\n return ret\n\n######Factorization######",
"nCr",
"if n == r: return 1\n ",
"n == r",
"n",
"r",
"if n < r or r < 0: return 0\n ",
"n < r or r < 0",
"n < r",
"n",
"r",
"r < 0",
"r",
"0",
"ret = 1",
"ret",
"1",
"ret = ret * kaijo(n) % MOD",
"ret",
"ret * kaijo(n) % MOD",
"ret * kaijo(n)",
"ret",
"kaijo(n)",
"kaijo",
"n",
"MOD",
"ret = ret * gyaku_kaijo(r) % MOD",
"ret",
"ret * gyaku_kaijo(r) % MOD",
"ret * gyaku_kaijo(r)",
"ret",
"gyaku_kaijo(r)",
"gyaku_kaijo",
"r",
"MOD",
"ret = ret * gyaku_kaijo(n-r) % MOD",
"ret",
"ret * gyaku_kaijo(n-r) % MOD",
"ret * gyaku_kaijo(n-r)",
"ret",
"gyaku_kaijo(n-r)",
"gyaku_kaijo",
"n-r",
"n",
"r",
"MOD",
"return ret",
"ret",
"n",
"n",
"r",
"r",
"def factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0: \n cnt+=1 \n temp //= i\n arr.append([i, cnt])\n if temp!=1: arr.append([temp, 1])\n if arr==[]: arr.append([n, 1])\n return arr\n\n#####MakeDivisors######",
"factorization",
"arr = []",
"arr",
"[]",
"temp = n",
"temp",
"n",
"for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0: \n cnt+=1 \n temp //= i\n arr.append([i, cnt])\n ",
"i",
"range(2, int(-(-n**0.5//1))+1)",
"range",
"2",
"int(-(-n**0.5//1))+1",
"int(-(-n**0.5//1))",
"int",
"-(-n**0.5//1)",
"-n**0.5//1",
"-n**0.5",
"n**0.5",
"n",
"0.5",
"1",
"1",
"if temp%i==0:\n cnt=0\n while temp%i==0: \n cnt+=1 \n temp //= i\n arr.append([i, cnt])\n ",
"temp%i==0",
"temp%i",
"temp",
"i",
"0",
"cnt=0",
"cnt",
"0",
"while temp%i==0: \n cnt+=1 \n temp //= i\n ",
"temp%i==0",
"temp%i",
"temp",
"i",
"0",
"cnt+=1",
"cnt",
"1",
"temp //= i",
"temp",
"i",
"arr.append([i, cnt])",
"arr.append",
"arr",
"append",
"[i, cnt]",
"i",
"cnt",
"if temp!=1: arr.append([temp, 1])\n ",
"temp!=1",
"temp",
"1",
"if arr==[]: arr.append([n, 1])\n ",
"arr==[]",
"arr",
"[]",
"return arr",
"arr",
"n",
"n",
"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 return divisors\n\n#####MakePrimes######",
"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 ",
"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 % 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 ",
"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 make_primes(N):\n max = int(math.sqrt(N))\n seachList = [i for i in range(2,N+1)]\n primeNum = []\n while seachList[0] <= max:\n primeNum.append(seachList[0])\n tmp = seachList[0]\n seachList = [i for i in seachList if i % tmp != 0]\n primeNum.extend(seachList)\n return primeNum\n\n#####GCD#####",
"make_primes",
"max = int(math.sqrt(N))",
"max",
"int(math.sqrt(N))",
"int",
"math.sqrt(N)",
"math.sqrt",
"math",
"sqrt",
"N",
"i for i in range(2,N+1)",
"for i in range(2,N+1)",
"i",
"range(2,N+1)",
"range",
"2",
"N+1",
"N",
"1",
"for i in range(2,N+1)",
"i",
"seachList = [i for i in range(2,N+1)]",
"seachList",
"[i for i in range(2,N+1)]",
"primeNum = []",
"primeNum",
"[]",
"while seachList[0] <= max:\n primeNum.append(seachList[0])\n tmp = seachList[0]\n seachList = [i for i in seachList if i % tmp != 0]\n ",
"seachList[0] <= max",
"seachList[0]",
"seachList",
"0",
"max",
"primeNum.append(seachList[0])",
"primeNum.append",
"primeNum",
"append",
"seachList[0]",
"seachList",
"0",
"tmp = seachList[0]",
"tmp",
"seachList[0]",
"seachList",
"0",
"i for i in seachList if i % tmp != 0",
"for i in seachList if i % tmp != 0",
"i",
"seachList",
"i % tmp != 0",
"i % tmp",
"i",
"tmp",
"0",
"if i % tmp != 0",
"i",
"seachList = [i for i in seachList if i % tmp != 0]",
"seachList",
"[i for i in seachList if i % tmp != 0]",
"primeNum.extend(seachList)",
"primeNum.extend",
"primeNum",
"extend",
"seachList",
"return primeNum",
"primeNum",
"N",
"N",
"def gcd(a, b):\n while b: a, b = b, a % b\n return a\n\n#####LCM#####",
"gcd",
"while b: a, b = b, a % b\n ",
"b",
"return a",
"a",
"a",
"a",
"b",
"b",
"def lcm(a, b):\n return a * b // gcd (a, b)\n\n#####BitCount#####",
"lcm",
"return a * b // gcd (a, b)",
"a * b // gcd (a, b)",
"a * b",
"a",
"b",
"gcd (a, b)",
"gcd",
"a",
"b",
"a",
"a",
"b",
"b",
"def count_bit(n):\n count = 0\n while n:\n n &= n-1\n count += 1\n return count\n\n#####ChangeBase#####",
"count_bit",
"count = 0",
"count",
"0",
"while n:\n n &= n-1\n count += 1\n ",
"n",
"n &= n-1",
"n",
"n-1",
"n",
"1",
"count += 1",
"count",
"1",
"return count",
"count",
"n",
"n",
"def base_10_to_n(X, n):\n if X//n: return base_10_to_n(X//n, n)+[X%n]\n return [X%n]",
"base_10_to_n",
"if X//n: return base_10_to_n(X//n, n)+[X%n]\n ",
"X//n",
"X",
"n",
"return [X%n]",
"[X%n]",
"X%n",
"X",
"n",
"X",
"X",
"n",
"n",
"def base_n_to_10(X, n):\n return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))",
"base_n_to_10",
"return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))",
"sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))",
"sum",
"int(str(X)[-i-1])*n**i",
"int(str(X)[-i-1])",
"int",
"str(X)[-i-1]",
"(X)",
"str",
"X",
"-i-1",
"-i",
"i",
"1",
"n**i",
"n",
"i",
"X",
"X",
"n",
"n",
"def base_10_to_n_without_0(X, n):\n X -= 1\n if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]\n return [X%n]\n\n#####IntLog#####",
"base_10_to_n_without_0",
"X -= 1",
"X",
"1",
"if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]\n ",
"X//n",
"X",
"n",
"return [X%n]",
"[X%n]",
"X%n",
"X",
"n",
"X",
"X",
"n",
"n",
"def int_log(n, a):\n count = 0\n while n>=a:\n n //= a\n count += 1\n return count\n\n#############\n# Main Code #\n#############",
"int_log",
"count = 0",
"count",
"0",
"while n>=a:\n n //= a\n count += 1\n ",
"n>=a",
"n",
"a",
"n //= a",
"n",
"a",
"count += 1",
"count",
"1",
"return count",
"count",
"n",
"n",
"a",
"a",
"H,W,N = IL()",
"H",
"IL()",
"IL",
"W",
"N",
"data = ILL(N)",
"data",
"ILL(N)",
"ILL",
"N",
"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",
"dic = DD(int)",
"dic",
"DD(int)",
"DD",
"int",
"for y,x in data:\n for i in range(9):\n ny,nx = y+dy[i], x+dx[i]\n if 2<=ny<=H-1 and 2<=nx<=W-1:\n dic[ny*W+nx] += 1\n ",
"y",
"x",
"data",
"for i in range(9):\n ny,nx = y+dy[i], x+dx[i]\n if 2<=ny<=H-1 and 2<=nx<=W-1:\n dic[ny*W+nx] += 1\n ",
"i",
"range(9)",
"range",
"9",
"ny,nx = y+dy[i], x+dx[i]",
"ny",
"y+dy[i]",
"y",
"dy[i]",
"dy",
"i",
"nx",
"x+dx[i]",
"x",
"dx[i]",
"dx",
"i",
"if 2<=ny<=H-1 and 2<=nx<=W-1:\n dic[ny*W+nx] += 1\n ",
"2<=ny<=H-1 and 2<=nx<=W-1",
"2<=ny<=H-1",
"2<=ny",
"2",
"ny",
"H-1",
"H",
"1",
"2<=nx<=W-1",
"2<=nx",
"2",
"nx",
"W-1",
"W",
"1",
"dic[ny*W+nx] += 1",
"dic[ny*W+nx]",
"dic",
"ny*W+nx",
"ny*W",
"ny",
"W",
"nx",
"1",
"ans = [(H-2)*(W-2),0,0,0,0,0,0,0,0,0]",
"ans",
"[(H-2)*(W-2),0,0,0,0,0,0,0,0,0]",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"for k in dic:\n ans[0] -= 1\n ans[dic[k]] += 1",
"k",
"dic",
"ans[0] -= 1",
"ans[0]",
"ans",
"0",
"1",
"ans[dic[k]] += 1",
"ans[dic[k]]",
"ans",
"dic[k]",
"dic",
"k",
"1",
"print(*ans,sep=\"\\n\")",
"print",
"*ans",
"ans",
"sep=\"\\n\"",
"sep",
"\"\\n\"",
"def SL(): return list(map(str,input().split()))",
"def SL(): return list(map(str,input().split()))",
"SL",
"MOD = 10**9+7",
"10**9+7",
"MOD",
"def nCr(n,r):\n if n == r: return 1\n if n < r or r < 0: return 0\n ret = 1\n ret = ret * kaijo(n) % MOD\n ret = ret * gyaku_kaijo(r) % MOD\n ret = ret * gyaku_kaijo(n-r) % MOD\n return ret\n\n######Factorization######",
"def nCr(n,r):\n if n == r: return 1\n if n < r or r < 0: return 0\n ret = 1\n ret = ret * kaijo(n) % MOD\n ret = ret * gyaku_kaijo(r) % MOD\n ret = ret * gyaku_kaijo(n-r) % MOD\n return ret\n\n######Factorization######",
"nCr",
"def make_primes(N):\n max = int(math.sqrt(N))\n seachList = [i for i in range(2,N+1)]\n primeNum = []\n while seachList[0] <= max:\n primeNum.append(seachList[0])\n tmp = seachList[0]\n seachList = [i for i in seachList if i % tmp != 0]\n primeNum.extend(seachList)\n return primeNum\n\n#####GCD#####",
"def make_primes(N):\n max = int(math.sqrt(N))\n seachList = [i for i in range(2,N+1)]\n primeNum = []\n while seachList[0] <= max:\n primeNum.append(seachList[0])\n tmp = seachList[0]\n seachList = [i for i in seachList if i % tmp != 0]\n primeNum.extend(seachList)\n return primeNum\n\n#####GCD#####",
"make_primes",
"def lcm(a, b):\n return a * b // gcd (a, b)\n\n#####BitCount#####",
"def lcm(a, b):\n return a * b // gcd (a, b)\n\n#####BitCount#####",
"lcm",
"def base_10_to_n(X, n):\n if X//n: return base_10_to_n(X//n, n)+[X%n]\n return [X%n]",
"def base_10_to_n(X, n):\n if X//n: return base_10_to_n(X//n, n)+[X%n]\n return [X%n]",
"base_10_to_n",
"INF = float('inf')",
"float('inf')",
"INF",
"def IL(): return list(map(int,input().split()))",
"def IL(): return list(map(int,input().split()))",
"IL",
"def S(): return input().strip()",
"def S(): return input().strip()",
"S",
"def base_10_to_n_without_0(X, n):\n X -= 1\n if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]\n return [X%n]\n\n#####IntLog#####",
"def base_10_to_n_without_0(X, n):\n X -= 1\n if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]\n return [X%n]\n\n#####IntLog#####",
"base_10_to_n_without_0",
"ans = [(H-2)*(W-2),0,0,0,0,0,0,0,0,0]",
"[(H-2)*(W-2),0,0,0,0,0,0,0,0,0]",
"ans",
"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 return divisors\n\n#####MakePrimes######",
"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 return divisors\n\n#####MakePrimes######",
"make_divisors",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"def ILs(n): return list(int(input()) for _ in range(n))",
"def ILs(n): return list(int(input()) for _ in range(n))",
"ILs",
"def kaijo(n):\n if(len(kaijo_memo) > n): return kaijo_memo[n]\n if(len(kaijo_memo) == 0): kaijo_memo.append(1)\n while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)\n return kaijo_memo[n]",
"def kaijo(n):\n if(len(kaijo_memo) > n): return kaijo_memo[n]\n if(len(kaijo_memo) == 0): kaijo_memo.append(1)\n while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)\n return kaijo_memo[n]",
"kaijo",
"H,W,N = IL()",
"IL()",
"H",
"def int_log(n, a):\n count = 0\n while n>=a:\n n //= a\n count += 1\n return count\n\n#############\n# Main Code #\n#############",
"def int_log(n, a):\n count = 0\n while n>=a:\n n //= a\n count += 1\n return count\n\n#############\n# Main Code #\n#############",
"int_log",
"ny,nx = y+dy[i], x+dx[i]",
"y+dy[i]",
"ny",
"dy = [1,0,-1,1,0,-1,1,0,-1]",
"[1,0,-1,1,0,-1,1,0,-1]",
"dy",
"def SLs(n): return list(input().strip() for _ in range(n))",
"def SLs(n): return list(input().strip() for _ in range(n))",
"SLs",
"dx = [1,1,1,0,0,0,-1,-1,-1]",
"[1,1,1,0,0,0,-1,-1,-1]",
"dx",
"def inv(n): return pow(n, MOD-2, MOD)\n\n######Combination######",
"def inv(n): return pow(n, MOD-2, MOD)\n\n######Combination######",
"inv",
"AZ = \"abcdefghijklmnopqrstuvwxyz\"",
"\"abcdefghijklmnopqrstuvwxyz\"",
"AZ",
"def ILL(n): return [list(map(int, input().split())) for _ in range(n)]",
"def ILL(n): return [list(map(int, input().split())) for _ in range(n)]",
"ILL",
"def I(): return int(input().strip())",
"def I(): return int(input().strip())",
"I",
"kaijo_memo = []",
"[]",
"kaijo_memo",
"def factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0: \n cnt+=1 \n temp //= i\n arr.append([i, cnt])\n if temp!=1: arr.append([temp, 1])\n if arr==[]: arr.append([n, 1])\n return arr\n\n#####MakeDivisors######",
"def factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0: \n cnt+=1 \n temp //= i\n arr.append([i, cnt])\n if temp!=1: arr.append([temp, 1])\n if arr==[]: arr.append([n, 1])\n return arr\n\n#####MakeDivisors######",
"factorization",
"dic = DD(int)",
"DD(int)",
"dic",
"nx = y+dy[i], x+dx[i]",
"x+dx[i]",
"nx",
"W,N = IL()",
"IL()",
"W",
"N = IL()",
"IL()",
"N",
"def gyaku_kaijo(n):\n if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]\n if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)\n while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)\n return gyaku_kaijo_memo[n]",
"def gyaku_kaijo(n):\n if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]\n if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)\n while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)\n return gyaku_kaijo_memo[n]",
"gyaku_kaijo",
"def gcd(a, b):\n while b: a, b = b, a % b\n return a\n\n#####LCM#####",
"def gcd(a, b):\n while b: a, b = b, a % b\n return a\n\n#####LCM#####",
"gcd",
"data = ILL(N)",
"ILL(N)",
"data",
"def SLL(n): return [list(map(str, input().split())) for _ in range(n)]\n\n\n#####Shorten#####",
"def SLL(n): return [list(map(str, input().split())) for _ in range(n)]\n\n\n#####Shorten#####",
"SLL",
"gyaku_kaijo_memo = []",
"[]",
"gyaku_kaijo_memo",
"def DD(arg): return defaultdict(arg)\n\n#####Inverse#####",
"def DD(arg): return defaultdict(arg)\n\n#####Inverse#####",
"DD",
"def count_bit(n):\n count = 0\n while n:\n n &= n-1\n count += 1\n return count\n\n#####ChangeBase#####",
"def count_bit(n):\n count = 0\n while n:\n n &= n-1\n count += 1\n return count\n\n#####ChangeBase#####",
"count_bit",
"def base_n_to_10(X, n):\n return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))",
"def base_n_to_10(X, n):\n return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))",
"base_n_to_10"
] | # -*- coding: utf-8 -*-
#############
# Libraries #
#############
import sys
input = sys.stdin.readline
import math
#from math import gcd
import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache
#############
# Constants #
#############
MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"
#############
# Functions #
#############
######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]
#####Shorten#####
def DD(arg): return defaultdict(arg)
#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)
######Combination######
kaijo_memo = []
def kaijo(n):
if(len(kaijo_memo) > n): return kaijo_memo[n]
if(len(kaijo_memo) == 0): kaijo_memo.append(1)
while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
return kaijo_memo[n]
gyaku_kaijo_memo = []
def gyaku_kaijo(n):
if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
return gyaku_kaijo_memo[n]
def nCr(n,r):
if n == r: return 1
if n < r or r < 0: return 0
ret = 1
ret = ret * kaijo(n) % MOD
ret = ret * gyaku_kaijo(r) % MOD
ret = ret * gyaku_kaijo(n-r) % MOD
return ret
######Factorization######
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
arr.append([i, cnt])
if temp!=1: arr.append([temp, 1])
if arr==[]: arr.append([n, 1])
return arr
#####MakeDivisors######
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)
return divisors
#####MakePrimes######
def make_primes(N):
max = int(math.sqrt(N))
seachList = [i for i in range(2,N+1)]
primeNum = []
while seachList[0] <= max:
primeNum.append(seachList[0])
tmp = seachList[0]
seachList = [i for i in seachList if i % tmp != 0]
primeNum.extend(seachList)
return primeNum
#####GCD#####
def gcd(a, b):
while b: a, b = b, a % b
return a
#####LCM#####
def lcm(a, b):
return a * b // gcd (a, b)
#####BitCount#####
def count_bit(n):
count = 0
while n:
n &= n-1
count += 1
return count
#####ChangeBase#####
def base_10_to_n(X, n):
if X//n: return base_10_to_n(X//n, n)+[X%n]
return [X%n]
def base_n_to_10(X, n):
return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))
def base_10_to_n_without_0(X, n):
X -= 1
if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]
return [X%n]
#####IntLog#####
def int_log(n, a):
count = 0
while n>=a:
n //= a
count += 1
return count
#############
# Main Code #
#############
H,W,N = IL()
data = ILL(N)
dx = [1,1,1,0,0,0,-1,-1,-1]
dy = [1,0,-1,1,0,-1,1,0,-1]
dic = DD(int)
for y,x in data:
for i in range(9):
ny,nx = y+dy[i], x+dx[i]
if 2<=ny<=H-1 and 2<=nx<=W-1:
dic[ny*W+nx] += 1
ans = [(H-2)*(W-2),0,0,0,0,0,0,0,0,0]
for k in dic:
ans[0] -= 1
ans[dic[k]] += 1
print(*ans,sep="\n") |
[
7,
15,
13,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
13,
4,
18,
13,
13,
39,
13,
13,
0,
13,
17,
28,
13,
13,
4,
13,
13,
0,
13,
13,
13,
0,
13,
2,
13,
17,
13,
2,
13,
17,
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,
14,
2,
39,
13,
13,
4,
18,
13,
13,
0,
18,
13,
39,
13,
13,
17,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
13,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
13,
17,
0,
18,
13,
17,
2,
13,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
7,
6
],
[
7,
16
],
[
7,
17
],
[
20,
19
],
[
23,
22
],
[
17,
25
],
[
28,
27
],
[
28,
37
],
[
19,
40
],
[
47,
46
],
[
19,
53
],
[
56,
55
],
[
56,
57
],
[
60,
59
],
[
55,
61
],
[
27,
61
],
[
59,
61
],
[
64,
63
],
[
57,
65
],
[
37,
65
],
[
63,
65
],
[
69,
68
],
[
59,
75
],
[
55,
75
],
[
27,
75
],
[
6,
80
],
[
59,
83
],
[
55,
83
],
[
27,
83
],
[
87,
86
],
[
63,
93
],
[
57,
93
],
[
37,
93
],
[
16,
98
],
[
63,
101
],
[
57,
101
],
[
37,
101
],
[
46,
110
],
[
118,
113
],
[
46,
114
],
[
125,
120
],
[
46,
121
],
[
128,
127
],
[
134,
133
],
[
6,
136
],
[
16,
139
],
[
143,
142
],
[
146,
145
],
[
46,
148
],
[
154,
151
],
[
127,
152
],
[
145,
153
],
[
157,
156
],
[
162,
159
],
[
127,
160
],
[
133,
163
],
[
156,
164
],
[
142,
164
],
[
167,
166
],
[
151,
172
],
[
127,
173
],
[
166,
174
],
[
183,
180
]
] | [
"# -*- coding: utf-8 -*-\nimport sys\n\ndef main():\n\tH, W, N = map(int, input().split(\" \"))\n\tAB = []\n\tfor _ in range(N):\n\t\ta, b = map(int, input().split(\" \"))\n\t\tAB.append((a, b))\n\n\tans = {}\n\tfor i, val in enumerate(AB):\n\t\ta, b = val\n\t\ta, b = a-1, b-1\n\t\tfor ba in range(max(0, a-2), min(H-2, a+1)):\n\t\t\tfor bb in range(max(0, b-2), min(W-2, b+1)):\n\t\t\t\tif (ba, bb) in ans.keys():\n\t\t\t\t\tans[(ba, bb)] += 1\n\t\t\t\telse:\n\t\t\t\t\tans[(ba, bb)] = 1\n\n\tans2 = [0] * 10\n\ttotal = (H-2) * (W-2)\n\tt = 0\n\tfor i in ans.values():\n\t\tans2[i] += 1\n\t\tt += 1\n\tans2[0] = total - t\n\tfor i in range(10):\n\t\tprint(ans2[i])\n\nif __name__ == \"__main__\":\n\tmain()",
"import sys",
"sys",
"def main():\n\tH, W, N = map(int, input().split(\" \"))\n\tAB = []\n\tfor _ in range(N):\n\t\ta, b = map(int, input().split(\" \"))\n\t\tAB.append((a, b))\n\n\tans = {}\n\tfor i, val in enumerate(AB):\n\t\ta, b = val\n\t\ta, b = a-1, b-1\n\t\tfor ba in range(max(0, a-2), min(H-2, a+1)):\n\t\t\tfor bb in range(max(0, b-2), min(W-2, b+1)):\n\t\t\t\tif (ba, bb) in ans.keys():\n\t\t\t\t\tans[(ba, bb)] += 1\n\t\t\t\telse:\n\t\t\t\t\tans[(ba, bb)] = 1\n\n\tans2 = [0] * 10\n\ttotal = (H-2) * (W-2)\n\tt = 0\n\tfor i in ans.values():\n\t\tans2[i] += 1\n\t\tt += 1\n\tans2[0] = total - t\n\tfor i in range(10):\n\t\tprint(ans2[i])",
"main",
"H, W, N = map(int, input().split(\" \"))",
"H",
"map(int, input().split(\" \"))",
"map",
"int",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"W",
"N",
"AB = []",
"AB",
"[]",
"for _ in range(N):\n\t\ta, b = map(int, input().split(\" \"))\n\t\tAB.append((a, b))\n\n\t",
"_",
"range(N)",
"range",
"N",
"a, b = map(int, input().split(\" \"))",
"a",
"map(int, input().split(\" \"))",
"map",
"int",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"b",
"AB.append((a, b))",
"AB.append",
"AB",
"append",
"(a, b)",
"a",
"b",
"ans = {}",
"ans",
"{}",
"for i, val in enumerate(AB):\n\t\ta, b = val\n\t\ta, b = a-1, b-1\n\t\tfor ba in range(max(0, a-2), min(H-2, a+1)):\n\t\t\tfor bb in range(max(0, b-2), min(W-2, b+1)):\n\t\t\t\tif (ba, bb) in ans.keys():\n\t\t\t\t\tans[(ba, bb)] += 1\n\t\t\t\telse:\n\t\t\t\t\tans[(ba, bb)] = 1\n\n\t",
"i",
"val",
"enumerate(AB)",
"enumerate",
"AB",
"a, b = val",
"a",
"val",
"b",
"a, b = a-1, b-1",
"a",
"a-1",
"a",
"1",
"b",
"b-1",
"b",
"1",
"for ba in range(max(0, a-2), min(H-2, a+1)):\n\t\t\tfor bb in range(max(0, b-2), min(W-2, b+1)):\n\t\t\t\tif (ba, bb) in ans.keys():\n\t\t\t\t\tans[(ba, bb)] += 1\n\t\t\t\telse:\n\t\t\t\t\tans[(ba, bb)] = 1\n\n\t",
"ba",
"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 bb in range(max(0, b-2), min(W-2, b+1)):\n\t\t\t\tif (ba, bb) in ans.keys():\n\t\t\t\t\tans[(ba, bb)] += 1\n\t\t\t\telse:\n\t\t\t\t\tans[(ba, bb)] = 1\n\n\t",
"bb",
"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",
"if (ba, bb) in ans.keys():\n\t\t\t\t\tans[(ba, bb)] += 1\n\t\t\t\telse:\n\t\t\t\t\tans[(ba, bb)] = 1\n\n\t",
"(ba, bb) in ans.keys()",
"(ba, bb)",
"ba",
"bb",
"ans.keys()",
"ans.keys",
"ans",
"keys",
"ans[(ba, bb)] += 1",
"ans[(ba, bb)]",
"ans",
"(ba, bb)",
"ba",
"bb",
"1",
"ans[(ba, bb)] = 1",
"ans[(ba, bb)]",
"ans",
"(ba, bb)",
"ba",
"bb",
"1",
"ans2 = [0] * 10",
"ans2",
"[0] * 10",
"[0]",
"0",
"10",
"total = (H-2) * (W-2)",
"total",
"(H-2) * (W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"t = 0",
"t",
"0",
"for i in ans.values():\n\t\tans2[i] += 1\n\t\tt += 1\n\t",
"i",
"ans.values()",
"ans.values",
"ans",
"values",
"ans2[i] += 1",
"ans2[i]",
"ans2",
"i",
"1",
"t += 1",
"t",
"1",
"ans2[0] = total - t",
"ans2[0]",
"ans2",
"0",
"total - t",
"total",
"t",
"for i in range(10):\n\t\tprint(ans2[i])",
"i",
"range(10)",
"range",
"10",
"print(ans2[i])",
"print",
"ans2[i]",
"ans2",
"i",
"if __name__ == \"__main__\":\n\tmain()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n\tH, W, N = map(int, input().split(\" \"))\n\tAB = []\n\tfor _ in range(N):\n\t\ta, b = map(int, input().split(\" \"))\n\t\tAB.append((a, b))\n\n\tans = {}\n\tfor i, val in enumerate(AB):\n\t\ta, b = val\n\t\ta, b = a-1, b-1\n\t\tfor ba in range(max(0, a-2), min(H-2, a+1)):\n\t\t\tfor bb in range(max(0, b-2), min(W-2, b+1)):\n\t\t\t\tif (ba, bb) in ans.keys():\n\t\t\t\t\tans[(ba, bb)] += 1\n\t\t\t\telse:\n\t\t\t\t\tans[(ba, bb)] = 1\n\n\tans2 = [0] * 10\n\ttotal = (H-2) * (W-2)\n\tt = 0\n\tfor i in ans.values():\n\t\tans2[i] += 1\n\t\tt += 1\n\tans2[0] = total - t\n\tfor i in range(10):\n\t\tprint(ans2[i])",
"def main():\n\tH, W, N = map(int, input().split(\" \"))\n\tAB = []\n\tfor _ in range(N):\n\t\ta, b = map(int, input().split(\" \"))\n\t\tAB.append((a, b))\n\n\tans = {}\n\tfor i, val in enumerate(AB):\n\t\ta, b = val\n\t\ta, b = a-1, b-1\n\t\tfor ba in range(max(0, a-2), min(H-2, a+1)):\n\t\t\tfor bb in range(max(0, b-2), min(W-2, b+1)):\n\t\t\t\tif (ba, bb) in ans.keys():\n\t\t\t\t\tans[(ba, bb)] += 1\n\t\t\t\telse:\n\t\t\t\t\tans[(ba, bb)] = 1\n\n\tans2 = [0] * 10\n\ttotal = (H-2) * (W-2)\n\tt = 0\n\tfor i in ans.values():\n\t\tans2[i] += 1\n\t\tt += 1\n\tans2[0] = total - t\n\tfor i in range(10):\n\t\tprint(ans2[i])",
"main"
] | # -*- coding: utf-8 -*-
import sys
def main():
H, W, N = map(int, input().split(" "))
AB = []
for _ in range(N):
a, b = map(int, input().split(" "))
AB.append((a, b))
ans = {}
for i, val in enumerate(AB):
a, b = val
a, b = a-1, b-1
for ba in range(max(0, a-2), min(H-2, a+1)):
for bb in range(max(0, b-2), min(W-2, b+1)):
if (ba, bb) in ans.keys():
ans[(ba, bb)] += 1
else:
ans[(ba, bb)] = 1
ans2 = [0] * 10
total = (H-2) * (W-2)
t = 0
for i in ans.values():
ans2[i] += 1
t += 1
ans2[0] = total - t
for i in range(10):
print(ans2[i])
if __name__ == "__main__":
main()
|
[
7,
15,
13,
15,
13,
0,
13,
18,
18,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
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,
18,
13,
13,
39,
41,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
4,
39,
13,
13,
0,
13,
13,
12,
13,
29,
2,
2,
13,
2,
17,
17,
13,
23,
13,
23,
13,
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,
13,
0,
13,
13,
13,
14,
2,
40,
40,
17,
2,
13,
13,
2,
13,
17,
40,
40,
17,
2,
13,
13,
2,
13,
17,
0,
13,
18,
13,
4,
13,
2,
13,
13,
2,
13,
13,
0,
18,
13,
4,
13,
2,
13,
13,
2,
13,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
28,
13,
13,
4,
13,
13,
10,
13,
13,
10,
13,
13,
10,
12,
13,
10,
13,
13,
10,
4,
13,
10,
18,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
18,
13,
10,
13,
13,
10,
13,
13
] | [
[
200,
6
],
[
15,
14
],
[
201,
18
],
[
14,
23
],
[
218,
25
],
[
218,
27
],
[
218,
28
],
[
32,
31
],
[
194,
38
],
[
44,
41
],
[
195,
42
],
[
219,
46
],
[
189,
49
],
[
197,
52
],
[
61,
60
],
[
67,
66
],
[
185,
76
],
[
89,
83
],
[
91,
87
],
[
89,
89
],
[
91,
91
],
[
94,
93
],
[
213,
96
],
[
100,
99
],
[
201,
103
],
[
99,
109
],
[
209,
112
],
[
209,
114
],
[
117,
116
],
[
186,
116
],
[
221,
119
],
[
116,
120
],
[
221,
121
],
[
222,
128
],
[
207,
129
],
[
219,
131
],
[
204,
137
],
[
210,
138
],
[
189,
140
],
[
215,
143
],
[
198,
145
],
[
192,
147
],
[
222,
149
],
[
207,
150
],
[
204,
152
],
[
210,
153
],
[
165,
155
],
[
198,
156
],
[
192,
158
],
[
222,
160
],
[
207,
161
],
[
204,
163
],
[
210,
164
],
[
170,
167
],
[
195,
168
],
[
216,
169
],
[
177,
172
],
[
195,
173
],
[
216,
175
],
[
180,
179
],
[
195,
179
],
[
179,
183
],
[
185,
186
],
[
218,
189
],
[
194,
195
],
[
197,
198
],
[
200,
201
],
[
116,
203
],
[
221,
204
],
[
209,
207
],
[
209,
210
],
[
218,
213
],
[
215,
216
],
[
218,
219
],
[
116,
221
],
[
221,
222
]
] | [
"import collections\nimport sys\ninput = sys.stdin.readline\n\nh, w, n = [ int(v) for v in input().split() ]\nans_list = [ 0 for i in range(10) ]\nans_list[0] = (h-2)*(w-2) \nadjust_counter = collections.Counter([])\nadjust_list = [ [i,j] for i in range(-1,2) for j in range(-1,2)]\n\n\ndef makehash(a,b):\n return a*10**9+b\n\nfor i in range(n):\n a, b = [ int(v) - 1 for v in input().split() ]\n for j in adjust_list:\n p, q = j\n if 1 <= p+a <= h-2 and 1 <= q+b <= w-2:\n c = adjust_counter[makehash(p+a,q+b)]\n adjust_counter[makehash(p+a,q+b)] += 1\n ans_list[c] -= 1\n ans_list[c+1] += 1\n\nfor i in ans_list:\n print(i)",
"import collections",
"collections",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"int(v) for v in input().split()",
"for v in input().split()",
"v",
"input().split()",
"().split",
"()",
"input",
"split",
"for v in input().split()",
"int(v)",
"int",
"v",
"h, w, n = [ int(v) for v in input().split() ]",
"h",
"[ int(v) for v in input().split() ]",
"w",
"n",
"0 for i in range(10)",
"for i in range(10)",
"i",
"range(10)",
"range",
"10",
"for i in range(10)",
"0",
"ans_list = [ 0 for i in range(10) ]",
"ans_list",
"[ 0 for i in range(10) ]",
"ans_list[0] = (h-2)*(w-2)",
"ans_list[0]",
"ans_list",
"0",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"adjust_counter = collections.Counter([])",
"adjust_counter",
"collections.Counter([])",
"collections.Counter",
"collections",
"Counter",
"[]",
"[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",
"adjust_list = [ [i,j] for i in range(-1,2) for j in range(-1,2)]",
"adjust_list",
"[ [i,j] for i in range(-1,2) for j in range(-1,2)]",
"def makehash(a,b):\n return a*10**9+b",
"makehash",
"return a*10**9+b",
"a*10**9+b",
"a*10**9",
"a",
"10**9",
"10",
"9",
"b",
"a",
"a",
"b",
"b",
"for i in range(n):\n a, b = [ int(v) - 1 for v in input().split() ]\n for j in adjust_list:\n p, q = j\n if 1 <= p+a <= h-2 and 1 <= q+b <= w-2:\n c = adjust_counter[makehash(p+a,q+b)]\n adjust_counter[makehash(p+a,q+b)] += 1\n ans_list[c] -= 1\n ans_list[c+1] += 1",
"i",
"range(n)",
"range",
"n",
"int(v) - 1 for v in input().split()",
"for v in input().split()",
"v",
"input().split()",
"().split",
"()",
"input",
"split",
"for v in input().split()",
"int(v) - 1",
"int(v)",
"int",
"v",
"1",
"a, b = [ int(v) - 1 for v in input().split() ]",
"a",
"[ int(v) - 1 for v in input().split() ]",
"b",
"for j in adjust_list:\n p, q = j\n if 1 <= p+a <= h-2 and 1 <= q+b <= w-2:\n c = adjust_counter[makehash(p+a,q+b)]\n adjust_counter[makehash(p+a,q+b)] += 1\n ans_list[c] -= 1\n ans_list[c+1] += 1",
"j",
"adjust_list",
"p, q = j",
"p",
"j",
"q",
"if 1 <= p+a <= h-2 and 1 <= q+b <= w-2:\n c = adjust_counter[makehash(p+a,q+b)]\n adjust_counter[makehash(p+a,q+b)] += 1\n ans_list[c] -= 1\n ans_list[c+1] += 1",
"1 <= p+a <= h-2 and 1 <= q+b <= w-2",
"1 <= p+a <= h-2",
"1 <= p+a",
"1",
"p+a",
"p",
"a",
"h-2",
"h",
"2",
"1 <= q+b <= w-2",
"1 <= q+b",
"1",
"q+b",
"q",
"b",
"w-2",
"w",
"2",
"c = adjust_counter[makehash(p+a,q+b)]",
"c",
"adjust_counter[makehash(p+a,q+b)]",
"adjust_counter",
"makehash(p+a,q+b)",
"makehash",
"p+a",
"p",
"a",
"q+b",
"q",
"b",
"adjust_counter[makehash(p+a,q+b)] += 1",
"adjust_counter[makehash(p+a,q+b)]",
"adjust_counter",
"makehash(p+a,q+b)",
"makehash",
"p+a",
"p",
"a",
"q+b",
"q",
"b",
"1",
"ans_list[c] -= 1",
"ans_list[c]",
"ans_list",
"c",
"1",
"ans_list[c+1] += 1",
"ans_list[c+1]",
"ans_list",
"c+1",
"c",
"1",
"1",
"for i in ans_list:\n print(i)",
"i",
"ans_list",
"print(i)",
"print",
"i",
"adjust_list = [ [i,j] for i in range(-1,2) for j in range(-1,2)]",
"[ [i,j] for i in range(-1,2) for j in range(-1,2)]",
"adjust_list",
"w, n = [ int(v) for v in input().split() ]",
"[ int(v) for v in input().split() ]",
"w",
"def makehash(a,b):\n return a*10**9+b",
"def makehash(a,b):\n return a*10**9+b",
"makehash",
"ans_list = [ 0 for i in range(10) ]",
"[ 0 for i in range(10) ]",
"ans_list",
"adjust_counter = collections.Counter([])",
"collections.Counter([])",
"adjust_counter",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"q = j",
"j",
"q",
"a, b = [ int(v) - 1 for v in input().split() ]",
"[ int(v) - 1 for v in input().split() ]",
"a",
"b = [ int(v) - 1 for v in input().split() ]",
"[ int(v) - 1 for v in input().split() ]",
"b",
"n = [ int(v) for v in input().split() ]",
"[ int(v) for v in input().split() ]",
"n",
"c = adjust_counter[makehash(p+a,q+b)]",
"adjust_counter[makehash(p+a,q+b)]",
"c",
"h, w, n = [ int(v) for v in input().split() ]",
"[ int(v) for v in input().split() ]",
"h",
"p, q = j",
"j",
"p"
] | import collections
import sys
input = sys.stdin.readline
h, w, n = [ int(v) for v in input().split() ]
ans_list = [ 0 for i in range(10) ]
ans_list[0] = (h-2)*(w-2)
adjust_counter = collections.Counter([])
adjust_list = [ [i,j] for i in range(-1,2) for j in range(-1,2)]
def makehash(a,b):
return a*10**9+b
for i in range(n):
a, b = [ int(v) - 1 for v in input().split() ]
for j in adjust_list:
p, q = j
if 1 <= p+a <= h-2 and 1 <= q+b <= w-2:
c = adjust_counter[makehash(p+a,q+b)]
adjust_counter[makehash(p+a,q+b)] += 1
ans_list[c] -= 1
ans_list[c+1] += 1
for i in ans_list:
print(i) |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
0,
13,
4,
13,
13,
12,
13,
14,
2,
2,
2,
2,
13,
17,
2,
13,
2,
13,
17,
2,
13,
17,
2,
13,
2,
13,
17,
23,
13,
23,
13,
12,
13,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
14,
4,
13,
13,
13,
0,
13,
39,
13,
13,
0,
18,
13,
13,
17,
23,
13,
23,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
4,
13,
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,
18,
13,
39,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
13,
13
] | [
[
169,
3
],
[
169,
12
],
[
169,
13
],
[
17,
16
],
[
181,
23
],
[
172,
26
],
[
53,
37
],
[
53,
40
],
[
158,
42
],
[
55,
45
],
[
55,
48
],
[
164,
50
],
[
53,
53
],
[
55,
55
],
[
60,
59
],
[
94,
63
],
[
94,
66
],
[
70,
69
],
[
96,
73
],
[
96,
76
],
[
176,
80
],
[
59,
81
],
[
69,
82
],
[
85,
84
],
[
92,
89
],
[
173,
90
],
[
84,
91
],
[
94,
94
],
[
96,
96
],
[
99,
98
],
[
170,
101
],
[
178,
103
],
[
178,
112
],
[
161,
114
],
[
167,
115
],
[
179,
116
],
[
119,
118
],
[
173,
121
],
[
127,
124
],
[
182,
125
],
[
118,
126
],
[
132,
129
],
[
182,
130
],
[
158,
135
],
[
164,
138
],
[
182,
143
],
[
148,
147
],
[
182,
154
],
[
147,
155
],
[
169,
158
],
[
169,
164
],
[
178,
167
],
[
169,
170
],
[
172,
173
],
[
178,
179
],
[
181,
182
]
] | [
"from collections import defaultdict\nH,W,N=map(int,input().split())\nans=[0 for i in range(10)]\n\ndata=defaultdict(int)\ndef check(a,b):\n if a>0 and a<H-1 and b>0 and b<W-1:return True\n else:return False\n\ndef count(a,b):\n for i in range(a-2,a+1):\n for j in range(b-2,b+1):\n if check(i,j):\n x=(i,j)\n data[x]+=1\n \nfor k in range(N):\n a,b=map(int,input().split())\n count(a,b)\n\nfor v in data.values():\n ans[v]+=1\n\nans[0]=(H-2)*(W-2)-sum(ans[1:])\nfor i in range(10):\n print(ans[i])\n \n#http://arc061.contest.atcoder.jp/data/arc/061/editorial.pdf\n#https://atcoder.jp/contests/abc045/submissions/4024831\n#https://atcoder.jp/contests/abc045/submissions/4017890",
"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",
"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)]",
"data=defaultdict(int)",
"data",
"defaultdict(int)",
"defaultdict",
"int",
"def check(a,b):\n if a>0 and a<H-1 and b>0 and b<W-1:return True\n else:return False",
"check",
"if a>0 and a<H-1 and b>0 and b<W-1:return True\n else:return False",
"a>0 and a<H-1 and b>0 and b<W-1",
"a>0 and a<H-1 and b>0",
"a>0 and a<H-1",
"a>0",
"a",
"0",
"a<H-1",
"a",
"H-1",
"H",
"1",
"b>0",
"b",
"0",
"b<W-1",
"b",
"W-1",
"W",
"1",
"a",
"a",
"b",
"b",
"def count(a,b):\n for i in range(a-2,a+1):\n for j in range(b-2,b+1):\n if check(i,j):\n x=(i,j)\n data[x]+=1\n ",
"count",
"for i in range(a-2,a+1):\n for j in range(b-2,b+1):\n if check(i,j):\n x=(i,j)\n data[x]+=1\n ",
"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 check(i,j):\n x=(i,j)\n data[x]+=1\n ",
"j",
"range(b-2,b+1)",
"range",
"b-2",
"b",
"2",
"b+1",
"b",
"1",
"if check(i,j):\n x=(i,j)\n data[x]+=1\n ",
"check(i,j)",
"check",
"i",
"j",
"x=(i,j)",
"x",
"(i,j)",
"i",
"j",
"data[x]+=1",
"data[x]",
"data",
"x",
"1",
"a",
"a",
"b",
"b",
"for k in range(N):\n a,b=map(int,input().split())\n count(a,b)",
"k",
"range(N)",
"range",
"N",
"a,b=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"count(a,b)",
"count",
"a",
"b",
"for v in data.values():\n ans[v]+=1",
"v",
"data.values()",
"data.values",
"data",
"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 i in range(10):\n print(ans[i])\n \n#http://arc061.contest.atcoder.jp/data/arc/061/editorial.pdf\n#https://atcoder.jp/contests/abc045/submissions/4024831\n#https://atcoder.jp/contests/abc045/submissions/4017890",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"H,W,N=map(int,input().split())",
"map(int,input().split())",
"H",
"def count(a,b):\n for i in range(a-2,a+1):\n for j in range(b-2,b+1):\n if check(i,j):\n x=(i,j)\n data[x]+=1\n ",
"def count(a,b):\n for i in range(a-2,a+1):\n for j in range(b-2,b+1):\n if check(i,j):\n x=(i,j)\n data[x]+=1\n ",
"count",
"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",
"data=defaultdict(int)",
"defaultdict(int)",
"data",
"def check(a,b):\n if a>0 and a<H-1 and b>0 and b<W-1:return True\n else:return False",
"def check(a,b):\n if a>0 and a<H-1 and b>0 and b<W-1:return True\n else:return False",
"check",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"ans=[0 for i in range(10)]",
"[0 for i in range(10)]",
"ans"
] | from collections import defaultdict
H,W,N=map(int,input().split())
ans=[0 for i in range(10)]
data=defaultdict(int)
def check(a,b):
if a>0 and a<H-1 and b>0 and b<W-1:return True
else:return False
def count(a,b):
for i in range(a-2,a+1):
for j in range(b-2,b+1):
if check(i,j):
x=(i,j)
data[x]+=1
for k in range(N):
a,b=map(int,input().split())
count(a,b)
for v in data.values():
ans[v]+=1
ans[0]=(H-2)*(W-2)-sum(ans[1:])
for i in range(10):
print(ans[i])
#http://arc061.contest.atcoder.jp/data/arc/061/editorial.pdf
#https://atcoder.jp/contests/abc045/submissions/4024831
#https://atcoder.jp/contests/abc045/submissions/4017890 |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
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,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
4,
18,
13,
13,
2,
2,
13,
2,
17,
17,
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,
2,
2,
2,
2,
13,
13,
2,
17,
17,
13,
13,
28,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
2,
2,
13,
2,
13,
2,
17,
17,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
4,
13,
18,
13,
39,
17,
41,
28,
13,
13,
4,
4,
13,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] | [
[
185,
4
],
[
200,
11
],
[
186,
18
],
[
200,
20
],
[
200,
21
],
[
194,
23
],
[
201,
28
],
[
183,
31
],
[
203,
38
],
[
188,
42
],
[
47,
46
],
[
174,
49
],
[
179,
51
],
[
186,
58
],
[
179,
60
],
[
189,
63
],
[
180,
67
],
[
177,
71
],
[
74,
73
],
[
79,
78
],
[
180,
88
],
[
73,
89
],
[
201,
91
],
[
177,
97
],
[
78,
98
],
[
183,
100
],
[
204,
104
],
[
180,
110
],
[
73,
111
],
[
177,
115
],
[
78,
116
],
[
119,
118
],
[
204,
118
],
[
191,
121
],
[
125,
124
],
[
130,
129
],
[
118,
137
],
[
124,
139
],
[
129,
143
],
[
189,
144
],
[
197,
146
],
[
152,
149
],
[
195,
150
],
[
198,
151
],
[
192,
151
],
[
157,
154
],
[
195,
155
],
[
195,
160
],
[
166,
165
],
[
195,
165
],
[
165,
170
],
[
200,
174
],
[
179,
177
],
[
179,
180
],
[
200,
183
],
[
185,
186
],
[
188,
189
],
[
191,
192
],
[
194,
195
],
[
197,
198
],
[
200,
201
],
[
203,
204
]
] | [
"import sys\ninput=sys.stdin.readline\nh,w,n=map(int,input().split())\nans=[(h-2)*(w-2)]+[0]*9\ns1=set()\ns2=set()\nfor i in range(n):\n a,b=map(int,input().split())\n s2.add(a*(10**10)+b)\n for j in range(3):\n for k in range(3):\n if 0<a-j<h-1 and 0<b-k<w-1:\n s1.add((a-j)*(10**10)+b-k)\nfor x in s1:\n now=0\n for i in range(3):\n for j in range(3):\n if (x+i*(10**10)+j) in s2:\n now+=1\n ans[now]+=1\nans[0]-=sum(ans[1:])\n[print(x) for x in 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",
"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",
"s1=set()",
"s1",
"set()",
"set",
"s2=set()",
"s2",
"set()",
"set",
"for i in range(n):\n a,b=map(int,input().split())\n s2.add(a*(10**10)+b)\n for j in range(3):\n for k in range(3):\n if 0<a-j<h-1 and 0<b-k<w-1:\n s1.add((a-j)*(10**10)+b-k)",
"i",
"range(n)",
"range",
"n",
"a,b=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"s2.add(a*(10**10)+b)",
"s2.add",
"s2",
"add",
"a*(10**10)+b",
"a*(10**10)",
"a",
"10**10",
"10",
"10",
"b",
"for j in range(3):\n for k in range(3):\n if 0<a-j<h-1 and 0<b-k<w-1:\n s1.add((a-j)*(10**10)+b-k)",
"j",
"range(3)",
"range",
"3",
"for k in range(3):\n if 0<a-j<h-1 and 0<b-k<w-1:\n s1.add((a-j)*(10**10)+b-k)",
"k",
"range(3)",
"range",
"3",
"if 0<a-j<h-1 and 0<b-k<w-1:\n s1.add((a-j)*(10**10)+b-k)",
"0<a-j<h-1 and 0<b-k<w-1",
"0<a-j<h-1",
"0<a-j",
"0",
"a-j",
"a",
"j",
"h-1",
"h",
"1",
"0<b-k<w-1",
"0<b-k",
"0",
"b-k",
"b",
"k",
"w-1",
"w",
"1",
"s1.add((a-j)*(10**10)+b-k)",
"s1.add",
"s1",
"add",
"(a-j)*(10**10)+b-k",
"(a-j)*(10**10)+b",
"(a-j)*(10**10)",
"a-j",
"a",
"j",
"10**10",
"10",
"10",
"b",
"k",
"for x in s1:\n now=0\n for i in range(3):\n for j in range(3):\n if (x+i*(10**10)+j) in s2:\n now+=1\n ans[now]+=1",
"x",
"s1",
"now=0",
"now",
"0",
"for i in range(3):\n for j in range(3):\n if (x+i*(10**10)+j) in s2:\n now+=1\n ",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n if (x+i*(10**10)+j) in s2:\n now+=1\n ",
"j",
"range(3)",
"range",
"3",
"if (x+i*(10**10)+j) in s2:\n now+=1\n ",
"(x+i*(10**10)+j) in s2",
"x+i*(10**10)+j",
"x+i*(10**10)",
"x",
"i*(10**10)",
"i",
"10**10",
"10",
"10",
"j",
"s2",
"now+=1",
"now",
"1",
"ans[now]+=1",
"ans[now]",
"ans",
"now",
"1",
"ans[0]-=sum(ans[1:])",
"ans[0]",
"ans",
"0",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"print(x) for x in ans",
"for x in ans",
"x",
"ans",
"for x in ans",
"print(x)",
"print",
"x",
"[print(x) for x in ans]",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"input=sys.stdin.readline",
"sys.stdin.readline",
"input",
"s2=set()",
"set()",
"s2",
"now=0",
"0",
"now",
"ans=[(h-2)*(w-2)]+[0]*9",
"[(h-2)*(w-2)]+[0]*9",
"ans",
"now+=1",
"1",
"now",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"s1=set()",
"set()",
"s1"
] | import sys
input=sys.stdin.readline
h,w,n=map(int,input().split())
ans=[(h-2)*(w-2)]+[0]*9
s1=set()
s2=set()
for i in range(n):
a,b=map(int,input().split())
s2.add(a*(10**10)+b)
for j in range(3):
for k in range(3):
if 0<a-j<h-1 and 0<b-k<w-1:
s1.add((a-j)*(10**10)+b-k)
for x in s1:
now=0
for i in range(3):
for j in range(3):
if (x+i*(10**10)+j) in s2:
now+=1
ans[now]+=1
ans[0]-=sum(ans[1:])
[print(x) for x in ans]
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
0,
13,
17,
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,
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,
0,
13,
17,
4,
18,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
0,
18,
13,
13,
17,
0,
13,
17,
14,
40,
13,
17,
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,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] | [
[
196,
2
],
[
196,
11
],
[
196,
12
],
[
178,
14
],
[
190,
17
],
[
187,
20
],
[
27,
26
],
[
197,
29
],
[
193,
31
],
[
193,
40
],
[
163,
42
],
[
202,
45
],
[
49,
48
],
[
164,
55
],
[
194,
55
],
[
164,
60
],
[
194,
60
],
[
170,
63
],
[
67,
66
],
[
203,
73
],
[
182,
73
],
[
203,
78
],
[
182,
78
],
[
185,
81
],
[
179,
85
],
[
172,
91
],
[
179,
95
],
[
166,
98
],
[
102,
101
],
[
173,
105
],
[
191,
105
],
[
179,
110
],
[
101,
111
],
[
179,
113
],
[
101,
115
],
[
175,
118
],
[
124,
121
],
[
188,
122
],
[
167,
123
],
[
200,
123
],
[
176,
123
],
[
199,
126
],
[
173,
130
],
[
191,
130
],
[
136,
133
],
[
188,
134
],
[
200,
135
],
[
176,
135
],
[
167,
135
],
[
141,
138
],
[
188,
139
],
[
170,
144
],
[
185,
147
],
[
188,
151
],
[
154,
153
],
[
188,
160
],
[
153,
161
],
[
163,
164
],
[
166,
167
],
[
196,
170
],
[
172,
173
],
[
175,
176
],
[
178,
179
],
[
193,
182
],
[
196,
185
],
[
187,
188
],
[
190,
191
],
[
193,
194
],
[
196,
197
],
[
199,
200
],
[
202,
203
]
] | [
"H, W, N = map(int, input().split())\nA = []\nL = 0\nans = [0] * 10\n\nfor i in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in range(max(0, a - 2), min(a + 1,H-2)):\n for j in range(max(0, b - 2), min(b + 1,W-2)):\n A.append((i, j))\n L += 1\n\nA.sort()\ncount = 1\nfor i in range(L - 1):\n if A[i] == A[i + 1]:\n count += 1\n else:\n ans[count] += 1\n count = 1\nif L >= 1:\n ans[count] += 1\n\nans[0] = (H - 2) * (W - 2) - sum(ans)\n\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",
"A = []",
"A",
"[]",
"L = 0",
"L",
"0",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for i in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in range(max(0, a - 2), min(a + 1,H-2)):\n for j in range(max(0, b - 2), min(b + 1,W-2)):\n A.append((i, j))\n 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 i in range(max(0, a - 2), min(a + 1,H-2)):\n for j in range(max(0, b - 2), min(b + 1,W-2)):\n A.append((i, j))\n L += 1",
"i",
"range(max(0, a - 2), min(a + 1,H-2))",
"range",
"max(0, a - 2)",
"max",
"0",
"a - 2",
"a",
"2",
"min(a + 1,H-2)",
"min",
"a + 1",
"a",
"1",
"H-2",
"H",
"2",
"for j in range(max(0, b - 2), min(b + 1,W-2)):\n A.append((i, j))\n L += 1",
"j",
"range(max(0, b - 2), min(b + 1,W-2))",
"range",
"max(0, b - 2)",
"max",
"0",
"b - 2",
"b",
"2",
"min(b + 1,W-2)",
"min",
"b + 1",
"b",
"1",
"W-2",
"W",
"2",
"A.append((i, j))",
"A.append",
"A",
"append",
"(i, j)",
"i",
"j",
"L += 1",
"L",
"1",
"A.sort()",
"A.sort",
"A",
"sort",
"count = 1",
"count",
"1",
"for i in range(L - 1):\n if A[i] == A[i + 1]:\n count += 1\n else:\n ans[count] += 1\n count = 1",
"i",
"range(L - 1)",
"range",
"L - 1",
"L",
"1",
"if A[i] == A[i + 1]:\n count += 1\n else:\n ans[count] += 1\n count = 1",
"A[i] == A[i + 1]",
"A[i]",
"A",
"i",
"A[i + 1]",
"A",
"i + 1",
"i",
"1",
"count += 1",
"count",
"1",
"ans[count] += 1",
"ans[count]",
"ans",
"count",
"1",
"count = 1",
"count",
"1",
"if L >= 1:\n ans[count] += 1",
"L >= 1",
"L",
"1",
"ans[count] += 1",
"ans[count]",
"ans",
"count",
"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",
"a -= 1",
"1",
"a",
"count = 1",
"1",
"count",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"L += 1",
"1",
"L",
"count += 1",
"1",
"count",
"A = []",
"[]",
"A",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"ans = [0] * 10",
"[0] * 10",
"ans",
"L = 0",
"0",
"L",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"count = 1",
"1",
"count",
"b -= 1",
"1",
"b"
] | H, W, N = map(int, input().split())
A = []
L = 0
ans = [0] * 10
for i in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
for i in range(max(0, a - 2), min(a + 1,H-2)):
for j in range(max(0, b - 2), min(b + 1,W-2)):
A.append((i, j))
L += 1
A.sort()
count = 1
for i in range(L - 1):
if A[i] == A[i + 1]:
count += 1
else:
ans[count] += 1
count = 1
if L >= 1:
ans[count] += 1
ans[0] = (H - 2) * (W - 2) - sum(ans)
for i in range(10):
print(ans[i]) |
[
7,
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,
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,
4,
18,
13,
13,
2,
2,
2,
13,
13,
13,
2,
13,
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,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
148,
2
],
[
148,
11
],
[
148,
12
],
[
136,
14
],
[
18,
17
],
[
149,
20
],
[
139,
22
],
[
139,
31
],
[
34,
33
],
[
40,
39
],
[
128,
51
],
[
39,
53
],
[
143,
55
],
[
140,
62
],
[
33,
64
],
[
134,
66
],
[
137,
70
],
[
140,
75
],
[
33,
76
],
[
143,
77
],
[
128,
79
],
[
39,
80
],
[
130,
84
],
[
137,
89
],
[
145,
91
],
[
131,
96
],
[
143,
103
],
[
134,
106
],
[
137,
112
],
[
115,
114
],
[
146,
123
],
[
114,
125
],
[
139,
128
],
[
130,
131
],
[
148,
134
],
[
136,
137
],
[
139,
140
],
[
148,
143
],
[
145,
146
],
[
148,
149
]
] | [
"H,W,N = map(int,input().split())\nNli=[]\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.append((b-n)*(H)+(a-m))\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",
"Nli=[]",
"Nli",
"[]",
"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.append((b-n)*(H)+(a-m))",
"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.append((b-n)*(H)+(a-m))",
"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.append((b-n)*(H)+(a-m))",
"m",
"range(-1,2)",
"range",
"-1",
"2",
"if 0<=a-2-m<H-2 and 0<=b-2-n<W-2:\n Nli.append((b-n)*(H)+(a-m))",
"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.append((b-n)*(H)+(a-m))",
"Nli.append",
"Nli",
"append",
"(b-n)*(H)+(a-m)",
"(b-n)*(H)",
"b-n",
"b",
"n",
"H",
"a-m",
"a",
"m",
"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",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"s = collections.Counter(Nli)",
"collections.Counter(Nli)",
"s",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"Nli=[]",
"[]",
"Nli",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"v = list(s.values())",
"list(s.values())",
"v",
"N = map(int,input().split())",
"map(int,input().split())",
"N"
] | H,W,N = map(int,input().split())
Nli=[]
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.append((b-n)*(H)+(a-m))
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,
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,
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,
40,
39,
13,
13,
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,
39,
13,
13,
13,
14,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
2,
13,
17,
2,
13,
2,
13,
17,
0,
13,
18,
13,
39,
13,
13,
0,
18,
13,
17,
17,
0,
18,
13,
13,
17,
28,
13,
4,
13,
17,
2,
17,
17,
0,
13,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13
] | [
[
186,
2
],
[
186,
11
],
[
186,
12
],
[
177,
14
],
[
18,
17
],
[
187,
20
],
[
183,
22
],
[
183,
31
],
[
189,
33
],
[
166,
35
],
[
190,
35
],
[
192,
37
],
[
184,
39
],
[
193,
39
],
[
43,
42
],
[
190,
49
],
[
166,
49
],
[
175,
53
],
[
190,
55
],
[
166,
55
],
[
59,
58
],
[
193,
65
],
[
184,
65
],
[
163,
69
],
[
193,
71
],
[
184,
71
],
[
178,
78
],
[
85,
80
],
[
178,
81
],
[
171,
87
],
[
96,
93
],
[
172,
94
],
[
175,
98
],
[
163,
101
],
[
107,
104
],
[
178,
104
],
[
175,
121
],
[
163,
126
],
[
168,
129
],
[
178,
131
],
[
139,
136
],
[
172,
137
],
[
144,
141
],
[
172,
142
],
[
169,
143
],
[
147,
146
],
[
180,
154
],
[
172,
156
],
[
146,
157
],
[
181,
160
],
[
186,
163
],
[
183,
166
],
[
168,
169
],
[
171,
172
],
[
186,
175
],
[
177,
178
],
[
180,
181
],
[
183,
184
],
[
186,
187
],
[
189,
190
],
[
192,
193
]
] | [
"H, W, N = map(int, input().split())\nS = {}\nfor i in range(N):\n a, b = map(int, input().split())\n a, b = a-1, b-1\n for i in range(max(0, a-1), min(H, a+2)):\n for j in range(max(0, b-1), min(W, b+2)):\n if (i, j) not in S: S[(i, j)] = 0\n S[(i, j)] += 1\nrs = [0]*10\nrs[0] = (H-2)*(W-2)\nfor (i, j) in S:\n if i > 0 and j > 0 and i < H-1 and j < W-1:\n n = S[(i, j)]\n #print(i, j, n)\n rs[0] -= 1\n rs[n] += 1\nfor j in range(0, 9+1):\n r = rs[j]\n print(r)",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"S = {}",
"S",
"{}",
"for i in range(N):\n a, b = map(int, input().split())\n a, b = a-1, b-1\n for i in range(max(0, a-1), min(H, a+2)):\n for j in range(max(0, b-1), min(W, b+2)):\n if (i, j) not in S: S[(i, j)] = 0\n S[(i, 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, b = a-1, b-1",
"a",
"a-1",
"a",
"1",
"b",
"b-1",
"b",
"1",
"for i in range(max(0, a-1), min(H, a+2)):\n for j in range(max(0, b-1), min(W, b+2)):\n if (i, j) not in S: S[(i, j)] = 0\n S[(i, j)] += 1",
"i",
"range(max(0, a-1), min(H, a+2))",
"range",
"max(0, a-1)",
"max",
"0",
"a-1",
"a",
"1",
"min(H, a+2)",
"min",
"H",
"a+2",
"a",
"2",
"for j in range(max(0, b-1), min(W, b+2)):\n if (i, j) not in S: S[(i, j)] = 0\n S[(i, j)] += 1",
"j",
"range(max(0, b-1), min(W, b+2))",
"range",
"max(0, b-1)",
"max",
"0",
"b-1",
"b",
"1",
"min(W, b+2)",
"min",
"W",
"b+2",
"b",
"2",
"if (i, j) not in S: S[(i, j)] = 0\n ",
"(i, j) not in S",
"(i, j)",
"i",
"j",
"S",
"S[(i, j)] += 1",
"S[(i, j)]",
"S",
"(i, j)",
"i",
"j",
"1",
"rs = [0]*10",
"rs",
"[0]*10",
"[0]",
"0",
"10",
"rs[0] = (H-2)*(W-2)",
"rs[0]",
"rs",
"0",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"for (i, j) in S:\n if i > 0 and j > 0 and i < H-1 and j < W-1:\n n = S[(i, j)]\n #print(i, j, n)\n rs[0] -= 1\n rs[n] += 1",
"(i, j)",
"i",
"j",
"S",
"if i > 0 and j > 0 and i < H-1 and j < W-1:\n n = S[(i, j)]\n #print(i, j, n)\n rs[0] -= 1\n rs[n] += 1",
"i > 0 and j > 0 and i < H-1 and j < W-1",
"i > 0 and j > 0 and i < H-1",
"i > 0 and j > 0",
"i > 0",
"i",
"0",
"j > 0",
"j",
"0",
"i < H-1",
"i",
"H-1",
"H",
"1",
"j < W-1",
"j",
"W-1",
"W",
"1",
"n = S[(i, j)]",
"n",
"S[(i, j)]",
"S",
"(i, j)",
"i",
"j",
"rs[0] -= 1",
"rs[0]",
"rs",
"0",
"1",
"rs[n] += 1",
"rs[n]",
"rs",
"n",
"1",
"for j in range(0, 9+1):\n r = rs[j]\n print(r)",
"j",
"range(0, 9+1)",
"range",
"0",
"9+1",
"9",
"1",
"r = rs[j]",
"r",
"rs[j]",
"rs",
"j",
"print(r)",
"print",
"r",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"n = S[(i, j)]",
"S[(i, j)]",
"n",
"rs = [0]*10",
"[0]*10",
"rs",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"S = {}",
"{}",
"S",
"r = rs[j]",
"rs[j]",
"r",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"a, b = a-1, b-1",
"a-1",
"a",
"b = a-1, b-1",
"b-1",
"b"
] | H, W, N = map(int, input().split())
S = {}
for i in range(N):
a, b = map(int, input().split())
a, b = a-1, b-1
for i in range(max(0, a-1), min(H, a+2)):
for j in range(max(0, b-1), min(W, b+2)):
if (i, j) not in S: S[(i, j)] = 0
S[(i, j)] += 1
rs = [0]*10
rs[0] = (H-2)*(W-2)
for (i, j) in S:
if i > 0 and j > 0 and i < H-1 and j < W-1:
n = S[(i, j)]
#print(i, j, n)
rs[0] -= 1
rs[n] += 1
for j in range(0, 9+1):
r = rs[j]
print(r)
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
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,
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,
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,
2,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
18,
13
] | [
[
160,
4
],
[
157,
12
],
[
161,
19
],
[
157,
21
],
[
157,
22
],
[
26,
25
],
[
158,
28
],
[
161,
38
],
[
154,
41
],
[
139,
44
],
[
54,
53
],
[
59,
58
],
[
53,
69
],
[
149,
71
],
[
58,
78
],
[
152,
80
],
[
92,
83
],
[
140,
84
],
[
53,
88
],
[
58,
91
],
[
136,
94
],
[
145,
100
],
[
104,
103
],
[
140,
106
],
[
112,
109
],
[
137,
110
],
[
103,
111
],
[
142,
114
],
[
120,
117
],
[
137,
118
],
[
149,
123
],
[
152,
126
],
[
143,
128
],
[
146,
128
],
[
131,
130
],
[
137,
130
],
[
130,
134
],
[
136,
137
],
[
139,
140
],
[
142,
143
],
[
145,
146
],
[
157,
149
],
[
157,
152
],
[
154,
155
],
[
157,
158
],
[
160,
161
]
] | [
"# python3 (3.4.3)\nimport sys\ninput = sys.stdin.readline\n\n# main\nfrom collections import defaultdict\nH,W,N = map(int,input().split())\nAB = [list(map(int,input().split())) for _ in range(N)]\n\ndic = defaultdict(int)\nfor a,b in AB:\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 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)",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"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)]",
"dic = defaultdict(int)",
"dic",
"defaultdict(int)",
"defaultdict",
"int",
"for a,b in AB:\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 dic[(a-dh,b-dw)] += 1",
"a",
"b",
"AB",
"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 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 dic[(a-dh,b-dw)] += 1",
"dw",
"range(3)",
"range",
"3",
"if 0 < a-dh <= H-2 and 0 < b-dw <= W-2:\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",
"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",
"Ans = [0]*10",
"[0]*10",
"Ans",
"dic = defaultdict(int)",
"defaultdict(int)",
"dic",
"total += 1",
"1",
"total",
"total = 0",
"0",
"total",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"AB = [list(map(int,input().split())) for _ in range(N)]",
"[list(map(int,input().split())) for _ in range(N)]",
"AB",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input"
] | # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
from collections import defaultdict
H,W,N = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
dic = defaultdict(int)
for a,b in AB:
for dh in range(3):
for dw in range(3):
if 0 < a-dh <= H-2 and 0 < b-dw <= W-2:
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,
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,
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,
0,
13,
2,
13,
13,
13,
2,
13,
13,
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,
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,
2,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] | [
[
139,
5
],
[
136,
12
],
[
140,
19
],
[
136,
21
],
[
136,
22
],
[
145,
24
],
[
30,
29
],
[
137,
32
],
[
154,
34
],
[
140,
41
],
[
154,
43
],
[
46,
45
],
[
51,
50
],
[
151,
55
],
[
155,
57
],
[
45,
58
],
[
130,
59
],
[
149,
61
],
[
50,
62
],
[
152,
68
],
[
134,
70
],
[
131,
75
],
[
128,
77
],
[
85,
80
],
[
146,
81
],
[
142,
87
],
[
146,
97
],
[
103,
100
],
[
143,
101
],
[
108,
105
],
[
143,
106
],
[
134,
111
],
[
128,
114
],
[
143,
118
],
[
143,
122
],
[
125,
124
],
[
136,
128
],
[
130,
131
],
[
136,
134
],
[
136,
137
],
[
139,
140
],
[
142,
143
],
[
145,
146
],
[
154,
149
],
[
151,
152
],
[
154,
155
]
] | [
"from collections import defaultdict\nimport sys\ninput = sys.stdin.readline\n\nH, W, N = map(int, input().split())\ncount = defaultdict(int)\nfor _ in range(N):\n a, b = map(int, input().split())\n for da in range(3):\n for db in range(3):\n na, nb = a - da, b - db\n if 1 <= na <= H - 2 and 1 <= nb <= W - 2:\n count[(na, nb)] += 1\nans = [0] * 10\nfor k, v in count.items():\n ans[v] += 1\nans[0] = (H-2) * (W-2) - sum(ans)\nprint(*ans, sep='\\n')",
"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",
"count = defaultdict(int)",
"count",
"defaultdict(int)",
"defaultdict",
"int",
"for _ in range(N):\n a, b = map(int, input().split())\n for da in range(3):\n for db in range(3):\n na, nb = a - da, b - db\n if 1 <= na <= H - 2 and 1 <= nb <= W - 2:\n count[(na, nb)] += 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 da in range(3):\n for db in range(3):\n na, nb = a - da, b - db\n if 1 <= na <= H - 2 and 1 <= nb <= W - 2:\n count[(na, nb)] += 1",
"da",
"range(3)",
"range",
"3",
"for db in range(3):\n na, nb = a - da, b - db\n if 1 <= na <= H - 2 and 1 <= nb <= W - 2:\n count[(na, nb)] += 1",
"db",
"range(3)",
"range",
"3",
"na, nb = a - da, b - db",
"na",
"a - da",
"a",
"da",
"nb",
"b - db",
"b",
"db",
"if 1 <= na <= H - 2 and 1 <= nb <= W - 2:\n count[(na, nb)] += 1",
"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",
"count[(na, nb)] += 1",
"count[(na, nb)]",
"count",
"(na, nb)",
"na",
"nb",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for k, v in count.items():\n ans[v] += 1",
"k",
"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'",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"nb = a - da, b - db",
"b - db",
"nb",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"ans = [0] * 10",
"[0] * 10",
"ans",
"count = defaultdict(int)",
"defaultdict(int)",
"count",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"na, nb = a - da, b - db",
"a - da",
"na",
"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())
count = defaultdict(int)
for _ in range(N):
a, b = map(int, input().split())
for da in range(3):
for db in range(3):
na, nb = a - da, b - db
if 1 <= na <= H - 2 and 1 <= nb <= W - 2:
count[(na, nb)] += 1
ans = [0] * 10
for k, 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,
17,
28,
13,
4,
13,
13,
0,
13,
18,
13,
13,
13,
14,
2,
40,
2,
13,
17,
17,
40,
2,
13,
17,
17,
14,
40,
39,
2,
13,
17,
2,
13,
17,
13,
0,
18,
13,
39,
2,
13,
17,
2,
13,
17,
17,
0,
18,
13,
39,
2,
13,
17,
2,
13,
17,
17,
14,
2,
2,
40,
2,
13,
17,
17,
40,
2,
13,
17,
17,
40,
2,
13,
17,
13,
14,
40,
39,
2,
13,
17,
2,
13,
17,
13,
0,
18,
13,
39,
2,
13,
17,
2,
13,
17,
17,
0,
18,
13,
39,
2,
13,
17,
2,
13,
17,
17,
14,
2,
40,
2,
13,
17,
17,
40,
2,
13,
17,
13,
14,
40,
39,
2,
13,
17,
13,
13,
0,
18,
13,
39,
2,
13,
17,
13,
17,
0,
18,
13,
39,
2,
13,
17,
13,
17,
14,
2,
2,
40,
2,
13,
17,
17,
40,
2,
13,
17,
17,
40,
2,
13,
17,
13,
14,
40,
39,
2,
13,
17,
2,
13,
17,
13,
0,
18,
13,
39,
2,
13,
17,
2,
13,
17,
17,
0,
18,
13,
39,
2,
13,
17,
2,
13,
17,
17,
14,
2,
2,
2,
40,
2,
13,
17,
17,
40,
2,
13,
17,
17,
40,
2,
13,
17,
13,
40,
2,
13,
17,
13,
14,
40,
39,
2,
13,
17,
2,
13,
17,
13,
0,
18,
13,
39,
2,
13,
17,
2,
13,
17,
17,
0,
18,
13,
39,
2,
13,
17,
2,
13,
17,
17,
14,
2,
2,
40,
2,
13,
17,
17,
40,
2,
13,
17,
13,
40,
2,
13,
17,
13,
14,
40,
39,
2,
13,
17,
13,
13,
0,
18,
13,
39,
2,
13,
17,
13,
17,
0,
18,
13,
39,
2,
13,
17,
13,
17,
14,
2,
40,
2,
13,
17,
17,
40,
2,
13,
17,
13,
14,
40,
39,
13,
2,
13,
17,
13,
0,
18,
13,
39,
13,
2,
13,
17,
17,
0,
18,
13,
39,
13,
2,
13,
17,
17,
14,
2,
2,
40,
2,
13,
17,
17,
40,
2,
13,
17,
13,
40,
2,
13,
17,
13,
14,
40,
39,
13,
2,
13,
17,
13,
0,
18,
13,
39,
13,
2,
13,
17,
17,
0,
18,
13,
39,
13,
2,
13,
17,
17,
14,
2,
40,
2,
13,
17,
13,
40,
2,
13,
17,
13,
14,
40,
39,
13,
13,
13,
0,
18,
13,
39,
13,
13,
17,
0,
18,
13,
39,
13,
13,
17,
41,
28,
13,
4,
13,
17,
4,
13,
17,
0,
13,
13,
28,
13,
13,
0,
18,
13,
18,
13,
13,
17,
0,
13,
17,
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,
13,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13
] | [
[
524,
2
],
[
524,
11
],
[
524,
12
],
[
16,
15
],
[
510,
18
],
[
506,
31
],
[
527,
34
],
[
38,
37
],
[
510,
40
],
[
530,
42
],
[
507,
44
],
[
37,
45
],
[
530,
46
],
[
519,
51
],
[
531,
56
],
[
519,
63
],
[
531,
66
],
[
528,
68
],
[
79,
70
],
[
528,
71
],
[
519,
74
],
[
531,
77
],
[
90,
81
],
[
528,
82
],
[
519,
85
],
[
531,
88
],
[
519,
96
],
[
531,
101
],
[
531,
106
],
[
525,
108
],
[
519,
113
],
[
531,
116
],
[
528,
118
],
[
129,
120
],
[
528,
121
],
[
519,
124
],
[
531,
127
],
[
140,
131
],
[
528,
132
],
[
519,
135
],
[
531,
138
],
[
519,
145
],
[
531,
150
],
[
525,
152
],
[
519,
157
],
[
528,
160
],
[
169,
162
],
[
528,
163
],
[
519,
166
],
[
178,
171
],
[
528,
172
],
[
519,
175
],
[
519,
184
],
[
531,
189
],
[
519,
194
],
[
516,
196
],
[
519,
201
],
[
531,
204
],
[
528,
206
],
[
217,
208
],
[
528,
209
],
[
519,
212
],
[
531,
215
],
[
228,
219
],
[
528,
220
],
[
519,
223
],
[
531,
226
],
[
519,
235
],
[
531,
240
],
[
519,
245
],
[
516,
247
],
[
531,
250
],
[
525,
252
],
[
519,
257
],
[
531,
260
],
[
528,
262
],
[
273,
264
],
[
528,
265
],
[
519,
268
],
[
531,
271
],
[
284,
275
],
[
528,
276
],
[
519,
279
],
[
531,
282
],
[
519,
290
],
[
519,
295
],
[
516,
297
],
[
531,
300
],
[
525,
302
],
[
519,
307
],
[
528,
310
],
[
319,
312
],
[
528,
313
],
[
519,
316
],
[
328,
321
],
[
528,
322
],
[
519,
325
],
[
531,
333
],
[
519,
338
],
[
516,
340
],
[
531,
346
],
[
528,
348
],
[
357,
350
],
[
528,
351
],
[
531,
355
],
[
366,
359
],
[
528,
360
],
[
531,
364
],
[
531,
372
],
[
519,
377
],
[
516,
379
],
[
531,
382
],
[
525,
384
],
[
531,
390
],
[
528,
392
],
[
401,
394
],
[
528,
395
],
[
531,
399
],
[
410,
403
],
[
528,
404
],
[
531,
408
],
[
519,
415
],
[
516,
417
],
[
531,
420
],
[
525,
422
],
[
528,
428
],
[
435,
430
],
[
528,
431
],
[
442,
437
],
[
528,
438
],
[
446,
445
],
[
445,
450
],
[
503,
453
],
[
457,
456
],
[
528,
456
],
[
464,
459
],
[
504,
460
],
[
528,
462
],
[
456,
463
],
[
512,
466
],
[
470,
469
],
[
521,
475
],
[
504,
477
],
[
469,
478
],
[
483,
480
],
[
504,
481
],
[
516,
486
],
[
525,
489
],
[
522,
491
],
[
513,
491
],
[
494,
493
],
[
504,
500
],
[
493,
501
],
[
503,
504
],
[
506,
507
],
[
524,
510
],
[
512,
513
],
[
524,
516
],
[
530,
519
],
[
521,
522
],
[
524,
525
],
[
527,
528
],
[
530,
531
]
] | [
"H,W,N = map(int,input().split())\nX = [list(map(int,input().split())) for _ in range(N)]\nC = {}\nfor i in range(N):\n a,b = X[i]\n if a-2>=1 and b-2>=1:\n if (a-2,b-2) not in C:\n C[(a-2,b-2)] = 0\n C[(a-2,b-2)] += 1\n if a-2>=1 and b-1>=1 and b+1<=W:\n if (a-2,b-1) not in C:\n C[(a-2,b-1)] = 0\n C[(a-2,b-1)] += 1\n if a-2>=1 and b+2<=W:\n if (a-2,b) not in C:\n C[(a-2,b)] = 0\n C[(a-2,b)] += 1\n if a-1>=1 and b-2>=1 and a+1<=H:\n if (a-1,b-2) not in C:\n C[(a-1,b-2)] = 0\n C[(a-1,b-2)] += 1\n if a-1>=1 and b-1>=1 and a+1<=H and b+1<=W:\n if (a-1,b-1) not in C:\n C[(a-1,b-1)] = 0\n C[(a-1,b-1)] += 1\n if a-1>=1 and a+1<=H and b+2<=W:\n if (a-1,b) not in C:\n C[(a-1,b)] = 0\n C[(a-1,b)] += 1\n if b-2>=1 and a+2<=H:\n if (a,b-2) not in C:\n C[(a,b-2)] = 0\n C[(a,b-2)] += 1\n if b-1>=1 and a+2<=H and b+1<=W:\n if (a,b-1) not in C:\n C[(a,b-1)] = 0\n C[(a,b-1)] += 1\n if a+2<=H and b+2<=W:\n if (a,b) not in C:\n C[(a,b)] = 0\n C[(a,b)] += 1\nD = {i:0 for i in range(10)}\nfor c in C:\n D[C[c]] += 1\ncnt = 0\nfor i in range(1,10):\n cnt += D[i]\nD[0] = (H-2)*(W-2)-cnt\nfor i in range(10):\n print(D[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",
"X = [list(map(int,input().split())) for _ in range(N)]",
"X",
"[list(map(int,input().split())) for _ in range(N)]",
"C = {}",
"C",
"{}",
"for i in range(N):\n a,b = X[i]\n if a-2>=1 and b-2>=1:\n if (a-2,b-2) not in C:\n C[(a-2,b-2)] = 0\n C[(a-2,b-2)] += 1\n if a-2>=1 and b-1>=1 and b+1<=W:\n if (a-2,b-1) not in C:\n C[(a-2,b-1)] = 0\n C[(a-2,b-1)] += 1\n if a-2>=1 and b+2<=W:\n if (a-2,b) not in C:\n C[(a-2,b)] = 0\n C[(a-2,b)] += 1\n if a-1>=1 and b-2>=1 and a+1<=H:\n if (a-1,b-2) not in C:\n C[(a-1,b-2)] = 0\n C[(a-1,b-2)] += 1\n if a-1>=1 and b-1>=1 and a+1<=H and b+1<=W:\n if (a-1,b-1) not in C:\n C[(a-1,b-1)] = 0\n C[(a-1,b-1)] += 1\n if a-1>=1 and a+1<=H and b+2<=W:\n if (a-1,b) not in C:\n C[(a-1,b)] = 0\n C[(a-1,b)] += 1\n if b-2>=1 and a+2<=H:\n if (a,b-2) not in C:\n C[(a,b-2)] = 0\n C[(a,b-2)] += 1\n if b-1>=1 and a+2<=H and b+1<=W:\n if (a,b-1) not in C:\n C[(a,b-1)] = 0\n C[(a,b-1)] += 1\n if a+2<=H and b+2<=W:\n if (a,b) not in C:\n C[(a,b)] = 0\n C[(a,b)] += 1",
"i",
"range(N)",
"range",
"N",
"a,b = X[i]",
"a",
"X[i]",
"X",
"i",
"b",
"if a-2>=1 and b-2>=1:\n if (a-2,b-2) not in C:\n C[(a-2,b-2)] = 0\n C[(a-2,b-2)] += 1\n ",
"a-2>=1 and b-2>=1",
"a-2>=1",
"a-2",
"a",
"2",
"1",
"b-2>=1",
"b-2",
"b",
"2",
"1",
"if (a-2,b-2) not in C:\n C[(a-2,b-2)] = 0\n ",
"(a-2,b-2) not in C",
"(a-2,b-2)",
"a-2",
"a",
"2",
"b-2",
"b",
"2",
"C",
"C[(a-2,b-2)] = 0",
"C[(a-2,b-2)]",
"C",
"(a-2,b-2)",
"a-2",
"a",
"2",
"b-2",
"b",
"2",
"0",
"C[(a-2,b-2)] += 1",
"C[(a-2,b-2)]",
"C",
"(a-2,b-2)",
"a-2",
"a",
"2",
"b-2",
"b",
"2",
"1",
"if a-2>=1 and b-1>=1 and b+1<=W:\n if (a-2,b-1) not in C:\n C[(a-2,b-1)] = 0\n C[(a-2,b-1)] += 1\n ",
"a-2>=1 and b-1>=1 and b+1<=W",
"a-2>=1 and b-1>=1",
"a-2>=1",
"a-2",
"a",
"2",
"1",
"b-1>=1",
"b-1",
"b",
"1",
"1",
"b+1<=W",
"b+1",
"b",
"1",
"W",
"if (a-2,b-1) not in C:\n C[(a-2,b-1)] = 0\n ",
"(a-2,b-1) not in C",
"(a-2,b-1)",
"a-2",
"a",
"2",
"b-1",
"b",
"1",
"C",
"C[(a-2,b-1)] = 0",
"C[(a-2,b-1)]",
"C",
"(a-2,b-1)",
"a-2",
"a",
"2",
"b-1",
"b",
"1",
"0",
"C[(a-2,b-1)] += 1",
"C[(a-2,b-1)]",
"C",
"(a-2,b-1)",
"a-2",
"a",
"2",
"b-1",
"b",
"1",
"1",
"if a-2>=1 and b+2<=W:\n if (a-2,b) not in C:\n C[(a-2,b)] = 0\n C[(a-2,b)] += 1\n ",
"a-2>=1 and b+2<=W",
"a-2>=1",
"a-2",
"a",
"2",
"1",
"b+2<=W",
"b+2",
"b",
"2",
"W",
"if (a-2,b) not in C:\n C[(a-2,b)] = 0\n ",
"(a-2,b) not in C",
"(a-2,b)",
"a-2",
"a",
"2",
"b",
"C",
"C[(a-2,b)] = 0",
"C[(a-2,b)]",
"C",
"(a-2,b)",
"a-2",
"a",
"2",
"b",
"0",
"C[(a-2,b)] += 1",
"C[(a-2,b)]",
"C",
"(a-2,b)",
"a-2",
"a",
"2",
"b",
"1",
"if a-1>=1 and b-2>=1 and a+1<=H:\n if (a-1,b-2) not in C:\n C[(a-1,b-2)] = 0\n C[(a-1,b-2)] += 1\n ",
"a-1>=1 and b-2>=1 and a+1<=H",
"a-1>=1 and b-2>=1",
"a-1>=1",
"a-1",
"a",
"1",
"1",
"b-2>=1",
"b-2",
"b",
"2",
"1",
"a+1<=H",
"a+1",
"a",
"1",
"H",
"if (a-1,b-2) not in C:\n C[(a-1,b-2)] = 0\n ",
"(a-1,b-2) not in C",
"(a-1,b-2)",
"a-1",
"a",
"1",
"b-2",
"b",
"2",
"C",
"C[(a-1,b-2)] = 0",
"C[(a-1,b-2)]",
"C",
"(a-1,b-2)",
"a-1",
"a",
"1",
"b-2",
"b",
"2",
"0",
"C[(a-1,b-2)] += 1",
"C[(a-1,b-2)]",
"C",
"(a-1,b-2)",
"a-1",
"a",
"1",
"b-2",
"b",
"2",
"1",
"if a-1>=1 and b-1>=1 and a+1<=H and b+1<=W:\n if (a-1,b-1) not in C:\n C[(a-1,b-1)] = 0\n C[(a-1,b-1)] += 1\n ",
"a-1>=1 and b-1>=1 and a+1<=H and b+1<=W",
"a-1>=1 and b-1>=1 and a+1<=H",
"a-1>=1 and b-1>=1",
"a-1>=1",
"a-1",
"a",
"1",
"1",
"b-1>=1",
"b-1",
"b",
"1",
"1",
"a+1<=H",
"a+1",
"a",
"1",
"H",
"b+1<=W",
"b+1",
"b",
"1",
"W",
"if (a-1,b-1) not in C:\n C[(a-1,b-1)] = 0\n ",
"(a-1,b-1) not in C",
"(a-1,b-1)",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"C",
"C[(a-1,b-1)] = 0",
"C[(a-1,b-1)]",
"C",
"(a-1,b-1)",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"0",
"C[(a-1,b-1)] += 1",
"C[(a-1,b-1)]",
"C",
"(a-1,b-1)",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"1",
"if a-1>=1 and a+1<=H and b+2<=W:\n if (a-1,b) not in C:\n C[(a-1,b)] = 0\n C[(a-1,b)] += 1\n ",
"a-1>=1 and a+1<=H and b+2<=W",
"a-1>=1 and a+1<=H",
"a-1>=1",
"a-1",
"a",
"1",
"1",
"a+1<=H",
"a+1",
"a",
"1",
"H",
"b+2<=W",
"b+2",
"b",
"2",
"W",
"if (a-1,b) not in C:\n C[(a-1,b)] = 0\n ",
"(a-1,b) not in C",
"(a-1,b)",
"a-1",
"a",
"1",
"b",
"C",
"C[(a-1,b)] = 0",
"C[(a-1,b)]",
"C",
"(a-1,b)",
"a-1",
"a",
"1",
"b",
"0",
"C[(a-1,b)] += 1",
"C[(a-1,b)]",
"C",
"(a-1,b)",
"a-1",
"a",
"1",
"b",
"1",
"if b-2>=1 and a+2<=H:\n if (a,b-2) not in C:\n C[(a,b-2)] = 0\n C[(a,b-2)] += 1\n ",
"b-2>=1 and a+2<=H",
"b-2>=1",
"b-2",
"b",
"2",
"1",
"a+2<=H",
"a+2",
"a",
"2",
"H",
"if (a,b-2) not in C:\n C[(a,b-2)] = 0\n ",
"(a,b-2) not in C",
"(a,b-2)",
"a",
"b-2",
"b",
"2",
"C",
"C[(a,b-2)] = 0",
"C[(a,b-2)]",
"C",
"(a,b-2)",
"a",
"b-2",
"b",
"2",
"0",
"C[(a,b-2)] += 1",
"C[(a,b-2)]",
"C",
"(a,b-2)",
"a",
"b-2",
"b",
"2",
"1",
"if b-1>=1 and a+2<=H and b+1<=W:\n if (a,b-1) not in C:\n C[(a,b-1)] = 0\n C[(a,b-1)] += 1\n ",
"b-1>=1 and a+2<=H and b+1<=W",
"b-1>=1 and a+2<=H",
"b-1>=1",
"b-1",
"b",
"1",
"1",
"a+2<=H",
"a+2",
"a",
"2",
"H",
"b+1<=W",
"b+1",
"b",
"1",
"W",
"if (a,b-1) not in C:\n C[(a,b-1)] = 0\n ",
"(a,b-1) not in C",
"(a,b-1)",
"a",
"b-1",
"b",
"1",
"C",
"C[(a,b-1)] = 0",
"C[(a,b-1)]",
"C",
"(a,b-1)",
"a",
"b-1",
"b",
"1",
"0",
"C[(a,b-1)] += 1",
"C[(a,b-1)]",
"C",
"(a,b-1)",
"a",
"b-1",
"b",
"1",
"1",
"if a+2<=H and b+2<=W:\n if (a,b) not in C:\n C[(a,b)] = 0\n C[(a,b)] += 1",
"a+2<=H and b+2<=W",
"a+2<=H",
"a+2",
"a",
"2",
"H",
"b+2<=W",
"b+2",
"b",
"2",
"W",
"if (a,b) not in C:\n C[(a,b)] = 0\n ",
"(a,b) not in C",
"(a,b)",
"a",
"b",
"C",
"C[(a,b)] = 0",
"C[(a,b)]",
"C",
"(a,b)",
"a",
"b",
"0",
"C[(a,b)] += 1",
"C[(a,b)]",
"C",
"(a,b)",
"a",
"b",
"1",
"i:0 for i in range(10)",
"for i in range(10)",
"i",
"range(10)",
"range",
"10",
"for i in range(10)",
"i",
"0",
"D = {i:0 for i in range(10)}",
"D",
"{i:0 for i in range(10)}",
"for c in C:\n D[C[c]] += 1",
"c",
"C",
"D[C[c]] += 1",
"D[C[c]]",
"D",
"C[c]",
"C",
"c",
"1",
"cnt = 0",
"cnt",
"0",
"for i in range(1,10):\n cnt += D[i]",
"i",
"range(1,10)",
"range",
"1",
"10",
"cnt += D[i]",
"cnt",
"D[i]",
"D",
"i",
"D[0] = (H-2)*(W-2)-cnt",
"D[0]",
"D",
"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(D[i])",
"i",
"range(10)",
"range",
"10",
"print(D[i])",
"print",
"D[i]",
"D",
"i",
"D = {i:0 for i in range(10)}",
"{i:0 for i in range(10)}",
"D",
"X = [list(map(int,input().split())) for _ in range(N)]",
"[list(map(int,input().split())) for _ in range(N)]",
"X",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"cnt = 0",
"0",
"cnt",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"a,b = X[i]",
"X[i]",
"a",
"cnt += D[i]",
"D[i]",
"cnt",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"C = {}",
"{}",
"C",
"b = X[i]",
"X[i]",
"b"
] | H,W,N = map(int,input().split())
X = [list(map(int,input().split())) for _ in range(N)]
C = {}
for i in range(N):
a,b = X[i]
if a-2>=1 and b-2>=1:
if (a-2,b-2) not in C:
C[(a-2,b-2)] = 0
C[(a-2,b-2)] += 1
if a-2>=1 and b-1>=1 and b+1<=W:
if (a-2,b-1) not in C:
C[(a-2,b-1)] = 0
C[(a-2,b-1)] += 1
if a-2>=1 and b+2<=W:
if (a-2,b) not in C:
C[(a-2,b)] = 0
C[(a-2,b)] += 1
if a-1>=1 and b-2>=1 and a+1<=H:
if (a-1,b-2) not in C:
C[(a-1,b-2)] = 0
C[(a-1,b-2)] += 1
if a-1>=1 and b-1>=1 and a+1<=H and b+1<=W:
if (a-1,b-1) not in C:
C[(a-1,b-1)] = 0
C[(a-1,b-1)] += 1
if a-1>=1 and a+1<=H and b+2<=W:
if (a-1,b) not in C:
C[(a-1,b)] = 0
C[(a-1,b)] += 1
if b-2>=1 and a+2<=H:
if (a,b-2) not in C:
C[(a,b-2)] = 0
C[(a,b-2)] += 1
if b-1>=1 and a+2<=H and b+1<=W:
if (a,b-1) not in C:
C[(a,b-1)] = 0
C[(a,b-1)] += 1
if a+2<=H and b+2<=W:
if (a,b) not in C:
C[(a,b)] = 0
C[(a,b)] += 1
D = {i:0 for i in range(10)}
for c in C:
D[C[c]] += 1
cnt = 0
for i in range(1,10):
cnt += D[i]
D[0] = (H-2)*(W-2)-cnt
for i in range(10):
print(D[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,
15,
0,
13,
4,
13,
13,
28,
13,
13,
13,
28,
13,
39,
2,
13,
17,
13,
2,
13,
17,
28,
13,
39,
2,
13,
17,
13,
2,
13,
17,
14,
2,
2,
40,
17,
13,
13,
2,
40,
17,
13,
13,
0,
18,
13,
39,
13,
13,
17,
0,
13,
4,
13,
4,
18,
13,
13,
0,
13,
2,
39,
17,
17,
28,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] | [
[
147,
2
],
[
147,
11
],
[
147,
12
],
[
16,
15
],
[
136,
18
],
[
141,
31
],
[
144,
36
],
[
46,
45
],
[
56,
55
],
[
45,
69
],
[
148,
70
],
[
55,
74
],
[
133,
75
],
[
82,
77
],
[
145,
78
],
[
138,
84
],
[
145,
89
],
[
150,
92
],
[
99,
98
],
[
139,
98
],
[
104,
101
],
[
151,
102
],
[
98,
103
],
[
139,
105
],
[
98,
106
],
[
111,
108
],
[
151,
109
],
[
148,
114
],
[
133,
117
],
[
139,
123
],
[
127,
126
],
[
151,
126
],
[
126,
130
],
[
147,
133
],
[
147,
136
],
[
138,
139
],
[
141,
142
],
[
144,
145
],
[
147,
148
],
[
150,
151
]
] | [
"H,W,N=map(int,input().split())\nAB=[list(map(int,input().split())) for i in range(N)]\n\nfrom collections import defaultdict\nfrom collections import Counter\n\nANS = defaultdict(int)\n\nfor a,b in AB:\n for i in [a-1,a,a+1]:\n for j in [b-1,b,b+1]:\n if 2<=i<H and 2<=j<W:\n ANS[(i,j)]+=1\n\ncounter=Counter(ANS.values())\nANSLIST=[0]*10\nfor c in counter:\n ANSLIST[c]=counter[c]\nANSLIST[0]=(H-2)*(W-2)-sum(counter.values())\n\nfor a in ANSLIST:\n print(a)",
"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)]",
"from collections import defaultdict",
"from collections import Counter",
"ANS = defaultdict(int)",
"ANS",
"defaultdict(int)",
"defaultdict",
"int",
"for a,b in AB:\n for i in [a-1,a,a+1]:\n for j in [b-1,b,b+1]:\n if 2<=i<H and 2<=j<W:\n ANS[(i,j)]+=1",
"a",
"b",
"AB",
"for i in [a-1,a,a+1]:\n for j in [b-1,b,b+1]:\n if 2<=i<H and 2<=j<W:\n ANS[(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]:\n if 2<=i<H and 2<=j<W:\n ANS[(i,j)]+=1",
"j",
"[b-1,b,b+1]",
"b-1",
"b",
"1",
"b",
"b+1",
"b",
"1",
"if 2<=i<H and 2<=j<W:\n ANS[(i,j)]+=1",
"2<=i<H and 2<=j<W",
"2<=i<H",
"2<=i",
"2",
"i",
"H",
"2<=j<W",
"2<=j",
"2",
"j",
"W",
"ANS[(i,j)]+=1",
"ANS[(i,j)]",
"ANS",
"(i,j)",
"i",
"j",
"1",
"counter=Counter(ANS.values())",
"counter",
"Counter(ANS.values())",
"Counter",
"ANS.values()",
"ANS.values",
"ANS",
"values",
"ANSLIST=[0]*10",
"ANSLIST",
"[0]*10",
"[0]",
"0",
"10",
"for c in counter:\n ANSLIST[c]=counter[c]",
"c",
"counter",
"ANSLIST[c]=counter[c]",
"ANSLIST[c]",
"ANSLIST",
"c",
"counter[c]",
"counter",
"c",
"ANSLIST[0]=(H-2)*(W-2)-sum(counter.values())",
"ANSLIST[0]",
"ANSLIST",
"0",
"(H-2)*(W-2)-sum(counter.values())",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(counter.values())",
"sum",
"counter.values()",
"counter.values",
"counter",
"values",
"for a in ANSLIST:\n print(a)",
"a",
"ANSLIST",
"print(a)",
"print",
"a",
"W,N=map(int,input().split())",
"map(int,input().split())",
"W",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"counter=Counter(ANS.values())",
"Counter(ANS.values())",
"counter",
"AB=[list(map(int,input().split())) for i in range(N)]",
"[list(map(int,input().split())) for i in range(N)]",
"AB",
"ANS = defaultdict(int)",
"defaultdict(int)",
"ANS",
"H,W,N=map(int,input().split())",
"map(int,input().split())",
"H",
"ANSLIST=[0]*10",
"[0]*10",
"ANSLIST"
] | H,W,N=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(N)]
from collections import defaultdict
from collections import Counter
ANS = defaultdict(int)
for a,b in AB:
for i in [a-1,a,a+1]:
for j in [b-1,b,b+1]:
if 2<=i<H and 2<=j<W:
ANS[(i,j)]+=1
counter=Counter(ANS.values())
ANSLIST=[0]*10
for c in counter:
ANSLIST[c]=counter[c]
ANSLIST[0]=(H-2)*(W-2)-sum(counter.values())
for a in ANSLIST:
print(a) |
[
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,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] | [
[
169,
2
],
[
169,
11
],
[
169,
12
],
[
157,
14
],
[
18,
17
],
[
167,
20
],
[
175,
22
],
[
175,
31
],
[
178,
33
],
[
172,
36
],
[
40,
39
],
[
46,
45
],
[
179,
56
],
[
161,
56
],
[
39,
57
],
[
179,
61
],
[
161,
61
],
[
39,
62
],
[
170,
64
],
[
173,
68
],
[
176,
68
],
[
45,
69
],
[
173,
73
],
[
176,
73
],
[
45,
74
],
[
164,
76
],
[
179,
83
],
[
161,
83
],
[
39,
84
],
[
173,
86
],
[
176,
86
],
[
45,
87
],
[
158,
88
],
[
99,
90
],
[
158,
91
],
[
179,
94
],
[
161,
94
],
[
39,
95
],
[
173,
97
],
[
176,
97
],
[
45,
98
],
[
110,
101
],
[
158,
102
],
[
179,
105
],
[
161,
105
],
[
39,
106
],
[
173,
108
],
[
176,
108
],
[
45,
109
],
[
154,
112
],
[
119,
118
],
[
158,
121
],
[
127,
124
],
[
155,
125
],
[
118,
126
],
[
132,
129
],
[
155,
130
],
[
170,
135
],
[
164,
138
],
[
155,
142
],
[
145,
144
],
[
155,
151
],
[
144,
152
],
[
154,
155
],
[
157,
158
],
[
175,
161
],
[
169,
164
],
[
169,
167
],
[
169,
170
],
[
172,
173
],
[
175,
176
],
[
178,
179
]
] | [
"H,W,N = map(int, input().split())\n\ndic = {}\nfor _ 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 \nans = [0]*10\nfor t in dic.values():\n ans[t] += 1\nans[0] = (H-2)*(W-2)-sum(ans)\n\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",
"dic = {}",
"dic",
"{}",
"for _ 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 ",
"_",
"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\n ",
"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\n ",
"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\n ",
"(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",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for t in dic.values():\n ans[t] += 1",
"t",
"dic.values()",
"dic.values",
"dic",
"values",
"ans[t] += 1",
"ans[t]",
"ans",
"t",
"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",
"dic = {}",
"{}",
"dic",
"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 -= 1",
"1",
"b",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"a -= 1",
"1",
"a"
] | H,W,N = map(int, input().split())
dic = {}
for _ 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
ans = [0]*10
for t in dic.values():
ans[t] += 1
ans[0] = (H-2)*(W-2)-sum(ans)
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,
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,
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,
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,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
149,
3
],
[
149,
16
],
[
149,
17
],
[
149,
18
],
[
140,
21
],
[
137,
51
],
[
144,
79
],
[
147,
88
],
[
100,
91
],
[
138,
92
],
[
134,
102
],
[
144,
111
],
[
147,
114
],
[
135,
120
],
[
124,
123
],
[
135,
131
],
[
123,
132
],
[
134,
135
],
[
137,
138
],
[
140,
141
],
[
149,
144
],
[
149,
147
],
[
149,
150
]
] | [
"from collections import Counter\n\nH, W, N, *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 for i, j in move:\n if 2 <= a - i <= H - 1 and 2 <= b - j <= W - 1:\n C[(a - i, b - j)] += 1\n\nD = Counter(v for _, v in C.items())\n\nprint((H - 2) * (W - 2) - sum(D.values()))\nfor i in range(1, 10):\n print(D[i])",
"from collections import Counter",
"H, W, N, *AB = 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",
"*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 for i, j in move:\n if 2 <= a - i <= H - 1 and 2 <= b - j <= W - 1:\n C[(a - i, b - j)] += 1",
"a",
"b",
"zip(*[iter(AB)] * 2)",
"zip",
"*[iter(AB)] * 2",
"[iter(AB)] * 2",
"[iter(AB)]",
"iter(AB)",
"iter",
"AB",
"2",
"for i, j in move:\n if 2 <= a - i <= H - 1 and 2 <= b - j <= W - 1:\n C[(a - i, b - j)] += 1",
"i",
"j",
"move",
"if 2 <= a - i <= H - 1 and 2 <= b - j <= W - 1:\n C[(a - i, b - j)] += 1",
"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",
"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",
"D = Counter(v for _, v in C.items())",
"D",
"Counter(v for _, v in C.items())",
"Counter",
"v",
"print((H - 2) * (W - 2) - sum(D.values()))",
"print",
"(H - 2) * (W - 2) - sum(D.values())",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"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",
"D = Counter(v for _, v in C.items())",
"Counter(v for _, v in C.items())",
"D",
"C = Counter()",
"Counter()",
"C",
"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",
"H, W, N, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"H",
"W, N, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"W",
"N, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"N"
] | from collections import Counter
H, W, N, *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):
for i, j in move:
if 2 <= a - i <= H - 1 and 2 <= b - j <= W - 1:
C[(a - i, b - j)] += 1
D = Counter(v for _, v in C.items())
print((H - 2) * (W - 2) - sum(D.values()))
for i in range(1, 10):
print(D[i])
|
[
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,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
21,
22,
17,
39,
17,
17,
17,
22,
17,
39,
17,
17,
17,
22,
17,
39,
17,
17,
17,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
13,
28,
13,
4,
13,
17,
0,
13,
18,
13,
13,
28,
13,
4,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
18,
13,
13,
28,
13,
13,
0,
13,
2,
13,
13,
28,
13,
13,
0,
13,
2,
13,
13,
14,
2,
2,
2,
2,
13,
17,
2,
13,
13,
2,
13,
17,
2,
13,
13,
0,
13,
17,
3,
14,
2,
39,
13,
13,
13,
0,
13,
17,
14,
13,
3,
14,
13,
9,
0,
18,
13,
13,
17,
28,
13,
4,
13,
17,
17,
0,
18,
13,
13,
13,
0,
18,
13,
17,
2,
13,
4,
13,
18,
13,
39,
17,
4,
13,
31,
13,
0,
13,
17,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
18,
13,
10,
18,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
2,
13,
10,
17,
13,
10,
21,
13
] | [
[
189,
4
],
[
219,
11
],
[
190,
18
],
[
219,
20
],
[
219,
21
],
[
201,
23
],
[
190,
34
],
[
234,
37
],
[
198,
58
],
[
217,
61
],
[
193,
64
],
[
225,
67
],
[
78,
77
],
[
204,
82
],
[
235,
84
],
[
77,
85
],
[
88,
87
],
[
195,
92
],
[
213,
95
],
[
207,
98
],
[
235,
100
],
[
87,
101
],
[
104,
103
],
[
205,
103
],
[
228,
106
],
[
103,
109
],
[
112,
111
],
[
208,
111
],
[
210,
114
],
[
111,
117
],
[
229,
123
],
[
217,
126
],
[
229,
127
],
[
211,
129
],
[
193,
132
],
[
211,
133
],
[
231,
135
],
[
202,
143
],
[
222,
145
],
[
157,
154
],
[
226,
155
],
[
223,
156
],
[
196,
156
],
[
160,
159
],
[
168,
165
],
[
226,
166
],
[
159,
167
],
[
159,
168
],
[
173,
170
],
[
226,
171
],
[
199,
174
],
[
226,
178
],
[
226,
184
],
[
187,
186
],
[
189,
190
],
[
219,
193
],
[
195,
196
],
[
198,
199
],
[
201,
202
],
[
204,
205
],
[
207,
208
],
[
210,
211
],
[
213,
214
],
[
219,
217
],
[
219,
220
],
[
222,
223
],
[
225,
226
],
[
228,
229
],
[
231,
232
],
[
234,
235
]
] | [
"import sys\ninput = sys.stdin.readline\n\nH, W, N = map(int, input().split())\nab = set(tuple(map(int, input().split())) for i in range(N))\n\ndxy = {0:[0, 1, 2], 1:[-1, 0, 1], 2:[-2, -1, 0]}\nnum_all = (H - 2) * (W - 2)\nnum = [0] * 10\nfor a, b in ab:\n for i in range(3):\n Da = dxy[i]\n for j in range(3):\n n = 0\n flag = False\n Db = dxy[j]\n for da in Da:\n aa = a + da\n for db in Db:\n bb = b + db\n if aa < 1 or H < aa or bb < 1 or W < bb:\n flag = True\n break\n if (aa, bb) in ab:\n n += 1\n if flag:\n break\n if flag:\n continue\n num[n] += 1\n\nfor i in range(2, 10):\n num[i] //= i\n\nnum[0] = num_all - sum(num[1:])\nprint(*num, sep='\\n')",
"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",
"ab = set(tuple(map(int, input().split())) for i in range(N))",
"ab",
"set(tuple(map(int, input().split())) for i in range(N))",
"set",
"tuple(map(int, input().split()))",
"tuple",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"dxy = {0:[0, 1, 2], 1:[-1, 0, 1], 2:[-2, -1, 0]}",
"dxy",
"{0:[0, 1, 2], 1:[-1, 0, 1], 2:[-2, -1, 0]}",
"0",
"0",
"[0, 1, 2]",
"0",
"1",
"2",
"1",
"1",
"[-1, 0, 1]",
"-1",
"0",
"1",
"2",
"2",
"[-2, -1, 0]",
"-2",
"-1",
"0",
"num_all = (H - 2) * (W - 2)",
"num_all",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"num = [0] * 10",
"num",
"[0] * 10",
"[0]",
"0",
"10",
"for a, b in ab:\n for i in range(3):\n Da = dxy[i]\n for j in range(3):\n n = 0\n flag = False\n Db = dxy[j]\n for da in Da:\n aa = a + da\n for db in Db:\n bb = b + db\n if aa < 1 or H < aa or bb < 1 or W < bb:\n flag = True\n break\n if (aa, bb) in ab:\n n += 1\n if flag:\n break\n if flag:\n continue\n num[n] += 1",
"a",
"b",
"ab",
"for i in range(3):\n Da = dxy[i]\n for j in range(3):\n n = 0\n flag = False\n Db = dxy[j]\n for da in Da:\n aa = a + da\n for db in Db:\n bb = b + db\n if aa < 1 or H < aa or bb < 1 or W < bb:\n flag = True\n break\n if (aa, bb) in ab:\n n += 1\n if flag:\n break\n if flag:\n continue\n num[n] += 1",
"i",
"range(3)",
"range",
"3",
"Da = dxy[i]",
"Da",
"dxy[i]",
"dxy",
"i",
"for j in range(3):\n n = 0\n flag = False\n Db = dxy[j]\n for da in Da:\n aa = a + da\n for db in Db:\n bb = b + db\n if aa < 1 or H < aa or bb < 1 or W < bb:\n flag = True\n break\n if (aa, bb) in ab:\n n += 1\n if flag:\n break\n if flag:\n continue\n num[n] += 1",
"j",
"range(3)",
"range",
"3",
"n = 0",
"n",
"0",
"flag = False",
"flag",
"False",
"Db = dxy[j]",
"Db",
"dxy[j]",
"dxy",
"j",
"for da in Da:\n aa = a + da\n for db in Db:\n bb = b + db\n if aa < 1 or H < aa or bb < 1 or W < bb:\n flag = True\n break\n if (aa, bb) in ab:\n n += 1\n if flag:\n break\n ",
"da",
"Da",
"aa = a + da",
"aa",
"a + da",
"a",
"da",
"for db in Db:\n bb = b + db\n if aa < 1 or H < aa or bb < 1 or W < bb:\n flag = True\n break\n if (aa, bb) in ab:\n n += 1\n ",
"db",
"Db",
"bb = b + db",
"bb",
"b + db",
"b",
"db",
"if aa < 1 or H < aa or bb < 1 or W < bb:\n flag = True\n break\n ",
"aa < 1 or H < aa or bb < 1 or W < bb",
"aa < 1 or H < aa or bb < 1",
"aa < 1 or H < aa",
"aa < 1",
"aa",
"1",
"H < aa",
"H",
"aa",
"bb < 1",
"bb",
"1",
"W < bb",
"W",
"bb",
"flag = True",
"flag",
"True",
"break",
"if (aa, bb) in ab:\n n += 1\n ",
"(aa, bb) in ab",
"(aa, bb)",
"aa",
"bb",
"ab",
"n += 1",
"n",
"1",
"if flag:\n break\n ",
"flag",
"break",
"if flag:\n continue\n ",
"flag",
"continue",
"num[n] += 1",
"num[n]",
"num",
"n",
"1",
"for i in range(2, 10):\n num[i] //= i",
"i",
"range(2, 10)",
"range",
"2",
"10",
"num[i] //= i",
"num[i]",
"num",
"i",
"i",
"num[0] = num_all - sum(num[1:])",
"num[0]",
"num",
"0",
"num_all - sum(num[1:])",
"num_all",
"sum(num[1:])",
"sum",
"num[1:]",
"num",
"1:",
"1",
"print(*num, sep='\\n')",
"print",
"*num",
"num",
"sep='\\n'",
"sep",
"'\\n'",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"n = 0",
"0",
"n",
"num_all = (H - 2) * (W - 2)",
"(H - 2) * (W - 2)",
"num_all",
"ab = set(tuple(map(int, input().split())) for i in range(N))",
"set(tuple(map(int, input().split())) for i in range(N))",
"ab",
"Da = dxy[i]",
"dxy[i]",
"Da",
"Db = dxy[j]",
"dxy[j]",
"Db",
"bb = b + db",
"b + db",
"bb",
"flag = False",
"False",
"flag",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"n += 1",
"1",
"n",
"num = [0] * 10",
"[0] * 10",
"num",
"aa = a + da",
"a + da",
"aa",
"flag = True",
"True",
"flag",
"dxy = {0:[0, 1, 2], 1:[-1, 0, 1], 2:[-2, -1, 0]}",
"{0:[0, 1, 2], 1:[-1, 0, 1], 2:[-2, -1, 0]}",
"dxy"
] | import sys
input = sys.stdin.readline
H, W, N = map(int, input().split())
ab = set(tuple(map(int, input().split())) for i in range(N))
dxy = {0:[0, 1, 2], 1:[-1, 0, 1], 2:[-2, -1, 0]}
num_all = (H - 2) * (W - 2)
num = [0] * 10
for a, b in ab:
for i in range(3):
Da = dxy[i]
for j in range(3):
n = 0
flag = False
Db = dxy[j]
for da in Da:
aa = a + da
for db in Db:
bb = b + db
if aa < 1 or H < aa or bb < 1 or W < bb:
flag = True
break
if (aa, bb) in ab:
n += 1
if flag:
break
if flag:
continue
num[n] += 1
for i in range(2, 10):
num[i] //= i
num[0] = num_all - sum(num[1:])
print(*num, sep='\n') |
[
7,
15,
15,
13,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
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,
28,
13,
13,
4,
18,
13,
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,
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,
4,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13
] | [
[
145,
7
],
[
154,
14
],
[
148,
19
],
[
146,
26
],
[
148,
28
],
[
148,
29
],
[
32,
31
],
[
149,
34
],
[
133,
36
],
[
146,
43
],
[
133,
45
],
[
59,
58
],
[
151,
61
],
[
131,
63
],
[
157,
66
],
[
134,
68
],
[
152,
75
],
[
140,
77
],
[
158,
82
],
[
143,
84
],
[
92,
87
],
[
155,
88
],
[
136,
94
],
[
155,
99
],
[
105,
102
],
[
137,
103
],
[
140,
108
],
[
143,
111
],
[
137,
117
],
[
121,
120
],
[
137,
127
],
[
120,
128
],
[
133,
131
],
[
133,
134
],
[
136,
137
],
[
148,
140
],
[
148,
143
],
[
145,
146
],
[
148,
149
],
[
151,
152
],
[
154,
155
],
[
157,
158
]
] | [
"from collections import defaultdict, Counter\nimport sys\nimport itertools\ninput = sys.stdin.readline\n\nc = defaultdict(int)\nH,W,N = map(int,input().split())\nfor _ in range(N):\n a,b = map(int,input().split())\n # そのセルを含む正方形の中心を記録\n for dx,dy in itertools.product([-1,0,1],repeat = 2):\n aa = a + dx\n bb = b + dy\n if 2 <= aa <= H-1 and 2 <= bb <= W-1:\n\t c[(aa,bb)] += 1\n\nresult = Counter(c.values())\nresult[0] = (H-2)*(W-2) - sum(result.values())\n\nfor j in range(10):\n print(result[j])",
"from collections import defaultdict, Counter",
"import sys",
"sys",
"import itertools",
"itertools",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"c = defaultdict(int)",
"c",
"defaultdict(int)",
"defaultdict",
"int",
"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 # そのセルを含む正方形の中心を記録\n for dx,dy in itertools.product([-1,0,1],repeat = 2):\n aa = a + dx\n bb = b + dy\n if 2 <= aa <= H-1 and 2 <= bb <= W-1:\n\t c[(aa,bb)] += 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 dx,dy in itertools.product([-1,0,1],repeat = 2):\n aa = a + dx\n bb = b + dy\n if 2 <= aa <= H-1 and 2 <= bb <= W-1:\n\t c[(aa,bb)] += 1",
"dx",
"dy",
"itertools.product([-1,0,1],repeat = 2)",
"itertools.product",
"itertools",
"product",
"[-1,0,1]",
"-1",
"0",
"1",
"repeat = 2",
"repeat",
"2",
"aa = a + dx",
"aa",
"a + dx",
"a",
"dx",
"bb = b + dy",
"bb",
"b + dy",
"b",
"dy",
"if 2 <= aa <= H-1 and 2 <= bb <= W-1:\n\t c[(aa,bb)] += 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",
"c[(aa,bb)] += 1",
"c[(aa,bb)]",
"c",
"(aa,bb)",
"aa",
"bb",
"1",
"result = Counter(c.values())",
"result",
"Counter(c.values())",
"Counter",
"c.values()",
"c.values",
"c",
"values",
"result[0] = (H-2)*(W-2) - sum(result.values())",
"result[0]",
"result",
"0",
"(H-2)*(W-2) - sum(result.values())",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(result.values())",
"sum",
"result.values()",
"result.values",
"result",
"values",
"for j in range(10):\n print(result[j])",
"j",
"range(10)",
"range",
"10",
"print(result[j])",
"print",
"result[j]",
"result",
"j",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"result = Counter(c.values())",
"Counter(c.values())",
"result",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"aa = a + dx",
"a + dx",
"aa",
"c = defaultdict(int)",
"defaultdict(int)",
"c",
"bb = b + dy",
"b + dy",
"bb"
] | from collections import defaultdict, Counter
import sys
import itertools
input = sys.stdin.readline
c = defaultdict(int)
H,W,N = map(int,input().split())
for _ in range(N):
a,b = map(int,input().split())
# そのセルを含む正方形の中心を記録
for dx,dy in itertools.product([-1,0,1],repeat = 2):
aa = a + dx
bb = b + dy
if 2 <= aa <= H-1 and 2 <= bb <= W-1:
c[(aa,bb)] += 1
result = Counter(c.values())
result[0] = (H-2)*(W-2) - sum(result.values())
for j in range(10):
print(result[j])
|
[
7,
0,
13,
12,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
13,
0,
13,
17,
42,
13,
0,
13,
17,
0,
13,
4,
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,
13,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
17,
13
] | [
[
140,
2
],
[
143,
13
],
[
141,
15
],
[
143,
16
],
[
143,
17
],
[
146,
19
],
[
131,
24
],
[
134,
27
],
[
141,
29
],
[
134,
30
],
[
33,
32
],
[
122,
37
],
[
135,
40
],
[
32,
42
],
[
129,
45
],
[
32,
47
],
[
53,
50
],
[
147,
51
],
[
123,
52
],
[
147,
56
],
[
123,
58
],
[
126,
64
],
[
123,
66
],
[
123,
70
],
[
138,
72
],
[
76,
75
],
[
147,
86
],
[
75,
90
],
[
119,
93
],
[
126,
100
],
[
138,
103
],
[
120,
107
],
[
110,
109
],
[
120,
116
],
[
109,
117
],
[
119,
120
],
[
122,
123
],
[
143,
126
],
[
134,
129
],
[
131,
132
],
[
134,
135
],
[
143,
138
],
[
140,
141
],
[
143,
144
],
[
146,
147
]
] | [
"f=lambda:map(int,input().split())\nh,w,n = f()\n\nd={}\nwhile n:\n n-=1\n x,y=f()\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)]\n\nprint((h-2)*(w-2)-sum(c))\nfor i in range(9):\n print(c[i])",
"f=lambda:map(int,input().split())",
"f",
"lambda:map(int,input().split())",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h,w,n = f()",
"h",
"f()",
"f",
"w",
"n",
"d={}",
"d",
"{}",
"while n:\n n-=1\n x,y=f()\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=f()",
"x",
"f()",
"f",
"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",
"c=[list(d.values()).count(i+1)for i in range(9)]",
"[list(d.values()).count(i+1)for i in range(9)]",
"c",
"a=(x+i%3,y+i//3)",
"(x+i%3,y+i//3)",
"a",
"h,w,n = f()",
"f()",
"h",
"y=f()",
"f()",
"y",
"n-=1",
"1",
"n",
"x,y=f()",
"f()",
"x",
"w,n = f()",
"f()",
"w",
"f=lambda:map(int,input().split())",
"lambda:map(int,input().split())",
"f",
"n = f()",
"f()",
"n",
"d={}",
"{}",
"d"
] | f=lambda:map(int,input().split())
h,w,n = f()
d={}
while n:
n-=1
x,y=f()
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,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
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,
4,
13,
13,
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,
13,
0,
13,
2,
13,
18,
13,
17,
13,
2,
13,
18,
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,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
4,
13,
17,
17,
0,
13,
17,
28,
13,
4,
18,
13,
13,
14,
2,
13,
13,
0,
13,
17,
4,
13,
13,
10,
39,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
13,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13
] | [
[
5,
4
],
[
4,
13
],
[
176,
15
],
[
176,
17
],
[
176,
18
],
[
155,
20
],
[
170,
50
],
[
56,
55
],
[
162,
58
],
[
62,
61
],
[
61,
71
],
[
179,
74
],
[
179,
76
],
[
79,
78
],
[
156,
78
],
[
167,
81
],
[
159,
83
],
[
78,
85
],
[
173,
87
],
[
180,
89
],
[
78,
91
],
[
168,
98
],
[
165,
100
],
[
174,
105
],
[
177,
107
],
[
115,
110
],
[
171,
111
],
[
165,
121
],
[
177,
124
],
[
171,
128
],
[
131,
130
],
[
182,
136
],
[
140,
139
],
[
171,
142
],
[
139,
146
],
[
130,
147
],
[
185,
149
],
[
186,
153
],
[
183,
153
],
[
155,
156
],
[
179,
159
],
[
176,
162
],
[
176,
165
],
[
167,
168
],
[
170,
171
],
[
173,
174
],
[
176,
177
],
[
179,
180
],
[
182,
183
],
[
185,
186
]
] | [
"from collections import defaultdict\nH,W,N = [int(n) for n in input().split()]\n# N = int(input())\ndxy = [[0,0],[1,0],[0,1],\n[-1,0],[0,-1],[1,1],\n[-1,-1], [1,-1], [-1,1]]\n\neffdic = defaultdict(int)\nfor i in range(N):\n a,b = [int(n)-1 for n in input().split()]\n for d in dxy:\n ta, tb = a+d[0], b+d[1]\n if(1 <= ta < H-1 and 1 <= tb < W-1):\n effdic[(ta,tb)] += 1\nprint((H-2)*(W-2) - len(effdic))\nfor i in range(1,10):\n tmp=0\n for v in effdic.values():\n if(v == i):\n tmp+=1\n print(tmp)",
"from collections import defaultdict",
"int(n) for n in input().split()",
"for n in input().split()",
"n",
"input().split()",
"().split",
"()",
"input",
"split",
"for n in input().split()",
"int(n)",
"int",
"n",
"H,W,N = [int(n) for n in input().split()]",
"H",
"[int(n) for n in input().split()]",
"W",
"N",
"dxy = [[0,0],[1,0],[0,1],\n[-1,0],[0,-1],[1,1],\n[-1,-1], [1,-1], [-1,1]]",
"dxy",
"[[0,0],[1,0],[0,1],\n[-1,0],[0,-1],[1,1],\n[-1,-1], [1,-1], [-1,1]]",
"[0,0]",
"0",
"0",
"[1,0]",
"1",
"0",
"[0,1]",
"0",
"1",
"[-1,0]",
"-1",
"0",
"[0,-1]",
"0",
"-1",
"[1,1]",
"1",
"1",
"[-1,-1]",
"-1",
"-1",
"[1,-1]",
"1",
"-1",
"[-1,1]",
"-1",
"1",
"effdic = defaultdict(int)",
"effdic",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n a,b = [int(n)-1 for n in input().split()]\n for d in dxy:\n ta, tb = a+d[0], b+d[1]\n if(1 <= ta < H-1 and 1 <= tb < W-1):\n effdic[(ta,tb)] += 1",
"i",
"range(N)",
"range",
"N",
"int(n)-1 for n in input().split()",
"for n in input().split()",
"n",
"input().split()",
"().split",
"()",
"input",
"split",
"for n in input().split()",
"int(n)-1",
"int(n)",
"int",
"n",
"1",
"a,b = [int(n)-1 for n in input().split()]",
"a",
"[int(n)-1 for n in input().split()]",
"b",
"for d in dxy:\n ta, tb = a+d[0], b+d[1]\n if(1 <= ta < H-1 and 1 <= tb < W-1):\n effdic[(ta,tb)] += 1",
"d",
"dxy",
"ta, tb = a+d[0], b+d[1]",
"ta",
"a+d[0]",
"a",
"d[0]",
"d",
"0",
"tb",
"b+d[1]",
"b",
"d[1]",
"d",
"1",
"if(1 <= ta < H-1 and 1 <= tb < W-1):\n effdic[(ta,tb)] += 1",
"1 <= ta < H-1 and 1 <= tb < W-1",
"1 <= ta < H-1",
"1 <= ta",
"1",
"ta",
"H-1",
"H",
"1",
"1 <= tb < W-1",
"1 <= tb",
"1",
"tb",
"W-1",
"W",
"1",
"effdic[(ta,tb)] += 1",
"effdic[(ta,tb)]",
"effdic",
"(ta,tb)",
"ta",
"tb",
"1",
"print((H-2)*(W-2) - len(effdic))",
"print",
"(H-2)*(W-2) - len(effdic)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"len(effdic)",
"len",
"effdic",
"for i in range(1,10):\n tmp=0\n for v in effdic.values():\n if(v == i):\n tmp+=1\n print(tmp)",
"i",
"range(1,10)",
"range",
"1",
"10",
"tmp=0",
"tmp",
"0",
"for v in effdic.values():\n if(v == i):\n tmp+=1\n ",
"v",
"effdic.values()",
"effdic.values",
"effdic",
"values",
"if(v == i):\n tmp+=1\n ",
"v == i",
"v",
"i",
"tmp+=1",
"tmp",
"1",
"print(tmp)",
"print",
"tmp",
"dxy = [[0,0],[1,0],[0,1],\n[-1,0],[0,-1],[1,1],\n[-1,-1], [1,-1], [-1,1]]",
"[[0,0],[1,0],[0,1],\n[-1,0],[0,-1],[1,1],\n[-1,-1], [1,-1], [-1,1]]",
"dxy",
"a,b = [int(n)-1 for n in input().split()]",
"[int(n)-1 for n in input().split()]",
"a",
"N = [int(n) for n in input().split()]",
"[int(n) for n in input().split()]",
"N",
"H,W,N = [int(n) for n in input().split()]",
"[int(n) for n in input().split()]",
"H",
"ta, tb = a+d[0], b+d[1]",
"a+d[0]",
"ta",
"effdic = defaultdict(int)",
"defaultdict(int)",
"effdic",
"tb = a+d[0], b+d[1]",
"b+d[1]",
"tb",
"W,N = [int(n) for n in input().split()]",
"[int(n) for n in input().split()]",
"W",
"b = [int(n)-1 for n in input().split()]",
"[int(n)-1 for n in input().split()]",
"b",
"tmp=0",
"0",
"tmp",
"tmp+=1",
"1",
"tmp"
] | from collections import defaultdict
H,W,N = [int(n) for n in input().split()]
# N = int(input())
dxy = [[0,0],[1,0],[0,1],
[-1,0],[0,-1],[1,1],
[-1,-1], [1,-1], [-1,1]]
effdic = defaultdict(int)
for i in range(N):
a,b = [int(n)-1 for n in input().split()]
for d in dxy:
ta, tb = a+d[0], b+d[1]
if(1 <= ta < H-1 and 1 <= tb < W-1):
effdic[(ta,tb)] += 1
print((H-2)*(W-2) - len(effdic))
for i in range(1,10):
tmp=0
for v in effdic.values():
if(v == i):
tmp+=1
print(tmp)
|
[
7,
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,
4,
13,
2,
13,
17,
17,
2,
13,
17,
28,
13,
4,
13,
4,
13,
2,
13,
17,
17,
2,
13,
17,
14,
2,
2,
13,
2,
13,
17,
2,
13,
2,
13,
17,
9,
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,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
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,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] | [
[
151,
3
],
[
151,
12
],
[
151,
13
],
[
145,
15
],
[
19,
18
],
[
143,
21
],
[
148,
23
],
[
148,
32
],
[
35,
34
],
[
149,
40
],
[
149,
44
],
[
48,
47
],
[
134,
53
],
[
134,
57
],
[
152,
62
],
[
34,
64
],
[
137,
67
],
[
47,
69
],
[
146,
77
],
[
84,
79
],
[
146,
80
],
[
91,
86
],
[
146,
87
],
[
139,
93
],
[
102,
99
],
[
140,
100
],
[
152,
104
],
[
137,
107
],
[
146,
114
],
[
120,
117
],
[
140,
118
],
[
125,
122
],
[
140,
123
],
[
128,
127
],
[
140,
127
],
[
127,
131
],
[
148,
134
],
[
151,
137
],
[
139,
140
],
[
151,
143
],
[
145,
146
],
[
148,
149
],
[
151,
152
]
] | [
"from collections import Counter\nh,w,n=map(int,input().split())\nd={}\n\nfor _ in range(n):\n a,b=map(int,input().split())\n\n for i in range(max(a-2,1),a+1):\n for j in range(max(b-2,1),b+1):\n if h<i+2 or w<j+2:\n continue\n if (i,j) in d:\n d[(i,j)]+=1\n else:\n d[(i,j)]=1\nans=[0]*10\nans[0]=(h-2)*(w-2)\nfor k,v in d.items():\n ans[v]+=1\n ans[0]-=1\n\nfor a in ans:\n print(a)",
"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",
"d={}",
"d",
"{}",
"for _ in range(n):\n a,b=map(int,input().split())\n\n for i in range(max(a-2,1),a+1):\n for j in range(max(b-2,1),b+1):\n if h<i+2 or w<j+2:\n continue\n if (i,j) in d:\n d[(i,j)]+=1\n else:\n d[(i,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(max(a-2,1),a+1):\n for j in range(max(b-2,1),b+1):\n if h<i+2 or w<j+2:\n continue\n if (i,j) in d:\n d[(i,j)]+=1\n else:\n d[(i,j)]=1",
"i",
"range(max(a-2,1),a+1)",
"range",
"max(a-2,1)",
"max",
"a-2",
"a",
"2",
"1",
"a+1",
"a",
"1",
"for j in range(max(b-2,1),b+1):\n if h<i+2 or w<j+2:\n continue\n if (i,j) in d:\n d[(i,j)]+=1\n else:\n d[(i,j)]=1",
"j",
"range(max(b-2,1),b+1)",
"range",
"max(b-2,1)",
"max",
"b-2",
"b",
"2",
"1",
"b+1",
"b",
"1",
"if h<i+2 or w<j+2:\n continue\n ",
"h<i+2 or w<j+2",
"h<i+2",
"h",
"i+2",
"i",
"2",
"w<j+2",
"w",
"j+2",
"j",
"2",
"continue",
"if (i,j) in d:\n d[(i,j)]+=1\n else:\n d[(i,j)]=1",
"(i,j) in d",
"(i,j)",
"i",
"j",
"d",
"d[(i,j)]+=1",
"d[(i,j)]",
"d",
"(i,j)",
"i",
"j",
"1",
"d[(i,j)]=1",
"d[(i,j)]",
"d",
"(i,j)",
"i",
"j",
"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 k,v in d.items():\n ans[v]+=1\n ans[0]-=1",
"k",
"v",
"d.items()",
"d.items",
"d",
"items",
"ans[v]+=1",
"ans[v]",
"ans",
"v",
"1",
"ans[0]-=1",
"ans[0]",
"ans",
"0",
"1",
"for a in ans:\n print(a)",
"a",
"ans",
"print(a)",
"print",
"a",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"ans=[0]*10",
"[0]*10",
"ans",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"d={}",
"{}",
"d",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h"
] | from collections import Counter
h,w,n=map(int,input().split())
d={}
for _ in range(n):
a,b=map(int,input().split())
for i in range(max(a-2,1),a+1):
for j in range(max(b-2,1),b+1):
if h<i+2 or w<j+2:
continue
if (i,j) in d:
d[(i,j)]+=1
else:
d[(i,j)]=1
ans=[0]*10
ans[0]=(h-2)*(w-2)
for k,v in d.items():
ans[v]+=1
ans[0]-=1
for a in ans:
print(a) |
[
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,
40,
2,
13,
13,
17,
40,
2,
13,
13,
2,
13,
17,
40,
2,
13,
13,
17,
40,
2,
13,
13,
2,
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,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] | [
[
134,
3
],
[
134,
12
],
[
134,
13
],
[
143,
15
],
[
21,
20
],
[
129,
23
],
[
137,
25
],
[
137,
34
],
[
37,
36
],
[
43,
42
],
[
138,
53
],
[
36,
54
],
[
138,
58
],
[
36,
59
],
[
126,
61
],
[
132,
65
],
[
42,
66
],
[
132,
70
],
[
42,
71
],
[
135,
73
],
[
85,
76
],
[
144,
77
],
[
138,
80
],
[
36,
81
],
[
132,
83
],
[
42,
84
],
[
140,
87
],
[
96,
93
],
[
141,
94
],
[
126,
99
],
[
135,
102
],
[
144,
106
],
[
109,
108
],
[
144,
111
],
[
117,
114
],
[
141,
115
],
[
108,
116
],
[
120,
119
],
[
141,
119
],
[
119,
123
],
[
134,
126
],
[
134,
129
],
[
137,
132
],
[
134,
135
],
[
137,
138
],
[
140,
141
],
[
143,
144
]
] | [
"from collections import defaultdict\nH,W,N = map(int,input().split())\nd = defaultdict(int)\nfor i in range(N):\n a,b = map(int,input().split())\n for dy in range(-1,2):\n for dx in range(-1,2):\n if a+dy >= 2 and a+dy <= H-1 and b+dx >= 2 and b+dx <= W-1:\n d[(a+dy,b+dx)] += 1\nans = [0]*10\nans[0] = (H-2)*(W-2)-len(d)\nfor i in d.values():\n ans[i] += 1\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 i in range(N):\n a,b = map(int,input().split())\n for dy in range(-1,2):\n for dx in range(-1,2):\n if a+dy >= 2 and a+dy <= H-1 and b+dx >= 2 and b+dx <= W-1:\n d[(a+dy,b+dx)] += 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 dy in range(-1,2):\n for dx in range(-1,2):\n if a+dy >= 2 and a+dy <= H-1 and b+dx >= 2 and b+dx <= W-1:\n d[(a+dy,b+dx)] += 1",
"dy",
"range(-1,2)",
"range",
"-1",
"2",
"for dx in range(-1,2):\n if a+dy >= 2 and a+dy <= H-1 and b+dx >= 2 and b+dx <= W-1:\n d[(a+dy,b+dx)] += 1",
"dx",
"range(-1,2)",
"range",
"-1",
"2",
"if a+dy >= 2 and a+dy <= H-1 and b+dx >= 2 and b+dx <= W-1:\n d[(a+dy,b+dx)] += 1",
"a+dy >= 2 and a+dy <= H-1 and b+dx >= 2 and b+dx <= W-1",
"a+dy >= 2 and a+dy <= H-1 and b+dx >= 2",
"a+dy >= 2 and a+dy <= H-1",
"a+dy >= 2",
"a+dy",
"a",
"dy",
"2",
"a+dy <= H-1",
"a+dy",
"a",
"dy",
"H-1",
"H",
"1",
"b+dx >= 2",
"b+dx",
"b",
"dx",
"2",
"b+dx <= W-1",
"b+dx",
"b",
"dx",
"W-1",
"W",
"1",
"d[(a+dy,b+dx)] += 1",
"d[(a+dy,b+dx)]",
"d",
"(a+dy,b+dx)",
"a+dy",
"a",
"dy",
"b+dx",
"b",
"dx",
"1",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"ans[0] = (H-2)*(W-2)-len(d)",
"ans[0]",
"ans",
"0",
"(H-2)*(W-2)-len(d)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"len(d)",
"len",
"d",
"for i in d.values():\n ans[i] += 1",
"i",
"d.values()",
"d.values",
"d",
"values",
"ans[i] += 1",
"ans[i]",
"ans",
"i",
"1",
"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",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"ans = [0]*10",
"[0]*10",
"ans",
"d = defaultdict(int)",
"defaultdict(int)",
"d"
] | from collections import defaultdict
H,W,N = map(int,input().split())
d = defaultdict(int)
for i in range(N):
a,b = map(int,input().split())
for dy in range(-1,2):
for dx in range(-1,2):
if a+dy >= 2 and a+dy <= H-1 and b+dx >= 2 and b+dx <= W-1:
d[(a+dy,b+dx)] += 1
ans = [0]*10
ans[0] = (H-2)*(W-2)-len(d)
for i in d.values():
ans[i] += 1
for i in ans:
print(i) |
[
7,
15,
13,
15,
13,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
0,
13,
4,
18,
13,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
4,
18,
13,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
40,
2,
18,
13,
17,
13,
17,
40,
2,
18,
13,
17,
13,
2,
13,
17,
14,
2,
40,
2,
18,
13,
17,
13,
17,
40,
2,
18,
13,
17,
13,
2,
13,
17,
0,
18,
13,
39,
2,
18,
13,
17,
13,
2,
18,
13,
17,
13,
17,
0,
13,
4,
18,
13,
13,
4,
18,
13,
13,
0,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
13,
13,
4,
13,
13,
28,
13,
4,
13,
17,
17,
14,
2,
13,
13,
4,
13,
18,
13,
13,
4,
13,
17,
10,
39,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
170,
8
],
[
191,
15
],
[
171,
22
],
[
191,
24
],
[
191,
25
],
[
167,
27
],
[
176,
30
],
[
38,
37
],
[
192,
40
],
[
188,
42
],
[
171,
51
],
[
168,
55
],
[
189,
57
],
[
60,
59
],
[
65,
64
],
[
189,
73
],
[
59,
75
],
[
189,
80
],
[
59,
82
],
[
174,
84
],
[
189,
91
],
[
64,
93
],
[
189,
98
],
[
64,
100
],
[
180,
102
],
[
118,
105
],
[
177,
106
],
[
189,
110
],
[
59,
112
],
[
189,
115
],
[
64,
117
],
[
182,
120
],
[
177,
127
],
[
185,
130
],
[
174,
134
],
[
180,
137
],
[
183,
143
],
[
186,
147
],
[
150,
149
],
[
149,
156
],
[
183,
157
],
[
183,
161
],
[
149,
162
],
[
167,
168
],
[
170,
171
],
[
191,
174
],
[
176,
177
],
[
191,
180
],
[
182,
183
],
[
185,
186
],
[
188,
189
],
[
191,
192
]
] | [
"import numpy as np\n# import math\nimport collections\nimport sys\ninput = sys.stdin.readline\n\nH,W,N = map(int,input().split())\n\nab = []\n\neff = collections.defaultdict(int)\n\nfor i in range(N):\n temp = list(map(int,input().split()))\n ab.append(temp)\n for j in range(3):\n for k in range(3):\n if (temp[0]-j >= 1) & (temp[0]-j <= H-2):\n if (temp[1]-k >= 1) & (temp[1]-k <= W-2):\n eff[(temp[0]-j,temp[1]-k)] += 1\n\ncount = collections.Counter(eff.values())\n\ncount0 = (H-2) * (W-2) - sum(count.values())\n\nprint(count0)\nfor i in range(1,10):\n if i in count:\n print(count[i])\n else:\n print(0)",
"import numpy as np",
"numpy",
"import collections",
"collections",
"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",
"ab = []",
"ab",
"[]",
"eff = collections.defaultdict(int)",
"eff",
"collections.defaultdict(int)",
"collections.defaultdict",
"collections",
"defaultdict",
"int",
"for i in range(N):\n temp = list(map(int,input().split()))\n ab.append(temp)\n for j in range(3):\n for k in range(3):\n if (temp[0]-j >= 1) & (temp[0]-j <= H-2):\n if (temp[1]-k >= 1) & (temp[1]-k <= W-2):\n eff[(temp[0]-j,temp[1]-k)] += 1",
"i",
"range(N)",
"range",
"N",
"temp = list(map(int,input().split()))",
"temp",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ab.append(temp)",
"ab.append",
"ab",
"append",
"temp",
"for j in range(3):\n for k in range(3):\n if (temp[0]-j >= 1) & (temp[0]-j <= H-2):\n if (temp[1]-k >= 1) & (temp[1]-k <= W-2):\n eff[(temp[0]-j,temp[1]-k)] += 1",
"j",
"range(3)",
"range",
"3",
"for k in range(3):\n if (temp[0]-j >= 1) & (temp[0]-j <= H-2):\n if (temp[1]-k >= 1) & (temp[1]-k <= W-2):\n eff[(temp[0]-j,temp[1]-k)] += 1",
"k",
"range(3)",
"range",
"3",
"if (temp[0]-j >= 1) & (temp[0]-j <= H-2):\n if (temp[1]-k >= 1) & (temp[1]-k <= W-2):\n eff[(temp[0]-j,temp[1]-k)] += 1",
"(temp[0]-j >= 1) & (temp[0]-j <= H-2)",
"temp[0]-j >= 1",
"temp[0]-j",
"temp[0]",
"temp",
"0",
"j",
"1",
"temp[0]-j <= H-2",
"temp[0]-j",
"temp[0]",
"temp",
"0",
"j",
"H-2",
"H",
"2",
"if (temp[1]-k >= 1) & (temp[1]-k <= W-2):\n eff[(temp[0]-j,temp[1]-k)] += 1",
"(temp[1]-k >= 1) & (temp[1]-k <= W-2)",
"temp[1]-k >= 1",
"temp[1]-k",
"temp[1]",
"temp",
"1",
"k",
"1",
"temp[1]-k <= W-2",
"temp[1]-k",
"temp[1]",
"temp",
"1",
"k",
"W-2",
"W",
"2",
"eff[(temp[0]-j,temp[1]-k)] += 1",
"eff[(temp[0]-j,temp[1]-k)]",
"eff",
"(temp[0]-j,temp[1]-k)",
"temp[0]-j",
"temp[0]",
"temp",
"0",
"j",
"temp[1]-k",
"temp[1]",
"temp",
"1",
"k",
"1",
"count = collections.Counter(eff.values())",
"count",
"collections.Counter(eff.values())",
"collections.Counter",
"collections",
"Counter",
"eff.values()",
"eff.values",
"eff",
"values",
"count0 = (H-2) * (W-2) - sum(count.values())",
"count0",
"(H-2) * (W-2) - sum(count.values())",
"(H-2) * (W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(count.values())",
"sum",
"count.values()",
"count.values",
"count",
"values",
"print(count0)",
"print",
"count0",
"for i in range(1,10):\n if i in count:\n print(count[i])\n else:\n print(0)",
"i",
"range(1,10)",
"range",
"1",
"10",
"if i in count:\n print(count[i])\n else:\n print(0)",
"i in count",
"i",
"count",
"print(count[i])",
"print",
"count[i]",
"count",
"i",
"print(0)",
"print",
"0",
"ab = []",
"[]",
"ab",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"eff = collections.defaultdict(int)",
"collections.defaultdict(int)",
"eff",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"count = collections.Counter(eff.values())",
"collections.Counter(eff.values())",
"count",
"count0 = (H-2) * (W-2) - sum(count.values())",
"(H-2) * (W-2) - sum(count.values())",
"count0",
"temp = list(map(int,input().split()))",
"list(map(int,input().split()))",
"temp",
"N = map(int,input().split())",
"map(int,input().split())",
"N"
] | import numpy as np
# import math
import collections
import sys
input = sys.stdin.readline
H,W,N = map(int,input().split())
ab = []
eff = collections.defaultdict(int)
for i in range(N):
temp = list(map(int,input().split()))
ab.append(temp)
for j in range(3):
for k in range(3):
if (temp[0]-j >= 1) & (temp[0]-j <= H-2):
if (temp[1]-k >= 1) & (temp[1]-k <= W-2):
eff[(temp[0]-j,temp[1]-k)] += 1
count = collections.Counter(eff.values())
count0 = (H-2) * (W-2) - sum(count.values())
print(count0)
for i in range(1,10):
if i in count:
print(count[i])
else:
print(0)
|
[
7,
12,
13,
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,
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,
17,
14,
2,
2,
13,
13,
17,
14,
2,
2,
2,
13,
13,
17,
13,
28,
13,
4,
13,
17,
14,
2,
2,
13,
13,
17,
14,
2,
2,
2,
13,
13,
17,
13,
0,
18,
13,
2,
2,
2,
13,
13,
13,
2,
13,
13,
17,
0,
13,
2,
39,
17,
17,
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,
4,
13,
31,
13,
0,
13,
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
],
[
38,
37
],
[
7,
41
],
[
37,
47
],
[
51,
50
],
[
51,
52
],
[
55,
54
],
[
50,
61
],
[
54,
62
],
[
50,
68
],
[
54,
69
],
[
14,
71
],
[
74,
73
],
[
52,
80
],
[
73,
81
],
[
52,
87
],
[
73,
88
],
[
23,
90
],
[
103,
92
],
[
26,
93
],
[
50,
97
],
[
54,
98
],
[
23,
99
],
[
52,
101
],
[
73,
102
],
[
106,
105
],
[
112,
111
],
[
14,
114
],
[
23,
117
],
[
121,
120
],
[
26,
123
],
[
129,
126
],
[
105,
127
],
[
120,
128
],
[
132,
131
],
[
137,
134
],
[
105,
135
],
[
131,
137
],
[
111,
137
],
[
105,
141
],
[
144,
143
],
[
153,
150
]
] | [
"def main():\n from collections import defaultdict\n import sys\n input = sys.stdin.readline\n\n H, W, N = map(int, input().split())\n\n g = defaultdict(int)\n for _ in range(N):\n a, b = (int(x) - 1 for x in input().split())\n for i in range(3):\n if a - i < 0: continue\n if a - i + 3 > H: continue\n for j in range(3):\n if b - j < 0: continue\n if b - j + 3 > W: continue\n g[(a - i) * W + (b - j)] += 1\n # (a,b)を塗ったとき影響される3x3マス目の左上の座標に加算する\n\n ctr = [0] * 10\n tot = (H - 2) * (W - 2)\n for cnt in g.values():\n ctr[cnt] += 1\n tot -= 1\n ctr[0] = tot\n\n print(*ctr, sep='\\n')\n\n\nif __name__ == '__main__':\n main()",
"def main():\n from collections import defaultdict\n import sys\n input = sys.stdin.readline\n\n H, W, N = map(int, input().split())\n\n g = defaultdict(int)\n for _ in range(N):\n a, b = (int(x) - 1 for x in input().split())\n for i in range(3):\n if a - i < 0: continue\n if a - i + 3 > H: continue\n for j in range(3):\n if b - j < 0: continue\n if b - j + 3 > W: continue\n g[(a - i) * W + (b - j)] += 1\n # (a,b)を塗ったとき影響される3x3マス目の左上の座標に加算する\n\n ctr = [0] * 10\n tot = (H - 2) * (W - 2)\n for cnt in g.values():\n ctr[cnt] += 1\n tot -= 1\n ctr[0] = tot\n\n print(*ctr, sep='\\n')",
"main",
"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",
"g = defaultdict(int)",
"g",
"defaultdict(int)",
"defaultdict",
"int",
"for _ in range(N):\n a, b = (int(x) - 1 for x in input().split())\n for i in range(3):\n if a - i < 0: continue\n if a - i + 3 > H: continue\n for j in range(3):\n if b - j < 0: continue\n if b - j + 3 > W: continue\n g[(a - i) * W + (b - j)] += 1\n # (a,b)を塗ったとき影響される3x3マス目の左上の座標に加算する\n\n ",
"_",
"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 i in range(3):\n if a - i < 0: continue\n if a - i + 3 > H: continue\n for j in range(3):\n if b - j < 0: continue\n if b - j + 3 > W: continue\n g[(a - i) * W + (b - j)] += 1\n # (a,b)を塗ったとき影響される3x3マス目の左上の座標に加算する\n\n ",
"i",
"range(3)",
"range",
"3",
"if a - i < 0: continue\n ",
"a - i < 0",
"a - i",
"a",
"i",
"0",
"if a - i + 3 > H: continue\n ",
"a - i + 3 > H",
"a - i + 3",
"a - i",
"a",
"i",
"3",
"H",
"for j in range(3):\n if b - j < 0: continue\n if b - j + 3 > W: continue\n g[(a - i) * W + (b - j)] += 1\n # (a,b)を塗ったとき影響される3x3マス目の左上の座標に加算する\n\n ",
"j",
"range(3)",
"range",
"3",
"if b - j < 0: continue\n ",
"b - j < 0",
"b - j",
"b",
"j",
"0",
"if b - j + 3 > W: continue\n ",
"b - j + 3 > W",
"b - j + 3",
"b - j",
"b",
"j",
"3",
"W",
"g[(a - i) * W + (b - j)] += 1",
"g[(a - i) * W + (b - j)]",
"g",
"(a - i) * W + (b - j)",
"(a - i) * W",
"a - i",
"a",
"i",
"W",
"b - j",
"b",
"j",
"1",
"ctr = [0] * 10",
"ctr",
"[0] * 10",
"[0]",
"0",
"10",
"tot = (H - 2) * (W - 2)",
"tot",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"for cnt in g.values():\n ctr[cnt] += 1\n tot -= 1\n ",
"cnt",
"g.values()",
"g.values",
"g",
"values",
"ctr[cnt] += 1",
"ctr[cnt]",
"ctr",
"cnt",
"1",
"tot -= 1",
"tot",
"1",
"ctr[0] = tot",
"ctr[0]",
"ctr",
"0",
"tot",
"print(*ctr, sep='\\n')",
"print",
"*ctr",
"ctr",
"sep='\\n'",
"sep",
"'\\n'",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n from collections import defaultdict\n import sys\n input = sys.stdin.readline\n\n H, W, N = map(int, input().split())\n\n g = defaultdict(int)\n for _ in range(N):\n a, b = (int(x) - 1 for x in input().split())\n for i in range(3):\n if a - i < 0: continue\n if a - i + 3 > H: continue\n for j in range(3):\n if b - j < 0: continue\n if b - j + 3 > W: continue\n g[(a - i) * W + (b - j)] += 1\n # (a,b)を塗ったとき影響される3x3マス目の左上の座標に加算する\n\n ctr = [0] * 10\n tot = (H - 2) * (W - 2)\n for cnt in g.values():\n ctr[cnt] += 1\n tot -= 1\n ctr[0] = tot\n\n print(*ctr, sep='\\n')",
"def main():\n from collections import defaultdict\n import sys\n input = sys.stdin.readline\n\n H, W, N = map(int, input().split())\n\n g = defaultdict(int)\n for _ in range(N):\n a, b = (int(x) - 1 for x in input().split())\n for i in range(3):\n if a - i < 0: continue\n if a - i + 3 > H: continue\n for j in range(3):\n if b - j < 0: continue\n if b - j + 3 > W: continue\n g[(a - i) * W + (b - j)] += 1\n # (a,b)を塗ったとき影響される3x3マス目の左上の座標に加算する\n\n ctr = [0] * 10\n tot = (H - 2) * (W - 2)\n for cnt in g.values():\n ctr[cnt] += 1\n tot -= 1\n ctr[0] = tot\n\n print(*ctr, sep='\\n')",
"main"
] | def main():
from collections import defaultdict
import sys
input = sys.stdin.readline
H, W, N = map(int, input().split())
g = defaultdict(int)
for _ in range(N):
a, b = (int(x) - 1 for x in input().split())
for i in range(3):
if a - i < 0: continue
if a - i + 3 > H: continue
for j in range(3):
if b - j < 0: continue
if b - j + 3 > W: continue
g[(a - i) * W + (b - j)] += 1
# (a,b)を塗ったとき影響される3x3マス目の左上の座標に加算する
ctr = [0] * 10
tot = (H - 2) * (W - 2)
for cnt in g.values():
ctr[cnt] += 1
tot -= 1
ctr[0] = tot
print(*ctr, sep='\n')
if __name__ == '__main__':
main()
|
[
7,
15,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
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,
4,
18,
13,
13,
39,
13,
13,
28,
13,
4,
13,
17,
17,
14,
40,
40,
17,
2,
13,
13,
2,
13,
17,
28,
13,
4,
13,
17,
17,
14,
40,
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,
28,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
0,
13,
4,
13,
2,
39,
2,
13,
13,
2,
13,
13,
13,
0,
18,
13,
13,
17,
0,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
0,
18,
13,
17,
13,
4,
13,
31,
13,
0,
13,
17,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13
] | [
[
199,
4
],
[
190,
20
],
[
200,
27
],
[
190,
29
],
[
190,
30
],
[
181,
32
],
[
202,
36
],
[
41,
40
],
[
188,
43
],
[
193,
45
],
[
200,
52
],
[
193,
54
],
[
203,
57
],
[
64,
63
],
[
185,
73
],
[
63,
74
],
[
176,
76
],
[
80,
79
],
[
194,
89
],
[
79,
90
],
[
191,
92
],
[
182,
96
],
[
185,
100
],
[
63,
101
],
[
194,
103
],
[
79,
104
],
[
172,
106
],
[
205,
116
],
[
120,
119
],
[
125,
124
],
[
178,
129
],
[
185,
135
],
[
119,
136
],
[
194,
138
],
[
124,
139
],
[
203,
140
],
[
145,
142
],
[
173,
143
],
[
179,
144
],
[
206,
144
],
[
196,
147
],
[
176,
151
],
[
191,
154
],
[
173,
158
],
[
163,
160
],
[
173,
161
],
[
197,
163
],
[
173,
167
],
[
170,
169
],
[
172,
173
],
[
190,
176
],
[
178,
179
],
[
181,
182
],
[
193,
185
],
[
190,
188
],
[
190,
191
],
[
193,
194
],
[
196,
197
],
[
199,
200
],
[
202,
203
],
[
205,
206
]
] | [
"import sys\ninput = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 7)\n\nH, W, N = map(int, input().split())\ncand = set()\ndot = set()\nfor _ in range(N):\n x, y = map(int, input().split())\n dot.add((x, y))\n for i in range(-2, 1):\n if 1 <= x + i <= H - 2:\n for j in range(-2, 1):\n if 1 <= y + j <= W - 2:\n cand.add((x + i, y + j))\n\nans = [0] * 10\nfor x, y in cand:\n cnt = 0\n for i in range(3):\n for j in range(3):\n cnt += int((x + i, y + j) in dot)\n ans[cnt] += 1\n\nzero = (H - 2) * (W - 2) - sum(ans)\nans[0] = zero\nprint(*ans, sep=\"\\n\")",
"import sys",
"sys",
"input = sys.stdin.buffer.readline",
"input",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"sys.setrecursionlimit(10 ** 7)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 7",
"10",
"7",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"cand = set()",
"cand",
"set()",
"set",
"dot = set()",
"dot",
"set()",
"set",
"for _ in range(N):\n x, y = map(int, input().split())\n dot.add((x, y))\n for i in range(-2, 1):\n if 1 <= x + i <= H - 2:\n for j in range(-2, 1):\n if 1 <= y + j <= W - 2:\n cand.add((x + i, y + j))",
"_",
"range(N)",
"range",
"N",
"x, y = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"dot.add((x, y))",
"dot.add",
"dot",
"add",
"(x, y)",
"x",
"y",
"for i in range(-2, 1):\n if 1 <= x + i <= H - 2:\n for j in range(-2, 1):\n if 1 <= y + j <= W - 2:\n cand.add((x + i, y + j))",
"i",
"range(-2, 1)",
"range",
"-2",
"1",
"if 1 <= x + i <= H - 2:\n for j in range(-2, 1):\n if 1 <= y + j <= W - 2:\n cand.add((x + i, y + j))",
"1 <= x + i <= H - 2",
"1 <= x + i",
"1",
"x + i",
"x",
"i",
"H - 2",
"H",
"2",
"for j in range(-2, 1):\n if 1 <= y + j <= W - 2:\n cand.add((x + i, y + j))",
"j",
"range(-2, 1)",
"range",
"-2",
"1",
"if 1 <= y + j <= W - 2:\n cand.add((x + i, y + j))",
"1 <= y + j <= W - 2",
"1 <= y + j",
"1",
"y + j",
"y",
"j",
"W - 2",
"W",
"2",
"cand.add((x + i, y + j))",
"cand.add",
"cand",
"add",
"(x + i, y + j)",
"x + i",
"x",
"i",
"y + j",
"y",
"j",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for x, y in cand:\n cnt = 0\n for i in range(3):\n for j in range(3):\n cnt += int((x + i, y + j) in dot)\n ans[cnt] += 1",
"x",
"y",
"cand",
"cnt = 0",
"cnt",
"0",
"for i in range(3):\n for j in range(3):\n cnt += int((x + i, y + j) in dot)\n ",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n cnt += int((x + i, y + j) in dot)\n ",
"j",
"range(3)",
"range",
"3",
"cnt += int((x + i, y + j) in dot)",
"cnt",
"int((x + i, y + j) in dot)",
"int",
"(x + i, y + j) in dot",
"(x + i, y + j)",
"x + i",
"x",
"i",
"y + j",
"y",
"j",
"dot",
"ans[cnt] += 1",
"ans[cnt]",
"ans",
"cnt",
"1",
"zero = (H - 2) * (W - 2) - sum(ans)",
"zero",
"(H - 2) * (W - 2) - sum(ans)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(ans)",
"sum",
"ans",
"ans[0] = zero",
"ans[0]",
"ans",
"0",
"zero",
"print(*ans, sep=\"\\n\")",
"print",
"*ans",
"ans",
"sep=\"\\n\"",
"sep",
"\"\\n\"",
"ans = [0] * 10",
"[0] * 10",
"ans",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"cnt += int((x + i, y + j) in dot)",
"int((x + i, y + j) in dot)",
"cnt",
"cand = set()",
"set()",
"cand",
"x, y = map(int, input().split())",
"map(int, input().split())",
"x",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"y = map(int, input().split())",
"map(int, input().split())",
"y",
"zero = (H - 2) * (W - 2) - sum(ans)",
"(H - 2) * (W - 2) - sum(ans)",
"zero",
"input = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"input",
"dot = set()",
"set()",
"dot",
"cnt = 0",
"0",
"cnt"
] | import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
H, W, N = map(int, input().split())
cand = set()
dot = set()
for _ in range(N):
x, y = map(int, input().split())
dot.add((x, y))
for i in range(-2, 1):
if 1 <= x + i <= H - 2:
for j in range(-2, 1):
if 1 <= y + j <= W - 2:
cand.add((x + i, y + j))
ans = [0] * 10
for x, y in cand:
cnt = 0
for i in range(3):
for j in range(3):
cnt += int((x + i, y + j) in dot)
ans[cnt] += 1
zero = (H - 2) * (W - 2) - sum(ans)
ans[0] = zero
print(*ans, sep="\n") |
[
7,
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,
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,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13
] | [
[
125,
3
],
[
125,
16
],
[
125,
17
],
[
125,
18
],
[
119,
21
],
[
122,
51
],
[
123,
68
],
[
113,
78
],
[
123,
83
],
[
111,
90
],
[
126,
93
],
[
123,
97
],
[
100,
99
],
[
114,
107
],
[
99,
108
],
[
125,
111
],
[
113,
114
],
[
125,
117
],
[
119,
120
],
[
122,
123
],
[
125,
126
]
] | [
"from collections import Counter\n\nH, W, N, *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 <= H - 1 and 2 <= b - j <= W - 1\n )\n\nD = Counter(C.values())\n\nprint((H - 2) * (W - 2) - len(C))\nfor i in range(1, 10):\n print(D[i])",
"from collections import Counter",
"H, W, N, *AB = 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",
"*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 <= H - 1 and 2 <= b - j <= W - 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 <= H - 1 and 2 <= b - j <= W - 1\n )",
"C.update",
"C",
"update",
"(a - i, b - j)",
"a - i",
"a",
"i",
"b - j",
"b",
"j",
"D = Counter(C.values())",
"D",
"Counter(C.values())",
"Counter",
"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 i in range(1, 10):\n print(D[i])",
"i",
"range(1, 10)",
"range",
"1",
"10",
"print(D[i])",
"print",
"D[i]",
"D",
"i",
"H, W, N, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"H",
"D = Counter(C.values())",
"Counter(C.values())",
"D",
"N, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"N",
"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",
"C = Counter()",
"Counter()",
"C",
"W, N, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"W"
] | from collections import Counter
H, W, N, *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 <= H - 1 and 2 <= b - j <= W - 1
)
D = Counter(C.values())
print((H - 2) * (W - 2) - len(C))
for i in range(1, 10):
print(D[i])
|
[
7,
41,
28,
13,
4,
18,
4,
13,
13,
17,
4,
4,
13,
13,
0,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
17,
4,
4,
13,
13,
0,
13,
13,
13,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
0,
13,
39,
2,
13,
13,
2,
13,
13,
14,
2,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
41,
28,
13,
4,
13,
17,
17,
4,
13,
17,
0,
13,
13,
0,
13,
17,
28,
13,
13,
4,
18,
13,
13,
14,
2,
2,
2,
17,
18,
13,
17,
13,
2,
2,
17,
18,
13,
17,
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,
10,
13,
13,
10,
39,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
17,
13,
10,
13,
13
] | [
[
4,
3
],
[
3,
13
],
[
171,
15
],
[
171,
17
],
[
171,
18
],
[
162,
20
],
[
24,
23
],
[
166,
26
],
[
30,
29
],
[
29,
39
],
[
177,
41
],
[
177,
43
],
[
46,
45
],
[
52,
51
],
[
153,
57
],
[
157,
60
],
[
45,
61
],
[
178,
63
],
[
51,
64
],
[
154,
67
],
[
163,
68
],
[
73,
70
],
[
163,
71
],
[
154,
72
],
[
78,
75
],
[
163,
76
],
[
154,
77
],
[
82,
81
],
[
81,
87
],
[
150,
90
],
[
174,
93
],
[
163,
100
],
[
154,
108
],
[
169,
110
],
[
154,
115
],
[
172,
117
],
[
122,
119
],
[
151,
120
],
[
159,
124
],
[
130,
127
],
[
151,
128
],
[
172,
133
],
[
169,
136
],
[
160,
138
],
[
175,
138
],
[
141,
140
],
[
151,
147
],
[
140,
148
],
[
150,
151
],
[
153,
154
],
[
177,
157
],
[
159,
160
],
[
162,
163
],
[
171,
166
],
[
171,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
]
] | [
"h,w,n = [int(_) for _ in input().split(\" \")]\nd = {}\nfor _ in range(n):\n a, b = [int(_) for _ in input().split(\" \")]\n for i in [-1, 0, 1]:\n for j in [-1, 0, 1]:\n k = (a+i,b+j)\n if k in d:\n d[k] += 1\n else:\n d[k] = 1\n\nans = {i:0 for i in range(1,10)}\ns = 0\nfor k, v in d.items():\n if 1 < k[0] < h and 1 < k[1] < w:\n ans[v] += 1\n s += 1\nans[0] = (w-2) * (h-2) - s\n\nfor _ in range(10):\n print(ans[_])",
"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",
"d = {}",
"d",
"{}",
"for _ in range(n):\n a, b = [int(_) for _ in input().split(\" \")]\n for i in [-1, 0, 1]:\n for j in [-1, 0, 1]:\n k = (a+i,b+j)\n if k in d:\n d[k] += 1\n else:\n d[k] = 1",
"_",
"range(n)",
"range",
"n",
"int(_) for _ in input().split(\" \")",
"for _ in input().split(\" \")",
"_",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"for _ in input().split(\" \")",
"int(_)",
"int",
"_",
"a, b = [int(_) for _ in input().split(\" \")]",
"a",
"[int(_) for _ in input().split(\" \")]",
"b",
"for i in [-1, 0, 1]:\n for j in [-1, 0, 1]:\n k = (a+i,b+j)\n if k in d:\n d[k] += 1\n else:\n d[k] = 1",
"i",
"[-1, 0, 1]",
"-1",
"0",
"1",
"for j in [-1, 0, 1]:\n k = (a+i,b+j)\n if k in d:\n d[k] += 1\n else:\n d[k] = 1",
"j",
"[-1, 0, 1]",
"-1",
"0",
"1",
"k = (a+i,b+j)",
"k",
"(a+i,b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"if k in d:\n d[k] += 1\n else:\n d[k] = 1",
"k in d",
"k",
"d",
"d[k] += 1",
"d[k]",
"d",
"k",
"1",
"d[k] = 1",
"d[k]",
"d",
"k",
"1",
"i:0 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)",
"i",
"0",
"ans = {i:0 for i in range(1,10)}",
"ans",
"{i:0 for i in range(1,10)}",
"s = 0",
"s",
"0",
"for k, v in d.items():\n if 1 < k[0] < h and 1 < k[1] < w:\n ans[v] += 1\n s += 1",
"k",
"v",
"d.items()",
"d.items",
"d",
"items",
"if 1 < k[0] < h and 1 < k[1] < w:\n ans[v] += 1\n s += 1",
"1 < k[0] < h and 1 < k[1] < w",
"1 < k[0] < h",
"1 < k[0]",
"1",
"k[0]",
"k",
"0",
"h",
"1 < k[1] < w",
"1 < k[1]",
"1",
"k[1]",
"k",
"1",
"w",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"s += 1",
"s",
"1",
"ans[0] = (w-2) * (h-2) - s",
"ans[0]",
"ans",
"0",
"(w-2) * (h-2) - s",
"(w-2) * (h-2)",
"w-2",
"w",
"2",
"h-2",
"h",
"2",
"s",
"for _ in range(10):\n print(ans[_])",
"_",
"range(10)",
"range",
"10",
"print(ans[_])",
"print",
"ans[_]",
"ans",
"_",
"ans = {i:0 for i in range(1,10)}",
"{i:0 for i in range(1,10)}",
"ans",
"k = (a+i,b+j)",
"(a+i,b+j)",
"k",
"a, b = [int(_) for _ in input().split(\" \")]",
"[int(_) for _ in input().split(\" \")]",
"a",
"s += 1",
"1",
"s",
"d = {}",
"{}",
"d",
"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",
"w,n = [int(_) for _ in input().split(\" \")]",
"[int(_) for _ in input().split(\" \")]",
"w",
"s = 0",
"0",
"s",
"b = [int(_) for _ in input().split(\" \")]",
"[int(_) for _ in input().split(\" \")]",
"b"
] | h,w,n = [int(_) for _ in input().split(" ")]
d = {}
for _ in range(n):
a, b = [int(_) for _ in input().split(" ")]
for i in [-1, 0, 1]:
for j in [-1, 0, 1]:
k = (a+i,b+j)
if k in d:
d[k] += 1
else:
d[k] = 1
ans = {i:0 for i in range(1,10)}
s = 0
for k, v in d.items():
if 1 < k[0] < h and 1 < k[1] < w:
ans[v] += 1
s += 1
ans[0] = (w-2) * (h-2) - s
for _ in range(10):
print(ans[_]) |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
39,
0,
13,
18,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
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,
4,
13,
39,
2,
13,
13,
2,
13,
13,
4,
18,
13,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
13,
0,
13,
17,
0,
18,
13,
17,
17,
0,
18,
13,
13,
17,
0,
13,
17,
0,
13,
13,
0,
18,
13,
17,
17,
0,
18,
13,
13,
17,
4,
13,
31,
13,
0,
13,
17,
10,
17,
13,
10,
17,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
18,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
18,
13
] | [
[
212,
4
],
[
170,
11
],
[
197,
14
],
[
171,
16
],
[
182,
19
],
[
213,
26
],
[
182,
28
],
[
182,
29
],
[
194,
31
],
[
38,
37
],
[
177,
40
],
[
203,
42
],
[
213,
49
],
[
203,
51
],
[
200,
53
],
[
185,
56
],
[
60,
59
],
[
195,
59
],
[
201,
66
],
[
192,
66
],
[
59,
67
],
[
174,
69
],
[
73,
72
],
[
195,
72
],
[
186,
79
],
[
204,
79
],
[
72,
80
],
[
183,
82
],
[
198,
85
],
[
201,
88
],
[
192,
88
],
[
59,
89
],
[
186,
91
],
[
204,
91
],
[
72,
92
],
[
171,
95
],
[
206,
98
],
[
107,
104
],
[
207,
105
],
[
174,
109
],
[
183,
112
],
[
188,
115
],
[
209,
118
],
[
122,
121
],
[
171,
121
],
[
121,
125
],
[
189,
126
],
[
180,
126
],
[
164,
128
],
[
134,
131
],
[
207,
132
],
[
139,
136
],
[
207,
137
],
[
210,
138
],
[
168,
138
],
[
165,
138
],
[
167,
141
],
[
179,
144
],
[
121,
145
],
[
150,
147
],
[
207,
148
],
[
155,
152
],
[
207,
153
],
[
168,
154
],
[
165,
154
],
[
210,
154
],
[
207,
159
],
[
162,
161
],
[
164,
165
],
[
167,
168
],
[
170,
171
],
[
182,
174
],
[
182,
177
],
[
121,
179
],
[
179,
180
],
[
182,
183
],
[
185,
186
],
[
188,
189
],
[
203,
192
],
[
194,
195
],
[
197,
198
],
[
200,
201
],
[
203,
204
],
[
206,
207
],
[
209,
210
],
[
212,
213
]
] | [
"import sys\ninput = sys.stdin.readline\n\nlst = []\nlst_append = lst.append\nH, W, N = map(int, input().split())\ntmplst = [-1, 0, 1]\nfor _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in tmplst:\n if 1 <= a + i <= H - 2:\n for j in tmplst:\n if 1 <= b + j <= W - 2:\n lst_append((a + i, b + j))\n\nlst.sort()\nans = [0] * 10\nans[0] = (H - 2) * (W - 2)\n\ntmp = None\ncount = 0\nfor i in lst:\n if i == tmp:\n count += 1\n else:\n ans[0] -= 1\n ans[count] += 1\n count = 1\n tmp = i\n\nans[0] -= 1\nans[count] += 1\nprint (*ans, sep = '\\n')",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"lst = []",
"lst",
"[]",
"lst_append = lst.append",
"lst_append",
"lst.append",
"lst",
"append",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"tmplst = [-1, 0, 1]",
"tmplst",
"[-1, 0, 1]",
"-1",
"0",
"1",
"for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in tmplst:\n if 1 <= a + i <= H - 2:\n for j in tmplst:\n if 1 <= b + j <= W - 2:\n lst_append((a + i, b + j))",
"_",
"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 tmplst:\n if 1 <= a + i <= H - 2:\n for j in tmplst:\n if 1 <= b + j <= W - 2:\n lst_append((a + i, b + j))",
"i",
"tmplst",
"if 1 <= a + i <= H - 2:\n for j in tmplst:\n if 1 <= b + j <= W - 2:\n lst_append((a + i, b + j))",
"1 <= a + i <= H - 2",
"1 <= a + i",
"1",
"a + i",
"a",
"i",
"H - 2",
"H",
"2",
"for j in tmplst:\n if 1 <= b + j <= W - 2:\n lst_append((a + i, b + j))",
"j",
"tmplst",
"if 1 <= b + j <= W - 2:\n lst_append((a + i, b + j))",
"1 <= b + j <= W - 2",
"1 <= b + j",
"1",
"b + j",
"b",
"j",
"W - 2",
"W",
"2",
"lst_append((a + i, b + j))",
"lst_append",
"(a + i, b + j)",
"a + i",
"a",
"i",
"b + j",
"b",
"j",
"lst.sort()",
"lst.sort",
"lst",
"sort",
"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",
"tmp = None",
"tmp",
"None",
"count = 0",
"count",
"0",
"for i in lst:\n if i == tmp:\n count += 1\n else:\n ans[0] -= 1\n ans[count] += 1\n count = 1\n tmp = i",
"i",
"lst",
"if i == tmp:\n count += 1\n else:\n ans[0] -= 1\n ans[count] += 1\n count = 1\n tmp = i",
"i == tmp",
"i",
"tmp",
"count += 1",
"count",
"1",
"ans[0] -= 1",
"ans[0]",
"ans",
"0",
"1",
"ans[count] += 1",
"ans[count]",
"ans",
"count",
"1",
"count = 1",
"count",
"1",
"tmp = i",
"tmp",
"i",
"ans[0] -= 1",
"ans[0]",
"ans",
"0",
"1",
"ans[count] += 1",
"ans[count]",
"ans",
"count",
"1",
"print (*ans, sep = '\\n')",
"print",
"*ans",
"ans",
"sep = '\\n'",
"sep",
"'\\n'",
"count += 1",
"1",
"count",
"count = 1",
"1",
"count",
"lst = []",
"[]",
"lst",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"tmp = i",
"i",
"tmp",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"b -= 1",
"1",
"b",
"tmp = None",
"None",
"tmp",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"tmplst = [-1, 0, 1]",
"[-1, 0, 1]",
"tmplst",
"lst_append = lst.append",
"lst.append",
"lst_append",
"a -= 1",
"1",
"a",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"ans = [0] * 10",
"[0] * 10",
"ans",
"count = 0",
"0",
"count",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input"
] | import sys
input = sys.stdin.readline
lst = []
lst_append = lst.append
H, W, N = map(int, input().split())
tmplst = [-1, 0, 1]
for _ in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
for i in tmplst:
if 1 <= a + i <= H - 2:
for j in tmplst:
if 1 <= b + j <= W - 2:
lst_append((a + i, b + j))
lst.sort()
ans = [0] * 10
ans[0] = (H - 2) * (W - 2)
tmp = None
count = 0
for i in lst:
if i == tmp:
count += 1
else:
ans[0] -= 1
ans[count] += 1
count = 1
tmp = i
ans[0] -= 1
ans[count] += 1
print (*ans, sep = '\n') |
[
7,
15,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
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,
2,
39,
17,
17,
28,
39,
13,
13,
13,
4,
13,
4,
18,
13,
13,
14,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
17,
17,
0,
18,
13,
17,
18,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
18,
13
] | [
[
170,
4
],
[
167,
14
],
[
171,
21
],
[
167,
23
],
[
167,
24
],
[
28,
27
],
[
168,
30
],
[
171,
40
],
[
155,
43
],
[
152,
46
],
[
56,
55
],
[
66,
65
],
[
55,
79
],
[
159,
81
],
[
65,
86
],
[
162,
88
],
[
96,
91
],
[
153,
92
],
[
164,
98
],
[
153,
112
],
[
120,
117
],
[
165,
118
],
[
125,
122
],
[
165,
123
],
[
159,
127
],
[
162,
130
],
[
134,
133
],
[
142,
139
],
[
165,
140
],
[
165,
143
],
[
133,
144
],
[
147,
146
],
[
165,
146
],
[
146,
150
],
[
152,
153
],
[
155,
156
],
[
167,
159
],
[
167,
162
],
[
164,
165
],
[
167,
168
],
[
170,
171
]
] | [
"import sys\ninput = sys.stdin.buffer.readline\n\nfrom collections import defaultdict\n\nH, W, N = map(int, input().split())\nAB = [list(map(int, input().split())) for _ in range(N)]\n\ncounter = defaultdict(int)\nfor a, b in AB:\n for aa in range(a - 1, a + 2):\n for bb in range(b - 1, b + 2):\n if 2 <= aa <= H - 1 and 2 <= bb <= W - 1:\n counter[(aa, bb)] += 1\n\nanswer = [0] * (10)\nfor (x, y), n in list(counter.items()):\n if n:\n answer[n] += 1\nanswer[0] = (H - 2) * (W - 2)\nfor i in range(1, 10):\n answer[0] -= answer[i]\n \nfor a in answer:\n print(a)",
"import sys",
"sys",
"input = sys.stdin.buffer.readline",
"input",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"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)]",
"counter = defaultdict(int)",
"counter",
"defaultdict(int)",
"defaultdict",
"int",
"for a, b in AB:\n for aa in range(a - 1, a + 2):\n for bb in range(b - 1, b + 2):\n if 2 <= aa <= H - 1 and 2 <= bb <= W - 1:\n counter[(aa, bb)] += 1",
"a",
"b",
"AB",
"for aa in range(a - 1, a + 2):\n for bb in range(b - 1, b + 2):\n if 2 <= aa <= H - 1 and 2 <= bb <= W - 1:\n counter[(aa, bb)] += 1",
"aa",
"range(a - 1, a + 2)",
"range",
"a - 1",
"a",
"1",
"a + 2",
"a",
"2",
"for bb in range(b - 1, b + 2):\n if 2 <= aa <= H - 1 and 2 <= bb <= W - 1:\n counter[(aa, bb)] += 1",
"bb",
"range(b - 1, b + 2)",
"range",
"b - 1",
"b",
"1",
"b + 2",
"b",
"2",
"if 2 <= aa <= H - 1 and 2 <= bb <= W - 1:\n counter[(aa, bb)] += 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",
"counter[(aa, bb)] += 1",
"counter[(aa, bb)]",
"counter",
"(aa, bb)",
"aa",
"bb",
"1",
"answer = [0] * (10)",
"answer",
"[0] * (10)",
"[0]",
"0",
"10",
"for (x, y), n in list(counter.items()):\n if n:\n answer[n] += 1",
"(x, y)",
"x",
"y",
"n",
"list(counter.items())",
"list",
"counter.items()",
"counter.items",
"counter",
"items",
"if n:\n answer[n] += 1",
"n",
"answer[n] += 1",
"answer[n]",
"answer",
"n",
"1",
"answer[0] = (H - 2) * (W - 2)",
"answer[0]",
"answer",
"0",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"for i in range(1, 10):\n answer[0] -= answer[i]\n ",
"i",
"range(1, 10)",
"range",
"1",
"10",
"answer[0] -= answer[i]",
"answer[0]",
"answer",
"0",
"answer[i]",
"answer",
"i",
"for a in answer:\n print(a)",
"a",
"answer",
"print(a)",
"print",
"a",
"counter = defaultdict(int)",
"defaultdict(int)",
"counter",
"AB = [list(map(int, input().split())) for _ in range(N)]",
"[list(map(int, input().split())) for _ in range(N)]",
"AB",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"answer = [0] * (10)",
"[0] * (10)",
"answer",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"input = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"input"
] | import sys
input = sys.stdin.buffer.readline
from collections import defaultdict
H, W, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
counter = defaultdict(int)
for a, b in AB:
for aa in range(a - 1, a + 2):
for bb in range(b - 1, b + 2):
if 2 <= aa <= H - 1 and 2 <= bb <= W - 1:
counter[(aa, bb)] += 1
answer = [0] * (10)
for (x, y), n in list(counter.items()):
if n:
answer[n] += 1
answer[0] = (H - 2) * (W - 2)
for i in range(1, 10):
answer[0] -= answer[i]
for a in answer:
print(a) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
12,
13,
41,
14,
2,
2,
40,
17,
13,
2,
13,
17,
2,
40,
17,
13,
2,
13,
17,
14,
2,
39,
13,
13,
13,
0,
18,
13,
39,
13,
13,
17,
0,
18,
13,
39,
13,
13,
17,
23,
13,
23,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
4,
13,
13,
13,
4,
13,
2,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
13,
4,
13,
2,
13,
17,
13,
4,
13,
13,
2,
13,
17,
4,
13,
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,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
12,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] | [
[
197,
2
],
[
197,
11
],
[
197,
12
],
[
212,
14
],
[
57,
25
],
[
59,
32
],
[
48,
43
],
[
55,
50
],
[
57,
57
],
[
59,
59
],
[
62,
61
],
[
195,
64
],
[
209,
66
],
[
209,
75
],
[
203,
77
],
[
206,
80
],
[
186,
83
],
[
204,
84
],
[
210,
84
],
[
207,
85
],
[
201,
85
],
[
186,
87
],
[
204,
89
],
[
210,
89
],
[
207,
92
],
[
201,
92
],
[
186,
95
],
[
204,
97
],
[
210,
97
],
[
207,
100
],
[
201,
100
],
[
186,
103
],
[
204,
105
],
[
210,
105
],
[
207,
108
],
[
201,
108
],
[
186,
111
],
[
204,
113
],
[
210,
113
],
[
207,
116
],
[
201,
116
],
[
186,
119
],
[
204,
121
],
[
210,
121
],
[
207,
123
],
[
201,
123
],
[
186,
125
],
[
204,
127
],
[
210,
127
],
[
207,
129
],
[
201,
129
],
[
186,
131
],
[
204,
132
],
[
210,
132
],
[
207,
134
],
[
201,
134
],
[
186,
137
],
[
204,
138
],
[
210,
138
],
[
207,
140
],
[
201,
140
],
[
188,
143
],
[
152,
149
],
[
189,
150
],
[
192,
154
],
[
198,
157
],
[
161,
160
],
[
213,
160
],
[
168,
163
],
[
189,
164
],
[
213,
166
],
[
160,
167
],
[
173,
170
],
[
189,
171
],
[
176,
175
],
[
189,
182
],
[
175,
183
],
[
188,
189
],
[
197,
192
],
[
197,
195
],
[
197,
198
],
[
209,
201
],
[
203,
204
],
[
206,
207
],
[
209,
210
],
[
212,
213
]
] | [
"h,w,n=map(int,input().split())\nd=dict()\ndef change(a,b):\n global h,w,d\n if 1<=a<h-1 and 1<=b<w-1:\n if (a,b) in d:\n d[(a,b)]+=1\n else:\n d[(a,b)]=1\nfor i in range(n):\n a,b=map(int,input().split())\n a-=1\n b-=1\n change(a,b)\n change(a-1,b-1)\n change(a-1,b+1)\n change(a+1,b-1)\n change(a+1,b+1)\n change(a-1,b)\n change(a+1,b)\n change(a,b-1)\n change(a,b+1)\nans=[0]*10\nans[0]=(h-2)*(w-2)\n#print(d)\nfor i in d:\n ans[d[i]]+=1\n ans[0]-=1\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",
"d=dict()",
"d",
"dict()",
"dict",
"def change(a,b):\n global h,w,d\n if 1<=a<h-1 and 1<=b<w-1:\n if (a,b) in d:\n d[(a,b)]+=1\n else:\n d[(a,b)]=1",
"change",
"global h,w,d",
"if 1<=a<h-1 and 1<=b<w-1:\n if (a,b) in d:\n d[(a,b)]+=1\n else:\n d[(a,b)]=1",
"1<=a<h-1 and 1<=b<w-1",
"1<=a<h-1",
"1<=a",
"1",
"a",
"h-1",
"h",
"1",
"1<=b<w-1",
"1<=b",
"1",
"b",
"w-1",
"w",
"1",
"if (a,b) in d:\n d[(a,b)]+=1\n else:\n d[(a,b)]=1",
"(a,b) in d",
"(a,b)",
"a",
"b",
"d",
"d[(a,b)]+=1",
"d[(a,b)]",
"d",
"(a,b)",
"a",
"b",
"1",
"d[(a,b)]=1",
"d[(a,b)]",
"d",
"(a,b)",
"a",
"b",
"1",
"a",
"a",
"b",
"b",
"for i in range(n):\n a,b=map(int,input().split())\n a-=1\n b-=1\n change(a,b)\n change(a-1,b-1)\n change(a-1,b+1)\n change(a+1,b-1)\n change(a+1,b+1)\n change(a-1,b)\n change(a+1,b)\n change(a,b-1)\n change(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",
"change(a,b)",
"change",
"a",
"b",
"change(a-1,b-1)",
"change",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"change(a-1,b+1)",
"change",
"a-1",
"a",
"1",
"b+1",
"b",
"1",
"change(a+1,b-1)",
"change",
"a+1",
"a",
"1",
"b-1",
"b",
"1",
"change(a+1,b+1)",
"change",
"a+1",
"a",
"1",
"b+1",
"b",
"1",
"change(a-1,b)",
"change",
"a-1",
"a",
"1",
"b",
"change(a+1,b)",
"change",
"a+1",
"a",
"1",
"b",
"change(a,b-1)",
"change",
"a",
"b-1",
"b",
"1",
"change(a,b+1)",
"change",
"a",
"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 i in d:\n ans[d[i]]+=1\n ans[0]-=1",
"i",
"d",
"ans[d[i]]+=1",
"ans[d[i]]",
"ans",
"d[i]",
"d",
"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",
"def change(a,b):\n global h,w,d\n if 1<=a<h-1 and 1<=b<w-1:\n if (a,b) in d:\n d[(a,b)]+=1\n else:\n d[(a,b)]=1",
"def change(a,b):\n global h,w,d\n if 1<=a<h-1 and 1<=b<w-1:\n if (a,b) in d:\n d[(a,b)]+=1\n else:\n d[(a,b)]=1",
"change",
"ans=[0]*10",
"[0]*10",
"ans",
"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",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"a-=1",
"1",
"a",
"b-=1",
"1",
"b",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"d=dict()",
"dict()",
"d"
] | h,w,n=map(int,input().split())
d=dict()
def change(a,b):
global h,w,d
if 1<=a<h-1 and 1<=b<w-1:
if (a,b) in d:
d[(a,b)]+=1
else:
d[(a,b)]=1
for i in range(n):
a,b=map(int,input().split())
a-=1
b-=1
change(a,b)
change(a-1,b-1)
change(a-1,b+1)
change(a+1,b-1)
change(a+1,b+1)
change(a-1,b)
change(a+1,b)
change(a,b-1)
change(a,b+1)
ans=[0]*10
ans[0]=(h-2)*(w-2)
#print(d)
for i in d:
ans[d[i]]+=1
ans[0]-=1
for i in range(10):
print(ans[i])
|
[
7,
12,
13,
15,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
0,
13,
39,
17,
17,
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,
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,
4,
13,
31,
13,
0,
13,
17,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
8,
7
],
[
15,
14
],
[
7,
21
],
[
15,
23
],
[
15,
24
],
[
27,
26
],
[
35,
32
],
[
26,
33
],
[
14,
37
],
[
23,
40
],
[
44,
43
],
[
50,
49
],
[
55,
54
],
[
24,
57
],
[
60,
59
],
[
7,
66
],
[
60,
68
],
[
71,
70
],
[
74,
73
],
[
77,
76
],
[
43,
76
],
[
70,
83
],
[
59,
83
],
[
76,
84
],
[
14,
86
],
[
90,
89
],
[
43,
89
],
[
73,
96
],
[
68,
96
],
[
89,
97
],
[
23,
99
],
[
103,
102
],
[
49,
104
],
[
70,
107
],
[
59,
107
],
[
76,
108
],
[
73,
110
],
[
68,
110
],
[
89,
111
],
[
122,
113
],
[
49,
114
],
[
70,
117
],
[
59,
117
],
[
76,
118
],
[
73,
120
],
[
68,
120
],
[
89,
121
],
[
70,
129
],
[
59,
129
],
[
76,
130
],
[
14,
132
],
[
73,
138
],
[
68,
138
],
[
89,
139
],
[
23,
141
],
[
147,
144
],
[
26,
145
],
[
102,
146
],
[
154,
149
],
[
26,
150
],
[
102,
152
],
[
26,
158
],
[
161,
160
],
[
170,
167
]
] | [
"def main():\n from collections import defaultdict\n import sys\n input = sys.stdin.readline\n\n H, W, N = map(int, input().split())\n ans = [0] * 10\n ans[0] = (H - 2) * (W - 2)\n # print (ans)\n tmplst = [-1, 0, 1]\n dic = defaultdict(int)\n for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in tmplst:\n if 0 <= a + i <= H - 1:\n for j in tmplst:\n if 0 <= b + j <= W - 1: #範囲に入っている\n tmp = dic[(a + i, b + j)]\n dic[(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 print (*ans, sep = '\\n')\n\nif __name__ == '__main__':\n main()",
"def main():\n from collections import defaultdict\n import sys\n input = sys.stdin.readline\n\n H, W, N = map(int, input().split())\n ans = [0] * 10\n ans[0] = (H - 2) * (W - 2)\n # print (ans)\n tmplst = [-1, 0, 1]\n dic = defaultdict(int)\n for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in tmplst:\n if 0 <= a + i <= H - 1:\n for j in tmplst:\n if 0 <= b + j <= W - 1: #範囲に入っている\n tmp = dic[(a + i, b + j)]\n dic[(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 print (*ans, sep = '\\n')",
"main",
"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",
"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",
"tmplst = [-1, 0, 1]",
"tmplst",
"[-1, 0, 1]",
"-1",
"0",
"1",
"dic = defaultdict(int)",
"dic",
"defaultdict(int)",
"defaultdict",
"int",
"for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in tmplst:\n if 0 <= a + i <= H - 1:\n for j in tmplst:\n if 0 <= b + j <= W - 1: #範囲に入っている\n tmp = dic[(a + i, b + j)]\n dic[(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 ",
"_",
"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 tmplst:\n if 0 <= a + i <= H - 1:\n for j in tmplst:\n if 0 <= b + j <= W - 1: #範囲に入っている\n tmp = dic[(a + i, b + j)]\n dic[(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",
"tmplst",
"if 0 <= a + i <= H - 1:\n for j in tmplst:\n if 0 <= b + j <= W - 1: #範囲に入っている\n tmp = dic[(a + i, b + j)]\n dic[(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 tmplst:\n if 0 <= b + j <= W - 1: #範囲に入っている\n tmp = dic[(a + i, b + j)]\n dic[(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",
"tmplst",
"if 0 <= b + j <= W - 1: #範囲に入っている\n tmp = dic[(a + i, b + j)]\n dic[(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 = dic[(a + i, b + j)]",
"tmp",
"dic[(a + i, b + j)]",
"dic",
"(a + i, b + j)",
"a + i",
"a",
"i",
"b + j",
"b",
"j",
"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",
"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",
"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 from collections import defaultdict\n import sys\n input = sys.stdin.readline\n\n H, W, N = map(int, input().split())\n ans = [0] * 10\n ans[0] = (H - 2) * (W - 2)\n # print (ans)\n tmplst = [-1, 0, 1]\n dic = defaultdict(int)\n for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in tmplst:\n if 0 <= a + i <= H - 1:\n for j in tmplst:\n if 0 <= b + j <= W - 1: #範囲に入っている\n tmp = dic[(a + i, b + j)]\n dic[(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 print (*ans, sep = '\\n')",
"def main():\n from collections import defaultdict\n import sys\n input = sys.stdin.readline\n\n H, W, N = map(int, input().split())\n ans = [0] * 10\n ans[0] = (H - 2) * (W - 2)\n # print (ans)\n tmplst = [-1, 0, 1]\n dic = defaultdict(int)\n for _ in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in tmplst:\n if 0 <= a + i <= H - 1:\n for j in tmplst:\n if 0 <= b + j <= W - 1: #範囲に入っている\n tmp = dic[(a + i, b + j)]\n dic[(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 print (*ans, sep = '\\n')",
"main"
] | def main():
from collections import defaultdict
import sys
input = sys.stdin.readline
H, W, N = map(int, input().split())
ans = [0] * 10
ans[0] = (H - 2) * (W - 2)
# print (ans)
tmplst = [-1, 0, 1]
dic = defaultdict(int)
for _ in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
for i in tmplst:
if 0 <= a + i <= H - 1:
for j in tmplst:
if 0 <= b + j <= W - 1: #範囲に入っている
tmp = dic[(a + i, b + j)]
dic[(a + i, b + j)] += 1
if 1 <= a + i <= H - 2 and 1 <= b + j <= W - 2:
ans[tmp] -= 1
ans[tmp + 1] += 1
print (*ans, sep = '\n')
if __name__ == '__main__':
main() |
[
7,
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,
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,
4,
18,
17,
13,
4,
13,
13,
13,
10,
4,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
132,
3
],
[
132,
16
],
[
132,
17
],
[
132,
18
],
[
126,
21
],
[
135,
51
],
[
136,
68
],
[
123,
78
],
[
85,
84
],
[
136,
87
],
[
93,
90
],
[
124,
91
],
[
84,
92
],
[
98,
95
],
[
124,
96
],
[
133,
101
],
[
121,
104
],
[
136,
108
],
[
124,
118
],
[
132,
121
],
[
123,
124
],
[
126,
127
],
[
132,
130
],
[
132,
133
],
[
135,
136
]
] | [
"from collections import Counter\n\nH, W, N, *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 <= H - 1 and 2 <= b - j <= W - 1\n )\n\nD = [0] * 10\nfor v in C.values():\n D[v] += 1\n\nD[0] = (H - 2) * (W - 2) - len(C)\nprint(\"\\n\".join(map(str, D)))",
"from collections import Counter",
"H, W, N, *AB = 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",
"*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 <= H - 1 and 2 <= b - j <= W - 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 <= H - 1 and 2 <= b - j <= W - 1\n )",
"C.update",
"C",
"update",
"(a - i, b - j)",
"a - i",
"a",
"i",
"b - j",
"b",
"j",
"D = [0] * 10",
"D",
"[0] * 10",
"[0]",
"0",
"10",
"for v in C.values():\n D[v] += 1",
"v",
"C.values()",
"C.values",
"C",
"values",
"D[v] += 1",
"D[v]",
"D",
"v",
"1",
"D[0] = (H - 2) * (W - 2) - len(C)",
"D[0]",
"D",
"0",
"(H - 2) * (W - 2) - len(C)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"len(C)",
"len",
"C",
"print(\"\\n\".join(map(str, D)))",
"print",
"\"\\n\".join(map(str, D))",
"\"\\n\".join",
"\"\\n\"",
"join",
"map(str, D)",
"map",
"str",
"D",
"W, N, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"W",
"D = [0] * 10",
"[0] * 10",
"D",
"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",
"N, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"N",
"H, W, N, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"H",
"C = Counter()",
"Counter()",
"C"
] | from collections import Counter
H, W, N, *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 <= H - 1 and 2 <= b - j <= W - 1
)
D = [0] * 10
for v in C.values():
D[v] += 1
D[0] = (H - 2) * (W - 2) - len(C)
print("\n".join(map(str, D)))
|
[
7,
12,
13,
15,
0,
13,
18,
13,
13,
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,
2,
39,
17,
17,
0,
13,
17,
28,
13,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
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,
28,
39,
13,
13,
13,
4,
18,
13,
13,
14,
2,
2,
40,
17,
13,
13,
2,
40,
17,
13,
13,
0,
18,
13,
13,
17,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
18,
13,
39,
17,
4,
13,
13,
4,
13,
10,
12,
13
] | [
[
6,
5
],
[
11,
10
],
[
5,
17
],
[
11,
19
],
[
11,
20
],
[
24,
23
],
[
20,
27
],
[
5,
37
],
[
41,
40
],
[
44,
43
],
[
50,
49
],
[
57,
56
],
[
63,
62
],
[
77,
68
],
[
49,
69
],
[
56,
73
],
[
62,
76
],
[
49,
80
],
[
56,
85
],
[
62,
88
],
[
49,
98
],
[
10,
106
],
[
19,
111
],
[
116,
113
],
[
43,
114
],
[
10,
122
],
[
19,
125
],
[
43,
129
],
[
132,
131
],
[
43,
133
],
[
131,
138
],
[
143,
140
]
] | [
"def main():\n from sys import stdin\n input = stdin.readline\n h, w, n = map(int, input().split())\n ab = [list(map(int, input().split())) for _ in [0]*n]\n\n ans = [0]*10\n d = {}\n\n for a, b in ab:\n for j in range(-1, 2):\n for k in range(-1, 2):\n d[(a+j, b+k)] = d.get((a+j, b+k), 0)+1\n\n for (i, j), k in d.items():\n if 2 <= i < h and 2 <= j < w:\n ans[k] += 1\n\n print((h-2)*(w-2)-sum(ans))\n for i in ans[1:]:\n print(i)\n\n\nmain()",
"def main():\n from sys import stdin\n input = stdin.readline\n h, w, n = map(int, input().split())\n ab = [list(map(int, input().split())) for _ in [0]*n]\n\n ans = [0]*10\n d = {}\n\n for a, b in ab:\n for j in range(-1, 2):\n for k in range(-1, 2):\n d[(a+j, b+k)] = d.get((a+j, b+k), 0)+1\n\n for (i, j), k in d.items():\n if 2 <= i < h and 2 <= j < w:\n ans[k] += 1\n\n print((h-2)*(w-2)-sum(ans))\n for i in ans[1:]:\n print(i)",
"main",
"from sys import stdin",
"input = stdin.readline",
"input",
"stdin.readline",
"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 _ 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]",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"d = {}",
"d",
"{}",
"for a, b in ab:\n for j in range(-1, 2):\n for k in range(-1, 2):\n d[(a+j, b+k)] = d.get((a+j, b+k), 0)+1\n\n ",
"a",
"b",
"ab",
"for j in range(-1, 2):\n for k in range(-1, 2):\n d[(a+j, b+k)] = d.get((a+j, b+k), 0)+1\n\n ",
"j",
"range(-1, 2)",
"range",
"-1",
"2",
"for k in range(-1, 2):\n d[(a+j, b+k)] = d.get((a+j, b+k), 0)+1\n\n ",
"k",
"range(-1, 2)",
"range",
"-1",
"2",
"d[(a+j, b+k)] = d.get((a+j, b+k), 0)+1",
"d[(a+j, b+k)]",
"d",
"(a+j, b+k)",
"a+j",
"a",
"j",
"b+k",
"b",
"k",
"d.get((a+j, b+k), 0)+1",
"d.get((a+j, b+k), 0)",
"d.get",
"d",
"get",
"(a+j, b+k)",
"a+j",
"a",
"j",
"b+k",
"b",
"k",
"0",
"1",
"for (i, j), k in d.items():\n if 2 <= i < h and 2 <= j < w:\n ans[k] += 1\n\n ",
"(i, j)",
"i",
"j",
"k",
"d.items()",
"d.items",
"d",
"items",
"if 2 <= i < h and 2 <= j < w:\n ans[k] += 1\n\n ",
"2 <= i < h and 2 <= j < w",
"2 <= i < h",
"2 <= i",
"2",
"i",
"h",
"2 <= j < w",
"2 <= j",
"2",
"j",
"w",
"ans[k] += 1",
"ans[k]",
"ans",
"k",
"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[1:]:\n print(i)",
"i",
"ans[1:]",
"ans",
"1:",
"1",
"print(i)",
"print",
"i",
"main()",
"main",
"def main():\n from sys import stdin\n input = stdin.readline\n h, w, n = map(int, input().split())\n ab = [list(map(int, input().split())) for _ in [0]*n]\n\n ans = [0]*10\n d = {}\n\n for a, b in ab:\n for j in range(-1, 2):\n for k in range(-1, 2):\n d[(a+j, b+k)] = d.get((a+j, b+k), 0)+1\n\n for (i, j), k in d.items():\n if 2 <= i < h and 2 <= j < w:\n ans[k] += 1\n\n print((h-2)*(w-2)-sum(ans))\n for i in ans[1:]:\n print(i)",
"def main():\n from sys import stdin\n input = stdin.readline\n h, w, n = map(int, input().split())\n ab = [list(map(int, input().split())) for _ in [0]*n]\n\n ans = [0]*10\n d = {}\n\n for a, b in ab:\n for j in range(-1, 2):\n for k in range(-1, 2):\n d[(a+j, b+k)] = d.get((a+j, b+k), 0)+1\n\n for (i, j), k in d.items():\n if 2 <= i < h and 2 <= j < w:\n ans[k] += 1\n\n print((h-2)*(w-2)-sum(ans))\n for i in ans[1:]:\n print(i)",
"main"
] | def main():
from sys import stdin
input = stdin.readline
h, w, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in [0]*n]
ans = [0]*10
d = {}
for a, b in ab:
for j in range(-1, 2):
for k in range(-1, 2):
d[(a+j, b+k)] = d.get((a+j, b+k), 0)+1
for (i, j), k in d.items():
if 2 <= i < h and 2 <= j < w:
ans[k] += 1
print((h-2)*(w-2)-sum(ans))
for i in ans[1:]:
print(i)
main() |
[
7,
15,
13,
12,
13,
12,
13,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
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,
2,
13,
17,
2,
13,
17,
13,
2,
2,
13,
17,
2,
13,
17,
14,
2,
2,
13,
17,
2,
13,
17,
14,
2,
2,
13,
2,
13,
17,
2,
13,
2,
13,
17,
0,
13,
2,
2,
13,
13,
13,
14,
2,
13,
13,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
28,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13
] | [
[
10,
9
],
[
159,
16
],
[
10,
18
],
[
10,
19
],
[
22,
21
],
[
28,
27
],
[
31,
30
],
[
19,
33
],
[
36,
35
],
[
159,
42
],
[
36,
44
],
[
47,
46
],
[
52,
51
],
[
35,
54
],
[
46,
57
],
[
60,
59
],
[
44,
62
],
[
46,
65
],
[
51,
70
],
[
59,
73
],
[
51,
78
],
[
9,
80
],
[
59,
83
],
[
18,
85
],
[
89,
88
],
[
51,
91
],
[
18,
92
],
[
59,
93
],
[
88,
96
],
[
27,
97
],
[
104,
99
],
[
21,
100
],
[
118,
101
],
[
106,
101
],
[
27,
102
],
[
88,
103
],
[
109,
106
],
[
27,
107
],
[
88,
108
],
[
116,
111
],
[
21,
112
],
[
106,
113
],
[
118,
113
],
[
27,
114
],
[
88,
115
],
[
121,
118
],
[
27,
119
],
[
88,
120
],
[
126,
123
],
[
21,
124
],
[
131,
128
],
[
21,
129
],
[
9,
134
],
[
18,
137
],
[
21,
142
],
[
147,
146
],
[
21,
146
],
[
156,
153
]
] | [
"import sys\ndef input(): return sys.stdin.readline().strip()\n\ndef main():\n \"\"\"\n https://atcoder.jp/contests/abc045/submissions/14945636\n が高速に動作していたので参考に写経する。\n\n 各黒マスに対して、それを含むテンプレートを左上の座標値で管理する。\n (写経元は右下座標で管理してる)\n このテンプレート及びそこに黒マスが何個入っているかを管理しておけば\n 黒マス位置をソートして全体位置を把握していなくてもオンラインで更新が可能。\n \"\"\"\n H, W, N = map(int, input().split())\n ans = [0] * 10\n templates = {}\n for _ in range(N):\n a, b = map(int, input().split())\n for i in range(9):\n # (h, w)がテンプレートの左上座標\n h, w = (a - 3) + i // 3, (b - 3) + i % 3\n if h < 0 or w < 0: continue\n if h > H - 3 or w > W - 3: continue\n idx = h * W + w\n if idx in templates:\n ans[templates[idx]] -= 1\n templates[idx] += 1\n ans[templates[idx]] += 1\n else:\n templates[idx] = 1\n ans[1] += 1\n ans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n for a in ans: print(a)\n\n\nif __name__ == \"__main__\":\n main()",
"import sys",
"sys",
"def input(): return sys.stdin.readline().strip()",
"input",
"def main():\n \"\"\"\n https://atcoder.jp/contests/abc045/submissions/14945636\n が高速に動作していたので参考に写経する。\n\n 各黒マスに対して、それを含むテンプレートを左上の座標値で管理する。\n (写経元は右下座標で管理してる)\n このテンプレート及びそこに黒マスが何個入っているかを管理しておけば\n 黒マス位置をソートして全体位置を把握していなくてもオンラインで更新が可能。\n \"\"\"\n H, W, N = map(int, input().split())\n ans = [0] * 10\n templates = {}\n for _ in range(N):\n a, b = map(int, input().split())\n for i in range(9):\n # (h, w)がテンプレートの左上座標\n h, w = (a - 3) + i // 3, (b - 3) + i % 3\n if h < 0 or w < 0: continue\n if h > H - 3 or w > W - 3: continue\n idx = h * W + w\n if idx in templates:\n ans[templates[idx]] -= 1\n templates[idx] += 1\n ans[templates[idx]] += 1\n else:\n templates[idx] = 1\n ans[1] += 1\n ans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n for a in ans: print(a)",
"main",
"\"\"\"\n https://atcoder.jp/contests/abc045/submissions/14945636\n が高速に動作していたので参考に写経する。\n\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",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"templates = {}",
"templates",
"{}",
"for _ in range(N):\n a, b = map(int, input().split())\n for i in range(9):\n # (h, w)がテンプレートの左上座標\n h, w = (a - 3) + i // 3, (b - 3) + i % 3\n if h < 0 or w < 0: continue\n if h > H - 3 or w > W - 3: continue\n idx = h * W + w\n if idx in templates:\n ans[templates[idx]] -= 1\n templates[idx] += 1\n ans[templates[idx]] += 1\n else:\n templates[idx] = 1\n ans[1] += 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(9):\n # (h, w)がテンプレートの左上座標\n h, w = (a - 3) + i // 3, (b - 3) + i % 3\n if h < 0 or w < 0: continue\n if h > H - 3 or w > W - 3: continue\n idx = h * W + w\n if idx in templates:\n ans[templates[idx]] -= 1\n templates[idx] += 1\n ans[templates[idx]] += 1\n else:\n templates[idx] = 1\n ans[1] += 1\n ",
"i",
"range(9)",
"range",
"9",
"h, w = (a - 3) + i // 3, (b - 3) + i % 3",
"h",
"(a - 3) + i // 3",
"a - 3",
"a",
"3",
"i // 3",
"i",
"3",
"w",
"(b - 3) + i % 3",
"b - 3",
"b",
"3",
"i % 3",
"i",
"3",
"if h < 0 or w < 0: continue\n ",
"h < 0 or w < 0",
"h < 0",
"h",
"0",
"w < 0",
"w",
"0",
"if h > H - 3 or w > W - 3: continue\n ",
"h > H - 3 or w > W - 3",
"h > H - 3",
"h",
"H - 3",
"H",
"3",
"w > W - 3",
"w",
"W - 3",
"W",
"3",
"idx = h * W + w",
"idx",
"h * W + w",
"h * W",
"h",
"W",
"w",
"if idx in templates:\n ans[templates[idx]] -= 1\n templates[idx] += 1\n ans[templates[idx]] += 1\n else:\n templates[idx] = 1\n ans[1] += 1\n ",
"idx in templates",
"idx",
"templates",
"ans[templates[idx]] -= 1",
"ans[templates[idx]]",
"ans",
"templates[idx]",
"templates",
"idx",
"1",
"templates[idx] += 1",
"templates[idx]",
"templates",
"idx",
"1",
"ans[templates[idx]] += 1",
"ans[templates[idx]]",
"ans",
"templates[idx]",
"templates",
"idx",
"1",
"templates[idx] = 1",
"templates[idx]",
"templates",
"idx",
"1",
"ans[1] += 1",
"ans[1]",
"ans",
"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 a in ans: prin",
"a",
"ans",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n \"\"\"\n https://atcoder.jp/contests/abc045/submissions/14945636\n が高速に動作していたので参考に写経する。\n\n 各黒マスに対して、それを含むテンプレートを左上の座標値で管理する。\n (写経元は右下座標で管理してる)\n このテンプレート及びそこに黒マスが何個入っているかを管理しておけば\n 黒マス位置をソートして全体位置を把握していなくてもオンラインで更新が可能。\n \"\"\"\n H, W, N = map(int, input().split())\n ans = [0] * 10\n templates = {}\n for _ in range(N):\n a, b = map(int, input().split())\n for i in range(9):\n # (h, w)がテンプレートの左上座標\n h, w = (a - 3) + i // 3, (b - 3) + i % 3\n if h < 0 or w < 0: continue\n if h > H - 3 or w > W - 3: continue\n idx = h * W + w\n if idx in templates:\n ans[templates[idx]] -= 1\n templates[idx] += 1\n ans[templates[idx]] += 1\n else:\n templates[idx] = 1\n ans[1] += 1\n ans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n for a in ans: print(a)",
"def main():\n \"\"\"\n https://atcoder.jp/contests/abc045/submissions/14945636\n が高速に動作していたので参考に写経する。\n\n 各黒マスに対して、それを含むテンプレートを左上の座標値で管理する。\n (写経元は右下座標で管理してる)\n このテンプレート及びそこに黒マスが何個入っているかを管理しておけば\n 黒マス位置をソートして全体位置を把握していなくてもオンラインで更新が可能。\n \"\"\"\n H, W, N = map(int, input().split())\n ans = [0] * 10\n templates = {}\n for _ in range(N):\n a, b = map(int, input().split())\n for i in range(9):\n # (h, w)がテンプレートの左上座標\n h, w = (a - 3) + i // 3, (b - 3) + i % 3\n if h < 0 or w < 0: continue\n if h > H - 3 or w > W - 3: continue\n idx = h * W + w\n if idx in templates:\n ans[templates[idx]] -= 1\n templates[idx] += 1\n ans[templates[idx]] += 1\n else:\n templates[idx] = 1\n ans[1] += 1\n ans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n for a in ans: print(a)",
"main",
"def input(): return sys.stdin.readline().strip()",
"def input(): return sys.stdin.readline().strip()",
"input"
] | import sys
def input(): return sys.stdin.readline().strip()
def main():
"""
https://atcoder.jp/contests/abc045/submissions/14945636
が高速に動作していたので参考に写経する。
各黒マスに対して、それを含むテンプレートを左上の座標値で管理する。
(写経元は右下座標で管理してる)
このテンプレート及びそこに黒マスが何個入っているかを管理しておけば
黒マス位置をソートして全体位置を把握していなくてもオンラインで更新が可能。
"""
H, W, N = map(int, input().split())
ans = [0] * 10
templates = {}
for _ in range(N):
a, b = map(int, input().split())
for i in range(9):
# (h, w)がテンプレートの左上座標
h, w = (a - 3) + i // 3, (b - 3) + i % 3
if h < 0 or w < 0: continue
if h > H - 3 or w > W - 3: continue
idx = h * W + w
if idx in templates:
ans[templates[idx]] -= 1
templates[idx] += 1
ans[templates[idx]] += 1
else:
templates[idx] = 1
ans[1] += 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,
15,
13,
15,
15,
13,
15,
13,
15,
13,
15,
15,
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,
12,
13,
23,
13,
12,
13,
23,
13,
23,
13,
12,
13,
23,
13,
23,
13,
0,
13,
17,
12,
13,
0,
13,
4,
13,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
39,
39,
2,
13,
17,
2,
13,
17,
39,
2,
13,
17,
2,
13,
17,
39,
2,
13,
17,
13,
39,
2,
13,
17,
2,
13,
17,
39,
2,
13,
17,
2,
13,
17,
39,
2,
13,
17,
13,
39,
13,
2,
13,
17,
39,
13,
2,
13,
17,
39,
13,
13,
28,
13,
13,
13,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
4,
18,
13,
13,
39,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
4,
18,
13,
13,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
17,
17,
4,
18,
13,
13,
0,
13,
13,
0,
13,
2,
39,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
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,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
2,
13,
10,
12,
13,
10,
17,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] | [
[
324,
24
],
[
39,
38
],
[
307,
44
],
[
48,
48
],
[
52,
51
],
[
310,
57
],
[
61,
61
],
[
65,
64
],
[
304,
70
],
[
74,
74
],
[
78,
77
],
[
334,
83
],
[
87,
87
],
[
91,
90
],
[
304,
98
],
[
102,
102
],
[
106,
105
],
[
114,
114
],
[
118,
118
],
[
122,
122
],
[
124,
124
],
[
128,
128
],
[
130,
130
],
[
330,
132
],
[
138,
137
],
[
310,
139
],
[
138,
140
],
[
138,
141
],
[
144,
143
],
[
147,
146
],
[
141,
149
],
[
152,
151
],
[
310,
153
],
[
152,
154
],
[
157,
156
],
[
151,
160
],
[
154,
163
],
[
151,
167
],
[
154,
170
],
[
151,
174
],
[
151,
179
],
[
154,
182
],
[
151,
186
],
[
154,
189
],
[
151,
193
],
[
154,
199
],
[
154,
204
],
[
137,
220
],
[
140,
227
],
[
143,
231
],
[
238,
237
],
[
143,
240
],
[
243,
242
],
[
237,
247
],
[
251,
250
],
[
242,
253
],
[
257,
256
],
[
250,
263
],
[
256,
264
],
[
267,
266
],
[
270,
269
],
[
137,
275
],
[
140,
278
],
[
266,
282
],
[
266,
283
],
[
286,
285
],
[
269,
285
],
[
266,
285
],
[
285,
289
],
[
328,
295
],
[
324,
325
],
[
330,
331
]
] | [
"import sys\nimport numpy as np\nimport random\nfrom decimal import Decimal\nimport itertools\nimport re\nimport bisect\nfrom collections import deque, Counter\nfrom functools import lru_cache\n\nsys.setrecursionlimit(10**9)\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)]\ndef SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')\ndef GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]\ndef GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]\nMOD = 1000000007\n\ndef main():\n\th, w, n = LI()\n\tblack_points = []\n\tfor i in range(n):\n\t\ta, b = LI()\n\t\tadd_list = ((a-2,b-2),(a-2,b-1),(a-2,b),(a-1,b-2),(a-1,b-1),(a-1,b),(a,b-2),(a,b-1),(a,b))\n\t\tfor c, d in add_list:\n\t\t\tif 1 <= c <= h-2 and 1 <= d <= w-2:\n\t\t\t\tblack_points.append((c,d))\n\tcounter = Counter(black_points)\n\tcount_list = list(counter.values())\n\tcounter2 = Counter(count_list)\n\tans_list = [counter2[i] for i in range(1,10)]\n\tans_list = [(h-2)*(w-2)-sum(ans_list)] + ans_list\n\tfor ans in ans_list:\n\t\tprint(ans)\n\n\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"import numpy as np",
"numpy",
"import random",
"random",
"from decimal import Decimal",
"import itertools",
"itertools",
"import re",
"re",
"import bisect",
"bisect",
"from collections import deque, Counter",
"from functools import lru_cache",
"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",
"def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')",
"SERIES",
"n",
"n",
"def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]",
"GRID",
"h",
"h",
"w",
"w",
"def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]",
"GRIDfromString",
"h",
"h",
"w",
"w",
"MOD = 1000000007",
"MOD",
"1000000007",
"def main():\n\th, w, n = LI()\n\tblack_points = []\n\tfor i in range(n):\n\t\ta, b = LI()\n\t\tadd_list = ((a-2,b-2),(a-2,b-1),(a-2,b),(a-1,b-2),(a-1,b-1),(a-1,b),(a,b-2),(a,b-1),(a,b))\n\t\tfor c, d in add_list:\n\t\t\tif 1 <= c <= h-2 and 1 <= d <= w-2:\n\t\t\t\tblack_points.append((c,d))\n\tcounter = Counter(black_points)\n\tcount_list = list(counter.values())\n\tcounter2 = Counter(count_list)\n\tans_list = [counter2[i] for i in range(1,10)]\n\tans_list = [(h-2)*(w-2)-sum(ans_list)] + ans_list\n\tfor ans in ans_list:\n\t\tprint(ans)",
"main",
"h, w, n = LI()",
"h",
"LI()",
"LI",
"w",
"n",
"black_points = []",
"black_points",
"[]",
"for i in range(n):\n\t\ta, b = LI()\n\t\tadd_list = ((a-2,b-2),(a-2,b-1),(a-2,b),(a-1,b-2),(a-1,b-1),(a-1,b),(a,b-2),(a,b-1),(a,b))\n\t\tfor c, d in add_list:\n\t\t\tif 1 <= c <= h-2 and 1 <= d <= w-2:\n\t\t\t\tblack_points.append((c,d))\n\t",
"i",
"range(n)",
"range",
"n",
"a, b = LI()",
"a",
"LI()",
"LI",
"b",
"add_list = ((a-2,b-2),(a-2,b-1),(a-2,b),(a-1,b-2),(a-1,b-1),(a-1,b),(a,b-2),(a,b-1),(a,b))",
"add_list",
"((a-2,b-2),(a-2,b-1),(a-2,b),(a-1,b-2),(a-1,b-1),(a-1,b),(a,b-2),(a,b-1),(a,b))",
"(a-2,b-2)",
"a-2",
"a",
"2",
"b-2",
"b",
"2",
"(a-2,b-1)",
"a-2",
"a",
"2",
"b-1",
"b",
"1",
"(a-2,b)",
"a-2",
"a",
"2",
"b",
"(a-1,b-2)",
"a-1",
"a",
"1",
"b-2",
"b",
"2",
"(a-1,b-1)",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"(a-1,b)",
"a-1",
"a",
"1",
"b",
"(a,b-2)",
"a",
"b-2",
"b",
"2",
"(a,b-1)",
"a",
"b-1",
"b",
"1",
"(a,b)",
"a",
"b",
"for c, d in add_list:\n\t\t\tif 1 <= c <= h-2 and 1 <= d <= w-2:\n\t\t\t\tblack_points.append((c,d))\n\t",
"c",
"d",
"add_list",
"if 1 <= c <= h-2 and 1 <= d <= w-2:\n\t\t\t\tblack_points.append((c,d))\n\t",
"1 <= c <= h-2 and 1 <= d <= w-2",
"1 <= c <= h-2",
"1 <= c",
"1",
"c",
"h-2",
"h",
"2",
"1 <= d <= w-2",
"1 <= d",
"1",
"d",
"w-2",
"w",
"2",
"black_points.append((c,d))",
"black_points.append",
"black_points",
"append",
"(c,d)",
"c",
"d",
"counter = Counter(black_points)",
"counter",
"Counter(black_points)",
"Counter",
"black_points",
"count_list = list(counter.values())",
"count_list",
"list(counter.values())",
"list",
"counter.values()",
"counter.values",
"counter",
"values",
"counter2 = Counter(count_list)",
"counter2",
"Counter(count_list)",
"Counter",
"count_list",
"counter2[i] 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)",
"counter2[i]",
"counter2",
"i",
"ans_list = [counter2[i] for i in range(1,10)]",
"ans_list",
"[counter2[i] for i in range(1,10)]",
"ans_list = [(h-2)*(w-2)-sum(ans_list)] + ans_list",
"ans_list",
"[(h-2)*(w-2)-sum(ans_list)] + ans_list",
"[(h-2)*(w-2)-sum(ans_list)]",
"(h-2)*(w-2)-sum(ans_list)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans_list)",
"sum",
"ans_list",
"ans_list",
"for ans in ans_list:\n\t\tprint(ans)",
"ans",
"ans_list",
"print(ans)",
"print",
"ans",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def SRL(n): return [list(S()) for i in range(n)]",
"def SRL(n): return [list(S()) for i in range(n)]",
"SRL",
"def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]",
"def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]",
"GRIDfromString",
"def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')",
"def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')",
"S",
"def I(): return int(sys.stdin.buffer.readline())",
"def I(): return int(sys.stdin.buffer.readline())",
"I",
"def LI(): return list(map(int, sys.stdin.buffer.readline().split()))",
"def LI(): return list(map(int, sys.stdin.buffer.readline().split()))",
"LI",
"def LIR(n): return [LI() for i in range(n)]",
"def LIR(n): return [LI() for i in range(n)]",
"LIR",
"def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')",
"def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')",
"SERIES",
"def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]",
"def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]",
"GRID",
"def LSR(n): return [LS() for i in range(n)]",
"def LSR(n): return [LS() for i in range(n)]",
"LSR",
"INF = 10**13",
"10**13",
"INF",
"def main():\n\th, w, n = LI()\n\tblack_points = []\n\tfor i in range(n):\n\t\ta, b = LI()\n\t\tadd_list = ((a-2,b-2),(a-2,b-1),(a-2,b),(a-1,b-2),(a-1,b-1),(a-1,b),(a,b-2),(a,b-1),(a,b))\n\t\tfor c, d in add_list:\n\t\t\tif 1 <= c <= h-2 and 1 <= d <= w-2:\n\t\t\t\tblack_points.append((c,d))\n\tcounter = Counter(black_points)\n\tcount_list = list(counter.values())\n\tcounter2 = Counter(count_list)\n\tans_list = [counter2[i] for i in range(1,10)]\n\tans_list = [(h-2)*(w-2)-sum(ans_list)] + ans_list\n\tfor ans in ans_list:\n\t\tprint(ans)",
"def main():\n\th, w, n = LI()\n\tblack_points = []\n\tfor i in range(n):\n\t\ta, b = LI()\n\t\tadd_list = ((a-2,b-2),(a-2,b-1),(a-2,b),(a-1,b-2),(a-1,b-1),(a-1,b),(a,b-2),(a,b-1),(a,b))\n\t\tfor c, d in add_list:\n\t\t\tif 1 <= c <= h-2 and 1 <= d <= w-2:\n\t\t\t\tblack_points.append((c,d))\n\tcounter = Counter(black_points)\n\tcount_list = list(counter.values())\n\tcounter2 = Counter(count_list)\n\tans_list = [counter2[i] for i in range(1,10)]\n\tans_list = [(h-2)*(w-2)-sum(ans_list)] + ans_list\n\tfor ans in ans_list:\n\t\tprint(ans)",
"main",
"MOD = 1000000007",
"1000000007",
"MOD",
"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",
"def IR(n): return [I() for i in range(n)]",
"def IR(n): return [I() for i in range(n)]",
"IR",
"def SR(n): return [S() for i in range(n)]",
"def SR(n): return [S() for i in range(n)]",
"SR",
"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"
] | import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache
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)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007
def main():
h, w, n = LI()
black_points = []
for i in range(n):
a, b = LI()
add_list = ((a-2,b-2),(a-2,b-1),(a-2,b),(a-1,b-2),(a-1,b-1),(a-1,b),(a,b-2),(a,b-1),(a,b))
for c, d in add_list:
if 1 <= c <= h-2 and 1 <= d <= w-2:
black_points.append((c,d))
counter = Counter(black_points)
count_list = list(counter.values())
counter2 = Counter(count_list)
ans_list = [counter2[i] for i in range(1,10)]
ans_list = [(h-2)*(w-2)-sum(ans_list)] + ans_list
for ans in ans_list:
print(ans)
if __name__ == '__main__':
main() |
[
7,
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,
13,
28,
13,
39,
17,
17,
40,
17,
0,
13,
2,
13,
13,
14,
2,
40,
13,
17,
40,
13,
13,
28,
13,
39,
17,
17,
40,
17,
0,
13,
2,
13,
13,
14,
2,
40,
13,
17,
40,
13,
13,
4,
18,
13,
13,
39,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
0,
13,
2,
39,
17,
17,
42,
2,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
42,
2,
2,
2,
13,
13,
13,
2,
18,
13,
2,
13,
13,
13,
0,
18,
13,
13,
17,
0,
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,
2,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
13,
13
] | [
[
192,
2
],
[
192,
13
],
[
192,
14
],
[
174,
16
],
[
20,
19
],
[
184,
22
],
[
177,
24
],
[
177,
35
],
[
38,
37
],
[
171,
44
],
[
178,
46
],
[
37,
47
],
[
172,
51
],
[
172,
54
],
[
193,
55
],
[
58,
57
],
[
159,
64
],
[
169,
66
],
[
57,
67
],
[
160,
71
],
[
160,
74
],
[
163,
75
],
[
175,
78
],
[
195,
84
],
[
175,
87
],
[
186,
89
],
[
180,
92
],
[
196,
95
],
[
175,
95
],
[
189,
97
],
[
187,
104
],
[
202,
104
],
[
181,
105
],
[
165,
107
],
[
198,
110
],
[
196,
112
],
[
175,
112
],
[
187,
113
],
[
202,
113
],
[
187,
118
],
[
202,
118
],
[
166,
119
],
[
181,
120
],
[
196,
123
],
[
175,
123
],
[
187,
125
],
[
202,
125
],
[
166,
126
],
[
199,
127
],
[
132,
129
],
[
190,
130
],
[
166,
131
],
[
201,
134
],
[
166,
135
],
[
140,
137
],
[
190,
138
],
[
193,
143
],
[
163,
146
],
[
190,
150
],
[
190,
154
],
[
157,
156
],
[
159,
160
],
[
192,
163
],
[
165,
166
],
[
177,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
],
[
180,
181
],
[
192,
184
],
[
186,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
],
[
166,
201
],
[
201,
202
]
] | [
"H, W, N = list(map(int, input().split()))\nD = []\nfor _ in range(N):\n a, b = list(map(int, input().split()))\n for dy in (-1, 0, +1):\n y = a + dy\n if y<=1 or y>=H: continue\n for dx in (-1, 0, +1):\n x = b + dx\n if x<=1 or x>=W: continue\n D.append((x,y))\n\nD = sorted(D)\n\ni = 0\nM = len(D)\nans = [0]*10\nwhile i<M:\n n = 1\n d = D[i]\n while i+n<M and D[i+n]==d: n+=1\n ans[n] += 1\n i+=n\n\nans[0] = (H-2)*(W-2) - sum(ans)\nprint(*ans, sep='\\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",
"D = []",
"D",
"[]",
"for _ in range(N):\n a, b = list(map(int, input().split()))\n for dy in (-1, 0, +1):\n y = a + dy\n if y<=1 or y>=H: continue\n for dx in (-1, 0, +1):\n x = b + dx\n if x<=1 or x>=W: continue\n D.append((x,y))",
"_",
"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 dy in (-1, 0, +1):\n y = a + dy\n if y<=1 or y>=H: continue\n for dx in (-1, 0, +1):\n x = b + dx\n if x<=1 or x>=W: continue\n D.append((x,y))",
"dy",
"(-1, 0, +1)",
"-1",
"0",
"+1",
"1",
"y = a + dy",
"y",
"a + dy",
"a",
"dy",
"if y<=1 or y>=H: continue\n ",
"y<=1 or y>=H",
"y<=1",
"y",
"1",
"y>=H",
"y",
"H",
"for dx in (-1, 0, +1):\n x = b + dx\n if x<=1 or x>=W: continue\n D.append((x,y))",
"dx",
"(-1, 0, +1)",
"-1",
"0",
"+1",
"1",
"x = b + dx",
"x",
"b + dx",
"b",
"dx",
"if x<=1 or x>=W: continue\n ",
"x<=1 or x>=W",
"x<=1",
"x",
"1",
"x>=W",
"x",
"W",
"D.append((x,y))",
"D.append",
"D",
"append",
"(x,y)",
"x",
"y",
"D = sorted(D)",
"D",
"sorted(D)",
"sorted",
"D",
"i = 0",
"i",
"0",
"M = len(D)",
"M",
"len(D)",
"len",
"D",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"while i<M:\n n = 1\n d = D[i]\n while i+n<M and D[i+n]==d: n+=1\n ans[n] += 1\n i+=n",
"i<M",
"i",
"M",
"n = 1",
"n",
"1",
"d = D[i]",
"d",
"D[i]",
"D",
"i",
"while i+n<M and D[i+n]==d: n+=1\n ",
"i+n<M and D[i+n]==d",
"i+n<M",
"i+n",
"i",
"n",
"M",
"D[i+n]==d",
"D[i+n]",
"D",
"i+n",
"i",
"n",
"d",
"ans[n] += 1",
"ans[n]",
"ans",
"n",
"1",
"i+=n",
"i",
"n",
"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'",
"x = b + dx",
"b + dx",
"x",
"W, N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"W",
"n = 1",
"1",
"n",
"b = list(map(int, input().split()))",
"list(map(int, input().split()))",
"b",
"y = a + dy",
"a + dy",
"y",
"D = []",
"[]",
"D",
"a, b = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"M = len(D)",
"len(D)",
"M",
"N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"N",
"i = 0",
"0",
"i",
"ans = [0]*10",
"[0]*10",
"ans",
"H, W, N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"H",
"D = sorted(D)",
"sorted(D)",
"D",
"d = D[i]",
"D[i]",
"d",
"i+=n",
"n",
"i"
] | H, W, N = list(map(int, input().split()))
D = []
for _ in range(N):
a, b = list(map(int, input().split()))
for dy in (-1, 0, +1):
y = a + dy
if y<=1 or y>=H: continue
for dx in (-1, 0, +1):
x = b + dx
if x<=1 or x>=W: continue
D.append((x,y))
D = sorted(D)
i = 0
M = len(D)
ans = [0]*10
while i<M:
n = 1
d = D[i]
while i+n<M and D[i+n]==d: n+=1
ans[n] += 1
i+=n
ans[0] = (H-2)*(W-2) - sum(ans)
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,
15,
0,
13,
4,
13,
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,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
13,
17,
9,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
13,
17,
9,
0,
18,
13,
39,
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,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
157,
4
],
[
166,
11
],
[
158,
18
],
[
166,
20
],
[
166,
21
],
[
169,
24
],
[
30,
29
],
[
161,
32
],
[
175,
34
],
[
158,
41
],
[
175,
43
],
[
148,
45
],
[
173,
47
],
[
149,
47
],
[
163,
49
],
[
176,
51
],
[
164,
51
],
[
55,
54
],
[
149,
61
],
[
173,
61
],
[
149,
66
],
[
173,
66
],
[
152,
69
],
[
54,
73
],
[
78,
77
],
[
164,
84
],
[
176,
84
],
[
164,
89
],
[
176,
89
],
[
167,
92
],
[
77,
96
],
[
105,
100
],
[
170,
101
],
[
154,
107
],
[
114,
113
],
[
170,
116
],
[
122,
119
],
[
155,
120
],
[
113,
121
],
[
127,
124
],
[
155,
125
],
[
152,
130
],
[
167,
133
],
[
155,
138
],
[
143,
142
],
[
155,
142
],
[
142,
146
],
[
148,
149
],
[
166,
152
],
[
154,
155
],
[
157,
158
],
[
166,
161
],
[
163,
164
],
[
166,
167
],
[
169,
170
],
[
175,
173
],
[
175,
176
]
] | [
"import sys\nreadline = sys.stdin.readline\n\nH,W,N = map(int,readline().split())\nfrom collections import defaultdict\n\n# 9x9のマスの左上のマスの座標をキーにして、各正方形の黒マス数をdictionaryで管理\n# 10 ** 5 * 9程度\n\ndic = defaultdict(int)\n\nfor i in range(N):\n a,b = map(int,readline().split())\n a,b = a - 1,b - 1\n for A in range(max(0,a - 2), min(a + 1,H - 2)):\n if A < 0:\n continue\n for B in range(max(0,b - 2), min(b + 1,W - 2)):\n if B < 0:\n continue\n dic[(A,B)] += 1\n\nans = [0] * 10\nfor v in dic.values():\n ans[v] += 1\n\nans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n\nfor a in ans:\n print(a)",
"import sys",
"sys",
"readline = sys.stdin.readline",
"readline",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"H,W,N = map(int,readline().split())",
"H",
"map(int,readline().split())",
"map",
"int",
"readline().split()",
"().split",
"()",
"readline",
"split",
"W",
"N",
"from collections import defaultdict",
"dic = defaultdict(int)",
"dic",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n a,b = map(int,readline().split())\n a,b = a - 1,b - 1\n for A in range(max(0,a - 2), min(a + 1,H - 2)):\n if A < 0:\n continue\n for B in range(max(0,b - 2), min(b + 1,W - 2)):\n if B < 0:\n continue\n dic[(A,B)] += 1",
"i",
"range(N)",
"range",
"N",
"a,b = map(int,readline().split())",
"a",
"map(int,readline().split())",
"map",
"int",
"readline().split()",
"().split",
"()",
"readline",
"split",
"b",
"a,b = a - 1,b - 1",
"a",
"a - 1",
"a",
"1",
"b",
"b - 1",
"b",
"1",
"for A in range(max(0,a - 2), min(a + 1,H - 2)):\n if A < 0:\n continue\n for B in range(max(0,b - 2), min(b + 1,W - 2)):\n if B < 0:\n continue\n dic[(A,B)] += 1",
"A",
"range(max(0,a - 2), min(a + 1,H - 2))",
"range",
"max(0,a - 2)",
"max",
"0",
"a - 2",
"a",
"2",
"min(a + 1,H - 2)",
"min",
"a + 1",
"a",
"1",
"H - 2",
"H",
"2",
"if A < 0:\n continue\n ",
"A < 0",
"A",
"0",
"continue",
"for B in range(max(0,b - 2), min(b + 1,W - 2)):\n if B < 0:\n continue\n dic[(A,B)] += 1",
"B",
"range(max(0,b - 2), min(b + 1,W - 2))",
"range",
"max(0,b - 2)",
"max",
"0",
"b - 2",
"b",
"2",
"min(b + 1,W - 2)",
"min",
"b + 1",
"b",
"1",
"W - 2",
"W",
"2",
"if B < 0:\n continue\n ",
"B < 0",
"B",
"0",
"continue",
"dic[(A,B)] += 1",
"dic[(A,B)]",
"dic",
"(A,B)",
"A",
"B",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for v in dic.values():\n ans[v] += 1",
"v",
"dic.values()",
"dic.values",
"dic",
"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)",
"a",
"ans",
"print(a)",
"print",
"a",
"a,b = a - 1,b - 1",
"a - 1",
"a",
"H,W,N = map(int,readline().split())",
"map(int,readline().split())",
"H",
"ans = [0] * 10",
"[0] * 10",
"ans",
"readline = sys.stdin.readline",
"sys.stdin.readline",
"readline",
"N = map(int,readline().split())",
"map(int,readline().split())",
"N",
"b = a - 1,b - 1",
"b - 1",
"b",
"W,N = map(int,readline().split())",
"map(int,readline().split())",
"W",
"dic = defaultdict(int)",
"defaultdict(int)",
"dic",
"a,b = map(int,readline().split())",
"map(int,readline().split())",
"a",
"b = map(int,readline().split())",
"map(int,readline().split())",
"b"
] | import sys
readline = sys.stdin.readline
H,W,N = map(int,readline().split())
from collections import defaultdict
# 9x9のマスの左上のマスの座標をキーにして、各正方形の黒マス数をdictionaryで管理
# 10 ** 5 * 9程度
dic = defaultdict(int)
for i in range(N):
a,b = map(int,readline().split())
a,b = a - 1,b - 1
for A in range(max(0,a - 2), min(a + 1,H - 2)):
if A < 0:
continue
for B in range(max(0,b - 2), min(b + 1,W - 2)):
if B < 0:
continue
dic[(A,B)] += 1
ans = [0] * 10
for v in dic.values():
ans[v] += 1
ans[0] = (H - 2) * (W - 2) - sum(ans[1:])
for a in ans:
print(a) |
[
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,
0,
13,
2,
13,
17,
13,
2,
13,
17,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
40,
2,
2,
40,
17,
2,
13,
13,
2,
13,
17,
2,
40,
17,
2,
13,
13,
2,
13,
17,
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,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
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,
2,
13,
10,
2,
13,
10,
4,
13
] | [
[
156,
3
],
[
156,
12
],
[
156,
13
],
[
147,
15
],
[
21,
20
],
[
139,
23
],
[
141,
25
],
[
141,
34
],
[
150,
36
],
[
142,
38
],
[
151,
38
],
[
153,
40
],
[
133,
42
],
[
154,
42
],
[
46,
45
],
[
52,
51
],
[
151,
63
],
[
142,
63
],
[
45,
64
],
[
157,
66
],
[
154,
72
],
[
133,
72
],
[
51,
73
],
[
145,
75
],
[
88,
79
],
[
148,
80
],
[
151,
83
],
[
142,
83
],
[
45,
84
],
[
154,
86
],
[
133,
86
],
[
51,
87
],
[
135,
90
],
[
97,
96
],
[
148,
99
],
[
105,
102
],
[
136,
103
],
[
96,
104
],
[
110,
107
],
[
136,
108
],
[
157,
113
],
[
145,
116
],
[
136,
121
],
[
136,
127
],
[
130,
129
],
[
141,
133
],
[
135,
136
],
[
156,
139
],
[
141,
142
],
[
156,
145
],
[
147,
148
],
[
150,
151
],
[
153,
154
],
[
156,
157
]
] | [
"from collections import defaultdict\nH, W, N = map(int, input().split())\n\n\nD = defaultdict(int)\nfor i in range(N):\n h, w = map(int, input().split())\n h, w = h - 1, w - 1\n for dh in range(-1, 2):\n for dw in range(-1, 2):\n if not ((1 <= h + dh < H - 1) and (1 <= w + dw < W - 1)):\n continue\n D[(h + dh, w + dw)] += 1\n\nans = [0] * 10\nfor v in D.values():\n ans[v] += 1\n\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",
"D = defaultdict(int)",
"D",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n h, w = map(int, input().split())\n h, w = h - 1, w - 1\n for dh in range(-1, 2):\n for dw in range(-1, 2):\n if not ((1 <= h + dh < H - 1) and (1 <= w + dw < W - 1)):\n continue\n D[(h + dh, w + dw)] += 1",
"i",
"range(N)",
"range",
"N",
"h, w = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"h, w = h - 1, w - 1",
"h",
"h - 1",
"h",
"1",
"w",
"w - 1",
"w",
"1",
"for dh in range(-1, 2):\n for dw in range(-1, 2):\n if not ((1 <= h + dh < H - 1) and (1 <= w + dw < W - 1)):\n continue\n D[(h + dh, w + dw)] += 1",
"dh",
"range(-1, 2)",
"range",
"-1",
"2",
"for dw in range(-1, 2):\n if not ((1 <= h + dh < H - 1) and (1 <= w + dw < W - 1)):\n continue\n D[(h + dh, w + dw)] += 1",
"dw",
"range(-1, 2)",
"range",
"-1",
"2",
"if not ((1 <= h + dh < H - 1) and (1 <= w + dw < W - 1)):\n continue\n ",
"not ((1 <= h + dh < H - 1) and (1 <= w + dw < W - 1))",
"(1 <= h + dh < H - 1) and (1 <= w + dw < W - 1)",
"1 <= h + dh < H - 1",
"1 <= h + dh",
"1",
"h + dh",
"h",
"dh",
"H - 1",
"H",
"1",
"1 <= w + dw < W - 1",
"1 <= w + dw",
"1",
"w + dw",
"w",
"dw",
"W - 1",
"W",
"1",
"continue",
"D[(h + dh, w + dw)] += 1",
"D[(h + dh, w + dw)]",
"D",
"(h + dh, w + dw)",
"h + dh",
"h",
"dh",
"w + dw",
"w",
"dw",
"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'",
"w = map(int, input().split())",
"map(int, input().split())",
"w",
"ans = [0] * 10",
"[0] * 10",
"ans",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"h, w = map(int, input().split())",
"map(int, input().split())",
"h",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"D = defaultdict(int)",
"defaultdict(int)",
"D",
"h, w = h - 1, w - 1",
"h - 1",
"h",
"w = h - 1, w - 1",
"w - 1",
"w",
"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 i in range(N):
h, w = map(int, input().split())
h, w = h - 1, w - 1
for dh in range(-1, 2):
for dw in range(-1, 2):
if not ((1 <= h + dh < H - 1) and (1 <= w + dw < W - 1)):
continue
D[(h + dh, w + dw)] += 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,
15,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
13,
31,
13,
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,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
90,
4
],
[
90,
17
],
[
90,
18
],
[
90,
19
],
[
84,
22
],
[
85,
39
],
[
93,
49
],
[
82,
58
],
[
88,
61
],
[
94,
67
],
[
71,
70
],
[
94,
78
],
[
70,
79
],
[
90,
82
],
[
84,
85
],
[
90,
88
],
[
90,
91
],
[
93,
94
]
] | [
"from collections import Counter\nfrom itertools import product\n\nH, W, N, *AB = map(int, open(0).read().split())\n\nC = Counter()\nfor a, b in zip(*[iter(AB)] * 2):\n C.update(\n (a - i, b - j)\n for i, j in product((-1, 0, 1), repeat=2)\n if 2 <= a - i <= H - 1 and 2 <= b - j <= W - 1\n )\n\nD = Counter(v for _, v in C.items())\n\nprint((H - 2) * (W - 2) - sum(D.values()))\nfor i in range(1, 10):\n print(D[i])",
"from collections import Counter",
"from itertools import product",
"H, W, N, *AB = 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",
"*AB",
"AB",
"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 product((-1, 0, 1), repeat=2)\n if 2 <= a - i <= H - 1 and 2 <= b - j <= W - 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 product((-1, 0, 1), repeat=2)\n if 2 <= a - i <= H - 1 and 2 <= b - j <= W - 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((H - 2) * (W - 2) - sum(D.values()))",
"print",
"(H - 2) * (W - 2) - sum(D.values())",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"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",
"H, W, N, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"H",
"C = Counter()",
"Counter()",
"C",
"W, N, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"W",
"N, *AB = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"N",
"D = Counter(v for _, v in C.items())",
"Counter(v for _, v in C.items())",
"D"
] | from collections import Counter
from itertools import product
H, W, N, *AB = map(int, open(0).read().split())
C = Counter()
for a, b in zip(*[iter(AB)] * 2):
C.update(
(a - i, b - j)
for i, j in product((-1, 0, 1), repeat=2)
if 2 <= a - i <= H - 1 and 2 <= b - j <= W - 1
)
D = Counter(v for _, v in C.items())
print((H - 2) * (W - 2) - sum(D.values()))
for i in range(1, 10):
print(D[i])
|
[
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,
15,
0,
13,
4,
13,
12,
17,
28,
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,
40,
40,
40,
17,
13,
13,
14,
40,
40,
40,
17,
13,
13,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
39,
13,
13,
13,
4,
18,
13,
13,
14,
2,
2,
2,
2,
13,
17,
2,
13,
13,
2,
13,
17,
2,
13,
13,
0,
18,
13,
13,
17,
0,
13,
4,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
13,
4,
13,
31,
13,
0,
13,
17,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] | [
[
175,
4
],
[
181,
11
],
[
176,
18
],
[
181,
20
],
[
181,
21
],
[
25,
24
],
[
182,
27
],
[
176,
37
],
[
169,
40
],
[
172,
44
],
[
55,
54
],
[
61,
60
],
[
157,
66
],
[
54,
69
],
[
160,
70
],
[
60,
73
],
[
158,
79
],
[
164,
80
],
[
161,
86
],
[
167,
87
],
[
94,
89
],
[
173,
90
],
[
184,
96
],
[
173,
108
],
[
164,
119
],
[
167,
125
],
[
130,
127
],
[
185,
128
],
[
178,
132
],
[
185,
135
],
[
140,
137
],
[
185,
138
],
[
164,
143
],
[
167,
146
],
[
179,
148
],
[
185,
152
],
[
155,
154
],
[
157,
158
],
[
160,
161
],
[
181,
164
],
[
181,
167
],
[
169,
170
],
[
172,
173
],
[
175,
176
],
[
178,
179
],
[
181,
182
],
[
184,
185
]
] | [
"import sys\ninput = sys.stdin.readline\nH,W,N = map(int,input().split())\nAB = [tuple(map(int,input().split())) for i in range(N)]\nfrom collections import defaultdict\ndic = defaultdict(lambda: 0)\nfor y,x in AB:\n for dx in range(-1,2):\n for dy in range(-1,2):\n nx,ny = x+dx,y+dy\n if not 1 <= nx <= W: continue\n if not 1 <= ny <= H: continue\n dic[(nx,ny)] += 1\n\nans = [0] * 10\nfor (x,y),c in dic.items():\n if x==1 or x==W or y==1 or y==H: continue\n ans[c] += 1\ns = sum(ans)\nans[0] = (W-2)*(H-2)-s\n\nprint(*ans, sep='\\n')",
"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 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)]",
"from collections import defaultdict",
"dic = defaultdict(lambda: 0)",
"dic",
"defaultdict(lambda: 0)",
"defaultdict",
"lambda: 0",
"0",
"for y,x in AB:\n for dx in range(-1,2):\n for dy in range(-1,2):\n nx,ny = x+dx,y+dy\n if not 1 <= nx <= W: continue\n if not 1 <= ny <= H: continue\n dic[(nx,ny)] += 1",
"y",
"x",
"AB",
"for dx in range(-1,2):\n for dy in range(-1,2):\n nx,ny = x+dx,y+dy\n if not 1 <= nx <= W: continue\n if not 1 <= ny <= H: continue\n dic[(nx,ny)] += 1",
"dx",
"range(-1,2)",
"range",
"-1",
"2",
"for dy in range(-1,2):\n nx,ny = x+dx,y+dy\n if not 1 <= nx <= W: continue\n if not 1 <= ny <= H: continue\n dic[(nx,ny)] += 1",
"dy",
"range(-1,2)",
"range",
"-1",
"2",
"nx,ny = x+dx,y+dy",
"nx",
"x+dx",
"x",
"dx",
"ny",
"y+dy",
"y",
"dy",
"if not 1 <= nx <= W: continue\n ",
"not 1 <= nx <= W",
"1 <= nx <= W",
"1 <= nx",
"1",
"nx",
"W",
"if not 1 <= ny <= H: continue\n ",
"not 1 <= ny <= H",
"1 <= ny <= H",
"1 <= ny",
"1",
"ny",
"H",
"dic[(nx,ny)] += 1",
"dic[(nx,ny)]",
"dic",
"(nx,ny)",
"nx",
"ny",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for (x,y),c in dic.items():\n if x==1 or x==W or y==1 or y==H: continue\n ans[c] += 1",
"(x,y)",
"x",
"y",
"c",
"dic.items()",
"dic.items",
"dic",
"items",
"if x==1 or x==W or y==1 or y==H: continue\n ",
"x==1 or x==W or y==1 or y==H",
"x==1 or x==W or y==1",
"x==1 or x==W",
"x==1",
"x",
"1",
"x==W",
"x",
"W",
"y==1",
"y",
"1",
"y==H",
"y",
"H",
"ans[c] += 1",
"ans[c]",
"ans",
"c",
"1",
"s = sum(ans)",
"s",
"sum(ans)",
"sum",
"ans",
"ans[0] = (W-2)*(H-2)-s",
"ans[0]",
"ans",
"0",
"(W-2)*(H-2)-s",
"(W-2)*(H-2)",
"W-2",
"W",
"2",
"H-2",
"H",
"2",
"s",
"print(*ans, sep='\\n')",
"print",
"*ans",
"ans",
"sep='\\n'",
"sep",
"'\\n'",
"nx,ny = x+dx,y+dy",
"x+dx",
"nx",
"ny = x+dx,y+dy",
"y+dy",
"ny",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"AB = [tuple(map(int,input().split())) for i in range(N)]",
"[tuple(map(int,input().split())) for i in range(N)]",
"AB",
"dic = defaultdict(lambda: 0)",
"defaultdict(lambda: 0)",
"dic",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"s = sum(ans)",
"sum(ans)",
"s",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"ans = [0] * 10",
"[0] * 10",
"ans"
] | import sys
input = sys.stdin.readline
H,W,N = map(int,input().split())
AB = [tuple(map(int,input().split())) for i in range(N)]
from collections import defaultdict
dic = defaultdict(lambda: 0)
for y,x in AB:
for dx in range(-1,2):
for dy in range(-1,2):
nx,ny = x+dx,y+dy
if not 1 <= nx <= W: continue
if not 1 <= ny <= H: continue
dic[(nx,ny)] += 1
ans = [0] * 10
for (x,y),c in dic.items():
if x==1 or x==W or y==1 or y==H: continue
ans[c] += 1
s = sum(ans)
ans[0] = (W-2)*(H-2)-s
print(*ans, sep='\n') |
[
7,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
15,
15,
12,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
13,
17,
13,
13,
13,
0,
13,
4,
18,
13,
13,
13,
0,
13,
4,
18,
13,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
13,
17,
13,
13,
0,
13,
17,
0,
13,
17,
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,
18,
13,
18,
13,
13,
17,
0,
18,
13,
2,
18,
13,
13,
17,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
17,
2,
2,
13,
17,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
20,
19
],
[
27,
26
],
[
34,
33
],
[
19,
44
],
[
34,
48
],
[
34,
49
],
[
52,
51
],
[
59,
58
],
[
66,
65
],
[
49,
68
],
[
71,
70
],
[
19,
81
],
[
71,
85
],
[
88,
87
],
[
91,
90
],
[
94,
93
],
[
87,
100
],
[
70,
100
],
[
33,
105
],
[
87,
108
],
[
70,
108
],
[
112,
111
],
[
90,
118
],
[
85,
118
],
[
48,
123
],
[
90,
126
],
[
85,
126
],
[
132,
129
],
[
51,
130
],
[
93,
131
],
[
139,
134
],
[
58,
135
],
[
129,
136
],
[
51,
137
],
[
93,
138
],
[
148,
141
],
[
58,
142
],
[
129,
144
],
[
51,
145
],
[
93,
146
],
[
153,
150
],
[
58,
151
],
[
33,
156
],
[
48,
161
],
[
166,
165
],
[
58,
172
],
[
165,
173
],
[
182,
179
]
] | [
"import sys\nimport bisect\nimport collections\nimport fractions\nimport heapq\nimport math\nfrom operator import mul\nfrom functools import reduce\nfrom functools import lru_cache\n\n\ndef slove():\n input = sys.stdin.readline\n mod = 10 ** 9 + 7\n h, w, n = list(map(int, input().rstrip('\\n').split()))\n d = collections.defaultdict(int)\n dt = collections.defaultdict(int)\n for i in range(n):\n a, b = list(map(int, input().rstrip('\\n').split()))\n a -= 1\n b -= 1\n for j in range(max(1, a - 1), min(h-1, a + 2)):\n for k in range(max(1, b - 1), min(w-1, b + 2)):\n d[j, k] += 1\n dt[d[j, k]] += 1\n dt[d[j, k]-1] -= 1\n dt[0] += (h - 3 + 1) * (w - 3 + 1)\n for i in range(10):\n print(dt[i])\n\n\nif __name__ == '__main__':\n slove()",
"import sys",
"sys",
"import bisect",
"bisect",
"import collections",
"collections",
"import fractions",
"fractions",
"import heapq",
"heapq",
"import math",
"math",
"from operator import mul",
"from functools import reduce",
"from functools import lru_cache",
"def slove():\n input = sys.stdin.readline\n mod = 10 ** 9 + 7\n h, w, n = list(map(int, input().rstrip('\\n').split()))\n d = collections.defaultdict(int)\n dt = collections.defaultdict(int)\n for i in range(n):\n a, b = list(map(int, input().rstrip('\\n').split()))\n a -= 1\n b -= 1\n for j in range(max(1, a - 1), min(h-1, a + 2)):\n for k in range(max(1, b - 1), min(w-1, b + 2)):\n d[j, k] += 1\n dt[d[j, k]] += 1\n dt[d[j, k]-1] -= 1\n dt[0] += (h - 3 + 1) * (w - 3 + 1)\n for i in range(10):\n print(dt[i])",
"slove",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"mod = 10 ** 9 + 7",
"mod",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"h, w, n = list(map(int, input().rstrip('\\n').split()))",
"h",
"list(map(int, input().rstrip('\\n').split()))",
"list",
"map(int, input().rstrip('\\n').split())",
"map",
"int",
"input().rstrip('\\n').split()",
"().rstrip('\\n').split",
"().rstrip('\\n')",
"().rstrip",
"()",
"input",
"rstrip",
"'\\n'",
"split",
"w",
"n",
"d = collections.defaultdict(int)",
"d",
"collections.defaultdict(int)",
"collections.defaultdict",
"collections",
"defaultdict",
"int",
"dt = collections.defaultdict(int)",
"dt",
"collections.defaultdict(int)",
"collections.defaultdict",
"collections",
"defaultdict",
"int",
"for i in range(n):\n a, b = list(map(int, input().rstrip('\\n').split()))\n a -= 1\n b -= 1\n for j in range(max(1, a - 1), min(h-1, a + 2)):\n for k in range(max(1, b - 1), min(w-1, b + 2)):\n d[j, k] += 1\n dt[d[j, k]] += 1\n dt[d[j, k]-1] -= 1\n ",
"i",
"range(n)",
"range",
"n",
"a, b = list(map(int, input().rstrip('\\n').split()))",
"a",
"list(map(int, input().rstrip('\\n').split()))",
"list",
"map(int, input().rstrip('\\n').split())",
"map",
"int",
"input().rstrip('\\n').split()",
"().rstrip('\\n').split",
"().rstrip('\\n')",
"().rstrip",
"()",
"input",
"rstrip",
"'\\n'",
"split",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for j in range(max(1, a - 1), min(h-1, a + 2)):\n for k in range(max(1, b - 1), min(w-1, b + 2)):\n d[j, k] += 1\n dt[d[j, k]] += 1\n dt[d[j, k]-1] -= 1\n ",
"j",
"range(max(1, a - 1), min(h-1, a + 2))",
"range",
"max(1, a - 1)",
"max",
"1",
"a - 1",
"a",
"1",
"min(h-1, a + 2)",
"min",
"h-1",
"h",
"1",
"a + 2",
"a",
"2",
"for k in range(max(1, b - 1), min(w-1, b + 2)):\n d[j, k] += 1\n dt[d[j, k]] += 1\n dt[d[j, k]-1] -= 1\n ",
"k",
"range(max(1, b - 1), min(w-1, b + 2))",
"range",
"max(1, b - 1)",
"max",
"1",
"b - 1",
"b",
"1",
"min(w-1, b + 2)",
"min",
"w-1",
"w",
"1",
"b + 2",
"b",
"2",
"d[j, k] += 1",
"d[j, k]",
"d",
"j",
"1",
"dt[d[j, k]] += 1",
"dt[d[j, k]]",
"dt",
"d[j, k]",
"d",
"j",
"1",
"dt[d[j, k]-1] -= 1",
"dt[d[j, k]-1]",
"dt",
"d[j, k]-1",
"d[j, k]",
"d",
"j",
"1",
"1",
"dt[0] += (h - 3 + 1) * (w - 3 + 1)",
"dt[0]",
"dt",
"0",
"(h - 3 + 1) * (w - 3 + 1)",
"h - 3 + 1",
"h - 3",
"h",
"3",
"1",
"w - 3 + 1",
"w - 3",
"w",
"3",
"1",
"for i in range(10):\n print(dt[i])",
"i",
"range(10)",
"range",
"10",
"print(dt[i])",
"print",
"dt[i]",
"dt",
"i",
"if __name__ == '__main__':\n slove()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"slove()",
"slove",
"def slove():\n input = sys.stdin.readline\n mod = 10 ** 9 + 7\n h, w, n = list(map(int, input().rstrip('\\n').split()))\n d = collections.defaultdict(int)\n dt = collections.defaultdict(int)\n for i in range(n):\n a, b = list(map(int, input().rstrip('\\n').split()))\n a -= 1\n b -= 1\n for j in range(max(1, a - 1), min(h-1, a + 2)):\n for k in range(max(1, b - 1), min(w-1, b + 2)):\n d[j, k] += 1\n dt[d[j, k]] += 1\n dt[d[j, k]-1] -= 1\n dt[0] += (h - 3 + 1) * (w - 3 + 1)\n for i in range(10):\n print(dt[i])",
"def slove():\n input = sys.stdin.readline\n mod = 10 ** 9 + 7\n h, w, n = list(map(int, input().rstrip('\\n').split()))\n d = collections.defaultdict(int)\n dt = collections.defaultdict(int)\n for i in range(n):\n a, b = list(map(int, input().rstrip('\\n').split()))\n a -= 1\n b -= 1\n for j in range(max(1, a - 1), min(h-1, a + 2)):\n for k in range(max(1, b - 1), min(w-1, b + 2)):\n d[j, k] += 1\n dt[d[j, k]] += 1\n dt[d[j, k]-1] -= 1\n dt[0] += (h - 3 + 1) * (w - 3 + 1)\n for i in range(10):\n print(dt[i])",
"slove"
] | import sys
import bisect
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache
def slove():
input = sys.stdin.readline
mod = 10 ** 9 + 7
h, w, n = list(map(int, input().rstrip('\n').split()))
d = collections.defaultdict(int)
dt = collections.defaultdict(int)
for i in range(n):
a, b = list(map(int, input().rstrip('\n').split()))
a -= 1
b -= 1
for j in range(max(1, a - 1), min(h-1, a + 2)):
for k in range(max(1, b - 1), min(w-1, b + 2)):
d[j, k] += 1
dt[d[j, k]] += 1
dt[d[j, k]-1] -= 1
dt[0] += (h - 3 + 1) * (w - 3 + 1)
for i in range(10):
print(dt[i])
if __name__ == '__main__':
slove()
|
[
7,
15,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
12,
4,
18,
4,
18,
18,
13,
13,
13,
13,
0,
13,
12,
4,
13,
8,
13,
39,
4,
13,
17,
4,
13,
17,
23,
0,
13,
12,
4,
13,
8,
13,
39,
4,
13,
17,
4,
13,
17,
23,
0,
13,
12,
2,
4,
13,
13,
17,
23,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
28,
13,
4,
13,
13,
4,
18,
13,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
4,
13,
28,
13,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
2,
2,
2,
2,
17,
2,
2,
13,
13,
17,
40,
2,
2,
13,
13,
17,
13,
2,
17,
2,
2,
13,
13,
17,
40,
2,
2,
13,
13,
17,
13,
2,
39,
2,
13,
13,
2,
13,
13,
13,
9,
0,
13,
17,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
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,
14,
2,
13,
17,
4,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13
] | [
[
270,
11
],
[
258,
16
],
[
264,
23
],
[
267,
35
],
[
273,
50
],
[
276,
65
],
[
77,
76
],
[
265,
83
],
[
77,
85
],
[
77,
86
],
[
89,
88
],
[
93,
92
],
[
86,
95
],
[
88,
98
],
[
277,
104
],
[
265,
108
],
[
112,
111
],
[
118,
117
],
[
126,
125
],
[
132,
131
],
[
125,
146
],
[
125,
152
],
[
76,
154
],
[
131,
160
],
[
131,
166
],
[
85,
168
],
[
125,
173
],
[
131,
176
],
[
117,
177
],
[
181,
180
],
[
117,
184
],
[
125,
189
],
[
131,
192
],
[
195,
194
],
[
201,
200
],
[
125,
211
],
[
194,
212
],
[
131,
216
],
[
200,
217
],
[
88,
218
],
[
221,
220
],
[
226,
223
],
[
111,
224
],
[
220,
225
],
[
180,
225
],
[
231,
228
],
[
111,
229
],
[
76,
234
],
[
85,
237
],
[
111,
242
],
[
247,
246
],
[
111,
246
],
[
246,
250
],
[
262,
256
],
[
258,
259
],
[
264,
265
],
[
267,
268
],
[
270,
271
],
[
273,
274
],
[
276,
277
]
] | [
"# -*- coding: utf-8 -*-\nimport sys\nsys.setrecursionlimit(10**9)\nINF=10**18\nMOD=10**9+7\ninput=lambda: sys.stdin.readline().rstrip()\nYesNo=lambda b: bool([print('Yes')] if b else print('No'))\nYESNO=lambda b: bool([print('YES')] if b else print('NO'))\nint1=lambda x:int(x)-1\n\ndef main():\n H,W,N=map(int,input().split())\n s=set()\n for i in range(N):\n s.add(tuple(map(int1,input().split())))\n ans=[0]*10\n used=set()\n for y,x in s:\n for dy in range(-1,2):\n for dx in range(-1,2):\n if 0>y+dy-1 or y+dy+1>=H or 0>x+dx-1 or x+dx+1>=W or (y+dy,x+dx) in used:\n continue\n tmp=0\n used.add((y+dy,x+dx))\n for ddy in range(-1,2):\n for ddx in range(-1,2):\n if (y+dy+ddy,x+dx+ddx) in s:\n tmp+=1\n ans[tmp]+=1\n ans[0]=(H-2)*(W-2)-sum(ans[1:])\n for row in ans:\n print(row)\n \n \n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"sys.setrecursionlimit(10**9)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**9",
"10",
"9",
"INF=10**18",
"INF",
"10**18",
"10",
"18",
"MOD=10**9+7",
"MOD",
"10**9+7",
"10**9",
"10",
"9",
"7",
"input=lambda: sys.stdin.readline().rstrip()",
"input",
"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",
"YesNo=lambda b: bool([print('Yes')] if b else print('No'))",
"YesNo",
"lambda b: bool([print('Yes')] if b else print('No'))",
"bool([print('Yes')] if b else print('No'))",
"bool",
"[print('Yes')] if b else print('No')",
"b",
"[print('Yes')]",
"print('Yes')",
"print",
"'Yes'",
"print('No')",
"print",
"'No'",
"b",
"YESNO=lambda b: bool([print('YES')] if b else print('NO'))",
"YESNO",
"lambda b: bool([print('YES')] if b else print('NO'))",
"bool([print('YES')] if b else print('NO'))",
"bool",
"[print('YES')] if b else print('NO')",
"b",
"[print('YES')]",
"print('YES')",
"print",
"'YES'",
"print('NO')",
"print",
"'NO'",
"b",
"int1=lambda x:int(x)-1",
"int1",
"lambda x:int(x)-1",
"int(x)-1",
"int(x)",
"int",
"x",
"1",
"x",
"def main():\n H,W,N=map(int,input().split())\n s=set()\n for i in range(N):\n s.add(tuple(map(int1,input().split())))\n ans=[0]*10\n used=set()\n for y,x in s:\n for dy in range(-1,2):\n for dx in range(-1,2):\n if 0>y+dy-1 or y+dy+1>=H or 0>x+dx-1 or x+dx+1>=W or (y+dy,x+dx) in used:\n continue\n tmp=0\n used.add((y+dy,x+dx))\n for ddy in range(-1,2):\n for ddx in range(-1,2):\n if (y+dy+ddy,x+dx+ddx) in s:\n tmp+=1\n ans[tmp]+=1\n ans[0]=(H-2)*(W-2)-sum(ans[1:])\n for row in ans:\n print(row)\n \n ",
"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 i in range(N):\n s.add(tuple(map(int1,input().split())))\n ",
"i",
"range(N)",
"range",
"N",
"s.add(tuple(map(int1,input().split())))",
"s.add",
"s",
"add",
"tuple(map(int1,input().split()))",
"tuple",
"map(int1,input().split())",
"map",
"int1",
"input().split()",
"().split",
"()",
"input",
"split",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"used=set()",
"used",
"set()",
"set",
"for y,x in s:\n for dy in range(-1,2):\n for dx in range(-1,2):\n if 0>y+dy-1 or y+dy+1>=H or 0>x+dx-1 or x+dx+1>=W or (y+dy,x+dx) in used:\n continue\n tmp=0\n used.add((y+dy,x+dx))\n for ddy in range(-1,2):\n for ddx in range(-1,2):\n if (y+dy+ddy,x+dx+ddx) in s:\n tmp+=1\n ans[tmp]+=1\n ",
"y",
"x",
"s",
"for dy in range(-1,2):\n for dx in range(-1,2):\n if 0>y+dy-1 or y+dy+1>=H or 0>x+dx-1 or x+dx+1>=W or (y+dy,x+dx) in used:\n continue\n tmp=0\n used.add((y+dy,x+dx))\n for ddy in range(-1,2):\n for ddx in range(-1,2):\n if (y+dy+ddy,x+dx+ddx) in s:\n tmp+=1\n ans[tmp]+=1\n ",
"dy",
"range(-1,2)",
"range",
"-1",
"2",
"for dx in range(-1,2):\n if 0>y+dy-1 or y+dy+1>=H or 0>x+dx-1 or x+dx+1>=W or (y+dy,x+dx) in used:\n continue\n tmp=0\n used.add((y+dy,x+dx))\n for ddy in range(-1,2):\n for ddx in range(-1,2):\n if (y+dy+ddy,x+dx+ddx) in s:\n tmp+=1\n ans[tmp]+=1\n ",
"dx",
"range(-1,2)",
"range",
"-1",
"2",
"if 0>y+dy-1 or y+dy+1>=H or 0>x+dx-1 or x+dx+1>=W or (y+dy,x+dx) in used:\n continue\n ",
"0>y+dy-1 or y+dy+1>=H or 0>x+dx-1 or x+dx+1>=W or (y+dy,x+dx) in used",
"0>y+dy-1 or y+dy+1>=H or 0>x+dx-1 or x+dx+1>=W",
"0>y+dy-1 or y+dy+1>=H or 0>x+dx-1",
"0>y+dy-1 or y+dy+1>=H",
"0>y+dy-1",
"0",
"y+dy-1",
"y+dy",
"y",
"dy",
"1",
"y+dy+1>=H",
"y+dy+1",
"y+dy",
"y",
"dy",
"1",
"H",
"0>x+dx-1",
"0",
"x+dx-1",
"x+dx",
"x",
"dx",
"1",
"x+dx+1>=W",
"x+dx+1",
"x+dx",
"x",
"dx",
"1",
"W",
"(y+dy,x+dx) in used",
"(y+dy,x+dx)",
"y+dy",
"y",
"dy",
"x+dx",
"x",
"dx",
"used",
"continue",
"tmp=0",
"tmp",
"0",
"used.add((y+dy,x+dx))",
"used.add",
"used",
"add",
"(y+dy,x+dx)",
"y+dy",
"y",
"dy",
"x+dx",
"x",
"dx",
"for ddy in range(-1,2):\n for ddx in range(-1,2):\n if (y+dy+ddy,x+dx+ddx) in s:\n tmp+=1\n ",
"ddy",
"range(-1,2)",
"range",
"-1",
"2",
"for ddx in range(-1,2):\n if (y+dy+ddy,x+dx+ddx) in s:\n tmp+=1\n ",
"ddx",
"range(-1,2)",
"range",
"-1",
"2",
"if (y+dy+ddy,x+dx+ddx) in s:\n tmp+=1\n ",
"(y+dy+ddy,x+dx+ddx) in s",
"(y+dy+ddy,x+dx+ddx)",
"y+dy+ddy",
"y+dy",
"y",
"dy",
"ddy",
"x+dx+ddx",
"x+dx",
"x",
"dx",
"ddx",
"s",
"tmp+=1",
"tmp",
"1",
"ans[tmp]+=1",
"ans[tmp]",
"ans",
"tmp",
"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 row in ans:\n print(row)\n \n ",
"row",
"ans",
"print(row)",
"print",
"row",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"MOD=10**9+7",
"10**9+7",
"MOD",
"def main():\n H,W,N=map(int,input().split())\n s=set()\n for i in range(N):\n s.add(tuple(map(int1,input().split())))\n ans=[0]*10\n used=set()\n for y,x in s:\n for dy in range(-1,2):\n for dx in range(-1,2):\n if 0>y+dy-1 or y+dy+1>=H or 0>x+dx-1 or x+dx+1>=W or (y+dy,x+dx) in used:\n continue\n tmp=0\n used.add((y+dy,x+dx))\n for ddy in range(-1,2):\n for ddx in range(-1,2):\n if (y+dy+ddy,x+dx+ddx) in s:\n tmp+=1\n ans[tmp]+=1\n ans[0]=(H-2)*(W-2)-sum(ans[1:])\n for row in ans:\n print(row)\n \n ",
"def main():\n H,W,N=map(int,input().split())\n s=set()\n for i in range(N):\n s.add(tuple(map(int1,input().split())))\n ans=[0]*10\n used=set()\n for y,x in s:\n for dy in range(-1,2):\n for dx in range(-1,2):\n if 0>y+dy-1 or y+dy+1>=H or 0>x+dx-1 or x+dx+1>=W or (y+dy,x+dx) in used:\n continue\n tmp=0\n used.add((y+dy,x+dx))\n for ddy in range(-1,2):\n for ddx in range(-1,2):\n if (y+dy+ddy,x+dx+ddx) in s:\n tmp+=1\n ans[tmp]+=1\n ans[0]=(H-2)*(W-2)-sum(ans[1:])\n for row in ans:\n print(row)\n \n ",
"main",
"input=lambda: sys.stdin.readline().rstrip()",
"lambda: sys.stdin.readline().rstrip()",
"input",
"YesNo=lambda b: bool([print('Yes')] if b else print('No'))",
"lambda b: bool([print('Yes')] if b else print('No'))",
"YesNo",
"INF=10**18",
"10**18",
"INF",
"YESNO=lambda b: bool([print('YES')] if b else print('NO'))",
"lambda b: bool([print('YES')] if b else print('NO'))",
"YESNO",
"int1=lambda x:int(x)-1",
"lambda x:int(x)-1",
"int1"
] | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
def main():
H,W,N=map(int,input().split())
s=set()
for i in range(N):
s.add(tuple(map(int1,input().split())))
ans=[0]*10
used=set()
for y,x in s:
for dy in range(-1,2):
for dx in range(-1,2):
if 0>y+dy-1 or y+dy+1>=H or 0>x+dx-1 or x+dx+1>=W or (y+dy,x+dx) in used:
continue
tmp=0
used.add((y+dy,x+dx))
for ddy in range(-1,2):
for ddx in range(-1,2):
if (y+dy+ddy,x+dx+ddx) in s:
tmp+=1
ans[tmp]+=1
ans[0]=(H-2)*(W-2)-sum(ans[1:])
for row in ans:
print(row)
if __name__ == '__main__':
main()
|
[
7,
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,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
14,
2,
2,
2,
2,
2,
13,
13,
17,
2,
2,
13,
13,
17,
2,
2,
13,
13,
2,
13,
17,
2,
2,
13,
13,
2,
13,
17,
9,
0,
18,
13,
39,
2,
2,
13,
13,
17,
2,
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,
13,
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,
4,
13,
10,
2,
13
] | [
[
143,
2
],
[
143,
11
],
[
143,
12
],
[
134,
15
],
[
21,
20
],
[
144,
23
],
[
149,
25
],
[
149,
34
],
[
37,
36
],
[
43,
42
],
[
147,
53
],
[
36,
54
],
[
150,
58
],
[
42,
59
],
[
147,
63
],
[
36,
64
],
[
141,
66
],
[
150,
70
],
[
42,
71
],
[
138,
73
],
[
90,
77
],
[
135,
78
],
[
147,
82
],
[
36,
83
],
[
150,
87
],
[
42,
88
],
[
152,
92
],
[
99,
98
],
[
135,
101
],
[
107,
104
],
[
153,
105
],
[
98,
106
],
[
112,
109
],
[
153,
110
],
[
141,
115
],
[
138,
118
],
[
153,
122
],
[
125,
124
],
[
153,
131
],
[
124,
132
],
[
134,
135
],
[
143,
138
],
[
143,
141
],
[
143,
144
],
[
149,
147
],
[
149,
150
],
[
152,
153
]
] | [
"H,W,N = map(int,input().split())\n\nfrom collections import defaultdict\nL = defaultdict(int)\n\n#黒く塗りつぶしたマスとその周りだけ探索すればよい\nfor i in range(N):\n a,b = map(int,input().split())\n for p in [-1,0,1]:\n for q in [-1,0,1]:\n if a+p < 2 or b+q < 2 or a+p >H-1 or b+q >W-1:\n continue\n L[(a+p-1,b+q-1)] += 1\n \nans = [0]*10\nfor v in L.values():\n ans[v] += 1\nans[0] = (H-2)*(W-2) - sum(ans)\n\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",
"from collections import defaultdict",
"L = defaultdict(int)",
"L",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n a,b = map(int,input().split())\n for p in [-1,0,1]:\n for q in [-1,0,1]:\n if a+p < 2 or b+q < 2 or a+p >H-1 or b+q >W-1:\n continue\n L[(a+p-1,b+q-1)] += 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 p in [-1,0,1]:\n for q in [-1,0,1]:\n if a+p < 2 or b+q < 2 or a+p >H-1 or b+q >W-1:\n continue\n L[(a+p-1,b+q-1)] += 1\n ",
"p",
"[-1,0,1]",
"-1",
"0",
"1",
"for q in [-1,0,1]:\n if a+p < 2 or b+q < 2 or a+p >H-1 or b+q >W-1:\n continue\n L[(a+p-1,b+q-1)] += 1\n ",
"q",
"[-1,0,1]",
"-1",
"0",
"1",
"if a+p < 2 or b+q < 2 or a+p >H-1 or b+q >W-1:\n continue\n ",
"a+p < 2 or b+q < 2 or a+p >H-1 or b+q >W-1",
"a+p < 2 or b+q < 2 or a+p >H-1",
"a+p < 2 or b+q < 2",
"a+p < 2",
"a+p",
"a",
"p",
"2",
"b+q < 2",
"b+q",
"b",
"q",
"2",
"a+p >H-1",
"a+p",
"a",
"p",
"H-1",
"H",
"1",
"b+q >W-1",
"b+q",
"b",
"q",
"W-1",
"W",
"1",
"continue",
"L[(a+p-1,b+q-1)] += 1",
"L[(a+p-1,b+q-1)]",
"L",
"(a+p-1,b+q-1)",
"a+p-1",
"a+p",
"a",
"p",
"1",
"b+q-1",
"b+q",
"b",
"q",
"1",
"1",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for v in L.values():\n ans[v] += 1",
"v",
"L.values()",
"L.values",
"L",
"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",
"L = defaultdict(int)",
"defaultdict(int)",
"L",
"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",
"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"
] | H,W,N = map(int,input().split())
from collections import defaultdict
L = defaultdict(int)
#黒く塗りつぶしたマスとその周りだけ探索すればよい
for i in range(N):
a,b = map(int,input().split())
for p in [-1,0,1]:
for q in [-1,0,1]:
if a+p < 2 or b+q < 2 or a+p >H-1 or b+q >W-1:
continue
L[(a+p-1,b+q-1)] += 1
ans = [0]*10
for v in L.values():
ans[v] += 1
ans[0] = (H-2)*(W-2) - sum(ans)
for i in range(10):
print(ans[i])
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
12,
2,
4,
13,
13,
17,
23,
4,
18,
4,
13,
13,
13,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
0,
13,
2,
13,
13,
13,
2,
13,
13,
14,
2,
2,
40,
17,
13,
2,
13,
17,
2,
40,
17,
13,
2,
13,
17,
0,
13,
39,
2,
13,
13,
2,
13,
13,
4,
18,
13,
13,
13,
17,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
18,
13,
13,
17,
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,
39,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13
] | [
[
146,
2
],
[
146,
11
],
[
146,
12
],
[
143,
14
],
[
23,
20
],
[
144,
21
],
[
147,
25
],
[
138,
28
],
[
134,
31
],
[
36,
35
],
[
141,
38
],
[
161,
40
],
[
161,
55
],
[
58,
57
],
[
64,
63
],
[
155,
69
],
[
150,
71
],
[
57,
72
],
[
158,
73
],
[
162,
75
],
[
63,
76
],
[
156,
82
],
[
147,
84
],
[
159,
89
],
[
138,
91
],
[
152,
94
],
[
150,
97
],
[
57,
98
],
[
162,
100
],
[
63,
101
],
[
135,
104
],
[
153,
106
],
[
114,
109
],
[
144,
110
],
[
116,
111
],
[
135,
112
],
[
153,
113
],
[
119,
116
],
[
135,
117
],
[
153,
118
],
[
126,
121
],
[
144,
122
],
[
116,
123
],
[
135,
124
],
[
153,
125
],
[
129,
128
],
[
144,
128
],
[
128,
132
],
[
134,
135
],
[
146,
138
],
[
146,
141
],
[
143,
144
],
[
146,
147
],
[
161,
150
],
[
152,
153
],
[
155,
156
],
[
158,
159
],
[
161,
162
]
] | [
"h, w, n = map(int, input().split())\ncnts = [0] * 10\ncnts[0] = (h-2)*(w-2)\n\npoints = dict()\nfor _ in range(n):\n a, b = map(lambda x: int(x)-1, input().split())\n for i in (-1, 0, 1):\n for j in (-1, 0, 1):\n ai, bj = a+i, b+j\n if 1 <= ai < h-1 and 1 <= bj < w-1:\n ab = (a+i, b+j)\n points.setdefault(ab, 0)\n cnts[points[ab]] -= 1\n points[ab] += 1\n cnts[points[ab]] += 1\nfor c in cnts:\n print(c)",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"cnts = [0] * 10",
"cnts",
"[0] * 10",
"[0]",
"0",
"10",
"cnts[0] = (h-2)*(w-2)",
"cnts[0]",
"cnts",
"0",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"points = dict()",
"points",
"dict()",
"dict",
"for _ in range(n):\n a, b = map(lambda x: int(x)-1, input().split())\n for i in (-1, 0, 1):\n for j in (-1, 0, 1):\n ai, bj = a+i, b+j\n if 1 <= ai < h-1 and 1 <= bj < w-1:\n ab = (a+i, b+j)\n points.setdefault(ab, 0)\n cnts[points[ab]] -= 1\n points[ab] += 1\n cnts[points[ab]] += 1",
"_",
"range(n)",
"range",
"n",
"a, b = map(lambda x: int(x)-1, input().split())",
"a",
"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",
"b",
"for i in (-1, 0, 1):\n for j in (-1, 0, 1):\n ai, bj = a+i, b+j\n if 1 <= ai < h-1 and 1 <= bj < w-1:\n ab = (a+i, b+j)\n points.setdefault(ab, 0)\n cnts[points[ab]] -= 1\n points[ab] += 1\n cnts[points[ab]] += 1",
"i",
"(-1, 0, 1)",
"-1",
"0",
"1",
"for j in (-1, 0, 1):\n ai, bj = a+i, b+j\n if 1 <= ai < h-1 and 1 <= bj < w-1:\n ab = (a+i, b+j)\n points.setdefault(ab, 0)\n cnts[points[ab]] -= 1\n points[ab] += 1\n cnts[points[ab]] += 1",
"j",
"(-1, 0, 1)",
"-1",
"0",
"1",
"ai, bj = a+i, b+j",
"ai",
"a+i",
"a",
"i",
"bj",
"b+j",
"b",
"j",
"if 1 <= ai < h-1 and 1 <= bj < w-1:\n ab = (a+i, b+j)\n points.setdefault(ab, 0)\n cnts[points[ab]] -= 1\n points[ab] += 1\n cnts[points[ab]] += 1",
"1 <= ai < h-1 and 1 <= bj < w-1",
"1 <= ai < h-1",
"1 <= ai",
"1",
"ai",
"h-1",
"h",
"1",
"1 <= bj < w-1",
"1 <= bj",
"1",
"bj",
"w-1",
"w",
"1",
"ab = (a+i, b+j)",
"ab",
"(a+i, b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"points.setdefault(ab, 0)",
"points.setdefault",
"points",
"setdefault",
"ab",
"0",
"cnts[points[ab]] -= 1",
"cnts[points[ab]]",
"cnts",
"points[ab]",
"points",
"ab",
"1",
"points[ab] += 1",
"points[ab]",
"points",
"ab",
"1",
"cnts[points[ab]] += 1",
"cnts[points[ab]]",
"cnts",
"points[ab]",
"points",
"ab",
"1",
"for c in cnts:\n print(c)",
"c",
"cnts",
"print(c)",
"print",
"c",
"points = dict()",
"dict()",
"points",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"cnts = [0] * 10",
"[0] * 10",
"cnts",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"a, b = map(lambda x: int(x)-1, input().split())",
"map(lambda x: int(x)-1, input().split())",
"a",
"ab = (a+i, b+j)",
"(a+i, b+j)",
"ab",
"ai, bj = a+i, b+j",
"a+i",
"ai",
"bj = a+i, b+j",
"b+j",
"bj",
"b = map(lambda x: int(x)-1, input().split())",
"map(lambda x: int(x)-1, input().split())",
"b"
] | h, w, n = map(int, input().split())
cnts = [0] * 10
cnts[0] = (h-2)*(w-2)
points = dict()
for _ in range(n):
a, b = map(lambda x: int(x)-1, input().split())
for i in (-1, 0, 1):
for j in (-1, 0, 1):
ai, bj = a+i, b+j
if 1 <= ai < h-1 and 1 <= bj < w-1:
ab = (a+i, b+j)
points.setdefault(ab, 0)
cnts[points[ab]] -= 1
points[ab] += 1
cnts[points[ab]] += 1
for c in cnts:
print(c)
|
[
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,
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,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
18,
13,
17,
2,
13,
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,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
136,
3
],
[
136,
12
],
[
136,
13
],
[
127,
15
],
[
21,
20
],
[
125,
23
],
[
121,
25
],
[
121,
34
],
[
37,
36
],
[
119,
40
],
[
119,
43
],
[
47,
46
],
[
122,
50
],
[
122,
53
],
[
36,
60
],
[
137,
62
],
[
46,
67
],
[
131,
69
],
[
77,
72
],
[
128,
73
],
[
139,
79
],
[
128,
84
],
[
133,
87
],
[
131,
90
],
[
137,
93
],
[
99,
96
],
[
140,
97
],
[
134,
100
],
[
140,
105
],
[
109,
108
],
[
140,
115
],
[
108,
116
],
[
121,
119
],
[
121,
122
],
[
136,
125
],
[
127,
128
],
[
136,
131
],
[
133,
134
],
[
136,
137
],
[
139,
140
]
] | [
"from collections import Counter, defaultdict\n\nh, w, n = map(int, input().split())\ndic = defaultdict(int)\nfor _ in range(n):\n a, b = map(int, input().split())\n for y in range(a - 2, a + 1):\n for x in range(b - 2, b + 1):\n if 1 <= y <= h - 2 and 1 <= x <= w - 2:\n dic[(x, y)] += 1\ncounter = Counter(dic.values())\ncntSum = (w - 2) * (h - 2)\ncounter[0] = cntSum - sum(counter.values())\nfor k in range(10):\n print(counter[k])",
"from collections import Counter, defaultdict",
"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 a, b = map(int, input().split())\n for y in range(a - 2, a + 1):\n for x in range(b - 2, b + 1):\n if 1 <= y <= h - 2 and 1 <= x <= w - 2:\n dic[(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 y in range(a - 2, a + 1):\n for x in range(b - 2, b + 1):\n if 1 <= y <= h - 2 and 1 <= x <= w - 2:\n dic[(x, y)] += 1",
"y",
"range(a - 2, a + 1)",
"range",
"a - 2",
"a",
"2",
"a + 1",
"a",
"1",
"for x in range(b - 2, b + 1):\n if 1 <= y <= h - 2 and 1 <= x <= w - 2:\n dic[(x, y)] += 1",
"x",
"range(b - 2, b + 1)",
"range",
"b - 2",
"b",
"2",
"b + 1",
"b",
"1",
"if 1 <= y <= h - 2 and 1 <= x <= w - 2:\n dic[(x, y)] += 1",
"1 <= y <= h - 2 and 1 <= x <= w - 2",
"1 <= y <= h - 2",
"1 <= y",
"1",
"y",
"h - 2",
"h",
"2",
"1 <= x <= w - 2",
"1 <= x",
"1",
"x",
"w - 2",
"w",
"2",
"dic[(x, y)] += 1",
"dic[(x, y)]",
"dic",
"(x, y)",
"x",
"y",
"1",
"counter = Counter(dic.values())",
"counter",
"Counter(dic.values())",
"Counter",
"dic.values()",
"dic.values",
"dic",
"values",
"cntSum = (w - 2) * (h - 2)",
"cntSum",
"(w - 2) * (h - 2)",
"w - 2",
"w",
"2",
"h - 2",
"h",
"2",
"counter[0] = cntSum - sum(counter.values())",
"counter[0]",
"counter",
"0",
"cntSum - sum(counter.values())",
"cntSum",
"sum(counter.values())",
"sum",
"counter.values()",
"counter.values",
"counter",
"values",
"for k in range(10):\n print(counter[k])",
"k",
"range(10)",
"range",
"10",
"print(counter[k])",
"print",
"counter[k]",
"counter",
"k",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"dic = defaultdict(int)",
"defaultdict(int)",
"dic",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"cntSum = (w - 2) * (h - 2)",
"(w - 2) * (h - 2)",
"cntSum",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"counter = Counter(dic.values())",
"Counter(dic.values())",
"counter"
] | from collections import Counter, defaultdict
h, w, n = map(int, input().split())
dic = defaultdict(int)
for _ in range(n):
a, b = map(int, input().split())
for y in range(a - 2, a + 1):
for x in range(b - 2, b + 1):
if 1 <= y <= h - 2 and 1 <= x <= w - 2:
dic[(x, y)] += 1
counter = Counter(dic.values())
cntSum = (w - 2) * (h - 2)
counter[0] = cntSum - sum(counter.values())
for k in range(10):
print(counter[k]) |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
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,
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,
0,
13,
17,
4,
18,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
0,
18,
13,
13,
17,
0,
13,
17,
14,
40,
13,
17,
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,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13
] | [
[
211,
4
],
[
208,
11
],
[
212,
18
],
[
208,
20
],
[
208,
21
],
[
196,
23
],
[
199,
26
],
[
30,
29
],
[
194,
32
],
[
187,
34
],
[
212,
41
],
[
187,
43
],
[
202,
45
],
[
175,
48
],
[
52,
51
],
[
203,
58
],
[
185,
58
],
[
203,
63
],
[
185,
63
],
[
179,
66
],
[
70,
69
],
[
176,
76
],
[
188,
76
],
[
176,
81
],
[
188,
81
],
[
209,
84
],
[
197,
88
],
[
181,
94
],
[
197,
98
],
[
172,
101
],
[
205,
107
],
[
111,
110
],
[
182,
114
],
[
200,
114
],
[
197,
119
],
[
110,
120
],
[
197,
122
],
[
110,
124
],
[
214,
127
],
[
133,
130
],
[
173,
131
],
[
206,
132
],
[
191,
132
],
[
215,
132
],
[
190,
135
],
[
182,
139
],
[
200,
139
],
[
145,
142
],
[
173,
143
],
[
191,
144
],
[
215,
144
],
[
206,
144
],
[
150,
147
],
[
173,
148
],
[
179,
153
],
[
209,
156
],
[
173,
160
],
[
163,
162
],
[
173,
169
],
[
162,
170
],
[
172,
173
],
[
175,
176
],
[
208,
179
],
[
181,
182
],
[
187,
185
],
[
187,
188
],
[
190,
191
],
[
208,
194
],
[
196,
197
],
[
199,
200
],
[
202,
203
],
[
205,
206
],
[
208,
209
],
[
211,
212
],
[
214,
215
]
] | [
"import sys\ninput = sys.stdin.readline\nH,W,N = map(int,input().split())\ncount = []\nL = 0\nfor i in range(N):\n a,b = map(int, input().split())\n a -= 1\n b -= 1\n for i in range(max(0,a-2),min(a+1,H-2)):\n for j in range(max(0,b-2),min(b+1,W-2)):\n count.append((i,j))\n L += 1\ncount.sort()\nans = [0]*10\ntmp = 1\nfor i in range(L-1):\n if count[i] == count[i+1]:\n tmp += 1\n else:\n ans[tmp] += 1\n tmp = 1\nif L>=1:\n ans[tmp] += 1\nans[0] = (H-2)*(W-2)-sum(ans)\nfor i in range(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",
"count = []",
"count",
"[]",
"L = 0",
"L",
"0",
"for i in range(N):\n a,b = map(int, input().split())\n a -= 1\n b -= 1\n for i in range(max(0,a-2),min(a+1,H-2)):\n for j in range(max(0,b-2),min(b+1,W-2)):\n count.append((i,j))\n 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 i in range(max(0,a-2),min(a+1,H-2)):\n for j in range(max(0,b-2),min(b+1,W-2)):\n count.append((i,j))\n L += 1",
"i",
"range(max(0,a-2),min(a+1,H-2))",
"range",
"max(0,a-2)",
"max",
"0",
"a-2",
"a",
"2",
"min(a+1,H-2)",
"min",
"a+1",
"a",
"1",
"H-2",
"H",
"2",
"for j in range(max(0,b-2),min(b+1,W-2)):\n count.append((i,j))\n L += 1",
"j",
"range(max(0,b-2),min(b+1,W-2))",
"range",
"max(0,b-2)",
"max",
"0",
"b-2",
"b",
"2",
"min(b+1,W-2)",
"min",
"b+1",
"b",
"1",
"W-2",
"W",
"2",
"count.append((i,j))",
"count.append",
"count",
"append",
"(i,j)",
"i",
"j",
"L += 1",
"L",
"1",
"count.sort()",
"count.sort",
"count",
"sort",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"tmp = 1",
"tmp",
"1",
"for i in range(L-1):\n if count[i] == count[i+1]:\n tmp += 1\n else:\n ans[tmp] += 1\n tmp = 1",
"i",
"range(L-1)",
"range",
"L-1",
"L",
"1",
"if count[i] == count[i+1]:\n tmp += 1\n else:\n ans[tmp] += 1\n tmp = 1",
"count[i] == count[i+1]",
"count[i]",
"count",
"i",
"count[i+1]",
"count",
"i+1",
"i",
"1",
"tmp += 1",
"tmp",
"1",
"ans[tmp] += 1",
"ans[tmp]",
"ans",
"tmp",
"1",
"tmp = 1",
"tmp",
"1",
"if L>=1:\n ans[tmp] += 1",
"L>=1",
"L",
"1",
"ans[tmp] += 1",
"ans[tmp]",
"ans",
"tmp",
"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",
"b -= 1",
"1",
"b",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"L += 1",
"1",
"L",
"a,b = map(int, input().split())",
"map(int, input().split())",
"a",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"tmp = 1",
"1",
"tmp",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"count = []",
"[]",
"count",
"L = 0",
"0",
"L",
"a -= 1",
"1",
"a",
"tmp = 1",
"1",
"tmp",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"tmp += 1",
"1",
"tmp"
] | import sys
input = sys.stdin.readline
H,W,N = map(int,input().split())
count = []
L = 0
for i in range(N):
a,b = map(int, input().split())
a -= 1
b -= 1
for i in range(max(0,a-2),min(a+1,H-2)):
for j in range(max(0,b-2),min(b+1,W-2)):
count.append((i,j))
L += 1
count.sort()
ans = [0]*10
tmp = 1
for i in range(L-1):
if count[i] == count[i+1]:
tmp += 1
else:
ans[tmp] += 1
tmp = 1
if L>=1:
ans[tmp] += 1
ans[0] = (H-2)*(W-2)-sum(ans)
for i in range(10):
print(ans[i]) |
[
7,
15,
15,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
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,
14,
40,
40,
17,
2,
13,
13,
2,
13,
17,
28,
13,
4,
13,
17,
17,
14,
40,
40,
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,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
4,
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,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] | [
[
144,
5
],
[
147,
21
],
[
145,
28
],
[
147,
30
],
[
147,
31
],
[
156,
33
],
[
39,
38
],
[
148,
41
],
[
138,
43
],
[
145,
50
],
[
138,
52
],
[
55,
54
],
[
133,
64
],
[
54,
65
],
[
142,
67
],
[
71,
70
],
[
139,
80
],
[
70,
81
],
[
136,
83
],
[
95,
86
],
[
157,
87
],
[
133,
90
],
[
54,
91
],
[
139,
93
],
[
70,
94
],
[
150,
97
],
[
157,
102
],
[
153,
105
],
[
142,
109
],
[
136,
112
],
[
157,
116
],
[
154,
119
],
[
122,
121
],
[
151,
129
],
[
121,
130
],
[
138,
133
],
[
147,
136
],
[
138,
139
],
[
147,
142
],
[
144,
145
],
[
147,
148
],
[
150,
151
],
[
153,
154
],
[
156,
157
]
] | [
"from collections import defaultdict, Counter\nimport sys\ninput = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 7)\n\nH, W, N = map(int, input().split())\nd = defaultdict(int)\nfor _ in range(N):\n x, y = map(int, input().split())\n for i in range(-2, 1):\n if 1 <= x + i <= H - 2:\n for j in range(-2, 1):\n if 1 <= y + j <= W - 2:\n d[(x + i, y + j)] += 1\n\nc = Counter(d.values())\nzero = (H - 2) * (W - 2) - len(d)\nprint(zero)\nfor i in range(1, 10):\n print(c[i])",
"from collections import defaultdict, Counter",
"import sys",
"sys",
"input = sys.stdin.buffer.readline",
"input",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"sys.setrecursionlimit(10 ** 7)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 7",
"10",
"7",
"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 x, y = map(int, input().split())\n for i in range(-2, 1):\n if 1 <= x + i <= H - 2:\n for j in range(-2, 1):\n if 1 <= y + j <= W - 2:\n d[(x + i, y + j)] += 1",
"_",
"range(N)",
"range",
"N",
"x, y = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"for i in range(-2, 1):\n if 1 <= x + i <= H - 2:\n for j in range(-2, 1):\n if 1 <= y + j <= W - 2:\n d[(x + i, y + j)] += 1",
"i",
"range(-2, 1)",
"range",
"-2",
"1",
"if 1 <= x + i <= H - 2:\n for j in range(-2, 1):\n if 1 <= y + j <= W - 2:\n d[(x + i, y + j)] += 1",
"1 <= x + i <= H - 2",
"1 <= x + i",
"1",
"x + i",
"x",
"i",
"H - 2",
"H",
"2",
"for j in range(-2, 1):\n if 1 <= y + j <= W - 2:\n d[(x + i, y + j)] += 1",
"j",
"range(-2, 1)",
"range",
"-2",
"1",
"if 1 <= y + j <= W - 2:\n d[(x + i, y + j)] += 1",
"1 <= y + j <= W - 2",
"1 <= y + j",
"1",
"y + j",
"y",
"j",
"W - 2",
"W",
"2",
"d[(x + i, y + j)] += 1",
"d[(x + i, y + j)]",
"d",
"(x + i, y + j)",
"x + i",
"x",
"i",
"y + j",
"y",
"j",
"1",
"c = Counter(d.values())",
"c",
"Counter(d.values())",
"Counter",
"d.values()",
"d.values",
"d",
"values",
"zero = (H - 2) * (W - 2) - len(d)",
"zero",
"(H - 2) * (W - 2) - len(d)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"len(d)",
"len",
"d",
"print(zero)",
"print",
"zero",
"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",
"x, y = map(int, input().split())",
"map(int, input().split())",
"x",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"y = map(int, input().split())",
"map(int, input().split())",
"y",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"input = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"input",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"c = Counter(d.values())",
"Counter(d.values())",
"c",
"zero = (H - 2) * (W - 2) - len(d)",
"(H - 2) * (W - 2) - len(d)",
"zero",
"d = defaultdict(int)",
"defaultdict(int)",
"d"
] | from collections import defaultdict, Counter
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
H, W, N = map(int, input().split())
d = defaultdict(int)
for _ in range(N):
x, y = map(int, input().split())
for i in range(-2, 1):
if 1 <= x + i <= H - 2:
for j in range(-2, 1):
if 1 <= y + j <= W - 2:
d[(x + i, y + j)] += 1
c = Counter(d.values())
zero = (H - 2) * (W - 2) - len(d)
print(zero)
for i in range(1, 10):
print(c[i]) |
[
7,
15,
13,
15,
15,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
17,
17,
17,
0,
13,
39,
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,
13,
4,
13,
13,
0,
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,
4,
13,
4,
18,
4,
13,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
14,
4,
18,
13,
13,
13,
4,
13,
18,
13,
13,
4,
13,
17,
10,
39,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13
] | [
[
180,
6
],
[
177,
13
],
[
181,
20
],
[
177,
22
],
[
177,
23
],
[
165,
25
],
[
150,
31
],
[
35,
34
],
[
169,
37
],
[
171,
39
],
[
181,
46
],
[
171,
48
],
[
162,
50
],
[
172,
52
],
[
163,
52
],
[
153,
54
],
[
157,
56
],
[
154,
56
],
[
166,
63
],
[
66,
65
],
[
163,
73
],
[
172,
73
],
[
178,
76
],
[
154,
82
],
[
157,
82
],
[
160,
85
],
[
151,
89
],
[
163,
93
],
[
172,
93
],
[
154,
96
],
[
157,
96
],
[
174,
99
],
[
151,
108
],
[
114,
111
],
[
175,
112
],
[
178,
117
],
[
160,
120
],
[
175,
128
],
[
132,
131
],
[
175,
138
],
[
131,
140
],
[
175,
144
],
[
131,
145
],
[
150,
151
],
[
153,
154
],
[
171,
157
],
[
177,
160
],
[
162,
163
],
[
165,
166
],
[
177,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
],
[
180,
181
]
] | [
"import sys\nfrom itertools import product\nfrom collections import Counter\ninput = sys.stdin.readline\n\nH, W, N = map(int, input().split())\nudlr = [-1, 0, 1]\ncenter = []\n\nfor _ in range(N):\n a, b = map(int, input().split())\n a, b = a - 1, b - 1\n for i, j in product(udlr, repeat=2):\n if 0 < a + i < H - 1 and 0 < b + j < W - 1:\n center.append((a + i, b + j))\n\nblack = Counter(list(Counter(center).values()))\nblack[0] = (H - 2) * (W - 2) - sum(list(black.values()))\n\nfor i in range(10):\n if black.get(i):\n print(black[i])\n else:\n print(0)",
"import sys",
"sys",
"from itertools import product",
"from collections import Counter",
"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",
"udlr = [-1, 0, 1]",
"udlr",
"[-1, 0, 1]",
"-1",
"0",
"1",
"center = []",
"center",
"[]",
"for _ in range(N):\n a, b = map(int, input().split())\n a, b = a - 1, b - 1\n for i, j in product(udlr, repeat=2):\n if 0 < a + i < H - 1 and 0 < b + j < W - 1:\n center.append((a + i, b + j))",
"_",
"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 i, j in product(udlr, repeat=2):\n if 0 < a + i < H - 1 and 0 < b + j < W - 1:\n center.append((a + i, b + j))",
"i",
"j",
"product(udlr, repeat=2)",
"product",
"udlr",
"repeat=2",
"repeat",
"2",
"if 0 < a + i < H - 1 and 0 < b + j < W - 1:\n center.append((a + i, b + j))",
"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",
"center.append((a + i, b + j))",
"center.append",
"center",
"append",
"(a + i, b + j)",
"a + i",
"a",
"i",
"b + j",
"b",
"j",
"black = Counter(list(Counter(center).values()))",
"black",
"Counter(list(Counter(center).values()))",
"Counter",
"list(Counter(center).values())",
"list",
"Counter(center).values()",
"(center).values",
"(center)",
"Counter",
"center",
"values",
"black[0] = (H - 2) * (W - 2) - sum(list(black.values()))",
"black[0]",
"black",
"0",
"(H - 2) * (W - 2) - sum(list(black.values()))",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(list(black.values()))",
"sum",
"list(black.values())",
"list",
"black.values()",
"black.values",
"black",
"values",
"for i in range(10):\n if black.get(i):\n print(black[i])\n else:\n print(0)",
"i",
"range(10)",
"range",
"10",
"if black.get(i):\n print(black[i])\n else:\n print(0)",
"black.get(i)",
"black.get",
"black",
"get",
"i",
"print(black[i])",
"print",
"black[i]",
"black",
"i",
"print(0)",
"print",
"0",
"center = []",
"[]",
"center",
"b = a - 1, b - 1",
"b - 1",
"b",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"a, b = a - 1, b - 1",
"a - 1",
"a",
"udlr = [-1, 0, 1]",
"[-1, 0, 1]",
"udlr",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"black = Counter(list(Counter(center).values()))",
"Counter(list(Counter(center).values()))",
"black",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input"
] | import sys
from itertools import product
from collections import Counter
input = sys.stdin.readline
H, W, N = map(int, input().split())
udlr = [-1, 0, 1]
center = []
for _ in range(N):
a, b = map(int, input().split())
a, b = a - 1, b - 1
for i, j in product(udlr, repeat=2):
if 0 < a + i < H - 1 and 0 < b + j < W - 1:
center.append((a + i, b + j))
black = Counter(list(Counter(center).values()))
black[0] = (H - 2) * (W - 2) - sum(list(black.values()))
for i in range(10):
if black.get(i):
print(black[i])
else:
print(0) |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
12,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
12,
2,
4,
13,
13,
17,
23,
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,
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,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
18,
13,
17,
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,
18,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] | [
[
148,
4
],
[
157,
12
],
[
149,
19
],
[
157,
21
],
[
157,
22
],
[
145,
24
],
[
31,
30
],
[
143,
33
],
[
151,
35
],
[
149,
48
],
[
151,
50
],
[
53,
52
],
[
140,
56
],
[
140,
59
],
[
63,
62
],
[
152,
66
],
[
152,
69
],
[
52,
76
],
[
137,
78
],
[
62,
83
],
[
158,
85
],
[
93,
88
],
[
146,
89
],
[
154,
95
],
[
102,
101
],
[
146,
101
],
[
109,
104
],
[
155,
105
],
[
146,
107
],
[
101,
108
],
[
114,
111
],
[
155,
112
],
[
155,
117
],
[
137,
121
],
[
158,
124
],
[
146,
128
],
[
131,
130
],
[
155,
130
],
[
130,
134
],
[
157,
137
],
[
151,
140
],
[
157,
143
],
[
145,
146
],
[
148,
149
],
[
151,
152
],
[
154,
155
],
[
157,
158
]
] | [
"import sys\ninput = sys.stdin.readline\nfrom collections import defaultdict\nH, W, N = map(int, input().split())\ncnt = defaultdict(lambda : 0)\nfor i in range(N):\n a, b = map(lambda x: int(x)-1, input().split())\n for y in range(a-2, a+1):\n for x in range(b-2, b+1):\n if 0 <= y < H-2 and 0 <= x < W-2:\n cnt[(y, x)] += 1\nans = [0] * 10\nfor key in cnt:\n ans[cnt[key]] += 1\nans[0] += ans[0] + (H-2) * (W-2) - len(cnt)\nfor i in ans:\n print(i)",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"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",
"cnt = defaultdict(lambda : 0)",
"cnt",
"defaultdict(lambda : 0)",
"defaultdict",
"lambda : 0",
"0",
"for i in range(N):\n a, b = map(lambda x: int(x)-1, input().split())\n for y in range(a-2, a+1):\n for x in range(b-2, b+1):\n if 0 <= y < H-2 and 0 <= x < W-2:\n cnt[(y, x)] += 1",
"i",
"range(N)",
"range",
"N",
"a, b = map(lambda x: int(x)-1, input().split())",
"a",
"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",
"b",
"for y in range(a-2, a+1):\n for x in range(b-2, b+1):\n if 0 <= y < H-2 and 0 <= x < W-2:\n cnt[(y, x)] += 1",
"y",
"range(a-2, a+1)",
"range",
"a-2",
"a",
"2",
"a+1",
"a",
"1",
"for x in range(b-2, b+1):\n if 0 <= y < H-2 and 0 <= x < W-2:\n cnt[(y, x)] += 1",
"x",
"range(b-2, b+1)",
"range",
"b-2",
"b",
"2",
"b+1",
"b",
"1",
"if 0 <= y < H-2 and 0 <= x < W-2:\n cnt[(y, x)] += 1",
"0 <= y < H-2 and 0 <= x < W-2",
"0 <= y < H-2",
"0 <= y",
"0",
"y",
"H-2",
"H",
"2",
"0 <= x < W-2",
"0 <= x",
"0",
"x",
"W-2",
"W",
"2",
"cnt[(y, x)] += 1",
"cnt[(y, x)]",
"cnt",
"(y, x)",
"y",
"x",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for key in cnt:\n ans[cnt[key]] += 1",
"key",
"cnt",
"ans[cnt[key]] += 1",
"ans[cnt[key]]",
"ans",
"cnt[key]",
"cnt",
"key",
"1",
"ans[0] += ans[0] + (H-2) * (W-2) - len(cnt)",
"ans[0]",
"ans",
"0",
"ans[0] + (H-2) * (W-2) - len(cnt)",
"ans[0] + (H-2) * (W-2)",
"ans[0]",
"ans",
"0",
"(H-2) * (W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"len(cnt)",
"len",
"cnt",
"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",
"a, b = map(lambda x: int(x)-1, input().split())",
"map(lambda x: int(x)-1, input().split())",
"a",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"cnt = defaultdict(lambda : 0)",
"defaultdict(lambda : 0)",
"cnt",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"b = map(lambda x: int(x)-1, input().split())",
"map(lambda x: int(x)-1, input().split())",
"b",
"ans = [0] * 10",
"[0] * 10",
"ans",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W"
] | import sys
input = sys.stdin.readline
from collections import defaultdict
H, W, N = map(int, input().split())
cnt = defaultdict(lambda : 0)
for i in range(N):
a, b = map(lambda x: int(x)-1, input().split())
for y in range(a-2, a+1):
for x in range(b-2, b+1):
if 0 <= y < H-2 and 0 <= x < W-2:
cnt[(y, x)] += 1
ans = [0] * 10
for key in cnt:
ans[cnt[key]] += 1
ans[0] += ans[0] + (H-2) * (W-2) - len(cnt)
for i in ans:
print(i)
|
[
7,
15,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
40,
40,
17,
2,
13,
13,
2,
13,
17,
40,
40,
17,
2,
13,
13,
2,
13,
17,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
17,
4,
13,
17,
0,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
28,
13,
4,
13,
4,
18,
13,
13,
4,
13,
18,
13,
13,
10,
13,
13,
10,
39,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13
] | [
[
5,
4
],
[
4,
13
],
[
159,
15
],
[
159,
17
],
[
159,
18
],
[
144,
20
],
[
24,
23
],
[
151,
26
],
[
30,
29
],
[
29,
38
],
[
162,
40
],
[
162,
42
],
[
45,
44
],
[
50,
49
],
[
163,
59
],
[
44,
60
],
[
160,
62
],
[
154,
68
],
[
49,
69
],
[
142,
71
],
[
145,
75
],
[
163,
79
],
[
44,
80
],
[
154,
82
],
[
49,
83
],
[
147,
85
],
[
145,
88
],
[
92,
91
],
[
91,
96
],
[
156,
99
],
[
105,
102
],
[
157,
103
],
[
160,
108
],
[
142,
111
],
[
148,
115
],
[
118,
117
],
[
148,
120
],
[
126,
123
],
[
157,
124
],
[
117,
125
],
[
129,
128
],
[
157,
133
],
[
157,
138
],
[
128,
139
],
[
159,
142
],
[
144,
145
],
[
147,
148
],
[
159,
151
],
[
162,
154
],
[
156,
157
],
[
159,
160
],
[
162,
163
]
] | [
"from collections import Counter\n\nH, W, N = [int(v) for v in input().split()]\n\nsquare_list = []\nfor i in range(N):\n a, b = [int(v) for v in input().split()]\n for p in range(3):\n for q in range(3):\n if 1 <= a-p <= H-2 and 1 <= b - q <= W-2:\n square_list.append((a - p, b - q))\n\nsquare_cnt = Counter(square_list)\nans = {i: 0 for i in range(10)}\nans[0] = (H-2) * (W-2) - len(square_cnt)\nfor cnt in square_cnt.values():\n ans[cnt] += 1\n\nfor k in sorted(ans.keys()):\n print(ans[k])",
"from collections import Counter",
"int(v) for v in input().split()",
"for v in input().split()",
"v",
"input().split()",
"().split",
"()",
"input",
"split",
"for v in input().split()",
"int(v)",
"int",
"v",
"H, W, N = [int(v) for v in input().split()]",
"H",
"[int(v) for v in input().split()]",
"W",
"N",
"square_list = []",
"square_list",
"[]",
"for i in range(N):\n a, b = [int(v) for v in input().split()]\n for p in range(3):\n for q in range(3):\n if 1 <= a-p <= H-2 and 1 <= b - q <= W-2:\n square_list.append((a - p, b - q))",
"i",
"range(N)",
"range",
"N",
"int(v) for v in input().split()",
"for v in input().split()",
"v",
"input().split()",
"().split",
"()",
"input",
"split",
"for v in input().split()",
"int(v)",
"int",
"v",
"a, b = [int(v) for v in input().split()]",
"a",
"[int(v) for v in input().split()]",
"b",
"for p in range(3):\n for q in range(3):\n if 1 <= a-p <= H-2 and 1 <= b - q <= W-2:\n square_list.append((a - p, b - q))",
"p",
"range(3)",
"range",
"3",
"for q in range(3):\n if 1 <= a-p <= H-2 and 1 <= b - q <= W-2:\n square_list.append((a - p, b - q))",
"q",
"range(3)",
"range",
"3",
"if 1 <= a-p <= H-2 and 1 <= b - q <= W-2:\n square_list.append((a - p, b - q))",
"1 <= a-p <= H-2 and 1 <= b - q <= W-2",
"1 <= a-p <= H-2",
"1 <= a-p",
"1",
"a-p",
"a",
"p",
"H-2",
"H",
"2",
"1 <= b - q <= W-2",
"1 <= b - q",
"1",
"b - q",
"b",
"q",
"W-2",
"W",
"2",
"square_list.append((a - p, b - q))",
"square_list.append",
"square_list",
"append",
"(a - p, b - q)",
"a - p",
"a",
"p",
"b - q",
"b",
"q",
"square_cnt = Counter(square_list)",
"square_cnt",
"Counter(square_list)",
"Counter",
"square_list",
"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) - len(square_cnt)",
"ans[0]",
"ans",
"0",
"(H-2) * (W-2) - len(square_cnt)",
"(H-2) * (W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"len(square_cnt)",
"len",
"square_cnt",
"for cnt in square_cnt.values():\n ans[cnt] += 1",
"cnt",
"square_cnt.values()",
"square_cnt.values",
"square_cnt",
"values",
"ans[cnt] += 1",
"ans[cnt]",
"ans",
"cnt",
"1",
"for k in sorted(ans.keys()):\n print(ans[k])",
"k",
"sorted(ans.keys())",
"sorted",
"ans.keys()",
"ans.keys",
"ans",
"keys",
"print(ans[k])",
"print",
"ans[k]",
"ans",
"k",
"W, N = [int(v) for v in input().split()]",
"[int(v) for v in input().split()]",
"W",
"square_list = []",
"[]",
"square_list",
"square_cnt = Counter(square_list)",
"Counter(square_list)",
"square_cnt",
"N = [int(v) for v in input().split()]",
"[int(v) for v in input().split()]",
"N",
"b = [int(v) for v in input().split()]",
"[int(v) for v in input().split()]",
"b",
"ans = {i: 0 for i in range(10)}",
"{i: 0 for i in range(10)}",
"ans",
"H, W, N = [int(v) for v in input().split()]",
"[int(v) for v in input().split()]",
"H",
"a, b = [int(v) for v in input().split()]",
"[int(v) for v in input().split()]",
"a"
] | from collections import Counter
H, W, N = [int(v) for v in input().split()]
square_list = []
for i in range(N):
a, b = [int(v) for v in input().split()]
for p in range(3):
for q in range(3):
if 1 <= a-p <= H-2 and 1 <= b - q <= W-2:
square_list.append((a - p, b - q))
square_cnt = Counter(square_list)
ans = {i: 0 for i in range(10)}
ans[0] = (H-2) * (W-2) - len(square_cnt)
for cnt in square_cnt.values():
ans[cnt] += 1
for k in sorted(ans.keys()):
print(ans[k]) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
15,
15,
0,
13,
2,
39,
2,
2,
13,
17,
2,
13,
17,
2,
39,
17,
17,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
28,
13,
13,
4,
18,
4,
13,
4,
18,
4,
13,
13,
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,
4,
13,
10,
2,
13,
10,
4,
13
] | [
[
94,
2
],
[
94,
11
],
[
94,
12
],
[
91,
16
],
[
89,
21
],
[
95,
24
],
[
33,
32
],
[
83,
35
],
[
85,
48
],
[
68,
65
],
[
92,
66
],
[
73,
70
],
[
92,
71
],
[
92,
77
],
[
80,
79
],
[
94,
83
],
[
85,
86
],
[
94,
89
],
[
91,
92
],
[
94,
95
]
] | [
"h,w,n=map(int,input().split())\nfrom itertools import product as pr\nfrom collections import Counter as co\nans=[(h-2)*(w-2)]+[0]*9\nio=[tuple(map(int,input().split())) for i in range(n)]\nfor k,v in co(co([(a-x)*w+b-y for x,y in pr(range(3),repeat=2) for a,b in io if h-1>a-x>0<b-y<w-1]).values()).items():\n ans[k]=v\n ans[0]-=v\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",
"from itertools import product as pr",
"from collections import Counter as co",
"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",
"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",
"io=[tuple(map(int,input().split())) for i in range(n)]",
"io",
"[tuple(map(int,input().split())) for i in range(n)]",
"for k,v in co(co([(a-x)*w+b-y for x,y in pr(range(3),repeat=2) for a,b in io if h-1>a-x>0<b-y<w-1]).values()).items():\n ans[k]=v\n ans[0]-=v",
"k",
"v",
"co(co([(a-x)*w+b-y for x,y in pr(range(3),repeat=2) for a,b in io if h-1>a-x>0<b-y<w-1]).values()).items()",
"(co([(a-x)*w+b-y for x,y in pr(range(3),repeat=2) for a,b in io if h-1>a-x>0<b-y<w-1]).values()).items",
"(co([(a-x)*w+b-y for x,y in pr(range(3),repeat=2) for a,b in io if h-1>a-x>0<b-y<w-1]).values())",
"co",
"co([(a-x)*w+b-y for x,y in pr(range(3),repeat=2) for a,b in io if h-1>a-x>0<b-y<w-1]).values()",
"([(a-x)*w+b-y for x,y in pr(range(3),repeat=2) for a,b in io if h-1>a-x>0<b-y<w-1]).values",
"([(a-x)*w+b-y for x,y in pr(range(3),repeat=2) for a,b in io if h-1>a-x>0<b-y<w-1])",
"co",
"[(a-x)*w+b-y for x,y in pr(range(3),repeat=2) for a,b in io if h-1>a-x>0<b-y<w-1]",
"values",
"items",
"ans[k]=v",
"ans[k]",
"ans",
"k",
"v",
"ans[0]-=v",
"ans[0]",
"ans",
"0",
"v",
"print(*ans,sep='\\n')",
"print",
"*ans",
"ans",
"sep='\\n'",
"sep",
"'\\n'",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"io=[tuple(map(int,input().split())) for i in range(n)]",
"[tuple(map(int,input().split())) for i in range(n)]",
"io",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"ans=[(h-2)*(w-2)]+[0]*9",
"[(h-2)*(w-2)]+[0]*9",
"ans",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w"
] | h,w,n=map(int,input().split())
from itertools import product as pr
from collections import Counter as co
ans=[(h-2)*(w-2)]+[0]*9
io=[tuple(map(int,input().split())) for i in range(n)]
for k,v in co(co([(a-x)*w+b-y for x,y in pr(range(3),repeat=2) for a,b in io if h-1>a-x>0<b-y<w-1]).values()).items():
ans[k]=v
ans[0]-=v
print(*ans,sep='\n') |
[
7,
15,
13,
13,
13,
13,
13,
15,
15,
15,
12,
13,
29,
18,
4,
18,
18,
13,
13,
13,
39,
17,
12,
13,
29,
2,
39,
17,
4,
13,
4,
13,
13,
23,
13,
12,
13,
29,
40,
2,
40,
13,
13,
23,
13,
23,
13,
4,
18,
13,
13,
17,
0,
13,
2,
4,
13,
17,
17,
17,
41,
28,
13,
4,
13,
17,
4,
4,
13,
2,
4,
13,
17,
13,
0,
13,
13,
0,
13,
39,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
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,
17,
0,
13,
17,
28,
13,
13,
13,
0,
18,
13,
39,
13,
13,
17,
12,
13,
14,
2,
2,
40,
2,
39,
13,
13,
13,
2,
40,
17,
13,
13,
2,
40,
17,
13,
13,
0,
18,
13,
39,
13,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
0,
13,
2,
39,
2,
2,
13,
17,
13,
2,
2,
13,
17,
13,
13,
29,
13,
29,
17,
23,
13,
23,
13,
0,
13,
2,
39,
17,
17,
28,
13,
4,
13,
13,
0,
13,
18,
13,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
0,
13,
4,
13,
2,
2,
13,
17,
13,
2,
2,
13,
17,
13,
14,
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,
39,
13,
10,
17,
13,
10,
2,
13,
10,
13,
13,
10,
12,
13,
10,
18,
13,
10,
12,
13,
10,
4,
13,
10,
18,
13,
10,
12,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
12,
13
] | [
[
34,
32
],
[
34,
34
],
[
44,
41
],
[
46,
42
],
[
44,
44
],
[
46,
46
],
[
285,
53
],
[
63,
62
],
[
62,
73
],
[
312,
75
],
[
279,
78
],
[
315,
93
],
[
307,
100
],
[
315,
102
],
[
315,
103
],
[
107,
106
],
[
310,
109
],
[
307,
119
],
[
288,
122
],
[
324,
125
],
[
282,
128
],
[
140,
135
],
[
283,
136
],
[
325,
151
],
[
202,
155
],
[
301,
156
],
[
204,
160
],
[
316,
161
],
[
168,
163
],
[
325,
164
],
[
171,
170
],
[
174,
173
],
[
179,
178
],
[
184,
183
],
[
202,
188
],
[
173,
190
],
[
204,
193
],
[
178,
195
],
[
283,
196
],
[
183,
198
],
[
170,
198
],
[
202,
202
],
[
204,
204
],
[
321,
206
],
[
213,
212
],
[
310,
215
],
[
303,
217
],
[
289,
219
],
[
212,
220
],
[
303,
221
],
[
224,
223
],
[
229,
228
],
[
318,
233
],
[
328,
235
],
[
304,
238
],
[
223,
240
],
[
295,
243
],
[
228,
245
],
[
252,
249
],
[
322,
250
],
[
319,
251
],
[
257,
254
],
[
322,
255
],
[
301,
260
],
[
316,
263
],
[
322,
267
],
[
270,
269
],
[
322,
276
],
[
269,
277
],
[
279,
280
],
[
282,
283
],
[
285,
286
],
[
288,
289
],
[
303,
295
],
[
315,
301
],
[
303,
304
],
[
315,
310
],
[
312,
313
],
[
315,
316
],
[
318,
319
],
[
321,
322
],
[
324,
325
]
] | [
"import bisect, copy, heapq, math, sys\nfrom collections import *\nfrom functools import lru_cache\nfrom itertools import accumulate, combinations, permutations, product\ndef input():\n return sys.stdin.readline()[:-1]\ndef ruiseki(lst):\n return [0]+list(accumulate(lst))\ndef celi(a,b):\n return -(-a//b)\nsys.setrecursionlimit(5000000)\nmod=pow(10,9)+7\nal=[chr(ord('a') + i) for i in range(26)]\ndirection=[[1,0],[0,1],[-1,0],[0,-1]]\n\nh,w,n=map(int,input().split())\nab=[list(map(int,input().split())) for i in range(n)]\n\nitta={}\ndic={}\nfor a,b in ab:\n dic[(a,b)]=1\ndef seek(t,y):\n if (not (t,y) in itta) and 2<=t<h and 2<=y<w:\n itta[(t,y)]=1\n cnt=0\n for i in range(3):\n for j in range(3):\n cnt+=(t-1+i,y-1+j) in dic\n return cnt\n else:\n return 0\n\nlst=[0]*10\nfor i in range(n):\n a,b=ab[i]\n for i in range(3):\n for j in range(3):\n cnt=seek(a-1+i,b-1+j)\n if cnt:\n lst[cnt]+=1\n\n# print(lst)\n# sumlst=sum(lst)\nlst[0]=(h-2)*(w-2)-sum(lst)\nfor i in range(10):\n print(lst[i])",
"import bisect, copy, heapq, math, sys",
"bisect",
"copy",
"heapq",
"math",
"sys",
"from collections import *",
"from functools import lru_cache",
"from itertools import accumulate, combinations, permutations, product",
"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",
"def ruiseki(lst):\n return [0]+list(accumulate(lst))",
"ruiseki",
"return [0]+list(accumulate(lst))",
"[0]+list(accumulate(lst))",
"[0]",
"0",
"list(accumulate(lst))",
"list",
"accumulate(lst)",
"accumulate",
"lst",
"lst",
"lst",
"def celi(a,b):\n return -(-a//b)",
"celi",
"return -(-a//b)",
"-(-a//b)",
"-a//b",
"-a",
"a",
"b",
"a",
"a",
"b",
"b",
"sys.setrecursionlimit(5000000)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"5000000",
"mod=pow(10,9)+7",
"mod",
"pow(10,9)+7",
"pow(10,9)",
"pow",
"10",
"9",
"7",
"chr(ord('a') + i) for i in range(26)",
"for i in range(26)",
"i",
"range(26)",
"range",
"26",
"for i in range(26)",
"chr(ord('a') + i)",
"chr",
"ord('a') + i",
"ord('a')",
"ord",
"'a'",
"i",
"al=[chr(ord('a') + i) for i in range(26)]",
"al",
"[chr(ord('a') + i) for i in range(26)]",
"direction=[[1,0],[0,1],[-1,0],[0,-1]]",
"direction",
"[[1,0],[0,1],[-1,0],[0,-1]]",
"[1,0]",
"1",
"0",
"[0,1]",
"0",
"1",
"[-1,0]",
"-1",
"0",
"[0,-1]",
"0",
"-1",
"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)]",
"itta={}",
"itta",
"{}",
"dic={}",
"dic",
"{}",
"for a,b in ab:\n dic[(a,b)]=1",
"a",
"b",
"ab",
"dic[(a,b)]=1",
"dic[(a,b)]",
"dic",
"(a,b)",
"a",
"b",
"1",
"def seek(t,y):\n if (not (t,y) in itta) and 2<=t<h and 2<=y<w:\n itta[(t,y)]=1\n cnt=0\n for i in range(3):\n for j in range(3):\n cnt+=(t-1+i,y-1+j) in dic\n return cnt\n else:\n return 0",
"seek",
"if (not (t,y) in itta) and 2<=t<h and 2<=y<w:\n itta[(t,y)]=1\n cnt=0\n for i in range(3):\n for j in range(3):\n cnt+=(t-1+i,y-1+j) in dic\n return cnt\n else:\n return 0",
"(not (t,y) in itta) and 2<=t<h and 2<=y<w",
"(not (t,y) in itta) and 2<=t<h",
"not (t,y) in itta",
"(t,y) in itta",
"(t,y)",
"t",
"y",
"itta",
"2<=t<h",
"2<=t",
"2",
"t",
"h",
"2<=y<w",
"2<=y",
"2",
"y",
"w",
"itta[(t,y)]=1",
"itta[(t,y)]",
"itta",
"(t,y)",
"t",
"y",
"1",
"cnt=0",
"cnt",
"0",
"for i in range(3):\n for j in range(3):\n cnt+=(t-1+i,y-1+j) in dic\n ",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n cnt+=(t-1+i,y-1+j) in dic\n ",
"j",
"range(3)",
"range",
"3",
"cnt+=(t-1+i,y-1+j) in dic",
"cnt",
"(t-1+i,y-1+j) in dic",
"(t-1+i,y-1+j)",
"t-1+i",
"t-1",
"t",
"1",
"i",
"y-1+j",
"y-1",
"y",
"1",
"j",
"dic",
"return cnt",
"cnt",
"return 0",
"0",
"t",
"t",
"y",
"y",
"lst=[0]*10",
"lst",
"[0]*10",
"[0]",
"0",
"10",
"for i in range(n):\n a,b=ab[i]\n for i in range(3):\n for j in range(3):\n cnt=seek(a-1+i,b-1+j)\n if cnt:\n lst[cnt]+=1\n\n# print(lst)\n# sumlst=sum(lst)",
"i",
"range(n)",
"range",
"n",
"a,b=ab[i]",
"a",
"ab[i]",
"ab",
"i",
"b",
"for i in range(3):\n for j in range(3):\n cnt=seek(a-1+i,b-1+j)\n if cnt:\n lst[cnt]+=1\n\n# print(lst)\n# sumlst=sum(lst)",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n cnt=seek(a-1+i,b-1+j)\n if cnt:\n lst[cnt]+=1\n\n# print(lst)\n# sumlst=sum(lst)",
"j",
"range(3)",
"range",
"3",
"cnt=seek(a-1+i,b-1+j)",
"cnt",
"seek(a-1+i,b-1+j)",
"seek",
"a-1+i",
"a-1",
"a",
"1",
"i",
"b-1+j",
"b-1",
"b",
"1",
"j",
"if cnt:\n lst[cnt]+=1\n\n# print(lst)\n# sumlst=sum(lst)",
"cnt",
"lst[cnt]+=1",
"lst[cnt]",
"lst",
"cnt",
"1",
"lst[0]=(h-2)*(w-2)-sum(lst)",
"lst[0]",
"lst",
"0",
"(h-2)*(w-2)-sum(lst)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(lst)",
"sum",
"lst",
"for i in range(10):\n print(lst[i])",
"i",
"range(10)",
"range",
"10",
"print(lst[i])",
"print",
"lst[i]",
"lst",
"i",
"direction=[[1,0],[0,1],[-1,0],[0,-1]]",
"[[1,0],[0,1],[-1,0],[0,-1]]",
"direction",
"dic={}",
"{}",
"dic",
"mod=pow(10,9)+7",
"pow(10,9)+7",
"mod",
"ab=[list(map(int,input().split())) for i in range(n)]",
"[list(map(int,input().split())) for i in range(n)]",
"ab",
"def ruiseki(lst):\n return [0]+list(accumulate(lst))",
"def ruiseki(lst):\n return [0]+list(accumulate(lst))",
"ruiseki",
"b=ab[i]",
"ab[i]",
"b",
"def celi(a,b):\n return -(-a//b)",
"def celi(a,b):\n return -(-a//b)",
"celi",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"a,b=ab[i]",
"ab[i]",
"a",
"def input():\n return sys.stdin.readline()[:-1]",
"def input():\n return sys.stdin.readline()[:-1]",
"input",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"al=[chr(ord('a') + i) for i in range(26)]",
"[chr(ord('a') + i) for i in range(26)]",
"al",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"cnt=seek(a-1+i,b-1+j)",
"seek(a-1+i,b-1+j)",
"cnt",
"lst=[0]*10",
"[0]*10",
"lst",
"itta={}",
"{}",
"itta",
"def seek(t,y):\n if (not (t,y) in itta) and 2<=t<h and 2<=y<w:\n itta[(t,y)]=1\n cnt=0\n for i in range(3):\n for j in range(3):\n cnt+=(t-1+i,y-1+j) in dic\n return cnt\n else:\n return 0",
"def seek(t,y):\n if (not (t,y) in itta) and 2<=t<h and 2<=y<w:\n itta[(t,y)]=1\n cnt=0\n for i in range(3):\n for j in range(3):\n cnt+=(t-1+i,y-1+j) in dic\n return cnt\n else:\n return 0",
"seek"
] | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]
h,w,n=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]
itta={}
dic={}
for a,b in ab:
dic[(a,b)]=1
def seek(t,y):
if (not (t,y) in itta) and 2<=t<h and 2<=y<w:
itta[(t,y)]=1
cnt=0
for i in range(3):
for j in range(3):
cnt+=(t-1+i,y-1+j) in dic
return cnt
else:
return 0
lst=[0]*10
for i in range(n):
a,b=ab[i]
for i in range(3):
for j in range(3):
cnt=seek(a-1+i,b-1+j)
if cnt:
lst[cnt]+=1
# print(lst)
# sumlst=sum(lst)
lst[0]=(h-2)*(w-2)-sum(lst)
for i in range(10):
print(lst[i]) |
[
7,
12,
13,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
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,
13,
0,
13,
13,
14,
2,
2,
40,
2,
17,
13,
13,
40,
2,
17,
13,
13,
2,
39,
13,
13,
13,
14,
2,
40,
2,
17,
13,
13,
40,
2,
17,
13,
13,
0,
13,
2,
39,
17,
17,
28,
13,
13,
14,
2,
2,
18,
13,
17,
17,
2,
18,
13,
17,
17,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
2,
2,
13,
13,
4,
13,
13,
2,
13,
17,
2,
13,
17,
17,
28,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
7,
6
],
[
14,
13
],
[
6,
20
],
[
14,
22
],
[
14,
23
],
[
26,
25
],
[
29,
28
],
[
59,
58
],
[
23,
61
],
[
64,
63
],
[
6,
70
],
[
64,
72
],
[
79,
78
],
[
63,
79
],
[
82,
81
],
[
72,
82
],
[
78,
89
],
[
13,
90
],
[
81,
94
],
[
22,
95
],
[
25,
100
],
[
78,
106
],
[
13,
107
],
[
81,
111
],
[
22,
112
],
[
115,
114
],
[
121,
120
],
[
25,
120
],
[
120,
126
],
[
120,
131
],
[
140,
135
],
[
114,
136
],
[
25,
138
],
[
120,
139
],
[
145,
142
],
[
114,
143
],
[
13,
150
],
[
22,
151
],
[
114,
154
],
[
22,
156
],
[
13,
159
],
[
164,
163
],
[
114,
163
],
[
163,
167
],
[
176,
173
]
] | [
"def sol():\n import sys\n input=sys.stdin.readline\n h,w,n=map(int,input().split())\n d={}\n t=[(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]\n for i in range(n):\n y,x=map(int,input().split())\n for a,b in t:\n a+=y\n b+=x\n if 0<a<=h and 0<b<=w and (a,b) in d: d[(a,b)]+=1\n elif 0<a<=h and 0<b<=w: d[(a,b)]=1\n\n ans=[0]*10\n for i in d:\n if i[0]>2 and i[1]>2:\n ans[d[i]]+=1\n\n ans[0]=h*w-sum(ans)-w*2-h*2+4\n for i in ans:\n print(i)\n\nif __name__==\"__main__\":\n sol()",
"def sol():\n import sys\n input=sys.stdin.readline\n h,w,n=map(int,input().split())\n d={}\n t=[(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]\n for i in range(n):\n y,x=map(int,input().split())\n for a,b in t:\n a+=y\n b+=x\n if 0<a<=h and 0<b<=w and (a,b) in d: d[(a,b)]+=1\n elif 0<a<=h and 0<b<=w: d[(a,b)]=1\n\n ans=[0]*10\n for i in d:\n if i[0]>2 and i[1]>2:\n ans[d[i]]+=1\n\n ans[0]=h*w-sum(ans)-w*2-h*2+4\n for i in ans:\n print(i)",
"sol",
"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={}",
"d",
"{}",
"t=[(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]",
"t",
"[(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",
"for i in range(n):\n y,x=map(int,input().split())\n for a,b in t:\n a+=y\n b+=x\n if 0<a<=h and 0<b<=w and (a,b) in d: d[(a,b)]+=1\n elif 0<a<=h and 0<b<=w: d[(a,b)]=1\n\n ",
"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 a,b in t:\n a+=y\n b+=x\n if 0<a<=h and 0<b<=w and (a,b) in d: d[(a,b)]+=1\n elif 0<a<=h and 0<b<=w: d[(a,b)]=1\n\n ",
"a",
"b",
"t",
"a+=y",
"a",
"y",
"b+=x",
"b",
"x",
"if 0<a<=h and 0<b<=w and (a,b) in d: d[(a,b)]+=1\n elif 0<a<=h and 0<b<=w: d[(a,b)]=1\n\n ",
"0<a<=h and 0<b<=w and (a,b) in d",
"0<a<=h and 0<b<=w",
"0<a<=h",
"0<a",
"0",
"a",
"h",
"0<b<=w",
"0<b",
"0",
"b",
"w",
"(a,b) in d",
"(a,b)",
"a",
"b",
"d",
"elif 0<a<=h and 0<b<=w: d[(a,b)]=1\n\n ",
"0<a<=h and 0<b<=w",
"0<a<=h",
"0<a",
"0",
"a",
"h",
"0<b<=w",
"0<b",
"0",
"b",
"w",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for i in d:\n if i[0]>2 and i[1]>2:\n ans[d[i]]+=1\n\n ",
"i",
"d",
"if i[0]>2 and i[1]>2:\n ans[d[i]]+=1\n\n ",
"i[0]>2 and i[1]>2",
"i[0]>2",
"i[0]",
"i",
"0",
"2",
"i[1]>2",
"i[1]",
"i",
"1",
"2",
"ans[d[i]]+=1",
"ans[d[i]]",
"ans",
"d[i]",
"d",
"i",
"1",
"ans[0]=h*w-sum(ans)-w*2-h*2+4",
"ans[0]",
"ans",
"0",
"h*w-sum(ans)-w*2-h*2+4",
"h*w-sum(ans)-w*2-h*2",
"h*w-sum(ans)-w*2",
"h*w-sum(ans)",
"h*w",
"h",
"w",
"sum(ans)",
"sum",
"ans",
"w*2",
"w",
"2",
"h*2",
"h",
"2",
"4",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"if __name__==\"__main__\":\n sol()",
"__name__==\"__main__\"",
"__name__",
"\"__main__\"",
"sol()",
"sol",
"def sol():\n import sys\n input=sys.stdin.readline\n h,w,n=map(int,input().split())\n d={}\n t=[(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]\n for i in range(n):\n y,x=map(int,input().split())\n for a,b in t:\n a+=y\n b+=x\n if 0<a<=h and 0<b<=w and (a,b) in d: d[(a,b)]+=1\n elif 0<a<=h and 0<b<=w: d[(a,b)]=1\n\n ans=[0]*10\n for i in d:\n if i[0]>2 and i[1]>2:\n ans[d[i]]+=1\n\n ans[0]=h*w-sum(ans)-w*2-h*2+4\n for i in ans:\n print(i)",
"def sol():\n import sys\n input=sys.stdin.readline\n h,w,n=map(int,input().split())\n d={}\n t=[(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]\n for i in range(n):\n y,x=map(int,input().split())\n for a,b in t:\n a+=y\n b+=x\n if 0<a<=h and 0<b<=w and (a,b) in d: d[(a,b)]+=1\n elif 0<a<=h and 0<b<=w: d[(a,b)]=1\n\n ans=[0]*10\n for i in d:\n if i[0]>2 and i[1]>2:\n ans[d[i]]+=1\n\n ans[0]=h*w-sum(ans)-w*2-h*2+4\n for i in ans:\n print(i)",
"sol"
] | def sol():
import sys
input=sys.stdin.readline
h,w,n=map(int,input().split())
d={}
t=[(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]
for i in range(n):
y,x=map(int,input().split())
for a,b in t:
a+=y
b+=x
if 0<a<=h and 0<b<=w and (a,b) in d: d[(a,b)]+=1
elif 0<a<=h and 0<b<=w: d[(a,b)]=1
ans=[0]*10
for i in d:
if i[0]>2 and i[1]>2:
ans[d[i]]+=1
ans[0]=h*w-sum(ans)-w*2-h*2+4
for i in ans:
print(i)
if __name__=="__main__":
sol() |
[
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,
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,
39,
13,
13,
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,
18,
13,
39,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
142,
3
],
[
142,
12
],
[
142,
13
],
[
148,
15
],
[
21,
20
],
[
134,
23
],
[
145,
25
],
[
145,
34
],
[
37,
36
],
[
146,
43
],
[
137,
49
],
[
146,
51
],
[
55,
54
],
[
131,
61
],
[
143,
67
],
[
131,
69
],
[
139,
72
],
[
80,
77
],
[
149,
78
],
[
140,
79
],
[
127,
82
],
[
89,
88
],
[
149,
91
],
[
97,
94
],
[
128,
95
],
[
88,
96
],
[
102,
99
],
[
128,
100
],
[
137,
105
],
[
143,
108
],
[
128,
113
],
[
118,
117
],
[
128,
124
],
[
117,
125
],
[
127,
128
],
[
145,
131
],
[
142,
134
],
[
142,
137
],
[
139,
140
],
[
142,
143
],
[
145,
146
],
[
148,
149
]
] | [
"from collections import defaultdict\n\nh, w, n = map(int, input().split())\nd = defaultdict(int)\nfor i in range(n):\n a, b = map(int, input().split())\n for k in range(max(1, a - 2), min(h - 2, a) + 1):\n for l in range(max(1, b - 2), min(w - 2, b) + 1):\n x = (k, l)\n d[x] += 1\nans = [0] * 10\nfor v in d.values():\n ans[v] += 1\nans[0] = (h - 2) * (w - 2) - sum(ans[1:])\nfor i in range(10):\n 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",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(n):\n a, b = map(int, input().split())\n for k in range(max(1, a - 2), min(h - 2, a) + 1):\n for l in range(max(1, b - 2), min(w - 2, b) + 1):\n x = (k, l)\n d[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 k in range(max(1, a - 2), min(h - 2, a) + 1):\n for l in range(max(1, b - 2), min(w - 2, b) + 1):\n x = (k, l)\n d[x] += 1",
"k",
"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 l in range(max(1, b - 2), min(w - 2, b) + 1):\n x = (k, l)\n d[x] += 1",
"l",
"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",
"x = (k, l)",
"x",
"(k, l)",
"k",
"l",
"d[x] += 1",
"d[x]",
"d",
"x",
"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",
"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",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"x = (k, l)",
"(k, l)",
"x",
"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"
] | from collections import defaultdict
h, w, n = map(int, input().split())
d = defaultdict(int)
for i in range(n):
a, b = map(int, input().split())
for k in range(max(1, a - 2), min(h - 2, a) + 1):
for l in range(max(1, b - 2), min(w - 2, b) + 1):
x = (k, l)
d[x] += 1
ans = [0] * 10
for v in d.values():
ans[v] += 1
ans[0] = (h - 2) * (w - 2) - sum(ans[1:])
for i in range(10):
print(ans[i])
|
[
7,
15,
13,
15,
15,
12,
13,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
0,
13,
4,
13,
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,
4,
18,
18,
13,
2,
13,
17,
13,
2,
13,
17,
28,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
4,
13,
28,
13,
4,
13,
17,
28,
13,
13,
13,
0,
13,
2,
13,
2,
13,
17,
13,
2,
13,
2,
13,
17,
14,
2,
39,
13,
13,
13,
14,
2,
2,
13,
17,
2,
13,
17,
14,
2,
2,
13,
2,
13,
17,
2,
13,
2,
13,
17,
0,
13,
17,
0,
13,
4,
13,
18,
13,
13,
13,
0,
13,
4,
13,
18,
13,
13,
2,
13,
17,
0,
13,
2,
13,
13,
0,
13,
4,
13,
18,
13,
2,
13,
17,
13,
0,
13,
4,
13,
18,
13,
2,
13,
17,
2,
13,
17,
0,
13,
2,
13,
13,
0,
13,
4,
13,
18,
13,
2,
13,
17,
13,
0,
13,
4,
13,
18,
13,
2,
13,
17,
2,
13,
17,
0,
13,
2,
13,
13,
0,
18,
13,
13,
17,
4,
18,
13,
13,
39,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
28,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13
] | [
[
11,
10
],
[
252,
17
],
[
11,
19
],
[
11,
20
],
[
23,
22
],
[
26,
25
],
[
31,
30
],
[
20,
33
],
[
36,
35
],
[
252,
42
],
[
36,
44
],
[
22,
47
],
[
35,
51
],
[
44,
54
],
[
25,
59
],
[
35,
61
],
[
44,
65
],
[
69,
68
],
[
25,
68
],
[
72,
71
],
[
78,
77
],
[
82,
81
],
[
91,
90
],
[
35,
92
],
[
81,
94
],
[
97,
96
],
[
44,
98
],
[
81,
100
],
[
77,
107
],
[
90,
111
],
[
96,
114
],
[
90,
119
],
[
10,
121
],
[
96,
124
],
[
19,
126
],
[
130,
129
],
[
133,
132
],
[
25,
136
],
[
90,
137
],
[
96,
138
],
[
141,
140
],
[
25,
144
],
[
90,
145
],
[
96,
147
],
[
151,
150
],
[
140,
152
],
[
192,
152
],
[
165,
152
],
[
132,
153
],
[
182,
153
],
[
155,
153
],
[
156,
155
],
[
25,
159
],
[
90,
161
],
[
96,
163
],
[
166,
165
],
[
25,
169
],
[
90,
171
],
[
96,
174
],
[
178,
177
],
[
165,
179
],
[
140,
179
],
[
192,
179
],
[
155,
180
],
[
132,
180
],
[
182,
180
],
[
183,
182
],
[
25,
186
],
[
90,
188
],
[
96,
190
],
[
193,
192
],
[
25,
196
],
[
90,
198
],
[
96,
201
],
[
205,
204
],
[
192,
206
],
[
165,
206
],
[
140,
206
],
[
182,
207
],
[
155,
207
],
[
132,
207
],
[
212,
209
],
[
71,
210
],
[
204,
211
],
[
177,
211
],
[
150,
211
],
[
129,
211
],
[
77,
215
],
[
224,
221
],
[
71,
222
],
[
10,
227
],
[
19,
230
],
[
71,
235
],
[
240,
239
],
[
71,
239
],
[
249,
246
]
] | [
"import sys\nfrom bisect import bisect_left\nfrom collections import defaultdict\ndef input(): return sys.stdin.readline().strip()\n\ndef main():\n H, W, N = map(int, input().split())\n black = []\n d = defaultdict(list)\n for _ in range(N):\n a, b = map(int, input().split())\n black.append((a - 1, b - 1))\n d[a - 1].append(b - 1)\n for key in d: d[key].sort()\n\n ans = [0] * 10\n checked = set()\n # (a, b)がテンプレートのどこにいるかで9通り試す\n for i in range(9):\n for a, b in black:\n h, w = a - i // 3, b - i % 3\n if (h, w) in checked: continue\n if h < 0 or w < 0: continue\n if h > H - 3 or w > W - 3: continue\n cnt = 0\n idx1 = bisect_left(d[h], w)\n idx2 = bisect_left(d[h], w + 3)\n cnt += idx2 - idx1\n idx1 = bisect_left(d[h + 1], w)\n idx2 = bisect_left(d[h + 1], w + 3)\n cnt += idx2 - idx1\n idx1 = bisect_left(d[h + 2], w)\n idx2 = bisect_left(d[h + 2], w + 3)\n cnt += idx2 - idx1\n #print(\"({}, {})=>{}\".format(h, w, cnt))\n ans[cnt] += 1\n checked.add((h, w))\n ans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n for a in ans: print(a)\n\n\n\n\nif __name__ == \"__main__\":\n main()",
"import sys",
"sys",
"from bisect import bisect_left",
"from collections import defaultdict",
"def input(): return sys.stdin.readline().strip()",
"input",
"def main():\n H, W, N = map(int, input().split())\n black = []\n d = defaultdict(list)\n for _ in range(N):\n a, b = map(int, input().split())\n black.append((a - 1, b - 1))\n d[a - 1].append(b - 1)\n for key in d: d[key].sort()\n\n ans = [0] * 10\n checked = set()\n # (a, b)がテンプレートのどこにいるかで9通り試す\n for i in range(9):\n for a, b in black:\n h, w = a - i // 3, b - i % 3\n if (h, w) in checked: continue\n if h < 0 or w < 0: continue\n if h > H - 3 or w > W - 3: continue\n cnt = 0\n idx1 = bisect_left(d[h], w)\n idx2 = bisect_left(d[h], w + 3)\n cnt += idx2 - idx1\n idx1 = bisect_left(d[h + 1], w)\n idx2 = bisect_left(d[h + 1], w + 3)\n cnt += idx2 - idx1\n idx1 = bisect_left(d[h + 2], w)\n idx2 = bisect_left(d[h + 2], w + 3)\n cnt += idx2 - idx1\n #print(\"({}, {})=>{}\".format(h, w, cnt))\n ans[cnt] += 1\n checked.add((h, w))\n ans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n for a in ans: print(a)",
"main",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"black = []",
"black",
"[]",
"d = defaultdict(list)",
"d",
"defaultdict(list)",
"defaultdict",
"list",
"for _ in range(N):\n a, b = map(int, input().split())\n black.append((a - 1, b - 1))\n d[a - 1].append(b - 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",
"black.append((a - 1, b - 1))",
"black.append",
"black",
"append",
"(a - 1, b - 1)",
"a - 1",
"a",
"1",
"b - 1",
"b",
"1",
"d[a - 1].append(b - 1)",
"[a - 1].append",
"[a - 1]",
"d",
"a - 1",
"a",
"1",
"append",
"b - 1",
"b",
"1",
"for key in d: d[key].sort()\n\n ",
"key",
"d",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"checked = set()",
"checked",
"set()",
"set",
"for i in range(9):\n for a, b in black:\n h, w = a - i // 3, b - i % 3\n if (h, w) in checked: continue\n if h < 0 or w < 0: continue\n if h > H - 3 or w > W - 3: continue\n cnt = 0\n idx1 = bisect_left(d[h], w)\n idx2 = bisect_left(d[h], w + 3)\n cnt += idx2 - idx1\n idx1 = bisect_left(d[h + 1], w)\n idx2 = bisect_left(d[h + 1], w + 3)\n cnt += idx2 - idx1\n idx1 = bisect_left(d[h + 2], w)\n idx2 = bisect_left(d[h + 2], w + 3)\n cnt += idx2 - idx1\n #print(\"({}, {})=>{}\".format(h, w, cnt))\n ans[cnt] += 1\n checked.add((h, w))\n ",
"i",
"range(9)",
"range",
"9",
"for a, b in black:\n h, w = a - i // 3, b - i % 3\n if (h, w) in checked: continue\n if h < 0 or w < 0: continue\n if h > H - 3 or w > W - 3: continue\n cnt = 0\n idx1 = bisect_left(d[h], w)\n idx2 = bisect_left(d[h], w + 3)\n cnt += idx2 - idx1\n idx1 = bisect_left(d[h + 1], w)\n idx2 = bisect_left(d[h + 1], w + 3)\n cnt += idx2 - idx1\n idx1 = bisect_left(d[h + 2], w)\n idx2 = bisect_left(d[h + 2], w + 3)\n cnt += idx2 - idx1\n #print(\"({}, {})=>{}\".format(h, w, cnt))\n ans[cnt] += 1\n checked.add((h, w))\n ",
"a",
"b",
"black",
"h, w = a - i // 3, b - i % 3",
"h",
"a - i // 3",
"a",
"i // 3",
"i",
"3",
"w",
"b - i % 3",
"b",
"i % 3",
"i",
"3",
"if (h, w) in checked: continue\n ",
"(h, w) in checked",
"(h, w)",
"h",
"w",
"checked",
"if h < 0 or w < 0: continue\n ",
"h < 0 or w < 0",
"h < 0",
"h",
"0",
"w < 0",
"w",
"0",
"if h > H - 3 or w > W - 3: continue\n ",
"h > H - 3 or w > W - 3",
"h > H - 3",
"h",
"H - 3",
"H",
"3",
"w > W - 3",
"w",
"W - 3",
"W",
"3",
"cnt = 0",
"cnt",
"0",
"idx1 = bisect_left(d[h], w)",
"idx1",
"bisect_left(d[h], w)",
"bisect_left",
"d[h]",
"d",
"h",
"w",
"idx2 = bisect_left(d[h], w + 3)",
"idx2",
"bisect_left(d[h], w + 3)",
"bisect_left",
"d[h]",
"d",
"h",
"w + 3",
"w",
"3",
"cnt += idx2 - idx1",
"cnt",
"idx2 - idx1",
"idx2",
"idx1",
"idx1 = bisect_left(d[h + 1], w)",
"idx1",
"bisect_left(d[h + 1], w)",
"bisect_left",
"d[h + 1]",
"d",
"h + 1",
"h",
"1",
"w",
"idx2 = bisect_left(d[h + 1], w + 3)",
"idx2",
"bisect_left(d[h + 1], w + 3)",
"bisect_left",
"d[h + 1]",
"d",
"h + 1",
"h",
"1",
"w + 3",
"w",
"3",
"cnt += idx2 - idx1",
"cnt",
"idx2 - idx1",
"idx2",
"idx1",
"idx1 = bisect_left(d[h + 2], w)",
"idx1",
"bisect_left(d[h + 2], w)",
"bisect_left",
"d[h + 2]",
"d",
"h + 2",
"h",
"2",
"w",
"idx2 = bisect_left(d[h + 2], w + 3)",
"idx2",
"bisect_left(d[h + 2], w + 3)",
"bisect_left",
"d[h + 2]",
"d",
"h + 2",
"h",
"2",
"w + 3",
"w",
"3",
"cnt += idx2 - idx1",
"cnt",
"idx2 - idx1",
"idx2",
"idx1",
"ans[cnt] += 1",
"ans[cnt]",
"ans",
"cnt",
"1",
"checked.add((h, w))",
"checked.add",
"checked",
"add",
"(h, w)",
"h",
"w",
"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: prin",
"a",
"ans",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n H, W, N = map(int, input().split())\n black = []\n d = defaultdict(list)\n for _ in range(N):\n a, b = map(int, input().split())\n black.append((a - 1, b - 1))\n d[a - 1].append(b - 1)\n for key in d: d[key].sort()\n\n ans = [0] * 10\n checked = set()\n # (a, b)がテンプレートのどこにいるかで9通り試す\n for i in range(9):\n for a, b in black:\n h, w = a - i // 3, b - i % 3\n if (h, w) in checked: continue\n if h < 0 or w < 0: continue\n if h > H - 3 or w > W - 3: continue\n cnt = 0\n idx1 = bisect_left(d[h], w)\n idx2 = bisect_left(d[h], w + 3)\n cnt += idx2 - idx1\n idx1 = bisect_left(d[h + 1], w)\n idx2 = bisect_left(d[h + 1], w + 3)\n cnt += idx2 - idx1\n idx1 = bisect_left(d[h + 2], w)\n idx2 = bisect_left(d[h + 2], w + 3)\n cnt += idx2 - idx1\n #print(\"({}, {})=>{}\".format(h, w, cnt))\n ans[cnt] += 1\n checked.add((h, w))\n ans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n for a in ans: print(a)",
"def main():\n H, W, N = map(int, input().split())\n black = []\n d = defaultdict(list)\n for _ in range(N):\n a, b = map(int, input().split())\n black.append((a - 1, b - 1))\n d[a - 1].append(b - 1)\n for key in d: d[key].sort()\n\n ans = [0] * 10\n checked = set()\n # (a, b)がテンプレートのどこにいるかで9通り試す\n for i in range(9):\n for a, b in black:\n h, w = a - i // 3, b - i % 3\n if (h, w) in checked: continue\n if h < 0 or w < 0: continue\n if h > H - 3 or w > W - 3: continue\n cnt = 0\n idx1 = bisect_left(d[h], w)\n idx2 = bisect_left(d[h], w + 3)\n cnt += idx2 - idx1\n idx1 = bisect_left(d[h + 1], w)\n idx2 = bisect_left(d[h + 1], w + 3)\n cnt += idx2 - idx1\n idx1 = bisect_left(d[h + 2], w)\n idx2 = bisect_left(d[h + 2], w + 3)\n cnt += idx2 - idx1\n #print(\"({}, {})=>{}\".format(h, w, cnt))\n ans[cnt] += 1\n checked.add((h, w))\n ans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n for a in ans: print(a)",
"main",
"def input(): return sys.stdin.readline().strip()",
"def input(): return sys.stdin.readline().strip()",
"input"
] | import sys
from bisect import bisect_left
from collections import defaultdict
def input(): return sys.stdin.readline().strip()
def main():
H, W, N = map(int, input().split())
black = []
d = defaultdict(list)
for _ in range(N):
a, b = map(int, input().split())
black.append((a - 1, b - 1))
d[a - 1].append(b - 1)
for key in d: d[key].sort()
ans = [0] * 10
checked = set()
# (a, b)がテンプレートのどこにいるかで9通り試す
for i in range(9):
for a, b in black:
h, w = a - i // 3, b - i % 3
if (h, w) in checked: continue
if h < 0 or w < 0: continue
if h > H - 3 or w > W - 3: continue
cnt = 0
idx1 = bisect_left(d[h], w)
idx2 = bisect_left(d[h], w + 3)
cnt += idx2 - idx1
idx1 = bisect_left(d[h + 1], w)
idx2 = bisect_left(d[h + 1], w + 3)
cnt += idx2 - idx1
idx1 = bisect_left(d[h + 2], w)
idx2 = bisect_left(d[h + 2], w + 3)
cnt += idx2 - idx1
#print("({}, {})=>{}".format(h, w, cnt))
ans[cnt] += 1
checked.add((h, w))
ans[0] = (H - 2) * (W - 2) - sum(ans[1:])
for a in ans: print(a)
if __name__ == "__main__":
main()
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
0,
13,
39,
41,
28,
13,
4,
13,
17,
4,
17,
0,
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,
40,
40,
17,
2,
13,
13,
2,
13,
17,
40,
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,
4,
13,
4,
18,
13,
13,
0,
13,
4,
13,
13,
28,
13,
13,
4,
18,
13,
13,
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,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13
] | [
[
166,
3
],
[
166,
12
],
[
166,
13
],
[
169,
15
],
[
145,
18
],
[
23,
22
],
[
163,
29
],
[
33,
32
],
[
161,
35
],
[
154,
37
],
[
154,
46
],
[
49,
48
],
[
55,
54
],
[
155,
65
],
[
48,
66
],
[
167,
68
],
[
152,
74
],
[
54,
75
],
[
143,
77
],
[
146,
81
],
[
155,
85
],
[
48,
86
],
[
152,
88
],
[
54,
89
],
[
172,
91
],
[
146,
94
],
[
148,
96
],
[
173,
101
],
[
157,
104
],
[
149,
107
],
[
158,
113
],
[
119,
116
],
[
164,
117
],
[
124,
121
],
[
164,
122
],
[
167,
127
],
[
143,
130
],
[
164,
134
],
[
137,
136
],
[
164,
136
],
[
136,
140
],
[
166,
143
],
[
145,
146
],
[
148,
149
],
[
154,
152
],
[
154,
155
],
[
157,
158
],
[
166,
161
],
[
163,
164
],
[
166,
167
],
[
169,
170
],
[
172,
173
]
] | [
"from collections import Counter\nH,W,N = map(int,input().split())\nab = []\ncorner = []\ncountlist = [0 for i in range(10)]\nfor i in range(N):\n a,b = map(int,input().split())\n for h in range(-2,1):\n for w in range(-2,1):\n if 1 <= a+h <= H-2 and 1 <= b+w <= W-2:\n corner.append((a+h,b+w))\ncc = Counter(corner)\nclist = list(cc.values())\nclistc = Counter(clist)\nfor k,v in clistc.items():\n countlist[k] += v\ncountlist[0] = (H-2)*(W-2) - sum(countlist)\nfor i in countlist:\n print(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",
"ab = []",
"ab",
"[]",
"corner = []",
"corner",
"[]",
"0 for i in range(10)",
"for i in range(10)",
"i",
"range(10)",
"range",
"10",
"for i in range(10)",
"0",
"countlist = [0 for i in range(10)]",
"countlist",
"[0 for i in range(10)]",
"for i in range(N):\n a,b = map(int,input().split())\n for h in range(-2,1):\n for w in range(-2,1):\n if 1 <= a+h <= H-2 and 1 <= b+w <= W-2:\n corner.append((a+h,b+w))",
"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 h in range(-2,1):\n for w in range(-2,1):\n if 1 <= a+h <= H-2 and 1 <= b+w <= W-2:\n corner.append((a+h,b+w))",
"h",
"range(-2,1)",
"range",
"-2",
"1",
"for w in range(-2,1):\n if 1 <= a+h <= H-2 and 1 <= b+w <= W-2:\n corner.append((a+h,b+w))",
"w",
"range(-2,1)",
"range",
"-2",
"1",
"if 1 <= a+h <= H-2 and 1 <= b+w <= W-2:\n corner.append((a+h,b+w))",
"1 <= a+h <= H-2 and 1 <= b+w <= W-2",
"1 <= a+h <= H-2",
"1 <= a+h",
"1",
"a+h",
"a",
"h",
"H-2",
"H",
"2",
"1 <= b+w <= W-2",
"1 <= b+w",
"1",
"b+w",
"b",
"w",
"W-2",
"W",
"2",
"corner.append((a+h,b+w))",
"corner.append",
"corner",
"append",
"(a+h,b+w)",
"a+h",
"a",
"h",
"b+w",
"b",
"w",
"cc = Counter(corner)",
"cc",
"Counter(corner)",
"Counter",
"corner",
"clist = list(cc.values())",
"clist",
"list(cc.values())",
"list",
"cc.values()",
"cc.values",
"cc",
"values",
"clistc = Counter(clist)",
"clistc",
"Counter(clist)",
"Counter",
"clist",
"for k,v in clistc.items():\n countlist[k] += v",
"k",
"v",
"clistc.items()",
"clistc.items",
"clistc",
"items",
"countlist[k] += v",
"countlist[k]",
"countlist",
"k",
"v",
"countlist[0] = (H-2)*(W-2) - sum(countlist)",
"countlist[0]",
"countlist",
"0",
"(H-2)*(W-2) - sum(countlist)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(countlist)",
"sum",
"countlist",
"for i in countlist:\n print(i)",
"i",
"countlist",
"print(i)",
"print",
"i",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"corner = []",
"[]",
"corner",
"clist = list(cc.values())",
"list(cc.values())",
"clist",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"clistc = Counter(clist)",
"Counter(clist)",
"clistc",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"countlist = [0 for i in range(10)]",
"[0 for i in range(10)]",
"countlist",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"ab = []",
"[]",
"ab",
"cc = Counter(corner)",
"Counter(corner)",
"cc"
] | from collections import Counter
H,W,N = map(int,input().split())
ab = []
corner = []
countlist = [0 for i in range(10)]
for i in range(N):
a,b = map(int,input().split())
for h in range(-2,1):
for w in range(-2,1):
if 1 <= a+h <= H-2 and 1 <= b+w <= W-2:
corner.append((a+h,b+w))
cc = Counter(corner)
clist = list(cc.values())
clistc = Counter(clist)
for k,v in clistc.items():
countlist[k] += v
countlist[0] = (H-2)*(W-2) - sum(countlist)
for i in countlist:
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,
0,
13,
17,
28,
13,
4,
13,
13,
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,
14,
2,
40,
40,
40,
17,
2,
18,
18,
13,
13,
17,
13,
2,
13,
17,
40,
40,
40,
17,
2,
18,
18,
13,
13,
17,
13,
2,
13,
17,
9,
14,
40,
2,
2,
18,
18,
13,
13,
17,
13,
13,
0,
18,
13,
2,
18,
18,
13,
13,
17,
13,
17,
14,
40,
2,
2,
18,
18,
13,
13,
17,
13,
18,
13,
2,
18,
18,
13,
13,
17,
13,
0,
18,
18,
13,
2,
18,
18,
13,
13,
17,
13,
2,
18,
18,
13,
13,
17,
13,
17,
0,
18,
18,
13,
2,
18,
18,
13,
13,
17,
13,
2,
18,
18,
13,
13,
17,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
28,
13,
4,
18,
18,
13,
13,
13,
0,
18,
13,
13,
17,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
4,
13,
17,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13
] | [
[
244,
2
],
[
244,
11
],
[
244,
12
],
[
16,
15
],
[
236,
18
],
[
238,
31
],
[
241,
34
],
[
38,
37
],
[
236,
40
],
[
239,
81
],
[
37,
82
],
[
245,
86
],
[
239,
95
],
[
37,
96
],
[
230,
100
],
[
239,
109
],
[
37,
110
],
[
242,
113
],
[
124,
115
],
[
242,
116
],
[
239,
120
],
[
37,
121
],
[
239,
131
],
[
37,
132
],
[
242,
136
],
[
239,
140
],
[
37,
141
],
[
162,
145
],
[
242,
147
],
[
239,
151
],
[
37,
152
],
[
239,
158
],
[
37,
159
],
[
181,
164
],
[
242,
166
],
[
239,
170
],
[
37,
171
],
[
239,
177
],
[
37,
178
],
[
232,
183
],
[
190,
189
],
[
242,
189
],
[
193,
192
],
[
242,
196
],
[
189,
197
],
[
203,
200
],
[
233,
201
],
[
192,
202
],
[
245,
209
],
[
230,
212
],
[
233,
216
],
[
219,
218
],
[
233,
226
],
[
218,
227
],
[
244,
230
],
[
232,
233
],
[
244,
236
],
[
238,
239
],
[
241,
242
],
[
244,
245
]
] | [
"h,w,n = map(int,input().split())\ncoord = [list(map(int,input().split())) for i in range(n)]\n\nnum = {}\n\nfor i in range(n):\n for j,k in [[0,0],[0,1],[0,-1],[1,0],[1,1],[1,-1],[-1,0],[-1,1],[-1,-1]]:\n if not(2<=coord[i][0]+j<=h-1) or not(2<=coord[i][1]+k<=w-1):\n continue\n if not coord[i][0]+j in num:\n num[coord[i][0]+j] = {}\n if not coord[i][1]+k in num[coord[i][0]+j]:\n num[coord[i][0]+j][coord[i][1]+k] = 1\n else:\n num[coord[i][0]+j][coord[i][1]+k] += 1\n\nans = [0]*10\nfor i in num:\n for value in num[i].values():\n ans[value] +=1\n\nprint((h-2)*(w-2)-sum(ans))\nfor i in range(1,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 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",
"coord = [list(map(int,input().split())) for i in range(n)]",
"coord",
"[list(map(int,input().split())) for i in range(n)]",
"num = {}",
"num",
"{}",
"for i in range(n):\n for j,k in [[0,0],[0,1],[0,-1],[1,0],[1,1],[1,-1],[-1,0],[-1,1],[-1,-1]]:\n if not(2<=coord[i][0]+j<=h-1) or not(2<=coord[i][1]+k<=w-1):\n continue\n if not coord[i][0]+j in num:\n num[coord[i][0]+j] = {}\n if not coord[i][1]+k in num[coord[i][0]+j]:\n num[coord[i][0]+j][coord[i][1]+k] = 1\n else:\n num[coord[i][0]+j][coord[i][1]+k] += 1",
"i",
"range(n)",
"range",
"n",
"for j,k in [[0,0],[0,1],[0,-1],[1,0],[1,1],[1,-1],[-1,0],[-1,1],[-1,-1]]:\n if not(2<=coord[i][0]+j<=h-1) or not(2<=coord[i][1]+k<=w-1):\n continue\n if not coord[i][0]+j in num:\n num[coord[i][0]+j] = {}\n if not coord[i][1]+k in num[coord[i][0]+j]:\n num[coord[i][0]+j][coord[i][1]+k] = 1\n else:\n num[coord[i][0]+j][coord[i][1]+k] += 1",
"j",
"k",
"[[0,0],[0,1],[0,-1],[1,0],[1,1],[1,-1],[-1,0],[-1,1],[-1,-1]]",
"[0,0]",
"0",
"0",
"[0,1]",
"0",
"1",
"[0,-1]",
"0",
"-1",
"[1,0]",
"1",
"0",
"[1,1]",
"1",
"1",
"[1,-1]",
"1",
"-1",
"[-1,0]",
"-1",
"0",
"[-1,1]",
"-1",
"1",
"[-1,-1]",
"-1",
"-1",
"if not(2<=coord[i][0]+j<=h-1) or not(2<=coord[i][1]+k<=w-1):\n continue\n ",
"not(2<=coord[i][0]+j<=h-1) or not(2<=coord[i][1]+k<=w-1)",
"not(2<=coord[i][0]+j<=h-1)",
"2<=coord[i][0]+j<=h-1",
"2<=coord[i][0]+j",
"2",
"coord[i][0]+j",
"coord[i][0]",
"[i]",
"coord",
"i",
"0",
"j",
"h-1",
"h",
"1",
"not(2<=coord[i][1]+k<=w-1)",
"2<=coord[i][1]+k<=w-1",
"2<=coord[i][1]+k",
"2",
"coord[i][1]+k",
"coord[i][1]",
"[i]",
"coord",
"i",
"1",
"k",
"w-1",
"w",
"1",
"continue",
"if not coord[i][0]+j in num:\n num[coord[i][0]+j] = {}\n ",
"not coord[i][0]+j in num",
"coord[i][0]+j in num",
"coord[i][0]+j",
"coord[i][0]",
"[i]",
"coord",
"i",
"0",
"j",
"num",
"num[coord[i][0]+j] = {}",
"num[coord[i][0]+j]",
"num",
"coord[i][0]+j",
"coord[i][0]",
"[i]",
"coord",
"i",
"0",
"j",
"{}",
"if not coord[i][1]+k in num[coord[i][0]+j]:\n num[coord[i][0]+j][coord[i][1]+k] = 1\n else:\n num[coord[i][0]+j][coord[i][1]+k] += 1",
"not coord[i][1]+k in num[coord[i][0]+j]",
"coord[i][1]+k in num[coord[i][0]+j]",
"coord[i][1]+k",
"coord[i][1]",
"[i]",
"coord",
"i",
"1",
"k",
"num[coord[i][0]+j]",
"num",
"coord[i][0]+j",
"coord[i][0]",
"[i]",
"coord",
"i",
"0",
"j",
"num[coord[i][0]+j][coord[i][1]+k] = 1",
"num[coord[i][0]+j][coord[i][1]+k]",
"[coord[i][0]+j]",
"num",
"coord[i][0]+j",
"coord[i][0]",
"[i]",
"coord",
"i",
"0",
"j",
"coord[i][1]+k",
"coord[i][1]",
"[i]",
"coord",
"i",
"1",
"k",
"1",
"num[coord[i][0]+j][coord[i][1]+k] += 1",
"num[coord[i][0]+j][coord[i][1]+k]",
"[coord[i][0]+j]",
"num",
"coord[i][0]+j",
"coord[i][0]",
"[i]",
"coord",
"i",
"0",
"j",
"coord[i][1]+k",
"coord[i][1]",
"[i]",
"coord",
"i",
"1",
"k",
"1",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for i in num:\n for value in num[i].values():\n ans[value] +=1",
"i",
"num",
"for value in num[i].values():\n ans[value] +=1",
"value",
"num[i].values()",
"[i].values",
"[i]",
"num",
"i",
"values",
"ans[value] +=1",
"ans[value]",
"ans",
"value",
"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 range(1,10):\n print(ans[i])",
"i",
"range(1,10)",
"range",
"1",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"w,n = map(int,input().split())",
"map(int,input().split())",
"w",
"ans = [0]*10",
"[0]*10",
"ans",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"coord = [list(map(int,input().split())) for i in range(n)]",
"[list(map(int,input().split())) for i in range(n)]",
"coord",
"num = {}",
"{}",
"num",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h"
] | h,w,n = map(int,input().split())
coord = [list(map(int,input().split())) for i in range(n)]
num = {}
for i in range(n):
for j,k in [[0,0],[0,1],[0,-1],[1,0],[1,1],[1,-1],[-1,0],[-1,1],[-1,-1]]:
if not(2<=coord[i][0]+j<=h-1) or not(2<=coord[i][1]+k<=w-1):
continue
if not coord[i][0]+j in num:
num[coord[i][0]+j] = {}
if not coord[i][1]+k in num[coord[i][0]+j]:
num[coord[i][0]+j][coord[i][1]+k] = 1
else:
num[coord[i][0]+j][coord[i][1]+k] += 1
ans = [0]*10
for i in num:
for value in num[i].values():
ans[value] +=1
print((h-2)*(w-2)-sum(ans))
for i in range(1,10):
print(ans[i]) |
[
7,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
13,
0,
13,
4,
13,
28,
13,
4,
13,
13,
4,
18,
13,
13,
4,
13,
4,
13,
13,
0,
13,
4,
13,
28,
13,
13,
13,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
14,
2,
2,
2,
40,
17,
2,
13,
13,
40,
2,
13,
13,
13,
40,
17,
2,
13,
13,
40,
2,
13,
13,
13,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
0,
13,
2,
39,
17,
17,
28,
13,
13,
13,
0,
13,
17,
14,
2,
2,
2,
2,
13,
17,
2,
13,
13,
2,
13,
17,
2,
13,
13,
9,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
14,
2,
39,
2,
13,
13,
2,
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,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
17,
13,
10,
2,
13,
10,
13,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13
] | [
[
4,
3
],
[
3,
12
],
[
195,
14
],
[
195,
16
],
[
195,
17
],
[
198,
19
],
[
24,
23
],
[
196,
26
],
[
199,
29
],
[
192,
37
],
[
46,
45
],
[
52,
51
],
[
45,
64
],
[
45,
68
],
[
184,
69
],
[
51,
74
],
[
51,
78
],
[
187,
79
],
[
193,
82
],
[
45,
87
],
[
51,
90
],
[
180,
92
],
[
177,
102
],
[
184,
113
],
[
187,
119
],
[
123,
122
],
[
129,
128
],
[
122,
138
],
[
128,
141
],
[
199,
142
],
[
189,
144
],
[
150,
147
],
[
181,
148
],
[
190,
149
],
[
178,
149
],
[
155,
152
],
[
181,
153
],
[
184,
158
],
[
187,
161
],
[
181,
165
],
[
168,
167
],
[
181,
174
],
[
167,
175
],
[
177,
178
],
[
180,
181
],
[
195,
184
],
[
195,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
]
] | [
"H,W,N = [ int(it) for it in input().split() ]\n\ndi = set()\n\nfor i in range(N):\n di.add( tuple( int(it) for it in input().split() ) )\n\npo = set()\nfor a,b in di:\n for da in [-1,0,1]:\n for db in [-1,0,1]:\n if (1<=a+da and a+da<=H and 1<=b+db and b+db<=W):\n po.add( (a+da,b+db) )\n\nli = [0]*10\nfor a,b in po:\n k = 0\n if ( a == 1 or a == H or b == 1 or b == W ):\n continue\n for da in [-1,0,1]:\n for db in [-1,0,1]:\n if ( (a+da,b+db) in di ):\n k+=1\n li[k]+=1\nli[0] += (H-2)*(W-2) - sum(li) \n \nfor i in range(10):\n print ( li[i] )",
"int(it) for it in input().split()",
"for it in input().split()",
"it",
"input().split()",
"().split",
"()",
"input",
"split",
"for it in input().split()",
"int(it)",
"int",
"it",
"H,W,N = [ int(it) for it in input().split() ]",
"H",
"[ int(it) for it in input().split() ]",
"W",
"N",
"di = set()",
"di",
"set()",
"set",
"for i in range(N):\n di.add( tuple( int(it) for it in input().split() ) )",
"i",
"range(N)",
"range",
"N",
"di.add( tuple( int(it) for it in input().split() ) )",
"di.add",
"di",
"add",
"tuple( int(it) for it in input().split() )",
"tuple",
"int(it)",
"int",
"it",
"po = set()",
"po",
"set()",
"set",
"for a,b in di:\n for da in [-1,0,1]:\n for db in [-1,0,1]:\n if (1<=a+da and a+da<=H and 1<=b+db and b+db<=W):\n po.add( (a+da,b+db) )",
"a",
"b",
"di",
"for da in [-1,0,1]:\n for db in [-1,0,1]:\n if (1<=a+da and a+da<=H and 1<=b+db and b+db<=W):\n po.add( (a+da,b+db) )",
"da",
"[-1,0,1]",
"-1",
"0",
"1",
"for db in [-1,0,1]:\n if (1<=a+da and a+da<=H and 1<=b+db and b+db<=W):\n po.add( (a+da,b+db) )",
"db",
"[-1,0,1]",
"-1",
"0",
"1",
"if (1<=a+da and a+da<=H and 1<=b+db and b+db<=W):\n po.add( (a+da,b+db) )",
"1<=a+da and a+da<=H and 1<=b+db and b+db<=W",
"1<=a+da and a+da<=H and 1<=b+db",
"1<=a+da and a+da<=H",
"1<=a+da",
"1",
"a+da",
"a",
"da",
"a+da<=H",
"a+da",
"a",
"da",
"H",
"1<=b+db",
"1",
"b+db",
"b",
"db",
"b+db<=W",
"b+db",
"b",
"db",
"W",
"po.add( (a+da,b+db) )",
"po.add",
"po",
"add",
"(a+da,b+db)",
"a+da",
"a",
"da",
"b+db",
"b",
"db",
"li = [0]*10",
"li",
"[0]*10",
"[0]",
"0",
"10",
"for a,b in po:\n k = 0\n if ( a == 1 or a == H or b == 1 or b == W ):\n continue\n for da in [-1,0,1]:\n for db in [-1,0,1]:\n if ( (a+da,b+db) in di ):\n k+=1\n li[k]+=1",
"a",
"b",
"po",
"k = 0",
"k",
"0",
"if ( a == 1 or a == H or b == 1 or b == W ):\n continue\n ",
"a == 1 or a == H or b == 1 or b == W",
"a == 1 or a == H or b == 1",
"a == 1 or a == H",
"a == 1",
"a",
"1",
"a == H",
"a",
"H",
"b == 1",
"b",
"1",
"b == W",
"b",
"W",
"continue",
"for da in [-1,0,1]:\n for db in [-1,0,1]:\n if ( (a+da,b+db) in di ):\n k+=1\n ",
"da",
"[-1,0,1]",
"-1",
"0",
"1",
"for db in [-1,0,1]:\n if ( (a+da,b+db) in di ):\n k+=1\n ",
"db",
"[-1,0,1]",
"-1",
"0",
"1",
"if ( (a+da,b+db) in di ):\n k+=1\n ",
"(a+da,b+db) in di",
"(a+da,b+db)",
"a+da",
"a",
"da",
"b+db",
"b",
"db",
"di",
"k+=1",
"k",
"1",
"li[k]+=1",
"li[k]",
"li",
"k",
"1",
"li[0] += (H-2)*(W-2) - sum(li)",
"li[0]",
"li",
"0",
"(H-2)*(W-2) - sum(li)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(li)",
"sum",
"li",
"for i in range(10):\n print ( li[i] )",
"i",
"range(10)",
"range",
"10",
"print ( li[i] )",
"print",
"li[i]",
"li",
"i",
"k = 0",
"0",
"k",
"li = [0]*10",
"[0]*10",
"li",
"H,W,N = [ int(it) for it in input().split() ]",
"[ int(it) for it in input().split() ]",
"H",
"W,N = [ int(it) for it in input().split() ]",
"[ int(it) for it in input().split() ]",
"W",
"k+=1",
"1",
"k",
"po = set()",
"set()",
"po",
"N = [ int(it) for it in input().split() ]",
"[ int(it) for it in input().split() ]",
"N",
"di = set()",
"set()",
"di"
] | H,W,N = [ int(it) for it in input().split() ]
di = set()
for i in range(N):
di.add( tuple( int(it) for it in input().split() ) )
po = set()
for a,b in di:
for da in [-1,0,1]:
for db in [-1,0,1]:
if (1<=a+da and a+da<=H and 1<=b+db and b+db<=W):
po.add( (a+da,b+db) )
li = [0]*10
for a,b in po:
k = 0
if ( a == 1 or a == H or b == 1 or b == W ):
continue
for da in [-1,0,1]:
for db in [-1,0,1]:
if ( (a+da,b+db) in di ):
k+=1
li[k]+=1
li[0] += (H-2)*(W-2) - sum(li)
for i in range(10):
print ( li[i] ) |
[
7,
15,
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,
40,
40,
17,
13,
13,
40,
40,
17,
13,
13,
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,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13
] | [
[
185,
3
],
[
185,
12
],
[
185,
13
],
[
167,
15
],
[
188,
20
],
[
182,
32
],
[
45,
44
],
[
186,
47
],
[
176,
49
],
[
176,
58
],
[
61,
60
],
[
170,
65
],
[
162,
67
],
[
189,
69
],
[
60,
70
],
[
191,
72
],
[
177,
74
],
[
183,
76
],
[
60,
77
],
[
171,
83
],
[
180,
84
],
[
192,
88
],
[
165,
89
],
[
96,
91
],
[
168,
92
],
[
173,
98
],
[
168,
108
],
[
180,
119
],
[
165,
128
],
[
134,
131
],
[
174,
132
],
[
139,
136
],
[
174,
137
],
[
180,
142
],
[
165,
145
],
[
174,
149
],
[
152,
151
],
[
174,
158
],
[
151,
159
],
[
176,
162
],
[
185,
165
],
[
167,
168
],
[
170,
171
],
[
173,
174
],
[
176,
177
],
[
185,
180
],
[
182,
183
],
[
185,
186
],
[
188,
189
],
[
191,
192
]
] | [
"from collections import defaultdict\n\nH, W, N = map(int,input().split())\nd = defaultdict(int)\nta = [1,1,0,-1,-1,-1,0,1,0]\ntb = [0,1,1,1,0,-1,-1,-1,0]\n\nfor _ in range(N):\n a, b = map(int,input().split())\n for i in range(9):\n na = a + ta[i]\n nb = b + tb[i]\n if 1 <= na <= H and 1 <= nb <= W:\n d[(na, nb)] += 1\n\nans = [0] * 10\n\nfor i, v in d.items():\n if 2 <= i[0] <= H-1 and 2 <= i[1] <= W-1:\n ans[v] += 1\n\nans[0] = (H-2) * (W-2) - sum(ans)\n\nfor i in range(10):\n 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",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"ta = [1,1,0,-1,-1,-1,0,1,0]",
"ta",
"[1,1,0,-1,-1,-1,0,1,0]",
"1",
"1",
"0",
"-1",
"-1",
"-1",
"0",
"1",
"0",
"tb = [0,1,1,1,0,-1,-1,-1,0]",
"tb",
"[0,1,1,1,0,-1,-1,-1,0]",
"0",
"1",
"1",
"1",
"0",
"-1",
"-1",
"-1",
"0",
"for _ in range(N):\n a, b = map(int,input().split())\n for i in range(9):\n na = a + ta[i]\n nb = b + tb[i]\n if 1 <= na <= H and 1 <= nb <= W:\n d[(na, nb)] += 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(9):\n na = a + ta[i]\n nb = b + tb[i]\n if 1 <= na <= H and 1 <= nb <= W:\n d[(na, nb)] += 1",
"i",
"range(9)",
"range",
"9",
"na = a + ta[i]",
"na",
"a + ta[i]",
"a",
"ta[i]",
"ta",
"i",
"nb = b + tb[i]",
"nb",
"b + tb[i]",
"b",
"tb[i]",
"tb",
"i",
"if 1 <= na <= H and 1 <= nb <= W:\n d[(na, nb)] += 1",
"1 <= na <= H and 1 <= nb <= W",
"1 <= na <= H",
"1 <= na",
"1",
"na",
"H",
"1 <= nb <= W",
"1 <= nb",
"1",
"nb",
"W",
"d[(na, nb)] += 1",
"d[(na, nb)]",
"d",
"(na, nb)",
"na",
"nb",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for i, v in d.items():\n if 2 <= i[0] <= H-1 and 2 <= i[1] <= W-1:\n ans[v] += 1",
"i",
"v",
"d.items()",
"d.items",
"d",
"items",
"if 2 <= i[0] <= H-1 and 2 <= i[1] <= W-1:\n ans[v] += 1",
"2 <= i[0] <= H-1 and 2 <= i[1] <= W-1",
"2 <= i[0] <= H-1",
"2 <= i[0]",
"2",
"i[0]",
"i",
"0",
"H-1",
"H",
"1",
"2 <= i[1] <= W-1",
"2 <= i[1]",
"2",
"i[1]",
"i",
"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 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",
"d = defaultdict(int)",
"defaultdict(int)",
"d",
"na = a + ta[i]",
"a + ta[i]",
"na",
"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",
"tb = [0,1,1,1,0,-1,-1,-1,0]",
"[0,1,1,1,0,-1,-1,-1,0]",
"tb",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"ta = [1,1,0,-1,-1,-1,0,1,0]",
"[1,1,0,-1,-1,-1,0,1,0]",
"ta",
"nb = b + tb[i]",
"b + tb[i]",
"nb"
] | from collections import defaultdict
H, W, N = map(int,input().split())
d = defaultdict(int)
ta = [1,1,0,-1,-1,-1,0,1,0]
tb = [0,1,1,1,0,-1,-1,-1,0]
for _ in range(N):
a, b = map(int,input().split())
for i in range(9):
na = a + ta[i]
nb = b + tb[i]
if 1 <= na <= H and 1 <= nb <= W:
d[(na, nb)] += 1
ans = [0] * 10
for i, v in d.items():
if 2 <= i[0] <= H-1 and 2 <= i[1] <= W-1:
ans[v] += 1
ans[0] = (H-2) * (W-2) - sum(ans)
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,
0,
13,
18,
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,
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,
4,
13,
2,
2,
13,
2,
17,
17,
13,
0,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
28,
13,
13,
13,
0,
18,
13,
13,
17,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
18,
13,
39,
17,
4,
13,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13
] | [
[
166,
3
],
[
166,
12
],
[
166,
13
],
[
160,
15
],
[
139,
18
],
[
161,
20
],
[
24,
23
],
[
167,
26
],
[
154,
28
],
[
154,
37
],
[
40,
39
],
[
46,
45
],
[
136,
51
],
[
143,
53
],
[
39,
54
],
[
148,
56
],
[
155,
58
],
[
45,
59
],
[
137,
65
],
[
158,
67
],
[
149,
72
],
[
152,
74
],
[
140,
77
],
[
137,
80
],
[
149,
84
],
[
163,
86
],
[
161,
91
],
[
96,
95
],
[
145,
102
],
[
112,
109
],
[
146,
110
],
[
158,
118
],
[
152,
121
],
[
146,
125
],
[
128,
127
],
[
146,
129
],
[
127,
134
],
[
136,
137
],
[
139,
140
],
[
154,
143
],
[
145,
146
],
[
148,
149
],
[
166,
152
],
[
154,
155
],
[
166,
158
],
[
160,
161
],
[
163,
164
],
[
166,
167
]
] | [
"from collections import Counter\nh,w,n = map(int,input().split())\nneed = []\nappend = need.append\nfor i in range(n):\n a,b = map(int,input().split())\n for x in range(-2,1):\n for y in range(-2,1):\n s = a + x\n t = b + y\n if 1 <= s <= h-2 and 1 <= t <= w-2:\n append(s*10**9 + t)\n\ndata = Counter(need).most_common()\nans = [0 for i in range(10)]\nfor x,y in data:\n ans[y] += 1\n\nprint((h-2)*(w-2)-sum(ans))\nfor i in ans[1:]:\n print(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",
"need = []",
"need",
"[]",
"append = need.append",
"append",
"need.append",
"need",
"append",
"for i in range(n):\n a,b = map(int,input().split())\n for x in range(-2,1):\n for y in range(-2,1):\n s = a + x\n t = b + y\n if 1 <= s <= h-2 and 1 <= t <= w-2:\n append(s*10**9 + 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 x in range(-2,1):\n for y in range(-2,1):\n s = a + x\n t = b + y\n if 1 <= s <= h-2 and 1 <= t <= w-2:\n append(s*10**9 + t)",
"x",
"range(-2,1)",
"range",
"-2",
"1",
"for y in range(-2,1):\n s = a + x\n t = b + y\n if 1 <= s <= h-2 and 1 <= t <= w-2:\n append(s*10**9 + t)",
"y",
"range(-2,1)",
"range",
"-2",
"1",
"s = a + x",
"s",
"a + x",
"a",
"x",
"t = b + y",
"t",
"b + y",
"b",
"y",
"if 1 <= s <= h-2 and 1 <= t <= w-2:\n append(s*10**9 + t)",
"1 <= s <= h-2 and 1 <= t <= w-2",
"1 <= s <= h-2",
"1 <= s",
"1",
"s",
"h-2",
"h",
"2",
"1 <= t <= w-2",
"1 <= t",
"1",
"t",
"w-2",
"w",
"2",
"append(s*10**9 + t)",
"append",
"s*10**9 + t",
"s*10**9",
"s",
"10**9",
"10",
"9",
"t",
"data = Counter(need).most_common()",
"data",
"Counter(need).most_common()",
"(need).most_common",
"(need)",
"Counter",
"need",
"most_common",
"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 x,y in data:\n ans[y] += 1",
"x",
"y",
"data",
"ans[y] += 1",
"ans[y]",
"ans",
"y",
"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[1:]:\n print(i)",
"i",
"ans[1:]",
"ans",
"1:",
"1",
"print(i)",
"print",
"i",
"s = a + x",
"a + x",
"s",
"append = need.append",
"need.append",
"append",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"ans = [0 for i in range(10)]",
"[0 for i in range(10)]",
"ans",
"t = b + y",
"b + y",
"t",
"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())",
"map(int,input().split())",
"h",
"need = []",
"[]",
"need",
"data = Counter(need).most_common()",
"Counter(need).most_common()",
"data",
"n = map(int,input().split())",
"map(int,input().split())",
"n"
] | from collections import Counter
h,w,n = map(int,input().split())
need = []
append = need.append
for i in range(n):
a,b = map(int,input().split())
for x in range(-2,1):
for y in range(-2,1):
s = a + x
t = b + y
if 1 <= s <= h-2 and 1 <= t <= w-2:
append(s*10**9 + t)
data = Counter(need).most_common()
ans = [0 for i in range(10)]
for x,y in data:
ans[y] += 1
print((h-2)*(w-2)-sum(ans))
for i in ans[1:]:
print(i) |
[
7,
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,
4,
18,
13,
13,
39,
2,
13,
17,
2,
13,
17,
0,
13,
17,
28,
13,
13,
13,
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,
14,
2,
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,
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,
18,
13,
39,
17,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
39,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] | [
[
168,
2
],
[
168,
11
],
[
168,
12
],
[
174,
14
],
[
18,
17
],
[
166,
20
],
[
183,
22
],
[
183,
31
],
[
175,
34
],
[
181,
38
],
[
184,
41
],
[
177,
44
],
[
52,
51
],
[
57,
56
],
[
181,
66
],
[
51,
67
],
[
169,
69
],
[
184,
75
],
[
56,
76
],
[
163,
78
],
[
181,
84
],
[
51,
85
],
[
184,
87
],
[
56,
88
],
[
178,
91
],
[
103,
94
],
[
178,
95
],
[
181,
98
],
[
51,
99
],
[
184,
101
],
[
56,
102
],
[
114,
105
],
[
178,
106
],
[
181,
109
],
[
51,
110
],
[
184,
112
],
[
56,
113
],
[
118,
117
],
[
171,
124
],
[
128,
127
],
[
178,
130
],
[
136,
133
],
[
172,
134
],
[
127,
135
],
[
141,
138
],
[
172,
139
],
[
169,
144
],
[
163,
147
],
[
172,
152
],
[
157,
156
],
[
172,
156
],
[
156,
160
],
[
168,
163
],
[
168,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
],
[
183,
181
],
[
183,
184
]
] | [
"H, W, N = map(int, input().split())\nab = []\nfor i in range(N):\n a, b = map(int, input().split())\n ab.append((a - 1, b - 1))\n\ncomb_map = {}\n\n\nfor a, b in ab:\n for k in range(3):\n for m in range(3):\n if 0 <= a - k < H - 2 and 0 <= b - m < W - 2:\n if (a-k, b-m) in comb_map.keys():\n comb_map[(a - k, b - m)] += 1\n else:\n comb_map[(a - k, b - m)] = 1\n\ncount = [0 for _ in range(10)]\n\nfor v in comb_map.values():\n count[v] += 1\n\ncount[0] = (H - 2) * (W - 2) - sum(count[1:])\n\nfor c in count:\n print(c)",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"ab = []",
"ab",
"[]",
"for i in range(N):\n a, b = map(int, input().split())\n ab.append((a - 1, 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",
"ab.append((a - 1, b - 1))",
"ab.append",
"ab",
"append",
"(a - 1, b - 1)",
"a - 1",
"a",
"1",
"b - 1",
"b",
"1",
"comb_map = {}",
"comb_map",
"{}",
"for a, b in ab:\n for k in range(3):\n for m in range(3):\n if 0 <= a - k < H - 2 and 0 <= b - m < W - 2:\n if (a-k, b-m) in comb_map.keys():\n comb_map[(a - k, b - m)] += 1\n else:\n comb_map[(a - k, b - m)] = 1",
"a",
"b",
"ab",
"for k in range(3):\n for m in range(3):\n if 0 <= a - k < H - 2 and 0 <= b - m < W - 2:\n if (a-k, b-m) in comb_map.keys():\n comb_map[(a - k, b - m)] += 1\n else:\n comb_map[(a - k, b - m)] = 1",
"k",
"range(3)",
"range",
"3",
"for m in range(3):\n if 0 <= a - k < H - 2 and 0 <= b - m < W - 2:\n if (a-k, b-m) in comb_map.keys():\n comb_map[(a - k, b - m)] += 1\n else:\n comb_map[(a - k, b - m)] = 1",
"m",
"range(3)",
"range",
"3",
"if 0 <= a - k < H - 2 and 0 <= b - m < W - 2:\n if (a-k, b-m) in comb_map.keys():\n comb_map[(a - k, b - m)] += 1\n else:\n comb_map[(a - k, b - m)] = 1",
"0 <= a - k < H - 2 and 0 <= b - m < W - 2",
"0 <= a - k < H - 2",
"0 <= a - k",
"0",
"a - k",
"a",
"k",
"H - 2",
"H",
"2",
"0 <= b - m < W - 2",
"0 <= b - m",
"0",
"b - m",
"b",
"m",
"W - 2",
"W",
"2",
"if (a-k, b-m) in comb_map.keys():\n comb_map[(a - k, b - m)] += 1\n else:\n comb_map[(a - k, b - m)] = 1",
"(a-k, b-m) in comb_map.keys()",
"(a-k, b-m)",
"a-k",
"a",
"k",
"b-m",
"b",
"m",
"comb_map.keys()",
"comb_map.keys",
"comb_map",
"keys",
"comb_map[(a - k, b - m)] += 1",
"comb_map[(a - k, b - m)]",
"comb_map",
"(a - k, b - m)",
"a - k",
"a",
"k",
"b - m",
"b",
"m",
"1",
"comb_map[(a - k, b - m)] = 1",
"comb_map[(a - k, b - m)]",
"comb_map",
"(a - k, b - m)",
"a - k",
"a",
"k",
"b - m",
"b",
"m",
"1",
"0 for _ in range(10)",
"for _ in range(10)",
"_",
"range(10)",
"range",
"10",
"for _ in range(10)",
"0",
"count = [0 for _ in range(10)]",
"count",
"[0 for _ in range(10)]",
"for v in comb_map.values():\n count[v] += 1",
"v",
"comb_map.values()",
"comb_map.values",
"comb_map",
"values",
"count[v] += 1",
"count[v]",
"count",
"v",
"1",
"count[0] = (H - 2) * (W - 2) - sum(count[1:])",
"count[0]",
"count",
"0",
"(H - 2) * (W - 2) - sum(count[1:])",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(count[1:])",
"sum",
"count[1:]",
"count",
"1:",
"1",
"for c in count:\n print(c)",
"c",
"count",
"print(c)",
"print",
"c",
"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",
"count = [0 for _ in range(10)]",
"[0 for _ in range(10)]",
"count",
"ab = []",
"[]",
"ab",
"comb_map = {}",
"{}",
"comb_map",
"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())
ab = []
for i in range(N):
a, b = map(int, input().split())
ab.append((a - 1, b - 1))
comb_map = {}
for a, b in ab:
for k in range(3):
for m in range(3):
if 0 <= a - k < H - 2 and 0 <= b - m < W - 2:
if (a-k, b-m) in comb_map.keys():
comb_map[(a - k, b - m)] += 1
else:
comb_map[(a - k, b - m)] = 1
count = [0 for _ in range(10)]
for v in comb_map.values():
count[v] += 1
count[0] = (H - 2) * (W - 2) - sum(count[1:])
for c in count:
print(c)
|
[
7,
15,
13,
4,
18,
13,
13,
17,
0,
13,
4,
13,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
12,
4,
18,
4,
18,
18,
13,
13,
13,
13,
15,
15,
12,
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,
28,
13,
13,
4,
13,
4,
13,
2,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
40,
40,
17,
13,
13,
40,
40,
17,
13,
13,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
4,
18,
13,
13,
0,
13,
13,
13,
14,
2,
2,
2,
2,
13,
17,
2,
13,
13,
2,
13,
17,
2,
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,
4,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
2,
13
] | [
[
175,
9
],
[
181,
14
],
[
172,
21
],
[
38,
37
],
[
173,
44
],
[
38,
46
],
[
38,
47
],
[
50,
49
],
[
55,
54
],
[
47,
57
],
[
60,
59
],
[
173,
66
],
[
60,
68
],
[
59,
77
],
[
59,
80
],
[
68,
85
],
[
68,
88
],
[
37,
96
],
[
46,
101
],
[
108,
103
],
[
49,
104
],
[
111,
110
],
[
49,
120
],
[
124,
123
],
[
124,
125
],
[
123,
131
],
[
123,
134
],
[
37,
135
],
[
125,
137
],
[
125,
140
],
[
46,
141
],
[
146,
143
],
[
110,
144
],
[
151,
148
],
[
110,
149
],
[
37,
154
],
[
46,
157
],
[
110,
161
],
[
110,
165
],
[
168,
167
],
[
179,
170
],
[
172,
173
],
[
175,
176
],
[
181,
182
]
] | [
"import sys\nsys.setrecursionlimit(2147483647)\nINF=float(\"inf\")\nMOD=10**9+7\ninput=lambda :sys.stdin.readline().rstrip()\nfrom itertools import product\nfrom collections import defaultdict\ndef resolve():\n h,w,n=map(int,input().split())\n D=defaultdict(int)\n for _ in range(n):\n a,b=map(int,input().split())\n for i,j in product(range(a-1,a+2),range(b-1,b+2)):\n if(1<=i<=h and 1<=j<=w):\n D[(i,j)]+=1\n\n ans=[0]*10\n for k,v in D.items():\n i,j=k\n if(i==1 or i==h or j==1 or j==w): continue\n ans[v]+=1\n ans[0]=(h-2)*(w-2)-sum(ans)\n print(*ans,sep='\\n')\nresolve()",
"import sys",
"sys",
"sys.setrecursionlimit(2147483647)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"2147483647",
"INF=float(\"inf\")",
"INF",
"float(\"inf\")",
"float",
"\"inf\"",
"MOD=10**9+7",
"MOD",
"10**9+7",
"10**9",
"10",
"9",
"7",
"input=lambda :sys.stdin.readline().rstrip()",
"input",
"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",
"from itertools import product",
"from collections import defaultdict",
"def resolve():\n h,w,n=map(int,input().split())\n D=defaultdict(int)\n for _ in range(n):\n a,b=map(int,input().split())\n for i,j in product(range(a-1,a+2),range(b-1,b+2)):\n if(1<=i<=h and 1<=j<=w):\n D[(i,j)]+=1\n\n ans=[0]*10\n for k,v in D.items():\n i,j=k\n if(i==1 or i==h or j==1 or j==w): continue\n ans[v]+=1\n ans[0]=(h-2)*(w-2)-sum(ans)\n print(*ans,sep='\\n')",
"resolve",
"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 for i,j in product(range(a-1,a+2),range(b-1,b+2)):\n if(1<=i<=h and 1<=j<=w):\n D[(i,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,j in product(range(a-1,a+2),range(b-1,b+2)):\n if(1<=i<=h and 1<=j<=w):\n D[(i,j)]+=1\n\n ",
"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 and 1<=j<=w):\n D[(i,j)]+=1\n\n ",
"1<=i<=h and 1<=j<=w",
"1<=i<=h",
"1<=i",
"1",
"i",
"h",
"1<=j<=w",
"1<=j",
"1",
"j",
"w",
"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 i,j=k\n if(i==1 or i==h or j==1 or j==w): continue\n ans[v]+=1\n ",
"k",
"v",
"D.items()",
"D.items",
"D",
"items",
"i,j=k",
"i",
"k",
"j",
"if(i==1 or i==h or j==1 or j==w): continue\n ",
"i==1 or i==h or j==1 or j==w",
"i==1 or i==h or j==1",
"i==1 or i==h",
"i==1",
"i",
"1",
"i==h",
"i",
"h",
"j==1",
"j",
"1",
"j==w",
"j",
"w",
"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'",
"resolve()",
"resolve",
"input=lambda :sys.stdin.readline().rstrip()",
"lambda :sys.stdin.readline().rstrip()",
"input",
"INF=float(\"inf\")",
"float(\"inf\")",
"INF",
"def resolve():\n h,w,n=map(int,input().split())\n D=defaultdict(int)\n for _ in range(n):\n a,b=map(int,input().split())\n for i,j in product(range(a-1,a+2),range(b-1,b+2)):\n if(1<=i<=h and 1<=j<=w):\n D[(i,j)]+=1\n\n ans=[0]*10\n for k,v in D.items():\n i,j=k\n if(i==1 or i==h or j==1 or j==w): continue\n ans[v]+=1\n ans[0]=(h-2)*(w-2)-sum(ans)\n print(*ans,sep='\\n')",
"def resolve():\n h,w,n=map(int,input().split())\n D=defaultdict(int)\n for _ in range(n):\n a,b=map(int,input().split())\n for i,j in product(range(a-1,a+2),range(b-1,b+2)):\n if(1<=i<=h and 1<=j<=w):\n D[(i,j)]+=1\n\n ans=[0]*10\n for k,v in D.items():\n i,j=k\n if(i==1 or i==h or j==1 or j==w): continue\n ans[v]+=1\n ans[0]=(h-2)*(w-2)-sum(ans)\n print(*ans,sep='\\n')",
"resolve",
"MOD=10**9+7",
"10**9+7",
"MOD"
] | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
from itertools import product
from collections import defaultdict
def resolve():
h,w,n=map(int,input().split())
D=defaultdict(int)
for _ in range(n):
a,b=map(int,input().split())
for i,j in product(range(a-1,a+2),range(b-1,b+2)):
if(1<=i<=h and 1<=j<=w):
D[(i,j)]+=1
ans=[0]*10
for k,v in D.items():
i,j=k
if(i==1 or i==h or j==1 or j==w): continue
ans[v]+=1
ans[0]=(h-2)*(w-2)-sum(ans)
print(*ans,sep='\n')
resolve() |
[
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,
28,
13,
4,
13,
13,
28,
13,
4,
13,
17,
0,
18,
18,
13,
13,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
40,
40,
17,
2,
18,
18,
13,
13,
17,
13,
2,
13,
17,
40,
40,
17,
2,
18,
18,
13,
13,
17,
13,
2,
13,
17,
38,
5,
0,
18,
13,
39,
2,
18,
18,
13,
13,
17,
13,
2,
18,
18,
13,
13,
17,
13,
17,
0,
18,
13,
39,
2,
18,
18,
13,
13,
17,
13,
2,
18,
18,
13,
13,
17,
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,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
13,
13
] | [
[
191,
2
],
[
191,
13
],
[
191,
14
],
[
18,
17
],
[
183,
20
],
[
197,
33
],
[
37,
36
],
[
183,
39
],
[
42,
41
],
[
51,
46
],
[
198,
48
],
[
36,
49
],
[
41,
50
],
[
188,
53
],
[
57,
56
],
[
183,
59
],
[
62,
61
],
[
68,
67
],
[
198,
80
],
[
56,
81
],
[
61,
83
],
[
186,
85
],
[
198,
93
],
[
56,
94
],
[
67,
96
],
[
192,
98
],
[
120,
103
],
[
189,
104
],
[
198,
109
],
[
56,
110
],
[
61,
112
],
[
198,
116
],
[
56,
117
],
[
67,
119
],
[
139,
122
],
[
189,
123
],
[
198,
128
],
[
56,
129
],
[
61,
131
],
[
198,
135
],
[
56,
136
],
[
67,
138
],
[
194,
141
],
[
148,
147
],
[
189,
150
],
[
156,
153
],
[
195,
154
],
[
147,
155
],
[
161,
158
],
[
195,
159
],
[
186,
164
],
[
192,
167
],
[
195,
172
],
[
177,
176
],
[
195,
176
],
[
176,
180
],
[
191,
183
],
[
191,
186
],
[
188,
189
],
[
191,
192
],
[
194,
195
],
[
197,
198
]
] | [
"h, w, n = list(map(int,input().split()))\nA = [list(map(int,input().split())) for i in range(n)]\n\nfor i in range(n):\n for j in range(2):\n A[i][j] -= 1\n\nD = {}\n\nfor i in range(n):\n # print(D)\n for j in range(-1, 2):\n for k in range(-1, 2):\n if 1 <= A[i][0]+j <= h-2 and 1 <= A[i][1]+k <= w-2:\n try:\n D[(A[i][0]+j, A[i][1]+k)] += 1\n except:\n D[(A[i][0]+j, A[i][1]+k)] = 1\n\nANS = [0] * 10\nfor i in D.values():\n ANS[i] += 1\nANS[0] = (h-2) * (w-2) - sum(ANS[1:])\n\nfor i in ANS:\n print(i)",
"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 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)]",
"for i in range(n):\n for j in range(2):\n A[i][j] -= 1",
"i",
"range(n)",
"range",
"n",
"for j in range(2):\n A[i][j] -= 1",
"j",
"range(2)",
"range",
"2",
"A[i][j] -= 1",
"A[i][j]",
"[i]",
"A",
"i",
"j",
"1",
"D = {}",
"D",
"{}",
"for i in range(n):\n # print(D)\n for j in range(-1, 2):\n for k in range(-1, 2):\n if 1 <= A[i][0]+j <= h-2 and 1 <= A[i][1]+k <= w-2:\n try:\n D[(A[i][0]+j, A[i][1]+k)] += 1\n except:\n D[(A[i][0]+j, A[i][1]+k)] = 1",
"i",
"range(n)",
"range",
"n",
"for j in range(-1, 2):\n for k in range(-1, 2):\n if 1 <= A[i][0]+j <= h-2 and 1 <= A[i][1]+k <= w-2:\n try:\n D[(A[i][0]+j, A[i][1]+k)] += 1\n except:\n D[(A[i][0]+j, A[i][1]+k)] = 1",
"j",
"range(-1, 2)",
"range",
"-1",
"2",
"for k in range(-1, 2):\n if 1 <= A[i][0]+j <= h-2 and 1 <= A[i][1]+k <= w-2:\n try:\n D[(A[i][0]+j, A[i][1]+k)] += 1\n except:\n D[(A[i][0]+j, A[i][1]+k)] = 1",
"k",
"range(-1, 2)",
"range",
"-1",
"2",
"if 1 <= A[i][0]+j <= h-2 and 1 <= A[i][1]+k <= w-2:\n try:\n D[(A[i][0]+j, A[i][1]+k)] += 1\n except:\n D[(A[i][0]+j, A[i][1]+k)] = 1",
"1 <= A[i][0]+j <= h-2 and 1 <= A[i][1]+k <= w-2",
"1 <= A[i][0]+j <= h-2",
"1 <= A[i][0]+j",
"1",
"A[i][0]+j",
"A[i][0]",
"[i]",
"A",
"i",
"0",
"j",
"h-2",
"h",
"2",
"1 <= A[i][1]+k <= w-2",
"1 <= A[i][1]+k",
"1",
"A[i][1]+k",
"A[i][1]",
"[i]",
"A",
"i",
"1",
"k",
"w-2",
"w",
"2",
"try:\n D[(A[i][0]+j, A[i][1]+k)] += 1\n except:\n D[(A[i][0]+j, A[i][1]+k)] = 1",
"except:\n D[(A[i][0]+j, A[i][1]+k)] = 1",
"D[(A[i][0]+j, A[i][1]+k)] = 1",
"D[(A[i][0]+j, A[i][1]+k)]",
"D",
"(A[i][0]+j, A[i][1]+k)",
"A[i][0]+j",
"A[i][0]",
"[i]",
"A",
"i",
"0",
"j",
"A[i][1]+k",
"A[i][1]",
"[i]",
"A",
"i",
"1",
"k",
"1",
"D[(A[i][0]+j, A[i][1]+k)] += 1",
"D[(A[i][0]+j, A[i][1]+k)]",
"D",
"(A[i][0]+j, A[i][1]+k)",
"A[i][0]+j",
"A[i][0]",
"[i]",
"A",
"i",
"0",
"j",
"A[i][1]+k",
"A[i][1]",
"[i]",
"A",
"i",
"1",
"k",
"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[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",
"n = list(map(int,input().split()))",
"list(map(int,input().split()))",
"n",
"h, w, n = list(map(int,input().split()))",
"list(map(int,input().split()))",
"h",
"D = {}",
"{}",
"D",
"w, n = list(map(int,input().split()))",
"list(map(int,input().split()))",
"w",
"ANS = [0] * 10",
"[0] * 10",
"ANS",
"A = [list(map(int,input().split())) for i in range(n)]",
"[list(map(int,input().split())) for i in range(n)]",
"A"
] | h, w, n = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(n)]
for i in range(n):
for j in range(2):
A[i][j] -= 1
D = {}
for i in range(n):
# print(D)
for j in range(-1, 2):
for k in range(-1, 2):
if 1 <= A[i][0]+j <= h-2 and 1 <= A[i][1]+k <= w-2:
try:
D[(A[i][0]+j, A[i][1]+k)] += 1
except:
D[(A[i][0]+j, A[i][1]+k)] = 1
ANS = [0] * 10
for i in D.values():
ANS[i] += 1
ANS[0] = (h-2) * (w-2) - sum(ANS[1:])
for i in ANS:
print(i) |
[
7,
12,
13,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
4,
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,
14,
2,
40,
40,
17,
2,
13,
13,
2,
13,
17,
40,
40,
17,
2,
13,
13,
2,
13,
17,
0,
13,
2,
2,
2,
2,
13,
13,
2,
17,
17,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
2,
2,
13,
2,
17,
17,
13,
0,
13,
4,
13,
13,
28,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
2,
2,
13,
2,
13,
2,
17,
17,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
28,
13,
4,
13,
17,
17,
4,
13,
18,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
7,
6
],
[
14,
13
],
[
6,
20
],
[
14,
22
],
[
14,
23
],
[
26,
25
],
[
32,
31
],
[
36,
35
],
[
40,
39
],
[
23,
42
],
[
45,
44
],
[
6,
51
],
[
45,
53
],
[
56,
55
],
[
62,
61
],
[
44,
72
],
[
55,
73
],
[
13,
75
],
[
53,
81
],
[
61,
82
],
[
22,
84
],
[
88,
87
],
[
44,
92
],
[
55,
93
],
[
53,
97
],
[
61,
98
],
[
31,
101
],
[
87,
103
],
[
35,
106
],
[
44,
110
],
[
53,
114
],
[
117,
116
],
[
31,
119
],
[
122,
121
],
[
116,
121
],
[
31,
121
],
[
125,
124
],
[
128,
127
],
[
134,
133
],
[
121,
142
],
[
127,
144
],
[
133,
148
],
[
35,
149
],
[
152,
151
],
[
157,
154
],
[
25,
155
],
[
151,
156
],
[
124,
156
],
[
13,
163
],
[
22,
166
],
[
25,
171
],
[
176,
175
],
[
25,
183
],
[
175,
184
],
[
193,
190
]
] | [
"def main():\n\timport sys\n\tinput=sys.stdin.readline\n\th,w,n=map(int,input().split())\n\tans=[0]*10\n\tp=set()\n\tq=set()\n\tfor i in range(n):\n\t\ta,b=map(int,input().split())\n\t\tfor j in range(-1,2):\n\t\t\tfor k in range(-1,2):\n\t\t\t\tif 2<=a+j<=h-1 and 2<=b+k<=w-1:\n\t\t\t\t\tr=(a+j)*(10**10)+b+k\n\t\t\t\t\tp.add(r)\n\t\tq.add(a*(10**10)+b)\n\tp=list(p)\n\tfor x in p:\n\t\tcnt=0\n\t\tfor j in range(-1,2):\n\t\t\tfor k in range(-1,2):\n\t\t\t\tif x+j*(10**10)+k in q:\n\t\t\t\t\tcnt+=1\n\t\tans[cnt]+=1\n\tprint((h-2)*(w-2)-sum(ans[1:]))\n\tfor i in range(1,10):\n\t\tprint(ans[i])\nif __name__ == '__main__':\n\tmain()",
"def main():\n\timport sys\n\tinput=sys.stdin.readline\n\th,w,n=map(int,input().split())\n\tans=[0]*10\n\tp=set()\n\tq=set()\n\tfor i in range(n):\n\t\ta,b=map(int,input().split())\n\t\tfor j in range(-1,2):\n\t\t\tfor k in range(-1,2):\n\t\t\t\tif 2<=a+j<=h-1 and 2<=b+k<=w-1:\n\t\t\t\t\tr=(a+j)*(10**10)+b+k\n\t\t\t\t\tp.add(r)\n\t\tq.add(a*(10**10)+b)\n\tp=list(p)\n\tfor x in p:\n\t\tcnt=0\n\t\tfor j in range(-1,2):\n\t\t\tfor k in range(-1,2):\n\t\t\t\tif x+j*(10**10)+k in q:\n\t\t\t\t\tcnt+=1\n\t\tans[cnt]+=1\n\tprint((h-2)*(w-2)-sum(ans[1:]))\n\tfor i in range(1,10):\n\t\tprint(ans[i])",
"main",
"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",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"p=set()",
"p",
"set()",
"set",
"q=set()",
"q",
"set()",
"set",
"for i in range(n):\n\t\ta,b=map(int,input().split())\n\t\tfor j in range(-1,2):\n\t\t\tfor k in range(-1,2):\n\t\t\t\tif 2<=a+j<=h-1 and 2<=b+k<=w-1:\n\t\t\t\t\tr=(a+j)*(10**10)+b+k\n\t\t\t\t\tp.add(r)\n\t\tq.add(a*(10**10)+b)\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 j in range(-1,2):\n\t\t\tfor k in range(-1,2):\n\t\t\t\tif 2<=a+j<=h-1 and 2<=b+k<=w-1:\n\t\t\t\t\tr=(a+j)*(10**10)+b+k\n\t\t\t\t\tp.add(r)\n\t\t",
"j",
"range(-1,2)",
"range",
"-1",
"2",
"for k in range(-1,2):\n\t\t\t\tif 2<=a+j<=h-1 and 2<=b+k<=w-1:\n\t\t\t\t\tr=(a+j)*(10**10)+b+k\n\t\t\t\t\tp.add(r)\n\t\t",
"k",
"range(-1,2)",
"range",
"-1",
"2",
"if 2<=a+j<=h-1 and 2<=b+k<=w-1:\n\t\t\t\t\tr=(a+j)*(10**10)+b+k\n\t\t\t\t\tp.add(r)\n\t\t",
"2<=a+j<=h-1 and 2<=b+k<=w-1",
"2<=a+j<=h-1",
"2<=a+j",
"2",
"a+j",
"a",
"j",
"h-1",
"h",
"1",
"2<=b+k<=w-1",
"2<=b+k",
"2",
"b+k",
"b",
"k",
"w-1",
"w",
"1",
"r=(a+j)*(10**10)+b+k",
"r",
"(a+j)*(10**10)+b+k",
"(a+j)*(10**10)+b",
"(a+j)*(10**10)",
"a+j",
"a",
"j",
"10**10",
"10",
"10",
"b",
"k",
"p.add(r)",
"p.add",
"p",
"add",
"r",
"q.add(a*(10**10)+b)",
"q.add",
"q",
"add",
"a*(10**10)+b",
"a*(10**10)",
"a",
"10**10",
"10",
"10",
"b",
"p=list(p)",
"p",
"list(p)",
"list",
"p",
"for x in p:\n\t\tcnt=0\n\t\tfor j in range(-1,2):\n\t\t\tfor k in range(-1,2):\n\t\t\t\tif x+j*(10**10)+k in q:\n\t\t\t\t\tcnt+=1\n\t\tans[cnt]+=1\n\t",
"x",
"p",
"cnt=0",
"cnt",
"0",
"for j in range(-1,2):\n\t\t\tfor k in range(-1,2):\n\t\t\t\tif x+j*(10**10)+k in q:\n\t\t\t\t\tcnt+=1\n\t\t",
"j",
"range(-1,2)",
"range",
"-1",
"2",
"for k in range(-1,2):\n\t\t\t\tif x+j*(10**10)+k in q:\n\t\t\t\t\tcnt+=1\n\t\t",
"k",
"range(-1,2)",
"range",
"-1",
"2",
"if x+j*(10**10)+k in q:\n\t\t\t\t\tcnt+=1\n\t\t",
"x+j*(10**10)+k in q",
"x+j*(10**10)+k",
"x+j*(10**10)",
"x",
"j*(10**10)",
"j",
"10**10",
"10",
"10",
"k",
"q",
"cnt+=1",
"cnt",
"1",
"ans[cnt]+=1",
"ans[cnt]",
"ans",
"cnt",
"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 i in range(1,10):\n\t\tprint(ans[i])",
"i",
"range(1,10)",
"range",
"1",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"if __name__ == '__main__':\n\tmain()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n\timport sys\n\tinput=sys.stdin.readline\n\th,w,n=map(int,input().split())\n\tans=[0]*10\n\tp=set()\n\tq=set()\n\tfor i in range(n):\n\t\ta,b=map(int,input().split())\n\t\tfor j in range(-1,2):\n\t\t\tfor k in range(-1,2):\n\t\t\t\tif 2<=a+j<=h-1 and 2<=b+k<=w-1:\n\t\t\t\t\tr=(a+j)*(10**10)+b+k\n\t\t\t\t\tp.add(r)\n\t\tq.add(a*(10**10)+b)\n\tp=list(p)\n\tfor x in p:\n\t\tcnt=0\n\t\tfor j in range(-1,2):\n\t\t\tfor k in range(-1,2):\n\t\t\t\tif x+j*(10**10)+k in q:\n\t\t\t\t\tcnt+=1\n\t\tans[cnt]+=1\n\tprint((h-2)*(w-2)-sum(ans[1:]))\n\tfor i in range(1,10):\n\t\tprint(ans[i])",
"def main():\n\timport sys\n\tinput=sys.stdin.readline\n\th,w,n=map(int,input().split())\n\tans=[0]*10\n\tp=set()\n\tq=set()\n\tfor i in range(n):\n\t\ta,b=map(int,input().split())\n\t\tfor j in range(-1,2):\n\t\t\tfor k in range(-1,2):\n\t\t\t\tif 2<=a+j<=h-1 and 2<=b+k<=w-1:\n\t\t\t\t\tr=(a+j)*(10**10)+b+k\n\t\t\t\t\tp.add(r)\n\t\tq.add(a*(10**10)+b)\n\tp=list(p)\n\tfor x in p:\n\t\tcnt=0\n\t\tfor j in range(-1,2):\n\t\t\tfor k in range(-1,2):\n\t\t\t\tif x+j*(10**10)+k in q:\n\t\t\t\t\tcnt+=1\n\t\tans[cnt]+=1\n\tprint((h-2)*(w-2)-sum(ans[1:]))\n\tfor i in range(1,10):\n\t\tprint(ans[i])",
"main"
] | def main():
import sys
input=sys.stdin.readline
h,w,n=map(int,input().split())
ans=[0]*10
p=set()
q=set()
for i in range(n):
a,b=map(int,input().split())
for j in range(-1,2):
for k in range(-1,2):
if 2<=a+j<=h-1 and 2<=b+k<=w-1:
r=(a+j)*(10**10)+b+k
p.add(r)
q.add(a*(10**10)+b)
p=list(p)
for x in p:
cnt=0
for j in range(-1,2):
for k in range(-1,2):
if x+j*(10**10)+k in q:
cnt+=1
ans[cnt]+=1
print((h-2)*(w-2)-sum(ans[1:]))
for i in range(1,10):
print(ans[i])
if __name__ == '__main__':
main() |
[
7,
15,
12,
13,
0,
13,
4,
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,
0,
13,
4,
13,
13,
28,
13,
13,
0,
13,
4,
13,
13,
14,
2,
40,
2,
18,
13,
17,
17,
13,
40,
2,
18,
13,
17,
17,
13,
0,
18,
13,
13,
17,
14,
2,
2,
40,
2,
18,
13,
17,
17,
13,
40,
17,
2,
18,
13,
17,
17,
40,
2,
18,
13,
17,
17,
13,
0,
18,
13,
39,
18,
13,
17,
2,
18,
13,
17,
17,
17,
14,
2,
40,
2,
18,
13,
17,
17,
13,
40,
17,
2,
18,
13,
17,
17,
0,
18,
13,
39,
18,
13,
17,
2,
18,
13,
17,
17,
17,
14,
2,
2,
40,
17,
2,
18,
13,
17,
17,
40,
2,
18,
13,
17,
17,
13,
40,
2,
18,
13,
17,
17,
13,
0,
18,
13,
39,
2,
18,
13,
17,
17,
18,
13,
17,
17,
14,
2,
2,
2,
40,
17,
2,
18,
13,
17,
17,
40,
2,
18,
13,
17,
17,
13,
40,
17,
2,
18,
13,
17,
17,
40,
2,
18,
13,
17,
17,
13,
0,
18,
13,
39,
2,
18,
13,
17,
17,
2,
18,
13,
17,
17,
17,
14,
2,
2,
40,
17,
2,
18,
13,
17,
17,
40,
2,
18,
13,
17,
17,
13,
40,
17,
2,
18,
13,
17,
17,
0,
18,
13,
39,
2,
18,
13,
17,
17,
2,
18,
13,
17,
17,
17,
14,
2,
40,
17,
2,
18,
13,
17,
17,
40,
2,
18,
13,
17,
17,
13,
0,
18,
13,
39,
2,
18,
13,
17,
17,
18,
13,
17,
17,
14,
2,
2,
40,
17,
2,
18,
13,
17,
17,
40,
17,
2,
18,
13,
17,
17,
40,
2,
18,
13,
17,
17,
13,
0,
18,
13,
39,
2,
18,
13,
17,
17,
2,
18,
13,
17,
17,
17,
14,
2,
40,
17,
2,
18,
13,
17,
17,
40,
17,
2,
18,
13,
17,
17,
0,
18,
13,
39,
2,
18,
13,
17,
17,
2,
18,
13,
17,
17,
17,
0,
13,
4,
13,
13,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
13,
13,
0,
18,
13,
17,
13,
28,
13,
4,
13,
17,
17,
4,
13,
18,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
6,
5
],
[
6,
17
],
[
6,
18
],
[
22,
21
],
[
18,
24
],
[
39,
38
],
[
42,
41
],
[
47,
46
],
[
38,
46
],
[
50,
49
],
[
46,
52
],
[
49,
52
],
[
49,
58
],
[
46,
58
],
[
5,
61
],
[
49,
65
],
[
46,
65
],
[
17,
68
],
[
73,
70
],
[
41,
71
],
[
49,
72
],
[
46,
72
],
[
49,
80
],
[
46,
80
],
[
5,
83
],
[
49,
88
],
[
46,
88
],
[
49,
94
],
[
46,
94
],
[
17,
97
],
[
110,
99
],
[
41,
100
],
[
49,
103
],
[
46,
103
],
[
49,
107
],
[
46,
107
],
[
49,
116
],
[
46,
116
],
[
5,
119
],
[
49,
124
],
[
46,
124
],
[
139,
128
],
[
41,
129
],
[
49,
132
],
[
46,
132
],
[
49,
136
],
[
46,
136
],
[
49,
147
],
[
46,
147
],
[
49,
153
],
[
46,
153
],
[
5,
156
],
[
49,
160
],
[
46,
160
],
[
17,
163
],
[
176,
165
],
[
41,
166
],
[
49,
170
],
[
46,
170
],
[
49,
174
],
[
46,
174
],
[
49,
185
],
[
46,
185
],
[
49,
191
],
[
46,
191
],
[
5,
194
],
[
49,
199
],
[
46,
199
],
[
49,
205
],
[
46,
205
],
[
17,
208
],
[
223,
210
],
[
41,
211
],
[
49,
215
],
[
46,
215
],
[
49,
220
],
[
46,
220
],
[
49,
231
],
[
46,
231
],
[
49,
237
],
[
46,
237
],
[
5,
240
],
[
49,
245
],
[
46,
245
],
[
262,
249
],
[
41,
250
],
[
49,
254
],
[
46,
254
],
[
49,
259
],
[
46,
259
],
[
49,
269
],
[
46,
269
],
[
49,
275
],
[
46,
275
],
[
17,
278
],
[
291,
280
],
[
41,
281
],
[
49,
285
],
[
46,
285
],
[
49,
289
],
[
46,
289
],
[
49,
299
],
[
46,
299
],
[
49,
306
],
[
46,
306
],
[
49,
312
],
[
46,
312
],
[
17,
315
],
[
330,
317
],
[
41,
318
],
[
49,
322
],
[
46,
322
],
[
49,
327
],
[
46,
327
],
[
49,
337
],
[
46,
337
],
[
49,
344
],
[
46,
344
],
[
361,
348
],
[
41,
349
],
[
49,
353
],
[
46,
353
],
[
49,
358
],
[
46,
358
],
[
364,
363
],
[
369,
368
],
[
41,
371
],
[
377,
374
],
[
363,
375
],
[
368,
376
],
[
380,
379
],
[
5,
383
],
[
17,
386
],
[
363,
392
],
[
398,
395
],
[
363,
396
],
[
379,
398
],
[
401,
400
],
[
363,
408
],
[
400,
409
],
[
418,
415
]
] | [
"from collections import defaultdict\n\n\ndef main():\n H, W, N = list(map(int, input().split(' ')))\n coord_list = [list(map(int, input().split(' '))) for _ in range(N)]\n # count squares (key: coord of top left cell, value: number of appearance)\n square_count = defaultdict(int)\n for coord in coord_list:\n coord = tuple(coord)\n # black cell is located on the top row\n if coord[0] + 2 <= H and coord[1] + 2 <= W:\n square_count[coord] += 1\n if coord[0] + 2 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0], coord[1] - 1)] += 1\n if coord[0] + 2 <= H and 1 <= coord[1] - 2:\n square_count[(coord[0], coord[1] - 2)] += 1\n # black cell is located in the middle row\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and coord[1] + 2 <= W:\n square_count[(coord[0] - 1, coord[1])] += 1\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0] - 1, coord[1] - 1)] += 1\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 2:\n square_count[(coord[0] - 1, coord[1] - 2)] += 1\n # black cell is located on the bottom row\n if 1 <= coord[0] - 2 and coord[1] + 2 <= W:\n square_count[(coord[0] - 2, coord[1])] += 1\n if 1 <= coord[0] - 2 and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0] - 2, coord[1] - 1)] += 1\n if 1 <= coord[0] - 2 and 1 <= coord[1] - 2:\n square_count[(coord[0] - 2, coord[1] - 2)] += 1\n # remove duplicated counts\n count = defaultdict(int) # key: number of black cells, value: number of squares\n for v in square_count.values():\n count[v] += 1\n count_white_only = (H - 2) * (W - 2) - sum(count.values())\n count[0] = count_white_only\n # print answer\n for c in range(0, 10):\n print(count[c])\n\n\nif __name__ == '__main__':\n main()",
"from collections import defaultdict",
"def main():\n H, W, N = list(map(int, input().split(' ')))\n coord_list = [list(map(int, input().split(' '))) for _ in range(N)]\n # count squares (key: coord of top left cell, value: number of appearance)\n square_count = defaultdict(int)\n for coord in coord_list:\n coord = tuple(coord)\n # black cell is located on the top row\n if coord[0] + 2 <= H and coord[1] + 2 <= W:\n square_count[coord] += 1\n if coord[0] + 2 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0], coord[1] - 1)] += 1\n if coord[0] + 2 <= H and 1 <= coord[1] - 2:\n square_count[(coord[0], coord[1] - 2)] += 1\n # black cell is located in the middle row\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and coord[1] + 2 <= W:\n square_count[(coord[0] - 1, coord[1])] += 1\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0] - 1, coord[1] - 1)] += 1\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 2:\n square_count[(coord[0] - 1, coord[1] - 2)] += 1\n # black cell is located on the bottom row\n if 1 <= coord[0] - 2 and coord[1] + 2 <= W:\n square_count[(coord[0] - 2, coord[1])] += 1\n if 1 <= coord[0] - 2 and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0] - 2, coord[1] - 1)] += 1\n if 1 <= coord[0] - 2 and 1 <= coord[1] - 2:\n square_count[(coord[0] - 2, coord[1] - 2)] += 1\n # remove duplicated counts\n count = defaultdict(int) # key: number of black cells, value: number of squares\n for v in square_count.values():\n count[v] += 1\n count_white_only = (H - 2) * (W - 2) - sum(count.values())\n count[0] = count_white_only\n # print answer\n for c in range(0, 10):\n print(count[c])",
"main",
"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",
"' '",
"coord_list = [list(map(int, input().split(' '))) for _ in range(N)]",
"coord_list",
"[list(map(int, input().split(' '))) for _ in range(N)]",
"square_count = defaultdict(int)",
"square_count",
"defaultdict(int)",
"defaultdict",
"int",
"for coord in coord_list:\n coord = tuple(coord)\n # black cell is located on the top row\n if coord[0] + 2 <= H and coord[1] + 2 <= W:\n square_count[coord] += 1\n if coord[0] + 2 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0], coord[1] - 1)] += 1\n if coord[0] + 2 <= H and 1 <= coord[1] - 2:\n square_count[(coord[0], coord[1] - 2)] += 1\n # black cell is located in the middle row\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and coord[1] + 2 <= W:\n square_count[(coord[0] - 1, coord[1])] += 1\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0] - 1, coord[1] - 1)] += 1\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 2:\n square_count[(coord[0] - 1, coord[1] - 2)] += 1\n # black cell is located on the bottom row\n if 1 <= coord[0] - 2 and coord[1] + 2 <= W:\n square_count[(coord[0] - 2, coord[1])] += 1\n if 1 <= coord[0] - 2 and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0] - 2, coord[1] - 1)] += 1\n if 1 <= coord[0] - 2 and 1 <= coord[1] - 2:\n square_count[(coord[0] - 2, coord[1] - 2)] += 1\n # remove duplicated counts\n ",
"coord",
"coord_list",
"coord = tuple(coord)",
"coord",
"tuple(coord)",
"tuple",
"coord",
"if coord[0] + 2 <= H and coord[1] + 2 <= W:\n square_count[coord] += 1\n ",
"coord[0] + 2 <= H and coord[1] + 2 <= W",
"coord[0] + 2 <= H",
"coord[0] + 2",
"coord[0]",
"coord",
"0",
"2",
"H",
"coord[1] + 2 <= W",
"coord[1] + 2",
"coord[1]",
"coord",
"1",
"2",
"W",
"square_count[coord] += 1",
"square_count[coord]",
"square_count",
"coord",
"1",
"if coord[0] + 2 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0], coord[1] - 1)] += 1\n ",
"coord[0] + 2 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W",
"coord[0] + 2 <= H and 1 <= coord[1] - 1",
"coord[0] + 2 <= H",
"coord[0] + 2",
"coord[0]",
"coord",
"0",
"2",
"H",
"1 <= coord[1] - 1",
"1",
"coord[1] - 1",
"coord[1]",
"coord",
"1",
"1",
"coord[1] + 1 <= W",
"coord[1] + 1",
"coord[1]",
"coord",
"1",
"1",
"W",
"square_count[(coord[0], coord[1] - 1)] += 1",
"square_count[(coord[0], coord[1] - 1)]",
"square_count",
"(coord[0], coord[1] - 1)",
"coord[0]",
"coord",
"0",
"coord[1] - 1",
"coord[1]",
"coord",
"1",
"1",
"1",
"if coord[0] + 2 <= H and 1 <= coord[1] - 2:\n square_count[(coord[0], coord[1] - 2)] += 1\n # black cell is located in the middle row\n ",
"coord[0] + 2 <= H and 1 <= coord[1] - 2",
"coord[0] + 2 <= H",
"coord[0] + 2",
"coord[0]",
"coord",
"0",
"2",
"H",
"1 <= coord[1] - 2",
"1",
"coord[1] - 2",
"coord[1]",
"coord",
"1",
"2",
"square_count[(coord[0], coord[1] - 2)] += 1",
"square_count[(coord[0], coord[1] - 2)]",
"square_count",
"(coord[0], coord[1] - 2)",
"coord[0]",
"coord",
"0",
"coord[1] - 2",
"coord[1]",
"coord",
"1",
"2",
"1",
"if 1 <= coord[0] - 1 and coord[0] + 1 <= H and coord[1] + 2 <= W:\n square_count[(coord[0] - 1, coord[1])] += 1\n ",
"1 <= coord[0] - 1 and coord[0] + 1 <= H and coord[1] + 2 <= W",
"1 <= coord[0] - 1 and coord[0] + 1 <= H",
"1 <= coord[0] - 1",
"1",
"coord[0] - 1",
"coord[0]",
"coord",
"0",
"1",
"coord[0] + 1 <= H",
"coord[0] + 1",
"coord[0]",
"coord",
"0",
"1",
"H",
"coord[1] + 2 <= W",
"coord[1] + 2",
"coord[1]",
"coord",
"1",
"2",
"W",
"square_count[(coord[0] - 1, coord[1])] += 1",
"square_count[(coord[0] - 1, coord[1])]",
"square_count",
"(coord[0] - 1, coord[1])",
"coord[0] - 1",
"coord[0]",
"coord",
"0",
"1",
"coord[1]",
"coord",
"1",
"1",
"if 1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0] - 1, coord[1] - 1)] += 1\n ",
"1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W",
"1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 1",
"1 <= coord[0] - 1 and coord[0] + 1 <= H",
"1 <= coord[0] - 1",
"1",
"coord[0] - 1",
"coord[0]",
"coord",
"0",
"1",
"coord[0] + 1 <= H",
"coord[0] + 1",
"coord[0]",
"coord",
"0",
"1",
"H",
"1 <= coord[1] - 1",
"1",
"coord[1] - 1",
"coord[1]",
"coord",
"1",
"1",
"coord[1] + 1 <= W",
"coord[1] + 1",
"coord[1]",
"coord",
"1",
"1",
"W",
"square_count[(coord[0] - 1, coord[1] - 1)] += 1",
"square_count[(coord[0] - 1, coord[1] - 1)]",
"square_count",
"(coord[0] - 1, coord[1] - 1)",
"coord[0] - 1",
"coord[0]",
"coord",
"0",
"1",
"coord[1] - 1",
"coord[1]",
"coord",
"1",
"1",
"1",
"if 1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 2:\n square_count[(coord[0] - 1, coord[1] - 2)] += 1\n # black cell is located on the bottom row\n ",
"1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 2",
"1 <= coord[0] - 1 and coord[0] + 1 <= H",
"1 <= coord[0] - 1",
"1",
"coord[0] - 1",
"coord[0]",
"coord",
"0",
"1",
"coord[0] + 1 <= H",
"coord[0] + 1",
"coord[0]",
"coord",
"0",
"1",
"H",
"1 <= coord[1] - 2",
"1",
"coord[1] - 2",
"coord[1]",
"coord",
"1",
"2",
"square_count[(coord[0] - 1, coord[1] - 2)] += 1",
"square_count[(coord[0] - 1, coord[1] - 2)]",
"square_count",
"(coord[0] - 1, coord[1] - 2)",
"coord[0] - 1",
"coord[0]",
"coord",
"0",
"1",
"coord[1] - 2",
"coord[1]",
"coord",
"1",
"2",
"1",
"if 1 <= coord[0] - 2 and coord[1] + 2 <= W:\n square_count[(coord[0] - 2, coord[1])] += 1\n ",
"1 <= coord[0] - 2 and coord[1] + 2 <= W",
"1 <= coord[0] - 2",
"1",
"coord[0] - 2",
"coord[0]",
"coord",
"0",
"2",
"coord[1] + 2 <= W",
"coord[1] + 2",
"coord[1]",
"coord",
"1",
"2",
"W",
"square_count[(coord[0] - 2, coord[1])] += 1",
"square_count[(coord[0] - 2, coord[1])]",
"square_count",
"(coord[0] - 2, coord[1])",
"coord[0] - 2",
"coord[0]",
"coord",
"0",
"2",
"coord[1]",
"coord",
"1",
"1",
"if 1 <= coord[0] - 2 and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0] - 2, coord[1] - 1)] += 1\n ",
"1 <= coord[0] - 2 and 1 <= coord[1] - 1 and coord[1] + 1 <= W",
"1 <= coord[0] - 2 and 1 <= coord[1] - 1",
"1 <= coord[0] - 2",
"1",
"coord[0] - 2",
"coord[0]",
"coord",
"0",
"2",
"1 <= coord[1] - 1",
"1",
"coord[1] - 1",
"coord[1]",
"coord",
"1",
"1",
"coord[1] + 1 <= W",
"coord[1] + 1",
"coord[1]",
"coord",
"1",
"1",
"W",
"square_count[(coord[0] - 2, coord[1] - 1)] += 1",
"square_count[(coord[0] - 2, coord[1] - 1)]",
"square_count",
"(coord[0] - 2, coord[1] - 1)",
"coord[0] - 2",
"coord[0]",
"coord",
"0",
"2",
"coord[1] - 1",
"coord[1]",
"coord",
"1",
"1",
"1",
"if 1 <= coord[0] - 2 and 1 <= coord[1] - 2:\n square_count[(coord[0] - 2, coord[1] - 2)] += 1\n # remove duplicated counts\n ",
"1 <= coord[0] - 2 and 1 <= coord[1] - 2",
"1 <= coord[0] - 2",
"1",
"coord[0] - 2",
"coord[0]",
"coord",
"0",
"2",
"1 <= coord[1] - 2",
"1",
"coord[1] - 2",
"coord[1]",
"coord",
"1",
"2",
"square_count[(coord[0] - 2, coord[1] - 2)] += 1",
"square_count[(coord[0] - 2, coord[1] - 2)]",
"square_count",
"(coord[0] - 2, coord[1] - 2)",
"coord[0] - 2",
"coord[0]",
"coord",
"0",
"2",
"coord[1] - 2",
"coord[1]",
"coord",
"1",
"2",
"1",
"count = defaultdict(int)",
"count",
"defaultdict(int)",
"defaultdict",
"int",
"for v in square_count.values():\n count[v] += 1\n ",
"v",
"square_count.values()",
"square_count.values",
"square_count",
"values",
"count[v] += 1",
"count[v]",
"count",
"v",
"1",
"count_white_only = (H - 2) * (W - 2) - sum(count.values())",
"count_white_only",
"(H - 2) * (W - 2) - sum(count.values())",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(count.values())",
"sum",
"count.values()",
"count.values",
"count",
"values",
"count[0] = count_white_only",
"count[0]",
"count",
"0",
"count_white_only",
"for c in range(0, 10):\n print(count[c])",
"c",
"range(0, 10)",
"range",
"0",
"10",
"print(count[c])",
"print",
"count[c]",
"count",
"c",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n H, W, N = list(map(int, input().split(' ')))\n coord_list = [list(map(int, input().split(' '))) for _ in range(N)]\n # count squares (key: coord of top left cell, value: number of appearance)\n square_count = defaultdict(int)\n for coord in coord_list:\n coord = tuple(coord)\n # black cell is located on the top row\n if coord[0] + 2 <= H and coord[1] + 2 <= W:\n square_count[coord] += 1\n if coord[0] + 2 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0], coord[1] - 1)] += 1\n if coord[0] + 2 <= H and 1 <= coord[1] - 2:\n square_count[(coord[0], coord[1] - 2)] += 1\n # black cell is located in the middle row\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and coord[1] + 2 <= W:\n square_count[(coord[0] - 1, coord[1])] += 1\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0] - 1, coord[1] - 1)] += 1\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 2:\n square_count[(coord[0] - 1, coord[1] - 2)] += 1\n # black cell is located on the bottom row\n if 1 <= coord[0] - 2 and coord[1] + 2 <= W:\n square_count[(coord[0] - 2, coord[1])] += 1\n if 1 <= coord[0] - 2 and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0] - 2, coord[1] - 1)] += 1\n if 1 <= coord[0] - 2 and 1 <= coord[1] - 2:\n square_count[(coord[0] - 2, coord[1] - 2)] += 1\n # remove duplicated counts\n count = defaultdict(int) # key: number of black cells, value: number of squares\n for v in square_count.values():\n count[v] += 1\n count_white_only = (H - 2) * (W - 2) - sum(count.values())\n count[0] = count_white_only\n # print answer\n for c in range(0, 10):\n print(count[c])",
"def main():\n H, W, N = list(map(int, input().split(' ')))\n coord_list = [list(map(int, input().split(' '))) for _ in range(N)]\n # count squares (key: coord of top left cell, value: number of appearance)\n square_count = defaultdict(int)\n for coord in coord_list:\n coord = tuple(coord)\n # black cell is located on the top row\n if coord[0] + 2 <= H and coord[1] + 2 <= W:\n square_count[coord] += 1\n if coord[0] + 2 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0], coord[1] - 1)] += 1\n if coord[0] + 2 <= H and 1 <= coord[1] - 2:\n square_count[(coord[0], coord[1] - 2)] += 1\n # black cell is located in the middle row\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and coord[1] + 2 <= W:\n square_count[(coord[0] - 1, coord[1])] += 1\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0] - 1, coord[1] - 1)] += 1\n if 1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 2:\n square_count[(coord[0] - 1, coord[1] - 2)] += 1\n # black cell is located on the bottom row\n if 1 <= coord[0] - 2 and coord[1] + 2 <= W:\n square_count[(coord[0] - 2, coord[1])] += 1\n if 1 <= coord[0] - 2 and 1 <= coord[1] - 1 and coord[1] + 1 <= W:\n square_count[(coord[0] - 2, coord[1] - 1)] += 1\n if 1 <= coord[0] - 2 and 1 <= coord[1] - 2:\n square_count[(coord[0] - 2, coord[1] - 2)] += 1\n # remove duplicated counts\n count = defaultdict(int) # key: number of black cells, value: number of squares\n for v in square_count.values():\n count[v] += 1\n count_white_only = (H - 2) * (W - 2) - sum(count.values())\n count[0] = count_white_only\n # print answer\n for c in range(0, 10):\n print(count[c])",
"main"
] | from collections import defaultdict
def main():
H, W, N = list(map(int, input().split(' ')))
coord_list = [list(map(int, input().split(' '))) for _ in range(N)]
# count squares (key: coord of top left cell, value: number of appearance)
square_count = defaultdict(int)
for coord in coord_list:
coord = tuple(coord)
# black cell is located on the top row
if coord[0] + 2 <= H and coord[1] + 2 <= W:
square_count[coord] += 1
if coord[0] + 2 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W:
square_count[(coord[0], coord[1] - 1)] += 1
if coord[0] + 2 <= H and 1 <= coord[1] - 2:
square_count[(coord[0], coord[1] - 2)] += 1
# black cell is located in the middle row
if 1 <= coord[0] - 1 and coord[0] + 1 <= H and coord[1] + 2 <= W:
square_count[(coord[0] - 1, coord[1])] += 1
if 1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 1 and coord[1] + 1 <= W:
square_count[(coord[0] - 1, coord[1] - 1)] += 1
if 1 <= coord[0] - 1 and coord[0] + 1 <= H and 1 <= coord[1] - 2:
square_count[(coord[0] - 1, coord[1] - 2)] += 1
# black cell is located on the bottom row
if 1 <= coord[0] - 2 and coord[1] + 2 <= W:
square_count[(coord[0] - 2, coord[1])] += 1
if 1 <= coord[0] - 2 and 1 <= coord[1] - 1 and coord[1] + 1 <= W:
square_count[(coord[0] - 2, coord[1] - 1)] += 1
if 1 <= coord[0] - 2 and 1 <= coord[1] - 2:
square_count[(coord[0] - 2, coord[1] - 2)] += 1
# remove duplicated counts
count = defaultdict(int) # key: number of black cells, value: number of squares
for v in square_count.values():
count[v] += 1
count_white_only = (H - 2) * (W - 2) - sum(count.values())
count[0] = count_white_only
# print answer
for c in range(0, 10):
print(count[c])
if __name__ == '__main__':
main()
|
[
7,
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,
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,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
39,
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,
41,
28,
13,
4,
13,
17,
17,
4,
18,
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,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13
] | [
[
157,
2
],
[
157,
11
],
[
157,
12
],
[
163,
15
],
[
21,
20
],
[
146,
23
],
[
151,
25
],
[
151,
34
],
[
160,
36
],
[
142,
39
],
[
43,
42
],
[
161,
46
],
[
149,
46
],
[
161,
49
],
[
149,
49
],
[
53,
52
],
[
143,
56
],
[
152,
56
],
[
143,
59
],
[
152,
59
],
[
42,
66
],
[
140,
68
],
[
52,
73
],
[
158,
75
],
[
83,
78
],
[
164,
79
],
[
87,
86
],
[
154,
93
],
[
97,
96
],
[
164,
99
],
[
105,
102
],
[
155,
103
],
[
96,
104
],
[
109,
108
],
[
102,
114
],
[
155,
115
],
[
108,
116
],
[
121,
118
],
[
155,
119
],
[
140,
124
],
[
158,
127
],
[
134,
133
],
[
155,
133
],
[
133,
137
],
[
157,
140
],
[
142,
143
],
[
157,
146
],
[
151,
149
],
[
151,
152
],
[
154,
155
],
[
157,
158
],
[
160,
161
],
[
163,
164
]
] | [
"h,w,n = map(int,input().split())\n\nfrom collections import defaultdict\ndic = defaultdict(int)\nfor _ in range(n):\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n for aa in range(a-1, a+2):\n for bb in range(b-1, b+2):\n if 1 <= aa <= h-2 and 1 <= bb <= w-2:\n dic[(aa,bb)] += 1\nans = [0 for i in range(10)]\nfor i in dic.values():\n ans[i] += 1\n\nans[0] = (h-2)*(w-2) - sum([ans[i] for i in range(1,10)])\n\nfor anss in ans:\n print(anss)",
"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",
"dic = defaultdict(int)",
"dic",
"defaultdict(int)",
"defaultdict",
"int",
"for _ in range(n):\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n for aa in range(a-1, a+2):\n for bb in range(b-1, b+2):\n if 1 <= aa <= h-2 and 1 <= bb <= w-2:\n dic[(aa,bb)] += 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 -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for aa in range(a-1, a+2):\n for bb in range(b-1, b+2):\n if 1 <= aa <= h-2 and 1 <= bb <= w-2:\n dic[(aa,bb)] += 1",
"aa",
"range(a-1, a+2)",
"range",
"a-1",
"a",
"1",
"a+2",
"a",
"2",
"for bb in range(b-1, b+2):\n if 1 <= aa <= h-2 and 1 <= bb <= w-2:\n dic[(aa,bb)] += 1",
"bb",
"range(b-1, b+2)",
"range",
"b-1",
"b",
"1",
"b+2",
"b",
"2",
"if 1 <= aa <= h-2 and 1 <= bb <= w-2:\n dic[(aa,bb)] += 1",
"1 <= aa <= h-2 and 1 <= bb <= w-2",
"1 <= aa <= h-2",
"1 <= aa",
"1",
"aa",
"h-2",
"h",
"2",
"1 <= bb <= w-2",
"1 <= bb",
"1",
"bb",
"w-2",
"w",
"2",
"dic[(aa,bb)] += 1",
"dic[(aa,bb)]",
"dic",
"(aa,bb)",
"aa",
"bb",
"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 i in dic.values():\n ans[i] += 1",
"i",
"dic.values()",
"dic.values",
"dic",
"values",
"ans[i] += 1",
"ans[i]",
"ans",
"i",
"1",
"ans[i] 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)",
"ans[i]",
"ans",
"i",
"ans[0] = (h-2)*(w-2) - sum([ans[i] for i in range(1,10)])",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2) - sum([ans[i] for i in range(1,10)])",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum([ans[i] for i in range(1,10)])",
"sum",
"[ans[i] for i in range(1,10)]",
"for anss in ans:\n print(anss)",
"anss",
"ans",
"print(anss)",
"print",
"anss",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h",
"b -= 1",
"1",
"b",
"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",
"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 -= 1",
"1",
"a",
"dic = defaultdict(int)",
"defaultdict(int)",
"dic"
] | h,w,n = map(int,input().split())
from collections import defaultdict
dic = defaultdict(int)
for _ in range(n):
a,b = map(int,input().split())
a -= 1
b -= 1
for aa in range(a-1, a+2):
for bb in range(b-1, b+2):
if 1 <= aa <= h-2 and 1 <= bb <= w-2:
dic[(aa,bb)] += 1
ans = [0 for i in range(10)]
for i in dic.values():
ans[i] += 1
ans[0] = (h-2)*(w-2) - sum([ans[i] for i in range(1,10)])
for anss in ans:
print(anss) |
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
13,
13,
0,
13,
4,
18,
13,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
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,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
0,
13,
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,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13
] | [
[
134,
4
],
[
134,
14
],
[
134,
15
],
[
140,
17
],
[
25,
24
],
[
132,
27
],
[
149,
29
],
[
149,
39
],
[
42,
41
],
[
47,
46
],
[
150,
56
],
[
41,
57
],
[
129,
59
],
[
138,
65
],
[
46,
66
],
[
135,
68
],
[
80,
71
],
[
141,
72
],
[
150,
75
],
[
41,
76
],
[
138,
78
],
[
46,
79
],
[
84,
83
],
[
143,
90
],
[
146,
93
],
[
97,
96
],
[
141,
99
],
[
105,
102
],
[
144,
103
],
[
96,
104
],
[
110,
107
],
[
144,
108
],
[
129,
113
],
[
135,
116
],
[
144,
120
],
[
123,
122
],
[
144,
122
],
[
122,
126
],
[
134,
129
],
[
134,
132
],
[
134,
135
],
[
149,
138
],
[
140,
141
],
[
143,
144
],
[
146,
147
],
[
149,
150
]
] | [
"# -*- coding: utf-8 -*-\n\n\n#\nimport collections\nH, W, N = map(int, input().split(' '))\n\npoint_frq_dict = collections.defaultdict(int)\nfor _ in range(N):\n a, b = map(int, input().split(' '))\n for i in range(3):\n for j in range(3):\n if 0 < a-i < H-1 and 0 < b-j < W-1:\n point_frq_dict[(a-i, b-j)] += 1\n\nans = [0 for _ in range(10)]\nn = 0\nfor frq in point_frq_dict.values():\n ans[frq] += 1\n\nans[0] = (H-2)*(W-2) - sum(ans)\nfor a in ans:\n print(a)\n",
"import collections",
"collections",
"H, W, N = map(int, input().split(' '))",
"H",
"map(int, input().split(' '))",
"map",
"int",
"input().split(' ')",
"().split",
"()",
"input",
"split",
"' '",
"W",
"N",
"point_frq_dict = collections.defaultdict(int)",
"point_frq_dict",
"collections.defaultdict(int)",
"collections.defaultdict",
"collections",
"defaultdict",
"int",
"for _ in range(N):\n a, b = map(int, input().split(' '))\n for i in range(3):\n for j in range(3):\n if 0 < a-i < H-1 and 0 < b-j < W-1:\n point_frq_dict[(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(3):\n for j in range(3):\n if 0 < a-i < H-1 and 0 < b-j < W-1:\n point_frq_dict[(a-i, b-j)] += 1",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n if 0 < a-i < H-1 and 0 < b-j < W-1:\n point_frq_dict[(a-i, b-j)] += 1",
"j",
"range(3)",
"range",
"3",
"if 0 < a-i < H-1 and 0 < b-j < W-1:\n point_frq_dict[(a-i, b-j)] += 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",
"point_frq_dict[(a-i, b-j)] += 1",
"point_frq_dict[(a-i, b-j)]",
"point_frq_dict",
"(a-i, b-j)",
"a-i",
"a",
"i",
"b-j",
"b",
"j",
"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)]",
"n = 0",
"n",
"0",
"for frq in point_frq_dict.values():\n ans[frq] += 1",
"frq",
"point_frq_dict.values()",
"point_frq_dict.values",
"point_frq_dict",
"values",
"ans[frq] += 1",
"ans[frq]",
"ans",
"frq",
"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",
"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",
"b = map(int, input().split(' '))",
"map(int, input().split(' '))",
"b",
"point_frq_dict = collections.defaultdict(int)",
"collections.defaultdict(int)",
"point_frq_dict",
"ans = [0 for _ in range(10)]",
"[0 for _ in range(10)]",
"ans",
"n = 0",
"0",
"n",
"a, b = map(int, input().split(' '))",
"map(int, input().split(' '))",
"a"
] | # -*- coding: utf-8 -*-
#
import collections
H, W, N = map(int, input().split(' '))
point_frq_dict = collections.defaultdict(int)
for _ in range(N):
a, b = map(int, input().split(' '))
for i in range(3):
for j in range(3):
if 0 < a-i < H-1 and 0 < b-j < W-1:
point_frq_dict[(a-i, b-j)] += 1
ans = [0 for _ in range(10)]
n = 0
for frq in point_frq_dict.values():
ans[frq] += 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,
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,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
13,
14,
2,
40,
40,
17,
2,
13,
18,
13,
17,
2,
13,
17,
40,
40,
17,
2,
13,
18,
13,
17,
2,
13,
17,
0,
13,
39,
2,
13,
18,
13,
17,
2,
13,
18,
13,
17,
14,
2,
13,
13,
0,
18,
13,
13,
2,
18,
13,
13,
17,
0,
18,
13,
13,
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,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13
] | [
[
173,
2
],
[
173,
11
],
[
173,
12
],
[
155,
14
],
[
167,
44
],
[
48,
47
],
[
171,
50
],
[
176,
52
],
[
176,
61
],
[
64,
63
],
[
156,
63
],
[
177,
71
],
[
63,
73
],
[
159,
76
],
[
162,
82
],
[
63,
84
],
[
174,
87
],
[
179,
90
],
[
177,
93
],
[
63,
95
],
[
162,
98
],
[
63,
100
],
[
180,
104
],
[
168,
105
],
[
110,
107
],
[
168,
108
],
[
180,
109
],
[
116,
111
],
[
107,
111
],
[
168,
112
],
[
180,
113
],
[
119,
116
],
[
168,
117
],
[
180,
118
],
[
164,
121
],
[
168,
126
],
[
159,
133
],
[
174,
136
],
[
165,
140
],
[
143,
142
],
[
165,
151
],
[
142,
153
],
[
155,
156
],
[
173,
159
],
[
176,
162
],
[
164,
165
],
[
167,
168
],
[
173,
171
],
[
173,
174
],
[
176,
177
],
[
179,
180
]
] | [
"H,W,N=map(int,input().split())\ndirec=[[0,0],[-1,0],[-2,0],[0,-1],[-1,-1],[-2,-1],[0,-2],[-1,-2],[-2,-2]]\ndic={}\nfor i in range(N):\n h,w=map(int,input().split())\n for d in direc:\n if 1<=h+d[0]<=(H-2) and 1<=w+d[1]<=(W-2):\n l=(h+d[0],w+d[1])\n if l in dic:\n dic[l]=dic[l]+1\n else:\n dic[l]=1\nA=list(dic.values())\nprint((H-2)*(W-2)-len(A))\nfor i in range(1,10):\n print(A.count(i))",
"H,W,N=map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"direc=[[0,0],[-1,0],[-2,0],[0,-1],[-1,-1],[-2,-1],[0,-2],[-1,-2],[-2,-2]]",
"direc",
"[[0,0],[-1,0],[-2,0],[0,-1],[-1,-1],[-2,-1],[0,-2],[-1,-2],[-2,-2]]",
"[0,0]",
"0",
"0",
"[-1,0]",
"-1",
"0",
"[-2,0]",
"-2",
"0",
"[0,-1]",
"0",
"-1",
"[-1,-1]",
"-1",
"-1",
"[-2,-1]",
"-2",
"-1",
"[0,-2]",
"0",
"-2",
"[-1,-2]",
"-1",
"-2",
"[-2,-2]",
"-2",
"-2",
"dic={}",
"dic",
"{}",
"for i in range(N):\n h,w=map(int,input().split())\n for d in direc:\n if 1<=h+d[0]<=(H-2) and 1<=w+d[1]<=(W-2):\n l=(h+d[0],w+d[1])\n if l in dic:\n dic[l]=dic[l]+1\n else:\n dic[l]=1",
"i",
"range(N)",
"range",
"N",
"h,w=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"for d in direc:\n if 1<=h+d[0]<=(H-2) and 1<=w+d[1]<=(W-2):\n l=(h+d[0],w+d[1])\n if l in dic:\n dic[l]=dic[l]+1\n else:\n dic[l]=1",
"d",
"direc",
"if 1<=h+d[0]<=(H-2) and 1<=w+d[1]<=(W-2):\n l=(h+d[0],w+d[1])\n if l in dic:\n dic[l]=dic[l]+1\n else:\n dic[l]=1",
"1<=h+d[0]<=(H-2) and 1<=w+d[1]<=(W-2)",
"1<=h+d[0]<=(H-2)",
"1<=h+d[0]",
"1",
"h+d[0]",
"h",
"d[0]",
"d",
"0",
"H-2",
"H",
"2",
"1<=w+d[1]<=(W-2)",
"1<=w+d[1]",
"1",
"w+d[1]",
"w",
"d[1]",
"d",
"1",
"W-2",
"W",
"2",
"l=(h+d[0],w+d[1])",
"l",
"(h+d[0],w+d[1])",
"h+d[0]",
"h",
"d[0]",
"d",
"0",
"w+d[1]",
"w",
"d[1]",
"d",
"1",
"if l in dic:\n dic[l]=dic[l]+1\n else:\n dic[l]=1",
"l in dic",
"l",
"dic",
"dic[l]=dic[l]+1",
"dic[l]",
"dic",
"l",
"dic[l]+1",
"dic[l]",
"dic",
"l",
"1",
"dic[l]=1",
"dic[l]",
"dic",
"l",
"1",
"A=list(dic.values())",
"A",
"list(dic.values())",
"list",
"dic.values()",
"dic.values",
"dic",
"values",
"print((H-2)*(W-2)-len(A))",
"print",
"(H-2)*(W-2)-len(A)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"len(A)",
"len",
"A",
"for i in range(1,10):\n print(A.count(i))",
"i",
"range(1,10)",
"range",
"1",
"10",
"print(A.count(i))",
"print",
"A.count(i)",
"A.count",
"A",
"count",
"i",
"direc=[[0,0],[-1,0],[-2,0],[0,-1],[-1,-1],[-2,-1],[0,-2],[-1,-2],[-2,-2]]",
"[[0,0],[-1,0],[-2,0],[0,-1],[-1,-1],[-2,-1],[0,-2],[-1,-2],[-2,-2]]",
"direc",
"H,W,N=map(int,input().split())",
"map(int,input().split())",
"H",
"w=map(int,input().split())",
"map(int,input().split())",
"w",
"A=list(dic.values())",
"list(dic.values())",
"A",
"dic={}",
"{}",
"dic",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"W,N=map(int,input().split())",
"map(int,input().split())",
"W",
"h,w=map(int,input().split())",
"map(int,input().split())",
"h",
"l=(h+d[0],w+d[1])",
"(h+d[0],w+d[1])",
"l"
] | H,W,N=map(int,input().split())
direc=[[0,0],[-1,0],[-2,0],[0,-1],[-1,-1],[-2,-1],[0,-2],[-1,-2],[-2,-2]]
dic={}
for i in range(N):
h,w=map(int,input().split())
for d in direc:
if 1<=h+d[0]<=(H-2) and 1<=w+d[1]<=(W-2):
l=(h+d[0],w+d[1])
if l in dic:
dic[l]=dic[l]+1
else:
dic[l]=1
A=list(dic.values())
print((H-2)*(W-2)-len(A))
for i in range(1,10):
print(A.count(i)) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
17,
14,
2,
13,
17,
4,
13,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
17,
4,
13,
17,
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,
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,
14,
2,
39,
13,
13,
13,
0,
18,
13,
39,
13,
13,
17,
0,
18,
13,
39,
13,
13,
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,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] | [
[
175,
2
],
[
175,
11
],
[
175,
12
],
[
166,
14
],
[
178,
20
],
[
176,
24
],
[
164,
30
],
[
173,
33
],
[
37,
36
],
[
47,
46
],
[
176,
49
],
[
160,
51
],
[
160,
60
],
[
169,
62
],
[
181,
65
],
[
69,
68
],
[
182,
75
],
[
161,
75
],
[
164,
80
],
[
182,
83
],
[
161,
83
],
[
87,
86
],
[
170,
93
],
[
158,
93
],
[
173,
98
],
[
170,
101
],
[
158,
101
],
[
179,
108
],
[
115,
110
],
[
179,
111
],
[
122,
117
],
[
179,
118
],
[
127,
124
],
[
167,
125
],
[
173,
129
],
[
164,
132
],
[
136,
135
],
[
179,
138
],
[
144,
141
],
[
167,
142
],
[
149,
146
],
[
167,
147
],
[
135,
148
],
[
152,
151
],
[
167,
151
],
[
151,
155
],
[
160,
158
],
[
160,
161
],
[
175,
164
],
[
166,
167
],
[
169,
170
],
[
175,
173
],
[
175,
176
],
[
178,
179
],
[
181,
182
]
] | [
"h,w,n=map(int,input().split())\njl=[0]*10\ncnt={}\nif n==0:\n print((w-2)*(h-2))\n for i in range(9):\n print(0)\n exit()\nfor i in range(n):\n a,b=map(int,input().split())\n a-=1\n b-=1\n for j in range(max(0,b-2),min(w-2,b+1)):\n for k in range(max(0,a-2),min(h-2,a+1)):\n if (k, j) in cnt:\n cnt[(k, j)]+=1\n else:\n cnt[(k, j)]=1\njl[0]=(h-2)*(w-2)\nfor i in cnt.values():\n jl[0]-=1\n jl[i]+=1\nfor i in jl:\n print(i)",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"jl=[0]*10",
"jl",
"[0]*10",
"[0]",
"0",
"10",
"cnt={}",
"cnt",
"{}",
"if n==0:\n print((w-2)*(h-2))\n for i in range(9):\n print(0)\n exit()",
"n==0",
"n",
"0",
"print((w-2)*(h-2))",
"print",
"(w-2)*(h-2)",
"w-2",
"w",
"2",
"h-2",
"h",
"2",
"for i in range(9):\n print(0)\n ",
"i",
"range(9)",
"range",
"9",
"print(0)",
"print",
"0",
"exit()",
"exit",
"for i in range(n):\n a,b=map(int,input().split())\n a-=1\n b-=1\n for j in range(max(0,b-2),min(w-2,b+1)):\n for k in range(max(0,a-2),min(h-2,a+1)):\n if (k, j) in cnt:\n cnt[(k, j)]+=1\n else:\n cnt[(k, 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 j in range(max(0,b-2),min(w-2,b+1)):\n for k in range(max(0,a-2),min(h-2,a+1)):\n if (k, j) in cnt:\n cnt[(k, j)]+=1\n else:\n cnt[(k, 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",
"for k in range(max(0,a-2),min(h-2,a+1)):\n if (k, j) in cnt:\n cnt[(k, j)]+=1\n else:\n cnt[(k, j)]=1",
"k",
"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",
"if (k, j) in cnt:\n cnt[(k, j)]+=1\n else:\n cnt[(k, j)]=1",
"(k, j) in cnt",
"(k, j)",
"k",
"j",
"cnt",
"cnt[(k, j)]+=1",
"cnt[(k, j)]",
"cnt",
"(k, j)",
"k",
"j",
"1",
"cnt[(k, j)]=1",
"cnt[(k, j)]",
"cnt",
"(k, j)",
"k",
"j",
"1",
"jl[0]=(h-2)*(w-2)",
"jl[0]",
"jl",
"0",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"for i in cnt.values():\n jl[0]-=1\n jl[i]+=1",
"i",
"cnt.values()",
"cnt.values",
"cnt",
"values",
"jl[0]-=1",
"jl[0]",
"jl",
"0",
"1",
"jl[i]+=1",
"jl[i]",
"jl",
"i",
"1",
"for i in jl:\n print(i)",
"i",
"jl",
"print(i)",
"print",
"i",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"jl=[0]*10",
"[0]*10",
"jl",
"a-=1",
"1",
"a",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"cnt={}",
"{}",
"cnt",
"b-=1",
"1",
"b"
] | h,w,n=map(int,input().split())
jl=[0]*10
cnt={}
if n==0:
print((w-2)*(h-2))
for i in range(9):
print(0)
exit()
for i in range(n):
a,b=map(int,input().split())
a-=1
b-=1
for j in range(max(0,b-2),min(w-2,b+1)):
for k in range(max(0,a-2),min(h-2,a+1)):
if (k, j) in cnt:
cnt[(k, j)]+=1
else:
cnt[(k, j)]=1
jl[0]=(h-2)*(w-2)
for i in cnt.values():
jl[0]-=1
jl[i]+=1
for i in jl:
print(i) |
[
7,
15,
15,
13,
0,
13,
18,
18,
18,
13,
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,
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,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] | [
[
162,
5
],
[
168,
14
],
[
163,
21
],
[
168,
23
],
[
168,
24
],
[
153,
26
],
[
32,
31
],
[
169,
34
],
[
171,
36
],
[
163,
43
],
[
171,
45
],
[
48,
47
],
[
172,
56
],
[
47,
57
],
[
172,
63
],
[
47,
64
],
[
157,
67
],
[
72,
71
],
[
160,
80
],
[
71,
82
],
[
160,
87
],
[
71,
89
],
[
166,
91
],
[
108,
95
],
[
154,
96
],
[
172,
100
],
[
47,
102
],
[
160,
105
],
[
71,
107
],
[
174,
110
],
[
154,
120
],
[
126,
123
],
[
175,
124
],
[
131,
128
],
[
175,
129
],
[
157,
134
],
[
166,
137
],
[
175,
142
],
[
175,
148
],
[
151,
150
],
[
153,
154
],
[
168,
157
],
[
171,
160
],
[
162,
163
],
[
168,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
]
] | [
"from collections import defaultdict\nimport sys\n\ninput = sys.stdin.buffer.readline\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",
"import sys",
"sys",
"input = sys.stdin.buffer.readline",
"input",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"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\"",
"count = defaultdict(int)",
"defaultdict(int)",
"count",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"input = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"input",
"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",
"ans = [0] * 10",
"[0] * 10",
"ans"
] | from collections import defaultdict
import sys
input = sys.stdin.buffer.readline
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,
12,
13,
41,
14,
40,
40,
17,
13,
2,
13,
17,
14,
40,
40,
17,
13,
2,
13,
17,
4,
18,
13,
13,
39,
13,
13,
23,
13,
23,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
28,
13,
4,
13,
17,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
4,
13,
2,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
13,
4,
13,
2,
13,
17,
2,
13,
17,
4,
13,
13,
2,
13,
17,
4,
13,
13,
13,
4,
13,
13,
2,
13,
17,
4,
13,
2,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
13,
4,
13,
2,
13,
17,
2,
13,
17,
4,
18,
13,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
2,
2,
13,
18,
18,
13,
13,
17,
2,
13,
18,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
17,
0,
13,
17,
0,
18,
13,
13,
17,
0,
13,
18,
18,
13,
13,
17,
0,
13,
18,
18,
13,
13,
17,
28,
13,
4,
13,
17,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
12,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13
] | [
[
28,
8
],
[
30,
16
],
[
28,
28
],
[
30,
30
],
[
262,
32
],
[
262,
41
],
[
262,
42
],
[
238,
44
],
[
48,
47
],
[
263,
51
],
[
268,
53
],
[
268,
62
],
[
242,
64
],
[
269,
66
],
[
236,
69
],
[
242,
72
],
[
269,
74
],
[
236,
76
],
[
242,
78
],
[
269,
80
],
[
236,
83
],
[
242,
86
],
[
269,
87
],
[
236,
89
],
[
242,
92
],
[
269,
93
],
[
236,
94
],
[
242,
96
],
[
269,
97
],
[
236,
99
],
[
242,
102
],
[
269,
104
],
[
236,
107
],
[
242,
110
],
[
269,
112
],
[
236,
114
],
[
242,
116
],
[
269,
118
],
[
236,
121
],
[
239,
125
],
[
256,
128
],
[
137,
134
],
[
257,
135
],
[
233,
139
],
[
230,
142
],
[
259,
145
],
[
247,
148
],
[
250,
151
],
[
155,
154
],
[
239,
160
],
[
260,
164
],
[
254,
164
],
[
239,
167
],
[
154,
168
],
[
248,
171
],
[
266,
171
],
[
239,
174
],
[
154,
175
],
[
181,
178
],
[
257,
179
],
[
251,
180
],
[
245,
180
],
[
272,
180
],
[
271,
183
],
[
189,
186
],
[
257,
187
],
[
272,
188
],
[
251,
188
],
[
245,
188
],
[
194,
191
],
[
257,
192
],
[
244,
196
],
[
202,
199
],
[
257,
200
],
[
245,
201
],
[
251,
201
],
[
272,
201
],
[
253,
204
],
[
239,
207
],
[
154,
208
],
[
265,
211
],
[
239,
214
],
[
154,
215
],
[
219,
218
],
[
257,
226
],
[
218,
227
],
[
262,
230
],
[
262,
233
],
[
268,
236
],
[
238,
239
],
[
244,
245
],
[
247,
248
],
[
250,
251
],
[
253,
254
],
[
256,
257
],
[
259,
260
],
[
262,
263
],
[
265,
266
],
[
268,
269
],
[
271,
272
]
] | [
"def add_memo(tate,yoko):\n global memo\n if 2 <= tate <= h-1:\n if 2 <= yoko <= w-1:\n memo.append([tate,yoko])\n\nh,w,n = map(int,input().split())\n#print(s)\nmemo = []\nfor i in range(0,n):\n x,y = map(int,input().split())\n add_memo(x-1,y-1)\n add_memo(x-1,y)\n add_memo(x-1,y+1)\n add_memo(x,y-1)\n add_memo(x,y)\n add_memo(x,y+1)\n add_memo(x+1,y-1)\n add_memo(x+1,y)\n add_memo(x+1,y+1)\n\nmemo.sort()\nans = [0] * 10\nans[0] = (h-2)*(w-2)\ntmp_x = 0\ntmp_y = 0\ncount = 0\nfor i in range(0,len(memo)):\n if tmp_x == memo[i][0] and tmp_y == memo[i][1]:\n ans[count] -= 1\n count += 1\n ans[count] += 1\n else:\n ans[0] -= 1\n count = 1\n ans[count] += 1\n tmp_x = memo[i][0]\n tmp_y = memo[i][1]\n# print(memo[i],count)\n\nfor i in range(0,10):\n print(ans[i])",
"def add_memo(tate,yoko):\n global memo\n if 2 <= tate <= h-1:\n if 2 <= yoko <= w-1:\n memo.append([tate,yoko])",
"add_memo",
"global memo",
"if 2 <= tate <= h-1:\n if 2 <= yoko <= w-1:\n memo.append([tate,yoko])",
"2 <= tate <= h-1",
"2 <= tate",
"2",
"tate",
"h-1",
"h",
"1",
"if 2 <= yoko <= w-1:\n memo.append([tate,yoko])",
"2 <= yoko <= w-1",
"2 <= yoko",
"2",
"yoko",
"w-1",
"w",
"1",
"memo.append([tate,yoko])",
"memo.append",
"memo",
"append",
"[tate,yoko]",
"tate",
"yoko",
"tate",
"tate",
"yoko",
"yoko",
"h,w,n = map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"memo = []",
"memo",
"[]",
"for i in range(0,n):\n x,y = map(int,input().split())\n add_memo(x-1,y-1)\n add_memo(x-1,y)\n add_memo(x-1,y+1)\n add_memo(x,y-1)\n add_memo(x,y)\n add_memo(x,y+1)\n add_memo(x+1,y-1)\n add_memo(x+1,y)\n add_memo(x+1,y+1)",
"i",
"range(0,n)",
"range",
"0",
"n",
"x,y = map(int,input().split())",
"x",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"add_memo(x-1,y-1)",
"add_memo",
"x-1",
"x",
"1",
"y-1",
"y",
"1",
"add_memo(x-1,y)",
"add_memo",
"x-1",
"x",
"1",
"y",
"add_memo(x-1,y+1)",
"add_memo",
"x-1",
"x",
"1",
"y+1",
"y",
"1",
"add_memo(x,y-1)",
"add_memo",
"x",
"y-1",
"y",
"1",
"add_memo(x,y)",
"add_memo",
"x",
"y",
"add_memo(x,y+1)",
"add_memo",
"x",
"y+1",
"y",
"1",
"add_memo(x+1,y-1)",
"add_memo",
"x+1",
"x",
"1",
"y-1",
"y",
"1",
"add_memo(x+1,y)",
"add_memo",
"x+1",
"x",
"1",
"y",
"add_memo(x+1,y+1)",
"add_memo",
"x+1",
"x",
"1",
"y+1",
"y",
"1",
"memo.sort()",
"memo.sort",
"memo",
"sort",
"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",
"tmp_x = 0",
"tmp_x",
"0",
"tmp_y = 0",
"tmp_y",
"0",
"count = 0",
"count",
"0",
"for i in range(0,len(memo)):\n if tmp_x == memo[i][0] and tmp_y == memo[i][1]:\n ans[count] -= 1\n count += 1\n ans[count] += 1\n else:\n ans[0] -= 1\n count = 1\n ans[count] += 1\n tmp_x = memo[i][0]\n tmp_y = memo[i][1]\n# print(memo[i],count)",
"i",
"range(0,len(memo))",
"range",
"0",
"len(memo)",
"len",
"memo",
"if tmp_x == memo[i][0] and tmp_y == memo[i][1]:\n ans[count] -= 1\n count += 1\n ans[count] += 1\n else:\n ans[0] -= 1\n count = 1\n ans[count] += 1\n ",
"tmp_x == memo[i][0] and tmp_y == memo[i][1]",
"tmp_x == memo[i][0]",
"tmp_x",
"memo[i][0]",
"[i]",
"memo",
"i",
"0",
"tmp_y == memo[i][1]",
"tmp_y",
"memo[i][1]",
"[i]",
"memo",
"i",
"1",
"ans[count] -= 1",
"ans[count]",
"ans",
"count",
"1",
"count += 1",
"count",
"1",
"ans[count] += 1",
"ans[count]",
"ans",
"count",
"1",
"ans[0] -= 1",
"ans[0]",
"ans",
"0",
"1",
"count = 1",
"count",
"1",
"ans[count] += 1",
"ans[count]",
"ans",
"count",
"1",
"tmp_x = memo[i][0]",
"tmp_x",
"memo[i][0]",
"[i]",
"memo",
"i",
"0",
"tmp_y = memo[i][1]",
"tmp_y",
"memo[i][1]",
"[i]",
"memo",
"i",
"1",
"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",
"w,n = map(int,input().split())",
"map(int,input().split())",
"w",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h",
"y = map(int,input().split())",
"map(int,input().split())",
"y",
"memo = []",
"[]",
"memo",
"def add_memo(tate,yoko):\n global memo\n if 2 <= tate <= h-1:\n if 2 <= yoko <= w-1:\n memo.append([tate,yoko])",
"def add_memo(tate,yoko):\n global memo\n if 2 <= tate <= h-1:\n if 2 <= yoko <= w-1:\n memo.append([tate,yoko])",
"add_memo",
"count = 1",
"1",
"count",
"tmp_y = 0",
"0",
"tmp_y",
"count = 0",
"0",
"count",
"tmp_x = memo[i][0]",
"memo[i][0]",
"tmp_x",
"ans = [0] * 10",
"[0] * 10",
"ans",
"tmp_x = 0",
"0",
"tmp_x",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"tmp_y = memo[i][1]",
"memo[i][1]",
"tmp_y",
"x,y = map(int,input().split())",
"map(int,input().split())",
"x",
"count += 1",
"1",
"count"
] | def add_memo(tate,yoko):
global memo
if 2 <= tate <= h-1:
if 2 <= yoko <= w-1:
memo.append([tate,yoko])
h,w,n = map(int,input().split())
#print(s)
memo = []
for i in range(0,n):
x,y = map(int,input().split())
add_memo(x-1,y-1)
add_memo(x-1,y)
add_memo(x-1,y+1)
add_memo(x,y-1)
add_memo(x,y)
add_memo(x,y+1)
add_memo(x+1,y-1)
add_memo(x+1,y)
add_memo(x+1,y+1)
memo.sort()
ans = [0] * 10
ans[0] = (h-2)*(w-2)
tmp_x = 0
tmp_y = 0
count = 0
for i in range(0,len(memo)):
if tmp_x == memo[i][0] and tmp_y == memo[i][1]:
ans[count] -= 1
count += 1
ans[count] += 1
else:
ans[0] -= 1
count = 1
ans[count] += 1
tmp_x = memo[i][0]
tmp_y = memo[i][1]
# print(memo[i],count)
for i in range(0,10):
print(ans[i])
|
[
7,
15,
13,
13,
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,
12,
13,
41,
28,
13,
13,
4,
4,
13,
13,
29,
4,
13,
13,
23,
13,
0,
13,
17,
0,
13,
4,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
0,
13,
13,
28,
13,
13,
13,
28,
13,
4,
13,
2,
13,
17,
13,
28,
13,
4,
13,
2,
13,
17,
13,
14,
2,
2,
13,
17,
2,
13,
17,
9,
14,
2,
40,
2,
13,
17,
13,
40,
2,
13,
17,
13,
9,
14,
40,
2,
2,
2,
4,
13,
13,
17,
4,
13,
13,
13,
0,
18,
13,
2,
2,
4,
13,
13,
17,
4,
13,
13,
17,
0,
18,
13,
2,
2,
4,
13,
13,
17,
4,
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,
12,
13,
10,
2,
13,
10,
17,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
2,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
13,
13,
10,
4,
13
] | [
[
208,
26
],
[
214,
31
],
[
42,
41
],
[
52,
41
],
[
41,
46
],
[
52,
52
],
[
199,
54
],
[
229,
57
],
[
203,
59
],
[
229,
60
],
[
229,
61
],
[
65,
64
],
[
230,
67
],
[
221,
70
],
[
226,
72
],
[
80,
79
],
[
88,
87
],
[
79,
97
],
[
87,
100
],
[
79,
107
],
[
206,
109
],
[
87,
112
],
[
218,
114
],
[
79,
123
],
[
87,
127
],
[
200,
128
],
[
141,
130
],
[
200,
131
],
[
79,
136
],
[
87,
140
],
[
154,
143
],
[
200,
144
],
[
79,
149
],
[
87,
153
],
[
196,
156
],
[
163,
162
],
[
200,
162
],
[
170,
165
],
[
197,
166
],
[
200,
168
],
[
162,
169
],
[
175,
172
],
[
197,
173
],
[
206,
178
],
[
218,
181
],
[
197,
185
],
[
188,
187
],
[
197,
187
],
[
187,
191
],
[
196,
197
],
[
199,
200
],
[
229,
206
],
[
208,
209
],
[
214,
215
],
[
229,
218
],
[
226,
227
],
[
229,
230
]
] | [
"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\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\ndef sum_matrix(array):\n\treturn sum([sum(x) for x in array])\ncount = {}\nH, W, N = MAP()\nab = [LIST() for _ in range(N)]\nfor a, b in ab:\t\t\t\t\n\tfor i in range(a-3, a):\n\t\tfor j in range(b-3, b):\n\t\t\tif i < 0 or j < 0:\n\t\t\t\tcontinue\n\t\t\tif i+2 >= H or j+2 >= W:\n\t\t\t\tcontinue\n\t\t\telse:\n\t\t\t\tif not str(i)+\",\"+str(j) in count:\n\t\t\t\t\tcount[str(i)+\",\"+str(j)] = 1\n\t\t\t\telse:\n\t\t\t\t\tcount[str(i)+\",\"+str(j)] += 1\nans = [0] * 10\nfor key in count:\n\tans[count[key]] += 1\nans[0] = (H-2)*(W-2)-sum(ans)\nfor i in ans:\n\tprint(i)",
"import sys, re",
"sys",
"re",
"from collections import deque, defaultdict, Counter",
"from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians",
"from itertools import permutations, combinations, product",
"from operator import itemgetter, mul",
"from copy import deepcopy",
"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",
"def sum_matrix(array):\n\treturn sum([sum(x) for x in array])",
"sum_matrix",
"sum(x) for x in array",
"for x in array",
"x",
"array",
"for x in array",
"sum(x)",
"sum",
"x",
"return sum([sum(x) for x in array])",
"sum([sum(x) for x in array])",
"sum",
"[sum(x) for x in array]",
"array",
"array",
"count = {}",
"count",
"{}",
"H, W, N = MAP()",
"H",
"MAP()",
"MAP",
"W",
"N",
"LIST() for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"LIST()",
"LIST",
"ab = [LIST() for _ in range(N)]",
"ab",
"[LIST() for _ in range(N)]",
"for a, b in ab:\t\t\t\t\n\tfor i in range(a-3, a):\n\t\tfor j in range(b-3, b):\n\t\t\tif i < 0 or j < 0:\n\t\t\t\tcontinue\n\t\t\tif i+2 >= H or j+2 >= W:\n\t\t\t\tcontinue\n\t\t\telse:\n\t\t\t\tif not str(i)+\",\"+str(j) in count:\n\t\t\t\t\tcount[str(i)+\",\"+str(j)] = 1\n\t\t\t\telse:\n\t\t\t\t\tcount[str(i)+\",\"+str(j)] += 1",
"a",
"b",
"ab",
"for i in range(a-3, a):\n\t\tfor j in range(b-3, b):\n\t\t\tif i < 0 or j < 0:\n\t\t\t\tcontinue\n\t\t\tif i+2 >= H or j+2 >= W:\n\t\t\t\tcontinue\n\t\t\telse:\n\t\t\t\tif not str(i)+\",\"+str(j) in count:\n\t\t\t\t\tcount[str(i)+\",\"+str(j)] = 1\n\t\t\t\telse:\n\t\t\t\t\tcount[str(i)+\",\"+str(j)] += 1",
"i",
"range(a-3, a)",
"range",
"a-3",
"a",
"3",
"a",
"for j in range(b-3, b):\n\t\t\tif i < 0 or j < 0:\n\t\t\t\tcontinue\n\t\t\tif i+2 >= H or j+2 >= W:\n\t\t\t\tcontinue\n\t\t\telse:\n\t\t\t\tif not str(i)+\",\"+str(j) in count:\n\t\t\t\t\tcount[str(i)+\",\"+str(j)] = 1\n\t\t\t\telse:\n\t\t\t\t\tcount[str(i)+\",\"+str(j)] += 1",
"j",
"range(b-3, b)",
"range",
"b-3",
"b",
"3",
"b",
"if i < 0 or j < 0:\n\t\t\t\tcontinue\n\t\t\t",
"i < 0 or j < 0",
"i < 0",
"i",
"0",
"j < 0",
"j",
"0",
"continue",
"if i+2 >= H or j+2 >= W:\n\t\t\t\tcontinue\n\t\t\telse:\n\t\t\t\tif not str(i)+\",\"+str(j) in count:\n\t\t\t\t\tcount[str(i)+\",\"+str(j)] = 1\n\t\t\t\telse:\n\t\t\t\t\tcount[str(i)+\",\"+str(j)] += 1",
"i+2 >= H or j+2 >= W",
"i+2 >= H",
"i+2",
"i",
"2",
"H",
"j+2 >= W",
"j+2",
"j",
"2",
"W",
"continue",
"if not str(i)+\",\"+str(j) in count:\n\t\t\t\t\tcount[str(i)+\",\"+str(j)] = 1\n\t\t\t\telse:\n\t\t\t\t\tcount[str(i)+\",\"+str(j)] += 1",
"not str(i)+\",\"+str(j) in count",
"str(i)+\",\"+str(j) in count",
"str(i)+\",\"+str(j)",
"str(i)+\",\"",
"str(i)",
"str",
"i",
"\",\"",
"str(j)",
"str",
"j",
"count",
"count[str(i)+\",\"+str(j)] = 1",
"count[str(i)+\",\"+str(j)]",
"count",
"str(i)+\",\"+str(j)",
"str(i)+\",\"",
"str(i)",
"str",
"i",
"\",\"",
"str(j)",
"str",
"j",
"1",
"count[str(i)+\",\"+str(j)] += 1",
"count[str(i)+\",\"+str(j)]",
"count",
"str(i)+\",\"+str(j)",
"str(i)+\",\"",
"str(i)",
"str",
"i",
"\",\"",
"str(j)",
"str",
"j",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for key in count:\n\tans[count[key]] += 1",
"key",
"count",
"ans[count[key]] += 1",
"ans[count[key]]",
"ans",
"count[key]",
"count",
"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 i in ans:\n\tprint(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"def INT(): return int(input())",
"def INT(): return int(input())",
"INT",
"ans = [0] * 10",
"[0] * 10",
"ans",
"count = {}",
"{}",
"count",
"def MAP(): return map(int, input().split())",
"def MAP(): return map(int, input().split())",
"MAP",
"H, W, N = MAP()",
"MAP()",
"H",
"INF = float('inf')",
"float('inf')",
"INF",
"def sum_matrix(array):\n\treturn sum([sum(x) for x in array])",
"def sum_matrix(array):\n\treturn sum([sum(x) for x in array])",
"sum_matrix",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"W, N = MAP()",
"MAP()",
"W",
"def LIST(): return list(map(int, input().split()))",
"def LIST(): return list(map(int, input().split()))",
"LIST",
"def input(): return sys.stdin.readline().strip()",
"def input(): return sys.stdin.readline().strip()",
"input",
"ab = [LIST() for _ in range(N)]",
"[LIST() for _ in range(N)]",
"ab",
"N = MAP()",
"MAP()",
"N"
] | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
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
def sum_matrix(array):
return sum([sum(x) for x in array])
count = {}
H, W, N = MAP()
ab = [LIST() for _ in range(N)]
for a, b in ab:
for i in range(a-3, a):
for j in range(b-3, b):
if i < 0 or j < 0:
continue
if i+2 >= H or j+2 >= W:
continue
else:
if not str(i)+","+str(j) in count:
count[str(i)+","+str(j)] = 1
else:
count[str(i)+","+str(j)] += 1
ans = [0] * 10
for key in count:
ans[count[key]] += 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,
0,
13,
4,
13,
28,
13,
4,
13,
4,
13,
13,
0,
13,
2,
18,
18,
13,
13,
17,
17,
0,
13,
2,
18,
18,
13,
13,
17,
17,
0,
18,
13,
13,
4,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
18,
18,
13,
13,
17,
17,
0,
13,
2,
18,
18,
13,
13,
17,
17,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
0,
13,
2,
13,
13,
13,
2,
13,
13,
14,
2,
2,
2,
40,
13,
17,
40,
13,
2,
13,
17,
40,
13,
17,
40,
13,
2,
13,
17,
0,
13,
17,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
14,
2,
2,
2,
13,
13,
13,
2,
2,
13,
13,
18,
13,
2,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
4,
18,
18,
13,
13,
13,
13,
28,
13,
13,
4,
13,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] | [
[
242,
2
],
[
242,
11
],
[
242,
12
],
[
16,
15
],
[
225,
18
],
[
248,
31
],
[
245,
34
],
[
39,
38
],
[
249,
43
],
[
236,
45
],
[
249,
49
],
[
38,
50
],
[
209,
54
],
[
249,
58
],
[
38,
59
],
[
66,
63
],
[
246,
64
],
[
237,
65
],
[
233,
69
],
[
78,
75
],
[
234,
76
],
[
243,
80
],
[
231,
83
],
[
87,
86
],
[
225,
89
],
[
218,
91
],
[
249,
95
],
[
86,
96
],
[
212,
100
],
[
249,
104
],
[
86,
105
],
[
110,
109
],
[
116,
115
],
[
227,
121
],
[
219,
123
],
[
237,
123
],
[
109,
124
],
[
215,
125
],
[
213,
127
],
[
210,
127
],
[
115,
128
],
[
228,
134
],
[
228,
137
],
[
243,
139
],
[
216,
142
],
[
216,
145
],
[
231,
147
],
[
239,
150
],
[
154,
153
],
[
160,
159
],
[
228,
168
],
[
153,
169
],
[
246,
170
],
[
216,
173
],
[
159,
174
],
[
246,
176
],
[
228,
178
],
[
153,
179
],
[
221,
181
],
[
187,
184
],
[
234,
185
],
[
222,
186
],
[
240,
186
],
[
194,
189
],
[
234,
190
],
[
222,
192
],
[
240,
192
],
[
63,
197
],
[
246,
198
],
[
219,
199
],
[
237,
199
],
[
213,
201
],
[
210,
201
],
[
204,
203
],
[
234,
203
],
[
203,
207
],
[
209,
210
],
[
212,
213
],
[
215,
216
],
[
218,
219
],
[
221,
222
],
[
242,
225
],
[
227,
228
],
[
242,
231
],
[
233,
234
],
[
236,
237
],
[
239,
240
],
[
242,
243
],
[
245,
246
],
[
248,
249
]
] | [
"h, w, n = map(int, input().split())\nab = [list(map(int, input().split())) for _ in range(n)]\n\nd = dict()\nfor i in range(len(ab)):\n a = ab[i][0] - 1\n b = ab[i][0] - 1\n d[a] = set()\n\ndp = [0] * 10\ndp[0] = (h - 2) * (w - 2)\nfor i in range(n):\n a = ab[i][0] - 1\n b = ab[i][1] - 1\n for dx in [-1, 0, 1]:\n for dy in [-1, 0, 1]:\n nx, ny = a + dx, b + dy # center\n if nx >= 1 and nx <= h - 2 and ny >= 1 and ny <= w - 2:\n # print(nx, ny)\n tmp = 0\n for dx2 in [-1, 0, 1]:\n for dy2 in [-1, 0, 1]:\n if nx + dx2 in d and ny + dy2 in d[nx + dx2]:\n tmp += 1\n\n dp[tmp] -= 1\n dp[tmp + 1] += 1\n\n d[a].add(b)\n\nfor x in dp:\n print(x)",
"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 = dict()",
"d",
"dict()",
"dict",
"for i in range(len(ab)):\n a = ab[i][0] - 1\n b = ab[i][0] - 1\n d[a] = set()",
"i",
"range(len(ab))",
"range",
"len(ab)",
"len",
"ab",
"a = ab[i][0] - 1",
"a",
"ab[i][0] - 1",
"ab[i][0]",
"[i]",
"ab",
"i",
"0",
"1",
"b = ab[i][0] - 1",
"b",
"ab[i][0] - 1",
"ab[i][0]",
"[i]",
"ab",
"i",
"0",
"1",
"d[a] = set()",
"d[a]",
"d",
"a",
"set()",
"set",
"dp = [0] * 10",
"dp",
"[0] * 10",
"[0]",
"0",
"10",
"dp[0] = (h - 2) * (w - 2)",
"dp[0]",
"dp",
"0",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"for i in range(n):\n a = ab[i][0] - 1\n b = ab[i][1] - 1\n for dx in [-1, 0, 1]:\n for dy in [-1, 0, 1]:\n nx, ny = a + dx, b + dy # center\n if nx >= 1 and nx <= h - 2 and ny >= 1 and ny <= w - 2:\n # print(nx, ny)\n tmp = 0\n for dx2 in [-1, 0, 1]:\n for dy2 in [-1, 0, 1]:\n if nx + dx2 in d and ny + dy2 in d[nx + dx2]:\n tmp += 1\n\n dp[tmp] -= 1\n dp[tmp + 1] += 1\n\n d[a].add(b)",
"i",
"range(n)",
"range",
"n",
"a = ab[i][0] - 1",
"a",
"ab[i][0] - 1",
"ab[i][0]",
"[i]",
"ab",
"i",
"0",
"1",
"b = ab[i][1] - 1",
"b",
"ab[i][1] - 1",
"ab[i][1]",
"[i]",
"ab",
"i",
"1",
"1",
"for dx in [-1, 0, 1]:\n for dy in [-1, 0, 1]:\n nx, ny = a + dx, b + dy # center\n if nx >= 1 and nx <= h - 2 and ny >= 1 and ny <= w - 2:\n # print(nx, ny)\n tmp = 0\n for dx2 in [-1, 0, 1]:\n for dy2 in [-1, 0, 1]:\n if nx + dx2 in d and ny + dy2 in d[nx + dx2]:\n tmp += 1\n\n dp[tmp] -= 1\n dp[tmp + 1] += 1\n\n ",
"dx",
"[-1, 0, 1]",
"-1",
"0",
"1",
"for dy in [-1, 0, 1]:\n nx, ny = a + dx, b + dy # center\n if nx >= 1 and nx <= h - 2 and ny >= 1 and ny <= w - 2:\n # print(nx, ny)\n tmp = 0\n for dx2 in [-1, 0, 1]:\n for dy2 in [-1, 0, 1]:\n if nx + dx2 in d and ny + dy2 in d[nx + dx2]:\n tmp += 1\n\n dp[tmp] -= 1\n dp[tmp + 1] += 1\n\n ",
"dy",
"[-1, 0, 1]",
"-1",
"0",
"1",
"nx, ny = a + dx, b + dy",
"nx",
"a + dx",
"a",
"dx",
"ny",
"b + dy",
"b",
"dy",
"if nx >= 1 and nx <= h - 2 and ny >= 1 and ny <= w - 2:\n # print(nx, ny)\n tmp = 0\n for dx2 in [-1, 0, 1]:\n for dy2 in [-1, 0, 1]:\n if nx + dx2 in d and ny + dy2 in d[nx + dx2]:\n tmp += 1\n\n dp[tmp] -= 1\n dp[tmp + 1] += 1\n\n ",
"nx >= 1 and nx <= h - 2 and ny >= 1 and ny <= w - 2",
"nx >= 1 and nx <= h - 2 and ny >= 1",
"nx >= 1 and nx <= h - 2",
"nx >= 1",
"nx",
"1",
"nx <= h - 2",
"nx",
"h - 2",
"h",
"2",
"ny >= 1",
"ny",
"1",
"ny <= w - 2",
"ny",
"w - 2",
"w",
"2",
"tmp = 0",
"tmp",
"0",
"for dx2 in [-1, 0, 1]:\n for dy2 in [-1, 0, 1]:\n if nx + dx2 in d and ny + dy2 in d[nx + dx2]:\n tmp += 1\n\n ",
"dx2",
"[-1, 0, 1]",
"-1",
"0",
"1",
"for dy2 in [-1, 0, 1]:\n if nx + dx2 in d and ny + dy2 in d[nx + dx2]:\n tmp += 1\n\n ",
"dy2",
"[-1, 0, 1]",
"-1",
"0",
"1",
"if nx + dx2 in d and ny + dy2 in d[nx + dx2]:\n tmp += 1\n\n ",
"nx + dx2 in d and ny + dy2 in d[nx + dx2]",
"nx + dx2 in d",
"nx + dx2",
"nx",
"dx2",
"d",
"ny + dy2 in d[nx + dx2]",
"ny + dy2",
"ny",
"dy2",
"d[nx + dx2]",
"d",
"nx + dx2",
"nx",
"dx2",
"tmp += 1",
"tmp",
"1",
"dp[tmp] -= 1",
"dp[tmp]",
"dp",
"tmp",
"1",
"dp[tmp + 1] += 1",
"dp[tmp + 1]",
"dp",
"tmp + 1",
"tmp",
"1",
"1",
"d[a].add(b)",
"[a].add",
"[a]",
"d",
"a",
"add",
"b",
"for x in dp:\n print(x)",
"x",
"dp",
"print(x)",
"print",
"x",
"b = ab[i][0] - 1",
"ab[i][0] - 1",
"b",
"b = ab[i][1] - 1",
"ab[i][1] - 1",
"b",
"ny = a + dx, b + dy",
"b + dy",
"ny",
"a = ab[i][0] - 1",
"ab[i][0] - 1",
"a",
"tmp += 1",
"1",
"tmp",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"nx, ny = a + dx, b + dy",
"a + dx",
"nx",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"dp = [0] * 10",
"[0] * 10",
"dp",
"a = ab[i][0] - 1",
"ab[i][0] - 1",
"a",
"tmp = 0",
"0",
"tmp",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"d = dict()",
"dict()",
"d",
"ab = [list(map(int, input().split())) for _ in range(n)]",
"[list(map(int, input().split())) for _ in range(n)]",
"ab"
] | h, w, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
d = dict()
for i in range(len(ab)):
a = ab[i][0] - 1
b = ab[i][0] - 1
d[a] = set()
dp = [0] * 10
dp[0] = (h - 2) * (w - 2)
for i in range(n):
a = ab[i][0] - 1
b = ab[i][1] - 1
for dx in [-1, 0, 1]:
for dy in [-1, 0, 1]:
nx, ny = a + dx, b + dy # center
if nx >= 1 and nx <= h - 2 and ny >= 1 and ny <= w - 2:
# print(nx, ny)
tmp = 0
for dx2 in [-1, 0, 1]:
for dy2 in [-1, 0, 1]:
if nx + dx2 in d and ny + dy2 in d[nx + dx2]:
tmp += 1
dp[tmp] -= 1
dp[tmp + 1] += 1
d[a].add(b)
for x in dp:
print(x)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
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,
4,
18,
13,
13,
39,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
28,
13,
13,
13,
14,
2,
2,
2,
2,
2,
13,
17,
13,
2,
2,
13,
17,
13,
2,
13,
17,
2,
13,
17,
9,
0,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
0,
13,
2,
13,
13,
13,
2,
13,
13,
14,
2,
39,
13,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
0,
13,
2,
4,
13,
17,
2,
13,
17,
4,
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,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] | [
[
181,
2
],
[
181,
11
],
[
181,
12
],
[
169,
14
],
[
184,
18
],
[
166,
22
],
[
29,
28
],
[
182,
31
],
[
199,
33
],
[
199,
42
],
[
170,
45
],
[
52,
51
],
[
57,
56
],
[
185,
62
],
[
200,
66
],
[
51,
67
],
[
194,
69
],
[
56,
70
],
[
200,
81
],
[
179,
83
],
[
194,
86
],
[
176,
88
],
[
194,
90
],
[
200,
93
],
[
202,
97
],
[
101,
100
],
[
106,
105
],
[
187,
110
],
[
200,
112
],
[
100,
113
],
[
172,
114
],
[
194,
116
],
[
105,
117
],
[
170,
123
],
[
196,
125
],
[
131,
128
],
[
167,
129
],
[
197,
130
],
[
203,
130
],
[
190,
133
],
[
179,
139
],
[
176,
145
],
[
151,
148
],
[
167,
149
],
[
191,
152
],
[
167,
156
],
[
161,
160
],
[
167,
160
],
[
160,
164
],
[
166,
167
],
[
169,
170
],
[
172,
173
],
[
181,
176
],
[
181,
179
],
[
181,
182
],
[
184,
185
],
[
187,
188
],
[
190,
191
],
[
199,
194
],
[
196,
197
],
[
199,
200
],
[
202,
203
]
] | [
"H, W, N = map(int, input().split())\nS = set()\ntoCheck = set()\nrs = [0] * 10\nfor _ in range(N):\n a, b = map(int, input().split())\n S.add((a, b))\n for i in range(3):\n for j in range(3):\n toCheck.add((a - i, b - j))\n\nfor a, b in toCheck:\n if a + 2 > H or b + 2 > W or b < 1 or a < 1:\n continue\n cnt = 0\n for i in range(3):\n for j in range(3):\n na, nb = a + i, b + j\n if (na, nb) in S:\n cnt += 1\n rs[cnt] += 1\n\ntotal = max(0, H - 2) * max(0, W - 2)\nrs[0] = total - sum(rs[1:])\nfor it in rs:\n print(it)\n\n",
"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",
"toCheck = set()",
"toCheck",
"set()",
"set",
"rs = [0] * 10",
"rs",
"[0] * 10",
"[0]",
"0",
"10",
"for _ in range(N):\n a, b = map(int, input().split())\n S.add((a, b))\n for i in range(3):\n for j in range(3):\n toCheck.add((a - i, b - j))",
"_",
"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",
"for i in range(3):\n for j in range(3):\n toCheck.add((a - i, b - j))",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n toCheck.add((a - i, b - j))",
"j",
"range(3)",
"range",
"3",
"toCheck.add((a - i, b - j))",
"toCheck.add",
"toCheck",
"add",
"(a - i, b - j)",
"a - i",
"a",
"i",
"b - j",
"b",
"j",
"for a, b in toCheck:\n if a + 2 > H or b + 2 > W or b < 1 or a < 1:\n continue\n cnt = 0\n for i in range(3):\n for j in range(3):\n na, nb = a + i, b + j\n if (na, nb) in S:\n cnt += 1\n rs[cnt] += 1",
"a",
"b",
"toCheck",
"if a + 2 > H or b + 2 > W or b < 1 or a < 1:\n continue\n ",
"a + 2 > H or b + 2 > W or b < 1 or a < 1",
"a + 2 > H or b + 2 > W or b < 1",
"a + 2 > H or b + 2 > W",
"a + 2 > H",
"a + 2",
"a",
"2",
"H",
"b + 2 > W",
"b + 2",
"b",
"2",
"W",
"b < 1",
"b",
"1",
"a < 1",
"a",
"1",
"continue",
"cnt = 0",
"cnt",
"0",
"for i in range(3):\n for j in range(3):\n na, nb = a + i, b + j\n if (na, nb) in S:\n cnt += 1\n ",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n na, nb = a + i, b + j\n if (na, nb) in S:\n cnt += 1\n ",
"j",
"range(3)",
"range",
"3",
"na, nb = a + i, b + j",
"na",
"a + i",
"a",
"i",
"nb",
"b + j",
"b",
"j",
"if (na, nb) in S:\n cnt += 1\n ",
"(na, nb) in S",
"(na, nb)",
"na",
"nb",
"S",
"cnt += 1",
"cnt",
"1",
"rs[cnt] += 1",
"rs[cnt]",
"rs",
"cnt",
"1",
"total = max(0, H - 2) * max(0, W - 2)",
"total",
"max(0, H - 2) * max(0, W - 2)",
"max(0, H - 2)",
"max",
"0",
"H - 2",
"H",
"2",
"max(0, W - 2)",
"max",
"0",
"W - 2",
"W",
"2",
"rs[0] = total - sum(rs[1:])",
"rs[0]",
"rs",
"0",
"total - sum(rs[1:])",
"total",
"sum(rs[1:])",
"sum",
"rs[1:]",
"rs",
"1:",
"1",
"for it in rs:\n print(it)",
"it",
"rs",
"print(it)",
"print",
"it",
"rs = [0] * 10",
"[0] * 10",
"rs",
"S = set()",
"set()",
"S",
"nb = a + i, b + j",
"b + j",
"nb",
"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",
"toCheck = set()",
"set()",
"toCheck",
"na, nb = a + i, b + j",
"a + i",
"na",
"total = max(0, H - 2) * max(0, W - 2)",
"max(0, H - 2) * max(0, W - 2)",
"total",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"cnt += 1",
"1",
"cnt",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"cnt = 0",
"0",
"cnt"
] | H, W, N = map(int, input().split())
S = set()
toCheck = set()
rs = [0] * 10
for _ in range(N):
a, b = map(int, input().split())
S.add((a, b))
for i in range(3):
for j in range(3):
toCheck.add((a - i, b - j))
for a, b in toCheck:
if a + 2 > H or b + 2 > W or b < 1 or a < 1:
continue
cnt = 0
for i in range(3):
for j in range(3):
na, nb = a + i, b + j
if (na, nb) in S:
cnt += 1
rs[cnt] += 1
total = max(0, H - 2) * max(0, W - 2)
rs[0] = total - sum(rs[1:])
for it in rs:
print(it)
|
[
7,
15,
13,
4,
18,
13,
13,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
2,
17,
17,
15,
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,
2,
39,
17,
17,
0,
13,
4,
13,
13,
28,
13,
13,
13,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
14,
2,
40,
2,
13,
13,
17,
40,
2,
13,
13,
13,
9,
14,
2,
40,
2,
13,
13,
17,
40,
2,
13,
13,
13,
9,
0,
13,
39,
2,
13,
13,
2,
13,
13,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
17,
13,
4,
13,
13,
13,
14,
2,
13,
17,
4,
13,
10,
2,
13,
10,
2,
13,
10,
12,
13
] | [
[
167,
9
],
[
164,
16
],
[
25,
24
],
[
25,
33
],
[
25,
34
],
[
38,
37
],
[
34,
40
],
[
54,
53
],
[
57,
56
],
[
63,
62
],
[
72,
71
],
[
78,
77
],
[
71,
87
],
[
71,
92
],
[
24,
93
],
[
77,
100
],
[
77,
105
],
[
33,
106
],
[
110,
109
],
[
71,
113
],
[
77,
116
],
[
123,
118
],
[
56,
119
],
[
125,
120
],
[
62,
121
],
[
109,
122
],
[
128,
125
],
[
62,
126
],
[
109,
127
],
[
135,
130
],
[
56,
131
],
[
125,
132
],
[
62,
133
],
[
109,
134
],
[
140,
137
],
[
56,
138
],
[
24,
142
],
[
33,
145
],
[
56,
156
],
[
171,
162
],
[
164,
165
],
[
167,
168
]
] | [
"import sys\nsys.setrecursionlimit(10000000)\nMOD = 10 ** 9 + 7\nINF = 10 ** 15\n\nfrom collections import deque,defaultdict,Counter\ndef main():\n H,W,N = map(int,input().split())\n point = [tuple(map(int,input().split())) for _ in range(N)]\n ans = [0] * 10\n\n dic = defaultdict(int)\n for p,q in point:\n for dy in (-1,0,1):\n for dx in (-1,0,1):\n if p + dy <= 1 or p + dy >= H:\n continue\n if q + dx <= 1 or q + dx >= W:\n continue\n center = (p + dy,q + dx)\n ans[dic[center]] -= 1\n dic[center] += 1\n ans[dic[center]] += 1\n ans[0] += (H - 2)*(W - 2)\n print('\\n'.join(map(str,ans)))\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"sys.setrecursionlimit(10000000)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10000000",
"MOD = 10 ** 9 + 7",
"MOD",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"INF = 10 ** 15",
"INF",
"10 ** 15",
"10",
"15",
"from collections import deque,defaultdict,Counter",
"def main():\n H,W,N = map(int,input().split())\n point = [tuple(map(int,input().split())) for _ in range(N)]\n ans = [0] * 10\n\n dic = defaultdict(int)\n for p,q in point:\n for dy in (-1,0,1):\n for dx in (-1,0,1):\n if p + dy <= 1 or p + dy >= H:\n continue\n if q + dx <= 1 or q + dx >= W:\n continue\n center = (p + dy,q + dx)\n ans[dic[center]] -= 1\n dic[center] += 1\n ans[dic[center]] += 1\n ans[0] += (H - 2)*(W - 2)\n print('\\n'.join(map(str,ans)))",
"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",
"point = [tuple(map(int,input().split())) for _ in range(N)]",
"point",
"[tuple(map(int,input().split())) for _ in range(N)]",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"dic = defaultdict(int)",
"dic",
"defaultdict(int)",
"defaultdict",
"int",
"for p,q in point:\n for dy in (-1,0,1):\n for dx in (-1,0,1):\n if p + dy <= 1 or p + dy >= H:\n continue\n if q + dx <= 1 or q + dx >= W:\n continue\n center = (p + dy,q + dx)\n ans[dic[center]] -= 1\n dic[center] += 1\n ans[dic[center]] += 1\n ",
"p",
"q",
"point",
"for dy in (-1,0,1):\n for dx in (-1,0,1):\n if p + dy <= 1 or p + dy >= H:\n continue\n if q + dx <= 1 or q + dx >= W:\n continue\n center = (p + dy,q + dx)\n ans[dic[center]] -= 1\n dic[center] += 1\n ans[dic[center]] += 1\n ",
"dy",
"(-1,0,1)",
"-1",
"0",
"1",
"for dx in (-1,0,1):\n if p + dy <= 1 or p + dy >= H:\n continue\n if q + dx <= 1 or q + dx >= W:\n continue\n center = (p + dy,q + dx)\n ans[dic[center]] -= 1\n dic[center] += 1\n ans[dic[center]] += 1\n ",
"dx",
"(-1,0,1)",
"-1",
"0",
"1",
"if p + dy <= 1 or p + dy >= H:\n continue\n ",
"p + dy <= 1 or p + dy >= H",
"p + dy <= 1",
"p + dy",
"p",
"dy",
"1",
"p + dy >= H",
"p + dy",
"p",
"dy",
"H",
"continue",
"if q + dx <= 1 or q + dx >= W:\n continue\n ",
"q + dx <= 1 or q + dx >= W",
"q + dx <= 1",
"q + dx",
"q",
"dx",
"1",
"q + dx >= W",
"q + dx",
"q",
"dx",
"W",
"continue",
"center = (p + dy,q + dx)",
"center",
"(p + dy,q + dx)",
"p + dy",
"p",
"dy",
"q + dx",
"q",
"dx",
"ans[dic[center]] -= 1",
"ans[dic[center]]",
"ans",
"dic[center]",
"dic",
"center",
"1",
"dic[center] += 1",
"dic[center]",
"dic",
"center",
"1",
"ans[dic[center]] += 1",
"ans[dic[center]]",
"ans",
"dic[center]",
"dic",
"center",
"1",
"ans[0] += (H - 2)*(W - 2)",
"ans[0]",
"ans",
"0",
"(H - 2)*(W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"print('\\n'.join(map(str,ans)))",
"print",
"'\\n'.join(map(str,ans))",
"'\\n'.join",
"'\\n'",
"join",
"map(str,ans)",
"map",
"str",
"ans",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"INF = 10 ** 15",
"10 ** 15",
"INF",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"def main():\n H,W,N = map(int,input().split())\n point = [tuple(map(int,input().split())) for _ in range(N)]\n ans = [0] * 10\n\n dic = defaultdict(int)\n for p,q in point:\n for dy in (-1,0,1):\n for dx in (-1,0,1):\n if p + dy <= 1 or p + dy >= H:\n continue\n if q + dx <= 1 or q + dx >= W:\n continue\n center = (p + dy,q + dx)\n ans[dic[center]] -= 1\n dic[center] += 1\n ans[dic[center]] += 1\n ans[0] += (H - 2)*(W - 2)\n print('\\n'.join(map(str,ans)))",
"def main():\n H,W,N = map(int,input().split())\n point = [tuple(map(int,input().split())) for _ in range(N)]\n ans = [0] * 10\n\n dic = defaultdict(int)\n for p,q in point:\n for dy in (-1,0,1):\n for dx in (-1,0,1):\n if p + dy <= 1 or p + dy >= H:\n continue\n if q + dx <= 1 or q + dx >= W:\n continue\n center = (p + dy,q + dx)\n ans[dic[center]] -= 1\n dic[center] += 1\n ans[dic[center]] += 1\n ans[0] += (H - 2)*(W - 2)\n print('\\n'.join(map(str,ans)))",
"main"
] | import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
from collections import deque,defaultdict,Counter
def main():
H,W,N = map(int,input().split())
point = [tuple(map(int,input().split())) for _ in range(N)]
ans = [0] * 10
dic = defaultdict(int)
for p,q in point:
for dy in (-1,0,1):
for dx in (-1,0,1):
if p + dy <= 1 or p + dy >= H:
continue
if q + dx <= 1 or q + dx >= W:
continue
center = (p + dy,q + dx)
ans[dic[center]] -= 1
dic[center] += 1
ans[dic[center]] += 1
ans[0] += (H - 2)*(W - 2)
print('\n'.join(map(str,ans)))
if __name__ == '__main__':
main() |
[
7,
15,
15,
13,
4,
18,
13,
13,
2,
2,
17,
17,
17,
0,
13,
18,
18,
13,
13,
13,
15,
15,
13,
13,
15,
13,
15,
13,
15,
13,
15,
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,
4,
13,
13,
0,
13,
39,
17,
17,
17,
28,
13,
4,
13,
13,
0,
13,
18,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
28,
13,
13,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
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,
4,
13,
4,
13,
4,
18,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
17,
4,
13,
18,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
18,
13
] | [
[
181,
14
],
[
35,
34
],
[
182,
41
],
[
35,
43
],
[
35,
44
],
[
48,
47
],
[
44,
50
],
[
182,
60
],
[
64,
63
],
[
67,
66
],
[
72,
71
],
[
78,
77
],
[
44,
80
],
[
83,
82
],
[
63,
84
],
[
77,
85
],
[
83,
86
],
[
89,
88
],
[
92,
91
],
[
95,
94
],
[
71,
94
],
[
98,
97
],
[
71,
97
],
[
101,
100
],
[
88,
102
],
[
82,
102
],
[
94,
103
],
[
106,
105
],
[
91,
107
],
[
86,
107
],
[
97,
108
],
[
100,
114
],
[
34,
116
],
[
105,
121
],
[
43,
123
],
[
131,
126
],
[
66,
127
],
[
134,
133
],
[
66,
140
],
[
34,
147
],
[
43,
150
],
[
133,
158
],
[
162,
161
],
[
133,
169
],
[
161,
170
],
[
179,
176
],
[
181,
182
]
] | [
"from collections import Counter, defaultdict\nimport sys\nsys.setrecursionlimit(10 ** 5 + 10)\ninput = sys.stdin.readline\nfrom math import factorial\nimport heapq, bisect\nimport math\nimport itertools\n# from copy import deepcopy, copy\n\nimport queue\nfrom collections import deque\n\n\n\n\ndef main():\n high, width, num = map(int, input().split())\n data = [list(map(int, input().split())) for i in range(num)]\n\n ans_list = defaultdict(int)\n move_dic = [-2, -1, 0]\n for i in range(num):\n a, b = data[i]\n a -= 1\n b -= 1\n for move_a in move_dic:\n for move_b in move_dic:\n now_a = a + move_a\n now_b = b + move_b\n if 0 <= now_a < high - 2 and 0 <= now_b < width - 2:\n ans_list[(now_a, now_b)] += 1\n # print(ans_list)\n\n ans = Counter(list(ans_list.values()))\n print((high - 2) * (width - 2) - sum(list(ans.values())))\n for i in range(1, 10):\n print(ans[i])\n\nif __name__ == '__main__':\n main()",
"from collections import Counter, defaultdict",
"import sys",
"sys",
"sys.setrecursionlimit(10 ** 5 + 10)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 5 + 10",
"10 ** 5",
"10",
"5",
"10",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"from math import factorial",
"import heapq, bisect",
"heapq",
"bisect",
"import math",
"math",
"import itertools",
"itertools",
"import queue",
"queue",
"from collections import deque",
"def main():\n high, width, num = map(int, input().split())\n data = [list(map(int, input().split())) for i in range(num)]\n\n ans_list = defaultdict(int)\n move_dic = [-2, -1, 0]\n for i in range(num):\n a, b = data[i]\n a -= 1\n b -= 1\n for move_a in move_dic:\n for move_b in move_dic:\n now_a = a + move_a\n now_b = b + move_b\n if 0 <= now_a < high - 2 and 0 <= now_b < width - 2:\n ans_list[(now_a, now_b)] += 1\n # print(ans_list)\n\n ans = Counter(list(ans_list.values()))\n print((high - 2) * (width - 2) - sum(list(ans.values())))\n for i in range(1, 10):\n print(ans[i])",
"main",
"high, width, num = map(int, input().split())",
"high",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"width",
"num",
"list(map(int, input().split())) for i in range(num)",
"for i in range(num)",
"i",
"range(num)",
"range",
"num",
"for i in range(num)",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"data = [list(map(int, input().split())) for i in range(num)]",
"data",
"[list(map(int, input().split())) for i in range(num)]",
"ans_list = defaultdict(int)",
"ans_list",
"defaultdict(int)",
"defaultdict",
"int",
"move_dic = [-2, -1, 0]",
"move_dic",
"[-2, -1, 0]",
"-2",
"-1",
"0",
"for i in range(num):\n a, b = data[i]\n a -= 1\n b -= 1\n for move_a in move_dic:\n for move_b in move_dic:\n now_a = a + move_a\n now_b = b + move_b\n if 0 <= now_a < high - 2 and 0 <= now_b < width - 2:\n ans_list[(now_a, now_b)] += 1\n # print(ans_list)\n\n ",
"i",
"range(num)",
"range",
"num",
"a, b = data[i]",
"a",
"data[i]",
"data",
"i",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for move_a in move_dic:\n for move_b in move_dic:\n now_a = a + move_a\n now_b = b + move_b\n if 0 <= now_a < high - 2 and 0 <= now_b < width - 2:\n ans_list[(now_a, now_b)] += 1\n # print(ans_list)\n\n ",
"move_a",
"move_dic",
"for move_b in move_dic:\n now_a = a + move_a\n now_b = b + move_b\n if 0 <= now_a < high - 2 and 0 <= now_b < width - 2:\n ans_list[(now_a, now_b)] += 1\n # print(ans_list)\n\n ",
"move_b",
"move_dic",
"now_a = a + move_a",
"now_a",
"a + move_a",
"a",
"move_a",
"now_b = b + move_b",
"now_b",
"b + move_b",
"b",
"move_b",
"if 0 <= now_a < high - 2 and 0 <= now_b < width - 2:\n ans_list[(now_a, now_b)] += 1\n # print(ans_list)\n\n ",
"0 <= now_a < high - 2 and 0 <= now_b < width - 2",
"0 <= now_a < high - 2",
"0 <= now_a",
"0",
"now_a",
"high - 2",
"high",
"2",
"0 <= now_b < width - 2",
"0 <= now_b",
"0",
"now_b",
"width - 2",
"width",
"2",
"ans_list[(now_a, now_b)] += 1",
"ans_list[(now_a, now_b)]",
"ans_list",
"(now_a, now_b)",
"now_a",
"now_b",
"1",
"ans = Counter(list(ans_list.values()))",
"ans",
"Counter(list(ans_list.values()))",
"Counter",
"list(ans_list.values())",
"list",
"ans_list.values()",
"ans_list.values",
"ans_list",
"values",
"print((high - 2) * (width - 2) - sum(list(ans.values())))",
"print",
"(high - 2) * (width - 2) - sum(list(ans.values()))",
"(high - 2) * (width - 2)",
"high - 2",
"high",
"2",
"width - 2",
"width",
"2",
"sum(list(ans.values()))",
"sum",
"list(ans.values())",
"list",
"ans.values()",
"ans.values",
"ans",
"values",
"for i in range(1, 10):\n print(ans[i])",
"i",
"range(1, 10)",
"range",
"1",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n high, width, num = map(int, input().split())\n data = [list(map(int, input().split())) for i in range(num)]\n\n ans_list = defaultdict(int)\n move_dic = [-2, -1, 0]\n for i in range(num):\n a, b = data[i]\n a -= 1\n b -= 1\n for move_a in move_dic:\n for move_b in move_dic:\n now_a = a + move_a\n now_b = b + move_b\n if 0 <= now_a < high - 2 and 0 <= now_b < width - 2:\n ans_list[(now_a, now_b)] += 1\n # print(ans_list)\n\n ans = Counter(list(ans_list.values()))\n print((high - 2) * (width - 2) - sum(list(ans.values())))\n for i in range(1, 10):\n print(ans[i])",
"def main():\n high, width, num = map(int, input().split())\n data = [list(map(int, input().split())) for i in range(num)]\n\n ans_list = defaultdict(int)\n move_dic = [-2, -1, 0]\n for i in range(num):\n a, b = data[i]\n a -= 1\n b -= 1\n for move_a in move_dic:\n for move_b in move_dic:\n now_a = a + move_a\n now_b = b + move_b\n if 0 <= now_a < high - 2 and 0 <= now_b < width - 2:\n ans_list[(now_a, now_b)] += 1\n # print(ans_list)\n\n ans = Counter(list(ans_list.values()))\n print((high - 2) * (width - 2) - sum(list(ans.values())))\n for i in range(1, 10):\n print(ans[i])",
"main",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input"
] | from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools
# from copy import deepcopy, copy
import queue
from collections import deque
def main():
high, width, num = map(int, input().split())
data = [list(map(int, input().split())) for i in range(num)]
ans_list = defaultdict(int)
move_dic = [-2, -1, 0]
for i in range(num):
a, b = data[i]
a -= 1
b -= 1
for move_a in move_dic:
for move_b in move_dic:
now_a = a + move_a
now_b = b + move_b
if 0 <= now_a < high - 2 and 0 <= now_b < width - 2:
ans_list[(now_a, now_b)] += 1
# print(ans_list)
ans = Counter(list(ans_list.values()))
print((high - 2) * (width - 2) - sum(list(ans.values())))
for i in range(1, 10):
print(ans[i])
if __name__ == '__main__':
main()
|
[
7,
15,
13,
15,
0,
13,
39,
17,
17,
17,
0,
13,
17,
0,
13,
18,
13,
13,
0,
13,
12,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
12,
4,
13,
4,
13,
0,
13,
17,
12,
13,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
12,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
40,
2,
13,
13,
17,
40,
2,
13,
13,
17,
9,
14,
2,
2,
2,
13,
13,
2,
13,
17,
2,
2,
13,
13,
2,
13,
17,
9,
0,
13,
2,
2,
2,
13,
13,
2,
13,
17,
2,
13,
13,
0,
18,
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,
18,
13,
39,
17,
28,
13,
13,
4,
13,
13,
0,
13,
17,
12,
13,
14,
13,
4,
13,
13,
23,
13,
12,
13,
15,
13,
0,
13,
4,
18,
13,
13,
0,
13,
4,
18,
13,
13,
28,
13,
13,
27,
13,
14,
2,
13,
17,
14,
2,
18,
13,
13,
17,
14,
2,
13,
18,
13,
17,
0,
13,
4,
13,
0,
13,
12,
4,
18,
13,
13,
14,
2,
13,
18,
13,
17,
0,
18,
13,
13,
4,
13,
17,
0,
13,
17,
0,
13,
4,
13,
14,
40,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
18,
13,
10,
17,
13,
10,
12,
13,
10,
17,
13,
10,
39,
13
] | [
[
288,
5
],
[
285,
11
],
[
276,
14
],
[
289,
16
],
[
286,
17
],
[
261,
19
],
[
270,
30
],
[
252,
37
],
[
43,
42
],
[
262,
44
],
[
43,
45
],
[
43,
46
],
[
49,
48
],
[
55,
54
],
[
46,
57
],
[
60,
59
],
[
262,
61
],
[
60,
62
],
[
65,
64
],
[
70,
69
],
[
59,
77
],
[
64,
78
],
[
62,
82
],
[
69,
83
],
[
59,
90
],
[
64,
91
],
[
42,
93
],
[
62,
97
],
[
69,
98
],
[
45,
100
],
[
105,
104
],
[
59,
108
],
[
64,
109
],
[
45,
111
],
[
62,
114
],
[
69,
115
],
[
120,
117
],
[
48,
118
],
[
104,
119
],
[
123,
122
],
[
129,
128
],
[
48,
128
],
[
136,
131
],
[
122,
132
],
[
48,
134
],
[
128,
135
],
[
141,
138
],
[
122,
139
],
[
42,
144
],
[
45,
147
],
[
122,
152
],
[
157,
156
],
[
122,
156
],
[
156,
160
],
[
279,
162
],
[
172,
170
],
[
172,
172
],
[
179,
178
],
[
185,
184
],
[
178,
187
],
[
191,
190
],
[
184,
190
],
[
190,
193
],
[
277,
206
],
[
289,
208
],
[
249,
211
],
[
274,
213
],
[
282,
215
],
[
250,
219
],
[
277,
223
],
[
289,
225
],
[
231,
228
],
[
255,
235
],
[
267,
238
],
[
259,
240
],
[
268,
243
],
[
268,
247
],
[
249,
250
],
[
252,
253
],
[
255,
256
],
[
261,
262
],
[
267,
268
],
[
270,
271
],
[
276,
277
],
[
279,
280
],
[
282,
283
],
[
285,
286
],
[
288,
289
]
] | [
"import sys\nfrom collections import defaultdict\n\ninput_methods=['clipboard','file','key']\nusing_method=0\ninput_method=input_methods[using_method]\n\ntin=lambda : map(int, input().split())\nlin=lambda : list(IN())\nmod=1000000007\n\n#+++++\n\ndef main():\n\t#a = int(input())\n\tH, W, N = tin()\n\t#s = input()\n\tdd=defaultdict(lambda : 0)\n\tfor _ in range(N):\n\t\ta, b = tin()\n\t\tfor da in range(3):\n\t\t\tfor db in range(3):\n\t\t\t\tif a - da <= 0 or b - db <= 0:\n\t\t\t\t\tcontinue\n\t\t\t\tif a - da > H -2 or b -db > W-2:\n\t\t\t\t\tcontinue\n\t\t\t\tii = (a - da)*(W+1)+(b - db)\n\t\t\t\tdd[ii]+=1\n\t\n\tnn = [0]*10\n\tfor k in dd:\n\t\tnn[dd[k]]+=1\n\tnn[0]=((H-2)*(W-2))-sum(nn[1:])\n\tfor v in nn:\n\t\tprint(v)\n\t\n\t\n\t\n#+++++\nisTest=False\n\ndef pa(v):\n\tif isTest:\n\t\tprint(v)\n\t\t\ndef input_clipboard():\n\timport clipboard\n\tinput_text=clipboard.get()\n\tinput_l=input_text.splitlines()\n\tfor l in input_l:\n\t\tyield l\n\nif __name__ == \"__main__\":\n\tif sys.platform =='ios':\n\t\tif input_method==input_methods[0]:\n\t\t\tic=input_clipboard()\n\t\t\tinput = lambda : ic.__next__()\n\t\telif input_method==input_methods[1]:\n\t\t\tsys.stdin=open('inputFile.txt')\n\t\telse:\n\t\t\tpass\n\t\tisTest=True\n\telse:\n\t\tpass\n\t\t#input = sys.stdin.readline\n\t\t\t\n\tret = main()\n\tif ret is not None:\n\t\tprint(ret)",
"import sys",
"sys",
"from collections import defaultdict",
"input_methods=['clipboard','file','key']",
"input_methods",
"['clipboard','file','key']",
"'clipboard'",
"'file'",
"'key'",
"using_method=0",
"using_method",
"0",
"input_method=input_methods[using_method]",
"input_method",
"input_methods[using_method]",
"input_methods",
"using_method",
"tin=lambda : map(int, input().split())",
"tin",
"lambda : map(int, input().split())",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"lin=lambda : list(IN())",
"lin",
"lambda : list(IN())",
"list(IN())",
"list",
"IN()",
"IN",
"mod=1000000007",
"mod",
"1000000007",
"def main():\n\t#a = int(input())\n\tH, W, N = tin()\n\t#s = input()\n\tdd=defaultdict(lambda : 0)\n\tfor _ in range(N):\n\t\ta, b = tin()\n\t\tfor da in range(3):\n\t\t\tfor db in range(3):\n\t\t\t\tif a - da <= 0 or b - db <= 0:\n\t\t\t\t\tcontinue\n\t\t\t\tif a - da > H -2 or b -db > W-2:\n\t\t\t\t\tcontinue\n\t\t\t\tii = (a - da)*(W+1)+(b - db)\n\t\t\t\tdd[ii]+=1\n\t\n\tnn = [0]*10\n\tfor k in dd:\n\t\tnn[dd[k]]+=1\n\tnn[0]=((H-2)*(W-2))-sum(nn[1:])\n\tfor v in nn:\n\t\tprint(v)\n\t\n\t\n\t\n#+++++",
"main",
"H, W, N = tin()",
"H",
"tin()",
"tin",
"W",
"N",
"dd=defaultdict(lambda : 0)",
"dd",
"defaultdict(lambda : 0)",
"defaultdict",
"lambda : 0",
"0",
"for _ in range(N):\n\t\ta, b = tin()\n\t\tfor da in range(3):\n\t\t\tfor db in range(3):\n\t\t\t\tif a - da <= 0 or b - db <= 0:\n\t\t\t\t\tcontinue\n\t\t\t\tif a - da > H -2 or b -db > W-2:\n\t\t\t\t\tcontinue\n\t\t\t\tii = (a - da)*(W+1)+(b - db)\n\t\t\t\tdd[ii]+=1\n\t\n\t",
"_",
"range(N)",
"range",
"N",
"a, b = tin()",
"a",
"tin()",
"tin",
"b",
"for da in range(3):\n\t\t\tfor db in range(3):\n\t\t\t\tif a - da <= 0 or b - db <= 0:\n\t\t\t\t\tcontinue\n\t\t\t\tif a - da > H -2 or b -db > W-2:\n\t\t\t\t\tcontinue\n\t\t\t\tii = (a - da)*(W+1)+(b - db)\n\t\t\t\tdd[ii]+=1\n\t\n\t",
"da",
"range(3)",
"range",
"3",
"for db in range(3):\n\t\t\t\tif a - da <= 0 or b - db <= 0:\n\t\t\t\t\tcontinue\n\t\t\t\tif a - da > H -2 or b -db > W-2:\n\t\t\t\t\tcontinue\n\t\t\t\tii = (a - da)*(W+1)+(b - db)\n\t\t\t\tdd[ii]+=1\n\t\n\t",
"db",
"range(3)",
"range",
"3",
"if a - da <= 0 or b - db <= 0:\n\t\t\t\t\tcontinue\n\t\t\t\t",
"a - da <= 0 or b - db <= 0",
"a - da <= 0",
"a - da",
"a",
"da",
"0",
"b - db <= 0",
"b - db",
"b",
"db",
"0",
"continue",
"if a - da > H -2 or b -db > W-2:\n\t\t\t\t\tcontinue\n\t\t\t\t",
"a - da > H -2 or b -db > W-2",
"a - da > H -2",
"a - da",
"a",
"da",
"H -2",
"H",
"2",
"b -db > W-2",
"b -db",
"b",
"db",
"W-2",
"W",
"2",
"continue",
"ii = (a - da)*(W+1)+(b - db)",
"ii",
"(a - da)*(W+1)+(b - db)",
"(a - da)*(W+1)",
"a - da",
"a",
"da",
"W+1",
"W",
"1",
"b - db",
"b",
"db",
"dd[ii]+=1",
"dd[ii]",
"dd",
"ii",
"1",
"nn = [0]*10",
"nn",
"[0]*10",
"[0]",
"0",
"10",
"for k in dd:\n\t\tnn[dd[k]]+=1\n\t",
"k",
"dd",
"nn[dd[k]]+=1",
"nn[dd[k]]",
"nn",
"dd[k]",
"dd",
"k",
"1",
"nn[0]=((H-2)*(W-2))-sum(nn[1:])",
"nn[0]",
"nn",
"0",
"((H-2)*(W-2))-sum(nn[1:])",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(nn[1:])",
"sum",
"nn[1:]",
"nn",
"1:",
"1",
"for v in nn:\n\t\tprint(v)\n\t\n\t\n\t\n#+++++",
"v",
"nn",
"print(v)",
"print",
"v",
"isTest=False",
"isTest",
"False",
"def pa(v):\n\tif isTest:\n\t\tprint(v)\n\t\t",
"pa",
"if isTest:\n\t\tprint(v)\n\t\t",
"isTest",
"print(v)",
"print",
"v",
"v",
"v",
"def input_clipboard():\n\timport clipboard\n\tinput_text=clipboard.get()\n\tinput_l=input_text.splitlines()\n\tfor l in input_l:\n\t\tyield l",
"input_clipboard",
"import clipboard",
"clipboard",
"input_text=clipboard.get()",
"input_text",
"clipboard.get()",
"clipboard.get",
"clipboard",
"get",
"input_l=input_text.splitlines()",
"input_l",
"input_text.splitlines()",
"input_text.splitlines",
"input_text",
"splitlines",
"for l in input_l:\n\t\tyield l",
"l",
"input_l",
"yield l",
"l",
"if __name__ == \"__main__\":\n\tif sys.platform =='ios':\n\t\tif input_method==input_methods[0]:\n\t\t\tic=input_clipboard()\n\t\t\tinput = lambda : ic.__next__()\n\t\telif input_method==input_methods[1]:\n\t\t\tsys.stdin=open('inputFile.txt')\n\t\telse:\n\t\t\tpass\n\t\tisTest=True\n\telse:\n\t\tpass\n\t\t#input = sys.stdin.readline\n\t\t\t\n\tret = main()\n\tif ret is not None:\n\t\tprint(ret)",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"if sys.platform =='ios':\n\t\tif input_method==input_methods[0]:\n\t\t\tic=input_clipboard()\n\t\t\tinput = lambda : ic.__next__()\n\t\telif input_method==input_methods[1]:\n\t\t\tsys.stdin=open('inputFile.txt')\n\t\telse:\n\t\t\tpass\n\t\tisTest=True\n\telse:\n\t\tpass\n\t\t#input = sys.stdin.readline\n\t\t\t\n\t",
"sys.platform =='ios'",
"sys.platform",
"sys",
"platform",
"'ios'",
"if input_method==input_methods[0]:\n\t\t\tic=input_clipboard()\n\t\t\tinput = lambda : ic.__next__()\n\t\telif input_method==input_methods[1]:\n\t\t\tsys.stdin=open('inputFile.txt')\n\t\telse:\n\t\t\tpass\n\t\t",
"input_method==input_methods[0]",
"input_method",
"input_methods[0]",
"input_methods",
"0",
"ic=input_clipboard()",
"ic",
"input_clipboard()",
"input_clipboard",
"input = lambda : ic.__next__()",
"input",
"lambda : ic.__next__()",
"ic.__next__()",
"ic.__next__",
"ic",
"__next__",
"elif input_method==input_methods[1]:\n\t\t\tsys.stdin=open('inputFile.txt')\n\t\t",
"input_method==input_methods[1]",
"input_method",
"input_methods[1]",
"input_methods",
"1",
"sys.stdin=open('inputFile.txt')",
"sys.stdin",
"sys",
"stdin",
"open('inputFile.txt')",
"open",
"'inputFile.txt'",
"isTest=True",
"isTest",
"True",
"ret = main()",
"ret",
"main()",
"main",
"if ret is not None:\n\t\tprint(ret)",
"ret is not None",
"ret",
"None",
"print(ret)",
"print",
"ret",
"ic=input_clipboard()",
"input_clipboard()",
"ic",
"mod=1000000007",
"1000000007",
"mod",
"isTest=True",
"True",
"isTest",
"def main():\n\t#a = int(input())\n\tH, W, N = tin()\n\t#s = input()\n\tdd=defaultdict(lambda : 0)\n\tfor _ in range(N):\n\t\ta, b = tin()\n\t\tfor da in range(3):\n\t\t\tfor db in range(3):\n\t\t\t\tif a - da <= 0 or b - db <= 0:\n\t\t\t\t\tcontinue\n\t\t\t\tif a - da > H -2 or b -db > W-2:\n\t\t\t\t\tcontinue\n\t\t\t\tii = (a - da)*(W+1)+(b - db)\n\t\t\t\tdd[ii]+=1\n\t\n\tnn = [0]*10\n\tfor k in dd:\n\t\tnn[dd[k]]+=1\n\tnn[0]=((H-2)*(W-2))-sum(nn[1:])\n\tfor v in nn:\n\t\tprint(v)\n\t\n\t\n\t\n#+++++",
"def main():\n\t#a = int(input())\n\tH, W, N = tin()\n\t#s = input()\n\tdd=defaultdict(lambda : 0)\n\tfor _ in range(N):\n\t\ta, b = tin()\n\t\tfor da in range(3):\n\t\t\tfor db in range(3):\n\t\t\t\tif a - da <= 0 or b - db <= 0:\n\t\t\t\t\tcontinue\n\t\t\t\tif a - da > H -2 or b -db > W-2:\n\t\t\t\t\tcontinue\n\t\t\t\tii = (a - da)*(W+1)+(b - db)\n\t\t\t\tdd[ii]+=1\n\t\n\tnn = [0]*10\n\tfor k in dd:\n\t\tnn[dd[k]]+=1\n\tnn[0]=((H-2)*(W-2))-sum(nn[1:])\n\tfor v in nn:\n\t\tprint(v)\n\t\n\t\n\t\n#+++++",
"main",
"tin=lambda : map(int, input().split())",
"lambda : map(int, input().split())",
"tin",
"def pa(v):\n\tif isTest:\n\t\tprint(v)\n\t\t",
"def pa(v):\n\tif isTest:\n\t\tprint(v)\n\t\t",
"pa",
"ret = main()",
"main()",
"ret",
"lin=lambda : list(IN())",
"lambda : list(IN())",
"lin",
"def input_clipboard():\n\timport clipboard\n\tinput_text=clipboard.get()\n\tinput_l=input_text.splitlines()\n\tfor l in input_l:\n\t\tyield l",
"def input_clipboard():\n\timport clipboard\n\tinput_text=clipboard.get()\n\tinput_l=input_text.splitlines()\n\tfor l in input_l:\n\t\tyield l",
"input_clipboard",
"input_method=input_methods[using_method]",
"input_methods[using_method]",
"input_method",
"isTest=False",
"False",
"isTest",
"input = lambda : ic.__next__()",
"lambda : ic.__next__()",
"input",
"using_method=0",
"0",
"using_method",
"input_methods=['clipboard','file','key']",
"['clipboard','file','key']",
"input_methods"
] | import sys
from collections import defaultdict
input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]
tin=lambda : map(int, input().split())
lin=lambda : list(IN())
mod=1000000007
#+++++
def main():
#a = int(input())
H, W, N = tin()
#s = input()
dd=defaultdict(lambda : 0)
for _ in range(N):
a, b = tin()
for da in range(3):
for db in range(3):
if a - da <= 0 or b - db <= 0:
continue
if a - da > H -2 or b -db > W-2:
continue
ii = (a - da)*(W+1)+(b - db)
dd[ii]+=1
nn = [0]*10
for k in dd:
nn[dd[k]]+=1
nn[0]=((H-2)*(W-2))-sum(nn[1:])
for v in nn:
print(v)
#+++++
isTest=False
def pa(v):
if isTest:
print(v)
def input_clipboard():
import clipboard
input_text=clipboard.get()
input_l=input_text.splitlines()
for l in input_l:
yield l
if __name__ == "__main__":
if sys.platform =='ios':
if input_method==input_methods[0]:
ic=input_clipboard()
input = lambda : ic.__next__()
elif input_method==input_methods[1]:
sys.stdin=open('inputFile.txt')
else:
pass
isTest=True
else:
pass
#input = sys.stdin.readline
ret = main()
if ret is not None:
print(ret) |
[
7,
15,
13,
4,
18,
13,
13,
17,
0,
13,
4,
13,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
12,
4,
18,
4,
18,
18,
13,
13,
13,
13,
15,
15,
12,
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,
28,
13,
13,
4,
13,
4,
13,
2,
13,
17,
2,
13,
17,
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,
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,
4,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13
] | [
[
164,
9
],
[
155,
14
],
[
158,
21
],
[
38,
37
],
[
159,
44
],
[
38,
46
],
[
38,
47
],
[
50,
49
],
[
55,
54
],
[
47,
57
],
[
60,
59
],
[
159,
66
],
[
60,
68
],
[
59,
77
],
[
59,
80
],
[
68,
85
],
[
68,
88
],
[
37,
97
],
[
46,
104
],
[
112,
107
],
[
49,
108
],
[
115,
114
],
[
121,
120
],
[
49,
123
],
[
129,
126
],
[
114,
127
],
[
120,
128
],
[
134,
131
],
[
114,
132
],
[
37,
137
],
[
46,
140
],
[
114,
144
],
[
114,
148
],
[
151,
150
],
[
162,
153
],
[
155,
156
],
[
158,
159
],
[
164,
165
]
] | [
"import sys\nsys.setrecursionlimit(2147483647)\nINF=float(\"inf\")\nMOD=10**9+7\ninput=lambda :sys.stdin.readline().rstrip()\nfrom itertools import product\nfrom collections import defaultdict\ndef resolve():\n h,w,n=map(int,input().split())\n D=defaultdict(int)\n for _ in range(n):\n a,b=map(int,input().split())\n for i,j in product(range(a-1,a+2),range(b-1,b+2)):\n if(2<=i<=h-1 and 2<=j<=w-1):\n D[(i,j)]+=1\n\n ans=[0]*10\n for v in D.values():\n ans[v]+=1\n ans[0]=(h-2)*(w-2)-sum(ans)\n print(*ans,sep='\\n')\nresolve()",
"import sys",
"sys",
"sys.setrecursionlimit(2147483647)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"2147483647",
"INF=float(\"inf\")",
"INF",
"float(\"inf\")",
"float",
"\"inf\"",
"MOD=10**9+7",
"MOD",
"10**9+7",
"10**9",
"10",
"9",
"7",
"input=lambda :sys.stdin.readline().rstrip()",
"input",
"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",
"from itertools import product",
"from collections import defaultdict",
"def resolve():\n h,w,n=map(int,input().split())\n D=defaultdict(int)\n for _ in range(n):\n a,b=map(int,input().split())\n for i,j in product(range(a-1,a+2),range(b-1,b+2)):\n if(2<=i<=h-1 and 2<=j<=w-1):\n D[(i,j)]+=1\n\n ans=[0]*10\n for v in D.values():\n ans[v]+=1\n ans[0]=(h-2)*(w-2)-sum(ans)\n print(*ans,sep='\\n')",
"resolve",
"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 for i,j in product(range(a-1,a+2),range(b-1,b+2)):\n if(2<=i<=h-1 and 2<=j<=w-1):\n D[(i,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,j in product(range(a-1,a+2),range(b-1,b+2)):\n if(2<=i<=h-1 and 2<=j<=w-1):\n D[(i,j)]+=1\n\n ",
"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(2<=i<=h-1 and 2<=j<=w-1):\n D[(i,j)]+=1\n\n ",
"2<=i<=h-1 and 2<=j<=w-1",
"2<=i<=h-1",
"2<=i",
"2",
"i",
"h-1",
"h",
"1",
"2<=j<=w-1",
"2<=j",
"2",
"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 v in D.values():\n ans[v]+=1\n ",
"v",
"D.values()",
"D.values",
"D",
"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",
"print(*ans,sep='\\n')",
"print",
"*ans",
"ans",
"sep='\\n'",
"sep",
"'\\n'",
"resolve()",
"resolve",
"MOD=10**9+7",
"10**9+7",
"MOD",
"input=lambda :sys.stdin.readline().rstrip()",
"lambda :sys.stdin.readline().rstrip()",
"input",
"def resolve():\n h,w,n=map(int,input().split())\n D=defaultdict(int)\n for _ in range(n):\n a,b=map(int,input().split())\n for i,j in product(range(a-1,a+2),range(b-1,b+2)):\n if(2<=i<=h-1 and 2<=j<=w-1):\n D[(i,j)]+=1\n\n ans=[0]*10\n for v in D.values():\n ans[v]+=1\n ans[0]=(h-2)*(w-2)-sum(ans)\n print(*ans,sep='\\n')",
"def resolve():\n h,w,n=map(int,input().split())\n D=defaultdict(int)\n for _ in range(n):\n a,b=map(int,input().split())\n for i,j in product(range(a-1,a+2),range(b-1,b+2)):\n if(2<=i<=h-1 and 2<=j<=w-1):\n D[(i,j)]+=1\n\n ans=[0]*10\n for v in D.values():\n ans[v]+=1\n ans[0]=(h-2)*(w-2)-sum(ans)\n print(*ans,sep='\\n')",
"resolve",
"INF=float(\"inf\")",
"float(\"inf\")",
"INF"
] | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
from itertools import product
from collections import defaultdict
def resolve():
h,w,n=map(int,input().split())
D=defaultdict(int)
for _ in range(n):
a,b=map(int,input().split())
for i,j in product(range(a-1,a+2),range(b-1,b+2)):
if(2<=i<=h-1 and 2<=j<=w-1):
D[(i,j)]+=1
ans=[0]*10
for v in D.values():
ans[v]+=1
ans[0]=(h-2)*(w-2)-sum(ans)
print(*ans,sep='\n')
resolve() |
[
7,
0,
13,
12,
4,
13,
13,
0,
13,
17,
23,
0,
13,
12,
4,
13,
4,
13,
0,
13,
12,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
12,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
12,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
12,
13,
14,
13,
4,
13,
13,
23,
13,
12,
13,
0,
13,
18,
18,
13,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
2,
2,
2,
2,
2,
13,
17,
13,
17,
40,
2,
13,
13,
13,
2,
2,
2,
13,
17,
13,
17,
40,
2,
13,
13,
13,
9,
0,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
2,
2,
13,
13,
2,
13,
13,
17,
0,
13,
17,
14,
2,
18,
18,
13,
2,
13,
13,
2,
13,
13,
17,
14,
13,
0,
13,
17,
0,
13,
17,
3,
14,
13,
0,
18,
13,
13,
17,
23,
13,
23,
13,
23,
13,
0,
13,
4,
13,
13,
13,
0,
13,
17,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
17,
4,
18,
13,
13,
39,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
41,
28,
13,
4,
13,
17,
4,
2,
39,
17,
17,
0,
18,
18,
13,
13,
13,
13,
0,
18,
18,
18,
18,
13,
13,
13,
17,
17,
17,
28,
13,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
2,
2,
2,
13,
13,
13,
2,
2,
13,
13,
18,
13,
2,
13,
13,
40,
2,
2,
13,
13,
17,
0,
18,
18,
18,
18,
13,
2,
13,
13,
2,
13,
13,
2,
17,
13,
2,
17,
13,
17,
14,
2,
17,
13,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
14,
2,
2,
13,
13,
2,
13,
18,
13,
13,
28,
13,
4,
13,
17,
4,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
2,
39,
17,
17,
28,
13,
13,
13,
4,
13,
13,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
4,
13,
17,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
12,
13,
10,
17,
13,
10,
4,
13,
10,
12,
13,
10,
39,
13,
10,
17,
13,
10,
4,
13,
10,
12,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
2,
13,
10,
2,
13
] | [
[
436,
2
],
[
9,
8
],
[
433,
12
],
[
415,
19
],
[
442,
32
],
[
406,
43
],
[
400,
51
],
[
454,
54
],
[
451,
59
],
[
73,
71
],
[
73,
73
],
[
78,
77
],
[
183,
81
],
[
185,
82
],
[
85,
84
],
[
90,
89
],
[
183,
100
],
[
84,
102
],
[
183,
106
],
[
84,
107
],
[
185,
112
],
[
89,
114
],
[
185,
118
],
[
89,
119
],
[
124,
123
],
[
127,
126
],
[
130,
129
],
[
133,
132
],
[
138,
137
],
[
84,
145
],
[
132,
146
],
[
89,
148
],
[
137,
149
],
[
153,
152
],
[
77,
158
],
[
84,
160
],
[
132,
161
],
[
89,
163
],
[
137,
164
],
[
170,
169
],
[
173,
172
],
[
181,
178
],
[
187,
179
],
[
169,
180
],
[
129,
180
],
[
183,
183
],
[
185,
185
],
[
187,
187
],
[
439,
189
],
[
443,
191
],
[
439,
192
],
[
439,
193
],
[
409,
195
],
[
418,
198
],
[
202,
201
],
[
398,
204
],
[
445,
206
],
[
443,
208
],
[
445,
209
],
[
403,
211
],
[
421,
214
],
[
419,
218
],
[
404,
225
],
[
413,
225
],
[
410,
226
],
[
231,
228
],
[
410,
229
],
[
404,
230
],
[
413,
230
],
[
235,
234
],
[
249,
244
],
[
228,
245
],
[
410,
246
],
[
404,
247
],
[
413,
247
],
[
422,
248
],
[
446,
248
],
[
260,
251
],
[
244,
253
],
[
228,
254
],
[
410,
255
],
[
404,
256
],
[
413,
256
],
[
422,
257
],
[
446,
257
],
[
267,
266
],
[
273,
272
],
[
404,
282
],
[
413,
282
],
[
266,
283
],
[
410,
284
],
[
422,
287
],
[
446,
287
],
[
272,
288
],
[
410,
290
],
[
404,
292
],
[
413,
292
],
[
266,
293
],
[
266,
297
],
[
272,
298
],
[
318,
301
],
[
410,
305
],
[
404,
307
],
[
413,
307
],
[
266,
308
],
[
422,
310
],
[
446,
310
],
[
272,
311
],
[
266,
314
],
[
272,
317
],
[
401,
322
],
[
325,
324
],
[
425,
327
],
[
330,
329
],
[
440,
332
],
[
324,
336
],
[
410,
337
],
[
329,
339
],
[
410,
341
],
[
324,
342
],
[
345,
344
],
[
410,
353
],
[
324,
354
],
[
329,
355
],
[
344,
356
],
[
430,
358
],
[
449,
368
],
[
404,
369
],
[
413,
369
],
[
422,
370
],
[
446,
370
],
[
431,
371
],
[
425,
377
],
[
440,
380
],
[
431,
384
],
[
387,
386
],
[
431,
394
],
[
386,
395
],
[
439,
398
],
[
400,
401
],
[
403,
404
],
[
406,
407
],
[
409,
410
],
[
445,
413
],
[
415,
416
],
[
418,
419
],
[
421,
422
],
[
439,
425
],
[
430,
431
],
[
433,
434
],
[
436,
437
],
[
439,
440
],
[
442,
443
],
[
445,
446
],
[
451,
452
],
[
454,
455
]
] | [
"#from collections import deque,defaultdict\nprintn = lambda x: print(x,end='')\ninn = lambda : int(input())\ninl = lambda: list(map(int, input().split()))\ninm = lambda: map(int, input().split())\nins = lambda : input().strip()\nDBG = True # and False\nBIG = 10**18\nR = 10**9 + 7\n\ndef ddprint(x):\n if DBG:\n print(x)\n\ndef foo(a,b,ans):\n z = d[a][b]\n for p in range(3):\n for q in range(3):\n if a-2+p<0 or a+p>=h or b-2+q<0 or b+q>=w:\n continue\n ok = True\n reachorig = False\n v = 0\n for i in range(3):\n for j in range(3):\n if p+i==q+j==2:\n reachorig = True\n if z[p+i][q+j]==1:\n if reachorig:\n v += 1\n else:\n ok = False\n break\n if ok:\n ans[v] += 1\n\nh,w,n = inm()\nd = {}\nab = []\nfor i in range(n):\n a,b = inm()\n a -= 1\n b -= 1\n ab.append((a,b))\n if a not in d:\n d[a] = {}\n d[a][b] = [[0]*5 for j in range(5)]\n d[a][b][2][2] = 1\nfor a,b in ab:\n for dx in range(-2,3):\n for dy in range(-2,3):\n if a+dx in d and b+dy in d[a+dx] and not (dx==dy==0):\n d[a+dx][b+dy][2-dx][2-dy] = 1\n\nif False and DBG:\n for i in range(h):\n for j in range(w):\n if i in d and j in d[i]:\n #print(f\"{i=} {j=}\")\n for k in range(5):\n print(d[i][j][k])\nans = [0]*10\nfor a,b in ab:\n foo(a,b,ans)\nprint((h-2)*(w-2)-sum(ans))\nfor i in range(1,10):\n print(ans[i])",
"printn = lambda x: print(x,end='')",
"printn",
"lambda x: print(x,end='')",
"print(x,end='')",
"print",
"x",
"end=''",
"end",
"''",
"x",
"inn = lambda : int(input())",
"inn",
"lambda : int(input())",
"int(input())",
"int",
"input()",
"input",
"inl = lambda: list(map(int, input().split()))",
"inl",
"lambda: list(map(int, input().split()))",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"inm = lambda: map(int, input().split())",
"inm",
"lambda: map(int, input().split())",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ins = lambda : input().strip()",
"ins",
"lambda : input().strip()",
"input().strip()",
"().strip",
"()",
"input",
"strip",
"DBG = True",
"DBG",
"True",
"BIG = 10**18",
"BIG",
"10**18",
"10",
"18",
"R = 10**9 + 7",
"R",
"10**9 + 7",
"10**9",
"10",
"9",
"7",
"def ddprint(x):\n if DBG:\n print(x)",
"ddprint",
"if DBG:\n print(x)",
"DBG",
"print(x)",
"print",
"x",
"x",
"x",
"def foo(a,b,ans):\n z = d[a][b]\n for p in range(3):\n for q in range(3):\n if a-2+p<0 or a+p>=h or b-2+q<0 or b+q>=w:\n continue\n ok = True\n reachorig = False\n v = 0\n for i in range(3):\n for j in range(3):\n if p+i==q+j==2:\n reachorig = True\n if z[p+i][q+j]==1:\n if reachorig:\n v += 1\n else:\n ok = False\n break\n if ok:\n ans[v] += 1",
"foo",
"z = d[a][b]",
"z",
"d[a][b]",
"[a]",
"d",
"a",
"b",
"for p in range(3):\n for q in range(3):\n if a-2+p<0 or a+p>=h or b-2+q<0 or b+q>=w:\n continue\n ok = True\n reachorig = False\n v = 0\n for i in range(3):\n for j in range(3):\n if p+i==q+j==2:\n reachorig = True\n if z[p+i][q+j]==1:\n if reachorig:\n v += 1\n else:\n ok = False\n break\n if ok:\n ans[v] += 1",
"p",
"range(3)",
"range",
"3",
"for q in range(3):\n if a-2+p<0 or a+p>=h or b-2+q<0 or b+q>=w:\n continue\n ok = True\n reachorig = False\n v = 0\n for i in range(3):\n for j in range(3):\n if p+i==q+j==2:\n reachorig = True\n if z[p+i][q+j]==1:\n if reachorig:\n v += 1\n else:\n ok = False\n break\n if ok:\n ans[v] += 1",
"q",
"range(3)",
"range",
"3",
"if a-2+p<0 or a+p>=h or b-2+q<0 or b+q>=w:\n continue\n ",
"a-2+p<0 or a+p>=h or b-2+q<0 or b+q>=w",
"a-2+p<0 or a+p>=h or b-2+q<0",
"a-2+p<0 or a+p>=h",
"a-2+p<0",
"a-2+p",
"a-2",
"a",
"2",
"p",
"0",
"a+p>=h",
"a+p",
"a",
"p",
"h",
"b-2+q<0",
"b-2+q",
"b-2",
"b",
"2",
"q",
"0",
"b+q>=w",
"b+q",
"b",
"q",
"w",
"continue",
"ok = True",
"ok",
"True",
"reachorig = False",
"reachorig",
"False",
"v = 0",
"v",
"0",
"for i in range(3):\n for j in range(3):\n if p+i==q+j==2:\n reachorig = True\n if z[p+i][q+j]==1:\n if reachorig:\n v += 1\n else:\n ok = False\n break\n ",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n if p+i==q+j==2:\n reachorig = True\n if z[p+i][q+j]==1:\n if reachorig:\n v += 1\n else:\n ok = False\n break\n ",
"j",
"range(3)",
"range",
"3",
"if p+i==q+j==2:\n reachorig = True\n ",
"p+i==q+j==2",
"p+i==q+j",
"p+i",
"p",
"i",
"q+j",
"q",
"j",
"2",
"reachorig = True",
"reachorig",
"True",
"if z[p+i][q+j]==1:\n if reachorig:\n v += 1\n else:\n ok = False\n break\n ",
"z[p+i][q+j]==1",
"z[p+i][q+j]",
"[p+i]",
"z",
"p+i",
"p",
"i",
"q+j",
"q",
"j",
"1",
"if reachorig:\n v += 1\n else:\n ok = False\n break\n ",
"reachorig",
"v += 1",
"v",
"1",
"ok = False",
"ok",
"False",
"break",
"if ok:\n ans[v] += 1",
"ok",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"a",
"a",
"b",
"b",
"ans",
"ans",
"h,w,n = inm()",
"h",
"inm()",
"inm",
"w",
"n",
"d = {}",
"d",
"{}",
"ab = []",
"ab",
"[]",
"for i in range(n):\n a,b = inm()\n a -= 1\n b -= 1\n ab.append((a,b))\n if a not in d:\n d[a] = {}\n d[a][b] = [[0]*5 for j in range(5)]\n d[a][b][2][2] = 1",
"i",
"range(n)",
"range",
"n",
"a,b = inm()",
"a",
"inm()",
"inm",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"ab.append((a,b))",
"ab.append",
"ab",
"append",
"(a,b)",
"a",
"b",
"if a not in d:\n d[a] = {}\n ",
"a not in d",
"a",
"d",
"d[a] = {}",
"d[a]",
"d",
"a",
"{}",
"[0]*5 for j in range(5)",
"for j in range(5)",
"j",
"range(5)",
"range",
"5",
"for j in range(5)",
"[0]*5",
"[0]",
"0",
"5",
"d[a][b] = [[0]*5 for j in range(5)]",
"d[a][b]",
"[a]",
"d",
"a",
"b",
"[[0]*5 for j in range(5)]",
"d[a][b][2][2] = 1",
"d[a][b][2][2]",
"[2]",
"[b]",
"[a]",
"d",
"a",
"b",
"2",
"2",
"1",
"for a,b in ab:\n for dx in range(-2,3):\n for dy in range(-2,3):\n if a+dx in d and b+dy in d[a+dx] and not (dx==dy==0):\n d[a+dx][b+dy][2-dx][2-dy] = 1",
"a",
"b",
"ab",
"for dx in range(-2,3):\n for dy in range(-2,3):\n if a+dx in d and b+dy in d[a+dx] and not (dx==dy==0):\n d[a+dx][b+dy][2-dx][2-dy] = 1",
"dx",
"range(-2,3)",
"range",
"-2",
"3",
"for dy in range(-2,3):\n if a+dx in d and b+dy in d[a+dx] and not (dx==dy==0):\n d[a+dx][b+dy][2-dx][2-dy] = 1",
"dy",
"range(-2,3)",
"range",
"-2",
"3",
"if a+dx in d and b+dy in d[a+dx] and not (dx==dy==0):\n d[a+dx][b+dy][2-dx][2-dy] = 1",
"a+dx in d and b+dy in d[a+dx] and not (dx==dy==0)",
"a+dx in d and b+dy in d[a+dx]",
"a+dx in d",
"a+dx",
"a",
"dx",
"d",
"b+dy in d[a+dx]",
"b+dy",
"b",
"dy",
"d[a+dx]",
"d",
"a+dx",
"a",
"dx",
"not (dx==dy==0)",
"dx==dy==0",
"dx==dy",
"dx",
"dy",
"0",
"d[a+dx][b+dy][2-dx][2-dy] = 1",
"d[a+dx][b+dy][2-dx][2-dy]",
"[2-dx]",
"[b+dy]",
"[a+dx]",
"d",
"a+dx",
"a",
"dx",
"b+dy",
"b",
"dy",
"2-dx",
"2",
"dx",
"2-dy",
"2",
"dy",
"1",
"if False and DBG:\n for i in range(h):\n for j in range(w):\n if i in d and j in d[i]:\n #print(f\"{i=} {j=}\")\n for k in range(5):\n print(d[i][j][k])",
"False and DBG",
"False",
"DBG",
"for i in range(h):\n for j in range(w):\n if i in d and j in d[i]:\n #print(f\"{i=} {j=}\")\n for k in range(5):\n print(d[i][j][k])",
"i",
"range(h)",
"range",
"h",
"for j in range(w):\n if i in d and j in d[i]:\n #print(f\"{i=} {j=}\")\n for k in range(5):\n print(d[i][j][k])",
"j",
"range(w)",
"range",
"w",
"if i in d and j in d[i]:\n #print(f\"{i=} {j=}\")\n for k in range(5):\n print(d[i][j][k])",
"i in d and j in d[i]",
"i in d",
"i",
"d",
"j in d[i]",
"j",
"d[i]",
"d",
"i",
"for k in range(5):\n print(d[i][j][k])",
"k",
"range(5)",
"range",
"5",
"print(d[i][j][k])",
"print",
"d[i][j][k]",
"[j]",
"[i]",
"d",
"i",
"j",
"k",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for a,b in ab:\n foo(a,b,ans)",
"a",
"b",
"ab",
"foo(a,b,ans)",
"foo",
"a",
"b",
"ans",
"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 range(1,10):\n print(ans[i])",
"i",
"range(1,10)",
"range",
"1",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"n = inm()",
"inm()",
"n",
"DBG = True",
"True",
"DBG",
"a -= 1",
"1",
"a",
"ins = lambda : input().strip()",
"lambda : input().strip()",
"ins",
"d = {}",
"{}",
"d",
"a,b = inm()",
"inm()",
"a",
"inl = lambda: list(map(int, input().split()))",
"lambda: list(map(int, input().split()))",
"inl",
"ab = []",
"[]",
"ab",
"b -= 1",
"1",
"b",
"h,w,n = inm()",
"inm()",
"h",
"def ddprint(x):\n if DBG:\n print(x)",
"def ddprint(x):\n if DBG:\n print(x)",
"ddprint",
"ans = [0]*10",
"[0]*10",
"ans",
"inn = lambda : int(input())",
"lambda : int(input())",
"inn",
"printn = lambda x: print(x,end='')",
"lambda x: print(x,end='')",
"printn",
"w,n = inm()",
"inm()",
"w",
"inm = lambda: map(int, input().split())",
"lambda: map(int, input().split())",
"inm",
"b = inm()",
"inm()",
"b",
"def foo(a,b,ans):\n z = d[a][b]\n for p in range(3):\n for q in range(3):\n if a-2+p<0 or a+p>=h or b-2+q<0 or b+q>=w:\n continue\n ok = True\n reachorig = False\n v = 0\n for i in range(3):\n for j in range(3):\n if p+i==q+j==2:\n reachorig = True\n if z[p+i][q+j]==1:\n if reachorig:\n v += 1\n else:\n ok = False\n break\n if ok:\n ans[v] += 1",
"def foo(a,b,ans):\n z = d[a][b]\n for p in range(3):\n for q in range(3):\n if a-2+p<0 or a+p>=h or b-2+q<0 or b+q>=w:\n continue\n ok = True\n reachorig = False\n v = 0\n for i in range(3):\n for j in range(3):\n if p+i==q+j==2:\n reachorig = True\n if z[p+i][q+j]==1:\n if reachorig:\n v += 1\n else:\n ok = False\n break\n if ok:\n ans[v] += 1",
"foo",
"R = 10**9 + 7",
"10**9 + 7",
"R",
"BIG = 10**18",
"10**18",
"BIG"
] | #from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
def foo(a,b,ans):
z = d[a][b]
for p in range(3):
for q in range(3):
if a-2+p<0 or a+p>=h or b-2+q<0 or b+q>=w:
continue
ok = True
reachorig = False
v = 0
for i in range(3):
for j in range(3):
if p+i==q+j==2:
reachorig = True
if z[p+i][q+j]==1:
if reachorig:
v += 1
else:
ok = False
break
if ok:
ans[v] += 1
h,w,n = inm()
d = {}
ab = []
for i in range(n):
a,b = inm()
a -= 1
b -= 1
ab.append((a,b))
if a not in d:
d[a] = {}
d[a][b] = [[0]*5 for j in range(5)]
d[a][b][2][2] = 1
for a,b in ab:
for dx in range(-2,3):
for dy in range(-2,3):
if a+dx in d and b+dy in d[a+dx] and not (dx==dy==0):
d[a+dx][b+dy][2-dx][2-dy] = 1
if False and DBG:
for i in range(h):
for j in range(w):
if i in d and j in d[i]:
#print(f"{i=} {j=}")
for k in range(5):
print(d[i][j][k])
ans = [0]*10
for a,b in ab:
foo(a,b,ans)
print((h-2)*(w-2)-sum(ans))
for i in range(1,10):
print(ans[i])
|
[
7,
15,
13,
15,
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,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
39,
17,
17,
17,
14,
2,
2,
2,
13,
13,
17,
2,
2,
13,
13,
2,
13,
17,
9,
28,
13,
39,
17,
17,
17,
14,
2,
2,
2,
13,
13,
17,
2,
2,
13,
13,
2,
13,
17,
9,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
0,
13,
4,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
4,
13,
4,
18,
13,
13,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
4,
13,
4,
18,
17,
13,
4,
13,
13,
13,
10,
12,
13,
10,
4,
13,
10,
17,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
12,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13
] | [
[
171,
5
],
[
201,
17
],
[
172,
22
],
[
180,
24
],
[
172,
34
],
[
204,
37
],
[
181,
39
],
[
204,
40
],
[
204,
41
],
[
207,
43
],
[
47,
46
],
[
196,
49
],
[
186,
51
],
[
181,
53
],
[
186,
54
],
[
177,
56
],
[
198,
59
],
[
63,
62
],
[
178,
71
],
[
187,
71
],
[
62,
72
],
[
178,
76
],
[
187,
76
],
[
62,
77
],
[
205,
79
],
[
84,
83
],
[
199,
92
],
[
184,
92
],
[
83,
93
],
[
199,
97
],
[
184,
97
],
[
83,
98
],
[
190,
100
],
[
208,
105
],
[
178,
109
],
[
187,
109
],
[
62,
110
],
[
199,
112
],
[
184,
112
],
[
83,
113
],
[
192,
115
],
[
208,
118
],
[
210,
120
],
[
174,
126
],
[
193,
131
],
[
175,
138
],
[
144,
141
],
[
211,
142
],
[
149,
146
],
[
211,
147
],
[
205,
152
],
[
190,
155
],
[
211,
159
],
[
211,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
],
[
180,
181
],
[
186,
184
],
[
186,
187
],
[
204,
190
],
[
192,
193
],
[
204,
196
],
[
198,
199
],
[
201,
202
],
[
204,
205
],
[
207,
208
],
[
210,
211
]
] | [
"import sys\nfrom collections import Counter\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\nH, W, N = lr()\npairs = []\nfor _ in range(N):\n a, b = lr()\n a -= 1; b -= 1\n for dh in [-2, -1, 0]:\n if a + dh < 0 or a + dh > H-3:\n continue\n for dw in [-2, -1, 0]:\n if b + dw < 0 or b + dw > W-3:\n continue\n pairs.append((a+dh, b+dw))\n\ncounter = Counter(pairs)\nanswer = [0] * 10\ncounter2 = Counter(counter.values())\nfor k, v in counter2.items():\n answer[k] = v\n\nanswer[0] = (H-2) * (W-2) - sum(answer)\nprint('\\n'.join(map(str, answer)))\n# 30",
"import sys",
"sys",
"from collections import Counter",
"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",
"pairs = []",
"pairs",
"[]",
"for _ in range(N):\n a, b = lr()\n a -= 1; b -= 1\n for dh in [-2, -1, 0]:\n if a + dh < 0 or a + dh > H-3:\n continue\n for dw in [-2, -1, 0]:\n if b + dw < 0 or b + dw > W-3:\n continue\n pairs.append((a+dh, b+dw))",
"_",
"range(N)",
"range",
"N",
"a, b = lr()",
"a",
"lr()",
"lr",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for dh in [-2, -1, 0]:\n if a + dh < 0 or a + dh > H-3:\n continue\n for dw in [-2, -1, 0]:\n if b + dw < 0 or b + dw > W-3:\n continue\n pairs.append((a+dh, b+dw))",
"dh",
"[-2, -1, 0]",
"-2",
"-1",
"0",
"if a + dh < 0 or a + dh > H-3:\n continue\n ",
"a + dh < 0 or a + dh > H-3",
"a + dh < 0",
"a + dh",
"a",
"dh",
"0",
"a + dh > H-3",
"a + dh",
"a",
"dh",
"H-3",
"H",
"3",
"continue",
"for dw in [-2, -1, 0]:\n if b + dw < 0 or b + dw > W-3:\n continue\n pairs.append((a+dh, b+dw))",
"dw",
"[-2, -1, 0]",
"-2",
"-1",
"0",
"if b + dw < 0 or b + dw > W-3:\n continue\n ",
"b + dw < 0 or b + dw > W-3",
"b + dw < 0",
"b + dw",
"b",
"dw",
"0",
"b + dw > W-3",
"b + dw",
"b",
"dw",
"W-3",
"W",
"3",
"continue",
"pairs.append((a+dh, b+dw))",
"pairs.append",
"pairs",
"append",
"(a+dh, b+dw)",
"a+dh",
"a",
"dh",
"b+dw",
"b",
"dw",
"counter = Counter(pairs)",
"counter",
"Counter(pairs)",
"Counter",
"pairs",
"answer = [0] * 10",
"answer",
"[0] * 10",
"[0]",
"0",
"10",
"counter2 = Counter(counter.values())",
"counter2",
"Counter(counter.values())",
"Counter",
"counter.values()",
"counter.values",
"counter",
"values",
"for k, v in counter2.items():\n answer[k] = v",
"k",
"v",
"counter2.items()",
"counter2.items",
"counter2",
"items",
"answer[k] = v",
"answer[k]",
"answer",
"k",
"v",
"answer[0] = (H-2) * (W-2) - sum(answer)",
"answer[0]",
"answer",
"0",
"(H-2) * (W-2) - sum(answer)",
"(H-2) * (W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(answer)",
"sum",
"answer",
"print('\\n'.join(map(str, answer)))",
"print",
"'\\n'.join(map(str, answer))",
"'\\n'.join",
"'\\n'",
"join",
"map(str, answer)",
"map",
"str",
"answer",
"sr = lambda: sys.stdin.readline().rstrip()",
"lambda: sys.stdin.readline().rstrip()",
"sr",
"counter2 = Counter(counter.values())",
"Counter(counter.values())",
"counter2",
"a -= 1",
"1",
"a",
"lr = lambda: list(map(int, sr().split()))",
"lambda: list(map(int, sr().split()))",
"lr",
"b = lr()",
"lr()",
"b",
"a, b = lr()",
"lr()",
"a",
"W, N = lr()",
"lr()",
"W",
"counter = Counter(pairs)",
"Counter(pairs)",
"counter",
"N = lr()",
"lr()",
"N",
"b -= 1",
"1",
"b",
"ir = lambda: int(sr())",
"lambda: int(sr())",
"ir",
"H, W, N = lr()",
"lr()",
"H",
"pairs = []",
"[]",
"pairs",
"answer = [0] * 10",
"[0] * 10",
"answer"
] | import sys
from collections import Counter
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
H, W, N = lr()
pairs = []
for _ in range(N):
a, b = lr()
a -= 1; b -= 1
for dh in [-2, -1, 0]:
if a + dh < 0 or a + dh > H-3:
continue
for dw in [-2, -1, 0]:
if b + dw < 0 or b + dw > W-3:
continue
pairs.append((a+dh, b+dw))
counter = Counter(pairs)
answer = [0] * 10
counter2 = Counter(counter.values())
for k, v in counter2.items():
answer[k] = v
answer[0] = (H-2) * (W-2) - sum(answer)
print('\n'.join(map(str, answer)))
# 30 |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
42,
17,
38,
5,
4,
18,
13,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
21,
22,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
17,
17,
0,
18,
13,
13,
17,
28,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
2,
2,
2,
2,
18,
13,
17,
13,
17,
2,
2,
18,
13,
17,
13,
2,
13,
17,
2,
2,
18,
13,
17,
13,
17,
2,
2,
18,
13,
17,
13,
2,
13,
17,
38,
5,
0,
18,
13,
39,
2,
18,
13,
17,
13,
2,
18,
13,
17,
13,
17,
0,
18,
13,
39,
2,
18,
13,
17,
13,
2,
18,
13,
17,
13,
17,
0,
13,
18,
13,
39,
2,
18,
13,
17,
13,
2,
18,
13,
17,
13,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
28,
13,
4,
13,
17,
4,
13,
4,
18,
17,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
39,
13,
10,
17,
13,
10,
4,
13,
10,
21,
13
] | [
[
200,
2
],
[
200,
11
],
[
200,
12
],
[
194,
14
],
[
195,
22
],
[
197,
35
],
[
203,
38
],
[
51,
50
],
[
59,
56
],
[
204,
57
],
[
50,
58
],
[
62,
61
],
[
195,
61
],
[
65,
64
],
[
71,
70
],
[
61,
82
],
[
64,
84
],
[
61,
89
],
[
64,
91
],
[
186,
93
],
[
61,
98
],
[
70,
100
],
[
61,
105
],
[
70,
107
],
[
189,
109
],
[
127,
114
],
[
198,
115
],
[
61,
119
],
[
64,
121
],
[
61,
124
],
[
70,
126
],
[
142,
129
],
[
198,
130
],
[
61,
134
],
[
64,
136
],
[
61,
139
],
[
70,
141
],
[
191,
144
],
[
198,
146
],
[
61,
150
],
[
64,
152
],
[
61,
155
],
[
70,
157
],
[
162,
159
],
[
204,
160
],
[
192,
161
],
[
169,
164
],
[
204,
165
],
[
192,
167
],
[
172,
171
],
[
56,
181
],
[
204,
182
],
[
171,
183
],
[
200,
186
],
[
200,
189
],
[
191,
192
],
[
194,
195
],
[
197,
198
],
[
200,
201
],
[
203,
204
]
] | [
"h,w,n=map(int,input().split())\nls=[]\nwhile True:\n try:\n ls.append(tuple(map(int,input().split())))\n except EOFError:break\ncheck={}\ncount={0:(h-2)*(w-2)}\nfor i in range(1,10):\n count[i]=0\nfor tup in ls:\n for i in range(-2,1):\n for j in range(-2,1):\n if(tup[0]+i>0 and tup[0]+i<h-1 and tup[1]+j>0 and tup[1]+j<w-1):\n try:\n check[(tup[0]+i,tup[1]+j)]+=1\n except KeyError:\n check[(tup[0]+i,tup[1]+j)]=1\n index=check[(tup[0]+i,tup[1]+j)]\n count[index]+=1\n count[index-1]-=1\nfor i in range(10):\n print(\"{}\".format(count[i]))",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"ls=[]",
"ls",
"[]",
"while True:\n try:\n ls.append(tuple(map(int,input().split())))\n except EOFError:break",
"True",
"try:\n ls.append(tuple(map(int,input().split())))\n except EOFError:break",
"except EOFError:b",
"ls.append(tuple(map(int,input().split())))",
"ls.append",
"ls",
"append",
"tuple(map(int,input().split()))",
"tuple",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"check={}",
"check",
"{}",
"count={0:(h-2)*(w-2)}",
"count",
"{0:(h-2)*(w-2)}",
"0",
"0",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"for i in range(1,10):\n count[i]=0",
"i",
"range(1,10)",
"range",
"1",
"10",
"count[i]=0",
"count[i]",
"count",
"i",
"0",
"for tup in ls:\n for i in range(-2,1):\n for j in range(-2,1):\n if(tup[0]+i>0 and tup[0]+i<h-1 and tup[1]+j>0 and tup[1]+j<w-1):\n try:\n check[(tup[0]+i,tup[1]+j)]+=1\n except KeyError:\n check[(tup[0]+i,tup[1]+j)]=1\n index=check[(tup[0]+i,tup[1]+j)]\n count[index]+=1\n count[index-1]-=1",
"tup",
"ls",
"for i in range(-2,1):\n for j in range(-2,1):\n if(tup[0]+i>0 and tup[0]+i<h-1 and tup[1]+j>0 and tup[1]+j<w-1):\n try:\n check[(tup[0]+i,tup[1]+j)]+=1\n except KeyError:\n check[(tup[0]+i,tup[1]+j)]=1\n index=check[(tup[0]+i,tup[1]+j)]\n count[index]+=1\n count[index-1]-=1",
"i",
"range(-2,1)",
"range",
"-2",
"1",
"for j in range(-2,1):\n if(tup[0]+i>0 and tup[0]+i<h-1 and tup[1]+j>0 and tup[1]+j<w-1):\n try:\n check[(tup[0]+i,tup[1]+j)]+=1\n except KeyError:\n check[(tup[0]+i,tup[1]+j)]=1\n index=check[(tup[0]+i,tup[1]+j)]\n count[index]+=1\n count[index-1]-=1",
"j",
"range(-2,1)",
"range",
"-2",
"1",
"if(tup[0]+i>0 and tup[0]+i<h-1 and tup[1]+j>0 and tup[1]+j<w-1):\n try:\n check[(tup[0]+i,tup[1]+j)]+=1\n except KeyError:\n check[(tup[0]+i,tup[1]+j)]=1\n index=check[(tup[0]+i,tup[1]+j)]\n count[index]+=1\n count[index-1]-=1",
"tup[0]+i>0 and tup[0]+i<h-1 and tup[1]+j>0 and tup[1]+j<w-1",
"tup[0]+i>0 and tup[0]+i<h-1 and tup[1]+j>0",
"tup[0]+i>0 and tup[0]+i<h-1",
"tup[0]+i>0",
"tup[0]+i",
"tup[0]",
"tup",
"0",
"i",
"0",
"tup[0]+i<h-1",
"tup[0]+i",
"tup[0]",
"tup",
"0",
"i",
"h-1",
"h",
"1",
"tup[1]+j>0",
"tup[1]+j",
"tup[1]",
"tup",
"1",
"j",
"0",
"tup[1]+j<w-1",
"tup[1]+j",
"tup[1]",
"tup",
"1",
"j",
"w-1",
"w",
"1",
"try:\n check[(tup[0]+i,tup[1]+j)]+=1\n except KeyError:\n check[(tup[0]+i,tup[1]+j)]=1\n ",
"except KeyError:\n check[(tup[0]+i,tup[1]+j)]=1\n ",
"check[(tup[0]+i,tup[1]+j)]=1",
"check[(tup[0]+i,tup[1]+j)]",
"check",
"(tup[0]+i,tup[1]+j)",
"tup[0]+i",
"tup[0]",
"tup",
"0",
"i",
"tup[1]+j",
"tup[1]",
"tup",
"1",
"j",
"1",
"check[(tup[0]+i,tup[1]+j)]+=1",
"check[(tup[0]+i,tup[1]+j)]",
"check",
"(tup[0]+i,tup[1]+j)",
"tup[0]+i",
"tup[0]",
"tup",
"0",
"i",
"tup[1]+j",
"tup[1]",
"tup",
"1",
"j",
"1",
"index=check[(tup[0]+i,tup[1]+j)]",
"index",
"check[(tup[0]+i,tup[1]+j)]",
"check",
"(tup[0]+i,tup[1]+j)",
"tup[0]+i",
"tup[0]",
"tup",
"0",
"i",
"tup[1]+j",
"tup[1]",
"tup",
"1",
"j",
"count[index]+=1",
"count[index]",
"count",
"index",
"1",
"count[index-1]-=1",
"count[index-1]",
"count",
"index-1",
"index",
"1",
"1",
"for i in range(10):\n print(\"{}\".format(count[i]))",
"i",
"range(10)",
"range",
"10",
"print(\"{}\".format(count[i]))",
"print",
"\"{}\".format(count[i])",
"\"{}\".format",
"\"{}\"",
"format",
"count[i]",
"count",
"i",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"index=check[(tup[0]+i,tup[1]+j)]",
"check[(tup[0]+i,tup[1]+j)]",
"index",
"ls=[]",
"[]",
"ls",
"check={}",
"{}",
"check",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"count={0:(h-2)*(w-2)}",
"{0:(h-2)*(w-2)}",
"count"
] | h,w,n=map(int,input().split())
ls=[]
while True:
try:
ls.append(tuple(map(int,input().split())))
except EOFError:break
check={}
count={0:(h-2)*(w-2)}
for i in range(1,10):
count[i]=0
for tup in ls:
for i in range(-2,1):
for j in range(-2,1):
if(tup[0]+i>0 and tup[0]+i<h-1 and tup[1]+j>0 and tup[1]+j<w-1):
try:
check[(tup[0]+i,tup[1]+j)]+=1
except KeyError:
check[(tup[0]+i,tup[1]+j)]=1
index=check[(tup[0]+i,tup[1]+j)]
count[index]+=1
count[index-1]-=1
for i in range(10):
print("{}".format(count[i])) |
[
7,
15,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
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,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
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,
4,
13,
4,
18,
13,
13,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
28,
13,
13,
4,
18,
13,
13,
14,
2,
13,
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,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
183,
4
],
[
183,
13
],
[
183,
14
],
[
177,
16
],
[
174,
46
],
[
52,
51
],
[
184,
54
],
[
189,
56
],
[
189,
65
],
[
181,
76
],
[
169,
79
],
[
190,
85
],
[
166,
88
],
[
100,
91
],
[
175,
92
],
[
181,
95
],
[
190,
98
],
[
186,
102
],
[
175,
107
],
[
112,
111
],
[
171,
118
],
[
187,
125
],
[
135,
132
],
[
172,
133
],
[
140,
137
],
[
172,
138
],
[
169,
143
],
[
166,
146
],
[
172,
151
],
[
156,
155
],
[
172,
162
],
[
155,
163
],
[
183,
166
],
[
183,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
],
[
189,
181
],
[
183,
184
],
[
186,
187
],
[
189,
190
]
] | [
"from collections import defaultdict\nfrom collections import Counter\n\nH, W, N = map(int, input().split())\n\n# 3*3マスの処理用リスト\ndir = [[0, 0], [1, 0], [1, 1], [0, 1], [-1, 1],\n [-1, 0], [-1, -1], [0, -1], [1, -1]]\n\n# そのマスを中心とする3*3グリッドに含まれる黒マスの数\ndict = defaultdict(int)\n\nfor i in range(N):\n a, b = map(int, input().split())\n for dy, dx in dir:\n # 3*3グリッドは、H*Wの中に完全に含まれていなければならないことに注意\n if 2 <= a + dy <= H - 1 and 2 <= b + dx <= W - 1:\n dict[(a + dy, b + dx)] += 1\n\nc = Counter(dict.values())\nans = [0 for _ in range(10)]\n\n# ans[1], ans[2], ..., ans[9]を確定させる(ans[0]は後述)\nfor k, v in c.items():\n if v > 0:\n ans[k] = v\n\n# 全体で作れる3*3グリッドは(H-2)*(W-2)個\n# ans[1],...,ans[9]の総和を引くとans[0]になる\nans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n\nfor i in range(10):\n print(ans[i])",
"from collections import defaultdict",
"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",
"dir = [[0, 0], [1, 0], [1, 1], [0, 1], [-1, 1],\n [-1, 0], [-1, -1], [0, -1], [1, -1]]",
"dir",
"[[0, 0], [1, 0], [1, 1], [0, 1], [-1, 1],\n [-1, 0], [-1, -1], [0, -1], [1, -1]]",
"[0, 0]",
"0",
"0",
"[1, 0]",
"1",
"0",
"[1, 1]",
"1",
"1",
"[0, 1]",
"0",
"1",
"[-1, 1]",
"-1",
"1",
"[-1, 0]",
"-1",
"0",
"[-1, -1]",
"-1",
"-1",
"[0, -1]",
"0",
"-1",
"[1, -1]",
"1",
"-1",
"dict = defaultdict(int)",
"dict",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n a, b = map(int, input().split())\n for dy, dx in dir:\n # 3*3グリッドは、H*Wの中に完全に含まれていなければならないことに注意\n if 2 <= a + dy <= H - 1 and 2 <= b + dx <= W - 1:\n dict[(a + dy, b + dx)] += 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 dy, dx in dir:\n # 3*3グリッドは、H*Wの中に完全に含まれていなければならないことに注意\n if 2 <= a + dy <= H - 1 and 2 <= b + dx <= W - 1:\n dict[(a + dy, b + dx)] += 1",
"dy",
"dx",
"dir",
"if 2 <= a + dy <= H - 1 and 2 <= b + dx <= W - 1:\n dict[(a + dy, b + dx)] += 1",
"2 <= a + dy <= H - 1 and 2 <= b + dx <= W - 1",
"2 <= a + dy <= H - 1",
"2 <= a + dy",
"2",
"a + dy",
"a",
"dy",
"H - 1",
"H",
"1",
"2 <= b + dx <= W - 1",
"2 <= b + dx",
"2",
"b + dx",
"b",
"dx",
"W - 1",
"W",
"1",
"dict[(a + dy, b + dx)] += 1",
"dict[(a + dy, b + dx)]",
"dict",
"(a + dy, b + dx)",
"a + dy",
"a",
"dy",
"b + dx",
"b",
"dx",
"1",
"c = Counter(dict.values())",
"c",
"Counter(dict.values())",
"Counter",
"dict.values()",
"dict.values",
"dict",
"values",
"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)]",
"for k, v in c.items():\n if v > 0:\n ans[k] = v\n\n# 全体で作れる3*3グリッドは(H-2)*(W-2)個\n# ans[1],...,ans[9]の総和を引くとans[0]になる",
"k",
"v",
"c.items()",
"c.items",
"c",
"items",
"if v > 0:\n ans[k] = v\n\n# 全体で作れる3*3グリッドは(H-2)*(W-2)個\n# ans[1],...,ans[9]の総和を引くとans[0]になる",
"v > 0",
"v",
"0",
"ans[k] = v",
"ans[k]",
"ans",
"k",
"v",
"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 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",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"ans = [0 for _ in range(10)]",
"[0 for _ in range(10)]",
"ans",
"dict = defaultdict(int)",
"defaultdict(int)",
"dict",
"dir = [[0, 0], [1, 0], [1, 1], [0, 1], [-1, 1],\n [-1, 0], [-1, -1], [0, -1], [1, -1]]",
"[[0, 0], [1, 0], [1, 1], [0, 1], [-1, 1],\n [-1, 0], [-1, -1], [0, -1], [1, -1]]",
"dir",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"c = Counter(dict.values())",
"Counter(dict.values())",
"c",
"b = map(int, input().split())",
"map(int, input().split())",
"b"
] | from collections import defaultdict
from collections import Counter
H, W, N = map(int, input().split())
# 3*3マスの処理用リスト
dir = [[0, 0], [1, 0], [1, 1], [0, 1], [-1, 1],
[-1, 0], [-1, -1], [0, -1], [1, -1]]
# そのマスを中心とする3*3グリッドに含まれる黒マスの数
dict = defaultdict(int)
for i in range(N):
a, b = map(int, input().split())
for dy, dx in dir:
# 3*3グリッドは、H*Wの中に完全に含まれていなければならないことに注意
if 2 <= a + dy <= H - 1 and 2 <= b + dx <= W - 1:
dict[(a + dy, b + dx)] += 1
c = Counter(dict.values())
ans = [0 for _ in range(10)]
# ans[1], ans[2], ..., ans[9]を確定させる(ans[0]は後述)
for k, v in c.items():
if v > 0:
ans[k] = v
# 全体で作れる3*3グリッドは(H-2)*(W-2)個
# ans[1],...,ans[9]の総和を引くとans[0]になる
ans[0] = (H - 2) * (W - 2) - sum(ans[1:])
for i in range(10):
print(ans[i])
|
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
18,
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,
0,
13,
2,
2,
13,
17,
13,
0,
13,
2,
2,
13,
17,
13,
14,
2,
2,
2,
40,
17,
13,
2,
2,
13,
17,
13,
40,
17,
13,
2,
2,
13,
17,
13,
0,
18,
13,
39,
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,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] | [
[
152,
4
],
[
152,
13
],
[
152,
14
],
[
143,
16
],
[
24,
23
],
[
147,
26
],
[
134,
28
],
[
134,
37
],
[
40,
39
],
[
45,
44
],
[
131,
49
],
[
135,
52
],
[
39,
54
],
[
149,
56
],
[
129,
59
],
[
44,
61
],
[
132,
68
],
[
132,
71
],
[
153,
73
],
[
150,
76
],
[
150,
79
],
[
141,
81
],
[
88,
83
],
[
144,
84
],
[
137,
90
],
[
97,
96
],
[
144,
99
],
[
105,
102
],
[
138,
103
],
[
96,
104
],
[
110,
107
],
[
138,
108
],
[
153,
113
],
[
141,
116
],
[
138,
120
],
[
123,
122
],
[
138,
122
],
[
122,
126
],
[
134,
129
],
[
131,
132
],
[
134,
135
],
[
137,
138
],
[
152,
141
],
[
143,
144
],
[
152,
147
],
[
149,
150
],
[
152,
153
]
] | [
"# O(N)\nimport collections\nH, W, N = map(int, input().split())\ntable = collections.defaultdict(int) # (left, top) of 3x3 block => black count\nfor i in range(N):\n a, b = map(int, input().split())\n for yy in range(3):\n for xx in range(3):\n y = a - 1 - yy\n x = b - 1 - xx\n if 0 <= y and y + 2 < H and 0 <= x and x + 2 < W:\n table[(y, x)] += 1\ncounts = [0] * 10\nfor v in table.values():\n counts[v] += 1\ncounts[0] = (H - 2) * (W - 2) - sum(counts)\nfor c in counts:\n print(c)",
"import collections",
"collections",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"table = collections.defaultdict(int)",
"table",
"collections.defaultdict(int)",
"collections.defaultdict",
"collections",
"defaultdict",
"int",
"for i in range(N):\n a, b = map(int, input().split())\n for yy in range(3):\n for xx in range(3):\n y = a - 1 - yy\n x = b - 1 - xx\n if 0 <= y and y + 2 < H and 0 <= x and x + 2 < W:\n table[(y, 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 yy in range(3):\n for xx in range(3):\n y = a - 1 - yy\n x = b - 1 - xx\n if 0 <= y and y + 2 < H and 0 <= x and x + 2 < W:\n table[(y, x)] += 1",
"yy",
"range(3)",
"range",
"3",
"for xx in range(3):\n y = a - 1 - yy\n x = b - 1 - xx\n if 0 <= y and y + 2 < H and 0 <= x and x + 2 < W:\n table[(y, x)] += 1",
"xx",
"range(3)",
"range",
"3",
"y = a - 1 - yy",
"y",
"a - 1 - yy",
"a - 1",
"a",
"1",
"yy",
"x = b - 1 - xx",
"x",
"b - 1 - xx",
"b - 1",
"b",
"1",
"xx",
"if 0 <= y and y + 2 < H and 0 <= x and x + 2 < W:\n table[(y, x)] += 1",
"0 <= y and y + 2 < H and 0 <= x and x + 2 < W",
"0 <= y and y + 2 < H and 0 <= x",
"0 <= y and y + 2 < H",
"0 <= y",
"0",
"y",
"y + 2 < H",
"y + 2",
"y",
"2",
"H",
"0 <= x",
"0",
"x",
"x + 2 < W",
"x + 2",
"x",
"2",
"W",
"table[(y, x)] += 1",
"table[(y, x)]",
"table",
"(y, x)",
"y",
"x",
"1",
"counts = [0] * 10",
"counts",
"[0] * 10",
"[0]",
"0",
"10",
"for v in table.values():\n counts[v] += 1",
"v",
"table.values()",
"table.values",
"table",
"values",
"counts[v] += 1",
"counts[v]",
"counts",
"v",
"1",
"counts[0] = (H - 2) * (W - 2) - sum(counts)",
"counts[0]",
"counts",
"0",
"(H - 2) * (W - 2) - sum(counts)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(counts)",
"sum",
"counts",
"for c in counts:\n print(c)",
"c",
"counts",
"print(c)",
"print",
"c",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"y = a - 1 - yy",
"a - 1 - yy",
"y",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"counts = [0] * 10",
"[0] * 10",
"counts",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"table = collections.defaultdict(int)",
"collections.defaultdict(int)",
"table",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"x = b - 1 - xx",
"b - 1 - xx",
"x",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H"
] | # O(N)
import collections
H, W, N = map(int, input().split())
table = collections.defaultdict(int) # (left, top) of 3x3 block => black count
for i in range(N):
a, b = map(int, input().split())
for yy in range(3):
for xx in range(3):
y = a - 1 - yy
x = b - 1 - xx
if 0 <= y and y + 2 < H and 0 <= x and x + 2 < W:
table[(y, x)] += 1
counts = [0] * 10
for v in table.values():
counts[v] += 1
counts[0] = (H - 2) * (W - 2) - sum(counts)
for c in counts:
print(c)
|
[
7,
12,
13,
41,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
4,
39,
2,
13,
17,
2,
13,
17,
0,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
13,
13,
0,
13,
2,
13,
13,
13,
2,
13,
13,
14,
2,
2,
2,
40,
13,
17,
40,
13,
13,
40,
13,
17,
40,
13,
13,
14,
2,
39,
13,
13,
13,
0,
13,
18,
13,
39,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
0,
18,
13,
39,
13,
13,
17,
0,
18,
13,
17,
17,
0,
18,
13,
17,
17,
0,
18,
13,
39,
13,
13,
17,
4,
13,
4,
18,
17,
13,
4,
13,
13,
13,
4,
13,
10,
12,
13
] | [
[
6,
5
],
[
11,
10
],
[
5,
17
],
[
10,
20
],
[
24,
23
],
[
27,
26
],
[
27,
35
],
[
27,
36
],
[
39,
38
],
[
42,
41
],
[
50,
47
],
[
41,
48
],
[
35,
52
],
[
26,
55
],
[
59,
58
],
[
36,
61
],
[
64,
63
],
[
64,
72
],
[
79,
78
],
[
63,
80
],
[
83,
82
],
[
72,
84
],
[
78,
91
],
[
78,
94
],
[
26,
95
],
[
82,
97
],
[
82,
100
],
[
35,
101
],
[
38,
107
],
[
110,
109
],
[
38,
111
],
[
119,
116
],
[
41,
117
],
[
109,
118
],
[
126,
121
],
[
41,
122
],
[
109,
124
],
[
133,
128
],
[
38,
129
],
[
138,
135
],
[
41,
136
],
[
143,
140
],
[
41,
141
],
[
150,
145
],
[
38,
146
],
[
41,
160
],
[
165,
162
]
] | [
"def solve():\n diff = [(i-1,j-1) for i in range(3) for j in range(3)]\n H,W,N = map(int, input().split())\n count_dict = {}\n ret = [0]*10\n ret[0] = (W-2)*(H-2)\n for i in range(N):\n a, b = map(int,input().split())\n # da = min(a, W-a, 2)+1\n # db = min(b, H-b, 2)+1\n # rect_num = da*db\n for da,db in diff:\n ra, rb = a+da, b+db\n if ra <= 1 or ra >= H or rb <= 1 or rb >= W : continue\n # if (ra,rb) == (4,2): print(i+1, a, b, ra, rb)\n if (ra,rb) in count_dict:\n dom = count_dict[(ra,rb)]\n ret[dom] -= 1\n ret[dom+1] += 1\n count_dict[(ra,rb)] += 1\n else:\n ret[0] -= 1\n ret[1] += 1\n count_dict[(ra,rb)] = 1\n \n # print(count_dict)\n print('\\n'.join(map(str,ret)))\n \nsolve()",
"def solve():\n diff = [(i-1,j-1) for i in range(3) for j in range(3)]\n H,W,N = map(int, input().split())\n count_dict = {}\n ret = [0]*10\n ret[0] = (W-2)*(H-2)\n for i in range(N):\n a, b = map(int,input().split())\n # da = min(a, W-a, 2)+1\n # db = min(b, H-b, 2)+1\n # rect_num = da*db\n for da,db in diff:\n ra, rb = a+da, b+db\n if ra <= 1 or ra >= H or rb <= 1 or rb >= W : continue\n # if (ra,rb) == (4,2): print(i+1, a, b, ra, rb)\n if (ra,rb) in count_dict:\n dom = count_dict[(ra,rb)]\n ret[dom] -= 1\n ret[dom+1] += 1\n count_dict[(ra,rb)] += 1\n else:\n ret[0] -= 1\n ret[1] += 1\n count_dict[(ra,rb)] = 1\n \n # print(count_dict)\n print('\\n'.join(map(str,ret)))\n ",
"solve",
"(i-1,j-1) for i in range(3) for j in range(3)",
"for i in range(3) for j in range(3)",
"i",
"range(3)",
"range",
"3",
"for j in range(3)",
"j",
"range(3)",
"range",
"3",
"for j in range(3)",
"(i-1,j-1)",
"i-1",
"i",
"1",
"j-1",
"j",
"1",
"diff = [(i-1,j-1) for i in range(3) for j in range(3)]",
"diff",
"[(i-1,j-1) for i in range(3) for j in range(3)]",
"H,W,N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"count_dict = {}",
"count_dict",
"{}",
"ret = [0]*10",
"ret",
"[0]*10",
"[0]",
"0",
"10",
"ret[0] = (W-2)*(H-2)",
"ret[0]",
"ret",
"0",
"(W-2)*(H-2)",
"W-2",
"W",
"2",
"H-2",
"H",
"2",
"for i in range(N):\n a, b = map(int,input().split())\n # da = min(a, W-a, 2)+1\n # db = min(b, H-b, 2)+1\n # rect_num = da*db\n for da,db in diff:\n ra, rb = a+da, b+db\n if ra <= 1 or ra >= H or rb <= 1 or rb >= W : continue\n # if (ra,rb) == (4,2): print(i+1, a, b, ra, rb)\n if (ra,rb) in count_dict:\n dom = count_dict[(ra,rb)]\n ret[dom] -= 1\n ret[dom+1] += 1\n count_dict[(ra,rb)] += 1\n else:\n ret[0] -= 1\n ret[1] += 1\n count_dict[(ra,rb)] = 1\n \n # print(count_dict)\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 da,db in diff:\n ra, rb = a+da, b+db\n if ra <= 1 or ra >= H or rb <= 1 or rb >= W : continue\n # if (ra,rb) == (4,2): print(i+1, a, b, ra, rb)\n if (ra,rb) in count_dict:\n dom = count_dict[(ra,rb)]\n ret[dom] -= 1\n ret[dom+1] += 1\n count_dict[(ra,rb)] += 1\n else:\n ret[0] -= 1\n ret[1] += 1\n count_dict[(ra,rb)] = 1\n \n # print(count_dict)\n ",
"da",
"db",
"diff",
"ra, rb = a+da, b+db",
"ra",
"a+da",
"a",
"da",
"rb",
"b+db",
"b",
"db",
"if ra <= 1 or ra >= H or rb <= 1 or rb >= W : continue\n # if (ra,rb) == (4,2): print(i+1, a, b, ra, rb)\n ",
"ra <= 1 or ra >= H or rb <= 1 or rb >= W",
"ra <= 1 or ra >= H or rb <= 1",
"ra <= 1 or ra >= H",
"ra <= 1",
"ra",
"1",
"ra >= H",
"ra",
"H",
"rb <= 1",
"rb",
"1",
"rb >= W",
"rb",
"W",
"if (ra,rb) in count_dict:\n dom = count_dict[(ra,rb)]\n ret[dom] -= 1\n ret[dom+1] += 1\n count_dict[(ra,rb)] += 1\n else:\n ret[0] -= 1\n ret[1] += 1\n count_dict[(ra,rb)] = 1\n \n # print(count_dict)\n ",
"(ra,rb) in count_dict",
"(ra,rb)",
"ra",
"rb",
"count_dict",
"dom = count_dict[(ra,rb)]",
"dom",
"count_dict[(ra,rb)]",
"count_dict",
"(ra,rb)",
"ra",
"rb",
"ret[dom] -= 1",
"ret[dom]",
"ret",
"dom",
"1",
"ret[dom+1] += 1",
"ret[dom+1]",
"ret",
"dom+1",
"dom",
"1",
"1",
"count_dict[(ra,rb)] += 1",
"count_dict[(ra,rb)]",
"count_dict",
"(ra,rb)",
"ra",
"rb",
"1",
"ret[0] -= 1",
"ret[0]",
"ret",
"0",
"1",
"ret[1] += 1",
"ret[1]",
"ret",
"1",
"1",
"count_dict[(ra,rb)] = 1",
"count_dict[(ra,rb)]",
"count_dict",
"(ra,rb)",
"ra",
"rb",
"1",
"print('\\n'.join(map(str,ret)))",
"print",
"'\\n'.join(map(str,ret))",
"'\\n'.join",
"'\\n'",
"join",
"map(str,ret)",
"map",
"str",
"ret",
"solve()",
"solve",
"def solve():\n diff = [(i-1,j-1) for i in range(3) for j in range(3)]\n H,W,N = map(int, input().split())\n count_dict = {}\n ret = [0]*10\n ret[0] = (W-2)*(H-2)\n for i in range(N):\n a, b = map(int,input().split())\n # da = min(a, W-a, 2)+1\n # db = min(b, H-b, 2)+1\n # rect_num = da*db\n for da,db in diff:\n ra, rb = a+da, b+db\n if ra <= 1 or ra >= H or rb <= 1 or rb >= W : continue\n # if (ra,rb) == (4,2): print(i+1, a, b, ra, rb)\n if (ra,rb) in count_dict:\n dom = count_dict[(ra,rb)]\n ret[dom] -= 1\n ret[dom+1] += 1\n count_dict[(ra,rb)] += 1\n else:\n ret[0] -= 1\n ret[1] += 1\n count_dict[(ra,rb)] = 1\n \n # print(count_dict)\n print('\\n'.join(map(str,ret)))\n ",
"def solve():\n diff = [(i-1,j-1) for i in range(3) for j in range(3)]\n H,W,N = map(int, input().split())\n count_dict = {}\n ret = [0]*10\n ret[0] = (W-2)*(H-2)\n for i in range(N):\n a, b = map(int,input().split())\n # da = min(a, W-a, 2)+1\n # db = min(b, H-b, 2)+1\n # rect_num = da*db\n for da,db in diff:\n ra, rb = a+da, b+db\n if ra <= 1 or ra >= H or rb <= 1 or rb >= W : continue\n # if (ra,rb) == (4,2): print(i+1, a, b, ra, rb)\n if (ra,rb) in count_dict:\n dom = count_dict[(ra,rb)]\n ret[dom] -= 1\n ret[dom+1] += 1\n count_dict[(ra,rb)] += 1\n else:\n ret[0] -= 1\n ret[1] += 1\n count_dict[(ra,rb)] = 1\n \n # print(count_dict)\n print('\\n'.join(map(str,ret)))\n ",
"solve"
] | def solve():
diff = [(i-1,j-1) for i in range(3) for j in range(3)]
H,W,N = map(int, input().split())
count_dict = {}
ret = [0]*10
ret[0] = (W-2)*(H-2)
for i in range(N):
a, b = map(int,input().split())
# da = min(a, W-a, 2)+1
# db = min(b, H-b, 2)+1
# rect_num = da*db
for da,db in diff:
ra, rb = a+da, b+db
if ra <= 1 or ra >= H or rb <= 1 or rb >= W : continue
# if (ra,rb) == (4,2): print(i+1, a, b, ra, rb)
if (ra,rb) in count_dict:
dom = count_dict[(ra,rb)]
ret[dom] -= 1
ret[dom+1] += 1
count_dict[(ra,rb)] += 1
else:
ret[0] -= 1
ret[1] += 1
count_dict[(ra,rb)] = 1
# print(count_dict)
print('\n'.join(map(str,ret)))
solve() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.