node_ids
listlengths 4
1.4k
| edge_index
listlengths 1
2.22k
| text
listlengths 4
1.4k
| source
stringlengths 14
427k
|
---|---|---|---|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
39,
2,
39,
17,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
13,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
13,
0,
18,
18,
13,
13,
13,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
0,
18,
13,
13,
2,
39,
17,
13,
28,
13,
4,
13,
13,
13,
0,
18,
13,
13,
2,
39,
17,
13,
0,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
14,
18,
18,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13
] |
[
[
151,
2
],
[
151,
11
],
[
151,
12
],
[
157,
14
],
[
149,
20
],
[
152,
21
],
[
24,
23
],
[
140,
26
],
[
160,
28
],
[
160,
37
],
[
160,
38
],
[
146,
41
],
[
45,
44
],
[
152,
47
],
[
50,
49
],
[
155,
52
],
[
59,
54
],
[
106,
55
],
[
92,
55
],
[
158,
56
],
[
44,
57
],
[
49,
58
],
[
146,
62
],
[
66,
65
],
[
152,
68
],
[
71,
70
],
[
155,
73
],
[
149,
74
],
[
81,
76
],
[
106,
77
],
[
92,
77
],
[
158,
78
],
[
65,
79
],
[
70,
80
],
[
146,
84
],
[
88,
87
],
[
161,
90
],
[
95,
92
],
[
158,
93
],
[
87,
94
],
[
149,
98
],
[
101,
100
],
[
161,
103
],
[
152,
104
],
[
109,
106
],
[
158,
107
],
[
100,
108
],
[
149,
112
],
[
163,
114
],
[
118,
117
],
[
152,
120
],
[
123,
122
],
[
149,
125
],
[
158,
129
],
[
117,
130
],
[
122,
131
],
[
142,
133
],
[
143,
137
],
[
164,
137
],
[
151,
140
],
[
142,
143
],
[
160,
146
],
[
151,
149
],
[
151,
152
],
[
160,
155
],
[
157,
158
],
[
160,
161
],
[
163,
164
]
] |
[
"W, H, n = map(int, input().split())\nl = [[True]*W]*H\nfor i in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n for h in range(H):\n for w in range(x):\n l[h][w] = False\n elif a == 2:\n for h in range(H):\n for w in range(x, W):\n l[h][w] = False\n elif a == 3:\n for h in range(y):\n l[h] = [False]*W\n else:\n for h in range(y, H):\n l[h] = [False]*W\n\nans = 0\nfor i in range(H):\n for j in range(W):\n if l[i][j]:\n ans += 1\nprint(ans)",
"W, H, n = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"n",
"l = [[True]*W]*H",
"l",
"[[True]*W]*H",
"[[True]*W]",
"[True]*W",
"[True]",
"True",
"W",
"H",
"for i in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n for h in range(H):\n for w in range(x):\n l[h][w] = False\n elif a == 2:\n for h in range(H):\n for w in range(x, W):\n l[h][w] = False\n elif a == 3:\n for h in range(y):\n l[h] = [False]*W\n else:\n for h in range(y, H):\n l[h] = [False]*W",
"i",
"range(n)",
"range",
"n",
"x, y, a = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"a",
"if a == 1:\n for h in range(H):\n for w in range(x):\n l[h][w] = False\n elif a == 2:\n for h in range(H):\n for w in range(x, W):\n l[h][w] = False\n elif a == 3:\n for h in range(y):\n l[h] = [False]*W\n else:\n for h in range(y, H):\n l[h] = [False]*W",
"a == 1",
"a",
"1",
"for h in range(H):\n for w in range(x):\n l[h][w] = False\n ",
"h",
"range(H)",
"range",
"H",
"for w in range(x):\n l[h][w] = False\n ",
"w",
"range(x)",
"range",
"x",
"l[h][w] = False",
"l[h][w]",
"[h]",
"l",
"h",
"w",
"False",
"elif a == 2:\n for h in range(H):\n for w in range(x, W):\n l[h][w] = False\n ",
"a == 2",
"a",
"2",
"for h in range(H):\n for w in range(x, W):\n l[h][w] = False\n ",
"h",
"range(H)",
"range",
"H",
"for w in range(x, W):\n l[h][w] = False\n ",
"w",
"range(x, W)",
"range",
"x",
"W",
"l[h][w] = False",
"l[h][w]",
"[h]",
"l",
"h",
"w",
"False",
"elif a == 3:\n for h in range(y):\n l[h] = [False]*W\n ",
"a == 3",
"a",
"3",
"for h in range(y):\n l[h] = [False]*W\n ",
"h",
"range(y)",
"range",
"y",
"l[h] = [False]*W",
"l[h]",
"l",
"h",
"[False]*W",
"[False]",
"False",
"W",
"for h in range(y, H):\n l[h] = [False]*W",
"h",
"range(y, H)",
"range",
"y",
"H",
"l[h] = [False]*W",
"l[h]",
"l",
"h",
"[False]*W",
"[False]",
"False",
"W",
"ans = 0",
"ans",
"0",
"for i in range(H):\n for j in range(W):\n if l[i][j]:\n ans += 1",
"i",
"range(H)",
"range",
"H",
"for j in range(W):\n if l[i][j]:\n ans += 1",
"j",
"range(W)",
"range",
"W",
"if l[i][j]:\n ans += 1",
"l[i][j]",
"[i]",
"l",
"i",
"j",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"ans += 1",
"1",
"ans",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"W, H, n = map(int, input().split())",
"map(int, input().split())",
"W",
"H, n = map(int, input().split())",
"map(int, input().split())",
"H",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"l = [[True]*W]*H",
"[[True]*W]*H",
"l",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"ans = 0",
"0",
"ans"
] |
W, H, n = map(int, input().split())
l = [[True]*W]*H
for i in range(n):
x, y, a = map(int, input().split())
if a == 1:
for h in range(H):
for w in range(x):
l[h][w] = False
elif a == 2:
for h in range(H):
for w in range(x, W):
l[h][w] = False
elif a == 3:
for h in range(y):
l[h] = [False]*W
else:
for h in range(y, H):
l[h] = [False]*W
ans = 0
for i in range(H):
for j in range(W):
if l[i][j]:
ans += 1
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
2,
39,
17,
13,
0,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
0,
13,
13,
0,
13,
17,
0,
13,
13,
14,
2,
13,
17,
0,
13,
13,
14,
2,
13,
17,
0,
13,
13,
14,
2,
13,
17,
0,
13,
13,
14,
2,
13,
17,
0,
13,
13,
28,
13,
4,
13,
13,
13,
28,
13,
4,
13,
13,
13,
0,
18,
18,
13,
13,
13,
17,
41,
28,
13,
13,
4,
4,
13,
13,
4,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13
] |
[
[
150,
2
],
[
150,
11
],
[
150,
12
],
[
16,
15
],
[
124,
18
],
[
151,
23
],
[
141,
25
],
[
29,
28
],
[
118,
31
],
[
156,
33
],
[
156,
42
],
[
156,
43
],
[
144,
45
],
[
129,
48
],
[
124,
49
],
[
120,
51
],
[
159,
54
],
[
151,
55
],
[
127,
58
],
[
132,
61
],
[
136,
62
],
[
127,
65
],
[
153,
68
],
[
136,
69
],
[
127,
72
],
[
138,
75
],
[
157,
76
],
[
127,
79
],
[
147,
82
],
[
157,
83
],
[
86,
85
],
[
148,
88
],
[
145,
88
],
[
139,
89
],
[
130,
89
],
[
92,
91
],
[
154,
94
],
[
121,
94
],
[
133,
95
],
[
160,
95
],
[
102,
97
],
[
142,
99
],
[
85,
100
],
[
91,
101
],
[
106,
105
],
[
142,
105
],
[
105,
110
],
[
150,
118
],
[
120,
121
],
[
150,
124
],
[
156,
127
],
[
124,
129
],
[
129,
130
],
[
136,
132
],
[
132,
133
],
[
156,
136
],
[
157,
138
],
[
138,
139
],
[
141,
142
],
[
144,
145
],
[
157,
147
],
[
147,
148
],
[
150,
151
],
[
136,
153
],
[
153,
154
],
[
156,
157
],
[
151,
159
],
[
159,
160
]
] |
[
"W, H, N = map(int, input().split())\n\nboard = [[1]*W for _ in range(H)]\n\nfor _ in range(N):\n x, y, a = map(int, input().split())\n t = 0\n b = H\n l = 0\n r = W\n if a == 1:\n r = x\n if a == 2:\n l = x\n if a == 3:\n b = y\n if a == 4:\n t = y\n \n for h in range(t, b):\n for w in range(l, r):\n board[h][w] = 0\n \nprint(sum([sum(r) for r in board]))",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"[1]*W for _ in range(H)",
"for _ in range(H)",
"_",
"range(H)",
"range",
"H",
"for _ in range(H)",
"[1]*W",
"[1]",
"1",
"W",
"board = [[1]*W for _ in range(H)]",
"board",
"[[1]*W for _ in range(H)]",
"for _ in range(N):\n x, y, a = map(int, input().split())\n t = 0\n b = H\n l = 0\n r = W\n if a == 1:\n r = x\n if a == 2:\n l = x\n if a == 3:\n b = y\n if a == 4:\n t = y\n \n for h in range(t, b):\n for w in range(l, r):\n board[h][w] = 0\n ",
"_",
"range(N)",
"range",
"N",
"x, y, a = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"a",
"t = 0",
"t",
"0",
"b = H",
"b",
"H",
"l = 0",
"l",
"0",
"r = W",
"r",
"W",
"if a == 1:\n r = x\n ",
"a == 1",
"a",
"1",
"r = x",
"r",
"x",
"if a == 2:\n l = x\n ",
"a == 2",
"a",
"2",
"l = x",
"l",
"x",
"if a == 3:\n b = y\n ",
"a == 3",
"a",
"3",
"b = y",
"b",
"y",
"if a == 4:\n t = y\n \n ",
"a == 4",
"a",
"4",
"t = y",
"t",
"y",
"for h in range(t, b):\n for w in range(l, r):\n board[h][w] = 0\n ",
"h",
"range(t, b)",
"range",
"t",
"b",
"for w in range(l, r):\n board[h][w] = 0\n ",
"w",
"range(l, r)",
"range",
"l",
"r",
"board[h][w] = 0",
"board[h][w]",
"[h]",
"board",
"h",
"w",
"0",
"sum(r) for r in board",
"for r in board",
"r",
"board",
"for r in board",
"sum(r)",
"sum",
"r",
"print(sum([sum(r) for r in board]))",
"print",
"sum([sum(r) for r in board])",
"sum",
"[sum(r) for r in board]",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"l = 0",
"0",
"l",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"b = H",
"H",
"b",
"r = x",
"x",
"r",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"b = y",
"y",
"b",
"board = [[1]*W for _ in range(H)]",
"[[1]*W for _ in range(H)]",
"board",
"t = 0",
"0",
"t",
"t = y",
"y",
"t",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"l = x",
"x",
"l",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"r = W",
"W",
"r"
] |
W, H, N = map(int, input().split())
board = [[1]*W for _ in range(H)]
for _ in range(N):
x, y, a = map(int, input().split())
t = 0
b = H
l = 0
r = W
if a == 1:
r = x
if a == 2:
l = x
if a == 3:
b = y
if a == 4:
t = y
for h in range(t, b):
for w in range(l, r):
board[h][w] = 0
print(sum([sum(r) for r in board]))
|
[
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,
4,
13,
13,
4,
18,
4,
13,
13,
4,
18,
13,
13,
13,
0,
13,
17,
0,
13,
13,
0,
13,
17,
0,
13,
13,
28,
13,
4,
13,
13,
14,
2,
2,
18,
18,
13,
13,
17,
17,
2,
13,
18,
18,
13,
13,
17,
0,
13,
18,
18,
13,
13,
17,
14,
2,
2,
18,
18,
13,
13,
17,
17,
2,
13,
18,
18,
13,
13,
17,
0,
13,
18,
18,
13,
13,
17,
14,
2,
2,
18,
18,
13,
13,
17,
17,
2,
13,
18,
18,
13,
13,
17,
0,
13,
18,
18,
13,
13,
17,
14,
2,
2,
18,
18,
13,
13,
17,
17,
2,
13,
18,
18,
13,
13,
17,
0,
13,
18,
18,
13,
13,
17,
14,
2,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
4,
13,
2,
13,
13,
10,
18,
13,
10,
39,
13,
10,
18,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13
] |
[
[
207,
2
],
[
207,
11
],
[
207,
12
],
[
180,
14
],
[
18,
17
],
[
199,
20
],
[
192,
22
],
[
181,
35
],
[
193,
37
],
[
195,
39
],
[
201,
42
],
[
205,
43
],
[
213,
45
],
[
222,
48
],
[
208,
49
],
[
52,
51
],
[
199,
54
],
[
181,
60
],
[
51,
61
],
[
196,
65
],
[
184,
65
],
[
181,
68
],
[
51,
69
],
[
183,
72
],
[
181,
75
],
[
51,
76
],
[
181,
83
],
[
51,
84
],
[
202,
88
],
[
217,
88
],
[
181,
91
],
[
51,
92
],
[
216,
95
],
[
181,
98
],
[
51,
99
],
[
181,
106
],
[
51,
107
],
[
214,
111
],
[
178,
111
],
[
181,
114
],
[
51,
115
],
[
177,
118
],
[
181,
121
],
[
51,
122
],
[
181,
129
],
[
51,
130
],
[
223,
134
],
[
190,
134
],
[
181,
137
],
[
51,
138
],
[
189,
141
],
[
181,
144
],
[
51,
145
],
[
184,
149
],
[
196,
149
],
[
217,
150
],
[
202,
150
],
[
186,
152
],
[
217,
154
],
[
202,
154
],
[
184,
155
],
[
196,
155
],
[
219,
157
],
[
178,
161
],
[
214,
161
],
[
190,
162
],
[
223,
162
],
[
210,
164
],
[
190,
166
],
[
223,
166
],
[
178,
167
],
[
214,
167
],
[
225,
169
],
[
220,
174
],
[
187,
174
],
[
226,
175
],
[
211,
175
],
[
177,
178
],
[
180,
181
],
[
183,
184
],
[
186,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
],
[
207,
199
],
[
205,
201
],
[
201,
202
],
[
207,
205
],
[
207,
208
],
[
210,
211
],
[
213,
214
],
[
216,
217
],
[
219,
220
],
[
208,
222
],
[
222,
223
],
[
225,
226
]
] |
[
"W,H,N = map(int,input().split())\na = []\nfor i in range(N):\n b = list(map(int,input().split()))\n a.append(b)\nxs = 0\nxe = W\nys = 0\nye = H\nfor i in range(N):\n if a[i][2] == 1 and xs < a[i][0]:\n xs = a[i][0]\n elif a[i][2] == 2 and xe > a [i][0]:\n xe = a[i][0]\n elif a[i][2] == 3 and ys < a[i][1]:\n ys = a[i][1]\n elif a[i][2] == 4 and ye > a[i][1]:\n ye = a[i][1]\nif xs < xe:\n w = xe - xs\nelse:\n w = 0\nif ys < ye:\n h = ye - ys\nelse:\n h = 0\nprint(w*h)",
"W,H,N = map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"a = []",
"a",
"[]",
"for i in range(N):\n b = list(map(int,input().split()))\n a.append(b)",
"i",
"range(N)",
"range",
"N",
"b = list(map(int,input().split()))",
"b",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"a.append(b)",
"a.append",
"a",
"append",
"b",
"xs = 0",
"xs",
"0",
"xe = W",
"xe",
"W",
"ys = 0",
"ys",
"0",
"ye = H",
"ye",
"H",
"for i in range(N):\n if a[i][2] == 1 and xs < a[i][0]:\n xs = a[i][0]\n elif a[i][2] == 2 and xe > a [i][0]:\n xe = a[i][0]\n elif a[i][2] == 3 and ys < a[i][1]:\n ys = a[i][1]\n elif a[i][2] == 4 and ye > a[i][1]:\n ye = a[i][1]",
"i",
"range(N)",
"range",
"N",
"if a[i][2] == 1 and xs < a[i][0]:\n xs = a[i][0]\n elif a[i][2] == 2 and xe > a [i][0]:\n xe = a[i][0]\n elif a[i][2] == 3 and ys < a[i][1]:\n ys = a[i][1]\n elif a[i][2] == 4 and ye > a[i][1]:\n ye = a[i][1]",
"a[i][2] == 1 and xs < a[i][0]",
"a[i][2] == 1",
"a[i][2]",
"[i]",
"a",
"i",
"2",
"1",
"xs < a[i][0]",
"xs",
"a[i][0]",
"[i]",
"a",
"i",
"0",
"xs = a[i][0]",
"xs",
"a[i][0]",
"[i]",
"a",
"i",
"0",
"elif a[i][2] == 2 and xe > a [i][0]:\n xe = a[i][0]\n ",
"a[i][2] == 2 and xe > a [i][0]",
"a[i][2] == 2",
"a[i][2]",
"[i]",
"a",
"i",
"2",
"2",
"xe > a [i][0]",
"xe",
"a [i][0]",
"[i]",
"a",
"i",
"0",
"xe = a[i][0]",
"xe",
"a[i][0]",
"[i]",
"a",
"i",
"0",
"elif a[i][2] == 3 and ys < a[i][1]:\n ys = a[i][1]\n ",
"a[i][2] == 3 and ys < a[i][1]",
"a[i][2] == 3",
"a[i][2]",
"[i]",
"a",
"i",
"2",
"3",
"ys < a[i][1]",
"ys",
"a[i][1]",
"[i]",
"a",
"i",
"1",
"ys = a[i][1]",
"ys",
"a[i][1]",
"[i]",
"a",
"i",
"1",
"elif a[i][2] == 4 and ye > a[i][1]:\n ye = a[i][1]",
"a[i][2] == 4 and ye > a[i][1]",
"a[i][2] == 4",
"a[i][2]",
"[i]",
"a",
"i",
"2",
"4",
"ye > a[i][1]",
"ye",
"a[i][1]",
"[i]",
"a",
"i",
"1",
"ye = a[i][1]",
"ye",
"a[i][1]",
"[i]",
"a",
"i",
"1",
"if xs < xe:\n w = xe - xs\nelse:\n w = 0",
"xs < xe",
"xs",
"xe",
"w = xe - xs",
"w",
"xe - xs",
"xe",
"xs",
"w = 0",
"w",
"0",
"if ys < ye:\n h = ye - ys\nelse:\n h = 0",
"ys < ye",
"ys",
"ye",
"h = ye - ys",
"h",
"ye - ys",
"ye",
"ys",
"h = 0",
"h",
"0",
"print(w*h)",
"print",
"w*h",
"w",
"h",
"ys = a[i][1]",
"a[i][1]",
"ys",
"a = []",
"[]",
"a",
"xs = a[i][0]",
"a[i][0]",
"xs",
"w = xe - xs",
"xe - xs",
"w",
"ye = a[i][1]",
"a[i][1]",
"ye",
"b = list(map(int,input().split()))",
"list(map(int,input().split()))",
"b",
"xs = 0",
"0",
"xs",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"xe = W",
"W",
"xe",
"W,H,N = map(int,input().split())",
"map(int,input().split())",
"W",
"H,N = map(int,input().split())",
"map(int,input().split())",
"H",
"h = ye - ys",
"ye - ys",
"h",
"ys = 0",
"0",
"ys",
"xe = a[i][0]",
"a[i][0]",
"xe",
"w = 0",
"0",
"w",
"ye = H",
"H",
"ye",
"h = 0",
"0",
"h"
] |
W,H,N = map(int,input().split())
a = []
for i in range(N):
b = list(map(int,input().split()))
a.append(b)
xs = 0
xe = W
ys = 0
ye = H
for i in range(N):
if a[i][2] == 1 and xs < a[i][0]:
xs = a[i][0]
elif a[i][2] == 2 and xe > a [i][0]:
xe = a[i][0]
elif a[i][2] == 3 and ys < a[i][1]:
ys = a[i][1]
elif a[i][2] == 4 and ye > a[i][1]:
ye = a[i][1]
if xs < xe:
w = xe - xs
else:
w = 0
if ys < ye:
h = ye - ys
else:
h = 0
print(w*h)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
39,
17,
39,
13,
0,
13,
39,
39,
17,
39,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
2,
13,
17,
2,
13,
17,
4,
18,
18,
13,
2,
13,
17,
13,
13,
4,
18,
18,
13,
2,
13,
17,
13,
13,
0,
13,
4,
13,
18,
13,
17,
0,
13,
4,
13,
18,
13,
17,
0,
13,
4,
13,
18,
13,
17,
0,
13,
4,
13,
18,
13,
17,
14,
2,
40,
13,
13,
40,
13,
13,
4,
13,
2,
2,
13,
13,
2,
13,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
143,
2
],
[
143,
11
],
[
143,
12
],
[
122,
14
],
[
128,
21
],
[
29,
28
],
[
138,
31
],
[
149,
33
],
[
149,
42
],
[
149,
43
],
[
120,
47
],
[
120,
50
],
[
123,
55
],
[
120,
57
],
[
147,
60
],
[
129,
64
],
[
120,
66
],
[
150,
69
],
[
116,
71
],
[
123,
75
],
[
140,
78
],
[
123,
82
],
[
125,
85
],
[
129,
89
],
[
134,
92
],
[
129,
96
],
[
117,
101
],
[
141,
102
],
[
126,
104
],
[
135,
105
],
[
117,
110
],
[
141,
111
],
[
126,
113
],
[
135,
114
],
[
116,
117
],
[
149,
120
],
[
122,
123
],
[
125,
126
],
[
128,
129
],
[
143,
132
],
[
134,
135
],
[
143,
138
],
[
140,
141
],
[
143,
144
],
[
149,
147
],
[
149,
150
]
] |
[
"W, H, N = map(int, input().split())\n\nlstx = [[0], [W]]\nlsty = [[0], [H]]\n\nfor i in range(N):\n x, y, a = map(int, input().split())\n if a==1 or a==2:\n lstx[a-1].append(x)\n else:\n lsty[a-3].append(y)\n\nxmax = max(lstx[0])\nxmin = min(lstx[1])\nymax = max(lsty[0])\nymin = min(lsty[1])\n\nif xmax <= xmin and ymax <= ymin:\n print((xmax-xmin)*(ymax-ymin))\nelse: print(0)\n",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"lstx = [[0], [W]]",
"lstx",
"[[0], [W]]",
"[0]",
"0",
"[W]",
"W",
"lsty = [[0], [H]]",
"lsty",
"[[0], [H]]",
"[0]",
"0",
"[H]",
"H",
"for i in range(N):\n x, y, a = map(int, input().split())\n if a==1 or a==2:\n lstx[a-1].append(x)\n else:\n lsty[a-3].append(y)",
"i",
"range(N)",
"range",
"N",
"x, y, a = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"a",
"if a==1 or a==2:\n lstx[a-1].append(x)\n else:\n lsty[a-3].append(y)",
"a==1 or a==2",
"a==1",
"a",
"1",
"a==2",
"a",
"2",
"lstx[a-1].append(x)",
"[a-1].append",
"[a-1]",
"lstx",
"a-1",
"a",
"1",
"append",
"x",
"lsty[a-3].append(y)",
"[a-3].append",
"[a-3]",
"lsty",
"a-3",
"a",
"3",
"append",
"y",
"xmax = max(lstx[0])",
"xmax",
"max(lstx[0])",
"max",
"lstx[0]",
"lstx",
"0",
"xmin = min(lstx[1])",
"xmin",
"min(lstx[1])",
"min",
"lstx[1]",
"lstx",
"1",
"ymax = max(lsty[0])",
"ymax",
"max(lsty[0])",
"max",
"lsty[0]",
"lsty",
"0",
"ymin = min(lsty[1])",
"ymin",
"min(lsty[1])",
"min",
"lsty[1]",
"lsty",
"1",
"if xmax <= xmin and ymax <= ymin:\n print((xmax-xmin)*(ymax-ymin))\nelse: print(0)",
"xmax <= xmin and ymax <= ymin",
"xmax <= xmin",
"xmax",
"xmin",
"ymax <= ymin",
"ymax",
"ymin",
"print((xmax-xmin)*(ymax-ymin))",
"print",
"(xmax-xmin)*(ymax-ymin)",
"xmax-xmin",
"xmax",
"xmin",
"ymax-ymin",
"ymax",
"ymin",
"xmax = max(lstx[0])",
"max(lstx[0])",
"xmax",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"lstx = [[0], [W]]",
"[[0], [W]]",
"lstx",
"ymax = max(lsty[0])",
"max(lsty[0])",
"ymax",
"lsty = [[0], [H]]",
"[[0], [H]]",
"lsty",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"ymin = min(lsty[1])",
"min(lsty[1])",
"ymin",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"xmin = min(lstx[1])",
"min(lstx[1])",
"xmin",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y"
] |
W, H, N = map(int, input().split())
lstx = [[0], [W]]
lsty = [[0], [H]]
for i in range(N):
x, y, a = map(int, input().split())
if a==1 or a==2:
lstx[a-1].append(x)
else:
lsty[a-3].append(y)
xmax = max(lstx[0])
xmin = min(lstx[1])
ymax = max(lsty[0])
ymin = min(lsty[1])
if xmax <= xmin and ymax <= ymin:
print((xmax-xmin)*(ymax-ymin))
else: print(0)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
13,
13,
13,
17,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
14,
2,
40,
13,
17,
40,
13,
17,
4,
13,
17,
4,
13,
2,
13,
13,
10,
2,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] |
[
[
136,
2
],
[
136,
11
],
[
136,
12
],
[
145,
14
],
[
139,
16
],
[
137,
17
],
[
118,
18
],
[
112,
20
],
[
125,
21
],
[
24,
23
],
[
122,
26
],
[
130,
28
],
[
130,
37
],
[
130,
38
],
[
131,
41
],
[
142,
44
],
[
146,
47
],
[
143,
47
],
[
116,
48
],
[
131,
51
],
[
148,
54
],
[
140,
57
],
[
149,
57
],
[
116,
58
],
[
131,
61
],
[
109,
64
],
[
119,
67
],
[
110,
67
],
[
128,
68
],
[
131,
71
],
[
151,
74
],
[
113,
77
],
[
152,
77
],
[
128,
78
],
[
133,
80
],
[
149,
82
],
[
140,
82
],
[
143,
83
],
[
146,
83
],
[
106,
85
],
[
152,
87
],
[
113,
87
],
[
110,
88
],
[
119,
88
],
[
134,
92
],
[
131,
92
],
[
107,
95
],
[
134,
103
],
[
131,
103
],
[
107,
104
],
[
106,
107
],
[
109,
110
],
[
125,
112
],
[
112,
113
],
[
130,
116
],
[
118,
119
],
[
136,
122
],
[
136,
125
],
[
130,
128
],
[
130,
131
],
[
133,
134
],
[
136,
137
],
[
137,
139
],
[
139,
140
],
[
142,
143
],
[
145,
146
],
[
148,
149
],
[
151,
152
]
] |
[
"w, h, n = map(int, input().split())\nright, left, lower, upper = 0, w, 0, h\nfor _ in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n right = max(right, x)\n if a == 2:\n left = min(left, x)\n if a == 3:\n lower = max(lower, y)\n if a == 4:\n upper = min(upper, y)\n\na = left - right\nb = upper - lower\n\nif a <= 0 or b <= 0:\n print(0)\nelse:\n print(a*b)",
"w, h, n = map(int, input().split())",
"w",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"right, left, lower, upper = 0, w, 0, h",
"right",
"0",
"left",
"w",
"lower",
"0",
"upper",
"h",
"for _ in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n right = max(right, x)\n if a == 2:\n left = min(left, x)\n if a == 3:\n lower = max(lower, y)\n if a == 4:\n upper = min(upper, y)",
"_",
"range(n)",
"range",
"n",
"x, y, a = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"a",
"if a == 1:\n right = max(right, x)\n ",
"a == 1",
"a",
"1",
"right = max(right, x)",
"right",
"max(right, x)",
"max",
"right",
"x",
"if a == 2:\n left = min(left, x)\n ",
"a == 2",
"a",
"2",
"left = min(left, x)",
"left",
"min(left, x)",
"min",
"left",
"x",
"if a == 3:\n lower = max(lower, y)\n ",
"a == 3",
"a",
"3",
"lower = max(lower, y)",
"lower",
"max(lower, y)",
"max",
"lower",
"y",
"if a == 4:\n upper = min(upper, y)",
"a == 4",
"a",
"4",
"upper = min(upper, y)",
"upper",
"min(upper, y)",
"min",
"upper",
"y",
"a = left - right",
"a",
"left - right",
"left",
"right",
"b = upper - lower",
"b",
"upper - lower",
"upper",
"lower",
"if a <= 0 or b <= 0:\n print(0)\nelse:\n print(a*b)",
"a <= 0 or b <= 0",
"a <= 0",
"a",
"0",
"b <= 0",
"b",
"0",
"print(0)",
"print",
"0",
"print(a*b)",
"print",
"a*b",
"a",
"b",
"b = upper - lower",
"upper - lower",
"b",
"lower = max(lower, y)",
"max(lower, y)",
"lower",
"upper = 0, w, 0, h",
"h",
"upper",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"lower, upper = 0, w, 0, h",
"0",
"lower",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"h, n = map(int, input().split())",
"map(int, input().split())",
"h",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"a = left - right",
"left - right",
"a",
"w, h, n = map(int, input().split())",
"map(int, input().split())",
"w",
"left, lower, upper = 0, w, 0, h",
"w",
"left",
"right = max(right, x)",
"max(right, x)",
"right",
"right, left, lower, upper = 0, w, 0, h",
"0",
"right",
"left = min(left, x)",
"min(left, x)",
"left",
"upper = min(upper, y)",
"min(upper, y)",
"upper"
] |
w, h, n = map(int, input().split())
right, left, lower, upper = 0, w, 0, h
for _ in range(n):
x, y, a = map(int, input().split())
if a == 1:
right = max(right, x)
if a == 2:
left = min(left, x)
if a == 3:
lower = max(lower, y)
if a == 4:
upper = min(upper, y)
a = left - right
b = upper - lower
if a <= 0 or b <= 0:
print(0)
else:
print(a*b)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
0,
13,
13,
0,
13,
17,
0,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
40,
13,
13,
40,
13,
13,
4,
13,
17,
4,
13,
2,
4,
13,
2,
13,
13,
4,
13,
2,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
137,
2
],
[
137,
11
],
[
137,
12
],
[
107,
14
],
[
122,
17
],
[
126,
18
],
[
113,
20
],
[
134,
23
],
[
117,
24
],
[
27,
26
],
[
138,
29
],
[
143,
31
],
[
143,
40
],
[
143,
41
],
[
132,
44
],
[
140,
47
],
[
108,
50
],
[
141,
50
],
[
129,
51
],
[
132,
54
],
[
146,
57
],
[
123,
60
],
[
147,
60
],
[
129,
61
],
[
132,
64
],
[
119,
67
],
[
114,
70
],
[
120,
70
],
[
144,
71
],
[
132,
74
],
[
110,
77
],
[
135,
80
],
[
111,
80
],
[
144,
81
],
[
141,
85
],
[
108,
85
],
[
147,
86
],
[
123,
86
],
[
120,
88
],
[
114,
88
],
[
111,
89
],
[
135,
89
],
[
141,
99
],
[
108,
99
],
[
147,
100
],
[
123,
100
],
[
120,
104
],
[
114,
104
],
[
111,
105
],
[
135,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
],
[
137,
117
],
[
119,
120
],
[
126,
122
],
[
122,
123
],
[
137,
126
],
[
143,
129
],
[
143,
132
],
[
117,
134
],
[
134,
135
],
[
137,
138
],
[
140,
141
],
[
143,
144
],
[
146,
147
]
] |
[
"w,h,n = map(int,input().split())\n \nx1 = 0\nx2 = w\ny1 = 0\ny2 = h\n\nfor i in range(n):\n x,y,a = map(int,input().split())\n if a == 1:\n x1 = max(x1,x)\n elif a == 2:\n x2 = min(x2,x)\n elif a == 3:\n y1 = max(y1,y) \n elif a == 4:\n y2 = min(y2,y) \n\nif x1 >= x2 or y1 >= y2:\n print(0)\nelse:\n print(abs(x1-x2)*abs(y1-y2))",
"w,h,n = map(int,input().split())",
"w",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"x1 = 0",
"x1",
"0",
"x2 = w",
"x2",
"w",
"y1 = 0",
"y1",
"0",
"y2 = h",
"y2",
"h",
"for i in range(n):\n x,y,a = map(int,input().split())\n if a == 1:\n x1 = max(x1,x)\n elif a == 2:\n x2 = min(x2,x)\n elif a == 3:\n y1 = max(y1,y) \n elif a == 4:\n y2 = min(y2,y) ",
"i",
"range(n)",
"range",
"n",
"x,y,a = map(int,input().split())",
"x",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"a",
"if a == 1:\n x1 = max(x1,x)\n elif a == 2:\n x2 = min(x2,x)\n elif a == 3:\n y1 = max(y1,y) \n elif a == 4:\n y2 = min(y2,y) ",
"a == 1",
"a",
"1",
"x1 = max(x1,x)",
"x1",
"max(x1,x)",
"max",
"x1",
"x",
"elif a == 2:\n x2 = min(x2,x)\n ",
"a == 2",
"a",
"2",
"x2 = min(x2,x)",
"x2",
"min(x2,x)",
"min",
"x2",
"x",
"elif a == 3:\n y1 = max(y1,y) \n ",
"a == 3",
"a",
"3",
"y1 = max(y1,y)",
"y1",
"max(y1,y)",
"max",
"y1",
"y",
"elif a == 4:\n y2 = min(y2,y) ",
"a == 4",
"a",
"4",
"y2 = min(y2,y)",
"y2",
"min(y2,y)",
"min",
"y2",
"y",
"if x1 >= x2 or y1 >= y2:\n print(0)\nelse:\n print(abs(x1-x2)*abs(y1-y2))",
"x1 >= x2 or y1 >= y2",
"x1 >= x2",
"x1",
"x2",
"y1 >= y2",
"y1",
"y2",
"print(0)",
"print",
"0",
"print(abs(x1-x2)*abs(y1-y2))",
"print",
"abs(x1-x2)*abs(y1-y2)",
"abs(x1-x2)",
"abs",
"x1-x2",
"x1",
"x2",
"abs(y1-y2)",
"abs",
"y1-y2",
"y1",
"y2",
"x1 = 0",
"0",
"x1",
"y2 = min(y2,y)",
"min(y2,y)",
"y2",
"y1 = 0",
"0",
"y1",
"h,n = map(int,input().split())",
"map(int,input().split())",
"h",
"y1 = max(y1,y)",
"max(y1,y)",
"y1",
"x2 = w",
"w",
"x2",
"w,h,n = map(int,input().split())",
"map(int,input().split())",
"w",
"x,y,a = map(int,input().split())",
"map(int,input().split())",
"x",
"a = map(int,input().split())",
"map(int,input().split())",
"a",
"y2 = h",
"h",
"y2",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"x1 = max(x1,x)",
"max(x1,x)",
"x1",
"y,a = map(int,input().split())",
"map(int,input().split())",
"y",
"x2 = min(x2,x)",
"min(x2,x)",
"x2"
] |
w,h,n = map(int,input().split())
x1 = 0
x2 = w
y1 = 0
y2 = h
for i in range(n):
x,y,a = map(int,input().split())
if a == 1:
x1 = max(x1,x)
elif a == 2:
x2 = min(x2,x)
elif a == 3:
y1 = max(y1,y)
elif a == 4:
y2 = min(y2,y)
if x1 >= x2 or y1 >= y2:
print(0)
else:
print(abs(x1-x2)*abs(y1-y2))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
2,
39,
17,
13,
0,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
14,
2,
18,
18,
13,
13,
13,
17,
0,
18,
18,
13,
13,
13,
17,
0,
13,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
13,
14,
2,
18,
18,
13,
13,
13,
17,
0,
18,
18,
13,
13,
13,
17,
0,
13,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
14,
2,
18,
18,
13,
13,
13,
17,
0,
18,
18,
13,
13,
13,
17,
0,
13,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
13,
28,
13,
4,
13,
13,
14,
2,
18,
18,
13,
13,
13,
17,
0,
18,
18,
13,
13,
13,
17,
0,
13,
17,
4,
13,
2,
2,
13,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] |
[
[
203,
2
],
[
203,
11
],
[
203,
12
],
[
16,
15
],
[
201,
18
],
[
186,
23
],
[
194,
25
],
[
206,
28
],
[
32,
31
],
[
204,
34
],
[
215,
36
],
[
215,
45
],
[
215,
46
],
[
216,
49
],
[
53,
52
],
[
201,
55
],
[
58,
57
],
[
213,
60
],
[
70,
63
],
[
168,
63
],
[
135,
63
],
[
103,
63
],
[
195,
65
],
[
52,
66
],
[
57,
67
],
[
75,
70
],
[
195,
72
],
[
52,
73
],
[
57,
74
],
[
197,
77
],
[
216,
81
],
[
85,
84
],
[
201,
87
],
[
90,
89
],
[
213,
92
],
[
186,
93
],
[
70,
96
],
[
103,
96
],
[
168,
96
],
[
135,
96
],
[
195,
98
],
[
84,
99
],
[
89,
100
],
[
108,
103
],
[
195,
105
],
[
84,
106
],
[
89,
107
],
[
218,
110
],
[
216,
114
],
[
118,
117
],
[
192,
120
],
[
123,
122
],
[
186,
125
],
[
103,
128
],
[
70,
128
],
[
135,
128
],
[
168,
128
],
[
195,
130
],
[
117,
131
],
[
122,
132
],
[
140,
135
],
[
195,
137
],
[
117,
138
],
[
122,
139
],
[
188,
142
],
[
216,
146
],
[
150,
149
],
[
192,
152
],
[
201,
153
],
[
156,
155
],
[
186,
158
],
[
135,
161
],
[
103,
161
],
[
70,
161
],
[
168,
161
],
[
195,
163
],
[
149,
164
],
[
155,
165
],
[
173,
168
],
[
195,
170
],
[
149,
171
],
[
155,
172
],
[
209,
175
],
[
186,
181
],
[
201,
182
],
[
210,
183
],
[
189,
183
],
[
219,
183
],
[
198,
183
],
[
207,
183
],
[
203,
186
],
[
188,
189
],
[
215,
192
],
[
194,
195
],
[
197,
198
],
[
203,
201
],
[
203,
204
],
[
206,
207
],
[
209,
210
],
[
215,
213
],
[
215,
216
],
[
218,
219
]
] |
[
"w, h, n = map(int, input().split())\nl = [[0]*w for _ in range(h)]\ncount = 0\nfor _ in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n for i in range(h):\n for j in range(x):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n if a == 2:\n for i in range(h):\n for j in range(x,w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n if a == 3:\n for i in range(y):\n for j in range(w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n if a == 4:\n for i in range(y,h):\n for j in range(w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n\nprint(w*h - count) ",
"w, h, n = map(int, input().split())",
"w",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"[0]*w for _ in range(h)",
"for _ in range(h)",
"_",
"range(h)",
"range",
"h",
"for _ in range(h)",
"[0]*w",
"[0]",
"0",
"w",
"l = [[0]*w for _ in range(h)]",
"l",
"[[0]*w for _ in range(h)]",
"count = 0",
"count",
"0",
"for _ in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n for i in range(h):\n for j in range(x):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n if a == 2:\n for i in range(h):\n for j in range(x,w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n if a == 3:\n for i in range(y):\n for j in range(w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n if a == 4:\n for i in range(y,h):\n for j in range(w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1",
"_",
"range(n)",
"range",
"n",
"x, y, a = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"a",
"if a == 1:\n for i in range(h):\n for j in range(x):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n ",
"a == 1",
"a",
"1",
"for i in range(h):\n for j in range(x):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n ",
"i",
"range(h)",
"range",
"h",
"for j in range(x):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n ",
"j",
"range(x)",
"range",
"x",
"if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n ",
"l[i][j] == 0",
"l[i][j]",
"[i]",
"l",
"i",
"j",
"0",
"l[i][j] = 1",
"l[i][j]",
"[i]",
"l",
"i",
"j",
"1",
"count += 1",
"count",
"1",
"if a == 2:\n for i in range(h):\n for j in range(x,w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n ",
"a == 2",
"a",
"2",
"for i in range(h):\n for j in range(x,w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n ",
"i",
"range(h)",
"range",
"h",
"for j in range(x,w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n ",
"j",
"range(x,w)",
"range",
"x",
"w",
"if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n ",
"l[i][j] == 0",
"l[i][j]",
"[i]",
"l",
"i",
"j",
"0",
"l[i][j] = 1",
"l[i][j]",
"[i]",
"l",
"i",
"j",
"1",
"count += 1",
"count",
"1",
"if a == 3:\n for i in range(y):\n for j in range(w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n ",
"a == 3",
"a",
"3",
"for i in range(y):\n for j in range(w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n ",
"i",
"range(y)",
"range",
"y",
"for j in range(w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n ",
"j",
"range(w)",
"range",
"w",
"if l[i][j] == 0:\n l[i][j] = 1\n count += 1\n ",
"l[i][j] == 0",
"l[i][j]",
"[i]",
"l",
"i",
"j",
"0",
"l[i][j] = 1",
"l[i][j]",
"[i]",
"l",
"i",
"j",
"1",
"count += 1",
"count",
"1",
"if a == 4:\n for i in range(y,h):\n for j in range(w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1",
"a == 4",
"a",
"4",
"for i in range(y,h):\n for j in range(w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1",
"i",
"range(y,h)",
"range",
"y",
"h",
"for j in range(w):\n if l[i][j] == 0:\n l[i][j] = 1\n count += 1",
"j",
"range(w)",
"range",
"w",
"if l[i][j] == 0:\n l[i][j] = 1\n count += 1",
"l[i][j] == 0",
"l[i][j]",
"[i]",
"l",
"i",
"j",
"0",
"l[i][j] = 1",
"l[i][j]",
"[i]",
"l",
"i",
"j",
"1",
"count += 1",
"count",
"1",
"print(w*h - count)",
"print",
"w*h - count",
"w*h",
"w",
"h",
"count",
"w, h, n = map(int, input().split())",
"map(int, input().split())",
"w",
"count += 1",
"1",
"count",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"l = [[0]*w for _ in range(h)]",
"[[0]*w for _ in range(h)]",
"l",
"count += 1",
"1",
"count",
"h, n = map(int, input().split())",
"map(int, input().split())",
"h",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"count = 0",
"0",
"count",
"count += 1",
"1",
"count",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"count += 1",
"1",
"count"
] |
w, h, n = map(int, input().split())
l = [[0]*w for _ in range(h)]
count = 0
for _ in range(n):
x, y, a = map(int, input().split())
if a == 1:
for i in range(h):
for j in range(x):
if l[i][j] == 0:
l[i][j] = 1
count += 1
if a == 2:
for i in range(h):
for j in range(x,w):
if l[i][j] == 0:
l[i][j] = 1
count += 1
if a == 3:
for i in range(y):
for j in range(w):
if l[i][j] == 0:
l[i][j] = 1
count += 1
if a == 4:
for i in range(y,h):
for j in range(w):
if l[i][j] == 0:
l[i][j] = 1
count += 1
print(w*h - count)
|
[
7,
15,
13,
13,
13,
13,
13,
13,
13,
13,
15,
15,
4,
18,
13,
13,
17,
0,
13,
12,
4,
13,
4,
18,
4,
18,
18,
18,
13,
13,
13,
13,
13,
0,
13,
12,
4,
13,
4,
13,
13,
4,
18,
4,
18,
18,
18,
13,
13,
13,
13,
13,
0,
13,
12,
4,
13,
4,
13,
13,
4,
18,
4,
18,
18,
18,
13,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
18,
4,
18,
18,
18,
13,
13,
13,
13,
13,
0,
13,
12,
13,
23,
0,
13,
12,
4,
18,
4,
18,
4,
18,
18,
18,
13,
13,
13,
13,
13,
13,
0,
13,
12,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
18,
18,
18,
13,
13,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
18,
4,
18,
4,
18,
18,
18,
13,
13,
13,
13,
13,
13,
0,
13,
12,
13,
23,
0,
13,
12,
2,
2,
13,
13,
4,
18,
13,
13,
13,
13,
23,
23,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
17,
12,
13,
14,
4,
18,
13,
13,
17,
0,
18,
13,
13,
4,
13,
17,
17,
0,
13,
4,
13,
13,
13,
0,
13,
17,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
13,
14,
2,
2,
13,
17,
40,
13,
13,
0,
13,
13,
14,
2,
2,
13,
17,
40,
13,
13,
0,
13,
13,
14,
2,
2,
13,
17,
40,
13,
13,
0,
13,
13,
14,
2,
2,
13,
17,
40,
13,
13,
0,
13,
13,
14,
2,
40,
13,
13,
40,
13,
13,
4,
13,
17,
4,
13,
2,
2,
13,
13,
2,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] |
[
[
297,
18
],
[
324,
34
],
[
318,
53
],
[
74,
73
],
[
300,
92
],
[
303,
97
],
[
327,
114
],
[
138,
137
],
[
321,
157
],
[
312,
162
],
[
315,
177
],
[
306,
184
],
[
200,
197
],
[
206,
205
],
[
325,
207
],
[
206,
208
],
[
206,
209
],
[
212,
211
],
[
214,
213
],
[
217,
216
],
[
209,
219
],
[
222,
221
],
[
325,
223
],
[
222,
224
],
[
222,
225
],
[
225,
229
],
[
211,
232
],
[
235,
232
],
[
221,
233
],
[
236,
235
],
[
221,
236
],
[
225,
240
],
[
205,
243
],
[
246,
243
],
[
221,
244
],
[
247,
246
],
[
221,
247
],
[
225,
251
],
[
213,
254
],
[
257,
254
],
[
224,
255
],
[
258,
257
],
[
224,
258
],
[
225,
262
],
[
208,
265
],
[
268,
265
],
[
224,
266
],
[
269,
268
],
[
224,
269
],
[
257,
273
],
[
213,
273
],
[
268,
274
],
[
208,
274
],
[
235,
276
],
[
211,
276
],
[
246,
277
],
[
205,
277
],
[
268,
285
],
[
208,
285
],
[
257,
286
],
[
213,
286
],
[
246,
288
],
[
205,
288
],
[
235,
289
],
[
211,
289
],
[
310,
295
],
[
297,
298
],
[
300,
301
],
[
303,
304
],
[
306,
307
],
[
312,
313
],
[
315,
316
],
[
318,
319
],
[
321,
322
],
[
324,
325
],
[
327,
328
]
] |
[
"import sys, os, math, bisect, itertools, collections, heapq, queue\n# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall\nfrom decimal import Decimal\nfrom collections import defaultdict, deque\n\nsys.setrecursionlimit(10000000)\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\nlcm = lambda x, y: (x * y) // math.gcd(x, y)\n\nMOD = 10 ** 9 + 7\nMAX = float('inf')\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n\n W, H, N = il()\n w, h = 0, 0\n for _ in range(N):\n x, y, a = il()\n if a == 1 and w <= x:\n w = x\n if a == 2 and W >= x:\n W = x\n if a == 3 and h <= y:\n h = y\n if a == 4 and H >= y:\n H = y\n\n if h >= H or w >= W:\n print(0)\n else:\n print((H - h) * (W - w))\n\n\nif __name__ == '__main__':\n main()",
"import sys, os, math, bisect, itertools, collections, heapq, queue",
"sys",
"os",
"math",
"bisect",
"itertools",
"collections",
"heapq",
"queue",
"from decimal import Decimal",
"from collections import defaultdict, deque",
"sys.setrecursionlimit(10000000)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10000000",
"ii = lambda: int(sys.stdin.buffer.readline().rstrip())",
"ii",
"lambda: int(sys.stdin.buffer.readline().rstrip())",
"int(sys.stdin.buffer.readline().rstrip())",
"int",
"sys.stdin.buffer.readline().rstrip()",
"sys.stdin.buffer.readline().rstrip",
"sys.stdin.buffer.readline()",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"rstrip",
"il = lambda: list(map(int, sys.stdin.buffer.readline().split()))",
"il",
"lambda: list(map(int, sys.stdin.buffer.readline().split()))",
"list(map(int, sys.stdin.buffer.readline().split()))",
"list",
"map(int, sys.stdin.buffer.readline().split())",
"map",
"int",
"sys.stdin.buffer.readline().split()",
"sys.stdin.buffer.readline().split",
"sys.stdin.buffer.readline()",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"split",
"fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))",
"fl",
"lambda: list(map(float, sys.stdin.buffer.readline().split()))",
"list(map(float, sys.stdin.buffer.readline().split()))",
"list",
"map(float, sys.stdin.buffer.readline().split())",
"map",
"float",
"sys.stdin.buffer.readline().split()",
"sys.stdin.buffer.readline().split",
"sys.stdin.buffer.readline()",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"split",
"int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"int(sys.stdin.buffer.readline().rstrip())",
"int",
"sys.stdin.buffer.readline().rstrip()",
"sys.stdin.buffer.readline().rstrip",
"sys.stdin.buffer.readline()",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"rstrip",
"iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]",
"iln",
"lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]",
"[int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]",
"n",
"iss = lambda: sys.stdin.buffer.readline().decode().rstrip()",
"iss",
"lambda: sys.stdin.buffer.readline().decode().rstrip()",
"sys.stdin.buffer.readline().decode().rstrip()",
"sys.stdin.buffer.readline().decode().rstrip",
"sys.stdin.buffer.readline().decode()",
"sys.stdin.buffer.readline().decode",
"sys.stdin.buffer.readline()",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"decode",
"rstrip",
"sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))",
"sl",
"lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))",
"list(map(str, sys.stdin.buffer.readline().decode().split()))",
"list",
"map(str, sys.stdin.buffer.readline().decode().split())",
"map",
"str",
"sys.stdin.buffer.readline().decode().split()",
"sys.stdin.buffer.readline().decode().split",
"sys.stdin.buffer.readline().decode()",
"sys.stdin.buffer.readline().decode",
"sys.stdin.buffer.readline()",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"decode",
"split",
"sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"sys.stdin.buffer.readline().decode().rstrip()",
"sys.stdin.buffer.readline().decode().rstrip",
"sys.stdin.buffer.readline().decode()",
"sys.stdin.buffer.readline().decode",
"sys.stdin.buffer.readline()",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"decode",
"rstrip",
"isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]",
"isn",
"lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]",
"[sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]",
"n",
"lcm = lambda x, y: (x * y) // math.gcd(x, y)",
"lcm",
"lambda x, y: (x * y) // math.gcd(x, y)",
"(x * y) // math.gcd(x, y)",
"x * y",
"x",
"y",
"math.gcd(x, y)",
"math.gcd",
"math",
"gcd",
"x",
"y",
"x",
"y",
"MOD = 10 ** 9 + 7",
"MOD",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"MAX = float('inf')",
"MAX",
"float('inf')",
"float",
"'inf'",
"def main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n\n W, H, N = il()\n w, h = 0, 0\n for _ in range(N):\n x, y, a = il()\n if a == 1 and w <= x:\n w = x\n if a == 2 and W >= x:\n W = x\n if a == 3 and h <= y:\n h = y\n if a == 4 and H >= y:\n H = y\n\n if h >= H or w >= W:\n print(0)\n else:\n print((H - h) * (W - w))",
"main",
"if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n\n ",
"os.getenv(\"LOCAL\")",
"os.getenv",
"os",
"getenv",
"\"LOCAL\"",
"sys.stdin = open(\"input.txt\", \"r\")",
"sys.stdin",
"sys",
"stdin",
"open(\"input.txt\", \"r\")",
"open",
"\"input.txt\"",
"\"r\"",
"W, H, N = il()",
"W",
"il()",
"il",
"H",
"N",
"w, h = 0, 0",
"w",
"0",
"h",
"0",
"for _ in range(N):\n x, y, a = il()\n if a == 1 and w <= x:\n w = x\n if a == 2 and W >= x:\n W = x\n if a == 3 and h <= y:\n h = y\n if a == 4 and H >= y:\n H = y\n\n ",
"_",
"range(N)",
"range",
"N",
"x, y, a = il()",
"x",
"il()",
"il",
"y",
"a",
"if a == 1 and w <= x:\n w = x\n ",
"a == 1 and w <= x",
"a == 1",
"a",
"1",
"w <= x",
"w",
"x",
"w = x",
"w",
"x",
"if a == 2 and W >= x:\n W = x\n ",
"a == 2 and W >= x",
"a == 2",
"a",
"2",
"W >= x",
"W",
"x",
"W = x",
"W",
"x",
"if a == 3 and h <= y:\n h = y\n ",
"a == 3 and h <= y",
"a == 3",
"a",
"3",
"h <= y",
"h",
"y",
"h = y",
"h",
"y",
"if a == 4 and H >= y:\n H = y\n\n ",
"a == 4 and H >= y",
"a == 4",
"a",
"4",
"H >= y",
"H",
"y",
"H = y",
"H",
"y",
"if h >= H or w >= W:\n print(0)\n else:\n print((H - h) * (W - w))",
"h >= H or w >= W",
"h >= H",
"h",
"H",
"w >= W",
"w",
"W",
"print(0)",
"print",
"0",
"print((H - h) * (W - w))",
"print",
"(H - h) * (W - w)",
"H - h",
"H",
"h",
"W - w",
"W",
"w",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"ii = lambda: int(sys.stdin.buffer.readline().rstrip())",
"lambda: int(sys.stdin.buffer.readline().rstrip())",
"ii",
"iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]",
"lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]",
"iln",
"iss = lambda: sys.stdin.buffer.readline().decode().rstrip()",
"lambda: sys.stdin.buffer.readline().decode().rstrip()",
"iss",
"MAX = float('inf')",
"float('inf')",
"MAX",
"def main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n\n W, H, N = il()\n w, h = 0, 0\n for _ in range(N):\n x, y, a = il()\n if a == 1 and w <= x:\n w = x\n if a == 2 and W >= x:\n W = x\n if a == 3 and h <= y:\n h = y\n if a == 4 and H >= y:\n H = y\n\n if h >= H or w >= W:\n print(0)\n else:\n print((H - h) * (W - w))",
"def main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n\n W, H, N = il()\n w, h = 0, 0\n for _ in range(N):\n x, y, a = il()\n if a == 1 and w <= x:\n w = x\n if a == 2 and W >= x:\n W = x\n if a == 3 and h <= y:\n h = y\n if a == 4 and H >= y:\n H = y\n\n if h >= H or w >= W:\n print(0)\n else:\n print((H - h) * (W - w))",
"main",
"lcm = lambda x, y: (x * y) // math.gcd(x, y)",
"lambda x, y: (x * y) // math.gcd(x, y)",
"lcm",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))",
"lambda: list(map(float, sys.stdin.buffer.readline().split()))",
"fl",
"isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]",
"lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]",
"isn",
"il = lambda: list(map(int, sys.stdin.buffer.readline().split()))",
"lambda: list(map(int, sys.stdin.buffer.readline().split()))",
"il",
"sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))",
"lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))",
"sl"
] |
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]
lcm = lambda x, y: (x * y) // math.gcd(x, y)
MOD = 10 ** 9 + 7
MAX = float('inf')
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
W, H, N = il()
w, h = 0, 0
for _ in range(N):
x, y, a = il()
if a == 1 and w <= x:
w = x
if a == 2 and W >= x:
W = x
if a == 3 and h <= y:
h = y
if a == 4 and H >= y:
H = y
if h >= H or w >= W:
print(0)
else:
print((H - h) * (W - w))
if __name__ == '__main__':
main()
|
[
7,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
17,
13,
17,
28,
13,
4,
13,
13,
14,
2,
18,
18,
13,
13,
17,
17,
0,
13,
4,
13,
13,
18,
18,
13,
13,
17,
14,
2,
18,
18,
13,
13,
17,
17,
0,
13,
4,
13,
13,
18,
18,
13,
13,
17,
14,
2,
18,
18,
13,
13,
17,
17,
0,
13,
4,
13,
13,
18,
18,
13,
13,
17,
14,
2,
18,
18,
13,
13,
17,
17,
0,
13,
4,
13,
13,
18,
18,
13,
13,
17,
4,
13,
2,
4,
13,
17,
2,
13,
13,
4,
13,
17,
2,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
5,
13
],
[
5,
14
],
[
18,
17
],
[
14,
20
],
[
34,
33
],
[
37,
36
],
[
39,
38
],
[
42,
41
],
[
14,
44
],
[
33,
49
],
[
41,
50
],
[
55,
54
],
[
36,
57
],
[
54,
57
],
[
33,
60
],
[
41,
61
],
[
33,
67
],
[
41,
68
],
[
73,
72
],
[
4,
75
],
[
72,
75
],
[
33,
78
],
[
41,
79
],
[
33,
85
],
[
41,
86
],
[
91,
90
],
[
38,
93
],
[
90,
93
],
[
33,
96
],
[
41,
97
],
[
33,
103
],
[
41,
104
],
[
109,
108
],
[
13,
111
],
[
108,
111
],
[
33,
114
],
[
41,
115
],
[
72,
124
],
[
4,
124
],
[
54,
125
],
[
36,
125
],
[
108,
130
],
[
13,
130
],
[
90,
131
],
[
38,
131
],
[
140,
137
]
] |
[
"#!/usr/bin/env python3\n\ndef main():\n W, H, N = map(int, input().split())\n xya = [list(map(int, input().split())) for i in range(N)]\n a, b = 0, 0\n for i in range(N):\n if xya[i][2] == 1:\n a = max(a, xya[i][0])\n elif xya[i][2] == 2:\n W = min(W, xya[i][0])\n elif xya[i][2] == 3:\n b = max(b, xya[i][1])\n elif xya[i][2] == 4:\n H = min(H, xya[i][1])\n print(max(0, W - a) * max(0, H - b))\n\n\nif __name__ == \"__main__\":\n main()",
"def main():\n W, H, N = map(int, input().split())\n xya = [list(map(int, input().split())) for i in range(N)]\n a, b = 0, 0\n for i in range(N):\n if xya[i][2] == 1:\n a = max(a, xya[i][0])\n elif xya[i][2] == 2:\n W = min(W, xya[i][0])\n elif xya[i][2] == 3:\n b = max(b, xya[i][1])\n elif xya[i][2] == 4:\n H = min(H, xya[i][1])\n print(max(0, W - a) * max(0, H - b))",
"main",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"list(map(int, input().split())) for i in range(N)",
"for i in range(N)",
"i",
"range(N)",
"range",
"N",
"for i in range(N)",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"xya = [list(map(int, input().split())) for i in range(N)]",
"xya",
"[list(map(int, input().split())) for i in range(N)]",
"a, b = 0, 0",
"a",
"0",
"b",
"0",
"for i in range(N):\n if xya[i][2] == 1:\n a = max(a, xya[i][0])\n elif xya[i][2] == 2:\n W = min(W, xya[i][0])\n elif xya[i][2] == 3:\n b = max(b, xya[i][1])\n elif xya[i][2] == 4:\n H = min(H, xya[i][1])\n ",
"i",
"range(N)",
"range",
"N",
"if xya[i][2] == 1:\n a = max(a, xya[i][0])\n elif xya[i][2] == 2:\n W = min(W, xya[i][0])\n elif xya[i][2] == 3:\n b = max(b, xya[i][1])\n elif xya[i][2] == 4:\n H = min(H, xya[i][1])\n ",
"xya[i][2] == 1",
"xya[i][2]",
"[i]",
"xya",
"i",
"2",
"1",
"a = max(a, xya[i][0])",
"a",
"max(a, xya[i][0])",
"max",
"a",
"xya[i][0]",
"[i]",
"xya",
"i",
"0",
"elif xya[i][2] == 2:\n W = min(W, xya[i][0])\n ",
"xya[i][2] == 2",
"xya[i][2]",
"[i]",
"xya",
"i",
"2",
"2",
"W = min(W, xya[i][0])",
"W",
"min(W, xya[i][0])",
"min",
"W",
"xya[i][0]",
"[i]",
"xya",
"i",
"0",
"elif xya[i][2] == 3:\n b = max(b, xya[i][1])\n ",
"xya[i][2] == 3",
"xya[i][2]",
"[i]",
"xya",
"i",
"2",
"3",
"b = max(b, xya[i][1])",
"b",
"max(b, xya[i][1])",
"max",
"b",
"xya[i][1]",
"[i]",
"xya",
"i",
"1",
"elif xya[i][2] == 4:\n H = min(H, xya[i][1])\n ",
"xya[i][2] == 4",
"xya[i][2]",
"[i]",
"xya",
"i",
"2",
"4",
"H = min(H, xya[i][1])",
"H",
"min(H, xya[i][1])",
"min",
"H",
"xya[i][1]",
"[i]",
"xya",
"i",
"1",
"print(max(0, W - a) * max(0, H - b))",
"print",
"max(0, W - a) * max(0, H - b)",
"max(0, W - a)",
"max",
"0",
"W - a",
"W",
"a",
"max(0, H - b)",
"max",
"0",
"H - b",
"H",
"b",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n W, H, N = map(int, input().split())\n xya = [list(map(int, input().split())) for i in range(N)]\n a, b = 0, 0\n for i in range(N):\n if xya[i][2] == 1:\n a = max(a, xya[i][0])\n elif xya[i][2] == 2:\n W = min(W, xya[i][0])\n elif xya[i][2] == 3:\n b = max(b, xya[i][1])\n elif xya[i][2] == 4:\n H = min(H, xya[i][1])\n print(max(0, W - a) * max(0, H - b))",
"def main():\n W, H, N = map(int, input().split())\n xya = [list(map(int, input().split())) for i in range(N)]\n a, b = 0, 0\n for i in range(N):\n if xya[i][2] == 1:\n a = max(a, xya[i][0])\n elif xya[i][2] == 2:\n W = min(W, xya[i][0])\n elif xya[i][2] == 3:\n b = max(b, xya[i][1])\n elif xya[i][2] == 4:\n H = min(H, xya[i][1])\n print(max(0, W - a) * max(0, H - b))",
"main"
] |
#!/usr/bin/env python3
def main():
W, H, N = map(int, input().split())
xya = [list(map(int, input().split())) for i in range(N)]
a, b = 0, 0
for i in range(N):
if xya[i][2] == 1:
a = max(a, xya[i][0])
elif xya[i][2] == 2:
W = min(W, xya[i][0])
elif xya[i][2] == 3:
b = max(b, xya[i][1])
elif xya[i][2] == 4:
H = min(H, xya[i][1])
print(max(0, W - a) * max(0, H - b))
if __name__ == "__main__":
main()
|
[
7,
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,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
28,
13,
4,
13,
13,
0,
18,
13,
13,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
13,
0,
18,
13,
13,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
0,
18,
13,
13,
17,
28,
13,
4,
13,
13,
13,
0,
18,
13,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
18,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
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
] |
[
[
139,
2
],
[
139,
11
],
[
139,
12
],
[
142,
14
],
[
140,
18
],
[
148,
20
],
[
134,
24
],
[
27,
26
],
[
128,
29
],
[
151,
31
],
[
151,
40
],
[
151,
41
],
[
152,
44
],
[
48,
47
],
[
137,
50
],
[
55,
52
],
[
149,
53
],
[
47,
54
],
[
152,
58
],
[
62,
61
],
[
137,
64
],
[
134,
65
],
[
70,
67
],
[
149,
68
],
[
61,
69
],
[
152,
73
],
[
77,
76
],
[
131,
79
],
[
84,
81
],
[
143,
82
],
[
76,
83
],
[
87,
86
],
[
131,
89
],
[
140,
90
],
[
95,
92
],
[
143,
93
],
[
86,
94
],
[
145,
97
],
[
101,
100
],
[
134,
103
],
[
106,
105
],
[
140,
108
],
[
143,
112
],
[
105,
113
],
[
149,
115
],
[
100,
116
],
[
124,
118
],
[
125,
122
],
[
146,
122
],
[
124,
125
],
[
139,
128
],
[
151,
131
],
[
139,
134
],
[
151,
137
],
[
139,
140
],
[
142,
143
],
[
145,
146
],
[
148,
149
],
[
151,
152
]
] |
[
"W,H,n = map(int,input().split())\nH_ls = [1] * H\nW_ls = [1] * W\nfor i in range(n):\n x,y,a = map(int,input().split())\n if a == 1:\n for i in range(x):\n W_ls[i] = 0\n elif a == 2:\n for i in range(x,W):\n W_ls[i] = 0\n elif a == 3:\n for i in range(y):\n H_ls[i] = 0\n else:\n for i in range(y,H):\n H_ls[i] = 0\nans = 0\nfor x in range(W):\n for y in range(H):\n if H_ls[y] and W_ls[x]:\n ans += 1\nprint(ans)\n\n",
"W,H,n = map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"n",
"H_ls = [1] * H",
"H_ls",
"[1] * H",
"[1]",
"1",
"H",
"W_ls = [1] * W",
"W_ls",
"[1] * W",
"[1]",
"1",
"W",
"for i in range(n):\n x,y,a = map(int,input().split())\n if a == 1:\n for i in range(x):\n W_ls[i] = 0\n elif a == 2:\n for i in range(x,W):\n W_ls[i] = 0\n elif a == 3:\n for i in range(y):\n H_ls[i] = 0\n else:\n for i in range(y,H):\n H_ls[i] = 0",
"i",
"range(n)",
"range",
"n",
"x,y,a = map(int,input().split())",
"x",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"a",
"if a == 1:\n for i in range(x):\n W_ls[i] = 0\n elif a == 2:\n for i in range(x,W):\n W_ls[i] = 0\n elif a == 3:\n for i in range(y):\n H_ls[i] = 0\n else:\n for i in range(y,H):\n H_ls[i] = 0",
"a == 1",
"a",
"1",
"for i in range(x):\n W_ls[i] = 0\n ",
"i",
"range(x)",
"range",
"x",
"W_ls[i] = 0",
"W_ls[i]",
"W_ls",
"i",
"0",
"elif a == 2:\n for i in range(x,W):\n W_ls[i] = 0\n ",
"a == 2",
"a",
"2",
"for i in range(x,W):\n W_ls[i] = 0\n ",
"i",
"range(x,W)",
"range",
"x",
"W",
"W_ls[i] = 0",
"W_ls[i]",
"W_ls",
"i",
"0",
"elif a == 3:\n for i in range(y):\n H_ls[i] = 0\n ",
"a == 3",
"a",
"3",
"for i in range(y):\n H_ls[i] = 0\n ",
"i",
"range(y)",
"range",
"y",
"H_ls[i] = 0",
"H_ls[i]",
"H_ls",
"i",
"0",
"for i in range(y,H):\n H_ls[i] = 0",
"i",
"range(y,H)",
"range",
"y",
"H",
"H_ls[i] = 0",
"H_ls[i]",
"H_ls",
"i",
"0",
"ans = 0",
"ans",
"0",
"for x in range(W):\n for y in range(H):\n if H_ls[y] and W_ls[x]:\n ans += 1",
"x",
"range(W)",
"range",
"W",
"for y in range(H):\n if H_ls[y] and W_ls[x]:\n ans += 1",
"y",
"range(H)",
"range",
"H",
"if H_ls[y] and W_ls[x]:\n ans += 1",
"H_ls[y] and W_ls[x]",
"H_ls[y]",
"H_ls",
"y",
"W_ls[x]",
"W_ls",
"x",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"ans += 1",
"1",
"ans",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"y,a = map(int,input().split())",
"map(int,input().split())",
"y",
"W,H,n = map(int,input().split())",
"map(int,input().split())",
"W",
"x,y,a = map(int,input().split())",
"map(int,input().split())",
"x",
"H,n = map(int,input().split())",
"map(int,input().split())",
"H",
"H_ls = [1] * H",
"[1] * H",
"H_ls",
"ans = 0",
"0",
"ans",
"W_ls = [1] * W",
"[1] * W",
"W_ls",
"a = map(int,input().split())",
"map(int,input().split())",
"a"
] |
W,H,n = map(int,input().split())
H_ls = [1] * H
W_ls = [1] * W
for i in range(n):
x,y,a = map(int,input().split())
if a == 1:
for i in range(x):
W_ls[i] = 0
elif a == 2:
for i in range(x,W):
W_ls[i] = 0
elif a == 3:
for i in range(y):
H_ls[i] = 0
else:
for i in range(y,H):
H_ls[i] = 0
ans = 0
for x in range(W):
for y in range(H):
if H_ls[y] and W_ls[x]:
ans += 1
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
17,
13,
0,
13,
39,
17,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
13,
14,
2,
13,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
13,
14,
2,
13,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
13,
0,
18,
13,
17,
4,
13,
18,
13,
17,
13,
14,
2,
40,
18,
13,
17,
18,
13,
17,
40,
18,
13,
17,
18,
13,
17,
4,
13,
17,
4,
13,
2,
2,
18,
13,
17,
18,
13,
17,
2,
18,
13,
17,
18,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
135,
2
],
[
135,
11
],
[
135,
12
],
[
141,
14
],
[
138,
19
],
[
25,
24
],
[
133,
27
],
[
150,
29
],
[
150,
38
],
[
150,
39
],
[
148,
42
],
[
48,
45
],
[
142,
46
],
[
142,
51
],
[
151,
53
],
[
148,
56
],
[
62,
59
],
[
142,
60
],
[
142,
65
],
[
151,
67
],
[
148,
70
],
[
76,
73
],
[
139,
74
],
[
139,
79
],
[
145,
81
],
[
86,
83
],
[
139,
84
],
[
139,
89
],
[
145,
91
],
[
142,
96
],
[
142,
99
],
[
139,
103
],
[
139,
106
],
[
142,
116
],
[
142,
119
],
[
139,
123
],
[
139,
126
],
[
135,
130
],
[
135,
133
],
[
135,
136
],
[
138,
139
],
[
141,
142
],
[
150,
145
],
[
150,
148
],
[
150,
151
]
] |
[
"W, H, N = map(int, input().split())\nregion_w = [0, W]\nregion_h = [0, H]\n\nfor i in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n region_w[0] = max(region_w[0], x)\n elif a == 2:\n region_w[1] = min(region_w[1], x)\n elif a == 3:\n region_h[0] = max(region_h[0], y)\n else:\n region_h[1] = min(region_h[1], y)\n\nif (region_w[0] >= region_w[1]) or (region_h[0] >= region_h[1]):\n print(0)\nelse:\n print((region_w[1]-region_w[0])*(region_h[1]- region_h[0]))",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"region_w = [0, W]",
"region_w",
"[0, W]",
"0",
"W",
"region_h = [0, H]",
"region_h",
"[0, H]",
"0",
"H",
"for i in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n region_w[0] = max(region_w[0], x)\n elif a == 2:\n region_w[1] = min(region_w[1], x)\n elif a == 3:\n region_h[0] = max(region_h[0], y)\n else:\n region_h[1] = min(region_h[1], y)",
"i",
"range(N)",
"range",
"N",
"x, y, a = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"a",
"if a == 1:\n region_w[0] = max(region_w[0], x)\n elif a == 2:\n region_w[1] = min(region_w[1], x)\n elif a == 3:\n region_h[0] = max(region_h[0], y)\n else:\n region_h[1] = min(region_h[1], y)",
"a == 1",
"a",
"1",
"region_w[0] = max(region_w[0], x)",
"region_w[0]",
"region_w",
"0",
"max(region_w[0], x)",
"max",
"region_w[0]",
"region_w",
"0",
"x",
"elif a == 2:\n region_w[1] = min(region_w[1], x)\n ",
"a == 2",
"a",
"2",
"region_w[1] = min(region_w[1], x)",
"region_w[1]",
"region_w",
"1",
"min(region_w[1], x)",
"min",
"region_w[1]",
"region_w",
"1",
"x",
"elif a == 3:\n region_h[0] = max(region_h[0], y)\n ",
"a == 3",
"a",
"3",
"region_h[0] = max(region_h[0], y)",
"region_h[0]",
"region_h",
"0",
"max(region_h[0], y)",
"max",
"region_h[0]",
"region_h",
"0",
"y",
"region_h[1] = min(region_h[1], y)",
"region_h[1]",
"region_h",
"1",
"min(region_h[1], y)",
"min",
"region_h[1]",
"region_h",
"1",
"y",
"if (region_w[0] >= region_w[1]) or (region_h[0] >= region_h[1]):\n print(0)\nelse:\n print((region_w[1]-region_w[0])*(region_h[1]- region_h[0]))",
"(region_w[0] >= region_w[1]) or (region_h[0] >= region_h[1])",
"region_w[0] >= region_w[1]",
"region_w[0]",
"region_w",
"0",
"region_w[1]",
"region_w",
"1",
"region_h[0] >= region_h[1]",
"region_h[0]",
"region_h",
"0",
"region_h[1]",
"region_h",
"1",
"print(0)",
"print",
"0",
"print((region_w[1]-region_w[0])*(region_h[1]- region_h[0]))",
"print",
"(region_w[1]-region_w[0])*(region_h[1]- region_h[0])",
"region_w[1]-region_w[0]",
"region_w[1]",
"region_w",
"1",
"region_w[0]",
"region_w",
"0",
"region_h[1]- region_h[0]",
"region_h[1]",
"region_h",
"1",
"region_h[0]",
"region_h",
"0",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"region_h = [0, H]",
"[0, H]",
"region_h",
"region_w = [0, W]",
"[0, W]",
"region_w",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x"
] |
W, H, N = map(int, input().split())
region_w = [0, W]
region_h = [0, H]
for i in range(N):
x, y, a = map(int, input().split())
if a == 1:
region_w[0] = max(region_w[0], x)
elif a == 2:
region_w[1] = min(region_w[1], x)
elif a == 3:
region_h[0] = max(region_h[0], y)
else:
region_h[1] = min(region_h[1], y)
if (region_w[0] >= region_w[1]) or (region_h[0] >= region_h[1]):
print(0)
else:
print((region_w[1]-region_w[0])*(region_h[1]- region_h[0]))
|
[
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,
13,
14,
2,
2,
13,
17,
2,
13,
17,
4,
18,
13,
13,
39,
13,
13,
4,
18,
13,
13,
39,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
18,
13,
13,
13,
14,
2,
13,
17,
14,
2,
13,
13,
0,
13,
17,
3,
14,
2,
13,
17,
14,
40,
13,
13,
0,
13,
17,
3,
14,
2,
13,
17,
14,
2,
13,
13,
0,
13,
17,
3,
14,
40,
13,
13,
0,
13,
17,
3,
14,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
39,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13
] |
[
[
167,
2
],
[
167,
11
],
[
167,
12
],
[
152,
14
],
[
18,
17
],
[
144,
20
],
[
173,
22
],
[
173,
31
],
[
173,
32
],
[
165,
36
],
[
165,
39
],
[
153,
43
],
[
153,
50
],
[
176,
56
],
[
60,
59
],
[
138,
62
],
[
65,
64
],
[
168,
67
],
[
155,
69
],
[
73,
72
],
[
144,
75
],
[
179,
77
],
[
153,
79
],
[
72,
80
],
[
179,
81
],
[
180,
84
],
[
64,
88
],
[
141,
89
],
[
158,
91
],
[
180,
96
],
[
64,
100
],
[
141,
101
],
[
149,
103
],
[
180,
108
],
[
59,
112
],
[
141,
113
],
[
182,
115
],
[
59,
120
],
[
141,
121
],
[
161,
123
],
[
162,
128
],
[
183,
128
],
[
150,
128
],
[
159,
128
],
[
156,
128
],
[
146,
131
],
[
147,
135
],
[
177,
135
],
[
167,
138
],
[
179,
141
],
[
167,
144
],
[
146,
147
],
[
149,
150
],
[
152,
153
],
[
155,
156
],
[
158,
159
],
[
161,
162
],
[
173,
165
],
[
167,
168
],
[
173,
171
],
[
173,
174
],
[
176,
177
],
[
179,
180
],
[
182,
183
]
] |
[
"w,h,n=map(int,input().split())\nlst=[]\nfor _ in range(n):\n x,y,a=map(int,input().split())\n if a==1 or a==2:\n lst.append([x,a])\n else:\n lst.append([y,a])\nanswer=0\nfor i in range(h):\n for j in range(w):\n ans=True\n for k in range(n):\n nuri,c=lst[k]\n if c==1:\n if j<nuri:\n ans=False\n break\n elif c==2:\n if j>=nuri:\n ans=False\n break\n elif c==3:\n if i<nuri:\n ans=False\n break\n else:\n if i>=nuri:\n ans=False\n break\n if ans==True:\n answer+=1\nprint(answer)",
"w,h,n=map(int,input().split())",
"w",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"lst=[]",
"lst",
"[]",
"for _ in range(n):\n x,y,a=map(int,input().split())\n if a==1 or a==2:\n lst.append([x,a])\n else:\n lst.append([y,a])",
"_",
"range(n)",
"range",
"n",
"x,y,a=map(int,input().split())",
"x",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"a",
"if a==1 or a==2:\n lst.append([x,a])\n else:\n lst.append([y,a])",
"a==1 or a==2",
"a==1",
"a",
"1",
"a==2",
"a",
"2",
"lst.append([x,a])",
"lst.append",
"lst",
"append",
"[x,a]",
"x",
"a",
"lst.append([y,a])",
"lst.append",
"lst",
"append",
"[y,a]",
"y",
"a",
"answer=0",
"answer",
"0",
"for i in range(h):\n for j in range(w):\n ans=True\n for k in range(n):\n nuri,c=lst[k]\n if c==1:\n if j<nuri:\n ans=False\n break\n elif c==2:\n if j>=nuri:\n ans=False\n break\n elif c==3:\n if i<nuri:\n ans=False\n break\n else:\n if i>=nuri:\n ans=False\n break\n if ans==True:\n answer+=1",
"i",
"range(h)",
"range",
"h",
"for j in range(w):\n ans=True\n for k in range(n):\n nuri,c=lst[k]\n if c==1:\n if j<nuri:\n ans=False\n break\n elif c==2:\n if j>=nuri:\n ans=False\n break\n elif c==3:\n if i<nuri:\n ans=False\n break\n else:\n if i>=nuri:\n ans=False\n break\n if ans==True:\n answer+=1",
"j",
"range(w)",
"range",
"w",
"ans=True",
"ans",
"True",
"for k in range(n):\n nuri,c=lst[k]\n if c==1:\n if j<nuri:\n ans=False\n break\n elif c==2:\n if j>=nuri:\n ans=False\n break\n elif c==3:\n if i<nuri:\n ans=False\n break\n else:\n if i>=nuri:\n ans=False\n break\n ",
"k",
"range(n)",
"range",
"n",
"nuri,c=lst[k]",
"nuri",
"lst[k]",
"lst",
"k",
"c",
"if c==1:\n if j<nuri:\n ans=False\n break\n elif c==2:\n if j>=nuri:\n ans=False\n break\n elif c==3:\n if i<nuri:\n ans=False\n break\n else:\n if i>=nuri:\n ans=False\n break\n ",
"c==1",
"c",
"1",
"if j<nuri:\n ans=False\n break\n ",
"j<nuri",
"j",
"nuri",
"ans=False",
"ans",
"False",
"break",
"elif c==2:\n if j>=nuri:\n ans=False\n break\n ",
"c==2",
"c",
"2",
"if j>=nuri:\n ans=False\n break\n ",
"j>=nuri",
"j",
"nuri",
"ans=False",
"ans",
"False",
"break",
"elif c==3:\n if i<nuri:\n ans=False\n break\n ",
"c==3",
"c",
"3",
"if i<nuri:\n ans=False\n break\n ",
"i<nuri",
"i",
"nuri",
"ans=False",
"ans",
"False",
"break",
"if i>=nuri:\n ans=False\n break\n ",
"i>=nuri",
"i",
"nuri",
"ans=False",
"ans",
"False",
"break",
"if ans==True:\n answer+=1",
"ans==True",
"ans",
"True",
"answer+=1",
"answer",
"1",
"print(answer)",
"print",
"answer",
"h,n=map(int,input().split())",
"map(int,input().split())",
"h",
"nuri,c=lst[k]",
"lst[k]",
"nuri",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"answer+=1",
"1",
"answer",
"ans=False",
"False",
"ans",
"lst=[]",
"[]",
"lst",
"ans=True",
"True",
"ans",
"ans=False",
"False",
"ans",
"ans=False",
"False",
"ans",
"a=map(int,input().split())",
"map(int,input().split())",
"a",
"w,h,n=map(int,input().split())",
"map(int,input().split())",
"w",
"x,y,a=map(int,input().split())",
"map(int,input().split())",
"x",
"y,a=map(int,input().split())",
"map(int,input().split())",
"y",
"answer=0",
"0",
"answer",
"c=lst[k]",
"lst[k]",
"c",
"ans=False",
"False",
"ans"
] |
w,h,n=map(int,input().split())
lst=[]
for _ in range(n):
x,y,a=map(int,input().split())
if a==1 or a==2:
lst.append([x,a])
else:
lst.append([y,a])
answer=0
for i in range(h):
for j in range(w):
ans=True
for k in range(n):
nuri,c=lst[k]
if c==1:
if j<nuri:
ans=False
break
elif c==2:
if j>=nuri:
ans=False
break
elif c==3:
if i<nuri:
ans=False
break
else:
if i>=nuri:
ans=False
break
if ans==True:
answer+=1
print(answer)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
17,
13,
0,
13,
39,
17,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
13,
14,
2,
13,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
13,
14,
2,
13,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
13,
14,
2,
13,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
13,
4,
13,
4,
13,
17,
2,
4,
13,
17,
2,
18,
13,
17,
18,
13,
17,
4,
13,
17,
2,
18,
13,
17,
18,
13,
17,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13
] |
[
[
132,
2
],
[
132,
11
],
[
132,
12
],
[
126,
14
],
[
138,
19
],
[
25,
24
],
[
133,
27
],
[
144,
29
],
[
144,
38
],
[
144,
39
],
[
145,
42
],
[
48,
45
],
[
127,
46
],
[
127,
51
],
[
136,
53
],
[
145,
56
],
[
62,
59
],
[
127,
60
],
[
127,
65
],
[
136,
67
],
[
145,
70
],
[
76,
73
],
[
139,
74
],
[
139,
79
],
[
142,
81
],
[
145,
84
],
[
90,
87
],
[
139,
88
],
[
139,
93
],
[
142,
95
],
[
127,
107
],
[
127,
110
],
[
139,
117
],
[
139,
120
],
[
132,
124
],
[
126,
127
],
[
132,
130
],
[
132,
133
],
[
144,
136
],
[
138,
139
],
[
144,
142
],
[
144,
145
]
] |
[
"w, h, n = map(int, input().split())\n\nsx = [0, w]\nsy = [0, h]\n\nfor i in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n sx[0] = max(sx[0], x)\n if a == 2:\n sx[1] = min(sx[1], x)\n if a == 3:\n sy[0] = max(sy[0], y)\n if a == 4:\n sy[1] = min(sy[1], y)\n\nprint(max(0, max(0, (sx[1] - sx[0])) * max(0, (sy[1] - sy[0]))))",
"w, h, n = map(int, input().split())",
"w",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"sx = [0, w]",
"sx",
"[0, w]",
"0",
"w",
"sy = [0, h]",
"sy",
"[0, h]",
"0",
"h",
"for i in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n sx[0] = max(sx[0], x)\n if a == 2:\n sx[1] = min(sx[1], x)\n if a == 3:\n sy[0] = max(sy[0], y)\n if a == 4:\n sy[1] = min(sy[1], y)",
"i",
"range(n)",
"range",
"n",
"x, y, a = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"a",
"if a == 1:\n sx[0] = max(sx[0], x)\n ",
"a == 1",
"a",
"1",
"sx[0] = max(sx[0], x)",
"sx[0]",
"sx",
"0",
"max(sx[0], x)",
"max",
"sx[0]",
"sx",
"0",
"x",
"if a == 2:\n sx[1] = min(sx[1], x)\n ",
"a == 2",
"a",
"2",
"sx[1] = min(sx[1], x)",
"sx[1]",
"sx",
"1",
"min(sx[1], x)",
"min",
"sx[1]",
"sx",
"1",
"x",
"if a == 3:\n sy[0] = max(sy[0], y)\n ",
"a == 3",
"a",
"3",
"sy[0] = max(sy[0], y)",
"sy[0]",
"sy",
"0",
"max(sy[0], y)",
"max",
"sy[0]",
"sy",
"0",
"y",
"if a == 4:\n sy[1] = min(sy[1], y)",
"a == 4",
"a",
"4",
"sy[1] = min(sy[1], y)",
"sy[1]",
"sy",
"1",
"min(sy[1], y)",
"min",
"sy[1]",
"sy",
"1",
"y",
"print(max(0, max(0, (sx[1] - sx[0])) * max(0, (sy[1] - sy[0]))))",
"print",
"max(0, max(0, (sx[1] - sx[0])) * max(0, (sy[1] - sy[0])))",
"max",
"0",
"max(0, (sx[1] - sx[0])) * max(0, (sy[1] - sy[0]))",
"max(0, (sx[1] - sx[0]))",
"max",
"0",
"sx[1] - sx[0]",
"sx[1]",
"sx",
"1",
"sx[0]",
"sx",
"0",
"max(0, (sy[1] - sy[0]))",
"max",
"0",
"sy[1] - sy[0]",
"sy[1]",
"sy",
"1",
"sy[0]",
"sy",
"0",
"w, h, n = map(int, input().split())",
"map(int, input().split())",
"w",
"sx = [0, w]",
"[0, w]",
"sx",
"h, n = map(int, input().split())",
"map(int, input().split())",
"h",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"sy = [0, h]",
"[0, h]",
"sy",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"a = map(int, input().split())",
"map(int, input().split())",
"a"
] |
w, h, n = map(int, input().split())
sx = [0, w]
sy = [0, h]
for i in range(n):
x, y, a = map(int, input().split())
if a == 1:
sx[0] = max(sx[0], x)
if a == 2:
sx[1] = min(sx[1], x)
if a == 3:
sy[0] = max(sy[0], y)
if a == 4:
sy[1] = min(sy[1], y)
print(max(0, max(0, (sx[1] - sx[0])) * max(0, (sy[1] - sy[0]))))
|
[
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,
17,
13,
13,
0,
13,
17,
13,
13,
28,
13,
4,
13,
13,
0,
13,
18,
18,
13,
13,
17,
13,
18,
18,
13,
13,
17,
14,
2,
18,
18,
13,
13,
17,
17,
14,
2,
13,
13,
0,
13,
13,
14,
2,
18,
18,
13,
13,
17,
17,
14,
2,
13,
13,
0,
13,
13,
14,
2,
13,
17,
4,
13,
17,
4,
13,
14,
2,
18,
18,
13,
13,
17,
17,
14,
2,
13,
13,
0,
13,
13,
14,
2,
18,
18,
13,
13,
17,
17,
14,
2,
13,
13,
0,
13,
13,
14,
2,
13,
17,
4,
13,
17,
4,
13,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
14,
40,
2,
13,
13,
17,
4,
13,
17,
4,
13,
2,
13,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
18,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
13,
13,
10,
13,
13
] |
[
[
199,
2
],
[
199,
11
],
[
199,
12
],
[
175,
14
],
[
18,
17
],
[
173,
20
],
[
176,
23
],
[
166,
36
],
[
208,
38
],
[
200,
39
],
[
205,
41
],
[
193,
43
],
[
188,
44
],
[
47,
46
],
[
173,
49
],
[
190,
51
],
[
176,
54
],
[
46,
55
],
[
184,
57
],
[
176,
60
],
[
46,
61
],
[
176,
67
],
[
46,
68
],
[
167,
73
],
[
170,
73
],
[
191,
74
],
[
169,
76
],
[
191,
77
],
[
176,
82
],
[
46,
83
],
[
209,
88
],
[
203,
88
],
[
191,
89
],
[
202,
91
],
[
191,
92
],
[
203,
95
],
[
209,
95
],
[
176,
106
],
[
46,
107
],
[
206,
112
],
[
212,
112
],
[
185,
113
],
[
211,
115
],
[
185,
116
],
[
176,
121
],
[
46,
122
],
[
194,
127
],
[
197,
127
],
[
185,
128
],
[
196,
130
],
[
185,
131
],
[
197,
134
],
[
194,
134
],
[
178,
142
],
[
203,
144
],
[
209,
144
],
[
170,
145
],
[
167,
145
],
[
181,
147
],
[
197,
149
],
[
194,
149
],
[
212,
150
],
[
206,
150
],
[
182,
154
],
[
179,
155
],
[
182,
163
],
[
179,
164
],
[
166,
167
],
[
191,
169
],
[
169,
170
],
[
199,
173
],
[
175,
176
],
[
178,
179
],
[
181,
182
],
[
184,
185
],
[
199,
188
],
[
190,
191
],
[
188,
193
],
[
193,
194
],
[
185,
196
],
[
196,
197
],
[
199,
200
],
[
191,
202
],
[
202,
203
],
[
205,
206
],
[
200,
208
],
[
208,
209
],
[
185,
211
],
[
211,
212
]
] |
[
"W, H, N = map(int,input().split())\n\nlst = []\nfor i in range(N):\n lst.append(list(map(int,input().split())))\n\n\nx_left,x_right = 0, W\ny_under, y_up = 0,H\n\nfor i in range(N):\n x,y = lst[i][0], lst[i][1]\n if lst[i][2] == 1:\n if x_left < x: \n x_left = x\n elif lst[i][2] == 2:\n if x_right > x:\n x_right = x\n if x_right == 0:\n print(0)\n exit()\n elif lst[i][2] == 3:\n if y_under < y:\n y_under = y\n elif lst[i][2] == 4:\n if y_up > y:\n y_up = y\n if y_up == 0:\n print(0)\n exit()\n\nyoko = x_right - x_left\ntate = y_up - y_under\nif tate * yoko <= 0:\n print(0)\nelse:\n print(tate * yoko)",
"W, H, N = map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"lst = []",
"lst",
"[]",
"for i in range(N):\n lst.append(list(map(int,input().split())))",
"i",
"range(N)",
"range",
"N",
"lst.append(list(map(int,input().split())))",
"lst.append",
"lst",
"append",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"x_left,x_right = 0, W",
"x_left",
"0",
"x_right",
"W",
"y_under, y_up = 0,H",
"y_under",
"0",
"y_up",
"H",
"for i in range(N):\n x,y = lst[i][0], lst[i][1]\n if lst[i][2] == 1:\n if x_left < x: \n x_left = x\n elif lst[i][2] == 2:\n if x_right > x:\n x_right = x\n if x_right == 0:\n print(0)\n exit()\n elif lst[i][2] == 3:\n if y_under < y:\n y_under = y\n elif lst[i][2] == 4:\n if y_up > y:\n y_up = y\n if y_up == 0:\n print(0)\n exit()",
"i",
"range(N)",
"range",
"N",
"x,y = lst[i][0], lst[i][1]",
"x",
"lst[i][0]",
"[i]",
"lst",
"i",
"0",
"y",
"lst[i][1]",
"[i]",
"lst",
"i",
"1",
"if lst[i][2] == 1:\n if x_left < x: \n x_left = x\n elif lst[i][2] == 2:\n if x_right > x:\n x_right = x\n if x_right == 0:\n print(0)\n exit()\n elif lst[i][2] == 3:\n if y_under < y:\n y_under = y\n elif lst[i][2] == 4:\n if y_up > y:\n y_up = y\n if y_up == 0:\n print(0)\n exit()",
"lst[i][2] == 1",
"lst[i][2]",
"[i]",
"lst",
"i",
"2",
"1",
"if x_left < x: \n x_left = x\n ",
"x_left < x",
"x_left",
"x",
"x_left = x",
"x_left",
"x",
"elif lst[i][2] == 2:\n if x_right > x:\n x_right = x\n if x_right == 0:\n print(0)\n exit()\n ",
"lst[i][2] == 2",
"lst[i][2]",
"[i]",
"lst",
"i",
"2",
"2",
"if x_right > x:\n x_right = x\n if x_right == 0:\n print(0)\n exit()\n ",
"x_right > x",
"x_right",
"x",
"x_right = x",
"x_right",
"x",
"if x_right == 0:\n print(0)\n exit()\n ",
"x_right == 0",
"x_right",
"0",
"print(0)",
"print",
"0",
"exit()",
"exit",
"elif lst[i][2] == 3:\n if y_under < y:\n y_under = y\n ",
"lst[i][2] == 3",
"lst[i][2]",
"[i]",
"lst",
"i",
"2",
"3",
"if y_under < y:\n y_under = y\n ",
"y_under < y",
"y_under",
"y",
"y_under = y",
"y_under",
"y",
"elif lst[i][2] == 4:\n if y_up > y:\n y_up = y\n if y_up == 0:\n print(0)\n exit()",
"lst[i][2] == 4",
"lst[i][2]",
"[i]",
"lst",
"i",
"2",
"4",
"if y_up > y:\n y_up = y\n if y_up == 0:\n print(0)\n exit()",
"y_up > y",
"y_up",
"y",
"y_up = y",
"y_up",
"y",
"if y_up == 0:\n print(0)\n exit()",
"y_up == 0",
"y_up",
"0",
"print(0)",
"print",
"0",
"exit()",
"exit",
"yoko = x_right - x_left",
"yoko",
"x_right - x_left",
"x_right",
"x_left",
"tate = y_up - y_under",
"tate",
"y_up - y_under",
"y_up",
"y_under",
"if tate * yoko <= 0:\n print(0)\nelse:\n print(tate * yoko)",
"tate * yoko <= 0",
"tate * yoko",
"tate",
"yoko",
"0",
"print(0)",
"print",
"0",
"print(tate * yoko)",
"print",
"tate * yoko",
"tate",
"yoko",
"x_left,x_right = 0, W",
"0",
"x_left",
"x_left = x",
"x",
"x_left",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"lst = []",
"[]",
"lst",
"yoko = x_right - x_left",
"x_right - x_left",
"yoko",
"tate = y_up - y_under",
"y_up - y_under",
"tate",
"y = lst[i][0], lst[i][1]",
"lst[i][1]",
"y",
"H, N = map(int,input().split())",
"map(int,input().split())",
"H",
"x,y = lst[i][0], lst[i][1]",
"lst[i][0]",
"x",
"y_up = 0,H",
"H",
"y_up",
"y_up = y",
"y",
"y_up",
"W, H, N = map(int,input().split())",
"map(int,input().split())",
"W",
"x_right = x",
"x",
"x_right",
"y_under, y_up = 0,H",
"0",
"y_under",
"x_right = 0, W",
"W",
"x_right",
"y_under = y",
"y",
"y_under"
] |
W, H, N = map(int,input().split())
lst = []
for i in range(N):
lst.append(list(map(int,input().split())))
x_left,x_right = 0, W
y_under, y_up = 0,H
for i in range(N):
x,y = lst[i][0], lst[i][1]
if lst[i][2] == 1:
if x_left < x:
x_left = x
elif lst[i][2] == 2:
if x_right > x:
x_right = x
if x_right == 0:
print(0)
exit()
elif lst[i][2] == 3:
if y_under < y:
y_under = y
elif lst[i][2] == 4:
if y_up > y:
y_up = y
if y_up == 0:
print(0)
exit()
yoko = x_right - x_left
tate = y_up - y_under
if tate * yoko <= 0:
print(0)
else:
print(tate * yoko)
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
13,
0,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
0,
13,
39,
13,
13,
13,
13,
4,
13,
2,
4,
13,
17,
2,
13,
13,
4,
13,
17,
2,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
39,
13,
10,
13,
13,
10,
4,
13
] |
[
[
139,
4
],
[
163,
11
],
[
140,
20
],
[
163,
22
],
[
163,
23
],
[
145,
25
],
[
136,
28
],
[
160,
31
],
[
164,
32
],
[
154,
34
],
[
122,
35
],
[
38,
37
],
[
134,
40
],
[
142,
42
],
[
140,
51
],
[
142,
53
],
[
142,
54
],
[
119,
57
],
[
148,
60
],
[
143,
63
],
[
146,
64
],
[
149,
64
],
[
119,
67
],
[
127,
70
],
[
143,
73
],
[
161,
74
],
[
128,
74
],
[
119,
77
],
[
130,
80
],
[
125,
83
],
[
137,
84
],
[
131,
84
],
[
119,
87
],
[
151,
90
],
[
125,
93
],
[
155,
94
],
[
152,
94
],
[
157,
96
],
[
128,
109
],
[
161,
109
],
[
149,
110
],
[
146,
110
],
[
152,
115
],
[
155,
115
],
[
131,
116
],
[
137,
116
],
[
142,
119
],
[
163,
122
],
[
142,
125
],
[
127,
128
],
[
130,
131
],
[
163,
134
],
[
136,
137
],
[
139,
140
],
[
142,
143
],
[
145,
146
],
[
148,
149
],
[
151,
152
],
[
122,
154
],
[
154,
155
],
[
157,
158
],
[
164,
160
],
[
160,
161
],
[
163,
164
]
] |
[
"import sys\ninput = sys.stdin.readline\n\nW,H,N = list(map(int,input().split()))\nx0 = 0\ny0 = 0\nx1 = W\ny1 = H\n\nfor i in range(N):\n x,y,a = list(map(int,input().split()))\n\n if a == 1:\n x0 = max(x,x0)\n elif a == 2:\n x1 = min(x,x1)\n elif a == 3:\n y0 = max(y,y0)\n elif a == 4:\n y1 = min(y,y1)\nX = [x0,x1,y0,y1]\n\nprint(max(0,x1-x0)*max(0,y1-y0))",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"W,H,N = list(map(int,input().split()))",
"W",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"x0 = 0",
"x0",
"0",
"y0 = 0",
"y0",
"0",
"x1 = W",
"x1",
"W",
"y1 = H",
"y1",
"H",
"for i in range(N):\n x,y,a = list(map(int,input().split()))\n\n if a == 1:\n x0 = max(x,x0)\n elif a == 2:\n x1 = min(x,x1)\n elif a == 3:\n y0 = max(y,y0)\n elif a == 4:\n y1 = min(y,y1)",
"i",
"range(N)",
"range",
"N",
"x,y,a = list(map(int,input().split()))",
"x",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"a",
"if a == 1:\n x0 = max(x,x0)\n elif a == 2:\n x1 = min(x,x1)\n elif a == 3:\n y0 = max(y,y0)\n elif a == 4:\n y1 = min(y,y1)",
"a == 1",
"a",
"1",
"x0 = max(x,x0)",
"x0",
"max(x,x0)",
"max",
"x",
"x0",
"elif a == 2:\n x1 = min(x,x1)\n ",
"a == 2",
"a",
"2",
"x1 = min(x,x1)",
"x1",
"min(x,x1)",
"min",
"x",
"x1",
"elif a == 3:\n y0 = max(y,y0)\n ",
"a == 3",
"a",
"3",
"y0 = max(y,y0)",
"y0",
"max(y,y0)",
"max",
"y",
"y0",
"elif a == 4:\n y1 = min(y,y1)",
"a == 4",
"a",
"4",
"y1 = min(y,y1)",
"y1",
"min(y,y1)",
"min",
"y",
"y1",
"X = [x0,x1,y0,y1]",
"X",
"[x0,x1,y0,y1]",
"x0",
"x1",
"y0",
"y1",
"print(max(0,x1-x0)*max(0,y1-y0))",
"print",
"max(0,x1-x0)*max(0,y1-y0)",
"max(0,x1-x0)",
"max",
"0",
"x1-x0",
"x1",
"x0",
"max(0,y1-y0)",
"max",
"0",
"y1-y0",
"y1",
"y0",
"a = list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"H,N = list(map(int,input().split()))",
"list(map(int,input().split()))",
"H",
"y,a = list(map(int,input().split()))",
"list(map(int,input().split()))",
"y",
"x1 = min(x,x1)",
"min(x,x1)",
"x1",
"y0 = max(y,y0)",
"max(y,y0)",
"y0",
"N = list(map(int,input().split()))",
"list(map(int,input().split()))",
"N",
"y0 = 0",
"0",
"y0",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"x,y,a = list(map(int,input().split()))",
"list(map(int,input().split()))",
"x",
"x0 = 0",
"0",
"x0",
"x0 = max(x,x0)",
"max(x,x0)",
"x0",
"y1 = min(y,y1)",
"min(y,y1)",
"y1",
"y1 = H",
"H",
"y1",
"X = [x0,x1,y0,y1]",
"[x0,x1,y0,y1]",
"X",
"x1 = W",
"W",
"x1",
"W,H,N = list(map(int,input().split()))",
"list(map(int,input().split()))",
"W"
] |
import sys
input = sys.stdin.readline
W,H,N = list(map(int,input().split()))
x0 = 0
y0 = 0
x1 = W
y1 = H
for i in range(N):
x,y,a = list(map(int,input().split()))
if a == 1:
x0 = max(x,x0)
elif a == 2:
x1 = min(x,x1)
elif a == 3:
y0 = max(y,y0)
elif a == 4:
y1 = min(y,y1)
X = [x0,x1,y0,y1]
print(max(0,x1-x0)*max(0,y1-y0))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
13,
0,
13,
17,
0,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
17,
2,
13,
13,
0,
13,
4,
13,
17,
2,
13,
13,
4,
13,
2,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13
] |
[
[
142,
2
],
[
142,
11
],
[
142,
12
],
[
115,
14
],
[
119,
15
],
[
145,
17
],
[
139,
20
],
[
143,
21
],
[
109,
23
],
[
27,
26
],
[
104,
29
],
[
136,
31
],
[
136,
40
],
[
136,
41
],
[
137,
44
],
[
121,
47
],
[
110,
50
],
[
122,
50
],
[
125,
51
],
[
137,
54
],
[
112,
57
],
[
140,
60
],
[
113,
60
],
[
125,
61
],
[
137,
64
],
[
106,
67
],
[
146,
70
],
[
107,
70
],
[
101,
71
],
[
127,
73
],
[
116,
76
],
[
128,
76
],
[
101,
77
],
[
133,
79
],
[
113,
84
],
[
140,
84
],
[
122,
85
],
[
110,
85
],
[
130,
87
],
[
128,
92
],
[
116,
92
],
[
107,
93
],
[
146,
93
],
[
134,
97
],
[
131,
98
],
[
136,
101
],
[
142,
104
],
[
106,
107
],
[
109,
110
],
[
112,
113
],
[
119,
115
],
[
115,
116
],
[
142,
119
],
[
121,
122
],
[
136,
125
],
[
127,
128
],
[
130,
131
],
[
133,
134
],
[
136,
137
],
[
143,
139
],
[
139,
140
],
[
142,
143
],
[
145,
146
]
] |
[
"W, H, N = map(int, input().split())\nu = H\nd = 0\nr = W\nl = 0\nfor _ in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n l = max(l, x)\n elif a == 2:\n r = min(r, x)\n elif a == 3:\n d = max(d, y)\n else:\n u = min(u, y)\ndx = max(0, r - l)\ndy = max(0, u - d)\nprint(dx * dy)",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"u = H",
"u",
"H",
"d = 0",
"d",
"0",
"r = W",
"r",
"W",
"l = 0",
"l",
"0",
"for _ in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n l = max(l, x)\n elif a == 2:\n r = min(r, x)\n elif a == 3:\n d = max(d, y)\n else:\n u = min(u, y)",
"_",
"range(N)",
"range",
"N",
"x, y, a = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"a",
"if a == 1:\n l = max(l, x)\n elif a == 2:\n r = min(r, x)\n elif a == 3:\n d = max(d, y)\n else:\n u = min(u, y)",
"a == 1",
"a",
"1",
"l = max(l, x)",
"l",
"max(l, x)",
"max",
"l",
"x",
"elif a == 2:\n r = min(r, x)\n ",
"a == 2",
"a",
"2",
"r = min(r, x)",
"r",
"min(r, x)",
"min",
"r",
"x",
"elif a == 3:\n d = max(d, y)\n ",
"a == 3",
"a",
"3",
"d = max(d, y)",
"d",
"max(d, y)",
"max",
"d",
"y",
"u = min(u, y)",
"u",
"min(u, y)",
"min",
"u",
"y",
"dx = max(0, r - l)",
"dx",
"max(0, r - l)",
"max",
"0",
"r - l",
"r",
"l",
"dy = max(0, u - d)",
"dy",
"max(0, u - d)",
"max",
"0",
"u - d",
"u",
"d",
"print(dx * dy)",
"print",
"dx * dy",
"dx",
"dy",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"d = max(d, y)",
"max(d, y)",
"d",
"l = 0",
"0",
"l",
"r = min(r, x)",
"min(r, x)",
"r",
"u = H",
"H",
"u",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"l = max(l, x)",
"max(l, x)",
"l",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"u = min(u, y)",
"min(u, y)",
"u",
"dy = max(0, u - d)",
"max(0, u - d)",
"dy",
"dx = max(0, r - l)",
"max(0, r - l)",
"dx",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"r = W",
"W",
"r",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"d = 0",
"0",
"d"
] |
W, H, N = map(int, input().split())
u = H
d = 0
r = W
l = 0
for _ in range(N):
x, y, a = map(int, input().split())
if a == 1:
l = max(l, x)
elif a == 2:
r = min(r, x)
elif a == 3:
d = max(d, y)
else:
u = min(u, y)
dx = max(0, r - l)
dy = max(0, u - d)
print(dx * dy)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
0,
13,
17,
0,
13,
13,
0,
13,
17,
0,
13,
13,
28,
13,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
13,
0,
13,
2,
4,
13,
2,
13,
13,
17,
4,
13,
2,
13,
13,
17,
4,
13,
13,
10,
13,
13,
10,
2,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13
] |
[
[
132,
2
],
[
132,
11
],
[
132,
12
],
[
16,
15
],
[
133,
18
],
[
138,
31
],
[
129,
34
],
[
105,
37
],
[
124,
38
],
[
120,
40
],
[
114,
43
],
[
112,
44
],
[
135,
55
],
[
130,
58
],
[
136,
58
],
[
117,
65
],
[
106,
68
],
[
118,
68
],
[
141,
75
],
[
121,
78
],
[
142,
78
],
[
126,
81
],
[
115,
84
],
[
127,
84
],
[
108,
87
],
[
118,
92
],
[
106,
92
],
[
136,
93
],
[
130,
93
],
[
127,
98
],
[
115,
98
],
[
142,
99
],
[
121,
99
],
[
109,
103
],
[
124,
105
],
[
105,
106
],
[
108,
109
],
[
132,
112
],
[
112,
114
],
[
114,
115
],
[
117,
118
],
[
120,
121
],
[
132,
124
],
[
126,
127
],
[
129,
130
],
[
132,
133
],
[
135,
136
],
[
138,
139
],
[
141,
142
]
] |
[
"W,H,N=map(int,input().split())\nxya=[list(map(int,input().split()))for _ in range(N)]\n\nwl=0\nwr=W\nhd=0\nhu=H\nfor x,y,a in xya:\n if a==1:\n wl=max(wl,x)\n elif a==2:\n wr=min(wr,x)\n elif a==3:\n hd=max(hd,y)\n else:\n hu=min(hu,y)\n\nans=max(wr-wl,0)*max(hu-hd,0)\nprint(ans)",
"W,H,N=map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"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",
"xya=[list(map(int,input().split()))for _ in range(N)]",
"xya",
"[list(map(int,input().split()))for _ in range(N)]",
"wl=0",
"wl",
"0",
"wr=W",
"wr",
"W",
"hd=0",
"hd",
"0",
"hu=H",
"hu",
"H",
"for x,y,a in xya:\n if a==1:\n wl=max(wl,x)\n elif a==2:\n wr=min(wr,x)\n elif a==3:\n hd=max(hd,y)\n else:\n hu=min(hu,y)",
"x",
"y",
"a",
"xya",
"if a==1:\n wl=max(wl,x)\n elif a==2:\n wr=min(wr,x)\n elif a==3:\n hd=max(hd,y)\n else:\n hu=min(hu,y)",
"a==1",
"a",
"1",
"wl=max(wl,x)",
"wl",
"max(wl,x)",
"max",
"wl",
"x",
"elif a==2:\n wr=min(wr,x)\n ",
"a==2",
"a",
"2",
"wr=min(wr,x)",
"wr",
"min(wr,x)",
"min",
"wr",
"x",
"elif a==3:\n hd=max(hd,y)\n ",
"a==3",
"a",
"3",
"hd=max(hd,y)",
"hd",
"max(hd,y)",
"max",
"hd",
"y",
"hu=min(hu,y)",
"hu",
"min(hu,y)",
"min",
"hu",
"y",
"ans=max(wr-wl,0)*max(hu-hd,0)",
"ans",
"max(wr-wl,0)*max(hu-hd,0)",
"max(wr-wl,0)",
"max",
"wr-wl",
"wr",
"wl",
"0",
"max(hu-hd,0)",
"max",
"hu-hd",
"hu",
"hd",
"0",
"print(ans)",
"print",
"ans",
"wr=W",
"W",
"wr",
"ans=max(wr-wl,0)*max(hu-hd,0)",
"max(wr-wl,0)*max(hu-hd,0)",
"ans",
"H,N=map(int,input().split())",
"map(int,input().split())",
"H",
"hu=H",
"H",
"hu",
"wr=min(wr,x)",
"min(wr,x)",
"wr",
"hd=0",
"0",
"hd",
"W,H,N=map(int,input().split())",
"map(int,input().split())",
"W",
"hu=min(hu,y)",
"min(hu,y)",
"hu",
"wl=0",
"0",
"wl",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"wl=max(wl,x)",
"max(wl,x)",
"wl",
"xya=[list(map(int,input().split()))for _ in range(N)]",
"[list(map(int,input().split()))for _ in range(N)]",
"xya",
"hd=max(hd,y)",
"max(hd,y)",
"hd"
] |
W,H,N=map(int,input().split())
xya=[list(map(int,input().split()))for _ in range(N)]
wl=0
wr=W
hd=0
hu=H
for x,y,a in xya:
if a==1:
wl=max(wl,x)
elif a==2:
wr=min(wr,x)
elif a==3:
hd=max(hd,y)
else:
hu=min(hu,y)
ans=max(wr-wl,0)*max(hu-hd,0)
print(ans)
|
[
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,
2,
39,
17,
13,
0,
13,
13,
12,
13,
14,
2,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
13,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
13,
0,
18,
18,
13,
13,
13,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
13,
17,
28,
13,
4,
13,
13,
13,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
13,
17,
29,
13,
23,
13,
23,
13,
23,
13,
28,
13,
4,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
13,
4,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
18,
18,
13,
13,
13,
17,
4,
13,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
17,
13,
10,
12,
13,
10,
13,
13
] |
[
[
4,
3
],
[
3,
12
],
[
190,
14
],
[
190,
16
],
[
190,
17
],
[
21,
20
],
[
173,
23
],
[
191,
28
],
[
199,
30
],
[
123,
36
],
[
40,
39
],
[
173,
42
],
[
45,
44
],
[
119,
47
],
[
54,
49
],
[
200,
51
],
[
39,
52
],
[
44,
53
],
[
123,
57
],
[
61,
60
],
[
173,
63
],
[
66,
65
],
[
119,
68
],
[
191,
69
],
[
76,
71
],
[
200,
73
],
[
60,
74
],
[
65,
75
],
[
123,
79
],
[
83,
82
],
[
121,
85
],
[
88,
87
],
[
191,
90
],
[
97,
92
],
[
200,
94
],
[
82,
95
],
[
87,
96
],
[
100,
99
],
[
121,
102
],
[
173,
103
],
[
106,
105
],
[
191,
108
],
[
115,
110
],
[
200,
112
],
[
99,
113
],
[
105,
114
],
[
200,
117
],
[
119,
119
],
[
121,
121
],
[
123,
123
],
[
126,
125
],
[
179,
128
],
[
132,
131
],
[
131,
140
],
[
187,
142
],
[
187,
144
],
[
187,
145
],
[
197,
147
],
[
176,
148
],
[
185,
149
],
[
188,
150
],
[
193,
152
],
[
156,
155
],
[
173,
158
],
[
181,
160
],
[
200,
164
],
[
155,
165
],
[
182,
170
],
[
194,
170
],
[
190,
173
],
[
187,
176
],
[
190,
179
],
[
181,
182
],
[
187,
185
],
[
187,
188
],
[
190,
191
],
[
193,
194
],
[
199,
200
]
] |
[
"w,h,n=[int(i) for i in input().split()]\n#二次元配列の作成\nlist_2d=[[0]*w for i in range(h)]\n\n\ndef nurie(x,y,a):\n if a==1:\n for i in range(h):\n for j in range(x):\n list_2d[i][j]=1\n elif a==2:\n for i in range(h):\n for j in range(x,w):\n list_2d[i][j]=1\n \n\n elif a==3:\n for i in range(y):\n for j in range(w):\n list_2d[i][j]=1\n \n else:\n for i in range(y,h):\n for j in range(w):\n list_2d[i][j]=1\n return list_2d\n \nfor i in range(n):\n x,y,a=[int(i) for i in input().split()]\n nurie(x,y,a)\n \nsum=0\nfor i in range(h):\n sum+=list_2d[i].count(0)\n \nprint(sum)",
"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",
"w,h,n=[int(i) for i in input().split()]",
"w",
"[int(i) for i in input().split()]",
"h",
"n",
"[0]*w for i in range(h)",
"for i in range(h)",
"i",
"range(h)",
"range",
"h",
"for i in range(h)",
"[0]*w",
"[0]",
"0",
"w",
"list_2d=[[0]*w for i in range(h)]",
"list_2d",
"[[0]*w for i in range(h)]",
"def nurie(x,y,a):\n if a==1:\n for i in range(h):\n for j in range(x):\n list_2d[i][j]=1\n elif a==2:\n for i in range(h):\n for j in range(x,w):\n list_2d[i][j]=1\n \n\n elif a==3:\n for i in range(y):\n for j in range(w):\n list_2d[i][j]=1\n \n else:\n for i in range(y,h):\n for j in range(w):\n list_2d[i][j]=1\n return list_2d\n ",
"nurie",
"if a==1:\n for i in range(h):\n for j in range(x):\n list_2d[i][j]=1\n elif a==2:\n for i in range(h):\n for j in range(x,w):\n list_2d[i][j]=1\n \n\n elif a==3:\n for i in range(y):\n for j in range(w):\n list_2d[i][j]=1\n \n else:\n for i in range(y,h):\n for j in range(w):\n list_2d[i][j]=1\n ",
"a==1",
"a",
"1",
"for i in range(h):\n for j in range(x):\n list_2d[i][j]=1\n ",
"i",
"range(h)",
"range",
"h",
"for j in range(x):\n list_2d[i][j]=1\n ",
"j",
"range(x)",
"range",
"x",
"list_2d[i][j]=1",
"list_2d[i][j]",
"[i]",
"list_2d",
"i",
"j",
"1",
"elif a==2:\n for i in range(h):\n for j in range(x,w):\n list_2d[i][j]=1\n \n\n ",
"a==2",
"a",
"2",
"for i in range(h):\n for j in range(x,w):\n list_2d[i][j]=1\n \n\n ",
"i",
"range(h)",
"range",
"h",
"for j in range(x,w):\n list_2d[i][j]=1\n \n\n ",
"j",
"range(x,w)",
"range",
"x",
"w",
"list_2d[i][j]=1",
"list_2d[i][j]",
"[i]",
"list_2d",
"i",
"j",
"1",
"elif a==3:\n for i in range(y):\n for j in range(w):\n list_2d[i][j]=1\n \n ",
"a==3",
"a",
"3",
"for i in range(y):\n for j in range(w):\n list_2d[i][j]=1\n \n ",
"i",
"range(y)",
"range",
"y",
"for j in range(w):\n list_2d[i][j]=1\n \n ",
"j",
"range(w)",
"range",
"w",
"list_2d[i][j]=1",
"list_2d[i][j]",
"[i]",
"list_2d",
"i",
"j",
"1",
"for i in range(y,h):\n for j in range(w):\n list_2d[i][j]=1\n ",
"i",
"range(y,h)",
"range",
"y",
"h",
"for j in range(w):\n list_2d[i][j]=1\n ",
"j",
"range(w)",
"range",
"w",
"list_2d[i][j]=1",
"list_2d[i][j]",
"[i]",
"list_2d",
"i",
"j",
"1",
"return list_2d",
"list_2d",
"x",
"x",
"y",
"y",
"a",
"a",
"for i in range(n):\n x,y,a=[int(i) for i in input().split()]\n nurie(x,y,a)\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",
"x,y,a=[int(i) for i in input().split()]",
"x",
"[int(i) for i in input().split()]",
"y",
"a",
"nurie(x,y,a)",
"nurie",
"x",
"y",
"a",
"sum=0",
"sum",
"0",
"for i in range(h):\n sum+=list_2d[i].count(0)\n ",
"i",
"range(h)",
"range",
"h",
"sum+=list_2d[i].count(0)",
"sum",
"list_2d[i].count(0)",
"[i].count",
"[i]",
"list_2d",
"i",
"count",
"0",
"print(sum)",
"print",
"sum",
"h,n=[int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"h",
"x,y,a=[int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"x",
"n=[int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"n",
"sum+=list_2d[i].count(0)",
"list_2d[i].count(0)",
"sum",
"y,a=[int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"y",
"a=[int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"a",
"w,h,n=[int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"w",
"sum=0",
"0",
"sum",
"def nurie(x,y,a):\n if a==1:\n for i in range(h):\n for j in range(x):\n list_2d[i][j]=1\n elif a==2:\n for i in range(h):\n for j in range(x,w):\n list_2d[i][j]=1\n \n\n elif a==3:\n for i in range(y):\n for j in range(w):\n list_2d[i][j]=1\n \n else:\n for i in range(y,h):\n for j in range(w):\n list_2d[i][j]=1\n return list_2d\n ",
"def nurie(x,y,a):\n if a==1:\n for i in range(h):\n for j in range(x):\n list_2d[i][j]=1\n elif a==2:\n for i in range(h):\n for j in range(x,w):\n list_2d[i][j]=1\n \n\n elif a==3:\n for i in range(y):\n for j in range(w):\n list_2d[i][j]=1\n \n else:\n for i in range(y,h):\n for j in range(w):\n list_2d[i][j]=1\n return list_2d\n ",
"nurie",
"list_2d=[[0]*w for i in range(h)]",
"[[0]*w for i in range(h)]",
"list_2d"
] |
w,h,n=[int(i) for i in input().split()]
#二次元配列の作成
list_2d=[[0]*w for i in range(h)]
def nurie(x,y,a):
if a==1:
for i in range(h):
for j in range(x):
list_2d[i][j]=1
elif a==2:
for i in range(h):
for j in range(x,w):
list_2d[i][j]=1
elif a==3:
for i in range(y):
for j in range(w):
list_2d[i][j]=1
else:
for i in range(y,h):
for j in range(w):
list_2d[i][j]=1
return list_2d
for i in range(n):
x,y,a=[int(i) for i in input().split()]
nurie(x,y,a)
sum=0
for i in range(h):
sum+=list_2d[i].count(0)
print(sum)
|
[
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,
39,
17,
13,
0,
13,
39,
17,
13,
28,
13,
4,
13,
13,
14,
2,
18,
18,
13,
13,
17,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
18,
18,
13,
13,
17,
14,
2,
18,
18,
13,
13,
17,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
18,
18,
13,
13,
17,
14,
2,
18,
18,
13,
13,
17,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
18,
18,
13,
13,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
18,
18,
13,
13,
17,
14,
2,
2,
18,
13,
17,
18,
13,
17,
17,
0,
13,
2,
18,
13,
17,
18,
13,
17,
0,
13,
17,
14,
2,
2,
18,
13,
17,
18,
13,
17,
17,
0,
13,
2,
18,
13,
17,
18,
13,
17,
0,
13,
17,
0,
13,
2,
13,
13,
4,
13,
13,
10,
4,
13,
10,
39,
13,
10,
39,
13,
10,
2,
13,
10,
2,
13,
10,
39,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] |
[
[
213,
2
],
[
213,
11
],
[
213,
12
],
[
186,
14
],
[
18,
17
],
[
184,
20
],
[
187,
23
],
[
189,
36
],
[
198,
41
],
[
47,
46
],
[
184,
49
],
[
187,
54
],
[
46,
55
],
[
62,
59
],
[
190,
60
],
[
190,
65
],
[
187,
69
],
[
46,
70
],
[
187,
76
],
[
46,
77
],
[
84,
81
],
[
190,
82
],
[
190,
87
],
[
187,
91
],
[
46,
92
],
[
187,
98
],
[
46,
99
],
[
106,
103
],
[
199,
104
],
[
199,
109
],
[
187,
113
],
[
46,
114
],
[
120,
117
],
[
199,
118
],
[
199,
123
],
[
187,
127
],
[
46,
128
],
[
190,
134
],
[
190,
137
],
[
192,
141
],
[
190,
144
],
[
190,
147
],
[
201,
150
],
[
199,
156
],
[
199,
159
],
[
204,
163
],
[
199,
166
],
[
199,
169
],
[
207,
172
],
[
195,
175
],
[
208,
177
],
[
205,
177
],
[
214,
177
],
[
202,
178
],
[
193,
178
],
[
211,
178
],
[
196,
181
],
[
213,
184
],
[
186,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
],
[
201,
202
],
[
204,
205
],
[
207,
208
],
[
213,
211
],
[
213,
214
]
] |
[
"W,H,N=map(int,input().split())\nList = []\nfor i in range (N):\n List.append(list(map(int, input().split())))\nWRange = [0,W]\nHRange = [0,H]\nfor i in range(N):\n if List[i][2] == 1:\n WRange[0] = max(WRange[0],List[i][0])\n elif List[i][2] == 2:\n WRange[1] = min(WRange[1],List[i][0])\n elif List[i][2] == 3:\n HRange[0] = max(HRange[0],List[i][1])\n else:\n HRange[1] = min(HRange[1],List[i][1])\nif WRange[1]-WRange[0] >0:\n W = WRange[1]-WRange[0]\nelse:\n W = 0\nif HRange[1]-HRange[0] >0:\n H = HRange[1]-HRange[0]\nelse:\n H = 0\nres = H * W\nprint(res)",
"W,H,N=map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"List = []",
"List",
"[]",
"for i in range (N):\n List.append(list(map(int, input().split())))",
"i",
"range (N)",
"range",
"N",
"List.append(list(map(int, input().split())))",
"List.append",
"List",
"append",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"WRange = [0,W]",
"WRange",
"[0,W]",
"0",
"W",
"HRange = [0,H]",
"HRange",
"[0,H]",
"0",
"H",
"for i in range(N):\n if List[i][2] == 1:\n WRange[0] = max(WRange[0],List[i][0])\n elif List[i][2] == 2:\n WRange[1] = min(WRange[1],List[i][0])\n elif List[i][2] == 3:\n HRange[0] = max(HRange[0],List[i][1])\n else:\n HRange[1] = min(HRange[1],List[i][1])",
"i",
"range(N)",
"range",
"N",
"if List[i][2] == 1:\n WRange[0] = max(WRange[0],List[i][0])\n elif List[i][2] == 2:\n WRange[1] = min(WRange[1],List[i][0])\n elif List[i][2] == 3:\n HRange[0] = max(HRange[0],List[i][1])\n else:\n HRange[1] = min(HRange[1],List[i][1])",
"List[i][2] == 1",
"List[i][2]",
"[i]",
"List",
"i",
"2",
"1",
"WRange[0] = max(WRange[0],List[i][0])",
"WRange[0]",
"WRange",
"0",
"max(WRange[0],List[i][0])",
"max",
"WRange[0]",
"WRange",
"0",
"List[i][0]",
"[i]",
"List",
"i",
"0",
"elif List[i][2] == 2:\n WRange[1] = min(WRange[1],List[i][0])\n ",
"List[i][2] == 2",
"List[i][2]",
"[i]",
"List",
"i",
"2",
"2",
"WRange[1] = min(WRange[1],List[i][0])",
"WRange[1]",
"WRange",
"1",
"min(WRange[1],List[i][0])",
"min",
"WRange[1]",
"WRange",
"1",
"List[i][0]",
"[i]",
"List",
"i",
"0",
"elif List[i][2] == 3:\n HRange[0] = max(HRange[0],List[i][1])\n ",
"List[i][2] == 3",
"List[i][2]",
"[i]",
"List",
"i",
"2",
"3",
"HRange[0] = max(HRange[0],List[i][1])",
"HRange[0]",
"HRange",
"0",
"max(HRange[0],List[i][1])",
"max",
"HRange[0]",
"HRange",
"0",
"List[i][1]",
"[i]",
"List",
"i",
"1",
"HRange[1] = min(HRange[1],List[i][1])",
"HRange[1]",
"HRange",
"1",
"min(HRange[1],List[i][1])",
"min",
"HRange[1]",
"HRange",
"1",
"List[i][1]",
"[i]",
"List",
"i",
"1",
"if WRange[1]-WRange[0] >0:\n W = WRange[1]-WRange[0]\nelse:\n W = 0",
"WRange[1]-WRange[0] >0",
"WRange[1]-WRange[0]",
"WRange[1]",
"WRange",
"1",
"WRange[0]",
"WRange",
"0",
"0",
"W = WRange[1]-WRange[0]",
"W",
"WRange[1]-WRange[0]",
"WRange[1]",
"WRange",
"1",
"WRange[0]",
"WRange",
"0",
"W = 0",
"W",
"0",
"if HRange[1]-HRange[0] >0:\n H = HRange[1]-HRange[0]\nelse:\n H = 0",
"HRange[1]-HRange[0] >0",
"HRange[1]-HRange[0]",
"HRange[1]",
"HRange",
"1",
"HRange[0]",
"HRange",
"0",
"0",
"H = HRange[1]-HRange[0]",
"H",
"HRange[1]-HRange[0]",
"HRange[1]",
"HRange",
"1",
"HRange[0]",
"HRange",
"0",
"H = 0",
"H",
"0",
"res = H * W",
"res",
"H * W",
"H",
"W",
"print(res)",
"print",
"res",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"List = []",
"[]",
"List",
"WRange = [0,W]",
"[0,W]",
"WRange",
"W = WRange[1]-WRange[0]",
"WRange[1]-WRange[0]",
"W",
"res = H * W",
"H * W",
"res",
"HRange = [0,H]",
"[0,H]",
"HRange",
"W = 0",
"0",
"W",
"H = HRange[1]-HRange[0]",
"HRange[1]-HRange[0]",
"H",
"H = 0",
"0",
"H",
"W,H,N=map(int,input().split())",
"map(int,input().split())",
"W",
"H,N=map(int,input().split())",
"map(int,input().split())",
"H"
] |
W,H,N=map(int,input().split())
List = []
for i in range (N):
List.append(list(map(int, input().split())))
WRange = [0,W]
HRange = [0,H]
for i in range(N):
if List[i][2] == 1:
WRange[0] = max(WRange[0],List[i][0])
elif List[i][2] == 2:
WRange[1] = min(WRange[1],List[i][0])
elif List[i][2] == 3:
HRange[0] = max(HRange[0],List[i][1])
else:
HRange[1] = min(HRange[1],List[i][1])
if WRange[1]-WRange[0] >0:
W = WRange[1]-WRange[0]
else:
W = 0
if HRange[1]-HRange[0] >0:
H = HRange[1]-HRange[0]
else:
H = 0
res = H * W
print(res)
|
[
7,
15,
13,
15,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
17,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
31,
13,
0,
13,
17,
0,
13,
13,
0,
13,
17,
0,
13,
13,
28,
13,
13,
13,
4,
13,
31,
2,
39,
4,
13,
13,
17,
14,
2,
2,
13,
17,
2,
13,
13,
0,
13,
13,
14,
2,
2,
13,
17,
2,
13,
13,
0,
13,
13,
14,
2,
2,
13,
17,
2,
13,
13,
0,
13,
13,
14,
2,
2,
13,
17,
2,
13,
13,
0,
13,
13,
4,
13,
2,
4,
13,
2,
13,
13,
17,
4,
13,
2,
13,
13,
17,
29,
14,
2,
13,
17,
4,
13,
10,
17,
13,
10,
18,
13,
10,
18,
13,
10,
18,
13,
10,
12,
13,
10,
2,
13
] |
[
[
151,
5
],
[
154,
12
],
[
157,
19
],
[
163,
33
],
[
148,
38
],
[
44,
43
],
[
152,
50
],
[
44,
52
],
[
44,
53
],
[
44,
54
],
[
58,
57
],
[
61,
60
],
[
43,
61
],
[
64,
63
],
[
67,
66
],
[
52,
67
],
[
57,
87
],
[
90,
87
],
[
91,
90
],
[
60,
98
],
[
101,
98
],
[
102,
101
],
[
63,
109
],
[
112,
109
],
[
113,
112
],
[
66,
120
],
[
123,
120
],
[
124,
123
],
[
101,
131
],
[
60,
131
],
[
90,
132
],
[
57,
132
],
[
123,
137
],
[
66,
137
],
[
112,
138
],
[
63,
138
],
[
161,
146
],
[
148,
149
],
[
151,
152
],
[
154,
155
],
[
157,
158
],
[
163,
164
]
] |
[
"import sys\nfrom itertools import accumulate\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n W, H, N, *XYA = map(int, read().split())\n\n x_left = 0\n x_right = W\n y_left = 0\n y_right = H\n for x, y, a in zip(*[iter(XYA)] * 3):\n if a == 1 and x_left < x:\n x_left = x\n elif a == 2 and x_right > x:\n x_right = x\n elif a == 3 and y_left < y:\n y_left = y\n elif a == 4 and y_right > y:\n y_right = y\n\n print(max(x_right - x_left, 0) * max(y_right - y_left, 0))\n return\n\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"from itertools import accumulate",
"read = sys.stdin.read",
"read",
"sys.stdin.read",
"sys.stdin",
"sys",
"stdin",
"read",
"readline = sys.stdin.readline",
"readline",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"readlines = sys.stdin.readlines",
"readlines",
"sys.stdin.readlines",
"sys.stdin",
"sys",
"stdin",
"readlines",
"sys.setrecursionlimit(10 ** 9)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 9",
"10",
"9",
"INF = 1 << 60",
"INF",
"1 << 60",
"1",
"60",
"MOD = 1000000007",
"MOD",
"1000000007",
"def main():\n W, H, N, *XYA = map(int, read().split())\n\n x_left = 0\n x_right = W\n y_left = 0\n y_right = H\n for x, y, a in zip(*[iter(XYA)] * 3):\n if a == 1 and x_left < x:\n x_left = x\n elif a == 2 and x_right > x:\n x_right = x\n elif a == 3 and y_left < y:\n y_left = y\n elif a == 4 and y_right > y:\n y_right = y\n\n print(max(x_right - x_left, 0) * max(y_right - y_left, 0))\n return",
"main",
"W, H, N, *XYA = map(int, read().split())",
"W",
"map(int, read().split())",
"map",
"int",
"read().split()",
"().split",
"()",
"read",
"split",
"H",
"N",
"*XYA",
"XYA",
"x_left = 0",
"x_left",
"0",
"x_right = W",
"x_right",
"W",
"y_left = 0",
"y_left",
"0",
"y_right = H",
"y_right",
"H",
"for x, y, a in zip(*[iter(XYA)] * 3):\n if a == 1 and x_left < x:\n x_left = x\n elif a == 2 and x_right > x:\n x_right = x\n elif a == 3 and y_left < y:\n y_left = y\n elif a == 4 and y_right > y:\n y_right = y\n\n ",
"x",
"y",
"a",
"zip(*[iter(XYA)] * 3)",
"zip",
"*[iter(XYA)] * 3",
"[iter(XYA)] * 3",
"[iter(XYA)]",
"iter(XYA)",
"iter",
"XYA",
"3",
"if a == 1 and x_left < x:\n x_left = x\n elif a == 2 and x_right > x:\n x_right = x\n elif a == 3 and y_left < y:\n y_left = y\n elif a == 4 and y_right > y:\n y_right = y\n\n ",
"a == 1 and x_left < x",
"a == 1",
"a",
"1",
"x_left < x",
"x_left",
"x",
"x_left = x",
"x_left",
"x",
"elif a == 2 and x_right > x:\n x_right = x\n ",
"a == 2 and x_right > x",
"a == 2",
"a",
"2",
"x_right > x",
"x_right",
"x",
"x_right = x",
"x_right",
"x",
"elif a == 3 and y_left < y:\n y_left = y\n ",
"a == 3 and y_left < y",
"a == 3",
"a",
"3",
"y_left < y",
"y_left",
"y",
"y_left = y",
"y_left",
"y",
"elif a == 4 and y_right > y:\n y_right = y\n\n ",
"a == 4 and y_right > y",
"a == 4",
"a",
"4",
"y_right > y",
"y_right",
"y",
"y_right = y",
"y_right",
"y",
"print(max(x_right - x_left, 0) * max(y_right - y_left, 0))",
"print",
"max(x_right - x_left, 0) * max(y_right - y_left, 0)",
"max(x_right - x_left, 0)",
"max",
"x_right - x_left",
"x_right",
"x_left",
"0",
"max(y_right - y_left, 0)",
"max",
"y_right - y_left",
"y_right",
"y_left",
"0",
"return",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"MOD = 1000000007",
"1000000007",
"MOD",
"read = sys.stdin.read",
"sys.stdin.read",
"read",
"readline = sys.stdin.readline",
"sys.stdin.readline",
"readline",
"readlines = sys.stdin.readlines",
"sys.stdin.readlines",
"readlines",
"def main():\n W, H, N, *XYA = map(int, read().split())\n\n x_left = 0\n x_right = W\n y_left = 0\n y_right = H\n for x, y, a in zip(*[iter(XYA)] * 3):\n if a == 1 and x_left < x:\n x_left = x\n elif a == 2 and x_right > x:\n x_right = x\n elif a == 3 and y_left < y:\n y_left = y\n elif a == 4 and y_right > y:\n y_right = y\n\n print(max(x_right - x_left, 0) * max(y_right - y_left, 0))\n return",
"def main():\n W, H, N, *XYA = map(int, read().split())\n\n x_left = 0\n x_right = W\n y_left = 0\n y_right = H\n for x, y, a in zip(*[iter(XYA)] * 3):\n if a == 1 and x_left < x:\n x_left = x\n elif a == 2 and x_right > x:\n x_right = x\n elif a == 3 and y_left < y:\n y_left = y\n elif a == 4 and y_right > y:\n y_right = y\n\n print(max(x_right - x_left, 0) * max(y_right - y_left, 0))\n return",
"main",
"INF = 1 << 60",
"1 << 60",
"INF"
] |
import sys
from itertools import accumulate
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
W, H, N, *XYA = map(int, read().split())
x_left = 0
x_right = W
y_left = 0
y_right = H
for x, y, a in zip(*[iter(XYA)] * 3):
if a == 1 and x_left < x:
x_left = x
elif a == 2 and x_right > x:
x_right = x
elif a == 3 and y_left < y:
y_left = y
elif a == 4 and y_right > y:
y_right = y
print(max(x_right - x_left, 0) * max(y_right - y_left, 0))
return
if __name__ == '__main__':
main()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
13,
0,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
13,
28,
13,
4,
13,
13,
0,
13,
18,
13,
13,
13,
13,
14,
2,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
13,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
13,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
13,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
13,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
13,
0,
18,
18,
13,
13,
13,
17,
0,
13,
17,
28,
13,
13,
0,
13,
4,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
18,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
18,
13
] |
[
[
181,
2
],
[
181,
11
],
[
181,
12
],
[
16,
15
],
[
158,
18
],
[
163,
22
],
[
27,
26
],
[
182,
29
],
[
169,
42
],
[
46,
45
],
[
182,
48
],
[
184,
50
],
[
170,
52
],
[
45,
53
],
[
184,
54
],
[
184,
55
],
[
179,
58
],
[
62,
61
],
[
167,
64
],
[
67,
66
],
[
158,
69
],
[
76,
71
],
[
164,
73
],
[
66,
74
],
[
61,
75
],
[
179,
79
],
[
83,
82
],
[
167,
85
],
[
161,
86
],
[
89,
88
],
[
158,
91
],
[
98,
93
],
[
164,
95
],
[
88,
96
],
[
82,
97
],
[
179,
101
],
[
105,
104
],
[
161,
107
],
[
110,
109
],
[
185,
112
],
[
119,
114
],
[
164,
116
],
[
109,
117
],
[
104,
118
],
[
179,
122
],
[
126,
125
],
[
161,
128
],
[
131,
130
],
[
185,
133
],
[
158,
134
],
[
141,
136
],
[
164,
138
],
[
130,
139
],
[
125,
140
],
[
172,
143
],
[
147,
146
],
[
164,
146
],
[
175,
149
],
[
146,
152
],
[
176,
155
],
[
173,
155
],
[
181,
158
],
[
181,
161
],
[
163,
164
],
[
184,
167
],
[
169,
170
],
[
172,
173
],
[
175,
176
],
[
184,
179
],
[
181,
182
],
[
184,
185
]
] |
[
"W, H, N = map(int, input().split())\nfield = [[1 for i in range(W)] for j in range(H)]\nxya = [list(map(int, input().split())) for _ in range(N)]\n\nfor i in range(N):\n x, y, a = xya[i]\n if a == 1:\n for w in range(x):\n for h in range(H):\n field[h][w] = 0\n elif a == 2:\n for w in range(x, W):\n for h in range(H):\n field[h][w] = 0\n\n elif a == 3:\n for w in range(W):\n for h in range(y):\n field[h][w] = 0\n\n elif a == 4:\n for w in range(W):\n for h in range(y, H):\n field[h][w] = 0\nans = 0\nfor i in field:\n ans += sum(i)\nprint(ans)",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"[1 for i in range(W)] for j in range(H)",
"for j in range(H)",
"j",
"range(H)",
"range",
"H",
"for j in range(H)",
"[1 for i in range(W)]",
"field = [[1 for i in range(W)] for j in range(H)]",
"field",
"[[1 for i in range(W)] for j in range(H)]",
"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",
"xya = [list(map(int, input().split())) for _ in range(N)]",
"xya",
"[list(map(int, input().split())) for _ in range(N)]",
"for i in range(N):\n x, y, a = xya[i]\n if a == 1:\n for w in range(x):\n for h in range(H):\n field[h][w] = 0\n elif a == 2:\n for w in range(x, W):\n for h in range(H):\n field[h][w] = 0\n\n elif a == 3:\n for w in range(W):\n for h in range(y):\n field[h][w] = 0\n\n elif a == 4:\n for w in range(W):\n for h in range(y, H):\n field[h][w] = 0",
"i",
"range(N)",
"range",
"N",
"x, y, a = xya[i]",
"x",
"xya[i]",
"xya",
"i",
"y",
"a",
"if a == 1:\n for w in range(x):\n for h in range(H):\n field[h][w] = 0\n elif a == 2:\n for w in range(x, W):\n for h in range(H):\n field[h][w] = 0\n\n elif a == 3:\n for w in range(W):\n for h in range(y):\n field[h][w] = 0\n\n elif a == 4:\n for w in range(W):\n for h in range(y, H):\n field[h][w] = 0",
"a == 1",
"a",
"1",
"for w in range(x):\n for h in range(H):\n field[h][w] = 0\n ",
"w",
"range(x)",
"range",
"x",
"for h in range(H):\n field[h][w] = 0\n ",
"h",
"range(H)",
"range",
"H",
"field[h][w] = 0",
"field[h][w]",
"[h]",
"field",
"h",
"w",
"0",
"elif a == 2:\n for w in range(x, W):\n for h in range(H):\n field[h][w] = 0\n\n ",
"a == 2",
"a",
"2",
"for w in range(x, W):\n for h in range(H):\n field[h][w] = 0\n\n ",
"w",
"range(x, W)",
"range",
"x",
"W",
"for h in range(H):\n field[h][w] = 0\n\n ",
"h",
"range(H)",
"range",
"H",
"field[h][w] = 0",
"field[h][w]",
"[h]",
"field",
"h",
"w",
"0",
"elif a == 3:\n for w in range(W):\n for h in range(y):\n field[h][w] = 0\n\n ",
"a == 3",
"a",
"3",
"for w in range(W):\n for h in range(y):\n field[h][w] = 0\n\n ",
"w",
"range(W)",
"range",
"W",
"for h in range(y):\n field[h][w] = 0\n\n ",
"h",
"range(y)",
"range",
"y",
"field[h][w] = 0",
"field[h][w]",
"[h]",
"field",
"h",
"w",
"0",
"elif a == 4:\n for w in range(W):\n for h in range(y, H):\n field[h][w] = 0",
"a == 4",
"a",
"4",
"for w in range(W):\n for h in range(y, H):\n field[h][w] = 0",
"w",
"range(W)",
"range",
"W",
"for h in range(y, H):\n field[h][w] = 0",
"h",
"range(y, H)",
"range",
"y",
"H",
"field[h][w] = 0",
"field[h][w]",
"[h]",
"field",
"h",
"w",
"0",
"ans = 0",
"ans",
"0",
"for i in field:\n ans += sum(i)",
"i",
"field",
"ans += sum(i)",
"ans",
"sum(i)",
"sum",
"i",
"print(ans)",
"print",
"ans",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"field = [[1 for i in range(W)] for j in range(H)]",
"[[1 for i in range(W)] for j in range(H)]",
"field",
"x, y, a = xya[i]",
"xya[i]",
"x",
"xya = [list(map(int, input().split())) for _ in range(N)]",
"[list(map(int, input().split())) for _ in range(N)]",
"xya",
"ans = 0",
"0",
"ans",
"ans += sum(i)",
"sum(i)",
"ans",
"a = xya[i]",
"xya[i]",
"a",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"y, a = xya[i]",
"xya[i]",
"y"
] |
W, H, N = map(int, input().split())
field = [[1 for i in range(W)] for j in range(H)]
xya = [list(map(int, input().split())) for _ in range(N)]
for i in range(N):
x, y, a = xya[i]
if a == 1:
for w in range(x):
for h in range(H):
field[h][w] = 0
elif a == 2:
for w in range(x, W):
for h in range(H):
field[h][w] = 0
elif a == 3:
for w in range(W):
for h in range(y):
field[h][w] = 0
elif a == 4:
for w in range(W):
for h in range(y, H):
field[h][w] = 0
ans = 0
for i in field:
ans += sum(i)
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
13,
13,
13,
17,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
4,
13,
2,
4,
13,
17,
2,
13,
13,
4,
13,
17,
2,
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,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13
] |
[
[
125,
2
],
[
125,
11
],
[
125,
12
],
[
119,
14
],
[
128,
16
],
[
111,
17
],
[
122,
18
],
[
131,
20
],
[
126,
21
],
[
24,
23
],
[
114,
26
],
[
116,
28
],
[
116,
37
],
[
116,
38
],
[
99,
41
],
[
104,
44
],
[
120,
47
],
[
105,
47
],
[
117,
48
],
[
99,
51
],
[
134,
54
],
[
129,
57
],
[
135,
57
],
[
117,
58
],
[
99,
61
],
[
101,
64
],
[
123,
67
],
[
102,
67
],
[
96,
68
],
[
99,
71
],
[
107,
74
],
[
132,
77
],
[
108,
77
],
[
96,
78
],
[
108,
86
],
[
132,
86
],
[
102,
87
],
[
123,
87
],
[
135,
92
],
[
129,
92
],
[
105,
93
],
[
120,
93
],
[
116,
96
],
[
116,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
],
[
125,
111
],
[
125,
114
],
[
116,
117
],
[
119,
120
],
[
122,
123
],
[
125,
126
],
[
111,
128
],
[
128,
129
],
[
126,
131
],
[
131,
132
],
[
134,
135
]
] |
[
"W, H, N = map(int, input().split())\nx1, x2, y1, y2 = 0, W, 0, H\nfor _ in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n x1 = max(x1, x)\n elif a == 2:\n x2 = min(x2, x)\n elif a == 3:\n y1 = max(y1, y)\n elif a == 4:\n y2 = min(y2, y)\n\nprint(max(0, (y2 - y1)) * max(0, (x2 - x1)))",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"x1, x2, y1, y2 = 0, W, 0, H",
"x1",
"0",
"x2",
"W",
"y1",
"0",
"y2",
"H",
"for _ in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n x1 = max(x1, x)\n elif a == 2:\n x2 = min(x2, x)\n elif a == 3:\n y1 = max(y1, y)\n elif a == 4:\n y2 = min(y2, y)",
"_",
"range(N)",
"range",
"N",
"x, y, a = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"a",
"if a == 1:\n x1 = max(x1, x)\n elif a == 2:\n x2 = min(x2, x)\n elif a == 3:\n y1 = max(y1, y)\n elif a == 4:\n y2 = min(y2, y)",
"a == 1",
"a",
"1",
"x1 = max(x1, x)",
"x1",
"max(x1, x)",
"max",
"x1",
"x",
"elif a == 2:\n x2 = min(x2, x)\n ",
"a == 2",
"a",
"2",
"x2 = min(x2, x)",
"x2",
"min(x2, x)",
"min",
"x2",
"x",
"elif a == 3:\n y1 = max(y1, y)\n ",
"a == 3",
"a",
"3",
"y1 = max(y1, y)",
"y1",
"max(y1, y)",
"max",
"y1",
"y",
"elif a == 4:\n y2 = min(y2, y)",
"a == 4",
"a",
"4",
"y2 = min(y2, y)",
"y2",
"min(y2, y)",
"min",
"y2",
"y",
"print(max(0, (y2 - y1)) * max(0, (x2 - x1)))",
"print",
"max(0, (y2 - y1)) * max(0, (x2 - x1))",
"max(0, (y2 - y1))",
"max",
"0",
"y2 - y1",
"y2",
"y1",
"max(0, (x2 - x1))",
"max",
"0",
"x2 - x1",
"x2",
"x1",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"y1 = max(y1, y)",
"max(y1, y)",
"y1",
"x1 = max(x1, x)",
"max(x1, x)",
"x1",
"y2 = min(y2, y)",
"min(y2, y)",
"y2",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"x1, x2, y1, y2 = 0, W, 0, H",
"0",
"x1",
"y1, y2 = 0, W, 0, H",
"0",
"y1",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"x2, y1, y2 = 0, W, 0, H",
"W",
"x2",
"y2 = 0, W, 0, H",
"H",
"y2",
"x2 = min(x2, x)",
"min(x2, x)",
"x2"
] |
W, H, N = map(int, input().split())
x1, x2, y1, y2 = 0, W, 0, H
for _ in range(N):
x, y, a = map(int, input().split())
if a == 1:
x1 = max(x1, x)
elif a == 2:
x2 = min(x2, x)
elif a == 3:
y1 = max(y1, y)
elif a == 4:
y2 = min(y2, y)
print(max(0, (y2 - y1)) * max(0, (x2 - x1)))
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
13,
14,
40,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
18,
13,
10,
17,
13
] |
[
[
32,
2
],
[
41,
8
],
[
33,
10
],
[
44,
13
],
[
17,
16
],
[
33,
16
],
[
16,
20
],
[
42,
21
],
[
39,
21
],
[
35,
23
],
[
38,
26
],
[
16,
27
],
[
36,
30
],
[
45,
30
],
[
32,
33
],
[
35,
36
],
[
16,
38
],
[
38,
39
],
[
41,
42
],
[
44,
45
]
] |
[
"s=list(input())\na=s[0]\nans=0\nfor i in s:\n if i !=a:\n ans+=1\n a=i\n\nprint(ans)",
"s=list(input())",
"s",
"list(input())",
"list",
"input()",
"input",
"a=s[0]",
"a",
"s[0]",
"s",
"0",
"ans=0",
"ans",
"0",
"for i in s:\n if i !=a:\n ans+=1\n a=i",
"i",
"s",
"if i !=a:\n ans+=1\n a=i",
"i !=a",
"i",
"a",
"ans+=1",
"ans",
"1",
"a=i",
"a",
"i",
"print(ans)",
"print",
"ans",
"s=list(input())",
"list(input())",
"s",
"ans+=1",
"1",
"ans",
"a=i",
"i",
"a",
"a=s[0]",
"s[0]",
"a",
"ans=0",
"0",
"ans"
] |
s=list(input())
a=s[0]
ans=0
for i in s:
if i !=a:
ans+=1
a=i
print(ans)
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
13,
14,
40,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
13,
13,
10,
17,
13
] |
[
[
30,
2
],
[
36,
6
],
[
31,
8
],
[
33,
11
],
[
15,
14
],
[
31,
14
],
[
14,
18
],
[
37,
19
],
[
40,
19
],
[
42,
21
],
[
39,
24
],
[
14,
25
],
[
43,
28
],
[
34,
28
],
[
30,
31
],
[
33,
34
],
[
36,
37
],
[
14,
39
],
[
39,
40
],
[
42,
43
]
] |
[
"s=input()\nb=s[0]\nc=0\nfor a in s:\n if a!=b:\n c+=1\n b=a\nprint(c)",
"s=input()",
"s",
"input()",
"input",
"b=s[0]",
"b",
"s[0]",
"s",
"0",
"c=0",
"c",
"0",
"for a in s:\n if a!=b:\n c+=1\n b=a",
"a",
"s",
"if a!=b:\n c+=1\n ",
"a!=b",
"a",
"b",
"c+=1",
"c",
"1",
"b=a",
"b",
"a",
"print(c)",
"print",
"c",
"s=input()",
"input()",
"s",
"c=0",
"0",
"c",
"b=s[0]",
"s[0]",
"b",
"b=a",
"a",
"b",
"c+=1",
"1",
"c"
] |
s=input()
b=s[0]
c=0
for a in s:
if a!=b:
c+=1
b=a
print(c)
|
[
7,
15,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
12,
4,
13,
4,
18,
18,
13,
13,
13,
0,
13,
12,
4,
13,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
0,
13,
12,
4,
13,
4,
13,
0,
13,
12,
4,
18,
4,
18,
18,
13,
13,
13,
13,
0,
13,
4,
13,
12,
13,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
17,
42,
2,
13,
13,
42,
2,
2,
13,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
17,
14,
2,
13,
13,
3,
0,
13,
17,
0,
13,
13,
0,
13,
17,
29,
13,
4,
13,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13
] |
[
[
121,
11
],
[
130,
22
],
[
118,
37
],
[
131,
42
],
[
115,
44
],
[
127,
56
],
[
116,
58
],
[
63,
62
],
[
128,
65
],
[
68,
67
],
[
71,
70
],
[
74,
73
],
[
70,
77
],
[
106,
77
],
[
92,
77
],
[
62,
78
],
[
70,
82
],
[
92,
82
],
[
106,
82
],
[
62,
83
],
[
128,
86
],
[
67,
87
],
[
103,
87
],
[
128,
89
],
[
70,
90
],
[
92,
90
],
[
106,
90
],
[
93,
92
],
[
92,
96
],
[
70,
96
],
[
106,
96
],
[
62,
97
],
[
101,
100
],
[
104,
103
],
[
92,
104
],
[
70,
104
],
[
106,
104
],
[
107,
106
],
[
100,
109
],
[
73,
109
],
[
125,
113
],
[
115,
116
],
[
118,
119
],
[
121,
122
],
[
127,
128
],
[
130,
131
]
] |
[
"import sys\n\nsys.setrecursionlimit(10 ** 8)\nini = lambda: int(sys.stdin.readline())\ninm = lambda: map(int, sys.stdin.readline().split())\ninl = lambda: list(inm())\nins = lambda: sys.stdin.readline().rstrip()\n# debug = lambda *a, **kw: print(*a, **kw, file=sys.stderr)\n\nS = ins()\n\n\ndef solve():\n N = len(S)\n i = 0\n j = 1\n flip = 0\n while j < N:\n while j < N and S[i] == S[j]:\n j += 1\n if j == N:\n break\n flip += 1\n i = j\n j += 1\n\n return flip\n\n\nprint(solve())",
"import sys",
"sys",
"sys.setrecursionlimit(10 ** 8)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 8",
"10",
"8",
"ini = lambda: int(sys.stdin.readline())",
"ini",
"lambda: int(sys.stdin.readline())",
"int(sys.stdin.readline())",
"int",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"inm = lambda: map(int, sys.stdin.readline().split())",
"inm",
"lambda: map(int, sys.stdin.readline().split())",
"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",
"inl = lambda: list(inm())",
"inl",
"lambda: list(inm())",
"list(inm())",
"list",
"inm()",
"inm",
"ins = lambda: sys.stdin.readline().rstrip()",
"ins",
"lambda: sys.stdin.readline().rstrip()",
"sys.stdin.readline().rstrip()",
"sys.stdin.readline().rstrip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"rstrip",
"S = ins()",
"S",
"ins()",
"ins",
"def solve():\n N = len(S)\n i = 0\n j = 1\n flip = 0\n while j < N:\n while j < N and S[i] == S[j]:\n j += 1\n if j == N:\n break\n flip += 1\n i = j\n j += 1\n\n return flip",
"solve",
"N = len(S)",
"N",
"len(S)",
"len",
"S",
"i = 0",
"i",
"0",
"j = 1",
"j",
"1",
"flip = 0",
"flip",
"0",
"while j < N:\n while j < N and S[i] == S[j]:\n j += 1\n if j == N:\n break\n flip += 1\n i = j\n j += 1\n\n ",
"j < N",
"j",
"N",
"while j < N and S[i] == S[j]:\n j += 1\n ",
"j < N and S[i] == S[j]",
"j < N",
"j",
"N",
"S[i] == S[j]",
"S[i]",
"S",
"i",
"S[j]",
"S",
"j",
"j += 1",
"j",
"1",
"if j == N:\n break\n ",
"j == N",
"j",
"N",
"break",
"flip += 1",
"flip",
"1",
"i = j",
"i",
"j",
"j += 1",
"j",
"1",
"return flip",
"flip",
"print(solve())",
"print",
"solve()",
"solve",
"ins = lambda: sys.stdin.readline().rstrip()",
"lambda: sys.stdin.readline().rstrip()",
"ins",
"inl = lambda: list(inm())",
"lambda: list(inm())",
"inl",
"ini = lambda: int(sys.stdin.readline())",
"lambda: int(sys.stdin.readline())",
"ini",
"def solve():\n N = len(S)\n i = 0\n j = 1\n flip = 0\n while j < N:\n while j < N and S[i] == S[j]:\n j += 1\n if j == N:\n break\n flip += 1\n i = j\n j += 1\n\n return flip",
"def solve():\n N = len(S)\n i = 0\n j = 1\n flip = 0\n while j < N:\n while j < N and S[i] == S[j]:\n j += 1\n if j == N:\n break\n flip += 1\n i = j\n j += 1\n\n return flip",
"solve",
"S = ins()",
"ins()",
"S",
"inm = lambda: map(int, sys.stdin.readline().split())",
"lambda: map(int, sys.stdin.readline().split())",
"inm"
] |
import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
# debug = lambda *a, **kw: print(*a, **kw, file=sys.stderr)
S = ins()
def solve():
N = len(S)
i = 0
j = 1
flip = 0
while j < N:
while j < N and S[i] == S[j]:
j += 1
if j == N:
break
flip += 1
i = j
j += 1
return flip
print(solve())
|
[
7,
12,
13,
0,
13,
4,
13,
41,
28,
13,
4,
13,
2,
4,
13,
13,
17,
40,
18,
13,
13,
18,
13,
2,
13,
17,
4,
17,
4,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
10,
9
],
[
4,
15
],
[
4,
19
],
[
9,
20
],
[
4,
22
],
[
9,
24
],
[
41,
38
]
] |
[
"def main():\n s = input()\n print(sum([1 for i in range(len(s) - 1) if s[i] != s[i + 1]]))\n\n\nif __name__ == '__main__':\n main()",
"def main():\n s = input()\n print(sum([1 for i in range(len(s) - 1) if s[i] != s[i + 1]]))",
"main",
"s = input()",
"s",
"input()",
"input",
"1 for i in range(len(s) - 1) if s[i] != s[i + 1]",
"for i in range(len(s) - 1) if s[i] != s[i + 1]",
"i",
"range(len(s) - 1)",
"range",
"len(s) - 1",
"len(s)",
"len",
"s",
"1",
"s[i] != s[i + 1]",
"s[i]",
"s",
"i",
"s[i + 1]",
"s",
"i + 1",
"i",
"1",
"if s[i] != s[i + 1]",
"1",
"print(sum([1 for i in range(len(s) - 1) if s[i] != s[i + 1]]))",
"print",
"sum([1 for i in range(len(s) - 1) if s[i] != s[i + 1]])",
"sum",
"[1 for i in range(len(s) - 1) if s[i] != s[i + 1]]",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n s = input()\n print(sum([1 for i in range(len(s) - 1) if s[i] != s[i + 1]]))",
"def main():\n s = input()\n print(sum([1 for i in range(len(s) - 1) if s[i] != s[i + 1]]))",
"main"
] |
def main():
s = input()
print(sum([1 for i in range(len(s) - 1) if s[i] != s[i + 1]]))
if __name__ == '__main__':
main()
|
[
7,
12,
13,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
9,
8
],
[
12,
11
],
[
4,
17
],
[
4,
22
],
[
11,
23
],
[
4,
25
],
[
11,
27
],
[
31,
30
],
[
30,
34
],
[
8,
34
],
[
43,
40
]
] |
[
"def solve():\n s = input()\n ans = 0\n for i in range(len(s)-1):\n if s[i] != s[i + 1]:\n ans += 1\n print(ans)\n\nif __name__ == '__main__':\n solve()",
"def solve():\n s = input()\n ans = 0\n for i in range(len(s)-1):\n if s[i] != s[i + 1]:\n ans += 1\n print(ans)",
"solve",
"s = input()",
"s",
"input()",
"input",
"ans = 0",
"ans",
"0",
"for i in range(len(s)-1):\n if s[i] != s[i + 1]:\n ans += 1\n ",
"i",
"range(len(s)-1)",
"range",
"len(s)-1",
"len(s)",
"len",
"s",
"1",
"if s[i] != s[i + 1]:\n ans += 1\n ",
"s[i] != s[i + 1]",
"s[i]",
"s",
"i",
"s[i + 1]",
"s",
"i + 1",
"i",
"1",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"if __name__ == '__main__':\n solve()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"solve()",
"solve",
"def solve():\n s = input()\n ans = 0\n for i in range(len(s)-1):\n if s[i] != s[i + 1]:\n ans += 1\n print(ans)",
"def solve():\n s = input()\n ans = 0\n for i in range(len(s)-1):\n if s[i] != s[i + 1]:\n ans += 1\n print(ans)",
"solve"
] |
def solve():
s = input()
ans = 0
for i in range(len(s)-1):
if s[i] != s[i + 1]:
ans += 1
print(ans)
if __name__ == '__main__':
solve()
|
[
7,
15,
13,
15,
15,
15,
13,
15,
13,
12,
13,
12,
13,
12,
13,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
17,
13,
10,
17,
13,
10,
12,
13,
10,
4,
13
] |
[
[
54,
16
],
[
58,
18
],
[
69,
20
],
[
55,
23
],
[
60,
25
],
[
29,
28
],
[
70,
32
],
[
55,
37
],
[
28,
38
],
[
55,
40
],
[
28,
42
],
[
63,
45
],
[
64,
49
],
[
61,
49
],
[
54,
55
],
[
60,
61
],
[
63,
64
],
[
69,
70
]
] |
[
"import sys\nfrom collections import Counter\nfrom collections import deque\nimport math\nimport bisect\ndef input(): return sys.stdin.readline().strip()\ndef mp(): return map(int,input().split())\ndef lmp(): return list(map(int,input().split()))\n\ns=input()\nn=len(s)\nans=0\nfor i in range(n-1):\n if s[i]!=s[i+1]:\n ans+=1\nprint(ans)",
"import sys",
"sys",
"from collections import Counter",
"from collections import deque",
"import math",
"math",
"import bisect",
"bisect",
"def input(): return sys.stdin.readline().strip()",
"input",
"def mp(): return map(int,input().split())",
"mp",
"def lmp(): return list(map(int,input().split()))",
"lmp",
"s=input()",
"s",
"input()",
"input",
"n=len(s)",
"n",
"len(s)",
"len",
"s",
"ans=0",
"ans",
"0",
"for i in range(n-1):\n if s[i]!=s[i+1]:\n ans+=1",
"i",
"range(n-1)",
"range",
"n-1",
"n",
"1",
"if s[i]!=s[i+1]:\n ans+=1",
"s[i]!=s[i+1]",
"s[i]",
"s",
"i",
"s[i+1]",
"s",
"i+1",
"i",
"1",
"ans+=1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"def mp(): return map(int,input().split())",
"def mp(): return map(int,input().split())",
"mp",
"s=input()",
"input()",
"s",
"def input(): return sys.stdin.readline().strip()",
"def input(): return sys.stdin.readline().strip()",
"input",
"ans=0",
"0",
"ans",
"ans+=1",
"1",
"ans",
"def lmp(): return list(map(int,input().split()))",
"def lmp(): return list(map(int,input().split()))",
"lmp",
"n=len(s)",
"len(s)",
"n"
] |
import sys
from collections import Counter
from collections import deque
import math
import bisect
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))
s=input()
n=len(s)
ans=0
for i in range(n-1):
if s[i]!=s[i+1]:
ans+=1
print(ans)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
17,
0,
13,
2,
18,
13,
17,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
2,
18,
13,
13,
17,
13,
0,
13,
17,
0,
13,
2,
18,
13,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
17,
13
] |
[
[
50,
2
],
[
59,
8
],
[
53,
11
],
[
51,
14
],
[
19,
18
],
[
51,
24
],
[
51,
29
],
[
18,
30
],
[
54,
32
],
[
57,
32
],
[
47,
34
],
[
56,
37
],
[
51,
40
],
[
18,
41
],
[
48,
45
],
[
60,
45
],
[
47,
48
],
[
50,
51
],
[
53,
54
],
[
56,
57
],
[
59,
60
]
] |
[
"S = list(input())\n\nans = 0\nB = S[0] == \"B\"\n\nfor i in range(1, len(S)):\n if (S[i] == \"B\") != B:\n ans += 1\n B = S[i] == \"B\"\nprint(ans)",
"S = list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"ans = 0",
"ans",
"0",
"B = S[0] == \"B\"",
"B",
"S[0] == \"B\"",
"S[0]",
"S",
"0",
"\"B\"",
"for i in range(1, len(S)):\n if (S[i] == \"B\") != B:\n ans += 1\n B = S[i] == \"B\"",
"i",
"range(1, len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"if (S[i] == \"B\") != B:\n ans += 1\n B = S[i] == \"B\"",
"(S[i] == \"B\") != B",
"S[i] == \"B\"",
"S[i]",
"S",
"i",
"\"B\"",
"B",
"ans += 1",
"ans",
"1",
"B = S[i] == \"B\"",
"B",
"S[i] == \"B\"",
"S[i]",
"S",
"i",
"\"B\"",
"print(ans)",
"print",
"ans",
"ans += 1",
"1",
"ans",
"S = list(input())",
"list(input())",
"S",
"B = S[0] == \"B\"",
"S[0] == \"B\"",
"B",
"B = S[i] == \"B\"",
"S[i] == \"B\"",
"B",
"ans = 0",
"0",
"ans"
] |
S = list(input())
ans = 0
B = S[0] == "B"
for i in range(1, len(S)):
if (S[i] == "B") != B:
ans += 1
B = S[i] == "B"
print(ans)
|
[
7,
12,
13,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
13,
14,
40,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
9,
8
],
[
4,
10
],
[
14,
13
],
[
17,
16
],
[
4,
16
],
[
16,
20
],
[
8,
21
],
[
26,
21
],
[
24,
23
],
[
27,
26
],
[
16,
27
],
[
23,
30
],
[
13,
30
],
[
35,
32
]
] |
[
"def resolve():\n S = input()\n # 色が変わる回数=色を統一するために必要な手数\n prev_color = S[0]\n color_change_count = 0\n for s in S:\n if s != prev_color:\n color_change_count += 1\n prev_color = s\n print(color_change_count)\n\nresolve()",
"def resolve():\n S = input()\n # 色が変わる回数=色を統一するために必要な手数\n prev_color = S[0]\n color_change_count = 0\n for s in S:\n if s != prev_color:\n color_change_count += 1\n prev_color = s\n print(color_change_count)",
"resolve",
"S = input()",
"S",
"input()",
"input",
"prev_color = S[0]",
"prev_color",
"S[0]",
"S",
"0",
"color_change_count = 0",
"color_change_count",
"0",
"for s in S:\n if s != prev_color:\n color_change_count += 1\n prev_color = s\n ",
"s",
"S",
"if s != prev_color:\n color_change_count += 1\n prev_color = s\n ",
"s != prev_color",
"s",
"prev_color",
"color_change_count += 1",
"color_change_count",
"1",
"prev_color = s",
"prev_color",
"s",
"print(color_change_count)",
"print",
"color_change_count",
"resolve()",
"resolve",
"def resolve():\n S = input()\n # 色が変わる回数=色を統一するために必要な手数\n prev_color = S[0]\n color_change_count = 0\n for s in S:\n if s != prev_color:\n color_change_count += 1\n prev_color = s\n print(color_change_count)",
"def resolve():\n S = input()\n # 色が変わる回数=色を統一するために必要な手数\n prev_color = S[0]\n color_change_count = 0\n for s in S:\n if s != prev_color:\n color_change_count += 1\n prev_color = s\n print(color_change_count)",
"resolve"
] |
def resolve():
S = input()
# 色が変わる回数=色を統一するために必要な手数
prev_color = S[0]
color_change_count = 0
for s in S:
if s != prev_color:
color_change_count += 1
prev_color = s
print(color_change_count)
resolve()
|
[
7,
0,
13,
4,
13,
0,
13,
4,
18,
13,
13,
17,
0,
13,
4,
18,
13,
13,
17,
4,
13,
2,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
28,
2
],
[
31,
6
],
[
29,
9
],
[
25,
13
],
[
29,
16
],
[
32,
22
],
[
26,
23
],
[
25,
26
],
[
28,
29
],
[
31,
32
]
] |
[
"a = input()\n\np = a.count(\"WB\")\nq = a.count(\"BW\")\n\nprint(p + q)",
"a = input()",
"a",
"input()",
"input",
"p = a.count(\"WB\")",
"p",
"a.count(\"WB\")",
"a.count",
"a",
"count",
"\"WB\"",
"q = a.count(\"BW\")",
"q",
"a.count(\"BW\")",
"a.count",
"a",
"count",
"\"BW\"",
"print(p + q)",
"print",
"p + q",
"p",
"q",
"q = a.count(\"BW\")",
"a.count(\"BW\")",
"q",
"a = input()",
"input()",
"a",
"p = a.count(\"WB\")",
"a.count(\"WB\")",
"p"
] |
a = input()
p = a.count("WB")
q = a.count("BW")
print(p + q)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
13,
17,
0,
13,
18,
13,
13,
9,
14,
2,
13,
18,
13,
13,
9,
0,
13,
18,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13
] |
[
[
61,
2
],
[
58,
8
],
[
49,
11
],
[
15,
14
],
[
62,
19
],
[
50,
22
],
[
65,
22
],
[
53,
22
],
[
52,
25
],
[
62,
27
],
[
14,
28
],
[
53,
32
],
[
50,
32
],
[
65,
32
],
[
62,
34
],
[
14,
35
],
[
64,
38
],
[
62,
40
],
[
14,
41
],
[
55,
43
],
[
56,
47
],
[
59,
47
],
[
49,
50
],
[
52,
53
],
[
55,
56
],
[
58,
59
],
[
61,
62
],
[
64,
65
]
] |
[
"s = list(input())\n\ncnt = 0\ncheck = \"\"\n\nfor i in range(len(s)):\n if check == \"\":\n check = s[i]\n continue\n\n if check == s[i]:\n continue\n else:\n check = s[i]\n cnt += 1\n\n\nprint(cnt)",
"s = list(input())",
"s",
"list(input())",
"list",
"input()",
"input",
"cnt = 0",
"cnt",
"0",
"check = \"\"",
"check",
"\"\"",
"for i in range(len(s)):\n if check == \"\":\n check = s[i]\n continue\n\n if check == s[i]:\n continue\n else:\n check = s[i]\n cnt += 1",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if check == \"\":\n check = s[i]\n continue\n\n ",
"check == \"\"",
"check",
"\"\"",
"check = s[i]",
"check",
"s[i]",
"s",
"i",
"continue",
"if check == s[i]:\n continue\n else:\n check = s[i]\n cnt += 1",
"check == s[i]",
"check",
"s[i]",
"s",
"i",
"continue",
"check = s[i]",
"check",
"s[i]",
"s",
"i",
"cnt += 1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"check = \"\"",
"\"\"",
"check",
"check = s[i]",
"s[i]",
"check",
"cnt += 1",
"1",
"cnt",
"cnt = 0",
"0",
"cnt",
"s = list(input())",
"list(input())",
"s",
"check = s[i]",
"s[i]",
"check"
] |
s = list(input())
cnt = 0
check = ""
for i in range(len(s)):
if check == "":
check = s[i]
continue
if check == s[i]:
continue
else:
check = s[i]
cnt += 1
print(cnt)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
13,
28,
13,
18,
13,
39,
17,
14,
40,
13,
13,
0,
13,
13,
0,
13,
13,
4,
13,
2,
4,
13,
13,
17,
10,
18,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13
] |
[
[
42,
2
],
[
39,
8
],
[
43,
10
],
[
45,
13
],
[
40,
14
],
[
17,
16
],
[
43,
18
],
[
40,
23
],
[
49,
23
],
[
16,
24
],
[
48,
26
],
[
16,
27
],
[
51,
29
],
[
49,
30
],
[
40,
30
],
[
52,
36
],
[
46,
36
],
[
39,
40
],
[
42,
43
],
[
40,
45
],
[
45,
46
],
[
16,
48
],
[
48,
49
],
[
49,
51
],
[
40,
51
],
[
51,
52
]
] |
[
"S = list(input())\n\ncheck=S[0]\nS_=check\nfor s in S[1:]:\n if check != s:\n check = s\n S_+=check\n \nprint(len(S_)-1)",
"S = list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"check=S[0]",
"check",
"S[0]",
"S",
"0",
"S_=check",
"S_",
"check",
"for s in S[1:]:\n if check != s:\n check = s\n S_+=check\n ",
"s",
"S[1:]",
"S",
"1:",
"1",
"if check != s:\n check = s\n S_+=check\n ",
"check != s",
"check",
"s",
"check = s",
"check",
"s",
"S_+=check",
"S_",
"check",
"print(len(S_)-1)",
"print",
"len(S_)-1",
"len(S_)",
"len",
"S_",
"1",
"check=S[0]",
"S[0]",
"check",
"S = list(input())",
"list(input())",
"S",
"S_=check",
"check",
"S_",
"check = s",
"s",
"check",
"S_+=check",
"check",
"S_"
] |
S = list(input())
check=S[0]
S_=check
for s in S[1:]:
if check != s:
check = s
S_+=check
print(len(S_)-1)
|
[
7,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
4,
13,
0,
13,
17,
0,
13,
17,
42,
2,
13,
4,
13,
13,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
0,
13,
17,
4,
13,
2,
13,
17,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13
] |
[
[
114,
20
],
[
105,
25
],
[
102,
32
],
[
120,
41
],
[
117,
50
],
[
123,
59
],
[
96,
63
],
[
108,
66
],
[
97,
70
],
[
112,
70
],
[
124,
73
],
[
124,
77
],
[
97,
78
],
[
112,
78
],
[
124,
80
],
[
97,
82
],
[
112,
82
],
[
99,
85
],
[
111,
88
],
[
100,
93
],
[
109,
93
],
[
96,
97
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
120,
121
],
[
123,
124
]
] |
[
"import sys\nimport itertools\n# import numpy as np\nimport time\nimport math\nimport heapq\nfrom collections import defaultdict\nsys.setrecursionlimit(10 ** 7)\n \nINF = 10 ** 18\nMOD = 10 ** 9 + 7\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n# map(int, input().split())\n\nS = input()\n\ni = 1\ncount = 1\nwhile i < len(S):\n if S[i] != S[i - 1]:\n count += 1\n i += 1\nprint(count - 1)",
"import sys",
"sys",
"import itertools",
"itertools",
"import time",
"time",
"import math",
"math",
"import heapq",
"heapq",
"from collections import defaultdict",
"sys.setrecursionlimit(10 ** 7)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 7",
"10",
"7",
"INF = 10 ** 18",
"INF",
"10 ** 18",
"10",
"18",
"MOD = 10 ** 9 + 7",
"MOD",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"read = sys.stdin.buffer.read",
"read",
"sys.stdin.buffer.read",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"read",
"readline = sys.stdin.buffer.readline",
"readline",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"readlines = sys.stdin.buffer.readlines",
"readlines",
"sys.stdin.buffer.readlines",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readlines",
"S = input()",
"S",
"input()",
"input",
"i = 1",
"i",
"1",
"count = 1",
"count",
"1",
"while i < len(S):\n if S[i] != S[i - 1]:\n count += 1\n i += 1",
"i < len(S)",
"i",
"len(S)",
"len",
"S",
"if S[i] != S[i - 1]:\n count += 1\n ",
"S[i] != S[i - 1]",
"S[i]",
"S",
"i",
"S[i - 1]",
"S",
"i - 1",
"i",
"1",
"count += 1",
"count",
"1",
"i += 1",
"i",
"1",
"print(count - 1)",
"print",
"count - 1",
"count",
"1",
"i = 1",
"1",
"i",
"count += 1",
"1",
"count",
"read = sys.stdin.buffer.read",
"sys.stdin.buffer.read",
"read",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"count = 1",
"1",
"count",
"i += 1",
"1",
"i",
"INF = 10 ** 18",
"10 ** 18",
"INF",
"readlines = sys.stdin.buffer.readlines",
"sys.stdin.buffer.readlines",
"readlines",
"readline = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"readline",
"S = input()",
"input()",
"S"
] |
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split())
S = input()
i = 1
count = 1
while i < len(S):
if S[i] != S[i - 1]:
count += 1
i += 1
print(count - 1)
|
[
7,
12,
13,
29,
4,
13,
4,
18,
4,
13,
13,
12,
13,
29,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
13,
13,
17,
12,
13,
0,
13,
4,
18,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
29,
13,
14,
2,
13,
17,
4,
13,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] |
[
[
32,
31
],
[
39,
38
],
[
42,
41
],
[
31,
47
],
[
31,
51
],
[
41,
52
],
[
31,
54
],
[
41,
56
],
[
60,
59
],
[
59,
62
],
[
38,
62
],
[
76,
70
]
] |
[
"\n\ndef read_int():\n return int(input().strip())\n\n\ndef read_ints():\n return list(map(int, input().strip().split(' ')))\n\n\ndef solve():\n S = input().strip()\n ans = 0\n for i in range(1, len(S)):\n if S[i] != S[i-1]:\n ans += 1\n return ans\n\n\nif __name__ == '__main__':\n print(solve())",
"def read_int():\n return int(input().strip())",
"read_int",
"return int(input().strip())",
"int(input().strip())",
"int",
"input().strip()",
"().strip",
"()",
"input",
"strip",
"def read_ints():\n return list(map(int, input().strip().split(' ')))",
"read_ints",
"return list(map(int, input().strip().split(' ')))",
"list(map(int, input().strip().split(' ')))",
"list",
"map(int, input().strip().split(' '))",
"map",
"int",
"input().strip().split(' ')",
"().strip().split",
"().strip()",
"().strip",
"()",
"input",
"strip",
"split",
"' '",
"def solve():\n S = input().strip()\n ans = 0\n for i in range(1, len(S)):\n if S[i] != S[i-1]:\n ans += 1\n return ans",
"solve",
"S = input().strip()",
"S",
"input().strip()",
"().strip",
"()",
"input",
"strip",
"ans = 0",
"ans",
"0",
"for i in range(1, len(S)):\n if S[i] != S[i-1]:\n ans += 1\n ",
"i",
"range(1, len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"if S[i] != S[i-1]:\n ans += 1\n ",
"S[i] != S[i-1]",
"S[i]",
"S",
"i",
"S[i-1]",
"S",
"i-1",
"i",
"1",
"ans += 1",
"ans",
"1",
"return ans",
"ans",
"if __name__ == '__main__':\n print(solve())",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"print(solve())",
"print",
"solve()",
"solve",
"def read_int():\n return int(input().strip())",
"def read_int():\n return int(input().strip())",
"read_int",
"def solve():\n S = input().strip()\n ans = 0\n for i in range(1, len(S)):\n if S[i] != S[i-1]:\n ans += 1\n return ans",
"def solve():\n S = input().strip()\n ans = 0\n for i in range(1, len(S)):\n if S[i] != S[i-1]:\n ans += 1\n return ans",
"solve",
"def read_ints():\n return list(map(int, input().strip().split(' ')))",
"def read_ints():\n return list(map(int, input().strip().split(' ')))",
"read_ints"
] |
def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(' ')))
def solve():
S = input().strip()
ans = 0
for i in range(1, len(S)):
if S[i] != S[i-1]:
ans += 1
return ans
if __name__ == '__main__':
print(solve())
|
[
7,
0,
13,
4,
13,
4,
13,
2,
4,
18,
13,
13,
17,
4,
18,
13,
13,
17,
10,
4,
13
] |
[
[
19,
2
],
[
20,
10
],
[
20,
15
],
[
19,
20
]
] |
[
"s = input()\nprint(s.count(\"BW\")+s.count(\"WB\"))",
"s = input()",
"s",
"input()",
"input",
"print(s.count(\"BW\")+s.count(\"WB\"))",
"print",
"s.count(\"BW\")+s.count(\"WB\")",
"s.count(\"BW\")",
"s.count",
"s",
"count",
"\"BW\"",
"s.count(\"WB\")",
"s.count",
"s",
"count",
"\"WB\"",
"s = input()",
"input()",
"s"
] |
s = input()
print(s.count("BW")+s.count("WB"))
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
18,
13,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
4,
13,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13
] |
[
[
45,
2
],
[
51,
6
],
[
46,
8
],
[
48,
11
],
[
15,
14
],
[
46,
20
],
[
46,
24
],
[
14,
25
],
[
52,
26
],
[
43,
26
],
[
39,
28
],
[
42,
31
],
[
46,
33
],
[
14,
34
],
[
40,
37
],
[
49,
37
],
[
39,
40
],
[
42,
43
],
[
45,
46
],
[
48,
49
],
[
51,
52
]
] |
[
"s=input()\na=s[0]\nc=0\nfor i in range(1,len(s)):\n if s[i]!=a:\n c+=1;a=s[i]\nprint(c)",
"s=input()",
"s",
"input()",
"input",
"a=s[0]",
"a",
"s[0]",
"s",
"0",
"c=0",
"c",
"0",
"for i in range(1,len(s)):\n if s[i]!=a:\n c+=1;a=s[i]",
"i",
"range(1,len(s))",
"range",
"1",
"len(s)",
"len",
"s",
"if s[i]!=a:\n c+=1;a=s[i]",
"s[i]!=a",
"s[i]",
"s",
"i",
"a",
"c+=1",
"c",
"1",
"a=s[i]",
"a",
"s[i]",
"s",
"i",
"print(c)",
"print",
"c",
"c+=1",
"1",
"c",
"a=s[i]",
"s[i]",
"a",
"s=input()",
"input()",
"s",
"c=0",
"0",
"c",
"a=s[0]",
"s[0]",
"a"
] |
s=input()
a=s[0]
c=0
for i in range(1,len(s)):
if s[i]!=a:
c+=1;a=s[i]
print(c)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
13,
9,
0,
13,
13,
0,
13,
17,
4,
13,
2,
13,
17,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13
] |
[
[
36,
2
],
[
39,
8
],
[
33,
11
],
[
15,
14
],
[
37,
14
],
[
34,
18
],
[
46,
18
],
[
14,
19
],
[
45,
22
],
[
14,
23
],
[
42,
25
],
[
43,
30
],
[
40,
30
],
[
33,
34
],
[
36,
37
],
[
39,
40
],
[
42,
43
],
[
14,
45
],
[
45,
46
]
] |
[
"S = list(input())\ncount = 0\nt = ''\nfor i in S:\n if t == i:\n continue\n else:\n t = i\n count += 1\nprint(count - 1)",
"S = list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"count = 0",
"count",
"0",
"t = ''",
"t",
"''",
"for i in S:\n if t == i:\n continue\n else:\n t = i\n count += 1",
"i",
"S",
"if t == i:\n continue\n else:\n t = i\n count += 1",
"t == i",
"t",
"i",
"continue",
"t = i",
"t",
"i",
"count += 1",
"count",
"1",
"print(count - 1)",
"print",
"count - 1",
"count",
"1",
"t = ''",
"''",
"t",
"S = list(input())",
"list(input())",
"S",
"count = 0",
"0",
"count",
"count += 1",
"1",
"count",
"t = i",
"i",
"t"
] |
S = list(input())
count = 0
t = ''
for i in S:
if t == i:
continue
else:
t = i
count += 1
print(count - 1)
|
[
7,
0,
13,
4,
13,
14,
2,
4,
13,
13,
17,
4,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] |
[
[
43,
2
],
[
44,
9
],
[
46,
15
],
[
19,
18
],
[
44,
24
],
[
44,
29
],
[
18,
30
],
[
44,
32
],
[
18,
34
],
[
49,
37
],
[
50,
41
],
[
47,
41
],
[
43,
44
],
[
46,
47
],
[
49,
50
]
] |
[
"s = input()\nif len(s) == 1:\n print(0)\nelse:\n cnt = 0\n for i in range(len(s)-1):\n if s[i] != s[i+1]:\n cnt += 1\n\n print(cnt)",
"s = input()",
"s",
"input()",
"input",
"if len(s) == 1:\n print(0)\nelse:\n cnt = 0\n for i in range(len(s)-1):\n if s[i] != s[i+1]:\n cnt += 1\n\n print(cnt)",
"len(s) == 1",
"len(s)",
"len",
"s",
"1",
"print(0)",
"print",
"0",
"cnt = 0",
"cnt",
"0",
"for i in range(len(s)-1):\n if s[i] != s[i+1]:\n cnt += 1\n\n ",
"i",
"range(len(s)-1)",
"range",
"len(s)-1",
"len(s)",
"len",
"s",
"1",
"if s[i] != s[i+1]:\n cnt += 1\n\n ",
"s[i] != s[i+1]",
"s[i]",
"s",
"i",
"s[i+1]",
"s",
"i+1",
"i",
"1",
"cnt += 1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"s = input()",
"input()",
"s",
"cnt = 0",
"0",
"cnt",
"cnt += 1",
"1",
"cnt"
] |
s = input()
if len(s) == 1:
print(0)
else:
cnt = 0
for i in range(len(s)-1):
if s[i] != s[i+1]:
cnt += 1
print(cnt)
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
13,
14,
40,
13,
13,
0,
13,
13,
0,
13,
17,
4,
13,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13
] |
[
[
33,
2
],
[
30,
6
],
[
34,
8
],
[
36,
11
],
[
15,
14
],
[
34,
14
],
[
31,
18
],
[
40,
18
],
[
14,
19
],
[
39,
21
],
[
14,
22
],
[
42,
24
],
[
43,
28
],
[
37,
28
],
[
30,
31
],
[
33,
34
],
[
36,
37
],
[
14,
39
],
[
39,
40
],
[
42,
43
]
] |
[
"s = input()\n\npivot = s[0]\nresult = 0\nfor c in s:\n if pivot != c:\n pivot = c\n result += 1\nprint(result)",
"s = input()",
"s",
"input()",
"input",
"pivot = s[0]",
"pivot",
"s[0]",
"s",
"0",
"result = 0",
"result",
"0",
"for c in s:\n if pivot != c:\n pivot = c\n result += 1",
"c",
"s",
"if pivot != c:\n pivot = c\n result += 1",
"pivot != c",
"pivot",
"c",
"pivot = c",
"pivot",
"c",
"result += 1",
"result",
"1",
"print(result)",
"print",
"result",
"pivot = s[0]",
"s[0]",
"pivot",
"s = input()",
"input()",
"s",
"result = 0",
"0",
"result",
"pivot = c",
"c",
"pivot",
"result += 1",
"1",
"result"
] |
s = input()
pivot = s[0]
result = 0
for c in s:
if pivot != c:
pivot = c
result += 1
print(result)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
18,
13,
13,
0,
13,
17,
0,
13,
17,
4,
13,
2,
13,
17,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13
] |
[
[
53,
2
],
[
68,
6
],
[
74,
9
],
[
54,
11
],
[
77,
14
],
[
18,
17
],
[
54,
23
],
[
54,
27
],
[
17,
28
],
[
75,
29
],
[
66,
29
],
[
71,
31
],
[
59,
34
],
[
65,
37
],
[
54,
39
],
[
17,
40
],
[
62,
42
],
[
56,
45
],
[
57,
50
],
[
60,
50
],
[
69,
50
],
[
53,
54
],
[
56,
57
],
[
59,
60
],
[
62,
63
],
[
65,
66
],
[
68,
69
],
[
71,
72
],
[
74,
75
],
[
77,
78
]
] |
[
"s = input()\ncnt = 0\ncur = s[0]\nstrk = 1\n\nfor i in range(1, len(s)):\n if s[i] == cur:\n strk += 1\n else:\n cnt += 1\n cur = s[i]\n strk = 1\n\ncnt += 1\n\nprint(cnt-1)",
"s = input()",
"s",
"input()",
"input",
"cnt = 0",
"cnt",
"0",
"cur = s[0]",
"cur",
"s[0]",
"s",
"0",
"strk = 1",
"strk",
"1",
"for i in range(1, len(s)):\n if s[i] == cur:\n strk += 1\n else:\n cnt += 1\n cur = s[i]\n strk = 1",
"i",
"range(1, len(s))",
"range",
"1",
"len(s)",
"len",
"s",
"if s[i] == cur:\n strk += 1\n else:\n cnt += 1\n cur = s[i]\n strk = 1",
"s[i] == cur",
"s[i]",
"s",
"i",
"cur",
"strk += 1",
"strk",
"1",
"cnt += 1",
"cnt",
"1",
"cur = s[i]",
"cur",
"s[i]",
"s",
"i",
"strk = 1",
"strk",
"1",
"cnt += 1",
"cnt",
"1",
"print(cnt-1)",
"print",
"cnt-1",
"cnt",
"1",
"s = input()",
"input()",
"s",
"cnt += 1",
"1",
"cnt",
"cnt += 1",
"1",
"cnt",
"strk = 1",
"1",
"strk",
"cur = s[i]",
"s[i]",
"cur",
"cnt = 0",
"0",
"cnt",
"strk += 1",
"1",
"strk",
"cur = s[0]",
"s[0]",
"cur",
"strk = 1",
"1",
"strk"
] |
s = input()
cnt = 0
cur = s[0]
strk = 1
for i in range(1, len(s)):
if s[i] == cur:
strk += 1
else:
cnt += 1
cur = s[i]
strk = 1
cnt += 1
print(cnt-1)
|
[
7,
15,
0,
13,
4,
13,
0,
13,
4,
13,
13,
4,
13,
2,
4,
13,
4,
13,
13,
17,
10,
4,
13,
10,
4,
13
] |
[
[
21,
3
],
[
24,
7
],
[
22,
10
],
[
25,
18
],
[
21,
22
],
[
24,
25
]
] |
[
"from itertools import groupby\nS = input()\ngr = groupby(S)\nprint(len(list(gr))-1)",
"from itertools import groupby",
"S = input()",
"S",
"input()",
"input",
"gr = groupby(S)",
"gr",
"groupby(S)",
"groupby",
"S",
"print(len(list(gr))-1)",
"print",
"len(list(gr))-1",
"len(list(gr))",
"len",
"list(gr)",
"list",
"gr",
"1",
"S = input()",
"input()",
"S",
"gr = groupby(S)",
"groupby(S)",
"gr"
] |
from itertools import groupby
S = input()
gr = groupby(S)
print(len(list(gr))-1)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
13,
17,
0,
13,
18,
13,
17,
14,
40,
13,
18,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13
] |
[
[
45,
2
],
[
57,
6
],
[
51,
9
],
[
13,
12
],
[
46,
17
],
[
12,
20
],
[
54,
23
],
[
46,
25
],
[
52,
29
],
[
49,
29
],
[
55,
29
],
[
46,
31
],
[
12,
32
],
[
60,
34
],
[
48,
37
],
[
46,
39
],
[
12,
40
],
[
61,
43
],
[
58,
43
],
[
45,
46
],
[
48,
49
],
[
51,
52
],
[
54,
55
],
[
57,
58
],
[
60,
61
]
] |
[
"s = input()\nans = 0\niro = ''\n\nfor i in range(len(s)):\n if i == 0:\n iro = s[0]\n elif iro != s[i]:\n ans += 1\n iro = s[i]\n\nprint(ans)",
"s = input()",
"s",
"input()",
"input",
"ans = 0",
"ans",
"0",
"iro = ''",
"iro",
"''",
"for i in range(len(s)):\n if i == 0:\n iro = s[0]\n elif iro != s[i]:\n ans += 1\n iro = s[i]",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if i == 0:\n iro = s[0]\n elif iro != s[i]:\n ans += 1\n iro = s[i]",
"i == 0",
"i",
"0",
"iro = s[0]",
"iro",
"s[0]",
"s",
"0",
"elif iro != s[i]:\n ans += 1\n iro = s[i]",
"iro != s[i]",
"iro",
"s[i]",
"s",
"i",
"ans += 1",
"ans",
"1",
"iro = s[i]",
"iro",
"s[i]",
"s",
"i",
"print(ans)",
"print",
"ans",
"s = input()",
"input()",
"s",
"iro = s[i]",
"s[i]",
"iro",
"iro = ''",
"''",
"iro",
"iro = s[0]",
"s[0]",
"iro",
"ans = 0",
"0",
"ans",
"ans += 1",
"1",
"ans"
] |
s = input()
ans = 0
iro = ''
for i in range(len(s)):
if i == 0:
iro = s[0]
elif iro != s[i]:
ans += 1
iro = s[i]
print(ans)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
18,
13,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
18,
13,
10,
17,
13
] |
[
[
44,
2
],
[
41,
8
],
[
47,
11
],
[
45,
13
],
[
17,
16
],
[
45,
22
],
[
45,
26
],
[
16,
27
],
[
48,
28
],
[
51,
28
],
[
53,
30
],
[
50,
33
],
[
45,
35
],
[
16,
36
],
[
54,
39
],
[
42,
39
],
[
41,
42
],
[
44,
45
],
[
47,
48
],
[
50,
51
],
[
53,
54
]
] |
[
"S = list(input())\nc=0\nfirst = S[0]\nfor i in range(1,len(S)):\n if S[i] != first:\n c+=1\n first = S[i]\nprint(c)\n ",
"S = list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"c=0",
"c",
"0",
"first = S[0]",
"first",
"S[0]",
"S",
"0",
"for i in range(1,len(S)):\n if S[i] != first:\n c+=1\n first = S[i]",
"i",
"range(1,len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"if S[i] != first:\n c+=1\n first = S[i]",
"S[i] != first",
"S[i]",
"S",
"i",
"first",
"c+=1",
"c",
"1",
"first = S[i]",
"first",
"S[i]",
"S",
"i",
"print(c)",
"print",
"c",
"c=0",
"0",
"c",
"S = list(input())",
"list(input())",
"S",
"first = S[0]",
"S[0]",
"first",
"first = S[i]",
"S[i]",
"first",
"c+=1",
"1",
"c"
] |
S = list(input())
c=0
first = S[0]
for i in range(1,len(S)):
if S[i] != first:
c+=1
first = S[i]
print(c)
|
[
7,
15,
13,
0,
13,
4,
13,
0,
13,
4,
18,
13,
13,
13,
0,
13,
17,
28,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13
] |
[
[
37,
4
],
[
28,
8
],
[
38,
13
],
[
34,
15
],
[
31,
22
],
[
32,
26
],
[
35,
26
],
[
28,
29
],
[
31,
32
],
[
34,
35
],
[
37,
38
]
] |
[
"import itertools\n\nS=input()\n\nS_=itertools.groupby(S)\ncnt=-1\nfor key,gr in S_:\n\tcnt+=1\n\nprint(cnt)",
"import itertools",
"itertools",
"S=input()",
"S",
"input()",
"input",
"S_=itertools.groupby(S)",
"S_",
"itertools.groupby(S)",
"itertools.groupby",
"itertools",
"groupby",
"S",
"cnt=-1",
"cnt",
"-1",
"for key,gr in S_:\n\tcnt+=1",
"key",
"gr",
"S_",
"cnt+=1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"S_=itertools.groupby(S)",
"itertools.groupby(S)",
"S_",
"cnt+=1",
"1",
"cnt",
"cnt=-1",
"-1",
"cnt",
"S=input()",
"input()",
"S"
] |
import itertools
S=input()
S_=itertools.groupby(S)
cnt=-1
for key,gr in S_:
cnt+=1
print(cnt)
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
13,
14,
40,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13
] |
[
[
33,
2
],
[
30,
6
],
[
34,
8
],
[
42,
11
],
[
15,
14
],
[
34,
14
],
[
14,
18
],
[
31,
19
],
[
40,
19
],
[
36,
21
],
[
39,
24
],
[
14,
25
],
[
37,
28
],
[
43,
28
],
[
30,
31
],
[
33,
34
],
[
36,
37
],
[
14,
39
],
[
39,
40
],
[
42,
43
]
] |
[
"s = input()\nex = s[0]\ncount = 0\nfor c in s:\n if c!= ex:\n count +=1\n ex = c\nprint(count)",
"s = input()",
"s",
"input()",
"input",
"ex = s[0]",
"ex",
"s[0]",
"s",
"0",
"count = 0",
"count",
"0",
"for c in s:\n if c!= ex:\n count +=1\n ex = c",
"c",
"s",
"if c!= ex:\n count +=1\n ex = c",
"c!= ex",
"c",
"ex",
"count +=1",
"count",
"1",
"ex = c",
"ex",
"c",
"print(count)",
"print",
"count",
"ex = s[0]",
"s[0]",
"ex",
"s = input()",
"input()",
"s",
"count +=1",
"1",
"count",
"ex = c",
"c",
"ex",
"count = 0",
"0",
"count"
] |
s = input()
ex = s[0]
count = 0
for c in s:
if c!= ex:
count +=1
ex = c
print(count)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] |
[
[
34,
2
],
[
37,
6
],
[
10,
9
],
[
35,
15
],
[
35,
20
],
[
9,
21
],
[
35,
23
],
[
9,
25
],
[
40,
28
],
[
41,
32
],
[
38,
32
],
[
34,
35
],
[
37,
38
],
[
40,
41
]
] |
[
"s = input()\ncount = 0\n\nfor i in range(len(s)-1):\n if s[i] != s[i+1]:\n count += 1\nprint(count)",
"s = input()",
"s",
"input()",
"input",
"count = 0",
"count",
"0",
"for i in range(len(s)-1):\n if s[i] != s[i+1]:\n count += 1",
"i",
"range(len(s)-1)",
"range",
"len(s)-1",
"len(s)",
"len",
"s",
"1",
"if s[i] != s[i+1]:\n count += 1",
"s[i] != s[i+1]",
"s[i]",
"s",
"i",
"s[i+1]",
"s",
"i+1",
"i",
"1",
"count += 1",
"count",
"1",
"print(count)",
"print",
"count",
"s = input()",
"input()",
"s",
"count = 0",
"0",
"count",
"count += 1",
"1",
"count"
] |
s = input()
count = 0
for i in range(len(s)-1):
if s[i] != s[i+1]:
count += 1
print(count)
|
[
7,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13
] |
[
[
46,
2
],
[
37,
6
],
[
47,
9
],
[
40,
11
],
[
15,
14
],
[
38,
18
],
[
47,
23
],
[
14,
24
],
[
47,
26
],
[
14,
28
],
[
43,
31
],
[
44,
35
],
[
41,
35
],
[
37,
38
],
[
40,
41
],
[
43,
44
],
[
46,
47
]
] |
[
"S = input()\nn = len(S)\ncnt = 0\nfor i in range(n-1):\n if S[i]!=S[i+1]:\n cnt += 1\nprint(cnt)",
"S = input()",
"S",
"input()",
"input",
"n = len(S)",
"n",
"len(S)",
"len",
"S",
"cnt = 0",
"cnt",
"0",
"for i in range(n-1):\n if S[i]!=S[i+1]:\n cnt += 1",
"i",
"range(n-1)",
"range",
"n-1",
"n",
"1",
"if S[i]!=S[i+1]:\n cnt += 1",
"S[i]!=S[i+1]",
"S[i]",
"S",
"i",
"S[i+1]",
"S",
"i+1",
"i",
"1",
"cnt += 1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"n = len(S)",
"len(S)",
"n",
"cnt = 0",
"0",
"cnt",
"cnt += 1",
"1",
"cnt",
"S = input()",
"input()",
"S"
] |
S = input()
n = len(S)
cnt = 0
for i in range(n-1):
if S[i]!=S[i+1]:
cnt += 1
print(cnt)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
40,
13,
13,
0,
13,
13,
0,
13,
17,
4,
13,
2,
13,
17,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13
] |
[
[
42,
2
],
[
36,
6
],
[
30,
9
],
[
13,
12
],
[
43,
12
],
[
12,
16
],
[
37,
17
],
[
40,
17
],
[
39,
19
],
[
12,
20
],
[
33,
22
],
[
34,
27
],
[
31,
27
],
[
30,
31
],
[
33,
34
],
[
36,
37
],
[
12,
39
],
[
39,
40
],
[
42,
43
]
] |
[
"S = input()\nnow = 1\ncnt = 0\nfor s in S:\n if s != now:\n now = s\n cnt += 1\nprint(cnt -1)",
"S = input()",
"S",
"input()",
"input",
"now = 1",
"now",
"1",
"cnt = 0",
"cnt",
"0",
"for s in S:\n if s != now:\n now = s\n cnt += 1",
"s",
"S",
"if s != now:\n now = s\n cnt += 1",
"s != now",
"s",
"now",
"now = s",
"now",
"s",
"cnt += 1",
"cnt",
"1",
"print(cnt -1)",
"print",
"cnt -1",
"cnt",
"1",
"cnt = 0",
"0",
"cnt",
"cnt += 1",
"1",
"cnt",
"now = 1",
"1",
"now",
"now = s",
"s",
"now",
"S = input()",
"input()",
"S"
] |
S = input()
now = 1
cnt = 0
for s in S:
if s != now:
now = s
cnt += 1
print(cnt -1)
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
13,
18,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
4,
13,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] |
[
[
45,
2
],
[
42,
6
],
[
46,
8
],
[
48,
11
],
[
15,
14
],
[
46,
20
],
[
43,
23
],
[
40,
23
],
[
46,
25
],
[
14,
26
],
[
51,
28
],
[
39,
31
],
[
46,
33
],
[
14,
34
],
[
52,
37
],
[
49,
37
],
[
39,
40
],
[
42,
43
],
[
45,
46
],
[
48,
49
],
[
51,
52
]
] |
[
"S = input()\n\npre = S[0]\nres = 0\nfor i in range(1, len(S)):\n if pre != S[i]:\n res += 1\n pre = S[i]\n\nprint(res)",
"S = input()",
"S",
"input()",
"input",
"pre = S[0]",
"pre",
"S[0]",
"S",
"0",
"res = 0",
"res",
"0",
"for i in range(1, len(S)):\n if pre != S[i]:\n res += 1\n pre = S[i]",
"i",
"range(1, len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"if pre != S[i]:\n res += 1\n pre = S[i]",
"pre != S[i]",
"pre",
"S[i]",
"S",
"i",
"res += 1",
"res",
"1",
"pre = S[i]",
"pre",
"S[i]",
"S",
"i",
"print(res)",
"print",
"res",
"pre = S[i]",
"S[i]",
"pre",
"pre = S[0]",
"S[0]",
"pre",
"S = input()",
"input()",
"S",
"res = 0",
"0",
"res",
"res += 1",
"1",
"res"
] |
S = input()
pre = S[0]
res = 0
for i in range(1, len(S)):
if pre != S[i]:
res += 1
pre = S[i]
print(res)
|
[
7,
15,
13,
0,
13,
4,
13,
14,
4,
13,
13,
4,
13,
17,
4,
18,
13,
13,
0,
13,
4,
18,
13,
13,
17,
0,
13,
4,
18,
13,
13,
17,
4,
13,
2,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
38,
4
],
[
44,
19
],
[
39,
22
],
[
41,
26
],
[
39,
29
],
[
45,
35
],
[
42,
36
],
[
38,
39
],
[
41,
42
],
[
44,
45
]
] |
[
"import sys\ns = input()\n\nif all([x == s[0] for x in s]):\n print(0)\n sys.exit()\n\nbw = s.count(\"BW\")\nwb = s.count(\"WB\")\n\nprint(bw + wb)",
"import sys",
"sys",
"s = input()",
"s",
"input()",
"input",
"if all([x == s[0] for x in s]):\n print(0)\n sys.exit()",
"all([x == s[0] for x in s])",
"all",
"[x == s[0] for x in s]",
"print(0)",
"print",
"0",
"sys.exit()",
"sys.exit",
"sys",
"exit",
"bw = s.count(\"BW\")",
"bw",
"s.count(\"BW\")",
"s.count",
"s",
"count",
"\"BW\"",
"wb = s.count(\"WB\")",
"wb",
"s.count(\"WB\")",
"s.count",
"s",
"count",
"\"WB\"",
"print(bw + wb)",
"print",
"bw + wb",
"bw",
"wb",
"s = input()",
"input()",
"s",
"wb = s.count(\"WB\")",
"s.count(\"WB\")",
"wb",
"bw = s.count(\"BW\")",
"s.count(\"BW\")",
"bw"
] |
import sys
s = input()
if all([x == s[0] for x in s]):
print(0)
sys.exit()
bw = s.count("BW")
wb = s.count("WB")
print(bw + wb)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
18,
13,
17,
42,
2,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
18,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
18,
13,
10,
17,
13
] |
[
[
58,
2
],
[
52,
6
],
[
61,
9
],
[
59,
12
],
[
55,
14
],
[
70,
17
],
[
59,
19
],
[
53,
23
],
[
50,
23
],
[
74,
23
],
[
62,
24
],
[
59,
28
],
[
53,
29
],
[
50,
29
],
[
74,
29
],
[
71,
30
],
[
68,
30
],
[
73,
32
],
[
64,
35
],
[
67,
38
],
[
59,
40
],
[
53,
41
],
[
50,
41
],
[
74,
41
],
[
49,
43
],
[
65,
47
],
[
56,
47
],
[
49,
50
],
[
52,
53
],
[
55,
56
],
[
58,
59
],
[
61,
62
],
[
64,
65
],
[
67,
68
],
[
70,
71
],
[
73,
74
]
] |
[
"S=input()\ni=1\nl=len(S)\nres=0\nf=S[0]\n\nwhile i<l:\n if (S[i] == f):\n i+=1\n else:\n res+=1\n f=S[i]\n i+=1\nprint(res)",
"S=input()",
"S",
"input()",
"input",
"i=1",
"i",
"1",
"l=len(S)",
"l",
"len(S)",
"len",
"S",
"res=0",
"res",
"0",
"f=S[0]",
"f",
"S[0]",
"S",
"0",
"while i<l:\n if (S[i] == f):\n i+=1\n else:\n res+=1\n f=S[i]\n i+=1",
"i<l",
"i",
"l",
"if (S[i] == f):\n i+=1\n else:\n res+=1\n f=S[i]\n i+=1",
"S[i] == f",
"S[i]",
"S",
"i",
"f",
"i+=1",
"i",
"1",
"res+=1",
"res",
"1",
"f=S[i]",
"f",
"S[i]",
"S",
"i",
"i+=1",
"i",
"1",
"print(res)",
"print",
"res",
"i+=1",
"1",
"i",
"i=1",
"1",
"i",
"res=0",
"0",
"res",
"S=input()",
"input()",
"S",
"l=len(S)",
"len(S)",
"l",
"res+=1",
"1",
"res",
"f=S[i]",
"S[i]",
"f",
"f=S[0]",
"S[0]",
"f",
"i+=1",
"1",
"i"
] |
S=input()
i=1
l=len(S)
res=0
f=S[0]
while i<l:
if (S[i] == f):
i+=1
else:
res+=1
f=S[i]
i+=1
print(res)
|
[
7,
12,
13,
0,
13,
4,
13,
4,
13,
0,
13,
4,
18,
13,
13,
17,
0,
13,
2,
4,
13,
13,
13,
14,
2,
2,
13,
4,
13,
13,
2,
13,
4,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
18,
13,
13,
42,
17,
14,
2,
2,
13,
17,
2,
13,
17,
3,
14,
2,
18,
13,
13,
17,
0,
13,
17,
0,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
18,
13,
13,
0,
13,
17,
14,
40,
2,
2,
13,
17,
2,
13,
17,
0,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
11,
10
],
[
4,
13
],
[
18,
17
],
[
4,
21
],
[
10,
22
],
[
10,
26
],
[
4,
29
],
[
17,
31
],
[
4,
34
],
[
37,
36
],
[
40,
39
],
[
43,
42
],
[
46,
45
],
[
4,
47
],
[
42,
48
],
[
10,
54
],
[
67,
54
],
[
17,
57
],
[
70,
57
],
[
4,
63
],
[
42,
64
],
[
90,
64
],
[
79,
64
],
[
68,
67
],
[
71,
70
],
[
4,
75
],
[
42,
76
],
[
90,
76
],
[
79,
76
],
[
45,
77
],
[
85,
77
],
[
80,
79
],
[
83,
82
],
[
86,
85
],
[
4,
87
],
[
42,
88
],
[
90,
88
],
[
79,
88
],
[
91,
90
],
[
67,
96
],
[
10,
96
],
[
70,
99
],
[
17,
99
],
[
103,
102
],
[
102,
106
],
[
82,
106
],
[
36,
106
],
[
39,
106
],
[
115,
112
]
] |
[
"def main():\n s = str(input())\n b_count = s.count('B')\n w_count = len(s) - b_count\n\n if b_count == len(s) or w_count == len(s):\n count = 0\n else:\n count = 0\n index = 0\n alp = s[index]\n\n while True:\n if b_count == 0 or w_count == 0:\n break\n else:\n if s[index] == 'B':\n b_count -= 1\n else:\n w_count -= 1\n\n if s[index] == alp:\n index += 1\n else:\n count += 1\n alp = s[index]\n index += 1\n\n if not (b_count == 0 and w_count == 0):\n count += 1\n\n print(count)\n\n\nif __name__ == '__main__':\n main()",
"def main():\n s = str(input())\n b_count = s.count('B')\n w_count = len(s) - b_count\n\n if b_count == len(s) or w_count == len(s):\n count = 0\n else:\n count = 0\n index = 0\n alp = s[index]\n\n while True:\n if b_count == 0 or w_count == 0:\n break\n else:\n if s[index] == 'B':\n b_count -= 1\n else:\n w_count -= 1\n\n if s[index] == alp:\n index += 1\n else:\n count += 1\n alp = s[index]\n index += 1\n\n if not (b_count == 0 and w_count == 0):\n count += 1\n\n print(count)",
"main",
"s = str(input())",
"s",
"str(input())",
"str",
"input()",
"input",
"b_count = s.count('B')",
"b_count",
"s.count('B')",
"s.count",
"s",
"count",
"'B'",
"w_count = len(s) - b_count",
"w_count",
"len(s) - b_count",
"len(s)",
"len",
"s",
"b_count",
"if b_count == len(s) or w_count == len(s):\n count = 0\n else:\n count = 0\n index = 0\n alp = s[index]\n\n while True:\n if b_count == 0 or w_count == 0:\n break\n else:\n if s[index] == 'B':\n b_count -= 1\n else:\n w_count -= 1\n\n if s[index] == alp:\n index += 1\n else:\n count += 1\n alp = s[index]\n index += 1\n\n if not (b_count == 0 and w_count == 0):\n count += 1\n\n ",
"b_count == len(s) or w_count == len(s)",
"b_count == len(s)",
"b_count",
"len(s)",
"len",
"s",
"w_count == len(s)",
"w_count",
"len(s)",
"len",
"s",
"count = 0",
"count",
"0",
"count = 0",
"count",
"0",
"index = 0",
"index",
"0",
"alp = s[index]",
"alp",
"s[index]",
"s",
"index",
"while True:\n if b_count == 0 or w_count == 0:\n break\n else:\n if s[index] == 'B':\n b_count -= 1\n else:\n w_count -= 1\n\n if s[index] == alp:\n index += 1\n else:\n count += 1\n alp = s[index]\n index += 1\n\n ",
"True",
"if b_count == 0 or w_count == 0:\n break\n else:\n if s[index] == 'B':\n b_count -= 1\n else:\n w_count -= 1\n\n if s[index] == alp:\n index += 1\n else:\n count += 1\n alp = s[index]\n index += 1\n\n ",
"b_count == 0 or w_count == 0",
"b_count == 0",
"b_count",
"0",
"w_count == 0",
"w_count",
"0",
"break",
"if s[index] == 'B':\n b_count -= 1\n else:\n w_count -= 1\n\n ",
"s[index] == 'B'",
"s[index]",
"s",
"index",
"'B'",
"b_count -= 1",
"b_count",
"1",
"w_count -= 1",
"w_count",
"1",
"if s[index] == alp:\n index += 1\n else:\n count += 1\n alp = s[index]\n index += 1\n\n ",
"s[index] == alp",
"s[index]",
"s",
"index",
"alp",
"index += 1",
"index",
"1",
"count += 1",
"count",
"1",
"alp = s[index]",
"alp",
"s[index]",
"s",
"index",
"index += 1",
"index",
"1",
"if not (b_count == 0 and w_count == 0):\n count += 1\n\n ",
"not (b_count == 0 and w_count == 0)",
"b_count == 0 and w_count == 0",
"b_count == 0",
"b_count",
"0",
"w_count == 0",
"w_count",
"0",
"count += 1",
"count",
"1",
"print(count)",
"print",
"count",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n s = str(input())\n b_count = s.count('B')\n w_count = len(s) - b_count\n\n if b_count == len(s) or w_count == len(s):\n count = 0\n else:\n count = 0\n index = 0\n alp = s[index]\n\n while True:\n if b_count == 0 or w_count == 0:\n break\n else:\n if s[index] == 'B':\n b_count -= 1\n else:\n w_count -= 1\n\n if s[index] == alp:\n index += 1\n else:\n count += 1\n alp = s[index]\n index += 1\n\n if not (b_count == 0 and w_count == 0):\n count += 1\n\n print(count)",
"def main():\n s = str(input())\n b_count = s.count('B')\n w_count = len(s) - b_count\n\n if b_count == len(s) or w_count == len(s):\n count = 0\n else:\n count = 0\n index = 0\n alp = s[index]\n\n while True:\n if b_count == 0 or w_count == 0:\n break\n else:\n if s[index] == 'B':\n b_count -= 1\n else:\n w_count -= 1\n\n if s[index] == alp:\n index += 1\n else:\n count += 1\n alp = s[index]\n index += 1\n\n if not (b_count == 0 and w_count == 0):\n count += 1\n\n print(count)",
"main"
] |
def main():
s = str(input())
b_count = s.count('B')
w_count = len(s) - b_count
if b_count == len(s) or w_count == len(s):
count = 0
else:
count = 0
index = 0
alp = s[index]
while True:
if b_count == 0 or w_count == 0:
break
else:
if s[index] == 'B':
b_count -= 1
else:
w_count -= 1
if s[index] == alp:
index += 1
else:
count += 1
alp = s[index]
index += 1
if not (b_count == 0 and w_count == 0):
count += 1
print(count)
if __name__ == '__main__':
main()
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
12,
13,
0,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
18,
13
] |
[
[
60,
4
],
[
14,
13
],
[
61,
17
],
[
21,
20
],
[
13,
23
],
[
26,
25
],
[
29,
28
],
[
20,
32
],
[
13,
37
],
[
28,
38
],
[
13,
40
],
[
28,
42
],
[
46,
45
],
[
45,
49
],
[
25,
49
],
[
58,
55
],
[
60,
61
]
] |
[
"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n S = input().rstrip()\n N = len(S)\n\n ans = 0\n for i in range(N - 1):\n if S[i] != S[i + 1]:\n ans += 1\n\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"def main():\n S = input().rstrip()\n N = len(S)\n\n ans = 0\n for i in range(N - 1):\n if S[i] != S[i + 1]:\n ans += 1\n\n print(ans)",
"main",
"S = input().rstrip()",
"S",
"input().rstrip()",
"().rstrip",
"()",
"input",
"rstrip",
"N = len(S)",
"N",
"len(S)",
"len",
"S",
"ans = 0",
"ans",
"0",
"for i in range(N - 1):\n if S[i] != S[i + 1]:\n ans += 1\n\n ",
"i",
"range(N - 1)",
"range",
"N - 1",
"N",
"1",
"if S[i] != S[i + 1]:\n ans += 1\n\n ",
"S[i] != S[i + 1]",
"S[i]",
"S",
"i",
"S[i + 1]",
"S",
"i + 1",
"i",
"1",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n S = input().rstrip()\n N = len(S)\n\n ans = 0\n for i in range(N - 1):\n if S[i] != S[i + 1]:\n ans += 1\n\n print(ans)",
"def main():\n S = input().rstrip()\n N = len(S)\n\n ans = 0\n for i in range(N - 1):\n if S[i] != S[i + 1]:\n ans += 1\n\n print(ans)",
"main",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input"
] |
import sys
input = sys.stdin.readline
def main():
S = input().rstrip()
N = len(S)
ans = 0
for i in range(N - 1):
if S[i] != S[i + 1]:
ans += 1
print(ans)
if __name__ == "__main__":
main()
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13
] |
[
[
39,
2
],
[
36,
6
],
[
10,
9
],
[
40,
15
],
[
40,
19
],
[
9,
20
],
[
40,
22
],
[
9,
24
],
[
33,
27
],
[
34,
31
],
[
37,
31
],
[
33,
34
],
[
36,
37
],
[
39,
40
]
] |
[
"S=input()\n\nX=0\nfor i in range(1,len(S)):\n if S[i]!=S[i-1]:\n X+=1\nprint(X)",
"S=input()",
"S",
"input()",
"input",
"X=0",
"X",
"0",
"for i in range(1,len(S)):\n if S[i]!=S[i-1]:\n X+=1",
"i",
"range(1,len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"if S[i]!=S[i-1]:\n X+=1",
"S[i]!=S[i-1]",
"S[i]",
"S",
"i",
"S[i-1]",
"S",
"i-1",
"i",
"1",
"X+=1",
"X",
"1",
"print(X)",
"print",
"X",
"X+=1",
"1",
"X",
"X=0",
"0",
"X",
"S=input()",
"input()",
"S"
] |
S=input()
X=0
for i in range(1,len(S)):
if S[i]!=S[i-1]:
X+=1
print(X)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
18,
13,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13
] |
[
[
37,
2
],
[
40,
8
],
[
38,
11
],
[
34,
15
],
[
19,
18
],
[
38,
18
],
[
41,
22
],
[
47,
22
],
[
18,
23
],
[
43,
25
],
[
46,
28
],
[
18,
29
],
[
44,
32
],
[
35,
32
],
[
34,
35
],
[
37,
38
],
[
40,
41
],
[
43,
44
],
[
18,
46
],
[
46,
47
]
] |
[
"S = list(input())\nk = S.pop(0)\nii = 0\nfor i in S:\n if k == i:\n pass\n else:\n ii += 1\n k = i\nprint(ii)",
"S = list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"k = S.pop(0)",
"k",
"S.pop(0)",
"S.pop",
"S",
"pop",
"0",
"ii = 0",
"ii",
"0",
"for i in S:\n if k == i:\n pass\n else:\n ii += 1\n k = i",
"i",
"S",
"if k == i:\n pass\n else:\n ii += 1\n k = i",
"k == i",
"k",
"i",
"ii += 1",
"ii",
"1",
"k = i",
"k",
"i",
"print(ii)",
"print",
"ii",
"ii = 0",
"0",
"ii",
"S = list(input())",
"list(input())",
"S",
"k = S.pop(0)",
"S.pop(0)",
"k",
"ii += 1",
"1",
"ii",
"k = i",
"i",
"k"
] |
S = list(input())
k = S.pop(0)
ii = 0
for i in S:
if k == i:
pass
else:
ii += 1
k = i
print(ii)
|
[
7,
0,
13,
4,
13,
0,
13,
4,
18,
4,
18,
13,
13,
17,
17,
13,
17,
17,
0,
13,
4,
13,
4,
18,
13,
13,
4,
13,
2,
4,
13,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
40,
2
],
[
37,
6
],
[
41,
11
],
[
34,
19
],
[
38,
24
],
[
35,
31
],
[
38,
31
],
[
34,
35
],
[
37,
38
],
[
40,
41
]
] |
[
"S = input()\n\ns = S.replace('WB', 'W B').replace('BW', 'B W')\ns = list(s.split())\nprint(len(s) -1)",
"S = input()",
"S",
"input()",
"input",
"s = S.replace('WB', 'W B').replace('BW', 'B W')",
"s",
"S.replace('WB', 'W B').replace('BW', 'B W')",
"S.replace('WB', 'W B').replace",
"S.replace('WB', 'W B')",
"S.replace",
"S",
"replace",
"'WB'",
"'W B'",
"replace",
"'BW'",
"'B W'",
"s = list(s.split())",
"s",
"list(s.split())",
"list",
"s.split()",
"s.split",
"s",
"split",
"print(len(s) -1)",
"print",
"len(s) -1",
"len(s)",
"len",
"s",
"1",
"s = list(s.split())",
"list(s.split())",
"s",
"s = S.replace('WB', 'W B').replace('BW', 'B W')",
"S.replace('WB', 'W B').replace('BW', 'B W')",
"s",
"S = input()",
"input()",
"S"
] |
S = input()
s = S.replace('WB', 'W B').replace('BW', 'B W')
s = list(s.split())
print(len(s) -1)
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
18,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13
] |
[
[
49,
4
],
[
52,
11
],
[
50,
15
],
[
55,
18
],
[
22,
21
],
[
53,
27
],
[
53,
32
],
[
21,
33
],
[
53,
35
],
[
21,
37
],
[
46,
40
],
[
47,
44
],
[
56,
44
],
[
46,
47
],
[
49,
50
],
[
52,
53
],
[
55,
56
]
] |
[
"import sys\ninput = sys.stdin.readline\n\ns = input().rstrip()\ncnt = 0\nfor i in range(len(s) - 1):\n if s[i] != s[i + 1]:\n cnt += 1\nprint(cnt)",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"s = input().rstrip()",
"s",
"input().rstrip()",
"().rstrip",
"()",
"input",
"rstrip",
"cnt = 0",
"cnt",
"0",
"for i in range(len(s) - 1):\n if s[i] != s[i + 1]:\n cnt += 1",
"i",
"range(len(s) - 1)",
"range",
"len(s) - 1",
"len(s)",
"len",
"s",
"1",
"if s[i] != s[i + 1]:\n cnt += 1",
"s[i] != s[i + 1]",
"s[i]",
"s",
"i",
"s[i + 1]",
"s",
"i + 1",
"i",
"1",
"cnt += 1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"cnt += 1",
"1",
"cnt",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"s = input().rstrip()",
"input().rstrip()",
"s",
"cnt = 0",
"0",
"cnt"
] |
import sys
input = sys.stdin.readline
s = input().rstrip()
cnt = 0
for i in range(len(s) - 1):
if s[i] != s[i + 1]:
cnt += 1
print(cnt)
|
[
7,
15,
0,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
13,
2,
4,
13,
13,
17,
10,
4,
13,
10,
4,
13
] |
[
[
24,
3
],
[
21,
7
],
[
25,
12
],
[
22,
18
],
[
21,
22
],
[
24,
25
]
] |
[
"from itertools import groupby\n\n\ns = input()\ng = list(groupby(s))\nprint(len(g) - 1)",
"from itertools import groupby",
"s = input()",
"s",
"input()",
"input",
"g = list(groupby(s))",
"g",
"list(groupby(s))",
"list",
"groupby(s)",
"groupby",
"s",
"print(len(g) - 1)",
"print",
"len(g) - 1",
"len(g)",
"len",
"g",
"1",
"g = list(groupby(s))",
"list(groupby(s))",
"g",
"s = input()",
"input()",
"s"
] |
from itertools import groupby
s = input()
g = list(groupby(s))
print(len(g) - 1)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
39,
0,
13,
18,
13,
17,
14,
2,
4,
13,
4,
13,
13,
17,
4,
13,
17,
4,
13,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
13,
18,
13,
13,
4,
18,
13,
13,
13,
0,
13,
18,
13,
13,
4,
18,
13,
13,
13,
4,
13,
2,
4,
13,
13,
17,
10,
18,
13,
10,
18,
13,
10,
39,
13,
10,
4,
13
] |
[
[
74,
2
],
[
71,
8
],
[
65,
11
],
[
75,
13
],
[
75,
21
],
[
30,
29
],
[
75,
35
],
[
66,
38
],
[
69,
38
],
[
75,
40
],
[
29,
41
],
[
72,
44
],
[
66,
46
],
[
69,
46
],
[
68,
48
],
[
75,
50
],
[
29,
51
],
[
72,
54
],
[
69,
56
],
[
66,
56
],
[
72,
62
],
[
65,
66
],
[
68,
69
],
[
71,
72
],
[
74,
75
]
] |
[
"S = list(input())\nrunlength = []\ntemp = S[0]\nif len(set(S)) == 1:\n print(0)\n exit() \nfor i in range(1,len(S)):\n if temp != S[i]:\n runlength.append(temp)\n temp = S[i]\nrunlength.append(temp)\nprint(len(runlength)-1)",
"S = list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"runlength = []",
"runlength",
"[]",
"temp = S[0]",
"temp",
"S[0]",
"S",
"0",
"if len(set(S)) == 1:\n print(0)\n exit() ",
"len(set(S)) == 1",
"len(set(S))",
"len",
"set(S)",
"set",
"S",
"1",
"print(0)",
"print",
"0",
"exit()",
"exit",
"for i in range(1,len(S)):\n if temp != S[i]:\n runlength.append(temp)\n temp = S[i]",
"i",
"range(1,len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"if temp != S[i]:\n runlength.append(temp)\n temp = S[i]",
"temp != S[i]",
"temp",
"S[i]",
"S",
"i",
"runlength.append(temp)",
"runlength.append",
"runlength",
"append",
"temp",
"temp = S[i]",
"temp",
"S[i]",
"S",
"i",
"runlength.append(temp)",
"runlength.append",
"runlength",
"append",
"temp",
"print(len(runlength)-1)",
"print",
"len(runlength)-1",
"len(runlength)",
"len",
"runlength",
"1",
"temp = S[0]",
"S[0]",
"temp",
"temp = S[i]",
"S[i]",
"temp",
"runlength = []",
"[]",
"runlength",
"S = list(input())",
"list(input())",
"S"
] |
S = list(input())
runlength = []
temp = S[0]
if len(set(S)) == 1:
print(0)
exit()
for i in range(1,len(S)):
if temp != S[i]:
runlength.append(temp)
temp = S[i]
runlength.append(temp)
print(len(runlength)-1)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
14,
40,
18,
13,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
4,
13,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13
] |
[
[
53,
2
],
[
47,
8
],
[
54,
11
],
[
59,
13
],
[
54,
15
],
[
56,
18
],
[
22,
21
],
[
48,
25
],
[
54,
29
],
[
21,
30
],
[
60,
31
],
[
45,
31
],
[
50,
33
],
[
44,
36
],
[
54,
38
],
[
21,
39
],
[
51,
42
],
[
57,
42
],
[
44,
45
],
[
47,
48
],
[
50,
51
],
[
53,
54
],
[
56,
57
],
[
59,
60
]
] |
[
"S = list(input())\nls = len(S)\np = S[0]\nans = 0\nfor i in range(1, ls):\n if S[i] != p:\n ans += 1\n p = S[i]\nprint(ans)",
"S = list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"ls = len(S)",
"ls",
"len(S)",
"len",
"S",
"p = S[0]",
"p",
"S[0]",
"S",
"0",
"ans = 0",
"ans",
"0",
"for i in range(1, ls):\n if S[i] != p:\n ans += 1\n p = S[i]",
"i",
"range(1, ls)",
"range",
"1",
"ls",
"if S[i] != p:\n ans += 1\n p = S[i]",
"S[i] != p",
"S[i]",
"S",
"i",
"p",
"ans += 1",
"ans",
"1",
"p = S[i]",
"p",
"S[i]",
"S",
"i",
"print(ans)",
"print",
"ans",
"p = S[i]",
"S[i]",
"p",
"ls = len(S)",
"len(S)",
"ls",
"ans += 1",
"1",
"ans",
"S = list(input())",
"list(input())",
"S",
"ans = 0",
"0",
"ans",
"p = S[0]",
"S[0]",
"p"
] |
S = list(input())
ls = len(S)
p = S[0]
ans = 0
for i in range(1, ls):
if S[i] != p:
ans += 1
p = S[i]
print(ans)
|
[
7,
12,
13,
0,
13,
4,
13,
0,
13,
21,
22,
17,
17,
22,
17,
17,
0,
13,
18,
13,
17,
0,
18,
13,
13,
17,
28,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
0,
13,
13,
29,
2,
4,
13,
4,
18,
13,
13,
17,
4,
13,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
9,
8
],
[
18,
17
],
[
4,
19
],
[
25,
22
],
[
8,
23
],
[
17,
24
],
[
28,
27
],
[
4,
27
],
[
27,
31
],
[
17,
32
],
[
39,
32
],
[
37,
34
],
[
8,
35
],
[
27,
36
],
[
40,
39
],
[
27,
40
],
[
8,
47
],
[
56,
53
]
] |
[
"def solve():\n S = input()\n \n d = {'B': 0, 'W': 0}\n ps = S[0]\n d[ps] += 1\n for si in S:\n if si != ps:\n d[si] += 1\n ps = si \n return sum(d.values())-1\n\nprint(solve())",
"def solve():\n S = input()\n \n d = {'B': 0, 'W': 0}\n ps = S[0]\n d[ps] += 1\n for si in S:\n if si != ps:\n d[si] += 1\n ps = si \n return sum(d.values())-1",
"solve",
"S = input()",
"S",
"input()",
"input",
"d = {'B': 0, 'W': 0}",
"d",
"{'B': 0, 'W': 0}",
"'B'",
"'B'",
"0",
"'W'",
"'W'",
"0",
"ps = S[0]",
"ps",
"S[0]",
"S",
"0",
"d[ps] += 1",
"d[ps]",
"d",
"ps",
"1",
"for si in S:\n if si != ps:\n d[si] += 1\n ps = si \n ",
"si",
"S",
"if si != ps:\n d[si] += 1\n ",
"si != ps",
"si",
"ps",
"d[si] += 1",
"d[si]",
"d",
"si",
"1",
"ps = si",
"ps",
"si",
"return sum(d.values())-1",
"sum(d.values())-1",
"sum(d.values())",
"sum",
"d.values()",
"d.values",
"d",
"values",
"1",
"print(solve())",
"print",
"solve()",
"solve",
"def solve():\n S = input()\n \n d = {'B': 0, 'W': 0}\n ps = S[0]\n d[ps] += 1\n for si in S:\n if si != ps:\n d[si] += 1\n ps = si \n return sum(d.values())-1",
"def solve():\n S = input()\n \n d = {'B': 0, 'W': 0}\n ps = S[0]\n d[ps] += 1\n for si in S:\n if si != ps:\n d[si] += 1\n ps = si \n return sum(d.values())-1",
"solve"
] |
def solve():
S = input()
d = {'B': 0, 'W': 0}
ps = S[0]
d[ps] += 1
for si in S:
if si != ps:
d[si] += 1
ps = si
return sum(d.values())-1
print(solve())
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
18,
13,
17,
18,
13,
13,
0,
13,
18,
13,
13,
14,
2,
4,
13,
13,
17,
4,
13,
17,
4,
13,
17,
14,
2,
4,
13,
13,
17,
4,
13,
17,
4,
13,
17,
4,
13,
2,
4,
13,
13,
17,
10,
18,
13,
10,
4,
13,
10,
18,
13
] |
[
[
66,
2
],
[
69,
6
],
[
67,
8
],
[
12,
11
],
[
67,
17
],
[
70,
21
],
[
64,
21
],
[
67,
24
],
[
11,
25
],
[
63,
27
],
[
67,
29
],
[
11,
30
],
[
67,
35
],
[
67,
47
],
[
64,
60
],
[
70,
60
],
[
63,
64
],
[
66,
67
],
[
69,
70
]
] |
[
"S = input()\n\ns = S[0]\nfor i in range(1, len(S)):\n if s[-1] != S[i]:\n s += S[i]\n\nif len(S) == 1:\n print(0)\n exit(0)\nelif len(S) == 2:\n print(1)\n exit(0)\n\nprint(len(s)-1)",
"S = input()",
"S",
"input()",
"input",
"s = S[0]",
"s",
"S[0]",
"S",
"0",
"for i in range(1, len(S)):\n if s[-1] != S[i]:\n s += S[i]",
"i",
"range(1, len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"if s[-1] != S[i]:\n s += S[i]",
"s[-1] != S[i]",
"s[-1]",
"s",
"-1",
"S[i]",
"S",
"i",
"s += S[i]",
"s",
"S[i]",
"S",
"i",
"if len(S) == 1:\n print(0)\n exit(0)\nelif len(S) == 2:\n print(1)\n exit(0)",
"len(S) == 1",
"len(S)",
"len",
"S",
"1",
"print(0)",
"print",
"0",
"exit(0)",
"exit",
"0",
"elif len(S) == 2:\n print(1)\n exit(0)",
"len(S) == 2",
"len(S)",
"len",
"S",
"2",
"print(1)",
"print",
"1",
"exit(0)",
"exit",
"0",
"print(len(s)-1)",
"print",
"len(s)-1",
"len(s)",
"len",
"s",
"1",
"s += S[i]",
"S[i]",
"s",
"S = input()",
"input()",
"S",
"s = S[0]",
"S[0]",
"s"
] |
S = input()
s = S[0]
for i in range(1, len(S)):
if s[-1] != S[i]:
s += S[i]
if len(S) == 1:
print(0)
exit(0)
elif len(S) == 2:
print(1)
exit(0)
print(len(s)-1)
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
18,
13,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13
] |
[
[
51,
2
],
[
45,
6
],
[
52,
8
],
[
39,
11
],
[
15,
14
],
[
52,
20
],
[
52,
24
],
[
14,
25
],
[
46,
26
],
[
49,
26
],
[
42,
28
],
[
48,
31
],
[
52,
33
],
[
14,
34
],
[
43,
37
],
[
40,
37
],
[
39,
40
],
[
42,
43
],
[
45,
46
],
[
48,
49
],
[
51,
52
]
] |
[
"s = input()\nprev = s[0]\nans = 0\nfor i in range(1, len(s)):\n if s[i] != prev:\n ans += 1\n prev = s[i]\nprint(ans)",
"s = input()",
"s",
"input()",
"input",
"prev = s[0]",
"prev",
"s[0]",
"s",
"0",
"ans = 0",
"ans",
"0",
"for i in range(1, len(s)):\n if s[i] != prev:\n ans += 1\n prev = s[i]",
"i",
"range(1, len(s))",
"range",
"1",
"len(s)",
"len",
"s",
"if s[i] != prev:\n ans += 1\n ",
"s[i] != prev",
"s[i]",
"s",
"i",
"prev",
"ans += 1",
"ans",
"1",
"prev = s[i]",
"prev",
"s[i]",
"s",
"i",
"print(ans)",
"print",
"ans",
"ans = 0",
"0",
"ans",
"ans += 1",
"1",
"ans",
"prev = s[0]",
"s[0]",
"prev",
"prev = s[i]",
"s[i]",
"prev",
"s = input()",
"input()",
"s"
] |
s = input()
prev = s[0]
ans = 0
for i in range(1, len(s)):
if s[i] != prev:
ans += 1
prev = s[i]
print(ans)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
17,
2,
4,
13,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] |
[
[
35,
2
],
[
38,
6
],
[
10,
9
],
[
36,
16
],
[
36,
21
],
[
9,
22
],
[
36,
24
],
[
9,
26
],
[
41,
29
],
[
42,
33
],
[
39,
33
],
[
35,
36
],
[
38,
39
],
[
41,
42
]
] |
[
"a=input()\nans=0\nfor i in range(0,len(a)-1):\n if a[i]!=a[i+1]:\n ans+=1\nprint(ans)",
"a=input()",
"a",
"input()",
"input",
"ans=0",
"ans",
"0",
"for i in range(0,len(a)-1):\n if a[i]!=a[i+1]:\n ans+=1",
"i",
"range(0,len(a)-1)",
"range",
"0",
"len(a)-1",
"len(a)",
"len",
"a",
"1",
"if a[i]!=a[i+1]:\n ans+=1",
"a[i]!=a[i+1]",
"a[i]",
"a",
"i",
"a[i+1]",
"a",
"i+1",
"i",
"1",
"ans+=1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"a=input()",
"input()",
"a",
"ans=0",
"0",
"ans",
"ans+=1",
"1",
"ans"
] |
a=input()
ans=0
for i in range(0,len(a)-1):
if a[i]!=a[i+1]:
ans+=1
print(ans)
|
[
7,
0,
13,
39,
0,
13,
4,
13,
4,
13,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
13,
13,
18,
13,
13,
4,
13,
2,
4,
18,
13,
13,
17,
4,
18,
13,
13,
17,
10,
4,
13,
10,
39,
13
] |
[
[
53,
2
],
[
50,
5
],
[
12,
11
],
[
51,
17
],
[
51,
22
],
[
11,
23
],
[
51,
25
],
[
11,
27
],
[
54,
31
],
[
51,
34
],
[
11,
35
],
[
54,
41
],
[
54,
46
],
[
50,
51
],
[
53,
54
]
] |
[
"ans = []\nS=list(input())\nfor i in range(len(S)-1):\n if S[i] != S[i+1]:\n ans.append(S[i])\nprint(ans.count(\"W\")+ans.count(\"B\"))",
"ans = []",
"ans",
"[]",
"S=list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"for i in range(len(S)-1):\n if S[i] != S[i+1]:\n ans.append(S[i])",
"i",
"range(len(S)-1)",
"range",
"len(S)-1",
"len(S)",
"len",
"S",
"1",
"if S[i] != S[i+1]:\n ans.append(S[i])",
"S[i] != S[i+1]",
"S[i]",
"S",
"i",
"S[i+1]",
"S",
"i+1",
"i",
"1",
"ans.append(S[i])",
"ans.append",
"ans",
"append",
"S[i]",
"S",
"i",
"print(ans.count(\"W\")+ans.count(\"B\"))",
"print",
"ans.count(\"W\")+ans.count(\"B\")",
"ans.count(\"W\")",
"ans.count",
"ans",
"count",
"\"W\"",
"ans.count(\"B\")",
"ans.count",
"ans",
"count",
"\"B\"",
"S=list(input())",
"list(input())",
"S",
"ans = []",
"[]",
"ans"
] |
ans = []
S=list(input())
for i in range(len(S)-1):
if S[i] != S[i+1]:
ans.append(S[i])
print(ans.count("W")+ans.count("B"))
|
[
7,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
40,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13
] |
[
[
39,
2
],
[
42,
6
],
[
40,
9
],
[
45,
11
],
[
36,
14
],
[
18,
17
],
[
40,
17
],
[
17,
21
],
[
37,
22
],
[
49,
22
],
[
33,
24
],
[
48,
27
],
[
17,
28
],
[
34,
31
],
[
46,
31
],
[
33,
34
],
[
36,
37
],
[
39,
40
],
[
42,
43
],
[
45,
46
],
[
17,
48
],
[
48,
49
]
] |
[
"s = input()\nn = len(s)\nans = -1\npre = \"\"\n\nfor i in s:\n if i != pre:\n ans += 1\n pre = i\n\nprint(ans)",
"s = input()",
"s",
"input()",
"input",
"n = len(s)",
"n",
"len(s)",
"len",
"s",
"ans = -1",
"ans",
"-1",
"pre = \"\"",
"pre",
"\"\"",
"for i in s:\n if i != pre:\n ans += 1\n pre = i",
"i",
"s",
"if i != pre:\n ans += 1\n ",
"i != pre",
"i",
"pre",
"ans += 1",
"ans",
"1",
"pre = i",
"pre",
"i",
"print(ans)",
"print",
"ans",
"ans += 1",
"1",
"ans",
"pre = \"\"",
"\"\"",
"pre",
"s = input()",
"input()",
"s",
"n = len(s)",
"len(s)",
"n",
"ans = -1",
"-1",
"ans",
"pre = i",
"i",
"pre"
] |
s = input()
n = len(s)
ans = -1
pre = ""
for i in s:
if i != pre:
ans += 1
pre = i
print(ans)
|
[
7,
15,
13,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
9,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] |
[
[
40,
4
],
[
43,
8
],
[
12,
11
],
[
41,
17
],
[
41,
22
],
[
11,
23
],
[
41,
25
],
[
11,
27
],
[
37,
31
],
[
38,
35
],
[
44,
35
],
[
37,
38
],
[
40,
41
],
[
43,
44
]
] |
[
"import numpy as np\ns = input()\nans = 0\n\nfor i in range(len(s)-1):\n if s[i] == s[i+1]:\n continue\n else:\n ans += 1\nprint(ans)\n ",
"import numpy as np",
"numpy",
"s = input()",
"s",
"input()",
"input",
"ans = 0",
"ans",
"0",
"for i in range(len(s)-1):\n if s[i] == s[i+1]:\n continue\n else:\n ans += 1",
"i",
"range(len(s)-1)",
"range",
"len(s)-1",
"len(s)",
"len",
"s",
"1",
"if s[i] == s[i+1]:\n continue\n else:\n ans += 1",
"s[i] == s[i+1]",
"s[i]",
"s",
"i",
"s[i+1]",
"s",
"i+1",
"i",
"1",
"continue",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"ans += 1",
"1",
"ans",
"s = input()",
"input()",
"s",
"ans = 0",
"0",
"ans"
] |
import numpy as np
s = input()
ans = 0
for i in range(len(s)-1):
if s[i] == s[i+1]:
continue
else:
ans += 1
print(ans)
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
40,
13,
18,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
18,
13
] |
[
[
38,
2
],
[
50,
6
],
[
39,
8
],
[
41,
11
],
[
15,
14
],
[
39,
19
],
[
51,
22
],
[
48,
22
],
[
39,
24
],
[
14,
25
],
[
44,
27
],
[
47,
30
],
[
39,
32
],
[
14,
33
],
[
45,
36
],
[
42,
36
],
[
38,
39
],
[
41,
42
],
[
44,
45
],
[
47,
48
],
[
50,
51
]
] |
[
"s=input()\n\ncolor = s[0]\nresult = 0\nfor i in range(len(s)):\n if color != s[i]:\n result += 1\n color = s[i]\nprint(result)",
"s=input()",
"s",
"input()",
"input",
"color = s[0]",
"color",
"s[0]",
"s",
"0",
"result = 0",
"result",
"0",
"for i in range(len(s)):\n if color != s[i]:\n result += 1\n color = s[i]",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if color != s[i]:\n result += 1\n color = s[i]",
"color != s[i]",
"color",
"s[i]",
"s",
"i",
"result += 1",
"result",
"1",
"color = s[i]",
"color",
"s[i]",
"s",
"i",
"print(result)",
"print",
"result",
"s=input()",
"input()",
"s",
"result = 0",
"0",
"result",
"result += 1",
"1",
"result",
"color = s[i]",
"s[i]",
"color",
"color = s[0]",
"s[0]",
"color"
] |
s=input()
color = s[0]
result = 0
for i in range(len(s)):
if color != s[i]:
result += 1
color = s[i]
print(result)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13
] |
[
[
42,
2
],
[
39,
8
],
[
12,
11
],
[
43,
17
],
[
43,
22
],
[
11,
23
],
[
43,
25
],
[
11,
27
],
[
36,
30
],
[
37,
34
],
[
40,
34
],
[
36,
37
],
[
39,
40
],
[
42,
43
]
] |
[
"s = str(input())\ncount = 0\n\nfor i in range(len(s) - 1):\n if s[i] != s[i + 1]:\n count += 1\nprint(count)",
"s = str(input())",
"s",
"str(input())",
"str",
"input()",
"input",
"count = 0",
"count",
"0",
"for i in range(len(s) - 1):\n if s[i] != s[i + 1]:\n count += 1",
"i",
"range(len(s) - 1)",
"range",
"len(s) - 1",
"len(s)",
"len",
"s",
"1",
"if s[i] != s[i + 1]:\n count += 1",
"s[i] != s[i + 1]",
"s[i]",
"s",
"i",
"s[i + 1]",
"s",
"i + 1",
"i",
"1",
"count += 1",
"count",
"1",
"print(count)",
"print",
"count",
"count += 1",
"1",
"count",
"count = 0",
"0",
"count",
"s = str(input())",
"str(input())",
"s"
] |
s = str(input())
count = 0
for i in range(len(s) - 1):
if s[i] != s[i + 1]:
count += 1
print(count)
|
[
7,
12,
13,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
9,
8
],
[
12,
11
],
[
4,
17
],
[
4,
21
],
[
11,
23
],
[
4,
26
],
[
11,
27
],
[
30,
29
],
[
29,
33
],
[
8,
33
],
[
42,
39
]
] |
[
"def main():\n S = input()\n answer = 0\n\n for i in range(1,len(S)):\n if S[i-1] != S[i]:\n answer += 1\n\n print(answer)\n\nif __name__ == '__main__':\n main()",
"def main():\n S = input()\n answer = 0\n\n for i in range(1,len(S)):\n if S[i-1] != S[i]:\n answer += 1\n\n print(answer)",
"main",
"S = input()",
"S",
"input()",
"input",
"answer = 0",
"answer",
"0",
"for i in range(1,len(S)):\n if S[i-1] != S[i]:\n answer += 1\n\n ",
"i",
"range(1,len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"if S[i-1] != S[i]:\n answer += 1\n\n ",
"S[i-1] != S[i]",
"S[i-1]",
"S",
"i-1",
"i",
"1",
"S[i]",
"S",
"i",
"answer += 1",
"answer",
"1",
"print(answer)",
"print",
"answer",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n S = input()\n answer = 0\n\n for i in range(1,len(S)):\n if S[i-1] != S[i]:\n answer += 1\n\n print(answer)",
"def main():\n S = input()\n answer = 0\n\n for i in range(1,len(S)):\n if S[i-1] != S[i]:\n answer += 1\n\n print(answer)",
"main"
] |
def main():
S = input()
answer = 0
for i in range(1,len(S)):
if S[i-1] != S[i]:
answer += 1
print(answer)
if __name__ == '__main__':
main()
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13
] |
[
[
31,
2
],
[
34,
6
],
[
10,
9
],
[
32,
15
],
[
32,
20
],
[
9,
21
],
[
32,
23
],
[
9,
25
],
[
35,
29
],
[
31,
32
],
[
34,
35
]
] |
[
"S = input()\n\nans = 0\nfor i in range(len(S)-1):\n if S[i] != S[i+1]: ans +=1\nprint(ans)",
"S = input()",
"S",
"input()",
"input",
"ans = 0",
"ans",
"0",
"for i in range(len(S)-1):\n if S[i] != S[i+1]: ans +=1",
"i",
"range(len(S)-1)",
"range",
"len(S)-1",
"len(S)",
"len",
"S",
"1",
"if S[i] != S[i+1]: ans +",
"S[i] != S[i+1]",
"S[i]",
"S",
"i",
"S[i+1]",
"S",
"i+1",
"i",
"1",
"print(ans)",
"print",
"ans",
"S = input()",
"input()",
"S",
"ans = 0",
"0",
"ans"
] |
S = input()
ans = 0
for i in range(len(S)-1):
if S[i] != S[i+1]: ans +=1
print(ans)
|
[
7,
0,
13,
4,
13,
0,
13,
39,
18,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
13,
13,
18,
13,
13,
4,
13,
2,
4,
13,
13,
17,
10,
4,
13,
10,
39,
13
] |
[
[
44,
2
],
[
47,
6
],
[
45,
9
],
[
13,
12
],
[
45,
18
],
[
45,
22
],
[
12,
23
],
[
45,
25
],
[
12,
27
],
[
48,
31
],
[
45,
34
],
[
12,
35
],
[
48,
41
],
[
44,
45
],
[
47,
48
]
] |
[
"s = input()\n\nstone = [s[0]]\nfor i in range(1,len(s)):\n if s[i] != s[i - 1]:\n stone.append(s[i])\nprint(len(stone) - 1)",
"s = input()",
"s",
"input()",
"input",
"stone = [s[0]]",
"stone",
"[s[0]]",
"s[0]",
"s",
"0",
"for i in range(1,len(s)):\n if s[i] != s[i - 1]:\n stone.append(s[i])",
"i",
"range(1,len(s))",
"range",
"1",
"len(s)",
"len",
"s",
"if s[i] != s[i - 1]:\n stone.append(s[i])",
"s[i] != s[i - 1]",
"s[i]",
"s",
"i",
"s[i - 1]",
"s",
"i - 1",
"i",
"1",
"stone.append(s[i])",
"stone.append",
"stone",
"append",
"s[i]",
"s",
"i",
"print(len(stone) - 1)",
"print",
"len(stone) - 1",
"len(stone)",
"len",
"stone",
"1",
"s = input()",
"input()",
"s",
"stone = [s[0]]",
"[s[0]]",
"stone"
] |
s = input()
stone = [s[0]]
for i in range(1,len(s)):
if s[i] != s[i - 1]:
stone.append(s[i])
print(len(stone) - 1)
|
[
7,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
18,
13,
17,
28,
13,
13,
0,
13,
2,
13,
13,
0,
13,
13,
4,
13,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] |
[
[
39,
2
],
[
36,
6
],
[
40,
9
],
[
33,
11
],
[
40,
13
],
[
17,
16
],
[
40,
16
],
[
30,
19
],
[
16,
21
],
[
34,
22
],
[
43,
22
],
[
42,
24
],
[
16,
25
],
[
31,
28
],
[
37,
28
],
[
30,
31
],
[
33,
34
],
[
36,
37
],
[
39,
40
],
[
16,
42
],
[
42,
43
]
] |
[
"S=input()\nans=len(S)\nnow=S[0]\nfor s in S:\n ans-=s==now\n now=s\nprint(ans)",
"S=input()",
"S",
"input()",
"input",
"ans=len(S)",
"ans",
"len(S)",
"len",
"S",
"now=S[0]",
"now",
"S[0]",
"S",
"0",
"for s in S:\n ans-=s==now\n now=s",
"s",
"S",
"ans-=s==now",
"ans",
"s==now",
"s",
"now",
"now=s",
"now",
"s",
"print(ans)",
"print",
"ans",
"ans-=s==now",
"s==now",
"ans",
"now=S[0]",
"S[0]",
"now",
"ans=len(S)",
"len(S)",
"ans",
"S=input()",
"input()",
"S",
"now=s",
"s",
"now"
] |
S=input()
ans=len(S)
now=S[0]
for s in S:
ans-=s==now
now=s
print(ans)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
0,
13,
18,
13,
17,
0,
13,
4,
13,
13,
28,
13,
4,
13,
17,
13,
14,
40,
18,
13,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13
] |
[
[
57,
2
],
[
45,
6
],
[
54,
9
],
[
58,
11
],
[
51,
14
],
[
58,
17
],
[
20,
19
],
[
52,
23
],
[
58,
27
],
[
19,
28
],
[
55,
29
],
[
49,
29
],
[
42,
31
],
[
48,
34
],
[
58,
36
],
[
19,
37
],
[
43,
40
],
[
46,
40
],
[
42,
43
],
[
45,
46
],
[
48,
49
],
[
51,
52
],
[
54,
55
],
[
57,
58
]
] |
[
"s=input()\nc=0\nre=s[0]\nn=len(s)\nfor i in range(1,n):\n if s[i]!=re:\n c+=1\n re=s[i]\nprint(c) ",
"s=input()",
"s",
"input()",
"input",
"c=0",
"c",
"0",
"re=s[0]",
"re",
"s[0]",
"s",
"0",
"n=len(s)",
"n",
"len(s)",
"len",
"s",
"for i in range(1,n):\n if s[i]!=re:\n c+=1\n re=s[i]",
"i",
"range(1,n)",
"range",
"1",
"n",
"if s[i]!=re:\n c+=1\n ",
"s[i]!=re",
"s[i]",
"s",
"i",
"re",
"c+=1",
"c",
"1",
"re=s[i]",
"re",
"s[i]",
"s",
"i",
"print(c)",
"print",
"c",
"c+=1",
"1",
"c",
"c=0",
"0",
"c",
"re=s[i]",
"s[i]",
"re",
"n=len(s)",
"len(s)",
"n",
"re=s[0]",
"s[0]",
"re",
"s=input()",
"input()",
"s"
] |
s=input()
c=0
re=s[0]
n=len(s)
for i in range(1,n):
if s[i]!=re:
c+=1
re=s[i]
print(c)
|
[
7,
15,
0,
13,
4,
13,
4,
13,
0,
13,
39,
28,
13,
13,
4,
13,
13,
4,
18,
13,
13,
13,
4,
13,
2,
4,
13,
13,
17,
10,
4,
13,
10,
39,
13
] |
[
[
30,
3
],
[
33,
9
],
[
31,
16
],
[
34,
19
],
[
34,
27
],
[
30,
31
],
[
33,
34
]
] |
[
"from itertools import groupby\n\ns =list(input())\na = []\n\nfor key, value in groupby(s):\n a.append(key)\n\n\nprint(len(a)-1)",
"from itertools import groupby",
"s =list(input())",
"s",
"list(input())",
"list",
"input()",
"input",
"a = []",
"a",
"[]",
"for key, value in groupby(s):\n a.append(key)",
"key",
"value",
"groupby(s)",
"groupby",
"s",
"a.append(key)",
"a.append",
"a",
"append",
"key",
"print(len(a)-1)",
"print",
"len(a)-1",
"len(a)",
"len",
"a",
"1",
"s =list(input())",
"list(input())",
"s",
"a = []",
"[]",
"a"
] |
from itertools import groupby
s =list(input())
a = []
for key, value in groupby(s):
a.append(key)
print(len(a)-1)
|
[
7,
0,
13,
4,
13,
12,
13,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
13,
17,
9,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
9,
4,
13,
13,
23,
13,
4,
13,
13,
10,
12,
13,
10,
4,
13
] |
[
[
48,
2
],
[
9,
8
],
[
12,
11
],
[
40,
16
],
[
11,
19
],
[
40,
25
],
[
11,
26
],
[
40,
28
],
[
11,
30
],
[
34,
33
],
[
33,
38
],
[
8,
38
],
[
40,
40
],
[
46,
42
],
[
49,
43
],
[
48,
49
]
] |
[
"S = input()\n\ndef calculate(s):\n categories = 0\n for i in range(len(s)):\n if i == 0:\n continue\n\n if s[i] != s[i-1]:\n categories += 1\n continue\n\n print(categories)\n\n\n\ncalculate(S)",
"S = input()",
"S",
"input()",
"input",
"def calculate(s):\n categories = 0\n for i in range(len(s)):\n if i == 0:\n continue\n\n if s[i] != s[i-1]:\n categories += 1\n continue\n\n print(categories)",
"calculate",
"categories = 0",
"categories",
"0",
"for i in range(len(s)):\n if i == 0:\n continue\n\n if s[i] != s[i-1]:\n categories += 1\n continue\n\n ",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if i == 0:\n continue\n\n ",
"i == 0",
"i",
"0",
"continue",
"if s[i] != s[i-1]:\n categories += 1\n continue\n\n ",
"s[i] != s[i-1]",
"s[i]",
"s",
"i",
"s[i-1]",
"s",
"i-1",
"i",
"1",
"categories += 1",
"categories",
"1",
"continue",
"print(categories)",
"print",
"categories",
"s",
"s",
"calculate(S)",
"calculate",
"S",
"def calculate(s):\n categories = 0\n for i in range(len(s)):\n if i == 0:\n continue\n\n if s[i] != s[i-1]:\n categories += 1\n continue\n\n print(categories)",
"def calculate(s):\n categories = 0\n for i in range(len(s)):\n if i == 0:\n continue\n\n if s[i] != s[i-1]:\n categories += 1\n continue\n\n print(categories)",
"calculate",
"S = input()",
"input()",
"S"
] |
S = input()
def calculate(s):
categories = 0
for i in range(len(s)):
if i == 0:
continue
if s[i] != s[i-1]:
categories += 1
continue
print(categories)
calculate(S)
|
[
7,
0,
13,
4,
13,
41,
28,
13,
13,
4,
13,
18,
13,
39,
17,
18,
13,
39,
17,
40,
13,
13,
4,
17,
4,
13,
4,
13,
13,
10,
4,
13
] |
[
[
30,
2
],
[
31,
12
],
[
31,
16
],
[
30,
31
]
] |
[
"S = input()\n\nprint(len([0 for c1, c2 in zip(S[:-1], S[1:]) if c1 != c2]))",
"S = input()",
"S",
"input()",
"input",
"0 for c1, c2 in zip(S[:-1], S[1:]) if c1 != c2",
"for c1, c2 in zip(S[:-1], S[1:]) if c1 != c2",
"c1",
"c2",
"zip(S[:-1], S[1:])",
"zip",
"S[:-1]",
"S",
":-1",
"-1",
"S[1:]",
"S",
"1:",
"1",
"c1 != c2",
"c1",
"c2",
"if c1 != c2",
"0",
"print(len([0 for c1, c2 in zip(S[:-1], S[1:]) if c1 != c2]))",
"print",
"len([0 for c1, c2 in zip(S[:-1], S[1:]) if c1 != c2])",
"len",
"[0 for c1, c2 in zip(S[:-1], S[1:]) if c1 != c2]",
"S = input()",
"input()",
"S"
] |
S = input()
print(len([0 for c1, c2 in zip(S[:-1], S[1:]) if c1 != c2]))
|
[
7,
0,
13,
4,
13,
14,
2,
4,
13,
4,
13,
13,
17,
4,
13,
17,
4,
13,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13
] |
[
[
46,
2
],
[
47,
11
],
[
43,
19
],
[
23,
22
],
[
47,
28
],
[
47,
32
],
[
22,
33
],
[
47,
35
],
[
22,
37
],
[
44,
41
],
[
43,
44
],
[
46,
47
]
] |
[
"S=input()\n\nif len(set(S))==1:\n print(0)\n exit()\n \ncount = 0\nfor i in range(1,len(S)):\n if S[i] != S[i-1]:count += 1\n \nprint(count)",
"S=input()",
"S",
"input()",
"input",
"if len(set(S))==1:\n print(0)\n exit()\n ",
"len(set(S))==1",
"len(set(S))",
"len",
"set(S)",
"set",
"S",
"1",
"print(0)",
"print",
"0",
"exit()",
"exit",
"count = 0",
"count",
"0",
"for i in range(1,len(S)):\n if S[i] != S[i-1]:count += 1\n ",
"i",
"range(1,len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"if S[i] != S[i-1]:count += 1\n ",
"S[i] != S[i-1]",
"S[i]",
"S",
"i",
"S[i-1]",
"S",
"i-1",
"i",
"1",
"print(count)",
"print",
"count",
"count = 0",
"0",
"count",
"S=input()",
"input()",
"S"
] |
S=input()
if len(set(S))==1:
print(0)
exit()
count = 0
for i in range(1,len(S)):
if S[i] != S[i-1]:count += 1
print(count)
|
[
7,
15,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
4,
13,
17,
0,
13,
2,
2,
17,
17,
17,
12,
13,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
2,
13,
10,
4,
13
] |
[
[
72,
11
],
[
69,
16
],
[
26,
25
],
[
30,
29
],
[
25,
32
],
[
35,
34
],
[
38,
37
],
[
29,
41
],
[
25,
46
],
[
37,
47
],
[
25,
49
],
[
37,
51
],
[
55,
54
],
[
54,
58
],
[
34,
58
],
[
67,
64
],
[
69,
70
],
[
72,
73
]
] |
[
"import sys\n\nsys.setrecursionlimit(10 ** 7)\nf_inf = float('inf')\nmod = 10 ** 9 + 7\n\n\ndef resolve():\n s = input()\n n = len(s)\n res = 0\n for i in range(n - 1):\n if s[i] != s[i + 1]:\n res += 1\n print(res)\n\n\nif __name__ == '__main__':\n resolve()",
"import sys",
"sys",
"sys.setrecursionlimit(10 ** 7)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 7",
"10",
"7",
"f_inf = float('inf')",
"f_inf",
"float('inf')",
"float",
"'inf'",
"mod = 10 ** 9 + 7",
"mod",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"def resolve():\n s = input()\n n = len(s)\n res = 0\n for i in range(n - 1):\n if s[i] != s[i + 1]:\n res += 1\n print(res)",
"resolve",
"s = input()",
"s",
"input()",
"input",
"n = len(s)",
"n",
"len(s)",
"len",
"s",
"res = 0",
"res",
"0",
"for i in range(n - 1):\n if s[i] != s[i + 1]:\n res += 1\n ",
"i",
"range(n - 1)",
"range",
"n - 1",
"n",
"1",
"if s[i] != s[i + 1]:\n res += 1\n ",
"s[i] != s[i + 1]",
"s[i]",
"s",
"i",
"s[i + 1]",
"s",
"i + 1",
"i",
"1",
"res += 1",
"res",
"1",
"print(res)",
"print",
"res",
"if __name__ == '__main__':\n resolve()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"resolve()",
"resolve",
"def resolve():\n s = input()\n n = len(s)\n res = 0\n for i in range(n - 1):\n if s[i] != s[i + 1]:\n res += 1\n print(res)",
"def resolve():\n s = input()\n n = len(s)\n res = 0\n for i in range(n - 1):\n if s[i] != s[i + 1]:\n res += 1\n print(res)",
"resolve",
"mod = 10 ** 9 + 7",
"10 ** 9 + 7",
"mod",
"f_inf = float('inf')",
"float('inf')",
"f_inf"
] |
import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
s = input()
n = len(s)
res = 0
for i in range(n - 1):
if s[i] != s[i + 1]:
res += 1
print(res)
if __name__ == '__main__':
resolve()
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
13,
14,
40,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13
] |
[
[
36,
2
],
[
33,
6
],
[
37,
8
],
[
39,
11
],
[
15,
14
],
[
37,
14
],
[
14,
18
],
[
34,
19
],
[
43,
19
],
[
30,
21
],
[
42,
24
],
[
14,
25
],
[
31,
28
],
[
40,
28
],
[
30,
31
],
[
33,
34
],
[
36,
37
],
[
39,
40
],
[
14,
42
],
[
42,
43
]
] |
[
"s=input()\np=s[0]\nc=0\nfor x in s:\n if x!=p:\n c+=1\n p=x\nprint(c)",
"s=input()",
"s",
"input()",
"input",
"p=s[0]",
"p",
"s[0]",
"s",
"0",
"c=0",
"c",
"0",
"for x in s:\n if x!=p:\n c+=1\n p=x",
"x",
"s",
"if x!=p:\n c+=1\n p=x",
"x!=p",
"x",
"p",
"c+=1",
"c",
"1",
"p=x",
"p",
"x",
"print(c)",
"print",
"c",
"c+=1",
"1",
"c",
"p=s[0]",
"s[0]",
"p",
"s=input()",
"input()",
"s",
"c=0",
"0",
"c",
"p=x",
"x",
"p"
] |
s=input()
p=s[0]
c=0
for x in s:
if x!=p:
c+=1
p=x
print(c)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
13,
14,
40,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] |
[
[
44,
2
],
[
38,
8
],
[
45,
11
],
[
47,
13
],
[
17,
16
],
[
39,
20
],
[
45,
24
],
[
16,
26
],
[
45,
29
],
[
16,
30
],
[
41,
32
],
[
42,
36
],
[
48,
36
],
[
38,
39
],
[
41,
42
],
[
44,
45
],
[
47,
48
]
] |
[
"S = list(input())\nl = len(S)\ncnt = 0\nfor i in range(1,l):\n if S[i-1] != S[i]:\n cnt += 1\nprint(cnt)",
"S = list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"l = len(S)",
"l",
"len(S)",
"len",
"S",
"cnt = 0",
"cnt",
"0",
"for i in range(1,l):\n if S[i-1] != S[i]:\n cnt += 1",
"i",
"range(1,l)",
"range",
"1",
"l",
"if S[i-1] != S[i]:\n cnt += 1",
"S[i-1] != S[i]",
"S[i-1]",
"S",
"i-1",
"i",
"1",
"S[i]",
"S",
"i",
"cnt += 1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"l = len(S)",
"len(S)",
"l",
"cnt += 1",
"1",
"cnt",
"S = list(input())",
"list(input())",
"S",
"cnt = 0",
"0",
"cnt"
] |
S = list(input())
l = len(S)
cnt = 0
for i in range(1,l):
if S[i-1] != S[i]:
cnt += 1
print(cnt)
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
13,
14,
40,
13,
13,
0,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13,
10,
18,
13
] |
[
[
30,
2
],
[
42,
6
],
[
31,
8
],
[
36,
11
],
[
15,
14
],
[
31,
14
],
[
14,
18
],
[
43,
19
],
[
40,
19
],
[
39,
21
],
[
14,
22
],
[
33,
24
],
[
34,
28
],
[
37,
28
],
[
30,
31
],
[
33,
34
],
[
36,
37
],
[
14,
39
],
[
39,
40
],
[
42,
43
]
] |
[
"S = input()\nnow = S[0]\nans = 0\nfor stone in S:\n if stone != now:\n now = stone\n ans += 1\nprint(ans)",
"S = input()",
"S",
"input()",
"input",
"now = S[0]",
"now",
"S[0]",
"S",
"0",
"ans = 0",
"ans",
"0",
"for stone in S:\n if stone != now:\n now = stone\n ans += 1",
"stone",
"S",
"if stone != now:\n now = stone\n ans += 1",
"stone != now",
"stone",
"now",
"now = stone",
"now",
"stone",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"S = input()",
"input()",
"S",
"ans += 1",
"1",
"ans",
"ans = 0",
"0",
"ans",
"now = stone",
"stone",
"now",
"now = S[0]",
"S[0]",
"now"
] |
S = input()
now = S[0]
ans = 0
for stone in S:
if stone != now:
now = stone
ans += 1
print(ans)
|
[
7,
12,
13,
0,
13,
4,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
11,
10
],
[
14,
13
],
[
4,
19
],
[
4,
24
],
[
13,
25
],
[
4,
27
],
[
13,
29
],
[
33,
32
],
[
32,
36
],
[
10,
36
],
[
45,
42
]
] |
[
"def main():\n S = list(input())\n ans = 0\n\n for i in range(len(S) - 1):\n if S[i] != S[i + 1]:\n ans += 1\n\n print(ans)\nif __name__ == \"__main__\":\n main()",
"def main():\n S = list(input())\n ans = 0\n\n for i in range(len(S) - 1):\n if S[i] != S[i + 1]:\n ans += 1\n\n print(ans)",
"main",
"S = list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"ans = 0",
"ans",
"0",
"for i in range(len(S) - 1):\n if S[i] != S[i + 1]:\n ans += 1\n\n ",
"i",
"range(len(S) - 1)",
"range",
"len(S) - 1",
"len(S)",
"len",
"S",
"1",
"if S[i] != S[i + 1]:\n ans += 1\n\n ",
"S[i] != S[i + 1]",
"S[i]",
"S",
"i",
"S[i + 1]",
"S",
"i + 1",
"i",
"1",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n S = list(input())\n ans = 0\n\n for i in range(len(S) - 1):\n if S[i] != S[i + 1]:\n ans += 1\n\n print(ans)",
"def main():\n S = list(input())\n ans = 0\n\n for i in range(len(S) - 1):\n if S[i] != S[i + 1]:\n ans += 1\n\n print(ans)",
"main"
] |
def main():
S = list(input())
ans = 0
for i in range(len(S) - 1):
if S[i] != S[i + 1]:
ans += 1
print(ans)
if __name__ == "__main__":
main()
|
[
7,
0,
13,
4,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
13,
17,
0,
13,
18,
13,
17,
9,
14,
40,
18,
13,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
18,
13
] |
[
[
46,
2
],
[
58,
6
],
[
49,
9
],
[
13,
12
],
[
47,
17
],
[
12,
20
],
[
61,
23
],
[
47,
25
],
[
47,
31
],
[
12,
32
],
[
62,
33
],
[
59,
33
],
[
56,
33
],
[
52,
35
],
[
55,
38
],
[
47,
40
],
[
12,
41
],
[
53,
44
],
[
50,
44
],
[
46,
47
],
[
49,
50
],
[
52,
53
],
[
55,
56
],
[
58,
59
],
[
61,
62
]
] |
[
"s = input()\n\nnow = \"\"\nans = 0\nfor i in range(len(s)):\n if i == 0:\n now = s[0]\n continue\n if s[i] != now:\n ans += 1\n now = s[i]\nprint(ans)",
"s = input()",
"s",
"input()",
"input",
"now = \"\"",
"now",
"\"\"",
"ans = 0",
"ans",
"0",
"for i in range(len(s)):\n if i == 0:\n now = s[0]\n continue\n if s[i] != now:\n ans += 1\n now = s[i]",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if i == 0:\n now = s[0]\n continue\n ",
"i == 0",
"i",
"0",
"now = s[0]",
"now",
"s[0]",
"s",
"0",
"continue",
"if s[i] != now:\n ans += 1\n now = s[i]",
"s[i] != now",
"s[i]",
"s",
"i",
"now",
"ans += 1",
"ans",
"1",
"now = s[i]",
"now",
"s[i]",
"s",
"i",
"print(ans)",
"print",
"ans",
"s = input()",
"input()",
"s",
"ans = 0",
"0",
"ans",
"ans += 1",
"1",
"ans",
"now = s[i]",
"s[i]",
"now",
"now = \"\"",
"\"\"",
"now",
"now = s[0]",
"s[0]",
"now"
] |
s = input()
now = ""
ans = 0
for i in range(len(s)):
if i == 0:
now = s[0]
continue
if s[i] != now:
ans += 1
now = s[i]
print(ans)
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
13,
14,
40,
13,
13,
0,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
13,
13
] |
[
[
33,
2
],
[
36,
6
],
[
34,
8
],
[
39,
11
],
[
15,
14
],
[
34,
14
],
[
37,
18
],
[
43,
18
],
[
14,
19
],
[
42,
21
],
[
14,
22
],
[
30,
24
],
[
31,
28
],
[
40,
28
],
[
30,
31
],
[
33,
34
],
[
36,
37
],
[
39,
40
],
[
14,
42
],
[
42,
43
]
] |
[
"s = input()\ntmp = s[0]\ncnt = 0\nfor c in s:\n if tmp != c:\n tmp = c\n cnt += 1\nprint(cnt)",
"s = input()",
"s",
"input()",
"input",
"tmp = s[0]",
"tmp",
"s[0]",
"s",
"0",
"cnt = 0",
"cnt",
"0",
"for c in s:\n if tmp != c:\n tmp = c\n cnt += 1",
"c",
"s",
"if tmp != c:\n tmp = c\n cnt += 1",
"tmp != c",
"tmp",
"c",
"tmp = c",
"tmp",
"c",
"cnt += 1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"cnt += 1",
"1",
"cnt",
"s = input()",
"input()",
"s",
"tmp = s[0]",
"s[0]",
"tmp",
"cnt = 0",
"0",
"cnt",
"tmp = c",
"c",
"tmp"
] |
s = input()
tmp = s[0]
cnt = 0
for c in s:
if tmp != c:
tmp = c
cnt += 1
print(cnt)
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
0,
13,
18,
13,
13,
14,
40,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13
] |
[
[
46,
2
],
[
43,
6
],
[
47,
8
],
[
52,
11
],
[
15,
14
],
[
47,
20
],
[
40,
22
],
[
47,
24
],
[
14,
25
],
[
41,
28
],
[
44,
29
],
[
50,
29
],
[
55,
31
],
[
49,
34
],
[
41,
35
],
[
56,
38
],
[
53,
38
],
[
40,
41
],
[
43,
44
],
[
46,
47
],
[
41,
49
],
[
49,
50
],
[
52,
53
],
[
55,
56
]
] |
[
"S=input()\n#変わり目数える\npre=S[0]\nans=0\nfor i in range(1,len(S)):\n s=S[i]\n if s!=pre:\n ans+=1\n pre=s\nprint(ans)",
"S=input()",
"S",
"input()",
"input",
"pre=S[0]",
"pre",
"S[0]",
"S",
"0",
"ans=0",
"ans",
"0",
"for i in range(1,len(S)):\n s=S[i]\n if s!=pre:\n ans+=1\n pre=s",
"i",
"range(1,len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"s=S[i]",
"s",
"S[i]",
"S",
"i",
"if s!=pre:\n ans+=1\n ",
"s!=pre",
"s",
"pre",
"ans+=1",
"ans",
"1",
"pre=s",
"pre",
"s",
"print(ans)",
"print",
"ans",
"s=S[i]",
"S[i]",
"s",
"pre=S[0]",
"S[0]",
"pre",
"S=input()",
"input()",
"S",
"pre=s",
"s",
"pre",
"ans=0",
"0",
"ans",
"ans+=1",
"1",
"ans"
] |
S=input()
#変わり目数える
pre=S[0]
ans=0
for i in range(1,len(S)):
s=S[i]
if s!=pre:
ans+=1
pre=s
print(ans)
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
40,
18,
13,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
4,
13,
13,
10,
18,
13,
10,
18,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] |
[
[
47,
2
],
[
41,
6
],
[
48,
8
],
[
50,
11
],
[
15,
14
],
[
48,
19
],
[
48,
23
],
[
14,
24
],
[
42,
25
],
[
39,
25
],
[
44,
27
],
[
38,
30
],
[
48,
32
],
[
14,
33
],
[
45,
36
],
[
51,
36
],
[
38,
39
],
[
41,
42
],
[
44,
45
],
[
47,
48
],
[
50,
51
]
] |
[
"s = input()\nmae = s[0]\ncou = 0\nfor i in range(len(s)):\n if s[i] != mae:\n cou += 1\n mae = s[i]\nprint(cou)",
"s = input()",
"s",
"input()",
"input",
"mae = s[0]",
"mae",
"s[0]",
"s",
"0",
"cou = 0",
"cou",
"0",
"for i in range(len(s)):\n if s[i] != mae:\n cou += 1\n mae = s[i]",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i] != mae:\n cou += 1\n mae = s[i]",
"s[i] != mae",
"s[i]",
"s",
"i",
"mae",
"cou += 1",
"cou",
"1",
"mae = s[i]",
"mae",
"s[i]",
"s",
"i",
"print(cou)",
"print",
"cou",
"mae = s[i]",
"s[i]",
"mae",
"mae = s[0]",
"s[0]",
"mae",
"cou += 1",
"1",
"cou",
"s = input()",
"input()",
"s",
"cou = 0",
"0",
"cou"
] |
s = input()
mae = s[0]
cou = 0
for i in range(len(s)):
if s[i] != mae:
cou += 1
mae = s[i]
print(cou)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
18,
13,
13,
14,
40,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
18,
13,
10,
18,
13,
10,
17,
13
] |
[
[
48,
2
],
[
57,
8
],
[
49,
10
],
[
45,
13
],
[
49,
16
],
[
63,
18
],
[
22,
21
],
[
46,
25
],
[
60,
27
],
[
49,
29
],
[
21,
30
],
[
58,
33
],
[
55,
33
],
[
61,
34
],
[
51,
36
],
[
54,
39
],
[
61,
40
],
[
52,
43
],
[
64,
43
],
[
45,
46
],
[
48,
49
],
[
51,
52
],
[
61,
54
],
[
54,
55
],
[
57,
58
],
[
60,
61
],
[
63,
64
]
] |
[
"S = list(input())\nprev = S[0]\nL = len(S)\nans = 0\nfor i in range(1,L):\n s = S[i]\n if prev != s:\n ans += 1\n prev = s\nprint(ans)",
"S = list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"prev = S[0]",
"prev",
"S[0]",
"S",
"0",
"L = len(S)",
"L",
"len(S)",
"len",
"S",
"ans = 0",
"ans",
"0",
"for i in range(1,L):\n s = S[i]\n if prev != s:\n ans += 1\n prev = s",
"i",
"range(1,L)",
"range",
"1",
"L",
"s = S[i]",
"s",
"S[i]",
"S",
"i",
"if prev != s:\n ans += 1\n prev = s",
"prev != s",
"prev",
"s",
"ans += 1",
"ans",
"1",
"prev = s",
"prev",
"s",
"print(ans)",
"print",
"ans",
"L = len(S)",
"len(S)",
"L",
"S = list(input())",
"list(input())",
"S",
"ans += 1",
"1",
"ans",
"prev = s",
"s",
"prev",
"prev = S[0]",
"S[0]",
"prev",
"s = S[i]",
"S[i]",
"s",
"ans = 0",
"0",
"ans"
] |
S = list(input())
prev = S[0]
L = len(S)
ans = 0
for i in range(1,L):
s = S[i]
if prev != s:
ans += 1
prev = s
print(ans)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
2,
13,
17,
4,
13,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13
] |
[
[
36,
2
],
[
42,
6
],
[
10,
9
],
[
37,
15
],
[
37,
20
],
[
9,
21
],
[
37,
23
],
[
9,
25
],
[
39,
28
],
[
43,
30
],
[
40,
30
],
[
40,
34
],
[
43,
34
],
[
36,
37
],
[
39,
40
],
[
42,
43
]
] |
[
"a=input()\nb=0\nfor i in range(len(a)-1):\n if a[i]!=a[i+1]:\n b=b+1\nprint(b)",
"a=input()",
"a",
"input()",
"input",
"b=0",
"b",
"0",
"for i in range(len(a)-1):\n if a[i]!=a[i+1]:\n b=b+1",
"i",
"range(len(a)-1)",
"range",
"len(a)-1",
"len(a)",
"len",
"a",
"1",
"if a[i]!=a[i+1]:\n b=b+1",
"a[i]!=a[i+1]",
"a[i]",
"a",
"i",
"a[i+1]",
"a",
"i+1",
"i",
"1",
"b=b+1",
"b",
"b+1",
"b",
"1",
"print(b)",
"print",
"b",
"a=input()",
"input()",
"a",
"b=b+1",
"b+1",
"b",
"b=0",
"0",
"b"
] |
a=input()
b=0
for i in range(len(a)-1):
if a[i]!=a[i+1]:
b=b+1
print(b)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
18,
13,
39,
17,
14,
40,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13
] |
[
[
33,
2
],
[
39,
6
],
[
36,
9
],
[
34,
11
],
[
15,
14
],
[
34,
16
],
[
37,
21
],
[
43,
21
],
[
14,
22
],
[
45,
24
],
[
42,
27
],
[
14,
28
],
[
46,
31
],
[
40,
31
],
[
33,
34
],
[
36,
37
],
[
39,
40
],
[
14,
42
],
[
42,
43
],
[
45,
46
]
] |
[
"s = input()\ncnt = 0\np = s[0]\nfor i in s[1:]:\n if p != i:\n cnt += 1\n p = i\nprint(cnt)",
"s = input()",
"s",
"input()",
"input",
"cnt = 0",
"cnt",
"0",
"p = s[0]",
"p",
"s[0]",
"s",
"0",
"for i in s[1:]:\n if p != i:\n cnt += 1\n p = i",
"i",
"s[1:]",
"s",
"1:",
"1",
"if p != i:\n cnt += 1\n ",
"p != i",
"p",
"i",
"cnt += 1",
"cnt",
"1",
"p = i",
"p",
"i",
"print(cnt)",
"print",
"cnt",
"s = input()",
"input()",
"s",
"p = s[0]",
"s[0]",
"p",
"cnt = 0",
"0",
"cnt",
"p = i",
"i",
"p",
"cnt += 1",
"1",
"cnt"
] |
s = input()
cnt = 0
p = s[0]
for i in s[1:]:
if p != i:
cnt += 1
p = i
print(cnt)
|
[
7,
15,
13,
12,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
18,
4,
13,
13,
17,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
18,
13,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
4,
13,
13,
29,
17,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
7,
6
],
[
14,
13
],
[
6,
17
],
[
22,
21
],
[
25,
24
],
[
13,
26
],
[
30,
29
],
[
13,
35
],
[
13,
39
],
[
29,
40
],
[
24,
41
],
[
46,
41
],
[
44,
43
],
[
47,
46
],
[
13,
48
],
[
29,
49
],
[
43,
52
],
[
21,
52
],
[
63,
60
]
] |
[
"import sys\n\ndef solve():\n input = sys.stdin.readline\n S = input().strip(\"\\n\")\n turn = 0\n current = S[0]\n for i in range(1, len(S)):\n if S[i] != current:\n turn += 1\n current = S[i]\n print(turn)\n\n return 0\n\nif __name__ == \"__main__\":\n solve()",
"import sys",
"sys",
"def solve():\n input = sys.stdin.readline\n S = input().strip(\"\\n\")\n turn = 0\n current = S[0]\n for i in range(1, len(S)):\n if S[i] != current:\n turn += 1\n current = S[i]\n print(turn)\n\n return 0",
"solve",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"S = input().strip(\"\\n\")",
"S",
"input().strip(\"\\n\")",
"().strip",
"()",
"input",
"strip",
"\"\\n\"",
"turn = 0",
"turn",
"0",
"current = S[0]",
"current",
"S[0]",
"S",
"0",
"for i in range(1, len(S)):\n if S[i] != current:\n turn += 1\n current = S[i]\n ",
"i",
"range(1, len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"if S[i] != current:\n turn += 1\n current = S[i]\n ",
"S[i] != current",
"S[i]",
"S",
"i",
"current",
"turn += 1",
"turn",
"1",
"current = S[i]",
"current",
"S[i]",
"S",
"i",
"print(turn)",
"print",
"turn",
"return 0",
"0",
"if __name__ == \"__main__\":\n solve()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"solve()",
"solve",
"def solve():\n input = sys.stdin.readline\n S = input().strip(\"\\n\")\n turn = 0\n current = S[0]\n for i in range(1, len(S)):\n if S[i] != current:\n turn += 1\n current = S[i]\n print(turn)\n\n return 0",
"def solve():\n input = sys.stdin.readline\n S = input().strip(\"\\n\")\n turn = 0\n current = S[0]\n for i in range(1, len(S)):\n if S[i] != current:\n turn += 1\n current = S[i]\n print(turn)\n\n return 0",
"solve"
] |
import sys
def solve():
input = sys.stdin.readline
S = input().strip("\n")
turn = 0
current = S[0]
for i in range(1, len(S)):
if S[i] != current:
turn += 1
current = S[i]
print(turn)
return 0
if __name__ == "__main__":
solve()
|
[
7,
0,
13,
4,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
40,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
2,
13,
17,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13
] |
[
[
36,
2
],
[
42,
6
],
[
30,
9
],
[
13,
12
],
[
37,
12
],
[
12,
16
],
[
31,
17
],
[
40,
17
],
[
33,
19
],
[
39,
22
],
[
12,
23
],
[
34,
27
],
[
43,
27
],
[
30,
31
],
[
33,
34
],
[
36,
37
],
[
12,
39
],
[
39,
40
],
[
42,
43
]
] |
[
"S = input()\nc = 0\n\nbs = '_'\nfor s in S:\n if s != bs:\n c += 1\n bs = s\n\nprint(c - 1)",
"S = input()",
"S",
"input()",
"input",
"c = 0",
"c",
"0",
"bs = '_'",
"bs",
"'_'",
"for s in S:\n if s != bs:\n c += 1\n bs = s",
"s",
"S",
"if s != bs:\n c += 1\n bs = s",
"s != bs",
"s",
"bs",
"c += 1",
"c",
"1",
"bs = s",
"bs",
"s",
"print(c - 1)",
"print",
"c - 1",
"c",
"1",
"bs = '_'",
"'_'",
"bs",
"c += 1",
"1",
"c",
"S = input()",
"input()",
"S",
"bs = s",
"s",
"bs",
"c = 0",
"0",
"c"
] |
S = input()
c = 0
bs = '_'
for s in S:
if s != bs:
c += 1
bs = s
print(c - 1)
|
[
7,
0,
13,
4,
13,
41,
28,
13,
4,
13,
17,
4,
13,
13,
40,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
13,
13,
0,
13,
2,
39,
18,
13,
17,
13,
4,
13,
2,
4,
13,
13,
17,
10,
4,
13,
10,
2,
13
] |
[
[
43,
2
],
[
8,
7
],
[
44,
13
],
[
44,
16
],
[
7,
17
],
[
44,
19
],
[
7,
21
],
[
44,
25
],
[
7,
26
],
[
46,
28
],
[
44,
32
],
[
47,
40
],
[
43,
44
],
[
46,
47
]
] |
[
"s = input()\n\nstone = [s[0]] + [s[i] for i in range(1, len(s)) if s[i] != s[i - 1]]\nprint(len(stone) - 1)",
"s = input()",
"s",
"input()",
"input",
"s[i] for i in range(1, len(s)) if s[i] != s[i - 1]",
"for i in range(1, len(s)) if s[i] != s[i - 1]",
"i",
"range(1, len(s))",
"range",
"1",
"len(s)",
"len",
"s",
"s[i] != s[i - 1]",
"s[i]",
"s",
"i",
"s[i - 1]",
"s",
"i - 1",
"i",
"1",
"if s[i] != s[i - 1]",
"s[i]",
"s",
"i",
"stone = [s[0]] + [s[i] for i in range(1, len(s)) if s[i] != s[i - 1]]",
"stone",
"[s[0]] + [s[i] for i in range(1, len(s)) if s[i] != s[i - 1]]",
"[s[0]]",
"s[0]",
"s",
"0",
"[s[i] for i in range(1, len(s)) if s[i] != s[i - 1]]",
"print(len(stone) - 1)",
"print",
"len(stone) - 1",
"len(stone)",
"len",
"stone",
"1",
"s = input()",
"input()",
"s",
"stone = [s[0]] + [s[i] for i in range(1, len(s)) if s[i] != s[i - 1]]",
"[s[0]] + [s[i] for i in range(1, len(s)) if s[i] != s[i - 1]]",
"stone"
] |
s = input()
stone = [s[0]] + [s[i] for i in range(1, len(s)) if s[i] != s[i - 1]]
print(len(stone) - 1)
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
28,
13,
13,
14,
40,
18,
13,
17,
13,
0,
13,
13,
4,
13,
2,
4,
13,
13,
17,
10,
4,
13,
10,
18,
13,
10,
13,
13
] |
[
[
30,
2
],
[
33,
6
],
[
31,
8
],
[
12,
11
],
[
31,
11
],
[
34,
16
],
[
37,
16
],
[
11,
18
],
[
36,
20
],
[
11,
21
],
[
37,
27
],
[
34,
27
],
[
30,
31
],
[
33,
34
],
[
11,
36
],
[
36,
37
]
] |
[
"s = input()\n\ns_ = s[0]\n\nfor c in s:\n if s_[-1]!=c:\n s_ += c\nprint(len(s_)-1)",
"s = input()",
"s",
"input()",
"input",
"s_ = s[0]",
"s_",
"s[0]",
"s",
"0",
"for c in s:\n if s_[-1]!=c:\n s_ += c",
"c",
"s",
"if s_[-1]!=c:\n s_ += c",
"s_[-1]!=c",
"s_[-1]",
"s_",
"-1",
"c",
"s_ += c",
"s_",
"c",
"print(len(s_)-1)",
"print",
"len(s_)-1",
"len(s_)",
"len",
"s_",
"1",
"s = input()",
"input()",
"s",
"s_ = s[0]",
"s[0]",
"s_",
"s_ += c",
"c",
"s_"
] |
s = input()
s_ = s[0]
for c in s:
if s_[-1]!=c:
s_ += c
print(len(s_)-1)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
13,
18,
13,
13,
0,
13,
18,
13,
13,
0,
13,
17,
4,
13,
13,
10,
18,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13
] |
[
[
42,
2
],
[
51,
6
],
[
39,
9
],
[
43,
11
],
[
15,
14
],
[
43,
20
],
[
40,
23
],
[
46,
23
],
[
43,
25
],
[
14,
26
],
[
45,
28
],
[
43,
30
],
[
14,
31
],
[
48,
33
],
[
49,
37
],
[
52,
37
],
[
39,
40
],
[
42,
43
],
[
45,
46
],
[
48,
49
],
[
51,
52
]
] |
[
"s=input()\ntotal=0\nrec=s[0]\nfor i in range(1,len(s)):\n if rec!=s[i]:\n rec=s[i]\n total+=1\nprint(total)",
"s=input()",
"s",
"input()",
"input",
"total=0",
"total",
"0",
"rec=s[0]",
"rec",
"s[0]",
"s",
"0",
"for i in range(1,len(s)):\n if rec!=s[i]:\n rec=s[i]\n total+=1",
"i",
"range(1,len(s))",
"range",
"1",
"len(s)",
"len",
"s",
"if rec!=s[i]:\n rec=s[i]\n total+=1",
"rec!=s[i]",
"rec",
"s[i]",
"s",
"i",
"rec=s[i]",
"rec",
"s[i]",
"s",
"i",
"total+=1",
"total",
"1",
"print(total)",
"print",
"total",
"rec=s[0]",
"s[0]",
"rec",
"s=input()",
"input()",
"s",
"rec=s[i]",
"s[i]",
"rec",
"total+=1",
"1",
"total",
"total=0",
"0",
"total"
] |
s=input()
total=0
rec=s[0]
for i in range(1,len(s)):
if rec!=s[i]:
rec=s[i]
total+=1
print(total)
|
[
7,
15,
0,
13,
4,
13,
4,
13,
4,
13,
0,
13,
17,
0,
13,
4,
18,
13,
13,
42,
13,
0,
13,
4,
18,
13,
13,
14,
40,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13
] |
[
[
44,
3
],
[
53,
11
],
[
41,
14
],
[
45,
17
],
[
47,
22
],
[
45,
25
],
[
42,
29
],
[
57,
29
],
[
48,
30
],
[
50,
32
],
[
56,
35
],
[
48,
36
],
[
51,
39
],
[
54,
39
],
[
41,
42
],
[
44,
45
],
[
47,
48
],
[
50,
51
],
[
53,
54
],
[
48,
56
],
[
56,
57
]
] |
[
"from collections import deque\nS = deque(list(input()))\n\nans = 0\ns = S.popleft()\nwhile S:\n n = S.popleft()\n if s != n:\n ans += 1\n s = n\nprint(ans)",
"from collections import deque",
"S = deque(list(input()))",
"S",
"deque(list(input()))",
"deque",
"list(input())",
"list",
"input()",
"input",
"ans = 0",
"ans",
"0",
"s = S.popleft()",
"s",
"S.popleft()",
"S.popleft",
"S",
"popleft",
"while S:\n n = S.popleft()\n if s != n:\n ans += 1\n s = n",
"S",
"n = S.popleft()",
"n",
"S.popleft()",
"S.popleft",
"S",
"popleft",
"if s != n:\n ans += 1\n s = n",
"s != n",
"s",
"n",
"ans += 1",
"ans",
"1",
"s = n",
"s",
"n",
"print(ans)",
"print",
"ans",
"s = S.popleft()",
"S.popleft()",
"s",
"S = deque(list(input()))",
"deque(list(input()))",
"S",
"n = S.popleft()",
"S.popleft()",
"n",
"ans += 1",
"1",
"ans",
"ans = 0",
"0",
"ans",
"s = n",
"n",
"s"
] |
from collections import deque
S = deque(list(input()))
ans = 0
s = S.popleft()
while S:
n = S.popleft()
if s != n:
ans += 1
s = n
print(ans)
|
[
7,
12,
13,
29,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
14,
40,
13,
29,
4,
13,
4,
13,
29,
4,
13,
23,
13,
17,
12,
13,
29,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
17,
0,
13,
17,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
40,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] |
[
[
26,
16
],
[
27,
26
],
[
89,
42
],
[
102,
44
],
[
83,
47
],
[
92,
50
],
[
84,
53
],
[
90,
53
],
[
86,
55
],
[
59,
58
],
[
93,
64
],
[
84,
64
],
[
90,
64
],
[
93,
69
],
[
84,
69
],
[
90,
69
],
[
58,
71
],
[
93,
74
],
[
84,
74
],
[
90,
74
],
[
58,
75
],
[
95,
77
],
[
96,
81
],
[
87,
81
],
[
83,
84
],
[
86,
87
],
[
89,
90
],
[
92,
93
],
[
95,
96
]
] |
[
"def cin():\n\treturn map(int,input().split())\n\ndef cino(test=False):\n if not test:\n return int(input())\n else:\n return input()\ndef cina():\n return list(map(int,input().split()))\n\n\ns = cino(True)\ns+='A'\ns = list(s)\ncnt = -1\nfor i in range(len(s)-1):\n if s[i+1]!=s[i]:\n cnt += 1\nprint(cnt)",
"def cin():\n\treturn map(int,input().split())",
"cin",
"return map(int,input().split())",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"def cino(test=False):\n if not test:\n return int(input())\n else:\n return input()",
"cino",
"if not test:\n return int(input())\n else:\n return input()",
"not test",
"test",
"return int(input())",
"int(input())",
"int",
"input()",
"input",
"return input()",
"input()",
"input",
"test=False",
"test",
"False",
"def cina():\n return list(map(int,input().split()))",
"cina",
"return list(map(int,input().split()))",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"s = cino(True)",
"s",
"cino(True)",
"cino",
"True",
"s+='A'",
"s",
"'A'",
"s = list(s)",
"s",
"list(s)",
"list",
"s",
"cnt = -1",
"cnt",
"-1",
"for i in range(len(s)-1):\n if s[i+1]!=s[i]:\n cnt += 1",
"i",
"range(len(s)-1)",
"range",
"len(s)-1",
"len(s)",
"len",
"s",
"1",
"if s[i+1]!=s[i]:\n cnt += 1",
"s[i+1]!=s[i]",
"s[i+1]",
"s",
"i+1",
"i",
"1",
"s[i]",
"s",
"i",
"cnt += 1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"s+='A'",
"'A'",
"s",
"cnt = -1",
"-1",
"cnt",
"s = cino(True)",
"cino(True)",
"s",
"s = list(s)",
"list(s)",
"s",
"cnt += 1",
"1",
"cnt",
"def cina():\n return list(map(int,input().split()))",
"def cina():\n return list(map(int,input().split()))",
"cina",
"def cino(test=False):\n if not test:\n return int(input())\n else:\n return input()",
"def cino(test=False):\n if not test:\n return int(input())\n else:\n return input()",
"cino",
"def cin():\n\treturn map(int,input().split())",
"def cin():\n\treturn map(int,input().split())",
"cin"
] |
def cin():
return map(int,input().split())
def cino(test=False):
if not test:
return int(input())
else:
return input()
def cina():
return list(map(int,input().split()))
s = cino(True)
s+='A'
s = list(s)
cnt = -1
for i in range(len(s)-1):
if s[i+1]!=s[i]:
cnt += 1
print(cnt)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
17,
2,
4,
13,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] |
[
[
37,
2
],
[
40,
8
],
[
12,
11
],
[
38,
18
],
[
38,
23
],
[
11,
24
],
[
38,
26
],
[
11,
28
],
[
43,
31
],
[
44,
35
],
[
41,
35
],
[
37,
38
],
[
40,
41
],
[
43,
44
]
] |
[
"s = str(input())\nc = 0\nfor i in range(0, len(s) - 1):\n if s[i] != s[i+1]:\n c += 1\nprint(c)",
"s = str(input())",
"s",
"str(input())",
"str",
"input()",
"input",
"c = 0",
"c",
"0",
"for i in range(0, len(s) - 1):\n if s[i] != s[i+1]:\n c += 1",
"i",
"range(0, len(s) - 1)",
"range",
"0",
"len(s) - 1",
"len(s)",
"len",
"s",
"1",
"if s[i] != s[i+1]:\n c += 1",
"s[i] != s[i+1]",
"s[i]",
"s",
"i",
"s[i+1]",
"s",
"i+1",
"i",
"1",
"c += 1",
"c",
"1",
"print(c)",
"print",
"c",
"s = str(input())",
"str(input())",
"s",
"c = 0",
"0",
"c",
"c += 1",
"1",
"c"
] |
s = str(input())
c = 0
for i in range(0, len(s) - 1):
if s[i] != s[i+1]:
c += 1
print(c)
|
[
7,
0,
13,
4,
13,
15,
0,
13,
39,
0,
13,
39,
28,
13,
13,
4,
13,
13,
4,
18,
13,
13,
4,
13,
13,
4,
18,
13,
13,
13,
4,
13,
2,
4,
13,
13,
17,
10,
4,
13,
10,
39,
13,
10,
39,
13
] |
[
[
38,
2
],
[
44,
7
],
[
41,
10
],
[
39,
17
],
[
45,
20
],
[
42,
27
],
[
42,
35
],
[
38,
39
],
[
41,
42
],
[
44,
45
]
] |
[
"s = input()\n\n# 圧縮した文字列 t に対して len(t) - 1 が答え\n\nfrom itertools import groupby\n\ngroups = []\nuniquekeys = []\nfor k, g in groupby(s):\n groups.append(list(g))\n uniquekeys.append(k)\n\n# print(groups)\n# print(uniquekeys)\n\nprint(len(uniquekeys) - 1)",
"s = input()",
"s",
"input()",
"input",
"from itertools import groupby",
"groups = []",
"groups",
"[]",
"uniquekeys = []",
"uniquekeys",
"[]",
"for k, g in groupby(s):\n groups.append(list(g))\n uniquekeys.append(k)\n\n# print(groups)\n# print(uniquekeys)",
"k",
"g",
"groupby(s)",
"groupby",
"s",
"groups.append(list(g))",
"groups.append",
"groups",
"append",
"list(g)",
"list",
"g",
"uniquekeys.append(k)",
"uniquekeys.append",
"uniquekeys",
"append",
"k",
"print(len(uniquekeys) - 1)",
"print",
"len(uniquekeys) - 1",
"len(uniquekeys)",
"len",
"uniquekeys",
"1",
"s = input()",
"input()",
"s",
"uniquekeys = []",
"[]",
"uniquekeys",
"groups = []",
"[]",
"groups"
] |
s = input()
# 圧縮した文字列 t に対して len(t) - 1 が答え
from itertools import groupby
groups = []
uniquekeys = []
for k, g in groupby(s):
groups.append(list(g))
uniquekeys.append(k)
# print(groups)
# print(uniquekeys)
print(len(uniquekeys) - 1)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.