node_ids
sequencelengths 4
1.4k
| edge_index
sequencelengths 1
2.22k
| text
sequencelengths 4
1.4k
| source
stringlengths 14
427k
|
---|---|---|---|
[
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,
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,
13,
2,
39,
17,
17,
28,
13,
13,
4,
13,
4,
18,
13,
13,
0,
13,
12,
18,
13,
17,
23,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
2,
13,
17,
17,
2,
2,
13,
17,
17,
4,
13,
13,
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
],
[
49,
61
],
[
64,
63
],
[
19,
74
],
[
64,
78
],
[
81,
80
],
[
84,
83
],
[
87,
86
],
[
80,
93
],
[
63,
93
],
[
33,
98
],
[
80,
101
],
[
63,
101
],
[
105,
104
],
[
83,
111
],
[
78,
111
],
[
48,
116
],
[
83,
119
],
[
78,
119
],
[
125,
122
],
[
51,
123
],
[
86,
124
],
[
128,
127
],
[
51,
139
],
[
143,
142
],
[
152,
149
],
[
127,
150
],
[
157,
154
],
[
127,
155
],
[
33,
161
],
[
48,
166
],
[
127,
171
],
[
174,
173
],
[
127,
180
],
[
173,
181
],
[
190,
187
]
] | [
"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 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 ls = [0] * 10\n for k, v in sorted(d.items(), key=lambda x: x[1]):\n ls[v] += 1\n ls[0] = (h - 3 + 1) * (w - 3 + 1) - sum(ls)\n for i in range(10):\n print(ls[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 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 ls = [0] * 10\n for k, v in sorted(d.items(), key=lambda x: x[1]):\n ls[v] += 1\n ls[0] = (h - 3 + 1) * (w - 3 + 1) - sum(ls)\n for i in range(10):\n print(ls[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",
"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 ",
"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 ",
"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 ",
"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",
"ls = [0] * 10",
"ls",
"[0] * 10",
"[0]",
"0",
"10",
"for k, v in sorted(d.items(), key=lambda x: x[1]):\n ls[v] += 1\n ",
"k",
"v",
"sorted(d.items(), key=lambda x: x[1])",
"sorted",
"d.items()",
"d.items",
"d",
"items",
"key=lambda x: x[1]",
"key",
"lambda x: x[1]",
"x[1]",
"x",
"1",
"x",
"ls[v] += 1",
"ls[v]",
"ls",
"v",
"1",
"ls[0] = (h - 3 + 1) * (w - 3 + 1) - sum(ls)",
"ls[0]",
"ls",
"0",
"(h - 3 + 1) * (w - 3 + 1) - sum(ls)",
"(h - 3 + 1) * (w - 3 + 1)",
"h - 3 + 1",
"h - 3",
"h",
"3",
"1",
"w - 3 + 1",
"w - 3",
"w",
"3",
"1",
"sum(ls)",
"sum",
"ls",
"for i in range(10):\n print(ls[i])",
"i",
"range(10)",
"range",
"10",
"print(ls[i])",
"print",
"ls[i]",
"ls",
"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 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 ls = [0] * 10\n for k, v in sorted(d.items(), key=lambda x: x[1]):\n ls[v] += 1\n ls[0] = (h - 3 + 1) * (w - 3 + 1) - sum(ls)\n for i in range(10):\n print(ls[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 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 ls = [0] * 10\n for k, v in sorted(d.items(), key=lambda x: x[1]):\n ls[v] += 1\n ls[0] = (h - 3 + 1) * (w - 3 + 1) - sum(ls)\n for i in range(10):\n print(ls[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)
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
ls = [0] * 10
for k, v in sorted(d.items(), key=lambda x: x[1]):
ls[v] += 1
ls[0] = (h - 3 + 1) * (w - 3 + 1) - sum(ls)
for i in range(10):
print(ls[i])
if __name__ == '__main__':
slove()
|
[
7,
15,
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,
0,
13,
2,
13,
17,
13,
2,
13,
17,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
14,
2,
2,
2,
40,
17,
2,
13,
17,
2,
2,
13,
17,
13,
40,
17,
2,
13,
17,
2,
2,
13,
17,
13,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
2,
2,
2,
13,
13,
2,
17,
13,
2,
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,
13,
4,
13,
18,
13,
39,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13
] | [
[
174,
3
],
[
174,
12
],
[
174,
13
],
[
177,
15
],
[
162,
18
],
[
24,
23
],
[
172,
26
],
[
180,
28
],
[
180,
37
],
[
186,
39
],
[
181,
41
],
[
187,
41
],
[
183,
43
],
[
169,
45
],
[
184,
45
],
[
49,
48
],
[
55,
54
],
[
192,
60
],
[
187,
62
],
[
181,
62
],
[
54,
63
],
[
165,
65
],
[
184,
67
],
[
169,
67
],
[
48,
68
],
[
193,
76
],
[
193,
80
],
[
157,
82
],
[
166,
86
],
[
166,
90
],
[
175,
92
],
[
99,
94
],
[
163,
95
],
[
159,
101
],
[
157,
106
],
[
175,
107
],
[
175,
110
],
[
157,
113
],
[
189,
116
],
[
163,
126
],
[
132,
129
],
[
190,
130
],
[
137,
134
],
[
190,
135
],
[
160,
138
],
[
190,
142
],
[
147,
146
],
[
190,
153
],
[
146,
154
],
[
174,
157
],
[
159,
160
],
[
162,
163
],
[
165,
166
],
[
180,
169
],
[
174,
172
],
[
174,
175
],
[
177,
178
],
[
180,
181
],
[
183,
184
],
[
186,
187
],
[
189,
190
],
[
192,
193
]
] | [
"from collections import defaultdict\n\nH,W,N=map(int,input().split())\nab=[]\ndict=defaultdict(int)\nfor i in range(N):\n a,b=map(int,input().split())\n a,b=a-1,b-1\n for x in [-1,0,1]:\n for y in [-1,0,1]:\n Y=a+y\n X=b+x\n if 0<=Y-1 and Y+1<H and 0<=X-1 and X+1<W:\n dict[(X,Y)]+=1\nM=H*W-2*W-2*H+4\nv=[0]*10\nfor i,j in dict.items():\n v[j]+=1\nv[0]=M-sum(v[1:])\nfor i in range(10):\n print(v[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",
"ab=[]",
"ab",
"[]",
"dict=defaultdict(int)",
"dict",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n a,b=map(int,input().split())\n a,b=a-1,b-1\n for x in [-1,0,1]:\n for y in [-1,0,1]:\n Y=a+y\n X=b+x\n if 0<=Y-1 and Y+1<H and 0<=X-1 and X+1<W:\n dict[(X,Y)]+=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 x in [-1,0,1]:\n for y in [-1,0,1]:\n Y=a+y\n X=b+x\n if 0<=Y-1 and Y+1<H and 0<=X-1 and X+1<W:\n dict[(X,Y)]+=1",
"x",
"[-1,0,1]",
"-1",
"0",
"1",
"for y in [-1,0,1]:\n Y=a+y\n X=b+x\n if 0<=Y-1 and Y+1<H and 0<=X-1 and X+1<W:\n dict[(X,Y)]+=1",
"y",
"[-1,0,1]",
"-1",
"0",
"1",
"Y=a+y",
"Y",
"a+y",
"a",
"y",
"X=b+x",
"X",
"b+x",
"b",
"x",
"if 0<=Y-1 and Y+1<H and 0<=X-1 and X+1<W:\n dict[(X,Y)]+=1",
"0<=Y-1 and Y+1<H and 0<=X-1 and X+1<W",
"0<=Y-1 and Y+1<H and 0<=X-1",
"0<=Y-1 and Y+1<H",
"0<=Y-1",
"0",
"Y-1",
"Y",
"1",
"Y+1<H",
"Y+1",
"Y",
"1",
"H",
"0<=X-1",
"0",
"X-1",
"X",
"1",
"X+1<W",
"X+1",
"X",
"1",
"W",
"dict[(X,Y)]+=1",
"dict[(X,Y)]",
"dict",
"(X,Y)",
"X",
"Y",
"1",
"M=H*W-2*W-2*H+4",
"M",
"H*W-2*W-2*H+4",
"H*W-2*W-2*H",
"H*W-2*W",
"H*W",
"H",
"W",
"2*W",
"2",
"W",
"2*H",
"2",
"H",
"4",
"v=[0]*10",
"v",
"[0]*10",
"[0]",
"0",
"10",
"for i,j in dict.items():\n v[j]+=1",
"i",
"j",
"dict.items()",
"dict.items",
"dict",
"items",
"v[j]+=1",
"v[j]",
"v",
"j",
"1",
"v[0]=M-sum(v[1:])",
"v[0]",
"v",
"0",
"M-sum(v[1:])",
"M",
"sum(v[1:])",
"sum",
"v[1:]",
"v",
"1:",
"1",
"for i in range(10):\n print(v[i])",
"i",
"range(10)",
"range",
"10",
"print(v[i])",
"print",
"v[i]",
"v",
"i",
"H,W,N=map(int,input().split())",
"map(int,input().split())",
"H",
"M=H*W-2*W-2*H+4",
"H*W-2*W-2*H+4",
"M",
"dict=defaultdict(int)",
"defaultdict(int)",
"dict",
"X=b+x",
"b+x",
"X",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"W,N=map(int,input().split())",
"map(int,input().split())",
"W",
"ab=[]",
"[]",
"ab",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"b=a-1,b-1",
"b-1",
"b",
"a,b=a-1,b-1",
"a-1",
"a",
"v=[0]*10",
"[0]*10",
"v",
"Y=a+y",
"a+y",
"Y"
] | from collections import defaultdict
H,W,N=map(int,input().split())
ab=[]
dict=defaultdict(int)
for i in range(N):
a,b=map(int,input().split())
a,b=a-1,b-1
for x in [-1,0,1]:
for y in [-1,0,1]:
Y=a+y
X=b+x
if 0<=Y-1 and Y+1<H and 0<=X-1 and X+1<W:
dict[(X,Y)]+=1
M=H*W-2*W-2*H+4
v=[0]*10
for i,j in dict.items():
v[j]+=1
v[0]=M-sum(v[1:])
for i in range(10):
print(v[i])
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
12,
13,
12,
13,
12,
13,
12,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
39,
15,
0,
13,
4,
13,
13,
0,
13,
2,
39,
17,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
17,
4,
18,
13,
13,
39,
13,
13,
12,
13,
14,
2,
2,
2,
13,
17,
13,
2,
2,
13,
17,
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,
39,
13,
13,
17,
29,
13,
29,
17,
23,
13,
23,
13,
12,
13,
28,
13,
4,
13,
17,
17,
17,
28,
13,
4,
13,
17,
17,
17,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
14,
2,
40,
13,
17,
40,
13,
17,
14,
40,
18,
13,
39,
13,
13,
0,
13,
4,
13,
13,
13,
14,
40,
13,
17,
0,
18,
13,
4,
13,
13,
13,
17,
23,
13,
23,
13,
28,
13,
13,
0,
13,
18,
13,
17,
13,
18,
13,
17,
4,
13,
13,
13,
0,
13,
4,
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,
4,
13,
10,
12,
13,
10,
12,
13,
10,
18,
13,
10,
12,
13,
10,
12,
13
] | [
[
248,
4
],
[
20,
19
],
[
27,
26
],
[
243,
28
],
[
27,
29
],
[
27,
30
],
[
33,
32
],
[
39,
38
],
[
44,
43
],
[
50,
49
],
[
30,
52
],
[
55,
54
],
[
243,
56
],
[
55,
57
],
[
60,
59
],
[
63,
62
],
[
32,
66
],
[
129,
77
],
[
26,
79
],
[
131,
82
],
[
29,
84
],
[
87,
86
],
[
90,
89
],
[
95,
94
],
[
100,
99
],
[
129,
101
],
[
89,
102
],
[
105,
104
],
[
131,
106
],
[
94,
107
],
[
32,
113
],
[
116,
115
],
[
123,
118
],
[
38,
119
],
[
115,
125
],
[
86,
125
],
[
129,
129
],
[
131,
131
],
[
136,
135
],
[
143,
142
],
[
150,
149
],
[
192,
151
],
[
135,
152
],
[
155,
154
],
[
194,
156
],
[
142,
157
],
[
149,
161
],
[
154,
164
],
[
38,
169
],
[
175,
174
],
[
72,
176
],
[
149,
177
],
[
154,
178
],
[
174,
181
],
[
190,
184
],
[
43,
185
],
[
72,
187
],
[
149,
188
],
[
154,
189
],
[
192,
192
],
[
194,
194
],
[
197,
196
],
[
32,
196
],
[
200,
199
],
[
196,
201
],
[
204,
203
],
[
196,
205
],
[
133,
208
],
[
199,
209
],
[
203,
210
],
[
213,
212
],
[
43,
215
],
[
220,
217
],
[
43,
218
],
[
26,
223
],
[
29,
226
],
[
212,
228
],
[
231,
230
],
[
43,
237
],
[
230,
238
],
[
252,
240
],
[
248,
249
]
] | [
"import sys\ninput = sys.stdin.readline\n\ndef I(): return int(input())\ndef MI(): return map(int, input().split())\ndef LI(): return list(map(int, input().split()))\n\ndef main():\n mod=10**9+7\n H,W,N=MI()\n B=set([])\n from collections import defaultdict\n used = defaultdict(int)\n ans=[0]*10\n \n for _ in range(N):\n a,b=MI()\n a-=1\n b-=1\n B.add((a,b))\n \n def cnt(i,j):#i,jが左上の9ます\n if i+2<H and j+2<W:\n temp=0\n for di in range(3):\n for dj in range(3):\n ii=i+di\n jj=j+dj\n if (ii,jj) in B:\n temp+=1\n used[(i,j)]=1\n return temp\n return -1\n \n def se(i,j):#i,jが中心の25ます\n for di in range(-2,1,1):\n for dj in range(-2,1,1):\n ii=i+di\n jj=j+dj\n if ii>=0 and jj>=0:\n if not used[(ii,jj)]:\n cc=cnt(ii,jj)\n if cc!=-1:\n #print(ii,jj,cc)\n ans[cnt(ii,jj)]+=1\n \n for k in B:\n i,j=k[0],k[1]\n se(i,j)\n \n S=sum(ans)\n ans[0]=(H-2)*(W-2) - S\n for i in range(10):\n print(ans[i])\n \n\nmain()",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"def I(): return int(input())",
"I",
"def MI(): return map(int, input().split())",
"MI",
"def LI(): return list(map(int, input().split()))",
"LI",
"def main():\n mod=10**9+7\n H,W,N=MI()\n B=set([])\n from collections import defaultdict\n used = defaultdict(int)\n ans=[0]*10\n \n for _ in range(N):\n a,b=MI()\n a-=1\n b-=1\n B.add((a,b))\n \n def cnt(i,j):#i,jが左上の9ます\n if i+2<H and j+2<W:\n temp=0\n for di in range(3):\n for dj in range(3):\n ii=i+di\n jj=j+dj\n if (ii,jj) in B:\n temp+=1\n used[(i,j)]=1\n return temp\n return -1\n \n def se(i,j):#i,jが中心の25ます\n for di in range(-2,1,1):\n for dj in range(-2,1,1):\n ii=i+di\n jj=j+dj\n if ii>=0 and jj>=0:\n if not used[(ii,jj)]:\n cc=cnt(ii,jj)\n if cc!=-1:\n #print(ii,jj,cc)\n ans[cnt(ii,jj)]+=1\n \n for k in B:\n i,j=k[0],k[1]\n se(i,j)\n \n S=sum(ans)\n ans[0]=(H-2)*(W-2) - S\n for i in range(10):\n print(ans[i])\n ",
"main",
"mod=10**9+7",
"mod",
"10**9+7",
"10**9",
"10",
"9",
"7",
"H,W,N=MI()",
"H",
"MI()",
"MI",
"W",
"N",
"B=set([])",
"B",
"set([])",
"set",
"[]",
"from collections import defaultdict",
"used = defaultdict(int)",
"used",
"defaultdict(int)",
"defaultdict",
"int",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for _ in range(N):\n a,b=MI()\n a-=1\n b-=1\n B.add((a,b))\n \n ",
"_",
"range(N)",
"range",
"N",
"a,b=MI()",
"a",
"MI()",
"MI",
"b",
"a-=1",
"a",
"1",
"b-=1",
"b",
"1",
"B.add((a,b))",
"B.add",
"B",
"add",
"(a,b)",
"a",
"b",
"def cnt(i,j):#i,jが左上の9ます\n if i+2<H and j+2<W:\n temp=0\n for di in range(3):\n for dj in range(3):\n ii=i+di\n jj=j+dj\n if (ii,jj) in B:\n temp+=1\n used[(i,j)]=1\n return temp\n return -1\n \n ",
"cnt",
"if i+2<H and j+2<W:\n temp=0\n for di in range(3):\n for dj in range(3):\n ii=i+di\n jj=j+dj\n if (ii,jj) in B:\n temp+=1\n used[(i,j)]=1\n return temp\n ",
"i+2<H and j+2<W",
"i+2<H",
"i+2",
"i",
"2",
"H",
"j+2<W",
"j+2",
"j",
"2",
"W",
"temp=0",
"temp",
"0",
"for di in range(3):\n for dj in range(3):\n ii=i+di\n jj=j+dj\n if (ii,jj) in B:\n temp+=1\n ",
"di",
"range(3)",
"range",
"3",
"for dj in range(3):\n ii=i+di\n jj=j+dj\n if (ii,jj) in B:\n temp+=1\n ",
"dj",
"range(3)",
"range",
"3",
"ii=i+di",
"ii",
"i+di",
"i",
"di",
"jj=j+dj",
"jj",
"j+dj",
"j",
"dj",
"if (ii,jj) in B:\n temp+=1\n ",
"(ii,jj) in B",
"(ii,jj)",
"ii",
"jj",
"B",
"temp+=1",
"temp",
"1",
"used[(i,j)]=1",
"used[(i,j)]",
"used",
"(i,j)",
"i",
"j",
"1",
"return temp",
"temp",
"return -1",
"-1",
"i",
"i",
"j",
"j",
"def se(i,j):#i,jが中心の25ます\n for di in range(-2,1,1):\n for dj in range(-2,1,1):\n ii=i+di\n jj=j+dj\n if ii>=0 and jj>=0:\n if not used[(ii,jj)]:\n cc=cnt(ii,jj)\n if cc!=-1:\n #print(ii,jj,cc)\n ans[cnt(ii,jj)]+=1\n \n ",
"se",
"for di in range(-2,1,1):\n for dj in range(-2,1,1):\n ii=i+di\n jj=j+dj\n if ii>=0 and jj>=0:\n if not used[(ii,jj)]:\n cc=cnt(ii,jj)\n if cc!=-1:\n #print(ii,jj,cc)\n ans[cnt(ii,jj)]+=1\n \n ",
"di",
"range(-2,1,1)",
"range",
"-2",
"1",
"1",
"for dj in range(-2,1,1):\n ii=i+di\n jj=j+dj\n if ii>=0 and jj>=0:\n if not used[(ii,jj)]:\n cc=cnt(ii,jj)\n if cc!=-1:\n #print(ii,jj,cc)\n ans[cnt(ii,jj)]+=1\n \n ",
"dj",
"range(-2,1,1)",
"range",
"-2",
"1",
"1",
"ii=i+di",
"ii",
"i+di",
"i",
"di",
"jj=j+dj",
"jj",
"j+dj",
"j",
"dj",
"if ii>=0 and jj>=0:\n if not used[(ii,jj)]:\n cc=cnt(ii,jj)\n if cc!=-1:\n #print(ii,jj,cc)\n ans[cnt(ii,jj)]+=1\n \n ",
"ii>=0 and jj>=0",
"ii>=0",
"ii",
"0",
"jj>=0",
"jj",
"0",
"if not used[(ii,jj)]:\n cc=cnt(ii,jj)\n if cc!=-1:\n #print(ii,jj,cc)\n ans[cnt(ii,jj)]+=1\n \n ",
"not used[(ii,jj)]",
"used[(ii,jj)]",
"used",
"(ii,jj)",
"ii",
"jj",
"cc=cnt(ii,jj)",
"cc",
"cnt(ii,jj)",
"cnt",
"ii",
"jj",
"if cc!=-1:\n #print(ii,jj,cc)\n ans[cnt(ii,jj)]+=1\n \n ",
"cc!=-1",
"cc",
"-1",
"ans[cnt(ii,jj)]+=1",
"ans[cnt(ii,jj)]",
"ans",
"cnt(ii,jj)",
"cnt",
"ii",
"jj",
"1",
"i",
"i",
"j",
"j",
"for k in B:\n i,j=k[0],k[1]\n se(i,j)\n \n ",
"k",
"B",
"i,j=k[0],k[1]",
"i",
"k[0]",
"k",
"0",
"j",
"k[1]",
"k",
"1",
"se(i,j)",
"se",
"i",
"j",
"S=sum(ans)",
"S",
"sum(ans)",
"sum",
"ans",
"ans[0]=(H-2)*(W-2) - S",
"ans[0]",
"ans",
"0",
"(H-2)*(W-2) - S",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"S",
"for i in range(10):\n print(ans[i])\n ",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"main()",
"main",
"def MI(): return map(int, input().split())",
"def MI(): return map(int, input().split())",
"MI",
"def I(): return int(input())",
"def I(): return int(input())",
"I",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"def main():\n mod=10**9+7\n H,W,N=MI()\n B=set([])\n from collections import defaultdict\n used = defaultdict(int)\n ans=[0]*10\n \n for _ in range(N):\n a,b=MI()\n a-=1\n b-=1\n B.add((a,b))\n \n def cnt(i,j):#i,jが左上の9ます\n if i+2<H and j+2<W:\n temp=0\n for di in range(3):\n for dj in range(3):\n ii=i+di\n jj=j+dj\n if (ii,jj) in B:\n temp+=1\n used[(i,j)]=1\n return temp\n return -1\n \n def se(i,j):#i,jが中心の25ます\n for di in range(-2,1,1):\n for dj in range(-2,1,1):\n ii=i+di\n jj=j+dj\n if ii>=0 and jj>=0:\n if not used[(ii,jj)]:\n cc=cnt(ii,jj)\n if cc!=-1:\n #print(ii,jj,cc)\n ans[cnt(ii,jj)]+=1\n \n for k in B:\n i,j=k[0],k[1]\n se(i,j)\n \n S=sum(ans)\n ans[0]=(H-2)*(W-2) - S\n for i in range(10):\n print(ans[i])\n ",
"def main():\n mod=10**9+7\n H,W,N=MI()\n B=set([])\n from collections import defaultdict\n used = defaultdict(int)\n ans=[0]*10\n \n for _ in range(N):\n a,b=MI()\n a-=1\n b-=1\n B.add((a,b))\n \n def cnt(i,j):#i,jが左上の9ます\n if i+2<H and j+2<W:\n temp=0\n for di in range(3):\n for dj in range(3):\n ii=i+di\n jj=j+dj\n if (ii,jj) in B:\n temp+=1\n used[(i,j)]=1\n return temp\n return -1\n \n def se(i,j):#i,jが中心の25ます\n for di in range(-2,1,1):\n for dj in range(-2,1,1):\n ii=i+di\n jj=j+dj\n if ii>=0 and jj>=0:\n if not used[(ii,jj)]:\n cc=cnt(ii,jj)\n if cc!=-1:\n #print(ii,jj,cc)\n ans[cnt(ii,jj)]+=1\n \n for k in B:\n i,j=k[0],k[1]\n se(i,j)\n \n S=sum(ans)\n ans[0]=(H-2)*(W-2) - S\n for i in range(10):\n print(ans[i])\n ",
"main",
"def LI(): return list(map(int, input().split()))",
"def LI(): return list(map(int, input().split()))",
"LI"
] | import sys
input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
H,W,N=MI()
B=set([])
from collections import defaultdict
used = defaultdict(int)
ans=[0]*10
for _ in range(N):
a,b=MI()
a-=1
b-=1
B.add((a,b))
def cnt(i,j):#i,jが左上の9ます
if i+2<H and j+2<W:
temp=0
for di in range(3):
for dj in range(3):
ii=i+di
jj=j+dj
if (ii,jj) in B:
temp+=1
used[(i,j)]=1
return temp
return -1
def se(i,j):#i,jが中心の25ます
for di in range(-2,1,1):
for dj in range(-2,1,1):
ii=i+di
jj=j+dj
if ii>=0 and jj>=0:
if not used[(ii,jj)]:
cc=cnt(ii,jj)
if cc!=-1:
#print(ii,jj,cc)
ans[cnt(ii,jj)]+=1
for k in B:
i,j=k[0],k[1]
se(i,j)
S=sum(ans)
ans[0]=(H-2)*(W-2) - S
for i in range(10):
print(ans[i])
main()
|
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
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,
17,
40,
2,
13,
13,
2,
13,
17,
40,
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,
2,
4,
18,
13,
13,
13,
17,
17,
0,
13,
4,
13,
4,
18,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
17,
0,
13,
2,
13,
4,
18,
13,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
13,
28,
13,
4,
13,
17,
17,
4,
13,
4,
18,
13,
13,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13
] | [
[
181,
2
],
[
181,
13
],
[
181,
14
],
[
178,
16
],
[
20,
19
],
[
164,
22
],
[
175,
24
],
[
175,
35
],
[
38,
37
],
[
44,
43
],
[
158,
54
],
[
37,
55
],
[
176,
59
],
[
43,
60
],
[
158,
64
],
[
37,
65
],
[
167,
67
],
[
176,
71
],
[
43,
72
],
[
182,
74
],
[
160,
77
],
[
158,
83
],
[
37,
84
],
[
176,
89
],
[
43,
90
],
[
95,
92
],
[
179,
93
],
[
161,
94
],
[
179,
98
],
[
161,
100
],
[
169,
104
],
[
179,
109
],
[
154,
112
],
[
116,
115
],
[
172,
121
],
[
155,
123
],
[
173,
123
],
[
170,
126
],
[
115,
128
],
[
167,
134
],
[
182,
137
],
[
173,
139
],
[
155,
139
],
[
142,
141
],
[
170,
150
],
[
141,
152
],
[
154,
155
],
[
175,
158
],
[
160,
161
],
[
181,
164
],
[
181,
167
],
[
169,
170
],
[
172,
173
],
[
175,
176
],
[
178,
179
],
[
181,
182
]
] | [
"H, W, N = list(map(int, input().split()))\nans = {}\nfor i in range(N):\n a, b = list(map(int, input().split()))\n for j in range(-1, 2):\n for k in range(-1, 2):\n if (a+j)>=2 and (b+k)>=2 and (a+j)<=(H-1) and (b+k)<=(W-1):\n key = str(a+j) + \"_\" + str(b+k)\n ans[key] = ans.get(key, 0) + 1\nans_value = list(ans.values())\nans_n0 = 0\nfor i in range(1, 10):\n ans_n0 = ans_n0 + ans_value.count(i)\nprint((H-2)*(W-2)-ans_n0)\nfor i in range(1, 10):\n print(ans_value.count(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",
"ans = {}",
"ans",
"{}",
"for i in range(N):\n a, b = list(map(int, input().split()))\n for j in range(-1, 2):\n for k in range(-1, 2):\n if (a+j)>=2 and (b+k)>=2 and (a+j)<=(H-1) and (b+k)<=(W-1):\n key = str(a+j) + \"_\" + str(b+k)\n ans[key] = ans.get(key, 0) + 1",
"i",
"range(N)",
"range",
"N",
"a, b = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for j in range(-1, 2):\n for k in range(-1, 2):\n if (a+j)>=2 and (b+k)>=2 and (a+j)<=(H-1) and (b+k)<=(W-1):\n key = str(a+j) + \"_\" + str(b+k)\n ans[key] = ans.get(key, 0) + 1",
"j",
"range(-1, 2)",
"range",
"-1",
"2",
"for k in range(-1, 2):\n if (a+j)>=2 and (b+k)>=2 and (a+j)<=(H-1) and (b+k)<=(W-1):\n key = str(a+j) + \"_\" + str(b+k)\n ans[key] = ans.get(key, 0) + 1",
"k",
"range(-1, 2)",
"range",
"-1",
"2",
"if (a+j)>=2 and (b+k)>=2 and (a+j)<=(H-1) and (b+k)<=(W-1):\n key = str(a+j) + \"_\" + str(b+k)\n ans[key] = ans.get(key, 0) + 1",
"(a+j)>=2 and (b+k)>=2 and (a+j)<=(H-1) and (b+k)<=(W-1)",
"(a+j)>=2 and (b+k)>=2 and (a+j)<=(H-1)",
"(a+j)>=2 and (b+k)>=2",
"(a+j)>=2",
"a+j",
"a",
"j",
"2",
"(b+k)>=2",
"b+k",
"b",
"k",
"2",
"(a+j)<=(H-1)",
"a+j",
"a",
"j",
"H-1",
"H",
"1",
"(b+k)<=(W-1)",
"b+k",
"b",
"k",
"W-1",
"W",
"1",
"key = str(a+j) + \"_\" + str(b+k)",
"key",
"str(a+j) + \"_\" + str(b+k)",
"str(a+j) + \"_\"",
"str(a+j)",
"str",
"a+j",
"a",
"j",
"\"_\"",
"str(b+k)",
"str",
"b+k",
"b",
"k",
"ans[key] = ans.get(key, 0) + 1",
"ans[key]",
"ans",
"key",
"ans.get(key, 0) + 1",
"ans.get(key, 0)",
"ans.get",
"ans",
"get",
"key",
"0",
"1",
"ans_value = list(ans.values())",
"ans_value",
"list(ans.values())",
"list",
"ans.values()",
"ans.values",
"ans",
"values",
"ans_n0 = 0",
"ans_n0",
"0",
"for i in range(1, 10):\n ans_n0 = ans_n0 + ans_value.count(i)",
"i",
"range(1, 10)",
"range",
"1",
"10",
"ans_n0 = ans_n0 + ans_value.count(i)",
"ans_n0",
"ans_n0 + ans_value.count(i)",
"ans_n0",
"ans_value.count(i)",
"ans_value.count",
"ans_value",
"count",
"i",
"print((H-2)*(W-2)-ans_n0)",
"print",
"(H-2)*(W-2)-ans_n0",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"ans_n0",
"for i in range(1, 10):\n print(ans_value.count(i))",
"i",
"range(1, 10)",
"range",
"1",
"10",
"print(ans_value.count(i))",
"print",
"ans_value.count(i)",
"ans_value.count",
"ans_value",
"count",
"i",
"ans_n0 = 0",
"0",
"ans_n0",
"a, b = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"key = str(a+j) + \"_\" + str(b+k)",
"str(a+j) + \"_\" + str(b+k)",
"key",
"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",
"ans_value = list(ans.values())",
"list(ans.values())",
"ans_value",
"ans_n0 = ans_n0 + ans_value.count(i)",
"ans_n0 + ans_value.count(i)",
"ans_n0",
"b = list(map(int, input().split()))",
"list(map(int, input().split()))",
"b",
"ans = {}",
"{}",
"ans",
"W, N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"W"
] | H, W, N = list(map(int, input().split()))
ans = {}
for i in range(N):
a, b = list(map(int, input().split()))
for j in range(-1, 2):
for k in range(-1, 2):
if (a+j)>=2 and (b+k)>=2 and (a+j)<=(H-1) and (b+k)<=(W-1):
key = str(a+j) + "_" + str(b+k)
ans[key] = ans.get(key, 0) + 1
ans_value = list(ans.values())
ans_n0 = 0
for i in range(1, 10):
ans_n0 = ans_n0 + ans_value.count(i)
print((H-2)*(W-2)-ans_n0)
for i in range(1, 10):
print(ans_value.count(i))
|
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
15,
41,
28,
13,
4,
13,
17,
4,
4,
13,
0,
13,
13,
0,
13,
17,
28,
13,
13,
13,
28,
13,
13,
4,
13,
39,
17,
17,
17,
0,
13,
17,
0,
13,
2,
2,
13,
13,
17,
0,
13,
2,
2,
13,
13,
17,
14,
2,
2,
2,
40,
13,
17,
40,
2,
13,
17,
13,
40,
13,
17,
40,
2,
13,
17,
13,
9,
0,
18,
13,
39,
13,
13,
2,
4,
18,
13,
13,
39,
13,
13,
17,
17,
15,
0,
13,
4,
13,
4,
18,
13,
13,
41,
28,
13,
4,
13,
17,
17,
4,
4,
18,
13,
13,
13,
17,
0,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13
] | [
[
188,
2
],
[
188,
13
],
[
188,
14
],
[
18,
17
],
[
189,
20
],
[
173,
33
],
[
39,
38
],
[
170,
46
],
[
191,
49
],
[
66,
65
],
[
179,
68
],
[
182,
75
],
[
180,
86
],
[
177,
90
],
[
180,
92
],
[
183,
94
],
[
168,
98
],
[
183,
100
],
[
108,
103
],
[
192,
104
],
[
192,
111
],
[
164,
120
],
[
192,
125
],
[
130,
129
],
[
165,
137
],
[
129,
139
],
[
185,
142
],
[
177,
149
],
[
168,
152
],
[
186,
156
],
[
159,
158
],
[
186,
158
],
[
158,
162
],
[
164,
165
],
[
188,
168
],
[
170,
171
],
[
173,
174
],
[
188,
177
],
[
179,
180
],
[
182,
183
],
[
185,
186
],
[
188,
189
],
[
191,
192
]
] | [
"H, W, N = list(map(int, input().split()))\nAB = [list(map(int, input().split())) for _ in range(N)]\n\nfrom itertools import product\n\nS = [set() for _ in range(10)]\n# S[i]: set(黒いマスをi個こ含む3*3マスの中心セル)\n\nmemo = {}\nfor a,b in AB:\n for x,y in product([-1,0,1], repeat=2):\n X = a+x-1\n Y = b+y-1\n if X<=0 or H-1<=X or Y<=0 or W-1<=Y:\n continue\n memo[(X,Y)] = memo.get((X,Y),0) + 1\n\n#print(memo)\n\nfrom collections import Counter\nc = Counter(memo.values())\nL = [c.get(i,0) for i in range(1,10)]\n\nprint((H-2)*(W-2) - sum(L))\n\nfor l in L:\n print(l)",
"H, W, N = list(map(int, input().split()))",
"H",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"list(map(int, input().split())) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"AB = [list(map(int, input().split())) for _ in range(N)]",
"AB",
"[list(map(int, input().split())) for _ in range(N)]",
"from itertools import product",
"set() for _ in range(10)",
"for _ in range(10)",
"_",
"range(10)",
"range",
"10",
"for _ in range(10)",
"set()",
"set",
"S = [set() for _ in range(10)]",
"S",
"[set() for _ in range(10)]",
"memo = {}",
"memo",
"{}",
"for a,b in AB:\n for x,y in product([-1,0,1], repeat=2):\n X = a+x-1\n Y = b+y-1\n if X<=0 or H-1<=X or Y<=0 or W-1<=Y:\n continue\n memo[(X,Y)] = memo.get((X,Y),0) + 1\n\n#print(memo)",
"a",
"b",
"AB",
"for x,y in product([-1,0,1], repeat=2):\n X = a+x-1\n Y = b+y-1\n if X<=0 or H-1<=X or Y<=0 or W-1<=Y:\n continue\n memo[(X,Y)] = memo.get((X,Y),0) + 1\n\n#print(memo)",
"x",
"y",
"product([-1,0,1], repeat=2)",
"product",
"[-1,0,1]",
"-1",
"0",
"1",
"repeat=2",
"repeat",
"2",
"X = a+x-1",
"X",
"a+x-1",
"a+x",
"a",
"x",
"1",
"Y = b+y-1",
"Y",
"b+y-1",
"b+y",
"b",
"y",
"1",
"if X<=0 or H-1<=X or Y<=0 or W-1<=Y:\n continue\n ",
"X<=0 or H-1<=X or Y<=0 or W-1<=Y",
"X<=0 or H-1<=X or Y<=0",
"X<=0 or H-1<=X",
"X<=0",
"X",
"0",
"H-1<=X",
"H-1",
"H",
"1",
"X",
"Y<=0",
"Y",
"0",
"W-1<=Y",
"W-1",
"W",
"1",
"Y",
"continue",
"memo[(X,Y)] = memo.get((X,Y),0) + 1",
"memo[(X,Y)]",
"memo",
"(X,Y)",
"X",
"Y",
"memo.get((X,Y),0) + 1",
"memo.get((X,Y),0)",
"memo.get",
"memo",
"get",
"(X,Y)",
"X",
"Y",
"0",
"1",
"from collections import Counter",
"c = Counter(memo.values())",
"c",
"Counter(memo.values())",
"Counter",
"memo.values()",
"memo.values",
"memo",
"values",
"c.get(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)",
"c.get(i,0)",
"c.get",
"c",
"get",
"i",
"0",
"L = [c.get(i,0) for i in range(1,10)]",
"L",
"[c.get(i,0) for i in range(1,10)]",
"print((H-2)*(W-2) - sum(L))",
"print",
"(H-2)*(W-2) - sum(L)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(L)",
"sum",
"L",
"for l in L:\n print(l)",
"l",
"L",
"print(l)",
"print",
"l",
"c = Counter(memo.values())",
"Counter(memo.values())",
"c",
"W, N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"W",
"S = [set() for _ in range(10)]",
"[set() for _ in range(10)]",
"S",
"AB = [list(map(int, input().split())) for _ in range(N)]",
"[list(map(int, input().split())) for _ in range(N)]",
"AB",
"H, W, N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"H",
"X = a+x-1",
"a+x-1",
"X",
"Y = b+y-1",
"b+y-1",
"Y",
"L = [c.get(i,0) for i in range(1,10)]",
"[c.get(i,0) for i in range(1,10)]",
"L",
"N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"N",
"memo = {}",
"{}",
"memo"
] | H, W, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
from itertools import product
S = [set() for _ in range(10)]
# S[i]: set(黒いマスをi個こ含む3*3マスの中心セル)
memo = {}
for a,b in AB:
for x,y in product([-1,0,1], repeat=2):
X = a+x-1
Y = b+y-1
if X<=0 or H-1<=X or Y<=0 or W-1<=Y:
continue
memo[(X,Y)] = memo.get((X,Y),0) + 1
#print(memo)
from collections import Counter
c = Counter(memo.values())
L = [c.get(i,0) for i in range(1,10)]
print((H-2)*(W-2) - sum(L))
for l in L:
print(l) |
[
7,
15,
13,
4,
18,
13,
13,
17,
12,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
17,
2,
18,
13,
13,
17,
0,
13,
4,
13,
2,
13,
17,
18,
13,
13,
0,
13,
4,
13,
17,
2,
18,
13,
13,
17,
0,
13,
4,
13,
2,
13,
17,
18,
13,
13,
28,
13,
4,
13,
13,
13,
28,
13,
4,
13,
13,
13,
4,
18,
13,
13,
39,
13,
13,
4,
18,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
0,
18,
13,
17,
17,
0,
18,
13,
13,
17,
0,
13,
17,
14,
4,
13,
13,
0,
18,
13,
17,
17,
0,
18,
13,
13,
17,
28,
13,
13,
4,
13,
13,
29,
23,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
17,
2,
18,
13,
13,
17,
0,
13,
4,
13,
2,
13,
17,
18,
13,
13,
0,
13,
4,
13,
17,
2,
18,
13,
13,
17,
0,
13,
4,
13,
2,
13,
17,
18,
13,
13,
28,
13,
4,
13,
13,
13,
28,
13,
4,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
18,
18,
13,
2,
13,
13,
2,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
0,
18,
18,
13,
2,
18,
13,
13,
17,
2,
18,
13,
13,
17,
17,
28,
13,
13,
4,
13,
13,
29,
23,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
12,
13,
28,
13,
18,
13,
13,
28,
13,
4,
18,
13,
13,
27,
13,
0,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
0,
13,
2,
39,
4,
13,
13,
0,
13,
2,
39,
4,
13,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
4,
13,
4,
13,
13,
0,
18,
13,
13,
4,
13,
4,
13,
13,
4,
13,
13,
13,
13,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] | [
[
12,
11
],
[
20,
17
],
[
11,
18
],
[
159,
22
],
[
157,
25
],
[
29,
28
],
[
32,
31
],
[
161,
34
],
[
37,
36
],
[
163,
42
],
[
31,
43
],
[
47,
46
],
[
157,
50
],
[
163,
53
],
[
31,
54
],
[
57,
56
],
[
165,
62
],
[
31,
63
],
[
67,
66
],
[
159,
70
],
[
165,
73
],
[
31,
74
],
[
77,
76
],
[
36,
79
],
[
46,
80
],
[
83,
82
],
[
56,
85
],
[
66,
86
],
[
28,
89
],
[
28,
96
],
[
100,
99
],
[
103,
102
],
[
28,
108
],
[
28,
112
],
[
102,
113
],
[
28,
115
],
[
102,
117
],
[
121,
120
],
[
126,
123
],
[
11,
124
],
[
131,
128
],
[
11,
129
],
[
99,
130
],
[
133,
130
],
[
120,
130
],
[
134,
133
],
[
28,
138
],
[
143,
140
],
[
11,
141
],
[
148,
145
],
[
11,
146
],
[
133,
147
],
[
120,
147
],
[
99,
147
],
[
151,
150
],
[
11,
150
],
[
150,
154
],
[
157,
157
],
[
159,
159
],
[
161,
161
],
[
163,
163
],
[
165,
165
],
[
170,
169
],
[
178,
175
],
[
169,
176
],
[
310,
180
],
[
308,
183
],
[
187,
186
],
[
190,
189
],
[
312,
192
],
[
195,
194
],
[
314,
200
],
[
189,
201
],
[
205,
204
],
[
308,
208
],
[
314,
211
],
[
189,
212
],
[
215,
214
],
[
316,
220
],
[
189,
221
],
[
225,
224
],
[
310,
228
],
[
316,
231
],
[
189,
232
],
[
235,
234
],
[
194,
237
],
[
204,
238
],
[
241,
240
],
[
214,
243
],
[
224,
244
],
[
247,
246
],
[
250,
249
],
[
256,
255
],
[
240,
265
],
[
255,
266
],
[
234,
268
],
[
249,
269
],
[
272,
271
],
[
277,
274
],
[
169,
275
],
[
271,
276
],
[
246,
276
],
[
284,
279
],
[
169,
280
],
[
271,
282
],
[
246,
282
],
[
299,
286
],
[
316,
291
],
[
189,
292
],
[
314,
296
],
[
189,
297
],
[
302,
301
],
[
169,
301
],
[
301,
305
],
[
308,
308
],
[
310,
310
],
[
312,
312
],
[
314,
314
],
[
316,
316
],
[
323,
322
],
[
328,
327
],
[
322,
330
],
[
327,
333
],
[
336,
335
],
[
320,
337
],
[
340,
339
],
[
335,
344
],
[
347,
346
],
[
335,
351
],
[
354,
353
],
[
335,
358
],
[
361,
360
],
[
353,
365
],
[
368,
367
],
[
353,
372
],
[
375,
374
],
[
353,
377
],
[
382,
379
],
[
360,
380
],
[
374,
381
],
[
335,
386
],
[
391,
388
],
[
367,
389
],
[
374,
390
],
[
335,
395
],
[
414,
397
],
[
339,
398
],
[
346,
399
],
[
353,
400
],
[
360,
401
],
[
367,
402
],
[
411,
408
]
] | [
"#!/usr/bin/env python3\nimport sys\nsys.setrecursionlimit(300000)\n\n\ndef solve(W: int, H: int, N: int, a: \"List[int]\", b: \"List[int]\"):\n ret = [0] * 10\n ret[0] = (H - 2) * (W - 2)\n reduces = []\n for i in range(N):\n lx = max(0, a[i] - 3)\n rx = min(W - 2, a[i])\n ly = max(0, b[i] - 3)\n ry = min(H - 2, b[i])\n for bx in range(lx, rx):\n for by in range(ly, ry):\n reduces.append((bx, by))\n reduces.sort()\n cnt = 1\n for i in range(1, len(reduces)):\n if reduces[i] == reduces[i - 1]:\n cnt += 1\n else:\n ret[0] -= 1\n ret[cnt] += 1\n cnt = 1\n if len(reduces):\n ret[0] -= 1\n ret[cnt] += 1\n for r in ret:\n print(r)\n return\n\n\ndef _solve(W: int, H: int, N: int, a: \"List[int]\", b: \"List[int]\"):\n ret = [0] * 10\n ret[0] = (H - 2) * (W - 2)\n reduces = []\n for i in range(N):\n lx = max(0, a[i] - 3)\n rx = min(W - 2, a[i])\n ly = max(0, b[i] - 3)\n ry = min(H - 2, b[i])\n for bx in range(lx, rx):\n for by in range(ly, ry):\n cnt = 0\n for x in range(0, 3):\n for y in range(0, 3):\n #print(a[i] - 1, b[i] - 1, bx + x, by + y)\n if grid[by + y][bx + x]:\n cnt += 1\n ret[cnt] -= 1\n ret[cnt + 1] += 1\n #print(b[i] - 1, a[i] - 1, H, W)\n grid[b[i] - 1][a[i] - 1] = True\n for r in ret:\n print(r)\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n H = int(next(tokens)) # type: int\n W = int(next(tokens)) # type: int\n N = int(next(tokens)) # type: int\n a = [int()] * (N) # type: \"List[int]\" \n b = [int()] * (N) # type: \"List[int]\" \n for i in range(N):\n a[i] = int(next(tokens))\n b[i] = int(next(tokens))\n solve(H, W, N, a, b)\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"sys.setrecursionlimit(300000)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"300000",
"def solve(W: int, H: int, N: int, a: \"List[int]\", b: \"List[int]\"):\n ret = [0] * 10\n ret[0] = (H - 2) * (W - 2)\n reduces = []\n for i in range(N):\n lx = max(0, a[i] - 3)\n rx = min(W - 2, a[i])\n ly = max(0, b[i] - 3)\n ry = min(H - 2, b[i])\n for bx in range(lx, rx):\n for by in range(ly, ry):\n reduces.append((bx, by))\n reduces.sort()\n cnt = 1\n for i in range(1, len(reduces)):\n if reduces[i] == reduces[i - 1]:\n cnt += 1\n else:\n ret[0] -= 1\n ret[cnt] += 1\n cnt = 1\n if len(reduces):\n ret[0] -= 1\n ret[cnt] += 1\n for r in ret:\n print(r)\n return",
"solve",
"ret = [0] * 10",
"ret",
"[0] * 10",
"[0]",
"0",
"10",
"ret[0] = (H - 2) * (W - 2)",
"ret[0]",
"ret",
"0",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"reduces = []",
"reduces",
"[]",
"for i in range(N):\n lx = max(0, a[i] - 3)\n rx = min(W - 2, a[i])\n ly = max(0, b[i] - 3)\n ry = min(H - 2, b[i])\n for bx in range(lx, rx):\n for by in range(ly, ry):\n reduces.append((bx, by))\n ",
"i",
"range(N)",
"range",
"N",
"lx = max(0, a[i] - 3)",
"lx",
"max(0, a[i] - 3)",
"max",
"0",
"a[i] - 3",
"a[i]",
"a",
"i",
"3",
"rx = min(W - 2, a[i])",
"rx",
"min(W - 2, a[i])",
"min",
"W - 2",
"W",
"2",
"a[i]",
"a",
"i",
"ly = max(0, b[i] - 3)",
"ly",
"max(0, b[i] - 3)",
"max",
"0",
"b[i] - 3",
"b[i]",
"b",
"i",
"3",
"ry = min(H - 2, b[i])",
"ry",
"min(H - 2, b[i])",
"min",
"H - 2",
"H",
"2",
"b[i]",
"b",
"i",
"for bx in range(lx, rx):\n for by in range(ly, ry):\n reduces.append((bx, by))\n ",
"bx",
"range(lx, rx)",
"range",
"lx",
"rx",
"for by in range(ly, ry):\n reduces.append((bx, by))\n ",
"by",
"range(ly, ry)",
"range",
"ly",
"ry",
"reduces.append((bx, by))",
"reduces.append",
"reduces",
"append",
"(bx, by)",
"bx",
"by",
"reduces.sort()",
"reduces.sort",
"reduces",
"sort",
"cnt = 1",
"cnt",
"1",
"for i in range(1, len(reduces)):\n if reduces[i] == reduces[i - 1]:\n cnt += 1\n else:\n ret[0] -= 1\n ret[cnt] += 1\n cnt = 1\n ",
"i",
"range(1, len(reduces))",
"range",
"1",
"len(reduces)",
"len",
"reduces",
"if reduces[i] == reduces[i - 1]:\n cnt += 1\n else:\n ret[0] -= 1\n ret[cnt] += 1\n cnt = 1\n ",
"reduces[i] == reduces[i - 1]",
"reduces[i]",
"reduces",
"i",
"reduces[i - 1]",
"reduces",
"i - 1",
"i",
"1",
"cnt += 1",
"cnt",
"1",
"ret[0] -= 1",
"ret[0]",
"ret",
"0",
"1",
"ret[cnt] += 1",
"ret[cnt]",
"ret",
"cnt",
"1",
"cnt = 1",
"cnt",
"1",
"if len(reduces):\n ret[0] -= 1\n ret[cnt] += 1\n ",
"len(reduces)",
"len",
"reduces",
"ret[0] -= 1",
"ret[0]",
"ret",
"0",
"1",
"ret[cnt] += 1",
"ret[cnt]",
"ret",
"cnt",
"1",
"for r in ret:\n print(r)\n ",
"r",
"ret",
"print(r)",
"print",
"r",
"return",
"W: int",
"W",
"H: int",
"H",
"N: int",
"N",
"a: \"List[int]\"",
"a",
"b: \"List[int]\"",
"b",
"def _solve(W: int, H: int, N: int, a: \"List[int]\", b: \"List[int]\"):\n ret = [0] * 10\n ret[0] = (H - 2) * (W - 2)\n reduces = []\n for i in range(N):\n lx = max(0, a[i] - 3)\n rx = min(W - 2, a[i])\n ly = max(0, b[i] - 3)\n ry = min(H - 2, b[i])\n for bx in range(lx, rx):\n for by in range(ly, ry):\n cnt = 0\n for x in range(0, 3):\n for y in range(0, 3):\n #print(a[i] - 1, b[i] - 1, bx + x, by + y)\n if grid[by + y][bx + x]:\n cnt += 1\n ret[cnt] -= 1\n ret[cnt + 1] += 1\n #print(b[i] - 1, a[i] - 1, H, W)\n grid[b[i] - 1][a[i] - 1] = True\n for r in ret:\n print(r)\n return",
"_solve",
"ret = [0] * 10",
"ret",
"[0] * 10",
"[0]",
"0",
"10",
"ret[0] = (H - 2) * (W - 2)",
"ret[0]",
"ret",
"0",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"reduces = []",
"reduces",
"[]",
"for i in range(N):\n lx = max(0, a[i] - 3)\n rx = min(W - 2, a[i])\n ly = max(0, b[i] - 3)\n ry = min(H - 2, b[i])\n for bx in range(lx, rx):\n for by in range(ly, ry):\n cnt = 0\n for x in range(0, 3):\n for y in range(0, 3):\n #print(a[i] - 1, b[i] - 1, bx + x, by + y)\n if grid[by + y][bx + x]:\n cnt += 1\n ret[cnt] -= 1\n ret[cnt + 1] += 1\n #print(b[i] - 1, a[i] - 1, H, W)\n grid[b[i] - 1][a[i] - 1] = True\n ",
"i",
"range(N)",
"range",
"N",
"lx = max(0, a[i] - 3)",
"lx",
"max(0, a[i] - 3)",
"max",
"0",
"a[i] - 3",
"a[i]",
"a",
"i",
"3",
"rx = min(W - 2, a[i])",
"rx",
"min(W - 2, a[i])",
"min",
"W - 2",
"W",
"2",
"a[i]",
"a",
"i",
"ly = max(0, b[i] - 3)",
"ly",
"max(0, b[i] - 3)",
"max",
"0",
"b[i] - 3",
"b[i]",
"b",
"i",
"3",
"ry = min(H - 2, b[i])",
"ry",
"min(H - 2, b[i])",
"min",
"H - 2",
"H",
"2",
"b[i]",
"b",
"i",
"for bx in range(lx, rx):\n for by in range(ly, ry):\n cnt = 0\n for x in range(0, 3):\n for y in range(0, 3):\n #print(a[i] - 1, b[i] - 1, bx + x, by + y)\n if grid[by + y][bx + x]:\n cnt += 1\n ret[cnt] -= 1\n ret[cnt + 1] += 1\n #print(b[i] - 1, a[i] - 1, H, W)\n ",
"bx",
"range(lx, rx)",
"range",
"lx",
"rx",
"for by in range(ly, ry):\n cnt = 0\n for x in range(0, 3):\n for y in range(0, 3):\n #print(a[i] - 1, b[i] - 1, bx + x, by + y)\n if grid[by + y][bx + x]:\n cnt += 1\n ret[cnt] -= 1\n ret[cnt + 1] += 1\n #print(b[i] - 1, a[i] - 1, H, W)\n ",
"by",
"range(ly, ry)",
"range",
"ly",
"ry",
"cnt = 0",
"cnt",
"0",
"for x in range(0, 3):\n for y in range(0, 3):\n #print(a[i] - 1, b[i] - 1, bx + x, by + y)\n if grid[by + y][bx + x]:\n cnt += 1\n ",
"x",
"range(0, 3)",
"range",
"0",
"3",
"for y in range(0, 3):\n #print(a[i] - 1, b[i] - 1, bx + x, by + y)\n if grid[by + y][bx + x]:\n cnt += 1\n ",
"y",
"range(0, 3)",
"range",
"0",
"3",
"if grid[by + y][bx + x]:\n cnt += 1\n ",
"grid[by + y][bx + x]",
"[by + y]",
"grid",
"by + y",
"by",
"y",
"bx + x",
"bx",
"x",
"cnt += 1",
"cnt",
"1",
"ret[cnt] -= 1",
"ret[cnt]",
"ret",
"cnt",
"1",
"ret[cnt + 1] += 1",
"ret[cnt + 1]",
"ret",
"cnt + 1",
"cnt",
"1",
"1",
"grid[b[i] - 1][a[i] - 1] = True",
"grid[b[i] - 1][a[i] - 1]",
"[b[i] - 1]",
"grid",
"b[i] - 1",
"b[i]",
"b",
"i",
"1",
"a[i] - 1",
"a[i]",
"a",
"i",
"1",
"True",
"for r in ret:\n print(r)\n ",
"r",
"ret",
"print(r)",
"print",
"r",
"return",
"W: int",
"W",
"H: int",
"H",
"N: int",
"N",
"a: \"List[int]\"",
"a",
"b: \"List[int]\"",
"b",
"def main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n H = int(next(tokens)) # type: int\n W = int(next(tokens)) # type: int\n N = int(next(tokens)) # type: int\n a = [int()] * (N) # type: \"List[int]\" \n b = [int()] * (N) # type: \"List[int]\" \n for i in range(N):\n a[i] = int(next(tokens))\n b[i] = int(next(tokens))\n solve(H, W, N, a, b)",
"main",
"def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n ",
"iterate_tokens",
"for line in sys.stdin:\n for word in line.split():\n yield word\n ",
"line",
"sys.stdin",
"sys",
"stdin",
"for word in line.split():\n yield word\n ",
"word",
"line.split()",
"line.split",
"line",
"split",
"yield word",
"word",
"tokens = iterate_tokens()",
"tokens",
"iterate_tokens()",
"iterate_tokens",
"H = int(next(tokens))",
"H",
"int(next(tokens))",
"int",
"next(tokens)",
"next",
"tokens",
"W = int(next(tokens))",
"W",
"int(next(tokens))",
"int",
"next(tokens)",
"next",
"tokens",
"N = int(next(tokens))",
"N",
"int(next(tokens))",
"int",
"next(tokens)",
"next",
"tokens",
"a = [int()] * (N)",
"a",
"[int()] * (N)",
"[int()]",
"int()",
"int",
"N",
"b = [int()] * (N)",
"b",
"[int()] * (N)",
"[int()]",
"int()",
"int",
"N",
"for i in range(N):\n a[i] = int(next(tokens))\n b[i] = int(next(tokens))\n ",
"i",
"range(N)",
"range",
"N",
"a[i] = int(next(tokens))",
"a[i]",
"a",
"i",
"int(next(tokens))",
"int",
"next(tokens)",
"next",
"tokens",
"b[i] = int(next(tokens))",
"b[i]",
"b",
"i",
"int(next(tokens))",
"int",
"next(tokens)",
"next",
"tokens",
"solve(H, W, N, a, b)",
"solve",
"H",
"W",
"N",
"a",
"b",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n H = int(next(tokens)) # type: int\n W = int(next(tokens)) # type: int\n N = int(next(tokens)) # type: int\n a = [int()] * (N) # type: \"List[int]\" \n b = [int()] * (N) # type: \"List[int]\" \n for i in range(N):\n a[i] = int(next(tokens))\n b[i] = int(next(tokens))\n solve(H, W, N, a, b)",
"def main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n H = int(next(tokens)) # type: int\n W = int(next(tokens)) # type: int\n N = int(next(tokens)) # type: int\n a = [int()] * (N) # type: \"List[int]\" \n b = [int()] * (N) # type: \"List[int]\" \n for i in range(N):\n a[i] = int(next(tokens))\n b[i] = int(next(tokens))\n solve(H, W, N, a, b)",
"main",
"def solve(W: int, H: int, N: int, a: \"List[int]\", b: \"List[int]\"):\n ret = [0] * 10\n ret[0] = (H - 2) * (W - 2)\n reduces = []\n for i in range(N):\n lx = max(0, a[i] - 3)\n rx = min(W - 2, a[i])\n ly = max(0, b[i] - 3)\n ry = min(H - 2, b[i])\n for bx in range(lx, rx):\n for by in range(ly, ry):\n reduces.append((bx, by))\n reduces.sort()\n cnt = 1\n for i in range(1, len(reduces)):\n if reduces[i] == reduces[i - 1]:\n cnt += 1\n else:\n ret[0] -= 1\n ret[cnt] += 1\n cnt = 1\n if len(reduces):\n ret[0] -= 1\n ret[cnt] += 1\n for r in ret:\n print(r)\n return",
"def solve(W: int, H: int, N: int, a: \"List[int]\", b: \"List[int]\"):\n ret = [0] * 10\n ret[0] = (H - 2) * (W - 2)\n reduces = []\n for i in range(N):\n lx = max(0, a[i] - 3)\n rx = min(W - 2, a[i])\n ly = max(0, b[i] - 3)\n ry = min(H - 2, b[i])\n for bx in range(lx, rx):\n for by in range(ly, ry):\n reduces.append((bx, by))\n reduces.sort()\n cnt = 1\n for i in range(1, len(reduces)):\n if reduces[i] == reduces[i - 1]:\n cnt += 1\n else:\n ret[0] -= 1\n ret[cnt] += 1\n cnt = 1\n if len(reduces):\n ret[0] -= 1\n ret[cnt] += 1\n for r in ret:\n print(r)\n return",
"solve",
"def _solve(W: int, H: int, N: int, a: \"List[int]\", b: \"List[int]\"):\n ret = [0] * 10\n ret[0] = (H - 2) * (W - 2)\n reduces = []\n for i in range(N):\n lx = max(0, a[i] - 3)\n rx = min(W - 2, a[i])\n ly = max(0, b[i] - 3)\n ry = min(H - 2, b[i])\n for bx in range(lx, rx):\n for by in range(ly, ry):\n cnt = 0\n for x in range(0, 3):\n for y in range(0, 3):\n #print(a[i] - 1, b[i] - 1, bx + x, by + y)\n if grid[by + y][bx + x]:\n cnt += 1\n ret[cnt] -= 1\n ret[cnt + 1] += 1\n #print(b[i] - 1, a[i] - 1, H, W)\n grid[b[i] - 1][a[i] - 1] = True\n for r in ret:\n print(r)\n return",
"def _solve(W: int, H: int, N: int, a: \"List[int]\", b: \"List[int]\"):\n ret = [0] * 10\n ret[0] = (H - 2) * (W - 2)\n reduces = []\n for i in range(N):\n lx = max(0, a[i] - 3)\n rx = min(W - 2, a[i])\n ly = max(0, b[i] - 3)\n ry = min(H - 2, b[i])\n for bx in range(lx, rx):\n for by in range(ly, ry):\n cnt = 0\n for x in range(0, 3):\n for y in range(0, 3):\n #print(a[i] - 1, b[i] - 1, bx + x, by + y)\n if grid[by + y][bx + x]:\n cnt += 1\n ret[cnt] -= 1\n ret[cnt + 1] += 1\n #print(b[i] - 1, a[i] - 1, H, W)\n grid[b[i] - 1][a[i] - 1] = True\n for r in ret:\n print(r)\n return",
"_solve"
] | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)
def solve(W: int, H: int, N: int, a: "List[int]", b: "List[int]"):
ret = [0] * 10
ret[0] = (H - 2) * (W - 2)
reduces = []
for i in range(N):
lx = max(0, a[i] - 3)
rx = min(W - 2, a[i])
ly = max(0, b[i] - 3)
ry = min(H - 2, b[i])
for bx in range(lx, rx):
for by in range(ly, ry):
reduces.append((bx, by))
reduces.sort()
cnt = 1
for i in range(1, len(reduces)):
if reduces[i] == reduces[i - 1]:
cnt += 1
else:
ret[0] -= 1
ret[cnt] += 1
cnt = 1
if len(reduces):
ret[0] -= 1
ret[cnt] += 1
for r in ret:
print(r)
return
def _solve(W: int, H: int, N: int, a: "List[int]", b: "List[int]"):
ret = [0] * 10
ret[0] = (H - 2) * (W - 2)
reduces = []
for i in range(N):
lx = max(0, a[i] - 3)
rx = min(W - 2, a[i])
ly = max(0, b[i] - 3)
ry = min(H - 2, b[i])
for bx in range(lx, rx):
for by in range(ly, ry):
cnt = 0
for x in range(0, 3):
for y in range(0, 3):
#print(a[i] - 1, b[i] - 1, bx + x, by + y)
if grid[by + y][bx + x]:
cnt += 1
ret[cnt] -= 1
ret[cnt + 1] += 1
#print(b[i] - 1, a[i] - 1, H, W)
grid[b[i] - 1][a[i] - 1] = True
for r in ret:
print(r)
return
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_tokens()
H = int(next(tokens)) # type: int
W = int(next(tokens)) # type: int
N = int(next(tokens)) # type: int
a = [int()] * (N) # type: "List[int]"
b = [int()] * (N) # type: "List[int]"
for i in range(N):
a[i] = int(next(tokens))
b[i] = int(next(tokens))
solve(H, W, N, a, b)
if __name__ == '__main__':
main()
|
[
7,
15,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
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,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
0,
13,
2,
13,
13,
13,
2,
13,
13,
14,
2,
2,
40,
17,
13,
2,
13,
17,
2,
40,
17,
13,
2,
13,
17,
0,
18,
13,
2,
2,
13,
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,
0,
13,
17,
4,
13,
4,
18,
13,
13,
13,
14,
2,
13,
17,
4,
13,
10,
18,
13,
10,
12,
13
] | [
[
144,
4
],
[
17,
16
],
[
145,
23
],
[
17,
25
],
[
17,
26
],
[
29,
28
],
[
34,
33
],
[
26,
36
],
[
39,
38
],
[
145,
45
],
[
39,
47
],
[
50,
49
],
[
53,
52
],
[
56,
55
],
[
61,
60
],
[
66,
65
],
[
49,
67
],
[
38,
67
],
[
55,
68
],
[
70,
69
],
[
52,
71
],
[
47,
71
],
[
60,
72
],
[
65,
78
],
[
16,
80
],
[
69,
85
],
[
25,
87
],
[
97,
90
],
[
28,
91
],
[
65,
94
],
[
25,
95
],
[
69,
96
],
[
100,
99
],
[
28,
104
],
[
108,
107
],
[
16,
111
],
[
25,
114
],
[
99,
118
],
[
28,
118
],
[
107,
121
],
[
124,
123
],
[
129,
128
],
[
99,
134
],
[
28,
134
],
[
128,
136
],
[
123,
136
],
[
148,
142
],
[
144,
145
]
] | [
"import sys\ninput = sys.stdin.buffer.readline\nfrom collections import defaultdict\n\ndef main():\n H,W,N = map(int,input().split())\n d = defaultdict(int)\n for i in range(N):\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n for x in range(3):\n for y in range(3):\n na,nb = a-x,b-y\n if (0 <= na < H-2 and 0 <= nb < W-2):\n d[na*W+nb] += 1\n \n d = list(d.values())\n ans = (H-2)*(W-2)-len(d)\n print(ans)\n for i in range(9):\n i += 1\n print(d.count(i))\n\nif __name__ == \"__main__\":\n main()",
"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",
"def main():\n H,W,N = map(int,input().split())\n d = defaultdict(int)\n for i in range(N):\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n for x in range(3):\n for y in range(3):\n na,nb = a-x,b-y\n if (0 <= na < H-2 and 0 <= nb < W-2):\n d[na*W+nb] += 1\n \n d = list(d.values())\n ans = (H-2)*(W-2)-len(d)\n print(ans)\n for i in range(9):\n i += 1\n print(d.count(i))",
"main",
"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 a -= 1\n b -= 1\n for x in range(3):\n for y in range(3):\n na,nb = a-x,b-y\n if (0 <= na < H-2 and 0 <= nb < W-2):\n d[na*W+nb] += 1\n \n ",
"i",
"range(N)",
"range",
"N",
"a,b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for x in range(3):\n for y in range(3):\n na,nb = a-x,b-y\n if (0 <= na < H-2 and 0 <= nb < W-2):\n d[na*W+nb] += 1\n \n ",
"x",
"range(3)",
"range",
"3",
"for y in range(3):\n na,nb = a-x,b-y\n if (0 <= na < H-2 and 0 <= nb < W-2):\n d[na*W+nb] += 1\n \n ",
"y",
"range(3)",
"range",
"3",
"na,nb = a-x,b-y",
"na",
"a-x",
"a",
"x",
"nb",
"b-y",
"b",
"y",
"if (0 <= na < H-2 and 0 <= nb < W-2):\n d[na*W+nb] += 1\n \n ",
"0 <= na < H-2 and 0 <= nb < W-2",
"0 <= na < H-2",
"0 <= na",
"0",
"na",
"H-2",
"H",
"2",
"0 <= nb < W-2",
"0 <= nb",
"0",
"nb",
"W-2",
"W",
"2",
"d[na*W+nb] += 1",
"d[na*W+nb]",
"d",
"na*W+nb",
"na*W",
"na",
"W",
"nb",
"1",
"d = list(d.values())",
"d",
"list(d.values())",
"list",
"d.values()",
"d.values",
"d",
"values",
"ans = (H-2)*(W-2)-len(d)",
"ans",
"(H-2)*(W-2)-len(d)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"len(d)",
"len",
"d",
"print(ans)",
"print",
"ans",
"for i in range(9):\n i += 1\n print(d.count(i))",
"i",
"range(9)",
"range",
"9",
"i += 1",
"i",
"1",
"print(d.count(i))",
"print",
"d.count(i)",
"d.count",
"d",
"count",
"i",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"input = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"input",
"def main():\n H,W,N = map(int,input().split())\n d = defaultdict(int)\n for i in range(N):\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n for x in range(3):\n for y in range(3):\n na,nb = a-x,b-y\n if (0 <= na < H-2 and 0 <= nb < W-2):\n d[na*W+nb] += 1\n \n d = list(d.values())\n ans = (H-2)*(W-2)-len(d)\n print(ans)\n for i in range(9):\n i += 1\n print(d.count(i))",
"def main():\n H,W,N = map(int,input().split())\n d = defaultdict(int)\n for i in range(N):\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n for x in range(3):\n for y in range(3):\n na,nb = a-x,b-y\n if (0 <= na < H-2 and 0 <= nb < W-2):\n d[na*W+nb] += 1\n \n d = list(d.values())\n ans = (H-2)*(W-2)-len(d)\n print(ans)\n for i in range(9):\n i += 1\n print(d.count(i))",
"main"
] | import sys
input = sys.stdin.buffer.readline
from collections import defaultdict
def main():
H,W,N = map(int,input().split())
d = defaultdict(int)
for i in range(N):
a,b = map(int,input().split())
a -= 1
b -= 1
for x in range(3):
for y in range(3):
na,nb = a-x,b-y
if (0 <= na < H-2 and 0 <= nb < W-2):
d[na*W+nb] += 1
d = list(d.values())
ans = (H-2)*(W-2)-len(d)
print(ans)
for i in range(9):
i += 1
print(d.count(i))
if __name__ == "__main__":
main() |
[
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,
2,
17,
2,
13,
13,
2,
13,
17,
2,
2,
17,
2,
13,
13,
2,
13,
17,
14,
40,
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,
41,
28,
13,
4,
13,
17,
4,
13,
17,
0,
13,
13,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13
] | [
[
165,
2
],
[
165,
11
],
[
165,
12
],
[
174,
14
],
[
18,
17
],
[
163,
20
],
[
180,
22
],
[
180,
31
],
[
168,
33
],
[
157,
35
],
[
169,
35
],
[
171,
37
],
[
181,
39
],
[
172,
39
],
[
43,
42
],
[
49,
48
],
[
169,
59
],
[
157,
59
],
[
42,
60
],
[
160,
62
],
[
172,
68
],
[
181,
68
],
[
48,
69
],
[
166,
71
],
[
169,
77
],
[
157,
77
],
[
42,
78
],
[
172,
80
],
[
181,
80
],
[
48,
81
],
[
175,
82
],
[
93,
84
],
[
175,
85
],
[
169,
88
],
[
157,
88
],
[
42,
89
],
[
172,
91
],
[
181,
91
],
[
48,
92
],
[
104,
95
],
[
175,
96
],
[
169,
99
],
[
157,
99
],
[
42,
100
],
[
172,
102
],
[
181,
102
],
[
48,
103
],
[
108,
107
],
[
107,
112
],
[
177,
115
],
[
121,
118
],
[
178,
119
],
[
160,
123
],
[
166,
126
],
[
175,
133
],
[
139,
136
],
[
178,
137
],
[
144,
141
],
[
178,
142
],
[
147,
146
],
[
178,
153
],
[
146,
154
],
[
180,
157
],
[
165,
160
],
[
165,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
],
[
180,
181
]
] | [
"h, w, n = map(int, input().split())\ncnt = {}\n\nfor _ in range(n):\n a, b = map(int, input().split())\n a, b = a - 1, b - 1\n for i in range(-1, 2):\n for j in range(-1, 2):\n if 0 < a + i < h - 1 and 0 < b + j < w - 1:\n if (a+i, b+j) not in cnt:\n cnt[(a+i, b+j)] = 0\n cnt[(a+i, b+j)] += 1\n\nans = {i: 0 for i in range(10)}\nans[0] = (h - 2) * (w - 2)\nfor _, x in cnt.items():\n ans[x] += 1\n ans[0] -= 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",
"cnt = {}",
"cnt",
"{}",
"for _ in range(n):\n a, b = map(int, input().split())\n a, b = a - 1, b - 1\n for i in range(-1, 2):\n for j in range(-1, 2):\n if 0 < a + i < h - 1 and 0 < b + j < w - 1:\n if (a+i, b+j) not in cnt:\n cnt[(a+i, b+j)] = 0\n cnt[(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",
"a, b = a - 1, b - 1",
"a",
"a - 1",
"a",
"1",
"b",
"b - 1",
"b",
"1",
"for i in range(-1, 2):\n for j in range(-1, 2):\n if 0 < a + i < h - 1 and 0 < b + j < w - 1:\n if (a+i, b+j) not in cnt:\n cnt[(a+i, b+j)] = 0\n cnt[(a+i, b+j)] += 1",
"i",
"range(-1, 2)",
"range",
"-1",
"2",
"for j in range(-1, 2):\n if 0 < a + i < h - 1 and 0 < b + j < w - 1:\n if (a+i, b+j) not in cnt:\n cnt[(a+i, b+j)] = 0\n cnt[(a+i, b+j)] += 1",
"j",
"range(-1, 2)",
"range",
"-1",
"2",
"if 0 < a + i < h - 1 and 0 < b + j < w - 1:\n if (a+i, b+j) not in cnt:\n cnt[(a+i, b+j)] = 0\n cnt[(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",
"if (a+i, b+j) not in cnt:\n cnt[(a+i, b+j)] = 0\n ",
"(a+i, b+j) not in cnt",
"(a+i, b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"cnt",
"cnt[(a+i, b+j)] = 0",
"cnt[(a+i, b+j)]",
"cnt",
"(a+i, b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"0",
"cnt[(a+i, b+j)] += 1",
"cnt[(a+i, b+j)]",
"cnt",
"(a+i, b+j)",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"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",
"ans = {i: 0 for i in range(10)}",
"ans",
"{i: 0 for i in range(10)}",
"ans[0] = (h - 2) * (w - 2)",
"ans[0]",
"ans",
"0",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"for _, x in cnt.items():\n ans[x] += 1\n ans[0] -= 1",
"_",
"x",
"cnt.items()",
"cnt.items",
"cnt",
"items",
"ans[x] += 1",
"ans[x]",
"ans",
"x",
"1",
"ans[0] -= 1",
"ans[0]",
"ans",
"0",
"1",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"a, b = map(int, input().split())",
"map(int, input().split())",
"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",
"a, b = a - 1, b - 1",
"a - 1",
"a",
"b = a - 1, b - 1",
"b - 1",
"b",
"cnt = {}",
"{}",
"cnt",
"ans = {i: 0 for i in range(10)}",
"{i: 0 for i in range(10)}",
"ans",
"b = map(int, input().split())",
"map(int, input().split())",
"b"
] | h, w, n = map(int, input().split())
cnt = {}
for _ in range(n):
a, b = map(int, input().split())
a, b = a - 1, b - 1
for i in range(-1, 2):
for j in range(-1, 2):
if 0 < a + i < h - 1 and 0 < b + j < w - 1:
if (a+i, b+j) not in cnt:
cnt[(a+i, b+j)] = 0
cnt[(a+i, b+j)] += 1
ans = {i: 0 for i in range(10)}
ans[0] = (h - 2) * (w - 2)
for _, x in cnt.items():
ans[x] += 1
ans[0] -= 1
for i in range(10):
print(ans[i]) |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
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,
13,
14,
2,
40,
40,
17,
2,
13,
13,
2,
13,
17,
40,
40,
17,
2,
13,
13,
2,
13,
17,
14,
40,
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,
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,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13
] | [
[
198,
3
],
[
198,
12
],
[
198,
13
],
[
201,
15
],
[
186,
45
],
[
49,
48
],
[
196,
51
],
[
204,
53
],
[
204,
62
],
[
184,
73
],
[
199,
76
],
[
205,
82
],
[
190,
85
],
[
184,
91
],
[
205,
94
],
[
187,
96
],
[
107,
98
],
[
187,
99
],
[
184,
102
],
[
205,
105
],
[
118,
109
],
[
187,
110
],
[
184,
113
],
[
205,
116
],
[
207,
120
],
[
187,
125
],
[
130,
129
],
[
192,
136
],
[
208,
143
],
[
153,
150
],
[
193,
151
],
[
158,
155
],
[
193,
156
],
[
199,
161
],
[
190,
164
],
[
193,
169
],
[
174,
173
],
[
193,
180
],
[
173,
181
],
[
204,
184
],
[
186,
187
],
[
198,
190
],
[
192,
193
],
[
198,
196
],
[
198,
199
],
[
201,
202
],
[
204,
205
],
[
207,
208
]
] | [
"from 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 = {}\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 if (a + dy, b + dx) not in dict:\n dict[(a + dy, b + dx)] = 1\n else:\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 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 = {}",
"dict",
"{}",
"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 if (a + dy, b + dx) not in dict:\n dict[(a + dy, b + dx)] = 1\n else:\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 if (a + dy, b + dx) not in dict:\n dict[(a + dy, b + dx)] = 1\n else:\n dict[(a + dy, b + dx)] += 1",
"dy",
"dx",
"dir",
"if 2 <= a + dy <= H - 1 and 2 <= b + dx <= W - 1:\n if (a + dy, b + dx) not in dict:\n dict[(a + dy, b + dx)] = 1\n else:\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",
"if (a + dy, b + dx) not in dict:\n dict[(a + dy, b + dx)] = 1\n else:\n dict[(a + dy, b + dx)] += 1",
"(a + dy, b + dx) not in dict",
"(a + dy, b + dx)",
"a + dy",
"a",
"dy",
"b + dx",
"b",
"dx",
"dict",
"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",
"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",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"dict = {}",
"{}",
"dict",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"ans = [0 for _ in range(10)]",
"[0 for _ in range(10)]",
"ans",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"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",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"c = Counter(dict.values())",
"Counter(dict.values())",
"c"
] | 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 = {}
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:
if (a + dy, b + dx) not in dict:
dict[(a + dy, b + dx)] = 1
else:
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,
18,
18,
13,
13,
13,
15,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
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,
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,
18,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
134,
4
],
[
149,
13
],
[
135,
20
],
[
149,
22
],
[
149,
23
],
[
27,
26
],
[
132,
29
],
[
135,
39
],
[
137,
42
],
[
143,
45
],
[
55,
54
],
[
60,
59
],
[
54,
70
],
[
150,
72
],
[
59,
79
],
[
141,
81
],
[
93,
84
],
[
144,
85
],
[
54,
89
],
[
59,
92
],
[
146,
95
],
[
144,
100
],
[
106,
103
],
[
147,
104
],
[
150,
109
],
[
141,
112
],
[
147,
118
],
[
122,
121
],
[
147,
128
],
[
121,
129
],
[
149,
132
],
[
134,
135
],
[
137,
138
],
[
149,
141
],
[
143,
144
],
[
146,
147
],
[
149,
150
]
] | [
"# python3 (3.4.3)\nimport sys\ninput = sys.stdin.readline\n\n# main\nfrom collections import defaultdict\nfrom collections import Counter\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 = Counter(dic.values())\nAns[0] = (H-2)*(W-2) - sum(Ans.values())\n\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",
"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",
"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 = Counter(dic.values())",
"Ans",
"Counter(dic.values())",
"Counter",
"dic.values()",
"dic.values",
"dic",
"values",
"Ans[0] = (H-2)*(W-2) - sum(Ans.values())",
"Ans[0]",
"Ans",
"0",
"(H-2)*(W-2) - sum(Ans.values())",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(Ans.values())",
"sum",
"Ans.values()",
"Ans.values",
"Ans",
"values",
"for i in range(10):\n print(Ans[i])",
"i",
"range(10)",
"range",
"10",
"print(Ans[i])",
"print",
"Ans[i]",
"Ans",
"i",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"AB = [list(map(int,input().split())) for _ in range(N)]",
"[list(map(int,input().split())) for _ in range(N)]",
"AB",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"dic = defaultdict(int)",
"defaultdict(int)",
"dic",
"Ans = Counter(dic.values())",
"Counter(dic.values())",
"Ans",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H"
] | # python3 (3.4.3)
import sys
input = sys.stdin.readline
# main
from collections import defaultdict
from collections import Counter
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 = Counter(dic.values())
Ans[0] = (H-2)*(W-2) - sum(Ans.values())
for i in range(10):
print(Ans[i]) |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
40,
40,
2,
13,
17,
2,
2,
13,
13,
17,
17,
40,
40,
2,
13,
17,
2,
2,
13,
13,
17,
17,
0,
18,
13,
39,
2,
2,
13,
13,
17,
2,
2,
13,
13,
17,
17,
0,
13,
2,
39,
17,
17,
0,
13,
17,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
153,
3
],
[
153,
12
],
[
153,
13
],
[
147,
15
],
[
21,
20
],
[
142,
23
],
[
156,
25
],
[
156,
34
],
[
37,
36
],
[
42,
41
],
[
136,
50
],
[
157,
54
],
[
36,
55
],
[
154,
61
],
[
151,
65
],
[
41,
66
],
[
83,
70
],
[
148,
71
],
[
157,
75
],
[
36,
76
],
[
151,
80
],
[
41,
81
],
[
144,
85
],
[
138,
91
],
[
148,
98
],
[
104,
101
],
[
145,
102
],
[
132,
106
],
[
112,
109
],
[
145,
110
],
[
154,
115
],
[
136,
118
],
[
133,
120
],
[
139,
120
],
[
123,
122
],
[
145,
129
],
[
122,
130
],
[
132,
133
],
[
153,
136
],
[
138,
139
],
[
153,
142
],
[
144,
145
],
[
147,
148
],
[
156,
151
],
[
153,
154
],
[
156,
157
]
] | [
"from collections import defaultdict\nH,W,N=map(int,input().split())\nd=defaultdict(int)\nfor n in range(N):\n y,x=map(int,input().split())\n for i in range(3):\n for j in range(3):\n if W-3>=x+i-3>=0 and H-3>=y+j-3>=0:\n d[(x+i-3,y+j-3)]+=1\nans=[0]*10\nS=0\nfor t,t_num in d.items():\n ans[t_num]+=1\n S+=1\nans[0]=(H-2)*(W-2)-S\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 n in range(N):\n y,x=map(int,input().split())\n for i in range(3):\n for j in range(3):\n if W-3>=x+i-3>=0 and H-3>=y+j-3>=0:\n d[(x+i-3,y+j-3)]+=1",
"n",
"range(N)",
"range",
"N",
"y,x=map(int,input().split())",
"y",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"x",
"for i in range(3):\n for j in range(3):\n if W-3>=x+i-3>=0 and H-3>=y+j-3>=0:\n d[(x+i-3,y+j-3)]+=1",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n if W-3>=x+i-3>=0 and H-3>=y+j-3>=0:\n d[(x+i-3,y+j-3)]+=1",
"j",
"range(3)",
"range",
"3",
"if W-3>=x+i-3>=0 and H-3>=y+j-3>=0:\n d[(x+i-3,y+j-3)]+=1",
"W-3>=x+i-3>=0 and H-3>=y+j-3>=0",
"W-3>=x+i-3>=0",
"W-3>=x+i-3",
"W-3",
"W",
"3",
"x+i-3",
"x+i",
"x",
"i",
"3",
"0",
"H-3>=y+j-3>=0",
"H-3>=y+j-3",
"H-3",
"H",
"3",
"y+j-3",
"y+j",
"y",
"j",
"3",
"0",
"d[(x+i-3,y+j-3)]+=1",
"d[(x+i-3,y+j-3)]",
"d",
"(x+i-3,y+j-3)",
"x+i-3",
"x+i",
"x",
"i",
"3",
"y+j-3",
"y+j",
"y",
"j",
"3",
"1",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"S=0",
"S",
"0",
"for t,t_num in d.items():\n ans[t_num]+=1\n S+=1",
"t",
"t_num",
"d.items()",
"d.items",
"d",
"items",
"ans[t_num]+=1",
"ans[t_num]",
"ans",
"t_num",
"1",
"S+=1",
"S",
"1",
"ans[0]=(H-2)*(W-2)-S",
"ans[0]",
"ans",
"0",
"(H-2)*(W-2)-S",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"S",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"S+=1",
"1",
"S",
"W,N=map(int,input().split())",
"map(int,input().split())",
"W",
"S=0",
"0",
"S",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"ans=[0]*10",
"[0]*10",
"ans",
"d=defaultdict(int)",
"defaultdict(int)",
"d",
"y,x=map(int,input().split())",
"map(int,input().split())",
"y",
"H,W,N=map(int,input().split())",
"map(int,input().split())",
"H",
"x=map(int,input().split())",
"map(int,input().split())",
"x"
] | from collections import defaultdict
H,W,N=map(int,input().split())
d=defaultdict(int)
for n in range(N):
y,x=map(int,input().split())
for i in range(3):
for j in range(3):
if W-3>=x+i-3>=0 and H-3>=y+j-3>=0:
d[(x+i-3,y+j-3)]+=1
ans=[0]*10
S=0
for t,t_num in d.items():
ans[t_num]+=1
S+=1
ans[0]=(H-2)*(W-2)-S
for i in range(10):
print(ans[i])
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
4,
13,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
17,
4,
13,
17,
4,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
2,
4,
13,
13,
17,
0,
13,
13,
0,
13,
39,
28,
13,
13,
13,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
2,
4,
13,
2,
13,
17,
13,
17,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
2,
4,
13,
2,
13,
17,
13,
17,
4,
18,
13,
13,
39,
13,
13,
4,
18,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
0,
18,
13,
13,
17,
0,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
13,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13
] | [
[
195,
2
],
[
195,
11
],
[
195,
12
],
[
187,
15
],
[
181,
21
],
[
196,
24
],
[
28,
27
],
[
39,
38
],
[
187,
41
],
[
192,
51
],
[
189,
54
],
[
62,
61
],
[
181,
74
],
[
80,
79
],
[
196,
92
],
[
190,
98
],
[
190,
105
],
[
198,
108
],
[
201,
114
],
[
118,
117
],
[
190,
123
],
[
190,
128
],
[
117,
129
],
[
190,
131
],
[
117,
133
],
[
183,
136
],
[
142,
139
],
[
199,
140
],
[
202,
141
],
[
205,
141
],
[
184,
141
],
[
204,
144
],
[
150,
147
],
[
199,
148
],
[
205,
149
],
[
184,
149
],
[
202,
149
],
[
155,
152
],
[
199,
153
],
[
181,
158
],
[
196,
161
],
[
199,
166
],
[
171,
170
],
[
199,
177
],
[
170,
178
],
[
195,
181
],
[
183,
184
],
[
195,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
],
[
201,
202
],
[
204,
205
]
] | [
"h, w, n = map(int, input().split())\n\nif n == 0:\n print((h-2) * (w-2))\n for i in range(9):\n print(0)\n exit()\n\nab = [tuple(int(x) - 1 for x in input().split()) for _ in range(n)]\n\np = []\n\nfor a, b in ab:\n for x in range(max(0, a-2), min(h-3, a) + 1):\n for y in range(max(0, b-2), min(w-3, b) + 1):\n p.append([x, y])\n\np.sort()\n\n#print(p)\n\nans = [0] * 10\n\nc = 1\nfor i in range(len(p) - 1):\n if p[i] == p[i + 1]:\n c += 1\n else:\n ans[c] += 1\n c = 1\nans[c] += 1\n\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",
"if n == 0:\n print((h-2) * (w-2))\n for i in range(9):\n print(0)\n exit()",
"n == 0",
"n",
"0",
"print((h-2) * (w-2))",
"print",
"(h-2) * (w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"for i in range(9):\n print(0)\n ",
"i",
"range(9)",
"range",
"9",
"print(0)",
"print",
"0",
"exit()",
"exit",
"tuple(int(x) - 1 for x in input().split()) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"tuple(int(x) - 1 for x in input().split())",
"tuple",
"int(x) - 1",
"int(x)",
"int",
"x",
"1",
"ab = [tuple(int(x) - 1 for x in input().split()) for _ in range(n)]",
"ab",
"[tuple(int(x) - 1 for x in input().split()) for _ in range(n)]",
"p = []",
"p",
"[]",
"for a, b in ab:\n for x in range(max(0, a-2), min(h-3, a) + 1):\n for y in range(max(0, b-2), min(w-3, b) + 1):\n p.append([x, y])",
"a",
"b",
"ab",
"for x in range(max(0, a-2), min(h-3, a) + 1):\n for y in range(max(0, b-2), min(w-3, b) + 1):\n p.append([x, y])",
"x",
"range(max(0, a-2), min(h-3, a) + 1)",
"range",
"max(0, a-2)",
"max",
"0",
"a-2",
"a",
"2",
"min(h-3, a) + 1",
"min(h-3, a)",
"min",
"h-3",
"h",
"3",
"a",
"1",
"for y in range(max(0, b-2), min(w-3, b) + 1):\n p.append([x, y])",
"y",
"range(max(0, b-2), min(w-3, b) + 1)",
"range",
"max(0, b-2)",
"max",
"0",
"b-2",
"b",
"2",
"min(w-3, b) + 1",
"min(w-3, b)",
"min",
"w-3",
"w",
"3",
"b",
"1",
"p.append([x, y])",
"p.append",
"p",
"append",
"[x, y]",
"x",
"y",
"p.sort()",
"p.sort",
"p",
"sort",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"c = 1",
"c",
"1",
"for i in range(len(p) - 1):\n if p[i] == p[i + 1]:\n c += 1\n else:\n ans[c] += 1\n c = 1",
"i",
"range(len(p) - 1)",
"range",
"len(p) - 1",
"len(p)",
"len",
"p",
"1",
"if p[i] == p[i + 1]:\n c += 1\n else:\n ans[c] += 1\n c = 1",
"p[i] == p[i + 1]",
"p[i]",
"p",
"i",
"p[i + 1]",
"p",
"i + 1",
"i",
"1",
"c += 1",
"c",
"1",
"ans[c] += 1",
"ans[c]",
"ans",
"c",
"1",
"c = 1",
"c",
"1",
"ans[c] += 1",
"ans[c]",
"ans",
"c",
"1",
"ans[0] = (h - 2) * (w - 2) - sum(ans[1:])",
"ans[0]",
"ans",
"0",
"(h - 2) * (w - 2) - sum(ans[1:])",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"for i in range(10):\n print(ans[i])",
"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",
"c += 1",
"1",
"c",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"p = []",
"[]",
"p",
"ab = [tuple(int(x) - 1 for x in input().split()) for _ in range(n)]",
"[tuple(int(x) - 1 for x in input().split()) for _ in range(n)]",
"ab",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"ans = [0] * 10",
"[0] * 10",
"ans",
"c = 1",
"1",
"c",
"c = 1",
"1",
"c"
] | h, w, n = map(int, input().split())
if n == 0:
print((h-2) * (w-2))
for i in range(9):
print(0)
exit()
ab = [tuple(int(x) - 1 for x in input().split()) for _ in range(n)]
p = []
for a, b in ab:
for x in range(max(0, a-2), min(h-3, a) + 1):
for y in range(max(0, b-2), min(w-3, b) + 1):
p.append([x, y])
p.sort()
#print(p)
ans = [0] * 10
c = 1
for i in range(len(p) - 1):
if p[i] == p[i + 1]:
c += 1
else:
ans[c] += 1
c = 1
ans[c] += 1
ans[0] = (h - 2) * (w - 2) - sum(ans[1:])
for i in range(10):
print(ans[i]) |
[
7,
15,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
39,
17,
13,
0,
13,
2,
39,
17,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
4,
13,
13,
4,
18,
4,
13,
13,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
0,
13,
2,
18,
13,
13,
13,
0,
13,
2,
18,
13,
13,
13,
14,
2,
2,
2,
2,
13,
17,
2,
2,
13,
17,
13,
2,
13,
17,
2,
2,
13,
17,
13,
9,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] | [
[
171,
3
],
[
186,
8
],
[
186,
17
],
[
186,
18
],
[
162,
20
],
[
181,
24
],
[
168,
26
],
[
181,
30
],
[
33,
32
],
[
181,
35
],
[
40,
37
],
[
163,
38
],
[
32,
39
],
[
40,
48
],
[
169,
49
],
[
32,
50
],
[
55,
52
],
[
163,
53
],
[
32,
54
],
[
60,
57
],
[
169,
58
],
[
32,
59
],
[
63,
62
],
[
181,
65
],
[
68,
67
],
[
73,
72
],
[
165,
77
],
[
163,
80
],
[
62,
81
],
[
67,
82
],
[
177,
84
],
[
169,
87
],
[
62,
88
],
[
72,
89
],
[
166,
95
],
[
166,
99
],
[
175,
101
],
[
178,
103
],
[
178,
107
],
[
187,
109
],
[
117,
112
],
[
172,
113
],
[
183,
119
],
[
172,
129
],
[
135,
132
],
[
184,
133
],
[
140,
137
],
[
184,
138
],
[
175,
143
],
[
187,
146
],
[
184,
150
],
[
153,
152
],
[
184,
159
],
[
152,
160
],
[
162,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
],
[
186,
175
],
[
177,
178
],
[
186,
181
],
[
183,
184
],
[
186,
187
]
] | [
"from collections import defaultdict\nd = defaultdict(int)\n\nh,w,n = map(int, input().split())\na = [0]*n\nb = [0]*n\nfor i in range(n):\n a[i],b[i] = map(int, input().split())\n a[i] -= 1; b[i] -= 1\n \n## 左上のマスを(0,0)とする\n## 正方形の左上のマスを(j,i)とする\n\nfor x in range(n):\n for k in range(3):\n for l in range(3):\n i = a[x]-k ; j = b[x]-l\n if i<0 or i+3>h or j<0 or j+3>w:\n continue\n d[(j,i)] += 1\n\nans =[0]*10\nfor k,v in d.items():\n ans[v] += 1\nans[0] = (h-2)*(w-2)-sum(ans)\n\nfor i in range(10):\n print(ans[i])",
"from collections import defaultdict",
"d = defaultdict(int)",
"d",
"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",
"a = [0]*n",
"a",
"[0]*n",
"[0]",
"0",
"n",
"b = [0]*n",
"b",
"[0]*n",
"[0]",
"0",
"n",
"for i in range(n):\n a[i],b[i] = map(int, input().split())\n a[i] -= 1; b[i] -= 1\n \n## 左上のマスを(0,0)とする\n## 正方形の左上のマスを(j,i)とする",
"i",
"range(n)",
"range",
"n",
"a[i],b[i] = map(int, input().split())",
"a[i]",
"a",
"i",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b[i]",
"b",
"i",
"a[i] -= 1",
"a[i]",
"a",
"i",
"1",
"b[i] -= 1",
"b[i]",
"b",
"i",
"1",
"for x in range(n):\n for k in range(3):\n for l in range(3):\n i = a[x]-k ; j = b[x]-l\n if i<0 or i+3>h or j<0 or j+3>w:\n continue\n d[(j,i)] += 1",
"x",
"range(n)",
"range",
"n",
"for k in range(3):\n for l in range(3):\n i = a[x]-k ; j = b[x]-l\n if i<0 or i+3>h or j<0 or j+3>w:\n continue\n d[(j,i)] += 1",
"k",
"range(3)",
"range",
"3",
"for l in range(3):\n i = a[x]-k ; j = b[x]-l\n if i<0 or i+3>h or j<0 or j+3>w:\n continue\n d[(j,i)] += 1",
"l",
"range(3)",
"range",
"3",
"i = a[x]-k",
"i",
"a[x]-k",
"a[x]",
"a",
"x",
"k",
"j = b[x]-l",
"j",
"b[x]-l",
"b[x]",
"b",
"x",
"l",
"if i<0 or i+3>h or j<0 or j+3>w:\n continue\n ",
"i<0 or i+3>h or j<0 or j+3>w",
"i<0 or i+3>h or j<0",
"i<0 or i+3>h",
"i<0",
"i",
"0",
"i+3>h",
"i+3",
"i",
"3",
"h",
"j<0",
"j",
"0",
"j+3>w",
"j+3",
"j",
"3",
"w",
"continue",
"d[(j,i)] += 1",
"d[(j,i)]",
"d",
"(j,i)",
"j",
"i",
"1",
"ans =[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for k,v in d.items():\n ans[v] += 1",
"k",
"v",
"d.items()",
"d.items",
"d",
"items",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"ans[0] = (h-2)*(w-2)-sum(ans)",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)-sum(ans)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"a = [0]*n",
"[0]*n",
"a",
"i = a[x]-k",
"a[x]-k",
"i",
"b = [0]*n",
"[0]*n",
"b",
"d = defaultdict(int)",
"defaultdict(int)",
"d",
"h,w,n = map(int, input().split())",
"map(int, input().split())",
"h",
"j = b[x]-l",
"b[x]-l",
"j",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"ans =[0]*10",
"[0]*10",
"ans",
"w,n = map(int, input().split())",
"map(int, input().split())",
"w"
] | from collections import defaultdict
d = defaultdict(int)
h,w,n = map(int, input().split())
a = [0]*n
b = [0]*n
for i in range(n):
a[i],b[i] = map(int, input().split())
a[i] -= 1; b[i] -= 1
## 左上のマスを(0,0)とする
## 正方形の左上のマスを(j,i)とする
for x in range(n):
for k in range(3):
for l in range(3):
i = a[x]-k ; j = b[x]-l
if i<0 or i+3>h or j<0 or j+3>w:
continue
d[(j,i)] += 1
ans =[0]*10
for k,v in d.items():
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,
15,
0,
13,
4,
13,
13,
0,
13,
39,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
2,
2,
40,
2,
13,
18,
13,
17,
13,
2,
2,
13,
18,
13,
17,
17,
2,
2,
13,
18,
13,
17,
17,
40,
2,
13,
18,
13,
17,
13,
9,
0,
18,
13,
39,
2,
13,
18,
13,
17,
2,
13,
18,
13,
17,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
14,
2,
2,
2,
40,
18,
13,
17,
17,
2,
18,
13,
17,
2,
13,
17,
40,
18,
13,
17,
17,
2,
18,
13,
17,
2,
13,
17,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
39,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
209,
2
],
[
209,
11
],
[
209,
12
],
[
197,
15
],
[
191,
20
],
[
51,
50
],
[
210,
53
],
[
215,
55
],
[
215,
64
],
[
206,
66
],
[
194,
69
],
[
73,
72
],
[
192,
72
],
[
207,
80
],
[
213,
80
],
[
72,
82
],
[
189,
84
],
[
207,
87
],
[
213,
87
],
[
72,
89
],
[
195,
94
],
[
216,
94
],
[
72,
96
],
[
195,
101
],
[
216,
101
],
[
72,
103
],
[
204,
105
],
[
121,
108
],
[
198,
109
],
[
207,
112
],
[
213,
112
],
[
72,
114
],
[
195,
117
],
[
216,
117
],
[
72,
119
],
[
200,
123
],
[
130,
129
],
[
198,
129
],
[
129,
137
],
[
129,
142
],
[
189,
145
],
[
129,
149
],
[
129,
154
],
[
204,
157
],
[
165,
160
],
[
201,
161
],
[
198,
163
],
[
129,
164
],
[
170,
167
],
[
201,
168
],
[
189,
173
],
[
204,
176
],
[
201,
180
],
[
183,
182
],
[
201,
182
],
[
182,
186
],
[
209,
189
],
[
191,
192
],
[
194,
195
],
[
197,
198
],
[
200,
201
],
[
209,
204
],
[
206,
207
],
[
209,
210
],
[
215,
213
],
[
215,
216
]
] | [
"h, w, n = map(int, input().split())\nfrom collections import defaultdict\nd = defaultdict(int)\nsurround = [(0, 0), (1,1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1)]\nfor _ in range(n):\n x, y = map(int, input().split())\n x -= 1\n y -= 1\n for i in surround:\n if x + i[0] >= h or x + i[0] < 0 or y + i[1] < 0 or y + i[1] >= w:\n continue\n else:\n d[(x+i[0], y + i[1])] += 1\nnum = [0]*10\nfor key in d:\n if key[0] >= 1 and key[0] < h -1 and key[1] >= 1 and key[1] < w-1:\n num[d[key]] += 1\n\nnum[0] = (h-2)*(w-2) - sum(num)\n\nfor ans in num:\n print(ans)",
"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",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"surround = [(0, 0), (1,1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1)]",
"surround",
"[(0, 0), (1,1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1)]",
"(0, 0)",
"0",
"0",
"(1,1)",
"1",
"1",
"(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",
"for _ in range(n):\n x, y = map(int, input().split())\n x -= 1\n y -= 1\n for i in surround:\n if x + i[0] >= h or x + i[0] < 0 or y + i[1] < 0 or y + i[1] >= w:\n continue\n else:\n d[(x+i[0], y + i[1])] += 1",
"_",
"range(n)",
"range",
"n",
"x, y = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"x -= 1",
"x",
"1",
"y -= 1",
"y",
"1",
"for i in surround:\n if x + i[0] >= h or x + i[0] < 0 or y + i[1] < 0 or y + i[1] >= w:\n continue\n else:\n d[(x+i[0], y + i[1])] += 1",
"i",
"surround",
"if x + i[0] >= h or x + i[0] < 0 or y + i[1] < 0 or y + i[1] >= w:\n continue\n else:\n d[(x+i[0], y + i[1])] += 1",
"x + i[0] >= h or x + i[0] < 0 or y + i[1] < 0 or y + i[1] >= w",
"x + i[0] >= h or x + i[0] < 0 or y + i[1] < 0",
"x + i[0] >= h or x + i[0] < 0",
"x + i[0] >= h",
"x + i[0]",
"x",
"i[0]",
"i",
"0",
"h",
"x + i[0] < 0",
"x + i[0]",
"x",
"i[0]",
"i",
"0",
"0",
"y + i[1] < 0",
"y + i[1]",
"y",
"i[1]",
"i",
"1",
"0",
"y + i[1] >= w",
"y + i[1]",
"y",
"i[1]",
"i",
"1",
"w",
"continue",
"d[(x+i[0], y + i[1])] += 1",
"d[(x+i[0], y + i[1])]",
"d",
"(x+i[0], y + i[1])",
"x+i[0]",
"x",
"i[0]",
"i",
"0",
"y + i[1]",
"y",
"i[1]",
"i",
"1",
"1",
"num = [0]*10",
"num",
"[0]*10",
"[0]",
"0",
"10",
"for key in d:\n if key[0] >= 1 and key[0] < h -1 and key[1] >= 1 and key[1] < w-1:\n num[d[key]] += 1",
"key",
"d",
"if key[0] >= 1 and key[0] < h -1 and key[1] >= 1 and key[1] < w-1:\n num[d[key]] += 1",
"key[0] >= 1 and key[0] < h -1 and key[1] >= 1 and key[1] < w-1",
"key[0] >= 1 and key[0] < h -1 and key[1] >= 1",
"key[0] >= 1 and key[0] < h -1",
"key[0] >= 1",
"key[0]",
"key",
"0",
"1",
"key[0] < h -1",
"key[0]",
"key",
"0",
"h -1",
"h",
"1",
"key[1] >= 1",
"key[1]",
"key",
"1",
"1",
"key[1] < w-1",
"key[1]",
"key",
"1",
"w-1",
"w",
"1",
"num[d[key]] += 1",
"num[d[key]]",
"num",
"d[key]",
"d",
"key",
"1",
"num[0] = (h-2)*(w-2) - sum(num)",
"num[0]",
"num",
"0",
"(h-2)*(w-2) - sum(num)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(num)",
"sum",
"num",
"for ans in num:\n print(ans)",
"ans",
"num",
"print(ans)",
"print",
"ans",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"surround = [(0, 0), (1,1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1)]",
"[(0, 0), (1,1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1)]",
"surround",
"y -= 1",
"1",
"y",
"d = defaultdict(int)",
"defaultdict(int)",
"d",
"num = [0]*10",
"[0]*10",
"num",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"x -= 1",
"1",
"x",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"x, y = map(int, input().split())",
"map(int, input().split())",
"x",
"y = map(int, input().split())",
"map(int, input().split())",
"y"
] | h, w, n = map(int, input().split())
from collections import defaultdict
d = defaultdict(int)
surround = [(0, 0), (1,1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1)]
for _ in range(n):
x, y = map(int, input().split())
x -= 1
y -= 1
for i in surround:
if x + i[0] >= h or x + i[0] < 0 or y + i[1] < 0 or y + i[1] >= w:
continue
else:
d[(x+i[0], y + i[1])] += 1
num = [0]*10
for key in d:
if key[0] >= 1 and key[0] < h -1 and key[1] >= 1 and key[1] < w-1:
num[d[key]] += 1
num[0] = (h-2)*(w-2) - sum(num)
for ans in num:
print(ans)
|
[
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,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
0,
13,
4,
13,
39,
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,
18,
13,
13,
13,
28,
13,
13,
0,
13,
39,
2,
13,
18,
13,
17,
2,
13,
18,
13,
17,
14,
2,
2,
2,
4,
13,
13,
17,
2,
18,
13,
17,
2,
13,
17,
2,
18,
13,
17,
2,
13,
17,
0,
13,
17,
28,
13,
13,
0,
13,
39,
2,
18,
13,
17,
18,
13,
17,
2,
18,
13,
17,
18,
13,
17,
14,
2,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
2,
13,
17,
17,
4,
18,
13,
13,
39,
13,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
18,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
18,
13,
10,
39,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13
] | [
[
217,
2
],
[
217,
11
],
[
217,
12
],
[
220,
14
],
[
18,
17
],
[
218,
20
],
[
238,
22
],
[
238,
31
],
[
221,
34
],
[
205,
40
],
[
44,
43
],
[
51,
48
],
[
206,
49
],
[
209,
53
],
[
200,
56
],
[
223,
59
],
[
229,
64
],
[
95,
94
],
[
218,
97
],
[
226,
99
],
[
221,
101
],
[
94,
102
],
[
226,
103
],
[
106,
105
],
[
230,
105
],
[
211,
108
],
[
227,
111
],
[
239,
111
],
[
105,
113
],
[
215,
116
],
[
236,
116
],
[
105,
118
],
[
212,
126
],
[
212,
130
],
[
209,
133
],
[
212,
137
],
[
200,
140
],
[
202,
143
],
[
147,
146
],
[
230,
146
],
[
232,
149
],
[
212,
153
],
[
146,
156
],
[
212,
160
],
[
146,
163
],
[
233,
167
],
[
224,
168
],
[
173,
170
],
[
206,
171
],
[
203,
172
],
[
180,
175
],
[
206,
176
],
[
203,
178
],
[
224,
183
],
[
190,
189
],
[
206,
196
],
[
189,
197
],
[
217,
200
],
[
202,
203
],
[
205,
206
],
[
217,
209
],
[
211,
212
],
[
226,
215
],
[
217,
218
],
[
220,
221
],
[
223,
224
],
[
226,
227
],
[
229,
230
],
[
232,
233
],
[
238,
236
],
[
238,
239
]
] | [
"h, w, n = map(int, input().split())\nlst = []\nfor i in range(n):\n ai, bi = map(int, input().split())\n lst.append((ai, bi))\n\ndic = {}\nfor i in range(10): dic[i] = 0\ndic[0] = (h-2) * (w-2)\nalready = set([])\nidx = [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 0], [0, 1], [1, -1], [1, 0], [1, 1]]\nfor i in range(n):\n ai, bi = lst[i]\n for surround in idx:\n center = [ai+surround[0], bi+surround[1]]\n if min(center) < 2 or center[0] > h-1 or center[1] > w-1: continue\n cnt = 0\n for ind in idx:\n cell = (center[0]+ind[0], center[1]+ind[1])\n if cell in already: cnt += 1\n dic[cnt] -= 1\n dic[cnt+1] += 1\n already.add((ai, bi))\n\nfor i in range(10):\n print(dic[i])",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"lst = []",
"lst",
"[]",
"for i in range(n):\n ai, bi = map(int, input().split())\n lst.append((ai, bi))",
"i",
"range(n)",
"range",
"n",
"ai, bi = map(int, input().split())",
"ai",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"bi",
"lst.append((ai, bi))",
"lst.append",
"lst",
"append",
"(ai, bi)",
"ai",
"bi",
"dic = {}",
"dic",
"{}",
"for i in range(10): dic[i] = 0",
"i",
"range(10)",
"range",
"10",
"dic[0] = (h-2) * (w-2)",
"dic[0]",
"dic",
"0",
"(h-2) * (w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"already = set([])",
"already",
"set([])",
"set",
"[]",
"idx = [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 0], [0, 1], [1, -1], [1, 0], [1, 1]]",
"idx",
"[[-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",
"for i in range(n):\n ai, bi = lst[i]\n for surround in idx:\n center = [ai+surround[0], bi+surround[1]]\n if min(center) < 2 or center[0] > h-1 or center[1] > w-1: continue\n cnt = 0\n for ind in idx:\n cell = (center[0]+ind[0], center[1]+ind[1])\n if cell in already: cnt += 1\n dic[cnt] -= 1\n dic[cnt+1] += 1\n already.add((ai, bi))",
"i",
"range(n)",
"range",
"n",
"ai, bi = lst[i]",
"ai",
"lst[i]",
"lst",
"i",
"bi",
"for surround in idx:\n center = [ai+surround[0], bi+surround[1]]\n if min(center) < 2 or center[0] > h-1 or center[1] > w-1: continue\n cnt = 0\n for ind in idx:\n cell = (center[0]+ind[0], center[1]+ind[1])\n if cell in already: cnt += 1\n dic[cnt] -= 1\n dic[cnt+1] += 1\n ",
"surround",
"idx",
"center = [ai+surround[0], bi+surround[1]]",
"center",
"[ai+surround[0], bi+surround[1]]",
"ai+surround[0]",
"ai",
"surround[0]",
"surround",
"0",
"bi+surround[1]",
"bi",
"surround[1]",
"surround",
"1",
"if min(center) < 2 or center[0] > h-1 or center[1] > w-1: continue\n ",
"min(center) < 2 or center[0] > h-1 or center[1] > w-1",
"min(center) < 2 or center[0] > h-1",
"min(center) < 2",
"min(center)",
"min",
"center",
"2",
"center[0] > h-1",
"center[0]",
"center",
"0",
"h-1",
"h",
"1",
"center[1] > w-1",
"center[1]",
"center",
"1",
"w-1",
"w",
"1",
"cnt = 0",
"cnt",
"0",
"for ind in idx:\n cell = (center[0]+ind[0], center[1]+ind[1])\n if cell in already: cnt += 1\n ",
"ind",
"idx",
"cell = (center[0]+ind[0], center[1]+ind[1])",
"cell",
"(center[0]+ind[0], center[1]+ind[1])",
"center[0]+ind[0]",
"center[0]",
"center",
"0",
"ind[0]",
"ind",
"0",
"center[1]+ind[1]",
"center[1]",
"center",
"1",
"ind[1]",
"ind",
"1",
"if cell in already: cnt += 1\n ",
"cell in already",
"cell",
"already",
"dic[cnt] -= 1",
"dic[cnt]",
"dic",
"cnt",
"1",
"dic[cnt+1] += 1",
"dic[cnt+1]",
"dic",
"cnt+1",
"cnt",
"1",
"1",
"already.add((ai, bi))",
"already.add",
"already",
"add",
"(ai, bi)",
"ai",
"bi",
"for i in range(10):\n print(dic[i])",
"i",
"range(10)",
"range",
"10",
"print(dic[i])",
"print",
"dic[i]",
"dic",
"i",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"cnt = 0",
"0",
"cnt",
"dic = {}",
"{}",
"dic",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"center = [ai+surround[0], bi+surround[1]]",
"[ai+surround[0], bi+surround[1]]",
"center",
"bi = lst[i]",
"lst[i]",
"bi",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"lst = []",
"[]",
"lst",
"already = set([])",
"set([])",
"already",
"ai, bi = lst[i]",
"lst[i]",
"ai",
"idx = [[-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]]",
"idx",
"cell = (center[0]+ind[0], center[1]+ind[1])",
"(center[0]+ind[0], center[1]+ind[1])",
"cell",
"bi = map(int, input().split())",
"map(int, input().split())",
"bi",
"ai, bi = map(int, input().split())",
"map(int, input().split())",
"ai"
] | h, w, n = map(int, input().split())
lst = []
for i in range(n):
ai, bi = map(int, input().split())
lst.append((ai, bi))
dic = {}
for i in range(10): dic[i] = 0
dic[0] = (h-2) * (w-2)
already = set([])
idx = [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 0], [0, 1], [1, -1], [1, 0], [1, 1]]
for i in range(n):
ai, bi = lst[i]
for surround in idx:
center = [ai+surround[0], bi+surround[1]]
if min(center) < 2 or center[0] > h-1 or center[1] > w-1: continue
cnt = 0
for ind in idx:
cell = (center[0]+ind[0], center[1]+ind[1])
if cell in already: cnt += 1
dic[cnt] -= 1
dic[cnt+1] += 1
already.add((ai, bi))
for i in range(10):
print(dic[i]) |
[
7,
15,
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,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
2,
2,
13,
13,
17,
40,
2,
2,
13,
13,
17,
13,
14,
2,
2,
2,
13,
13,
17,
40,
2,
2,
13,
13,
17,
13,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
0,
13,
4,
18,
13,
13,
13,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
28,
13,
4,
18,
13,
13,
0,
18,
13,
18,
13,
17,
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,
39,
13,
10,
4,
13,
10,
13,
13
] | [
[
150,
4
],
[
150,
14
],
[
150,
15
],
[
153,
17
],
[
21,
20
],
[
148,
23
],
[
156,
25
],
[
156,
35
],
[
38,
37
],
[
43,
42
],
[
157,
50
],
[
37,
51
],
[
157,
56
],
[
37,
57
],
[
139,
59
],
[
145,
64
],
[
42,
65
],
[
145,
70
],
[
42,
71
],
[
151,
73
],
[
154,
76
],
[
157,
80
],
[
37,
81
],
[
145,
83
],
[
42,
84
],
[
141,
86
],
[
154,
91
],
[
95,
94
],
[
159,
101
],
[
105,
104
],
[
142,
107
],
[
115,
110
],
[
160,
111
],
[
104,
113
],
[
120,
117
],
[
160,
118
],
[
139,
123
],
[
151,
126
],
[
160,
130
],
[
133,
132
],
[
160,
132
],
[
132,
136
],
[
150,
139
],
[
141,
142
],
[
156,
145
],
[
150,
148
],
[
150,
151
],
[
153,
154
],
[
156,
157
],
[
159,
160
]
] | [
"import collections\nh, w, n = map(int, input().split(\" \"))\nlist_include = []\nfor i in range(n):\n a, b = map(int, input().split(\" \"))\n for y in range(3):\n for x in range(3):\n if a - y > 0 and a - y + 2 <= h:\n if b - x > 0 and b - x + 2 <= w:\n list_include.append((a - y, b - x))\ncount = collections.Counter(list_include)\nresult = [0 for _ in range(10)]\nfor item in count.items():\n result[item[1]] += 1\nresult[0] = (h - 2) * (w - 2) - sum(result)\nfor one_result in result:\n print(one_result)",
"import collections",
"collections",
"h, w, n = map(int, input().split(\" \"))",
"h",
"map(int, input().split(\" \"))",
"map",
"int",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"w",
"n",
"list_include = []",
"list_include",
"[]",
"for i in range(n):\n a, b = map(int, input().split(\" \"))\n for y in range(3):\n for x in range(3):\n if a - y > 0 and a - y + 2 <= h:\n if b - x > 0 and b - x + 2 <= w:\n list_include.append((a - y, b - x))",
"i",
"range(n)",
"range",
"n",
"a, b = map(int, input().split(\" \"))",
"a",
"map(int, input().split(\" \"))",
"map",
"int",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"b",
"for y in range(3):\n for x in range(3):\n if a - y > 0 and a - y + 2 <= h:\n if b - x > 0 and b - x + 2 <= w:\n list_include.append((a - y, b - x))",
"y",
"range(3)",
"range",
"3",
"for x in range(3):\n if a - y > 0 and a - y + 2 <= h:\n if b - x > 0 and b - x + 2 <= w:\n list_include.append((a - y, b - x))",
"x",
"range(3)",
"range",
"3",
"if a - y > 0 and a - y + 2 <= h:\n if b - x > 0 and b - x + 2 <= w:\n list_include.append((a - y, b - x))",
"a - y > 0 and a - y + 2 <= h",
"a - y > 0",
"a - y",
"a",
"y",
"0",
"a - y + 2 <= h",
"a - y + 2",
"a - y",
"a",
"y",
"2",
"h",
"if b - x > 0 and b - x + 2 <= w:\n list_include.append((a - y, b - x))",
"b - x > 0 and b - x + 2 <= w",
"b - x > 0",
"b - x",
"b",
"x",
"0",
"b - x + 2 <= w",
"b - x + 2",
"b - x",
"b",
"x",
"2",
"w",
"list_include.append((a - y, b - x))",
"list_include.append",
"list_include",
"append",
"(a - y, b - x)",
"a - y",
"a",
"y",
"b - x",
"b",
"x",
"count = collections.Counter(list_include)",
"count",
"collections.Counter(list_include)",
"collections.Counter",
"collections",
"Counter",
"list_include",
"0 for _ in range(10)",
"for _ in range(10)",
"_",
"range(10)",
"range",
"10",
"for _ in range(10)",
"0",
"result = [0 for _ in range(10)]",
"result",
"[0 for _ in range(10)]",
"for item in count.items():\n result[item[1]] += 1",
"item",
"count.items()",
"count.items",
"count",
"items",
"result[item[1]] += 1",
"result[item[1]]",
"result",
"item[1]",
"item",
"1",
"1",
"result[0] = (h - 2) * (w - 2) - sum(result)",
"result[0]",
"result",
"0",
"(h - 2) * (w - 2) - sum(result)",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"sum(result)",
"sum",
"result",
"for one_result in result:\n print(one_result)",
"one_result",
"result",
"print(one_result)",
"print",
"one_result",
"h, w, n = map(int, input().split(\" \"))",
"map(int, input().split(\" \"))",
"h",
"count = collections.Counter(list_include)",
"collections.Counter(list_include)",
"count",
"b = map(int, input().split(\" \"))",
"map(int, input().split(\" \"))",
"b",
"n = map(int, input().split(\" \"))",
"map(int, input().split(\" \"))",
"n",
"w, n = map(int, input().split(\" \"))",
"map(int, input().split(\" \"))",
"w",
"list_include = []",
"[]",
"list_include",
"a, b = map(int, input().split(\" \"))",
"map(int, input().split(\" \"))",
"a",
"result = [0 for _ in range(10)]",
"[0 for _ in range(10)]",
"result"
] | import collections
h, w, n = map(int, input().split(" "))
list_include = []
for i in range(n):
a, b = map(int, input().split(" "))
for y in range(3):
for x in range(3):
if a - y > 0 and a - y + 2 <= h:
if b - x > 0 and b - x + 2 <= w:
list_include.append((a - y, b - x))
count = collections.Counter(list_include)
result = [0 for _ in range(10)]
for item in count.items():
result[item[1]] += 1
result[0] = (h - 2) * (w - 2) - sum(result)
for one_result in result:
print(one_result)
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
13,
31,
13,
0,
13,
4,
13,
13,
28,
13,
13,
4,
13,
31,
2,
39,
4,
13,
13,
17,
28,
13,
4,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
4,
13,
31,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
84,
3
],
[
84,
16
],
[
84,
17
],
[
84,
18
],
[
81,
21
],
[
39,
38
],
[
75,
43
],
[
56,
53
],
[
76,
54
],
[
79,
59
],
[
73,
62
],
[
76,
66
],
[
76,
70
],
[
84,
73
],
[
75,
76
],
[
84,
79
],
[
81,
82
],
[
84,
85
]
] | [
"from collections import*\nh,w,_,*t=map(int,open(0).read().split())\nd=defaultdict(int)\nfor a,b in zip(*[iter(t)]*2):\n for i in range(9):d[a-i//3,b-i%3]+=1\na=[0]*10\nfor i,j in d:a[d[i,j]]+=h-1>i>0<j<w-1\na[0]=(h-2)*(w-2)-sum(a)\nprint(*a)",
"from collections import*",
"h,w,_,*t=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",
"_",
"*t",
"t",
"d=defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"for a,b in zip(*[iter(t)]*2):\n for i in range(9):d[a-i//3,b-i%3]+=1",
"a",
"b",
"zip(*[iter(t)]*2)",
"zip",
"*[iter(t)]*2",
"[iter(t)]*2",
"[iter(t)]",
"iter(t)",
"iter",
"t",
"2",
"for i in range(9):d[a-i//3,b-i%3]+",
"i",
"range(9)",
"range",
"9",
"a=[0]*10",
"a",
"[0]*10",
"[0]",
"0",
"10",
"for i,j in d:a[d[i,j]]+=h-1>i>0<j<w-1",
"i",
"j",
"d",
"a[0]=(h-2)*(w-2)-sum(a)",
"a[0]",
"a",
"0",
"(h-2)*(w-2)-sum(a)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(a)",
"sum",
"a",
"print(*a)",
"print",
"*a",
"a",
"w,_,*t=map(int,open(0).read().split())",
"map(int,open(0).read().split())",
"w",
"a=[0]*10",
"[0]*10",
"a",
"h,w,_,*t=map(int,open(0).read().split())",
"map(int,open(0).read().split())",
"h",
"d=defaultdict(int)",
"defaultdict(int)",
"d",
"_,*t=map(int,open(0).read().split())",
"map(int,open(0).read().split())",
"_"
] | from collections import*
h,w,_,*t=map(int,open(0).read().split())
d=defaultdict(int)
for a,b in zip(*[iter(t)]*2):
for i in range(9):d[a-i//3,b-i%3]+=1
a=[0]*10
for i,j in d:a[d[i,j]]+=h-1>i>0<j<w-1
a[0]=(h-2)*(w-2)-sum(a)
print(*a) |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
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,
28,
13,
13,
0,
13,
2,
13,
13,
13,
2,
13,
13,
14,
40,
2,
2,
2,
17,
13,
2,
13,
17,
2,
2,
17,
13,
2,
13,
17,
9,
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,
17,
0,
13,
13,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] | [
[
171,
2
],
[
171,
11
],
[
171,
12
],
[
144,
14
],
[
150,
17
],
[
24,
23
],
[
160,
26
],
[
162,
28
],
[
162,
37
],
[
174,
39
],
[
165,
42
],
[
46,
45
],
[
151,
45
],
[
49,
48
],
[
151,
48
],
[
141,
51
],
[
175,
53
],
[
163,
53
],
[
45,
54
],
[
153,
55
],
[
166,
57
],
[
148,
57
],
[
48,
58
],
[
142,
65
],
[
172,
67
],
[
154,
72
],
[
169,
74
],
[
145,
82
],
[
89,
84
],
[
145,
85
],
[
96,
91
],
[
145,
92
],
[
100,
99
],
[
156,
106
],
[
110,
109
],
[
145,
112
],
[
118,
115
],
[
157,
116
],
[
109,
117
],
[
123,
120
],
[
157,
121
],
[
172,
126
],
[
169,
129
],
[
157,
133
],
[
136,
135
],
[
157,
135
],
[
135,
139
],
[
141,
142
],
[
144,
145
],
[
162,
148
],
[
150,
151
],
[
153,
154
],
[
156,
157
],
[
171,
160
],
[
162,
163
],
[
165,
166
],
[
171,
169
],
[
171,
172
],
[
174,
175
]
] | [
"h,w,n = map(int,input().split())\ngrids = {}\nD = [1,-1,0]\nfor _ in range(n):\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n \n for dx in D:\n for dy in D:\n na,nb = a+dx,b+dy\n if not(0<na<h-1 and 0<nb<w-1):\n continue\n if(na,nb) not in grids:\n grids[(na,nb)] = 0\n grids[(na,nb)] += 1\n \n \n \nans = [0 for _ in range(10)]\n\nfor v in grids.values():\n ans[v]+=1\n\nans[0] = (h-2)*(w-2)-sum(ans)\n\nfor a in ans:\n print(a)",
"h,w,n = map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"grids = {}",
"grids",
"{}",
"D = [1,-1,0]",
"D",
"[1,-1,0]",
"1",
"-1",
"0",
"for _ in range(n):\n a,b = map(int,input().split())\n a -= 1\n b -= 1\n \n for dx in D:\n for dy in D:\n na,nb = a+dx,b+dy\n if not(0<na<h-1 and 0<nb<w-1):\n continue\n if(na,nb) not in grids:\n grids[(na,nb)] = 0\n grids[(na,nb)] += 1\n \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 dx in D:\n for dy in D:\n na,nb = a+dx,b+dy\n if not(0<na<h-1 and 0<nb<w-1):\n continue\n if(na,nb) not in grids:\n grids[(na,nb)] = 0\n grids[(na,nb)] += 1\n \n \n ",
"dx",
"D",
"for dy in D:\n na,nb = a+dx,b+dy\n if not(0<na<h-1 and 0<nb<w-1):\n continue\n if(na,nb) not in grids:\n grids[(na,nb)] = 0\n grids[(na,nb)] += 1\n \n \n ",
"dy",
"D",
"na,nb = a+dx,b+dy",
"na",
"a+dx",
"a",
"dx",
"nb",
"b+dy",
"b",
"dy",
"if not(0<na<h-1 and 0<nb<w-1):\n continue\n ",
"not(0<na<h-1 and 0<nb<w-1)",
"0<na<h-1 and 0<nb<w-1",
"0<na<h-1",
"0<na",
"0",
"na",
"h-1",
"h",
"1",
"0<nb<w-1",
"0<nb",
"0",
"nb",
"w-1",
"w",
"1",
"continue",
"if(na,nb) not in grids:\n grids[(na,nb)] = 0\n ",
"(na,nb) not in grids",
"(na,nb)",
"na",
"nb",
"grids",
"grids[(na,nb)] = 0",
"grids[(na,nb)]",
"grids",
"(na,nb)",
"na",
"nb",
"0",
"grids[(na,nb)] += 1",
"grids[(na,nb)]",
"grids",
"(na,nb)",
"na",
"nb",
"1",
"0 for _ in range(10)",
"for _ in range(10)",
"_",
"range(10)",
"range",
"10",
"for _ in range(10)",
"0",
"ans = [0 for _ in range(10)]",
"ans",
"[0 for _ in range(10)]",
"for v in grids.values():\n ans[v]+=1",
"v",
"grids.values()",
"grids.values",
"grids",
"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 a in ans:\n print(a)",
"a",
"ans",
"print(a)",
"print",
"a",
"na,nb = a+dx,b+dy",
"a+dx",
"na",
"grids = {}",
"{}",
"grids",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"D = [1,-1,0]",
"[1,-1,0]",
"D",
"nb = a+dx,b+dy",
"b+dy",
"nb",
"ans = [0 for _ in range(10)]",
"[0 for _ in range(10)]",
"ans",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"b -= 1",
"1",
"b",
"w,n = map(int,input().split())",
"map(int,input().split())",
"w",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h",
"a -= 1",
"1",
"a"
] | h,w,n = map(int,input().split())
grids = {}
D = [1,-1,0]
for _ in range(n):
a,b = map(int,input().split())
a -= 1
b -= 1
for dx in D:
for dy in D:
na,nb = a+dx,b+dy
if not(0<na<h-1 and 0<nb<w-1):
continue
if(na,nb) not in grids:
grids[(na,nb)] = 0
grids[(na,nb)] += 1
ans = [0 for _ in range(10)]
for v in grids.values():
ans[v]+=1
ans[0] = (h-2)*(w-2)-sum(ans)
for a in ans:
print(a) |
[
7,
15,
13,
12,
13,
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,
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,
13,
13,
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,
2,
39,
17,
17,
14,
13,
0,
13,
4,
18,
13,
13,
13,
0,
13,
4,
13,
31,
4,
18,
13,
13,
13,
28,
13,
4,
13,
17,
0,
18,
13,
13,
4,
18,
13,
13,
13,
0,
13,
4,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
13,
28,
13,
13,
4,
13,
13,
4,
13,
10,
12,
13
] | [
[
8,
7
],
[
7,
16
],
[
19,
18
],
[
19,
20
],
[
19,
21
],
[
24,
23
],
[
27,
26
],
[
21,
29
],
[
33,
32
],
[
32,
41
],
[
44,
43
],
[
44,
45
],
[
48,
47
],
[
43,
86
],
[
18,
89
],
[
45,
95
],
[
20,
98
],
[
23,
102
],
[
43,
106
],
[
45,
109
],
[
113,
112
],
[
121,
120
],
[
23,
125
],
[
128,
127
],
[
120,
133
],
[
23,
133
],
[
128,
135
],
[
138,
137
],
[
145,
142
],
[
112,
143
],
[
137,
144
],
[
135,
147
],
[
137,
149
],
[
152,
151
],
[
112,
154
],
[
159,
156
],
[
112,
157
],
[
18,
162
],
[
20,
165
],
[
151,
167
],
[
170,
169
],
[
112,
169
],
[
169,
173
],
[
178,
175
]
] | [
"import collections \ndef solve():\n h,w,n = (int(i) for i in input().split())\n \n query = []\n for i in range(n):\n a,b = (int(i) for i in input().split())\n d = [(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]\n for dx,dy in d:\n if 2 <= a+dx <= h-1 and 2 <= b+dy <= w-1:\n query.append((a+dx,b+dy))\n ans = [0]*10\n if query:\n query = collections.Counter(query)\n values, counts = zip(*query.most_common())\n for i in range(10):\n ans[i] = counts.count(i)\n tp = sum(ans)\n ans[0] = (h-2)*(w-2)-tp\n \n for i in ans:\n print(i)\nsolve()",
"import collections",
"collections",
"def solve():\n h,w,n = (int(i) for i in input().split())\n \n query = []\n for i in range(n):\n a,b = (int(i) for i in input().split())\n d = [(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]\n for dx,dy in d:\n if 2 <= a+dx <= h-1 and 2 <= b+dy <= w-1:\n query.append((a+dx,b+dy))\n ans = [0]*10\n if query:\n query = collections.Counter(query)\n values, counts = zip(*query.most_common())\n for i in range(10):\n ans[i] = counts.count(i)\n tp = sum(ans)\n ans[0] = (h-2)*(w-2)-tp\n \n for i in ans:\n print(i)",
"solve",
"int(i) for i in input().split()",
"for i in input().split()",
"i",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in input().split()",
"int(i)",
"int",
"i",
"h,w,n = (int(i) for i in input().split())",
"h",
"(int(i) for i in input().split())",
"w",
"n",
"query = []",
"query",
"[]",
"for i in range(n):\n a,b = (int(i) for i in input().split())\n d = [(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]\n for dx,dy in d:\n if 2 <= a+dx <= h-1 and 2 <= b+dy <= w-1:\n query.append((a+dx,b+dy))\n ",
"i",
"range(n)",
"range",
"n",
"int(i) for i in input().split()",
"for i in input().split()",
"i",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in input().split()",
"int(i)",
"int",
"i",
"a,b = (int(i) for i in input().split())",
"a",
"(int(i) for i in input().split())",
"b",
"d = [(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]",
"d",
"[(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]",
"(-1,-1)",
"-1",
"-1",
"(-1,0)",
"-1",
"0",
"(-1,1)",
"-1",
"1",
"(0,-1)",
"0",
"-1",
"(0,0)",
"0",
"0",
"(0,1)",
"0",
"1",
"(1,-1)",
"1",
"-1",
"(1,0)",
"1",
"0",
"(1,1)",
"1",
"1",
"for dx,dy in d:\n if 2 <= a+dx <= h-1 and 2 <= b+dy <= w-1:\n query.append((a+dx,b+dy))\n ",
"dx",
"dy",
"d",
"if 2 <= a+dx <= h-1 and 2 <= b+dy <= w-1:\n query.append((a+dx,b+dy))\n ",
"2 <= a+dx <= h-1 and 2 <= b+dy <= w-1",
"2 <= a+dx <= h-1",
"2 <= a+dx",
"2",
"a+dx",
"a",
"dx",
"h-1",
"h",
"1",
"2 <= b+dy <= w-1",
"2 <= b+dy",
"2",
"b+dy",
"b",
"dy",
"w-1",
"w",
"1",
"query.append((a+dx,b+dy))",
"query.append",
"query",
"append",
"(a+dx,b+dy)",
"a+dx",
"a",
"dx",
"b+dy",
"b",
"dy",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"if query:\n query = collections.Counter(query)\n values, counts = zip(*query.most_common())\n for i in range(10):\n ans[i] = counts.count(i)\n ",
"query",
"query = collections.Counter(query)",
"query",
"collections.Counter(query)",
"collections.Counter",
"collections",
"Counter",
"query",
"values, counts = zip(*query.most_common())",
"values",
"zip(*query.most_common())",
"zip",
"*query.most_common()",
"query.most_common()",
"query.most_common",
"query",
"most_common",
"counts",
"for i in range(10):\n ans[i] = counts.count(i)\n ",
"i",
"range(10)",
"range",
"10",
"ans[i] = counts.count(i)",
"ans[i]",
"ans",
"i",
"counts.count(i)",
"counts.count",
"counts",
"count",
"i",
"tp = sum(ans)",
"tp",
"sum(ans)",
"sum",
"ans",
"ans[0] = (h-2)*(w-2)-tp",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)-tp",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"tp",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"solve()",
"solve",
"def solve():\n h,w,n = (int(i) for i in input().split())\n \n query = []\n for i in range(n):\n a,b = (int(i) for i in input().split())\n d = [(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]\n for dx,dy in d:\n if 2 <= a+dx <= h-1 and 2 <= b+dy <= w-1:\n query.append((a+dx,b+dy))\n ans = [0]*10\n if query:\n query = collections.Counter(query)\n values, counts = zip(*query.most_common())\n for i in range(10):\n ans[i] = counts.count(i)\n tp = sum(ans)\n ans[0] = (h-2)*(w-2)-tp\n \n for i in ans:\n print(i)",
"def solve():\n h,w,n = (int(i) for i in input().split())\n \n query = []\n for i in range(n):\n a,b = (int(i) for i in input().split())\n d = [(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]\n for dx,dy in d:\n if 2 <= a+dx <= h-1 and 2 <= b+dy <= w-1:\n query.append((a+dx,b+dy))\n ans = [0]*10\n if query:\n query = collections.Counter(query)\n values, counts = zip(*query.most_common())\n for i in range(10):\n ans[i] = counts.count(i)\n tp = sum(ans)\n ans[0] = (h-2)*(w-2)-tp\n \n for i in ans:\n print(i)",
"solve"
] | import collections
def solve():
h,w,n = (int(i) for i in input().split())
query = []
for i in range(n):
a,b = (int(i) for i in input().split())
d = [(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]
for dx,dy in d:
if 2 <= a+dx <= h-1 and 2 <= b+dy <= w-1:
query.append((a+dx,b+dy))
ans = [0]*10
if query:
query = collections.Counter(query)
values, counts = zip(*query.most_common())
for i in range(10):
ans[i] = counts.count(i)
tp = sum(ans)
ans[0] = (h-2)*(w-2)-tp
for i in ans:
print(i)
solve()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
28,
13,
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,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
28,
13,
4,
18,
13,
13,
0,
13,
18,
13,
17,
13,
18,
13,
17,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
18,
13,
13,
17,
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,
18,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
18,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13
] | [
[
167,
2
],
[
167,
11
],
[
167,
12
],
[
161,
14
],
[
18,
17
],
[
159,
20
],
[
179,
22
],
[
179,
31
],
[
34,
33
],
[
177,
37
],
[
177,
40
],
[
44,
43
],
[
180,
47
],
[
180,
50
],
[
162,
59
],
[
67,
62
],
[
162,
63
],
[
74,
69
],
[
162,
70
],
[
78,
77
],
[
173,
84
],
[
88,
87
],
[
162,
90
],
[
155,
93
],
[
87,
95
],
[
170,
97
],
[
87,
99
],
[
156,
106
],
[
177,
106
],
[
168,
108
],
[
171,
113
],
[
180,
113
],
[
153,
115
],
[
123,
118
],
[
174,
119
],
[
162,
121
],
[
87,
122
],
[
164,
125
],
[
168,
129
],
[
153,
132
],
[
174,
136
],
[
165,
139
],
[
142,
141
],
[
174,
149
],
[
141,
150
],
[
167,
153
],
[
155,
156
],
[
167,
159
],
[
161,
162
],
[
164,
165
],
[
167,
168
],
[
170,
171
],
[
173,
174
],
[
179,
177
],
[
179,
180
]
] | [
"#すぬけくんの塗り絵\nh,w,n=map(int,input().split())\ndic={}\nfor _ in range(n):\n a,b=map(int,input().split())\n for i in range(a-1,a+2):\n for j in range(b-1,b+2):\n if (i,j) in dic.keys():\n dic[(i,j)]+=1\n else:\n dic[(i,j)]=1\n \nhowmany=[0 for i in range(10)]\nfor some in dic.keys():\n a,b=some[0],some[1]\n if 2<=a<=h-1 and 2<=b<=w-1:\n howmany[dic[some]]+=1\nJ=(h-2)*(w-2)-sum(howmany)\nprint(J)\nfor i in range(1,10):\n print(howmany[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 for i in range(a-1,a+2):\n for j in range(b-1,b+2):\n if (i,j) in dic.keys():\n dic[(i,j)]+=1\n else:\n dic[(i,j)]=1\n ",
"_",
"range(n)",
"range",
"n",
"a,b=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in range(a-1,a+2):\n for j in range(b-1,b+2):\n if (i,j) in dic.keys():\n dic[(i,j)]+=1\n else:\n dic[(i,j)]=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,j) in dic.keys():\n dic[(i,j)]+=1\n else:\n dic[(i,j)]=1\n ",
"j",
"range(b-1,b+2)",
"range",
"b-1",
"b",
"1",
"b+2",
"b",
"2",
"if (i,j) in dic.keys():\n dic[(i,j)]+=1\n else:\n dic[(i,j)]=1\n ",
"(i,j) in dic.keys()",
"(i,j)",
"i",
"j",
"dic.keys()",
"dic.keys",
"dic",
"keys",
"dic[(i,j)]+=1",
"dic[(i,j)]",
"dic",
"(i,j)",
"i",
"j",
"1",
"dic[(i,j)]=1",
"dic[(i,j)]",
"dic",
"(i,j)",
"i",
"j",
"1",
"0 for i in range(10)",
"for i in range(10)",
"i",
"range(10)",
"range",
"10",
"for i in range(10)",
"0",
"howmany=[0 for i in range(10)]",
"howmany",
"[0 for i in range(10)]",
"for some in dic.keys():\n a,b=some[0],some[1]\n if 2<=a<=h-1 and 2<=b<=w-1:\n howmany[dic[some]]+=1",
"some",
"dic.keys()",
"dic.keys",
"dic",
"keys",
"a,b=some[0],some[1]",
"a",
"some[0]",
"some",
"0",
"b",
"some[1]",
"some",
"1",
"if 2<=a<=h-1 and 2<=b<=w-1:\n howmany[dic[some]]+=1",
"2<=a<=h-1 and 2<=b<=w-1",
"2<=a<=h-1",
"2<=a",
"2",
"a",
"h-1",
"h",
"1",
"2<=b<=w-1",
"2<=b",
"2",
"b",
"w-1",
"w",
"1",
"howmany[dic[some]]+=1",
"howmany[dic[some]]",
"howmany",
"dic[some]",
"dic",
"some",
"1",
"J=(h-2)*(w-2)-sum(howmany)",
"J",
"(h-2)*(w-2)-sum(howmany)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(howmany)",
"sum",
"howmany",
"print(J)",
"print",
"J",
"for i in range(1,10):\n print(howmany[i])",
"i",
"range(1,10)",
"range",
"1",
"10",
"print(howmany[i])",
"print",
"howmany[i]",
"howmany",
"i",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"a,b=some[0],some[1]",
"some[0]",
"a",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"dic={}",
"{}",
"dic",
"J=(h-2)*(w-2)-sum(howmany)",
"(h-2)*(w-2)-sum(howmany)",
"J",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"b=some[0],some[1]",
"some[1]",
"b",
"howmany=[0 for i in range(10)]",
"[0 for i in range(10)]",
"howmany",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"b=map(int,input().split())",
"map(int,input().split())",
"b"
] | #すぬけくんの塗り絵
h,w,n=map(int,input().split())
dic={}
for _ in range(n):
a,b=map(int,input().split())
for i in range(a-1,a+2):
for j in range(b-1,b+2):
if (i,j) in dic.keys():
dic[(i,j)]+=1
else:
dic[(i,j)]=1
howmany=[0 for i in range(10)]
for some in dic.keys():
a,b=some[0],some[1]
if 2<=a<=h-1 and 2<=b<=w-1:
howmany[dic[some]]+=1
J=(h-2)*(w-2)-sum(howmany)
print(J)
for i in range(1,10):
print(howmany[i])
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
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,
2,
2,
2,
17,
13,
13,
2,
2,
17,
13,
13,
0,
18,
13,
39,
13,
13,
17,
0,
18,
13,
18,
13,
39,
13,
13,
17,
0,
18,
13,
2,
18,
13,
39,
13,
13,
17,
17,
4,
13,
31,
13,
0,
13,
17,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13
] | [
[
143,
3
],
[
143,
12
],
[
143,
13
],
[
17,
16
],
[
132,
19
],
[
134,
32
],
[
140,
35
],
[
149,
40
],
[
49,
46
],
[
150,
47
],
[
129,
51
],
[
144,
54
],
[
62,
61
],
[
68,
67
],
[
137,
73
],
[
61,
76
],
[
146,
77
],
[
67,
80
],
[
138,
86
],
[
129,
87
],
[
147,
91
],
[
144,
92
],
[
99,
94
],
[
141,
95
],
[
108,
101
],
[
150,
102
],
[
141,
104
],
[
119,
110
],
[
150,
111
],
[
141,
114
],
[
150,
123
],
[
126,
125
],
[
143,
129
],
[
143,
132
],
[
134,
135
],
[
137,
138
],
[
140,
141
],
[
143,
144
],
[
146,
147
],
[
149,
150
]
] | [
"from collections import defaultdict\n\nh, w, n = map(int, input().split())\nAB = [list(map(int, input().split())) for _ in range(n)]\nd = defaultdict(int)\nL = [0]*10\nL[0] = (h-2) * (w-2)\nfor a, b in AB:\n for i in range(-1, 2):\n for j in range(-1, 2):\n y, x = a+i, b+j\n if 1 < y < h and 1 < x < w:\n d[(y, x)] += 1\n L[d[(y, x)]] += 1\n L[d[(y, x)]-1] -= 1\nprint(*L, 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",
"list(map(int, input().split())) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"AB = [list(map(int, input().split())) for _ in range(n)]",
"AB",
"[list(map(int, input().split())) for _ in range(n)]",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"L = [0]*10",
"L",
"[0]*10",
"[0]",
"0",
"10",
"L[0] = (h-2) * (w-2)",
"L[0]",
"L",
"0",
"(h-2) * (w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"for a, b in AB:\n for i in range(-1, 2):\n for j in range(-1, 2):\n y, x = a+i, b+j\n if 1 < y < h and 1 < x < w:\n d[(y, x)] += 1\n L[d[(y, x)]] += 1\n L[d[(y, x)]-1] -= 1",
"a",
"b",
"AB",
"for i in range(-1, 2):\n for j in range(-1, 2):\n y, x = a+i, b+j\n if 1 < y < h and 1 < x < w:\n d[(y, x)] += 1\n L[d[(y, x)]] += 1\n L[d[(y, x)]-1] -= 1",
"i",
"range(-1, 2)",
"range",
"-1",
"2",
"for j in range(-1, 2):\n y, x = a+i, b+j\n if 1 < y < h and 1 < x < w:\n d[(y, x)] += 1\n L[d[(y, x)]] += 1\n L[d[(y, x)]-1] -= 1",
"j",
"range(-1, 2)",
"range",
"-1",
"2",
"y, x = a+i, b+j",
"y",
"a+i",
"a",
"i",
"x",
"b+j",
"b",
"j",
"if 1 < y < h and 1 < x < w:\n d[(y, x)] += 1\n L[d[(y, x)]] += 1\n L[d[(y, x)]-1] -= 1",
"1 < y < h and 1 < x < w",
"1 < y < h",
"1 < y",
"1",
"y",
"h",
"1 < x < w",
"1 < x",
"1",
"x",
"w",
"d[(y, x)] += 1",
"d[(y, x)]",
"d",
"(y, x)",
"y",
"x",
"1",
"L[d[(y, x)]] += 1",
"L[d[(y, x)]]",
"L",
"d[(y, x)]",
"d",
"(y, x)",
"y",
"x",
"1",
"L[d[(y, x)]-1] -= 1",
"L[d[(y, x)]-1]",
"L",
"d[(y, x)]-1",
"d[(y, x)]",
"d",
"(y, x)",
"y",
"x",
"1",
"1",
"print(*L, sep=\"\\n\")",
"print",
"*L",
"L",
"sep=\"\\n\"",
"sep",
"\"\\n\"",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"AB = [list(map(int, input().split())) for _ in range(n)]",
"[list(map(int, input().split())) for _ in range(n)]",
"AB",
"y, x = a+i, b+j",
"a+i",
"y",
"d = defaultdict(int)",
"defaultdict(int)",
"d",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"x = a+i, b+j",
"b+j",
"x",
"L = [0]*10",
"[0]*10",
"L"
] | from collections import defaultdict
h, w, n = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(n)]
d = defaultdict(int)
L = [0]*10
L[0] = (h-2) * (w-2)
for a, b in AB:
for i in range(-1, 2):
for j in range(-1, 2):
y, x = a+i, b+j
if 1 < y < h and 1 < x < w:
d[(y, x)] += 1
L[d[(y, x)]] += 1
L[d[(y, x)]-1] -= 1
print(*L, sep="\n") |
[
7,
15,
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,
0,
13,
17,
0,
13,
17,
28,
13,
13,
0,
13,
13,
13,
14,
2,
2,
2,
17,
2,
13,
13,
2,
13,
17,
2,
2,
17,
2,
13,
13,
2,
13,
17,
14,
40,
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,
4,
13,
31,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
2,
13,
10,
39,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] | [
[
177,
3
],
[
177,
12
],
[
177,
13
],
[
189,
15
],
[
183,
18
],
[
49,
48
],
[
172,
51
],
[
195,
53
],
[
195,
62
],
[
168,
64
],
[
186,
67
],
[
71,
70
],
[
184,
70
],
[
198,
73
],
[
70,
74
],
[
198,
75
],
[
169,
82
],
[
193,
82
],
[
175,
83
],
[
178,
85
],
[
187,
91
],
[
196,
91
],
[
199,
92
],
[
166,
94
],
[
169,
100
],
[
193,
100
],
[
175,
101
],
[
187,
103
],
[
196,
103
],
[
199,
104
],
[
190,
105
],
[
116,
107
],
[
190,
108
],
[
169,
111
],
[
193,
111
],
[
175,
112
],
[
187,
114
],
[
196,
114
],
[
199,
115
],
[
127,
118
],
[
190,
119
],
[
169,
122
],
[
193,
122
],
[
175,
123
],
[
187,
125
],
[
196,
125
],
[
199,
126
],
[
180,
129
],
[
136,
135
],
[
190,
138
],
[
144,
141
],
[
181,
142
],
[
135,
143
],
[
149,
146
],
[
181,
147
],
[
178,
152
],
[
166,
155
],
[
181,
159
],
[
181,
163
],
[
177,
166
],
[
168,
169
],
[
177,
172
],
[
70,
174
],
[
198,
175
],
[
177,
178
],
[
180,
181
],
[
183,
184
],
[
186,
187
],
[
189,
190
],
[
195,
193
],
[
195,
196
],
[
70,
198
],
[
198,
199
]
] | [
"#import sys\n#import numpy as np\n#import math\n#import itertools\n#from fractions import Fraction\n#import itertools\nfrom collections import deque\n#import heapq\n#from fractions import gcd\n#input=sys.stdin.readline\n#import bisect\n\nh,w,n=map(int,input().split())\nd={}\np=((1,1),(1,0),(1,-1),(0,1),(0,0),(0,-1),(-1,1),(-1,0),(-1,-1))\nfor i in range(n):\n a,b=map(int,input().split())\n a-=1\n b-=1\n for idx in p:\n s,t=idx\n if 0<a+s<h-1 and 0<b+t<w-1:\n if (a+s,b+t) not in d:\n d[(a+s,b+t)]=1\n else:\n d[(a+s,b+t)]+=1\nans=[0]*10\nfor x in d.values():\n ans[x]+=1\nans[0]=(h-2)*(w-2)-sum(ans)\nprint(*ans)",
"from collections import deque",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"d={}",
"d",
"{}",
"p=((1,1),(1,0),(1,-1),(0,1),(0,0),(0,-1),(-1,1),(-1,0),(-1,-1))",
"p",
"((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",
"for i in range(n):\n a,b=map(int,input().split())\n a-=1\n b-=1\n for idx in p:\n s,t=idx\n if 0<a+s<h-1 and 0<b+t<w-1:\n if (a+s,b+t) not in d:\n d[(a+s,b+t)]=1\n else:\n d[(a+s,b+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",
"a-=1",
"a",
"1",
"b-=1",
"b",
"1",
"for idx in p:\n s,t=idx\n if 0<a+s<h-1 and 0<b+t<w-1:\n if (a+s,b+t) not in d:\n d[(a+s,b+t)]=1\n else:\n d[(a+s,b+t)]+=1",
"idx",
"p",
"s,t=idx",
"s",
"idx",
"t",
"if 0<a+s<h-1 and 0<b+t<w-1:\n if (a+s,b+t) not in d:\n d[(a+s,b+t)]=1\n else:\n d[(a+s,b+t)]+=1",
"0<a+s<h-1 and 0<b+t<w-1",
"0<a+s<h-1",
"0<a+s",
"0",
"a+s",
"a",
"s",
"h-1",
"h",
"1",
"0<b+t<w-1",
"0<b+t",
"0",
"b+t",
"b",
"t",
"w-1",
"w",
"1",
"if (a+s,b+t) not in d:\n d[(a+s,b+t)]=1\n else:\n d[(a+s,b+t)]+=1",
"(a+s,b+t) not in d",
"(a+s,b+t)",
"a+s",
"a",
"s",
"b+t",
"b",
"t",
"d",
"d[(a+s,b+t)]=1",
"d[(a+s,b+t)]",
"d",
"(a+s,b+t)",
"a+s",
"a",
"s",
"b+t",
"b",
"t",
"1",
"d[(a+s,b+t)]+=1",
"d[(a+s,b+t)]",
"d",
"(a+s,b+t)",
"a+s",
"a",
"s",
"b+t",
"b",
"t",
"1",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for x in d.values():\n ans[x]+=1",
"x",
"d.values()",
"d.values",
"d",
"values",
"ans[x]+=1",
"ans[x]",
"ans",
"x",
"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",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"a-=1",
"1",
"a",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"s,t=idx",
"idx",
"s",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"ans=[0]*10",
"[0]*10",
"ans",
"p=((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))",
"p",
"b-=1",
"1",
"b",
"d={}",
"{}",
"d",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"t=idx",
"idx",
"t"
] | #import sys
#import numpy as np
#import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
#from fractions import gcd
#input=sys.stdin.readline
#import bisect
h,w,n=map(int,input().split())
d={}
p=((1,1),(1,0),(1,-1),(0,1),(0,0),(0,-1),(-1,1),(-1,0),(-1,-1))
for i in range(n):
a,b=map(int,input().split())
a-=1
b-=1
for idx in p:
s,t=idx
if 0<a+s<h-1 and 0<b+t<w-1:
if (a+s,b+t) not in d:
d[(a+s,b+t)]=1
else:
d[(a+s,b+t)]+=1
ans=[0]*10
for x in d.values():
ans[x]+=1
ans[0]=(h-2)*(w-2)-sum(ans)
print(*ans) |
[
7,
15,
13,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
0,
13,
4,
13,
4,
13,
39,
17,
17,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
13,
0,
13,
2,
13,
18,
13,
17,
0,
13,
2,
13,
18,
13,
17,
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,
18,
13,
13,
13,
0,
13,
2,
39,
17,
17,
28,
13,
13,
4,
18,
13,
13,
14,
2,
40,
18,
13,
17,
2,
13,
17,
40,
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,
18,
13,
39,
17,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] | [
[
183,
5
],
[
183,
14
],
[
183,
15
],
[
177,
17
],
[
165,
20
],
[
31,
30
],
[
34,
33
],
[
181,
36
],
[
186,
38
],
[
186,
47
],
[
50,
49
],
[
166,
49
],
[
171,
52
],
[
187,
54
],
[
49,
56
],
[
168,
59
],
[
160,
61
],
[
49,
63
],
[
172,
70
],
[
163,
72
],
[
169,
77
],
[
184,
79
],
[
178,
83
],
[
174,
89
],
[
178,
94
],
[
189,
96
],
[
175,
106
],
[
163,
115
],
[
184,
122
],
[
128,
125
],
[
190,
126
],
[
133,
130
],
[
190,
131
],
[
163,
136
],
[
184,
139
],
[
190,
144
],
[
150,
149
],
[
190,
156
],
[
149,
157
],
[
186,
160
],
[
183,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
],
[
183,
181
],
[
183,
184
],
[
186,
187
],
[
189,
190
]
] | [
"import collections\nfrom itertools import product\n\nH, W, N = map(int,input().split())\nPaintList = []\npat = list(product((-2,-1,0),repeat=2))\nfor i in range(N):\n x,y = map(int, input().split())\n for p in pat:\n xw = x + p[0]\n yw = y + p[1]\n #print(xw,yw)\n if 1 <= xw <= H-2 and 1 <= yw <= W-2:\n PaintList.append((xw,yw))\n\nc = collections.Counter(PaintList)\n#print(c)\nans = [0] * 10\nfor k,v in c.items():\n if k[0] <= H-2 and k[1] <= W-2:\n ans[v] += 1\n \nans[0] = (H-2)*(W-2) - sum(ans[1:10])\n \nfor i in range(10):\n print(ans[i])",
"import collections",
"collections",
"from itertools import product",
"H, W, N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"PaintList = []",
"PaintList",
"[]",
"pat = list(product((-2,-1,0),repeat=2))",
"pat",
"list(product((-2,-1,0),repeat=2))",
"list",
"product((-2,-1,0),repeat=2)",
"product",
"(-2,-1,0)",
"-2",
"-1",
"0",
"repeat=2",
"repeat",
"2",
"for i in range(N):\n x,y = map(int, input().split())\n for p in pat:\n xw = x + p[0]\n yw = y + p[1]\n #print(xw,yw)\n if 1 <= xw <= H-2 and 1 <= yw <= W-2:\n PaintList.append((xw,yw))",
"i",
"range(N)",
"range",
"N",
"x,y = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"for p in pat:\n xw = x + p[0]\n yw = y + p[1]\n #print(xw,yw)\n if 1 <= xw <= H-2 and 1 <= yw <= W-2:\n PaintList.append((xw,yw))",
"p",
"pat",
"xw = x + p[0]",
"xw",
"x + p[0]",
"x",
"p[0]",
"p",
"0",
"yw = y + p[1]",
"yw",
"y + p[1]",
"y",
"p[1]",
"p",
"1",
"if 1 <= xw <= H-2 and 1 <= yw <= W-2:\n PaintList.append((xw,yw))",
"1 <= xw <= H-2 and 1 <= yw <= W-2",
"1 <= xw <= H-2",
"1 <= xw",
"1",
"xw",
"H-2",
"H",
"2",
"1 <= yw <= W-2",
"1 <= yw",
"1",
"yw",
"W-2",
"W",
"2",
"PaintList.append((xw,yw))",
"PaintList.append",
"PaintList",
"append",
"(xw,yw)",
"xw",
"yw",
"c = collections.Counter(PaintList)",
"c",
"collections.Counter(PaintList)",
"collections.Counter",
"collections",
"Counter",
"PaintList",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for k,v in c.items():\n if k[0] <= H-2 and k[1] <= W-2:\n ans[v] += 1\n ",
"k",
"v",
"c.items()",
"c.items",
"c",
"items",
"if k[0] <= H-2 and k[1] <= W-2:\n ans[v] += 1\n ",
"k[0] <= H-2 and k[1] <= W-2",
"k[0] <= H-2",
"k[0]",
"k",
"0",
"H-2",
"H",
"2",
"k[1] <= W-2",
"k[1]",
"k",
"1",
"W-2",
"W",
"2",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"ans[0] = (H-2)*(W-2) - sum(ans[1:10])",
"ans[0]",
"ans",
"0",
"(H-2)*(W-2) - sum(ans[1:10])",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(ans[1:10])",
"sum",
"ans[1:10]",
"ans",
"1:10",
"1",
"10",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"y = map(int, input().split())",
"map(int, input().split())",
"y",
"H, W, N = map(int,input().split())",
"map(int,input().split())",
"H",
"pat = list(product((-2,-1,0),repeat=2))",
"list(product((-2,-1,0),repeat=2))",
"pat",
"yw = y + p[1]",
"y + p[1]",
"yw",
"xw = x + p[0]",
"x + p[0]",
"xw",
"c = collections.Counter(PaintList)",
"collections.Counter(PaintList)",
"c",
"PaintList = []",
"[]",
"PaintList",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"W, N = map(int,input().split())",
"map(int,input().split())",
"W",
"x,y = map(int, input().split())",
"map(int, input().split())",
"x",
"ans = [0] * 10",
"[0] * 10",
"ans"
] | import collections
from itertools import product
H, W, N = map(int,input().split())
PaintList = []
pat = list(product((-2,-1,0),repeat=2))
for i in range(N):
x,y = map(int, input().split())
for p in pat:
xw = x + p[0]
yw = y + p[1]
#print(xw,yw)
if 1 <= xw <= H-2 and 1 <= yw <= W-2:
PaintList.append((xw,yw))
c = collections.Counter(PaintList)
#print(c)
ans = [0] * 10
for k,v in c.items():
if k[0] <= H-2 and k[1] <= W-2:
ans[v] += 1
ans[0] = (H-2)*(W-2) - sum(ans[1:10])
for i in range(10):
print(ans[i]) |
[
7,
15,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
12,
13,
0,
18,
13,
18,
13,
39,
13,
13,
17,
0,
18,
13,
2,
18,
13,
39,
13,
13,
17,
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,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
14,
2,
40,
40,
17,
2,
13,
13,
2,
13,
17,
40,
40,
17,
2,
13,
13,
2,
13,
17,
4,
13,
2,
13,
13,
2,
13,
13,
28,
13,
13,
4,
13,
13,
4,
13,
10,
12,
13
] | [
[
6,
5
],
[
6,
14
],
[
6,
15
],
[
18,
17
],
[
24,
23
],
[
31,
30
],
[
36,
33
],
[
30,
34
],
[
5,
38
],
[
14,
41
],
[
53,
46
],
[
30,
47
],
[
17,
49
],
[
64,
55
],
[
30,
56
],
[
17,
59
],
[
71,
66
],
[
17,
67
],
[
73,
73
],
[
75,
75
],
[
78,
77
],
[
15,
80
],
[
83,
82
],
[
83,
91
],
[
94,
93
],
[
100,
99
],
[
82,
110
],
[
93,
111
],
[
5,
113
],
[
91,
119
],
[
99,
120
],
[
14,
122
],
[
44,
125
],
[
82,
127
],
[
93,
128
],
[
91,
130
],
[
99,
131
],
[
134,
133
],
[
30,
133
],
[
133,
137
],
[
142,
139
]
] | [
"from collections import defaultdict\n\ndef sol():\n H, W, N = map(int, input().split())\n origin = defaultdict(int)\n\n ans = [0 for _ in range(10)]\n ans[0] = (H - 2) * (W - 2)\n\n def addBlack(h, w):\n ans[origin[(h, w)]] -= 1\n ans[origin[(h, w)] + 1] += 1\n origin[(h, w)] += 1\n\n for _ in range(N):\n h, w = map(int, input().split())\n\n for a in [-1, 0, 1]:\n for b in [-1, 0, 1]:\n if 2 <= h + a <= H - 1 and 2 <= w + b <= W - 1:\n addBlack(h + a, w + b)\n\n for a in ans:\n print(a)\n\nsol()",
"from collections import defaultdict",
"def sol():\n H, W, N = map(int, input().split())\n origin = defaultdict(int)\n\n ans = [0 for _ in range(10)]\n ans[0] = (H - 2) * (W - 2)\n\n def addBlack(h, w):\n ans[origin[(h, w)]] -= 1\n ans[origin[(h, w)] + 1] += 1\n origin[(h, w)] += 1\n\n for _ in range(N):\n h, w = map(int, input().split())\n\n for a in [-1, 0, 1]:\n for b in [-1, 0, 1]:\n if 2 <= h + a <= H - 1 and 2 <= w + b <= W - 1:\n addBlack(h + a, w + b)\n\n for a in ans:\n print(a)",
"sol",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"origin = defaultdict(int)",
"origin",
"defaultdict(int)",
"defaultdict",
"int",
"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)]",
"ans[0] = (H - 2) * (W - 2)",
"ans[0]",
"ans",
"0",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"def addBlack(h, w):\n ans[origin[(h, w)]] -= 1\n ans[origin[(h, w)] + 1] += 1\n origin[(h, w)] += 1\n\n ",
"addBlack",
"ans[origin[(h, w)]] -= 1",
"ans[origin[(h, w)]]",
"ans",
"origin[(h, w)]",
"origin",
"(h, w)",
"h",
"w",
"1",
"ans[origin[(h, w)] + 1] += 1",
"ans[origin[(h, w)] + 1]",
"ans",
"origin[(h, w)] + 1",
"origin[(h, w)]",
"origin",
"(h, w)",
"h",
"w",
"1",
"1",
"origin[(h, w)] += 1",
"origin[(h, w)]",
"origin",
"(h, w)",
"h",
"w",
"1",
"h",
"h",
"w",
"w",
"for _ in range(N):\n h, w = map(int, input().split())\n\n for a in [-1, 0, 1]:\n for b in [-1, 0, 1]:\n if 2 <= h + a <= H - 1 and 2 <= w + b <= W - 1:\n addBlack(h + a, w + b)\n\n ",
"_",
"range(N)",
"range",
"N",
"h, w = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"for a in [-1, 0, 1]:\n for b in [-1, 0, 1]:\n if 2 <= h + a <= H - 1 and 2 <= w + b <= W - 1:\n addBlack(h + a, w + b)\n\n ",
"a",
"[-1, 0, 1]",
"-1",
"0",
"1",
"for b in [-1, 0, 1]:\n if 2 <= h + a <= H - 1 and 2 <= w + b <= W - 1:\n addBlack(h + a, w + b)\n\n ",
"b",
"[-1, 0, 1]",
"-1",
"0",
"1",
"if 2 <= h + a <= H - 1 and 2 <= w + b <= W - 1:\n addBlack(h + a, w + b)\n\n ",
"2 <= h + a <= H - 1 and 2 <= w + b <= W - 1",
"2 <= h + a <= H - 1",
"2 <= h + a",
"2",
"h + a",
"h",
"a",
"H - 1",
"H",
"1",
"2 <= w + b <= W - 1",
"2 <= w + b",
"2",
"w + b",
"w",
"b",
"W - 1",
"W",
"1",
"addBlack(h + a, w + b)",
"addBlack",
"h + a",
"h",
"a",
"w + b",
"w",
"b",
"for a in ans:\n print(a)",
"a",
"ans",
"print(a)",
"print",
"a",
"sol()",
"sol",
"def sol():\n H, W, N = map(int, input().split())\n origin = defaultdict(int)\n\n ans = [0 for _ in range(10)]\n ans[0] = (H - 2) * (W - 2)\n\n def addBlack(h, w):\n ans[origin[(h, w)]] -= 1\n ans[origin[(h, w)] + 1] += 1\n origin[(h, w)] += 1\n\n for _ in range(N):\n h, w = map(int, input().split())\n\n for a in [-1, 0, 1]:\n for b in [-1, 0, 1]:\n if 2 <= h + a <= H - 1 and 2 <= w + b <= W - 1:\n addBlack(h + a, w + b)\n\n for a in ans:\n print(a)",
"def sol():\n H, W, N = map(int, input().split())\n origin = defaultdict(int)\n\n ans = [0 for _ in range(10)]\n ans[0] = (H - 2) * (W - 2)\n\n def addBlack(h, w):\n ans[origin[(h, w)]] -= 1\n ans[origin[(h, w)] + 1] += 1\n origin[(h, w)] += 1\n\n for _ in range(N):\n h, w = map(int, input().split())\n\n for a in [-1, 0, 1]:\n for b in [-1, 0, 1]:\n if 2 <= h + a <= H - 1 and 2 <= w + b <= W - 1:\n addBlack(h + a, w + b)\n\n for a in ans:\n print(a)",
"sol"
] | from collections import defaultdict
def sol():
H, W, N = map(int, input().split())
origin = defaultdict(int)
ans = [0 for _ in range(10)]
ans[0] = (H - 2) * (W - 2)
def addBlack(h, w):
ans[origin[(h, w)]] -= 1
ans[origin[(h, w)] + 1] += 1
origin[(h, w)] += 1
for _ in range(N):
h, w = map(int, input().split())
for a in [-1, 0, 1]:
for b in [-1, 0, 1]:
if 2 <= h + a <= H - 1 and 2 <= w + b <= W - 1:
addBlack(h + a, w + b)
for a in ans:
print(a)
sol() |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
28,
13,
13,
13,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
4,
13,
31,
13,
0,
13,
17,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
144,
3
],
[
144,
12
],
[
144,
13
],
[
17,
16
],
[
133,
19
],
[
129,
32
],
[
135,
35
],
[
45,
44
],
[
55,
54
],
[
44,
68
],
[
145,
70
],
[
54,
75
],
[
142,
77
],
[
85,
80
],
[
136,
81
],
[
138,
87
],
[
94,
93
],
[
136,
96
],
[
102,
99
],
[
139,
100
],
[
93,
101
],
[
107,
104
],
[
139,
105
],
[
145,
110
],
[
142,
113
],
[
139,
118
],
[
139,
124
],
[
127,
126
],
[
129,
130
],
[
144,
133
],
[
135,
136
],
[
138,
139
],
[
144,
142
],
[
144,
145
]
] | [
"from collections import defaultdict\n\nh, w, n = map(int, input().split())\nab = [list(map(int, input().split())) for _ in range(n)]\n\nd = defaultdict(int)\n\nfor a, b in ab:\n for hi in range(a - 2, a + 1):\n for wi in range(b - 2, b + 1):\n if 1 <= hi <= h - 2 and 1 <= wi <= w - 2:\n d[(hi, wi)] += 1\n\ncnt = [0] * 10\nfor v in d.values():\n cnt[v] += 1\n\ncnt[0] = (h - 2) * (w - 2) - sum(cnt[1:])\nprint(*cnt, 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",
"list(map(int, input().split())) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ab = [list(map(int, input().split())) for _ in range(n)]",
"ab",
"[list(map(int, input().split())) for _ in range(n)]",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"for a, b in ab:\n for hi in range(a - 2, a + 1):\n for wi in range(b - 2, b + 1):\n if 1 <= hi <= h - 2 and 1 <= wi <= w - 2:\n d[(hi, wi)] += 1",
"a",
"b",
"ab",
"for hi in range(a - 2, a + 1):\n for wi in range(b - 2, b + 1):\n if 1 <= hi <= h - 2 and 1 <= wi <= w - 2:\n d[(hi, wi)] += 1",
"hi",
"range(a - 2, a + 1)",
"range",
"a - 2",
"a",
"2",
"a + 1",
"a",
"1",
"for wi in range(b - 2, b + 1):\n if 1 <= hi <= h - 2 and 1 <= wi <= w - 2:\n d[(hi, wi)] += 1",
"wi",
"range(b - 2, b + 1)",
"range",
"b - 2",
"b",
"2",
"b + 1",
"b",
"1",
"if 1 <= hi <= h - 2 and 1 <= wi <= w - 2:\n d[(hi, wi)] += 1",
"1 <= hi <= h - 2 and 1 <= wi <= w - 2",
"1 <= hi <= h - 2",
"1 <= hi",
"1",
"hi",
"h - 2",
"h",
"2",
"1 <= wi <= w - 2",
"1 <= wi",
"1",
"wi",
"w - 2",
"w",
"2",
"d[(hi, wi)] += 1",
"d[(hi, wi)]",
"d",
"(hi, wi)",
"hi",
"wi",
"1",
"cnt = [0] * 10",
"cnt",
"[0] * 10",
"[0]",
"0",
"10",
"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) - sum(cnt[1:])",
"cnt[0]",
"cnt",
"0",
"(h - 2) * (w - 2) - sum(cnt[1:])",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"sum(cnt[1:])",
"sum",
"cnt[1:]",
"cnt",
"1:",
"1",
"print(*cnt, sep=\"\\n\")",
"print",
"*cnt",
"cnt",
"sep=\"\\n\"",
"sep",
"\"\\n\"",
"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",
"d = defaultdict(int)",
"defaultdict(int)",
"d",
"cnt = [0] * 10",
"[0] * 10",
"cnt",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h"
] | from collections import defaultdict
h, w, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
d = defaultdict(int)
for a, b in ab:
for hi in range(a - 2, a + 1):
for wi in range(b - 2, b + 1):
if 1 <= hi <= h - 2 and 1 <= wi <= w - 2:
d[(hi, wi)] += 1
cnt = [0] * 10
for v in d.values():
cnt[v] += 1
cnt[0] = (h - 2) * (w - 2) - sum(cnt[1:])
print(*cnt, sep="\n")
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
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,
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,
13,
13,
0,
18,
13,
18,
13,
39,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] | [
[
178,
3
],
[
178,
12
],
[
178,
13
],
[
148,
15
],
[
157,
20
],
[
25,
24
],
[
170,
27
],
[
181,
29
],
[
181,
38
],
[
166,
40
],
[
163,
43
],
[
47,
46
],
[
53,
52
],
[
172,
58
],
[
167,
60
],
[
182,
60
],
[
46,
61
],
[
184,
62
],
[
164,
64
],
[
161,
64
],
[
52,
65
],
[
173,
73
],
[
179,
74
],
[
185,
78
],
[
176,
79
],
[
173,
82
],
[
179,
84
],
[
185,
87
],
[
176,
89
],
[
96,
91
],
[
149,
92
],
[
158,
99
],
[
151,
105
],
[
154,
111
],
[
125,
118
],
[
152,
119
],
[
149,
121
],
[
130,
127
],
[
152,
128
],
[
179,
133
],
[
176,
136
],
[
158,
140
],
[
143,
142
],
[
152,
142
],
[
142,
146
],
[
148,
149
],
[
151,
152
],
[
154,
155
],
[
157,
158
],
[
181,
161
],
[
163,
164
],
[
166,
167
],
[
178,
170
],
[
172,
173
],
[
178,
176
],
[
178,
179
],
[
181,
182
],
[
184,
185
]
] | [
"from collections import defaultdict\nh,w,n=map(int,input().split())\nd=defaultdict(int)\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 d[(ny,nx)]+=1\n s.add((ny,nx))\ncnt=[0]*10\nq=0\nfor y,x in s:\n cnt[d[(y,x)]]+=1\ncnt[0]=(h-2)*(w-2)-len(s)\nfor i in cnt:\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",
"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 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 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 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 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",
"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 y,x in s:\n cnt[d[(y,x)]]+=1",
"y",
"x",
"s",
"cnt[d[(y,x)]]+=1",
"cnt[d[(y,x)]]",
"cnt",
"d[(y,x)]",
"d",
"(y,x)",
"y",
"x",
"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",
"d=defaultdict(int)",
"defaultdict(int)",
"d",
"cnt=[0]*10",
"[0]*10",
"cnt",
"q=0",
"0",
"q",
"s=set()",
"set()",
"s",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"b-=1",
"1",
"b",
"a-=1",
"1",
"a",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"ny,nx=a+dy,b+dx",
"a+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",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"nx=a+dy,b+dx",
"b+dx",
"nx"
] | from collections import defaultdict
h,w,n=map(int,input().split())
d=defaultdict(int)
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:
d[(ny,nx)]+=1
s.add((ny,nx))
cnt=[0]*10
q=0
for y,x in s:
cnt[d[(y,x)]]+=1
cnt[0]=(h-2)*(w-2)-len(s)
for i in cnt:
print(i)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
15,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
18,
13,
39,
2,
13,
17,
2,
13,
17,
17,
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,
4,
13,
10,
2,
13
] | [
[
168,
2
],
[
168,
11
],
[
168,
12
],
[
165,
15
],
[
162,
20
],
[
26,
25
],
[
169,
28
],
[
159,
30
],
[
159,
39
],
[
50,
41
],
[
166,
42
],
[
160,
45
],
[
151,
48
],
[
53,
52
],
[
59,
58
],
[
160,
69
],
[
52,
70
],
[
151,
74
],
[
58,
75
],
[
160,
79
],
[
52,
80
],
[
154,
82
],
[
151,
86
],
[
58,
87
],
[
157,
89
],
[
106,
93
],
[
163,
94
],
[
160,
98
],
[
52,
99
],
[
151,
103
],
[
58,
104
],
[
171,
108
],
[
115,
114
],
[
163,
117
],
[
123,
120
],
[
172,
121
],
[
114,
122
],
[
128,
125
],
[
172,
126
],
[
154,
131
],
[
157,
134
],
[
172,
138
],
[
141,
140
],
[
172,
147
],
[
140,
148
],
[
159,
151
],
[
168,
154
],
[
168,
157
],
[
159,
160
],
[
162,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
]
] | [
"H,W,N = map(int,input().split())\n\nfrom collections import defaultdict\nt =defaultdict(int)\nL = defaultdict(int)\n\nfor i in range(N):\n a,b = map(int,input().split())\n t[(a-1,b-1)] = 1\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\nans = [0]*10\nfor v in L.values():\n ans[v] += 1\n\nans[0] = (H-2)*(W-2) - sum(ans)\nfor i in range(10):\n print(ans[i])",
"H,W,N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"from collections import defaultdict",
"t =defaultdict(int)",
"t",
"defaultdict(int)",
"defaultdict",
"int",
"L = defaultdict(int)",
"L",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n a,b = map(int,input().split())\n t[(a-1,b-1)] = 1\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",
"i",
"range(N)",
"range",
"N",
"a,b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"t[(a-1,b-1)] = 1",
"t[(a-1,b-1)]",
"t",
"(a-1,b-1)",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"1",
"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",
"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",
"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",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"L = defaultdict(int)",
"defaultdict(int)",
"L",
"t =defaultdict(int)",
"defaultdict(int)",
"t",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"ans = [0]*10",
"[0]*10",
"ans"
] | H,W,N = map(int,input().split())
from collections import defaultdict
t =defaultdict(int)
L = defaultdict(int)
for i in range(N):
a,b = map(int,input().split())
t[(a-1,b-1)] = 1
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,
15,
15,
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,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
0,
13,
17,
28,
13,
13,
28,
13,
39,
17,
17,
17,
28,
13,
39,
17,
17,
17,
0,
13,
2,
18,
13,
17,
13,
0,
13,
2,
18,
13,
17,
13,
14,
2,
2,
2,
2,
13,
17,
2,
13,
17,
40,
2,
13,
17,
13,
40,
2,
13,
17,
13,
9,
0,
13,
2,
2,
4,
13,
13,
17,
4,
13,
13,
14,
2,
13,
13,
0,
13,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
13,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
39,
13,
10,
13,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
190,
2
],
[
190,
11
],
[
190,
12
],
[
169,
16
],
[
20,
19
],
[
164,
22
],
[
193,
24
],
[
193,
33
],
[
170,
36
],
[
176,
40
],
[
194,
43
],
[
48,
47
],
[
172,
54
],
[
166,
57
],
[
61,
60
],
[
170,
60
],
[
64,
63
],
[
70,
69
],
[
187,
75
],
[
60,
78
],
[
63,
80
],
[
184,
82
],
[
60,
85
],
[
69,
87
],
[
188,
93
],
[
185,
96
],
[
188,
100
],
[
161,
102
],
[
185,
105
],
[
191,
107
],
[
181,
110
],
[
188,
115
],
[
185,
119
],
[
182,
122
],
[
167,
123
],
[
178,
125
],
[
161,
128
],
[
191,
131
],
[
135,
134
],
[
167,
137
],
[
143,
140
],
[
173,
141
],
[
134,
142
],
[
148,
145
],
[
173,
146
],
[
179,
149
],
[
167,
152
],
[
155,
154
],
[
173,
154
],
[
154,
158
],
[
190,
161
],
[
190,
164
],
[
166,
167
],
[
169,
170
],
[
172,
173
],
[
193,
176
],
[
178,
179
],
[
181,
182
],
[
184,
185
],
[
187,
188
],
[
190,
191
],
[
193,
194
]
] | [
"H, W , N = map(int,input().split())\nfrom bisect import bisect_left\nfrom bisect import bisect_right\nmatrix = []\nfor _ in range(N):\n x,y = map(int,input().split())\n matrix.append([x-1,y-1])\nans = [0 for _ in range(10)]\ncand = {}\nfor l in matrix:\n for x_r in [-2, -1 , 0]:\n for y_r in [-2, -1 , 0]:\n nowx = l[0] + x_r\n nowy = l[1] + y_r\n if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:\n continue\n #ここで起点(左上)nowx, nowy として 9マスに着目する\n name = str(nowx) + ' ' +str(nowy)\n if name in cand : cand[name] += 1\n else: cand[name] = 1\ntmp = ((H - 2) * (W - 2))\nfor x in cand.values():\n ans[x] +=1\nans[0] =tmp - len(cand)\nfor x in ans:\n print(x)",
"H, W , N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"from bisect import bisect_left",
"from bisect import bisect_right",
"matrix = []",
"matrix",
"[]",
"for _ in range(N):\n x,y = map(int,input().split())\n matrix.append([x-1,y-1])",
"_",
"range(N)",
"range",
"N",
"x,y = map(int,input().split())",
"x",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"matrix.append([x-1,y-1])",
"matrix.append",
"matrix",
"append",
"[x-1,y-1]",
"x-1",
"x",
"1",
"y-1",
"y",
"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)]",
"cand = {}",
"cand",
"{}",
"for l in matrix:\n for x_r in [-2, -1 , 0]:\n for y_r in [-2, -1 , 0]:\n nowx = l[0] + x_r\n nowy = l[1] + y_r\n if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:\n continue\n #ここで起点(左上)nowx, nowy として 9マスに着目する\n name = str(nowx) + ' ' +str(nowy)\n if name in cand : cand[name] += 1\n else: cand[name] = 1",
"l",
"matrix",
"for x_r in [-2, -1 , 0]:\n for y_r in [-2, -1 , 0]:\n nowx = l[0] + x_r\n nowy = l[1] + y_r\n if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:\n continue\n #ここで起点(左上)nowx, nowy として 9マスに着目する\n name = str(nowx) + ' ' +str(nowy)\n if name in cand : cand[name] += 1\n else: cand[name] = 1",
"x_r",
"[-2, -1 , 0]",
"-2",
"-1",
"0",
"for y_r in [-2, -1 , 0]:\n nowx = l[0] + x_r\n nowy = l[1] + y_r\n if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:\n continue\n #ここで起点(左上)nowx, nowy として 9マスに着目する\n name = str(nowx) + ' ' +str(nowy)\n if name in cand : cand[name] += 1\n else: cand[name] = 1",
"y_r",
"[-2, -1 , 0]",
"-2",
"-1",
"0",
"nowx = l[0] + x_r",
"nowx",
"l[0] + x_r",
"l[0]",
"l",
"0",
"x_r",
"nowy = l[1] + y_r",
"nowy",
"l[1] + y_r",
"l[1]",
"l",
"1",
"y_r",
"if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:\n continue\n #ここで起点(左上)nowx, nowy として 9マスに着目する\n ",
"nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W",
"nowx < 0 or nowy < 0 or nowx + 2>= H",
"nowx < 0 or nowy < 0",
"nowx < 0",
"nowx",
"0",
"nowy < 0",
"nowy",
"0",
"nowx + 2>= H",
"nowx + 2",
"nowx",
"2",
"H",
"nowy+ 2 >= W",
"nowy+ 2",
"nowy",
"2",
"W",
"continue",
"name = str(nowx) + ' ' +str(nowy)",
"name",
"str(nowx) + ' ' +str(nowy)",
"str(nowx) + ' '",
"str(nowx)",
"str",
"nowx",
"' '",
"str(nowy)",
"str",
"nowy",
"if name in cand : cand[name] += 1\n else: cand[name] = 1",
"name in cand",
"name",
"cand",
"tmp = ((H - 2) * (W - 2))",
"tmp",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"for x in cand.values():\n ans[x] +=1",
"x",
"cand.values()",
"cand.values",
"cand",
"values",
"ans[x] +=1",
"ans[x]",
"ans",
"x",
"1",
"ans[0] =tmp - len(cand)",
"ans[0]",
"ans",
"0",
"tmp - len(cand)",
"tmp",
"len(cand)",
"len",
"cand",
"for x in ans:\n print(x)",
"x",
"ans",
"print(x)",
"print",
"x",
"H, W , N = map(int,input().split())",
"map(int,input().split())",
"H",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"cand = {}",
"{}",
"cand",
"matrix = []",
"[]",
"matrix",
"ans = [0 for _ in range(10)]",
"[0 for _ in range(10)]",
"ans",
"x,y = map(int,input().split())",
"map(int,input().split())",
"x",
"tmp = ((H - 2) * (W - 2))",
"(H - 2) * (W - 2)",
"tmp",
"name = str(nowx) + ' ' +str(nowy)",
"str(nowx) + ' ' +str(nowy)",
"name",
"nowy = l[1] + y_r",
"l[1] + y_r",
"nowy",
"nowx = l[0] + x_r",
"l[0] + x_r",
"nowx",
"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())
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
x,y = map(int,input().split())
matrix.append([x-1,y-1])
ans = [0 for _ in range(10)]
cand = {}
for l in matrix:
for x_r in [-2, -1 , 0]:
for y_r in [-2, -1 , 0]:
nowx = l[0] + x_r
nowy = l[1] + y_r
if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:
continue
#ここで起点(左上)nowx, nowy として 9マスに着目する
name = str(nowx) + ' ' +str(nowy)
if name in cand : cand[name] += 1
else: cand[name] = 1
tmp = ((H - 2) * (W - 2))
for x in cand.values():
ans[x] +=1
ans[0] =tmp - len(cand)
for x in ans:
print(x)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
2,
39,
17,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
17,
28,
13,
13,
13,
28,
13,
39,
2,
13,
17,
13,
2,
13,
17,
28,
13,
39,
2,
13,
17,
13,
2,
13,
17,
0,
18,
13,
39,
13,
13,
2,
4,
18,
13,
13,
39,
13,
13,
17,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
4,
18,
13,
13,
0,
13,
13,
13,
14,
2,
2,
13,
17,
2,
13,
17,
14,
2,
2,
13,
2,
13,
17,
2,
13,
2,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
13,
13
] | [
[
153,
2
],
[
153,
11
],
[
153,
12
],
[
16,
15
],
[
148,
19
],
[
162,
32
],
[
156,
35
],
[
43,
42
],
[
53,
52
],
[
67,
62
],
[
157,
63
],
[
157,
70
],
[
150,
78
],
[
157,
88
],
[
159,
91
],
[
159,
93
],
[
160,
97
],
[
145,
100
],
[
160,
105
],
[
142,
107
],
[
145,
110
],
[
154,
112
],
[
118,
115
],
[
151,
116
],
[
123,
120
],
[
151,
121
],
[
154,
126
],
[
142,
129
],
[
151,
133
],
[
136,
135
],
[
151,
135
],
[
135,
139
],
[
153,
142
],
[
159,
145
],
[
153,
148
],
[
150,
151
],
[
153,
154
],
[
156,
157
],
[
159,
160
],
[
162,
163
]
] | [
"H,W,N=map(int,input().split())\nab=[list(map(int,input().split())) for _ in [0]*N]\nd={}\nfor a,b in ab:\n for i in (a-1,a,a+1):\n for j in (b-1,b,b+1):\n d[(i,j)] = d.get((i,j),0)+1\ncnt = [0]*10\nfor k,v in d.items():\n a,b = k\n if a<2 or b<2:continue\n if a>H-1 or b>W-1:continue\n cnt[v] += 1\ncnt[0] = (W-2)*(H-2)-sum(cnt)\nfor ans in cnt:\n print(ans)",
"H,W,N=map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"list(map(int,input().split())) for _ in [0]*N",
"for _ in [0]*N",
"_",
"[0]*N",
"[0]",
"0",
"N",
"for _ in [0]*N",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ab=[list(map(int,input().split())) for _ in [0]*N]",
"ab",
"[list(map(int,input().split())) for _ in [0]*N]",
"d={}",
"d",
"{}",
"for a,b in ab:\n for i in (a-1,a,a+1):\n for j in (b-1,b,b+1):\n d[(i,j)] = d.get((i,j),0)+1",
"a",
"b",
"ab",
"for i in (a-1,a,a+1):\n for j in (b-1,b,b+1):\n d[(i,j)] = d.get((i,j),0)+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 d[(i,j)] = d.get((i,j),0)+1",
"j",
"(b-1,b,b+1)",
"b-1",
"b",
"1",
"b",
"b+1",
"b",
"1",
"d[(i,j)] = d.get((i,j),0)+1",
"d[(i,j)]",
"d",
"(i,j)",
"i",
"j",
"d.get((i,j),0)+1",
"d.get((i,j),0)",
"d.get",
"d",
"get",
"(i,j)",
"i",
"j",
"0",
"1",
"cnt = [0]*10",
"cnt",
"[0]*10",
"[0]",
"0",
"10",
"for k,v in d.items():\n a,b = k\n if a<2 or b<2:continue\n if a>H-1 or b>W-1:continue\n cnt[v] += 1",
"k",
"v",
"d.items()",
"d.items",
"d",
"items",
"a,b = k",
"a",
"k",
"b",
"if a<2 or b<2:continue\n ",
"a<2 or b<2",
"a<2",
"a",
"2",
"b<2",
"b",
"2",
"if a>H-1 or b>W-1:continue\n ",
"a>H-1 or b>W-1",
"a>H-1",
"a",
"H-1",
"H",
"1",
"b>W-1",
"b",
"W-1",
"W",
"1",
"cnt[v] += 1",
"cnt[v]",
"cnt",
"v",
"1",
"cnt[0] = (W-2)*(H-2)-sum(cnt)",
"cnt[0]",
"cnt",
"0",
"(W-2)*(H-2)-sum(cnt)",
"(W-2)*(H-2)",
"W-2",
"W",
"2",
"H-2",
"H",
"2",
"sum(cnt)",
"sum",
"cnt",
"for ans in cnt:\n print(ans)",
"ans",
"cnt",
"print(ans)",
"print",
"ans",
"H,W,N=map(int,input().split())",
"map(int,input().split())",
"H",
"b = k",
"k",
"b",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"cnt = [0]*10",
"[0]*10",
"cnt",
"W,N=map(int,input().split())",
"map(int,input().split())",
"W",
"d={}",
"{}",
"d",
"a,b = k",
"k",
"a",
"ab=[list(map(int,input().split())) for _ in [0]*N]",
"[list(map(int,input().split())) for _ in [0]*N]",
"ab"
] | H,W,N=map(int,input().split())
ab=[list(map(int,input().split())) for _ in [0]*N]
d={}
for a,b in ab:
for i in (a-1,a,a+1):
for j in (b-1,b,b+1):
d[(i,j)] = d.get((i,j),0)+1
cnt = [0]*10
for k,v in d.items():
a,b = k
if a<2 or b<2:continue
if a>H-1 or b>W-1:continue
cnt[v] += 1
cnt[0] = (W-2)*(H-2)-sum(cnt)
for ans in cnt:
print(ans)
|
[
7,
15,
13,
12,
13,
29,
18,
4,
18,
18,
13,
13,
13,
39,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
17,
14,
40,
2,
2,
17,
2,
13,
13,
13,
9,
28,
13,
4,
13,
17,
17,
14,
40,
2,
2,
17,
2,
13,
13,
13,
9,
0,
13,
39,
2,
13,
13,
2,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
0,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
17,
4,
13,
31,
13,
0,
13,
17,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
17,
13,
10,
39,
13,
10,
39,
13,
10,
2,
13,
10,
17,
13
] | [
[
177,
16
],
[
181,
23
],
[
177,
25
],
[
177,
26
],
[
189,
28
],
[
32,
31
],
[
172,
34
],
[
183,
36
],
[
181,
43
],
[
183,
45
],
[
48,
47
],
[
184,
58
],
[
47,
59
],
[
178,
60
],
[
64,
63
],
[
163,
74
],
[
63,
75
],
[
169,
76
],
[
192,
79
],
[
184,
82
],
[
47,
83
],
[
163,
85
],
[
63,
86
],
[
190,
89
],
[
193,
91
],
[
190,
94
],
[
195,
97
],
[
159,
103
],
[
186,
106
],
[
110,
109
],
[
190,
109
],
[
109,
113
],
[
160,
114
],
[
193,
114
],
[
175,
114
],
[
165,
116
],
[
122,
119
],
[
196,
120
],
[
187,
121
],
[
199,
121
],
[
166,
121
],
[
174,
124
],
[
109,
125
],
[
198,
127
],
[
133,
130
],
[
196,
131
],
[
199,
132
],
[
166,
132
],
[
187,
132
],
[
138,
135
],
[
196,
136
],
[
178,
142
],
[
169,
145
],
[
196,
149
],
[
196,
154
],
[
157,
156
],
[
159,
160
],
[
183,
163
],
[
165,
166
],
[
177,
169
],
[
177,
172
],
[
109,
174
],
[
174,
175
],
[
177,
178
],
[
183,
184
],
[
186,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
]
] | [
"import sys\ndef input():\n return sys.stdin.readline()[:-1]\nH,W,N=map(int,input().split())\nd=[]\nfor i in range(N):\n a,b=map(int,input().split())\n for j in range(-1,2):\n if not 1<a+j<H:\n continue\n for k in range(-1,2):\n if not 1<b+k<W:\n continue\n t=(a+j,b+k)\n d.append(t)\nd.sort()\nl=[0]*10\nt=0\nc=0\nfor i in d:\n if i==t:\n c+=1\n else:\n l[c]+=1\n t=i\n c=1\nl[c]+=1\nl[0]=(H-2)*(W-2)-sum(l)+1\nprint(*l,sep=\"\\n\")",
"import sys",
"sys",
"def input():\n return sys.stdin.readline()[:-1]",
"input",
"return sys.stdin.readline()[:-1]",
"sys.stdin.readline()[:-1]",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
":-1",
"-1",
"H,W,N=map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"d=[]",
"d",
"[]",
"for i in range(N):\n a,b=map(int,input().split())\n for j in range(-1,2):\n if not 1<a+j<H:\n continue\n for k in range(-1,2):\n if not 1<b+k<W:\n continue\n t=(a+j,b+k)\n d.append(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 if not 1<a+j<H:\n continue\n for k in range(-1,2):\n if not 1<b+k<W:\n continue\n t=(a+j,b+k)\n d.append(t)",
"j",
"range(-1,2)",
"range",
"-1",
"2",
"if not 1<a+j<H:\n continue\n ",
"not 1<a+j<H",
"1<a+j<H",
"1<a+j",
"1",
"a+j",
"a",
"j",
"H",
"continue",
"for k in range(-1,2):\n if not 1<b+k<W:\n continue\n t=(a+j,b+k)\n d.append(t)",
"k",
"range(-1,2)",
"range",
"-1",
"2",
"if not 1<b+k<W:\n continue\n ",
"not 1<b+k<W",
"1<b+k<W",
"1<b+k",
"1",
"b+k",
"b",
"k",
"W",
"continue",
"t=(a+j,b+k)",
"t",
"(a+j,b+k)",
"a+j",
"a",
"j",
"b+k",
"b",
"k",
"d.append(t)",
"d.append",
"d",
"append",
"t",
"d.sort()",
"d.sort",
"d",
"sort",
"l=[0]*10",
"l",
"[0]*10",
"[0]",
"0",
"10",
"t=0",
"t",
"0",
"c=0",
"c",
"0",
"for i in d:\n if i==t:\n c+=1\n else:\n l[c]+=1\n t=i\n c=1",
"i",
"d",
"if i==t:\n c+=1\n else:\n l[c]+=1\n t=i\n c=1",
"i==t",
"i",
"t",
"c+=1",
"c",
"1",
"l[c]+=1",
"l[c]",
"l",
"c",
"1",
"t=i",
"t",
"i",
"c=1",
"c",
"1",
"l[c]+=1",
"l[c]",
"l",
"c",
"1",
"l[0]=(H-2)*(W-2)-sum(l)+1",
"l[0]",
"l",
"0",
"(H-2)*(W-2)-sum(l)+1",
"(H-2)*(W-2)-sum(l)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(l)",
"sum",
"l",
"1",
"print(*l,sep=\"\\n\")",
"print",
"*l",
"l",
"sep=\"\\n\"",
"sep",
"\"\\n\"",
"t=0",
"0",
"t",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"c+=1",
"1",
"c",
"W,N=map(int,input().split())",
"map(int,input().split())",
"W",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"t=i",
"i",
"t",
"H,W,N=map(int,input().split())",
"map(int,input().split())",
"H",
"def input():\n return sys.stdin.readline()[:-1]",
"def input():\n return sys.stdin.readline()[:-1]",
"input",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"c=0",
"0",
"c",
"d=[]",
"[]",
"d",
"t=(a+j,b+k)",
"(a+j,b+k)",
"t",
"l=[0]*10",
"[0]*10",
"l",
"c=1",
"1",
"c"
] | import sys
def input():
return sys.stdin.readline()[:-1]
H,W,N=map(int,input().split())
d=[]
for i in range(N):
a,b=map(int,input().split())
for j in range(-1,2):
if not 1<a+j<H:
continue
for k in range(-1,2):
if not 1<b+k<W:
continue
t=(a+j,b+k)
d.append(t)
d.sort()
l=[0]*10
t=0
c=0
for i in d:
if i==t:
c+=1
else:
l[c]+=1
t=i
c=1
l[c]+=1
l[0]=(H-2)*(W-2)-sum(l)+1
print(*l,sep="\n") |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
13,
31,
13,
0,
13,
17,
28,
13,
13,
4,
13,
31,
2,
39,
4,
13,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
14,
2,
2,
2,
2,
17,
13,
40,
2,
13,
17,
13,
2,
17,
13,
40,
2,
13,
17,
13,
0,
18,
13,
2,
2,
13,
13,
13,
2,
4,
18,
13,
13,
2,
2,
13,
13,
13,
17,
17,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
17,
4,
13,
4,
18,
17,
13,
4,
13,
13,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
152,
2
],
[
152,
15
],
[
152,
16
],
[
152,
17
],
[
143,
20
],
[
36,
35
],
[
46,
45
],
[
35,
60
],
[
35,
63
],
[
153,
65
],
[
45,
68
],
[
45,
71
],
[
141,
73
],
[
82,
75
],
[
144,
76
],
[
35,
79
],
[
141,
80
],
[
45,
81
],
[
144,
85
],
[
35,
89
],
[
141,
90
],
[
45,
91
],
[
146,
95
],
[
104,
101
],
[
147,
102
],
[
141,
106
],
[
153,
109
],
[
113,
112
],
[
144,
115
],
[
123,
118
],
[
147,
119
],
[
144,
121
],
[
112,
122
],
[
128,
125
],
[
147,
126
],
[
147,
138
],
[
152,
141
],
[
143,
144
],
[
146,
147
],
[
152,
150
],
[
152,
153
]
] | [
"H, W, N, *L = map(int, open(0).read().split())\ndic = {}\nfor a, b in zip(*[iter(L)]*2):\n for i in range(a-2,a+1):\n for j in range(b-2,b+1):\n if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[i*W+j] = dic.get(i*W+j,0)+1\nans = [0]*10\nans[0] = (W-2)*(H-2)\nfor k in dic.keys():\n ans[dic[k]] += 1\n ans[0] -= 1\nprint('\\n'.join(map(str,ans)))",
"H, W, N, *L = map(int, open(0).read().split())",
"H",
"map(int, open(0).read().split())",
"map",
"int",
"open(0).read().split()",
"(0).read().split",
"(0).read()",
"(0).read",
"(0)",
"open",
"0",
"read",
"split",
"W",
"N",
"*L",
"L",
"dic = {}",
"dic",
"{}",
"for a, b in zip(*[iter(L)]*2):\n for i in range(a-2,a+1):\n for j in range(b-2,b+1):\n if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[i*W+j] = dic.get(i*W+j,0)+1",
"a",
"b",
"zip(*[iter(L)]*2)",
"zip",
"*[iter(L)]*2",
"[iter(L)]*2",
"[iter(L)]",
"iter(L)",
"iter",
"L",
"2",
"for i in range(a-2,a+1):\n for j in range(b-2,b+1):\n if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[i*W+j] = dic.get(i*W+j,0)+1",
"i",
"range(a-2,a+1)",
"range",
"a-2",
"a",
"2",
"a+1",
"a",
"1",
"for j in range(b-2,b+1):\n if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[i*W+j] = dic.get(i*W+j,0)+1",
"j",
"range(b-2,b+1)",
"range",
"b-2",
"b",
"2",
"b+1",
"b",
"1",
"if 0<i and i+2<=H and 0<j and j+2<=W:\n dic[i*W+j] = dic.get(i*W+j,0)+1",
"0<i and i+2<=H and 0<j and j+2<=W",
"0<i and i+2<=H and 0<j",
"0<i and i+2<=H",
"0<i",
"0",
"i",
"i+2<=H",
"i+2",
"i",
"2",
"H",
"0<j",
"0",
"j",
"j+2<=W",
"j+2",
"j",
"2",
"W",
"dic[i*W+j] = dic.get(i*W+j,0)+1",
"dic[i*W+j]",
"dic",
"i*W+j",
"i*W",
"i",
"W",
"j",
"dic.get(i*W+j,0)+1",
"dic.get(i*W+j,0)",
"dic.get",
"dic",
"get",
"i*W+j",
"i*W",
"i",
"W",
"j",
"0",
"1",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"ans[0] = (W-2)*(H-2)",
"ans[0]",
"ans",
"0",
"(W-2)*(H-2)",
"W-2",
"W",
"2",
"H-2",
"H",
"2",
"for k in dic.keys():\n ans[dic[k]] += 1\n ans[0] -= 1",
"k",
"dic.keys()",
"dic.keys",
"dic",
"keys",
"ans[dic[k]] += 1",
"ans[dic[k]]",
"ans",
"dic[k]",
"dic",
"k",
"1",
"ans[0] -= 1",
"ans[0]",
"ans",
"0",
"1",
"print('\\n'.join(map(str,ans)))",
"print",
"'\\n'.join(map(str,ans))",
"'\\n'.join",
"'\\n'",
"join",
"map(str,ans)",
"map",
"str",
"ans",
"W, N, *L = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"W",
"dic = {}",
"{}",
"dic",
"ans = [0]*10",
"[0]*10",
"ans",
"N, *L = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"N",
"H, W, N, *L = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"H"
] | H, W, N, *L = map(int, open(0).read().split())
dic = {}
for a, b in zip(*[iter(L)]*2):
for i in range(a-2,a+1):
for j in range(b-2,b+1):
if 0<i and i+2<=H and 0<j and j+2<=W:
dic[i*W+j] = dic.get(i*W+j,0)+1
ans = [0]*10
ans[0] = (W-2)*(H-2)
for k in dic.keys():
ans[dic[k]] += 1
ans[0] -= 1
print('\n'.join(map(str,ans))) |
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
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,
17,
40,
2,
13,
13,
13,
40,
2,
13,
13,
13,
9,
0,
13,
2,
2,
2,
2,
13,
13,
13,
13,
13,
14,
2,
4,
18,
13,
13,
13,
17,
17,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
17,
13,
10,
2,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
168,
2
],
[
168,
13
],
[
168,
14
],
[
147,
16
],
[
20,
19
],
[
160,
22
],
[
165,
24
],
[
165,
35
],
[
38,
37
],
[
44,
43
],
[
157,
54
],
[
37,
55
],
[
166,
59
],
[
43,
60
],
[
157,
64
],
[
37,
65
],
[
169,
66
],
[
166,
69
],
[
43,
70
],
[
163,
71
],
[
150,
74
],
[
157,
79
],
[
37,
80
],
[
163,
81
],
[
166,
82
],
[
43,
83
],
[
148,
88
],
[
151,
90
],
[
97,
94
],
[
148,
95
],
[
151,
96
],
[
102,
99
],
[
148,
100
],
[
151,
101
],
[
106,
105
],
[
153,
112
],
[
116,
115
],
[
148,
118
],
[
124,
121
],
[
154,
122
],
[
115,
123
],
[
129,
126
],
[
154,
127
],
[
169,
132
],
[
163,
135
],
[
154,
139
],
[
142,
141
],
[
154,
141
],
[
141,
145
],
[
147,
148
],
[
150,
151
],
[
153,
154
],
[
165,
157
],
[
168,
160
],
[
168,
163
],
[
165,
166
],
[
168,
169
]
] | [
"H,W,N=list(map(int,input().split()))\n\ndic={}\nfor _ in range(N):\n a,b=list(map(int,input().split()))\n for i in range(-1,2):\n for j in range(-1,2):\n if (a+i)<=1 or b+j<=1 or a+i>=H or b+j >=W:\n continue\n s=(a+i)*W+b+j\n if dic.get(s,0)==0:\n dic[s]=1\n else:\n dic[s]+=1\narr=[0 for i in range(10)]\nfor v in dic.values():\n arr[v]+=1\narr[0]=(H-2)*(W-2)-sum(arr)\nfor x in arr:\n print(x)",
"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",
"dic={}",
"dic",
"{}",
"for _ in range(N):\n a,b=list(map(int,input().split()))\n for i in range(-1,2):\n for j in range(-1,2):\n if (a+i)<=1 or b+j<=1 or a+i>=H or b+j >=W:\n continue\n s=(a+i)*W+b+j\n if dic.get(s,0)==0:\n dic[s]=1\n else:\n dic[s]+=1",
"_",
"range(N)",
"range",
"N",
"a,b=list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in range(-1,2):\n for j in range(-1,2):\n if (a+i)<=1 or b+j<=1 or a+i>=H or b+j >=W:\n continue\n s=(a+i)*W+b+j\n if dic.get(s,0)==0:\n dic[s]=1\n else:\n dic[s]+=1",
"i",
"range(-1,2)",
"range",
"-1",
"2",
"for j in range(-1,2):\n if (a+i)<=1 or b+j<=1 or a+i>=H or b+j >=W:\n continue\n s=(a+i)*W+b+j\n if dic.get(s,0)==0:\n dic[s]=1\n else:\n dic[s]+=1",
"j",
"range(-1,2)",
"range",
"-1",
"2",
"if (a+i)<=1 or b+j<=1 or a+i>=H or b+j >=W:\n continue\n ",
"(a+i)<=1 or b+j<=1 or a+i>=H or b+j >=W",
"(a+i)<=1 or b+j<=1 or a+i>=H",
"(a+i)<=1 or b+j<=1",
"(a+i)<=1",
"a+i",
"a",
"i",
"1",
"b+j<=1",
"b+j",
"b",
"j",
"1",
"a+i>=H",
"a+i",
"a",
"i",
"H",
"b+j >=W",
"b+j",
"b",
"j",
"W",
"continue",
"s=(a+i)*W+b+j",
"s",
"(a+i)*W+b+j",
"(a+i)*W+b",
"(a+i)*W",
"a+i",
"a",
"i",
"W",
"b",
"j",
"if dic.get(s,0)==0:\n dic[s]=1\n else:\n dic[s]+=1",
"dic.get(s,0)==0",
"dic.get(s,0)",
"dic.get",
"dic",
"get",
"s",
"0",
"0",
"dic[s]=1",
"dic[s]",
"dic",
"s",
"1",
"dic[s]+=1",
"dic[s]",
"dic",
"s",
"1",
"0 for i in range(10)",
"for i in range(10)",
"i",
"range(10)",
"range",
"10",
"for i in range(10)",
"0",
"arr=[0 for i in range(10)]",
"arr",
"[0 for i in range(10)]",
"for v in dic.values():\n arr[v]+=1",
"v",
"dic.values()",
"dic.values",
"dic",
"values",
"arr[v]+=1",
"arr[v]",
"arr",
"v",
"1",
"arr[0]=(H-2)*(W-2)-sum(arr)",
"arr[0]",
"arr",
"0",
"(H-2)*(W-2)-sum(arr)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(arr)",
"sum",
"arr",
"for x in arr:\n print(x)",
"x",
"arr",
"print(x)",
"print",
"x",
"dic={}",
"{}",
"dic",
"s=(a+i)*W+b+j",
"(a+i)*W+b+j",
"s",
"arr=[0 for i in range(10)]",
"[0 for i in range(10)]",
"arr",
"a,b=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"N=list(map(int,input().split()))",
"list(map(int,input().split()))",
"N",
"W,N=list(map(int,input().split()))",
"list(map(int,input().split()))",
"W",
"b=list(map(int,input().split()))",
"list(map(int,input().split()))",
"b",
"H,W,N=list(map(int,input().split()))",
"list(map(int,input().split()))",
"H"
] | H,W,N=list(map(int,input().split()))
dic={}
for _ in range(N):
a,b=list(map(int,input().split()))
for i in range(-1,2):
for j in range(-1,2):
if (a+i)<=1 or b+j<=1 or a+i>=H or b+j >=W:
continue
s=(a+i)*W+b+j
if dic.get(s,0)==0:
dic[s]=1
else:
dic[s]+=1
arr=[0 for i in range(10)]
for v in dic.values():
arr[v]+=1
arr[0]=(H-2)*(W-2)-sum(arr)
for x in arr:
print(x) |
[
7,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
15,
15,
15,
15,
15,
13,
14,
4,
18,
13,
13,
17,
0,
18,
13,
13,
4,
13,
17,
17,
4,
18,
13,
13,
17,
0,
13,
4,
13,
17,
0,
13,
2,
17,
17,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
0,
13,
13,
0,
13,
4,
13,
0,
13,
4,
13,
13,
28,
13,
13,
4,
18,
13,
13,
39,
17,
17,
17,
0,
13,
17,
28,
13,
13,
13,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
39,
13,
13,
13,
4,
18,
13,
13,
14,
2,
40,
40,
17,
13,
13,
40,
40,
17,
13,
13,
0,
18,
13,
13,
17,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
4,
13,
4,
18,
17,
13,
4,
13,
13,
18,
13,
39,
17,
10,
13,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
34,
31
],
[
204,
44
],
[
198,
49
],
[
219,
54
],
[
31,
64
],
[
219,
69
],
[
219,
70
],
[
74,
73
],
[
211,
76
],
[
31,
87
],
[
195,
93
],
[
207,
96
],
[
213,
100
],
[
117,
116
],
[
132,
123
],
[
214,
124
],
[
201,
134
],
[
214,
146
],
[
217,
154
],
[
220,
159
],
[
164,
161
],
[
202,
162
],
[
217,
170
],
[
220,
173
],
[
202,
178
],
[
202,
191
],
[
195,
196
],
[
198,
199
],
[
201,
202
],
[
204,
205
],
[
207,
208
],
[
219,
211
],
[
213,
214
],
[
219,
217
],
[
219,
220
]
] | [
"import bisect\nimport heapq\nimport itertools\nimport math\nimport os\nimport re\nimport string\nimport sys\nfrom collections import Counter, deque, defaultdict\nfrom decimal import Decimal\nfrom fractions import gcd\nfrom functools import lru_cache, reduce\nfrom operator import itemgetter\n\nimport numpy as np\n\nif os.getenv(\"LOCAL\"):\n sys.stdin = open(\"_in.txt\", \"r\")\n\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nIINF = 10 ** 18\n\nH, W, N = list(map(int, sys.stdin.readline().split()))\nAB = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]\n\nhist = set()\n\ncount = defaultdict(int)\nfor dx, dy in itertools.product([0, 1, 2], repeat=2):\n for a, b in AB:\n count[(a + dx, b + dy)] += 1\nans = [0] * 10\nfor [a, b], cnt in count.items():\n if 3 <= a <= H and 3 <= b <= W:\n ans[cnt] += 1\nprint((H - 2) * (W - 2) - sum(ans[1:]))\nprint('\\n'.join(map(str, ans[1:])))",
"import bisect",
"bisect",
"import heapq",
"heapq",
"import itertools",
"itertools",
"import math",
"math",
"import os",
"os",
"import re",
"re",
"import string",
"string",
"import sys",
"sys",
"from collections import Counter, deque, defaultdict",
"from decimal import Decimal",
"from fractions import gcd",
"from functools import lru_cache, reduce",
"from operator import itemgetter",
"import numpy as np",
"numpy",
"if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"_in.txt\", \"r\")",
"os.getenv(\"LOCAL\")",
"os.getenv",
"os",
"getenv",
"\"LOCAL\"",
"sys.stdin = open(\"_in.txt\", \"r\")",
"sys.stdin",
"sys",
"stdin",
"open(\"_in.txt\", \"r\")",
"open",
"\"_in.txt\"",
"\"r\"",
"sys.setrecursionlimit(2147483647)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"2147483647",
"INF = float(\"inf\")",
"INF",
"float(\"inf\")",
"float",
"\"inf\"",
"IINF = 10 ** 18",
"IINF",
"10 ** 18",
"10",
"18",
"H, W, N = list(map(int, sys.stdin.readline().split()))",
"H",
"list(map(int, sys.stdin.readline().split()))",
"list",
"map(int, sys.stdin.readline().split())",
"map",
"int",
"sys.stdin.readline().split()",
"sys.stdin.readline().split",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"split",
"W",
"N",
"list(map(int, sys.stdin.readline().split())) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"list(map(int, sys.stdin.readline().split()))",
"list",
"map(int, sys.stdin.readline().split())",
"map",
"int",
"sys.stdin.readline().split()",
"sys.stdin.readline().split",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"split",
"AB = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]",
"AB",
"[list(map(int, sys.stdin.readline().split())) for _ in range(N)]",
"hist = set()",
"hist",
"set()",
"set",
"count = defaultdict(int)",
"count",
"defaultdict(int)",
"defaultdict",
"int",
"for dx, dy in itertools.product([0, 1, 2], repeat=2):\n for a, b in AB:\n count[(a + dx, b + dy)] += 1",
"dx",
"dy",
"itertools.product([0, 1, 2], repeat=2)",
"itertools.product",
"itertools",
"product",
"[0, 1, 2]",
"0",
"1",
"2",
"repeat=2",
"repeat",
"2",
"for a, b in AB:\n count[(a + dx, b + dy)] += 1",
"a",
"b",
"AB",
"count[(a + dx, b + dy)] += 1",
"count[(a + dx, b + dy)]",
"count",
"(a + dx, b + dy)",
"a + dx",
"a",
"dx",
"b + dy",
"b",
"dy",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for [a, b], cnt in count.items():\n if 3 <= a <= H and 3 <= b <= W:\n ans[cnt] += 1",
"[a, b]",
"a",
"b",
"cnt",
"count.items()",
"count.items",
"count",
"items",
"if 3 <= a <= H and 3 <= b <= W:\n ans[cnt] += 1",
"3 <= a <= H and 3 <= b <= W",
"3 <= a <= H",
"3 <= a",
"3",
"a",
"H",
"3 <= b <= W",
"3 <= b",
"3",
"b",
"W",
"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",
"print('\\n'.join(map(str, ans[1:])))",
"print",
"'\\n'.join(map(str, ans[1:]))",
"'\\n'.join",
"'\\n'",
"join",
"map(str, ans[1:])",
"map",
"str",
"ans[1:]",
"ans",
"1:",
"1",
"AB = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]",
"[list(map(int, sys.stdin.readline().split())) for _ in range(N)]",
"AB",
"IINF = 10 ** 18",
"10 ** 18",
"IINF",
"ans = [0] * 10",
"[0] * 10",
"ans",
"INF = float(\"inf\")",
"float(\"inf\")",
"INF",
"hist = set()",
"set()",
"hist",
"N = list(map(int, sys.stdin.readline().split()))",
"list(map(int, sys.stdin.readline().split()))",
"N",
"count = defaultdict(int)",
"defaultdict(int)",
"count",
"H, W, N = list(map(int, sys.stdin.readline().split()))",
"list(map(int, sys.stdin.readline().split()))",
"H",
"W, N = list(map(int, sys.stdin.readline().split()))",
"list(map(int, sys.stdin.readline().split()))",
"W"
] | import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter
import numpy as np
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
H, W, N = list(map(int, sys.stdin.readline().split()))
AB = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
hist = set()
count = defaultdict(int)
for dx, dy in itertools.product([0, 1, 2], repeat=2):
for a, b in AB:
count[(a + dx, b + dy)] += 1
ans = [0] * 10
for [a, b], cnt in count.items():
if 3 <= a <= H and 3 <= b <= W:
ans[cnt] += 1
print((H - 2) * (W - 2) - sum(ans[1:]))
print('\n'.join(map(str, ans[1:])))
|
[
7,
15,
0,
13,
39,
17,
17,
17,
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,
28,
13,
13,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
14,
2,
2,
2,
17,
13,
13,
2,
2,
17,
13,
13,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
0,
13,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
17,
0,
18,
13,
13,
4,
18,
13,
13,
13,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
145,
3
],
[
154,
9
],
[
157,
14
],
[
157,
23
],
[
157,
24
],
[
27,
26
],
[
158,
29
],
[
136,
31
],
[
136,
40
],
[
43,
42
],
[
146,
42
],
[
46,
45
],
[
146,
45
],
[
127,
48
],
[
137,
50
],
[
42,
51
],
[
151,
53
],
[
134,
55
],
[
45,
56
],
[
128,
62
],
[
143,
63
],
[
152,
67
],
[
149,
68
],
[
75,
70
],
[
155,
71
],
[
130,
77
],
[
139,
83
],
[
155,
88
],
[
92,
91
],
[
100,
97
],
[
131,
98
],
[
91,
99
],
[
140,
102
],
[
91,
104
],
[
109,
106
],
[
131,
107
],
[
143,
112
],
[
149,
115
],
[
131,
119
],
[
122,
121
],
[
131,
121
],
[
121,
125
],
[
127,
128
],
[
130,
131
],
[
136,
134
],
[
136,
137
],
[
139,
140
],
[
157,
143
],
[
145,
146
],
[
157,
149
],
[
151,
152
],
[
154,
155
],
[
157,
158
]
] | [
"from collections import defaultdict as ddict\nd = (-1,0,1)\ncmap = ddict(int)\nh,w,n = map(int, input().split())\nfor _ in range(n):\n a,b = map(int, input().split()) \n for x in d:\n for y in d:\n ca = a+x\n cb = b+y\n if 1<ca<h and 1<cb<w:\n cmap[(ca,cb)] += 1\nl = [0]*10\nj = list(cmap.values())\nfor i in range(1,10):\n l[i] = j.count(i)\nl[0] = (h-2)*(w-2) - sum(l)\nfor x in l:\n print(x)",
"from collections import defaultdict as ddict",
"d = (-1,0,1)",
"d",
"(-1,0,1)",
"-1",
"0",
"1",
"cmap = ddict(int)",
"cmap",
"ddict(int)",
"ddict",
"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 for x in d:\n for y in d:\n ca = a+x\n cb = b+y\n if 1<ca<h and 1<cb<w:\n cmap[(ca,cb)] += 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 x in d:\n for y in d:\n ca = a+x\n cb = b+y\n if 1<ca<h and 1<cb<w:\n cmap[(ca,cb)] += 1",
"x",
"d",
"for y in d:\n ca = a+x\n cb = b+y\n if 1<ca<h and 1<cb<w:\n cmap[(ca,cb)] += 1",
"y",
"d",
"ca = a+x",
"ca",
"a+x",
"a",
"x",
"cb = b+y",
"cb",
"b+y",
"b",
"y",
"if 1<ca<h and 1<cb<w:\n cmap[(ca,cb)] += 1",
"1<ca<h and 1<cb<w",
"1<ca<h",
"1<ca",
"1",
"ca",
"h",
"1<cb<w",
"1<cb",
"1",
"cb",
"w",
"cmap[(ca,cb)] += 1",
"cmap[(ca,cb)]",
"cmap",
"(ca,cb)",
"ca",
"cb",
"1",
"l = [0]*10",
"l",
"[0]*10",
"[0]",
"0",
"10",
"j = list(cmap.values())",
"j",
"list(cmap.values())",
"list",
"cmap.values()",
"cmap.values",
"cmap",
"values",
"for i in range(1,10):\n l[i] = j.count(i)",
"i",
"range(1,10)",
"range",
"1",
"10",
"l[i] = j.count(i)",
"l[i]",
"l",
"i",
"j.count(i)",
"j.count",
"j",
"count",
"i",
"l[0] = (h-2)*(w-2) - sum(l)",
"l[0]",
"l",
"0",
"(h-2)*(w-2) - sum(l)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(l)",
"sum",
"l",
"for x in l:\n print(x)",
"x",
"l",
"print(x)",
"print",
"x",
"ca = a+x",
"a+x",
"ca",
"l = [0]*10",
"[0]*10",
"l",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"a,b = map(int, input().split())",
"map(int, input().split())",
"a",
"j = list(cmap.values())",
"list(cmap.values())",
"j",
"h,w,n = map(int, input().split())",
"map(int, input().split())",
"h",
"d = (-1,0,1)",
"(-1,0,1)",
"d",
"w,n = map(int, input().split())",
"map(int, input().split())",
"w",
"cb = b+y",
"b+y",
"cb",
"cmap = ddict(int)",
"ddict(int)",
"cmap",
"n = map(int, input().split())",
"map(int, input().split())",
"n"
] | from collections import defaultdict as ddict
d = (-1,0,1)
cmap = ddict(int)
h,w,n = map(int, input().split())
for _ in range(n):
a,b = map(int, input().split())
for x in d:
for y in d:
ca = a+x
cb = b+y
if 1<ca<h and 1<cb<w:
cmap[(ca,cb)] += 1
l = [0]*10
j = list(cmap.values())
for i in range(1,10):
l[i] = j.count(i)
l[0] = (h-2)*(w-2) - sum(l)
for x in l:
print(x) |
[
7,
15,
15,
15,
13,
38,
5,
15,
12,
13,
0,
13,
4,
13,
13,
28,
13,
13,
4,
13,
13,
13,
28,
13,
13,
4,
13,
39,
17,
17,
17,
0,
13,
17,
0,
13,
2,
2,
13,
17,
13,
0,
13,
2,
2,
13,
17,
13,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
13,
17,
0,
13,
4,
13,
4,
18,
13,
13,
41,
28,
13,
4,
13,
17,
17,
4,
18,
13,
13,
0,
13,
13,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
23,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
12,
13,
28,
13,
18,
13,
13,
28,
13,
4,
18,
13,
13,
27,
13,
0,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
0,
13,
2,
39,
4,
13,
13,
0,
13,
2,
39,
4,
13,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
4,
13,
4,
13,
13,
0,
18,
13,
13,
4,
13,
4,
13,
13,
4,
13,
13,
13,
13,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13
] | [
[
12,
11
],
[
117,
20
],
[
119,
21
],
[
33,
32
],
[
36,
35
],
[
43,
42
],
[
35,
53
],
[
111,
55
],
[
42,
60
],
[
113,
62
],
[
68,
65
],
[
11,
66
],
[
35,
67
],
[
71,
70
],
[
11,
75
],
[
80,
79
],
[
70,
86
],
[
79,
87
],
[
90,
89
],
[
111,
96
],
[
113,
99
],
[
89,
103
],
[
106,
105
],
[
89,
105
],
[
105,
109
],
[
111,
111
],
[
113,
113
],
[
115,
115
],
[
117,
117
],
[
119,
119
],
[
126,
125
],
[
131,
130
],
[
125,
133
],
[
130,
136
],
[
139,
138
],
[
123,
140
],
[
143,
142
],
[
138,
147
],
[
150,
149
],
[
138,
154
],
[
157,
156
],
[
138,
161
],
[
164,
163
],
[
156,
168
],
[
171,
170
],
[
156,
175
],
[
178,
177
],
[
156,
180
],
[
185,
182
],
[
163,
183
],
[
177,
184
],
[
138,
189
],
[
194,
191
],
[
170,
192
],
[
177,
193
],
[
138,
198
],
[
214,
200
],
[
142,
201
],
[
149,
202
],
[
156,
203
],
[
163,
204
],
[
170,
205
],
[
217,
211
]
] | [
"#!/usr/bin/env python3\nfrom collections import Counter, defaultdict\nfrom itertools import product\nimport sys\ntry:\n from typing import List\nexcept ImportError:\n pass\n\n\ndef solve(H: int, W: int, N: int, a: \"List[int]\", b: \"List[int]\"):\n d = defaultdict(int)\n for ai, bi in zip(a, b):\n for da, db in product((-1, 0, 1), repeat=2):\n aj = ai - 1 + da\n bj = bi - 1 + db\n if 1 <= aj <= H - 2 and 1 <= bj <= W - 2:\n d[aj, bj] += 1\n c = Counter(d.values())\n e = [c[i] for i in range(1, 10)]\n print((H - 2) * (W - 2) - sum(e))\n for ei in e:\n print(ei)\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n H = int(next(tokens)) # type: int\n W = int(next(tokens)) # type: int\n N = int(next(tokens)) # type: int\n a = [int()] * (N) # type: \"List[int]\"\n b = [int()] * (N) # type: \"List[int]\"\n for i in range(N):\n a[i] = int(next(tokens))\n b[i] = int(next(tokens))\n solve(H, W, N, a, b)\n\n\nif __name__ == '__main__':\n main()",
"from collections import Counter, defaultdict",
"from itertools import product",
"import sys",
"sys",
"try:\n from typing import List\nexcept ImportError:\n pass",
"except ImportError:\n pass",
"from typing import List",
"def solve(H: int, W: int, N: int, a: \"List[int]\", b: \"List[int]\"):\n d = defaultdict(int)\n for ai, bi in zip(a, b):\n for da, db in product((-1, 0, 1), repeat=2):\n aj = ai - 1 + da\n bj = bi - 1 + db\n if 1 <= aj <= H - 2 and 1 <= bj <= W - 2:\n d[aj, bj] += 1\n c = Counter(d.values())\n e = [c[i] for i in range(1, 10)]\n print((H - 2) * (W - 2) - sum(e))\n for ei in e:\n print(ei)",
"solve",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"for ai, bi in zip(a, b):\n for da, db in product((-1, 0, 1), repeat=2):\n aj = ai - 1 + da\n bj = bi - 1 + db\n if 1 <= aj <= H - 2 and 1 <= bj <= W - 2:\n d[aj, bj] += 1\n ",
"ai",
"bi",
"zip(a, b)",
"zip",
"a",
"b",
"for da, db in product((-1, 0, 1), repeat=2):\n aj = ai - 1 + da\n bj = bi - 1 + db\n if 1 <= aj <= H - 2 and 1 <= bj <= W - 2:\n d[aj, bj] += 1\n ",
"da",
"db",
"product((-1, 0, 1), repeat=2)",
"product",
"(-1, 0, 1)",
"-1",
"0",
"1",
"repeat=2",
"repeat",
"2",
"aj = ai - 1 + da",
"aj",
"ai - 1 + da",
"ai - 1",
"ai",
"1",
"da",
"bj = bi - 1 + db",
"bj",
"bi - 1 + db",
"bi - 1",
"bi",
"1",
"db",
"if 1 <= aj <= H - 2 and 1 <= bj <= W - 2:\n d[aj, bj] += 1\n ",
"1 <= aj <= H - 2 and 1 <= bj <= W - 2",
"1 <= aj <= H - 2",
"1 <= aj",
"1",
"aj",
"H - 2",
"H",
"2",
"1 <= bj <= W - 2",
"1 <= bj",
"1",
"bj",
"W - 2",
"W",
"2",
"d[aj, bj] += 1",
"d[aj, bj]",
"d",
"aj",
"1",
"c = Counter(d.values())",
"c",
"Counter(d.values())",
"Counter",
"d.values()",
"d.values",
"d",
"values",
"c[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)",
"c[i]",
"c",
"i",
"e = [c[i] for i in range(1, 10)]",
"e",
"[c[i] for i in range(1, 10)]",
"print((H - 2) * (W - 2) - sum(e))",
"print",
"(H - 2) * (W - 2) - sum(e)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(e)",
"sum",
"e",
"for ei in e:\n print(ei)",
"ei",
"e",
"print(ei)",
"print",
"ei",
"H: int",
"H",
"W: int",
"W",
"N: int",
"N",
"a: \"List[int]\"",
"a",
"b: \"List[int]\"",
"b",
"def main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n H = int(next(tokens)) # type: int\n W = int(next(tokens)) # type: int\n N = int(next(tokens)) # type: int\n a = [int()] * (N) # type: \"List[int]\"\n b = [int()] * (N) # type: \"List[int]\"\n for i in range(N):\n a[i] = int(next(tokens))\n b[i] = int(next(tokens))\n solve(H, W, N, a, b)",
"main",
"def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n ",
"iterate_tokens",
"for line in sys.stdin:\n for word in line.split():\n yield word\n ",
"line",
"sys.stdin",
"sys",
"stdin",
"for word in line.split():\n yield word\n ",
"word",
"line.split()",
"line.split",
"line",
"split",
"yield word",
"word",
"tokens = iterate_tokens()",
"tokens",
"iterate_tokens()",
"iterate_tokens",
"H = int(next(tokens))",
"H",
"int(next(tokens))",
"int",
"next(tokens)",
"next",
"tokens",
"W = int(next(tokens))",
"W",
"int(next(tokens))",
"int",
"next(tokens)",
"next",
"tokens",
"N = int(next(tokens))",
"N",
"int(next(tokens))",
"int",
"next(tokens)",
"next",
"tokens",
"a = [int()] * (N)",
"a",
"[int()] * (N)",
"[int()]",
"int()",
"int",
"N",
"b = [int()] * (N)",
"b",
"[int()] * (N)",
"[int()]",
"int()",
"int",
"N",
"for i in range(N):\n a[i] = int(next(tokens))\n b[i] = int(next(tokens))\n ",
"i",
"range(N)",
"range",
"N",
"a[i] = int(next(tokens))",
"a[i]",
"a",
"i",
"int(next(tokens))",
"int",
"next(tokens)",
"next",
"tokens",
"b[i] = int(next(tokens))",
"b[i]",
"b",
"i",
"int(next(tokens))",
"int",
"next(tokens)",
"next",
"tokens",
"solve(H, W, N, a, b)",
"solve",
"H",
"W",
"N",
"a",
"b",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def solve(H: int, W: int, N: int, a: \"List[int]\", b: \"List[int]\"):\n d = defaultdict(int)\n for ai, bi in zip(a, b):\n for da, db in product((-1, 0, 1), repeat=2):\n aj = ai - 1 + da\n bj = bi - 1 + db\n if 1 <= aj <= H - 2 and 1 <= bj <= W - 2:\n d[aj, bj] += 1\n c = Counter(d.values())\n e = [c[i] for i in range(1, 10)]\n print((H - 2) * (W - 2) - sum(e))\n for ei in e:\n print(ei)",
"def solve(H: int, W: int, N: int, a: \"List[int]\", b: \"List[int]\"):\n d = defaultdict(int)\n for ai, bi in zip(a, b):\n for da, db in product((-1, 0, 1), repeat=2):\n aj = ai - 1 + da\n bj = bi - 1 + db\n if 1 <= aj <= H - 2 and 1 <= bj <= W - 2:\n d[aj, bj] += 1\n c = Counter(d.values())\n e = [c[i] for i in range(1, 10)]\n print((H - 2) * (W - 2) - sum(e))\n for ei in e:\n print(ei)",
"solve",
"def main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n H = int(next(tokens)) # type: int\n W = int(next(tokens)) # type: int\n N = int(next(tokens)) # type: int\n a = [int()] * (N) # type: \"List[int]\"\n b = [int()] * (N) # type: \"List[int]\"\n for i in range(N):\n a[i] = int(next(tokens))\n b[i] = int(next(tokens))\n solve(H, W, N, a, b)",
"def main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n H = int(next(tokens)) # type: int\n W = int(next(tokens)) # type: int\n N = int(next(tokens)) # type: int\n a = [int()] * (N) # type: \"List[int]\"\n b = [int()] * (N) # type: \"List[int]\"\n for i in range(N):\n a[i] = int(next(tokens))\n b[i] = int(next(tokens))\n solve(H, W, N, a, b)",
"main"
] | #!/usr/bin/env python3
from collections import Counter, defaultdict
from itertools import product
import sys
try:
from typing import List
except ImportError:
pass
def solve(H: int, W: int, N: int, a: "List[int]", b: "List[int]"):
d = defaultdict(int)
for ai, bi in zip(a, b):
for da, db in product((-1, 0, 1), repeat=2):
aj = ai - 1 + da
bj = bi - 1 + db
if 1 <= aj <= H - 2 and 1 <= bj <= W - 2:
d[aj, bj] += 1
c = Counter(d.values())
e = [c[i] for i in range(1, 10)]
print((H - 2) * (W - 2) - sum(e))
for ei in e:
print(ei)
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_tokens()
H = int(next(tokens)) # type: int
W = int(next(tokens)) # type: int
N = int(next(tokens)) # type: int
a = [int()] * (N) # type: "List[int]"
b = [int()] * (N) # type: "List[int]"
for i in range(N):
a[i] = int(next(tokens))
b[i] = int(next(tokens))
solve(H, W, N, a, b)
if __name__ == '__main__':
main()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
0,
13,
39,
17,
17,
17,
0,
13,
39,
17,
17,
17,
0,
13,
2,
39,
17,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
13,
28,
13,
13,
14,
2,
2,
2,
40,
17,
2,
13,
13,
40,
2,
2,
13,
13,
17,
13,
40,
17,
2,
13,
13,
40,
2,
2,
13,
13,
17,
13,
14,
40,
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,
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,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13
] | [
[
174,
2
],
[
174,
11
],
[
174,
12
],
[
159,
14
],
[
171,
17
],
[
165,
23
],
[
168,
29
],
[
36,
35
],
[
154,
38
],
[
177,
40
],
[
177,
49
],
[
52,
51
],
[
172,
51
],
[
55,
54
],
[
166,
54
],
[
157,
63
],
[
54,
64
],
[
157,
68
],
[
54,
69
],
[
175,
71
],
[
178,
75
],
[
51,
76
],
[
178,
80
],
[
51,
81
],
[
163,
83
],
[
157,
88
],
[
54,
89
],
[
178,
91
],
[
51,
92
],
[
160,
93
],
[
104,
95
],
[
160,
96
],
[
157,
99
],
[
54,
100
],
[
178,
102
],
[
51,
103
],
[
115,
106
],
[
160,
107
],
[
157,
110
],
[
54,
111
],
[
178,
113
],
[
51,
114
],
[
120,
117
],
[
169,
118
],
[
175,
123
],
[
163,
126
],
[
160,
130
],
[
133,
132
],
[
160,
135
],
[
141,
138
],
[
169,
139
],
[
132,
140
],
[
144,
143
],
[
169,
150
],
[
143,
151
],
[
174,
154
],
[
177,
157
],
[
159,
160
],
[
174,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
]
] | [
"h,w,n=map(int,input().split())\ndic={}\ndx=[-2,-1,0]\ndy=[-2,-1,0]\nans=[0]*10\nfor _ in range(n):\n a,b=map(int,input().split())\n for x in dx:\n for y in dy:\n if 1<=a+y and a+y+2<=h and 1<=b+x and b+x+2<=w:\n if (a+y,b+x) not in dic:\n dic[(a+y,b+x)]=1\n else:\n dic[(a+y,b+x)]+=1\nans[0]=(h-2)*(w-2)-len(dic)\nfor v in dic.values():\n ans[v]+=1\nfor i in range(10):\n print(ans[i])",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"dic={}",
"dic",
"{}",
"dx=[-2,-1,0]",
"dx",
"[-2,-1,0]",
"-2",
"-1",
"0",
"dy=[-2,-1,0]",
"dy",
"[-2,-1,0]",
"-2",
"-1",
"0",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for _ in range(n):\n a,b=map(int,input().split())\n for x in dx:\n for y in dy:\n if 1<=a+y and a+y+2<=h and 1<=b+x and b+x+2<=w:\n if (a+y,b+x) not in dic:\n dic[(a+y,b+x)]=1\n else:\n dic[(a+y,b+x)]+=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 x in dx:\n for y in dy:\n if 1<=a+y and a+y+2<=h and 1<=b+x and b+x+2<=w:\n if (a+y,b+x) not in dic:\n dic[(a+y,b+x)]=1\n else:\n dic[(a+y,b+x)]+=1",
"x",
"dx",
"for y in dy:\n if 1<=a+y and a+y+2<=h and 1<=b+x and b+x+2<=w:\n if (a+y,b+x) not in dic:\n dic[(a+y,b+x)]=1\n else:\n dic[(a+y,b+x)]+=1",
"y",
"dy",
"if 1<=a+y and a+y+2<=h and 1<=b+x and b+x+2<=w:\n if (a+y,b+x) not in dic:\n dic[(a+y,b+x)]=1\n else:\n dic[(a+y,b+x)]+=1",
"1<=a+y and a+y+2<=h and 1<=b+x and b+x+2<=w",
"1<=a+y and a+y+2<=h and 1<=b+x",
"1<=a+y and a+y+2<=h",
"1<=a+y",
"1",
"a+y",
"a",
"y",
"a+y+2<=h",
"a+y+2",
"a+y",
"a",
"y",
"2",
"h",
"1<=b+x",
"1",
"b+x",
"b",
"x",
"b+x+2<=w",
"b+x+2",
"b+x",
"b",
"x",
"2",
"w",
"if (a+y,b+x) not in dic:\n dic[(a+y,b+x)]=1\n else:\n dic[(a+y,b+x)]+=1",
"(a+y,b+x) not in dic",
"(a+y,b+x)",
"a+y",
"a",
"y",
"b+x",
"b",
"x",
"dic",
"dic[(a+y,b+x)]=1",
"dic[(a+y,b+x)]",
"dic",
"(a+y,b+x)",
"a+y",
"a",
"y",
"b+x",
"b",
"x",
"1",
"dic[(a+y,b+x)]+=1",
"dic[(a+y,b+x)]",
"dic",
"(a+y,b+x)",
"a+y",
"a",
"y",
"b+x",
"b",
"x",
"1",
"ans[0]=(h-2)*(w-2)-len(dic)",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)-len(dic)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"len(dic)",
"len",
"dic",
"for v in dic.values():\n ans[v]+=1",
"v",
"dic.values()",
"dic.values",
"dic",
"values",
"ans[v]+=1",
"ans[v]",
"ans",
"v",
"1",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"dic={}",
"{}",
"dic",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"dy=[-2,-1,0]",
"[-2,-1,0]",
"dy",
"ans=[0]*10",
"[0]*10",
"ans",
"dx=[-2,-1,0]",
"[-2,-1,0]",
"dx",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"b=map(int,input().split())",
"map(int,input().split())",
"b"
] | h,w,n=map(int,input().split())
dic={}
dx=[-2,-1,0]
dy=[-2,-1,0]
ans=[0]*10
for _ in range(n):
a,b=map(int,input().split())
for x in dx:
for y in dy:
if 1<=a+y and a+y+2<=h and 1<=b+x and b+x+2<=w:
if (a+y,b+x) not in dic:
dic[(a+y,b+x)]=1
else:
dic[(a+y,b+x)]+=1
ans[0]=(h-2)*(w-2)-len(dic)
for v in dic.values():
ans[v]+=1
for i in range(10):
print(ans[i])
|
[
7,
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,
17,
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,
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,
14,
2,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
13,
2,
39,
17,
17,
18,
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,
18,
13,
39,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
163,
4
],
[
175,
13
],
[
164,
20
],
[
175,
22
],
[
175,
23
],
[
160,
25
],
[
29,
28
],
[
152,
31
],
[
172,
33
],
[
164,
40
],
[
172,
42
],
[
45,
44
],
[
51,
50
],
[
158,
61
],
[
44,
62
],
[
176,
64
],
[
173,
70
],
[
50,
71
],
[
155,
73
],
[
166,
76
],
[
158,
81
],
[
44,
82
],
[
173,
86
],
[
50,
87
],
[
167,
90
],
[
161,
91
],
[
96,
93
],
[
161,
94
],
[
167,
95
],
[
101,
98
],
[
161,
99
],
[
167,
100
],
[
169,
103
],
[
170,
109
],
[
113,
112
],
[
161,
115
],
[
121,
118
],
[
170,
119
],
[
112,
120
],
[
126,
123
],
[
170,
124
],
[
176,
129
],
[
155,
132
],
[
170,
137
],
[
142,
141
],
[
170,
148
],
[
141,
149
],
[
175,
152
],
[
175,
155
],
[
172,
158
],
[
160,
161
],
[
163,
164
],
[
166,
167
],
[
169,
170
],
[
172,
173
],
[
175,
176
]
] | [
"import sys\ninput = sys.stdin.buffer.readline\n\n\nh, w, n = map(int,input().split())\nd = {}\nfor i in range(n):\n ch, cw = map(int,input().split())\n for dh in [-1,0,1]:\n for dw in [-1,0,1]:\n if 2 <= ch + dh <= h-1 and 2 <= cw + dw <= w-1:\n x = (ch + dh)*10**10 + cw + dw\n # print(ch, cw, dh, dw, x)\n if x in d:\n d[x] += 1\n else:\n d[x] = 1\nans = [0] * 10\nans[0]\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])",
"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",
"d = {}",
"d",
"{}",
"for i in range(n):\n ch, cw = map(int,input().split())\n for dh in [-1,0,1]:\n for dw in [-1,0,1]:\n if 2 <= ch + dh <= h-1 and 2 <= cw + dw <= w-1:\n x = (ch + dh)*10**10 + cw + dw\n # print(ch, cw, dh, dw, x)\n if x in d:\n d[x] += 1\n else:\n d[x] = 1",
"i",
"range(n)",
"range",
"n",
"ch, cw = map(int,input().split())",
"ch",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"cw",
"for dh in [-1,0,1]:\n for dw in [-1,0,1]:\n if 2 <= ch + dh <= h-1 and 2 <= cw + dw <= w-1:\n x = (ch + dh)*10**10 + cw + dw\n # print(ch, cw, dh, dw, x)\n if x in d:\n d[x] += 1\n else:\n d[x] = 1",
"dh",
"[-1,0,1]",
"-1",
"0",
"1",
"for dw in [-1,0,1]:\n if 2 <= ch + dh <= h-1 and 2 <= cw + dw <= w-1:\n x = (ch + dh)*10**10 + cw + dw\n # print(ch, cw, dh, dw, x)\n if x in d:\n d[x] += 1\n else:\n d[x] = 1",
"dw",
"[-1,0,1]",
"-1",
"0",
"1",
"if 2 <= ch + dh <= h-1 and 2 <= cw + dw <= w-1:\n x = (ch + dh)*10**10 + cw + dw\n # print(ch, cw, dh, dw, x)\n if x in d:\n d[x] += 1\n else:\n d[x] = 1",
"2 <= ch + dh <= h-1 and 2 <= cw + dw <= w-1",
"2 <= ch + dh <= h-1",
"2 <= ch + dh",
"2",
"ch + dh",
"ch",
"dh",
"h-1",
"h",
"1",
"2 <= cw + dw <= w-1",
"2 <= cw + dw",
"2",
"cw + dw",
"cw",
"dw",
"w-1",
"w",
"1",
"x = (ch + dh)*10**10 + cw + dw",
"x",
"(ch + dh)*10**10 + cw + dw",
"(ch + dh)*10**10 + cw",
"(ch + dh)*10**10",
"ch + dh",
"ch",
"dh",
"10**10",
"10",
"10",
"cw",
"dw",
"if x in d:\n d[x] += 1\n else:\n d[x] = 1",
"x in d",
"x",
"d",
"d[x] += 1",
"d[x]",
"d",
"x",
"1",
"d[x] = 1",
"d[x]",
"d",
"x",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"ans[0]",
"ans",
"0",
"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",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"w, n = map(int,input().split())",
"map(int,input().split())",
"w",
"ch, cw = map(int,input().split())",
"map(int,input().split())",
"ch",
"d = {}",
"{}",
"d",
"input = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"input",
"x = (ch + dh)*10**10 + cw + dw",
"(ch + dh)*10**10 + cw + dw",
"x",
"ans = [0] * 10",
"[0] * 10",
"ans",
"cw = map(int,input().split())",
"map(int,input().split())",
"cw",
"h, w, n = map(int,input().split())",
"map(int,input().split())",
"h"
] | import sys
input = sys.stdin.buffer.readline
h, w, n = map(int,input().split())
d = {}
for i in range(n):
ch, cw = map(int,input().split())
for dh in [-1,0,1]:
for dw in [-1,0,1]:
if 2 <= ch + dh <= h-1 and 2 <= cw + dw <= w-1:
x = (ch + dh)*10**10 + cw + dw
# print(ch, cw, dh, dw, x)
if x in d:
d[x] += 1
else:
d[x] = 1
ans = [0] * 10
ans[0]
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,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
39,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
13,
13,
0,
13,
2,
2,
13,
13,
17,
0,
13,
2,
2,
13,
13,
17,
14,
2,
2,
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,
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,
2,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13
] | [
[
167,
4
],
[
167,
13
],
[
167,
14
],
[
170,
16
],
[
173,
21
],
[
52,
51
],
[
168,
54
],
[
152,
56
],
[
152,
65
],
[
158,
71
],
[
150,
74
],
[
164,
78
],
[
153,
81
],
[
159,
89
],
[
162,
91
],
[
165,
96
],
[
147,
98
],
[
106,
101
],
[
171,
102
],
[
155,
108
],
[
115,
114
],
[
171,
117
],
[
156,
118
],
[
123,
120
],
[
156,
121
],
[
114,
122
],
[
128,
125
],
[
156,
126
],
[
162,
131
],
[
147,
134
],
[
156,
138
],
[
141,
140
],
[
156,
140
],
[
140,
144
],
[
167,
147
],
[
152,
150
],
[
152,
153
],
[
155,
156
],
[
158,
159
],
[
167,
162
],
[
164,
165
],
[
167,
168
],
[
170,
171
],
[
173,
174
]
] | [
"from collections import defaultdict\nfrom itertools import product\n\nH,W,N = map(int,input().split())\n\ncovered = defaultdict(int)\nvector = [[-1,-1],[-1,0],[-1,1],[1,0],[1,1],[0,0],[0,-1],[0,1],[1,-1]]\n\nfor _ in range(N):\n a,b = map(int,input().split())\n for dx,dy in vector:\n x = a+dx-1\n y = b+dy-1\n if 1 <= x < H-1 and 1 <= y < W-1:\n covered[(x,y)] += 1\n\nvalues = [0]*10\nfor i in covered.values():\n values[i] += 1\n\nvalues[0] = (H-2)*(W-2) - sum(values)\n\nfor v in values:\n print(v)",
"from collections import defaultdict",
"from itertools import product",
"H,W,N = map(int,input().split())",
"H",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"covered = defaultdict(int)",
"covered",
"defaultdict(int)",
"defaultdict",
"int",
"vector = [[-1,-1],[-1,0],[-1,1],[1,0],[1,1],[0,0],[0,-1],[0,1],[1,-1]]",
"vector",
"[[-1,-1],[-1,0],[-1,1],[1,0],[1,1],[0,0],[0,-1],[0,1],[1,-1]]",
"[-1,-1]",
"-1",
"-1",
"[-1,0]",
"-1",
"0",
"[-1,1]",
"-1",
"1",
"[1,0]",
"1",
"0",
"[1,1]",
"1",
"1",
"[0,0]",
"0",
"0",
"[0,-1]",
"0",
"-1",
"[0,1]",
"0",
"1",
"[1,-1]",
"1",
"-1",
"for _ in range(N):\n a,b = map(int,input().split())\n for dx,dy in vector:\n x = a+dx-1\n y = b+dy-1\n if 1 <= x < H-1 and 1 <= y < W-1:\n covered[(x,y)] += 1",
"_",
"range(N)",
"range",
"N",
"a,b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for dx,dy in vector:\n x = a+dx-1\n y = b+dy-1\n if 1 <= x < H-1 and 1 <= y < W-1:\n covered[(x,y)] += 1",
"dx",
"dy",
"vector",
"x = a+dx-1",
"x",
"a+dx-1",
"a+dx",
"a",
"dx",
"1",
"y = b+dy-1",
"y",
"b+dy-1",
"b+dy",
"b",
"dy",
"1",
"if 1 <= x < H-1 and 1 <= y < W-1:\n covered[(x,y)] += 1",
"1 <= x < H-1 and 1 <= y < W-1",
"1 <= x < H-1",
"1 <= x",
"1",
"x",
"H-1",
"H",
"1",
"1 <= y < W-1",
"1 <= y",
"1",
"y",
"W-1",
"W",
"1",
"covered[(x,y)] += 1",
"covered[(x,y)]",
"covered",
"(x,y)",
"x",
"y",
"1",
"values = [0]*10",
"values",
"[0]*10",
"[0]",
"0",
"10",
"for i in covered.values():\n values[i] += 1",
"i",
"covered.values()",
"covered.values",
"covered",
"values",
"values[i] += 1",
"values[i]",
"values",
"i",
"1",
"values[0] = (H-2)*(W-2) - sum(values)",
"values[0]",
"values",
"0",
"(H-2)*(W-2) - sum(values)",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(values)",
"sum",
"values",
"for v in values:\n print(v)",
"v",
"values",
"print(v)",
"print",
"v",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"values = [0]*10",
"[0]*10",
"values",
"x = a+dx-1",
"a+dx-1",
"x",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"y = b+dy-1",
"b+dy-1",
"y",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"covered = defaultdict(int)",
"defaultdict(int)",
"covered",
"vector = [[-1,-1],[-1,0],[-1,1],[1,0],[1,1],[0,0],[0,-1],[0,1],[1,-1]]",
"[[-1,-1],[-1,0],[-1,1],[1,0],[1,1],[0,0],[0,-1],[0,1],[1,-1]]",
"vector"
] | from collections import defaultdict
from itertools import product
H,W,N = map(int,input().split())
covered = defaultdict(int)
vector = [[-1,-1],[-1,0],[-1,1],[1,0],[1,1],[0,0],[0,-1],[0,1],[1,-1]]
for _ in range(N):
a,b = map(int,input().split())
for dx,dy in vector:
x = a+dx-1
y = b+dy-1
if 1 <= x < H-1 and 1 <= y < W-1:
covered[(x,y)] += 1
values = [0]*10
for i in covered.values():
values[i] += 1
values[0] = (H-2)*(W-2) - sum(values)
for v in values:
print(v)
|
[
7,
15,
13,
13,
13,
13,
13,
13,
13,
13,
12,
13,
41,
28,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
4,
4,
13,
13,
0,
13,
12,
13,
0,
13,
4,
13,
13,
13,
0,
13,
4,
18,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
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,
2,
2,
17,
13,
13,
2,
2,
17,
13,
13,
0,
18,
13,
39,
13,
13,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
4,
18,
4,
18,
13,
13,
4,
18,
13,
13,
13,
0,
18,
13,
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
] | [
[
15,
14
],
[
14,
27
],
[
30,
29
],
[
34,
33
],
[
29,
35
],
[
34,
36
],
[
34,
37
],
[
40,
39
],
[
46,
45
],
[
37,
48
],
[
51,
50
],
[
29,
52
],
[
51,
53
],
[
56,
55
],
[
62,
61
],
[
68,
67
],
[
50,
69
],
[
55,
70
],
[
73,
72
],
[
53,
74
],
[
61,
75
],
[
67,
81
],
[
33,
82
],
[
72,
86
],
[
36,
87
],
[
94,
89
],
[
39,
90
],
[
97,
96
],
[
39,
112
],
[
119,
116
],
[
96,
117
],
[
50,
118
],
[
124,
121
],
[
96,
122
],
[
33,
127
],
[
36,
130
],
[
96,
135
],
[
96,
141
],
[
144,
143
],
[
153,
150
]
] | [
"import sys,queue,math,copy,itertools,bisect,collections,heapq\n\ndef main():\n LI = lambda : [int(x) for x in sys.stdin.readline().split()]\n\n\n H,W,N = LI()\n\n d = collections.Counter()\n for _ in range(N):\n x,y = LI()\n for dx in range(-1,2):\n for dy in range(-1,2):\n nx = x+dx\n ny = y+dy\n if 1 < nx < H and 1 < ny < W:\n d[(nx,ny)] += 1\n ans = [0] * 10\n for x,c in collections.Counter(d.values()).items():\n ans[x] += c\n ans[0] = (H-2) * (W-2) - sum(ans[1:])\n\n print(*ans,sep='\\n')\n\nif __name__ == '__main__':\n main()",
"import sys,queue,math,copy,itertools,bisect,collections,heapq",
"sys",
"queue",
"math",
"copy",
"itertools",
"bisect",
"collections",
"heapq",
"def main():\n LI = lambda : [int(x) for x in sys.stdin.readline().split()]\n\n\n H,W,N = LI()\n\n d = collections.Counter()\n for _ in range(N):\n x,y = LI()\n for dx in range(-1,2):\n for dy in range(-1,2):\n nx = x+dx\n ny = y+dy\n if 1 < nx < H and 1 < ny < W:\n d[(nx,ny)] += 1\n ans = [0] * 10\n for x,c in collections.Counter(d.values()).items():\n ans[x] += c\n ans[0] = (H-2) * (W-2) - sum(ans[1:])\n\n print(*ans,sep='\\n')",
"main",
"int(x) for x in sys.stdin.readline().split()",
"for x in sys.stdin.readline().split()",
"x",
"sys.stdin.readline().split()",
"sys.stdin.readline().split",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"split",
"for x in sys.stdin.readline().split()",
"int(x)",
"int",
"x",
"LI = lambda : [int(x) for x in sys.stdin.readline().split()]",
"LI",
"lambda : [int(x) for x in sys.stdin.readline().split()]",
"[int(x) for x in sys.stdin.readline().split()]",
"H,W,N = LI()",
"H",
"LI()",
"LI",
"W",
"N",
"d = collections.Counter()",
"d",
"collections.Counter()",
"collections.Counter",
"collections",
"Counter",
"for _ in range(N):\n x,y = LI()\n for dx in range(-1,2):\n for dy in range(-1,2):\n nx = x+dx\n ny = y+dy\n if 1 < nx < H and 1 < ny < W:\n d[(nx,ny)] += 1\n ",
"_",
"range(N)",
"range",
"N",
"x,y = LI()",
"x",
"LI()",
"LI",
"y",
"for dx in range(-1,2):\n for dy in range(-1,2):\n nx = x+dx\n ny = y+dy\n if 1 < nx < H and 1 < ny < W:\n d[(nx,ny)] += 1\n ",
"dx",
"range(-1,2)",
"range",
"-1",
"2",
"for dy in range(-1,2):\n nx = x+dx\n ny = y+dy\n if 1 < nx < H and 1 < ny < W:\n d[(nx,ny)] += 1\n ",
"dy",
"range(-1,2)",
"range",
"-1",
"2",
"nx = x+dx",
"nx",
"x+dx",
"x",
"dx",
"ny = y+dy",
"ny",
"y+dy",
"y",
"dy",
"if 1 < nx < H and 1 < ny < W:\n d[(nx,ny)] += 1\n ",
"1 < nx < H and 1 < ny < W",
"1 < nx < H",
"1 < nx",
"1",
"nx",
"H",
"1 < ny < W",
"1 < ny",
"1",
"ny",
"W",
"d[(nx,ny)] += 1",
"d[(nx,ny)]",
"d",
"(nx,ny)",
"nx",
"ny",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for x,c in collections.Counter(d.values()).items():\n ans[x] += c\n ",
"x",
"c",
"collections.Counter(d.values()).items()",
"collections.Counter(d.values()).items",
"collections.Counter(d.values())",
"collections.Counter",
"collections",
"Counter",
"d.values()",
"d.values",
"d",
"values",
"items",
"ans[x] += c",
"ans[x]",
"ans",
"x",
"c",
"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 LI = lambda : [int(x) for x in sys.stdin.readline().split()]\n\n\n H,W,N = LI()\n\n d = collections.Counter()\n for _ in range(N):\n x,y = LI()\n for dx in range(-1,2):\n for dy in range(-1,2):\n nx = x+dx\n ny = y+dy\n if 1 < nx < H and 1 < ny < W:\n d[(nx,ny)] += 1\n ans = [0] * 10\n for x,c in collections.Counter(d.values()).items():\n ans[x] += c\n ans[0] = (H-2) * (W-2) - sum(ans[1:])\n\n print(*ans,sep='\\n')",
"def main():\n LI = lambda : [int(x) for x in sys.stdin.readline().split()]\n\n\n H,W,N = LI()\n\n d = collections.Counter()\n for _ in range(N):\n x,y = LI()\n for dx in range(-1,2):\n for dy in range(-1,2):\n nx = x+dx\n ny = y+dy\n if 1 < nx < H and 1 < ny < W:\n d[(nx,ny)] += 1\n ans = [0] * 10\n for x,c in collections.Counter(d.values()).items():\n ans[x] += c\n ans[0] = (H-2) * (W-2) - sum(ans[1:])\n\n print(*ans,sep='\\n')",
"main"
] | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
H,W,N = LI()
d = collections.Counter()
for _ in range(N):
x,y = LI()
for dx in range(-1,2):
for dy in range(-1,2):
nx = x+dx
ny = y+dy
if 1 < nx < H and 1 < ny < W:
d[(nx,ny)] += 1
ans = [0] * 10
for x,c in collections.Counter(d.values()).items():
ans[x] += c
ans[0] = (H-2) * (W-2) - sum(ans[1:])
print(*ans,sep='\n')
if __name__ == '__main__':
main() |
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
4,
18,
13,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
39,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
28,
13,
13,
13,
14,
2,
2,
13,
2,
13,
17,
2,
13,
2,
13,
17,
0,
13,
39,
39,
13,
13,
39,
13,
2,
13,
17,
39,
13,
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,
2,
13,
17,
2,
13,
17,
39,
2,
13,
17,
2,
13,
17,
0,
13,
2,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
18,
13,
13,
17,
14,
2,
2,
2,
13,
2,
13,
17,
2,
13,
2,
13,
17,
2,
13,
17,
0,
13,
39,
39,
13,
2,
13,
17,
39,
13,
13,
39,
13,
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,
2,
13,
17,
2,
13,
17,
0,
13,
2,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
18,
13,
13,
17,
14,
2,
2,
13,
2,
13,
17,
2,
13,
17,
0,
13,
39,
39,
13,
2,
13,
17,
39,
13,
2,
13,
17,
39,
13,
13,
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,
0,
13,
2,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
18,
13,
13,
17,
14,
2,
2,
2,
13,
2,
13,
17,
2,
13,
17,
2,
13,
2,
13,
17,
0,
13,
39,
39,
2,
13,
17,
13,
39,
2,
13,
17,
2,
13,
17,
39,
2,
13,
17,
2,
13,
17,
39,
13,
13,
39,
13,
2,
13,
17,
39,
13,
2,
13,
17,
39,
2,
13,
17,
13,
39,
2,
13,
17,
2,
13,
17,
39,
2,
13,
17,
2,
13,
17,
0,
13,
2,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
18,
13,
13,
17,
14,
2,
2,
2,
2,
13,
2,
13,
17,
2,
13,
17,
2,
13,
2,
13,
17,
2,
13,
17,
0,
13,
39,
39,
2,
13,
17,
2,
13,
17,
39,
2,
13,
17,
13,
39,
2,
13,
17,
2,
13,
17,
39,
13,
2,
13,
17,
39,
13,
13,
39,
13,
2,
13,
17,
39,
2,
13,
17,
2,
13,
17,
39,
2,
13,
17,
13,
39,
2,
13,
17,
2,
13,
17,
0,
13,
2,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
18,
13,
13,
17,
14,
2,
2,
2,
13,
2,
13,
17,
2,
13,
17,
2,
13,
17,
0,
13,
39,
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,
39,
2,
13,
17,
2,
13,
17,
39,
2,
13,
17,
2,
13,
17,
39,
2,
13,
17,
13,
0,
13,
2,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
18,
13,
13,
17,
14,
2,
2,
13,
17,
2,
13,
2,
13,
17,
0,
13,
39,
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,
2,
13,
17,
2,
13,
17,
39,
2,
13,
17,
2,
13,
17,
39,
13,
13,
39,
13,
2,
13,
17,
39,
13,
2,
13,
17,
0,
13,
2,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
18,
13,
13,
17,
14,
2,
2,
2,
13,
17,
2,
13,
2,
13,
17,
2,
13,
17,
0,
13,
39,
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,
2,
13,
17,
2,
13,
17,
39,
13,
2,
13,
17,
39,
13,
13,
39,
13,
2,
13,
17,
0,
13,
2,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
18,
13,
13,
17,
14,
2,
2,
13,
17,
2,
13,
17,
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,
0,
13,
2,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
18,
13,
13,
17,
28,
13,
4,
13,
17,
17,
0,
18,
13,
13,
2,
18,
13,
13,
13,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
18,
13,
17,
2,
13,
4,
13,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13,
10,
39,
13,
10,
39,
13,
10,
39,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13,
10,
39,
13,
10,
39,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
2,
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,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13
] | [
[
961,
2
],
[
961,
11
],
[
961,
12
],
[
919,
14
],
[
18,
17
],
[
953,
20
],
[
920,
23
],
[
922,
36
],
[
920,
39
],
[
871,
41
],
[
923,
44
],
[
949,
46
],
[
962,
67
],
[
938,
72
],
[
877,
75
],
[
943,
129
],
[
872,
131
],
[
878,
134
],
[
895,
136
],
[
944,
139
],
[
144,
141
],
[
950,
142
],
[
896,
143
],
[
962,
151
],
[
938,
156
],
[
889,
162
],
[
910,
216
],
[
872,
218
],
[
890,
221
],
[
964,
223
],
[
911,
226
],
[
231,
228
],
[
950,
229
],
[
965,
230
],
[
962,
237
],
[
883,
243
],
[
904,
297
],
[
872,
299
],
[
884,
302
],
[
946,
304
],
[
905,
307
],
[
312,
309
],
[
950,
310
],
[
947,
311
],
[
962,
319
],
[
938,
327
],
[
934,
330
],
[
913,
384
],
[
872,
386
],
[
935,
389
],
[
955,
391
],
[
914,
394
],
[
399,
396
],
[
950,
397
],
[
956,
398
],
[
962,
407
],
[
938,
415
],
[
967,
421
],
[
880,
475
],
[
872,
477
],
[
968,
480
],
[
865,
482
],
[
881,
485
],
[
490,
487
],
[
950,
488
],
[
866,
489
],
[
962,
497
],
[
916,
506
],
[
892,
560
],
[
872,
562
],
[
917,
565
],
[
928,
567
],
[
893,
570
],
[
575,
572
],
[
950,
573
],
[
929,
574
],
[
938,
584
],
[
886,
587
],
[
898,
641
],
[
872,
643
],
[
887,
646
],
[
958,
648
],
[
899,
651
],
[
656,
653
],
[
950,
654
],
[
959,
655
],
[
938,
666
],
[
925,
672
],
[
901,
726
],
[
872,
728
],
[
926,
731
],
[
940,
733
],
[
902,
736
],
[
741,
738
],
[
950,
739
],
[
941,
740
],
[
868,
751
],
[
931,
805
],
[
872,
807
],
[
869,
810
],
[
874,
812
],
[
932,
815
],
[
820,
817
],
[
950,
818
],
[
875,
819
],
[
823,
822
],
[
831,
828
],
[
950,
829
],
[
822,
830
],
[
828,
832
],
[
950,
833
],
[
822,
834
],
[
822,
835
],
[
907,
837
],
[
962,
840
],
[
938,
843
],
[
849,
846
],
[
950,
847
],
[
908,
850
],
[
950,
853
],
[
856,
855
],
[
828,
861
],
[
950,
862
],
[
855,
863
],
[
865,
866
],
[
868,
869
],
[
871,
872
],
[
874,
875
],
[
877,
878
],
[
880,
881
],
[
883,
884
],
[
886,
887
],
[
889,
890
],
[
892,
893
],
[
895,
896
],
[
898,
899
],
[
901,
902
],
[
904,
905
],
[
907,
908
],
[
910,
911
],
[
913,
914
],
[
916,
917
],
[
919,
920
],
[
922,
923
],
[
925,
926
],
[
928,
929
],
[
931,
932
],
[
934,
935
],
[
961,
938
],
[
940,
941
],
[
943,
944
],
[
946,
947
],
[
949,
950
],
[
961,
953
],
[
955,
956
],
[
958,
959
],
[
961,
962
],
[
964,
965
],
[
967,
968
]
] | [
"H, W, N = map(int, input().split())\nli = []\nfor i in range(N):\n li.append(tuple(map(int, input().split())))\nt = tuple(li)\nst = set(t)\n#print(t)\n\nJs = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n\nfor a, b in t:\n if a > H-2 or b > W-2:\n pass\n else:\n t_p1 = ((a, b), (a, b+1), (a, b+2),\\\n (a+1, b), (a+1, b+1), (a+1, b+2),\\\n (a+2, b), (a+2, b+1), (a+2, b+2))\n s1 = st & set(t_p1)\n ls1 = len(s1)\n Js[ls1] += 1\n \n if a > H-2 or b > W-1 or b < 2:\n pass\n else:\n t_p2 = ((a, b-1), (a, b), (a, b+1),\\\n (a+1, b-1), (a+1, b), (a+1, b+1),\\\n (a+2, b-1), (a+2, b), (a+2, b+1))\n s2 = st & set(t_p2)\n ls2 = len(s2)\n Js[ls2] += 1\n \n if a > H-2 or b < 3:\n pass\n else:\n t_p3 = ((a, b-2), (a, b-1), (a, b),\\\n (a+1, b-2), (a+1, b-1), (a+1, b),\\\n (a+2, b-2), (a+2, b-1), (a+2, b))\n s3 = st & set(t_p3)\n ls3 = len(s3)\n Js[ls3] += 1\n\n if a > H-1 or a < 2 or b > W-2:\n pass\n else:\n t_p4 = ((a-1, b), (a-1, b+1), (a-1, b+2),\\\n (a, b), (a, b+1), (a, b+2),\\\n (a+1, b), (a+1, b+1), (a+1, b+2))\n s4 = st & set(t_p4)\n ls4 = len(s4)\n Js[ls4] += 1\n \n if a > H-1 or a < 2 or b > W-1 or b < 2:\n pass\n else:\n t_p5 = ((a-1, b-1), (a-1, b), (a-1, b+1),\\\n (a, b-1), (a, b), (a, b+1),\\\n (a+1, b-1), (a+1, b), (a+1, b+1))\n s5 = st & set(t_p5)\n ls5 = len(s5)\n Js[ls5] += 1\n \n if a > H-1 or a < 2 or b < 3:\n pass\n else:\n t_p6 = ((a-1, b-2), (a-1, b-1), (a-1, b),\\\n (a, b-2), (a, b-1), (a, b),\\\n (a+1, b-2), (a+1, b-1), (a+1, b))\n s6 = st & set(t_p6)\n ls6 = len(s6)\n Js[ls6] += 1\n \n if a < 3 or b > W-2:\n pass\n else:\n t_p7 = ((a-2, b), (a-2, b+1), (a-2, b+2),\\\n (a-1, b), (a-1, b+1), (a-1, b+2),\\\n (a, b), (a, b+1), (a, b+2))\n s7 = st & set(t_p7)\n ls7 = len(s7)\n Js[ls7] += 1\n \n if a < 3 or b > W-1 or b < 2:\n pass\n else:\n t_p8 = ((a-2, b-1), (a-2, b), (a-2, b+1),\\\n (a-1, b-1), (a-1, b), (a-1, b+1),\\\n (a, b-1), (a, b), (a, b+1))\n s8 = st & set(t_p8)\n ls8 = len(s8)\n Js[ls8] += 1\n \n if a < 3 or b < 3:\n pass\n else:\n t_p9 = ((a-2, b-2), (a-2, b-1), (a-2, b),\\\n (a-1, b-2), (a-1, b-1), (a-1, b),\\\n (a, b-2), (a, b-1), (a, b))\n s9 = st & set(t_p9)\n ls9 = len(s9)\n Js[ls9] += 1\n\nfor i in range(1, 10):\n Js[i] = Js[i] // i\n\nall = (H - 2) * (W - 2)\nJs[0] = all - sum(Js)\n \nfor i in range(10):\n print(Js[i])",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"li = []",
"li",
"[]",
"for i in range(N):\n li.append(tuple(map(int, input().split())))",
"i",
"range(N)",
"range",
"N",
"li.append(tuple(map(int, input().split())))",
"li.append",
"li",
"append",
"tuple(map(int, input().split()))",
"tuple",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t = tuple(li)",
"t",
"tuple(li)",
"tuple",
"li",
"st = set(t)",
"st",
"set(t)",
"set",
"t",
"Js = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
"Js",
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"0",
"for a, b in t:\n if a > H-2 or b > W-2:\n pass\n else:\n t_p1 = ((a, b), (a, b+1), (a, b+2),\\\n (a+1, b), (a+1, b+1), (a+1, b+2),\\\n (a+2, b), (a+2, b+1), (a+2, b+2))\n s1 = st & set(t_p1)\n ls1 = len(s1)\n Js[ls1] += 1\n \n if a > H-2 or b > W-1 or b < 2:\n pass\n else:\n t_p2 = ((a, b-1), (a, b), (a, b+1),\\\n (a+1, b-1), (a+1, b), (a+1, b+1),\\\n (a+2, b-1), (a+2, b), (a+2, b+1))\n s2 = st & set(t_p2)\n ls2 = len(s2)\n Js[ls2] += 1\n \n if a > H-2 or b < 3:\n pass\n else:\n t_p3 = ((a, b-2), (a, b-1), (a, b),\\\n (a+1, b-2), (a+1, b-1), (a+1, b),\\\n (a+2, b-2), (a+2, b-1), (a+2, b))\n s3 = st & set(t_p3)\n ls3 = len(s3)\n Js[ls3] += 1\n\n if a > H-1 or a < 2 or b > W-2:\n pass\n else:\n t_p4 = ((a-1, b), (a-1, b+1), (a-1, b+2),\\\n (a, b), (a, b+1), (a, b+2),\\\n (a+1, b), (a+1, b+1), (a+1, b+2))\n s4 = st & set(t_p4)\n ls4 = len(s4)\n Js[ls4] += 1\n \n if a > H-1 or a < 2 or b > W-1 or b < 2:\n pass\n else:\n t_p5 = ((a-1, b-1), (a-1, b), (a-1, b+1),\\\n (a, b-1), (a, b), (a, b+1),\\\n (a+1, b-1), (a+1, b), (a+1, b+1))\n s5 = st & set(t_p5)\n ls5 = len(s5)\n Js[ls5] += 1\n \n if a > H-1 or a < 2 or b < 3:\n pass\n else:\n t_p6 = ((a-1, b-2), (a-1, b-1), (a-1, b),\\\n (a, b-2), (a, b-1), (a, b),\\\n (a+1, b-2), (a+1, b-1), (a+1, b))\n s6 = st & set(t_p6)\n ls6 = len(s6)\n Js[ls6] += 1\n \n if a < 3 or b > W-2:\n pass\n else:\n t_p7 = ((a-2, b), (a-2, b+1), (a-2, b+2),\\\n (a-1, b), (a-1, b+1), (a-1, b+2),\\\n (a, b), (a, b+1), (a, b+2))\n s7 = st & set(t_p7)\n ls7 = len(s7)\n Js[ls7] += 1\n \n if a < 3 or b > W-1 or b < 2:\n pass\n else:\n t_p8 = ((a-2, b-1), (a-2, b), (a-2, b+1),\\\n (a-1, b-1), (a-1, b), (a-1, b+1),\\\n (a, b-1), (a, b), (a, b+1))\n s8 = st & set(t_p8)\n ls8 = len(s8)\n Js[ls8] += 1\n \n if a < 3 or b < 3:\n pass\n else:\n t_p9 = ((a-2, b-2), (a-2, b-1), (a-2, b),\\\n (a-1, b-2), (a-1, b-1), (a-1, b),\\\n (a, b-2), (a, b-1), (a, b))\n s9 = st & set(t_p9)\n ls9 = len(s9)\n Js[ls9] += 1",
"a",
"b",
"t",
"if a > H-2 or b > W-2:\n pass\n else:\n t_p1 = ((a, b), (a, b+1), (a, b+2),\\\n (a+1, b), (a+1, b+1), (a+1, b+2),\\\n (a+2, b), (a+2, b+1), (a+2, b+2))\n s1 = st & set(t_p1)\n ls1 = len(s1)\n Js[ls1] += 1\n \n ",
"a > H-2 or b > W-2",
"a > H-2",
"a",
"H-2",
"H",
"2",
"b > W-2",
"b",
"W-2",
"W",
"2",
"t_p1 = ((a, b), (a, b+1), (a, b+2),\\\n (a+1, b), (a+1, b+1), (a+1, b+2),\\\n (a+2, b), (a+2, b+1), (a+2, b+2))",
"t_p1",
"((a, b), (a, b+1), (a, b+2),\\\n (a+1, b), (a+1, b+1), (a+1, b+2),\\\n (a+2, b), (a+2, b+1), (a+2, b+2))",
"(a, b)",
"a",
"b",
"(a, b+1)",
"a",
"b+1",
"b",
"1",
"(a, b+2)",
"a",
"b+2",
"b",
"2",
"(a+1, b)",
"a+1",
"a",
"1",
"b",
"(a+1, b+1)",
"a+1",
"a",
"1",
"b+1",
"b",
"1",
"(a+1, b+2)",
"a+1",
"a",
"1",
"b+2",
"b",
"2",
"(a+2, b)",
"a+2",
"a",
"2",
"b",
"(a+2, b+1)",
"a+2",
"a",
"2",
"b+1",
"b",
"1",
"(a+2, b+2)",
"a+2",
"a",
"2",
"b+2",
"b",
"2",
"s1 = st & set(t_p1)",
"s1",
"st & set(t_p1)",
"st",
"set(t_p1)",
"set",
"t_p1",
"ls1 = len(s1)",
"ls1",
"len(s1)",
"len",
"s1",
"Js[ls1] += 1",
"Js[ls1]",
"Js",
"ls1",
"1",
"if a > H-2 or b > W-1 or b < 2:\n pass\n else:\n t_p2 = ((a, b-1), (a, b), (a, b+1),\\\n (a+1, b-1), (a+1, b), (a+1, b+1),\\\n (a+2, b-1), (a+2, b), (a+2, b+1))\n s2 = st & set(t_p2)\n ls2 = len(s2)\n Js[ls2] += 1\n \n ",
"a > H-2 or b > W-1 or b < 2",
"a > H-2 or b > W-1",
"a > H-2",
"a",
"H-2",
"H",
"2",
"b > W-1",
"b",
"W-1",
"W",
"1",
"b < 2",
"b",
"2",
"t_p2 = ((a, b-1), (a, b), (a, b+1),\\\n (a+1, b-1), (a+1, b), (a+1, b+1),\\\n (a+2, b-1), (a+2, b), (a+2, b+1))",
"t_p2",
"((a, b-1), (a, b), (a, b+1),\\\n (a+1, b-1), (a+1, b), (a+1, b+1),\\\n (a+2, b-1), (a+2, b), (a+2, b+1))",
"(a, b-1)",
"a",
"b-1",
"b",
"1",
"(a, b)",
"a",
"b",
"(a, b+1)",
"a",
"b+1",
"b",
"1",
"(a+1, b-1)",
"a+1",
"a",
"1",
"b-1",
"b",
"1",
"(a+1, b)",
"a+1",
"a",
"1",
"b",
"(a+1, b+1)",
"a+1",
"a",
"1",
"b+1",
"b",
"1",
"(a+2, b-1)",
"a+2",
"a",
"2",
"b-1",
"b",
"1",
"(a+2, b)",
"a+2",
"a",
"2",
"b",
"(a+2, b+1)",
"a+2",
"a",
"2",
"b+1",
"b",
"1",
"s2 = st & set(t_p2)",
"s2",
"st & set(t_p2)",
"st",
"set(t_p2)",
"set",
"t_p2",
"ls2 = len(s2)",
"ls2",
"len(s2)",
"len",
"s2",
"Js[ls2] += 1",
"Js[ls2]",
"Js",
"ls2",
"1",
"if a > H-2 or b < 3:\n pass\n else:\n t_p3 = ((a, b-2), (a, b-1), (a, b),\\\n (a+1, b-2), (a+1, b-1), (a+1, b),\\\n (a+2, b-2), (a+2, b-1), (a+2, b))\n s3 = st & set(t_p3)\n ls3 = len(s3)\n Js[ls3] += 1\n\n ",
"a > H-2 or b < 3",
"a > H-2",
"a",
"H-2",
"H",
"2",
"b < 3",
"b",
"3",
"t_p3 = ((a, b-2), (a, b-1), (a, b),\\\n (a+1, b-2), (a+1, b-1), (a+1, b),\\\n (a+2, b-2), (a+2, b-1), (a+2, b))",
"t_p3",
"((a, b-2), (a, b-1), (a, b),\\\n (a+1, b-2), (a+1, b-1), (a+1, b),\\\n (a+2, b-2), (a+2, b-1), (a+2, b))",
"(a, b-2)",
"a",
"b-2",
"b",
"2",
"(a, b-1)",
"a",
"b-1",
"b",
"1",
"(a, b)",
"a",
"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+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",
"s3 = st & set(t_p3)",
"s3",
"st & set(t_p3)",
"st",
"set(t_p3)",
"set",
"t_p3",
"ls3 = len(s3)",
"ls3",
"len(s3)",
"len",
"s3",
"Js[ls3] += 1",
"Js[ls3]",
"Js",
"ls3",
"1",
"if a > H-1 or a < 2 or b > W-2:\n pass\n else:\n t_p4 = ((a-1, b), (a-1, b+1), (a-1, b+2),\\\n (a, b), (a, b+1), (a, b+2),\\\n (a+1, b), (a+1, b+1), (a+1, b+2))\n s4 = st & set(t_p4)\n ls4 = len(s4)\n Js[ls4] += 1\n \n ",
"a > H-1 or a < 2 or b > W-2",
"a > H-1 or a < 2",
"a > H-1",
"a",
"H-1",
"H",
"1",
"a < 2",
"a",
"2",
"b > W-2",
"b",
"W-2",
"W",
"2",
"t_p4 = ((a-1, b), (a-1, b+1), (a-1, b+2),\\\n (a, b), (a, b+1), (a, b+2),\\\n (a+1, b), (a+1, b+1), (a+1, b+2))",
"t_p4",
"((a-1, b), (a-1, b+1), (a-1, b+2),\\\n (a, b), (a, b+1), (a, b+2),\\\n (a+1, b), (a+1, b+1), (a+1, b+2))",
"(a-1, b)",
"a-1",
"a",
"1",
"b",
"(a-1, b+1)",
"a-1",
"a",
"1",
"b+1",
"b",
"1",
"(a-1, b+2)",
"a-1",
"a",
"1",
"b+2",
"b",
"2",
"(a, b)",
"a",
"b",
"(a, b+1)",
"a",
"b+1",
"b",
"1",
"(a, b+2)",
"a",
"b+2",
"b",
"2",
"(a+1, b)",
"a+1",
"a",
"1",
"b",
"(a+1, b+1)",
"a+1",
"a",
"1",
"b+1",
"b",
"1",
"(a+1, b+2)",
"a+1",
"a",
"1",
"b+2",
"b",
"2",
"s4 = st & set(t_p4)",
"s4",
"st & set(t_p4)",
"st",
"set(t_p4)",
"set",
"t_p4",
"ls4 = len(s4)",
"ls4",
"len(s4)",
"len",
"s4",
"Js[ls4] += 1",
"Js[ls4]",
"Js",
"ls4",
"1",
"if a > H-1 or a < 2 or b > W-1 or b < 2:\n pass\n else:\n t_p5 = ((a-1, b-1), (a-1, b), (a-1, b+1),\\\n (a, b-1), (a, b), (a, b+1),\\\n (a+1, b-1), (a+1, b), (a+1, b+1))\n s5 = st & set(t_p5)\n ls5 = len(s5)\n Js[ls5] += 1\n \n ",
"a > H-1 or a < 2 or b > W-1 or b < 2",
"a > H-1 or a < 2 or b > W-1",
"a > H-1 or a < 2",
"a > H-1",
"a",
"H-1",
"H",
"1",
"a < 2",
"a",
"2",
"b > W-1",
"b",
"W-1",
"W",
"1",
"b < 2",
"b",
"2",
"t_p5 = ((a-1, b-1), (a-1, b), (a-1, b+1),\\\n (a, b-1), (a, b), (a, b+1),\\\n (a+1, b-1), (a+1, b), (a+1, b+1))",
"t_p5",
"((a-1, b-1), (a-1, b), (a-1, b+1),\\\n (a, b-1), (a, b), (a, b+1),\\\n (a+1, b-1), (a+1, b), (a+1, b+1))",
"(a-1, b-1)",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"(a-1, b)",
"a-1",
"a",
"1",
"b",
"(a-1, b+1)",
"a-1",
"a",
"1",
"b+1",
"b",
"1",
"(a, b-1)",
"a",
"b-1",
"b",
"1",
"(a, b)",
"a",
"b",
"(a, b+1)",
"a",
"b+1",
"b",
"1",
"(a+1, b-1)",
"a+1",
"a",
"1",
"b-1",
"b",
"1",
"(a+1, b)",
"a+1",
"a",
"1",
"b",
"(a+1, b+1)",
"a+1",
"a",
"1",
"b+1",
"b",
"1",
"s5 = st & set(t_p5)",
"s5",
"st & set(t_p5)",
"st",
"set(t_p5)",
"set",
"t_p5",
"ls5 = len(s5)",
"ls5",
"len(s5)",
"len",
"s5",
"Js[ls5] += 1",
"Js[ls5]",
"Js",
"ls5",
"1",
"if a > H-1 or a < 2 or b < 3:\n pass\n else:\n t_p6 = ((a-1, b-2), (a-1, b-1), (a-1, b),\\\n (a, b-2), (a, b-1), (a, b),\\\n (a+1, b-2), (a+1, b-1), (a+1, b))\n s6 = st & set(t_p6)\n ls6 = len(s6)\n Js[ls6] += 1\n \n ",
"a > H-1 or a < 2 or b < 3",
"a > H-1 or a < 2",
"a > H-1",
"a",
"H-1",
"H",
"1",
"a < 2",
"a",
"2",
"b < 3",
"b",
"3",
"t_p6 = ((a-1, b-2), (a-1, b-1), (a-1, b),\\\n (a, b-2), (a, b-1), (a, b),\\\n (a+1, b-2), (a+1, b-1), (a+1, b))",
"t_p6",
"((a-1, b-2), (a-1, b-1), (a-1, b),\\\n (a, b-2), (a, b-1), (a, b),\\\n (a+1, b-2), (a+1, b-1), (a+1, 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",
"(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",
"s6 = st & set(t_p6)",
"s6",
"st & set(t_p6)",
"st",
"set(t_p6)",
"set",
"t_p6",
"ls6 = len(s6)",
"ls6",
"len(s6)",
"len",
"s6",
"Js[ls6] += 1",
"Js[ls6]",
"Js",
"ls6",
"1",
"if a < 3 or b > W-2:\n pass\n else:\n t_p7 = ((a-2, b), (a-2, b+1), (a-2, b+2),\\\n (a-1, b), (a-1, b+1), (a-1, b+2),\\\n (a, b), (a, b+1), (a, b+2))\n s7 = st & set(t_p7)\n ls7 = len(s7)\n Js[ls7] += 1\n \n ",
"a < 3 or b > W-2",
"a < 3",
"a",
"3",
"b > W-2",
"b",
"W-2",
"W",
"2",
"t_p7 = ((a-2, b), (a-2, b+1), (a-2, b+2),\\\n (a-1, b), (a-1, b+1), (a-1, b+2),\\\n (a, b), (a, b+1), (a, b+2))",
"t_p7",
"((a-2, b), (a-2, b+1), (a-2, b+2),\\\n (a-1, b), (a-1, b+1), (a-1, b+2),\\\n (a, b), (a, b+1), (a, b+2))",
"(a-2, b)",
"a-2",
"a",
"2",
"b",
"(a-2, b+1)",
"a-2",
"a",
"2",
"b+1",
"b",
"1",
"(a-2, b+2)",
"a-2",
"a",
"2",
"b+2",
"b",
"2",
"(a-1, b)",
"a-1",
"a",
"1",
"b",
"(a-1, b+1)",
"a-1",
"a",
"1",
"b+1",
"b",
"1",
"(a-1, b+2)",
"a-1",
"a",
"1",
"b+2",
"b",
"2",
"(a, b)",
"a",
"b",
"(a, b+1)",
"a",
"b+1",
"b",
"1",
"(a, b+2)",
"a",
"b+2",
"b",
"2",
"s7 = st & set(t_p7)",
"s7",
"st & set(t_p7)",
"st",
"set(t_p7)",
"set",
"t_p7",
"ls7 = len(s7)",
"ls7",
"len(s7)",
"len",
"s7",
"Js[ls7] += 1",
"Js[ls7]",
"Js",
"ls7",
"1",
"if a < 3 or b > W-1 or b < 2:\n pass\n else:\n t_p8 = ((a-2, b-1), (a-2, b), (a-2, b+1),\\\n (a-1, b-1), (a-1, b), (a-1, b+1),\\\n (a, b-1), (a, b), (a, b+1))\n s8 = st & set(t_p8)\n ls8 = len(s8)\n Js[ls8] += 1\n \n ",
"a < 3 or b > W-1 or b < 2",
"a < 3 or b > W-1",
"a < 3",
"a",
"3",
"b > W-1",
"b",
"W-1",
"W",
"1",
"b < 2",
"b",
"2",
"t_p8 = ((a-2, b-1), (a-2, b), (a-2, b+1),\\\n (a-1, b-1), (a-1, b), (a-1, b+1),\\\n (a, b-1), (a, b), (a, b+1))",
"t_p8",
"((a-2, b-1), (a-2, b), (a-2, b+1),\\\n (a-1, b-1), (a-1, b), (a-1, b+1),\\\n (a, b-1), (a, b), (a, b+1))",
"(a-2, b-1)",
"a-2",
"a",
"2",
"b-1",
"b",
"1",
"(a-2, b)",
"a-2",
"a",
"2",
"b",
"(a-2, b+1)",
"a-2",
"a",
"2",
"b+1",
"b",
"1",
"(a-1, b-1)",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"(a-1, b)",
"a-1",
"a",
"1",
"b",
"(a-1, b+1)",
"a-1",
"a",
"1",
"b+1",
"b",
"1",
"(a, b-1)",
"a",
"b-1",
"b",
"1",
"(a, b)",
"a",
"b",
"(a, b+1)",
"a",
"b+1",
"b",
"1",
"s8 = st & set(t_p8)",
"s8",
"st & set(t_p8)",
"st",
"set(t_p8)",
"set",
"t_p8",
"ls8 = len(s8)",
"ls8",
"len(s8)",
"len",
"s8",
"Js[ls8] += 1",
"Js[ls8]",
"Js",
"ls8",
"1",
"if a < 3 or b < 3:\n pass\n else:\n t_p9 = ((a-2, b-2), (a-2, b-1), (a-2, b),\\\n (a-1, b-2), (a-1, b-1), (a-1, b),\\\n (a, b-2), (a, b-1), (a, b))\n s9 = st & set(t_p9)\n ls9 = len(s9)\n Js[ls9] += 1",
"a < 3 or b < 3",
"a < 3",
"a",
"3",
"b < 3",
"b",
"3",
"t_p9 = ((a-2, b-2), (a-2, b-1), (a-2, b),\\\n (a-1, b-2), (a-1, b-1), (a-1, b),\\\n (a, b-2), (a, b-1), (a, b))",
"t_p9",
"((a-2, b-2), (a-2, b-1), (a-2, b),\\\n (a-1, b-2), (a-1, b-1), (a-1, b),\\\n (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",
"s9 = st & set(t_p9)",
"s9",
"st & set(t_p9)",
"st",
"set(t_p9)",
"set",
"t_p9",
"ls9 = len(s9)",
"ls9",
"len(s9)",
"len",
"s9",
"Js[ls9] += 1",
"Js[ls9]",
"Js",
"ls9",
"1",
"for i in range(1, 10):\n Js[i] = Js[i] // i",
"i",
"range(1, 10)",
"range",
"1",
"10",
"Js[i] = Js[i] // i",
"Js[i]",
"Js",
"i",
"Js[i] // i",
"Js[i]",
"Js",
"i",
"i",
"all = (H - 2) * (W - 2)",
"all",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"Js[0] = all - sum(Js)",
"Js[0]",
"Js",
"0",
"all - sum(Js)",
"all",
"sum(Js)",
"sum",
"Js",
"for i in range(10):\n print(Js[i])",
"i",
"range(10)",
"range",
"10",
"print(Js[i])",
"print",
"Js[i]",
"Js",
"i",
"ls5 = len(s5)",
"len(s5)",
"ls5",
"t_p9 = ((a-2, b-2), (a-2, b-1), (a-2, b),\\\n (a-1, b-2), (a-1, b-1), (a-1, b),\\\n (a, b-2), (a, b-1), (a, b))",
"((a-2, b-2), (a-2, b-1), (a-2, b),\\\n (a-1, b-2), (a-1, b-1), (a-1, b),\\\n (a, b-2), (a, b-1), (a, b))",
"t_p9",
"st = set(t)",
"set(t)",
"st",
"ls9 = len(s9)",
"len(s9)",
"ls9",
"t_p1 = ((a, b), (a, b+1), (a, b+2),\\\n (a+1, b), (a+1, b+1), (a+1, b+2),\\\n (a+2, b), (a+2, b+1), (a+2, b+2))",
"((a, b), (a, b+1), (a, b+2),\\\n (a+1, b), (a+1, b+1), (a+1, b+2),\\\n (a+2, b), (a+2, b+1), (a+2, b+2))",
"t_p1",
"s5 = st & set(t_p5)",
"st & set(t_p5)",
"s5",
"t_p3 = ((a, b-2), (a, b-1), (a, b),\\\n (a+1, b-2), (a+1, b-1), (a+1, b),\\\n (a+2, b-2), (a+2, b-1), (a+2, b))",
"((a, b-2), (a, b-1), (a, b),\\\n (a+1, b-2), (a+1, b-1), (a+1, b),\\\n (a+2, b-2), (a+2, b-1), (a+2, b))",
"t_p3",
"t_p7 = ((a-2, b), (a-2, b+1), (a-2, b+2),\\\n (a-1, b), (a-1, b+1), (a-1, b+2),\\\n (a, b), (a, b+1), (a, b+2))",
"((a-2, b), (a-2, b+1), (a-2, b+2),\\\n (a-1, b), (a-1, b+1), (a-1, b+2),\\\n (a, b), (a, b+1), (a, b+2))",
"t_p7",
"t_p2 = ((a, b-1), (a, b), (a, b+1),\\\n (a+1, b-1), (a+1, b), (a+1, b+1),\\\n (a+2, b-1), (a+2, b), (a+2, b+1))",
"((a, b-1), (a, b), (a, b+1),\\\n (a+1, b-1), (a+1, b), (a+1, b+1),\\\n (a+2, b-1), (a+2, b), (a+2, b+1))",
"t_p2",
"s6 = st & set(t_p6)",
"st & set(t_p6)",
"s6",
"ls1 = len(s1)",
"len(s1)",
"ls1",
"s7 = st & set(t_p7)",
"st & set(t_p7)",
"s7",
"s8 = st & set(t_p8)",
"st & set(t_p8)",
"s8",
"s3 = st & set(t_p3)",
"st & set(t_p3)",
"s3",
"all = (H - 2) * (W - 2)",
"(H - 2) * (W - 2)",
"all",
"s2 = st & set(t_p2)",
"st & set(t_p2)",
"s2",
"s4 = st & set(t_p4)",
"st & set(t_p4)",
"s4",
"t_p6 = ((a-1, b-2), (a-1, b-1), (a-1, b),\\\n (a, b-2), (a, b-1), (a, b),\\\n (a+1, b-2), (a+1, b-1), (a+1, b))",
"((a-1, b-2), (a-1, b-1), (a-1, b),\\\n (a, b-2), (a, b-1), (a, b),\\\n (a+1, b-2), (a+1, b-1), (a+1, b))",
"t_p6",
"li = []",
"[]",
"li",
"t = tuple(li)",
"tuple(li)",
"t",
"t_p8 = ((a-2, b-1), (a-2, b), (a-2, b+1),\\\n (a-1, b-1), (a-1, b), (a-1, b+1),\\\n (a, b-1), (a, b), (a, b+1))",
"((a-2, b-1), (a-2, b), (a-2, b+1),\\\n (a-1, b-1), (a-1, b), (a-1, b+1),\\\n (a, b-1), (a, b), (a, b+1))",
"t_p8",
"ls6 = len(s6)",
"len(s6)",
"ls6",
"s9 = st & set(t_p9)",
"st & set(t_p9)",
"s9",
"t_p4 = ((a-1, b), (a-1, b+1), (a-1, b+2),\\\n (a, b), (a, b+1), (a, b+2),\\\n (a+1, b), (a+1, b+1), (a+1, b+2))",
"((a-1, b), (a-1, b+1), (a-1, b+2),\\\n (a, b), (a, b+1), (a, b+2),\\\n (a+1, b), (a+1, b+1), (a+1, b+2))",
"t_p4",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"ls8 = len(s8)",
"len(s8)",
"ls8",
"s1 = st & set(t_p1)",
"st & set(t_p1)",
"s1",
"ls3 = len(s3)",
"len(s3)",
"ls3",
"Js = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
"Js",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"ls4 = len(s4)",
"len(s4)",
"ls4",
"ls7 = len(s7)",
"len(s7)",
"ls7",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"ls2 = len(s2)",
"len(s2)",
"ls2",
"t_p5 = ((a-1, b-1), (a-1, b), (a-1, b+1),\\\n (a, b-1), (a, b), (a, b+1),\\\n (a+1, b-1), (a+1, b), (a+1, b+1))",
"((a-1, b-1), (a-1, b), (a-1, b+1),\\\n (a, b-1), (a, b), (a, b+1),\\\n (a+1, b-1), (a+1, b), (a+1, b+1))",
"t_p5"
] | H, W, N = map(int, input().split())
li = []
for i in range(N):
li.append(tuple(map(int, input().split())))
t = tuple(li)
st = set(t)
#print(t)
Js = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for a, b in t:
if a > H-2 or b > W-2:
pass
else:
t_p1 = ((a, b), (a, b+1), (a, b+2),\
(a+1, b), (a+1, b+1), (a+1, b+2),\
(a+2, b), (a+2, b+1), (a+2, b+2))
s1 = st & set(t_p1)
ls1 = len(s1)
Js[ls1] += 1
if a > H-2 or b > W-1 or b < 2:
pass
else:
t_p2 = ((a, b-1), (a, b), (a, b+1),\
(a+1, b-1), (a+1, b), (a+1, b+1),\
(a+2, b-1), (a+2, b), (a+2, b+1))
s2 = st & set(t_p2)
ls2 = len(s2)
Js[ls2] += 1
if a > H-2 or b < 3:
pass
else:
t_p3 = ((a, b-2), (a, b-1), (a, b),\
(a+1, b-2), (a+1, b-1), (a+1, b),\
(a+2, b-2), (a+2, b-1), (a+2, b))
s3 = st & set(t_p3)
ls3 = len(s3)
Js[ls3] += 1
if a > H-1 or a < 2 or b > W-2:
pass
else:
t_p4 = ((a-1, b), (a-1, b+1), (a-1, b+2),\
(a, b), (a, b+1), (a, b+2),\
(a+1, b), (a+1, b+1), (a+1, b+2))
s4 = st & set(t_p4)
ls4 = len(s4)
Js[ls4] += 1
if a > H-1 or a < 2 or b > W-1 or b < 2:
pass
else:
t_p5 = ((a-1, b-1), (a-1, b), (a-1, b+1),\
(a, b-1), (a, b), (a, b+1),\
(a+1, b-1), (a+1, b), (a+1, b+1))
s5 = st & set(t_p5)
ls5 = len(s5)
Js[ls5] += 1
if a > H-1 or a < 2 or b < 3:
pass
else:
t_p6 = ((a-1, b-2), (a-1, b-1), (a-1, b),\
(a, b-2), (a, b-1), (a, b),\
(a+1, b-2), (a+1, b-1), (a+1, b))
s6 = st & set(t_p6)
ls6 = len(s6)
Js[ls6] += 1
if a < 3 or b > W-2:
pass
else:
t_p7 = ((a-2, b), (a-2, b+1), (a-2, b+2),\
(a-1, b), (a-1, b+1), (a-1, b+2),\
(a, b), (a, b+1), (a, b+2))
s7 = st & set(t_p7)
ls7 = len(s7)
Js[ls7] += 1
if a < 3 or b > W-1 or b < 2:
pass
else:
t_p8 = ((a-2, b-1), (a-2, b), (a-2, b+1),\
(a-1, b-1), (a-1, b), (a-1, b+1),\
(a, b-1), (a, b), (a, b+1))
s8 = st & set(t_p8)
ls8 = len(s8)
Js[ls8] += 1
if a < 3 or b < 3:
pass
else:
t_p9 = ((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))
s9 = st & set(t_p9)
ls9 = len(s9)
Js[ls9] += 1
for i in range(1, 10):
Js[i] = Js[i] // i
all = (H - 2) * (W - 2)
Js[0] = all - sum(Js)
for i in range(10):
print(Js[i]) |
[
7,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
17,
28,
13,
13,
13,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
2,
4,
13,
2,
13,
17,
2,
13,
17,
17,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
2,
4,
13,
2,
13,
17,
2,
13,
17,
17,
0,
13,
39,
13,
13,
14,
40,
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,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
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,
13,
13,
10,
17,
13,
10,
13,
13,
10,
39,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13
] | [
[
4,
3
],
[
3,
12
],
[
173,
14
],
[
173,
16
],
[
173,
17
],
[
21,
20
],
[
174,
23
],
[
155,
34
],
[
158,
37
],
[
45,
44
],
[
171,
57
],
[
65,
64
],
[
162,
77
],
[
164,
84
],
[
165,
91
],
[
159,
92
],
[
97,
94
],
[
159,
95
],
[
165,
96
],
[
102,
99
],
[
159,
100
],
[
165,
101
],
[
106,
105
],
[
105,
111
],
[
167,
114
],
[
118,
117
],
[
159,
120
],
[
126,
123
],
[
168,
124
],
[
117,
125
],
[
171,
132
],
[
162,
135
],
[
168,
141
],
[
145,
144
],
[
168,
152
],
[
144,
153
],
[
155,
156
],
[
158,
159
],
[
173,
162
],
[
164,
165
],
[
167,
168
],
[
173,
171
],
[
173,
174
]
] | [
"H, W, N = [int(v) for v in input().split()]\npoints = (map(int, input().split()) for _ in range(N))\nmemory = {}\nfor ai, bi in points:\n for i in range(max(2, ai - 1), min(H - 1, ai + 1) + 1):\n for j in range(max(2, bi - 1), min(W - 1, bi + 1) + 1):\n key = (i, j)\n if not key in memory:\n memory[key] = 0\n memory[key] += 1\n\ncounter = {i: 0 for i in range(1, 10)}\nfor v in memory.values():\n counter[v] += 1\n\nprint((H - 2) * (W - 2) - sum(counter.values()))\nfor i in range(1, 10):\n print(counter[i])",
"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",
"map(int, input().split()) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"points = (map(int, input().split()) for _ in range(N))",
"points",
"(map(int, input().split()) for _ in range(N))",
"memory = {}",
"memory",
"{}",
"for ai, bi in points:\n for i in range(max(2, ai - 1), min(H - 1, ai + 1) + 1):\n for j in range(max(2, bi - 1), min(W - 1, bi + 1) + 1):\n key = (i, j)\n if not key in memory:\n memory[key] = 0\n memory[key] += 1",
"ai",
"bi",
"points",
"for i in range(max(2, ai - 1), min(H - 1, ai + 1) + 1):\n for j in range(max(2, bi - 1), min(W - 1, bi + 1) + 1):\n key = (i, j)\n if not key in memory:\n memory[key] = 0\n memory[key] += 1",
"i",
"range(max(2, ai - 1), min(H - 1, ai + 1) + 1)",
"range",
"max(2, ai - 1)",
"max",
"2",
"ai - 1",
"ai",
"1",
"min(H - 1, ai + 1) + 1",
"min(H - 1, ai + 1)",
"min",
"H - 1",
"H",
"1",
"ai + 1",
"ai",
"1",
"1",
"for j in range(max(2, bi - 1), min(W - 1, bi + 1) + 1):\n key = (i, j)\n if not key in memory:\n memory[key] = 0\n memory[key] += 1",
"j",
"range(max(2, bi - 1), min(W - 1, bi + 1) + 1)",
"range",
"max(2, bi - 1)",
"max",
"2",
"bi - 1",
"bi",
"1",
"min(W - 1, bi + 1) + 1",
"min(W - 1, bi + 1)",
"min",
"W - 1",
"W",
"1",
"bi + 1",
"bi",
"1",
"1",
"key = (i, j)",
"key",
"(i, j)",
"i",
"j",
"if not key in memory:\n memory[key] = 0\n ",
"not key in memory",
"key in memory",
"key",
"memory",
"memory[key] = 0",
"memory[key]",
"memory",
"key",
"0",
"memory[key] += 1",
"memory[key]",
"memory",
"key",
"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",
"counter = {i: 0 for i in range(1, 10)}",
"counter",
"{i: 0 for i in range(1, 10)}",
"for v in memory.values():\n counter[v] += 1",
"v",
"memory.values()",
"memory.values",
"memory",
"values",
"counter[v] += 1",
"counter[v]",
"counter",
"v",
"1",
"print((H - 2) * (W - 2) - sum(counter.values()))",
"print",
"(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 i in range(1, 10):\n print(counter[i])",
"i",
"range(1, 10)",
"range",
"1",
"10",
"print(counter[i])",
"print",
"counter[i]",
"counter",
"i",
"points = (map(int, input().split()) for _ in range(N))",
"(map(int, input().split()) for _ in range(N))",
"points",
"memory = {}",
"{}",
"memory",
"W, N = [int(v) for v in input().split()]",
"[int(v) for v in input().split()]",
"W",
"key = (i, j)",
"(i, j)",
"key",
"counter = {i: 0 for i in range(1, 10)}",
"{i: 0 for i in range(1, 10)}",
"counter",
"H, W, N = [int(v) for v in input().split()]",
"[int(v) for v in input().split()]",
"H",
"N = [int(v) for v in input().split()]",
"[int(v) for v in input().split()]",
"N"
] | H, W, N = [int(v) for v in input().split()]
points = (map(int, input().split()) for _ in range(N))
memory = {}
for ai, bi in points:
for i in range(max(2, ai - 1), min(H - 1, ai + 1) + 1):
for j in range(max(2, bi - 1), min(W - 1, bi + 1) + 1):
key = (i, j)
if not key in memory:
memory[key] = 0
memory[key] += 1
counter = {i: 0 for i in range(1, 10)}
for v in memory.values():
counter[v] += 1
print((H - 2) * (W - 2) - sum(counter.values()))
for i in range(1, 10):
print(counter[i])
|
[
7,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
17,
0,
13,
13,
41,
28,
13,
4,
13,
13,
4,
17,
0,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
14,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
13,
2,
13,
13,
14,
40,
4,
18,
17,
13,
13,
13,
4,
18,
13,
13,
0,
18,
13,
4,
18,
17,
13,
13,
13,
17,
0,
18,
13,
4,
18,
17,
13,
13,
13,
17,
14,
2,
2,
2,
2,
13,
17,
2,
13,
17,
40,
13,
13,
40,
13,
13,
14,
40,
4,
18,
17,
13,
2,
13,
17,
2,
13,
17,
4,
18,
13,
13,
0,
18,
13,
4,
18,
17,
13,
2,
13,
17,
2,
13,
17,
17,
0,
18,
13,
4,
18,
17,
13,
2,
13,
17,
2,
13,
17,
17,
14,
2,
2,
2,
2,
13,
17,
2,
13,
17,
40,
13,
13,
2,
13,
13,
14,
40,
4,
18,
17,
13,
2,
13,
17,
13,
4,
18,
13,
13,
0,
18,
13,
4,
18,
17,
13,
2,
13,
17,
13,
17,
0,
18,
13,
4,
18,
17,
13,
2,
13,
17,
13,
17,
14,
2,
2,
2,
2,
13,
17,
2,
13,
17,
40,
13,
13,
2,
13,
2,
13,
17,
14,
40,
4,
18,
17,
13,
2,
13,
17,
2,
13,
17,
4,
18,
13,
13,
0,
18,
13,
4,
18,
17,
13,
2,
13,
17,
2,
13,
17,
17,
0,
18,
13,
4,
18,
17,
13,
2,
13,
17,
2,
13,
17,
17,
14,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
13,
40,
13,
13,
14,
40,
4,
18,
17,
13,
13,
2,
13,
17,
4,
18,
13,
13,
0,
18,
13,
4,
18,
17,
13,
13,
2,
13,
17,
17,
0,
18,
13,
4,
18,
17,
13,
13,
2,
13,
17,
17,
14,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
2,
13,
17,
2,
13,
2,
13,
17,
14,
40,
4,
18,
17,
13,
2,
13,
17,
2,
13,
17,
4,
18,
13,
13,
0,
18,
13,
4,
18,
17,
13,
2,
13,
17,
2,
13,
17,
17,
0,
18,
13,
4,
18,
17,
13,
2,
13,
17,
2,
13,
17,
17,
14,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
2,
13,
17,
2,
13,
13,
14,
40,
4,
18,
17,
13,
2,
13,
17,
13,
4,
18,
13,
13,
0,
18,
13,
4,
18,
17,
13,
2,
13,
17,
13,
17,
0,
18,
13,
4,
18,
17,
13,
2,
13,
17,
13,
17,
14,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
13,
2,
13,
2,
13,
17,
14,
40,
4,
18,
17,
13,
13,
2,
13,
17,
4,
18,
13,
13,
0,
18,
13,
4,
18,
17,
13,
13,
2,
13,
17,
17,
0,
18,
13,
4,
18,
17,
13,
13,
2,
13,
17,
17,
14,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
2,
13,
17,
40,
13,
13,
14,
40,
4,
18,
17,
13,
2,
13,
17,
2,
13,
17,
4,
18,
13,
13,
0,
18,
13,
4,
18,
17,
13,
2,
13,
17,
2,
13,
17,
17,
0,
18,
13,
4,
18,
17,
13,
2,
13,
17,
2,
13,
17,
17,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
17,
13,
10,
13,
13
] | [
[
4,
3
],
[
3,
12
],
[
642,
14
],
[
642,
16
],
[
642,
17
],
[
21,
20
],
[
628,
23
],
[
630,
27
],
[
32,
31
],
[
628,
34
],
[
639,
38
],
[
645,
41
],
[
45,
44
],
[
628,
47
],
[
51,
50
],
[
50,
59
],
[
636,
61
],
[
636,
63
],
[
634,
69
],
[
637,
72
],
[
634,
75
],
[
625,
76
],
[
637,
78
],
[
643,
79
],
[
634,
86
],
[
637,
87
],
[
646,
90
],
[
101,
93
],
[
646,
94
],
[
634,
99
],
[
637,
100
],
[
111,
103
],
[
646,
104
],
[
634,
109
],
[
637,
110
],
[
634,
117
],
[
637,
120
],
[
634,
123
],
[
625,
124
],
[
637,
126
],
[
643,
127
],
[
634,
135
],
[
637,
138
],
[
646,
142
],
[
157,
145
],
[
646,
146
],
[
634,
152
],
[
637,
155
],
[
171,
159
],
[
646,
160
],
[
634,
166
],
[
637,
169
],
[
634,
177
],
[
637,
180
],
[
634,
183
],
[
625,
184
],
[
637,
186
],
[
643,
187
],
[
634,
195
],
[
637,
197
],
[
646,
200
],
[
213,
203
],
[
646,
204
],
[
634,
210
],
[
637,
212
],
[
225,
215
],
[
646,
216
],
[
634,
222
],
[
637,
224
],
[
634,
231
],
[
637,
234
],
[
634,
237
],
[
625,
238
],
[
637,
240
],
[
643,
242
],
[
634,
251
],
[
637,
254
],
[
646,
258
],
[
273,
261
],
[
646,
262
],
[
634,
268
],
[
637,
271
],
[
287,
275
],
[
646,
276
],
[
634,
282
],
[
637,
285
],
[
634,
293
],
[
637,
296
],
[
634,
299
],
[
625,
300
],
[
637,
302
],
[
643,
303
],
[
634,
310
],
[
637,
312
],
[
646,
316
],
[
329,
319
],
[
646,
320
],
[
634,
325
],
[
637,
327
],
[
341,
331
],
[
646,
332
],
[
634,
337
],
[
637,
339
],
[
634,
347
],
[
637,
350
],
[
634,
353
],
[
625,
355
],
[
637,
358
],
[
643,
360
],
[
634,
369
],
[
637,
372
],
[
646,
376
],
[
391,
379
],
[
646,
380
],
[
634,
386
],
[
637,
389
],
[
405,
393
],
[
646,
394
],
[
634,
400
],
[
637,
403
],
[
634,
411
],
[
637,
414
],
[
634,
417
],
[
625,
419
],
[
637,
422
],
[
643,
423
],
[
634,
431
],
[
637,
433
],
[
646,
436
],
[
449,
439
],
[
646,
440
],
[
634,
446
],
[
637,
448
],
[
461,
451
],
[
646,
452
],
[
634,
458
],
[
637,
460
],
[
634,
467
],
[
637,
470
],
[
634,
473
],
[
625,
474
],
[
637,
476
],
[
643,
478
],
[
634,
486
],
[
637,
488
],
[
646,
492
],
[
505,
495
],
[
646,
496
],
[
634,
501
],
[
637,
503
],
[
517,
507
],
[
646,
508
],
[
634,
513
],
[
637,
515
],
[
634,
523
],
[
637,
526
],
[
634,
529
],
[
625,
531
],
[
637,
534
],
[
643,
535
],
[
634,
543
],
[
637,
546
],
[
646,
550
],
[
565,
553
],
[
646,
554
],
[
634,
560
],
[
637,
563
],
[
579,
567
],
[
646,
568
],
[
634,
574
],
[
637,
577
],
[
583,
582
],
[
648,
589
],
[
593,
592
],
[
646,
595
],
[
601,
598
],
[
649,
599
],
[
592,
600
],
[
606,
603
],
[
649,
604
],
[
625,
609
],
[
643,
612
],
[
646,
616
],
[
619,
618
],
[
649,
618
],
[
618,
622
],
[
642,
625
],
[
642,
628
],
[
630,
631
],
[
636,
634
],
[
636,
637
],
[
639,
640
],
[
642,
643
],
[
645,
646
],
[
648,
649
]
] | [
"h, w, n = [int(i) for i in input().split()]\nA = [0 for _ in range(n)]\nB = [0 for _ in range(n)]\ncnt = {}\n\n\nfor i in range(n):\n\ta, b = [int(j) for j in input().split()]\n\tif a > 1 and b > 1 and a < h and b < w:\n\t\tif \"{} {}\".format(a, b) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a, b)] = 0\n\t\tcnt[\"{} {}\".format(a, b)] += 1\n\tif a > 2 and b > 2 and a <= h and b <= w:\t\n\t\tif \"{} {}\".format(a-1, b-1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a-1, b-1)] = 0\n\t\tcnt[\"{} {}\".format(a-1, b-1)] += 1\n\tif a > 2 and b > 1 and a <= h and b < w:\t\n\t\tif \"{} {}\".format(a-1, b) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a-1, b)] = 0\n\t\tcnt[\"{} {}\".format(a-1, b)] += 1\n\tif a > 2 and b > 0 and a <= h and b < w-1:\n\t\tif \"{} {}\".format(a-1, b+1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a-1, b+1)] = 0\n\t\tcnt[\"{} {}\".format(a-1, b+1)] += 1\n\tif a > 1 and b > 2 and a < h and b <= w:\n\t\tif \"{} {}\".format(a, b-1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a, b-1)] = 0\n\t\tcnt[\"{} {}\".format(a, b-1)] += 1\n\tif a > 0 and b > 0 and a < h-1 and b < w-1:\n\t\tif \"{} {}\".format(a+1, b+1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a+1, b+1)] = 0\n\t\tcnt[\"{} {}\".format(a+1, b+1)] += 1\n\tif a > 0 and b > 1 and a < h-1 and b < w:\n\t\tif \"{} {}\".format(a+1, b) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a+1, b)] = 0\n\t\tcnt[\"{} {}\".format(a+1, b)] += 1\n\tif a > 1 and b > 0 and a < h and b < w-1:\n\t\tif \"{} {}\".format(a, b+1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a, b+1)] = 0\n\t\tcnt[\"{} {}\".format(a, b+1)] += 1\n\tif a > 0 and b > 2 and a < h-1 and b <= w:\n\t\tif \"{} {}\".format(a+1, b-1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a+1, b-1)] = 0\n\t\tcnt[\"{} {}\".format(a+1, b-1)] += 1\n\ncount = [0 for i in range(10)]\nfor i in cnt.values():\n\tcount[i] += 1\ncount[0] = (h-2)*(w-2) - len(cnt)\n\nfor i in count:\n\tprint(i)\n\n\n",
"int(i) for i in input().split()",
"for i in input().split()",
"i",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in input().split()",
"int(i)",
"int",
"i",
"h, w, n = [int(i) for i in input().split()]",
"h",
"[int(i) for i in input().split()]",
"w",
"n",
"0 for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"0",
"A = [0 for _ in range(n)]",
"A",
"[0 for _ in range(n)]",
"0 for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"0",
"B = [0 for _ in range(n)]",
"B",
"[0 for _ in range(n)]",
"cnt = {}",
"cnt",
"{}",
"for i in range(n):\n\ta, b = [int(j) for j in input().split()]\n\tif a > 1 and b > 1 and a < h and b < w:\n\t\tif \"{} {}\".format(a, b) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a, b)] = 0\n\t\tcnt[\"{} {}\".format(a, b)] += 1\n\tif a > 2 and b > 2 and a <= h and b <= w:\t\n\t\tif \"{} {}\".format(a-1, b-1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a-1, b-1)] = 0\n\t\tcnt[\"{} {}\".format(a-1, b-1)] += 1\n\tif a > 2 and b > 1 and a <= h and b < w:\t\n\t\tif \"{} {}\".format(a-1, b) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a-1, b)] = 0\n\t\tcnt[\"{} {}\".format(a-1, b)] += 1\n\tif a > 2 and b > 0 and a <= h and b < w-1:\n\t\tif \"{} {}\".format(a-1, b+1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a-1, b+1)] = 0\n\t\tcnt[\"{} {}\".format(a-1, b+1)] += 1\n\tif a > 1 and b > 2 and a < h and b <= w:\n\t\tif \"{} {}\".format(a, b-1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a, b-1)] = 0\n\t\tcnt[\"{} {}\".format(a, b-1)] += 1\n\tif a > 0 and b > 0 and a < h-1 and b < w-1:\n\t\tif \"{} {}\".format(a+1, b+1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a+1, b+1)] = 0\n\t\tcnt[\"{} {}\".format(a+1, b+1)] += 1\n\tif a > 0 and b > 1 and a < h-1 and b < w:\n\t\tif \"{} {}\".format(a+1, b) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a+1, b)] = 0\n\t\tcnt[\"{} {}\".format(a+1, b)] += 1\n\tif a > 1 and b > 0 and a < h and b < w-1:\n\t\tif \"{} {}\".format(a, b+1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a, b+1)] = 0\n\t\tcnt[\"{} {}\".format(a, b+1)] += 1\n\tif a > 0 and b > 2 and a < h-1 and b <= w:\n\t\tif \"{} {}\".format(a+1, b-1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a+1, b-1)] = 0\n\t\tcnt[\"{} {}\".format(a+1, b-1)] += 1",
"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, b = [int(j) for j in input().split()]",
"a",
"[int(j) for j in input().split()]",
"b",
"if a > 1 and b > 1 and a < h and b < w:\n\t\tif \"{} {}\".format(a, b) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a, b)] = 0\n\t\tcnt[\"{} {}\".format(a, b)] += 1\n\t",
"a > 1 and b > 1 and a < h and b < w",
"a > 1 and b > 1 and a < h",
"a > 1 and b > 1",
"a > 1",
"a",
"1",
"b > 1",
"b",
"1",
"a < h",
"a",
"h",
"b < w",
"b",
"w",
"if \"{} {}\".format(a, b) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a, b)] = 0\n\t\t",
"\"{} {}\".format(a, b) not in cnt.keys()",
"\"{} {}\".format(a, b)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a",
"b",
"cnt.keys()",
"cnt.keys",
"cnt",
"keys",
"cnt[\"{} {}\".format(a, b)] = 0",
"cnt[\"{} {}\".format(a, b)]",
"cnt",
"\"{} {}\".format(a, b)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a",
"b",
"0",
"cnt[\"{} {}\".format(a, b)] += 1",
"cnt[\"{} {}\".format(a, b)]",
"cnt",
"\"{} {}\".format(a, b)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a",
"b",
"1",
"if a > 2 and b > 2 and a <= h and b <= w:\t\n\t\tif \"{} {}\".format(a-1, b-1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a-1, b-1)] = 0\n\t\tcnt[\"{} {}\".format(a-1, b-1)] += 1\n\t",
"a > 2 and b > 2 and a <= h and b <= w",
"a > 2 and b > 2 and a <= h",
"a > 2 and b > 2",
"a > 2",
"a",
"2",
"b > 2",
"b",
"2",
"a <= h",
"a",
"h",
"b <= w",
"b",
"w",
"if \"{} {}\".format(a-1, b-1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a-1, b-1)] = 0\n\t\t",
"\"{} {}\".format(a-1, b-1) not in cnt.keys()",
"\"{} {}\".format(a-1, b-1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"cnt.keys()",
"cnt.keys",
"cnt",
"keys",
"cnt[\"{} {}\".format(a-1, b-1)] = 0",
"cnt[\"{} {}\".format(a-1, b-1)]",
"cnt",
"\"{} {}\".format(a-1, b-1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"0",
"cnt[\"{} {}\".format(a-1, b-1)] += 1",
"cnt[\"{} {}\".format(a-1, b-1)]",
"cnt",
"\"{} {}\".format(a-1, b-1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a-1",
"a",
"1",
"b-1",
"b",
"1",
"1",
"if a > 2 and b > 1 and a <= h and b < w:\t\n\t\tif \"{} {}\".format(a-1, b) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a-1, b)] = 0\n\t\tcnt[\"{} {}\".format(a-1, b)] += 1\n\t",
"a > 2 and b > 1 and a <= h and b < w",
"a > 2 and b > 1 and a <= h",
"a > 2 and b > 1",
"a > 2",
"a",
"2",
"b > 1",
"b",
"1",
"a <= h",
"a",
"h",
"b < w",
"b",
"w",
"if \"{} {}\".format(a-1, b) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a-1, b)] = 0\n\t\t",
"\"{} {}\".format(a-1, b) not in cnt.keys()",
"\"{} {}\".format(a-1, b)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a-1",
"a",
"1",
"b",
"cnt.keys()",
"cnt.keys",
"cnt",
"keys",
"cnt[\"{} {}\".format(a-1, b)] = 0",
"cnt[\"{} {}\".format(a-1, b)]",
"cnt",
"\"{} {}\".format(a-1, b)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a-1",
"a",
"1",
"b",
"0",
"cnt[\"{} {}\".format(a-1, b)] += 1",
"cnt[\"{} {}\".format(a-1, b)]",
"cnt",
"\"{} {}\".format(a-1, b)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a-1",
"a",
"1",
"b",
"1",
"if a > 2 and b > 0 and a <= h and b < w-1:\n\t\tif \"{} {}\".format(a-1, b+1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a-1, b+1)] = 0\n\t\tcnt[\"{} {}\".format(a-1, b+1)] += 1\n\t",
"a > 2 and b > 0 and a <= h and b < w-1",
"a > 2 and b > 0 and a <= h",
"a > 2 and b > 0",
"a > 2",
"a",
"2",
"b > 0",
"b",
"0",
"a <= h",
"a",
"h",
"b < w-1",
"b",
"w-1",
"w",
"1",
"if \"{} {}\".format(a-1, b+1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a-1, b+1)] = 0\n\t\t",
"\"{} {}\".format(a-1, b+1) not in cnt.keys()",
"\"{} {}\".format(a-1, b+1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a-1",
"a",
"1",
"b+1",
"b",
"1",
"cnt.keys()",
"cnt.keys",
"cnt",
"keys",
"cnt[\"{} {}\".format(a-1, b+1)] = 0",
"cnt[\"{} {}\".format(a-1, b+1)]",
"cnt",
"\"{} {}\".format(a-1, b+1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a-1",
"a",
"1",
"b+1",
"b",
"1",
"0",
"cnt[\"{} {}\".format(a-1, b+1)] += 1",
"cnt[\"{} {}\".format(a-1, b+1)]",
"cnt",
"\"{} {}\".format(a-1, b+1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a-1",
"a",
"1",
"b+1",
"b",
"1",
"1",
"if a > 1 and b > 2 and a < h and b <= w:\n\t\tif \"{} {}\".format(a, b-1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a, b-1)] = 0\n\t\tcnt[\"{} {}\".format(a, b-1)] += 1\n\t",
"a > 1 and b > 2 and a < h and b <= w",
"a > 1 and b > 2 and a < h",
"a > 1 and b > 2",
"a > 1",
"a",
"1",
"b > 2",
"b",
"2",
"a < h",
"a",
"h",
"b <= w",
"b",
"w",
"if \"{} {}\".format(a, b-1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a, b-1)] = 0\n\t\t",
"\"{} {}\".format(a, b-1) not in cnt.keys()",
"\"{} {}\".format(a, b-1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a",
"b-1",
"b",
"1",
"cnt.keys()",
"cnt.keys",
"cnt",
"keys",
"cnt[\"{} {}\".format(a, b-1)] = 0",
"cnt[\"{} {}\".format(a, b-1)]",
"cnt",
"\"{} {}\".format(a, b-1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a",
"b-1",
"b",
"1",
"0",
"cnt[\"{} {}\".format(a, b-1)] += 1",
"cnt[\"{} {}\".format(a, b-1)]",
"cnt",
"\"{} {}\".format(a, b-1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a",
"b-1",
"b",
"1",
"1",
"if a > 0 and b > 0 and a < h-1 and b < w-1:\n\t\tif \"{} {}\".format(a+1, b+1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a+1, b+1)] = 0\n\t\tcnt[\"{} {}\".format(a+1, b+1)] += 1\n\t",
"a > 0 and b > 0 and a < h-1 and b < w-1",
"a > 0 and b > 0 and a < h-1",
"a > 0 and b > 0",
"a > 0",
"a",
"0",
"b > 0",
"b",
"0",
"a < h-1",
"a",
"h-1",
"h",
"1",
"b < w-1",
"b",
"w-1",
"w",
"1",
"if \"{} {}\".format(a+1, b+1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a+1, b+1)] = 0\n\t\t",
"\"{} {}\".format(a+1, b+1) not in cnt.keys()",
"\"{} {}\".format(a+1, b+1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a+1",
"a",
"1",
"b+1",
"b",
"1",
"cnt.keys()",
"cnt.keys",
"cnt",
"keys",
"cnt[\"{} {}\".format(a+1, b+1)] = 0",
"cnt[\"{} {}\".format(a+1, b+1)]",
"cnt",
"\"{} {}\".format(a+1, b+1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a+1",
"a",
"1",
"b+1",
"b",
"1",
"0",
"cnt[\"{} {}\".format(a+1, b+1)] += 1",
"cnt[\"{} {}\".format(a+1, b+1)]",
"cnt",
"\"{} {}\".format(a+1, b+1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a+1",
"a",
"1",
"b+1",
"b",
"1",
"1",
"if a > 0 and b > 1 and a < h-1 and b < w:\n\t\tif \"{} {}\".format(a+1, b) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a+1, b)] = 0\n\t\tcnt[\"{} {}\".format(a+1, b)] += 1\n\t",
"a > 0 and b > 1 and a < h-1 and b < w",
"a > 0 and b > 1 and a < h-1",
"a > 0 and b > 1",
"a > 0",
"a",
"0",
"b > 1",
"b",
"1",
"a < h-1",
"a",
"h-1",
"h",
"1",
"b < w",
"b",
"w",
"if \"{} {}\".format(a+1, b) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a+1, b)] = 0\n\t\t",
"\"{} {}\".format(a+1, b) not in cnt.keys()",
"\"{} {}\".format(a+1, b)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a+1",
"a",
"1",
"b",
"cnt.keys()",
"cnt.keys",
"cnt",
"keys",
"cnt[\"{} {}\".format(a+1, b)] = 0",
"cnt[\"{} {}\".format(a+1, b)]",
"cnt",
"\"{} {}\".format(a+1, b)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a+1",
"a",
"1",
"b",
"0",
"cnt[\"{} {}\".format(a+1, b)] += 1",
"cnt[\"{} {}\".format(a+1, b)]",
"cnt",
"\"{} {}\".format(a+1, b)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a+1",
"a",
"1",
"b",
"1",
"if a > 1 and b > 0 and a < h and b < w-1:\n\t\tif \"{} {}\".format(a, b+1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a, b+1)] = 0\n\t\tcnt[\"{} {}\".format(a, b+1)] += 1\n\t",
"a > 1 and b > 0 and a < h and b < w-1",
"a > 1 and b > 0 and a < h",
"a > 1 and b > 0",
"a > 1",
"a",
"1",
"b > 0",
"b",
"0",
"a < h",
"a",
"h",
"b < w-1",
"b",
"w-1",
"w",
"1",
"if \"{} {}\".format(a, b+1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a, b+1)] = 0\n\t\t",
"\"{} {}\".format(a, b+1) not in cnt.keys()",
"\"{} {}\".format(a, b+1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a",
"b+1",
"b",
"1",
"cnt.keys()",
"cnt.keys",
"cnt",
"keys",
"cnt[\"{} {}\".format(a, b+1)] = 0",
"cnt[\"{} {}\".format(a, b+1)]",
"cnt",
"\"{} {}\".format(a, b+1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a",
"b+1",
"b",
"1",
"0",
"cnt[\"{} {}\".format(a, b+1)] += 1",
"cnt[\"{} {}\".format(a, b+1)]",
"cnt",
"\"{} {}\".format(a, b+1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a",
"b+1",
"b",
"1",
"1",
"if a > 0 and b > 2 and a < h-1 and b <= w:\n\t\tif \"{} {}\".format(a+1, b-1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a+1, b-1)] = 0\n\t\tcnt[\"{} {}\".format(a+1, b-1)] += 1",
"a > 0 and b > 2 and a < h-1 and b <= w",
"a > 0 and b > 2 and a < h-1",
"a > 0 and b > 2",
"a > 0",
"a",
"0",
"b > 2",
"b",
"2",
"a < h-1",
"a",
"h-1",
"h",
"1",
"b <= w",
"b",
"w",
"if \"{} {}\".format(a+1, b-1) not in cnt.keys():\n\t\t\tcnt[\"{} {}\".format(a+1, b-1)] = 0\n\t\t",
"\"{} {}\".format(a+1, b-1) not in cnt.keys()",
"\"{} {}\".format(a+1, b-1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a+1",
"a",
"1",
"b-1",
"b",
"1",
"cnt.keys()",
"cnt.keys",
"cnt",
"keys",
"cnt[\"{} {}\".format(a+1, b-1)] = 0",
"cnt[\"{} {}\".format(a+1, b-1)]",
"cnt",
"\"{} {}\".format(a+1, b-1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a+1",
"a",
"1",
"b-1",
"b",
"1",
"0",
"cnt[\"{} {}\".format(a+1, b-1)] += 1",
"cnt[\"{} {}\".format(a+1, b-1)]",
"cnt",
"\"{} {}\".format(a+1, b-1)",
"\"{} {}\".format",
"\"{} {}\"",
"format",
"a+1",
"a",
"1",
"b-1",
"b",
"1",
"1",
"0 for i in range(10)",
"for i in range(10)",
"i",
"range(10)",
"range",
"10",
"for i in range(10)",
"0",
"count = [0 for i in range(10)]",
"count",
"[0 for i in range(10)]",
"for i in cnt.values():\n\tcount[i] += 1",
"i",
"cnt.values()",
"cnt.values",
"cnt",
"values",
"count[i] += 1",
"count[i]",
"count",
"i",
"1",
"count[0] = (h-2)*(w-2) - len(cnt)",
"count[0]",
"count",
"0",
"(h-2)*(w-2) - len(cnt)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"len(cnt)",
"len",
"cnt",
"for i in count:\n\tprint(i)",
"i",
"count",
"print(i)",
"print",
"i",
"h, w, n = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"h",
"n = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"n",
"A = [0 for _ in range(n)]",
"[0 for _ in range(n)]",
"A",
"a, b = [int(j) for j in input().split()]",
"[int(j) for j in input().split()]",
"a",
"b = [int(j) for j in input().split()]",
"[int(j) for j in input().split()]",
"b",
"B = [0 for _ in range(n)]",
"[0 for _ in range(n)]",
"B",
"w, n = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"w",
"cnt = {}",
"{}",
"cnt",
"count = [0 for i in range(10)]",
"[0 for i in range(10)]",
"count"
] | h, w, n = [int(i) for i in input().split()]
A = [0 for _ in range(n)]
B = [0 for _ in range(n)]
cnt = {}
for i in range(n):
a, b = [int(j) for j in input().split()]
if a > 1 and b > 1 and a < h and b < w:
if "{} {}".format(a, b) not in cnt.keys():
cnt["{} {}".format(a, b)] = 0
cnt["{} {}".format(a, b)] += 1
if a > 2 and b > 2 and a <= h and b <= w:
if "{} {}".format(a-1, b-1) not in cnt.keys():
cnt["{} {}".format(a-1, b-1)] = 0
cnt["{} {}".format(a-1, b-1)] += 1
if a > 2 and b > 1 and a <= h and b < w:
if "{} {}".format(a-1, b) not in cnt.keys():
cnt["{} {}".format(a-1, b)] = 0
cnt["{} {}".format(a-1, b)] += 1
if a > 2 and b > 0 and a <= h and b < w-1:
if "{} {}".format(a-1, b+1) not in cnt.keys():
cnt["{} {}".format(a-1, b+1)] = 0
cnt["{} {}".format(a-1, b+1)] += 1
if a > 1 and b > 2 and a < h and b <= w:
if "{} {}".format(a, b-1) not in cnt.keys():
cnt["{} {}".format(a, b-1)] = 0
cnt["{} {}".format(a, b-1)] += 1
if a > 0 and b > 0 and a < h-1 and b < w-1:
if "{} {}".format(a+1, b+1) not in cnt.keys():
cnt["{} {}".format(a+1, b+1)] = 0
cnt["{} {}".format(a+1, b+1)] += 1
if a > 0 and b > 1 and a < h-1 and b < w:
if "{} {}".format(a+1, b) not in cnt.keys():
cnt["{} {}".format(a+1, b)] = 0
cnt["{} {}".format(a+1, b)] += 1
if a > 1 and b > 0 and a < h and b < w-1:
if "{} {}".format(a, b+1) not in cnt.keys():
cnt["{} {}".format(a, b+1)] = 0
cnt["{} {}".format(a, b+1)] += 1
if a > 0 and b > 2 and a < h-1 and b <= w:
if "{} {}".format(a+1, b-1) not in cnt.keys():
cnt["{} {}".format(a+1, b-1)] = 0
cnt["{} {}".format(a+1, b-1)] += 1
count = [0 for i in range(10)]
for i in cnt.values():
count[i] += 1
count[0] = (h-2)*(w-2) - len(cnt)
for i in count:
print(i)
|
[
7,
15,
13,
15,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
39,
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,
18,
13,
2,
2,
2,
13,
17,
13,
2,
13,
17,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
28,
13,
4,
13,
4,
13,
2,
18,
13,
17,
17,
17,
4,
13,
2,
18,
13,
17,
17,
2,
13,
17,
28,
13,
4,
13,
4,
13,
2,
18,
13,
17,
17,
17,
4,
13,
2,
18,
13,
17,
17,
2,
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,
18,
13,
2,
2,
13,
13,
13,
17,
0,
13,
17,
0,
18,
13,
13,
17,
28,
13,
4,
13,
17,
17,
0,
18,
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,
17,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
222,
5
],
[
228,
12
],
[
223,
19
],
[
228,
21
],
[
228,
22
],
[
213,
24
],
[
204,
29
],
[
33,
32
],
[
226,
35
],
[
231,
37
],
[
223,
44
],
[
231,
46
],
[
205,
49
],
[
232,
53
],
[
208,
56
],
[
70,
59
],
[
214,
60
],
[
232,
64
],
[
211,
66
],
[
208,
68
],
[
216,
72
],
[
79,
78
],
[
205,
78
],
[
82,
81
],
[
78,
88
],
[
78,
96
],
[
229,
100
],
[
104,
103
],
[
78,
110
],
[
78,
118
],
[
211,
122
],
[
201,
125
],
[
129,
128
],
[
81,
132
],
[
81,
135
],
[
139,
138
],
[
103,
142
],
[
103,
145
],
[
214,
150
],
[
128,
153
],
[
211,
154
],
[
138,
155
],
[
219,
158
],
[
164,
161
],
[
217,
162
],
[
220,
163
],
[
202,
163
],
[
167,
166
],
[
175,
172
],
[
217,
173
],
[
166,
174
],
[
166,
175
],
[
229,
181
],
[
211,
184
],
[
217,
188
],
[
191,
190
],
[
172,
197
],
[
217,
198
],
[
190,
199
],
[
201,
202
],
[
204,
205
],
[
231,
208
],
[
228,
211
],
[
213,
214
],
[
216,
217
],
[
219,
220
],
[
222,
223
],
[
228,
226
],
[
228,
229
],
[
231,
232
]
] | [
"import sys\nfrom collections import defaultdict\ninput = sys.stdin.readline\nH, W, N = map(int, input().split())\n\nboard = defaultdict(int)\nblack = []\nfor _ in range(N):\n a, b = map(int, input().split())\n black.append((a - 1, b - 1))\n board[(a-1) * W + (b - 1)] = 1\n\nnum = [0] * 10\nfor p in black:\n for ch in range(max(p[0] - 1, 1), min(p[0] + 2, H - 1)):\n for cw in range(max(p[1] - 1, 1), min(p[1] + 2, W - 1)):\n count = 0\n for h in range(ch - 1, ch + 2):\n for w in range(cw - 1, cw + 2):\n if board[h * W + w] == 1:\n count += 1\n num[count] += 1\nfor i in range(1, 10):\n num[i] //= i\nprint((H - 2) * (W - 2) - sum(num))\nfor i in range(1, 10):\n print(num[i])",
"import sys",
"sys",
"from collections import defaultdict",
"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",
"board = defaultdict(int)",
"board",
"defaultdict(int)",
"defaultdict",
"int",
"black = []",
"black",
"[]",
"for _ in range(N):\n a, b = map(int, input().split())\n black.append((a - 1, b - 1))\n board[(a-1) * W + (b - 1)] = 1",
"_",
"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",
"board[(a-1) * W + (b - 1)] = 1",
"board[(a-1) * W + (b - 1)]",
"board",
"(a-1) * W + (b - 1)",
"(a-1) * W",
"a-1",
"a",
"1",
"W",
"b - 1",
"b",
"1",
"1",
"num = [0] * 10",
"num",
"[0] * 10",
"[0]",
"0",
"10",
"for p in black:\n for ch in range(max(p[0] - 1, 1), min(p[0] + 2, H - 1)):\n for cw in range(max(p[1] - 1, 1), min(p[1] + 2, W - 1)):\n count = 0\n for h in range(ch - 1, ch + 2):\n for w in range(cw - 1, cw + 2):\n if board[h * W + w] == 1:\n count += 1\n num[count] += 1",
"p",
"black",
"for ch in range(max(p[0] - 1, 1), min(p[0] + 2, H - 1)):\n for cw in range(max(p[1] - 1, 1), min(p[1] + 2, W - 1)):\n count = 0\n for h in range(ch - 1, ch + 2):\n for w in range(cw - 1, cw + 2):\n if board[h * W + w] == 1:\n count += 1\n num[count] += 1",
"ch",
"range(max(p[0] - 1, 1), min(p[0] + 2, H - 1))",
"range",
"max(p[0] - 1, 1)",
"max",
"p[0] - 1",
"p[0]",
"p",
"0",
"1",
"1",
"min(p[0] + 2, H - 1)",
"min",
"p[0] + 2",
"p[0]",
"p",
"0",
"2",
"H - 1",
"H",
"1",
"for cw in range(max(p[1] - 1, 1), min(p[1] + 2, W - 1)):\n count = 0\n for h in range(ch - 1, ch + 2):\n for w in range(cw - 1, cw + 2):\n if board[h * W + w] == 1:\n count += 1\n num[count] += 1",
"cw",
"range(max(p[1] - 1, 1), min(p[1] + 2, W - 1))",
"range",
"max(p[1] - 1, 1)",
"max",
"p[1] - 1",
"p[1]",
"p",
"1",
"1",
"1",
"min(p[1] + 2, W - 1)",
"min",
"p[1] + 2",
"p[1]",
"p",
"1",
"2",
"W - 1",
"W",
"1",
"count = 0",
"count",
"0",
"for h in range(ch - 1, ch + 2):\n for w in range(cw - 1, cw + 2):\n if board[h * W + w] == 1:\n count += 1\n ",
"h",
"range(ch - 1, ch + 2)",
"range",
"ch - 1",
"ch",
"1",
"ch + 2",
"ch",
"2",
"for w in range(cw - 1, cw + 2):\n if board[h * W + w] == 1:\n count += 1\n ",
"w",
"range(cw - 1, cw + 2)",
"range",
"cw - 1",
"cw",
"1",
"cw + 2",
"cw",
"2",
"if board[h * W + w] == 1:\n count += 1\n ",
"board[h * W + w] == 1",
"board[h * W + w]",
"board",
"h * W + w",
"h * W",
"h",
"W",
"w",
"1",
"count += 1",
"count",
"1",
"num[count] += 1",
"num[count]",
"num",
"count",
"1",
"for i in range(1, 10):\n num[i] //= i",
"i",
"range(1, 10)",
"range",
"1",
"10",
"num[i] //= i",
"num[i]",
"num",
"i",
"i",
"print((H - 2) * (W - 2) - sum(num))",
"print",
"(H - 2) * (W - 2) - sum(num)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(num)",
"sum",
"num",
"for i in range(1, 10):\n print(num[i])",
"i",
"range(1, 10)",
"range",
"1",
"10",
"print(num[i])",
"print",
"num[i]",
"num",
"i",
"count = 0",
"0",
"count",
"black = []",
"[]",
"black",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"board = defaultdict(int)",
"defaultdict(int)",
"board",
"num = [0] * 10",
"[0] * 10",
"num",
"count += 1",
"1",
"count",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a"
] | import sys
from collections import defaultdict
input = sys.stdin.readline
H, W, N = map(int, input().split())
board = defaultdict(int)
black = []
for _ in range(N):
a, b = map(int, input().split())
black.append((a - 1, b - 1))
board[(a-1) * W + (b - 1)] = 1
num = [0] * 10
for p in black:
for ch in range(max(p[0] - 1, 1), min(p[0] + 2, H - 1)):
for cw in range(max(p[1] - 1, 1), min(p[1] + 2, W - 1)):
count = 0
for h in range(ch - 1, ch + 2):
for w in range(cw - 1, cw + 2):
if board[h * W + w] == 1:
count += 1
num[count] += 1
for i in range(1, 10):
num[i] //= i
print((H - 2) * (W - 2) - sum(num))
for i in range(1, 10):
print(num[i])
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
28,
13,
13,
13,
28,
13,
4,
13,
4,
13,
39,
2,
13,
17,
17,
2,
4,
13,
39,
13,
2,
13,
17,
17,
28,
13,
4,
13,
4,
13,
39,
2,
13,
17,
17,
2,
4,
13,
39,
13,
2,
13,
17,
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,
18,
13,
39,
17,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] | [
[
147,
3
],
[
147,
12
],
[
147,
13
],
[
17,
16
],
[
148,
19
],
[
138,
32
],
[
141,
35
],
[
45,
44
],
[
133,
60
],
[
65,
64
],
[
136,
80
],
[
89,
84
],
[
142,
85
],
[
144,
91
],
[
98,
97
],
[
142,
100
],
[
106,
103
],
[
145,
104
],
[
97,
105
],
[
111,
108
],
[
145,
109
],
[
133,
114
],
[
136,
117
],
[
145,
122
],
[
127,
126
],
[
145,
126
],
[
126,
130
],
[
147,
133
],
[
147,
136
],
[
138,
139
],
[
141,
142
],
[
144,
145
],
[
147,
148
]
] | [
"from collections import defaultdict\n\nH, W, N = map(int, input().split())\nab = [list(map(int, input().split())) for _ in range(N)]\nh = defaultdict(int)\nfor a, b in ab:\n for y in range(max([a - 2, 1]), min([a, H - 2]) + 1):\n for x in range(max([b - 2, 1]), min([b, W - 2]) + 1):\n h[(y, x)] += 1\n\nans = [0] * 10\nfor v in h.values():\n ans[v] += 1\nans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n\nfor a in ans:\n print(a)",
"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)]",
"h = defaultdict(int)",
"h",
"defaultdict(int)",
"defaultdict",
"int",
"for a, b in ab:\n for y in range(max([a - 2, 1]), min([a, H - 2]) + 1):\n for x in range(max([b - 2, 1]), min([b, W - 2]) + 1):\n h[(y, x)] += 1",
"a",
"b",
"ab",
"for y in range(max([a - 2, 1]), min([a, H - 2]) + 1):\n for x in range(max([b - 2, 1]), min([b, W - 2]) + 1):\n h[(y, x)] += 1",
"y",
"range(max([a - 2, 1]), min([a, H - 2]) + 1)",
"range",
"max([a - 2, 1])",
"max",
"[a - 2, 1]",
"a - 2",
"a",
"2",
"1",
"min([a, H - 2]) + 1",
"min([a, H - 2])",
"min",
"[a, H - 2]",
"a",
"H - 2",
"H",
"2",
"1",
"for x in range(max([b - 2, 1]), min([b, W - 2]) + 1):\n h[(y, x)] += 1",
"x",
"range(max([b - 2, 1]), min([b, W - 2]) + 1)",
"range",
"max([b - 2, 1])",
"max",
"[b - 2, 1]",
"b - 2",
"b",
"2",
"1",
"min([b, W - 2]) + 1",
"min([b, W - 2])",
"min",
"[b, W - 2]",
"b",
"W - 2",
"W",
"2",
"1",
"h[(y, x)] += 1",
"h[(y, x)]",
"h",
"(y, x)",
"y",
"x",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for v in h.values():\n ans[v] += 1",
"v",
"h.values()",
"h.values",
"h",
"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",
"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",
"h = defaultdict(int)",
"defaultdict(int)",
"h",
"ans = [0] * 10",
"[0] * 10",
"ans",
"N = map(int, input().split())",
"map(int, input().split())",
"N"
] | from collections import defaultdict
H, W, N = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
h = defaultdict(int)
for a, b in ab:
for y in range(max([a - 2, 1]), min([a, H - 2]) + 1):
for x in range(max([b - 2, 1]), min([b, W - 2]) + 1):
h[(y, x)] += 1
ans = [0] * 10
for v in h.values():
ans[v] += 1
ans[0] = (H - 2) * (W - 2) - sum(ans[1:])
for a in ans:
print(a) |
[
7,
15,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
15,
15,
4,
18,
13,
13,
2,
17,
17,
0,
13,
17,
0,
13,
17,
0,
13,
2,
17,
17,
0,
13,
4,
13,
17,
0,
13,
2,
17,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
39,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
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,
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,
17,
12,
13,
41,
28,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
4,
2,
4,
13,
13,
17,
12,
13,
12,
13,
12,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
18,
13,
13,
13,
28,
13,
4,
13,
13,
28,
13,
13,
13,
0,
13,
2,
18,
18,
13,
13,
17,
13,
0,
13,
2,
18,
18,
13,
13,
17,
13,
14,
2,
2,
2,
17,
13,
2,
13,
17,
2,
2,
17,
13,
2,
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,
4,
13,
10,
39,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13,
10,
2,
13,
10,
2,
13,
10,
39,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13,
10,
2,
13,
10,
12,
13,
10,
4,
13,
10,
17,
13,
10,
39,
13
] | [
[
407,
25
],
[
344,
28
],
[
350,
31
],
[
386,
36
],
[
335,
41
],
[
362,
48
],
[
365,
55
],
[
341,
70
],
[
410,
97
],
[
132,
131
],
[
131,
145
],
[
158,
157
],
[
369,
163
],
[
167,
167
],
[
171,
170
],
[
375,
176
],
[
180,
180
],
[
184,
183
],
[
393,
189
],
[
193,
193
],
[
197,
196
],
[
396,
202
],
[
206,
206
],
[
210,
209
],
[
333,
215
],
[
219,
219
],
[
383,
221
],
[
393,
223
],
[
383,
224
],
[
383,
225
],
[
404,
227
],
[
402,
229
],
[
348,
230
],
[
338,
232
],
[
240,
239
],
[
348,
242
],
[
359,
248
],
[
405,
252
],
[
239,
253
],
[
398,
257
],
[
405,
261
],
[
239,
262
],
[
360,
270
],
[
384,
272
],
[
399,
277
],
[
381,
279
],
[
293,
282
],
[
339,
283
],
[
399,
288
],
[
360,
292
],
[
389,
295
],
[
302,
301
],
[
339,
301
],
[
309,
304
],
[
390,
305
],
[
339,
307
],
[
301,
308
],
[
314,
311
],
[
390,
312
],
[
381,
317
],
[
384,
320
],
[
390,
324
],
[
327,
326
],
[
390,
326
],
[
326,
330
],
[
335,
336
],
[
338,
339
],
[
341,
342
],
[
344,
345
],
[
383,
348
],
[
350,
351
],
[
359,
360
],
[
362,
363
],
[
365,
366
],
[
383,
381
],
[
383,
384
],
[
386,
387
],
[
389,
390
],
[
398,
399
],
[
404,
405
],
[
407,
408
],
[
410,
411
]
] | [
"import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools, random\nfrom collections import deque\nfrom heapq import heappush, heappop\nsys.setrecursionlimit(10 ** 7)\nans = 0\ntmp = 0\ninf = 10 ** 20\nINF = float(\"INF\")\neps = 1.0 / 10 ** 10\nmod = 10 ** 9 + 7\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\nddn9 = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1), (0, 0)]\n\"\"\"for dx, dy in dd:\n nx = j + dx; ny = i + dy\n if 0 <= nx < w and 0 <= ny < h:\"\"\"\ndef wi(): return list(map(int, sys.stdin.readline().split()))\ndef wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint\ndef ws(): return sys.stdin.readline().split()\ndef i(): return int(sys.stdin.readline())\ndef s(): return input()\ndef hi(n): return [i() for _ in range(n)]\ndef hs(n): return [s() for _ in range(n)]#HeightString\ndef mi(n): return [wi() for _ in range(n)]#MatrixInt\ndef mip(n): return [wip() for _ in range(n)]\ndef ms(n): return [ws() for _ in range(n)]\n\nh, w, n = wi()\nc = mip(n)\n\nd = collections.defaultdict(int)\n\nfor i in range(n):\n for dx, dy in ddn9:\n nx = c[i][1] + dx;\n ny = c[i][0] + dy\n if 0 < nx < w - 1 and 0 < ny < h - 1:\n d[str(ny) + \"+\" + str(nx)] += 1#前のままだと,28+1,2+81とかがが被る\n\nansli = [0] * 10\nfor i in d:\n ansli[d[i]] += 1\n\nansli[0] = (h - 2) * (w - 2) - sum(ansli)\nfor i in ansli:\n print(i)",
"import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools, random",
"math",
"string",
"itertools",
"fractions",
"heapq",
"collections",
"re",
"array",
"bisect",
"sys",
"copy",
"functools",
"random",
"from collections import deque",
"from heapq import heappush, heappop",
"sys.setrecursionlimit(10 ** 7)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 7",
"10",
"7",
"ans = 0",
"ans",
"0",
"tmp = 0",
"tmp",
"0",
"inf = 10 ** 20",
"inf",
"10 ** 20",
"10",
"20",
"INF = float(\"INF\")",
"INF",
"float(\"INF\")",
"float",
"\"INF\"",
"eps = 1.0 / 10 ** 10",
"eps",
"1.0 / 10 ** 10",
"1.0",
"10 ** 10",
"10",
"10",
"mod = 10 ** 9 + 7",
"mod",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]",
"dd",
"[(-1, 0), (0, 1), (1, 0), (0, -1)]",
"(-1, 0)",
"-1",
"0",
"(0, 1)",
"0",
"1",
"(1, 0)",
"1",
"0",
"(0, -1)",
"0",
"-1",
"ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]",
"ddn",
"[(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]",
"(-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",
"ddn9 = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1), (0, 0)]",
"ddn9",
"[(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1), (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",
"(0, 0)",
"0",
"0",
"\"\"\"for dx, dy in dd:\n nx = j + dx; ny = i + dy\n if 0 <= nx < w and 0 <= ny < h:\"\"\"",
"def wi(): return list(map(int, sys.stdin.readline().split()))",
"wi",
"int(x) - 1 for x in sys.stdin.readline().split()",
"for x in sys.stdin.readline().split()",
"x",
"sys.stdin.readline().split()",
"sys.stdin.readline().split",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"split",
"for x in sys.stdin.readline().split()",
"int(x) - 1",
"int(x)",
"int",
"x",
"1",
"def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint",
"wip",
"def ws(): return sys.stdin.readline().split()",
"ws",
"def i(): return int(sys.stdin.readline())",
"i",
"def s(): return input()",
"s",
"i() for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"i()",
"i",
"def hi(n): return [i() for _ in range(n)]",
"hi",
"n",
"n",
"s() for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"s()",
"s",
"def hs(n): return [s() for _ in range(n)]#HeightString",
"hs",
"n",
"n",
"wi() for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"wi()",
"wi",
"def mi(n): return [wi() for _ in range(n)]#MatrixInt",
"mi",
"n",
"n",
"wip() for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"wip()",
"wip",
"def mip(n): return [wip() for _ in range(n)]",
"mip",
"n",
"n",
"ws() for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"ws()",
"ws",
"def ms(n): return [ws() for _ in range(n)]",
"ms",
"n",
"n",
"h, w, n = wi()",
"h",
"wi()",
"wi",
"w",
"n",
"c = mip(n)",
"c",
"mip(n)",
"mip",
"n",
"d = collections.defaultdict(int)",
"d",
"collections.defaultdict(int)",
"collections.defaultdict",
"collections",
"defaultdict",
"int",
"for i in range(n):\n for dx, dy in ddn9:\n nx = c[i][1] + dx;\n ny = c[i][0] + dy\n if 0 < nx < w - 1 and 0 < ny < h - 1:\n d[str(ny) + \"+\" + str(nx)] += 1#前のままだと,28+1,2+81とかがが被る",
"i",
"range(n)",
"range",
"n",
"for dx, dy in ddn9:\n nx = c[i][1] + dx;\n ny = c[i][0] + dy\n if 0 < nx < w - 1 and 0 < ny < h - 1:\n d[str(ny) + \"+\" + str(nx)] += 1#前のままだと,28+1,2+81とかがが被る",
"dx",
"dy",
"ddn9",
"nx = c[i][1] + dx",
"nx",
"c[i][1] + dx",
"c[i][1]",
"[i]",
"c",
"i",
"1",
"dx",
"ny = c[i][0] + dy",
"ny",
"c[i][0] + dy",
"c[i][0]",
"[i]",
"c",
"i",
"0",
"dy",
"if 0 < nx < w - 1 and 0 < ny < h - 1:\n d[str(ny) + \"+\" + str(nx)] += 1#前のままだと,28+1,2+81とかがが被る",
"0 < nx < w - 1 and 0 < ny < h - 1",
"0 < nx < w - 1",
"0 < nx",
"0",
"nx",
"w - 1",
"w",
"1",
"0 < ny < h - 1",
"0 < ny",
"0",
"ny",
"h - 1",
"h",
"1",
"d[str(ny) + \"+\" + str(nx)] += 1",
"d[str(ny) + \"+\" + str(nx)]",
"d",
"str(ny) + \"+\" + str(nx)",
"str(ny) + \"+\"",
"str(ny)",
"str",
"ny",
"\"+\"",
"str(nx)",
"str",
"nx",
"1",
"ansli = [0] * 10",
"ansli",
"[0] * 10",
"[0]",
"0",
"10",
"for i in d:\n ansli[d[i]] += 1",
"i",
"d",
"ansli[d[i]] += 1",
"ansli[d[i]]",
"ansli",
"d[i]",
"d",
"i",
"1",
"ansli[0] = (h - 2) * (w - 2) - sum(ansli)",
"ansli[0]",
"ansli",
"0",
"(h - 2) * (w - 2) - sum(ansli)",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"sum(ansli)",
"sum",
"ansli",
"for i in ansli:\n print(i)",
"i",
"ansli",
"print(i)",
"print",
"i",
"def ws(): return sys.stdin.readline().split()",
"def ws(): return sys.stdin.readline().split()",
"ws",
"eps = 1.0 / 10 ** 10",
"1.0 / 10 ** 10",
"eps",
"d = collections.defaultdict(int)",
"collections.defaultdict(int)",
"d",
"ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]",
"[(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]",
"ddn",
"tmp = 0",
"0",
"tmp",
"n = wi()",
"wi()",
"n",
"inf = 10 ** 20",
"10 ** 20",
"inf",
"def mi(n): return [wi() for _ in range(n)]#MatrixInt",
"def mi(n): return [wi() for _ in range(n)]#MatrixInt",
"mi",
"def ms(n): return [ws() for _ in range(n)]",
"def ms(n): return [ws() for _ in range(n)]",
"ms",
"nx = c[i][1] + dx",
"c[i][1] + dx",
"nx",
"mod = 10 ** 9 + 7",
"10 ** 9 + 7",
"mod",
"dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]",
"[(-1, 0), (0, 1), (1, 0), (0, -1)]",
"dd",
"def i(): return int(sys.stdin.readline())",
"def i(): return int(sys.stdin.readline())",
"i",
"def hs(n): return [s() for _ in range(n)]#HeightString",
"def hs(n): return [s() for _ in range(n)]#HeightString",
"hs",
"def s(): return input()",
"def s(): return input()",
"s",
"def hi(n): return [i() for _ in range(n)]",
"def hi(n): return [i() for _ in range(n)]",
"hi",
"h, w, n = wi()",
"wi()",
"h",
"w, n = wi()",
"wi()",
"w",
"INF = float(\"INF\")",
"float(\"INF\")",
"INF",
"ansli = [0] * 10",
"[0] * 10",
"ansli",
"def wi(): return list(map(int, sys.stdin.readline().split()))",
"def wi(): return list(map(int, sys.stdin.readline().split()))",
"wi",
"def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint",
"def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint",
"wip",
"ny = c[i][0] + dy",
"c[i][0] + dy",
"ny",
"def mip(n): return [wip() for _ in range(n)]",
"def mip(n): return [wip() for _ in range(n)]",
"mip",
"c = mip(n)",
"mip(n)",
"c",
"ans = 0",
"0",
"ans",
"ddn9 = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1), (0, 0)]",
"[(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1), (0, 0)]",
"ddn9"
] | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools, random
from collections import deque
from heapq import heappush, heappop
sys.setrecursionlimit(10 ** 7)
ans = 0
tmp = 0
inf = 10 ** 20
INF = float("INF")
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
ddn9 = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1), (0, 0)]
"""for dx, dy in dd:
nx = j + dx; ny = i + dy
if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
h, w, n = wi()
c = mip(n)
d = collections.defaultdict(int)
for i in range(n):
for dx, dy in ddn9:
nx = c[i][1] + dx;
ny = c[i][0] + dy
if 0 < nx < w - 1 and 0 < ny < h - 1:
d[str(ny) + "+" + str(nx)] += 1#前のままだと,28+1,2+81とかがが被る
ansli = [0] * 10
for i in d:
ansli[d[i]] += 1
ansli[0] = (h - 2) * (w - 2) - sum(ansli)
for i in ansli:
print(i) |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
14,
40,
40,
17,
13,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
14,
40,
40,
17,
13,
2,
13,
17,
0,
18,
13,
39,
13,
13,
17,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
0,
13,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
17,
4,
13,
4,
18,
13,
13,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
129,
3
],
[
129,
12
],
[
129,
13
],
[
123,
15
],
[
21,
20
],
[
130,
23
],
[
132,
25
],
[
132,
34
],
[
37,
36
],
[
133,
40
],
[
133,
43
],
[
36,
49
],
[
115,
51
],
[
55,
54
],
[
118,
58
],
[
118,
61
],
[
54,
67
],
[
127,
69
],
[
77,
72
],
[
124,
73
],
[
115,
83
],
[
127,
86
],
[
124,
90
],
[
120,
92
],
[
124,
97
],
[
101,
100
],
[
121,
109
],
[
100,
111
],
[
129,
115
],
[
132,
118
],
[
120,
121
],
[
123,
124
],
[
129,
127
],
[
129,
130
],
[
132,
133
]
] | [
"from collections import defaultdict, Counter\n\nH, W, N = map(int, input().split())\n\nD = defaultdict(int)\n\nfor _ in range(N):\n a, b = map(int, input().split())\n for i in range(a - 2, a + 1):\n if 1 <= i <= H - 2:\n for j in range(b - 2, b + 1):\n if 1 <= j <= W - 2:\n D[(i, j)] += 1\n\nprint((H - 2) * (W - 2) - len(D))\n\nc = Counter(D.values())\nfor i in range(1, 10):\n print(c.get(i, 0))",
"from collections import defaultdict, Counter",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"D = defaultdict(int)",
"D",
"defaultdict(int)",
"defaultdict",
"int",
"for _ in range(N):\n a, b = map(int, input().split())\n for i in range(a - 2, a + 1):\n if 1 <= i <= H - 2:\n for j in range(b - 2, b + 1):\n if 1 <= j <= W - 2:\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(a - 2, a + 1):\n if 1 <= i <= H - 2:\n for j in range(b - 2, b + 1):\n if 1 <= j <= W - 2:\n D[(i, j)] += 1",
"i",
"range(a - 2, a + 1)",
"range",
"a - 2",
"a",
"2",
"a + 1",
"a",
"1",
"if 1 <= i <= H - 2:\n for j in range(b - 2, b + 1):\n if 1 <= j <= W - 2:\n D[(i, j)] += 1",
"1 <= i <= H - 2",
"1 <= i",
"1",
"i",
"H - 2",
"H",
"2",
"for j in range(b - 2, b + 1):\n if 1 <= j <= W - 2:\n D[(i, j)] += 1",
"j",
"range(b - 2, b + 1)",
"range",
"b - 2",
"b",
"2",
"b + 1",
"b",
"1",
"if 1 <= j <= W - 2:\n D[(i, j)] += 1",
"1 <= j <= W - 2",
"1 <= j",
"1",
"j",
"W - 2",
"W",
"2",
"D[(i, j)] += 1",
"D[(i, j)]",
"D",
"(i, j)",
"i",
"j",
"1",
"print((H - 2) * (W - 2) - len(D))",
"print",
"(H - 2) * (W - 2) - len(D)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"len(D)",
"len",
"D",
"c = Counter(D.values())",
"c",
"Counter(D.values())",
"Counter",
"D.values()",
"D.values",
"D",
"values",
"for i in range(1, 10):\n print(c.get(i, 0))",
"i",
"range(1, 10)",
"range",
"1",
"10",
"print(c.get(i, 0))",
"print",
"c.get(i, 0)",
"c.get",
"c",
"get",
"i",
"0",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"c = Counter(D.values())",
"Counter(D.values())",
"c",
"D = defaultdict(int)",
"defaultdict(int)",
"D",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a"
] | from collections import defaultdict, Counter
H, W, N = map(int, input().split())
D = defaultdict(int)
for _ in range(N):
a, b = map(int, input().split())
for i in range(a - 2, a + 1):
if 1 <= i <= H - 2:
for j in range(b - 2, b + 1):
if 1 <= j <= W - 2:
D[(i, j)] += 1
print((H - 2) * (W - 2) - len(D))
c = Counter(D.values())
for i in range(1, 10):
print(c.get(i, 0)) |
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
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,
13,
2,
13,
18,
13,
13,
14,
40,
2,
2,
17,
13,
13,
14,
40,
2,
2,
17,
13,
13,
0,
18,
13,
2,
2,
4,
13,
13,
17,
4,
13,
13,
17,
0,
13,
2,
39,
17,
17,
0,
13,
2,
2,
2,
13,
17,
17,
2,
2,
13,
17,
17,
0,
18,
13,
17,
2,
13,
4,
13,
4,
18,
13,
13,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
28,
13,
13,
4,
13,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] | [
[
182,
4
],
[
206,
19
],
[
183,
26
],
[
206,
28
],
[
206,
29
],
[
185,
31
],
[
173,
36
],
[
197,
48
],
[
61,
60
],
[
207,
63
],
[
188,
65
],
[
183,
72
],
[
188,
74
],
[
77,
76
],
[
203,
81
],
[
177,
83
],
[
198,
85
],
[
76,
86
],
[
194,
87
],
[
189,
89
],
[
174,
91
],
[
76,
92
],
[
204,
98
],
[
192,
99
],
[
195,
105
],
[
201,
106
],
[
119,
108
],
[
186,
109
],
[
204,
114
],
[
195,
118
],
[
179,
121
],
[
170,
127
],
[
192,
131
],
[
201,
136
],
[
143,
140
],
[
180,
141
],
[
171,
144
],
[
186,
149
],
[
186,
156
],
[
162,
159
],
[
180,
160
],
[
165,
164
],
[
180,
164
],
[
164,
168
],
[
170,
171
],
[
173,
174
],
[
188,
177
],
[
179,
180
],
[
182,
183
],
[
185,
186
],
[
188,
189
],
[
206,
192
],
[
194,
195
],
[
197,
198
],
[
206,
201
],
[
203,
204
],
[
206,
207
]
] | [
"import sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nfrom collections import defaultdict\n\nH, W, N = map(int, input().split())\ndic = defaultdict(int)\ndx = [-1, 0, 1, -1, 0, 1, -1, 0, 1]\ndy = [1, 1, 1, 0, 0, 0, -1, -1, -1]\nfor i in range(N):\n y, x = map(int, input().split())\n for j in range(9):\n ny, nx = y+dy[j], x+dx[j]\n if not 1 < ny < H: continue\n if not 1 < nx < W: continue\n dic[str(ny)+\":\"+str(nx)] += 1\ncount = [0]*10\ntot = (H-3+1)*(W-3+1)\ncount[0] = tot-len(dic.keys())\nfor k,v in dic.items():\n count[v] += 1\nfor c in count:\n print(c)",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"sys.setrecursionlimit(10**7)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**7",
"10",
"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",
"dx = [-1, 0, 1, -1, 0, 1, -1, 0, 1]",
"dx",
"[-1, 0, 1, -1, 0, 1, -1, 0, 1]",
"-1",
"0",
"1",
"-1",
"0",
"1",
"-1",
"0",
"1",
"dy = [1, 1, 1, 0, 0, 0, -1, -1, -1]",
"dy",
"[1, 1, 1, 0, 0, 0, -1, -1, -1]",
"1",
"1",
"1",
"0",
"0",
"0",
"-1",
"-1",
"-1",
"for i in range(N):\n y, x = map(int, input().split())\n for j in range(9):\n ny, nx = y+dy[j], x+dx[j]\n if not 1 < ny < H: continue\n if not 1 < nx < W: continue\n dic[str(ny)+\":\"+str(nx)] += 1",
"i",
"range(N)",
"range",
"N",
"y, x = map(int, input().split())",
"y",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"x",
"for j in range(9):\n ny, nx = y+dy[j], x+dx[j]\n if not 1 < ny < H: continue\n if not 1 < nx < W: continue\n dic[str(ny)+\":\"+str(nx)] += 1",
"j",
"range(9)",
"range",
"9",
"ny, nx = y+dy[j], x+dx[j]",
"ny",
"y+dy[j]",
"y",
"dy[j]",
"dy",
"j",
"nx",
"x+dx[j]",
"x",
"dx[j]",
"dx",
"j",
"if not 1 < ny < H: continue\n ",
"not 1 < ny < H",
"1 < ny < H",
"1 < ny",
"1",
"ny",
"H",
"if not 1 < nx < W: continue\n ",
"not 1 < nx < W",
"1 < nx < W",
"1 < nx",
"1",
"nx",
"W",
"dic[str(ny)+\":\"+str(nx)] += 1",
"dic[str(ny)+\":\"+str(nx)]",
"dic",
"str(ny)+\":\"+str(nx)",
"str(ny)+\":\"",
"str(ny)",
"str",
"ny",
"\":\"",
"str(nx)",
"str",
"nx",
"1",
"count = [0]*10",
"count",
"[0]*10",
"[0]",
"0",
"10",
"tot = (H-3+1)*(W-3+1)",
"tot",
"(H-3+1)*(W-3+1)",
"H-3+1",
"H-3",
"H",
"3",
"1",
"W-3+1",
"W-3",
"W",
"3",
"1",
"count[0] = tot-len(dic.keys())",
"count[0]",
"count",
"0",
"tot-len(dic.keys())",
"tot",
"len(dic.keys())",
"len",
"dic.keys()",
"dic.keys",
"dic",
"keys",
"for k,v in dic.items():\n count[v] += 1",
"k",
"v",
"dic.items()",
"dic.items",
"dic",
"items",
"count[v] += 1",
"count[v]",
"count",
"v",
"1",
"for c in count:\n print(c)",
"c",
"count",
"print(c)",
"print",
"c",
"tot = (H-3+1)*(W-3+1)",
"(H-3+1)*(W-3+1)",
"tot",
"dx = [-1, 0, 1, -1, 0, 1, -1, 0, 1]",
"[-1, 0, 1, -1, 0, 1, -1, 0, 1]",
"dx",
"y, x = map(int, input().split())",
"map(int, input().split())",
"y",
"count = [0]*10",
"[0]*10",
"count",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"dic = defaultdict(int)",
"defaultdict(int)",
"dic",
"x = map(int, input().split())",
"map(int, input().split())",
"x",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"nx = y+dy[j], x+dx[j]",
"x+dx[j]",
"nx",
"dy = [1, 1, 1, 0, 0, 0, -1, -1, -1]",
"[1, 1, 1, 0, 0, 0, -1, -1, -1]",
"dy",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"ny, nx = y+dy[j], x+dx[j]",
"y+dy[j]",
"ny",
"N = map(int, input().split())",
"map(int, input().split())",
"N"
] | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
H, W, N = map(int, input().split())
dic = defaultdict(int)
dx = [-1, 0, 1, -1, 0, 1, -1, 0, 1]
dy = [1, 1, 1, 0, 0, 0, -1, -1, -1]
for i in range(N):
y, x = map(int, input().split())
for j in range(9):
ny, nx = y+dy[j], x+dx[j]
if not 1 < ny < H: continue
if not 1 < nx < W: continue
dic[str(ny)+":"+str(nx)] += 1
count = [0]*10
tot = (H-3+1)*(W-3+1)
count[0] = tot-len(dic.keys())
for k,v in dic.items():
count[v] += 1
for c in count:
print(c)
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
2,
2,
13,
13,
2,
17,
13,
2,
17,
13,
17,
0,
13,
4,
13,
13,
0,
13,
39,
17,
17,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
13,
28,
13,
13,
14,
2,
2,
2,
17,
2,
13,
13,
13,
2,
2,
17,
2,
13,
13,
13,
0,
18,
13,
2,
2,
2,
2,
13,
13,
2,
2,
13,
13,
17,
13,
13,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
17,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13
] | [
[
137,
3
],
[
137,
12
],
[
137,
13
],
[
140,
15
],
[
24,
21
],
[
141,
22
],
[
135,
28
],
[
129,
29
],
[
135,
32
],
[
129,
35
],
[
149,
38
],
[
143,
43
],
[
50,
49
],
[
138,
52
],
[
146,
54
],
[
146,
63
],
[
66,
65
],
[
144,
65
],
[
69,
68
],
[
144,
68
],
[
147,
76
],
[
65,
77
],
[
135,
78
],
[
132,
83
],
[
68,
84
],
[
129,
85
],
[
102,
87
],
[
150,
88
],
[
147,
93
],
[
65,
94
],
[
135,
97
],
[
129,
98
],
[
132,
100
],
[
68,
101
],
[
105,
104
],
[
150,
107
],
[
115,
110
],
[
141,
111
],
[
150,
113
],
[
104,
114
],
[
120,
117
],
[
141,
118
],
[
123,
122
],
[
141,
122
],
[
122,
126
],
[
137,
129
],
[
146,
132
],
[
137,
135
],
[
137,
138
],
[
140,
141
],
[
143,
144
],
[
146,
147
],
[
149,
150
]
] | [
"from collections import defaultdict as dd\nH, W, N = map(int, input().split())\nres = [0] * 10\nres[0] = H * W - 2 * H - 2 * W + 4\np = dd(int)\nd = [-1, 0, 1]\nfor _ in range(N):\n y, x = map(int, input().split())\n for i in d:\n for j in d:\n if 1 < y + i < H and 1 < x + j < W:\n p[(y + i) * (H * W + 1) + x + j] += 1\nfor k in p.keys():\n res[p[k]] += 1\n res[0] -= 1\nfor r in res:\n print(r)",
"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",
"res = [0] * 10",
"res",
"[0] * 10",
"[0]",
"0",
"10",
"res[0] = H * W - 2 * H - 2 * W + 4",
"res[0]",
"res",
"0",
"H * W - 2 * H - 2 * W + 4",
"H * W - 2 * H - 2 * W",
"H * W - 2 * H",
"H * W",
"H",
"W",
"2 * H",
"2",
"H",
"2 * W",
"2",
"W",
"4",
"p = dd(int)",
"p",
"dd(int)",
"dd",
"int",
"d = [-1, 0, 1]",
"d",
"[-1, 0, 1]",
"-1",
"0",
"1",
"for _ in range(N):\n y, x = map(int, input().split())\n for i in d:\n for j in d:\n if 1 < y + i < H and 1 < x + j < W:\n p[(y + i) * (H * W + 1) + x + j] += 1",
"_",
"range(N)",
"range",
"N",
"y, x = map(int, input().split())",
"y",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"x",
"for i in d:\n for j in d:\n if 1 < y + i < H and 1 < x + j < W:\n p[(y + i) * (H * W + 1) + x + j] += 1",
"i",
"d",
"for j in d:\n if 1 < y + i < H and 1 < x + j < W:\n p[(y + i) * (H * W + 1) + x + j] += 1",
"j",
"d",
"if 1 < y + i < H and 1 < x + j < W:\n p[(y + i) * (H * W + 1) + x + j] += 1",
"1 < y + i < H and 1 < x + j < W",
"1 < y + i < H",
"1 < y + i",
"1",
"y + i",
"y",
"i",
"H",
"1 < x + j < W",
"1 < x + j",
"1",
"x + j",
"x",
"j",
"W",
"p[(y + i) * (H * W + 1) + x + j] += 1",
"p[(y + i) * (H * W + 1) + x + j]",
"p",
"(y + i) * (H * W + 1) + x + j",
"(y + i) * (H * W + 1) + x",
"(y + i) * (H * W + 1)",
"y + i",
"y",
"i",
"H * W + 1",
"H * W",
"H",
"W",
"1",
"x",
"j",
"1",
"for k in p.keys():\n res[p[k]] += 1\n res[0] -= 1",
"k",
"p.keys()",
"p.keys",
"p",
"keys",
"res[p[k]] += 1",
"res[p[k]]",
"res",
"p[k]",
"p",
"k",
"1",
"res[0] -= 1",
"res[0]",
"res",
"0",
"1",
"for r in res:\n print(r)",
"r",
"res",
"print(r)",
"print",
"r",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"x = map(int, input().split())",
"map(int, input().split())",
"x",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"res = [0] * 10",
"[0] * 10",
"res",
"d = [-1, 0, 1]",
"[-1, 0, 1]",
"d",
"y, x = map(int, input().split())",
"map(int, input().split())",
"y",
"p = dd(int)",
"dd(int)",
"p"
] | from collections import defaultdict as dd
H, W, N = map(int, input().split())
res = [0] * 10
res[0] = H * W - 2 * H - 2 * W + 4
p = dd(int)
d = [-1, 0, 1]
for _ in range(N):
y, x = map(int, input().split())
for i in d:
for j in d:
if 1 < y + i < H and 1 < x + j < W:
p[(y + i) * (H * W + 1) + x + j] += 1
for k in p.keys():
res[p[k]] += 1
res[0] -= 1
for r in res:
print(r) |
[
7,
12,
13,
15,
12,
13,
29,
4,
18,
4,
18,
13,
13,
13,
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,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
39,
17,
17,
17,
0,
13,
17,
0,
13,
2,
13,
18,
13,
17,
0,
13,
2,
13,
18,
13,
17,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
38,
5,
0,
18,
13,
39,
13,
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,
28,
13,
13,
4,
13,
13,
4,
13,
10,
12,
13
] | [
[
17,
16
],
[
5,
23
],
[
17,
25
],
[
17,
26
],
[
29,
28
],
[
32,
31
],
[
26,
34
],
[
37,
36
],
[
5,
43
],
[
37,
45
],
[
48,
47
],
[
51,
50
],
[
54,
53
],
[
62,
61
],
[
65,
64
],
[
47,
66
],
[
36,
66
],
[
53,
68
],
[
72,
71
],
[
50,
73
],
[
45,
73
],
[
53,
75
],
[
64,
82
],
[
16,
84
],
[
71,
89
],
[
25,
91
],
[
101,
96
],
[
28,
97
],
[
108,
103
],
[
28,
104
],
[
111,
110
],
[
117,
116
],
[
28,
119
],
[
125,
122
],
[
110,
123
],
[
116,
124
],
[
130,
127
],
[
110,
128
],
[
16,
133
],
[
25,
136
],
[
28,
140
],
[
143,
142
],
[
110,
142
],
[
142,
146
],
[
151,
148
]
] | [
"def main():\n from sys import stdin\n def input():\n return stdin.readline().strip()\n\n from itertools import product\n\n h, w, n = map(int, input().split())\n dic = {}\n for _ in range(n):\n a, b = map(int, input().split())\n a -= 2\n b -= 2\n for i in product([-1, 0, 1], repeat=2):\n aa = a + i[0]\n bb = b + i[1]\n if 0 <= aa <= h-3 and 0 <= bb <= w-3:\n try:\n dic[(aa, bb)] += 1\n except:\n dic[(aa, bb)] = 1\n\n ans = [0] * 10\n for i in dic.values():\n ans[i] += 1\n ans[0] = (h-2) * (w-2) - len(dic)\n\n for i in ans:\n print(i)\n\nmain()",
"def main():\n from sys import stdin\n def input():\n return stdin.readline().strip()\n\n from itertools import product\n\n h, w, n = map(int, input().split())\n dic = {}\n for _ in range(n):\n a, b = map(int, input().split())\n a -= 2\n b -= 2\n for i in product([-1, 0, 1], repeat=2):\n aa = a + i[0]\n bb = b + i[1]\n if 0 <= aa <= h-3 and 0 <= bb <= w-3:\n try:\n dic[(aa, bb)] += 1\n except:\n dic[(aa, bb)] = 1\n\n ans = [0] * 10\n for i in dic.values():\n ans[i] += 1\n ans[0] = (h-2) * (w-2) - len(dic)\n\n for i in ans:\n print(i)",
"main",
"from sys import stdin",
"def input():\n return stdin.readline().strip()\n\n ",
"input",
"return stdin.readline().strip()",
"stdin.readline().strip()",
"stdin.readline().strip",
"stdin.readline()",
"stdin.readline",
"stdin",
"readline",
"strip",
"from itertools import product",
"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 -= 2\n b -= 2\n for i in product([-1, 0, 1], repeat=2):\n aa = a + i[0]\n bb = b + i[1]\n if 0 <= aa <= h-3 and 0 <= bb <= w-3:\n try:\n dic[(aa, bb)] += 1\n except:\n dic[(aa, bb)] = 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 -= 2",
"a",
"2",
"b -= 2",
"b",
"2",
"for i in product([-1, 0, 1], repeat=2):\n aa = a + i[0]\n bb = b + i[1]\n if 0 <= aa <= h-3 and 0 <= bb <= w-3:\n try:\n dic[(aa, bb)] += 1\n except:\n dic[(aa, bb)] = 1\n\n ",
"i",
"product([-1, 0, 1], repeat=2)",
"product",
"[-1, 0, 1]",
"-1",
"0",
"1",
"repeat=2",
"repeat",
"2",
"aa = a + i[0]",
"aa",
"a + i[0]",
"a",
"i[0]",
"i",
"0",
"bb = b + i[1]",
"bb",
"b + i[1]",
"b",
"i[1]",
"i",
"1",
"if 0 <= aa <= h-3 and 0 <= bb <= w-3:\n try:\n dic[(aa, bb)] += 1\n except:\n dic[(aa, bb)] = 1\n\n ",
"0 <= aa <= h-3 and 0 <= bb <= w-3",
"0 <= aa <= h-3",
"0 <= aa",
"0",
"aa",
"h-3",
"h",
"3",
"0 <= bb <= w-3",
"0 <= bb",
"0",
"bb",
"w-3",
"w",
"3",
"try:\n dic[(aa, bb)] += 1\n except:\n dic[(aa, bb)] = 1\n\n ",
"except:\n dic[(aa, bb)] = 1\n\n ",
"dic[(aa, bb)] = 1",
"dic[(aa, bb)]",
"dic",
"(aa, bb)",
"aa",
"bb",
"1",
"dic[(aa, bb)] += 1",
"dic[(aa, bb)]",
"dic",
"(aa, bb)",
"aa",
"bb",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for i in dic.values():\n ans[i] += 1\n ",
"i",
"dic.values()",
"dic.values",
"dic",
"values",
"ans[i] += 1",
"ans[i]",
"ans",
"i",
"1",
"ans[0] = (h-2) * (w-2) - len(dic)",
"ans[0]",
"ans",
"0",
"(h-2) * (w-2) - len(dic)",
"(h-2) * (w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"len(dic)",
"len",
"dic",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"main()",
"main",
"def main():\n from sys import stdin\n def input():\n return stdin.readline().strip()\n\n from itertools import product\n\n h, w, n = map(int, input().split())\n dic = {}\n for _ in range(n):\n a, b = map(int, input().split())\n a -= 2\n b -= 2\n for i in product([-1, 0, 1], repeat=2):\n aa = a + i[0]\n bb = b + i[1]\n if 0 <= aa <= h-3 and 0 <= bb <= w-3:\n try:\n dic[(aa, bb)] += 1\n except:\n dic[(aa, bb)] = 1\n\n ans = [0] * 10\n for i in dic.values():\n ans[i] += 1\n ans[0] = (h-2) * (w-2) - len(dic)\n\n for i in ans:\n print(i)",
"def main():\n from sys import stdin\n def input():\n return stdin.readline().strip()\n\n from itertools import product\n\n h, w, n = map(int, input().split())\n dic = {}\n for _ in range(n):\n a, b = map(int, input().split())\n a -= 2\n b -= 2\n for i in product([-1, 0, 1], repeat=2):\n aa = a + i[0]\n bb = b + i[1]\n if 0 <= aa <= h-3 and 0 <= bb <= w-3:\n try:\n dic[(aa, bb)] += 1\n except:\n dic[(aa, bb)] = 1\n\n ans = [0] * 10\n for i in dic.values():\n ans[i] += 1\n ans[0] = (h-2) * (w-2) - len(dic)\n\n for i in ans:\n print(i)",
"main"
] | def main():
from sys import stdin
def input():
return stdin.readline().strip()
from itertools import product
h, w, n = map(int, input().split())
dic = {}
for _ in range(n):
a, b = map(int, input().split())
a -= 2
b -= 2
for i in product([-1, 0, 1], repeat=2):
aa = a + i[0]
bb = b + i[1]
if 0 <= aa <= h-3 and 0 <= bb <= w-3:
try:
dic[(aa, bb)] += 1
except:
dic[(aa, bb)] = 1
ans = [0] * 10
for i in dic.values():
ans[i] += 1
ans[0] = (h-2) * (w-2) - len(dic)
for i in ans:
print(i)
main() |
[
7,
15,
13,
15,
13,
15,
15,
4,
18,
13,
13,
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,
4,
13,
0,
13,
12,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
12,
4,
13,
4,
13,
0,
13,
12,
4,
13,
12,
13,
0,
13,
4,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
2,
2,
13,
13,
17,
2,
2,
13,
13,
17,
9,
14,
2,
40,
2,
13,
13,
2,
13,
17,
40,
2,
13,
13,
2,
13,
17,
9,
0,
13,
2,
2,
2,
2,
13,
13,
2,
17,
17,
13,
13,
0,
18,
13,
13,
2,
4,
18,
13,
13,
13,
17,
17,
0,
13,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
14,
2,
13,
17,
4,
13,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
4,
18,
13,
13,
4,
13,
4,
18,
13,
13,
13,
17,
14,
2,
13,
17,
4,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] | [
[
197,
13
],
[
215,
20
],
[
209,
32
],
[
216,
37
],
[
206,
39
],
[
216,
47
],
[
212,
50
],
[
207,
55
],
[
203,
57
],
[
216,
60
],
[
65,
64
],
[
207,
66
],
[
65,
67
],
[
65,
68
],
[
71,
70
],
[
74,
73
],
[
68,
76
],
[
79,
78
],
[
207,
80
],
[
79,
81
],
[
84,
83
],
[
90,
89
],
[
78,
98
],
[
83,
99
],
[
81,
103
],
[
89,
104
],
[
78,
111
],
[
83,
112
],
[
64,
114
],
[
81,
118
],
[
89,
119
],
[
67,
121
],
[
126,
125
],
[
78,
130
],
[
83,
131
],
[
81,
135
],
[
89,
136
],
[
141,
138
],
[
70,
139
],
[
125,
140
],
[
70,
144
],
[
125,
146
],
[
151,
150
],
[
70,
155
],
[
159,
158
],
[
158,
164
],
[
64,
171
],
[
67,
174
],
[
150,
180
],
[
150,
186
],
[
158,
188
],
[
201,
195
],
[
197,
198
],
[
203,
204
],
[
206,
207
],
[
209,
210
],
[
212,
213
],
[
215,
216
]
] | [
"import sys\nimport math\nfrom collections import deque\nfrom collections import Counter\n\nsys.setrecursionlimit(1000000)\nMOD = 10 ** 9 + 7\ninput = lambda: sys.stdin.readline().strip()\nNI = lambda: int(input())\nNMI = lambda: map(int, input().split())\nNLI = lambda: list(NMI())\nSI = lambda: input()\n\n\ndef main():\n H, W, N = NMI()\n grid = {}\n for i in range(N):\n a, b = NMI()\n for t in range(-2, 1):\n for k in range(-2, 1):\n if a + t < 1 or b + k < 1:\n continue\n if a + t >= H - 1 or b + k >= W - 1:\n continue\n point = (a+t) * 10**10 + b+k\n grid[point] = grid.get(point, 0) + 1\n c = Counter(grid.values())\n for i in range(10):\n if i == 0:\n print((H-2)*(W-2) - sum(c.values()))\n else:\n print(c.get(i, 0))\n\n\nif __name__ == \"__main__\":\n main()",
"import sys",
"sys",
"import math",
"math",
"from collections import deque",
"from collections import Counter",
"sys.setrecursionlimit(1000000)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"1000000",
"MOD = 10 ** 9 + 7",
"MOD",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"input = lambda: sys.stdin.readline().strip()",
"input",
"lambda: sys.stdin.readline().strip()",
"sys.stdin.readline().strip()",
"sys.stdin.readline().strip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"strip",
"NI = lambda: int(input())",
"NI",
"lambda: int(input())",
"int(input())",
"int",
"input()",
"input",
"NMI = lambda: map(int, input().split())",
"NMI",
"lambda: map(int, input().split())",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"NLI = lambda: list(NMI())",
"NLI",
"lambda: list(NMI())",
"list(NMI())",
"list",
"NMI()",
"NMI",
"SI = lambda: input()",
"SI",
"lambda: input()",
"input()",
"input",
"def main():\n H, W, N = NMI()\n grid = {}\n for i in range(N):\n a, b = NMI()\n for t in range(-2, 1):\n for k in range(-2, 1):\n if a + t < 1 or b + k < 1:\n continue\n if a + t >= H - 1 or b + k >= W - 1:\n continue\n point = (a+t) * 10**10 + b+k\n grid[point] = grid.get(point, 0) + 1\n c = Counter(grid.values())\n for i in range(10):\n if i == 0:\n print((H-2)*(W-2) - sum(c.values()))\n else:\n print(c.get(i, 0))",
"main",
"H, W, N = NMI()",
"H",
"NMI()",
"NMI",
"W",
"N",
"grid = {}",
"grid",
"{}",
"for i in range(N):\n a, b = NMI()\n for t in range(-2, 1):\n for k in range(-2, 1):\n if a + t < 1 or b + k < 1:\n continue\n if a + t >= H - 1 or b + k >= W - 1:\n continue\n point = (a+t) * 10**10 + b+k\n grid[point] = grid.get(point, 0) + 1\n ",
"i",
"range(N)",
"range",
"N",
"a, b = NMI()",
"a",
"NMI()",
"NMI",
"b",
"for t in range(-2, 1):\n for k in range(-2, 1):\n if a + t < 1 or b + k < 1:\n continue\n if a + t >= H - 1 or b + k >= W - 1:\n continue\n point = (a+t) * 10**10 + b+k\n grid[point] = grid.get(point, 0) + 1\n ",
"t",
"range(-2, 1)",
"range",
"-2",
"1",
"for k in range(-2, 1):\n if a + t < 1 or b + k < 1:\n continue\n if a + t >= H - 1 or b + k >= W - 1:\n continue\n point = (a+t) * 10**10 + b+k\n grid[point] = grid.get(point, 0) + 1\n ",
"k",
"range(-2, 1)",
"range",
"-2",
"1",
"if a + t < 1 or b + k < 1:\n continue\n ",
"a + t < 1 or b + k < 1",
"a + t < 1",
"a + t",
"a",
"t",
"1",
"b + k < 1",
"b + k",
"b",
"k",
"1",
"continue",
"if a + t >= H - 1 or b + k >= W - 1:\n continue\n ",
"a + t >= H - 1 or b + k >= W - 1",
"a + t >= H - 1",
"a + t",
"a",
"t",
"H - 1",
"H",
"1",
"b + k >= W - 1",
"b + k",
"b",
"k",
"W - 1",
"W",
"1",
"continue",
"point = (a+t) * 10**10 + b+k",
"point",
"(a+t) * 10**10 + b+k",
"(a+t) * 10**10 + b",
"(a+t) * 10**10",
"a+t",
"a",
"t",
"10**10",
"10",
"10",
"b",
"k",
"grid[point] = grid.get(point, 0) + 1",
"grid[point]",
"grid",
"point",
"grid.get(point, 0) + 1",
"grid.get(point, 0)",
"grid.get",
"grid",
"get",
"point",
"0",
"1",
"c = Counter(grid.values())",
"c",
"Counter(grid.values())",
"Counter",
"grid.values()",
"grid.values",
"grid",
"values",
"for i in range(10):\n if i == 0:\n print((H-2)*(W-2) - sum(c.values()))\n else:\n print(c.get(i, 0))",
"i",
"range(10)",
"range",
"10",
"if i == 0:\n print((H-2)*(W-2) - sum(c.values()))\n else:\n print(c.get(i, 0))",
"i == 0",
"i",
"0",
"print((H-2)*(W-2) - sum(c.values()))",
"print",
"(H-2)*(W-2) - sum(c.values())",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(c.values())",
"sum",
"c.values()",
"c.values",
"c",
"values",
"print(c.get(i, 0))",
"print",
"c.get(i, 0)",
"c.get",
"c",
"get",
"i",
"0",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"def main():\n H, W, N = NMI()\n grid = {}\n for i in range(N):\n a, b = NMI()\n for t in range(-2, 1):\n for k in range(-2, 1):\n if a + t < 1 or b + k < 1:\n continue\n if a + t >= H - 1 or b + k >= W - 1:\n continue\n point = (a+t) * 10**10 + b+k\n grid[point] = grid.get(point, 0) + 1\n c = Counter(grid.values())\n for i in range(10):\n if i == 0:\n print((H-2)*(W-2) - sum(c.values()))\n else:\n print(c.get(i, 0))",
"def main():\n H, W, N = NMI()\n grid = {}\n for i in range(N):\n a, b = NMI()\n for t in range(-2, 1):\n for k in range(-2, 1):\n if a + t < 1 or b + k < 1:\n continue\n if a + t >= H - 1 or b + k >= W - 1:\n continue\n point = (a+t) * 10**10 + b+k\n grid[point] = grid.get(point, 0) + 1\n c = Counter(grid.values())\n for i in range(10):\n if i == 0:\n print((H-2)*(W-2) - sum(c.values()))\n else:\n print(c.get(i, 0))",
"main",
"SI = lambda: input()",
"lambda: input()",
"SI",
"NMI = lambda: map(int, input().split())",
"lambda: map(int, input().split())",
"NMI",
"NI = lambda: int(input())",
"lambda: int(input())",
"NI",
"NLI = lambda: list(NMI())",
"lambda: list(NMI())",
"NLI",
"input = lambda: sys.stdin.readline().strip()",
"lambda: sys.stdin.readline().strip()",
"input"
] | import sys
import math
from collections import deque
from collections import Counter
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()
def main():
H, W, N = NMI()
grid = {}
for i in range(N):
a, b = NMI()
for t in range(-2, 1):
for k in range(-2, 1):
if a + t < 1 or b + k < 1:
continue
if a + t >= H - 1 or b + k >= W - 1:
continue
point = (a+t) * 10**10 + b+k
grid[point] = grid.get(point, 0) + 1
c = Counter(grid.values())
for i in range(10):
if i == 0:
print((H-2)*(W-2) - sum(c.values()))
else:
print(c.get(i, 0))
if __name__ == "__main__":
main() |
[
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,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
17,
28,
13,
4,
13,
2,
13,
17,
2,
13,
17,
17,
14,
2,
40,
40,
17,
13,
2,
13,
17,
40,
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,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
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,
13,
13,
10,
17,
13,
10,
17,
13
] | [
[
151,
2
],
[
151,
11
],
[
151,
12
],
[
157,
14
],
[
19,
18
],
[
149,
21
],
[
160,
23
],
[
160,
32
],
[
166,
34
],
[
169,
37
],
[
41,
40
],
[
170,
44
],
[
161,
44
],
[
170,
47
],
[
161,
47
],
[
52,
51
],
[
167,
55
],
[
155,
55
],
[
167,
58
],
[
155,
58
],
[
51,
66
],
[
152,
68
],
[
40,
73
],
[
146,
75
],
[
158,
82
],
[
89,
84
],
[
158,
85
],
[
96,
91
],
[
158,
92
],
[
100,
99
],
[
163,
106
],
[
110,
109
],
[
158,
112
],
[
118,
115
],
[
164,
116
],
[
109,
117
],
[
123,
120
],
[
164,
121
],
[
152,
126
],
[
146,
129
],
[
164,
133
],
[
136,
135
],
[
115,
141
],
[
164,
142
],
[
135,
143
],
[
151,
146
],
[
151,
149
],
[
151,
152
],
[
160,
155
],
[
157,
158
],
[
160,
161
],
[
163,
164
],
[
166,
167
],
[
169,
170
]
] | [
"h, w, n = map(int, input().split())\nsquare = dict()\nfor i in range(n):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for x in range(b-2,b+1,1):\n for y in range(a-2,a+1,1):\n if 0 <= y <= (h - 3) and 0 <= x <= (w - 3) :\n if (x,y) in square:\n square[(x,y)] += 1\n else:\n square[(x,y)] = 1\nans = [0 for i in range(10)]\nfor i in square.values():\n ans[i] += 1\nans[0] = (h - 2) * (w - 2) - sum(ans)\nfor i in range(10):\n print(ans[i])",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"square = dict()",
"square",
"dict()",
"dict",
"for i in range(n):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for x in range(b-2,b+1,1):\n for y in range(a-2,a+1,1):\n if 0 <= y <= (h - 3) and 0 <= x <= (w - 3) :\n if (x,y) in square:\n square[(x,y)] += 1\n else:\n square[(x,y)] = 1",
"i",
"range(n)",
"range",
"n",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for x in range(b-2,b+1,1):\n for y in range(a-2,a+1,1):\n if 0 <= y <= (h - 3) and 0 <= x <= (w - 3) :\n if (x,y) in square:\n square[(x,y)] += 1\n else:\n square[(x,y)] = 1",
"x",
"range(b-2,b+1,1)",
"range",
"b-2",
"b",
"2",
"b+1",
"b",
"1",
"1",
"for y in range(a-2,a+1,1):\n if 0 <= y <= (h - 3) and 0 <= x <= (w - 3) :\n if (x,y) in square:\n square[(x,y)] += 1\n else:\n square[(x,y)] = 1",
"y",
"range(a-2,a+1,1)",
"range",
"a-2",
"a",
"2",
"a+1",
"a",
"1",
"1",
"if 0 <= y <= (h - 3) and 0 <= x <= (w - 3) :\n if (x,y) in square:\n square[(x,y)] += 1\n else:\n square[(x,y)] = 1",
"0 <= y <= (h - 3) and 0 <= x <= (w - 3)",
"0 <= y <= (h - 3)",
"0 <= y",
"0",
"y",
"h - 3",
"h",
"3",
"0 <= x <= (w - 3)",
"0 <= x",
"0",
"x",
"w - 3",
"w",
"3",
"if (x,y) in square:\n square[(x,y)] += 1\n else:\n square[(x,y)] = 1",
"(x,y) in square",
"(x,y)",
"x",
"y",
"square",
"square[(x,y)] += 1",
"square[(x,y)]",
"square",
"(x,y)",
"x",
"y",
"1",
"square[(x,y)] = 1",
"square[(x,y)]",
"square",
"(x,y)",
"x",
"y",
"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 square.values():\n ans[i] += 1",
"i",
"square.values()",
"square.values",
"square",
"values",
"ans[i] += 1",
"ans[i]",
"ans",
"i",
"1",
"ans[0] = (h - 2) * (w - 2) - sum(ans)",
"ans[0]",
"ans",
"0",
"(h - 2) * (w - 2) - sum(ans)",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"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",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"square = dict()",
"dict()",
"square",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"ans = [0 for i in range(10)]",
"[0 for i in range(10)]",
"ans",
"a -= 1",
"1",
"a",
"b -= 1",
"1",
"b"
] | h, w, n = map(int, input().split())
square = dict()
for i in range(n):
a, b = map(int, input().split())
a -= 1
b -= 1
for x in range(b-2,b+1,1):
for y in range(a-2,a+1,1):
if 0 <= y <= (h - 3) and 0 <= x <= (w - 3) :
if (x,y) in square:
square[(x,y)] += 1
else:
square[(x,y)] = 1
ans = [0 for i in range(10)]
for i in square.values():
ans[i] += 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,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
12,
2,
4,
13,
13,
17,
23,
4,
18,
4,
13,
13,
13,
0,
18,
13,
39,
13,
13,
17,
4,
18,
13,
13,
39,
13,
13,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
28,
13,
13,
13,
28,
13,
4,
13,
17,
0,
13,
4,
13,
13,
17,
13,
14,
2,
2,
2,
13,
13,
17,
2,
2,
13,
13,
17,
9,
0,
13,
17,
28,
13,
4,
13,
17,
0,
13,
4,
13,
13,
17,
13,
14,
2,
40,
13,
2,
2,
13,
13,
13,
40,
13,
2,
2,
13,
13,
13,
3,
14,
2,
39,
2,
2,
13,
13,
13,
2,
2,
13,
13,
13,
13,
14,
2,
2,
2,
40,
13,
13,
17,
2,
2,
2,
40,
13,
13,
17,
2,
2,
40,
13,
13,
17,
3,
0,
13,
17,
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,
18,
13,
10,
4,
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,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13
] | [
[
206,
5
],
[
242,
12
],
[
207,
19
],
[
242,
21
],
[
242,
22
],
[
215,
24
],
[
248,
29
],
[
33,
32
],
[
213,
35
],
[
236,
37
],
[
207,
50
],
[
236,
52
],
[
59,
54
],
[
216,
55
],
[
249,
62
],
[
70,
69
],
[
227,
76
],
[
84,
83
],
[
233,
88
],
[
83,
91
],
[
233,
93
],
[
237,
98
],
[
210,
99
],
[
225,
103
],
[
234,
104
],
[
239,
108
],
[
112,
111
],
[
245,
116
],
[
111,
119
],
[
245,
121
],
[
243,
125
],
[
237,
128
],
[
210,
129
],
[
246,
130
],
[
222,
132
],
[
225,
135
],
[
234,
136
],
[
219,
137
],
[
237,
144
],
[
210,
145
],
[
246,
146
],
[
225,
149
],
[
234,
150
],
[
219,
151
],
[
216,
152
],
[
234,
158
],
[
219,
159
],
[
234,
165
],
[
219,
166
],
[
210,
171
],
[
246,
172
],
[
230,
176
],
[
182,
179
],
[
228,
180
],
[
231,
181
],
[
240,
181
],
[
187,
184
],
[
228,
185
],
[
243,
190
],
[
222,
193
],
[
228,
197
],
[
228,
201
],
[
204,
203
],
[
206,
207
],
[
233,
210
],
[
242,
213
],
[
215,
216
],
[
245,
219
],
[
242,
222
],
[
236,
225
],
[
227,
228
],
[
230,
231
],
[
233,
234
],
[
236,
237
],
[
239,
240
],
[
242,
243
],
[
245,
246
],
[
248,
249
]
] | [
"from collections import defaultdict\nimport sys\ninput = sys.stdin.readline\n\nH,W,N = map(int,input().split())\nD = defaultdict(bool)\nB = []\n\nfor _ in range(N):\n a,b = map(lambda x: int(x)-1,input().split())\n D[(a,b)] = True\n B.append((a,b))\n\nans = [0 for _ in range(10)]\n\nfor a,b in B:\n for i in range(9):\n ix,iy = divmod(i,3)\n if a-ix<0 or b-iy<0:\n continue\n black_count = 0\n for j in range(9):\n jx,jy = divmod(j,3)\n if H<=a-ix+jx or W<=b-iy+jy:\n break\n if (a-ix+jx,b-iy+jy) in D:\n if -iy+jy<0 or (-iy+jy==0 and -ix+jx<0):\n break\n black_count += 1\n else:\n ans[black_count] += 1\n\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",
"D = defaultdict(bool)",
"D",
"defaultdict(bool)",
"defaultdict",
"bool",
"B = []",
"B",
"[]",
"for _ in range(N):\n a,b = map(lambda x: int(x)-1,input().split())\n D[(a,b)] = True\n B.append((a,b))",
"_",
"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",
"D[(a,b)] = True",
"D[(a,b)]",
"D",
"(a,b)",
"a",
"b",
"True",
"B.append((a,b))",
"B.append",
"B",
"append",
"(a,b)",
"a",
"b",
"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 a,b in B:\n for i in range(9):\n ix,iy = divmod(i,3)\n if a-ix<0 or b-iy<0:\n continue\n black_count = 0\n for j in range(9):\n jx,jy = divmod(j,3)\n if H<=a-ix+jx or W<=b-iy+jy:\n break\n if (a-ix+jx,b-iy+jy) in D:\n if -iy+jy<0 or (-iy+jy==0 and -ix+jx<0):\n break\n black_count += 1\n else:\n ans[black_count] += 1",
"a",
"b",
"B",
"for i in range(9):\n ix,iy = divmod(i,3)\n if a-ix<0 or b-iy<0:\n continue\n black_count = 0\n for j in range(9):\n jx,jy = divmod(j,3)\n if H<=a-ix+jx or W<=b-iy+jy:\n break\n if (a-ix+jx,b-iy+jy) in D:\n if -iy+jy<0 or (-iy+jy==0 and -ix+jx<0):\n break\n black_count += 1\n else:\n ans[black_count] += 1",
"i",
"range(9)",
"range",
"9",
"ix,iy = divmod(i,3)",
"ix",
"divmod(i,3)",
"divmod",
"i",
"3",
"iy",
"if a-ix<0 or b-iy<0:\n continue\n ",
"a-ix<0 or b-iy<0",
"a-ix<0",
"a-ix",
"a",
"ix",
"0",
"b-iy<0",
"b-iy",
"b",
"iy",
"0",
"continue",
"black_count = 0",
"black_count",
"0",
"for j in range(9):\n jx,jy = divmod(j,3)\n if H<=a-ix+jx or W<=b-iy+jy:\n break\n if (a-ix+jx,b-iy+jy) in D:\n if -iy+jy<0 or (-iy+jy==0 and -ix+jx<0):\n break\n black_count += 1\n else:\n ans[black_count] += 1",
"j",
"range(9)",
"range",
"9",
"jx,jy = divmod(j,3)",
"jx",
"divmod(j,3)",
"divmod",
"j",
"3",
"jy",
"if H<=a-ix+jx or W<=b-iy+jy:\n break\n ",
"H<=a-ix+jx or W<=b-iy+jy",
"H<=a-ix+jx",
"H",
"a-ix+jx",
"a-ix",
"a",
"ix",
"jx",
"W<=b-iy+jy",
"W",
"b-iy+jy",
"b-iy",
"b",
"iy",
"jy",
"break",
"if (a-ix+jx,b-iy+jy) in D:\n if -iy+jy<0 or (-iy+jy==0 and -ix+jx<0):\n break\n black_count += 1\n ",
"(a-ix+jx,b-iy+jy) in D",
"(a-ix+jx,b-iy+jy)",
"a-ix+jx",
"a-ix",
"a",
"ix",
"jx",
"b-iy+jy",
"b-iy",
"b",
"iy",
"jy",
"D",
"if -iy+jy<0 or (-iy+jy==0 and -ix+jx<0):\n break\n ",
"-iy+jy<0 or (-iy+jy==0 and -ix+jx<0)",
"-iy+jy<0",
"-iy+jy",
"-iy",
"iy",
"jy",
"0",
"-iy+jy==0 and -ix+jx<0",
"-iy+jy==0",
"-iy+jy",
"-iy",
"iy",
"jy",
"0",
"-ix+jx<0",
"-ix+jx",
"-ix",
"ix",
"jx",
"0",
"break",
"black_count += 1",
"black_count",
"1",
"ans[black_count] += 1",
"ans[black_count]",
"ans",
"black_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",
"print(*ans,sep='\\n')",
"print",
"*ans",
"ans",
"sep='\\n'",
"sep",
"'\\n'",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"ix,iy = divmod(i,3)",
"divmod(i,3)",
"ix",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"D = defaultdict(bool)",
"defaultdict(bool)",
"D",
"jy = divmod(j,3)",
"divmod(j,3)",
"jy",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"b = map(lambda x: int(x)-1,input().split())",
"map(lambda x: int(x)-1,input().split())",
"b",
"ans = [0 for _ in range(10)]",
"[0 for _ in range(10)]",
"ans",
"black_count += 1",
"1",
"black_count",
"iy = divmod(i,3)",
"divmod(i,3)",
"iy",
"a,b = map(lambda x: int(x)-1,input().split())",
"map(lambda x: int(x)-1,input().split())",
"a",
"black_count = 0",
"0",
"black_count",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"jx,jy = divmod(j,3)",
"divmod(j,3)",
"jx",
"B = []",
"[]",
"B"
] | from collections import defaultdict
import sys
input = sys.stdin.readline
H,W,N = map(int,input().split())
D = defaultdict(bool)
B = []
for _ in range(N):
a,b = map(lambda x: int(x)-1,input().split())
D[(a,b)] = True
B.append((a,b))
ans = [0 for _ in range(10)]
for a,b in B:
for i in range(9):
ix,iy = divmod(i,3)
if a-ix<0 or b-iy<0:
continue
black_count = 0
for j in range(9):
jx,jy = divmod(j,3)
if H<=a-ix+jx or W<=b-iy+jy:
break
if (a-ix+jx,b-iy+jy) in D:
if -iy+jy<0 or (-iy+jy==0 and -ix+jx<0):
break
black_count += 1
else:
ans[black_count] += 1
ans[0] = (H-2)*(W-2)-sum(ans)
print(*ans,sep='\n') |
[
7,
15,
13,
15,
12,
13,
41,
28,
13,
4,
13,
13,
4,
2,
39,
13,
13,
12,
13,
23,
13,
23,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
13,
12,
13,
23,
13,
23,
13,
23,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
13,
12,
13,
23,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
23,
13,
23,
13,
17,
12,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
17,
12,
13,
12,
13,
12,
13,
12,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
4,
13,
2,
13,
17,
17,
4,
13,
2,
13,
17,
2,
13,
17,
28,
13,
4,
13,
4,
13,
2,
13,
17,
17,
4,
13,
2,
13,
17,
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,
4,
13,
2,
13,
4,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
17,
4,
13,
18,
13,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
12,
13,
10,
2,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
2,
13
] | [
[
9,
8
],
[
20,
20
],
[
22,
22
],
[
24,
24
],
[
28,
27
],
[
36,
36
],
[
38,
38
],
[
40,
40
],
[
42,
42
],
[
46,
45
],
[
54,
54
],
[
56,
56
],
[
58,
58
],
[
60,
60
],
[
62,
62
],
[
66,
66
],
[
69,
68
],
[
77,
76
],
[
273,
82
],
[
87,
86
],
[
245,
104
],
[
251,
109
],
[
257,
116
],
[
219,
118
],
[
257,
119
],
[
257,
120
],
[
269,
122
],
[
128,
127
],
[
240,
130
],
[
263,
132
],
[
219,
134
],
[
263,
135
],
[
138,
137
],
[
264,
143
],
[
264,
149
],
[
258,
152
],
[
156,
155
],
[
228,
161
],
[
228,
167
],
[
243,
170
],
[
178,
173
],
[
270,
174
],
[
266,
180
],
[
270,
185
],
[
281,
188
],
[
258,
191
],
[
243,
194
],
[
282,
199
],
[
267,
204
],
[
208,
207
],
[
267,
215
],
[
207,
216
],
[
263,
228
],
[
257,
240
],
[
257,
243
],
[
245,
246
],
[
251,
252
],
[
257,
258
],
[
263,
264
],
[
266,
267
],
[
269,
270
],
[
281,
282
]
] | [
"# -*- coding: utf-8 -*-\n\nimport sys\nfrom collections import defaultdict, Counter\n\ndef input(): return sys.stdin.readline().strip()\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\ndef list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\ndef ceil(x, y=1): return int(-(-x // y))\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]\ndef Yes(): print('Yes')\ndef No(): print('No')\ndef YES(): print('YES')\ndef NO(): print('NO')\nsys.setrecursionlimit(10 ** 9)\nINF = 10 ** 18\nMOD = 10 ** 9 + 7\n\nH, W, N = MAP()\nD = defaultdict(int)\n\n# あるマスが黒いことで黒マスが増える1〜9個の3*3正方形に+1する\nfor _ in range(N):\n a, b = MAP()\n for i in range(max(a-2, 1), min(a+1, H-1)):\n for j in range(max(b-2, 1), min(b+1, W-1)):\n D[(i, j)] += 1\n\nC = Counter(D.values())\ntotal = (H-2) * (W-2)\n# 0は 全体 - 合計 で出す\nprint(total - sum(C.values()))\nfor i in range(1, 10):\n print(C[i])",
"import sys",
"sys",
"from collections import defaultdict, Counter",
"def input(): return sys.stdin.readline().strip()",
"input",
"[c] * b for i in range(a)",
"for i in range(a)",
"i",
"range(a)",
"range",
"a",
"for i in range(a)",
"[c] * b",
"[c]",
"c",
"b",
"def list2d(a, b, c): return [[c] * b for i in range(a)]",
"list2d",
"a",
"a",
"b",
"b",
"c",
"c",
"[[d] * c for j in range(b)] for i in range(a)",
"for i in range(a)",
"i",
"range(a)",
"range",
"a",
"for i in range(a)",
"[[d] * c for j in range(b)]",
"def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]",
"list3d",
"a",
"a",
"b",
"b",
"c",
"c",
"d",
"d",
"[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)",
"for i in range(a)",
"i",
"range(a)",
"range",
"a",
"for i in range(a)",
"[[[e] * d for j in range(c)] for j in range(b)]",
"def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]",
"list4d",
"a",
"a",
"b",
"b",
"c",
"c",
"d",
"d",
"e",
"e",
"def ceil(x, y=1): return int(-(-x // y))",
"ceil",
"x",
"x",
"y=1",
"y",
"1",
"def INT(): return int(input())",
"INT",
"def MAP(): return map(int, input().split())",
"MAP",
"INT() for i in range(N)",
"for i in range(N)",
"i",
"range(N)",
"range",
"N",
"for i in range(N)",
"INT()",
"INT",
"def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]",
"LIST",
"N=None",
"N",
"None",
"def Yes(): print('Yes')",
"Yes",
"def No(): print('No')",
"No",
"def YES(): print('YES')",
"YES",
"def NO(): print('NO')",
"NO",
"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",
"H, W, N = MAP()",
"H",
"MAP()",
"MAP",
"W",
"N",
"D = defaultdict(int)",
"D",
"defaultdict(int)",
"defaultdict",
"int",
"for _ in range(N):\n a, b = MAP()\n for i in range(max(a-2, 1), min(a+1, H-1)):\n for j in range(max(b-2, 1), min(b+1, W-1)):\n D[(i, j)] += 1",
"_",
"range(N)",
"range",
"N",
"a, b = MAP()",
"a",
"MAP()",
"MAP",
"b",
"for i in range(max(a-2, 1), min(a+1, H-1)):\n for j in range(max(b-2, 1), min(b+1, W-1)):\n D[(i, j)] += 1",
"i",
"range(max(a-2, 1), min(a+1, H-1))",
"range",
"max(a-2, 1)",
"max",
"a-2",
"a",
"2",
"1",
"min(a+1, H-1)",
"min",
"a+1",
"a",
"1",
"H-1",
"H",
"1",
"for j in range(max(b-2, 1), min(b+1, W-1)):\n D[(i, j)] += 1",
"j",
"range(max(b-2, 1), min(b+1, W-1))",
"range",
"max(b-2, 1)",
"max",
"b-2",
"b",
"2",
"1",
"min(b+1, W-1)",
"min",
"b+1",
"b",
"1",
"W-1",
"W",
"1",
"D[(i, j)] += 1",
"D[(i, j)]",
"D",
"(i, j)",
"i",
"j",
"1",
"C = Counter(D.values())",
"C",
"Counter(D.values())",
"Counter",
"D.values()",
"D.values",
"D",
"values",
"total = (H-2) * (W-2)",
"total",
"(H-2) * (W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"print(total - sum(C.values()))",
"print",
"total - sum(C.values())",
"total",
"sum(C.values())",
"sum",
"C.values()",
"C.values",
"C",
"values",
"for i in range(1, 10):\n print(C[i])",
"i",
"range(1, 10)",
"range",
"1",
"10",
"print(C[i])",
"print",
"C[i]",
"C",
"i",
"def MAP(): return map(int, input().split())",
"def MAP(): return map(int, input().split())",
"MAP",
"def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]",
"def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]",
"LIST",
"def NO(): print('NO')",
"def NO(): print('NO')",
"NO",
"b = MAP()",
"MAP()",
"b",
"def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]",
"def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]",
"list4d",
"def YES(): print('YES')",
"def YES(): print('YES')",
"YES",
"def input(): return sys.stdin.readline().strip()",
"def input(): return sys.stdin.readline().strip()",
"input",
"N = MAP()",
"MAP()",
"N",
"W, N = MAP()",
"MAP()",
"W",
"INF = 10 ** 18",
"10 ** 18",
"INF",
"def No(): print('No')",
"def No(): print('No')",
"No",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"def list2d(a, b, c): return [[c] * b for i in range(a)]",
"def list2d(a, b, c): return [[c] * b for i in range(a)]",
"list2d",
"H, W, N = MAP()",
"MAP()",
"H",
"def Yes(): print('Yes')",
"def Yes(): print('Yes')",
"Yes",
"a, b = MAP()",
"MAP()",
"a",
"C = Counter(D.values())",
"Counter(D.values())",
"C",
"D = defaultdict(int)",
"defaultdict(int)",
"D",
"def INT(): return int(input())",
"def INT(): return int(input())",
"INT",
"def ceil(x, y=1): return int(-(-x // y))",
"def ceil(x, y=1): return int(-(-x // y))",
"ceil",
"def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]",
"def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]",
"list3d",
"total = (H-2) * (W-2)",
"(H-2) * (W-2)",
"total"
] | # -*- coding: utf-8 -*-
import sys
from collections import defaultdict, Counter
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7
H, W, N = MAP()
D = defaultdict(int)
# あるマスが黒いことで黒マスが増える1〜9個の3*3正方形に+1する
for _ in range(N):
a, b = MAP()
for i in range(max(a-2, 1), min(a+1, H-1)):
for j in range(max(b-2, 1), min(b+1, W-1)):
D[(i, j)] += 1
C = Counter(D.values())
total = (H-2) * (W-2)
# 0は 全体 - 合計 で出す
print(total - sum(C.values()))
for i in range(1, 10):
print(C[i])
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
41,
28,
13,
4,
13,
17,
4,
13,
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,
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,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
13,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13
] | [
[
160,
3
],
[
160,
12
],
[
160,
13
],
[
148,
15
],
[
22,
21
],
[
21,
26
],
[
163,
29
],
[
33,
32
],
[
155,
35
],
[
157,
37
],
[
157,
46
],
[
49,
48
],
[
54,
53
],
[
152,
63
],
[
48,
64
],
[
158,
68
],
[
53,
69
],
[
152,
73
],
[
48,
74
],
[
143,
76
],
[
158,
80
],
[
53,
81
],
[
161,
83
],
[
95,
86
],
[
149,
87
],
[
152,
90
],
[
48,
91
],
[
158,
93
],
[
53,
94
],
[
166,
97
],
[
149,
100
],
[
169,
102
],
[
106,
105
],
[
167,
108
],
[
149,
108
],
[
114,
111
],
[
164,
112
],
[
105,
113
],
[
145,
116
],
[
122,
119
],
[
164,
120
],
[
143,
125
],
[
161,
128
],
[
146,
130
],
[
170,
130
],
[
133,
132
],
[
111,
138
],
[
164,
139
],
[
132,
140
],
[
160,
143
],
[
145,
146
],
[
148,
149
],
[
157,
152
],
[
160,
155
],
[
157,
158
],
[
160,
161
],
[
163,
164
],
[
166,
167
],
[
169,
170
]
] | [
"from collections import defaultdict as dd\n\nh,w,n=map(int,input().split())\nd=dd(int)\nc={i:0 for i in range(10)}\n\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 a-i>0 and b-j>0 and a-i<=h-2 and b-j<=w-2:\n d[(a-i,b-j)]+=1\n\nd=dict(d)\nv=0\nfor i in d.values():\n c[i]+=1\n v+=1\nc[0]=(h-2)*(w-2)-v\n\nfor i in range(10):\n print(c[i])",
"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",
"d=dd(int)",
"d",
"dd(int)",
"dd",
"int",
"i:0 for i in range(10)",
"for i in range(10)",
"i",
"range(10)",
"range",
"10",
"for i in range(10)",
"i",
"0",
"c={i:0 for i in range(10)}",
"c",
"{i:0 for i in range(10)}",
"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 a-i>0 and b-j>0 and a-i<=h-2 and b-j<=w-2:\n d[(a-i,b-j)]+=1",
"_",
"range(n)",
"range",
"n",
"a,b=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in range(3):\n for j in range(3):\n if a-i>0 and b-j>0 and a-i<=h-2 and b-j<=w-2:\n d[(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-i<=h-2 and b-j<=w-2:\n d[(a-i,b-j)]+=1",
"j",
"range(3)",
"range",
"3",
"if a-i>0 and b-j>0 and a-i<=h-2 and b-j<=w-2:\n d[(a-i,b-j)]+=1",
"a-i>0 and b-j>0 and a-i<=h-2 and b-j<=w-2",
"a-i>0 and b-j>0 and a-i<=h-2",
"a-i>0 and 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",
"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=dict(d)",
"d",
"dict(d)",
"dict",
"d",
"v=0",
"v",
"0",
"for i in d.values():\n c[i]+=1\n v+=1",
"i",
"d.values()",
"d.values",
"d",
"values",
"c[i]+=1",
"c[i]",
"c",
"i",
"1",
"v+=1",
"v",
"1",
"c[0]=(h-2)*(w-2)-v",
"c[0]",
"c",
"0",
"(h-2)*(w-2)-v",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"v",
"for i in range(10):\n print(c[i])",
"i",
"range(10)",
"range",
"10",
"print(c[i])",
"print",
"c[i]",
"c",
"i",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"v+=1",
"1",
"v",
"d=dd(int)",
"dd(int)",
"d",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"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",
"c={i:0 for i in range(10)}",
"{i:0 for i in range(10)}",
"c",
"d=dict(d)",
"dict(d)",
"d",
"v=0",
"0",
"v"
] | from collections import defaultdict as dd
h,w,n=map(int,input().split())
d=dd(int)
c={i:0 for i in range(10)}
for _ in range(n):
a,b=map(int,input().split())
for i in range(3):
for j in range(3):
if a-i>0 and b-j>0 and a-i<=h-2 and b-j<=w-2:
d[(a-i,b-j)]+=1
d=dict(d)
v=0
for i in d.values():
c[i]+=1
v+=1
c[0]=(h-2)*(w-2)-v
for i in range(10):
print(c[i])
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
12,
17,
12,
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,
13,
2,
40,
17,
13,
13,
0,
18,
13,
39,
13,
13,
17,
23,
13,
23,
13,
28,
13,
4,
13,
13,
4,
13,
31,
18,
13,
13,
0,
13,
4,
13,
12,
17,
28,
13,
13,
13,
0,
18,
13,
18,
13,
39,
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,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13
] | [
[
166,
3
],
[
166,
12
],
[
166,
13
],
[
17,
16
],
[
158,
19
],
[
163,
32
],
[
151,
35
],
[
44,
43
],
[
50,
49
],
[
56,
55
],
[
83,
57
],
[
43,
58
],
[
60,
59
],
[
85,
61
],
[
49,
62
],
[
55,
68
],
[
155,
69
],
[
59,
73
],
[
167,
74
],
[
81,
76
],
[
152,
77
],
[
83,
83
],
[
85,
85
],
[
88,
87
],
[
158,
90
],
[
161,
92
],
[
164,
95
],
[
87,
96
],
[
169,
98
],
[
115,
108
],
[
170,
109
],
[
152,
111
],
[
120,
117
],
[
170,
118
],
[
155,
122
],
[
167,
125
],
[
129,
128
],
[
137,
134
],
[
170,
135
],
[
170,
138
],
[
128,
139
],
[
142,
141
],
[
170,
148
],
[
141,
149
],
[
151,
152
],
[
166,
155
],
[
166,
158
],
[
163,
164
],
[
166,
167
],
[
169,
170
]
] | [
"from collections import defaultdict\nH,W,N = map(int,input().split())\nab = [tuple(map(int,input().split())) for _ in range(N)]\n\nd = defaultdict(lambda:0)\ndef count(a,b):\n for dx1 in [-1,0,1]:\n for dy1 in [-1,0,1]:\n x,y = a+dx1,b+dy1\n if 2<=x<H and 2<=y<W:\n d[(x,y)] += 1\n\nfor i in range(N):\n count(*ab[i])\n\nans = defaultdict(lambda:0)\nfor x,y in d:\n ans[d[(x,y)]] += 1\n\nans[0] = (H-2)*(W-2)\nfor i in range(1,10):\n ans[0] -= ans[i]\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",
"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)]",
"d = defaultdict(lambda:0)",
"d",
"defaultdict(lambda:0)",
"defaultdict",
"lambda:0",
"0",
"def count(a,b):\n for dx1 in [-1,0,1]:\n for dy1 in [-1,0,1]:\n x,y = a+dx1,b+dy1\n if 2<=x<H and 2<=y<W:\n d[(x,y)] += 1",
"count",
"for dx1 in [-1,0,1]:\n for dy1 in [-1,0,1]:\n x,y = a+dx1,b+dy1\n if 2<=x<H and 2<=y<W:\n d[(x,y)] += 1",
"dx1",
"[-1,0,1]",
"-1",
"0",
"1",
"for dy1 in [-1,0,1]:\n x,y = a+dx1,b+dy1\n if 2<=x<H and 2<=y<W:\n d[(x,y)] += 1",
"dy1",
"[-1,0,1]",
"-1",
"0",
"1",
"x,y = a+dx1,b+dy1",
"x",
"a+dx1",
"a",
"dx1",
"y",
"b+dy1",
"b",
"dy1",
"if 2<=x<H and 2<=y<W:\n d[(x,y)] += 1",
"2<=x<H and 2<=y<W",
"2<=x<H",
"2<=x",
"2",
"x",
"H",
"2<=y<W",
"2<=y",
"2",
"y",
"W",
"d[(x,y)] += 1",
"d[(x,y)]",
"d",
"(x,y)",
"x",
"y",
"1",
"a",
"a",
"b",
"b",
"for i in range(N):\n count(*ab[i])",
"i",
"range(N)",
"range",
"N",
"count(*ab[i])",
"count",
"*ab[i]",
"ab[i]",
"ab",
"i",
"ans = defaultdict(lambda:0)",
"ans",
"defaultdict(lambda:0)",
"defaultdict",
"lambda:0",
"0",
"for x,y in d:\n ans[d[(x,y)]] += 1",
"x",
"y",
"d",
"ans[d[(x,y)]] += 1",
"ans[d[(x,y)]]",
"ans",
"d[(x,y)]",
"d",
"(x,y)",
"x",
"y",
"1",
"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 range(1,10):\n ans[0] -= ans[i]",
"i",
"range(1,10)",
"range",
"1",
"10",
"ans[0] -= ans[i]",
"ans[0]",
"ans",
"0",
"ans[i]",
"ans",
"i",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"d = defaultdict(lambda:0)",
"defaultdict(lambda:0)",
"d",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"def count(a,b):\n for dx1 in [-1,0,1]:\n for dy1 in [-1,0,1]:\n x,y = a+dx1,b+dy1\n if 2<=x<H and 2<=y<W:\n d[(x,y)] += 1",
"def count(a,b):\n for dx1 in [-1,0,1]:\n for dy1 in [-1,0,1]:\n x,y = a+dx1,b+dy1\n if 2<=x<H and 2<=y<W:\n d[(x,y)] += 1",
"count",
"ab = [tuple(map(int,input().split())) for _ in range(N)]",
"[tuple(map(int,input().split())) for _ in range(N)]",
"ab",
"W,N = map(int,input().split())",
"map(int,input().split())",
"W",
"ans = defaultdict(lambda:0)",
"defaultdict(lambda:0)",
"ans"
] | from collections import defaultdict
H,W,N = map(int,input().split())
ab = [tuple(map(int,input().split())) for _ in range(N)]
d = defaultdict(lambda:0)
def count(a,b):
for dx1 in [-1,0,1]:
for dy1 in [-1,0,1]:
x,y = a+dx1,b+dy1
if 2<=x<H and 2<=y<W:
d[(x,y)] += 1
for i in range(N):
count(*ab[i])
ans = defaultdict(lambda:0)
for x,y in d:
ans[d[(x,y)]] += 1
ans[0] = (H-2)*(W-2)
for i in range(1,10):
ans[0] -= ans[i]
for i in range(10):
print(ans[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,
2,
2,
13,
17,
2,
13,
17,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
4,
18,
13,
13,
39,
2,
2,
13,
13,
17,
2,
2,
13,
13,
17,
4,
18,
13,
13,
0,
13,
12,
2,
2,
2,
17,
17,
18,
13,
17,
18,
13,
17,
23,
0,
13,
4,
13,
13,
4,
18,
13,
13,
39,
2,
17,
17,
2,
17,
17,
0,
13,
2,
39,
17,
17,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
40,
40,
17,
18,
18,
13,
13,
17,
2,
13,
17,
40,
40,
17,
18,
18,
13,
13,
17,
2,
13,
17,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
0,
18,
13,
13,
17,
0,
13,
17,
0,
18,
13,
17,
2,
13,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
39,
13
] | [
[
215,
4
],
[
218,
11
],
[
216,
18
],
[
218,
20
],
[
218,
21
],
[
203,
23
],
[
198,
26
],
[
219,
29
],
[
221,
32
],
[
36,
35
],
[
213,
38
],
[
209,
40
],
[
216,
47
],
[
209,
49
],
[
52,
51
],
[
57,
56
],
[
222,
62
],
[
210,
67
],
[
51,
68
],
[
189,
72
],
[
56,
73
],
[
222,
77
],
[
81,
80
],
[
206,
95
],
[
222,
98
],
[
222,
101
],
[
191,
111
],
[
185,
117
],
[
121,
120
],
[
207,
123
],
[
213,
123
],
[
222,
131
],
[
120,
132
],
[
198,
135
],
[
222,
142
],
[
120,
143
],
[
219,
146
],
[
222,
151
],
[
120,
152
],
[
222,
154
],
[
120,
156
],
[
200,
159
],
[
165,
162
],
[
192,
163
],
[
186,
164
],
[
195,
164
],
[
201,
164
],
[
194,
167
],
[
173,
170
],
[
192,
171
],
[
204,
174
],
[
192,
177
],
[
180,
179
],
[
192,
179
],
[
179,
183
],
[
185,
186
],
[
209,
189
],
[
191,
192
],
[
194,
195
],
[
218,
198
],
[
200,
201
],
[
203,
204
],
[
206,
207
],
[
209,
210
],
[
218,
213
],
[
215,
216
],
[
218,
219
],
[
221,
222
]
] | [
"import sys\ninput=sys.stdin.readline\nh,w,n=map(int,input().split())\nz=(h-2)*(w-2)\np=[]\nfor i in range(n):\n x,y=map(int,input().split())\n for j in range(3):\n for k in range(3):\n p.append([x+j-1,y+k-1])\np.sort(key=lambda x:(10**10)*x[0]+x[1])\nn=len(p)\np.append([10**20,10**20])\nans=[0]*10\nf=1\nfor i in range(n):\n if 2<=p[i][0]<=h-1 and 2<=p[i][1]<=w-1:\n if p[i]==p[i+1]:\n f+=1\n else:\n ans[f]+=1\n f=1\nans[0]=z-sum(ans)\nfor i in ans:\n print(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",
"z=(h-2)*(w-2)",
"z",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"p=[]",
"p",
"[]",
"for i in range(n):\n x,y=map(int,input().split())\n for j in range(3):\n for k in range(3):\n p.append([x+j-1,y+k-1])",
"i",
"range(n)",
"range",
"n",
"x,y=map(int,input().split())",
"x",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"for j in range(3):\n for k in range(3):\n p.append([x+j-1,y+k-1])",
"j",
"range(3)",
"range",
"3",
"for k in range(3):\n p.append([x+j-1,y+k-1])",
"k",
"range(3)",
"range",
"3",
"p.append([x+j-1,y+k-1])",
"p.append",
"p",
"append",
"[x+j-1,y+k-1]",
"x+j-1",
"x+j",
"x",
"j",
"1",
"y+k-1",
"y+k",
"y",
"k",
"1",
"p.sort(key=lambda x:(10**10)*x[0]+x[1])",
"p.sort",
"p",
"sort",
"key=lambda x:(10**10)*x[0]+x[1]",
"key",
"lambda x:(10**10)*x[0]+x[1]",
"(10**10)*x[0]+x[1]",
"(10**10)*x[0]",
"10**10",
"10",
"10",
"x[0]",
"x",
"0",
"x[1]",
"x",
"1",
"x",
"n=len(p)",
"n",
"len(p)",
"len",
"p",
"p.append([10**20,10**20])",
"p.append",
"p",
"append",
"[10**20,10**20]",
"10**20",
"10",
"20",
"10**20",
"10",
"20",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"f=1",
"f",
"1",
"for i in range(n):\n if 2<=p[i][0]<=h-1 and 2<=p[i][1]<=w-1:\n if p[i]==p[i+1]:\n f+=1\n else:\n ans[f]+=1\n f=1",
"i",
"range(n)",
"range",
"n",
"if 2<=p[i][0]<=h-1 and 2<=p[i][1]<=w-1:\n if p[i]==p[i+1]:\n f+=1\n else:\n ans[f]+=1\n f=1",
"2<=p[i][0]<=h-1 and 2<=p[i][1]<=w-1",
"2<=p[i][0]<=h-1",
"2<=p[i][0]",
"2",
"p[i][0]",
"[i]",
"p",
"i",
"0",
"h-1",
"h",
"1",
"2<=p[i][1]<=w-1",
"2<=p[i][1]",
"2",
"p[i][1]",
"[i]",
"p",
"i",
"1",
"w-1",
"w",
"1",
"if p[i]==p[i+1]:\n f+=1\n else:\n ans[f]+=1\n f=1",
"p[i]==p[i+1]",
"p[i]",
"p",
"i",
"p[i+1]",
"p",
"i+1",
"i",
"1",
"f+=1",
"f",
"1",
"ans[f]+=1",
"ans[f]",
"ans",
"f",
"1",
"f=1",
"f",
"1",
"ans[0]=z-sum(ans)",
"ans[0]",
"ans",
"0",
"z-sum(ans)",
"z",
"sum(ans)",
"sum",
"ans",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"f=1",
"1",
"f",
"y=map(int,input().split())",
"map(int,input().split())",
"y",
"ans=[0]*10",
"[0]*10",
"ans",
"f=1",
"1",
"f",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"f+=1",
"1",
"f",
"z=(h-2)*(w-2)",
"(h-2)*(w-2)",
"z",
"n=len(p)",
"len(p)",
"n",
"x,y=map(int,input().split())",
"map(int,input().split())",
"x",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"input=sys.stdin.readline",
"sys.stdin.readline",
"input",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"p=[]",
"[]",
"p"
] | import sys
input=sys.stdin.readline
h,w,n=map(int,input().split())
z=(h-2)*(w-2)
p=[]
for i in range(n):
x,y=map(int,input().split())
for j in range(3):
for k in range(3):
p.append([x+j-1,y+k-1])
p.sort(key=lambda x:(10**10)*x[0]+x[1])
n=len(p)
p.append([10**20,10**20])
ans=[0]*10
f=1
for i in range(n):
if 2<=p[i][0]<=h-1 and 2<=p[i][1]<=w-1:
if p[i]==p[i+1]:
f+=1
else:
ans[f]+=1
f=1
ans[0]=z-sum(ans)
for i in ans:
print(i)
|
[
7,
15,
13,
15,
12,
13,
0,
13,
39,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
29,
13,
23,
13,
23,
13,
12,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
12,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
13,
13,
28,
13,
13,
14,
2,
2,
2,
40,
18,
13,
17,
17,
2,
2,
18,
13,
17,
17,
13,
40,
18,
13,
17,
17,
2,
2,
18,
13,
17,
17,
13,
9,
0,
18,
13,
13,
17,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
28,
13,
4,
18,
13,
13,
0,
13,
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,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13
] | [
[
8,
7
],
[
11,
10
],
[
16,
15
],
[
7,
21
],
[
33,
25
],
[
10,
26
],
[
35,
28
],
[
15,
29
],
[
7,
31
],
[
33,
33
],
[
35,
35
],
[
40,
39
],
[
47,
46
],
[
39,
53
],
[
47,
55
],
[
47,
56
],
[
59,
58
],
[
65,
64
],
[
56,
67
],
[
70,
69
],
[
39,
76
],
[
70,
78
],
[
81,
80
],
[
178,
82
],
[
69,
83
],
[
78,
84
],
[
87,
86
],
[
80,
86
],
[
86,
94
],
[
86,
100
],
[
46,
103
],
[
86,
106
],
[
86,
112
],
[
55,
115
],
[
121,
118
],
[
58,
119
],
[
86,
120
],
[
125,
124
],
[
132,
131
],
[
135,
134
],
[
58,
137
],
[
141,
140
],
[
58,
142
],
[
134,
143
],
[
148,
145
],
[
131,
146
],
[
140,
147
],
[
153,
150
],
[
131,
151
],
[
46,
156
],
[
55,
159
],
[
131,
163
],
[
166,
165
],
[
131,
165
],
[
165,
169
],
[
181,
175
]
] | [
"import sys\nfrom collections import defaultdict\n\ndef get_rect_pos(a, b):\n pos = []\n for i in range(3):\n for j in range(3):\n pos.append((a-i, b-j))\n\n return pos\n\n\ndef main():\n input = sys.stdin.readline\n H, W, N = map(int, input().split())\n d = defaultdict(lambda: 0)\n for _ in range(N):\n a, b = map(int, input().split())\n pos = get_rect_pos(a, b)\n for p in pos:\n if p[0] <= 0 or p[0] + 2 > H or p[1] <= 0 or p[1] + 2 > W:\n continue\n\n d[p] += 1\n\n ans = [0 for _ in range(10)]\n for key in d.keys():\n i = d[key]\n ans[i] += 1\n\n ans[0] = (H - 2) * (W - 2) - sum(ans)\n\n for i in ans:\n print(i)\n\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"from collections import defaultdict",
"def get_rect_pos(a, b):\n pos = []\n for i in range(3):\n for j in range(3):\n pos.append((a-i, b-j))\n\n return pos",
"get_rect_pos",
"pos = []",
"pos",
"[]",
"for i in range(3):\n for j in range(3):\n pos.append((a-i, b-j))\n\n ",
"i",
"range(3)",
"range",
"3",
"for j in range(3):\n pos.append((a-i, b-j))\n\n ",
"j",
"range(3)",
"range",
"3",
"pos.append((a-i, b-j))",
"pos.append",
"pos",
"append",
"(a-i, b-j)",
"a-i",
"a",
"i",
"b-j",
"b",
"j",
"return pos",
"pos",
"a",
"a",
"b",
"b",
"def main():\n input = sys.stdin.readline\n H, W, N = map(int, input().split())\n d = defaultdict(lambda: 0)\n for _ in range(N):\n a, b = map(int, input().split())\n pos = get_rect_pos(a, b)\n for p in pos:\n if p[0] <= 0 or p[0] + 2 > H or p[1] <= 0 or p[1] + 2 > W:\n continue\n\n d[p] += 1\n\n ans = [0 for _ in range(10)]\n for key in d.keys():\n i = d[key]\n ans[i] += 1\n\n ans[0] = (H - 2) * (W - 2) - sum(ans)\n\n for i in ans:\n print(i)",
"main",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"d = defaultdict(lambda: 0)",
"d",
"defaultdict(lambda: 0)",
"defaultdict",
"lambda: 0",
"0",
"for _ in range(N):\n a, b = map(int, input().split())\n pos = get_rect_pos(a, b)\n for p in pos:\n if p[0] <= 0 or p[0] + 2 > H or p[1] <= 0 or p[1] + 2 > W:\n continue\n\n d[p] += 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",
"pos = get_rect_pos(a, b)",
"pos",
"get_rect_pos(a, b)",
"get_rect_pos",
"a",
"b",
"for p in pos:\n if p[0] <= 0 or p[0] + 2 > H or p[1] <= 0 or p[1] + 2 > W:\n continue\n\n d[p] += 1\n\n ",
"p",
"pos",
"if p[0] <= 0 or p[0] + 2 > H or p[1] <= 0 or p[1] + 2 > W:\n continue\n\n ",
"p[0] <= 0 or p[0] + 2 > H or p[1] <= 0 or p[1] + 2 > W",
"p[0] <= 0 or p[0] + 2 > H or p[1] <= 0",
"p[0] <= 0 or p[0] + 2 > H",
"p[0] <= 0",
"p[0]",
"p",
"0",
"0",
"p[0] + 2 > H",
"p[0] + 2",
"p[0]",
"p",
"0",
"2",
"H",
"p[1] <= 0",
"p[1]",
"p",
"1",
"0",
"p[1] + 2 > W",
"p[1] + 2",
"p[1]",
"p",
"1",
"2",
"W",
"continue",
"d[p] += 1",
"d[p]",
"d",
"p",
"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)]",
"for key in d.keys():\n i = d[key]\n ans[i] += 1\n\n ",
"key",
"d.keys()",
"d.keys",
"d",
"keys",
"i = d[key]",
"i",
"d[key]",
"d",
"key",
"ans[i] += 1",
"ans[i]",
"ans",
"i",
"1",
"ans[0] = (H - 2) * (W - 2) - sum(ans)",
"ans[0]",
"ans",
"0",
"(H - 2) * (W - 2) - sum(ans)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(ans)",
"sum",
"ans",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def get_rect_pos(a, b):\n pos = []\n for i in range(3):\n for j in range(3):\n pos.append((a-i, b-j))\n\n return pos",
"def get_rect_pos(a, b):\n pos = []\n for i in range(3):\n for j in range(3):\n pos.append((a-i, b-j))\n\n return pos",
"get_rect_pos",
"def main():\n input = sys.stdin.readline\n H, W, N = map(int, input().split())\n d = defaultdict(lambda: 0)\n for _ in range(N):\n a, b = map(int, input().split())\n pos = get_rect_pos(a, b)\n for p in pos:\n if p[0] <= 0 or p[0] + 2 > H or p[1] <= 0 or p[1] + 2 > W:\n continue\n\n d[p] += 1\n\n ans = [0 for _ in range(10)]\n for key in d.keys():\n i = d[key]\n ans[i] += 1\n\n ans[0] = (H - 2) * (W - 2) - sum(ans)\n\n for i in ans:\n print(i)",
"def main():\n input = sys.stdin.readline\n H, W, N = map(int, input().split())\n d = defaultdict(lambda: 0)\n for _ in range(N):\n a, b = map(int, input().split())\n pos = get_rect_pos(a, b)\n for p in pos:\n if p[0] <= 0 or p[0] + 2 > H or p[1] <= 0 or p[1] + 2 > W:\n continue\n\n d[p] += 1\n\n ans = [0 for _ in range(10)]\n for key in d.keys():\n i = d[key]\n ans[i] += 1\n\n ans[0] = (H - 2) * (W - 2) - sum(ans)\n\n for i in ans:\n print(i)",
"main"
] | import sys
from collections import defaultdict
def get_rect_pos(a, b):
pos = []
for i in range(3):
for j in range(3):
pos.append((a-i, b-j))
return pos
def main():
input = sys.stdin.readline
H, W, N = map(int, input().split())
d = defaultdict(lambda: 0)
for _ in range(N):
a, b = map(int, input().split())
pos = get_rect_pos(a, b)
for p in pos:
if p[0] <= 0 or p[0] + 2 > H or p[1] <= 0 or p[1] + 2 > W:
continue
d[p] += 1
ans = [0 for _ in range(10)]
for key in d.keys():
i = d[key]
ans[i] += 1
ans[0] = (H - 2) * (W - 2) - sum(ans)
for i in ans:
print(i)
if __name__ == '__main__':
main()
|
[
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,
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,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
39,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13
] | [
[
167,
5
],
[
176,
12
],
[
168,
19
],
[
176,
21
],
[
176,
22
],
[
191,
24
],
[
33,
30
],
[
192,
31
],
[
177,
35
],
[
162,
38
],
[
170,
41
],
[
185,
47
],
[
53,
52
],
[
165,
55
],
[
182,
57
],
[
168,
64
],
[
182,
66
],
[
188,
68
],
[
194,
71
],
[
75,
74
],
[
171,
74
],
[
189,
81
],
[
180,
81
],
[
74,
82
],
[
177,
84
],
[
88,
87
],
[
171,
87
],
[
195,
94
],
[
183,
94
],
[
87,
95
],
[
162,
97
],
[
173,
100
],
[
186,
102
],
[
189,
105
],
[
180,
105
],
[
74,
106
],
[
195,
108
],
[
183,
108
],
[
87,
109
],
[
120,
111
],
[
186,
112
],
[
189,
115
],
[
180,
115
],
[
74,
116
],
[
195,
118
],
[
183,
118
],
[
87,
119
],
[
189,
127
],
[
180,
127
],
[
74,
128
],
[
177,
130
],
[
195,
136
],
[
183,
136
],
[
87,
137
],
[
162,
139
],
[
145,
142
],
[
192,
143
],
[
174,
144
],
[
152,
147
],
[
192,
148
],
[
174,
150
],
[
192,
156
],
[
159,
158
],
[
176,
162
],
[
176,
165
],
[
167,
168
],
[
170,
171
],
[
173,
174
],
[
176,
177
],
[
182,
180
],
[
182,
183
],
[
185,
186
],
[
188,
189
],
[
191,
192
],
[
194,
195
]
] | [
"from collections import defaultdict\nimport sys\ninput = sys.stdin.readline\n\nH, W, N = map(int, input().split())\nans = [0] * 10\nans[0] = (H - 2) * (W - 2)\n# print (ans)\ntmplst = [-1, 0, 1]\ndic = defaultdict(int)\nfor _ 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\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",
"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",
"_",
"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",
"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",
"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",
"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",
"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",
"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'",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"tmplst = [-1, 0, 1]",
"[-1, 0, 1]",
"tmplst",
"tmp = dic[(a + i, b + j)]",
"dic[(a + i, b + j)]",
"tmp",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"dic = defaultdict(int)",
"defaultdict(int)",
"dic",
"a -= 1",
"1",
"a",
"ans = [0] * 10",
"[0] * 10",
"ans",
"b -= 1",
"1",
"b"
] | 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') |
[
7,
15,
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,
12,
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,
2,
13,
17,
17,
4,
13,
13,
2,
13,
17,
28,
13,
4,
13,
4,
13,
2,
13,
17,
17,
4,
13,
13,
2,
13,
17,
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,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
2,
13
] | [
[
142,
3
],
[
142,
12
],
[
142,
13
],
[
145,
15
],
[
24,
21
],
[
146,
22
],
[
134,
26
],
[
125,
29
],
[
130,
32
],
[
41,
40
],
[
143,
43
],
[
136,
45
],
[
136,
54
],
[
57,
56
],
[
137,
62
],
[
137,
67
],
[
134,
69
],
[
73,
72
],
[
128,
78
],
[
128,
83
],
[
125,
85
],
[
139,
88
],
[
107,
89
],
[
131,
91
],
[
56,
92
],
[
72,
93
],
[
98,
95
],
[
146,
96
],
[
140,
97
],
[
105,
100
],
[
146,
101
],
[
140,
103
],
[
112,
107
],
[
131,
109
],
[
56,
110
],
[
72,
111
],
[
115,
114
],
[
146,
121
],
[
114,
122
],
[
142,
125
],
[
136,
128
],
[
130,
131
],
[
142,
134
],
[
136,
137
],
[
107,
139
],
[
139,
140
],
[
142,
143
],
[
145,
146
]
] | [
"from collections import defaultdict\nH, W, N = map(int, input().split())\nP = [0] * 10\nP[0] = (H - 2) * (W - 2)\nG = defaultdict(lambda: defaultdict(int))\nfor i in range(N):\n a, b = map(int, input().split())\n for i in range(max(a - 3, 0), min(a, H - 2)):\n for j in range(max(b - 3, 0), min(b, W - 2)):\n p = G[i][j]\n P[p] -= 1\n P[p + 1] += 1\n G[i][j] += 1\nfor i in range(10):\n print(P[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",
"P = [0] * 10",
"P",
"[0] * 10",
"[0]",
"0",
"10",
"P[0] = (H - 2) * (W - 2)",
"P[0]",
"P",
"0",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"G = defaultdict(lambda: defaultdict(int))",
"G",
"defaultdict(lambda: defaultdict(int))",
"defaultdict",
"lambda: defaultdict(int)",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n a, b = map(int, input().split())\n for i in range(max(a - 3, 0), min(a, H - 2)):\n for j in range(max(b - 3, 0), min(b, W - 2)):\n p = G[i][j]\n P[p] -= 1\n P[p + 1] += 1\n G[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",
"for i in range(max(a - 3, 0), min(a, H - 2)):\n for j in range(max(b - 3, 0), min(b, W - 2)):\n p = G[i][j]\n P[p] -= 1\n P[p + 1] += 1\n G[i][j] += 1",
"i",
"range(max(a - 3, 0), min(a, H - 2))",
"range",
"max(a - 3, 0)",
"max",
"a - 3",
"a",
"3",
"0",
"min(a, H - 2)",
"min",
"a",
"H - 2",
"H",
"2",
"for j in range(max(b - 3, 0), min(b, W - 2)):\n p = G[i][j]\n P[p] -= 1\n P[p + 1] += 1\n G[i][j] += 1",
"j",
"range(max(b - 3, 0), min(b, W - 2))",
"range",
"max(b - 3, 0)",
"max",
"b - 3",
"b",
"3",
"0",
"min(b, W - 2)",
"min",
"b",
"W - 2",
"W",
"2",
"p = G[i][j]",
"p",
"G[i][j]",
"[i]",
"G",
"i",
"j",
"P[p] -= 1",
"P[p]",
"P",
"p",
"1",
"P[p + 1] += 1",
"P[p + 1]",
"P",
"p + 1",
"p",
"1",
"1",
"G[i][j] += 1",
"G[i][j]",
"[i]",
"G",
"i",
"j",
"1",
"for i in range(10):\n print(P[i])",
"i",
"range(10)",
"range",
"10",
"print(P[i])",
"print",
"P[i]",
"P",
"i",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"G = defaultdict(lambda: defaultdict(int))",
"defaultdict(lambda: defaultdict(int))",
"G",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"p = G[i][j]",
"G[i][j]",
"p",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"P = [0] * 10",
"[0] * 10",
"P"
] | from collections import defaultdict
H, W, N = map(int, input().split())
P = [0] * 10
P[0] = (H - 2) * (W - 2)
G = defaultdict(lambda: defaultdict(int))
for i in range(N):
a, b = map(int, input().split())
for i in range(max(a - 3, 0), min(a, H - 2)):
for j in range(max(b - 3, 0), min(b, W - 2)):
p = G[i][j]
P[p] -= 1
P[p + 1] += 1
G[i][j] += 1
for i in range(10):
print(P[i]) |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
4,
18,
13,
13,
39,
13,
13,
0,
13,
4,
13,
28,
13,
4,
13,
13,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
14,
2,
40,
40,
17,
2,
18,
18,
13,
13,
17,
13,
13,
40,
40,
17,
2,
18,
18,
13,
13,
17,
13,
13,
14,
40,
39,
2,
18,
18,
13,
13,
17,
13,
2,
18,
18,
13,
13,
17,
13,
13,
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,
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,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
214,
3
],
[
214,
12
],
[
214,
13
],
[
208,
15
],
[
19,
18
],
[
206,
21
],
[
220,
23
],
[
220,
32
],
[
209,
35
],
[
223,
41
],
[
46,
45
],
[
206,
48
],
[
51,
50
],
[
56,
55
],
[
209,
67
],
[
45,
68
],
[
50,
70
],
[
215,
71
],
[
209,
78
],
[
45,
79
],
[
55,
81
],
[
200,
82
],
[
209,
89
],
[
45,
90
],
[
50,
92
],
[
209,
96
],
[
45,
97
],
[
55,
99
],
[
224,
100
],
[
119,
102
],
[
224,
103
],
[
209,
108
],
[
45,
109
],
[
50,
111
],
[
209,
115
],
[
45,
116
],
[
55,
118
],
[
138,
121
],
[
224,
122
],
[
209,
127
],
[
45,
128
],
[
50,
130
],
[
209,
134
],
[
45,
135
],
[
55,
137
],
[
202,
140
],
[
224,
145
],
[
150,
149
],
[
211,
156
],
[
203,
163
],
[
173,
170
],
[
212,
171
],
[
178,
175
],
[
212,
176
],
[
215,
181
],
[
200,
184
],
[
212,
189
],
[
194,
193
],
[
212,
193
],
[
193,
197
],
[
214,
200
],
[
202,
203
],
[
214,
206
],
[
208,
209
],
[
211,
212
],
[
214,
215
],
[
220,
218
],
[
220,
221
],
[
223,
224
]
] | [
"from collections import defaultdict, Counter\nH, W, N = map(int, input().split())\nL = []\nfor _ in range(N):\n a, b = map(int, input().split())\n L.append([a, b])\n\n# 黒いマスからスタートして右下の3 * 3グリッドマスにたどり着きたい場合はこう!\nd = defaultdict()\nfor i in range(N):\n for sx in range(3):\n for sy in range(3):\n if 3 <= L[i][0] + sx <= H and 3 <= L[i][1] + sy <= W:\n if (L[i][0] + sx, L[i][1] + sy) not in d:\n d[(L[i][0] + sx, L[i][1] + sy)] = 1\n else:\n d[(L[i][0] + sx, L[i][1] + sy)] += 1\n\n# print(d)\nc = Counter(d.values())\nans = [0 for _ in range(10)]\n\nfor k, v in c.items():\n if v > 0:\n ans[k] = v\n\nans[0] = (H - 2) * (W - 2) - sum(ans[1:])\n\nfor i in ans:\n print(i)",
"from collections import defaultdict, Counter",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"L = []",
"L",
"[]",
"for _ in range(N):\n a, b = map(int, input().split())\n L.append([a, b])\n\n# 黒いマスからスタートして右下の3 * 3グリッドマスにたどり着きたい場合はこう!",
"_",
"range(N)",
"range",
"N",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"L.append([a, b])",
"L.append",
"L",
"append",
"[a, b]",
"a",
"b",
"d = defaultdict()",
"d",
"defaultdict()",
"defaultdict",
"for i in range(N):\n for sx in range(3):\n for sy in range(3):\n if 3 <= L[i][0] + sx <= H and 3 <= L[i][1] + sy <= W:\n if (L[i][0] + sx, L[i][1] + sy) not in d:\n d[(L[i][0] + sx, L[i][1] + sy)] = 1\n else:\n d[(L[i][0] + sx, L[i][1] + sy)] += 1\n\n# print(d)",
"i",
"range(N)",
"range",
"N",
"for sx in range(3):\n for sy in range(3):\n if 3 <= L[i][0] + sx <= H and 3 <= L[i][1] + sy <= W:\n if (L[i][0] + sx, L[i][1] + sy) not in d:\n d[(L[i][0] + sx, L[i][1] + sy)] = 1\n else:\n d[(L[i][0] + sx, L[i][1] + sy)] += 1\n\n# print(d)",
"sx",
"range(3)",
"range",
"3",
"for sy in range(3):\n if 3 <= L[i][0] + sx <= H and 3 <= L[i][1] + sy <= W:\n if (L[i][0] + sx, L[i][1] + sy) not in d:\n d[(L[i][0] + sx, L[i][1] + sy)] = 1\n else:\n d[(L[i][0] + sx, L[i][1] + sy)] += 1\n\n# print(d)",
"sy",
"range(3)",
"range",
"3",
"if 3 <= L[i][0] + sx <= H and 3 <= L[i][1] + sy <= W:\n if (L[i][0] + sx, L[i][1] + sy) not in d:\n d[(L[i][0] + sx, L[i][1] + sy)] = 1\n else:\n d[(L[i][0] + sx, L[i][1] + sy)] += 1\n\n# print(d)",
"3 <= L[i][0] + sx <= H and 3 <= L[i][1] + sy <= W",
"3 <= L[i][0] + sx <= H",
"3 <= L[i][0] + sx",
"3",
"L[i][0] + sx",
"L[i][0]",
"[i]",
"L",
"i",
"0",
"sx",
"H",
"3 <= L[i][1] + sy <= W",
"3 <= L[i][1] + sy",
"3",
"L[i][1] + sy",
"L[i][1]",
"[i]",
"L",
"i",
"1",
"sy",
"W",
"if (L[i][0] + sx, L[i][1] + sy) not in d:\n d[(L[i][0] + sx, L[i][1] + sy)] = 1\n else:\n d[(L[i][0] + sx, L[i][1] + sy)] += 1\n\n# print(d)",
"(L[i][0] + sx, L[i][1] + sy) not in d",
"(L[i][0] + sx, L[i][1] + sy)",
"L[i][0] + sx",
"L[i][0]",
"[i]",
"L",
"i",
"0",
"sx",
"L[i][1] + sy",
"L[i][1]",
"[i]",
"L",
"i",
"1",
"sy",
"d",
"d[(L[i][0] + sx, L[i][1] + sy)] = 1",
"d[(L[i][0] + sx, L[i][1] + sy)]",
"d",
"(L[i][0] + sx, L[i][1] + sy)",
"L[i][0] + sx",
"L[i][0]",
"[i]",
"L",
"i",
"0",
"sx",
"L[i][1] + sy",
"L[i][1]",
"[i]",
"L",
"i",
"1",
"sy",
"1",
"d[(L[i][0] + sx, L[i][1] + sy)] += 1",
"d[(L[i][0] + sx, L[i][1] + sy)]",
"d",
"(L[i][0] + sx, L[i][1] + sy)",
"L[i][0] + sx",
"L[i][0]",
"[i]",
"L",
"i",
"0",
"sx",
"L[i][1] + sy",
"L[i][1]",
"[i]",
"L",
"i",
"1",
"sy",
"1",
"c = Counter(d.values())",
"c",
"Counter(d.values())",
"Counter",
"d.values()",
"d.values",
"d",
"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",
"k",
"v",
"c.items()",
"c.items",
"c",
"items",
"if v > 0:\n ans[k] = v",
"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 ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"c = Counter(d.values())",
"Counter(d.values())",
"c",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"L = []",
"[]",
"L",
"ans = [0 for _ in range(10)]",
"[0 for _ in range(10)]",
"ans",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"d = defaultdict()",
"defaultdict()",
"d"
] | from collections import defaultdict, Counter
H, W, N = map(int, input().split())
L = []
for _ in range(N):
a, b = map(int, input().split())
L.append([a, b])
# 黒いマスからスタートして右下の3 * 3グリッドマスにたどり着きたい場合はこう!
d = defaultdict()
for i in range(N):
for sx in range(3):
for sy in range(3):
if 3 <= L[i][0] + sx <= H and 3 <= L[i][1] + sy <= W:
if (L[i][0] + sx, L[i][1] + sy) not in d:
d[(L[i][0] + sx, L[i][1] + sy)] = 1
else:
d[(L[i][0] + sx, L[i][1] + sy)] += 1
# print(d)
c = Counter(d.values())
ans = [0 for _ in range(10)]
for k, v in c.items():
if v > 0:
ans[k] = v
ans[0] = (H - 2) * (W - 2) - sum(ans[1:])
for i in ans:
print(i)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
0,
13,
39,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
0,
13,
39,
2,
2,
13,
17,
2,
13,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
28,
13,
4,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
4,
18,
13,
13,
39,
13,
13,
28,
13,
13,
13,
14,
2,
2,
2,
40,
2,
13,
13,
17,
40,
2,
13,
13,
13,
40,
2,
13,
13,
17,
40,
2,
13,
13,
13,
0,
13,
17,
28,
13,
13,
13,
14,
2,
2,
2,
40,
2,
2,
13,
13,
13,
17,
40,
2,
2,
13,
13,
13,
13,
40,
2,
2,
13,
13,
13,
17,
40,
2,
2,
13,
13,
13,
13,
14,
2,
39,
2,
2,
13,
13,
13,
2,
2,
13,
13,
13,
13,
0,
13,
17,
0,
13,
17,
3,
14,
40,
13,
17,
0,
18,
13,
2,
13,
17,
17,
0,
18,
13,
13,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
17,
13,
10,
13,
13,
10,
39,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] | [
[
236,
2
],
[
236,
11
],
[
236,
12
],
[
227,
14
],
[
230,
18
],
[
215,
48
],
[
234,
52
],
[
237,
55
],
[
68,
67
],
[
222,
70
],
[
74,
73
],
[
73,
82
],
[
224,
84
],
[
224,
86
],
[
228,
89
],
[
225,
104
],
[
67,
105
],
[
225,
109
],
[
67,
110
],
[
234,
111
],
[
213,
114
],
[
213,
119
],
[
237,
121
],
[
239,
123
],
[
225,
136
],
[
67,
137
],
[
225,
143
],
[
67,
144
],
[
234,
146
],
[
213,
150
],
[
213,
157
],
[
237,
160
],
[
225,
166
],
[
67,
167
],
[
213,
171
],
[
228,
174
],
[
218,
176
],
[
209,
179
],
[
210,
184
],
[
219,
184
],
[
240,
184
],
[
192,
187
],
[
216,
188
],
[
210,
190
],
[
219,
190
],
[
240,
190
],
[
197,
194
],
[
216,
195
],
[
210,
196
],
[
219,
196
],
[
240,
196
],
[
200,
199
],
[
216,
206
],
[
199,
207
],
[
209,
210
],
[
224,
213
],
[
215,
216
],
[
218,
219
],
[
236,
222
],
[
224,
225
],
[
227,
228
],
[
230,
231
],
[
236,
234
],
[
236,
237
],
[
239,
240
]
] | [
"h,w,n=map(int,input().split())\ns=set()\nl=[[0,0],[1,1],[1,-1],[-1,1],[-1,-1],[0,1],[0,-1],[1,0],[-1,0]]\nans=[(h-2)*(w-2),0,0,0,0,0,0,0,0,0]\nfor i in range(n):\n a,b=[int(j) for j in input().split()]\n s.add((a,b))\n for i,j in l:\n if a+i>=1 and a+i<=h and b+j>=1 and b+j<=w:\n c=0\n for p,q in l:\n if a+i+p>=1 and a+i+p<=h and b+j+q>=1 and b+j+q<=w:\n if (a+i+p,b+j+q) in s:\n c+=1\n else:\n c=0\n break\n if c!=0:\n ans[c-1]-=1\n ans[c]+=1\n\nfor i in range(10):\n print(ans[i])\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",
"s=set()",
"s",
"set()",
"set",
"l=[[0,0],[1,1],[1,-1],[-1,1],[-1,-1],[0,1],[0,-1],[1,0],[-1,0]]",
"l",
"[[0,0],[1,1],[1,-1],[-1,1],[-1,-1],[0,1],[0,-1],[1,0],[-1,0]]",
"[0,0]",
"0",
"0",
"[1,1]",
"1",
"1",
"[1,-1]",
"1",
"-1",
"[-1,1]",
"-1",
"1",
"[-1,-1]",
"-1",
"-1",
"[0,1]",
"0",
"1",
"[0,-1]",
"0",
"-1",
"[1,0]",
"1",
"0",
"[-1,0]",
"-1",
"0",
"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 i in range(n):\n a,b=[int(j) for j in input().split()]\n s.add((a,b))\n for i,j in l:\n if a+i>=1 and a+i<=h and b+j>=1 and b+j<=w:\n c=0\n for p,q in l:\n if a+i+p>=1 and a+i+p<=h and b+j+q>=1 and b+j+q<=w:\n if (a+i+p,b+j+q) in s:\n c+=1\n else:\n c=0\n break\n if c!=0:\n ans[c-1]-=1\n ans[c]+=1",
"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,b=[int(j) for j in input().split()]",
"a",
"[int(j) for j in input().split()]",
"b",
"s.add((a,b))",
"s.add",
"s",
"add",
"(a,b)",
"a",
"b",
"for i,j in l:\n if a+i>=1 and a+i<=h and b+j>=1 and b+j<=w:\n c=0\n for p,q in l:\n if a+i+p>=1 and a+i+p<=h and b+j+q>=1 and b+j+q<=w:\n if (a+i+p,b+j+q) in s:\n c+=1\n else:\n c=0\n break\n if c!=0:\n ans[c-1]-=1\n ans[c]+=1",
"i",
"j",
"l",
"if a+i>=1 and a+i<=h and b+j>=1 and b+j<=w:\n c=0\n for p,q in l:\n if a+i+p>=1 and a+i+p<=h and b+j+q>=1 and b+j+q<=w:\n if (a+i+p,b+j+q) in s:\n c+=1\n else:\n c=0\n break\n if c!=0:\n ans[c-1]-=1\n ans[c]+=1",
"a+i>=1 and a+i<=h and b+j>=1 and b+j<=w",
"a+i>=1 and a+i<=h and b+j>=1",
"a+i>=1 and a+i<=h",
"a+i>=1",
"a+i",
"a",
"i",
"1",
"a+i<=h",
"a+i",
"a",
"i",
"h",
"b+j>=1",
"b+j",
"b",
"j",
"1",
"b+j<=w",
"b+j",
"b",
"j",
"w",
"c=0",
"c",
"0",
"for p,q in l:\n if a+i+p>=1 and a+i+p<=h and b+j+q>=1 and b+j+q<=w:\n if (a+i+p,b+j+q) in s:\n c+=1\n else:\n c=0\n break\n ",
"p",
"q",
"l",
"if a+i+p>=1 and a+i+p<=h and b+j+q>=1 and b+j+q<=w:\n if (a+i+p,b+j+q) in s:\n c+=1\n else:\n c=0\n break\n ",
"a+i+p>=1 and a+i+p<=h and b+j+q>=1 and b+j+q<=w",
"a+i+p>=1 and a+i+p<=h and b+j+q>=1",
"a+i+p>=1 and a+i+p<=h",
"a+i+p>=1",
"a+i+p",
"a+i",
"a",
"i",
"p",
"1",
"a+i+p<=h",
"a+i+p",
"a+i",
"a",
"i",
"p",
"h",
"b+j+q>=1",
"b+j+q",
"b+j",
"b",
"j",
"q",
"1",
"b+j+q<=w",
"b+j+q",
"b+j",
"b",
"j",
"q",
"w",
"if (a+i+p,b+j+q) in s:\n c+=1\n ",
"(a+i+p,b+j+q) in s",
"(a+i+p,b+j+q)",
"a+i+p",
"a+i",
"a",
"i",
"p",
"b+j+q",
"b+j",
"b",
"j",
"q",
"s",
"c+=1",
"c",
"1",
"c=0",
"c",
"0",
"break",
"if c!=0:\n ans[c-1]-=1\n ans[c]+=1",
"c!=0",
"c",
"0",
"ans[c-1]-=1",
"ans[c-1]",
"ans",
"c-1",
"c",
"1",
"1",
"ans[c]+=1",
"ans[c]",
"ans",
"c",
"1",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"c=0",
"0",
"c",
"b=[int(j) for j in input().split()]",
"[int(j) for j in input().split()]",
"b",
"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",
"c+=1",
"1",
"c",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"a,b=[int(j) for j in input().split()]",
"[int(j) for j in input().split()]",
"a",
"s=set()",
"set()",
"s",
"l=[[0,0],[1,1],[1,-1],[-1,1],[-1,-1],[0,1],[0,-1],[1,0],[-1,0]]",
"[[0,0],[1,1],[1,-1],[-1,1],[-1,-1],[0,1],[0,-1],[1,0],[-1,0]]",
"l",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"c=0",
"0",
"c"
] | h,w,n=map(int,input().split())
s=set()
l=[[0,0],[1,1],[1,-1],[-1,1],[-1,-1],[0,1],[0,-1],[1,0],[-1,0]]
ans=[(h-2)*(w-2),0,0,0,0,0,0,0,0,0]
for i in range(n):
a,b=[int(j) for j in input().split()]
s.add((a,b))
for i,j in l:
if a+i>=1 and a+i<=h and b+j>=1 and b+j<=w:
c=0
for p,q in l:
if a+i+p>=1 and a+i+p<=h and b+j+q>=1 and b+j+q<=w:
if (a+i+p,b+j+q) in s:
c+=1
else:
c=0
break
if c!=0:
ans[c-1]-=1
ans[c]+=1
for i in range(10):
print(ans[i])
|
[
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,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
4,
13,
2,
13,
17,
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,
18,
13,
39,
17,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13
] | [
[
144,
4
],
[
150,
11
],
[
145,
18
],
[
150,
20
],
[
150,
21
],
[
153,
24
],
[
30,
29
],
[
139,
32
],
[
159,
34
],
[
145,
41
],
[
159,
43
],
[
165,
45
],
[
157,
47
],
[
166,
47
],
[
162,
49
],
[
160,
51
],
[
163,
51
],
[
55,
54
],
[
166,
61
],
[
157,
61
],
[
166,
66
],
[
157,
66
],
[
151,
69
],
[
73,
72
],
[
163,
79
],
[
160,
79
],
[
163,
84
],
[
160,
84
],
[
148,
87
],
[
95,
90
],
[
154,
91
],
[
141,
97
],
[
104,
103
],
[
154,
106
],
[
112,
109
],
[
142,
110
],
[
103,
111
],
[
117,
114
],
[
142,
115
],
[
151,
120
],
[
148,
123
],
[
142,
128
],
[
133,
132
],
[
142,
132
],
[
132,
136
],
[
150,
139
],
[
141,
142
],
[
144,
145
],
[
150,
148
],
[
150,
151
],
[
153,
154
],
[
159,
157
],
[
159,
160
],
[
162,
163
],
[
165,
166
]
] | [
"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 for B in range(max(0,b - 2), min(b + 1,W - 2)):\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 for B in range(max(0,b - 2), min(b + 1,W - 2)):\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 for B in range(max(0,b - 2), min(b + 1,W - 2)):\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",
"for B in range(max(0,b - 2), min(b + 1,W - 2)):\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",
"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",
"N = map(int,readline().split())",
"map(int,readline().split())",
"N",
"ans = [0] * 10",
"[0] * 10",
"ans",
"readline = sys.stdin.readline",
"sys.stdin.readline",
"readline",
"W,N = map(int,readline().split())",
"map(int,readline().split())",
"W",
"H,W,N = map(int,readline().split())",
"map(int,readline().split())",
"H",
"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",
"b = a - 1,b - 1",
"b - 1",
"b",
"a,b = a - 1,b - 1",
"a - 1",
"a"
] | 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)):
for B in range(max(0,b - 2), min(b + 1,W - 2)):
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,
17,
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,
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,
2,
4,
18,
13,
13,
39,
13,
13,
17,
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,
4,
18,
13,
13,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] | [
[
148,
3
],
[
148,
12
],
[
148,
13
],
[
151,
15
],
[
19,
18
],
[
146,
21
],
[
139,
23
],
[
139,
32
],
[
35,
34
],
[
41,
40
],
[
142,
46
],
[
140,
48
],
[
40,
49
],
[
136,
51
],
[
134,
53
],
[
34,
54
],
[
143,
60
],
[
149,
62
],
[
137,
67
],
[
128,
69
],
[
77,
72
],
[
152,
73
],
[
152,
80
],
[
130,
88
],
[
152,
93
],
[
99,
96
],
[
131,
97
],
[
149,
102
],
[
128,
105
],
[
131,
111
],
[
115,
114
],
[
131,
122
],
[
114,
124
],
[
148,
128
],
[
130,
131
],
[
139,
134
],
[
136,
137
],
[
139,
140
],
[
142,
143
],
[
148,
146
],
[
148,
149
],
[
151,
152
]
] | [
"from collections import Counter\n\nh,w,n = map(int,input().split())\n\nblack_count = {}\n\nfor _ in range(n):\n a,b = map(int,input().split())\n for dx in (-1,0,1):\n for dy in (-1,0,1):\n y = a+dy\n x = b+dx\n if 2<=y<=h-1 and 2<=x<=w-1:\n black_count[(y,x)] = black_count.get((y,x),0) + 1\n\nans = Counter(black_count.values())\nans[0] = (h-2) * (w-2) - sum(ans.values())\nfor i in range(10):\n print(ans.get(i,0))",
"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",
"black_count = {}",
"black_count",
"{}",
"for _ in range(n):\n a,b = map(int,input().split())\n for dx in (-1,0,1):\n for dy in (-1,0,1):\n y = a+dy\n x = b+dx\n if 2<=y<=h-1 and 2<=x<=w-1:\n black_count[(y,x)] = black_count.get((y,x),0) + 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 in (-1,0,1):\n for dy in (-1,0,1):\n y = a+dy\n x = b+dx\n if 2<=y<=h-1 and 2<=x<=w-1:\n black_count[(y,x)] = black_count.get((y,x),0) + 1",
"dx",
"(-1,0,1)",
"-1",
"0",
"1",
"for dy in (-1,0,1):\n y = a+dy\n x = b+dx\n if 2<=y<=h-1 and 2<=x<=w-1:\n black_count[(y,x)] = black_count.get((y,x),0) + 1",
"dy",
"(-1,0,1)",
"-1",
"0",
"1",
"y = a+dy",
"y",
"a+dy",
"a",
"dy",
"x = b+dx",
"x",
"b+dx",
"b",
"dx",
"if 2<=y<=h-1 and 2<=x<=w-1:\n black_count[(y,x)] = black_count.get((y,x),0) + 1",
"2<=y<=h-1 and 2<=x<=w-1",
"2<=y<=h-1",
"2<=y",
"2",
"y",
"h-1",
"h",
"1",
"2<=x<=w-1",
"2<=x",
"2",
"x",
"w-1",
"w",
"1",
"black_count[(y,x)] = black_count.get((y,x),0) + 1",
"black_count[(y,x)]",
"black_count",
"(y,x)",
"y",
"x",
"black_count.get((y,x),0) + 1",
"black_count.get((y,x),0)",
"black_count.get",
"black_count",
"get",
"(y,x)",
"y",
"x",
"0",
"1",
"ans = Counter(black_count.values())",
"ans",
"Counter(black_count.values())",
"Counter",
"black_count.values()",
"black_count.values",
"black_count",
"values",
"ans[0] = (h-2) * (w-2) - sum(ans.values())",
"ans[0]",
"ans",
"0",
"(h-2) * (w-2) - sum(ans.values())",
"(h-2) * (w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans.values())",
"sum",
"ans.values()",
"ans.values",
"ans",
"values",
"for i in range(10):\n print(ans.get(i,0))",
"i",
"range(10)",
"range",
"10",
"print(ans.get(i,0))",
"print",
"ans.get(i,0)",
"ans.get",
"ans",
"get",
"i",
"0",
"w,n = map(int,input().split())",
"map(int,input().split())",
"w",
"ans = Counter(black_count.values())",
"Counter(black_count.values())",
"ans",
"b = map(int,input().split())",
"map(int,input().split())",
"b",
"x = b+dx",
"b+dx",
"x",
"a,b = map(int,input().split())",
"map(int,input().split())",
"a",
"y = a+dy",
"a+dy",
"y",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h",
"black_count = {}",
"{}",
"black_count"
] | from collections import Counter
h,w,n = map(int,input().split())
black_count = {}
for _ in range(n):
a,b = map(int,input().split())
for dx in (-1,0,1):
for dy in (-1,0,1):
y = a+dy
x = b+dx
if 2<=y<=h-1 and 2<=x<=w-1:
black_count[(y,x)] = black_count.get((y,x),0) + 1
ans = Counter(black_count.values())
ans[0] = (h-2) * (w-2) - sum(ans.values())
for i in range(10):
print(ans.get(i,0)) |
[
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,
28,
13,
4,
13,
17,
28,
13,
4,
13,
17,
4,
13,
2,
2,
13,
13,
17,
2,
2,
13,
13,
17,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
13,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
17,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] | [
[
153,
2
],
[
153,
11
],
[
153,
12
],
[
165,
14
],
[
57,
25
],
[
59,
32
],
[
48,
43
],
[
55,
50
],
[
57,
57
],
[
59,
59
],
[
62,
61
],
[
148,
64
],
[
171,
66
],
[
171,
75
],
[
168,
77
],
[
174,
80
],
[
84,
83
],
[
89,
88
],
[
160,
93
],
[
169,
96
],
[
163,
96
],
[
83,
97
],
[
175,
101
],
[
172,
101
],
[
88,
102
],
[
156,
105
],
[
114,
111
],
[
157,
112
],
[
154,
116
],
[
151,
119
],
[
123,
122
],
[
166,
122
],
[
130,
125
],
[
157,
126
],
[
166,
128
],
[
122,
129
],
[
135,
132
],
[
157,
133
],
[
138,
137
],
[
157,
144
],
[
137,
145
],
[
153,
148
],
[
153,
151
],
[
153,
154
],
[
156,
157
],
[
171,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
]
] | [
"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 for j in range(3):\n for k in range(3):\n change(a+j-1,b+k-1)\nans=[0]*10\nans[0]=(h-2)*(w-2)\n\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 for j in range(3):\n for k in range(3):\n change(a+j-1,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-=1",
"a",
"1",
"b-=1",
"b",
"1",
"for j in range(3):\n for k in range(3):\n change(a+j-1,b+k-1)",
"j",
"range(3)",
"range",
"3",
"for k in range(3):\n change(a+j-1,b+k-1)",
"k",
"range(3)",
"range",
"3",
"change(a+j-1,b+k-1)",
"change",
"a+j-1",
"a+j",
"a",
"j",
"1",
"b+k-1",
"b+k",
"b",
"k",
"1",
"ans=[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"ans[0]=(h-2)*(w-2)",
"ans[0]",
"ans",
"0",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"for i in 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",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"ans=[0]*10",
"[0]*10",
"ans",
"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",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"d=dict()",
"dict()",
"d",
"a-=1",
"1",
"a",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"b-=1",
"1",
"b"
] | 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
for j in range(3):
for k in range(3):
change(a+j-1,b+k-1)
ans=[0]*10
ans[0]=(h-2)*(w-2)
for i in d:
ans[d[i]]+=1
ans[0]-=1
for i in range(10):
print(ans[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,
39,
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,
17,
2,
13,
13,
13,
2,
2,
17,
2,
13,
13,
13,
4,
18,
13,
13,
39,
2,
13,
13,
2,
13,
13,
4,
18,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
0,
18,
13,
13,
17,
0,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
28,
13,
13,
4,
13,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
39,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] | [
[
172,
4
],
[
178,
11
],
[
173,
18
],
[
178,
20
],
[
178,
21
],
[
169,
23
],
[
27,
26
],
[
179,
29
],
[
160,
31
],
[
173,
38
],
[
160,
40
],
[
43,
42
],
[
49,
48
],
[
161,
59
],
[
42,
60
],
[
176,
61
],
[
158,
66
],
[
48,
67
],
[
164,
68
],
[
170,
71
],
[
161,
75
],
[
42,
76
],
[
158,
78
],
[
48,
79
],
[
170,
82
],
[
154,
85
],
[
166,
91
],
[
95,
94
],
[
170,
99
],
[
170,
103
],
[
94,
104
],
[
170,
106
],
[
94,
108
],
[
181,
111
],
[
117,
114
],
[
155,
115
],
[
167,
116
],
[
152,
116
],
[
182,
116
],
[
151,
119
],
[
125,
122
],
[
155,
123
],
[
152,
124
],
[
182,
124
],
[
167,
124
],
[
130,
127
],
[
155,
128
],
[
164,
133
],
[
176,
136
],
[
155,
141
],
[
146,
145
],
[
155,
145
],
[
145,
149
],
[
151,
152
],
[
154,
155
],
[
160,
158
],
[
160,
161
],
[
178,
164
],
[
166,
167
],
[
169,
170
],
[
172,
173
],
[
178,
176
],
[
178,
179
],
[
181,
182
]
] | [
"import sys\ninput = sys.stdin.readline\n\nH,W,N = map(int,input().split())\nA = []\nfor i in range(N):\n a,b = map(int,input().split())\n for i in [-1,0,1]:\n for j in [-1,0,1]:\n if (1< a+i <H) and (1 < b+j < W):\n A.append([a+i,b+j])\nA.sort()\nans = [0]*10\nhoge = 0\nfor i in range(len(A)):\n if A[i] == A[i-1]:\n hoge += 1\n else:\n ans[hoge]+= 1\n hoge = 1\nans[hoge]+= 1\n\n\nans[0] = (W-2)*(H-2)-sum(ans[1:])\n\nfor i in ans:\n print(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",
"A = []",
"A",
"[]",
"for i in range(N):\n a,b = map(int,input().split())\n for i in [-1,0,1]:\n for j in [-1,0,1]:\n if (1< a+i <H) and (1 < b+j < W):\n A.append([a+i,b+j])",
"i",
"range(N)",
"range",
"N",
"a,b = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in [-1,0,1]:\n for j in [-1,0,1]:\n if (1< a+i <H) and (1 < b+j < W):\n A.append([a+i,b+j])",
"i",
"[-1,0,1]",
"-1",
"0",
"1",
"for j in [-1,0,1]:\n if (1< a+i <H) and (1 < b+j < W):\n A.append([a+i,b+j])",
"j",
"[-1,0,1]",
"-1",
"0",
"1",
"if (1< a+i <H) and (1 < b+j < W):\n A.append([a+i,b+j])",
"(1< a+i <H) and (1 < b+j < W)",
"1< a+i <H",
"1< a+i",
"1",
"a+i",
"a",
"i",
"H",
"1 < b+j < W",
"1 < b+j",
"1",
"b+j",
"b",
"j",
"W",
"A.append([a+i,b+j])",
"A.append",
"A",
"append",
"[a+i,b+j]",
"a+i",
"a",
"i",
"b+j",
"b",
"j",
"A.sort()",
"A.sort",
"A",
"sort",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"hoge = 0",
"hoge",
"0",
"for i in range(len(A)):\n if A[i] == A[i-1]:\n hoge += 1\n else:\n ans[hoge]+= 1\n hoge = 1",
"i",
"range(len(A))",
"range",
"len(A)",
"len",
"A",
"if A[i] == A[i-1]:\n hoge += 1\n else:\n ans[hoge]+= 1\n hoge = 1",
"A[i] == A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"hoge += 1",
"hoge",
"1",
"ans[hoge]+= 1",
"ans[hoge]",
"ans",
"hoge",
"1",
"hoge = 1",
"hoge",
"1",
"ans[hoge]+= 1",
"ans[hoge]",
"ans",
"hoge",
"1",
"ans[0] = (W-2)*(H-2)-sum(ans[1:])",
"ans[0]",
"ans",
"0",
"(W-2)*(H-2)-sum(ans[1:])",
"(W-2)*(H-2)",
"W-2",
"W",
"2",
"H-2",
"H",
"2",
"sum(ans[1:])",
"sum",
"ans[1:]",
"ans",
"1:",
"1",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"hoge = 1",
"1",
"hoge",
"ans = [0]*10",
"[0]*10",
"ans",
"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",
"hoge = 0",
"0",
"hoge",
"A = []",
"[]",
"A",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"H,W,N = map(int,input().split())",
"map(int,input().split())",
"H",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"hoge += 1",
"1",
"hoge"
] | import sys
input = sys.stdin.readline
H,W,N = map(int,input().split())
A = []
for i in range(N):
a,b = map(int,input().split())
for i in [-1,0,1]:
for j in [-1,0,1]:
if (1< a+i <H) and (1 < b+j < W):
A.append([a+i,b+j])
A.sort()
ans = [0]*10
hoge = 0
for i in range(len(A)):
if A[i] == A[i-1]:
hoge += 1
else:
ans[hoge]+= 1
hoge = 1
ans[hoge]+= 1
ans[0] = (W-2)*(H-2)-sum(ans[1:])
for i in ans:
print(i) |
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
17,
0,
13,
2,
39,
17,
17,
0,
18,
13,
17,
2,
2,
13,
17,
2,
13,
17,
28,
13,
13,
0,
13,
4,
13,
13,
0,
13,
39,
28,
13,
4,
13,
2,
18,
13,
17,
17,
2,
18,
13,
17,
17,
28,
13,
4,
13,
2,
18,
13,
17,
17,
2,
18,
13,
17,
17,
4,
18,
13,
13,
39,
13,
13,
28,
13,
13,
14,
2,
2,
2,
17,
18,
13,
17,
13,
2,
2,
17,
18,
13,
17,
13,
0,
18,
13,
39,
18,
13,
17,
18,
13,
17,
2,
4,
18,
13,
13,
39,
18,
13,
17,
18,
13,
17,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
17,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] | [
[
183,
4
],
[
183,
13
],
[
183,
14
],
[
18,
17
],
[
166,
20
],
[
186,
31
],
[
171,
34
],
[
168,
37
],
[
46,
43
],
[
169,
44
],
[
184,
48
],
[
181,
51
],
[
55,
54
],
[
187,
54
],
[
174,
57
],
[
54,
60
],
[
177,
62
],
[
66,
65
],
[
175,
70
],
[
175,
75
],
[
80,
79
],
[
175,
84
],
[
175,
89
],
[
178,
94
],
[
101,
100
],
[
178,
100
],
[
100,
108
],
[
181,
110
],
[
100,
115
],
[
184,
117
],
[
128,
119
],
[
172,
120
],
[
100,
123
],
[
100,
126
],
[
172,
131
],
[
100,
135
],
[
100,
138
],
[
144,
143
],
[
172,
146
],
[
152,
149
],
[
169,
150
],
[
143,
151
],
[
157,
154
],
[
169,
155
],
[
160,
159
],
[
169,
159
],
[
159,
163
],
[
183,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
],
[
183,
181
],
[
183,
184
],
[
186,
187
]
] | [
"import sys\n\nh,w,n=map(int,input().split())\nA = [map(int,input().split()) for _ in range(n)]\n\ndict = {}\nans = [0]*10\nans[0] = (w-2)*(h-2)\n\nfor item in A:#for every paint\n cord = list(item)\n# print(\"----{},{}----\".format(cord[0],cord[1]))\n #update candidate\n upcand = []#max9\n for i in range(cord[0]-1,cord[0]+2):\n for j in range(cord[1]-1,cord[1]+2):\n# print(\"----({},{})----\".format(i,j))\n upcand.append([i,j])\n# print(upcand)\n for cand in upcand:\n# print(cand)\n if 1 < cand[0] < h and 1 < cand[1] < w:\n# print(cand)\n dict[(cand[0],cand[1])] = dict.get((cand[0],cand[1]), 0) + 1\n# print(dict)\nfor v in dict.values():\n ans[v] += 1\n ans[0] -= 1\n\nfor i in ans:\n print(i)",
"import sys",
"sys",
"h,w,n=map(int,input().split())",
"h",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"map(int,input().split()) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"A = [map(int,input().split()) for _ in range(n)]",
"A",
"[map(int,input().split()) for _ in range(n)]",
"dict = {}",
"dict",
"{}",
"ans = [0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"ans[0] = (w-2)*(h-2)",
"ans[0]",
"ans",
"0",
"(w-2)*(h-2)",
"w-2",
"w",
"2",
"h-2",
"h",
"2",
"for item in A:#for every paint\n cord = list(item)\n# print(\"----{},{}----\".format(cord[0],cord[1]))\n #update candidate\n upcand = []#max9\n for i in range(cord[0]-1,cord[0]+2):\n for j in range(cord[1]-1,cord[1]+2):\n# print(\"----({},{})----\".format(i,j))\n upcand.append([i,j])\n# print(upcand)\n for cand in upcand:\n# print(cand)\n if 1 < cand[0] < h and 1 < cand[1] < w:\n# print(cand)\n dict[(cand[0],cand[1])] = dict.get((cand[0],cand[1]), 0) + 1\n# print(dict)",
"item",
"A",
"cord = list(item)",
"cord",
"list(item)",
"list",
"item",
"upcand = []",
"upcand",
"[]",
"for i in range(cord[0]-1,cord[0]+2):\n for j in range(cord[1]-1,cord[1]+2):\n# print(\"----({},{})----\".format(i,j))\n upcand.append([i,j])\n# print(upcand)\n ",
"i",
"range(cord[0]-1,cord[0]+2)",
"range",
"cord[0]-1",
"cord[0]",
"cord",
"0",
"1",
"cord[0]+2",
"cord[0]",
"cord",
"0",
"2",
"for j in range(cord[1]-1,cord[1]+2):\n# print(\"----({},{})----\".format(i,j))\n upcand.append([i,j])\n# print(upcand)\n ",
"j",
"range(cord[1]-1,cord[1]+2)",
"range",
"cord[1]-1",
"cord[1]",
"cord",
"1",
"1",
"cord[1]+2",
"cord[1]",
"cord",
"1",
"2",
"upcand.append([i,j])",
"upcand.append",
"upcand",
"append",
"[i,j]",
"i",
"j",
"for cand in upcand:\n# print(cand)\n if 1 < cand[0] < h and 1 < cand[1] < w:\n# print(cand)\n dict[(cand[0],cand[1])] = dict.get((cand[0],cand[1]), 0) + 1\n# print(dict)",
"cand",
"upcand",
"if 1 < cand[0] < h and 1 < cand[1] < w:\n# print(cand)\n dict[(cand[0],cand[1])] = dict.get((cand[0],cand[1]), 0) + 1\n# print(dict)",
"1 < cand[0] < h and 1 < cand[1] < w",
"1 < cand[0] < h",
"1 < cand[0]",
"1",
"cand[0]",
"cand",
"0",
"h",
"1 < cand[1] < w",
"1 < cand[1]",
"1",
"cand[1]",
"cand",
"1",
"w",
"dict[(cand[0],cand[1])] = dict.get((cand[0],cand[1]), 0) + 1",
"dict[(cand[0],cand[1])]",
"dict",
"(cand[0],cand[1])",
"cand[0]",
"cand",
"0",
"cand[1]",
"cand",
"1",
"dict.get((cand[0],cand[1]), 0) + 1",
"dict.get((cand[0],cand[1]), 0)",
"dict.get",
"dict",
"get",
"(cand[0],cand[1])",
"cand[0]",
"cand",
"0",
"cand[1]",
"cand",
"1",
"0",
"1",
"for v in dict.values():\n ans[v] += 1\n ans[0] -= 1",
"v",
"dict.values()",
"dict.values",
"dict",
"values",
"ans[v] += 1",
"ans[v]",
"ans",
"v",
"1",
"ans[0] -= 1",
"ans[0]",
"ans",
"0",
"1",
"for i in ans:\n print(i)",
"i",
"ans",
"print(i)",
"print",
"i",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"ans = [0]*10",
"[0]*10",
"ans",
"dict = {}",
"{}",
"dict",
"cord = list(item)",
"list(item)",
"cord",
"upcand = []",
"[]",
"upcand",
"h,w,n=map(int,input().split())",
"map(int,input().split())",
"h",
"w,n=map(int,input().split())",
"map(int,input().split())",
"w",
"A = [map(int,input().split()) for _ in range(n)]",
"[map(int,input().split()) for _ in range(n)]",
"A"
] | import sys
h,w,n=map(int,input().split())
A = [map(int,input().split()) for _ in range(n)]
dict = {}
ans = [0]*10
ans[0] = (w-2)*(h-2)
for item in A:#for every paint
cord = list(item)
# print("----{},{}----".format(cord[0],cord[1]))
#update candidate
upcand = []#max9
for i in range(cord[0]-1,cord[0]+2):
for j in range(cord[1]-1,cord[1]+2):
# print("----({},{})----".format(i,j))
upcand.append([i,j])
# print(upcand)
for cand in upcand:
# print(cand)
if 1 < cand[0] < h and 1 < cand[1] < w:
# print(cand)
dict[(cand[0],cand[1])] = dict.get((cand[0],cand[1]), 0) + 1
# print(dict)
for v in dict.values():
ans[v] += 1
ans[0] -= 1
for i in ans:
print(i)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
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,
2,
2,
2,
13,
17,
2,
2,
13,
17,
13,
2,
13,
17,
2,
2,
13,
17,
13,
2,
39,
13,
13,
13,
9,
4,
18,
13,
13,
39,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
2,
13,
17,
28,
13,
4,
13,
13,
2,
13,
17,
14,
2,
39,
13,
13,
13,
0,
13,
17,
0,
18,
13,
13,
17,
2,
2,
4,
13,
2,
13,
17,
2,
13,
17,
4,
13,
18,
13,
39,
17,
17,
28,
13,
18,
13,
39,
17,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] | [
[
191,
2
],
[
191,
11
],
[
191,
12
],
[
182,
14
],
[
19,
18
],
[
168,
21
],
[
194,
23
],
[
194,
32
],
[
183,
35
],
[
185,
41
],
[
176,
47
],
[
56,
55
],
[
195,
59
],
[
195,
62
],
[
66,
65
],
[
171,
69
],
[
171,
72
],
[
65,
80
],
[
65,
84
],
[
192,
86
],
[
55,
88
],
[
55,
92
],
[
180,
94
],
[
177,
99
],
[
177,
103
],
[
173,
109
],
[
113,
112
],
[
55,
115
],
[
55,
117
],
[
121,
120
],
[
65,
123
],
[
65,
125
],
[
183,
132
],
[
188,
134
],
[
140,
137
],
[
186,
138
],
[
189,
139
],
[
174,
139
],
[
180,
146
],
[
192,
149
],
[
186,
154
],
[
160,
159
],
[
186,
161
],
[
191,
168
],
[
194,
171
],
[
173,
174
],
[
176,
177
],
[
191,
180
],
[
182,
183
],
[
185,
186
],
[
188,
189
],
[
191,
192
],
[
194,
195
]
] | [
"H, W, N = map(int, raw_input().split())\np = set()\nfor i in range(N):\n a, b = map(int, raw_input().split())\n p.add((a,b))\nr = [0]*10\nc = set()\nfor a, b in p:\n for y0 in range(a-2, a+1):\n for x0 in range(b-2, b+1):\n if x0<1 or x0+2>W or y0<1 or y0+2>H or (y0,x0) in c:\n continue\n c.add((y0,x0))\n s = 0\n for y in range(y0, y0+3):\n for x in range(x0, x0+3):\n if (y,x) in p:\n s += 1\n r[s] += 1\nprint (H-2)*(W-2)-sum(r[1:10])\nfor ri in r[1:10]:\n print ri",
"H, W, N = map(int, raw_input().split())",
"H",
"map(int, raw_input().split())",
"map",
"int",
"raw_input().split()",
"().split",
"()",
"raw_input",
"split",
"W",
"N",
"p = set()",
"p",
"set()",
"set",
"for i in range(N):\n a, b = map(int, raw_input().split())\n p.add((a,b))",
"i",
"range(N)",
"range",
"N",
"a, b = map(int, raw_input().split())",
"a",
"map(int, raw_input().split())",
"map",
"int",
"raw_input().split()",
"().split",
"()",
"raw_input",
"split",
"b",
"p.add((a,b))",
"p.add",
"p",
"add",
"(a,b)",
"a",
"b",
"r = [0]*10",
"r",
"[0]*10",
"[0]",
"0",
"10",
"c = set()",
"c",
"set()",
"set",
"for a, b in p:\n for y0 in range(a-2, a+1):\n for x0 in range(b-2, b+1):\n if x0<1 or x0+2>W or y0<1 or y0+2>H or (y0,x0) in c:\n continue\n c.add((y0,x0))\n s = 0\n for y in range(y0, y0+3):\n for x in range(x0, x0+3):\n if (y,x) in p:\n s += 1\n r[s] += 1",
"a",
"b",
"p",
"for y0 in range(a-2, a+1):\n for x0 in range(b-2, b+1):\n if x0<1 or x0+2>W or y0<1 or y0+2>H or (y0,x0) in c:\n continue\n c.add((y0,x0))\n s = 0\n for y in range(y0, y0+3):\n for x in range(x0, x0+3):\n if (y,x) in p:\n s += 1\n r[s] += 1",
"y0",
"range(a-2, a+1)",
"range",
"a-2",
"a",
"2",
"a+1",
"a",
"1",
"for x0 in range(b-2, b+1):\n if x0<1 or x0+2>W or y0<1 or y0+2>H or (y0,x0) in c:\n continue\n c.add((y0,x0))\n s = 0\n for y in range(y0, y0+3):\n for x in range(x0, x0+3):\n if (y,x) in p:\n s += 1\n r[s] += 1",
"x0",
"range(b-2, b+1)",
"range",
"b-2",
"b",
"2",
"b+1",
"b",
"1",
"if x0<1 or x0+2>W or y0<1 or y0+2>H or (y0,x0) in c:\n continue\n ",
"x0<1 or x0+2>W or y0<1 or y0+2>H or (y0,x0) in c",
"x0<1 or x0+2>W or y0<1 or y0+2>H",
"x0<1 or x0+2>W or y0<1",
"x0<1 or x0+2>W",
"x0<1",
"x0",
"1",
"x0+2>W",
"x0+2",
"x0",
"2",
"W",
"y0<1",
"y0",
"1",
"y0+2>H",
"y0+2",
"y0",
"2",
"H",
"(y0,x0) in c",
"(y0,x0)",
"y0",
"x0",
"c",
"continue",
"c.add((y0,x0))",
"c.add",
"c",
"add",
"(y0,x0)",
"y0",
"x0",
"s = 0",
"s",
"0",
"for y in range(y0, y0+3):\n for x in range(x0, x0+3):\n if (y,x) in p:\n s += 1\n ",
"y",
"range(y0, y0+3)",
"range",
"y0",
"y0+3",
"y0",
"3",
"for x in range(x0, x0+3):\n if (y,x) in p:\n s += 1\n ",
"x",
"range(x0, x0+3)",
"range",
"x0",
"x0+3",
"x0",
"3",
"if (y,x) in p:\n s += 1\n ",
"(y,x) in p",
"(y,x)",
"y",
"x",
"p",
"s += 1",
"s",
"1",
"r[s] += 1",
"r[s]",
"r",
"s",
"1",
"print (H-2)*(W-2)-sum(r[1:10])",
"print (H-2)*(W-2)",
"print (H-2)",
"print",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"sum(r[1:10])",
"sum",
"r[1:10]",
"r",
"1:10",
"1",
"10",
"for ri in r[1:10]:\n print ri",
"ri",
"r[1:10]",
"r",
"1:10",
"1",
"10",
"print",
"N = map(int, raw_input().split())",
"map(int, raw_input().split())",
"N",
"b = map(int, raw_input().split())",
"map(int, raw_input().split())",
"b",
"s = 0",
"0",
"s",
"c = set()",
"set()",
"c",
"H, W, N = map(int, raw_input().split())",
"map(int, raw_input().split())",
"H",
"p = set()",
"set()",
"p",
"r = [0]*10",
"[0]*10",
"r",
"s += 1",
"1",
"s",
"W, N = map(int, raw_input().split())",
"map(int, raw_input().split())",
"W",
"a, b = map(int, raw_input().split())",
"map(int, raw_input().split())",
"a"
] | H, W, N = map(int, raw_input().split())
p = set()
for i in range(N):
a, b = map(int, raw_input().split())
p.add((a,b))
r = [0]*10
c = set()
for a, b in p:
for y0 in range(a-2, a+1):
for x0 in range(b-2, b+1):
if x0<1 or x0+2>W or y0<1 or y0+2>H or (y0,x0) in c:
continue
c.add((y0,x0))
s = 0
for y in range(y0, y0+3):
for x in range(x0, x0+3):
if (y,x) in p:
s += 1
r[s] += 1
print (H-2)*(W-2)-sum(r[1:10])
for ri in r[1:10]:
print ri |
[
7,
15,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
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,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
0,
13,
4,
13,
13,
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,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
148,
4
],
[
148,
13
],
[
148,
14
],
[
139,
16
],
[
22,
21
],
[
149,
24
],
[
133,
26
],
[
133,
35
],
[
38,
37
],
[
43,
42
],
[
131,
52
],
[
37,
53
],
[
134,
57
],
[
42,
58
],
[
131,
62
],
[
37,
63
],
[
143,
65
],
[
134,
69
],
[
42,
70
],
[
146,
72
],
[
84,
75
],
[
140,
76
],
[
131,
79
],
[
37,
80
],
[
134,
82
],
[
42,
83
],
[
136,
86
],
[
140,
89
],
[
127,
91
],
[
137,
96
],
[
140,
96
],
[
102,
99
],
[
128,
100
],
[
143,
105
],
[
146,
108
],
[
128,
114
],
[
118,
117
],
[
128,
124
],
[
117,
125
],
[
127,
128
],
[
133,
131
],
[
133,
134
],
[
136,
137
],
[
139,
140
],
[
148,
143
],
[
148,
146
],
[
148,
149
]
] | [
"from collections import Counter\nfrom collections import defaultdict as dd\n\nh, w, n = map(int, input().split())\nd = dd(int)\n\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 a-i>0 and b-j>0 and a-i<=h-2 and b-j<=w-2:\n d[(a-i, b-j)] += 1\nd = dict(d)\ncon = Counter(d.values())\ncon[0] = (h-2)*(w-2) - sum(con.values())\nfor i in range(10):\n print(con[i])",
"from collections import Counter",
"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",
"d = dd(int)",
"d",
"dd(int)",
"dd",
"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 a-i>0 and b-j>0 and a-i<=h-2 and b-j<=w-2:\n d[(a-i, b-j)] += 1",
"_",
"range(n)",
"range",
"n",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in range(3):\n for j in range(3):\n if a-i>0 and b-j>0 and a-i<=h-2 and b-j<=w-2:\n d[(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-i<=h-2 and b-j<=w-2:\n d[(a-i, b-j)] += 1",
"j",
"range(3)",
"range",
"3",
"if a-i>0 and b-j>0 and a-i<=h-2 and b-j<=w-2:\n d[(a-i, b-j)] += 1",
"a-i>0 and b-j>0 and a-i<=h-2 and b-j<=w-2",
"a-i>0 and b-j>0 and a-i<=h-2",
"a-i>0 and 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",
"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 = dict(d)",
"d",
"dict(d)",
"dict",
"d",
"con = Counter(d.values())",
"con",
"Counter(d.values())",
"Counter",
"d.values()",
"d.values",
"d",
"values",
"con[0] = (h-2)*(w-2) - sum(con.values())",
"con[0]",
"con",
"0",
"(h-2)*(w-2) - sum(con.values())",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(con.values())",
"sum",
"con.values()",
"con.values",
"con",
"values",
"for i in range(10):\n print(con[i])",
"i",
"range(10)",
"range",
"10",
"print(con[i])",
"print",
"con[i]",
"con",
"i",
"con = Counter(d.values())",
"Counter(d.values())",
"con",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"d = dict(d)",
"dict(d)",
"d",
"d = dd(int)",
"dd(int)",
"d",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"n = map(int, input().split())",
"map(int, input().split())",
"n"
] | from collections import Counter
from collections import defaultdict as dd
h, w, n = map(int, input().split())
d = dd(int)
for _ in range(n):
a, b = map(int, input().split())
for i in range(3):
for j in range(3):
if a-i>0 and b-j>0 and a-i<=h-2 and b-j<=w-2:
d[(a-i, b-j)] += 1
d = dict(d)
con = Counter(d.values())
con[0] = (h-2)*(w-2) - sum(con.values())
for i in range(10):
print(con[i]) |
[
7,
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,
2,
13,
13,
13,
2,
13,
13,
14,
2,
2,
2,
17,
13,
13,
2,
2,
17,
13,
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,
17,
0,
13,
13,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
41,
28,
13,
13,
4,
4,
13,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
39,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13
] | [
[
179,
2
],
[
179,
11
],
[
179,
12
],
[
176,
14
],
[
173,
17
],
[
48,
47
],
[
162,
50
],
[
170,
52
],
[
170,
61
],
[
167,
67
],
[
159,
69
],
[
164,
71
],
[
171,
73
],
[
168,
80
],
[
156,
81
],
[
165,
85
],
[
180,
86
],
[
177,
92
],
[
99,
94
],
[
177,
95
],
[
106,
101
],
[
177,
102
],
[
110,
109
],
[
182,
116
],
[
177,
123
],
[
129,
126
],
[
183,
127
],
[
134,
131
],
[
183,
132
],
[
156,
137
],
[
180,
140
],
[
183,
144
],
[
148,
147
],
[
183,
147
],
[
147,
152
],
[
179,
156
],
[
170,
159
],
[
179,
162
],
[
164,
165
],
[
167,
168
],
[
170,
171
],
[
173,
174
],
[
176,
177
],
[
179,
180
],
[
182,
183
]
] | [
"h,w,n = map(int, input().split())\nmemo = {}\ndxy = [(0,1), (0,0), (1,0), (-1,0), (0,-1), (1,1), (-1,-1), (-1,1), (1,-1)]\nfor i in range(n):\n a,b = map(int, input().split())\n for dx,dy in dxy:\n x,y = a+dx,b+dy\n if 1 < x < h and 1 < y < w:\n if (x,y) not in memo:\n memo[(x,y)] = 0\n memo[(x,y)] += 1\n\nans = [0 for i in range(10)]\nfor k,v in memo.items():\n ans[v] += 1\nans[0] = (h-2)*(w-2) - sum(ans)\n[print(i) for i in ans]",
"h,w,n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"memo = {}",
"memo",
"{}",
"dxy = [(0,1), (0,0), (1,0), (-1,0), (0,-1), (1,1), (-1,-1), (-1,1), (1,-1)]",
"dxy",
"[(0,1), (0,0), (1,0), (-1,0), (0,-1), (1,1), (-1,-1), (-1,1), (1,-1)]",
"(0,1)",
"0",
"1",
"(0,0)",
"0",
"0",
"(1,0)",
"1",
"0",
"(-1,0)",
"-1",
"0",
"(0,-1)",
"0",
"-1",
"(1,1)",
"1",
"1",
"(-1,-1)",
"-1",
"-1",
"(-1,1)",
"-1",
"1",
"(1,-1)",
"1",
"-1",
"for i in range(n):\n a,b = map(int, input().split())\n for dx,dy in dxy:\n x,y = a+dx,b+dy\n if 1 < x < h and 1 < y < w:\n if (x,y) not in memo:\n memo[(x,y)] = 0\n memo[(x,y)] += 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 dx,dy in dxy:\n x,y = a+dx,b+dy\n if 1 < x < h and 1 < y < w:\n if (x,y) not in memo:\n memo[(x,y)] = 0\n memo[(x,y)] += 1",
"dx",
"dy",
"dxy",
"x,y = a+dx,b+dy",
"x",
"a+dx",
"a",
"dx",
"y",
"b+dy",
"b",
"dy",
"if 1 < x < h and 1 < y < w:\n if (x,y) not in memo:\n memo[(x,y)] = 0\n memo[(x,y)] += 1",
"1 < x < h and 1 < y < w",
"1 < x < h",
"1 < x",
"1",
"x",
"h",
"1 < y < w",
"1 < y",
"1",
"y",
"w",
"if (x,y) not in memo:\n memo[(x,y)] = 0\n ",
"(x,y) not in memo",
"(x,y)",
"x",
"y",
"memo",
"memo[(x,y)] = 0",
"memo[(x,y)]",
"memo",
"(x,y)",
"x",
"y",
"0",
"memo[(x,y)] += 1",
"memo[(x,y)]",
"memo",
"(x,y)",
"x",
"y",
"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 k,v in memo.items():\n ans[v] += 1",
"k",
"v",
"memo.items()",
"memo.items",
"memo",
"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(i) for i in ans",
"for i in ans",
"i",
"ans",
"for i in ans",
"print(i)",
"print",
"i",
"[print(i) for i in ans]",
"h,w,n = map(int, input().split())",
"map(int, input().split())",
"h",
"a,b = map(int, input().split())",
"map(int, input().split())",
"a",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"y = a+dx,b+dy",
"b+dy",
"y",
"x,y = a+dx,b+dy",
"a+dx",
"x",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"dxy = [(0,1), (0,0), (1,0), (-1,0), (0,-1), (1,1), (-1,-1), (-1,1), (1,-1)]",
"[(0,1), (0,0), (1,0), (-1,0), (0,-1), (1,1), (-1,-1), (-1,1), (1,-1)]",
"dxy",
"memo = {}",
"{}",
"memo",
"w,n = map(int, input().split())",
"map(int, input().split())",
"w",
"ans = [0 for i in range(10)]",
"[0 for i in range(10)]",
"ans"
] | h,w,n = map(int, input().split())
memo = {}
dxy = [(0,1), (0,0), (1,0), (-1,0), (0,-1), (1,1), (-1,-1), (-1,1), (1,-1)]
for i in range(n):
a,b = map(int, input().split())
for dx,dy in dxy:
x,y = a+dx,b+dy
if 1 < x < h and 1 < y < w:
if (x,y) not in memo:
memo[(x,y)] = 0
memo[(x,y)] += 1
ans = [0 for i in range(10)]
for k,v in memo.items():
ans[v] += 1
ans[0] = (h-2)*(w-2) - sum(ans)
[print(i) for i in ans] |
[
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,
17,
0,
13,
17,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
14,
2,
2,
40,
17,
2,
13,
13,
2,
13,
17,
2,
40,
17,
2,
13,
13,
2,
13,
17,
0,
18,
13,
39,
2,
13,
13,
2,
13,
13,
17,
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,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] | [
[
138,
3
],
[
138,
12
],
[
138,
13
],
[
141,
15
],
[
21,
20
],
[
136,
23
],
[
144,
25
],
[
144,
34
],
[
147,
36
],
[
150,
39
],
[
43,
42
],
[
49,
48
],
[
148,
59
],
[
145,
59
],
[
42,
60
],
[
133,
62
],
[
151,
68
],
[
124,
68
],
[
48,
69
],
[
139,
71
],
[
83,
74
],
[
142,
75
],
[
148,
78
],
[
145,
78
],
[
42,
79
],
[
151,
81
],
[
124,
81
],
[
48,
82
],
[
133,
89
],
[
139,
92
],
[
142,
96
],
[
99,
98
],
[
126,
104
],
[
108,
107
],
[
142,
110
],
[
107,
114
],
[
98,
115
],
[
129,
117
],
[
130,
121
],
[
127,
121
],
[
144,
124
],
[
126,
127
],
[
129,
130
],
[
138,
133
],
[
138,
136
],
[
138,
139
],
[
141,
142
],
[
144,
145
],
[
147,
148
],
[
150,
151
]
] | [
"from collections import defaultdict\nH, W, N = map(int, input().split())\nA = defaultdict(int)\n\nfor i in range(N):\n a, b = map(int, input().split())\n a -= 1\n 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 A[(a + j, b + k)] += 1\n \nprint((H - 2) * (W - 2) - len(A))\n \nfor i in range(1, 10):\n cnt = 0\n for v in A.values():\n if v == i:\n cnt += 1\n print(cnt)",
"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",
"A = defaultdict(int)",
"A",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for 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 A[(a + j, b + k)] += 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",
"a -= 1",
"a",
"1",
"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 A[(a + j, b + k)] += 1\n ",
"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 A[(a + j, b + k)] += 1\n ",
"k",
"range(-1, 2)",
"range",
"-1",
"2",
"if 1 <= a + j < H - 1 and 1 <= b + k < W - 1:\n A[(a + j, b + k)] += 1\n ",
"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",
"A[(a + j, b + k)] += 1",
"A[(a + j, b + k)]",
"A",
"(a + j, b + k)",
"a + j",
"a",
"j",
"b + k",
"b",
"k",
"1",
"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 cnt = 0\n for v in A.values():\n if v == i:\n cnt += 1\n print(cnt)",
"i",
"range(1, 10)",
"range",
"1",
"10",
"cnt = 0",
"cnt",
"0",
"for v in A.values():\n if v == i:\n cnt += 1\n ",
"v",
"A.values()",
"A.values",
"A",
"values",
"if v == i:\n cnt += 1\n ",
"v == i",
"v",
"i",
"cnt += 1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"cnt = 0",
"0",
"cnt",
"cnt += 1",
"1",
"cnt",
"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",
"A = defaultdict(int)",
"defaultdict(int)",
"A",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"a -= 1",
"1",
"a",
"b -= 1",
"1",
"b"
] | from collections import defaultdict
H, W, N = map(int, input().split())
A = defaultdict(int)
for i in range(N):
a, b = map(int, input().split())
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:
A[(a + j, b + k)] += 1
print((H - 2) * (W - 2) - len(A))
for i in range(1, 10):
cnt = 0
for v in A.values():
if v == i:
cnt += 1
print(cnt) |
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
18,
13,
13,
12,
4,
18,
13,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
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,
18,
13,
13,
13,
17,
0,
13,
4,
18,
13,
13,
28,
13,
13,
4,
18,
13,
13,
28,
13,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
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,
2,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13
] | [
[
177,
4
],
[
177,
13
],
[
177,
14
],
[
168,
16
],
[
29,
28
],
[
151,
31
],
[
165,
33
],
[
165,
42
],
[
171,
44
],
[
153,
47
],
[
51,
50
],
[
57,
56
],
[
147,
62
],
[
172,
64
],
[
163,
64
],
[
50,
65
],
[
174,
67
],
[
154,
69
],
[
166,
69
],
[
56,
70
],
[
175,
76
],
[
178,
78
],
[
148,
83
],
[
160,
85
],
[
93,
88
],
[
169,
90
],
[
148,
91
],
[
175,
92
],
[
156,
95
],
[
169,
105
],
[
118,
115
],
[
157,
116
],
[
160,
124
],
[
178,
127
],
[
157,
133
],
[
137,
136
],
[
157,
144
],
[
136,
145
],
[
147,
148
],
[
177,
151
],
[
153,
154
],
[
156,
157
],
[
177,
160
],
[
165,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
]
] | [
"import collections\n\nh, w, n = map(int, input().split())\nsquares = collections.defaultdict(lambda: collections.defaultdict(int))\nfor index in range(n):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in range(-2, 1):\n for j in range(-2, 1):\n y = a + i\n x = b + j\n if 0 <= x < w - 2 and 0 <= y < h - 2:\n squares[y][x] += 1\ncounter = collections.Counter()\nfor y, xs in squares.items():\n for x, count in xs.items():\n counter[count] += 1\nprint((h - 2) * (w - 2) - sum(counter.values()))\nfor i in range(1, 10):\n print(counter[i])",
"import collections",
"collections",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"squares = collections.defaultdict(lambda: collections.defaultdict(int))",
"squares",
"collections.defaultdict(lambda: collections.defaultdict(int))",
"collections.defaultdict",
"collections",
"defaultdict",
"lambda: collections.defaultdict(int)",
"collections.defaultdict(int)",
"collections.defaultdict",
"collections",
"defaultdict",
"int",
"for index in range(n):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for i in range(-2, 1):\n for j in range(-2, 1):\n y = a + i\n x = b + j\n if 0 <= x < w - 2 and 0 <= y < h - 2:\n squares[y][x] += 1",
"index",
"range(n)",
"range",
"n",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"a -= 1",
"a",
"1",
"b -= 1",
"b",
"1",
"for i in range(-2, 1):\n for j in range(-2, 1):\n y = a + i\n x = b + j\n if 0 <= x < w - 2 and 0 <= y < h - 2:\n squares[y][x] += 1",
"i",
"range(-2, 1)",
"range",
"-2",
"1",
"for j in range(-2, 1):\n y = a + i\n x = b + j\n if 0 <= x < w - 2 and 0 <= y < h - 2:\n squares[y][x] += 1",
"j",
"range(-2, 1)",
"range",
"-2",
"1",
"y = a + i",
"y",
"a + i",
"a",
"i",
"x = b + j",
"x",
"b + j",
"b",
"j",
"if 0 <= x < w - 2 and 0 <= y < h - 2:\n squares[y][x] += 1",
"0 <= x < w - 2 and 0 <= y < h - 2",
"0 <= x < w - 2",
"0 <= x",
"0",
"x",
"w - 2",
"w",
"2",
"0 <= y < h - 2",
"0 <= y",
"0",
"y",
"h - 2",
"h",
"2",
"squares[y][x] += 1",
"squares[y][x]",
"[y]",
"squares",
"y",
"x",
"1",
"counter = collections.Counter()",
"counter",
"collections.Counter()",
"collections.Counter",
"collections",
"Counter",
"for y, xs in squares.items():\n for x, count in xs.items():\n counter[count] += 1",
"y",
"xs",
"squares.items()",
"squares.items",
"squares",
"items",
"for x, count in xs.items():\n counter[count] += 1",
"x",
"count",
"xs.items()",
"xs.items",
"xs",
"items",
"counter[count] += 1",
"counter[count]",
"counter",
"count",
"1",
"print((h - 2) * (w - 2) - sum(counter.values()))",
"print",
"(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 i in range(1, 10):\n print(counter[i])",
"i",
"range(1, 10)",
"range",
"1",
"10",
"print(counter[i])",
"print",
"counter[i]",
"counter",
"i",
"y = a + i",
"a + i",
"y",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"b -= 1",
"1",
"b",
"counter = collections.Counter()",
"collections.Counter()",
"counter",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"squares = collections.defaultdict(lambda: collections.defaultdict(int))",
"collections.defaultdict(lambda: collections.defaultdict(int))",
"squares",
"a -= 1",
"1",
"a",
"x = b + j",
"b + j",
"x",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w"
] | import collections
h, w, n = map(int, input().split())
squares = collections.defaultdict(lambda: collections.defaultdict(int))
for index in range(n):
a, b = map(int, input().split())
a -= 1
b -= 1
for i in range(-2, 1):
for j in range(-2, 1):
y = a + i
x = b + j
if 0 <= x < w - 2 and 0 <= y < h - 2:
squares[y][x] += 1
counter = collections.Counter()
for y, xs in squares.items():
for x, count in xs.items():
counter[count] += 1
print((h - 2) * (w - 2) - sum(counter.values()))
for i in range(1, 10):
print(counter[i]) |
[
7,
15,
0,
13,
4,
13,
12,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
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,
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,
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,
4,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] | [
[
146,
3
],
[
149,
9
],
[
149,
18
],
[
149,
19
],
[
22,
21
],
[
138,
24
],
[
140,
26
],
[
140,
35
],
[
155,
37
],
[
152,
40
],
[
44,
43
],
[
156,
47
],
[
141,
47
],
[
156,
50
],
[
141,
50
],
[
54,
53
],
[
153,
57
],
[
135,
57
],
[
153,
60
],
[
135,
60
],
[
43,
67
],
[
132,
69
],
[
53,
74
],
[
150,
76
],
[
84,
79
],
[
147,
80
],
[
143,
86
],
[
147,
91
],
[
132,
98
],
[
150,
101
],
[
144,
107
],
[
111,
110
],
[
110,
117
],
[
144,
120
],
[
144,
125
],
[
110,
126
],
[
149,
132
],
[
140,
135
],
[
149,
138
],
[
140,
141
],
[
143,
144
],
[
146,
147
],
[
149,
150
],
[
152,
153
],
[
155,
156
]
] | [
"from collections import Counter, defaultdict\n\nans = defaultdict(lambda: 0)\nh, w, n = map(int, input().split())\nfor _ in range(n):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for a_i in range(a - 2, a + 1):\n for b_i in range(b - 2, b + 1):\n if (0 <= a_i < h - 2) & (0 <= b_i < w - 2):\n ans[(a_i, b_i)] += 1\n\nk = Counter(ans.values())\nprint((h - 2) * (w - 2) - sum(k.values()))\nfor i in range(1, 10):\n if i in k.keys():\n print(k[i])\n else:\n print(0)",
"from collections import Counter, defaultdict",
"ans = defaultdict(lambda: 0)",
"ans",
"defaultdict(lambda: 0)",
"defaultdict",
"lambda: 0",
"0",
"h, w, n = map(int, input().split())",
"h",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"w",
"n",
"for _ in range(n):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n for a_i in range(a - 2, a + 1):\n for b_i in range(b - 2, b + 1):\n if (0 <= a_i < h - 2) & (0 <= b_i < w - 2):\n ans[(a_i, b_i)] += 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 a_i in range(a - 2, a + 1):\n for b_i in range(b - 2, b + 1):\n if (0 <= a_i < h - 2) & (0 <= b_i < w - 2):\n ans[(a_i, b_i)] += 1",
"a_i",
"range(a - 2, a + 1)",
"range",
"a - 2",
"a",
"2",
"a + 1",
"a",
"1",
"for b_i in range(b - 2, b + 1):\n if (0 <= a_i < h - 2) & (0 <= b_i < w - 2):\n ans[(a_i, b_i)] += 1",
"b_i",
"range(b - 2, b + 1)",
"range",
"b - 2",
"b",
"2",
"b + 1",
"b",
"1",
"if (0 <= a_i < h - 2) & (0 <= b_i < w - 2):\n ans[(a_i, b_i)] += 1",
"(0 <= a_i < h - 2) & (0 <= b_i < w - 2)",
"0 <= a_i < h - 2",
"0 <= a_i",
"0",
"a_i",
"h - 2",
"h",
"2",
"0 <= b_i < w - 2",
"0 <= b_i",
"0",
"b_i",
"w - 2",
"w",
"2",
"ans[(a_i, b_i)] += 1",
"ans[(a_i, b_i)]",
"ans",
"(a_i, b_i)",
"a_i",
"b_i",
"1",
"k = Counter(ans.values())",
"k",
"Counter(ans.values())",
"Counter",
"ans.values()",
"ans.values",
"ans",
"values",
"print((h - 2) * (w - 2) - sum(k.values()))",
"print",
"(h - 2) * (w - 2) - sum(k.values())",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"sum(k.values())",
"sum",
"k.values()",
"k.values",
"k",
"values",
"for i in range(1, 10):\n if i in k.keys():\n print(k[i])\n else:\n print(0)",
"i",
"range(1, 10)",
"range",
"1",
"10",
"if i in k.keys():\n print(k[i])\n else:\n print(0)",
"i in k.keys()",
"i",
"k.keys()",
"k.keys",
"k",
"keys",
"print(k[i])",
"print",
"k[i]",
"k",
"i",
"print(0)",
"print",
"0",
"h, w, n = map(int, input().split())",
"map(int, input().split())",
"h",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"k = Counter(ans.values())",
"Counter(ans.values())",
"k",
"ans = defaultdict(lambda: 0)",
"defaultdict(lambda: 0)",
"ans",
"w, n = map(int, input().split())",
"map(int, input().split())",
"w",
"b -= 1",
"1",
"b",
"a -= 1",
"1",
"a"
] | from collections import Counter, defaultdict
ans = defaultdict(lambda: 0)
h, w, n = map(int, input().split())
for _ in range(n):
a, b = map(int, input().split())
a -= 1
b -= 1
for a_i in range(a - 2, a + 1):
for b_i in range(b - 2, b + 1):
if (0 <= a_i < h - 2) & (0 <= b_i < w - 2):
ans[(a_i, b_i)] += 1
k = Counter(ans.values())
print((h - 2) * (w - 2) - sum(k.values()))
for i in range(1, 10):
if i in k.keys():
print(k[i])
else:
print(0) |
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
14,
40,
40,
17,
2,
13,
13,
2,
13,
17,
28,
13,
4,
13,
17,
14,
40,
40,
17,
2,
13,
13,
2,
13,
17,
0,
13,
39,
2,
13,
13,
2,
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,
39,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
146,
3
],
[
146,
12
],
[
146,
13
],
[
131,
15
],
[
21,
20
],
[
141,
23
],
[
143,
25
],
[
143,
34
],
[
37,
36
],
[
144,
45
],
[
36,
46
],
[
147,
48
],
[
52,
51
],
[
135,
60
],
[
51,
61
],
[
138,
63
],
[
125,
66
],
[
144,
69
],
[
36,
70
],
[
135,
72
],
[
51,
73
],
[
78,
75
],
[
132,
76
],
[
126,
77
],
[
128,
80
],
[
87,
86
],
[
132,
89
],
[
95,
92
],
[
129,
93
],
[
86,
94
],
[
100,
97
],
[
129,
98
],
[
147,
103
],
[
138,
106
],
[
129,
111
],
[
116,
115
],
[
129,
122
],
[
115,
123
],
[
125,
126
],
[
128,
129
],
[
131,
132
],
[
143,
135
],
[
146,
138
],
[
146,
141
],
[
143,
144
],
[
146,
147
]
] | [
"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(3):\n if 1 <= a - k <= h - 2:\n for l in range(3):\n if 1 <= b - l <= w - 2:\n x = (a - k, b - 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(3):\n if 1 <= a - k <= h - 2:\n for l in range(3):\n if 1 <= b - l <= w - 2:\n x = (a - k, b - 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(3):\n if 1 <= a - k <= h - 2:\n for l in range(3):\n if 1 <= b - l <= w - 2:\n x = (a - k, b - l)\n d[x] += 1",
"k",
"range(3)",
"range",
"3",
"if 1 <= a - k <= h - 2:\n for l in range(3):\n if 1 <= b - l <= w - 2:\n x = (a - k, b - l)\n d[x] += 1",
"1 <= a - k <= h - 2",
"1 <= a - k",
"1",
"a - k",
"a",
"k",
"h - 2",
"h",
"2",
"for l in range(3):\n if 1 <= b - l <= w - 2:\n x = (a - k, b - l)\n d[x] += 1",
"l",
"range(3)",
"range",
"3",
"if 1 <= b - l <= w - 2:\n x = (a - k, b - l)\n d[x] += 1",
"1 <= b - l <= w - 2",
"1 <= b - l",
"1",
"b - l",
"b",
"l",
"w - 2",
"w",
"2",
"x = (a - k, b - l)",
"x",
"(a - k, b - l)",
"a - k",
"a",
"k",
"b - l",
"b",
"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",
"x = (a - k, b - l)",
"(a - k, b - l)",
"x",
"ans = [0] * 10",
"[0] * 10",
"ans",
"d = defaultdict(int)",
"defaultdict(int)",
"d",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"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",
"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):
a, b = map(int, input().split())
for k in range(3):
if 1 <= a - k <= h - 2:
for l in range(3):
if 1 <= b - l <= w - 2:
x = (a - k, b - 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,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
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,
14,
40,
39,
13,
13,
13,
0,
18,
13,
39,
13,
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,
18,
13,
39,
17,
28,
13,
4,
13,
17,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13
] | [
[
144,
2
],
[
144,
11
],
[
144,
12
],
[
153,
14
],
[
18,
17
],
[
139,
20
],
[
159,
22
],
[
159,
33
],
[
36,
35
],
[
42,
41
],
[
162,
47
],
[
160,
49
],
[
35,
50
],
[
156,
52
],
[
148,
54
],
[
41,
55
],
[
163,
61
],
[
145,
63
],
[
157,
68
],
[
142,
70
],
[
154,
77
],
[
84,
79
],
[
154,
80
],
[
91,
86
],
[
154,
87
],
[
150,
93
],
[
100,
99
],
[
154,
102
],
[
108,
105
],
[
151,
106
],
[
99,
107
],
[
113,
110
],
[
151,
111
],
[
145,
116
],
[
142,
119
],
[
151,
124
],
[
129,
128
],
[
151,
135
],
[
128,
136
],
[
144,
139
],
[
144,
142
],
[
144,
145
],
[
159,
148
],
[
150,
151
],
[
153,
154
],
[
156,
157
],
[
159,
160
],
[
162,
163
]
] | [
"H,W,N = map(int,input().split())\nd = {}\nfor _ in range(N):\n a,b = list(map(int,input().split()))\n for dy in range(-1,2):\n for dx in range(-1,2):\n cy = a + dy\n cx = b + dx\n if 2 <= cy <= H-1 and 2 <= cx <= W-1:\n if (cy,cx) not in d:\n d[(cy,cx)] = 1\n else:\n d[(cy, cx)] += 1\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 _ in range(N):\n a,b = list(map(int,input().split()))\n for dy in range(-1,2):\n for dx in range(-1,2):\n cy = a + dy\n cx = b + dx\n if 2 <= cy <= H-1 and 2 <= cx <= W-1:\n if (cy,cx) not in d:\n d[(cy,cx)] = 1\n else:\n d[(cy, cx)] += 1",
"_",
"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 range(-1,2):\n for dx in range(-1,2):\n cy = a + dy\n cx = b + dx\n if 2 <= cy <= H-1 and 2 <= cx <= W-1:\n if (cy,cx) not in d:\n d[(cy,cx)] = 1\n else:\n d[(cy, cx)] += 1",
"dy",
"range(-1,2)",
"range",
"-1",
"2",
"for dx in range(-1,2):\n cy = a + dy\n cx = b + dx\n if 2 <= cy <= H-1 and 2 <= cx <= W-1:\n if (cy,cx) not in d:\n d[(cy,cx)] = 1\n else:\n d[(cy, cx)] += 1",
"dx",
"range(-1,2)",
"range",
"-1",
"2",
"cy = a + dy",
"cy",
"a + dy",
"a",
"dy",
"cx = b + dx",
"cx",
"b + dx",
"b",
"dx",
"if 2 <= cy <= H-1 and 2 <= cx <= W-1:\n if (cy,cx) not in d:\n d[(cy,cx)] = 1\n else:\n d[(cy, cx)] += 1",
"2 <= cy <= H-1 and 2 <= cx <= W-1",
"2 <= cy <= H-1",
"2 <= cy",
"2",
"cy",
"H-1",
"H",
"1",
"2 <= cx <= W-1",
"2 <= cx",
"2",
"cx",
"W-1",
"W",
"1",
"if (cy,cx) not in d:\n d[(cy,cx)] = 1\n else:\n d[(cy, cx)] += 1",
"(cy,cx) not in d",
"(cy,cx)",
"cy",
"cx",
"d",
"d[(cy,cx)] = 1",
"d[(cy,cx)]",
"d",
"(cy,cx)",
"cy",
"cx",
"1",
"d[(cy, cx)] += 1",
"d[(cy, cx)]",
"d",
"(cy, cx)",
"cy",
"cx",
"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",
"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",
"b = list(map(int,input().split()))",
"list(map(int,input().split()))",
"b",
"ans = [0]*10",
"[0]*10",
"ans",
"d = {}",
"{}",
"d",
"cx = b + dx",
"b + dx",
"cx",
"a,b = list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"cy = a + dy",
"a + dy",
"cy"
] | H,W,N = map(int,input().split())
d = {}
for _ in range(N):
a,b = list(map(int,input().split()))
for dy in range(-1,2):
for dx in range(-1,2):
cy = a + dy
cx = b + dx
if 2 <= cy <= H-1 and 2 <= cx <= W-1:
if (cy,cx) not in d:
d[(cy,cx)] = 1
else:
d[(cy, cx)] += 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,
12,
13,
15,
13,
15,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
28,
13,
4,
13,
0,
13,
4,
13,
13,
4,
18,
13,
13,
13,
0,
13,
17,
0,
13,
17,
4,
18,
13,
13,
39,
13,
13,
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,
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,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
8,
7
],
[
15,
14
],
[
15,
23
],
[
15,
24
],
[
27,
26
],
[
31,
30
],
[
7,
32
],
[
35,
34
],
[
30,
40
],
[
35,
42
],
[
45,
44
],
[
48,
47
],
[
26,
51
],
[
58,
57
],
[
66,
65
],
[
44,
69
],
[
34,
69
],
[
44,
72
],
[
34,
72
],
[
76,
75
],
[
47,
79
],
[
42,
79
],
[
47,
82
],
[
42,
82
],
[
65,
89
],
[
14,
91
],
[
75,
96
],
[
23,
98
],
[
106,
101
],
[
57,
102
],
[
109,
108
],
[
57,
113
],
[
119,
116
],
[
108,
117
],
[
14,
122
],
[
23,
125
],
[
108,
131
],
[
135,
134
],
[
108,
141
],
[
134,
142
],
[
151,
148
]
] | [
"def main():\n import sys\n from collections import Counter\n # readline = sys.stdin.readline\n readlines = sys.stdin.readlines\n H, W, N = map(int, input().split())\n P = set()\n for s in readlines():\n a, b = map(int, s.split())\n a -= 1; b -= 1\n P.add((a, b))\n\n cnt = Counter()\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:\n cnt[(oa, ob)] += 1\n ans = Counter(cnt.values())\n ans[0] = (H - 2) * (W - 2) - sum(ans.values())\n\n for i in range(10):\n print(ans[i])\n\n\nif __name__ == \"__main__\":\n main()",
"def main():\n import sys\n from collections import Counter\n # readline = sys.stdin.readline\n readlines = sys.stdin.readlines\n H, W, N = map(int, input().split())\n P = set()\n for s in readlines():\n a, b = map(int, s.split())\n a -= 1; b -= 1\n P.add((a, b))\n\n cnt = Counter()\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:\n cnt[(oa, ob)] += 1\n ans = Counter(cnt.values())\n ans[0] = (H - 2) * (W - 2) - sum(ans.values())\n\n for i in range(10):\n print(ans[i])",
"main",
"import sys",
"sys",
"from collections import Counter",
"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",
"P = set()",
"P",
"set()",
"set",
"for s in readlines():\n a, b = map(int, s.split())\n a -= 1; b -= 1\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",
"P.add((a, b))",
"P.add",
"P",
"add",
"(a, b)",
"a",
"b",
"cnt = Counter()",
"cnt",
"Counter()",
"Counter",
"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:\n cnt[(oa, ob)] += 1\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:\n cnt[(oa, ob)] += 1\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:\n cnt[(oa, ob)] += 1\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:\n cnt[(oa, ob)] += 1\n ",
"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",
"cnt[(oa, ob)] += 1",
"cnt[(oa, ob)]",
"cnt",
"(oa, ob)",
"oa",
"ob",
"1",
"ans = Counter(cnt.values())",
"ans",
"Counter(cnt.values())",
"Counter",
"cnt.values()",
"cnt.values",
"cnt",
"values",
"ans[0] = (H - 2) * (W - 2) - sum(ans.values())",
"ans[0]",
"ans",
"0",
"(H - 2) * (W - 2) - sum(ans.values())",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(ans.values())",
"sum",
"ans.values()",
"ans.values",
"ans",
"values",
"for i in range(10):\n print(ans[i])",
"i",
"range(10)",
"range",
"10",
"print(ans[i])",
"print",
"ans[i]",
"ans",
"i",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n import sys\n from collections import Counter\n # readline = sys.stdin.readline\n readlines = sys.stdin.readlines\n H, W, N = map(int, input().split())\n P = set()\n for s in readlines():\n a, b = map(int, s.split())\n a -= 1; b -= 1\n P.add((a, b))\n\n cnt = Counter()\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:\n cnt[(oa, ob)] += 1\n ans = Counter(cnt.values())\n ans[0] = (H - 2) * (W - 2) - sum(ans.values())\n\n for i in range(10):\n print(ans[i])",
"def main():\n import sys\n from collections import Counter\n # readline = sys.stdin.readline\n readlines = sys.stdin.readlines\n H, W, N = map(int, input().split())\n P = set()\n for s in readlines():\n a, b = map(int, s.split())\n a -= 1; b -= 1\n P.add((a, b))\n\n cnt = Counter()\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:\n cnt[(oa, ob)] += 1\n ans = Counter(cnt.values())\n ans[0] = (H - 2) * (W - 2) - sum(ans.values())\n\n for i in range(10):\n print(ans[i])",
"main"
] | def main():
import sys
from collections import Counter
# readline = sys.stdin.readline
readlines = sys.stdin.readlines
H, W, N = map(int, input().split())
P = set()
for s in readlines():
a, b = map(int, s.split())
a -= 1; b -= 1
P.add((a, b))
cnt = Counter()
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:
cnt[(oa, ob)] += 1
ans = Counter(cnt.values())
ans[0] = (H - 2) * (W - 2) - sum(ans.values())
for i in range(10):
print(ans[i])
if __name__ == "__main__":
main()
|
[
7,
15,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
39,
17,
17,
17,
0,
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,
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,
2,
39,
17,
17,
28,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
4,
13,
31,
13,
0,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] | [
[
147,
4
],
[
147,
13
],
[
147,
14
],
[
138,
16
],
[
132,
21
],
[
32,
31
],
[
35,
34
],
[
130,
37
],
[
150,
39
],
[
150,
48
],
[
135,
54
],
[
151,
56
],
[
153,
59
],
[
142,
61
],
[
136,
68
],
[
148,
70
],
[
154,
75
],
[
127,
77
],
[
85,
80
],
[
139,
81
],
[
144,
87
],
[
94,
93
],
[
139,
96
],
[
102,
99
],
[
145,
100
],
[
93,
101
],
[
107,
104
],
[
145,
105
],
[
148,
110
],
[
127,
113
],
[
145,
117
],
[
145,
121
],
[
124,
123
],
[
147,
127
],
[
147,
130
],
[
132,
133
],
[
135,
136
],
[
138,
139
],
[
150,
142
],
[
144,
145
],
[
147,
148
],
[
150,
151
],
[
153,
154
]
] | [
"from collections import defaultdict\nfrom itertools import product\n\nH, W, N = map(int, input().split())\ncnt = defaultdict(int)\nD = tuple(product((-1, 0, 1), repeat=2))\n\nfor _ in range(N):\n a, b = map(int, input().split())\n for dh, dw in D:\n h = a + dh\n w = b + dw\n if 2 <= h <= H - 1 and 2 <= w <= W - 1:\n cnt[(h, w)] += 1\n\nans = [0] * 10\nfor c in cnt.values():\n ans[c] += 1\nans[0] = (H - 2) * (W - 2) - sum(ans)\nprint(*ans, sep='\\n')",
"from collections import defaultdict",
"from itertools import product",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"cnt = defaultdict(int)",
"cnt",
"defaultdict(int)",
"defaultdict",
"int",
"D = tuple(product((-1, 0, 1), repeat=2))",
"D",
"tuple(product((-1, 0, 1), repeat=2))",
"tuple",
"product((-1, 0, 1), repeat=2)",
"product",
"(-1, 0, 1)",
"-1",
"0",
"1",
"repeat=2",
"repeat",
"2",
"for _ in range(N):\n a, b = map(int, input().split())\n for dh, dw in D:\n h = a + dh\n w = b + dw\n if 2 <= h <= H - 1 and 2 <= w <= W - 1:\n cnt[(h, w)] += 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 dh, dw in D:\n h = a + dh\n w = b + dw\n if 2 <= h <= H - 1 and 2 <= w <= W - 1:\n cnt[(h, w)] += 1",
"dh",
"dw",
"D",
"h = a + dh",
"h",
"a + dh",
"a",
"dh",
"w = b + dw",
"w",
"b + dw",
"b",
"dw",
"if 2 <= h <= H - 1 and 2 <= w <= W - 1:\n cnt[(h, w)] += 1",
"2 <= h <= H - 1 and 2 <= w <= W - 1",
"2 <= h <= H - 1",
"2 <= h",
"2",
"h",
"H - 1",
"H",
"1",
"2 <= w <= W - 1",
"2 <= w",
"2",
"w",
"W - 1",
"W",
"1",
"cnt[(h, w)] += 1",
"cnt[(h, w)]",
"cnt",
"(h, w)",
"h",
"w",
"1",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for c in cnt.values():\n ans[c] += 1",
"c",
"cnt.values()",
"cnt.values",
"cnt",
"values",
"ans[c] += 1",
"ans[c]",
"ans",
"c",
"1",
"ans[0] = (H - 2) * (W - 2) - sum(ans)",
"ans[0]",
"ans",
"0",
"(H - 2) * (W - 2) - sum(ans)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(ans)",
"sum",
"ans",
"print(*ans, sep='\\n')",
"print",
"*ans",
"ans",
"sep='\\n'",
"sep",
"'\\n'",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"D = tuple(product((-1, 0, 1), repeat=2))",
"tuple(product((-1, 0, 1), repeat=2))",
"D",
"h = a + dh",
"a + dh",
"h",
"cnt = defaultdict(int)",
"defaultdict(int)",
"cnt",
"b = map(int, input().split())",
"map(int, input().split())",
"b",
"ans = [0] * 10",
"[0] * 10",
"ans",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"w = b + dw",
"b + dw",
"w"
] | from collections import defaultdict
from itertools import product
H, W, N = map(int, input().split())
cnt = defaultdict(int)
D = tuple(product((-1, 0, 1), repeat=2))
for _ in range(N):
a, b = map(int, input().split())
for dh, dw in D:
h = a + dh
w = b + dw
if 2 <= h <= H - 1 and 2 <= w <= W - 1:
cnt[(h, w)] += 1
ans = [0] * 10
for c in cnt.values():
ans[c] += 1
ans[0] = (H - 2) * (W - 2) - sum(ans)
print(*ans, sep='\n')
|
[
7,
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,
2,
13,
17,
17,
28,
13,
4,
13,
4,
13,
17,
2,
13,
17,
2,
4,
13,
2,
13,
17,
2,
13,
17,
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,
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
] | [
[
140,
3
],
[
140,
12
],
[
140,
13
],
[
122,
15
],
[
21,
20
],
[
141,
23
],
[
134,
25
],
[
134,
34
],
[
37,
36
],
[
135,
43
],
[
132,
49
],
[
135,
52
],
[
57,
56
],
[
129,
63
],
[
126,
69
],
[
129,
72
],
[
81,
76
],
[
123,
77
],
[
137,
83
],
[
123,
93
],
[
99,
96
],
[
138,
97
],
[
104,
101
],
[
138,
102
],
[
132,
107
],
[
126,
110
],
[
138,
114
],
[
117,
116
],
[
138,
116
],
[
116,
120
],
[
122,
123
],
[
140,
126
],
[
134,
129
],
[
140,
132
],
[
134,
135
],
[
137,
138
],
[
140,
141
]
] | [
"from collections import defaultdict\n\nH, W, N = map(int, input().split())\n\nmem = defaultdict(int)\nfor _ in range(N) :\n a, b = map(int, input().split())\n for i in range(max(2, a-1), min(H-1, a+1)+1) :\n for j in range(max(2, b-1), min(W-1, b+1)+1) :\n mem[(i, j)] += 1\n \nret = [0] * 10\nfor k, v in mem.items() :\n ret[v] += 1\n\nret[0] = (H - 2) * (W - 2) - sum(ret)\n \nfor r in ret :\n print(r)",
"from collections import defaultdict",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"mem = defaultdict(int)",
"mem",
"defaultdict(int)",
"defaultdict",
"int",
"for _ in range(N) :\n a, b = map(int, input().split())\n for i in range(max(2, a-1), min(H-1, a+1)+1) :\n for j in range(max(2, b-1), min(W-1, b+1)+1) :\n mem[(i, j)] += 1\n ",
"_",
"range(N)",
"range",
"N",
"a, b = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"for i in range(max(2, a-1), min(H-1, a+1)+1) :\n for j in range(max(2, b-1), min(W-1, b+1)+1) :\n mem[(i, j)] += 1\n ",
"i",
"range(max(2, a-1), min(H-1, a+1)+1)",
"range",
"max(2, a-1)",
"max",
"2",
"a-1",
"a",
"1",
"min(H-1, a+1)+1",
"min(H-1, a+1)",
"min",
"H-1",
"H",
"1",
"a+1",
"a",
"1",
"1",
"for j in range(max(2, b-1), min(W-1, b+1)+1) :\n mem[(i, j)] += 1\n ",
"j",
"range(max(2, b-1), min(W-1, b+1)+1)",
"range",
"max(2, b-1)",
"max",
"2",
"b-1",
"b",
"1",
"min(W-1, b+1)+1",
"min(W-1, b+1)",
"min",
"W-1",
"W",
"1",
"b+1",
"b",
"1",
"1",
"mem[(i, j)] += 1",
"mem[(i, j)]",
"mem",
"(i, j)",
"i",
"j",
"1",
"ret = [0] * 10",
"ret",
"[0] * 10",
"[0]",
"0",
"10",
"for k, v in mem.items() :\n ret[v] += 1",
"k",
"v",
"mem.items()",
"mem.items",
"mem",
"items",
"ret[v] += 1",
"ret[v]",
"ret",
"v",
"1",
"ret[0] = (H - 2) * (W - 2) - sum(ret)",
"ret[0]",
"ret",
"0",
"(H - 2) * (W - 2) - sum(ret)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(ret)",
"sum",
"ret",
"for r in ret :\n print(r)",
"r",
"ret",
"print(r)",
"print",
"r",
"mem = defaultdict(int)",
"defaultdict(int)",
"mem",
"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",
"a, b = map(int, input().split())",
"map(int, input().split())",
"a",
"ret = [0] * 10",
"[0] * 10",
"ret",
"N = map(int, input().split())",
"map(int, input().split())",
"N"
] | from collections import defaultdict
H, W, N = map(int, input().split())
mem = defaultdict(int)
for _ in range(N) :
a, b = map(int, input().split())
for i in range(max(2, a-1), min(H-1, a+1)+1) :
for j in range(max(2, b-1), min(W-1, b+1)+1) :
mem[(i, j)] += 1
ret = [0] * 10
for k, v in mem.items() :
ret[v] += 1
ret[0] = (H - 2) * (W - 2) - sum(ret)
for r in ret :
print(r)
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
13,
31,
13,
0,
13,
39,
0,
13,
2,
39,
2,
2,
13,
17,
2,
13,
17,
2,
39,
17,
17,
28,
13,
13,
4,
13,
31,
2,
39,
4,
13,
13,
17,
28,
13,
4,
13,
17,
0,
13,
2,
13,
2,
13,
17,
0,
13,
2,
13,
2,
13,
17,
14,
2,
2,
2,
2,
2,
13,
17,
13,
17,
13,
2,
13,
17,
28,
13,
13,
4,
18,
4,
13,
4,
18,
4,
13,
13,
13,
13,
4,
13,
31,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13
] | [
[
117,
3
],
[
117,
16
],
[
117,
17
],
[
117,
18
],
[
111,
21
],
[
102,
24
],
[
118,
29
],
[
109,
32
],
[
52,
51
],
[
120,
56
],
[
51,
60
],
[
114,
63
],
[
51,
67
],
[
118,
75
],
[
115,
77
],
[
121,
79
],
[
109,
81
],
[
112,
94
],
[
103,
100
],
[
102,
103
],
[
117,
106
],
[
117,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
120,
121
]
] | [
"from collections import Counter as C;H,W,N,*L=map(int,open(0).read().split());K=[];M=[(H-2)*(W-2)]+[0]*9\nfor a,b in zip(*[iter(L)]*2):\n\tfor c in range(9):\n\t\tx=b-c//3;y=a-c%3\n\t\tif H-1>y>0<x<W-1:K+=[y*W+x]\nfor k,v in C(C(K).values()).items():M[0]-=v;M[k]+=v\nprint(*M)",
"from collections import Counter as C",
"H,W,N,*L=map(int,open(0).read().split())",
"H",
"map(int,open(0).read().split())",
"map",
"int",
"open(0).read().split()",
"(0).read().split",
"(0).read()",
"(0).read",
"(0)",
"open",
"0",
"read",
"split",
"W",
"N",
"*L",
"L",
"K=[]",
"K",
"[]",
"M=[(H-2)*(W-2)]+[0]*9",
"M",
"[(H-2)*(W-2)]+[0]*9",
"[(H-2)*(W-2)]",
"(H-2)*(W-2)",
"H-2",
"H",
"2",
"W-2",
"W",
"2",
"[0]*9",
"[0]",
"0",
"9",
"for a,b in zip(*[iter(L)]*2):\n\tfor c in range(9):\n\t\tx=b-c//3;y=a-c%3\n\t\tif H-1>y>0<x<W-1:K+=[y*W+x]",
"a",
"b",
"zip(*[iter(L)]*2)",
"zip",
"*[iter(L)]*2",
"[iter(L)]*2",
"[iter(L)]",
"iter(L)",
"iter",
"L",
"2",
"for c in range(9):\n\t\tx=b-c//3;y=a-c%3\n\t\tif H-1>y>0<x<W-1:K+=[y*W+x]",
"c",
"range(9)",
"range",
"9",
"x=b-c//3",
"x",
"b-c//3",
"b",
"c//3",
"c",
"3",
"y=a-c%3",
"y",
"a-c%3",
"a",
"c%3",
"c",
"3",
"if H-1>y>0<x<W-1:K+=[y*W+",
"H-1>y>0<x<W-1",
"H-1>y>0<x",
"H-1>y>0",
"H-1>y",
"H-1",
"H",
"1",
"y",
"0",
"x",
"W-1",
"W",
"1",
"for k,v in C(C(K).values()).items():M[0]-=v;M[k]+=v",
"k",
"v",
"C(C(K).values()).items()",
"(C(K).values()).items",
"(C(K).values())",
"C",
"C(K).values()",
"(K).values",
"(K)",
"C",
"K",
"values",
"items",
"print(*M)",
"print",
"*M",
"M",
"M=[(H-2)*(W-2)]+[0]*9",
"[(H-2)*(W-2)]+[0]*9",
"M",
"N,*L=map(int,open(0).read().split())",
"map(int,open(0).read().split())",
"N",
"W,N,*L=map(int,open(0).read().split())",
"map(int,open(0).read().split())",
"W",
"K=[]",
"[]",
"K",
"y=a-c%3",
"a-c%3",
"y",
"H,W,N,*L=map(int,open(0).read().split())",
"map(int,open(0).read().split())",
"H",
"x=b-c//3",
"b-c//3",
"x"
] | from collections import Counter as C;H,W,N,*L=map(int,open(0).read().split());K=[];M=[(H-2)*(W-2)]+[0]*9
for a,b in zip(*[iter(L)]*2):
for c in range(9):
x=b-c//3;y=a-c%3
if H-1>y>0<x<W-1:K+=[y*W+x]
for k,v in C(C(K).values()).items():M[0]-=v;M[k]+=v
print(*M) |
[
7,
15,
13,
12,
13,
41,
28,
13,
4,
13,
17,
17,
28,
13,
4,
13,
17,
17,
2,
2,
2,
2,
2,
18,
13,
17,
13,
17,
2,
2,
18,
13,
17,
13,
13,
2,
2,
18,
13,
17,
13,
17,
2,
2,
18,
13,
17,
13,
13,
4,
2,
2,
18,
13,
17,
13,
2,
13,
2,
2,
18,
13,
17,
13,
17,
0,
13,
13,
29,
13,
23,
13,
23,
13,
23,
13,
12,
13,
0,
13,
39,
41,
28,
13,
4,
13,
17,
4,
17,
0,
13,
13,
28,
13,
13,
4,
18,
13,
13,
4,
13,
13,
13,
13,
4,
18,
13,
13,
4,
18,
13,
13,
2,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
40,
2,
18,
13,
2,
13,
17,
18,
13,
13,
17,
0,
18,
13,
2,
2,
13,
13,
17,
17,
0,
13,
2,
13,
17,
0,
18,
13,
17,
4,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
29,
13,
23,
13,
23,
13,
23,
13,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
0,
13,
13,
28,
13,
4,
13,
13,
13,
13,
4,
13,
13,
10,
13,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13
] | [
[
8,
7
],
[
14,
13
],
[
71,
24
],
[
7,
26
],
[
71,
31
],
[
7,
33
],
[
73,
34
],
[
71,
38
],
[
13,
40
],
[
71,
45
],
[
13,
47
],
[
75,
48
],
[
71,
53
],
[
7,
55
],
[
73,
57
],
[
71,
61
],
[
13,
63
],
[
67,
66
],
[
66,
69
],
[
71,
71
],
[
73,
73
],
[
75,
75
],
[
80,
79
],
[
84,
83
],
[
91,
90
],
[
94,
93
],
[
178,
93
],
[
79,
97
],
[
243,
100
],
[
93,
101
],
[
174,
102
],
[
176,
103
],
[
79,
106
],
[
79,
110
],
[
174,
113
],
[
176,
114
],
[
117,
116
],
[
120,
119
],
[
79,
125
],
[
79,
131
],
[
119,
133
],
[
79,
136
],
[
119,
137
],
[
147,
140
],
[
90,
141
],
[
119,
144
],
[
116,
145
],
[
149,
145
],
[
150,
149
],
[
119,
151
],
[
157,
154
],
[
90,
155
],
[
174,
163
],
[
176,
166
],
[
90,
170
],
[
90,
172
],
[
174,
174
],
[
176,
176
],
[
178,
178
],
[
251,
180
],
[
251,
196
],
[
251,
197
],
[
201,
200
],
[
249,
203
],
[
236,
223
],
[
227,
226
],
[
246,
228
],
[
252,
229
],
[
240,
230
],
[
237,
231
],
[
226,
234
],
[
236,
237
],
[
251,
240
],
[
251,
249
],
[
251,
252
]
] | [
"import sys\n\ndef getsqs(coor,h,w):\n l=[coor[0]+x+h*(coor[1]+y-1) for x in range(-1,2) for y in range(-1,2) \\\n if coor[0]+x>1 and coor[0]+x<h and coor[1]+y>1 and coor[1]+y<w]\n return l\n\ndef main(h,w,coords):\n sq=[]\n ans=[0 for _ in range(10)]\n for coor in coords:\n sq.extend(getsqs(coor,h,w))\n# print(coor,getsqs(coor,h,w))\n sq.sort()\n sq.append(h*w)\n ind=0\n for x in range(len(sq)-1):\n if sq[x+1]-sq[x]!=0:\n ans[x-ind+1]+=1\n ind=x+1\n ans[0]=max(0,(h-2)*(w-2)-sum(ans))\n return ans\n\nh,w,n=map(int,sys.stdin.readline().strip().split())\ncoords=[list(map(int,sys.stdin.readline().strip().split())) for _ in range(n)]\n\nfor x in main(h,w,coords):\n print(x)\n",
"import sys",
"sys",
"def getsqs(coor,h,w):\n l=[coor[0]+x+h*(coor[1]+y-1) for x in range(-1,2) for y in range(-1,2) \\\n if coor[0]+x>1 and coor[0]+x<h and coor[1]+y>1 and coor[1]+y<w]\n return l",
"getsqs",
"coor[0]+x+h*(coor[1]+y-1) for x in range(-1,2) for y in range(-1,2) \\\n if coor[0]+x>1 and coor[0]+x<h and coor[1]+y>1 and coor[1]+y<w",
"for x in range(-1,2) for y in range(-1,2) \\\n if coor[0]+x>1 and coor[0]+x<h and coor[1]+y>1 and coor[1]+y<w",
"x",
"range(-1,2)",
"range",
"-1",
"2",
"for y in range(-1,2) \\\n if coor[0]+x>1 and coor[0]+x<h and coor[1]+y>1 and coor[1]+y<w",
"y",
"range(-1,2)",
"range",
"-1",
"2",
"coor[0]+x>1 and coor[0]+x<h and coor[1]+y>1 and coor[1]+y<w",
"coor[0]+x>1 and coor[0]+x<h and coor[1]+y>1",
"coor[0]+x>1 and coor[0]+x<h",
"coor[0]+x>1",
"coor[0]+x",
"coor[0]",
"coor",
"0",
"x",
"1",
"coor[0]+x<h",
"coor[0]+x",
"coor[0]",
"coor",
"0",
"x",
"h",
"coor[1]+y>1",
"coor[1]+y",
"coor[1]",
"coor",
"1",
"y",
"1",
"coor[1]+y<w",
"coor[1]+y",
"coor[1]",
"coor",
"1",
"y",
"w",
"if coor[0]+x>1 and coor[0]+x<h and coor[1]+y>1 and coor[1]+y<w",
"coor[0]+x+h*(coor[1]+y-1)",
"coor[0]+x",
"coor[0]",
"coor",
"0",
"x",
"h*(coor[1]+y-1)",
"h",
"coor[1]+y-1",
"coor[1]+y",
"coor[1]",
"coor",
"1",
"y",
"1",
"l=[coor[0]+x+h*(coor[1]+y-1) for x in range(-1,2) for y in range(-1,2) \\\n if coor[0]+x>1 and coor[0]+x<h and coor[1]+y>1 and coor[1]+y<w]",
"l",
"[coor[0]+x+h*(coor[1]+y-1) for x in range(-1,2) for y in range(-1,2) \\\n if coor[0]+x>1 and coor[0]+x<h and coor[1]+y>1 and coor[1]+y<w]",
"return l",
"l",
"coor",
"coor",
"h",
"h",
"w",
"w",
"def main(h,w,coords):\n sq=[]\n ans=[0 for _ in range(10)]\n for coor in coords:\n sq.extend(getsqs(coor,h,w))\n# print(coor,getsqs(coor,h,w))\n sq.sort()\n sq.append(h*w)\n ind=0\n for x in range(len(sq)-1):\n if sq[x+1]-sq[x]!=0:\n ans[x-ind+1]+=1\n ind=x+1\n ans[0]=max(0,(h-2)*(w-2)-sum(ans))\n return ans",
"main",
"sq=[]",
"sq",
"[]",
"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 coor in coords:\n sq.extend(getsqs(coor,h,w))\n# print(coor,getsqs(coor,h,w))\n ",
"coor",
"coords",
"sq.extend(getsqs(coor,h,w))",
"sq.extend",
"sq",
"extend",
"getsqs(coor,h,w)",
"getsqs",
"coor",
"h",
"w",
"sq.sort()",
"sq.sort",
"sq",
"sort",
"sq.append(h*w)",
"sq.append",
"sq",
"append",
"h*w",
"h",
"w",
"ind=0",
"ind",
"0",
"for x in range(len(sq)-1):\n if sq[x+1]-sq[x]!=0:\n ans[x-ind+1]+=1\n ind=x+1\n ",
"x",
"range(len(sq)-1)",
"range",
"len(sq)-1",
"len(sq)",
"len",
"sq",
"1",
"if sq[x+1]-sq[x]!=0:\n ans[x-ind+1]+=1\n ind=x+1\n ",
"sq[x+1]-sq[x]!=0",
"sq[x+1]-sq[x]",
"sq[x+1]",
"sq",
"x+1",
"x",
"1",
"sq[x]",
"sq",
"x",
"0",
"ans[x-ind+1]+=1",
"ans[x-ind+1]",
"ans",
"x-ind+1",
"x-ind",
"x",
"ind",
"1",
"1",
"ind=x+1",
"ind",
"x+1",
"x",
"1",
"ans[0]=max(0,(h-2)*(w-2)-sum(ans))",
"ans[0]",
"ans",
"0",
"max(0,(h-2)*(w-2)-sum(ans))",
"max",
"0",
"(h-2)*(w-2)-sum(ans)",
"(h-2)*(w-2)",
"h-2",
"h",
"2",
"w-2",
"w",
"2",
"sum(ans)",
"sum",
"ans",
"return ans",
"ans",
"h",
"h",
"w",
"w",
"coords",
"coords",
"h,w,n=map(int,sys.stdin.readline().strip().split())",
"h",
"map(int,sys.stdin.readline().strip().split())",
"map",
"int",
"sys.stdin.readline().strip().split()",
"sys.stdin.readline().strip().split",
"sys.stdin.readline().strip()",
"sys.stdin.readline().strip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"strip",
"split",
"w",
"n",
"list(map(int,sys.stdin.readline().strip().split())) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"list(map(int,sys.stdin.readline().strip().split()))",
"list",
"map(int,sys.stdin.readline().strip().split())",
"map",
"int",
"sys.stdin.readline().strip().split()",
"sys.stdin.readline().strip().split",
"sys.stdin.readline().strip()",
"sys.stdin.readline().strip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"strip",
"split",
"coords=[list(map(int,sys.stdin.readline().strip().split())) for _ in range(n)]",
"coords",
"[list(map(int,sys.stdin.readline().strip().split())) for _ in range(n)]",
"for x in main(h,w,coords):\n print(x)",
"x",
"main(h,w,coords)",
"main",
"h",
"w",
"coords",
"print(x)",
"print",
"x",
"coords=[list(map(int,sys.stdin.readline().strip().split())) for _ in range(n)]",
"[list(map(int,sys.stdin.readline().strip().split())) for _ in range(n)]",
"coords",
"w,n=map(int,sys.stdin.readline().strip().split())",
"map(int,sys.stdin.readline().strip().split())",
"w",
"def getsqs(coor,h,w):\n l=[coor[0]+x+h*(coor[1]+y-1) for x in range(-1,2) for y in range(-1,2) \\\n if coor[0]+x>1 and coor[0]+x<h and coor[1]+y>1 and coor[1]+y<w]\n return l",
"def getsqs(coor,h,w):\n l=[coor[0]+x+h*(coor[1]+y-1) for x in range(-1,2) for y in range(-1,2) \\\n if coor[0]+x>1 and coor[0]+x<h and coor[1]+y>1 and coor[1]+y<w]\n return l",
"getsqs",
"def main(h,w,coords):\n sq=[]\n ans=[0 for _ in range(10)]\n for coor in coords:\n sq.extend(getsqs(coor,h,w))\n# print(coor,getsqs(coor,h,w))\n sq.sort()\n sq.append(h*w)\n ind=0\n for x in range(len(sq)-1):\n if sq[x+1]-sq[x]!=0:\n ans[x-ind+1]+=1\n ind=x+1\n ans[0]=max(0,(h-2)*(w-2)-sum(ans))\n return ans",
"def main(h,w,coords):\n sq=[]\n ans=[0 for _ in range(10)]\n for coor in coords:\n sq.extend(getsqs(coor,h,w))\n# print(coor,getsqs(coor,h,w))\n sq.sort()\n sq.append(h*w)\n ind=0\n for x in range(len(sq)-1):\n if sq[x+1]-sq[x]!=0:\n ans[x-ind+1]+=1\n ind=x+1\n ans[0]=max(0,(h-2)*(w-2)-sum(ans))\n return ans",
"main",
"n=map(int,sys.stdin.readline().strip().split())",
"map(int,sys.stdin.readline().strip().split())",
"n",
"h,w,n=map(int,sys.stdin.readline().strip().split())",
"map(int,sys.stdin.readline().strip().split())",
"h"
] | import sys
def getsqs(coor,h,w):
l=[coor[0]+x+h*(coor[1]+y-1) for x in range(-1,2) for y in range(-1,2) \
if coor[0]+x>1 and coor[0]+x<h and coor[1]+y>1 and coor[1]+y<w]
return l
def main(h,w,coords):
sq=[]
ans=[0 for _ in range(10)]
for coor in coords:
sq.extend(getsqs(coor,h,w))
# print(coor,getsqs(coor,h,w))
sq.sort()
sq.append(h*w)
ind=0
for x in range(len(sq)-1):
if sq[x+1]-sq[x]!=0:
ans[x-ind+1]+=1
ind=x+1
ans[0]=max(0,(h-2)*(w-2)-sum(ans))
return ans
h,w,n=map(int,sys.stdin.readline().strip().split())
coords=[list(map(int,sys.stdin.readline().strip().split())) for _ in range(n)]
for x in main(h,w,coords):
print(x)
|
[
7,
15,
13,
12,
13,
0,
13,
17,
0,
13,
4,
13,
17,
4,
18,
13,
13,
2,
17,
17,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
14,
2,
13,
13,
14,
2,
13,
18,
13,
13,
29,
17,
29,
17,
23,
13,
23,
13,
23,
13,
12,
13,
14,
40,
13,
13,
0,
18,
13,
13,
4,
13,
4,
18,
18,
13,
13,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
0,
13,
17,
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,
13,
0,
13,
17,
29,
13,
23,
13,
23,
13,
23,
13,
0,
13,
4,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
0,
13,
13,
0,
13,
2,
39,
17,
17,
0,
13,
4,
13,
0,
13,
4,
13,
28,
13,
13,
13,
4,
13,
13,
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,
2,
40,
40,
17,
13,
2,
13,
17,
40,
40,
17,
13,
2,
13,
17,
40,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
13,
13,
0,
18,
13,
13,
17,
4,
13,
13,
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
],
[
10,
9
],
[
53,
38
],
[
51,
39
],
[
55,
42
],
[
51,
44
],
[
53,
45
],
[
51,
51
],
[
53,
53
],
[
55,
55
],
[
78,
60
],
[
76,
61
],
[
66,
63
],
[
76,
64
],
[
78,
65
],
[
63,
70
],
[
76,
71
],
[
78,
72
],
[
80,
74
],
[
76,
76
],
[
78,
78
],
[
80,
80
],
[
85,
84
],
[
88,
87
],
[
120,
91
],
[
120,
94
],
[
98,
97
],
[
122,
101
],
[
122,
104
],
[
35,
108
],
[
118,
109
],
[
87,
110
],
[
97,
111
],
[
114,
113
],
[
113,
116
],
[
84,
116
],
[
118,
118
],
[
120,
120
],
[
122,
122
],
[
125,
124
],
[
25,
126
],
[
125,
127
],
[
125,
128
],
[
132,
131
],
[
128,
134
],
[
29,
137
],
[
140,
139
],
[
143,
142
],
[
149,
148
],
[
153,
152
],
[
57,
160
],
[
148,
161
],
[
170,
169
],
[
180,
179
],
[
169,
194
],
[
124,
196
],
[
179,
201
],
[
127,
203
],
[
35,
207
],
[
152,
208
],
[
169,
209
],
[
179,
210
],
[
213,
212
],
[
82,
214
],
[
148,
215
],
[
169,
216
],
[
179,
217
],
[
222,
219
],
[
142,
220
],
[
212,
221
],
[
57,
224
],
[
152,
225
],
[
169,
226
],
[
179,
227
],
[
232,
229
],
[
142,
230
],
[
124,
235
],
[
127,
238
],
[
142,
243
],
[
142,
249
],
[
252,
251
],
[
261,
258
]
] | [
"#!/usr/bin/env python3\n\nimport sys\n# import math\n# from string import ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits\n# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)\n# from operator import itemgetter # itemgetter(1), itemgetter('key')\n# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()\n# from collections import defaultdict # subclass of dict. defaultdict(facroty)\n# from collections import Counter # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)\n# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).\n# from heapq import nlargest, nsmallest # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).\n# from itertools import count, cycle, repeat # count(start[,step]), cycle(iter), repeat(elm[,n])\n# from itertools import groupby # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]\n# from itertools import starmap # starmap(pow, [[2,5], [3,2]]) returns [32, 9]\n# from itertools import product, permutations # product(iter, repeat=n), permutations(iter[,r])\n# from itertools import combinations, combinations_with_replacement\n# from itertools import accumulate # accumulate(iter[, f])\n# from functools import reduce # reduce(f, iter[, init])\n# from functools import lru_cache # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)\n# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).\n# from copy import deepcopy # to copy multi-dimentional matrix without reference\n# from fractions import gcd # for Python 3.4 (previous contest @AtCoder)\n\n\ndef main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n\n\n def contained_in_dict_set(d, i, j):\n if i in d:\n if j in d[i]:\n return True\n return False\n \n def register_dict_set(d, i, j):\n if i not in d:\n d[i] = set()\n d[i].add(j)\n\n def count_black_around_center(point_dict, i, j):\n cnt = 0\n for s in range(i-1, i+2):\n for t in range(j-1, j+2):\n if contained_in_dict_set(point_dict, s, t):\n cnt += 1\n return cnt\n \n\n h, w, n = mi()\n points = [lmi() for _ in range(n)]\n num_of_grids_contains_black = [0] * 10\n\n point_dict = dict()\n visited_dict = dict()\n\n for x, y in points:\n register_dict_set(point_dict, x, y)\n\n for x, y in points:\n for i in range(x-1, x+2):\n for j in range(y-1, y+2):\n if 2<=i<=h-1 and 2<=j<=w-1 and not contained_in_dict_set(visited_dict, i, j):\n cnt = count_black_around_center(point_dict, i, j)\n num_of_grids_contains_black[cnt] += 1\n register_dict_set(visited_dict, i, j)\n \n num_of_grids_contains_black[0] = (h - 2) * (w - 2) - sum(num_of_grids_contains_black[1:])\n print(*num_of_grids_contains_black, sep='\\n') \n\n\n\nif __name__ == \"__main__\":\n main()",
"import sys",
"sys",
"def main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n\n\n def contained_in_dict_set(d, i, j):\n if i in d:\n if j in d[i]:\n return True\n return False\n \n def register_dict_set(d, i, j):\n if i not in d:\n d[i] = set()\n d[i].add(j)\n\n def count_black_around_center(point_dict, i, j):\n cnt = 0\n for s in range(i-1, i+2):\n for t in range(j-1, j+2):\n if contained_in_dict_set(point_dict, s, t):\n cnt += 1\n return cnt\n \n\n h, w, n = mi()\n points = [lmi() for _ in range(n)]\n num_of_grids_contains_black = [0] * 10\n\n point_dict = dict()\n visited_dict = dict()\n\n for x, y in points:\n register_dict_set(point_dict, x, y)\n\n for x, y in points:\n for i in range(x-1, x+2):\n for j in range(y-1, y+2):\n if 2<=i<=h-1 and 2<=j<=w-1 and not contained_in_dict_set(visited_dict, i, j):\n cnt = count_black_around_center(point_dict, i, j)\n num_of_grids_contains_black[cnt] += 1\n register_dict_set(visited_dict, i, j)\n \n num_of_grids_contains_black[0] = (h - 2) * (w - 2) - sum(num_of_grids_contains_black[1:])\n print(*num_of_grids_contains_black, sep='\\n') ",
"main",
"mod = 1000000007",
"mod",
"1000000007",
"inf = float('inf')",
"inf",
"float('inf')",
"float",
"'inf'",
"sys.setrecursionlimit(10**6)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**6",
"10",
"6",
"def input(): return sys.stdin.readline().rstrip()\n ",
"input",
"def ii(): return int(input())\n ",
"ii",
"def mi(): return map(int, input().split())\n ",
"mi",
"def mi_0(): return map(lambda x: int(x)-1, input().split())\n ",
"mi_0",
"def lmi(): return list(map(int, input().split()))\n ",
"lmi",
"def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n ",
"lmi_0",
"def li(): return list(input())\n\n\n ",
"li",
"def contained_in_dict_set(d, i, j):\n if i in d:\n if j in d[i]:\n return True\n return False\n \n ",
"contained_in_dict_set",
"if i in d:\n if j in d[i]:\n return True\n ",
"i in d",
"i",
"d",
"if j in d[i]:\n return True\n ",
"j in d[i]",
"j",
"d[i]",
"d",
"i",
"return True",
"True",
"return False",
"False",
"d",
"d",
"i",
"i",
"j",
"j",
"def register_dict_set(d, i, j):\n if i not in d:\n d[i] = set()\n d[i].add(j)\n\n ",
"register_dict_set",
"if i not in d:\n d[i] = set()\n ",
"i not in d",
"i",
"d",
"d[i] = set()",
"d[i]",
"d",
"i",
"set()",
"set",
"d[i].add(j)",
"[i].add",
"[i]",
"d",
"i",
"add",
"j",
"d",
"d",
"i",
"i",
"j",
"j",
"def count_black_around_center(point_dict, i, j):\n cnt = 0\n for s in range(i-1, i+2):\n for t in range(j-1, j+2):\n if contained_in_dict_set(point_dict, s, t):\n cnt += 1\n return cnt\n \n\n ",
"count_black_around_center",
"cnt = 0",
"cnt",
"0",
"for s in range(i-1, i+2):\n for t in range(j-1, j+2):\n if contained_in_dict_set(point_dict, s, t):\n cnt += 1\n ",
"s",
"range(i-1, i+2)",
"range",
"i-1",
"i",
"1",
"i+2",
"i",
"2",
"for t in range(j-1, j+2):\n if contained_in_dict_set(point_dict, s, t):\n cnt += 1\n ",
"t",
"range(j-1, j+2)",
"range",
"j-1",
"j",
"1",
"j+2",
"j",
"2",
"if contained_in_dict_set(point_dict, s, t):\n cnt += 1\n ",
"contained_in_dict_set(point_dict, s, t)",
"contained_in_dict_set",
"point_dict",
"s",
"t",
"cnt += 1",
"cnt",
"1",
"return cnt",
"cnt",
"point_dict",
"point_dict",
"i",
"i",
"j",
"j",
"h, w, n = mi()",
"h",
"mi()",
"mi",
"w",
"n",
"lmi() for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"lmi()",
"lmi",
"points = [lmi() for _ in range(n)]",
"points",
"[lmi() for _ in range(n)]",
"num_of_grids_contains_black = [0] * 10",
"num_of_grids_contains_black",
"[0] * 10",
"[0]",
"0",
"10",
"point_dict = dict()",
"point_dict",
"dict()",
"dict",
"visited_dict = dict()",
"visited_dict",
"dict()",
"dict",
"for x, y in points:\n register_dict_set(point_dict, x, y)\n\n ",
"x",
"y",
"points",
"register_dict_set(point_dict, x, y)",
"register_dict_set",
"point_dict",
"x",
"y",
"for x, y in points:\n for i in range(x-1, x+2):\n for j in range(y-1, y+2):\n if 2<=i<=h-1 and 2<=j<=w-1 and not contained_in_dict_set(visited_dict, i, j):\n cnt = count_black_around_center(point_dict, i, j)\n num_of_grids_contains_black[cnt] += 1\n register_dict_set(visited_dict, i, j)\n \n ",
"x",
"y",
"points",
"for i in range(x-1, x+2):\n for j in range(y-1, y+2):\n if 2<=i<=h-1 and 2<=j<=w-1 and not contained_in_dict_set(visited_dict, i, j):\n cnt = count_black_around_center(point_dict, i, j)\n num_of_grids_contains_black[cnt] += 1\n register_dict_set(visited_dict, i, j)\n \n ",
"i",
"range(x-1, x+2)",
"range",
"x-1",
"x",
"1",
"x+2",
"x",
"2",
"for j in range(y-1, y+2):\n if 2<=i<=h-1 and 2<=j<=w-1 and not contained_in_dict_set(visited_dict, i, j):\n cnt = count_black_around_center(point_dict, i, j)\n num_of_grids_contains_black[cnt] += 1\n register_dict_set(visited_dict, i, j)\n \n ",
"j",
"range(y-1, y+2)",
"range",
"y-1",
"y",
"1",
"y+2",
"y",
"2",
"if 2<=i<=h-1 and 2<=j<=w-1 and not contained_in_dict_set(visited_dict, i, j):\n cnt = count_black_around_center(point_dict, i, j)\n num_of_grids_contains_black[cnt] += 1\n register_dict_set(visited_dict, i, j)\n \n ",
"2<=i<=h-1 and 2<=j<=w-1 and not contained_in_dict_set(visited_dict, i, j)",
"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",
"not contained_in_dict_set(visited_dict, i, j)",
"contained_in_dict_set(visited_dict, i, j)",
"contained_in_dict_set",
"visited_dict",
"i",
"j",
"cnt = count_black_around_center(point_dict, i, j)",
"cnt",
"count_black_around_center(point_dict, i, j)",
"count_black_around_center",
"point_dict",
"i",
"j",
"num_of_grids_contains_black[cnt] += 1",
"num_of_grids_contains_black[cnt]",
"num_of_grids_contains_black",
"cnt",
"1",
"register_dict_set(visited_dict, i, j)",
"register_dict_set",
"visited_dict",
"i",
"j",
"num_of_grids_contains_black[0] = (h - 2) * (w - 2) - sum(num_of_grids_contains_black[1:])",
"num_of_grids_contains_black[0]",
"num_of_grids_contains_black",
"0",
"(h - 2) * (w - 2) - sum(num_of_grids_contains_black[1:])",
"(h - 2) * (w - 2)",
"h - 2",
"h",
"2",
"w - 2",
"w",
"2",
"sum(num_of_grids_contains_black[1:])",
"sum",
"num_of_grids_contains_black[1:]",
"num_of_grids_contains_black",
"1:",
"1",
"print(*num_of_grids_contains_black, sep='\\n')",
"print",
"*num_of_grids_contains_black",
"num_of_grids_contains_black",
"sep='\\n'",
"sep",
"'\\n'",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n\n\n def contained_in_dict_set(d, i, j):\n if i in d:\n if j in d[i]:\n return True\n return False\n \n def register_dict_set(d, i, j):\n if i not in d:\n d[i] = set()\n d[i].add(j)\n\n def count_black_around_center(point_dict, i, j):\n cnt = 0\n for s in range(i-1, i+2):\n for t in range(j-1, j+2):\n if contained_in_dict_set(point_dict, s, t):\n cnt += 1\n return cnt\n \n\n h, w, n = mi()\n points = [lmi() for _ in range(n)]\n num_of_grids_contains_black = [0] * 10\n\n point_dict = dict()\n visited_dict = dict()\n\n for x, y in points:\n register_dict_set(point_dict, x, y)\n\n for x, y in points:\n for i in range(x-1, x+2):\n for j in range(y-1, y+2):\n if 2<=i<=h-1 and 2<=j<=w-1 and not contained_in_dict_set(visited_dict, i, j):\n cnt = count_black_around_center(point_dict, i, j)\n num_of_grids_contains_black[cnt] += 1\n register_dict_set(visited_dict, i, j)\n \n num_of_grids_contains_black[0] = (h - 2) * (w - 2) - sum(num_of_grids_contains_black[1:])\n print(*num_of_grids_contains_black, sep='\\n') ",
"def main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n\n\n def contained_in_dict_set(d, i, j):\n if i in d:\n if j in d[i]:\n return True\n return False\n \n def register_dict_set(d, i, j):\n if i not in d:\n d[i] = set()\n d[i].add(j)\n\n def count_black_around_center(point_dict, i, j):\n cnt = 0\n for s in range(i-1, i+2):\n for t in range(j-1, j+2):\n if contained_in_dict_set(point_dict, s, t):\n cnt += 1\n return cnt\n \n\n h, w, n = mi()\n points = [lmi() for _ in range(n)]\n num_of_grids_contains_black = [0] * 10\n\n point_dict = dict()\n visited_dict = dict()\n\n for x, y in points:\n register_dict_set(point_dict, x, y)\n\n for x, y in points:\n for i in range(x-1, x+2):\n for j in range(y-1, y+2):\n if 2<=i<=h-1 and 2<=j<=w-1 and not contained_in_dict_set(visited_dict, i, j):\n cnt = count_black_around_center(point_dict, i, j)\n num_of_grids_contains_black[cnt] += 1\n register_dict_set(visited_dict, i, j)\n \n num_of_grids_contains_black[0] = (h - 2) * (w - 2) - sum(num_of_grids_contains_black[1:])\n print(*num_of_grids_contains_black, sep='\\n') ",
"main"
] | #!/usr/bin/env python3
import sys
# import math
# from string import ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter # itemgetter(1), itemgetter('key')
# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict # subclass of dict. defaultdict(facroty)
# from collections import Counter # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate # accumulate(iter[, f])
# from functools import reduce # reduce(f, iter[, init])
# from functools import lru_cache # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy # to copy multi-dimentional matrix without reference
# from fractions import gcd # for Python 3.4 (previous contest @AtCoder)
def main():
mod = 1000000007 # 10^9+7
inf = float('inf') # sys.float_info.max = 1.79...e+308
# inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19
sys.setrecursionlimit(10**6) # 1000 -> 1000000
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def mi_0(): return map(lambda x: int(x)-1, input().split())
def lmi(): return list(map(int, input().split()))
def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
def li(): return list(input())
def contained_in_dict_set(d, i, j):
if i in d:
if j in d[i]:
return True
return False
def register_dict_set(d, i, j):
if i not in d:
d[i] = set()
d[i].add(j)
def count_black_around_center(point_dict, i, j):
cnt = 0
for s in range(i-1, i+2):
for t in range(j-1, j+2):
if contained_in_dict_set(point_dict, s, t):
cnt += 1
return cnt
h, w, n = mi()
points = [lmi() for _ in range(n)]
num_of_grids_contains_black = [0] * 10
point_dict = dict()
visited_dict = dict()
for x, y in points:
register_dict_set(point_dict, x, y)
for x, y in points:
for i in range(x-1, x+2):
for j in range(y-1, y+2):
if 2<=i<=h-1 and 2<=j<=w-1 and not contained_in_dict_set(visited_dict, i, j):
cnt = count_black_around_center(point_dict, i, j)
num_of_grids_contains_black[cnt] += 1
register_dict_set(visited_dict, i, j)
num_of_grids_contains_black[0] = (h - 2) * (w - 2) - sum(num_of_grids_contains_black[1:])
print(*num_of_grids_contains_black, sep='\n')
if __name__ == "__main__":
main()
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
28,
13,
4,
13,
17,
0,
18,
13,
2,
13,
2,
13,
17,
17,
0,
13,
2,
39,
17,
17,
28,
13,
13,
13,
0,
18,
13,
18,
13,
13,
2,
2,
2,
2,
2,
13,
17,
13,
17,
13,
2,
13,
17,
0,
18,
13,
17,
2,
2,
2,
13,
17,
2,
13,
17,
4,
13,
13,
28,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
115,
3
],
[
115,
12
],
[
115,
13
],
[
100,
15
],
[
21,
20
],
[
107,
23
],
[
118,
25
],
[
118,
34
],
[
37,
36
],
[
48,
41
],
[
101,
42
],
[
110,
44
],
[
36,
46
],
[
112,
50
],
[
65,
60
],
[
113,
61
],
[
101,
63
],
[
116,
70
],
[
104,
76
],
[
82,
79
],
[
113,
80
],
[
116,
85
],
[
104,
88
],
[
113,
92
],
[
95,
94
],
[
113,
94
],
[
94,
98
],
[
100,
101
],
[
115,
104
],
[
115,
107
],
[
118,
110
],
[
112,
113
],
[
115,
116
],
[
118,
119
]
] | [
"from collections import *\nh,w,n = map(int,input().split())\ndic = defaultdict(int)\nfor _ in range(n):\n a,b = map(int,input().split())\n for i in range(9):\n dic[a - i //3,b - i % 3] += 1\nans =[0]*10\nfor i, j in dic:\n ans[dic[i,j]] += h-1 > i > 0 < j < w -1\nans[0] = (h -2)*(w-2) - sum(ans)\nfor item in ans:\n print(item)",
"from collections import *",
"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 i in range(9):\n dic[a - i //3,b - i % 3] += 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 dic[a - i //3,b - i % 3] += 1",
"i",
"range(9)",
"range",
"9",
"dic[a - i //3,b - i % 3] += 1",
"dic[a - i //3,b - i % 3]",
"dic",
"a - i //3",
"a",
"i //3",
"i",
"3",
"1",
"ans =[0]*10",
"ans",
"[0]*10",
"[0]",
"0",
"10",
"for i, j in dic:\n ans[dic[i,j]] += h-1 > i > 0 < j < w -1",
"i",
"j",
"dic",
"ans[dic[i,j]] += h-1 > i > 0 < j < w -1",
"ans[dic[i,j]]",
"ans",
"dic[i,j]",
"dic",
"i",
"h-1 > i > 0 < j < w -1",
"h-1 > i > 0 < j",
"h-1 > i > 0",
"h-1 > i",
"h-1",
"h",
"1",
"i",
"0",
"j",
"w -1",
"w",
"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 item in ans:\n print(item)",
"item",
"ans",
"print(item)",
"print",
"item",
"dic = defaultdict(int)",
"defaultdict(int)",
"dic",
"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",
"h,w,n = map(int,input().split())",
"map(int,input().split())",
"h",
"b = map(int,input().split())",
"map(int,input().split())",
"b"
] | from collections import *
h,w,n = map(int,input().split())
dic = defaultdict(int)
for _ in range(n):
a,b = map(int,input().split())
for i in range(9):
dic[a - i //3,b - i % 3] += 1
ans =[0]*10
for i, j in dic:
ans[dic[i,j]] += h-1 > i > 0 < j < w -1
ans[0] = (h -2)*(w-2) - 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,
4,
13,
13,
0,
13,
4,
13,
4,
13,
39,
17,
17,
17,
0,
13,
17,
0,
13,
4,
13,
28,
13,
13,
13,
28,
13,
13,
13,
14,
2,
40,
40,
17,
2,
13,
13,
2,
13,
17,
40,
40,
17,
2,
13,
13,
2,
13,
17,
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,
13,
13,
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,
4,
13,
31,
13,
0,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13
] | [
[
168,
3
],
[
168,
12
],
[
168,
13
],
[
17,
16
],
[
151,
19
],
[
153,
32
],
[
159,
37
],
[
48,
47
],
[
174,
50
],
[
169,
70
],
[
157,
79
],
[
175,
83
],
[
162,
93
],
[
165,
103
],
[
154,
118
],
[
171,
120
],
[
126,
123
],
[
163,
124
],
[
172,
125
],
[
166,
125
],
[
131,
128
],
[
163,
129
],
[
169,
134
],
[
157,
137
],
[
163,
141
],
[
163,
145
],
[
148,
147
],
[
168,
151
],
[
153,
154
],
[
168,
157
],
[
159,
160
],
[
162,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
]
] | [
"from itertools import product\n\nH, W, N = map(int, input().split())\nV = set([tuple(map(int, input().split())) for _ in range(N)])\nD = tuple(product((-1, 0, 1), repeat=2))\n\nA = set()\nfor a, b in V:\n for h, w in D:\n if 2 <= a + h <= H - 1 and 2 <= b + w <= W - 1:\n A.add((a + h, b + w))\n\nans = [0] * 10\nfor a, b in A:\n cnt = 0\n for h, w in D:\n if (a + h, b + w) in V:\n cnt += 1\n ans[cnt] += 1\n\nans[0] = (H - 2) * (W - 2) - sum(ans)\nprint(*ans, sep='\\n')",
"from itertools import product",
"H, W, N = map(int, input().split())",
"H",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"W",
"N",
"tuple(map(int, input().split())) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"tuple(map(int, input().split()))",
"tuple",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"V = set([tuple(map(int, input().split())) for _ in range(N)])",
"V",
"set([tuple(map(int, input().split())) for _ in range(N)])",
"set",
"[tuple(map(int, input().split())) for _ in range(N)]",
"D = tuple(product((-1, 0, 1), repeat=2))",
"D",
"tuple(product((-1, 0, 1), repeat=2))",
"tuple",
"product((-1, 0, 1), repeat=2)",
"product",
"(-1, 0, 1)",
"-1",
"0",
"1",
"repeat=2",
"repeat",
"2",
"A = set()",
"A",
"set()",
"set",
"for a, b in V:\n for h, w in D:\n if 2 <= a + h <= H - 1 and 2 <= b + w <= W - 1:\n A.add((a + h, b + w))",
"a",
"b",
"V",
"for h, w in D:\n if 2 <= a + h <= H - 1 and 2 <= b + w <= W - 1:\n A.add((a + h, b + w))",
"h",
"w",
"D",
"if 2 <= a + h <= H - 1 and 2 <= b + w <= W - 1:\n A.add((a + h, b + w))",
"2 <= a + h <= H - 1 and 2 <= b + w <= W - 1",
"2 <= a + h <= H - 1",
"2 <= a + h",
"2",
"a + h",
"a",
"h",
"H - 1",
"H",
"1",
"2 <= b + w <= W - 1",
"2 <= b + w",
"2",
"b + w",
"b",
"w",
"W - 1",
"W",
"1",
"A.add((a + h, b + w))",
"A.add",
"A",
"add",
"(a + h, b + w)",
"a + h",
"a",
"h",
"b + w",
"b",
"w",
"ans = [0] * 10",
"ans",
"[0] * 10",
"[0]",
"0",
"10",
"for a, b in A:\n cnt = 0\n for h, w in D:\n if (a + h, b + w) in V:\n cnt += 1\n ans[cnt] += 1",
"a",
"b",
"A",
"cnt = 0",
"cnt",
"0",
"for h, w in D:\n if (a + h, b + w) in V:\n cnt += 1\n ",
"h",
"w",
"D",
"if (a + h, b + w) in V:\n cnt += 1\n ",
"(a + h, b + w) in V",
"(a + h, b + w)",
"a + h",
"a",
"h",
"b + w",
"b",
"w",
"V",
"cnt += 1",
"cnt",
"1",
"ans[cnt] += 1",
"ans[cnt]",
"ans",
"cnt",
"1",
"ans[0] = (H - 2) * (W - 2) - sum(ans)",
"ans[0]",
"ans",
"0",
"(H - 2) * (W - 2) - sum(ans)",
"(H - 2) * (W - 2)",
"H - 2",
"H",
"2",
"W - 2",
"W",
"2",
"sum(ans)",
"sum",
"ans",
"print(*ans, sep='\\n')",
"print",
"*ans",
"ans",
"sep='\\n'",
"sep",
"'\\n'",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"V = set([tuple(map(int, input().split())) for _ in range(N)])",
"set([tuple(map(int, input().split())) for _ in range(N)])",
"V",
"W, N = map(int, input().split())",
"map(int, input().split())",
"W",
"D = tuple(product((-1, 0, 1), repeat=2))",
"tuple(product((-1, 0, 1), repeat=2))",
"D",
"ans = [0] * 10",
"[0] * 10",
"ans",
"cnt = 0",
"0",
"cnt",
"H, W, N = map(int, input().split())",
"map(int, input().split())",
"H",
"cnt += 1",
"1",
"cnt",
"A = set()",
"set()",
"A"
] | from itertools import product
H, W, N = map(int, input().split())
V = set([tuple(map(int, input().split())) for _ in range(N)])
D = tuple(product((-1, 0, 1), repeat=2))
A = set()
for a, b in V:
for h, w in D:
if 2 <= a + h <= H - 1 and 2 <= b + w <= W - 1:
A.add((a + h, b + w))
ans = [0] * 10
for a, b in A:
cnt = 0
for h, w in D:
if (a + h, b + w) in V:
cnt += 1
ans[cnt] += 1
ans[0] = (H - 2) * (W - 2) - sum(ans)
print(*ans, sep='\n')
|
[
7,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
17,
2,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
2,
13,
2,
17,
13,
0,
13,
17,
0,
13,
18,
13,
2,
13,
17,
0,
13,
4,
13,
4,
13,
4,
13,
13,
4,
18,
13,
13,
17,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13
] | [
[
74,
2
],
[
86,
6
],
[
75,
9
],
[
83,
11
],
[
15,
14
],
[
87,
20
],
[
77,
23
],
[
75,
25
],
[
29,
28
],
[
87,
32
],
[
14,
36
],
[
28,
39
],
[
80,
41
],
[
71,
44
],
[
75,
46
],
[
28,
48
],
[
68,
51
],
[
72,
61
],
[
81,
61
],
[
78,
61
],
[
69,
66
],
[
84,
66
],
[
68,
69
],
[
71,
72
],
[
74,
75
],
[
77,
78
],
[
80,
81
],
[
83,
84
],
[
86,
87
]
] | [
"# https://atcoder.jp/contests/arc061/tasks/arc061_a\n\ns = input()\nk = len(s)\n\n# def dfs(i, f) :\n# \"\"\"\n# argument i : どこから始めるか\n# f : 最初の数\n# returen : falese or ture(作れるならtrue)\n# \"\"\"\n# if i == k-1:\n# return sum(list(map(int, f.split('+'))))\n\n# return dfs(i+1, f + s[ i +1 ]) + \\\n# dfs(i+1, f + '+' + s[ i +1 ]) \n\n# print(dfs(0, s[0]))\n\n#bit木を書いていきます\n\nans = 0\n\nfor bit in range(1 << (k-1)):\n f = s[0]\n \n for i in range(k-1):\n # if bit & (1 << i)で、bitにiが含まれているか(フラグが立っているか)を判定してくれるらしい\n if bit & (1 << i):\n f += '+'\n f += s[i + 1]\n ans += sum(list(map(int, f.split('+'))))\n\nprint(ans)",
"s = input()",
"s",
"input()",
"input",
"k = len(s)",
"k",
"len(s)",
"len",
"s",
"ans = 0",
"ans",
"0",
"for bit in range(1 << (k-1)):\n f = s[0]\n \n for i in range(k-1):\n # if bit & (1 << i)で、bitにiが含まれているか(フラグが立っているか)を判定してくれるらしい\n if bit & (1 << i):\n f += '+'\n f += s[i + 1]\n ans += sum(list(map(int, f.split('+'))))",
"bit",
"range(1 << (k-1))",
"range",
"1 << (k-1)",
"1",
"k-1",
"k",
"1",
"f = s[0]",
"f",
"s[0]",
"s",
"0",
"for i in range(k-1):\n # if bit & (1 << i)で、bitにiが含まれているか(フラグが立っているか)を判定してくれるらしい\n if bit & (1 << i):\n f += '+'\n f += s[i + 1]\n ",
"i",
"range(k-1)",
"range",
"k-1",
"k",
"1",
"if bit & (1 << i):\n f += '+'\n ",
"bit & (1 << i)",
"bit",
"1 << i",
"1",
"i",
"f += '+'",
"f",
"'+'",
"f += s[i + 1]",
"f",
"s[i + 1]",
"s",
"i + 1",
"i",
"1",
"ans += sum(list(map(int, f.split('+'))))",
"ans",
"sum(list(map(int, f.split('+'))))",
"sum",
"list(map(int, f.split('+')))",
"list",
"map(int, f.split('+'))",
"map",
"int",
"f.split('+')",
"f.split",
"f",
"split",
"'+'",
"print(ans)",
"print",
"ans",
"ans += sum(list(map(int, f.split('+'))))",
"sum(list(map(int, f.split('+'))))",
"ans",
"f += s[i + 1]",
"s[i + 1]",
"f",
"s = input()",
"input()",
"s",
"f = s[0]",
"s[0]",
"f",
"f += '+'",
"'+'",
"f",
"ans = 0",
"0",
"ans",
"k = len(s)",
"len(s)",
"k"
] | # https://atcoder.jp/contests/arc061/tasks/arc061_a
s = input()
k = len(s)
# def dfs(i, f) :
# """
# argument i : どこから始めるか
# f : 最初の数
# returen : falese or ture(作れるならtrue)
# """
# if i == k-1:
# return sum(list(map(int, f.split('+'))))
# return dfs(i+1, f + s[ i +1 ]) + \
# dfs(i+1, f + '+' + s[ i +1 ])
# print(dfs(0, s[0]))
#bit木を書いていきます
ans = 0
for bit in range(1 << (k-1)):
f = s[0]
for i in range(k-1):
# if bit & (1 << i)で、bitにiが含まれているか(フラグが立っているか)を判定してくれるらしい
if bit & (1 << i):
f += '+'
f += s[i + 1]
ans += sum(list(map(int, f.split('+'))))
print(ans) |
[
7,
0,
13,
4,
13,
0,
13,
2,
4,
13,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
17,
13,
0,
13,
4,
13,
0,
13,
18,
13,
17,
28,
13,
4,
13,
13,
14,
2,
2,
13,
13,
17,
0,
13,
2,
2,
13,
17,
18,
13,
2,
13,
17,
0,
13,
2,
13,
18,
13,
2,
13,
17,
0,
13,
4,
13,
4,
13,
13,
4,
18,
13,
13,
17,
28,
13,
4,
13,
4,
13,
13,
0,
13,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
2,
13,
10,
2,
13
] | [
[
93,
2
],
[
120,
6
],
[
94,
10
],
[
108,
13
],
[
111,
16
],
[
20,
19
],
[
121,
24
],
[
99,
26
],
[
102,
30
],
[
94,
32
],
[
36,
35
],
[
121,
38
],
[
19,
42
],
[
35,
43
],
[
114,
46
],
[
103,
49
],
[
109,
49
],
[
118,
49
],
[
115,
49
],
[
94,
52
],
[
35,
54
],
[
117,
57
],
[
103,
59
],
[
109,
59
],
[
118,
59
],
[
115,
59
],
[
94,
61
],
[
35,
63
],
[
105,
66
],
[
118,
74
],
[
115,
74
],
[
103,
74
],
[
109,
74
],
[
79,
78
],
[
106,
83
],
[
100,
83
],
[
96,
85
],
[
106,
87
],
[
100,
87
],
[
78,
88
],
[
97,
91
],
[
112,
91
],
[
93,
94
],
[
96,
97
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
120,
121
]
] | [
"S = input()\nn=len(S) - 1 \nshiki = \"\"\noutput = 0\nfor i in range(2**n):\n result = list()\n shiki = S[0]\n for j in range(n):\n if ((i>>j)&1):\n shiki = shiki + '+' + S[j+1]\n else:\n shiki = shiki + S[j+1]\n result = list(map(int,shiki.split('+')))\n for k in range(len(result)):\n output += result[k]\nprint(output)",
"S = input()",
"S",
"input()",
"input",
"n=len(S) - 1",
"n",
"len(S) - 1",
"len(S)",
"len",
"S",
"1",
"shiki = \"\"",
"shiki",
"\"\"",
"output = 0",
"output",
"0",
"for i in range(2**n):\n result = list()\n shiki = S[0]\n for j in range(n):\n if ((i>>j)&1):\n shiki = shiki + '+' + S[j+1]\n else:\n shiki = shiki + S[j+1]\n result = list(map(int,shiki.split('+')))\n for k in range(len(result)):\n output += result[k]",
"i",
"range(2**n)",
"range",
"2**n",
"2",
"n",
"result = list()",
"result",
"list()",
"list",
"shiki = S[0]",
"shiki",
"S[0]",
"S",
"0",
"for j in range(n):\n if ((i>>j)&1):\n shiki = shiki + '+' + S[j+1]\n else:\n shiki = shiki + S[j+1]\n ",
"j",
"range(n)",
"range",
"n",
"if ((i>>j)&1):\n shiki = shiki + '+' + S[j+1]\n else:\n shiki = shiki + S[j+1]\n ",
"(i>>j)&1",
"i>>j",
"i",
"j",
"1",
"shiki = shiki + '+' + S[j+1]",
"shiki",
"shiki + '+' + S[j+1]",
"shiki + '+'",
"shiki",
"'+'",
"S[j+1]",
"S",
"j+1",
"j",
"1",
"shiki = shiki + S[j+1]",
"shiki",
"shiki + S[j+1]",
"shiki",
"S[j+1]",
"S",
"j+1",
"j",
"1",
"result = list(map(int,shiki.split('+')))",
"result",
"list(map(int,shiki.split('+')))",
"list",
"map(int,shiki.split('+'))",
"map",
"int",
"shiki.split('+')",
"shiki.split",
"shiki",
"split",
"'+'",
"for k in range(len(result)):\n output += result[k]",
"k",
"range(len(result))",
"range",
"len(result)",
"len",
"result",
"output += result[k]",
"output",
"result[k]",
"result",
"k",
"print(output)",
"print",
"output",
"S = input()",
"input()",
"S",
"output += result[k]",
"result[k]",
"output",
"result = list()",
"list()",
"result",
"shiki = S[0]",
"S[0]",
"shiki",
"result = list(map(int,shiki.split('+')))",
"list(map(int,shiki.split('+')))",
"result",
"shiki = \"\"",
"\"\"",
"shiki",
"output = 0",
"0",
"output",
"shiki = shiki + '+' + S[j+1]",
"shiki + '+' + S[j+1]",
"shiki",
"shiki = shiki + S[j+1]",
"shiki + S[j+1]",
"shiki",
"n=len(S) - 1",
"len(S) - 1",
"n"
] | S = input()
n=len(S) - 1
shiki = ""
output = 0
for i in range(2**n):
result = list()
shiki = S[0]
for j in range(n):
if ((i>>j)&1):
shiki = shiki + '+' + S[j+1]
else:
shiki = shiki + S[j+1]
result = list(map(int,shiki.split('+')))
for k in range(len(result)):
output += result[k]
print(output) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
2,
4,
13,
13,
17,
0,
13,
17,
0,
13,
39,
28,
13,
4,
13,
2,
17,
13,
0,
13,
2,
39,
17,
13,
28,
13,
4,
13,
13,
14,
2,
2,
13,
13,
17,
0,
18,
13,
13,
17,
4,
18,
13,
13,
13,
28,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
4,
13,
2,
13,
18,
13,
13,
4,
13,
13,
10,
39,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13
] | [
[
102,
2
],
[
99,
8
],
[
103,
12
],
[
105,
15
],
[
87,
18
],
[
22,
21
],
[
100,
26
],
[
108,
28
],
[
100,
32
],
[
35,
34
],
[
100,
37
],
[
21,
41
],
[
34,
42
],
[
48,
45
],
[
109,
46
],
[
34,
47
],
[
88,
51
],
[
109,
53
],
[
56,
55
],
[
88,
55
],
[
96,
58
],
[
62,
61
],
[
100,
64
],
[
93,
66
],
[
103,
69
],
[
61,
70
],
[
55,
72
],
[
61,
73
],
[
90,
75
],
[
94,
79
],
[
97,
79
],
[
103,
81
],
[
100,
82
],
[
91,
85
],
[
106,
85
],
[
87,
88
],
[
90,
91
],
[
93,
94
],
[
96,
97
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
]
] | [
"s = list(input())\nn = (len(s)-1)\nsum = 0\npt = []\nfor i in range(2 ** n):\n tmp = [\"\"] * n\n for j in range(n):\n if (i >> j) &1 :\n tmp[j] = \"+\"\n pt.append(tmp)\n \nfor p in pt:\n fr = \"\"\n for j in range(n):\n \n fr += s[j] + p[j]\n sum += eval(fr+s[n])\n \nprint(sum)",
"s = list(input())",
"s",
"list(input())",
"list",
"input()",
"input",
"n = (len(s)-1)",
"n",
"len(s)-1",
"len(s)",
"len",
"s",
"1",
"sum = 0",
"sum",
"0",
"pt = []",
"pt",
"[]",
"for i in range(2 ** n):\n tmp = [\"\"] * n\n for j in range(n):\n if (i >> j) &1 :\n tmp[j] = \"+\"\n pt.append(tmp)\n ",
"i",
"range(2 ** n)",
"range",
"2 ** n",
"2",
"n",
"tmp = [\"\"] * n",
"tmp",
"[\"\"] * n",
"[\"\"]",
"\"\"",
"n",
"for j in range(n):\n if (i >> j) &1 :\n tmp[j] = \"+\"\n ",
"j",
"range(n)",
"range",
"n",
"if (i >> j) &1 :\n tmp[j] = \"+\"\n ",
"(i >> j) &1",
"i >> j",
"i",
"j",
"1",
"tmp[j] = \"+\"",
"tmp[j]",
"tmp",
"j",
"\"+\"",
"pt.append(tmp)",
"pt.append",
"pt",
"append",
"tmp",
"for p in pt:\n fr = \"\"\n for j in range(n):\n \n fr += s[j] + p[j]\n sum += eval(fr+s[n])\n ",
"p",
"pt",
"fr = \"\"",
"fr",
"\"\"",
"for j in range(n):\n \n fr += s[j] + p[j]\n ",
"j",
"range(n)",
"range",
"n",
"fr += s[j] + p[j]",
"fr",
"s[j] + p[j]",
"s[j]",
"s",
"j",
"p[j]",
"p",
"j",
"sum += eval(fr+s[n])",
"sum",
"eval(fr+s[n])",
"eval",
"fr+s[n]",
"fr",
"s[n]",
"s",
"n",
"print(sum)",
"print",
"sum",
"pt = []",
"[]",
"pt",
"sum += eval(fr+s[n])",
"eval(fr+s[n])",
"sum",
"fr += s[j] + p[j]",
"s[j] + p[j]",
"fr",
"fr = \"\"",
"\"\"",
"fr",
"n = (len(s)-1)",
"len(s)-1",
"n",
"s = list(input())",
"list(input())",
"s",
"sum = 0",
"0",
"sum",
"tmp = [\"\"] * n",
"[\"\"] * n",
"tmp"
] | s = list(input())
n = (len(s)-1)
sum = 0
pt = []
for i in range(2 ** n):
tmp = [""] * n
for j in range(n):
if (i >> j) &1 :
tmp[j] = "+"
pt.append(tmp)
for p in pt:
fr = ""
for j in range(n):
fr += s[j] + p[j]
sum += eval(fr+s[n])
print(sum) |
[
7,
0,
13,
4,
13,
0,
13,
2,
4,
13,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
17,
13,
0,
13,
18,
13,
17,
28,
13,
4,
13,
13,
14,
2,
13,
2,
17,
13,
0,
13,
17,
0,
13,
18,
13,
2,
13,
17,
0,
13,
4,
13,
13,
4,
13,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
2,
13
] | [
[
66,
2
],
[
75,
6
],
[
67,
10
],
[
57,
13
],
[
17,
16
],
[
76,
21
],
[
60,
23
],
[
67,
25
],
[
29,
28
],
[
76,
31
],
[
16,
34
],
[
28,
37
],
[
63,
39
],
[
72,
42
],
[
67,
44
],
[
28,
46
],
[
69,
49
],
[
73,
52
],
[
64,
52
],
[
61,
52
],
[
70,
55
],
[
58,
55
],
[
57,
58
],
[
60,
61
],
[
63,
64
],
[
66,
67
],
[
69,
70
],
[
72,
73
],
[
75,
76
]
] | [
"S = input()\nN = len(S) - 1\n\nsum = 0\nfor bit in range(2 ** N):\n E = S[0]\n for i in range(N):\n if (bit & (1 << i)):\n E += ' + '\n E += S[i + 1]\n sum += eval(E)\n\nprint(sum)",
"S = input()",
"S",
"input()",
"input",
"N = len(S) - 1",
"N",
"len(S) - 1",
"len(S)",
"len",
"S",
"1",
"sum = 0",
"sum",
"0",
"for bit in range(2 ** N):\n E = S[0]\n for i in range(N):\n if (bit & (1 << i)):\n E += ' + '\n E += S[i + 1]\n sum += eval(E)",
"bit",
"range(2 ** N)",
"range",
"2 ** N",
"2",
"N",
"E = S[0]",
"E",
"S[0]",
"S",
"0",
"for i in range(N):\n if (bit & (1 << i)):\n E += ' + '\n E += S[i + 1]\n ",
"i",
"range(N)",
"range",
"N",
"if (bit & (1 << i)):\n E += ' + '\n ",
"bit & (1 << i)",
"bit",
"1 << i",
"1",
"i",
"E += ' + '",
"E",
"' + '",
"E += S[i + 1]",
"E",
"S[i + 1]",
"S",
"i + 1",
"i",
"1",
"sum += eval(E)",
"sum",
"eval(E)",
"eval",
"E",
"print(sum)",
"print",
"sum",
"sum = 0",
"0",
"sum",
"E = S[0]",
"S[0]",
"E",
"E += ' + '",
"' + '",
"E",
"S = input()",
"input()",
"S",
"sum += eval(E)",
"eval(E)",
"sum",
"E += S[i + 1]",
"S[i + 1]",
"E",
"N = len(S) - 1",
"len(S) - 1",
"N"
] | S = input()
N = len(S) - 1
sum = 0
for bit in range(2 ** N):
E = S[0]
for i in range(N):
if (bit & (1 << i)):
E += ' + '
E += S[i + 1]
sum += eval(E)
print(sum) |
[
7,
12,
13,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
17,
2,
13,
17,
41,
28,
13,
4,
13,
2,
13,
17,
4,
17,
0,
13,
13,
0,
13,
4,
13,
4,
13,
13,
17,
0,
18,
13,
39,
2,
4,
13,
13,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
18,
13,
39,
13,
13,
0,
13,
13,
0,
13,
13,
0,
13,
4,
13,
18,
13,
39,
13,
13,
4,
13,
13,
4,
13,
10,
12,
13
] | [
[
5,
4
],
[
11,
10
],
[
4,
13
],
[
16,
15
],
[
19,
18
],
[
10,
24
],
[
29,
28
],
[
10,
32
],
[
38,
37
],
[
41,
40
],
[
18,
45
],
[
58,
48
],
[
37,
49
],
[
37,
54
],
[
40,
57
],
[
40,
58
],
[
61,
60
],
[
64,
63
],
[
67,
66
],
[
37,
71
],
[
37,
75
],
[
66,
76
],
[
80,
79
],
[
66,
81
],
[
85,
84
],
[
4,
88
],
[
94,
93
],
[
79,
94
],
[
63,
94
],
[
96,
94
],
[
97,
96
],
[
10,
97
],
[
100,
99
],
[
4,
103
],
[
99,
109
],
[
84,
109
],
[
15,
109
],
[
114,
111
]
] | [
"\ndef main():\n\n s = str( input() )\n s_l = len(s)\n ans = 0\n for i in range( 2 ** (s_l - 1) ):\n x_i = [ 0 for i in range( s_l - 1 ) ]\n x_i_ = list( format( i , 'b' ) )\n x_i[ len( x_i ) - len( x_i_ ) : ] = x_i_\n\n start = 0\n goal = 0\n for j in range( len(x_i) ):\n if x_i[j] == '1':\n goal = j + 1\n ans += int( s[start:goal] )\n\n #print(start,goal,int( s[start:goal] ) )\n\n start = goal\n goal = s_l\n ans += int( s[ start:goal ] )\n\n #print(start , goal,int( s[start:goal] ) )\n \n print( ans )\n\nmain()",
"def main():\n\n s = str( input() )\n s_l = len(s)\n ans = 0\n for i in range( 2 ** (s_l - 1) ):\n x_i = [ 0 for i in range( s_l - 1 ) ]\n x_i_ = list( format( i , 'b' ) )\n x_i[ len( x_i ) - len( x_i_ ) : ] = x_i_\n\n start = 0\n goal = 0\n for j in range( len(x_i) ):\n if x_i[j] == '1':\n goal = j + 1\n ans += int( s[start:goal] )\n\n #print(start,goal,int( s[start:goal] ) )\n\n start = goal\n goal = s_l\n ans += int( s[ start:goal ] )\n\n #print(start , goal,int( s[start:goal] ) )\n \n print( ans )",
"main",
"s = str( input() )",
"s",
"str( input() )",
"str",
"input()",
"input",
"s_l = len(s)",
"s_l",
"len(s)",
"len",
"s",
"ans = 0",
"ans",
"0",
"for i in range( 2 ** (s_l - 1) ):\n x_i = [ 0 for i in range( s_l - 1 ) ]\n x_i_ = list( format( i , 'b' ) )\n x_i[ len( x_i ) - len( x_i_ ) : ] = x_i_\n\n start = 0\n goal = 0\n for j in range( len(x_i) ):\n if x_i[j] == '1':\n goal = j + 1\n ans += int( s[start:goal] )\n\n #print(start,goal,int( s[start:goal] ) )\n\n start = goal\n goal = s_l\n ans += int( s[ start:goal ] )\n\n #print(start , goal,int( s[start:goal] ) )\n \n ",
"i",
"range( 2 ** (s_l - 1) )",
"range",
"2 ** (s_l - 1)",
"2",
"s_l - 1",
"s_l",
"1",
"0 for i in range( s_l - 1 )",
"for i in range( s_l - 1 )",
"i",
"range( s_l - 1 )",
"range",
"s_l - 1",
"s_l",
"1",
"for i in range( s_l - 1 )",
"0",
"x_i = [ 0 for i in range( s_l - 1 ) ]",
"x_i",
"[ 0 for i in range( s_l - 1 ) ]",
"x_i_ = list( format( i , 'b' ) )",
"x_i_",
"list( format( i , 'b' ) )",
"list",
"format( i , 'b' )",
"format",
"i",
"'b'",
"x_i[ len( x_i ) - len( x_i_ ) : ] = x_i_",
"x_i[ len( x_i ) - len( x_i_ ) : ]",
"x_i",
"len( x_i ) - len( x_i_ ) :",
"len( x_i ) - len( x_i_ )",
"len( x_i )",
"len",
"x_i",
"len( x_i_ )",
"len",
"x_i_",
"x_i_",
"start = 0",
"start",
"0",
"goal = 0",
"goal",
"0",
"for j in range( len(x_i) ):\n if x_i[j] == '1':\n goal = j + 1\n ans += int( s[start:goal] )\n\n #print(start,goal,int( s[start:goal] ) )\n\n start = goal\n ",
"j",
"range( len(x_i) )",
"range",
"len(x_i)",
"len",
"x_i",
"if x_i[j] == '1':\n goal = j + 1\n ans += int( s[start:goal] )\n\n #print(start,goal,int( s[start:goal] ) )\n\n start = goal\n ",
"x_i[j] == '1'",
"x_i[j]",
"x_i",
"j",
"'1'",
"goal = j + 1",
"goal",
"j + 1",
"j",
"1",
"ans += int( s[start:goal] )",
"ans",
"int( s[start:goal] )",
"int",
"s[start:goal]",
"s",
"start:goal",
"start",
"goal",
"start = goal",
"start",
"goal",
"goal = s_l",
"goal",
"s_l",
"ans += int( s[ start:goal ] )",
"ans",
"int( s[ start:goal ] )",
"int",
"s[ start:goal ]",
"s",
"start:goal",
"start",
"goal",
"print( ans )",
"print",
"ans",
"main()",
"main",
"def main():\n\n s = str( input() )\n s_l = len(s)\n ans = 0\n for i in range( 2 ** (s_l - 1) ):\n x_i = [ 0 for i in range( s_l - 1 ) ]\n x_i_ = list( format( i , 'b' ) )\n x_i[ len( x_i ) - len( x_i_ ) : ] = x_i_\n\n start = 0\n goal = 0\n for j in range( len(x_i) ):\n if x_i[j] == '1':\n goal = j + 1\n ans += int( s[start:goal] )\n\n #print(start,goal,int( s[start:goal] ) )\n\n start = goal\n goal = s_l\n ans += int( s[ start:goal ] )\n\n #print(start , goal,int( s[start:goal] ) )\n \n print( ans )",
"def main():\n\n s = str( input() )\n s_l = len(s)\n ans = 0\n for i in range( 2 ** (s_l - 1) ):\n x_i = [ 0 for i in range( s_l - 1 ) ]\n x_i_ = list( format( i , 'b' ) )\n x_i[ len( x_i ) - len( x_i_ ) : ] = x_i_\n\n start = 0\n goal = 0\n for j in range( len(x_i) ):\n if x_i[j] == '1':\n goal = j + 1\n ans += int( s[start:goal] )\n\n #print(start,goal,int( s[start:goal] ) )\n\n start = goal\n goal = s_l\n ans += int( s[ start:goal ] )\n\n #print(start , goal,int( s[start:goal] ) )\n \n print( ans )",
"main"
] |
def main():
s = str( input() )
s_l = len(s)
ans = 0
for i in range( 2 ** (s_l - 1) ):
x_i = [ 0 for i in range( s_l - 1 ) ]
x_i_ = list( format( i , 'b' ) )
x_i[ len( x_i ) - len( x_i_ ) : ] = x_i_
start = 0
goal = 0
for j in range( len(x_i) ):
if x_i[j] == '1':
goal = j + 1
ans += int( s[start:goal] )
#print(start,goal,int( s[start:goal] ) )
start = goal
goal = s_l
ans += int( s[ start:goal ] )
#print(start , goal,int( s[start:goal] ) )
print( ans )
main() |
[
7,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
17,
2,
13,
17,
0,
13,
4,
18,
18,
4,
13,
13,
39,
17,
13,
2,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
4,
13,
18,
13,
13,
0,
13,
4,
13,
18,
13,
39,
13,
2,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
18,
13,
39,
13,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] | [
[
94,
2
],
[
100,
6
],
[
95,
9
],
[
97,
11
],
[
15,
14
],
[
101,
20
],
[
85,
23
],
[
14,
29
],
[
101,
34
],
[
82,
37
],
[
41,
40
],
[
95,
46
],
[
86,
52
],
[
40,
53
],
[
88,
55
],
[
95,
59
],
[
40,
63
],
[
91,
66
],
[
40,
68
],
[
103,
71
],
[
95,
75
],
[
104,
80
],
[
89,
80
],
[
98,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
],
[
91,
92
],
[
94,
95
],
[
97,
98
],
[
100,
101
],
[
103,
104
]
] | [
"s=input()\nsl=len(s)\nans=0\nfor i in range(2**(sl-1)):\n bit=bin(i)[2:].zfill(sl-1)\n now=0\n for j in range(len(s)-1):\n if int(bit[j]):\n ans+=int(s[now:j+1])\n now=j+1\n ans+=int(s[now:])\nprint(ans)",
"s=input()",
"s",
"input()",
"input",
"sl=len(s)",
"sl",
"len(s)",
"len",
"s",
"ans=0",
"ans",
"0",
"for i in range(2**(sl-1)):\n bit=bin(i)[2:].zfill(sl-1)\n now=0\n for j in range(len(s)-1):\n if int(bit[j]):\n ans+=int(s[now:j+1])\n now=j+1\n ans+=int(s[now:])",
"i",
"range(2**(sl-1))",
"range",
"2**(sl-1)",
"2",
"sl-1",
"sl",
"1",
"bit=bin(i)[2:].zfill(sl-1)",
"bit",
"bin(i)[2:].zfill(sl-1)",
"[2:].zfill",
"[2:]",
"(i)",
"bin",
"i",
"2:",
"2",
"zfill",
"sl-1",
"sl",
"1",
"now=0",
"now",
"0",
"for j in range(len(s)-1):\n if int(bit[j]):\n ans+=int(s[now:j+1])\n now=j+1\n ",
"j",
"range(len(s)-1)",
"range",
"len(s)-1",
"len(s)",
"len",
"s",
"1",
"if int(bit[j]):\n ans+=int(s[now:j+1])\n now=j+1\n ",
"int(bit[j])",
"int",
"bit[j]",
"bit",
"j",
"ans+=int(s[now:j+1])",
"ans",
"int(s[now:j+1])",
"int",
"s[now:j+1]",
"s",
"now:j+1",
"now",
"j+1",
"j",
"1",
"now=j+1",
"now",
"j+1",
"j",
"1",
"ans+=int(s[now:])",
"ans",
"int(s[now:])",
"int",
"s[now:]",
"s",
"now:",
"now",
"print(ans)",
"print",
"ans",
"now=0",
"0",
"now",
"bit=bin(i)[2:].zfill(sl-1)",
"bin(i)[2:].zfill(sl-1)",
"bit",
"ans+=int(s[now:j+1])",
"int(s[now:j+1])",
"ans",
"now=j+1",
"j+1",
"now",
"s=input()",
"input()",
"s",
"ans=0",
"0",
"ans",
"sl=len(s)",
"len(s)",
"sl",
"ans+=int(s[now:])",
"int(s[now:])",
"ans"
] | s=input()
sl=len(s)
ans=0
for i in range(2**(sl-1)):
bit=bin(i)[2:].zfill(sl-1)
now=0
for j in range(len(s)-1):
if int(bit[j]):
ans+=int(s[now:j+1])
now=j+1
ans+=int(s[now:])
print(ans) |
[
7,
15,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
39,
17,
17,
0,
13,
2,
4,
13,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
0,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
18,
13,
2,
4,
13,
13,
17,
0,
13,
4,
13,
13,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13
] | [
[
93,
3
],
[
72,
9
],
[
19,
18
],
[
94,
22
],
[
78,
25
],
[
81,
28
],
[
32,
31
],
[
73,
31
],
[
87,
34
],
[
38,
37
],
[
94,
43
],
[
90,
46
],
[
94,
49
],
[
37,
50
],
[
31,
52
],
[
37,
53
],
[
75,
55
],
[
94,
57
],
[
94,
61
],
[
84,
64
],
[
76,
67
],
[
91,
67
],
[
88,
67
],
[
82,
67
],
[
85,
70
],
[
79,
70
],
[
72,
73
],
[
75,
76
],
[
78,
79
],
[
81,
82
],
[
84,
85
],
[
87,
88
],
[
90,
91
],
[
93,
94
]
] | [
"from itertools import product\n\ns = str(input())\na = list(product(['+', ''], repeat=len(s)-1))\n\n\nans = 0\ntmp = \"\"\nfor i in a:\n tmp = \"\"\n for j in range(len(s)-1):\n tmp += (s[j]+i[j])\n tmp += s[len(s)-1]\n ans += eval(tmp)\nprint(ans)",
"from itertools import product",
"s = str(input())",
"s",
"str(input())",
"str",
"input()",
"input",
"a = list(product(['+', ''], repeat=len(s)-1))",
"a",
"list(product(['+', ''], repeat=len(s)-1))",
"list",
"product(['+', ''], repeat=len(s)-1)",
"product",
"['+', '']",
"'+'",
"''",
"repeat=len(s)-1",
"repeat",
"len(s)-1",
"len(s)",
"len",
"s",
"1",
"ans = 0",
"ans",
"0",
"tmp = \"\"",
"tmp",
"\"\"",
"for i in a:\n tmp = \"\"\n for j in range(len(s)-1):\n tmp += (s[j]+i[j])\n tmp += s[len(s)-1]\n ans += eval(tmp)",
"i",
"a",
"tmp = \"\"",
"tmp",
"\"\"",
"for j in range(len(s)-1):\n tmp += (s[j]+i[j])\n ",
"j",
"range(len(s)-1)",
"range",
"len(s)-1",
"len(s)",
"len",
"s",
"1",
"tmp += (s[j]+i[j])",
"tmp",
"s[j]+i[j]",
"s[j]",
"s",
"j",
"i[j]",
"i",
"j",
"tmp += s[len(s)-1]",
"tmp",
"s[len(s)-1]",
"s",
"len(s)-1",
"len(s)",
"len",
"s",
"1",
"ans += eval(tmp)",
"ans",
"eval(tmp)",
"eval",
"tmp",
"print(ans)",
"print",
"ans",
"a = list(product(['+', ''], repeat=len(s)-1))",
"list(product(['+', ''], repeat=len(s)-1))",
"a",
"tmp += s[len(s)-1]",
"s[len(s)-1]",
"tmp",
"ans = 0",
"0",
"ans",
"tmp = \"\"",
"\"\"",
"tmp",
"ans += eval(tmp)",
"eval(tmp)",
"ans",
"tmp = \"\"",
"\"\"",
"tmp",
"tmp += (s[j]+i[j])",
"s[j]+i[j]",
"tmp",
"s = str(input())",
"str(input())",
"s"
] | from itertools import product
s = str(input())
a = list(product(['+', ''], repeat=len(s)-1))
ans = 0
tmp = ""
for i in a:
tmp = ""
for j in range(len(s)-1):
tmp += (s[j]+i[j])
tmp += s[len(s)-1]
ans += eval(tmp)
print(ans)
|
[
7,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
17,
2,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
0,
13,
2,
2,
13,
13,
17,
14,
13,
0,
13,
2,
17,
18,
13,
2,
13,
17,
0,
13,
18,
13,
2,
13,
17,
0,
13,
4,
13,
4,
13,
13,
4,
18,
13,
13,
17,
0,
13,
4,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13
] | [
[
85,
2
],
[
82,
6
],
[
86,
9
],
[
88,
11
],
[
15,
14
],
[
83,
20
],
[
91,
23
],
[
86,
25
],
[
29,
28
],
[
86,
34
],
[
100,
37
],
[
14,
40
],
[
28,
41
],
[
106,
46
],
[
86,
50
],
[
28,
52
],
[
94,
55
],
[
86,
57
],
[
28,
59
],
[
97,
62
],
[
95,
70
],
[
107,
70
],
[
92,
70
],
[
103,
74
],
[
98,
77
],
[
104,
80
],
[
89,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
],
[
91,
92
],
[
94,
95
],
[
97,
98
],
[
100,
101
],
[
103,
104
],
[
106,
107
]
] | [
"S = input()\n\nN = len(S)\n\nans = 0\nfor i in range(2**(N-1)):\n tmp = S[0]\n for j in range(len(S)-1):\n flag = (i >> j) & 1\n\n if flag:\n tmp += \"+\" + S[j+1]\n else:\n tmp += S[j+1]\n\n num = list(map(int, tmp.split(\"+\")))\n ans += sum(num)\n\nprint(ans)",
"S = input()",
"S",
"input()",
"input",
"N = len(S)",
"N",
"len(S)",
"len",
"S",
"ans = 0",
"ans",
"0",
"for i in range(2**(N-1)):\n tmp = S[0]\n for j in range(len(S)-1):\n flag = (i >> j) & 1\n\n if flag:\n tmp += \"+\" + S[j+1]\n else:\n tmp += S[j+1]\n\n num = list(map(int, tmp.split(\"+\")))\n ans += sum(num)",
"i",
"range(2**(N-1))",
"range",
"2**(N-1)",
"2",
"N-1",
"N",
"1",
"tmp = S[0]",
"tmp",
"S[0]",
"S",
"0",
"for j in range(len(S)-1):\n flag = (i >> j) & 1\n\n if flag:\n tmp += \"+\" + S[j+1]\n else:\n tmp += S[j+1]\n\n ",
"j",
"range(len(S)-1)",
"range",
"len(S)-1",
"len(S)",
"len",
"S",
"1",
"flag = (i >> j) & 1",
"flag",
"(i >> j) & 1",
"i >> j",
"i",
"j",
"1",
"if flag:\n tmp += \"+\" + S[j+1]\n else:\n tmp += S[j+1]\n\n ",
"flag",
"tmp += \"+\" + S[j+1]",
"tmp",
"\"+\" + S[j+1]",
"\"+\"",
"S[j+1]",
"S",
"j+1",
"j",
"1",
"tmp += S[j+1]",
"tmp",
"S[j+1]",
"S",
"j+1",
"j",
"1",
"num = list(map(int, tmp.split(\"+\")))",
"num",
"list(map(int, tmp.split(\"+\")))",
"list",
"map(int, tmp.split(\"+\"))",
"map",
"int",
"tmp.split(\"+\")",
"tmp.split",
"tmp",
"split",
"\"+\"",
"ans += sum(num)",
"ans",
"sum(num)",
"sum",
"num",
"print(ans)",
"print",
"ans",
"N = len(S)",
"len(S)",
"N",
"S = input()",
"input()",
"S",
"ans = 0",
"0",
"ans",
"tmp = S[0]",
"S[0]",
"tmp",
"tmp += S[j+1]",
"S[j+1]",
"tmp",
"num = list(map(int, tmp.split(\"+\")))",
"list(map(int, tmp.split(\"+\")))",
"num",
"flag = (i >> j) & 1",
"(i >> j) & 1",
"flag",
"ans += sum(num)",
"sum(num)",
"ans",
"tmp += \"+\" + S[j+1]",
"\"+\" + S[j+1]",
"tmp"
] | S = input()
N = len(S)
ans = 0
for i in range(2**(N-1)):
tmp = S[0]
for j in range(len(S)-1):
flag = (i >> j) & 1
if flag:
tmp += "+" + S[j+1]
else:
tmp += S[j+1]
num = list(map(int, tmp.split("+")))
ans += sum(num)
print(ans)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
17,
2,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
2,
13,
2,
17,
13,
0,
13,
17,
0,
13,
18,
13,
2,
13,
17,
0,
13,
4,
13,
4,
13,
13,
4,
18,
13,
13,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13
] | [
[
74,
2
],
[
68,
8
],
[
75,
11
],
[
83,
13
],
[
17,
16
],
[
69,
22
],
[
77,
25
],
[
75,
27
],
[
31,
30
],
[
69,
34
],
[
16,
38
],
[
30,
41
],
[
80,
43
],
[
86,
46
],
[
75,
48
],
[
30,
50
],
[
71,
53
],
[
87,
61
],
[
81,
61
],
[
78,
61
],
[
72,
66
],
[
84,
66
],
[
68,
69
],
[
71,
72
],
[
74,
75
],
[
77,
78
],
[
80,
81
],
[
83,
84
],
[
86,
87
]
] | [
"s=list(input())\nn=len(s)\n#print(n)\nans=0\nfor bit in range(1 << (n - 1)):\n # 各場合で式 f を生成する\n #print(\"bit\",bit,bin(bit))\n f = s[0]\n\n for i in range(n - 1):\n if bit & (1 << i):\n # フラグが立っているならば \"+\" を式の末尾に追加する\n f += \"+\"\n f += s[i + 1]\n #print(\"i\",i,\"1 << i\",bin(1 << i),\"f\",f)\n ans += sum(map(int, f.split(\"+\")))\n\nprint(ans)",
"s=list(input())",
"s",
"list(input())",
"list",
"input()",
"input",
"n=len(s)",
"n",
"len(s)",
"len",
"s",
"ans=0",
"ans",
"0",
"for bit in range(1 << (n - 1)):\n # 各場合で式 f を生成する\n #print(\"bit\",bit,bin(bit))\n f = s[0]\n\n for i in range(n - 1):\n if bit & (1 << i):\n # フラグが立っているならば \"+\" を式の末尾に追加する\n f += \"+\"\n f += s[i + 1]\n #print(\"i\",i,\"1 << i\",bin(1 << i),\"f\",f)\n ans += sum(map(int, f.split(\"+\")))",
"bit",
"range(1 << (n - 1))",
"range",
"1 << (n - 1)",
"1",
"n - 1",
"n",
"1",
"f = s[0]",
"f",
"s[0]",
"s",
"0",
"for i in range(n - 1):\n if bit & (1 << i):\n # フラグが立っているならば \"+\" を式の末尾に追加する\n f += \"+\"\n f += s[i + 1]\n #print(\"i\",i,\"1 << i\",bin(1 << i),\"f\",f)\n ",
"i",
"range(n - 1)",
"range",
"n - 1",
"n",
"1",
"if bit & (1 << i):\n # フラグが立っているならば \"+\" を式の末尾に追加する\n f += \"+\"\n ",
"bit & (1 << i)",
"bit",
"1 << i",
"1",
"i",
"f += \"+\"",
"f",
"\"+\"",
"f += s[i + 1]",
"f",
"s[i + 1]",
"s",
"i + 1",
"i",
"1",
"ans += sum(map(int, f.split(\"+\")))",
"ans",
"sum(map(int, f.split(\"+\")))",
"sum",
"map(int, f.split(\"+\"))",
"map",
"int",
"f.split(\"+\")",
"f.split",
"f",
"split",
"\"+\"",
"print(ans)",
"print",
"ans",
"n=len(s)",
"len(s)",
"n",
"ans += sum(map(int, f.split(\"+\")))",
"sum(map(int, f.split(\"+\")))",
"ans",
"s=list(input())",
"list(input())",
"s",
"f = s[0]",
"s[0]",
"f",
"f += \"+\"",
"\"+\"",
"f",
"ans=0",
"0",
"ans",
"f += s[i + 1]",
"s[i + 1]",
"f"
] | s=list(input())
n=len(s)
#print(n)
ans=0
for bit in range(1 << (n - 1)):
# 各場合で式 f を生成する
#print("bit",bit,bin(bit))
f = s[0]
for i in range(n - 1):
if bit & (1 << i):
# フラグが立っているならば "+" を式の末尾に追加する
f += "+"
f += s[i + 1]
#print("i",i,"1 << i",bin(1 << i),"f",f)
ans += sum(map(int, f.split("+")))
print(ans)
|
[
7,
12,
13,
0,
13,
4,
13,
0,
13,
2,
4,
13,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
17,
13,
0,
13,
18,
13,
17,
28,
13,
4,
13,
13,
14,
2,
2,
2,
13,
13,
17,
17,
0,
13,
17,
0,
13,
18,
13,
2,
13,
17,
0,
13,
4,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
5,
4
],
[
9,
8
],
[
4,
12
],
[
16,
15
],
[
19,
18
],
[
8,
23
],
[
26,
25
],
[
4,
27
],
[
31,
30
],
[
8,
33
],
[
18,
38
],
[
30,
39
],
[
44,
43
],
[
47,
46
],
[
4,
48
],
[
30,
50
],
[
54,
53
],
[
46,
56
],
[
43,
56
],
[
25,
56
],
[
53,
59
],
[
15,
59
],
[
68,
65
]
] | [
"#!/usr/bin python3\n# -*- coding: utf-8 -*-\n\ndef main():\n S = input()\n l = len(S)-1\n ret = 0\n for i in range(2**l):\n fs = S[0]\n for j in range(l):\n if (i>>j & 1) == 1:\n fs += '+'\n fs += S[j+1]\n ret += eval(fs)\n print(ret)\n\nif __name__ == '__main__':\n main()",
"def main():\n S = input()\n l = len(S)-1\n ret = 0\n for i in range(2**l):\n fs = S[0]\n for j in range(l):\n if (i>>j & 1) == 1:\n fs += '+'\n fs += S[j+1]\n ret += eval(fs)\n print(ret)",
"main",
"S = input()",
"S",
"input()",
"input",
"l = len(S)-1",
"l",
"len(S)-1",
"len(S)",
"len",
"S",
"1",
"ret = 0",
"ret",
"0",
"for i in range(2**l):\n fs = S[0]\n for j in range(l):\n if (i>>j & 1) == 1:\n fs += '+'\n fs += S[j+1]\n ret += eval(fs)\n ",
"i",
"range(2**l)",
"range",
"2**l",
"2",
"l",
"fs = S[0]",
"fs",
"S[0]",
"S",
"0",
"for j in range(l):\n if (i>>j & 1) == 1:\n fs += '+'\n fs += S[j+1]\n ",
"j",
"range(l)",
"range",
"l",
"if (i>>j & 1) == 1:\n fs += '+'\n ",
"(i>>j & 1) == 1",
"i>>j & 1",
"i>>j",
"i",
"j",
"1",
"1",
"fs += '+'",
"fs",
"'+'",
"fs += S[j+1]",
"fs",
"S[j+1]",
"S",
"j+1",
"j",
"1",
"ret += eval(fs)",
"ret",
"eval(fs)",
"eval",
"fs",
"print(ret)",
"print",
"ret",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n S = input()\n l = len(S)-1\n ret = 0\n for i in range(2**l):\n fs = S[0]\n for j in range(l):\n if (i>>j & 1) == 1:\n fs += '+'\n fs += S[j+1]\n ret += eval(fs)\n print(ret)",
"def main():\n S = input()\n l = len(S)-1\n ret = 0\n for i in range(2**l):\n fs = S[0]\n for j in range(l):\n if (i>>j & 1) == 1:\n fs += '+'\n fs += S[j+1]\n ret += eval(fs)\n print(ret)",
"main"
] | #!/usr/bin python3
# -*- coding: utf-8 -*-
def main():
S = input()
l = len(S)-1
ret = 0
for i in range(2**l):
fs = S[0]
for j in range(l):
if (i>>j & 1) == 1:
fs += '+'
fs += S[j+1]
ret += eval(fs)
print(ret)
if __name__ == '__main__':
main() |
[
7,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
17,
2,
13,
17,
0,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
2,
2,
13,
13,
17,
0,
13,
2,
2,
18,
13,
39,
2,
2,
40,
13,
13,
17,
17,
18,
13,
39,
2,
2,
40,
13,
13,
17,
0,
13,
17,
0,
13,
4,
13,
13,
4,
13,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13
] | [
[
97,
2
],
[
85,
6
],
[
98,
9
],
[
82,
11
],
[
15,
14
],
[
86,
20
],
[
79,
23
],
[
98,
24
],
[
76,
26
],
[
30,
29
],
[
86,
33
],
[
14,
38
],
[
29,
39
],
[
91,
42
],
[
80,
46
],
[
92,
46
],
[
29,
51
],
[
77,
52
],
[
95,
52
],
[
80,
56
],
[
92,
56
],
[
29,
61
],
[
77,
62
],
[
95,
62
],
[
94,
65
],
[
88,
68
],
[
92,
71
],
[
80,
71
],
[
89,
74
],
[
83,
74
],
[
76,
77
],
[
98,
79
],
[
79,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
],
[
91,
92
],
[
94,
95
],
[
97,
98
]
] | [
"S = input()\nn = len(S)\nans = 0\nfor i in range(2 ** (n - 1)):\n ope = S\n cur = 0\n for j in range(n - 1):\n if (i >> j) & 1:\n ope = ope[:-j - cur - 1] + '+' + ope[-j - cur - 1:]\n cur += 1\n ans += eval(ope)\nprint(ans)",
"S = input()",
"S",
"input()",
"input",
"n = len(S)",
"n",
"len(S)",
"len",
"S",
"ans = 0",
"ans",
"0",
"for i in range(2 ** (n - 1)):\n ope = S\n cur = 0\n for j in range(n - 1):\n if (i >> j) & 1:\n ope = ope[:-j - cur - 1] + '+' + ope[-j - cur - 1:]\n cur += 1\n ans += eval(ope)",
"i",
"range(2 ** (n - 1))",
"range",
"2 ** (n - 1)",
"2",
"n - 1",
"n",
"1",
"ope = S",
"ope",
"S",
"cur = 0",
"cur",
"0",
"for j in range(n - 1):\n if (i >> j) & 1:\n ope = ope[:-j - cur - 1] + '+' + ope[-j - cur - 1:]\n cur += 1\n ",
"j",
"range(n - 1)",
"range",
"n - 1",
"n",
"1",
"if (i >> j) & 1:\n ope = ope[:-j - cur - 1] + '+' + ope[-j - cur - 1:]\n cur += 1\n ",
"(i >> j) & 1",
"i >> j",
"i",
"j",
"1",
"ope = ope[:-j - cur - 1] + '+' + ope[-j - cur - 1:]",
"ope",
"ope[:-j - cur - 1] + '+' + ope[-j - cur - 1:]",
"ope[:-j - cur - 1] + '+'",
"ope[:-j - cur - 1]",
"ope",
":-j - cur - 1",
"-j - cur - 1",
"-j - cur",
"-j",
"j",
"cur",
"1",
"'+'",
"ope[-j - cur - 1:]",
"ope",
"-j - cur - 1:",
"-j - cur - 1",
"-j - cur",
"-j",
"j",
"cur",
"1",
"cur += 1",
"cur",
"1",
"ans += eval(ope)",
"ans",
"eval(ope)",
"eval",
"ope",
"print(ans)",
"print",
"ans",
"cur = 0",
"0",
"cur",
"ope = S",
"S",
"ope",
"ans = 0",
"0",
"ans",
"n = len(S)",
"len(S)",
"n",
"ans += eval(ope)",
"eval(ope)",
"ans",
"ope = ope[:-j - cur - 1] + '+' + ope[-j - cur - 1:]",
"ope[:-j - cur - 1] + '+' + ope[-j - cur - 1:]",
"ope",
"cur += 1",
"1",
"cur",
"S = input()",
"input()",
"S"
] | S = input()
n = len(S)
ans = 0
for i in range(2 ** (n - 1)):
ope = S
cur = 0
for j in range(n - 1):
if (i >> j) & 1:
ope = ope[:-j - cur - 1] + '+' + ope[-j - cur - 1:]
cur += 1
ans += eval(ope)
print(ans)
|
[
7,
15,
12,
13,
0,
13,
4,
13,
13,
29,
4,
18,
13,
13,
4,
13,
13,
13,
23,
13,
12,
13,
0,
13,
4,
13,
4,
13,
13,
13,
0,
13,
17,
28,
13,
13,
0,
13,
17,
0,
13,
13,
29,
13,
23,
13,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
4,
13,
17,
13,
14,
40,
13,
0,
13,
4,
13,
13,
0,
13,
2,
2,
39,
17,
4,
13,
13,
39,
13,
28,
13,
4,
13,
2,
4,
13,
13,
17,
0,
13,
4,
13,
18,
13,
39,
18,
13,
13,
18,
13,
2,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
6,
5
],
[
19,
8
],
[
5,
16
],
[
19,
19
],
[
24,
23
],
[
45,
29
],
[
32,
31
],
[
35,
34
],
[
23,
34
],
[
38,
37
],
[
41,
40
],
[
34,
41
],
[
40,
43
],
[
37,
43
],
[
31,
43
],
[
45,
45
],
[
134,
47
],
[
125,
51
],
[
135,
54
],
[
113,
56
],
[
60,
59
],
[
120,
61
],
[
126,
65
],
[
59,
68
],
[
116,
70
],
[
135,
73
],
[
128,
75
],
[
59,
82
],
[
87,
86
],
[
129,
92
],
[
131,
95
],
[
123,
97
],
[
135,
99
],
[
129,
102
],
[
86,
103
],
[
129,
105
],
[
86,
107
],
[
132,
111
],
[
117,
111
],
[
114,
111
],
[
113,
114
],
[
116,
117
],
[
125,
126
],
[
128,
129
],
[
131,
132
],
[
134,
135
]
] | [
"from itertools import chain, combinations\n\n\ndef powerset(iterable):\n s = list(iterable)\n return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))\n\n\ndef s_to_num(s):\n numlst = list(map(int, s))\n res = 0\n for i in numlst:\n res *= 10\n res += i\n return res\n\n\ns = input()\nlength = len(s)\nres = 0\nfor i in powerset(range(1, length)):\n if not i:\n res += int(s)\n else:\n jlst = [0] + list(i) + [length]\n for j in range(len(jlst) - 1):\n res += s_to_num(s[jlst[j]:jlst[j + 1]])\nprint(res)",
"from itertools import chain, combinations",
"def powerset(iterable):\n s = list(iterable)\n return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))",
"powerset",
"s = list(iterable)",
"s",
"list(iterable)",
"list",
"iterable",
"return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))",
"chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))",
"chain.from_iterable",
"chain",
"from_iterable",
"combinations(s, r)",
"combinations",
"s",
"r",
"iterable",
"iterable",
"def s_to_num(s):\n numlst = list(map(int, s))\n res = 0\n for i in numlst:\n res *= 10\n res += i\n return res",
"s_to_num",
"numlst = list(map(int, s))",
"numlst",
"list(map(int, s))",
"list",
"map(int, s)",
"map",
"int",
"s",
"res = 0",
"res",
"0",
"for i in numlst:\n res *= 10\n res += i\n ",
"i",
"numlst",
"res *= 10",
"res",
"10",
"res += i",
"res",
"i",
"return res",
"res",
"s",
"s",
"s = input()",
"s",
"input()",
"input",
"length = len(s)",
"length",
"len(s)",
"len",
"s",
"res = 0",
"res",
"0",
"for i in powerset(range(1, length)):\n if not i:\n res += int(s)\n else:\n jlst = [0] + list(i) + [length]\n for j in range(len(jlst) - 1):\n res += s_to_num(s[jlst[j]:jlst[j + 1]])",
"i",
"powerset(range(1, length))",
"powerset",
"range(1, length)",
"range",
"1",
"length",
"if not i:\n res += int(s)\n else:\n jlst = [0] + list(i) + [length]\n for j in range(len(jlst) - 1):\n res += s_to_num(s[jlst[j]:jlst[j + 1]])",
"not i",
"i",
"res += int(s)",
"res",
"int(s)",
"int",
"s",
"jlst = [0] + list(i) + [length]",
"jlst",
"[0] + list(i) + [length]",
"[0] + list(i)",
"[0]",
"0",
"list(i)",
"list",
"i",
"[length]",
"length",
"for j in range(len(jlst) - 1):\n res += s_to_num(s[jlst[j]:jlst[j + 1]])",
"j",
"range(len(jlst) - 1)",
"range",
"len(jlst) - 1",
"len(jlst)",
"len",
"jlst",
"1",
"res += s_to_num(s[jlst[j]:jlst[j + 1]])",
"res",
"s_to_num(s[jlst[j]:jlst[j + 1]])",
"s_to_num",
"s[jlst[j]:jlst[j + 1]]",
"s",
"jlst[j]:jlst[j + 1]",
"jlst[j]",
"jlst",
"j",
"jlst[j + 1]",
"jlst",
"j + 1",
"j",
"1",
"print(res)",
"print",
"res",
"res = 0",
"0",
"res",
"res += int(s)",
"int(s)",
"res",
"def powerset(iterable):\n s = list(iterable)\n return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))",
"def powerset(iterable):\n s = list(iterable)\n return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))",
"powerset",
"def s_to_num(s):\n numlst = list(map(int, s))\n res = 0\n for i in numlst:\n res *= 10\n res += i\n return res",
"def s_to_num(s):\n numlst = list(map(int, s))\n res = 0\n for i in numlst:\n res *= 10\n res += i\n return res",
"s_to_num",
"length = len(s)",
"len(s)",
"length",
"jlst = [0] + list(i) + [length]",
"[0] + list(i) + [length]",
"jlst",
"res += s_to_num(s[jlst[j]:jlst[j + 1]])",
"s_to_num(s[jlst[j]:jlst[j + 1]])",
"res",
"s = input()",
"input()",
"s"
] | from itertools import chain, combinations
def powerset(iterable):
s = list(iterable)
return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))
def s_to_num(s):
numlst = list(map(int, s))
res = 0
for i in numlst:
res *= 10
res += i
return res
s = input()
length = len(s)
res = 0
for i in powerset(range(1, length)):
if not i:
res += int(s)
else:
jlst = [0] + list(i) + [length]
for j in range(len(jlst) - 1):
res += s_to_num(s[jlst[j]:jlst[j + 1]])
print(res)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
12,
13,
14,
2,
13,
4,
13,
13,
41,
0,
13,
4,
13,
13,
29,
4,
13,
2,
2,
13,
17,
18,
13,
13,
2,
13,
17,
4,
13,
2,
13,
18,
13,
13,
2,
13,
17,
23,
13,
23,
13,
4,
13,
18,
13,
17,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
12,
13
] | [
[
59,
2
],
[
62,
6
],
[
48,
12
],
[
60,
15
],
[
19,
18
],
[
46,
21
],
[
46,
27
],
[
60,
30
],
[
48,
31
],
[
48,
33
],
[
46,
38
],
[
60,
40
],
[
48,
41
],
[
48,
43
],
[
46,
46
],
[
48,
48
],
[
66,
50
],
[
60,
52
],
[
63,
57
],
[
59,
60
],
[
62,
63
]
] | [
"S = input()\n\nans = 0\ndef dfs(now, i):\n if i == len(S):\n global ans\n ans += eval(now)\n return\n dfs(now+\"+\"+S[i], i+1)\n dfs(now+S[i], i+1)\n \ndfs(S[0],1)\nprint(ans)",
"S = input()",
"S",
"input()",
"input",
"ans = 0",
"ans",
"0",
"def dfs(now, i):\n if i == len(S):\n global ans\n ans += eval(now)\n return\n dfs(now+\"+\"+S[i], i+1)\n dfs(now+S[i], i+1)\n ",
"dfs",
"if i == len(S):\n global ans\n ans += eval(now)\n return\n ",
"i == len(S)",
"i",
"len(S)",
"len",
"S",
"global ans",
"ans += eval(now)",
"ans",
"eval(now)",
"eval",
"now",
"return",
"dfs(now+\"+\"+S[i], i+1)",
"dfs",
"now+\"+\"+S[i]",
"now+\"+\"",
"now",
"\"+\"",
"S[i]",
"S",
"i",
"i+1",
"i",
"1",
"dfs(now+S[i], i+1)",
"dfs",
"now+S[i]",
"now",
"S[i]",
"S",
"i",
"i+1",
"i",
"1",
"now",
"now",
"i",
"i",
"dfs(S[0],1)",
"dfs",
"S[0]",
"S",
"0",
"1",
"print(ans)",
"print",
"ans",
"S = input()",
"input()",
"S",
"ans = 0",
"0",
"ans",
"def dfs(now, i):\n if i == len(S):\n global ans\n ans += eval(now)\n return\n dfs(now+\"+\"+S[i], i+1)\n dfs(now+S[i], i+1)\n ",
"def dfs(now, i):\n if i == len(S):\n global ans\n ans += eval(now)\n return\n dfs(now+\"+\"+S[i], i+1)\n dfs(now+S[i], i+1)\n ",
"dfs"
] | S = input()
ans = 0
def dfs(now, i):
if i == len(S):
global ans
ans += eval(now)
return
dfs(now+"+"+S[i], i+1)
dfs(now+S[i], i+1)
dfs(S[0],1)
print(ans) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
2,
17,
2,
13,
17,
41,
28,
13,
4,
13,
13,
4,
39,
0,
13,
13,
28,
13,
4,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
18,
13,
13,
0,
13,
2,
2,
13,
17,
13,
14,
2,
2,
13,
13,
17,
0,
13,
13,
4,
18,
18,
13,
13,
13,
13,
0,
13,
17,
0,
13,
13,
0,
13,
13,
4,
18,
18,
13,
13,
13,
13,
4,
13,
13,
10,
2,
13,
10,
2,
13,
10,
13,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] | [
[
126,
2
],
[
135,
8
],
[
127,
11
],
[
132,
13
],
[
102,
16
],
[
136,
20
],
[
25,
24
],
[
103,
27
],
[
108,
31
],
[
35,
34
],
[
103,
37
],
[
114,
39
],
[
129,
42
],
[
120,
45
],
[
49,
48
],
[
136,
51
],
[
138,
53
],
[
127,
57
],
[
48,
58
],
[
105,
60
],
[
130,
63
],
[
118,
63
],
[
106,
63
],
[
139,
65
],
[
115,
65
],
[
34,
69
],
[
48,
70
],
[
123,
73
],
[
106,
74
],
[
130,
74
],
[
118,
74
],
[
109,
78
],
[
34,
79
],
[
106,
81
],
[
130,
81
],
[
118,
81
],
[
117,
83
],
[
111,
86
],
[
118,
87
],
[
106,
87
],
[
130,
87
],
[
141,
89
],
[
112,
90
],
[
124,
90
],
[
121,
90
],
[
109,
94
],
[
34,
95
],
[
118,
97
],
[
106,
97
],
[
130,
97
],
[
142,
100
],
[
133,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
118,
111
],
[
106,
111
],
[
130,
111
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
120,
121
],
[
106,
123
],
[
130,
123
],
[
118,
123
],
[
123,
124
],
[
126,
127
],
[
129,
130
],
[
132,
133
],
[
135,
136
],
[
138,
139
],
[
112,
141
],
[
124,
141
],
[
121,
141
],
[
141,
142
]
] | [
"s = str(input())\nl = len(s)\nans = 0\nx = 2**(l-1)\ndg = [[] for i in range(x)]\nfor i in range(x):\n b = 0#各桁の値\n d = 0#一つの値にするやつ\n tmp = 0 #数式計算用\n\n for j in range(l):\n b = int(s[j])\n d = d*10 +b\n if i>>j&1 :\n tmp += d\n dg[i].append(d)\n d = 0\n tmp += d\n ans += tmp\n dg[i].append(d)\n# for i in range(x):\n# print(dg[i])\nprint(ans)\n",
"s = str(input())",
"s",
"str(input())",
"str",
"input()",
"input",
"l = len(s)",
"l",
"len(s)",
"len",
"s",
"ans = 0",
"ans",
"0",
"x = 2**(l-1)",
"x",
"2**(l-1)",
"2",
"l-1",
"l",
"1",
"[] for i in range(x)",
"for i in range(x)",
"i",
"range(x)",
"range",
"x",
"for i in range(x)",
"[]",
"dg = [[] for i in range(x)]",
"dg",
"[[] for i in range(x)]",
"for i in range(x):\n b = 0#各桁の値\n d = 0#一つの値にするやつ\n tmp = 0 #数式計算用\n\n for j in range(l):\n b = int(s[j])\n d = d*10 +b\n if i>>j&1 :\n tmp += d\n dg[i].append(d)\n d = 0\n tmp += d\n ans += tmp\n dg[i].append(d)\n# for i in range(x):\n# print(dg[i])",
"i",
"range(x)",
"range",
"x",
"b = 0",
"b",
"0",
"d = 0",
"d",
"0",
"tmp = 0",
"tmp",
"0",
"for j in range(l):\n b = int(s[j])\n d = d*10 +b\n if i>>j&1 :\n tmp += d\n dg[i].append(d)\n d = 0\n ",
"j",
"range(l)",
"range",
"l",
"b = int(s[j])",
"b",
"int(s[j])",
"int",
"s[j]",
"s",
"j",
"d = d*10 +b",
"d",
"d*10 +b",
"d*10",
"d",
"10",
"b",
"if i>>j&1 :\n tmp += d\n dg[i].append(d)\n d = 0\n ",
"i>>j&1",
"i>>j",
"i",
"j",
"1",
"tmp += d",
"tmp",
"d",
"dg[i].append(d)",
"[i].append",
"[i]",
"dg",
"i",
"append",
"d",
"d = 0",
"d",
"0",
"tmp += d",
"tmp",
"d",
"ans += tmp",
"ans",
"tmp",
"dg[i].append(d)",
"[i].append",
"[i]",
"dg",
"i",
"append",
"d",
"print(ans)",
"print",
"ans",
"x = 2**(l-1)",
"2**(l-1)",
"x",
"d = d*10 +b",
"d*10 +b",
"d",
"dg = [[] for i in range(x)]",
"[[] for i in range(x)]",
"dg",
"tmp += d",
"d",
"tmp",
"b = 0",
"0",
"b",
"d = 0",
"0",
"d",
"tmp = 0",
"0",
"tmp",
"tmp += d",
"d",
"tmp",
"s = str(input())",
"str(input())",
"s",
"d = 0",
"0",
"d",
"ans = 0",
"0",
"ans",
"l = len(s)",
"len(s)",
"l",
"b = int(s[j])",
"int(s[j])",
"b",
"ans += tmp",
"tmp",
"ans"
] | s = str(input())
l = len(s)
ans = 0
x = 2**(l-1)
dg = [[] for i in range(x)]
for i in range(x):
b = 0#各桁の値
d = 0#一つの値にするやつ
tmp = 0 #数式計算用
for j in range(l):
b = int(s[j])
d = d*10 +b
if i>>j&1 :
tmp += d
dg[i].append(d)
d = 0
tmp += d
ans += tmp
dg[i].append(d)
# for i in range(x):
# print(dg[i])
print(ans)
|
[
7,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
15,
15,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
39,
17,
17,
0,
13,
2,
4,
13,
13,
17,
0,
13,
18,
13,
17,
28,
13,
13,
4,
13,
13,
17,
14,
2,
13,
17,
0,
13,
18,
13,
13,
0,
13,
4,
13,
13,
0,
13,
18,
13,
13,
0,
13,
4,
13,
13,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13
] | [
[
93,
15
],
[
75,
19
],
[
23,
22
],
[
30,
29
],
[
94,
33
],
[
84,
36
],
[
94,
38
],
[
22,
45
],
[
90,
52
],
[
94,
54
],
[
78,
57
],
[
85,
60
],
[
82,
60
],
[
91,
60
],
[
81,
62
],
[
94,
64
],
[
87,
67
],
[
82,
70
],
[
91,
70
],
[
85,
70
],
[
88,
73
],
[
79,
73
],
[
76,
73
],
[
75,
76
],
[
78,
79
],
[
81,
82
],
[
84,
85
],
[
87,
88
],
[
90,
91
],
[
93,
94
]
] | [
"import sys\nimport numpy as np\nimport math\nimport collections\nimport copy\nfrom collections import deque \nfrom functools import reduce\nfrom itertools import product\n\n# input = sys.stdin.readline\nS = input()\ntotal = 0\nfor p in (product((0, 1), repeat=len(S)-1)):\n ns = S[0]\n for i, pp in enumerate(p, 1):\n if pp == 0:\n ns += S[i]\n else:\n total += int(ns)\n ns = S[i]\n total += int(ns)\nprint(total)\n\n\n",
"import sys",
"sys",
"import numpy as np",
"numpy",
"import math",
"math",
"import collections",
"collections",
"import copy",
"copy",
"from collections import deque",
"from functools import reduce",
"from itertools import product",
"S = input()",
"S",
"input()",
"input",
"total = 0",
"total",
"0",
"for p in (product((0, 1), repeat=len(S)-1)):\n ns = S[0]\n for i, pp in enumerate(p, 1):\n if pp == 0:\n ns += S[i]\n else:\n total += int(ns)\n ns = S[i]\n total += int(ns)",
"p",
"product((0, 1), repeat=len(S)-1)",
"product",
"(0, 1)",
"0",
"1",
"repeat=len(S)-1",
"repeat",
"len(S)-1",
"len(S)",
"len",
"S",
"1",
"ns = S[0]",
"ns",
"S[0]",
"S",
"0",
"for i, pp in enumerate(p, 1):\n if pp == 0:\n ns += S[i]\n else:\n total += int(ns)\n ns = S[i]\n ",
"i",
"pp",
"enumerate(p, 1)",
"enumerate",
"p",
"1",
"if pp == 0:\n ns += S[i]\n else:\n total += int(ns)\n ns = S[i]\n ",
"pp == 0",
"pp",
"0",
"ns += S[i]",
"ns",
"S[i]",
"S",
"i",
"total += int(ns)",
"total",
"int(ns)",
"int",
"ns",
"ns = S[i]",
"ns",
"S[i]",
"S",
"i",
"total += int(ns)",
"total",
"int(ns)",
"int",
"ns",
"print(total)",
"print",
"total",
"total = 0",
"0",
"total",
"total += int(ns)",
"int(ns)",
"total",
"ns = S[i]",
"S[i]",
"ns",
"ns = S[0]",
"S[0]",
"ns",
"total += int(ns)",
"int(ns)",
"total",
"ns += S[i]",
"S[i]",
"ns",
"S = input()",
"input()",
"S"
] | import sys
import numpy as np
import math
import collections
import copy
from collections import deque
from functools import reduce
from itertools import product
# input = sys.stdin.readline
S = input()
total = 0
for p in (product((0, 1), repeat=len(S)-1)):
ns = S[0]
for i, pp in enumerate(p, 1):
if pp == 0:
ns += S[i]
else:
total += int(ns)
ns = S[i]
total += int(ns)
print(total)
|
[
7,
0,
13,
4,
13,
0,
13,
2,
4,
13,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
17,
13,
0,
13,
2,
39,
17,
13,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
2,
13,
13,
17,
0,
13,
2,
18,
13,
13,
17,
0,
13,
18,
13,
13,
0,
13,
4,
13,
2,
13,
18,
13,
17,
4,
13,
13,
10,
17,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13
] | [
[
76,
2
],
[
88,
6
],
[
77,
10
],
[
85,
13
],
[
17,
16
],
[
89,
21
],
[
79,
23
],
[
89,
27
],
[
67,
29
],
[
33,
32
],
[
89,
35
],
[
16,
39
],
[
32,
40
],
[
70,
43
],
[
77,
46
],
[
32,
47
],
[
73,
50
],
[
77,
52
],
[
32,
53
],
[
82,
55
],
[
74,
59
],
[
71,
59
],
[
68,
59
],
[
77,
61
],
[
83,
65
],
[
86,
65
],
[
67,
68
],
[
70,
71
],
[
73,
74
],
[
76,
77
],
[
79,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
]
] | [
"S = input()\nn = len(S) - 1\nsumLine = 0\nfor i in range(2 ** n):\n op = [0] * (n)\n e = ''\n for j in range(n):\n if (i >> j) & 1 :\n e += S[j] + '+'\n else:\n e += S[j]\n\n sumLine += eval(e+S[-1])\nprint(sumLine)",
"S = input()",
"S",
"input()",
"input",
"n = len(S) - 1",
"n",
"len(S) - 1",
"len(S)",
"len",
"S",
"1",
"sumLine = 0",
"sumLine",
"0",
"for i in range(2 ** n):\n op = [0] * (n)\n e = ''\n for j in range(n):\n if (i >> j) & 1 :\n e += S[j] + '+'\n else:\n e += S[j]\n\n sumLine += eval(e+S[-1])",
"i",
"range(2 ** n)",
"range",
"2 ** n",
"2",
"n",
"op = [0] * (n)",
"op",
"[0] * (n)",
"[0]",
"0",
"n",
"e = ''",
"e",
"''",
"for j in range(n):\n if (i >> j) & 1 :\n e += S[j] + '+'\n else:\n e += S[j]\n\n ",
"j",
"range(n)",
"range",
"n",
"if (i >> j) & 1 :\n e += S[j] + '+'\n else:\n e += S[j]\n\n ",
"(i >> j) & 1",
"i >> j",
"i",
"j",
"1",
"e += S[j] + '+'",
"e",
"S[j] + '+'",
"S[j]",
"S",
"j",
"'+'",
"e += S[j]",
"e",
"S[j]",
"S",
"j",
"sumLine += eval(e+S[-1])",
"sumLine",
"eval(e+S[-1])",
"eval",
"e+S[-1]",
"e",
"S[-1]",
"S",
"-1",
"print(sumLine)",
"print",
"sumLine",
"e = ''",
"''",
"e",
"e += S[j] + '+'",
"S[j] + '+'",
"e",
"e += S[j]",
"S[j]",
"e",
"S = input()",
"input()",
"S",
"op = [0] * (n)",
"[0] * (n)",
"op",
"sumLine += eval(e+S[-1])",
"eval(e+S[-1])",
"sumLine",
"sumLine = 0",
"0",
"sumLine",
"n = len(S) - 1",
"len(S) - 1",
"n"
] | S = input()
n = len(S) - 1
sumLine = 0
for i in range(2 ** n):
op = [0] * (n)
e = ''
for j in range(n):
if (i >> j) & 1 :
e += S[j] + '+'
else:
e += S[j]
sumLine += eval(e+S[-1])
print(sumLine)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
2,
17,
2,
4,
13,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
2,
13,
2,
17,
13,
0,
13,
17,
0,
13,
18,
13,
2,
13,
17,
0,
13,
4,
13,
13,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
18,
13
] | [
[
67,
2
],
[
61,
6
],
[
10,
9
],
[
68,
17
],
[
70,
20
],
[
68,
22
],
[
26,
25
],
[
68,
31
],
[
9,
35
],
[
25,
38
],
[
58,
40
],
[
73,
43
],
[
68,
45
],
[
25,
47
],
[
64,
50
],
[
74,
53
],
[
59,
53
],
[
71,
53
],
[
65,
56
],
[
62,
56
],
[
58,
59
],
[
61,
62
],
[
64,
65
],
[
67,
68
],
[
70,
71
],
[
73,
74
]
] | [
"s = input()\nans = 0\nfor i in range(1<<(len(s)-1)):\n tmp = s[0]\n for j in range(len(s)-1):\n if i&(1<<j):\n tmp += '+'\n tmp += s[j+1]\n ans += eval(tmp)\nprint(ans)",
"s = input()",
"s",
"input()",
"input",
"ans = 0",
"ans",
"0",
"for i in range(1<<(len(s)-1)):\n tmp = s[0]\n for j in range(len(s)-1):\n if i&(1<<j):\n tmp += '+'\n tmp += s[j+1]\n ans += eval(tmp)",
"i",
"range(1<<(len(s)-1))",
"range",
"1<<(len(s)-1)",
"1",
"len(s)-1",
"len(s)",
"len",
"s",
"1",
"tmp = s[0]",
"tmp",
"s[0]",
"s",
"0",
"for j in range(len(s)-1):\n if i&(1<<j):\n tmp += '+'\n tmp += s[j+1]\n ",
"j",
"range(len(s)-1)",
"range",
"len(s)-1",
"len(s)",
"len",
"s",
"1",
"if i&(1<<j):\n tmp += '+'\n ",
"i&(1<<j)",
"i",
"1<<j",
"1",
"j",
"tmp += '+'",
"tmp",
"'+'",
"tmp += s[j+1]",
"tmp",
"s[j+1]",
"s",
"j+1",
"j",
"1",
"ans += eval(tmp)",
"ans",
"eval(tmp)",
"eval",
"tmp",
"print(ans)",
"print",
"ans",
"tmp += '+'",
"'+'",
"tmp",
"ans = 0",
"0",
"ans",
"ans += eval(tmp)",
"eval(tmp)",
"ans",
"s = input()",
"input()",
"s",
"tmp = s[0]",
"s[0]",
"tmp",
"tmp += s[j+1]",
"s[j+1]",
"tmp"
] | s = input()
ans = 0
for i in range(1<<(len(s)-1)):
tmp = s[0]
for j in range(len(s)-1):
if i&(1<<j):
tmp += '+'
tmp += s[j+1]
ans += eval(tmp)
print(ans) |
[
7,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
17,
2,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
2,
13,
2,
17,
13,
0,
13,
17,
0,
13,
18,
13,
2,
13,
17,
0,
13,
4,
13,
4,
13,
13,
4,
18,
13,
13,
17,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13
] | [
[
66,
2
],
[
72,
6
],
[
67,
9
],
[
75,
11
],
[
15,
14
],
[
73,
20
],
[
69,
23
],
[
67,
25
],
[
29,
28
],
[
73,
32
],
[
14,
36
],
[
28,
39
],
[
78,
41
],
[
81,
44
],
[
67,
46
],
[
28,
48
],
[
84,
51
],
[
82,
59
],
[
79,
59
],
[
70,
59
],
[
85,
64
],
[
76,
64
],
[
66,
67
],
[
69,
70
],
[
72,
73
],
[
75,
76
],
[
78,
79
],
[
81,
82
],
[
84,
85
]
] | [
"# C - たくさんの数式\n# https://atcoder.jp/contests/arc061/tasks/arc061_a\nS = input()\nn = len(S)\nans = 0\n# 計算量: O(2**n*n)\nfor i in range(1 << n - 1):\n # 0からn-1番目までの数のうち、何番目の後にj番目に+を挿入するか\n x = S[0]\n for j in range(n - 1):\n if i & 1 << j:\n # +をjとj+1の間に挿入する\n x += '+'\n x += S[j + 1]\n ans += sum(map(int, x.split('+')))\nprint(ans)",
"S = input()",
"S",
"input()",
"input",
"n = len(S)",
"n",
"len(S)",
"len",
"S",
"ans = 0",
"ans",
"0",
"for i in range(1 << n - 1):\n # 0からn-1番目までの数のうち、何番目の後にj番目に+を挿入するか\n x = S[0]\n for j in range(n - 1):\n if i & 1 << j:\n # +をjとj+1の間に挿入する\n x += '+'\n x += S[j + 1]\n ans += sum(map(int, x.split('+')))",
"i",
"range(1 << n - 1)",
"range",
"1 << n - 1",
"1",
"n - 1",
"n",
"1",
"x = S[0]",
"x",
"S[0]",
"S",
"0",
"for j in range(n - 1):\n if i & 1 << j:\n # +をjとj+1の間に挿入する\n x += '+'\n x += S[j + 1]\n ",
"j",
"range(n - 1)",
"range",
"n - 1",
"n",
"1",
"if i & 1 << j:\n # +をjとj+1の間に挿入する\n x += '+'\n ",
"i & 1 << j",
"i",
"1 << j",
"1",
"j",
"x += '+'",
"x",
"'+'",
"x += S[j + 1]",
"x",
"S[j + 1]",
"S",
"j + 1",
"j",
"1",
"ans += sum(map(int, x.split('+')))",
"ans",
"sum(map(int, x.split('+')))",
"sum",
"map(int, x.split('+'))",
"map",
"int",
"x.split('+')",
"x.split",
"x",
"split",
"'+'",
"print(ans)",
"print",
"ans",
"S = input()",
"input()",
"S",
"x = S[0]",
"S[0]",
"x",
"n = len(S)",
"len(S)",
"n",
"ans = 0",
"0",
"ans",
"x += '+'",
"'+'",
"x",
"x += S[j + 1]",
"S[j + 1]",
"x",
"ans += sum(map(int, x.split('+')))",
"sum(map(int, x.split('+')))",
"ans"
] | # C - たくさんの数式
# https://atcoder.jp/contests/arc061/tasks/arc061_a
S = input()
n = len(S)
ans = 0
# 計算量: O(2**n*n)
for i in range(1 << n - 1):
# 0からn-1番目までの数のうち、何番目の後にj番目に+を挿入するか
x = S[0]
for j in range(n - 1):
if i & 1 << j:
# +をjとj+1の間に挿入する
x += '+'
x += S[j + 1]
ans += sum(map(int, x.split('+')))
print(ans)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.