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,
4,
13,
8,
2,
2,
2,
13,
2,
13,
13,
2,
13,
2,
13,
13,
2,
13,
2,
13,
13,
17,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
42,
2
],
[
42,
11
],
[
42,
12
],
[
43,
19
],
[
40,
21
],
[
37,
22
],
[
40,
24
],
[
43,
26
],
[
37,
27
],
[
37,
29
],
[
43,
31
],
[
40,
32
],
[
42,
37
],
[
42,
40
],
[
42,
43
]
] |
[
"a, b, c = map(int, input().split())\nprint('Yes' if a == (b + c) or b == (a + c) or c == (a+b) else 'No')",
"a, b, c = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"c",
"print('Yes' if a == (b + c) or b == (a + c) or c == (a+b) else 'No')",
"print",
"'Yes' if a == (b + c) or b == (a + c) or c == (a+b) else 'No'",
"a == (b + c) or b == (a + c) or c == (a+b)",
"a == (b + c) or b == (a + c)",
"a == (b + c)",
"a",
"b + c",
"b",
"c",
"b == (a + c)",
"b",
"a + c",
"a",
"c",
"c == (a+b)",
"c",
"a+b",
"a",
"b",
"'Yes'",
"'No'",
"c = map(int, input().split())",
"map(int, input().split())",
"c",
"b, c = map(int, input().split())",
"map(int, input().split())",
"b",
"a, b, c = map(int, input().split())",
"map(int, input().split())",
"a"
] |
a, b, c = map(int, input().split())
print('Yes' if a == (b + c) or b == (a + c) or c == (a+b) else 'No')
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
14,
2,
2,
2,
2,
13,
13,
13,
2,
2,
13,
13,
13,
2,
2,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] |
[
[
50,
2
],
[
50,
11
],
[
50,
12
],
[
47,
14
],
[
51,
21
],
[
45,
22
],
[
42,
23
],
[
51,
26
],
[
42,
27
],
[
45,
28
],
[
45,
31
],
[
42,
32
],
[
51,
33
],
[
53,
35
],
[
54,
39
],
[
48,
39
],
[
50,
42
],
[
50,
45
],
[
47,
48
],
[
50,
51
],
[
53,
54
]
] |
[
"#k = int(input())\n#s = input()\n#a, b = map(int, input().split())\n#s, t = map(str, input().split())\n#l = list(map(int, input().split()))\n#l = [list(map(int,input().split())) for i in range(n)]\n\na,b,c = map(int, input().split())\n\nans = \"No\"\n\nif a + b == c or a + c == b or b + c == a:\n ans = \"Yes\"\n\nprint(ans)",
"a,b,c = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"c",
"ans = \"No\"",
"ans",
"\"No\"",
"if a + b == c or a + c == b or b + c == a:\n ans = \"Yes\"",
"a + b == c or a + c == b or b + c == a",
"a + b == c or a + c == b",
"a + b == c",
"a + b",
"a",
"b",
"c",
"a + c == b",
"a + c",
"a",
"c",
"b",
"b + c == a",
"b + c",
"b",
"c",
"a",
"ans = \"Yes\"",
"ans",
"\"Yes\"",
"print(ans)",
"print",
"ans",
"c = map(int, input().split())",
"map(int, input().split())",
"c",
"b,c = map(int, input().split())",
"map(int, input().split())",
"b",
"ans = \"No\"",
"\"No\"",
"ans",
"a,b,c = map(int, input().split())",
"map(int, input().split())",
"a",
"ans = \"Yes\"",
"\"Yes\"",
"ans"
] |
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
a,b,c = map(int, input().split())
ans = "No"
if a + b == c or a + c == b or b + c == a:
ans = "Yes"
print(ans)
|
[
7,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
14,
2,
4,
13,
13,
2,
4,
13,
13,
4,
13,
13,
4,
13,
17,
4,
13,
17,
10,
13,
13
] |
[
[
4,
3
],
[
3,
12
],
[
35,
14
],
[
36,
20
],
[
36,
24
],
[
36,
27
],
[
35,
36
]
] |
[
"a = [int(i) for i in input().split()]\nif max(a) == (sum(a)-max(a)):\n print('Yes')\nelse:\n print('No')",
"int(i) for i in input().split()",
"for i in input().split()",
"i",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in input().split()",
"int(i)",
"int",
"i",
"a = [int(i) for i in input().split()]",
"a",
"[int(i) for i in input().split()]",
"if max(a) == (sum(a)-max(a)):\n print('Yes')\nelse:\n print('No')",
"max(a) == (sum(a)-max(a))",
"max(a)",
"max",
"a",
"sum(a)-max(a)",
"sum(a)",
"sum",
"a",
"max(a)",
"max",
"a",
"print('Yes')",
"print",
"'Yes'",
"print('No')",
"print",
"'No'",
"a = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"a"
] |
a = [int(i) for i in input().split()]
if max(a) == (sum(a)-max(a)):
print('Yes')
else:
print('No')
|
[
7,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
14,
2,
2,
2,
18,
13,
17,
4,
13,
18,
13,
39,
17,
2,
4,
13,
18,
13,
39,
17,
18,
13,
17,
2,
2,
18,
13,
17,
18,
13,
17,
18,
13,
17,
4,
13,
17,
4,
13,
17,
10,
13,
13
] |
[
[
4,
3
],
[
3,
12
],
[
57,
14
],
[
58,
21
],
[
58,
26
],
[
58,
33
],
[
58,
37
],
[
58,
42
],
[
58,
45
],
[
58,
48
],
[
57,
58
]
] |
[
"a=[int(i) for i in input().split()]\nif a[0]==sum(a[1:]) or sum(a[:2])==a[2] or a[0]+a[2]==a[1]:\n print(\"Yes\")\nelse:\n print(\"No\")",
"int(i) for i in input().split()",
"for i in input().split()",
"i",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in input().split()",
"int(i)",
"int",
"i",
"a=[int(i) for i in input().split()]",
"a",
"[int(i) for i in input().split()]",
"if a[0]==sum(a[1:]) or sum(a[:2])==a[2] or a[0]+a[2]==a[1]:\n print(\"Yes\")\nelse:\n print(\"No\")",
"a[0]==sum(a[1:]) or sum(a[:2])==a[2] or a[0]+a[2]==a[1]",
"a[0]==sum(a[1:]) or sum(a[:2])==a[2]",
"a[0]==sum(a[1:])",
"a[0]",
"a",
"0",
"sum(a[1:])",
"sum",
"a[1:]",
"a",
"1:",
"1",
"sum(a[:2])==a[2]",
"sum(a[:2])",
"sum",
"a[:2]",
"a",
":2",
"2",
"a[2]",
"a",
"2",
"a[0]+a[2]==a[1]",
"a[0]+a[2]",
"a[0]",
"a",
"0",
"a[2]",
"a",
"2",
"a[1]",
"a",
"1",
"print(\"Yes\")",
"print",
"\"Yes\"",
"print(\"No\")",
"print",
"\"No\"",
"a=[int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"a"
] |
a=[int(i) for i in input().split()]
if a[0]==sum(a[1:]) or sum(a[:2])==a[2] or a[0]+a[2]==a[1]:
print("Yes")
else:
print("No")
|
[
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,
4,
18,
13,
13,
14,
2,
2,
18,
13,
17,
18,
13,
17,
18,
13,
17,
4,
13,
17,
4,
13,
17,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13
] |
[
[
26,
16
],
[
27,
26
],
[
71,
42
],
[
69,
44
],
[
72,
47
],
[
72,
53
],
[
72,
56
],
[
72,
59
],
[
71,
72
]
] |
[
"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\n\na = cina()\na.sort()\nif a[0]+a[1]==a[2]:\n print(\"Yes\")\nelse:\n print(\"No\")",
"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",
"a = cina()",
"a",
"cina()",
"cina",
"a.sort()",
"a.sort",
"a",
"sort",
"if a[0]+a[1]==a[2]:\n print(\"Yes\")\nelse:\n print(\"No\")",
"a[0]+a[1]==a[2]",
"a[0]+a[1]",
"a[0]",
"a",
"0",
"a[1]",
"a",
"1",
"a[2]",
"a",
"2",
"print(\"Yes\")",
"print",
"\"Yes\"",
"print(\"No\")",
"print",
"\"No\"",
"def cina():\n return list(map(int,input().split()))",
"def cina():\n return list(map(int,input().split()))",
"cina",
"a = cina()",
"cina()",
"a",
"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()))
a = cina()
a.sort()
if a[0]+a[1]==a[2]:
print("Yes")
else:
print("No")
|
[
7,
0,
13,
4,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
4,
13,
8,
2,
4,
13,
18,
13,
39,
17,
18,
13,
17,
17,
17,
10,
4,
13
] |
[
[
31,
2
],
[
32,
22
],
[
32,
26
],
[
31,
32
]
] |
[
"A=sorted(list(map(int,input().split())))\nprint(\"Yes\" if sum(A[:2])==A[2] else \"No\")",
"A=sorted(list(map(int,input().split())))",
"A",
"sorted(list(map(int,input().split())))",
"sorted",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"print(\"Yes\" if sum(A[:2])==A[2] else \"No\")",
"print",
"\"Yes\" if sum(A[:2])==A[2] else \"No\"",
"sum(A[:2])==A[2]",
"sum(A[:2])",
"sum",
"A[:2]",
"A",
":2",
"2",
"A[2]",
"A",
"2",
"\"Yes\"",
"\"No\"",
"A=sorted(list(map(int,input().split())))",
"sorted(list(map(int,input().split())))",
"A"
] |
A=sorted(list(map(int,input().split())))
print("Yes" if sum(A[:2])==A[2] else "No")
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
2,
13,
13,
13,
14,
2,
2,
2,
13,
4,
13,
13,
13,
13,
4,
13,
13,
13,
13,
2,
2,
13,
17,
17,
4,
13,
17,
4,
13,
17,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] |
[
[
56,
2
],
[
56,
11
],
[
56,
12
],
[
50,
14
],
[
54,
17
],
[
57,
18
],
[
48,
19
],
[
51,
24
],
[
54,
27
],
[
57,
28
],
[
48,
29
],
[
54,
32
],
[
57,
33
],
[
48,
34
],
[
51,
37
],
[
56,
48
],
[
50,
51
],
[
56,
54
],
[
56,
57
]
] |
[
"x, y, z = map(int, input().split())\ni = x + y + z\nif i - max(x, y, z) == max(x, y, z) and i % 2 == 0:\n print('Yes')\nelse:\n print('No')",
"x, y, z = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"z",
"i = x + y + z",
"i",
"x + y + z",
"x + y",
"x",
"y",
"z",
"if i - max(x, y, z) == max(x, y, z) and i % 2 == 0:\n print('Yes')\nelse:\n print('No')",
"i - max(x, y, z) == max(x, y, z) and i % 2 == 0",
"i - max(x, y, z) == max(x, y, z)",
"i - max(x, y, z)",
"i",
"max(x, y, z)",
"max",
"x",
"y",
"z",
"max(x, y, z)",
"max",
"x",
"y",
"z",
"i % 2 == 0",
"i % 2",
"i",
"2",
"0",
"print('Yes')",
"print",
"'Yes'",
"print('No')",
"print",
"'No'",
"z = map(int, input().split())",
"map(int, input().split())",
"z",
"i = x + y + z",
"x + y + z",
"i",
"x, y, z = map(int, input().split())",
"map(int, input().split())",
"x",
"y, z = map(int, input().split())",
"map(int, input().split())",
"y"
] |
x, y, z = map(int, input().split())
i = x + y + z
if i - max(x, y, z) == max(x, y, z) and i % 2 == 0:
print('Yes')
else:
print('No')
|
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
2,
2,
2,
2,
2,
13,
13,
13,
17,
13,
2,
2,
2,
2,
13,
13,
13,
17,
13,
2,
2,
2,
2,
13,
13,
13,
17,
13,
4,
13,
17,
14,
2,
2,
2,
2,
2,
2,
13,
13,
13,
17,
2,
13,
13,
2,
2,
2,
2,
13,
13,
13,
17,
2,
13,
13,
2,
2,
2,
2,
13,
13,
13,
17,
2,
13,
13,
4,
13,
17,
4,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
97,
2
],
[
97,
13
],
[
97,
14
],
[
92,
22
],
[
95,
23
],
[
98,
24
],
[
92,
26
],
[
92,
31
],
[
95,
32
],
[
98,
33
],
[
95,
35
],
[
92,
40
],
[
95,
41
],
[
98,
42
],
[
98,
44
],
[
92,
55
],
[
95,
56
],
[
98,
57
],
[
92,
60
],
[
95,
61
],
[
92,
66
],
[
95,
67
],
[
98,
68
],
[
95,
71
],
[
98,
72
],
[
92,
77
],
[
95,
78
],
[
98,
79
],
[
98,
82
],
[
92,
83
],
[
97,
92
],
[
97,
95
],
[
97,
98
]
] |
[
"a, b, c =list(map(int, input().split()))\n\nif (a+b+c)/2 == a or (a+b+c)/2 == b or (a+b+c)/2 == c:\n print(\"Yes\")\nelif (a+b+c)/2 == a+b or (a+b+c)/2 == b+c or (a+b+c)/2 == c+a:\n print(\"Yes\")\nelse:\n print(\"No\")",
"a, b, c =list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"c",
"if (a+b+c)/2 == a or (a+b+c)/2 == b or (a+b+c)/2 == c:\n print(\"Yes\")\nelif (a+b+c)/2 == a+b or (a+b+c)/2 == b+c or (a+b+c)/2 == c+a:\n print(\"Yes\")\nelse:\n print(\"No\")",
"(a+b+c)/2 == a or (a+b+c)/2 == b or (a+b+c)/2 == c",
"(a+b+c)/2 == a or (a+b+c)/2 == b",
"(a+b+c)/2 == a",
"(a+b+c)/2",
"a+b+c",
"a+b",
"a",
"b",
"c",
"2",
"a",
"(a+b+c)/2 == b",
"(a+b+c)/2",
"a+b+c",
"a+b",
"a",
"b",
"c",
"2",
"b",
"(a+b+c)/2 == c",
"(a+b+c)/2",
"a+b+c",
"a+b",
"a",
"b",
"c",
"2",
"c",
"print(\"Yes\")",
"print",
"\"Yes\"",
"elif (a+b+c)/2 == a+b or (a+b+c)/2 == b+c or (a+b+c)/2 == c+a:\n print(\"Yes\")",
"(a+b+c)/2 == a+b or (a+b+c)/2 == b+c or (a+b+c)/2 == c+a",
"(a+b+c)/2 == a+b or (a+b+c)/2 == b+c",
"(a+b+c)/2 == a+b",
"(a+b+c)/2",
"a+b+c",
"a+b",
"a",
"b",
"c",
"2",
"a+b",
"a",
"b",
"(a+b+c)/2 == b+c",
"(a+b+c)/2",
"a+b+c",
"a+b",
"a",
"b",
"c",
"2",
"b+c",
"b",
"c",
"(a+b+c)/2 == c+a",
"(a+b+c)/2",
"a+b+c",
"a+b",
"a",
"b",
"c",
"2",
"c+a",
"c",
"a",
"print(\"Yes\")",
"print",
"\"Yes\"",
"print(\"No\")",
"print",
"\"No\"",
"a, b, c =list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"b, c =list(map(int, input().split()))",
"list(map(int, input().split()))",
"b",
"c =list(map(int, input().split()))",
"list(map(int, input().split()))",
"c"
] |
a, b, c =list(map(int, input().split()))
if (a+b+c)/2 == a or (a+b+c)/2 == b or (a+b+c)/2 == c:
print("Yes")
elif (a+b+c)/2 == a+b or (a+b+c)/2 == b+c or (a+b+c)/2 == c+a:
print("Yes")
else:
print("No")
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
13,
13,
0,
13,
2,
2,
2,
13,
13,
13,
13,
14,
2,
13,
13,
4,
13,
17,
4,
13,
17,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
52,
2
],
[
52,
11
],
[
52,
12
],
[
49,
14
],
[
44,
17
],
[
47,
18
],
[
53,
19
],
[
40,
21
],
[
44,
25
],
[
47,
26
],
[
53,
27
],
[
50,
28
],
[
50,
31
],
[
41,
32
],
[
40,
41
],
[
52,
44
],
[
52,
47
],
[
49,
50
],
[
52,
53
]
] |
[
"a, b, c = map(int, input().split())\nma = max(a, b, c)\nrem = a + b + c - ma\nif ma == rem:\n print('Yes')\nelse:\n print('No')",
"a, b, c = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"c",
"ma = max(a, b, c)",
"ma",
"max(a, b, c)",
"max",
"a",
"b",
"c",
"rem = a + b + c - ma",
"rem",
"a + b + c - ma",
"a + b + c",
"a + b",
"a",
"b",
"c",
"ma",
"if ma == rem:\n print('Yes')\nelse:\n print('No')",
"ma == rem",
"ma",
"rem",
"print('Yes')",
"print",
"'Yes'",
"print('No')",
"print",
"'No'",
"rem = a + b + c - ma",
"a + b + c - ma",
"rem",
"a, b, c = map(int, input().split())",
"map(int, input().split())",
"a",
"b, c = map(int, input().split())",
"map(int, input().split())",
"b",
"ma = max(a, b, c)",
"max(a, b, c)",
"ma",
"c = map(int, input().split())",
"map(int, input().split())",
"c"
] |
a, b, c = map(int, input().split())
ma = max(a, b, c)
rem = a + b + c - ma
if ma == rem:
print('Yes')
else:
print('No')
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
2,
13,
13,
13,
0,
13,
8,
2,
2,
2,
2,
13,
13,
13,
2,
2,
13,
13,
13,
2,
2,
13,
13,
13,
17,
17,
4,
13,
18,
39,
17,
17,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
8,
13,
10,
4,
13
] |
[
[
62,
2
],
[
62,
11
],
[
62,
12
],
[
56,
14
],
[
51,
17
],
[
54,
18
],
[
63,
19
],
[
59,
21
],
[
51,
27
],
[
54,
28
],
[
63,
29
],
[
51,
32
],
[
63,
33
],
[
54,
34
],
[
54,
37
],
[
63,
38
],
[
51,
39
],
[
60,
48
],
[
62,
51
],
[
62,
54
],
[
56,
57
],
[
59,
60
],
[
62,
63
]
] |
[
"a,b,c=map(int,input().split())\nt=a+b+c\nk=0 if a+b==c or a+c==b or b+c==a else 1\nprint(['Yes','No'][k])",
"a,b,c=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"c",
"t=a+b+c",
"t",
"a+b+c",
"a+b",
"a",
"b",
"c",
"k=0 if a+b==c or a+c==b or b+c==a else 1",
"k",
"0 if a+b==c or a+c==b or b+c==a else 1",
"a+b==c or a+c==b or b+c==a",
"a+b==c or a+c==b",
"a+b==c",
"a+b",
"a",
"b",
"c",
"a+c==b",
"a+c",
"a",
"c",
"b",
"b+c==a",
"b+c",
"b",
"c",
"a",
"0",
"1",
"print(['Yes','No'][k])",
"print",
"['Yes','No'][k]",
"['Yes','No']",
"'Yes'",
"'No'",
"k",
"a,b,c=map(int,input().split())",
"map(int,input().split())",
"a",
"b,c=map(int,input().split())",
"map(int,input().split())",
"b",
"t=a+b+c",
"a+b+c",
"t",
"k=0 if a+b==c or a+c==b or b+c==a else 1",
"0 if a+b==c or a+c==b or b+c==a else 1",
"k",
"c=map(int,input().split())",
"map(int,input().split())",
"c"
] |
a,b,c=map(int,input().split())
t=a+b+c
k=0 if a+b==c or a+c==b or b+c==a else 1
print(['Yes','No'][k])
|
[
7,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
4,
18,
13,
13,
14,
2,
2,
18,
13,
17,
18,
13,
17,
18,
13,
17,
4,
13,
17,
4,
13,
17,
10,
13,
13
] |
[
[
4,
3
],
[
3,
12
],
[
39,
14
],
[
40,
18
],
[
40,
24
],
[
40,
27
],
[
40,
30
],
[
39,
40
]
] |
[
"L = [int(x) for x in input().split()]\nL.sort()\nif L[0] + L[1] == L[2]:\n print(\"Yes\")\nelse:\n print(\"No\")",
"int(x) for x in input().split()",
"for x in input().split()",
"x",
"input().split()",
"().split",
"()",
"input",
"split",
"for x in input().split()",
"int(x)",
"int",
"x",
"L = [int(x) for x in input().split()]",
"L",
"[int(x) for x in input().split()]",
"L.sort()",
"L.sort",
"L",
"sort",
"if L[0] + L[1] == L[2]:\n print(\"Yes\")\nelse:\n print(\"No\")",
"L[0] + L[1] == L[2]",
"L[0] + L[1]",
"L[0]",
"L",
"0",
"L[1]",
"L",
"1",
"L[2]",
"L",
"2",
"print(\"Yes\")",
"print",
"\"Yes\"",
"print(\"No\")",
"print",
"\"No\"",
"L = [int(x) for x in input().split()]",
"[int(x) for x in input().split()]",
"L"
] |
L = [int(x) for x in input().split()]
L.sort()
if L[0] + L[1] == L[2]:
print("Yes")
else:
print("No")
|
[
7,
0,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
39,
13,
13,
13,
4,
18,
13,
13,
14,
2,
2,
18,
13,
17,
18,
13,
17,
18,
13,
17,
4,
13,
17,
4,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13
] |
[
[
66,
2
],
[
66,
8
],
[
66,
9
],
[
57,
11
],
[
61,
14
],
[
63,
16
],
[
55,
19
],
[
72,
21
],
[
67,
24
],
[
69,
26
],
[
70,
33
],
[
70,
39
],
[
70,
42
],
[
70,
45
],
[
66,
55
],
[
57,
58
],
[
66,
61
],
[
63,
64
],
[
66,
67
],
[
69,
70
],
[
72,
73
]
] |
[
"a,b,c=input().split()\na=int(a)\nb=int(b)\nc=int(c)\nls=[a,b,c]\nls.sort()\nif ls[0]+ls[1]==ls[2]:\n print(\"Yes\")\nelse:\n print(\"No\")",
"a,b,c=input().split()",
"a",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"c",
"a=int(a)",
"a",
"int(a)",
"int",
"a",
"b=int(b)",
"b",
"int(b)",
"int",
"b",
"c=int(c)",
"c",
"int(c)",
"int",
"c",
"ls=[a,b,c]",
"ls",
"[a,b,c]",
"a",
"b",
"c",
"ls.sort()",
"ls.sort",
"ls",
"sort",
"if ls[0]+ls[1]==ls[2]:\n print(\"Yes\")\nelse:\n print(\"No\")",
"ls[0]+ls[1]==ls[2]",
"ls[0]+ls[1]",
"ls[0]",
"ls",
"0",
"ls[1]",
"ls",
"1",
"ls[2]",
"ls",
"2",
"print(\"Yes\")",
"print",
"\"Yes\"",
"print(\"No\")",
"print",
"\"No\"",
"b,c=input().split()",
"input().split()",
"b",
"a=int(a)",
"int(a)",
"a",
"a,b,c=input().split()",
"input().split()",
"a",
"b=int(b)",
"int(b)",
"b",
"c=input().split()",
"input().split()",
"c",
"ls=[a,b,c]",
"[a,b,c]",
"ls",
"c=int(c)",
"int(c)",
"c"
] |
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
ls=[a,b,c]
ls.sort()
if ls[0]+ls[1]==ls[2]:
print("Yes")
else:
print("No")
|
[
7,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
4,
13,
8,
2,
4,
13,
13,
2,
17,
4,
13,
13,
17,
17,
10,
13,
13
] |
[
[
4,
3
],
[
3,
12
],
[
31,
14
],
[
32,
22
],
[
32,
27
],
[
31,
32
]
] |
[
"a=[int(i) for i in input().split()]\nprint(\"Yes\" if sum(a)==2*max(a) else \"No\")",
"int(i) for i in input().split()",
"for i in input().split()",
"i",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in input().split()",
"int(i)",
"int",
"i",
"a=[int(i) for i in input().split()]",
"a",
"[int(i) for i in input().split()]",
"print(\"Yes\" if sum(a)==2*max(a) else \"No\")",
"print",
"\"Yes\" if sum(a)==2*max(a) else \"No\"",
"sum(a)==2*max(a)",
"sum(a)",
"sum",
"a",
"2*max(a)",
"2",
"max(a)",
"max",
"a",
"\"Yes\"",
"\"No\"",
"a=[int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"a"
] |
a=[int(i) for i in input().split()]
print("Yes" if sum(a)==2*max(a) else "No")
|
[
7,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
13,
0,
13,
4,
13,
2,
2,
2,
13,
13,
13,
17,
14,
2,
2,
13,
13,
2,
2,
13,
13,
13,
4,
13,
17,
14,
2,
2,
13,
13,
2,
2,
13,
13,
13,
4,
13,
17,
14,
2,
2,
13,
13,
2,
2,
13,
13,
13,
4,
13,
17,
4,
13,
17,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13
] |
[
[
4,
3
],
[
3,
12
],
[
81,
14
],
[
81,
16
],
[
81,
17
],
[
75,
19
],
[
73,
25
],
[
79,
26
],
[
82,
27
],
[
73,
32
],
[
76,
33
],
[
79,
36
],
[
82,
37
],
[
76,
38
],
[
79,
45
],
[
76,
46
],
[
73,
49
],
[
82,
50
],
[
76,
51
],
[
82,
58
],
[
76,
59
],
[
79,
62
],
[
73,
63
],
[
76,
64
],
[
81,
73
],
[
75,
76
],
[
81,
79
],
[
81,
82
]
] |
[
"a,b,c = (int(x) for x in input().split())\nhalf_pack = int((a+b+c)/2)\nif(a == half_pack) and ((b+c) == half_pack):\n print(\"Yes\")\nelif(b == half_pack) and ((a+c) == half_pack):\n print(\"Yes\")\nelif(c == half_pack) and ((b+a) == half_pack):\n print(\"Yes\")\nelse:\n print(\"No\")",
"int(x) for x in input().split()",
"for x in input().split()",
"x",
"input().split()",
"().split",
"()",
"input",
"split",
"for x in input().split()",
"int(x)",
"int",
"x",
"a,b,c = (int(x) for x in input().split())",
"a",
"(int(x) for x in input().split())",
"b",
"c",
"half_pack = int((a+b+c)/2)",
"half_pack",
"int((a+b+c)/2)",
"int",
"(a+b+c)/2",
"a+b+c",
"a+b",
"a",
"b",
"c",
"2",
"if(a == half_pack) and ((b+c) == half_pack):\n print(\"Yes\")\nelif(b == half_pack) and ((a+c) == half_pack):\n print(\"Yes\")\nelif(c == half_pack) and ((b+a) == half_pack):\n print(\"Yes\")\nelse:\n print(\"No\")",
"(a == half_pack) and ((b+c) == half_pack)",
"a == half_pack",
"a",
"half_pack",
"(b+c) == half_pack",
"b+c",
"b",
"c",
"half_pack",
"print(\"Yes\")",
"print",
"\"Yes\"",
"elif(b == half_pack) and ((a+c) == half_pack):\n print(\"Yes\")",
"(b == half_pack) and ((a+c) == half_pack)",
"b == half_pack",
"b",
"half_pack",
"(a+c) == half_pack",
"a+c",
"a",
"c",
"half_pack",
"print(\"Yes\")",
"print",
"\"Yes\"",
"elif(c == half_pack) and ((b+a) == half_pack):\n print(\"Yes\")",
"(c == half_pack) and ((b+a) == half_pack)",
"c == half_pack",
"c",
"half_pack",
"(b+a) == half_pack",
"b+a",
"b",
"a",
"half_pack",
"print(\"Yes\")",
"print",
"\"Yes\"",
"print(\"No\")",
"print",
"\"No\"",
"a,b,c = (int(x) for x in input().split())",
"(int(x) for x in input().split())",
"a",
"half_pack = int((a+b+c)/2)",
"int((a+b+c)/2)",
"half_pack",
"b,c = (int(x) for x in input().split())",
"(int(x) for x in input().split())",
"b",
"c = (int(x) for x in input().split())",
"(int(x) for x in input().split())",
"c"
] |
a,b,c = (int(x) for x in input().split())
half_pack = int((a+b+c)/2)
if(a == half_pack) and ((b+c) == half_pack):
print("Yes")
elif(b == half_pack) and ((a+c) == half_pack):
print("Yes")
elif(c == half_pack) and ((b+a) == half_pack):
print("Yes")
else:
print("No")
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
14,
2,
2,
13,
13,
13,
0,
13,
17,
14,
2,
2,
13,
13,
13,
0,
13,
17,
14,
2,
2,
13,
13,
13,
0,
13,
17,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13
] |
[
[
59,
2
],
[
59,
11
],
[
59,
12
],
[
56,
14
],
[
51,
19
],
[
60,
20
],
[
54,
21
],
[
62,
23
],
[
51,
28
],
[
54,
29
],
[
60,
30
],
[
65,
32
],
[
60,
37
],
[
54,
38
],
[
51,
39
],
[
68,
41
],
[
71,
44
],
[
72,
48
],
[
69,
48
],
[
66,
48
],
[
63,
48
],
[
57,
48
],
[
59,
51
],
[
59,
54
],
[
56,
57
],
[
59,
60
],
[
62,
63
],
[
65,
66
],
[
68,
69
],
[
71,
72
]
] |
[
"# 競プロ幼稚園に通う 2人の子供がキャンディーの取り合いをしています。\n# 3個のキャンディーパックがあり、\n# それぞれのパックにはキャンディーが a, b, c個入っています。\n# えび先生はこの 3個のパックを、\n# キャンディーの個数が等しくなるように 2人に分けようとしています。\n# そのような分け方が可能かどうかを判定してください。\n# ただし、キャンディーをパックから取り出すことはできず、\n# それぞれのパックをそのままどちらかの子供にあげる必要があります。\n\n# 制約\n# 1 ≦ a, b, c ≦ 100\n\n# 標準入力から、a, b, c の値を取得する\na, b, c = map(int,input().split())\n\nresult = \"ret\"\nif (a + b) == c:\n result = \"Yes\"\nelif (a + c) == b:\n result = \"Yes\"\nelif (b + c) == a:\n result = \"Yes\"\nelse:\n result = \"No\"\n\nprint(result)",
"a, b, c = map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"c",
"result = \"ret\"",
"result",
"\"ret\"",
"if (a + b) == c:\n result = \"Yes\"\nelif (a + c) == b:\n result = \"Yes\"\nelif (b + c) == a:\n result = \"Yes\"\nelse:\n result = \"No\"",
"(a + b) == c",
"a + b",
"a",
"b",
"c",
"result = \"Yes\"",
"result",
"\"Yes\"",
"elif (a + c) == b:\n result = \"Yes\"",
"(a + c) == b",
"a + c",
"a",
"c",
"b",
"result = \"Yes\"",
"result",
"\"Yes\"",
"elif (b + c) == a:\n result = \"Yes\"",
"(b + c) == a",
"b + c",
"b",
"c",
"a",
"result = \"Yes\"",
"result",
"\"Yes\"",
"result = \"No\"",
"result",
"\"No\"",
"print(result)",
"print",
"result",
"a, b, c = map(int,input().split())",
"map(int,input().split())",
"a",
"c = map(int,input().split())",
"map(int,input().split())",
"c",
"result = \"ret\"",
"\"ret\"",
"result",
"b, c = map(int,input().split())",
"map(int,input().split())",
"b",
"result = \"Yes\"",
"\"Yes\"",
"result",
"result = \"Yes\"",
"\"Yes\"",
"result",
"result = \"Yes\"",
"\"Yes\"",
"result",
"result = \"No\"",
"\"No\"",
"result"
] |
# 競プロ幼稚園に通う 2人の子供がキャンディーの取り合いをしています。
# 3個のキャンディーパックがあり、
# それぞれのパックにはキャンディーが a, b, c個入っています。
# えび先生はこの 3個のパックを、
# キャンディーの個数が等しくなるように 2人に分けようとしています。
# そのような分け方が可能かどうかを判定してください。
# ただし、キャンディーをパックから取り出すことはできず、
# それぞれのパックをそのままどちらかの子供にあげる必要があります。
# 制約
# 1 ≦ a, b, c ≦ 100
# 標準入力から、a, b, c の値を取得する
a, b, c = map(int,input().split())
result = "ret"
if (a + b) == c:
result = "Yes"
elif (a + c) == b:
result = "Yes"
elif (b + c) == a:
result = "Yes"
else:
result = "No"
print(result)
|
[
7,
15,
12,
13,
0,
13,
18,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
13,
13,
13,
4,
18,
13,
13,
0,
13,
17,
14,
2,
18,
13,
17,
2,
18,
13,
17,
18,
13,
17,
4,
13,
17,
4,
13,
17,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
6,
5
],
[
11,
10
],
[
5,
17
],
[
11,
19
],
[
11,
20
],
[
23,
22
],
[
22,
29
],
[
33,
32
],
[
22,
37
],
[
22,
41
],
[
22,
44
],
[
60,
57
]
] |
[
"from sys import stdin\ndef main():\n #入力\n readline=stdin.readline\n a,b,c=map(int,readline().split())\n\n li=[a,b,c]\n li.sort(reverse=True)\n if li[0]==li[1]+li[2]:\n print(\"Yes\")\n else:\n print(\"No\")\nif __name__==\"__main__\":\n main()",
"from sys import stdin",
"def main():\n #入力\n readline=stdin.readline\n a,b,c=map(int,readline().split())\n\n li=[a,b,c]\n li.sort(reverse=True)\n if li[0]==li[1]+li[2]:\n print(\"Yes\")\n else:\n print(\"No\")",
"main",
"readline=stdin.readline",
"readline",
"stdin.readline",
"stdin",
"readline",
"a,b,c=map(int,readline().split())",
"a",
"map(int,readline().split())",
"map",
"int",
"readline().split()",
"().split",
"()",
"readline",
"split",
"b",
"c",
"li=[a,b,c]",
"li",
"[a,b,c]",
"a",
"b",
"c",
"li.sort(reverse=True)",
"li.sort",
"li",
"sort",
"reverse=True",
"reverse",
"True",
"if li[0]==li[1]+li[2]:\n print(\"Yes\")\n else:\n print(\"No\")",
"li[0]==li[1]+li[2]",
"li[0]",
"li",
"0",
"li[1]+li[2]",
"li[1]",
"li",
"1",
"li[2]",
"li",
"2",
"print(\"Yes\")",
"print",
"\"Yes\"",
"print(\"No\")",
"print",
"\"No\"",
"if __name__==\"__main__\":\n main()",
"__name__==\"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n #入力\n readline=stdin.readline\n a,b,c=map(int,readline().split())\n\n li=[a,b,c]\n li.sort(reverse=True)\n if li[0]==li[1]+li[2]:\n print(\"Yes\")\n else:\n print(\"No\")",
"def main():\n #入力\n readline=stdin.readline\n a,b,c=map(int,readline().split())\n\n li=[a,b,c]\n li.sort(reverse=True)\n if li[0]==li[1]+li[2]:\n print(\"Yes\")\n else:\n print(\"No\")",
"main"
] |
from sys import stdin
def main():
#入力
readline=stdin.readline
a,b,c=map(int,readline().split())
li=[a,b,c]
li.sort(reverse=True)
if li[0]==li[1]+li[2]:
print("Yes")
else:
print("No")
if __name__=="__main__":
main()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
2,
2,
13,
13,
13,
2,
4,
13,
13,
13,
13,
17,
4,
13,
17,
4,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
40,
2
],
[
40,
11
],
[
40,
12
],
[
35,
17
],
[
38,
18
],
[
41,
19
],
[
35,
23
],
[
38,
24
],
[
41,
25
],
[
40,
35
],
[
40,
38
],
[
40,
41
]
] |
[
"a, b, c = map(int, input().split())\n\nif a + b + c == max(a, b, c) * 2:\n print('Yes')\nelse:\n print('No')",
"a, b, c = map(int, input().split())",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"c",
"if a + b + c == max(a, b, c) * 2:\n print('Yes')\nelse:\n print('No')",
"a + b + c == max(a, b, c) * 2",
"a + b + c",
"a + b",
"a",
"b",
"c",
"max(a, b, c) * 2",
"max(a, b, c)",
"max",
"a",
"b",
"c",
"2",
"print('Yes')",
"print",
"'Yes'",
"print('No')",
"print",
"'No'",
"a, b, c = map(int, input().split())",
"map(int, input().split())",
"a",
"b, c = map(int, input().split())",
"map(int, input().split())",
"b",
"c = map(int, input().split())",
"map(int, input().split())",
"c"
] |
a, b, c = map(int, input().split())
if a + b + c == max(a, b, c) * 2:
print('Yes')
else:
print('No')
|
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
8,
2,
2,
4,
13,
13,
17,
13,
4,
13,
17,
4,
13,
17,
10,
4,
13
] |
[
[
28,
2
],
[
29,
18
],
[
29,
20
],
[
28,
29
]
] |
[
"l = list(map(int, input().split()))\n\nprint('Yes') if sum(l) / 2 in l else print('No')",
"l = list(map(int, input().split()))",
"l",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"print('Yes') if sum(l) / 2 in l else print('No')",
"sum(l) / 2 in l",
"sum(l) / 2",
"sum(l)",
"sum",
"l",
"2",
"l",
"print('Yes')",
"print",
"'Yes'",
"print('No')",
"print",
"'No'",
"l = list(map(int, input().split()))",
"list(map(int, input().split()))",
"l"
] |
l = list(map(int, input().split()))
print('Yes') if sum(l) / 2 in l else print('No')
|
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
4,
13,
8,
2,
2,
18,
13,
17,
18,
13,
17,
18,
13,
17,
17,
17,
10,
4,
13,
10,
4,
13
] |
[
[
35,
2
],
[
38,
14
],
[
36,
17
],
[
39,
24
],
[
39,
27
],
[
39,
30
],
[
35,
36
],
[
38,
39
]
] |
[
"s = list(map(int, input().split()))\ns_sort = sorted(s)\nprint('Yes' if s_sort[0]+s_sort[1] == s_sort[2] else 'No')",
"s = list(map(int, input().split()))",
"s",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"s_sort = sorted(s)",
"s_sort",
"sorted(s)",
"sorted",
"s",
"print('Yes' if s_sort[0]+s_sort[1] == s_sort[2] else 'No')",
"print",
"'Yes' if s_sort[0]+s_sort[1] == s_sort[2] else 'No'",
"s_sort[0]+s_sort[1] == s_sort[2]",
"s_sort[0]+s_sort[1]",
"s_sort[0]",
"s_sort",
"0",
"s_sort[1]",
"s_sort",
"1",
"s_sort[2]",
"s_sort",
"2",
"'Yes'",
"'No'",
"s = list(map(int, input().split()))",
"list(map(int, input().split()))",
"s",
"s_sort = sorted(s)",
"sorted(s)",
"s_sort"
] |
s = list(map(int, input().split()))
s_sort = sorted(s)
print('Yes' if s_sort[0]+s_sort[1] == s_sort[2] else 'No')
|
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
2,
2,
2,
13,
13,
13,
2,
2,
13,
13,
13,
2,
2,
13,
13,
13,
4,
13,
17,
4,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
46,
2
],
[
46,
13
],
[
46,
14
],
[
44,
20
],
[
41,
21
],
[
47,
22
],
[
44,
25
],
[
47,
26
],
[
41,
27
],
[
41,
30
],
[
47,
31
],
[
44,
32
],
[
46,
41
],
[
46,
44
],
[
46,
47
]
] |
[
"A,B,C = list(map(int,input().split()))\nif A+B==C or A+C==B or B+C==A:\n print(\"Yes\")\nelse:\n print(\"No\")",
"A,B,C = list(map(int,input().split()))",
"A",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"B",
"C",
"if A+B==C or A+C==B or B+C==A:\n print(\"Yes\")\nelse:\n print(\"No\")",
"A+B==C or A+C==B or B+C==A",
"A+B==C or A+C==B",
"A+B==C",
"A+B",
"A",
"B",
"C",
"A+C==B",
"A+C",
"A",
"C",
"B",
"B+C==A",
"B+C",
"B",
"C",
"A",
"print(\"Yes\")",
"print",
"\"Yes\"",
"print(\"No\")",
"print",
"\"No\"",
"B,C = list(map(int,input().split()))",
"list(map(int,input().split()))",
"B",
"A,B,C = list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"C = list(map(int,input().split()))",
"list(map(int,input().split()))",
"C"
] |
A,B,C = list(map(int,input().split()))
if A+B==C or A+C==B or B+C==A:
print("Yes")
else:
print("No")
|
[
7,
12,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
4,
18,
13,
13,
14,
2,
18,
13,
17,
2,
18,
13,
17,
18,
13,
17,
4,
13,
17,
4,
13,
17,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
4,
17
],
[
4,
22
],
[
4,
26
],
[
4,
29
],
[
45,
42
]
] |
[
"# -*- coding: utf-8 -*-\n\ndef main():\n\n lists = list(map(int, input().split()))\n\n lists.sort()\n\n if lists[2] == lists[1] + lists[0]:\n print('Yes')\n\n else:\n print('No')\n\n\nif __name__ == \"__main__\":\n main()",
"def main():\n\n lists = list(map(int, input().split()))\n\n lists.sort()\n\n if lists[2] == lists[1] + lists[0]:\n print('Yes')\n\n else:\n print('No')",
"main",
"lists = list(map(int, input().split()))",
"lists",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"lists.sort()",
"lists.sort",
"lists",
"sort",
"if lists[2] == lists[1] + lists[0]:\n print('Yes')\n\n else:\n print('No')",
"lists[2] == lists[1] + lists[0]",
"lists[2]",
"lists",
"2",
"lists[1] + lists[0]",
"lists[1]",
"lists",
"1",
"lists[0]",
"lists",
"0",
"print('Yes')",
"print",
"'Yes'",
"print('No')",
"print",
"'No'",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n\n lists = list(map(int, input().split()))\n\n lists.sort()\n\n if lists[2] == lists[1] + lists[0]:\n print('Yes')\n\n else:\n print('No')",
"def main():\n\n lists = list(map(int, input().split()))\n\n lists.sort()\n\n if lists[2] == lists[1] + lists[0]:\n print('Yes')\n\n else:\n print('No')",
"main"
] |
# -*- coding: utf-8 -*-
def main():
lists = list(map(int, input().split()))
lists.sort()
if lists[2] == lists[1] + lists[0]:
print('Yes')
else:
print('No')
if __name__ == "__main__":
main()
|
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
2,
2,
13,
13,
13,
17,
14,
2,
2,
2,
13,
13,
2,
13,
13,
2,
13,
13,
4,
13,
17,
4,
13,
17,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] |
[
[
52,
2
],
[
52,
13
],
[
52,
14
],
[
46,
16
],
[
44,
20
],
[
50,
21
],
[
53,
22
],
[
47,
28
],
[
44,
29
],
[
47,
31
],
[
50,
32
],
[
47,
34
],
[
53,
35
],
[
52,
44
],
[
46,
47
],
[
52,
50
],
[
52,
53
]
] |
[
"a, b, c = list(map(int, input().split()))\ns = (a + b + c) / 2\nif s == a or s == b or s == c:\n print('Yes')\nelse:\n print('No')",
"a, b, c = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"c",
"s = (a + b + c) / 2",
"s",
"(a + b + c) / 2",
"a + b + c",
"a + b",
"a",
"b",
"c",
"2",
"if s == a or s == b or s == c:\n print('Yes')\nelse:\n print('No')",
"s == a or s == b or s == c",
"s == a or s == b",
"s == a",
"s",
"a",
"s == b",
"s",
"b",
"s == c",
"s",
"c",
"print('Yes')",
"print",
"'Yes'",
"print('No')",
"print",
"'No'",
"a, b, c = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"s = (a + b + c) / 2",
"(a + b + c) / 2",
"s",
"b, c = list(map(int, input().split()))",
"list(map(int, input().split()))",
"b",
"c = list(map(int, input().split()))",
"list(map(int, input().split()))",
"c"
] |
a, b, c = list(map(int, input().split()))
s = (a + b + c) / 2
if s == a or s == b or s == c:
print('Yes')
else:
print('No')
|
[
7,
0,
13,
4,
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,
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,
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,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
39,
13
] |
[
[
136,
2
],
[
136,
13
],
[
136,
14
],
[
142,
16
],
[
145,
21
],
[
27,
26
],
[
125,
29
],
[
139,
31
],
[
139,
42
],
[
139,
43
],
[
128,
46
],
[
52,
49
],
[
143,
50
],
[
143,
55
],
[
131,
57
],
[
128,
60
],
[
66,
63
],
[
143,
64
],
[
143,
69
],
[
131,
71
],
[
128,
74
],
[
80,
77
],
[
146,
78
],
[
146,
83
],
[
140,
85
],
[
128,
88
],
[
94,
91
],
[
146,
92
],
[
146,
97
],
[
140,
99
],
[
143,
108
],
[
143,
111
],
[
146,
118
],
[
146,
121
],
[
136,
125
],
[
139,
128
],
[
139,
131
],
[
136,
134
],
[
136,
137
],
[
139,
140
],
[
142,
143
],
[
145,
146
]
] |
[
"W,H,N = list(map(int,input().split()))\n\nX = [0,W]\nY = [0,H]\n\nfor n in range(N):\n x,y,a = list(map(int,input().split()))\n if a == 1:\n X[0] = max(X[0],x)\n elif a == 2:\n X[1] = min(X[1],x)\n elif a == 3:\n Y[0] = max(Y[0],y)\n elif a == 4:\n Y[1] = min(Y[1],y)\n \n# print((X[1]-X[0])*(Y[1]-Y[0]))\nprint(max(0,X[1]-X[0])*max(0,Y[1]-Y[0]))",
"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",
"X = [0,W]",
"X",
"[0,W]",
"0",
"W",
"Y = [0,H]",
"Y",
"[0,H]",
"0",
"H",
"for n in range(N):\n x,y,a = list(map(int,input().split()))\n if a == 1:\n X[0] = max(X[0],x)\n elif a == 2:\n X[1] = min(X[1],x)\n elif a == 3:\n Y[0] = max(Y[0],y)\n elif a == 4:\n Y[1] = min(Y[1],y)\n \n# print((X[1]-X[0])*(Y[1]-Y[0]))",
"n",
"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 X[0] = max(X[0],x)\n elif a == 2:\n X[1] = min(X[1],x)\n elif a == 3:\n Y[0] = max(Y[0],y)\n elif a == 4:\n Y[1] = min(Y[1],y)\n \n# print((X[1]-X[0])*(Y[1]-Y[0]))",
"a == 1",
"a",
"1",
"X[0] = max(X[0],x)",
"X[0]",
"X",
"0",
"max(X[0],x)",
"max",
"X[0]",
"X",
"0",
"x",
"elif a == 2:\n X[1] = min(X[1],x)\n ",
"a == 2",
"a",
"2",
"X[1] = min(X[1],x)",
"X[1]",
"X",
"1",
"min(X[1],x)",
"min",
"X[1]",
"X",
"1",
"x",
"elif a == 3:\n Y[0] = max(Y[0],y)\n ",
"a == 3",
"a",
"3",
"Y[0] = max(Y[0],y)",
"Y[0]",
"Y",
"0",
"max(Y[0],y)",
"max",
"Y[0]",
"Y",
"0",
"y",
"elif a == 4:\n Y[1] = min(Y[1],y)\n \n# print((X[1]-X[0])*(Y[1]-Y[0]))",
"a == 4",
"a",
"4",
"Y[1] = min(Y[1],y)",
"Y[1]",
"Y",
"1",
"min(Y[1],y)",
"min",
"Y[1]",
"Y",
"1",
"y",
"print(max(0,X[1]-X[0])*max(0,Y[1]-Y[0]))",
"print",
"max(0,X[1]-X[0])*max(0,Y[1]-Y[0])",
"max(0,X[1]-X[0])",
"max",
"0",
"X[1]-X[0]",
"X[1]",
"X",
"1",
"X[0]",
"X",
"0",
"max(0,Y[1]-Y[0])",
"max",
"0",
"Y[1]-Y[0]",
"Y[1]",
"Y",
"1",
"Y[0]",
"Y",
"0",
"N = list(map(int,input().split()))",
"list(map(int,input().split()))",
"N",
"a = list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"x,y,a = list(map(int,input().split()))",
"list(map(int,input().split()))",
"x",
"W,H,N = list(map(int,input().split()))",
"list(map(int,input().split()))",
"W",
"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",
"X = [0,W]",
"[0,W]",
"X",
"Y = [0,H]",
"[0,H]",
"Y"
] |
W,H,N = list(map(int,input().split()))
X = [0,W]
Y = [0,H]
for n in range(N):
x,y,a = list(map(int,input().split()))
if a == 1:
X[0] = max(X[0],x)
elif a == 2:
X[1] = min(X[1],x)
elif a == 3:
Y[0] = max(Y[0],y)
elif a == 4:
Y[1] = min(Y[1],y)
# print((X[1]-X[0])*(Y[1]-Y[0]))
print(max(0,X[1]-X[0])*max(0,Y[1]-Y[0]))
|
[
7,
0,
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,
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,
14,
2,
2,
13,
13,
2,
13,
13,
4,
13,
2,
2,
13,
13,
2,
13,
13,
4,
13,
17,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
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,
4,
13,
10,
4,
13
] |
[
[
126,
2
],
[
126,
11
],
[
126,
12
],
[
120,
14
],
[
105,
17
],
[
114,
20
],
[
100,
21
],
[
102,
23
],
[
109,
24
],
[
27,
26
],
[
127,
29
],
[
138,
31
],
[
138,
40
],
[
138,
41
],
[
130,
44
],
[
135,
47
],
[
121,
50
],
[
136,
50
],
[
139,
51
],
[
130,
54
],
[
123,
57
],
[
115,
60
],
[
124,
60
],
[
139,
61
],
[
130,
64
],
[
111,
67
],
[
106,
70
],
[
112,
70
],
[
118,
71
],
[
132,
73
],
[
103,
76
],
[
133,
76
],
[
118,
77
],
[
124,
81
],
[
115,
81
],
[
136,
82
],
[
121,
82
],
[
133,
84
],
[
103,
84
],
[
112,
85
],
[
106,
85
],
[
124,
90
],
[
115,
90
],
[
136,
91
],
[
121,
91
],
[
133,
93
],
[
103,
93
],
[
112,
94
],
[
106,
94
],
[
126,
100
],
[
109,
102
],
[
102,
103
],
[
105,
106
],
[
126,
109
],
[
111,
112
],
[
100,
114
],
[
114,
115
],
[
138,
118
],
[
120,
121
],
[
123,
124
],
[
126,
127
],
[
138,
130
],
[
132,
133
],
[
135,
136
],
[
138,
139
]
] |
[
"W, H, N = map(int, input().split())\n\nmax_x = 0\nmax_y = 0\nmin_x = W\nmin_y = H\nfor i in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n max_x = max(max_x, x)\n elif a == 2:\n min_x = min(min_x, x)\n elif a == 3:\n max_y = max(max_y, y)\n else:\n min_y = min(min_y, y)\n\n# print(max_x, max_y)\n# print(min_x, min_y)\nif(min_x > max_x) and (min_y > max_y):\n print((min_x - max_x) * (min_y - max_y))\nelse:\n print(0)",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"max_x = 0",
"max_x",
"0",
"max_y = 0",
"max_y",
"0",
"min_x = W",
"min_x",
"W",
"min_y = H",
"min_y",
"H",
"for i in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n max_x = max(max_x, x)\n elif a == 2:\n min_x = min(min_x, x)\n elif a == 3:\n max_y = max(max_y, y)\n else:\n min_y = min(min_y, y)\n\n# print(max_x, max_y)\n# print(min_x, min_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 max_x = max(max_x, x)\n elif a == 2:\n min_x = min(min_x, x)\n elif a == 3:\n max_y = max(max_y, y)\n else:\n min_y = min(min_y, y)\n\n# print(max_x, max_y)\n# print(min_x, min_y)",
"a == 1",
"a",
"1",
"max_x = max(max_x, x)",
"max_x",
"max(max_x, x)",
"max",
"max_x",
"x",
"elif a == 2:\n min_x = min(min_x, x)\n ",
"a == 2",
"a",
"2",
"min_x = min(min_x, x)",
"min_x",
"min(min_x, x)",
"min",
"min_x",
"x",
"elif a == 3:\n max_y = max(max_y, y)\n ",
"a == 3",
"a",
"3",
"max_y = max(max_y, y)",
"max_y",
"max(max_y, y)",
"max",
"max_y",
"y",
"min_y = min(min_y, y)",
"min_y",
"min(min_y, y)",
"min",
"min_y",
"y",
"if(min_x > max_x) and (min_y > max_y):\n print((min_x - max_x) * (min_y - max_y))\nelse:\n print(0)",
"(min_x > max_x) and (min_y > max_y)",
"min_x > max_x",
"min_x",
"max_x",
"min_y > max_y",
"min_y",
"max_y",
"print((min_x - max_x) * (min_y - max_y))",
"print",
"(min_x - max_x) * (min_y - max_y)",
"min_x - max_x",
"min_x",
"max_x",
"min_y - max_y",
"min_y",
"max_y",
"print(0)",
"print",
"0",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"min_y = H",
"H",
"min_y",
"max_y = 0",
"0",
"max_y",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"max_y = max(max_y, y)",
"max(max_y, y)",
"max_y",
"min_x = W",
"W",
"min_x",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"max_x = 0",
"0",
"max_x",
"min_x = min(min_x, x)",
"min(min_x, x)",
"min_x",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"min_y = min(min_y, y)",
"min(min_y, y)",
"min_y",
"max_x = max(max_x, x)",
"max(max_x, x)",
"max_x",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x"
] |
W, H, N = map(int, input().split())
max_x = 0
max_y = 0
min_x = W
min_y = H
for i in range(N):
x, y, a = map(int, input().split())
if a == 1:
max_x = max(max_x, x)
elif a == 2:
min_x = min(min_x, x)
elif a == 3:
max_y = max(max_y, y)
else:
min_y = min(min_y, y)
# print(max_x, max_y)
# print(min_x, min_y)
if(min_x > max_x) and (min_y > max_y):
print((min_x - max_x) * (min_y - max_y))
else:
print(0)
|
[
7,
6,
13,
12,
13,
0,
18,
13,
13,
13,
0,
18,
13,
13,
13,
41,
28,
13,
4,
13,
2,
18,
13,
13,
17,
4,
17,
0,
18,
13,
13,
13,
41,
28,
13,
4,
13,
2,
18,
13,
13,
17,
4,
17,
0,
18,
13,
13,
13,
28,
13,
4,
13,
17,
2,
18,
13,
13,
17,
0,
18,
18,
13,
13,
13,
2,
2,
18,
18,
13,
13,
2,
13,
17,
13,
18,
13,
13,
0,
18,
18,
13,
13,
13,
2,
2,
18,
18,
13,
13,
2,
13,
17,
4,
13,
13,
17,
18,
13,
13,
18,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
29,
2,
2,
18,
18,
13,
13,
13,
2,
2,
18,
18,
13,
13,
2,
13,
13,
18,
18,
13,
13,
13,
18,
13,
13,
18,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
29,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
0,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
13,
28,
13,
4,
13,
13,
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,
13,
17,
0,
13,
4,
13,
13,
13,
4,
13,
2,
4,
13,
2,
13,
13,
17,
4,
13,
17,
2,
13,
13,
10,
13,
13,
10,
12,
13,
10,
4,
13,
10,
6,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13
] |
[
[
9,
6
],
[
104,
7
],
[
106,
8
],
[
106,
9
],
[
14,
11
],
[
104,
12
],
[
108,
13
],
[
108,
14
],
[
18,
17
],
[
6,
21
],
[
104,
22
],
[
106,
23
],
[
31,
28
],
[
104,
29
],
[
35,
34
],
[
6,
38
],
[
104,
39
],
[
106,
40
],
[
48,
45
],
[
104,
46
],
[
51,
50
],
[
6,
55
],
[
104,
56
],
[
106,
57
],
[
65,
60
],
[
28,
61
],
[
104,
62
],
[
50,
64
],
[
28,
68
],
[
104,
69
],
[
50,
72
],
[
50,
74
],
[
11,
75
],
[
104,
76
],
[
108,
77
],
[
84,
79
],
[
45,
80
],
[
104,
81
],
[
50,
83
],
[
45,
87
],
[
104,
88
],
[
50,
91
],
[
50,
95
],
[
11,
97
],
[
104,
98
],
[
108,
99
],
[
11,
100
],
[
104,
101
],
[
108,
102
],
[
104,
104
],
[
106,
106
],
[
108,
108
],
[
140,
116
],
[
142,
118
],
[
140,
123
],
[
142,
126
],
[
144,
127
],
[
140,
130
],
[
144,
132
],
[
140,
134
],
[
140,
137
],
[
140,
140
],
[
142,
142
],
[
144,
144
],
[
283,
163
],
[
251,
165
],
[
283,
166
],
[
283,
167
],
[
289,
169
],
[
284,
170
],
[
265,
172
],
[
277,
175
],
[
247,
178
],
[
275,
179
],
[
182,
181
],
[
263,
184
],
[
271,
186
],
[
251,
188
],
[
271,
189
],
[
271,
190
],
[
272,
193
],
[
280,
196
],
[
266,
199
],
[
281,
199
],
[
260,
200
],
[
272,
203
],
[
253,
206
],
[
290,
209
],
[
254,
209
],
[
260,
210
],
[
272,
213
],
[
292,
216
],
[
278,
219
],
[
293,
219
],
[
269,
220
],
[
272,
223
],
[
286,
226
],
[
248,
229
],
[
287,
229
],
[
269,
230
],
[
254,
237
],
[
290,
237
],
[
281,
238
],
[
266,
238
],
[
287,
244
],
[
248,
244
],
[
293,
245
],
[
278,
245
],
[
275,
247
],
[
247,
248
],
[
253,
254
],
[
271,
260
],
[
283,
263
],
[
265,
266
],
[
271,
269
],
[
271,
272
],
[
283,
275
],
[
277,
278
],
[
280,
281
],
[
283,
284
],
[
286,
287
],
[
284,
289
],
[
289,
290
],
[
292,
293
]
] |
[
"class Combination:\n def __init__(self, n, mod):\n self.n = n\n self.mod = mod\n self.fac = [1 for i in range(self.n + 1)]\n self.finv = [1 for i in range(self.n + 1)]\n for i in range(2, self.n+1):\n self.fac[i] = (self.fac[i - 1] * i) % self.mod\n self.finv[i] = (self.finv[i - 1] * pow(i, -1, self.mod)) % self.mod\n\n def comb(self, n, m):\n return self.fac[n] * (self.finv[n - m] * self.finv[m] % self.mod) % self.mod\n \ndef iparse():\n return list(map(int, input().split()))\n\n\nif __name__ == \"__main__\":\n w, h, n = iparse()\n xmax = w\n xmin = 0\n ymin = 0\n ymax = h\n for i in range(n):\n x, y, a = iparse()\n \n if a == 1:\n xmin = max(xmin,x)\n if a == 2:\n xmax = min(xmax,x)\n if a == 3:\n ymin = max(ymin,y)\n if a == 4:\n ymax = min(ymax,y)\n \n print((max(xmax-xmin,0)*(max(0,ymax-ymin))))",
"class Combination:\n def __init__(self, n, mod):\n self.n = n\n self.mod = mod\n self.fac = [1 for i in range(self.n + 1)]\n self.finv = [1 for i in range(self.n + 1)]\n for i in range(2, self.n+1):\n self.fac[i] = (self.fac[i - 1] * i) % self.mod\n self.finv[i] = (self.finv[i - 1] * pow(i, -1, self.mod)) % self.mod\n\n def comb(self, n, m):\n return self.fac[n] * (self.finv[n - m] * self.finv[m] % self.mod) % self.mod\n ",
"Combination",
"def __init__(self, n, mod):\n self.n = n\n self.mod = mod\n self.fac = [1 for i in range(self.n + 1)]\n self.finv = [1 for i in range(self.n + 1)]\n for i in range(2, self.n+1):\n self.fac[i] = (self.fac[i - 1] * i) % self.mod\n self.finv[i] = (self.finv[i - 1] * pow(i, -1, self.mod)) % self.mod\n\n ",
"__init__",
"self.n = n",
"self.n",
"self",
"n",
"n",
"self.mod = mod",
"self.mod",
"self",
"mod",
"mod",
"1 for i in range(self.n + 1)",
"for i in range(self.n + 1)",
"i",
"range(self.n + 1)",
"range",
"self.n + 1",
"self.n",
"self",
"n",
"1",
"for i in range(self.n + 1)",
"1",
"self.fac = [1 for i in range(self.n + 1)]",
"self.fac",
"self",
"fac",
"[1 for i in range(self.n + 1)]",
"1 for i in range(self.n + 1)",
"for i in range(self.n + 1)",
"i",
"range(self.n + 1)",
"range",
"self.n + 1",
"self.n",
"self",
"n",
"1",
"for i in range(self.n + 1)",
"1",
"self.finv = [1 for i in range(self.n + 1)]",
"self.finv",
"self",
"finv",
"[1 for i in range(self.n + 1)]",
"for i in range(2, self.n+1):\n self.fac[i] = (self.fac[i - 1] * i) % self.mod\n self.finv[i] = (self.finv[i - 1] * pow(i, -1, self.mod)) % self.mod\n\n ",
"i",
"range(2, self.n+1)",
"range",
"2",
"self.n+1",
"self.n",
"self",
"n",
"1",
"self.fac[i] = (self.fac[i - 1] * i) % self.mod",
"self.fac[i]",
"self.fac",
"self",
"fac",
"i",
"(self.fac[i - 1] * i) % self.mod",
"self.fac[i - 1] * i",
"self.fac[i - 1]",
"self.fac",
"self",
"fac",
"i - 1",
"i",
"1",
"i",
"self.mod",
"self",
"mod",
"self.finv[i] = (self.finv[i - 1] * pow(i, -1, self.mod)) % self.mod",
"self.finv[i]",
"self.finv",
"self",
"finv",
"i",
"(self.finv[i - 1] * pow(i, -1, self.mod)) % self.mod",
"self.finv[i - 1] * pow(i, -1, self.mod)",
"self.finv[i - 1]",
"self.finv",
"self",
"finv",
"i - 1",
"i",
"1",
"pow(i, -1, self.mod)",
"pow",
"i",
"-1",
"self.mod",
"self",
"mod",
"self.mod",
"self",
"mod",
"self",
"self",
"n",
"n",
"mod",
"mod",
"def comb(self, n, m):\n return self.fac[n] * (self.finv[n - m] * self.finv[m] % self.mod) % self.mod\n ",
"comb",
"return self.fac[n] * (self.finv[n - m] * self.finv[m] % self.mod) % self.mod",
"self.fac[n] * (self.finv[n - m] * self.finv[m] % self.mod) % self.mod",
"self.fac[n] * (self.finv[n - m] * self.finv[m] % self.mod)",
"self.fac[n]",
"self.fac",
"self",
"fac",
"n",
"self.finv[n - m] * self.finv[m] % self.mod",
"self.finv[n - m] * self.finv[m]",
"self.finv[n - m]",
"self.finv",
"self",
"finv",
"n - m",
"n",
"m",
"self.finv[m]",
"self.finv",
"self",
"finv",
"m",
"self.mod",
"self",
"mod",
"self.mod",
"self",
"mod",
"self",
"self",
"n",
"n",
"m",
"m",
"def iparse():\n return list(map(int, input().split()))",
"iparse",
"return list(map(int, input().split()))",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"if __name__ == \"__main__\":\n w, h, n = iparse()\n xmax = w\n xmin = 0\n ymin = 0\n ymax = h\n for i in range(n):\n x, y, a = iparse()\n \n if a == 1:\n xmin = max(xmin,x)\n if a == 2:\n xmax = min(xmax,x)\n if a == 3:\n ymin = max(ymin,y)\n if a == 4:\n ymax = min(ymax,y)\n \n print((max(xmax-xmin,0)*(max(0,ymax-ymin))))",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"w, h, n = iparse()",
"w",
"iparse()",
"iparse",
"h",
"n",
"xmax = w",
"xmax",
"w",
"xmin = 0",
"xmin",
"0",
"ymin = 0",
"ymin",
"0",
"ymax = h",
"ymax",
"h",
"for i in range(n):\n x, y, a = iparse()\n \n if a == 1:\n xmin = max(xmin,x)\n if a == 2:\n xmax = min(xmax,x)\n if a == 3:\n ymin = max(ymin,y)\n if a == 4:\n ymax = min(ymax,y)\n \n ",
"i",
"range(n)",
"range",
"n",
"x, y, a = iparse()",
"x",
"iparse()",
"iparse",
"y",
"a",
"if a == 1:\n xmin = max(xmin,x)\n ",
"a == 1",
"a",
"1",
"xmin = max(xmin,x)",
"xmin",
"max(xmin,x)",
"max",
"xmin",
"x",
"if a == 2:\n xmax = min(xmax,x)\n ",
"a == 2",
"a",
"2",
"xmax = min(xmax,x)",
"xmax",
"min(xmax,x)",
"min",
"xmax",
"x",
"if a == 3:\n ymin = max(ymin,y)\n ",
"a == 3",
"a",
"3",
"ymin = max(ymin,y)",
"ymin",
"max(ymin,y)",
"max",
"ymin",
"y",
"if a == 4:\n ymax = min(ymax,y)\n \n ",
"a == 4",
"a",
"4",
"ymax = min(ymax,y)",
"ymax",
"min(ymax,y)",
"min",
"ymax",
"y",
"print((max(xmax-xmin,0)*(max(0,ymax-ymin))))",
"print",
"max(xmax-xmin,0)*(max(0,ymax-ymin))",
"max(xmax-xmin,0)",
"max",
"xmax-xmin",
"xmax",
"xmin",
"0",
"max(0,ymax-ymin)",
"max",
"0",
"ymax-ymin",
"ymax",
"ymin",
"ymax = h",
"h",
"ymax",
"def iparse():\n return list(map(int, input().split()))",
"def iparse():\n return list(map(int, input().split()))",
"iparse",
"xmax = min(xmax,x)",
"min(xmax,x)",
"xmax",
"class Combination:\n def __init__(self, n, mod):\n self.n = n\n self.mod = mod\n self.fac = [1 for i in range(self.n + 1)]\n self.finv = [1 for i in range(self.n + 1)]\n for i in range(2, self.n+1):\n self.fac[i] = (self.fac[i - 1] * i) % self.mod\n self.finv[i] = (self.finv[i - 1] * pow(i, -1, self.mod)) % self.mod\n\n def comb(self, n, m):\n return self.fac[n] * (self.finv[n - m] * self.finv[m] % self.mod) % self.mod\n ",
"class Combination:\n def __init__(self, n, mod):\n self.n = n\n self.mod = mod\n self.fac = [1 for i in range(self.n + 1)]\n self.finv = [1 for i in range(self.n + 1)]\n for i in range(2, self.n+1):\n self.fac[i] = (self.fac[i - 1] * i) % self.mod\n self.finv[i] = (self.finv[i - 1] * pow(i, -1, self.mod)) % self.mod\n\n def comb(self, n, m):\n return self.fac[n] * (self.finv[n - m] * self.finv[m] % self.mod) % self.mod\n ",
"Combination",
"x, y, a = iparse()",
"iparse()",
"x",
"n = iparse()",
"iparse()",
"n",
"xmin = 0",
"0",
"xmin",
"y, a = iparse()",
"iparse()",
"y",
"a = iparse()",
"iparse()",
"a",
"h, n = iparse()",
"iparse()",
"h",
"ymin = 0",
"0",
"ymin",
"xmin = max(xmin,x)",
"max(xmin,x)",
"xmin",
"w, h, n = iparse()",
"iparse()",
"w",
"ymax = min(ymax,y)",
"min(ymax,y)",
"ymax",
"xmax = w",
"w",
"xmax",
"ymin = max(ymin,y)",
"max(ymin,y)",
"ymin"
] |
class Combination:
def __init__(self, n, mod):
self.n = n
self.mod = mod
self.fac = [1 for i in range(self.n + 1)]
self.finv = [1 for i in range(self.n + 1)]
for i in range(2, self.n+1):
self.fac[i] = (self.fac[i - 1] * i) % self.mod
self.finv[i] = (self.finv[i - 1] * pow(i, -1, self.mod)) % self.mod
def comb(self, n, m):
return self.fac[n] * (self.finv[n - m] * self.finv[m] % self.mod) % self.mod
def iparse():
return list(map(int, input().split()))
if __name__ == "__main__":
w, h, n = iparse()
xmax = w
xmin = 0
ymin = 0
ymax = h
for i in range(n):
x, y, a = iparse()
if a == 1:
xmin = max(xmin,x)
if a == 2:
xmax = min(xmax,x)
if a == 3:
ymin = max(ymin,y)
if a == 4:
ymax = min(ymax,y)
print((max(xmax-xmin,0)*(max(0,ymax-ymin))))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
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,
4,
13,
8,
2,
2,
13,
13,
2,
13,
13,
2,
2,
13,
13,
2,
13,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13
] |
[
[
123,
2
],
[
123,
11
],
[
123,
12
],
[
111,
14
],
[
120,
16
],
[
20,
19
],
[
124,
22
],
[
114,
24
],
[
114,
33
],
[
114,
34
],
[
91,
37
],
[
108,
40
],
[
112,
43
],
[
109,
43
],
[
115,
44
],
[
91,
47
],
[
102,
50
],
[
94,
53
],
[
103,
53
],
[
115,
54
],
[
91,
57
],
[
105,
60
],
[
121,
63
],
[
106,
63
],
[
100,
64
],
[
117,
66
],
[
97,
69
],
[
118,
69
],
[
100,
70
],
[
103,
76
],
[
94,
76
],
[
109,
77
],
[
112,
77
],
[
118,
79
],
[
97,
79
],
[
106,
80
],
[
121,
80
],
[
103,
83
],
[
94,
83
],
[
109,
84
],
[
112,
84
],
[
118,
86
],
[
97,
86
],
[
106,
87
],
[
121,
87
],
[
114,
91
],
[
123,
94
],
[
123,
97
],
[
114,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
120,
121
],
[
123,
124
]
] |
[
"w,h,n=map(int,input().split())\ni,j=0,0\nfor _ in range(n):\n x,y,a=map(int,input().split())\n if a==1:\n i=max(i,x)\n elif a==2:\n w=min(w,x)\n elif a==3:\n j=max(j,y)\n else:\n h=min(h,y)\nprint((w-i)*(h-j) if w>i and h>j else 0)",
"w,h,n=map(int,input().split())",
"w",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"i,j=0,0",
"i",
"0",
"j",
"0",
"for _ in range(n):\n x,y,a=map(int,input().split())\n if a==1:\n i=max(i,x)\n elif a==2:\n w=min(w,x)\n elif a==3:\n j=max(j,y)\n else:\n h=min(h,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 i=max(i,x)\n elif a==2:\n w=min(w,x)\n elif a==3:\n j=max(j,y)\n else:\n h=min(h,y)",
"a==1",
"a",
"1",
"i=max(i,x)",
"i",
"max(i,x)",
"max",
"i",
"x",
"elif a==2:\n w=min(w,x)\n ",
"a==2",
"a",
"2",
"w=min(w,x)",
"w",
"min(w,x)",
"min",
"w",
"x",
"elif a==3:\n j=max(j,y)\n ",
"a==3",
"a",
"3",
"j=max(j,y)",
"j",
"max(j,y)",
"max",
"j",
"y",
"h=min(h,y)",
"h",
"min(h,y)",
"min",
"h",
"y",
"print((w-i)*(h-j) if w>i and h>j else 0)",
"print",
"(w-i)*(h-j) if w>i and h>j else 0",
"w>i and h>j",
"w>i",
"w",
"i",
"h>j",
"h",
"j",
"(w-i)*(h-j)",
"w-i",
"w",
"i",
"h-j",
"h",
"j",
"0",
"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",
"y,a=map(int,input().split())",
"map(int,input().split())",
"y",
"w=min(w,x)",
"min(w,x)",
"w",
"j=max(j,y)",
"max(j,y)",
"j",
"i=max(i,x)",
"max(i,x)",
"i",
"i,j=0,0",
"0",
"i",
"x,y,a=map(int,input().split())",
"map(int,input().split())",
"x",
"h=min(h,y)",
"min(h,y)",
"h",
"j=0,0",
"0",
"j",
"n=map(int,input().split())",
"map(int,input().split())",
"n"
] |
w,h,n=map(int,input().split())
i,j=0,0
for _ in range(n):
x,y,a=map(int,input().split())
if a==1:
i=max(i,x)
elif a==2:
w=min(w,x)
elif a==3:
j=max(j,y)
else:
h=min(h,y)
print((w-i)*(h-j) if w>i and h>j else 0)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
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,
17,
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,
4,
13,
13,
28,
13,
4,
13,
13,
14,
2,
18,
18,
13,
13,
13,
17,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] |
[
[
181,
2
],
[
181,
12
],
[
181,
13
],
[
17,
16
],
[
161,
19
],
[
167,
24
],
[
163,
26
],
[
30,
29
],
[
182,
32
],
[
178,
34
],
[
178,
44
],
[
178,
45
],
[
173,
48
],
[
52,
51
],
[
170,
54
],
[
57,
56
],
[
161,
59
],
[
66,
61
],
[
164,
63
],
[
56,
64
],
[
51,
65
],
[
173,
69
],
[
73,
72
],
[
170,
75
],
[
167,
76
],
[
79,
78
],
[
161,
81
],
[
88,
83
],
[
164,
85
],
[
78,
86
],
[
72,
87
],
[
173,
91
],
[
95,
94
],
[
167,
97
],
[
100,
99
],
[
179,
102
],
[
109,
104
],
[
164,
106
],
[
99,
107
],
[
94,
108
],
[
173,
112
],
[
116,
115
],
[
167,
118
],
[
121,
120
],
[
179,
123
],
[
161,
124
],
[
131,
126
],
[
164,
128
],
[
120,
129
],
[
115,
130
],
[
175,
133
],
[
137,
136
],
[
161,
139
],
[
142,
141
],
[
167,
144
],
[
164,
149
],
[
136,
150
],
[
141,
151
],
[
184,
154
],
[
185,
158
],
[
176,
158
],
[
181,
161
],
[
163,
164
],
[
181,
167
],
[
178,
170
],
[
178,
173
],
[
175,
176
],
[
178,
179
],
[
181,
182
],
[
184,
185
]
] |
[
"w, h, n = map(int, input().split(\" \"))\narea = [[0] * w for i in range(h)]\n\nfor i in range(n):\n x, y , a = map(int, input().split(\" \"))\n if a == 1:\n for j in range(x):\n for k in range(h):\n area[k][j] = 1\n elif a == 2:\n for j in range(x, w):\n for k in range(h):\n area[k][j] = 1\n elif a == 3:\n for j in range(w):\n for k in range(y):\n area[k][j] = 1\n elif a == 4:\n for j in range(w):\n for k in range(y, h):\n area[k][j] = 1\nc = 0\nfor i in range(h):\n for j in range(w):\n if area[i][j] == 0:\n c += 1\nprint(c)",
"w, h, n = map(int, input().split(\" \"))",
"w",
"map(int, input().split(\" \"))",
"map",
"int",
"input().split(\" \")",
"().split",
"()",
"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",
"area = [[0] * w for i in range(h)]",
"area",
"[[0] * w for i in range(h)]",
"for i in range(n):\n x, y , a = map(int, input().split(\" \"))\n if a == 1:\n for j in range(x):\n for k in range(h):\n area[k][j] = 1\n elif a == 2:\n for j in range(x, w):\n for k in range(h):\n area[k][j] = 1\n elif a == 3:\n for j in range(w):\n for k in range(y):\n area[k][j] = 1\n elif a == 4:\n for j in range(w):\n for k in range(y, h):\n area[k][j] = 1",
"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 j in range(x):\n for k in range(h):\n area[k][j] = 1\n elif a == 2:\n for j in range(x, w):\n for k in range(h):\n area[k][j] = 1\n elif a == 3:\n for j in range(w):\n for k in range(y):\n area[k][j] = 1\n elif a == 4:\n for j in range(w):\n for k in range(y, h):\n area[k][j] = 1",
"a == 1",
"a",
"1",
"for j in range(x):\n for k in range(h):\n area[k][j] = 1\n ",
"j",
"range(x)",
"range",
"x",
"for k in range(h):\n area[k][j] = 1\n ",
"k",
"range(h)",
"range",
"h",
"area[k][j] = 1",
"area[k][j]",
"[k]",
"area",
"k",
"j",
"1",
"elif a == 2:\n for j in range(x, w):\n for k in range(h):\n area[k][j] = 1\n ",
"a == 2",
"a",
"2",
"for j in range(x, w):\n for k in range(h):\n area[k][j] = 1\n ",
"j",
"range(x, w)",
"range",
"x",
"w",
"for k in range(h):\n area[k][j] = 1\n ",
"k",
"range(h)",
"range",
"h",
"area[k][j] = 1",
"area[k][j]",
"[k]",
"area",
"k",
"j",
"1",
"elif a == 3:\n for j in range(w):\n for k in range(y):\n area[k][j] = 1\n ",
"a == 3",
"a",
"3",
"for j in range(w):\n for k in range(y):\n area[k][j] = 1\n ",
"j",
"range(w)",
"range",
"w",
"for k in range(y):\n area[k][j] = 1\n ",
"k",
"range(y)",
"range",
"y",
"area[k][j] = 1",
"area[k][j]",
"[k]",
"area",
"k",
"j",
"1",
"elif a == 4:\n for j in range(w):\n for k in range(y, h):\n area[k][j] = 1",
"a == 4",
"a",
"4",
"for j in range(w):\n for k in range(y, h):\n area[k][j] = 1",
"j",
"range(w)",
"range",
"w",
"for k in range(y, h):\n area[k][j] = 1",
"k",
"range(y, h)",
"range",
"y",
"h",
"area[k][j] = 1",
"area[k][j]",
"[k]",
"area",
"k",
"j",
"1",
"c = 0",
"c",
"0",
"for i in range(h):\n for j in range(w):\n if area[i][j] == 0:\n c += 1",
"i",
"range(h)",
"range",
"h",
"for j in range(w):\n if area[i][j] == 0:\n c += 1",
"j",
"range(w)",
"range",
"w",
"if area[i][j] == 0:\n c += 1",
"area[i][j] == 0",
"area[i][j]",
"[i]",
"area",
"i",
"j",
"0",
"c += 1",
"c",
"1",
"print(c)",
"print",
"c",
"h, n = map(int, input().split(\" \"))",
"map(int, input().split(\" \"))",
"h",
"area = [[0] * w for i in range(h)]",
"[[0] * w for i in range(h)]",
"area",
"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",
"c = 0",
"0",
"c",
"y , a = map(int, input().split(\" \"))",
"map(int, input().split(\" \"))",
"y",
"n = map(int, input().split(\" \"))",
"map(int, input().split(\" \"))",
"n",
"c += 1",
"1",
"c"
] |
w, h, n = map(int, input().split(" "))
area = [[0] * w for i in range(h)]
for i in range(n):
x, y , a = map(int, input().split(" "))
if a == 1:
for j in range(x):
for k in range(h):
area[k][j] = 1
elif a == 2:
for j in range(x, w):
for k in range(h):
area[k][j] = 1
elif a == 3:
for j in range(w):
for k in range(y):
area[k][j] = 1
elif a == 4:
for j in range(w):
for k in range(y, h):
area[k][j] = 1
c = 0
for i in range(h):
for j in range(w):
if area[i][j] == 0:
c += 1
print(c)
|
[
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,
14,
2,
13,
17,
14,
2,
13,
17,
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,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] |
[
[
103,
2
],
[
103,
11
],
[
103,
12
],
[
76,
14
],
[
97,
16
],
[
104,
17
],
[
88,
18
],
[
106,
20
],
[
86,
21
],
[
24,
23
],
[
83,
26
],
[
100,
28
],
[
100,
37
],
[
100,
38
],
[
74,
41
],
[
74,
45
],
[
74,
49
],
[
79,
52
],
[
98,
57
],
[
77,
58
],
[
94,
60
],
[
107,
65
],
[
89,
66
],
[
80,
70
],
[
95,
71
],
[
100,
74
],
[
76,
77
],
[
79,
80
],
[
103,
83
],
[
103,
86
],
[
88,
89
],
[
100,
92
],
[
94,
95
],
[
104,
97
],
[
97,
98
],
[
100,
101
],
[
103,
104
],
[
86,
106
],
[
106,
107
]
] |
[
"w,h,n = map(int, input().split())\nx1,x2,y1,y2 = 0,w,0,h\nfor _ in range(n):\n xi,yi,ai = map(int, input().split())\n if ai==1: x1 = max(xi,x1)\n elif ai==2: x2 = min(xi,x2)\n elif ai==3: y1 = max(yi,y1)\n else: y2 = min(yi,y2)\ndx = max(0, x2-x1)\ndy = max(0, y2-y1)\nprint(dx*dy)",
"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 xi,yi,ai = map(int, input().split())\n if ai==1: x1 = max(xi,x1)\n elif ai==2: x2 = min(xi,x2)\n elif ai==3: y1 = max(yi,y1)\n else: y2 = min(yi,y2)",
"_",
"range(n)",
"range",
"n",
"xi,yi,ai = map(int, input().split())",
"xi",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"yi",
"ai",
"if ai==1: x1 = max(xi,x1)\n elif ai==2: x2 = min(xi,x2)\n elif ai==3: y1 = max(yi,y1)\n else: y2 = min(yi,y2)",
"ai==1",
"ai",
"1",
"elif ai==2: x2 = min(xi,x2)\n ",
"ai==2",
"ai",
"2",
"elif ai==3: y1 = max(yi,y1)\n ",
"ai==3",
"ai",
"3",
"dx = max(0, x2-x1)",
"dx",
"max(0, x2-x1)",
"max",
"0",
"x2-x1",
"x2",
"x1",
"dy = max(0, y2-y1)",
"dy",
"max(0, y2-y1)",
"max",
"0",
"y2-y1",
"y2",
"y1",
"print(dx*dy)",
"print",
"dx*dy",
"dx",
"dy",
"ai = map(int, input().split())",
"map(int, input().split())",
"ai",
"x1,x2,y1,y2 = 0,w,0,h",
"0",
"x1",
"dx = max(0, x2-x1)",
"max(0, x2-x1)",
"dx",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"h,n = map(int, input().split())",
"map(int, input().split())",
"h",
"y1,y2 = 0,w,0,h",
"0",
"y1",
"yi,ai = map(int, input().split())",
"map(int, input().split())",
"yi",
"dy = max(0, y2-y1)",
"max(0, y2-y1)",
"dy",
"x2,y1,y2 = 0,w,0,h",
"w",
"x2",
"xi,yi,ai = map(int, input().split())",
"map(int, input().split())",
"xi",
"w,h,n = map(int, input().split())",
"map(int, input().split())",
"w",
"y2 = 0,w,0,h",
"h",
"y2"
] |
w,h,n = map(int, input().split())
x1,x2,y1,y2 = 0,w,0,h
for _ in range(n):
xi,yi,ai = map(int, input().split())
if ai==1: x1 = max(xi,x1)
elif ai==2: x2 = min(xi,x2)
elif ai==3: y1 = max(yi,y1)
else: y2 = min(yi,y2)
dx = max(0, x2-x1)
dy = max(0, y2-y1)
print(dx*dy)
|
[
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,
12,
8,
2,
13,
17,
13,
17,
23,
4,
13,
2,
4,
13,
2,
13,
13,
4,
13,
2,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] |
[
[
142,
2
],
[
142,
11
],
[
142,
12
],
[
136,
14
],
[
145,
16
],
[
107,
17
],
[
109,
18
],
[
121,
20
],
[
116,
21
],
[
24,
23
],
[
143,
26
],
[
130,
28
],
[
130,
37
],
[
130,
38
],
[
104,
41
],
[
118,
44
],
[
137,
47
],
[
119,
47
],
[
128,
48
],
[
104,
51
],
[
139,
54
],
[
146,
57
],
[
140,
57
],
[
128,
58
],
[
104,
61
],
[
133,
64
],
[
110,
67
],
[
134,
67
],
[
131,
68
],
[
104,
71
],
[
124,
74
],
[
122,
77
],
[
125,
77
],
[
131,
78
],
[
112,
80
],
[
113,
93
],
[
140,
95
],
[
146,
95
],
[
119,
96
],
[
137,
96
],
[
113,
98
],
[
125,
100
],
[
122,
100
],
[
134,
101
],
[
110,
101
],
[
130,
104
],
[
142,
107
],
[
109,
110
],
[
112,
113
],
[
142,
116
],
[
118,
119
],
[
116,
121
],
[
121,
122
],
[
124,
125
],
[
130,
128
],
[
130,
131
],
[
133,
134
],
[
136,
137
],
[
139,
140
],
[
142,
143
],
[
107,
145
],
[
145,
146
]
] |
[
"W, H, N = map(int, input().split())\nu, U, v, V = 0, W, 0, H\nfor _ in range(N):\n x, y, a = map(int,input().split())\n if a == 1:\n u = max(u,x)\n if a == 2:\n U = min(U,x)\n if a == 3:\n v = max(v,y)\n if a == 4:\n V = min(V,y)\nf = lambda x:x if x > 0 else 0\nprint(f(U-u)*f(V-v))",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"u, U, v, V = 0, W, 0, H",
"u",
"0",
"U",
"W",
"v",
"0",
"V",
"H",
"for _ in range(N):\n x, y, a = map(int,input().split())\n if a == 1:\n u = max(u,x)\n if a == 2:\n U = min(U,x)\n if a == 3:\n v = max(v,y)\n if a == 4:\n V = min(V,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 u = max(u,x)\n ",
"a == 1",
"a",
"1",
"u = max(u,x)",
"u",
"max(u,x)",
"max",
"u",
"x",
"if a == 2:\n U = min(U,x)\n ",
"a == 2",
"a",
"2",
"U = min(U,x)",
"U",
"min(U,x)",
"min",
"U",
"x",
"if a == 3:\n v = max(v,y)\n ",
"a == 3",
"a",
"3",
"v = max(v,y)",
"v",
"max(v,y)",
"max",
"v",
"y",
"if a == 4:\n V = min(V,y)",
"a == 4",
"a",
"4",
"V = min(V,y)",
"V",
"min(V,y)",
"min",
"V",
"y",
"f = lambda x:x if x > 0 else 0",
"f",
"lambda x:x if x > 0 else 0",
"x if x > 0 else 0",
"x > 0",
"x",
"0",
"x",
"0",
"x",
"print(f(U-u)*f(V-v))",
"print",
"f(U-u)*f(V-v)",
"f(U-u)",
"f",
"U-u",
"U",
"u",
"f(V-v)",
"f",
"V-v",
"V",
"v",
"a = map(int,input().split())",
"map(int,input().split())",
"a",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"v, V = 0, W, 0, H",
"0",
"v",
"f = lambda x:x if x > 0 else 0",
"lambda x:x if x > 0 else 0",
"f",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"u = max(u,x)",
"max(u,x)",
"u",
"V = 0, W, 0, H",
"H",
"V",
"V = min(V,y)",
"min(V,y)",
"V",
"x, y, a = map(int,input().split())",
"map(int,input().split())",
"x",
"y, a = map(int,input().split())",
"map(int,input().split())",
"y",
"v = max(v,y)",
"max(v,y)",
"v",
"u, U, v, V = 0, W, 0, H",
"0",
"u",
"U = min(U,x)",
"min(U,x)",
"U",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"U, v, V = 0, W, 0, H",
"W",
"U"
] |
W, H, N = map(int, input().split())
u, U, v, V = 0, W, 0, H
for _ in range(N):
x, y, a = map(int,input().split())
if a == 1:
u = max(u,x)
if a == 2:
U = min(U,x)
if a == 3:
v = max(v,y)
if a == 4:
V = min(V,y)
f = lambda x:x if x > 0 else 0
print(f(U-u)*f(V-v))
|
[
7,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
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,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
15,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
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,
2,
2,
13,
13,
17,
2,
2,
13,
13,
17,
4,
13,
17,
0,
13,
2,
2,
13,
13,
2,
13,
13,
4,
13,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
2,
13,
10,
13,
13,
10,
18,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
18,
13,
10,
4,
13
] |
[
[
253,
21
],
[
241,
26
],
[
262,
33
],
[
274,
42
],
[
277,
51
],
[
226,
79
],
[
268,
84
],
[
280,
91
],
[
263,
98
],
[
250,
100
],
[
275,
107
],
[
295,
109
],
[
278,
116
],
[
283,
118
],
[
283,
127
],
[
283,
128
],
[
259,
130
],
[
292,
133
],
[
239,
134
],
[
235,
136
],
[
271,
139
],
[
248,
140
],
[
143,
142
],
[
284,
145
],
[
286,
147
],
[
286,
156
],
[
286,
157
],
[
245,
160
],
[
289,
163
],
[
260,
166
],
[
290,
166
],
[
287,
167
],
[
245,
170
],
[
229,
173
],
[
293,
176
],
[
230,
176
],
[
287,
177
],
[
245,
180
],
[
298,
183
],
[
236,
186
],
[
299,
186
],
[
257,
187
],
[
245,
190
],
[
265,
193
],
[
272,
196
],
[
266,
196
],
[
257,
197
],
[
230,
202
],
[
293,
202
],
[
290,
203
],
[
260,
203
],
[
266,
207
],
[
272,
207
],
[
299,
208
],
[
236,
208
],
[
232,
214
],
[
230,
217
],
[
293,
217
],
[
290,
218
],
[
260,
218
],
[
266,
220
],
[
272,
220
],
[
299,
221
],
[
236,
221
],
[
233,
224
],
[
226,
227
],
[
229,
230
],
[
232,
233
],
[
235,
236
],
[
283,
239
],
[
241,
242
],
[
286,
245
],
[
283,
248
],
[
250,
251
],
[
253,
254
],
[
286,
257
],
[
259,
260
],
[
262,
263
],
[
265,
266
],
[
268,
269
],
[
248,
271
],
[
271,
272
],
[
274,
275
],
[
277,
278
],
[
280,
281
],
[
283,
284
],
[
286,
287
],
[
289,
290
],
[
239,
292
],
[
292,
293
],
[
295,
296
],
[
298,
299
]
] |
[
"import sys\nimport itertools\n# import numpy as np\nimport time\nimport math\nimport heapq\nfrom collections import defaultdict\nfrom collections import Counter\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\nimport sys\nimport itertools\n# import numpy as np\nimport time\nimport math\nimport heapq\nfrom collections import defaultdict\nfrom collections import Counter\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\nW, H, N = map(int, input().split())\n\nlx = 0\nrx = W\nby = 0\nty = H\nfor i in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n lx = max(lx, x)\n if a == 2:\n rx = min(rx, x)\n if a == 3:\n by = max(by, y)\n if a == 4:\n ty = min(ty, y)\nif rx - lx < 0 or ty - by < 0:\n print(0)\nelse:\n s = (rx - lx) * (ty - by)\n print(s)",
"import sys",
"sys",
"import itertools",
"itertools",
"import time",
"time",
"import math",
"math",
"import heapq",
"heapq",
"from collections import defaultdict",
"from collections import Counter",
"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",
"import sys",
"sys",
"import itertools",
"itertools",
"import time",
"time",
"import math",
"math",
"import heapq",
"heapq",
"from collections import defaultdict",
"from collections import Counter",
"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",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"lx = 0",
"lx",
"0",
"rx = W",
"rx",
"W",
"by = 0",
"by",
"0",
"ty = H",
"ty",
"H",
"for i in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n lx = max(lx, x)\n if a == 2:\n rx = min(rx, x)\n if a == 3:\n by = max(by, y)\n if a == 4:\n ty = min(ty, 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 lx = max(lx, x)\n ",
"a == 1",
"a",
"1",
"lx = max(lx, x)",
"lx",
"max(lx, x)",
"max",
"lx",
"x",
"if a == 2:\n rx = min(rx, x)\n ",
"a == 2",
"a",
"2",
"rx = min(rx, x)",
"rx",
"min(rx, x)",
"min",
"rx",
"x",
"if a == 3:\n by = max(by, y)\n ",
"a == 3",
"a",
"3",
"by = max(by, y)",
"by",
"max(by, y)",
"max",
"by",
"y",
"if a == 4:\n ty = min(ty, y)",
"a == 4",
"a",
"4",
"ty = min(ty, y)",
"ty",
"min(ty, y)",
"min",
"ty",
"y",
"if rx - lx < 0 or ty - by < 0:\n print(0)\nelse:\n s = (rx - lx) * (ty - by)\n print(s)",
"rx - lx < 0 or ty - by < 0",
"rx - lx < 0",
"rx - lx",
"rx",
"lx",
"0",
"ty - by < 0",
"ty - by",
"ty",
"by",
"0",
"print(0)",
"print",
"0",
"s = (rx - lx) * (ty - by)",
"s",
"(rx - lx) * (ty - by)",
"rx - lx",
"rx",
"lx",
"ty - by",
"ty",
"by",
"print(s)",
"print",
"s",
"INF = 10 ** 18",
"10 ** 18",
"INF",
"rx = min(rx, x)",
"min(rx, x)",
"rx",
"s = (rx - lx) * (ty - by)",
"(rx - lx) * (ty - by)",
"s",
"by = 0",
"0",
"by",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"readline = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"readline",
"INF = 10 ** 18",
"10 ** 18",
"INF",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"lx = 0",
"0",
"lx",
"read = sys.stdin.buffer.read",
"sys.stdin.buffer.read",
"read",
"ty = min(ty, y)",
"min(ty, y)",
"ty",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"ty = H",
"H",
"ty",
"readline = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"readline",
"readlines = sys.stdin.buffer.readlines",
"sys.stdin.buffer.readlines",
"readlines",
"read = sys.stdin.buffer.read",
"sys.stdin.buffer.read",
"read",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"lx = max(lx, x)",
"max(lx, x)",
"lx",
"rx = W",
"W",
"rx",
"readlines = sys.stdin.buffer.readlines",
"sys.stdin.buffer.readlines",
"readlines",
"by = max(by, y)",
"max(by, y)",
"by"
] |
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
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())
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
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())
W, H, N = map(int, input().split())
lx = 0
rx = W
by = 0
ty = H
for i in range(N):
x, y, a = map(int, input().split())
if a == 1:
lx = max(lx, x)
if a == 2:
rx = min(rx, x)
if a == 3:
by = max(by, y)
if a == 4:
ty = min(ty, y)
if rx - lx < 0 or ty - by < 0:
print(0)
else:
s = (rx - lx) * (ty - by)
print(s)
|
[
7,
15,
13,
15,
15,
15,
15,
15,
15,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
17,
0,
13,
2,
2,
17,
17,
17,
12,
13,
29,
2,
2,
13,
13,
4,
13,
13,
13,
23,
13,
23,
13,
12,
13,
29,
4,
13,
13,
13,
23,
13,
12,
13,
29,
4,
13,
13,
13,
23,
13,
12,
13,
29,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
29,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
29,
39,
4,
13,
4,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
4,
13,
8,
13,
18,
13,
17,
18,
13,
17,
23,
13,
23,
13,
39,
17,
17,
12,
13,
28,
13,
13,
4,
13,
13,
0,
13,
13,
23,
13,
23,
13,
17,
12,
13,
29,
2,
4,
13,
13,
4,
13,
13,
23,
13,
23,
13,
17,
12,
13,
29,
4,
13,
2,
13,
4,
13,
13,
23,
13,
23,
13,
17,
6,
13,
12,
13,
4,
18,
4,
13,
13,
13,
23,
13,
23,
12,
13,
4,
18,
13,
13,
13,
17,
0,
18,
13,
13,
17,
23,
13,
23,
13,
13,
0,
13,
4,
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,
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,
4,
13,
4,
13,
4,
13,
13,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
2,
13,
10,
12,
13,
10,
6,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
17,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13
] |
[
[
343,
17
],
[
379,
22
],
[
358,
25
],
[
43,
36
],
[
45,
37
],
[
43,
40
],
[
45,
41
],
[
43,
43
],
[
45,
45
],
[
54,
52
],
[
54,
54
],
[
350,
60
],
[
63,
61
],
[
63,
63
],
[
119,
111
],
[
121,
113
],
[
121,
116
],
[
119,
119
],
[
122,
121
],
[
129,
128
],
[
137,
128
],
[
128,
132
],
[
135,
134
],
[
139,
135
],
[
137,
137
],
[
140,
139
],
[
152,
147
],
[
154,
150
],
[
152,
152
],
[
155,
154
],
[
167,
162
],
[
169,
165
],
[
167,
167
],
[
170,
169
],
[
182,
182
],
[
198,
188
],
[
200,
190
],
[
196,
193
],
[
198,
194
],
[
200,
195
],
[
198,
198
],
[
200,
200
],
[
367,
203
],
[
329,
205
],
[
367,
206
],
[
367,
207
],
[
211,
210
],
[
341,
213
],
[
335,
218
],
[
337,
220
],
[
224,
223
],
[
368,
226
],
[
388,
228
],
[
329,
230
],
[
388,
231
],
[
388,
232
],
[
389,
235
],
[
239,
238
],
[
386,
241
],
[
244,
243
],
[
335,
246
],
[
253,
248
],
[
338,
250
],
[
238,
251
],
[
243,
252
],
[
389,
256
],
[
260,
259
],
[
386,
262
],
[
341,
263
],
[
266,
265
],
[
335,
268
],
[
275,
270
],
[
338,
272
],
[
259,
273
],
[
265,
274
],
[
389,
278
],
[
282,
281
],
[
341,
284
],
[
287,
286
],
[
371,
289
],
[
296,
291
],
[
338,
293
],
[
281,
294
],
[
286,
295
],
[
389,
299
],
[
303,
302
],
[
341,
305
],
[
308,
307
],
[
371,
310
],
[
335,
311
],
[
318,
313
],
[
338,
315
],
[
302,
316
],
[
307,
317
],
[
338,
326
],
[
367,
335
],
[
337,
338
],
[
367,
341
],
[
343,
344
],
[
358,
359
],
[
367,
368
],
[
388,
371
],
[
379,
380
],
[
388,
386
],
[
388,
389
]
] |
[
"import sys\nfrom sys import exit\nfrom collections import deque\nfrom bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)\nfrom heapq import heapify, heappop, heappush\nfrom itertools import product, permutations, combinations, combinations_with_replacement\nfrom math import *\n\nsys.setrecursionlimit(10**6)\nINF = 10**20\neps = 1.0e-20\nMOD = 10**9+7\n\ndef lcm(x,y):\n return x*y//gcd(x,y)\ndef lgcd(l):\n return reduce(gcd,l)\ndef llcm(l):\n return reduce(lcm,l)\ndef mint():\n return map(int,input().split())\ndef lint():\n return list(map(int,input().split()))\ndef ilint():\n return int(input()), list(map(int,input().split()))\ndef judge(x, l=['Yes', 'No']):\n print(l[0] if x else l[1])\ndef lprint(l, sep='\\n'):\n for x in l:\n print(x, end=sep)\ndef ston(c, c0='a'):\n return ord(c)-ord(c0)\ndef ntos(x, c0='a'):\n return chr(x+ord(c0))\nclass counter(dict):\n def __init__(self, *args):\n super().__init__(args)\n def add(self,x):\n self.setdefault(x,0)\n self[x] += 1\n\nW,H,N = mint()\nrec = [[1]*H for _ in range(W)]\n\nfor _ in range(N):\n X,Y,a = mint()\n if a==1:\n for x in range(X):\n for y in range(H):\n rec[x][y] = 0\n if a==2:\n for x in range(X,W):\n for y in range(H):\n rec[x][y] = 0\n if a==3:\n for x in range(W):\n for y in range(Y):\n rec[x][y] = 0\n if a==4:\n for x in range(W):\n for y in range(Y,H):\n rec[x][y] = 0\nprint(sum(map(sum,rec)))",
"import sys",
"sys",
"from sys import exit",
"from collections import deque",
"from bisect import bisect_left, bisect_right, insort_left, insort_right",
"from heapq import heapify, heappop, heappush",
"from itertools import product, permutations, combinations, combinations_with_replacement",
"from math import *",
"sys.setrecursionlimit(10**6)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**6",
"10",
"6",
"INF = 10**20",
"INF",
"10**20",
"10",
"20",
"eps = 1.0e-20",
"eps",
"1.0e-20",
"MOD = 10**9+7",
"MOD",
"10**9+7",
"10**9",
"10",
"9",
"7",
"def lcm(x,y):\n return x*y//gcd(x,y)",
"lcm",
"return x*y//gcd(x,y)",
"x*y//gcd(x,y)",
"x*y",
"x",
"y",
"gcd(x,y)",
"gcd",
"x",
"y",
"x",
"x",
"y",
"y",
"def lgcd(l):\n return reduce(gcd,l)",
"lgcd",
"return reduce(gcd,l)",
"reduce(gcd,l)",
"reduce",
"gcd",
"l",
"l",
"l",
"def llcm(l):\n return reduce(lcm,l)",
"llcm",
"return reduce(lcm,l)",
"reduce(lcm,l)",
"reduce",
"lcm",
"l",
"l",
"l",
"def mint():\n return map(int,input().split())",
"mint",
"return map(int,input().split())",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"def lint():\n return list(map(int,input().split()))",
"lint",
"return list(map(int,input().split()))",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"def ilint():\n return int(input()), list(map(int,input().split()))",
"ilint",
"return int(input()), list(map(int,input().split()))",
"return int(input()), list(map(int,input().split()))",
"int(input())",
"int",
"input()",
"input",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"def judge(x, l=['Yes', 'No']):\n print(l[0] if x else l[1])",
"judge",
"print(l[0] if x else l[1])",
"print",
"l[0] if x else l[1]",
"x",
"l[0]",
"l",
"0",
"l[1]",
"l",
"1",
"x",
"x",
"l=['Yes', 'No']",
"l",
"['Yes', 'No']",
"'Yes'",
"'No'",
"def lprint(l, sep='\\n'):\n for x in l:\n print(x, end=sep)",
"lprint",
"for x in l:\n print(x, end=sep)",
"x",
"l",
"print(x, end=sep)",
"print",
"x",
"end=sep",
"end",
"sep",
"l",
"l",
"sep='\\n'",
"sep",
"'\\n'",
"def ston(c, c0='a'):\n return ord(c)-ord(c0)",
"ston",
"return ord(c)-ord(c0)",
"ord(c)-ord(c0)",
"ord(c)",
"ord",
"c",
"ord(c0)",
"ord",
"c0",
"c",
"c",
"c0='a'",
"c0",
"'a'",
"def ntos(x, c0='a'):\n return chr(x+ord(c0))",
"ntos",
"return chr(x+ord(c0))",
"chr(x+ord(c0))",
"chr",
"x+ord(c0)",
"x",
"ord(c0)",
"ord",
"c0",
"x",
"x",
"c0='a'",
"c0",
"'a'",
"class counter(dict):\n def __init__(self, *args):\n super().__init__(args)\n def add(self,x):\n self.setdefault(x,0)\n self[x] += 1",
"counter",
"def __init__(self, *args):\n super().__init__(args)\n ",
"__init__",
"super().__init__(args)",
"().__init__",
"()",
"super",
"__init__",
"args",
"self",
"self",
"*args",
"def add(self,x):\n self.setdefault(x,0)\n self[x] += 1",
"add",
"self.setdefault(x,0)",
"self.setdefault",
"self",
"setdefault",
"x",
"0",
"self[x] += 1",
"self[x]",
"self",
"x",
"1",
"self",
"self",
"x",
"x",
"dict",
"W,H,N = mint()",
"W",
"mint()",
"mint",
"H",
"N",
"[1]*H for _ in range(W)",
"for _ in range(W)",
"_",
"range(W)",
"range",
"W",
"for _ in range(W)",
"[1]*H",
"[1]",
"1",
"H",
"rec = [[1]*H for _ in range(W)]",
"rec",
"[[1]*H for _ in range(W)]",
"for _ in range(N):\n X,Y,a = mint()\n if a==1:\n for x in range(X):\n for y in range(H):\n rec[x][y] = 0\n if a==2:\n for x in range(X,W):\n for y in range(H):\n rec[x][y] = 0\n if a==3:\n for x in range(W):\n for y in range(Y):\n rec[x][y] = 0\n if a==4:\n for x in range(W):\n for y in range(Y,H):\n rec[x][y] = 0",
"_",
"range(N)",
"range",
"N",
"X,Y,a = mint()",
"X",
"mint()",
"mint",
"Y",
"a",
"if a==1:\n for x in range(X):\n for y in range(H):\n rec[x][y] = 0\n ",
"a==1",
"a",
"1",
"for x in range(X):\n for y in range(H):\n rec[x][y] = 0\n ",
"x",
"range(X)",
"range",
"X",
"for y in range(H):\n rec[x][y] = 0\n ",
"y",
"range(H)",
"range",
"H",
"rec[x][y] = 0",
"rec[x][y]",
"[x]",
"rec",
"x",
"y",
"0",
"if a==2:\n for x in range(X,W):\n for y in range(H):\n rec[x][y] = 0\n ",
"a==2",
"a",
"2",
"for x in range(X,W):\n for y in range(H):\n rec[x][y] = 0\n ",
"x",
"range(X,W)",
"range",
"X",
"W",
"for y in range(H):\n rec[x][y] = 0\n ",
"y",
"range(H)",
"range",
"H",
"rec[x][y] = 0",
"rec[x][y]",
"[x]",
"rec",
"x",
"y",
"0",
"if a==3:\n for x in range(W):\n for y in range(Y):\n rec[x][y] = 0\n ",
"a==3",
"a",
"3",
"for x in range(W):\n for y in range(Y):\n rec[x][y] = 0\n ",
"x",
"range(W)",
"range",
"W",
"for y in range(Y):\n rec[x][y] = 0\n ",
"y",
"range(Y)",
"range",
"Y",
"rec[x][y] = 0",
"rec[x][y]",
"[x]",
"rec",
"x",
"y",
"0",
"if a==4:\n for x in range(W):\n for y in range(Y,H):\n rec[x][y] = 0",
"a==4",
"a",
"4",
"for x in range(W):\n for y in range(Y,H):\n rec[x][y] = 0",
"x",
"range(W)",
"range",
"W",
"for y in range(Y,H):\n rec[x][y] = 0",
"y",
"range(Y,H)",
"range",
"Y",
"H",
"rec[x][y] = 0",
"rec[x][y]",
"[x]",
"rec",
"x",
"y",
"0",
"print(sum(map(sum,rec)))",
"print",
"sum(map(sum,rec))",
"sum",
"map(sum,rec)",
"map",
"sum",
"rec",
"def mint():\n return map(int,input().split())",
"def mint():\n return map(int,input().split())",
"mint",
"def ntos(x, c0='a'):\n return chr(x+ord(c0))",
"def ntos(x, c0='a'):\n return chr(x+ord(c0))",
"ntos",
"H,N = mint()",
"mint()",
"H",
"rec = [[1]*H for _ in range(W)]",
"[[1]*H for _ in range(W)]",
"rec",
"W,H,N = mint()",
"mint()",
"W",
"INF = 10**20",
"10**20",
"INF",
"def lprint(l, sep='\\n'):\n for x in l:\n print(x, end=sep)",
"def lprint(l, sep='\\n'):\n for x in l:\n print(x, end=sep)",
"lprint",
"def lcm(x,y):\n return x*y//gcd(x,y)",
"def lcm(x,y):\n return x*y//gcd(x,y)",
"lcm",
"def ilint():\n return int(input()), list(map(int,input().split()))",
"def ilint():\n return int(input()), list(map(int,input().split()))",
"ilint",
"def lint():\n return list(map(int,input().split()))",
"def lint():\n return list(map(int,input().split()))",
"lint",
"MOD = 10**9+7",
"10**9+7",
"MOD",
"def ston(c, c0='a'):\n return ord(c)-ord(c0)",
"def ston(c, c0='a'):\n return ord(c)-ord(c0)",
"ston",
"class counter(dict):\n def __init__(self, *args):\n super().__init__(args)\n def add(self,x):\n self.setdefault(x,0)\n self[x] += 1",
"class counter(dict):\n def __init__(self, *args):\n super().__init__(args)\n def add(self,x):\n self.setdefault(x,0)\n self[x] += 1",
"counter",
"N = mint()",
"mint()",
"N",
"Y,a = mint()",
"mint()",
"Y",
"def judge(x, l=['Yes', 'No']):\n print(l[0] if x else l[1])",
"def judge(x, l=['Yes', 'No']):\n print(l[0] if x else l[1])",
"judge",
"def llcm(l):\n return reduce(lcm,l)",
"def llcm(l):\n return reduce(lcm,l)",
"llcm",
"eps = 1.0e-20",
"1.0e-20",
"eps",
"def lgcd(l):\n return reduce(gcd,l)",
"def lgcd(l):\n return reduce(gcd,l)",
"lgcd",
"X,Y,a = mint()",
"mint()",
"X",
"a = mint()",
"mint()",
"a"
] |
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from math import *
sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7
def lcm(x,y):
return x*y//gcd(x,y)
def lgcd(l):
return reduce(gcd,l)
def llcm(l):
return reduce(lcm,l)
def mint():
return map(int,input().split())
def lint():
return list(map(int,input().split()))
def ilint():
return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
print(l[0] if x else l[1])
def lprint(l, sep='\n'):
for x in l:
print(x, end=sep)
def ston(c, c0='a'):
return ord(c)-ord(c0)
def ntos(x, c0='a'):
return chr(x+ord(c0))
class counter(dict):
def __init__(self, *args):
super().__init__(args)
def add(self,x):
self.setdefault(x,0)
self[x] += 1
W,H,N = mint()
rec = [[1]*H for _ in range(W)]
for _ in range(N):
X,Y,a = mint()
if a==1:
for x in range(X):
for y in range(H):
rec[x][y] = 0
if a==2:
for x in range(X,W):
for y in range(H):
rec[x][y] = 0
if a==3:
for x in range(W):
for y in range(Y):
rec[x][y] = 0
if a==4:
for x in range(W):
for y in range(Y,H):
rec[x][y] = 0
print(sum(map(sum,rec)))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
13,
13,
13,
13,
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,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
4,
13,
2,
4,
13,
2,
13,
13,
17,
4,
13,
2,
13,
13,
17,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] |
[
[
125,
2
],
[
125,
11
],
[
125,
12
],
[
104,
14
],
[
134,
16
],
[
117,
17
],
[
119,
18
],
[
126,
19
],
[
101,
20
],
[
24,
23
],
[
96,
26
],
[
131,
28
],
[
131,
37
],
[
131,
38
],
[
132,
41
],
[
107,
44
],
[
105,
47
],
[
108,
47
],
[
129,
48
],
[
132,
51
],
[
110,
54
],
[
135,
57
],
[
111,
57
],
[
129,
58
],
[
132,
61
],
[
113,
64
],
[
102,
67
],
[
114,
67
],
[
99,
68
],
[
132,
71
],
[
122,
74
],
[
120,
77
],
[
123,
77
],
[
99,
78
],
[
111,
85
],
[
135,
85
],
[
108,
86
],
[
105,
86
],
[
123,
91
],
[
120,
91
],
[
114,
92
],
[
102,
92
],
[
125,
96
],
[
131,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
],
[
125,
117
],
[
126,
119
],
[
119,
120
],
[
122,
123
],
[
125,
126
],
[
131,
129
],
[
131,
132
],
[
117,
134
],
[
134,
135
]
] |
[
"W,H,N=map(int,input().split())\nxl,xr,yh,yl=0,W,H,0\nfor i in range(N):\n x,y,a=map(int,input().split())\n if a==1:\n xl=max(xl,x)\n elif a==2:\n xr=min(xr,x)\n elif a==3:\n yl=max(yl,y)\n elif a==4:\n yh=min(yh,y)\nprint(max(xr-xl,0)*max(yh-yl,0))",
"W,H,N=map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"xl,xr,yh,yl=0,W,H,0",
"xl",
"0",
"xr",
"W",
"yh",
"H",
"yl",
"0",
"for i in range(N):\n x,y,a=map(int,input().split())\n if a==1:\n xl=max(xl,x)\n elif a==2:\n xr=min(xr,x)\n elif a==3:\n yl=max(yl,y)\n elif a==4:\n yh=min(yh,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 xl=max(xl,x)\n elif a==2:\n xr=min(xr,x)\n elif a==3:\n yl=max(yl,y)\n elif a==4:\n yh=min(yh,y)",
"a==1",
"a",
"1",
"xl=max(xl,x)",
"xl",
"max(xl,x)",
"max",
"xl",
"x",
"elif a==2:\n xr=min(xr,x)\n ",
"a==2",
"a",
"2",
"xr=min(xr,x)",
"xr",
"min(xr,x)",
"min",
"xr",
"x",
"elif a==3:\n yl=max(yl,y)\n ",
"a==3",
"a",
"3",
"yl=max(yl,y)",
"yl",
"max(yl,y)",
"max",
"yl",
"y",
"elif a==4:\n yh=min(yh,y)",
"a==4",
"a",
"4",
"yh=min(yh,y)",
"yh",
"min(yh,y)",
"min",
"yh",
"y",
"print(max(xr-xl,0)*max(yh-yl,0))",
"print",
"max(xr-xl,0)*max(yh-yl,0)",
"max(xr-xl,0)",
"max",
"xr-xl",
"xr",
"xl",
"0",
"max(yh-yl,0)",
"max",
"yh-yl",
"yh",
"yl",
"0",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"y,a=map(int,input().split())",
"map(int,input().split())",
"y",
"yl=0,W,H,0",
"0",
"yl",
"xl,xr,yh,yl=0,W,H,0",
"0",
"xl",
"xl=max(xl,x)",
"max(xl,x)",
"xl",
"xr=min(xr,x)",
"min(xr,x)",
"xr",
"yl=max(yl,y)",
"max(yl,y)",
"yl",
"W,H,N=map(int,input().split())",
"map(int,input().split())",
"W",
"yh,yl=0,W,H,0",
"H",
"yh",
"yh=min(yh,y)",
"min(yh,y)",
"yh",
"H,N=map(int,input().split())",
"map(int,input().split())",
"H",
"x,y,a=map(int,input().split())",
"map(int,input().split())",
"x",
"a=map(int,input().split())",
"map(int,input().split())",
"a",
"xr,yh,yl=0,W,H,0",
"W",
"xr"
] |
W,H,N=map(int,input().split())
xl,xr,yh,yl=0,W,H,0
for i in range(N):
x,y,a=map(int,input().split())
if a==1:
xl=max(xl,x)
elif a==2:
xr=min(xr,x)
elif a==3:
yl=max(yl,y)
elif a==4:
yh=min(yh,y)
print(max(xr-xl,0)*max(yh-yl,0))
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
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,
13,
18,
13,
17,
14,
2,
13,
17,
0,
18,
13,
17,
4,
13,
13,
18,
13,
17,
14,
2,
13,
17,
0,
18,
13,
17,
4,
13,
13,
18,
13,
17,
0,
18,
13,
17,
4,
13,
13,
18,
13,
17,
14,
2,
40,
18,
13,
17,
18,
13,
17,
40,
18,
13,
17,
18,
13,
17,
0,
13,
17,
0,
13,
2,
2,
18,
13,
17,
18,
13,
17,
2,
18,
13,
17,
18,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
18,
13,
10,
12,
13
] |
[
[
149,
4
],
[
14,
13
],
[
150,
20
],
[
14,
22
],
[
14,
23
],
[
26,
25
],
[
31,
30
],
[
36,
35
],
[
23,
38
],
[
41,
40
],
[
150,
47
],
[
41,
49
],
[
41,
50
],
[
50,
53
],
[
59,
56
],
[
25,
57
],
[
40,
61
],
[
25,
63
],
[
50,
67
],
[
73,
70
],
[
25,
71
],
[
40,
75
],
[
25,
77
],
[
50,
81
],
[
87,
84
],
[
30,
85
],
[
49,
89
],
[
30,
91
],
[
97,
94
],
[
30,
95
],
[
49,
99
],
[
30,
101
],
[
25,
107
],
[
25,
110
],
[
30,
114
],
[
30,
117
],
[
121,
120
],
[
124,
123
],
[
25,
127
],
[
25,
130
],
[
30,
134
],
[
30,
137
],
[
123,
141
],
[
120,
141
],
[
153,
147
],
[
149,
150
]
] |
[
"import sys\n\ninput = sys.stdin.readline\n\ndef main():\n W, H, N = map(int, input().split())\n X = [0, W]\n Y = [0, H]\n for i in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n X[0] = max(x, X[0])\n elif a == 2:\n X[1] = min(x, X[1])\n elif a == 3:\n Y[0] = max(y, Y[0])\n else:\n Y[1] = min(y, Y[1])\n if X[1] <= X[0] or Y[1] <= Y[0]:\n ans = 0\n else:\n ans = (X[1] - X[0]) * (Y[1] - Y[0])\n print(ans)\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 W, H, N = map(int, input().split())\n X = [0, W]\n Y = [0, H]\n for i in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n X[0] = max(x, X[0])\n elif a == 2:\n X[1] = min(x, X[1])\n elif a == 3:\n Y[0] = max(y, Y[0])\n else:\n Y[1] = min(y, Y[1])\n if X[1] <= X[0] or Y[1] <= Y[0]:\n ans = 0\n else:\n ans = (X[1] - X[0]) * (Y[1] - Y[0])\n print(ans)",
"main",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"X = [0, W]",
"X",
"[0, W]",
"0",
"W",
"Y = [0, H]",
"Y",
"[0, H]",
"0",
"H",
"for i in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n X[0] = max(x, X[0])\n elif a == 2:\n X[1] = min(x, X[1])\n elif a == 3:\n Y[0] = max(y, Y[0])\n else:\n Y[1] = min(y, Y[1])\n ",
"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 X[0] = max(x, X[0])\n elif a == 2:\n X[1] = min(x, X[1])\n elif a == 3:\n Y[0] = max(y, Y[0])\n else:\n Y[1] = min(y, Y[1])\n ",
"a == 1",
"a",
"1",
"X[0] = max(x, X[0])",
"X[0]",
"X",
"0",
"max(x, X[0])",
"max",
"x",
"X[0]",
"X",
"0",
"elif a == 2:\n X[1] = min(x, X[1])\n ",
"a == 2",
"a",
"2",
"X[1] = min(x, X[1])",
"X[1]",
"X",
"1",
"min(x, X[1])",
"min",
"x",
"X[1]",
"X",
"1",
"elif a == 3:\n Y[0] = max(y, Y[0])\n ",
"a == 3",
"a",
"3",
"Y[0] = max(y, Y[0])",
"Y[0]",
"Y",
"0",
"max(y, Y[0])",
"max",
"y",
"Y[0]",
"Y",
"0",
"Y[1] = min(y, Y[1])",
"Y[1]",
"Y",
"1",
"min(y, Y[1])",
"min",
"y",
"Y[1]",
"Y",
"1",
"if X[1] <= X[0] or Y[1] <= Y[0]:\n ans = 0\n else:\n ans = (X[1] - X[0]) * (Y[1] - Y[0])\n ",
"X[1] <= X[0] or Y[1] <= Y[0]",
"X[1] <= X[0]",
"X[1]",
"X",
"1",
"X[0]",
"X",
"0",
"Y[1] <= Y[0]",
"Y[1]",
"Y",
"1",
"Y[0]",
"Y",
"0",
"ans = 0",
"ans",
"0",
"ans = (X[1] - X[0]) * (Y[1] - Y[0])",
"ans",
"(X[1] - X[0]) * (Y[1] - Y[0])",
"X[1] - X[0]",
"X[1]",
"X",
"1",
"X[0]",
"X",
"0",
"Y[1] - Y[0]",
"Y[1]",
"Y",
"1",
"Y[0]",
"Y",
"0",
"print(ans)",
"print",
"ans",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"def main():\n W, H, N = map(int, input().split())\n X = [0, W]\n Y = [0, H]\n for i in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n X[0] = max(x, X[0])\n elif a == 2:\n X[1] = min(x, X[1])\n elif a == 3:\n Y[0] = max(y, Y[0])\n else:\n Y[1] = min(y, Y[1])\n if X[1] <= X[0] or Y[1] <= Y[0]:\n ans = 0\n else:\n ans = (X[1] - X[0]) * (Y[1] - Y[0])\n print(ans)",
"def main():\n W, H, N = map(int, input().split())\n X = [0, W]\n Y = [0, H]\n for i in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n X[0] = max(x, X[0])\n elif a == 2:\n X[1] = min(x, X[1])\n elif a == 3:\n Y[0] = max(y, Y[0])\n else:\n Y[1] = min(y, Y[1])\n if X[1] <= X[0] or Y[1] <= Y[0]:\n ans = 0\n else:\n ans = (X[1] - X[0]) * (Y[1] - Y[0])\n print(ans)",
"main"
] |
import sys
input = sys.stdin.readline
def main():
W, H, N = map(int, input().split())
X = [0, W]
Y = [0, H]
for i in range(N):
x, y, a = map(int, input().split())
if a == 1:
X[0] = max(x, X[0])
elif a == 2:
X[1] = min(x, X[1])
elif a == 3:
Y[0] = max(y, Y[0])
else:
Y[1] = min(y, Y[1])
if X[1] <= X[0] or Y[1] <= Y[0]:
ans = 0
else:
ans = (X[1] - X[0]) * (Y[1] - Y[0])
print(ans)
if __name__ == "__main__":
main()
|
[
7,
0,
13,
4,
18,
4,
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,
13,
0,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
39,
0,
13,
39,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
18,
4,
13,
13,
4,
18,
13,
13,
4,
13,
18,
13,
17,
4,
18,
13,
13,
4,
13,
18,
13,
17,
4,
18,
13,
13,
4,
13,
18,
13,
17,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
14,
2,
18,
13,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
14,
2,
18,
13,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
0,
13,
2,
13,
13,
14,
2,
13,
17,
0,
13,
17,
0,
13,
2,
13,
13,
14,
2,
13,
17,
0,
13,
17,
0,
13,
2,
13,
13,
4,
13,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
39,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
39,
13,
10,
2,
13,
10,
13,
13,
10,
17,
13,
10,
18,
13,
10,
18,
13
] |
[
[
204,
2
],
[
189,
9
],
[
205,
13
],
[
225,
16
],
[
205,
20
],
[
228,
23
],
[
205,
27
],
[
240,
30
],
[
190,
31
],
[
231,
33
],
[
226,
34
],
[
207,
36
],
[
216,
39
],
[
192,
42
],
[
234,
45
],
[
219,
48
],
[
52,
51
],
[
229,
54
],
[
210,
56
],
[
193,
64
],
[
211,
69
],
[
235,
73
],
[
211,
78
],
[
220,
82
],
[
211,
87
],
[
91,
90
],
[
229,
93
],
[
220,
97
],
[
90,
98
],
[
193,
103
],
[
90,
104
],
[
208,
105
],
[
247,
105
],
[
246,
107
],
[
193,
109
],
[
90,
110
],
[
220,
114
],
[
90,
115
],
[
193,
120
],
[
90,
121
],
[
241,
122
],
[
250,
122
],
[
249,
124
],
[
193,
126
],
[
90,
127
],
[
220,
131
],
[
90,
132
],
[
235,
137
],
[
90,
138
],
[
217,
139
],
[
202,
139
],
[
201,
141
],
[
235,
143
],
[
90,
144
],
[
235,
148
],
[
90,
149
],
[
232,
150
],
[
214,
150
],
[
213,
152
],
[
235,
154
],
[
90,
155
],
[
195,
157
],
[
214,
159
],
[
232,
159
],
[
202,
160
],
[
217,
160
],
[
196,
163
],
[
222,
166
],
[
237,
169
],
[
250,
171
],
[
241,
171
],
[
247,
172
],
[
208,
172
],
[
238,
175
],
[
243,
178
],
[
198,
181
],
[
244,
183
],
[
238,
183
],
[
223,
184
],
[
196,
184
],
[
199,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
],
[
201,
202
],
[
204,
205
],
[
207,
208
],
[
210,
211
],
[
213,
214
],
[
216,
217
],
[
219,
220
],
[
222,
223
],
[
225,
226
],
[
228,
229
],
[
226,
231
],
[
231,
232
],
[
234,
235
],
[
237,
238
],
[
190,
240
],
[
240,
241
],
[
243,
244
],
[
246,
247
],
[
249,
250
]
] |
[
"s = input().split()\n\nw = int(s[0])\nh = int(s[1])\nn = int(s[2])\n\nmax_x = w\nmax_y = h\nmin_x = 0\nmin_y = 0\n\nx = []\ny = []\na = []\n\nfor num in range(n):\n v = input().split()\n x.append(int(v[0]))\n y.append(int(v[1]))\n a.append(int(v[2]))\n\nfor num in range(n):\n if a[num] == 1:\n if x[num] > min_x:\n min_x = x[num]\n elif a[num] == 2:\n if x[num] < max_x:\n max_x = x[num]\n elif a[num] == 3:\n if y[num] > min_y:\n min_y = y[num]\n else:\n if y[num] < max_y:\n max_y = y[num]\n\ny_length = max_y - min_y\nif y_length < 0:\n y_length = 0\nx_length = max_x - min_x\nif x_length < 0:\n x_length = 0\nanswer = x_length * y_length\n\nprint(answer)\n \n\n",
"s = input().split()",
"s",
"input().split()",
"().split",
"()",
"input",
"split",
"w = int(s[0])",
"w",
"int(s[0])",
"int",
"s[0]",
"s",
"0",
"h = int(s[1])",
"h",
"int(s[1])",
"int",
"s[1]",
"s",
"1",
"n = int(s[2])",
"n",
"int(s[2])",
"int",
"s[2]",
"s",
"2",
"max_x = w",
"max_x",
"w",
"max_y = h",
"max_y",
"h",
"min_x = 0",
"min_x",
"0",
"min_y = 0",
"min_y",
"0",
"x = []",
"x",
"[]",
"y = []",
"y",
"[]",
"a = []",
"a",
"[]",
"for num in range(n):\n v = input().split()\n x.append(int(v[0]))\n y.append(int(v[1]))\n a.append(int(v[2]))",
"num",
"range(n)",
"range",
"n",
"v = input().split()",
"v",
"input().split()",
"().split",
"()",
"input",
"split",
"x.append(int(v[0]))",
"x.append",
"x",
"append",
"int(v[0])",
"int",
"v[0]",
"v",
"0",
"y.append(int(v[1]))",
"y.append",
"y",
"append",
"int(v[1])",
"int",
"v[1]",
"v",
"1",
"a.append(int(v[2]))",
"a.append",
"a",
"append",
"int(v[2])",
"int",
"v[2]",
"v",
"2",
"for num in range(n):\n if a[num] == 1:\n if x[num] > min_x:\n min_x = x[num]\n elif a[num] == 2:\n if x[num] < max_x:\n max_x = x[num]\n elif a[num] == 3:\n if y[num] > min_y:\n min_y = y[num]\n else:\n if y[num] < max_y:\n max_y = y[num]",
"num",
"range(n)",
"range",
"n",
"if a[num] == 1:\n if x[num] > min_x:\n min_x = x[num]\n elif a[num] == 2:\n if x[num] < max_x:\n max_x = x[num]\n elif a[num] == 3:\n if y[num] > min_y:\n min_y = y[num]\n else:\n if y[num] < max_y:\n max_y = y[num]",
"a[num] == 1",
"a[num]",
"a",
"num",
"1",
"if x[num] > min_x:\n min_x = x[num]\n ",
"x[num] > min_x",
"x[num]",
"x",
"num",
"min_x",
"min_x = x[num]",
"min_x",
"x[num]",
"x",
"num",
"elif a[num] == 2:\n if x[num] < max_x:\n max_x = x[num]\n ",
"a[num] == 2",
"a[num]",
"a",
"num",
"2",
"if x[num] < max_x:\n max_x = x[num]\n ",
"x[num] < max_x",
"x[num]",
"x",
"num",
"max_x",
"max_x = x[num]",
"max_x",
"x[num]",
"x",
"num",
"elif a[num] == 3:\n if y[num] > min_y:\n min_y = y[num]\n ",
"a[num] == 3",
"a[num]",
"a",
"num",
"3",
"if y[num] > min_y:\n min_y = y[num]\n ",
"y[num] > min_y",
"y[num]",
"y",
"num",
"min_y",
"min_y = y[num]",
"min_y",
"y[num]",
"y",
"num",
"if y[num] < max_y:\n max_y = y[num]",
"y[num] < max_y",
"y[num]",
"y",
"num",
"max_y",
"max_y = y[num]",
"max_y",
"y[num]",
"y",
"num",
"y_length = max_y - min_y",
"y_length",
"max_y - min_y",
"max_y",
"min_y",
"if y_length < 0:\n y_length = 0",
"y_length < 0",
"y_length",
"0",
"y_length = 0",
"y_length",
"0",
"x_length = max_x - min_x",
"x_length",
"max_x - min_x",
"max_x",
"min_x",
"if x_length < 0:\n x_length = 0",
"x_length < 0",
"x_length",
"0",
"x_length = 0",
"x_length",
"0",
"answer = x_length * y_length",
"answer",
"x_length * y_length",
"x_length",
"y_length",
"print(answer)",
"print",
"answer",
"w = int(s[0])",
"int(s[0])",
"w",
"x = []",
"[]",
"x",
"y_length = max_y - min_y",
"max_y - min_y",
"y_length",
"answer = x_length * y_length",
"x_length * y_length",
"answer",
"min_y = y[num]",
"y[num]",
"min_y",
"s = input().split()",
"input().split()",
"s",
"min_x = 0",
"0",
"min_x",
"v = input().split()",
"input().split()",
"v",
"max_y = y[num]",
"y[num]",
"max_y",
"min_y = 0",
"0",
"min_y",
"a = []",
"[]",
"a",
"y_length = 0",
"0",
"y_length",
"h = int(s[1])",
"int(s[1])",
"h",
"n = int(s[2])",
"int(s[2])",
"n",
"max_y = h",
"h",
"max_y",
"y = []",
"[]",
"y",
"x_length = max_x - min_x",
"max_x - min_x",
"x_length",
"max_x = w",
"w",
"max_x",
"x_length = 0",
"0",
"x_length",
"min_x = x[num]",
"x[num]",
"min_x",
"max_x = x[num]",
"x[num]",
"max_x"
] |
s = input().split()
w = int(s[0])
h = int(s[1])
n = int(s[2])
max_x = w
max_y = h
min_x = 0
min_y = 0
x = []
y = []
a = []
for num in range(n):
v = input().split()
x.append(int(v[0]))
y.append(int(v[1]))
a.append(int(v[2]))
for num in range(n):
if a[num] == 1:
if x[num] > min_x:
min_x = x[num]
elif a[num] == 2:
if x[num] < max_x:
max_x = x[num]
elif a[num] == 3:
if y[num] > min_y:
min_y = y[num]
else:
if y[num] < max_y:
max_y = y[num]
y_length = max_y - min_y
if y_length < 0:
y_length = 0
x_length = max_x - min_x
if x_length < 0:
x_length = 0
answer = x_length * y_length
print(answer)
|
[
7,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
0,
13,
12,
4,
18,
4,
18,
18,
13,
13,
13,
13,
0,
13,
12,
4,
18,
4,
18,
18,
13,
13,
13,
13,
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,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
0,
13,
4,
13,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
13,
13,
0,
13,
17,
0,
13,
13,
0,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
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,
4,
13,
13,
13,
14,
2,
40,
13,
13,
40,
13,
13,
4,
13,
17,
4,
13,
2,
2,
13,
13,
2,
13,
13,
10,
13,
13,
10,
2,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] |
[
[
192,
16
],
[
228,
28
],
[
207,
40
],
[
189,
51
],
[
231,
66
],
[
234,
83
],
[
183,
88
],
[
237,
95
],
[
190,
97
],
[
237,
98
],
[
237,
99
],
[
222,
101
],
[
180,
104
],
[
211,
105
],
[
225,
107
],
[
238,
108
],
[
240,
110
],
[
114,
113
],
[
202,
116
],
[
216,
118
],
[
190,
120
],
[
216,
121
],
[
216,
122
],
[
217,
125
],
[
219,
128
],
[
223,
131
],
[
220,
131
],
[
214,
132
],
[
217,
135
],
[
186,
138
],
[
181,
141
],
[
187,
141
],
[
214,
142
],
[
217,
145
],
[
198,
148
],
[
226,
151
],
[
199,
151
],
[
196,
152
],
[
204,
154
],
[
241,
157
],
[
205,
157
],
[
196,
158
],
[
220,
162
],
[
223,
162
],
[
187,
163
],
[
181,
163
],
[
205,
165
],
[
241,
165
],
[
199,
166
],
[
226,
166
],
[
187,
174
],
[
181,
174
],
[
220,
175
],
[
223,
175
],
[
199,
177
],
[
226,
177
],
[
205,
178
],
[
241,
178
],
[
211,
180
],
[
180,
181
],
[
183,
184
],
[
186,
187
],
[
189,
190
],
[
192,
193
],
[
216,
196
],
[
198,
199
],
[
237,
202
],
[
204,
205
],
[
207,
208
],
[
237,
211
],
[
216,
214
],
[
216,
217
],
[
219,
220
],
[
222,
223
],
[
238,
225
],
[
225,
226
],
[
228,
229
],
[
231,
232
],
[
234,
235
],
[
237,
238
],
[
240,
241
]
] |
[
"import sys\nimport math\nimport itertools\nimport collections\nimport heapq\nimport re\nimport numpy as np\n\nrr = lambda: sys.stdin.readline().rstrip()\nrs = lambda: sys.stdin.readline().split()\nri = lambda: int(sys.stdin.readline())\nrm = lambda: map(int, sys.stdin.readline().split())\nrl = lambda: list(map(int, sys.stdin.readline().split()))\ninf = float('inf')\nmod = 10**9 + 7\n\nw, h, n = rm()\nxleft = 0\nxright = w\nytop = h\nybottom = 0\nfor _ in range(n):\n x, y, a = rm()\n if a == 1:\n xleft = max(xleft, x)\n elif a == 2:\n xright = min(xright, x)\n elif a == 4:\n ytop = min(ytop, y)\n else:\n ybottom = max(ybottom, y)\nif xleft >= xright or ybottom >= ytop:\n print(0)\nelse:\n print((xright-xleft)*(ytop-ybottom))\n\n\n\n\n\n\n\n\n\n\n\n\n",
"import sys",
"sys",
"import math",
"math",
"import itertools",
"itertools",
"import collections",
"collections",
"import heapq",
"heapq",
"import re",
"re",
"import numpy as np",
"numpy",
"rr = lambda: sys.stdin.readline().rstrip()",
"rr",
"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",
"rs = lambda: sys.stdin.readline().split()",
"rs",
"lambda: sys.stdin.readline().split()",
"sys.stdin.readline().split()",
"sys.stdin.readline().split",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"split",
"ri = lambda: int(sys.stdin.readline())",
"ri",
"lambda: int(sys.stdin.readline())",
"int(sys.stdin.readline())",
"int",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"rm = lambda: map(int, sys.stdin.readline().split())",
"rm",
"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",
"rl = lambda: list(map(int, sys.stdin.readline().split()))",
"rl",
"lambda: list(map(int, sys.stdin.readline().split()))",
"list(map(int, sys.stdin.readline().split()))",
"list",
"map(int, sys.stdin.readline().split())",
"map",
"int",
"sys.stdin.readline().split()",
"sys.stdin.readline().split",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"split",
"inf = float('inf')",
"inf",
"float('inf')",
"float",
"'inf'",
"mod = 10**9 + 7",
"mod",
"10**9 + 7",
"10**9",
"10",
"9",
"7",
"w, h, n = rm()",
"w",
"rm()",
"rm",
"h",
"n",
"xleft = 0",
"xleft",
"0",
"xright = w",
"xright",
"w",
"ytop = h",
"ytop",
"h",
"ybottom = 0",
"ybottom",
"0",
"for _ in range(n):\n x, y, a = rm()\n if a == 1:\n xleft = max(xleft, x)\n elif a == 2:\n xright = min(xright, x)\n elif a == 4:\n ytop = min(ytop, y)\n else:\n ybottom = max(ybottom, y)",
"_",
"range(n)",
"range",
"n",
"x, y, a = rm()",
"x",
"rm()",
"rm",
"y",
"a",
"if a == 1:\n xleft = max(xleft, x)\n elif a == 2:\n xright = min(xright, x)\n elif a == 4:\n ytop = min(ytop, y)\n else:\n ybottom = max(ybottom, y)",
"a == 1",
"a",
"1",
"xleft = max(xleft, x)",
"xleft",
"max(xleft, x)",
"max",
"xleft",
"x",
"elif a == 2:\n xright = min(xright, x)\n ",
"a == 2",
"a",
"2",
"xright = min(xright, x)",
"xright",
"min(xright, x)",
"min",
"xright",
"x",
"elif a == 4:\n ytop = min(ytop, y)\n ",
"a == 4",
"a",
"4",
"ytop = min(ytop, y)",
"ytop",
"min(ytop, y)",
"min",
"ytop",
"y",
"ybottom = max(ybottom, y)",
"ybottom",
"max(ybottom, y)",
"max",
"ybottom",
"y",
"if xleft >= xright or ybottom >= ytop:\n print(0)\nelse:\n print((xright-xleft)*(ytop-ybottom))",
"xleft >= xright or ybottom >= ytop",
"xleft >= xright",
"xleft",
"xright",
"ybottom >= ytop",
"ybottom",
"ytop",
"print(0)",
"print",
"0",
"print((xright-xleft)*(ytop-ybottom))",
"print",
"(xright-xleft)*(ytop-ybottom)",
"xright-xleft",
"xright",
"xleft",
"ytop-ybottom",
"ytop",
"ybottom",
"xright = w",
"w",
"xright",
"mod = 10**9 + 7",
"10**9 + 7",
"mod",
"xright = min(xright, x)",
"min(xright, x)",
"xright",
"rm = lambda: map(int, sys.stdin.readline().split())",
"lambda: map(int, sys.stdin.readline().split())",
"rm",
"rr = lambda: sys.stdin.readline().rstrip()",
"lambda: sys.stdin.readline().rstrip()",
"rr",
"y, a = rm()",
"rm()",
"y",
"ytop = min(ytop, y)",
"min(ytop, y)",
"ytop",
"n = rm()",
"rm()",
"n",
"ybottom = max(ybottom, y)",
"max(ybottom, y)",
"ybottom",
"ri = lambda: int(sys.stdin.readline())",
"lambda: int(sys.stdin.readline())",
"ri",
"w, h, n = rm()",
"rm()",
"w",
"x, y, a = rm()",
"rm()",
"x",
"a = rm()",
"rm()",
"a",
"xleft = max(xleft, x)",
"max(xleft, x)",
"xleft",
"xleft = 0",
"0",
"xleft",
"ytop = h",
"h",
"ytop",
"rs = lambda: sys.stdin.readline().split()",
"lambda: sys.stdin.readline().split()",
"rs",
"rl = lambda: list(map(int, sys.stdin.readline().split()))",
"lambda: list(map(int, sys.stdin.readline().split()))",
"rl",
"inf = float('inf')",
"float('inf')",
"inf",
"h, n = rm()",
"rm()",
"h",
"ybottom = 0",
"0",
"ybottom"
] |
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7
w, h, n = rm()
xleft = 0
xright = w
ytop = h
ybottom = 0
for _ in range(n):
x, y, a = rm()
if a == 1:
xleft = max(xleft, x)
elif a == 2:
xright = min(xright, x)
elif a == 4:
ytop = min(ytop, y)
else:
ybottom = max(ybottom, y)
if xleft >= xright or ybottom >= ytop:
print(0)
else:
print((xright-xleft)*(ytop-ybottom))
|
[
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,
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,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
140,
2
],
[
140,
11
],
[
140,
12
],
[
110,
14
],
[
119,
17
],
[
126,
18
],
[
128,
20
],
[
122,
23
],
[
132,
24
],
[
27,
26
],
[
141,
29
],
[
149,
31
],
[
149,
40
],
[
149,
41
],
[
150,
44
],
[
113,
47
],
[
111,
50
],
[
114,
50
],
[
105,
51
],
[
150,
54
],
[
116,
57
],
[
120,
60
],
[
117,
60
],
[
105,
61
],
[
150,
64
],
[
137,
67
],
[
129,
70
],
[
138,
70
],
[
144,
71
],
[
150,
74
],
[
107,
77
],
[
123,
80
],
[
108,
80
],
[
144,
81
],
[
146,
83
],
[
117,
88
],
[
120,
88
],
[
114,
89
],
[
111,
89
],
[
134,
91
],
[
108,
96
],
[
123,
96
],
[
138,
97
],
[
129,
97
],
[
147,
101
],
[
135,
102
],
[
149,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
],
[
116,
117
],
[
126,
119
],
[
119,
120
],
[
132,
122
],
[
122,
123
],
[
140,
126
],
[
128,
129
],
[
140,
132
],
[
134,
135
],
[
137,
138
],
[
140,
141
],
[
149,
144
],
[
146,
147
],
[
149,
150
]
] |
[
"W,H,N = map(int,input().split())\nxl = 0\nxh = W\nyl = 0\nyh = H\nfor _ in range(N):\n x,y,a = map(int,input().split())\n if a==1:\n xl = max(xl,x)\n elif a==2:\n xh = min(xh,x)\n elif a==3:\n yl = max(yl,y)\n elif a==4:\n yh = min(yh,y)\ndx = max(0,xh-xl)\ndy = max(0,yh-yl)\nprint(dx*dy)",
"W,H,N = map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"xl = 0",
"xl",
"0",
"xh = W",
"xh",
"W",
"yl = 0",
"yl",
"0",
"yh = H",
"yh",
"H",
"for _ in range(N):\n x,y,a = map(int,input().split())\n if a==1:\n xl = max(xl,x)\n elif a==2:\n xh = min(xh,x)\n elif a==3:\n yl = max(yl,y)\n elif a==4:\n yh = min(yh,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 xl = max(xl,x)\n elif a==2:\n xh = min(xh,x)\n elif a==3:\n yl = max(yl,y)\n elif a==4:\n yh = min(yh,y)",
"a==1",
"a",
"1",
"xl = max(xl,x)",
"xl",
"max(xl,x)",
"max",
"xl",
"x",
"elif a==2:\n xh = min(xh,x)\n ",
"a==2",
"a",
"2",
"xh = min(xh,x)",
"xh",
"min(xh,x)",
"min",
"xh",
"x",
"elif a==3:\n yl = max(yl,y)\n ",
"a==3",
"a",
"3",
"yl = max(yl,y)",
"yl",
"max(yl,y)",
"max",
"yl",
"y",
"elif a==4:\n yh = min(yh,y)",
"a==4",
"a",
"4",
"yh = min(yh,y)",
"yh",
"min(yh,y)",
"min",
"yh",
"y",
"dx = max(0,xh-xl)",
"dx",
"max(0,xh-xl)",
"max",
"0",
"xh-xl",
"xh",
"xl",
"dy = max(0,yh-yl)",
"dy",
"max(0,yh-yl)",
"max",
"0",
"yh-yl",
"yh",
"yl",
"print(dx*dy)",
"print",
"dx*dy",
"dx",
"dy",
"x,y,a = map(int,input().split())",
"map(int,input().split())",
"x",
"yh = min(yh,y)",
"min(yh,y)",
"yh",
"xl = 0",
"0",
"xl",
"xl = max(xl,x)",
"max(xl,x)",
"xl",
"xh = min(xh,x)",
"min(xh,x)",
"xh",
"xh = W",
"W",
"xh",
"yh = H",
"H",
"yh",
"W,H,N = map(int,input().split())",
"map(int,input().split())",
"W",
"yl = 0",
"0",
"yl",
"H,N = map(int,input().split())",
"map(int,input().split())",
"H",
"dy = max(0,yh-yl)",
"max(0,yh-yl)",
"dy",
"yl = max(yl,y)",
"max(yl,y)",
"yl",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"y,a = map(int,input().split())",
"map(int,input().split())",
"y",
"dx = max(0,xh-xl)",
"max(0,xh-xl)",
"dx",
"a = map(int,input().split())",
"map(int,input().split())",
"a"
] |
W,H,N = map(int,input().split())
xl = 0
xh = W
yl = 0
yh = H
for _ in range(N):
x,y,a = map(int,input().split())
if a==1:
xl = max(xl,x)
elif a==2:
xh = min(xh,x)
elif a==3:
yl = max(yl,y)
elif a==4:
yh = min(yh,y)
dx = max(0,xh-xl)
dy = max(0,yh-yl)
print(dx*dy)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
17,
13,
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,
13,
18,
13,
17,
14,
2,
13,
17,
0,
18,
13,
17,
4,
13,
13,
18,
13,
17,
14,
2,
13,
17,
0,
18,
13,
17,
4,
13,
13,
18,
13,
17,
14,
2,
13,
17,
0,
18,
13,
17,
4,
13,
13,
18,
13,
17,
14,
2,
40,
2,
18,
13,
17,
18,
13,
17,
17,
40,
2,
18,
13,
17,
18,
13,
17,
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,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13
] |
[
[
146,
2
],
[
146,
11
],
[
146,
12
],
[
152,
14
],
[
22,
21
],
[
138,
24
],
[
149,
26
],
[
149,
35
],
[
149,
36
],
[
135,
39
],
[
45,
42
],
[
153,
43
],
[
144,
47
],
[
153,
49
],
[
135,
53
],
[
59,
56
],
[
153,
57
],
[
144,
61
],
[
153,
63
],
[
135,
67
],
[
73,
70
],
[
153,
71
],
[
150,
75
],
[
153,
77
],
[
135,
81
],
[
87,
84
],
[
153,
85
],
[
150,
89
],
[
153,
91
],
[
153,
98
],
[
153,
101
],
[
153,
107
],
[
153,
110
],
[
153,
121
],
[
153,
124
],
[
153,
128
],
[
153,
131
],
[
149,
135
],
[
146,
138
],
[
146,
141
],
[
149,
144
],
[
146,
147
],
[
149,
150
],
[
152,
153
]
] |
[
"w, h, n = map(int, input().split())\n\nwhite = [0, w, 0, h]\n\nfor i in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n white[0] = max(x, white[0])\n elif a == 2:\n white[1] = min(x, white[1])\n elif a == 3:\n white[2] = max(y, white[2])\n elif a == 4:\n white[3] = min(y, white[3])\nif white[1] - white[0] <= 0 or white[3] - white[2] <= 0:\n print(0)\nelse:\n print((white[1] - white[0]) * (white[3] - white[2]))",
"w, h, n = map(int, input().split())",
"w",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"white = [0, w, 0, h]",
"white",
"[0, w, 0, h]",
"0",
"w",
"0",
"h",
"for i in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n white[0] = max(x, white[0])\n elif a == 2:\n white[1] = min(x, white[1])\n elif a == 3:\n white[2] = max(y, white[2])\n elif a == 4:\n white[3] = min(y, white[3])",
"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 white[0] = max(x, white[0])\n elif a == 2:\n white[1] = min(x, white[1])\n elif a == 3:\n white[2] = max(y, white[2])\n elif a == 4:\n white[3] = min(y, white[3])",
"a == 1",
"a",
"1",
"white[0] = max(x, white[0])",
"white[0]",
"white",
"0",
"max(x, white[0])",
"max",
"x",
"white[0]",
"white",
"0",
"elif a == 2:\n white[1] = min(x, white[1])\n ",
"a == 2",
"a",
"2",
"white[1] = min(x, white[1])",
"white[1]",
"white",
"1",
"min(x, white[1])",
"min",
"x",
"white[1]",
"white",
"1",
"elif a == 3:\n white[2] = max(y, white[2])\n ",
"a == 3",
"a",
"3",
"white[2] = max(y, white[2])",
"white[2]",
"white",
"2",
"max(y, white[2])",
"max",
"y",
"white[2]",
"white",
"2",
"elif a == 4:\n white[3] = min(y, white[3])",
"a == 4",
"a",
"4",
"white[3] = min(y, white[3])",
"white[3]",
"white",
"3",
"min(y, white[3])",
"min",
"y",
"white[3]",
"white",
"3",
"if white[1] - white[0] <= 0 or white[3] - white[2] <= 0:\n print(0)\nelse:\n print((white[1] - white[0]) * (white[3] - white[2]))",
"white[1] - white[0] <= 0 or white[3] - white[2] <= 0",
"white[1] - white[0] <= 0",
"white[1] - white[0]",
"white[1]",
"white",
"1",
"white[0]",
"white",
"0",
"0",
"white[3] - white[2] <= 0",
"white[3] - white[2]",
"white[3]",
"white",
"3",
"white[2]",
"white",
"2",
"0",
"print(0)",
"print",
"0",
"print((white[1] - white[0]) * (white[3] - white[2]))",
"print",
"(white[1] - white[0]) * (white[3] - white[2])",
"white[1] - white[0]",
"white[1]",
"white",
"1",
"white[0]",
"white",
"0",
"white[3] - white[2]",
"white[3]",
"white",
"3",
"white[2]",
"white",
"2",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"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",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"white = [0, w, 0, h]",
"[0, w, 0, h]",
"white"
] |
w, h, n = map(int, input().split())
white = [0, w, 0, h]
for i in range(n):
x, y, a = map(int, input().split())
if a == 1:
white[0] = max(x, white[0])
elif a == 2:
white[1] = min(x, white[1])
elif a == 3:
white[2] = max(y, white[2])
elif a == 4:
white[3] = min(y, white[3])
if white[1] - white[0] <= 0 or white[3] - white[2] <= 0:
print(0)
else:
print((white[1] - white[0]) * (white[3] - white[2]))
|
[
7,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
13,
0,
13,
17,
0,
13,
13,
0,
13,
17,
0,
13,
13,
28,
13,
4,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
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,
2,
13,
13,
2,
13,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
17,
13,
10,
13,
13
] |
[
[
4,
3
],
[
3,
12
],
[
146,
14
],
[
146,
16
],
[
146,
17
],
[
149,
19
],
[
137,
22
],
[
141,
23
],
[
122,
25
],
[
128,
28
],
[
147,
29
],
[
32,
31
],
[
120,
34
],
[
38,
37
],
[
37,
46
],
[
152,
48
],
[
152,
50
],
[
152,
51
],
[
153,
54
],
[
116,
57
],
[
150,
60
],
[
117,
60
],
[
126,
61
],
[
153,
64
],
[
131,
67
],
[
138,
70
],
[
132,
70
],
[
126,
71
],
[
153,
74
],
[
134,
77
],
[
123,
80
],
[
135,
80
],
[
144,
81
],
[
153,
84
],
[
113,
87
],
[
129,
90
],
[
114,
90
],
[
144,
91
],
[
114,
95
],
[
129,
95
],
[
135,
96
],
[
123,
96
],
[
132,
98
],
[
138,
98
],
[
117,
99
],
[
150,
99
],
[
132,
107
],
[
138,
107
],
[
117,
108
],
[
150,
108
],
[
114,
110
],
[
129,
110
],
[
135,
111
],
[
123,
111
],
[
113,
114
],
[
116,
117
],
[
146,
120
],
[
122,
123
],
[
152,
126
],
[
147,
128
],
[
128,
129
],
[
131,
132
],
[
134,
135
],
[
141,
137
],
[
137,
138
],
[
146,
141
],
[
152,
144
],
[
146,
147
],
[
149,
150
],
[
152,
153
]
] |
[
"# https://atcoder.jp/contests/abc047/tasks/abc047_b\n\nw, h, n = [int(i) for i in input().split()]\n\nleft = 0\nright = w\nbottom = 0\ntop = h\n\nfor _ in range(n):\n x, y, a = [int(i) for i in input().split()]\n if a == 1:\n left = max(left, x)\n elif a == 2:\n right = min(right, x)\n elif a == 3:\n bottom = max(bottom, y)\n elif a == 4:\n top = min(top, y)\n\nif top <= bottom or right <= left:\n print(0)\nelse:\n print((right - left) * (top - bottom))",
"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",
"left = 0",
"left",
"0",
"right = w",
"right",
"w",
"bottom = 0",
"bottom",
"0",
"top = h",
"top",
"h",
"for _ in range(n):\n x, y, a = [int(i) for i in input().split()]\n if a == 1:\n left = max(left, x)\n elif a == 2:\n right = min(right, x)\n elif a == 3:\n bottom = max(bottom, y)\n elif a == 4:\n top = min(top, y)",
"_",
"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",
"if a == 1:\n left = max(left, x)\n elif a == 2:\n right = min(right, x)\n elif a == 3:\n bottom = max(bottom, y)\n elif a == 4:\n top = min(top, y)",
"a == 1",
"a",
"1",
"left = max(left, x)",
"left",
"max(left, x)",
"max",
"left",
"x",
"elif a == 2:\n right = min(right, x)\n ",
"a == 2",
"a",
"2",
"right = min(right, x)",
"right",
"min(right, x)",
"min",
"right",
"x",
"elif a == 3:\n bottom = max(bottom, y)\n ",
"a == 3",
"a",
"3",
"bottom = max(bottom, y)",
"bottom",
"max(bottom, y)",
"max",
"bottom",
"y",
"elif a == 4:\n top = min(top, y)",
"a == 4",
"a",
"4",
"top = min(top, y)",
"top",
"min(top, y)",
"min",
"top",
"y",
"if top <= bottom or right <= left:\n print(0)\nelse:\n print((right - left) * (top - bottom))",
"top <= bottom or right <= left",
"top <= bottom",
"top",
"bottom",
"right <= left",
"right",
"left",
"print(0)",
"print",
"0",
"print((right - left) * (top - bottom))",
"print",
"(right - left) * (top - bottom)",
"right - left",
"right",
"left",
"top - bottom",
"top",
"bottom",
"top = min(top, y)",
"min(top, y)",
"top",
"left = max(left, x)",
"max(left, x)",
"left",
"n = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"n",
"bottom = 0",
"0",
"bottom",
"x, y, a = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"x",
"top = h",
"h",
"top",
"right = min(right, x)",
"min(right, x)",
"right",
"bottom = max(bottom, y)",
"max(bottom, y)",
"bottom",
"right = w",
"w",
"right",
"w, h, n = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"w",
"y, a = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"y",
"h, n = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"h",
"left = 0",
"0",
"left",
"a = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"a"
] |
# https://atcoder.jp/contests/abc047/tasks/abc047_b
w, h, n = [int(i) for i in input().split()]
left = 0
right = w
bottom = 0
top = h
for _ in range(n):
x, y, a = [int(i) for i in input().split()]
if a == 1:
left = max(left, x)
elif a == 2:
right = min(right, x)
elif a == 3:
bottom = max(bottom, y)
elif a == 4:
top = min(top, y)
if top <= bottom or right <= left:
print(0)
else:
print((right - left) * (top - bottom))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
39,
17,
39,
13,
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,
2,
4,
13,
18,
13,
17,
4,
13,
18,
13,
17,
0,
13,
2,
4,
13,
18,
13,
17,
4,
13,
18,
13,
17,
14,
2,
40,
13,
17,
40,
13,
17,
4,
13,
17,
4,
13,
2,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] |
[
[
134,
2
],
[
134,
11
],
[
134,
12
],
[
119,
14
],
[
26,
25
],
[
135,
28
],
[
122,
30
],
[
122,
39
],
[
122,
40
],
[
114,
44
],
[
114,
47
],
[
120,
52
],
[
114,
54
],
[
111,
57
],
[
120,
61
],
[
114,
63
],
[
123,
66
],
[
125,
68
],
[
120,
73
],
[
120,
78
],
[
128,
81
],
[
120,
86
],
[
120,
91
],
[
126,
96
],
[
129,
99
],
[
126,
107
],
[
129,
108
],
[
122,
111
],
[
122,
114
],
[
134,
117
],
[
119,
120
],
[
122,
123
],
[
125,
126
],
[
128,
129
],
[
134,
132
],
[
134,
135
]
] |
[
"w, h, n = map(int, input().split())\na = [[0], [w], [0], [h]]\nfor _ in range(n):\n x, y, z = map(int, input().split())\n if z == 1 or z == 2:\n a[z-1].append(x)\n else:\n a[z-1].append(y)\n\ndx = min(a[1]) - max(a[0])\ndy = min(a[3]) - max(a[2])\n\nif dx <= 0 or dy <= 0:\n print(0)\nelse:\n print(dx * dy)",
"w, h, n = map(int, input().split())",
"w",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"a = [[0], [w], [0], [h]]",
"a",
"[[0], [w], [0], [h]]",
"[0]",
"0",
"[w]",
"w",
"[0]",
"0",
"[h]",
"h",
"for _ in range(n):\n x, y, z = map(int, input().split())\n if z == 1 or z == 2:\n a[z-1].append(x)\n else:\n a[z-1].append(y)",
"_",
"range(n)",
"range",
"n",
"x, y, z = map(int, input().split())",
"x",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y",
"z",
"if z == 1 or z == 2:\n a[z-1].append(x)\n else:\n a[z-1].append(y)",
"z == 1 or z == 2",
"z == 1",
"z",
"1",
"z == 2",
"z",
"2",
"a[z-1].append(x)",
"[z-1].append",
"[z-1]",
"a",
"z-1",
"z",
"1",
"append",
"x",
"a[z-1].append(y)",
"[z-1].append",
"[z-1]",
"a",
"z-1",
"z",
"1",
"append",
"y",
"dx = min(a[1]) - max(a[0])",
"dx",
"min(a[1]) - max(a[0])",
"min(a[1])",
"min",
"a[1]",
"a",
"1",
"max(a[0])",
"max",
"a[0]",
"a",
"0",
"dy = min(a[3]) - max(a[2])",
"dy",
"min(a[3]) - max(a[2])",
"min(a[3])",
"min",
"a[3]",
"a",
"3",
"max(a[2])",
"max",
"a[2]",
"a",
"2",
"if dx <= 0 or dy <= 0:\n print(0)\nelse:\n print(dx * dy)",
"dx <= 0 or dy <= 0",
"dx <= 0",
"dx",
"0",
"dy <= 0",
"dy",
"0",
"print(0)",
"print",
"0",
"print(dx * dy)",
"print",
"dx * dy",
"dx",
"dy",
"x, y, z = map(int, input().split())",
"map(int, input().split())",
"x",
"z = map(int, input().split())",
"map(int, input().split())",
"z",
"w, h, n = map(int, input().split())",
"map(int, input().split())",
"w",
"a = [[0], [w], [0], [h]]",
"[[0], [w], [0], [h]]",
"a",
"y, z = map(int, input().split())",
"map(int, input().split())",
"y",
"dx = min(a[1]) - max(a[0])",
"min(a[1]) - max(a[0])",
"dx",
"dy = min(a[3]) - max(a[2])",
"min(a[3]) - max(a[2])",
"dy",
"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())
a = [[0], [w], [0], [h]]
for _ in range(n):
x, y, z = map(int, input().split())
if z == 1 or z == 2:
a[z-1].append(x)
else:
a[z-1].append(y)
dx = min(a[1]) - max(a[0])
dy = min(a[3]) - max(a[2])
if dx <= 0 or dy <= 0:
print(0)
else:
print(dx * dy)
|
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
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,
2,
4,
13,
2,
13,
13,
17,
4,
13,
2,
13,
13,
17,
4,
13,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
123,
4
],
[
123,
13
],
[
123,
14
],
[
108,
16
],
[
108,
19
],
[
23,
22
],
[
112,
25
],
[
129,
27
],
[
129,
36
],
[
129,
37
],
[
106,
40
],
[
120,
43
],
[
100,
46
],
[
121,
46
],
[
130,
47
],
[
106,
50
],
[
102,
53
],
[
118,
56
],
[
103,
56
],
[
130,
57
],
[
106,
60
],
[
114,
63
],
[
109,
66
],
[
115,
66
],
[
94,
67
],
[
126,
69
],
[
124,
72
],
[
127,
72
],
[
94,
73
],
[
96,
75
],
[
103,
80
],
[
118,
80
],
[
121,
81
],
[
100,
81
],
[
127,
86
],
[
124,
86
],
[
115,
87
],
[
109,
87
],
[
97,
91
],
[
129,
94
],
[
96,
97
],
[
108,
100
],
[
102,
103
],
[
129,
106
],
[
108,
109
],
[
123,
112
],
[
114,
115
],
[
123,
118
],
[
120,
121
],
[
123,
124
],
[
126,
127
],
[
129,
130
]
] |
[
"import numpy as np\n\nW,H,N=map(int,input().split())\n\nX=Y=0\nfor i in range(N):\n x,y,a=map(int,input().split())\n\n if a==1:\n X=max(X,x)\n elif a==2:\n W=min(W,x)\n elif a==3:\n Y=max(Y,y)\n else:\n H=min(H,y)\n\nS=max((W-X),0)*max((H-Y),0)\n\nprint(S)",
"import numpy as np",
"numpy",
"W,H,N=map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"X=Y=0",
"X",
"0",
"=Y=0",
"Y",
"0",
"for i in range(N):\n x,y,a=map(int,input().split())\n\n if a==1:\n X=max(X,x)\n elif a==2:\n W=min(W,x)\n elif a==3:\n Y=max(Y,y)\n else:\n H=min(H,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 X=max(X,x)\n elif a==2:\n W=min(W,x)\n elif a==3:\n Y=max(Y,y)\n else:\n H=min(H,y)",
"a==1",
"a",
"1",
"X=max(X,x)",
"X",
"max(X,x)",
"max",
"X",
"x",
"elif a==2:\n W=min(W,x)\n ",
"a==2",
"a",
"2",
"W=min(W,x)",
"W",
"min(W,x)",
"min",
"W",
"x",
"elif a==3:\n Y=max(Y,y)\n ",
"a==3",
"a",
"3",
"Y=max(Y,y)",
"Y",
"max(Y,y)",
"max",
"Y",
"y",
"H=min(H,y)",
"H",
"min(H,y)",
"min",
"H",
"y",
"S=max((W-X),0)*max((H-Y),0)",
"S",
"max((W-X),0)*max((H-Y),0)",
"max((W-X),0)",
"max",
"W-X",
"W",
"X",
"0",
"max((H-Y),0)",
"max",
"H-Y",
"H",
"Y",
"0",
"print(S)",
"print",
"S",
"y,a=map(int,input().split())",
"map(int,input().split())",
"y",
"S=max((W-X),0)*max((H-Y),0)",
"max((W-X),0)*max((H-Y),0)",
"S",
"X=Y=0",
"0",
"X",
"W=min(W,x)",
"min(W,x)",
"W",
"a=map(int,input().split())",
"map(int,input().split())",
"a",
"Y=0",
"0",
"Y",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"Y=max(Y,y)",
"max(Y,y)",
"Y",
"W,H,N=map(int,input().split())",
"map(int,input().split())",
"W",
"X=max(X,x)",
"max(X,x)",
"X",
"H,N=map(int,input().split())",
"map(int,input().split())",
"H",
"H=min(H,y)",
"min(H,y)",
"H",
"x,y,a=map(int,input().split())",
"map(int,input().split())",
"x"
] |
import numpy as np
W,H,N=map(int,input().split())
X=Y=0
for i in range(N):
x,y,a=map(int,input().split())
if a==1:
X=max(X,x)
elif a==2:
W=min(W,x)
elif a==3:
Y=max(Y,y)
else:
H=min(H,y)
S=max((W-X),0)*max((H-Y),0)
print(S)
|
[
7,
15,
13,
15,
15,
13,
6,
13,
12,
13,
0,
13,
18,
13,
13,
13,
18,
13,
13,
0,
18,
13,
13,
4,
13,
18,
13,
13,
4,
13,
13,
4,
13,
4,
18,
18,
13,
13,
13,
17,
0,
13,
18,
4,
18,
18,
13,
13,
13,
39,
17,
0,
18,
13,
13,
13,
18,
13,
13,
13,
4,
18,
13,
13,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
0,
13,
17,
0,
13,
17,
4,
18,
13,
13,
13,
13,
23,
13,
12,
13,
0,
13,
17,
0,
13,
17,
4,
18,
13,
13,
13,
13,
23,
13,
12,
13,
0,
13,
17,
0,
13,
17,
4,
18,
13,
13,
13,
13,
23,
13,
18,
13,
13,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
4,
18,
13,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
28,
13,
4,
13,
13,
14,
2,
18,
18,
13,
13,
17,
17,
0,
13,
4,
13,
18,
18,
13,
13,
17,
13,
14,
2,
18,
18,
13,
13,
17,
17,
0,
13,
4,
13,
18,
18,
13,
13,
17,
13,
14,
2,
18,
18,
13,
13,
17,
17,
0,
13,
4,
13,
18,
18,
13,
13,
17,
13,
14,
2,
18,
18,
13,
13,
17,
17,
0,
13,
4,
13,
18,
18,
13,
13,
17,
13,
4,
13,
2,
4,
13,
2,
13,
13,
17,
4,
13,
2,
13,
13,
17,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
6,
13
] |
[
[
12,
11
],
[
16,
15
],
[
23,
20
],
[
11,
22
],
[
28,
25
],
[
15,
27
],
[
69,
30
],
[
20,
35
],
[
11,
37
],
[
42,
41
],
[
20,
45
],
[
11,
47
],
[
55,
52
],
[
11,
54
],
[
11,
55
],
[
59,
56
],
[
15,
58
],
[
15,
59
],
[
67,
62
],
[
41,
64
],
[
71,
65
],
[
67,
67
],
[
69,
69
],
[
71,
71
],
[
76,
75
],
[
79,
78
],
[
87,
82
],
[
9,
83
],
[
75,
84
],
[
78,
85
],
[
87,
87
],
[
92,
91
],
[
95,
94
],
[
103,
98
],
[
9,
99
],
[
91,
100
],
[
94,
101
],
[
103,
103
],
[
108,
107
],
[
111,
110
],
[
119,
114
],
[
9,
115
],
[
107,
116
],
[
110,
117
],
[
119,
119
],
[
127,
126
],
[
127,
135
],
[
127,
136
],
[
139,
138
],
[
142,
141
],
[
145,
144
],
[
148,
147
],
[
136,
150
],
[
138,
153
],
[
167,
166
],
[
136,
169
],
[
138,
174
],
[
166,
175
],
[
180,
179
],
[
138,
184
],
[
166,
185
],
[
141,
187
],
[
179,
187
],
[
138,
192
],
[
166,
193
],
[
198,
197
],
[
138,
202
],
[
166,
203
],
[
126,
205
],
[
197,
205
],
[
138,
210
],
[
166,
211
],
[
216,
215
],
[
138,
220
],
[
166,
221
],
[
144,
223
],
[
215,
223
],
[
138,
228
],
[
166,
229
],
[
234,
233
],
[
138,
238
],
[
166,
239
],
[
135,
241
],
[
233,
241
],
[
197,
248
],
[
126,
248
],
[
179,
249
],
[
141,
249
],
[
233,
254
],
[
135,
254
],
[
215,
255
],
[
144,
255
],
[
265,
262
]
] |
[
"#\n# abc047 b\n#\nimport sys\nfrom io import StringIO\nimport unittest\n\n\nclass TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n def test_入力例_1(self):\n input = \"\"\"5 4 2\n2 1 1\n3 3 4\"\"\"\n output = \"\"\"9\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_2(self):\n input = \"\"\"5 4 3\n2 1 1\n3 3 4\n1 4 2\"\"\"\n output = \"\"\"0\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_3(self):\n input = \"\"\"10 10 5\n1 6 1\n4 1 3\n6 9 4\n9 4 2\n3 1 3\"\"\"\n output = \"\"\"64\"\"\"\n self.assertIO(input, output)\n\n\ndef resolve():\n W, H, N = map(int, input().split())\n a = []\n ox = 0\n oy = 0\n for _ in range(N):\n a.append(list(map(int, input().split())))\n for i in range(N):\n if a[i][2] == 1:\n ox = max(a[i][0], ox)\n elif a[i][2] == 2:\n W = min(a[i][0], W)\n elif a[i][2] == 3:\n oy = max(a[i][1], oy)\n elif a[i][2] == 4:\n H = min(a[i][1], H)\n print(max(W-ox, 0)*max(H-oy, 0))\n\n\nif __name__ == \"__main__\":\n # unittest.main()\n resolve()",
"import sys",
"sys",
"from io import StringIO",
"import unittest",
"unittest",
"class TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n def test_入力例_1(self):\n input = \"\"\"5 4 2\n2 1 1\n3 3 4\"\"\"\n output = \"\"\"9\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_2(self):\n input = \"\"\"5 4 3\n2 1 1\n3 3 4\n1 4 2\"\"\"\n output = \"\"\"0\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_3(self):\n input = \"\"\"10 10 5\n1 6 1\n4 1 3\n6 9 4\n9 4 2\n3 1 3\"\"\"\n output = \"\"\"64\"\"\"\n self.assertIO(input, output)",
"TestClass",
"def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n ",
"assertIO",
"stdout, stdin = sys.stdout, sys.stdin",
"stdout",
"sys.stdout",
"sys",
"stdout",
"stdin",
"sys.stdin",
"sys",
"stdin",
"sys.stdout, sys.stdin = StringIO(), StringIO(input)",
"sys.stdout",
"sys",
"stdout",
"StringIO()",
"StringIO",
"sys.stdin",
"sys",
"stdin",
"StringIO(input)",
"StringIO",
"input",
"resolve()",
"resolve",
"sys.stdout.seek(0)",
"sys.stdout.seek",
"sys.stdout",
"sys",
"stdout",
"seek",
"0",
"out = sys.stdout.read()[:-1]",
"out",
"sys.stdout.read()[:-1]",
"sys.stdout.read()",
"sys.stdout.read",
"sys.stdout",
"sys",
"stdout",
"read",
":-1",
"-1",
"sys.stdout, sys.stdin = stdout, stdin",
"sys.stdout",
"sys",
"stdout",
"stdout",
"sys.stdin",
"sys",
"stdin",
"stdin",
"self.assertEqual(out, output)",
"self.assertEqual",
"self",
"assertEqual",
"out",
"output",
"self",
"self",
"input",
"input",
"output",
"output",
"def test_入力例_1(self):\n input = \"\"\"5 4 2\n2 1 1\n3 3 4\"\"\"\n output = \"\"\"9\"\"\"\n self.assertIO(input, output)\n\n ",
"test_入力例_1",
"input = \"\"\"5 4 2\n2 1 1\n3 3 4\"\"\"",
"input",
"\"\"\"5 4 2\n2 1 1\n3 3 4\"\"\"",
"output = \"\"\"9\"\"\"",
"output",
"\"\"\"9\"\"\"",
"self.assertIO(input, output)",
"self.assertIO",
"self",
"assertIO",
"input",
"output",
"self",
"self",
"def test_入力例_2(self):\n input = \"\"\"5 4 3\n2 1 1\n3 3 4\n1 4 2\"\"\"\n output = \"\"\"0\"\"\"\n self.assertIO(input, output)\n\n ",
"test_入力例_2",
"input = \"\"\"5 4 3\n2 1 1\n3 3 4\n1 4 2\"\"\"",
"input",
"\"\"\"5 4 3\n2 1 1\n3 3 4\n1 4 2\"\"\"",
"output = \"\"\"0\"\"\"",
"output",
"\"\"\"0\"\"\"",
"self.assertIO(input, output)",
"self.assertIO",
"self",
"assertIO",
"input",
"output",
"self",
"self",
"def test_入力例_3(self):\n input = \"\"\"10 10 5\n1 6 1\n4 1 3\n6 9 4\n9 4 2\n3 1 3\"\"\"\n output = \"\"\"64\"\"\"\n self.assertIO(input, output)",
"test_入力例_3",
"input = \"\"\"10 10 5\n1 6 1\n4 1 3\n6 9 4\n9 4 2\n3 1 3\"\"\"",
"input",
"\"\"\"10 10 5\n1 6 1\n4 1 3\n6 9 4\n9 4 2\n3 1 3\"\"\"",
"output = \"\"\"64\"\"\"",
"output",
"\"\"\"64\"\"\"",
"self.assertIO(input, output)",
"self.assertIO",
"self",
"assertIO",
"input",
"output",
"self",
"self",
"unittest.TestCase",
"unittest",
"TestCase",
"def resolve():\n W, H, N = map(int, input().split())\n a = []\n ox = 0\n oy = 0\n for _ in range(N):\n a.append(list(map(int, input().split())))\n for i in range(N):\n if a[i][2] == 1:\n ox = max(a[i][0], ox)\n elif a[i][2] == 2:\n W = min(a[i][0], W)\n elif a[i][2] == 3:\n oy = max(a[i][1], oy)\n elif a[i][2] == 4:\n H = min(a[i][1], H)\n print(max(W-ox, 0)*max(H-oy, 0))",
"resolve",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"a = []",
"a",
"[]",
"ox = 0",
"ox",
"0",
"oy = 0",
"oy",
"0",
"for _ in range(N):\n a.append(list(map(int, input().split())))\n ",
"_",
"range(N)",
"range",
"N",
"a.append(list(map(int, input().split())))",
"a.append",
"a",
"append",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in range(N):\n if a[i][2] == 1:\n ox = max(a[i][0], ox)\n elif a[i][2] == 2:\n W = min(a[i][0], W)\n elif a[i][2] == 3:\n oy = max(a[i][1], oy)\n elif a[i][2] == 4:\n H = min(a[i][1], H)\n ",
"i",
"range(N)",
"range",
"N",
"if a[i][2] == 1:\n ox = max(a[i][0], ox)\n elif a[i][2] == 2:\n W = min(a[i][0], W)\n elif a[i][2] == 3:\n oy = max(a[i][1], oy)\n elif a[i][2] == 4:\n H = min(a[i][1], H)\n ",
"a[i][2] == 1",
"a[i][2]",
"[i]",
"a",
"i",
"2",
"1",
"ox = max(a[i][0], ox)",
"ox",
"max(a[i][0], ox)",
"max",
"a[i][0]",
"[i]",
"a",
"i",
"0",
"ox",
"elif a[i][2] == 2:\n W = min(a[i][0], W)\n ",
"a[i][2] == 2",
"a[i][2]",
"[i]",
"a",
"i",
"2",
"2",
"W = min(a[i][0], W)",
"W",
"min(a[i][0], W)",
"min",
"a[i][0]",
"[i]",
"a",
"i",
"0",
"W",
"elif a[i][2] == 3:\n oy = max(a[i][1], oy)\n ",
"a[i][2] == 3",
"a[i][2]",
"[i]",
"a",
"i",
"2",
"3",
"oy = max(a[i][1], oy)",
"oy",
"max(a[i][1], oy)",
"max",
"a[i][1]",
"[i]",
"a",
"i",
"1",
"oy",
"elif a[i][2] == 4:\n H = min(a[i][1], H)\n ",
"a[i][2] == 4",
"a[i][2]",
"[i]",
"a",
"i",
"2",
"4",
"H = min(a[i][1], H)",
"H",
"min(a[i][1], H)",
"min",
"a[i][1]",
"[i]",
"a",
"i",
"1",
"H",
"print(max(W-ox, 0)*max(H-oy, 0))",
"print",
"max(W-ox, 0)*max(H-oy, 0)",
"max(W-ox, 0)",
"max",
"W-ox",
"W",
"ox",
"0",
"max(H-oy, 0)",
"max",
"H-oy",
"H",
"oy",
"0",
"if __name__ == \"__main__\":\n # unittest.main()\n resolve()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"resolve()",
"resolve",
"def resolve():\n W, H, N = map(int, input().split())\n a = []\n ox = 0\n oy = 0\n for _ in range(N):\n a.append(list(map(int, input().split())))\n for i in range(N):\n if a[i][2] == 1:\n ox = max(a[i][0], ox)\n elif a[i][2] == 2:\n W = min(a[i][0], W)\n elif a[i][2] == 3:\n oy = max(a[i][1], oy)\n elif a[i][2] == 4:\n H = min(a[i][1], H)\n print(max(W-ox, 0)*max(H-oy, 0))",
"def resolve():\n W, H, N = map(int, input().split())\n a = []\n ox = 0\n oy = 0\n for _ in range(N):\n a.append(list(map(int, input().split())))\n for i in range(N):\n if a[i][2] == 1:\n ox = max(a[i][0], ox)\n elif a[i][2] == 2:\n W = min(a[i][0], W)\n elif a[i][2] == 3:\n oy = max(a[i][1], oy)\n elif a[i][2] == 4:\n H = min(a[i][1], H)\n print(max(W-ox, 0)*max(H-oy, 0))",
"resolve",
"class TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n def test_入力例_1(self):\n input = \"\"\"5 4 2\n2 1 1\n3 3 4\"\"\"\n output = \"\"\"9\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_2(self):\n input = \"\"\"5 4 3\n2 1 1\n3 3 4\n1 4 2\"\"\"\n output = \"\"\"0\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_3(self):\n input = \"\"\"10 10 5\n1 6 1\n4 1 3\n6 9 4\n9 4 2\n3 1 3\"\"\"\n output = \"\"\"64\"\"\"\n self.assertIO(input, output)",
"class TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n def test_入力例_1(self):\n input = \"\"\"5 4 2\n2 1 1\n3 3 4\"\"\"\n output = \"\"\"9\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_2(self):\n input = \"\"\"5 4 3\n2 1 1\n3 3 4\n1 4 2\"\"\"\n output = \"\"\"0\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_3(self):\n input = \"\"\"10 10 5\n1 6 1\n4 1 3\n6 9 4\n9 4 2\n3 1 3\"\"\"\n output = \"\"\"64\"\"\"\n self.assertIO(input, output)",
"TestClass"
] |
#
# abc047 b
#
import sys
from io import StringIO
import unittest
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.seek(0)
out = sys.stdout.read()[:-1]
sys.stdout, sys.stdin = stdout, stdin
self.assertEqual(out, output)
def test_入力例_1(self):
input = """5 4 2
2 1 1
3 3 4"""
output = """9"""
self.assertIO(input, output)
def test_入力例_2(self):
input = """5 4 3
2 1 1
3 3 4
1 4 2"""
output = """0"""
self.assertIO(input, output)
def test_入力例_3(self):
input = """10 10 5
1 6 1
4 1 3
6 9 4
9 4 2
3 1 3"""
output = """64"""
self.assertIO(input, output)
def resolve():
W, H, N = map(int, input().split())
a = []
ox = 0
oy = 0
for _ in range(N):
a.append(list(map(int, input().split())))
for i in range(N):
if a[i][2] == 1:
ox = max(a[i][0], ox)
elif a[i][2] == 2:
W = min(a[i][0], W)
elif a[i][2] == 3:
oy = max(a[i][1], oy)
elif a[i][2] == 4:
H = min(a[i][1], H)
print(max(W-ox, 0)*max(H-oy, 0))
if __name__ == "__main__":
# unittest.main()
resolve()
|
[
7,
12,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
4,
13,
2,
13,
17,
0,
13,
4,
13,
4,
13,
2,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
41,
28,
13,
13,
40,
13,
13,
4,
13,
0,
13,
13,
14,
2,
13,
17,
41,
28,
13,
13,
40,
13,
13,
4,
13,
0,
13,
13,
14,
2,
13,
17,
41,
28,
13,
13,
40,
13,
13,
4,
13,
0,
13,
13,
14,
2,
13,
17,
41,
28,
13,
13,
40,
13,
13,
4,
13,
0,
13,
13,
0,
13,
2,
4,
13,
13,
17,
0,
13,
2,
4,
13,
13,
17,
14,
2,
40,
13,
17,
40,
13,
17,
0,
13,
2,
13,
13,
4,
13,
13,
4,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
5,
15
],
[
5,
16
],
[
19,
18
],
[
4,
24
],
[
28,
27
],
[
15,
33
],
[
37,
36
],
[
16,
39
],
[
42,
41
],
[
42,
52
],
[
42,
53
],
[
53,
56
],
[
61,
60
],
[
18,
60
],
[
84,
60
],
[
68,
60
],
[
60,
63
],
[
41,
64
],
[
60,
66
],
[
69,
68
],
[
53,
72
],
[
77,
76
],
[
18,
76
],
[
84,
76
],
[
68,
76
],
[
76,
79
],
[
41,
80
],
[
76,
82
],
[
85,
84
],
[
53,
88
],
[
93,
92
],
[
27,
92
],
[
116,
92
],
[
100,
92
],
[
92,
95
],
[
52,
96
],
[
92,
98
],
[
101,
100
],
[
53,
104
],
[
109,
108
],
[
27,
108
],
[
116,
108
],
[
100,
108
],
[
108,
111
],
[
52,
112
],
[
108,
114
],
[
117,
116
],
[
120,
119
],
[
84,
123
],
[
68,
123
],
[
18,
123
],
[
127,
126
],
[
116,
130
],
[
100,
130
],
[
27,
130
],
[
119,
135
],
[
126,
138
],
[
142,
141
],
[
119,
143
],
[
126,
144
],
[
141,
147
],
[
155,
152
]
] |
[
"def resolve():\n W, H, N = list(map(int, input().split()))\n # (0,0)(W,H)を含む交点のx,y座標リスト\n white_W_list = list(range(W+1))\n white_H_list = list(range(H+1))\n for i in range(N):\n x, y, a = list(map(int, input().split()))\n if a == 1:\n white_W_list = [j for j in white_W_list if j >= x]\n elif a == 2:\n white_W_list = [j for j in white_W_list if j <= x]\n elif a == 3:\n white_H_list = [j for j in white_H_list if j >= y]\n elif a == 4:\n white_H_list = [j for j in white_H_list if j <= y]\n width = len(white_W_list) - 1\n length = len(white_H_list) - 1\n if width >= 1 and length >= 1:\n area = width * length\n print(area)\n else:\n print(0)\n\nresolve()",
"def resolve():\n W, H, N = list(map(int, input().split()))\n # (0,0)(W,H)を含む交点のx,y座標リスト\n white_W_list = list(range(W+1))\n white_H_list = list(range(H+1))\n for i in range(N):\n x, y, a = list(map(int, input().split()))\n if a == 1:\n white_W_list = [j for j in white_W_list if j >= x]\n elif a == 2:\n white_W_list = [j for j in white_W_list if j <= x]\n elif a == 3:\n white_H_list = [j for j in white_H_list if j >= y]\n elif a == 4:\n white_H_list = [j for j in white_H_list if j <= y]\n width = len(white_W_list) - 1\n length = len(white_H_list) - 1\n if width >= 1 and length >= 1:\n area = width * length\n print(area)\n else:\n print(0)",
"resolve",
"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",
"white_W_list = list(range(W+1))",
"white_W_list",
"list(range(W+1))",
"list",
"range(W+1)",
"range",
"W+1",
"W",
"1",
"white_H_list = list(range(H+1))",
"white_H_list",
"list(range(H+1))",
"list",
"range(H+1)",
"range",
"H+1",
"H",
"1",
"for i in range(N):\n x, y, a = list(map(int, input().split()))\n if a == 1:\n white_W_list = [j for j in white_W_list if j >= x]\n elif a == 2:\n white_W_list = [j for j in white_W_list if j <= x]\n elif a == 3:\n white_H_list = [j for j in white_H_list if j >= y]\n elif a == 4:\n white_H_list = [j for j in white_H_list if j <= y]\n ",
"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 white_W_list = [j for j in white_W_list if j >= x]\n elif a == 2:\n white_W_list = [j for j in white_W_list if j <= x]\n elif a == 3:\n white_H_list = [j for j in white_H_list if j >= y]\n elif a == 4:\n white_H_list = [j for j in white_H_list if j <= y]\n ",
"a == 1",
"a",
"1",
"j for j in white_W_list if j >= x",
"for j in white_W_list if j >= x",
"j",
"white_W_list",
"j >= x",
"j",
"x",
"if j >= x",
"j",
"white_W_list = [j for j in white_W_list if j >= x]",
"white_W_list",
"[j for j in white_W_list if j >= x]",
"elif a == 2:\n white_W_list = [j for j in white_W_list if j <= x]\n ",
"a == 2",
"a",
"2",
"j for j in white_W_list if j <= x",
"for j in white_W_list if j <= x",
"j",
"white_W_list",
"j <= x",
"j",
"x",
"if j <= x",
"j",
"white_W_list = [j for j in white_W_list if j <= x]",
"white_W_list",
"[j for j in white_W_list if j <= x]",
"elif a == 3:\n white_H_list = [j for j in white_H_list if j >= y]\n ",
"a == 3",
"a",
"3",
"j for j in white_H_list if j >= y",
"for j in white_H_list if j >= y",
"j",
"white_H_list",
"j >= y",
"j",
"y",
"if j >= y",
"j",
"white_H_list = [j for j in white_H_list if j >= y]",
"white_H_list",
"[j for j in white_H_list if j >= y]",
"elif a == 4:\n white_H_list = [j for j in white_H_list if j <= y]\n ",
"a == 4",
"a",
"4",
"j for j in white_H_list if j <= y",
"for j in white_H_list if j <= y",
"j",
"white_H_list",
"j <= y",
"j",
"y",
"if j <= y",
"j",
"white_H_list = [j for j in white_H_list if j <= y]",
"white_H_list",
"[j for j in white_H_list if j <= y]",
"width = len(white_W_list) - 1",
"width",
"len(white_W_list) - 1",
"len(white_W_list)",
"len",
"white_W_list",
"1",
"length = len(white_H_list) - 1",
"length",
"len(white_H_list) - 1",
"len(white_H_list)",
"len",
"white_H_list",
"1",
"if width >= 1 and length >= 1:\n area = width * length\n print(area)\n else:\n print(0)",
"width >= 1 and length >= 1",
"width >= 1",
"width",
"1",
"length >= 1",
"length",
"1",
"area = width * length",
"area",
"width * length",
"width",
"length",
"print(area)",
"print",
"area",
"print(0)",
"print",
"0",
"resolve()",
"resolve",
"def resolve():\n W, H, N = list(map(int, input().split()))\n # (0,0)(W,H)を含む交点のx,y座標リスト\n white_W_list = list(range(W+1))\n white_H_list = list(range(H+1))\n for i in range(N):\n x, y, a = list(map(int, input().split()))\n if a == 1:\n white_W_list = [j for j in white_W_list if j >= x]\n elif a == 2:\n white_W_list = [j for j in white_W_list if j <= x]\n elif a == 3:\n white_H_list = [j for j in white_H_list if j >= y]\n elif a == 4:\n white_H_list = [j for j in white_H_list if j <= y]\n width = len(white_W_list) - 1\n length = len(white_H_list) - 1\n if width >= 1 and length >= 1:\n area = width * length\n print(area)\n else:\n print(0)",
"def resolve():\n W, H, N = list(map(int, input().split()))\n # (0,0)(W,H)を含む交点のx,y座標リスト\n white_W_list = list(range(W+1))\n white_H_list = list(range(H+1))\n for i in range(N):\n x, y, a = list(map(int, input().split()))\n if a == 1:\n white_W_list = [j for j in white_W_list if j >= x]\n elif a == 2:\n white_W_list = [j for j in white_W_list if j <= x]\n elif a == 3:\n white_H_list = [j for j in white_H_list if j >= y]\n elif a == 4:\n white_H_list = [j for j in white_H_list if j <= y]\n width = len(white_W_list) - 1\n length = len(white_H_list) - 1\n if width >= 1 and length >= 1:\n area = width * length\n print(area)\n else:\n print(0)",
"resolve"
] |
def resolve():
W, H, N = list(map(int, input().split()))
# (0,0)(W,H)を含む交点のx,y座標リスト
white_W_list = list(range(W+1))
white_H_list = list(range(H+1))
for i in range(N):
x, y, a = list(map(int, input().split()))
if a == 1:
white_W_list = [j for j in white_W_list if j >= x]
elif a == 2:
white_W_list = [j for j in white_W_list if j <= x]
elif a == 3:
white_H_list = [j for j in white_H_list if j >= y]
elif a == 4:
white_H_list = [j for j in white_H_list if j <= y]
width = len(white_W_list) - 1
length = len(white_H_list) - 1
if width >= 1 and length >= 1:
area = width * length
print(area)
else:
print(0)
resolve()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
17,
17,
0,
13,
39,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
14,
2,
18,
13,
17,
13,
0,
18,
13,
17,
13,
14,
2,
13,
17,
14,
2,
18,
13,
17,
13,
0,
18,
13,
17,
13,
14,
2,
13,
17,
14,
2,
18,
13,
17,
13,
0,
18,
13,
17,
13,
14,
2,
18,
13,
17,
13,
0,
18,
13,
17,
13,
0,
13,
2,
4,
13,
17,
2,
18,
13,
17,
18,
13,
17,
4,
13,
17,
2,
18,
13,
17,
18,
13,
17,
4,
13,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
2,
13
] |
[
[
138,
2
],
[
138,
11
],
[
138,
12
],
[
123,
14
],
[
141,
19
],
[
25,
24
],
[
133,
27
],
[
144,
29
],
[
144,
38
],
[
144,
39
],
[
127,
42
],
[
124,
47
],
[
145,
49
],
[
54,
51
],
[
124,
52
],
[
145,
54
],
[
127,
57
],
[
142,
62
],
[
145,
64
],
[
69,
66
],
[
142,
67
],
[
145,
69
],
[
127,
72
],
[
124,
77
],
[
130,
79
],
[
84,
81
],
[
124,
82
],
[
130,
84
],
[
142,
88
],
[
130,
90
],
[
95,
92
],
[
142,
93
],
[
130,
95
],
[
147,
97
],
[
142,
104
],
[
124,
107
],
[
142,
114
],
[
124,
117
],
[
148,
121
],
[
123,
124
],
[
144,
127
],
[
144,
130
],
[
138,
133
],
[
138,
136
],
[
138,
139
],
[
141,
142
],
[
144,
145
],
[
147,
148
]
] |
[
"w, h, n = map(int, input().split())\nb = [0, 0]\nc = [w, h]\nfor _ in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n if b[0] < x:\n b[0] = x\n elif a == 2:\n if c[0] > x:\n c[0] = x\n elif a == 3:\n if b[1] < y:\n b[1] = y\n else:\n if c[1] > y:\n c[1] = y\nd = max(0, (c[0] - b[0])) * max(0, (c[1] - b[1]))\nprint(d)",
"w, h, n = map(int, input().split())",
"w",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"b = [0, 0]",
"b",
"[0, 0]",
"0",
"0",
"c = [w, h]",
"c",
"[w, h]",
"w",
"h",
"for _ in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n if b[0] < x:\n b[0] = x\n elif a == 2:\n if c[0] > x:\n c[0] = x\n elif a == 3:\n if b[1] < y:\n b[1] = y\n else:\n if c[1] > y:\n c[1] = 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 if b[0] < x:\n b[0] = x\n elif a == 2:\n if c[0] > x:\n c[0] = x\n elif a == 3:\n if b[1] < y:\n b[1] = y\n else:\n if c[1] > y:\n c[1] = y",
"a == 1",
"a",
"1",
"if b[0] < x:\n b[0] = x\n ",
"b[0] < x",
"b[0]",
"b",
"0",
"x",
"b[0] = x",
"b[0]",
"b",
"0",
"x",
"elif a == 2:\n if c[0] > x:\n c[0] = x\n ",
"a == 2",
"a",
"2",
"if c[0] > x:\n c[0] = x\n ",
"c[0] > x",
"c[0]",
"c",
"0",
"x",
"c[0] = x",
"c[0]",
"c",
"0",
"x",
"elif a == 3:\n if b[1] < y:\n b[1] = y\n ",
"a == 3",
"a",
"3",
"if b[1] < y:\n b[1] = y\n ",
"b[1] < y",
"b[1]",
"b",
"1",
"y",
"b[1] = y",
"b[1]",
"b",
"1",
"y",
"if c[1] > y:\n c[1] = y",
"c[1] > y",
"c[1]",
"c",
"1",
"y",
"c[1] = y",
"c[1]",
"c",
"1",
"y",
"d = max(0, (c[0] - b[0])) * max(0, (c[1] - b[1]))",
"d",
"max(0, (c[0] - b[0])) * max(0, (c[1] - b[1]))",
"max(0, (c[0] - b[0]))",
"max",
"0",
"c[0] - b[0]",
"c[0]",
"c",
"0",
"b[0]",
"b",
"0",
"max(0, (c[1] - b[1]))",
"max",
"0",
"c[1] - b[1]",
"c[1]",
"c",
"1",
"b[1]",
"b",
"1",
"print(d)",
"print",
"d",
"b = [0, 0]",
"[0, 0]",
"b",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"w, h, n = map(int, input().split())",
"map(int, input().split())",
"w",
"h, n = map(int, input().split())",
"map(int, input().split())",
"h",
"c = [w, h]",
"[w, h]",
"c",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"d = max(0, (c[0] - b[0])) * max(0, (c[1] - b[1]))",
"max(0, (c[0] - b[0])) * max(0, (c[1] - b[1]))",
"d"
] |
w, h, n = map(int, input().split())
b = [0, 0]
c = [w, h]
for _ in range(n):
x, y, a = map(int, input().split())
if a == 1:
if b[0] < x:
b[0] = x
elif a == 2:
if c[0] > x:
c[0] = x
elif a == 3:
if b[1] < y:
b[1] = y
else:
if c[1] > y:
c[1] = y
d = max(0, (c[0] - b[0])) * max(0, (c[1] - b[1]))
print(d)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
13,
0,
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,
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,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
13,
0,
18,
18,
13,
13,
13,
17,
4,
13,
4,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13
] |
[
[
140,
2
],
[
140,
11
],
[
140,
12
],
[
16,
15
],
[
141,
18
],
[
146,
22
],
[
26,
25
],
[
135,
28
],
[
149,
30
],
[
149,
39
],
[
149,
40
],
[
138,
43
],
[
47,
46
],
[
144,
49
],
[
52,
51
],
[
132,
54
],
[
61,
56
],
[
147,
58
],
[
46,
59
],
[
51,
60
],
[
138,
64
],
[
68,
67
],
[
144,
70
],
[
141,
71
],
[
74,
73
],
[
132,
76
],
[
83,
78
],
[
147,
80
],
[
67,
81
],
[
73,
82
],
[
138,
86
],
[
90,
89
],
[
141,
92
],
[
95,
94
],
[
150,
97
],
[
104,
99
],
[
147,
101
],
[
89,
102
],
[
94,
103
],
[
107,
106
],
[
141,
109
],
[
112,
111
],
[
150,
114
],
[
132,
115
],
[
122,
117
],
[
147,
119
],
[
106,
120
],
[
111,
121
],
[
144,
129
],
[
140,
132
],
[
140,
135
],
[
149,
138
],
[
140,
141
],
[
149,
144
],
[
146,
147
],
[
149,
150
]
] |
[
"W,H,N=map(int,input().split())\nwhite=[[1 for _ in range(H)] for _ in range(W)]\n\nfor i in range(N):\n x,y,a=map(int,input().split())\n if a==1:\n for i in range(x):\n for j in range(H):\n white[i][j]=0\n elif a==2:\n for i in range(x,W):\n for j in range(H):\n white[i][j]=0\n elif a==3:\n for i in range(W):\n for j in range(y):\n white[i][j]=0\n else:\n for i in range(W):\n for j in range(y,H):\n white[i][j]=0\nprint(sum(sum(x) for x in white))",
"W,H,N=map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"[1 for _ in range(H)] for _ in range(W)",
"for _ in range(W)",
"_",
"range(W)",
"range",
"W",
"for _ in range(W)",
"[1 for _ in range(H)]",
"white=[[1 for _ in range(H)] for _ in range(W)]",
"white",
"[[1 for _ in range(H)] for _ in range(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 for j in range(H):\n white[i][j]=0\n elif a==2:\n for i in range(x,W):\n for j in range(H):\n white[i][j]=0\n elif a==3:\n for i in range(W):\n for j in range(y):\n white[i][j]=0\n else:\n for i in range(W):\n for j in range(y,H):\n white[i][j]=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 for j in range(H):\n white[i][j]=0\n elif a==2:\n for i in range(x,W):\n for j in range(H):\n white[i][j]=0\n elif a==3:\n for i in range(W):\n for j in range(y):\n white[i][j]=0\n else:\n for i in range(W):\n for j in range(y,H):\n white[i][j]=0",
"a==1",
"a",
"1",
"for i in range(x):\n for j in range(H):\n white[i][j]=0\n ",
"i",
"range(x)",
"range",
"x",
"for j in range(H):\n white[i][j]=0\n ",
"j",
"range(H)",
"range",
"H",
"white[i][j]=0",
"white[i][j]",
"[i]",
"white",
"i",
"j",
"0",
"elif a==2:\n for i in range(x,W):\n for j in range(H):\n white[i][j]=0\n ",
"a==2",
"a",
"2",
"for i in range(x,W):\n for j in range(H):\n white[i][j]=0\n ",
"i",
"range(x,W)",
"range",
"x",
"W",
"for j in range(H):\n white[i][j]=0\n ",
"j",
"range(H)",
"range",
"H",
"white[i][j]=0",
"white[i][j]",
"[i]",
"white",
"i",
"j",
"0",
"elif a==3:\n for i in range(W):\n for j in range(y):\n white[i][j]=0\n ",
"a==3",
"a",
"3",
"for i in range(W):\n for j in range(y):\n white[i][j]=0\n ",
"i",
"range(W)",
"range",
"W",
"for j in range(y):\n white[i][j]=0\n ",
"j",
"range(y)",
"range",
"y",
"white[i][j]=0",
"white[i][j]",
"[i]",
"white",
"i",
"j",
"0",
"for i in range(W):\n for j in range(y,H):\n white[i][j]=0",
"i",
"range(W)",
"range",
"W",
"for j in range(y,H):\n white[i][j]=0",
"j",
"range(y,H)",
"range",
"y",
"H",
"white[i][j]=0",
"white[i][j]",
"[i]",
"white",
"i",
"j",
"0",
"print(sum(sum(x) for x in white))",
"print",
"sum(sum(x) for x in white)",
"sum",
"sum(x)",
"sum",
"x",
"H,N=map(int,input().split())",
"map(int,input().split())",
"H",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"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",
"white=[[1 for _ in range(H)] for _ in range(W)]",
"[[1 for _ in range(H)] for _ in range(W)]",
"white",
"y,a=map(int,input().split())",
"map(int,input().split())",
"y"
] |
W,H,N=map(int,input().split())
white=[[1 for _ in range(H)] for _ in range(W)]
for i in range(N):
x,y,a=map(int,input().split())
if a==1:
for i in range(x):
for j in range(H):
white[i][j]=0
elif a==2:
for i in range(x,W):
for j in range(H):
white[i][j]=0
elif a==3:
for i in range(W):
for j in range(y):
white[i][j]=0
else:
for i in range(W):
for j in range(y,H):
white[i][j]=0
print(sum(sum(x) for x in white))
|
[
7,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
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,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
0,
13,
2,
4,
13,
2,
13,
13,
17,
4,
13,
2,
13,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
5,
13
],
[
5,
14
],
[
17,
16
],
[
20,
19
],
[
23,
22
],
[
14,
25
],
[
28,
27
],
[
28,
36
],
[
28,
37
],
[
37,
40
],
[
44,
43
],
[
16,
46
],
[
43,
46
],
[
27,
47
],
[
37,
50
],
[
54,
53
],
[
4,
56
],
[
53,
56
],
[
27,
57
],
[
37,
60
],
[
64,
63
],
[
19,
66
],
[
63,
66
],
[
36,
67
],
[
37,
70
],
[
74,
73
],
[
13,
76
],
[
73,
76
],
[
36,
77
],
[
80,
79
],
[
53,
84
],
[
4,
84
],
[
43,
85
],
[
16,
85
],
[
73,
90
],
[
13,
90
],
[
63,
91
],
[
19,
91
],
[
79,
95
],
[
104,
101
]
] |
[
"def main():\n W,H,N = map(int,input().split())\n X = 0 #a=1初期値\n Y = 0 #a=3初期値\n for _ in range(N):\n x,y,a = map(int,input().split())\n if a == 1:\n X = max(X,x)\n elif a == 2:\n W = min(W,x)\n elif a == 3:\n Y = max(Y,y)\n elif a == 4:\n H = min(H,y)\n #Sを求める\n S = max((W-X),0) * max((H-Y),0)\n print(S)\nif __name__ == '__main__':\n main()\n",
"def main():\n W,H,N = map(int,input().split())\n X = 0 #a=1初期値\n Y = 0 #a=3初期値\n for _ in range(N):\n x,y,a = map(int,input().split())\n if a == 1:\n X = max(X,x)\n elif a == 2:\n W = min(W,x)\n elif a == 3:\n Y = max(Y,y)\n elif a == 4:\n H = min(H,y)\n #Sを求める\n S = max((W-X),0) * max((H-Y),0)\n print(S)",
"main",
"W,H,N = map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"X = 0",
"X",
"0",
"Y = 0",
"Y",
"0",
"for _ in range(N):\n x,y,a = map(int,input().split())\n if a == 1:\n X = max(X,x)\n elif a == 2:\n W = min(W,x)\n elif a == 3:\n Y = max(Y,y)\n elif a == 4:\n H = min(H,y)\n #Sを求める\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",
"if a == 1:\n X = max(X,x)\n elif a == 2:\n W = min(W,x)\n elif a == 3:\n Y = max(Y,y)\n elif a == 4:\n H = min(H,y)\n #Sを求める\n ",
"a == 1",
"a",
"1",
"X = max(X,x)",
"X",
"max(X,x)",
"max",
"X",
"x",
"elif a == 2:\n W = min(W,x)\n ",
"a == 2",
"a",
"2",
"W = min(W,x)",
"W",
"min(W,x)",
"min",
"W",
"x",
"elif a == 3:\n Y = max(Y,y)\n ",
"a == 3",
"a",
"3",
"Y = max(Y,y)",
"Y",
"max(Y,y)",
"max",
"Y",
"y",
"elif a == 4:\n H = min(H,y)\n #Sを求める\n ",
"a == 4",
"a",
"4",
"H = min(H,y)",
"H",
"min(H,y)",
"min",
"H",
"y",
"S = max((W-X),0) * max((H-Y),0)",
"S",
"max((W-X),0) * max((H-Y),0)",
"max((W-X),0)",
"max",
"W-X",
"W",
"X",
"0",
"max((H-Y),0)",
"max",
"H-Y",
"H",
"Y",
"0",
"print(S)",
"print",
"S",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n W,H,N = map(int,input().split())\n X = 0 #a=1初期値\n Y = 0 #a=3初期値\n for _ in range(N):\n x,y,a = map(int,input().split())\n if a == 1:\n X = max(X,x)\n elif a == 2:\n W = min(W,x)\n elif a == 3:\n Y = max(Y,y)\n elif a == 4:\n H = min(H,y)\n #Sを求める\n S = max((W-X),0) * max((H-Y),0)\n print(S)",
"def main():\n W,H,N = map(int,input().split())\n X = 0 #a=1初期値\n Y = 0 #a=3初期値\n for _ in range(N):\n x,y,a = map(int,input().split())\n if a == 1:\n X = max(X,x)\n elif a == 2:\n W = min(W,x)\n elif a == 3:\n Y = max(Y,y)\n elif a == 4:\n H = min(H,y)\n #Sを求める\n S = max((W-X),0) * max((H-Y),0)\n print(S)",
"main"
] |
def main():
W,H,N = map(int,input().split())
X = 0 #a=1初期値
Y = 0 #a=3初期値
for _ in range(N):
x,y,a = map(int,input().split())
if a == 1:
X = max(X,x)
elif a == 2:
W = min(W,x)
elif a == 3:
Y = max(Y,y)
elif a == 4:
H = min(H,y)
#Sを求める
S = max((W-X),0) * max((H-Y),0)
print(S)
if __name__ == '__main__':
main()
|
[
7,
15,
13,
4,
18,
13,
13,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
2,
17,
17,
12,
13,
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,
0,
13,
4,
13,
13,
13,
0,
13,
2,
4,
13,
17,
2,
13,
13,
4,
13,
17,
2,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
2,
13,
10,
2,
13,
10,
12,
13
] |
[
[
124,
9
],
[
121,
16
],
[
24,
23
],
[
24,
32
],
[
24,
33
],
[
36,
35
],
[
38,
37
],
[
23,
38
],
[
40,
39
],
[
42,
41
],
[
32,
42
],
[
45,
44
],
[
33,
47
],
[
50,
49
],
[
50,
58
],
[
50,
59
],
[
59,
62
],
[
66,
65
],
[
35,
68
],
[
65,
68
],
[
49,
69
],
[
59,
72
],
[
76,
75
],
[
37,
78
],
[
75,
78
],
[
49,
79
],
[
59,
82
],
[
86,
85
],
[
39,
88
],
[
85,
88
],
[
58,
89
],
[
92,
91
],
[
41,
94
],
[
91,
94
],
[
58,
95
],
[
98,
97
],
[
75,
103
],
[
37,
103
],
[
65,
104
],
[
35,
104
],
[
91,
109
],
[
41,
109
],
[
85,
110
],
[
39,
110
],
[
97,
113
],
[
128,
119
],
[
121,
122
],
[
124,
125
]
] |
[
"import sys\nsys.setrecursionlimit(10000000)\nMOD = 10 ** 9 + 7\nINF = 10 ** 15\n\ndef main():\n W,H,N = map(int,input().split())\n lx,rx,ly,ry = 0,W,0,H\n for _ in range(N):\n x,y,a = map(int,input().split())\n if a == 1:\n lx = max(lx,x)\n elif a == 2:\n rx = min(rx,x)\n elif a == 3:\n ly = max(ly,y)\n else:\n ry = min(ry,y)\n ans = max(0,rx - lx) * max(0,ry - ly)\n print(ans)\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"sys.setrecursionlimit(10000000)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10000000",
"MOD = 10 ** 9 + 7",
"MOD",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"INF = 10 ** 15",
"INF",
"10 ** 15",
"10",
"15",
"def main():\n W,H,N = map(int,input().split())\n lx,rx,ly,ry = 0,W,0,H\n for _ in range(N):\n x,y,a = map(int,input().split())\n if a == 1:\n lx = max(lx,x)\n elif a == 2:\n rx = min(rx,x)\n elif a == 3:\n ly = max(ly,y)\n else:\n ry = min(ry,y)\n ans = max(0,rx - lx) * max(0,ry - ly)\n print(ans)",
"main",
"W,H,N = map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"lx,rx,ly,ry = 0,W,0,H",
"lx",
"0",
"rx",
"W",
"ly",
"0",
"ry",
"H",
"for _ in range(N):\n x,y,a = map(int,input().split())\n if a == 1:\n lx = max(lx,x)\n elif a == 2:\n rx = min(rx,x)\n elif a == 3:\n ly = max(ly,y)\n else:\n ry = min(ry,y)\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",
"if a == 1:\n lx = max(lx,x)\n elif a == 2:\n rx = min(rx,x)\n elif a == 3:\n ly = max(ly,y)\n else:\n ry = min(ry,y)\n ",
"a == 1",
"a",
"1",
"lx = max(lx,x)",
"lx",
"max(lx,x)",
"max",
"lx",
"x",
"elif a == 2:\n rx = min(rx,x)\n ",
"a == 2",
"a",
"2",
"rx = min(rx,x)",
"rx",
"min(rx,x)",
"min",
"rx",
"x",
"elif a == 3:\n ly = max(ly,y)\n ",
"a == 3",
"a",
"3",
"ly = max(ly,y)",
"ly",
"max(ly,y)",
"max",
"ly",
"y",
"ry = min(ry,y)",
"ry",
"min(ry,y)",
"min",
"ry",
"y",
"ans = max(0,rx - lx) * max(0,ry - ly)",
"ans",
"max(0,rx - lx) * max(0,ry - ly)",
"max(0,rx - lx)",
"max",
"0",
"rx - lx",
"rx",
"lx",
"max(0,ry - ly)",
"max",
"0",
"ry - ly",
"ry",
"ly",
"print(ans)",
"print",
"ans",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"INF = 10 ** 15",
"10 ** 15",
"INF",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"def main():\n W,H,N = map(int,input().split())\n lx,rx,ly,ry = 0,W,0,H\n for _ in range(N):\n x,y,a = map(int,input().split())\n if a == 1:\n lx = max(lx,x)\n elif a == 2:\n rx = min(rx,x)\n elif a == 3:\n ly = max(ly,y)\n else:\n ry = min(ry,y)\n ans = max(0,rx - lx) * max(0,ry - ly)\n print(ans)",
"def main():\n W,H,N = map(int,input().split())\n lx,rx,ly,ry = 0,W,0,H\n for _ in range(N):\n x,y,a = map(int,input().split())\n if a == 1:\n lx = max(lx,x)\n elif a == 2:\n rx = min(rx,x)\n elif a == 3:\n ly = max(ly,y)\n else:\n ry = min(ry,y)\n ans = max(0,rx - lx) * max(0,ry - ly)\n print(ans)",
"main"
] |
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
def main():
W,H,N = map(int,input().split())
lx,rx,ly,ry = 0,W,0,H
for _ in range(N):
x,y,a = map(int,input().split())
if a == 1:
lx = max(lx,x)
elif a == 2:
rx = min(rx,x)
elif a == 3:
ly = max(ly,y)
else:
ry = min(ry,y)
ans = max(0,rx - lx) * max(0,ry - ly)
print(ans)
if __name__ == '__main__':
main()
|
[
7,
0,
39,
13,
13,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
13,
4,
18,
4,
13,
13,
0,
39,
13,
13,
13,
4,
13,
31,
13,
0,
13,
17,
0,
13,
13,
0,
13,
17,
0,
13,
13,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
0,
13,
4,
13,
13,
18,
13,
13,
14,
2,
18,
13,
13,
17,
0,
13,
4,
13,
13,
18,
13,
13,
14,
2,
18,
13,
13,
17,
0,
13,
4,
13,
13,
18,
13,
13,
0,
13,
4,
13,
13,
18,
13,
13,
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,
17,
13,
10,
13,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
2,
13
] |
[
[
6,
2
],
[
17,
16
],
[
34,
30
],
[
135,
39
],
[
165,
42
],
[
156,
45
],
[
138,
48
],
[
52,
51
],
[
51,
59
],
[
153,
62
],
[
136,
65
],
[
154,
65
],
[
51,
68
],
[
51,
73
],
[
159,
76
],
[
166,
79
],
[
160,
79
],
[
51,
82
],
[
51,
87
],
[
162,
90
],
[
157,
93
],
[
163,
93
],
[
51,
96
],
[
147,
98
],
[
139,
101
],
[
148,
101
],
[
51,
104
],
[
160,
107
],
[
166,
107
],
[
154,
108
],
[
136,
108
],
[
168,
110
],
[
160,
112
],
[
166,
112
],
[
154,
113
],
[
136,
113
],
[
150,
115
],
[
148,
119
],
[
139,
119
],
[
163,
120
],
[
157,
120
],
[
141,
122
],
[
148,
124
],
[
139,
124
],
[
163,
125
],
[
157,
125
],
[
144,
127
],
[
151,
132
],
[
169,
132
],
[
145,
133
],
[
142,
133
],
[
135,
136
],
[
138,
139
],
[
141,
142
],
[
144,
145
],
[
147,
148
],
[
150,
151
],
[
153,
154
],
[
156,
157
],
[
159,
160
],
[
162,
163
],
[
165,
166
],
[
168,
169
]
] |
[
"(w, h, n) = map(int, input().split())\n(x, y, a) = zip(*[map(int, input().split()) for _ in range(n)])\n\nx_min = 0\nx_max = w\ny_min = 0\ny_max = h\n\nfor i in range(n):\n if a[i] == 1:\n x_min = max(x_min, x[i])\n elif a[i] == 2:\n x_max = min(x_max, x[i])\n elif a[i] == 3:\n y_min = max(y_min, y[i])\n else:\n y_max = min(y_max, y[i])\n\nif x_max > x_min:\n x_delta = x_max - x_min\nelse:\n x_delta = 0\nif y_max > y_min:\n y_delta = y_max - y_min\nelse:\n y_delta = 0\nprint(x_delta * y_delta)",
"(w, h, n) = map(int, input().split())",
"(w, h, n)",
"w",
"h",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"map(int, input().split()) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"(x, y, a) = zip(*[map(int, input().split()) for _ in range(n)])",
"(x, y, a)",
"x",
"y",
"a",
"zip(*[map(int, input().split()) for _ in range(n)])",
"zip",
"*[map(int, input().split()) for _ in range(n)]",
"[map(int, input().split()) for _ in range(n)]",
"x_min = 0",
"x_min",
"0",
"x_max = w",
"x_max",
"w",
"y_min = 0",
"y_min",
"0",
"y_max = h",
"y_max",
"h",
"for i in range(n):\n if a[i] == 1:\n x_min = max(x_min, x[i])\n elif a[i] == 2:\n x_max = min(x_max, x[i])\n elif a[i] == 3:\n y_min = max(y_min, y[i])\n else:\n y_max = min(y_max, y[i])",
"i",
"range(n)",
"range",
"n",
"if a[i] == 1:\n x_min = max(x_min, x[i])\n elif a[i] == 2:\n x_max = min(x_max, x[i])\n elif a[i] == 3:\n y_min = max(y_min, y[i])\n else:\n y_max = min(y_max, y[i])",
"a[i] == 1",
"a[i]",
"a",
"i",
"1",
"x_min = max(x_min, x[i])",
"x_min",
"max(x_min, x[i])",
"max",
"x_min",
"x[i]",
"x",
"i",
"elif a[i] == 2:\n x_max = min(x_max, x[i])\n ",
"a[i] == 2",
"a[i]",
"a",
"i",
"2",
"x_max = min(x_max, x[i])",
"x_max",
"min(x_max, x[i])",
"min",
"x_max",
"x[i]",
"x",
"i",
"elif a[i] == 3:\n y_min = max(y_min, y[i])\n ",
"a[i] == 3",
"a[i]",
"a",
"i",
"3",
"y_min = max(y_min, y[i])",
"y_min",
"max(y_min, y[i])",
"max",
"y_min",
"y[i]",
"y",
"i",
"y_max = min(y_max, y[i])",
"y_max",
"min(y_max, y[i])",
"min",
"y_max",
"y[i]",
"y",
"i",
"if x_max > x_min:\n x_delta = x_max - x_min\nelse:\n x_delta = 0",
"x_max > x_min",
"x_max",
"x_min",
"x_delta = x_max - x_min",
"x_delta",
"x_max - x_min",
"x_max",
"x_min",
"x_delta = 0",
"x_delta",
"0",
"if y_max > y_min:\n y_delta = y_max - y_min\nelse:\n y_delta = 0",
"y_max > y_min",
"y_max",
"y_min",
"y_delta = y_max - y_min",
"y_delta",
"y_max - y_min",
"y_max",
"y_min",
"y_delta = 0",
"y_delta",
"0",
"print(x_delta * y_delta)",
"print",
"x_delta * y_delta",
"x_delta",
"y_delta",
"x_min = 0",
"0",
"x_min",
"y_max = h",
"h",
"y_max",
"y_delta = y_max - y_min",
"y_max - y_min",
"y_delta",
"y_delta = 0",
"0",
"y_delta",
"y_max = min(y_max, y[i])",
"min(y_max, y[i])",
"y_max",
"x_delta = 0",
"0",
"x_delta",
"x_min = max(x_min, x[i])",
"max(x_min, x[i])",
"x_min",
"y_min = 0",
"0",
"y_min",
"x_max = min(x_max, x[i])",
"min(x_max, x[i])",
"x_max",
"y_min = max(y_min, y[i])",
"max(y_min, y[i])",
"y_min",
"x_max = w",
"w",
"x_max",
"x_delta = x_max - x_min",
"x_max - x_min",
"x_delta"
] |
(w, h, n) = map(int, input().split())
(x, y, a) = zip(*[map(int, input().split()) for _ in range(n)])
x_min = 0
x_max = w
y_min = 0
y_max = h
for i in range(n):
if a[i] == 1:
x_min = max(x_min, x[i])
elif a[i] == 2:
x_max = min(x_max, x[i])
elif a[i] == 3:
y_min = max(y_min, y[i])
else:
y_max = min(y_max, y[i])
if x_max > x_min:
x_delta = x_max - x_min
else:
x_delta = 0
if y_max > y_min:
y_delta = y_max - y_min
else:
y_delta = 0
print(x_delta * y_delta)
|
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
18,
4,
18,
13,
13,
2,
13,
13,
13,
13,
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,
39,
17,
14,
2,
13,
17,
0,
18,
13,
39,
17,
14,
2,
13,
17,
0,
18,
13,
39,
13,
17,
14,
2,
13,
17,
0,
18,
13,
39,
13,
17,
4,
13,
4,
13,
4,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
111,
4
],
[
111,
13
],
[
111,
14
],
[
96,
16
],
[
112,
24
],
[
109,
25
],
[
109,
27
],
[
112,
28
],
[
31,
30
],
[
94,
33
],
[
105,
35
],
[
105,
44
],
[
105,
45
],
[
106,
48
],
[
54,
51
],
[
97,
52
],
[
106,
57
],
[
63,
60
],
[
97,
61
],
[
106,
66
],
[
73,
69
],
[
97,
70
],
[
106,
76
],
[
83,
79
],
[
97,
80
],
[
97,
90
],
[
111,
94
],
[
96,
97
],
[
105,
100
],
[
105,
103
],
[
105,
106
],
[
111,
109
],
[
111,
112
]
] |
[
"import numpy as np\nW,H,N=map(int,input().split())\n\nM = np.ones(W*H).reshape(H,W)\n\nfor i in range(N):\n x,y,a =map(int,input().split())\n if a==1:\n M[:,:x]=0\n if a==2:\n M[:,x:]=0\n if a==3:\n M[:y,:]=0\n if a==4:\n M[y:,:]=0\n #print(M)\nprint(int(M.sum()))",
"import numpy as np",
"numpy",
"W,H,N=map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"M = np.ones(W*H).reshape(H,W)",
"M",
"np.ones(W*H).reshape(H,W)",
"np.ones(W*H).reshape",
"np.ones(W*H)",
"np.ones",
"np",
"ones",
"W*H",
"W",
"H",
"reshape",
"H",
"W",
"for i in range(N):\n x,y,a =map(int,input().split())\n if a==1:\n M[:,:x]=0\n if a==2:\n M[:,x:]=0\n if a==3:\n M[:y,:]=0\n if a==4:\n M[y:,:]=0\n #print(M)",
"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 M[:,:x]=0\n ",
"a==1",
"a",
"1",
"M[:,:x]=0",
"M[:,:x]",
"M",
":",
"0",
"if a==2:\n M[:,x:]=0\n ",
"a==2",
"a",
"2",
"M[:,x:]=0",
"M[:,x:]",
"M",
":",
"0",
"if a==3:\n M[:y,:]=0\n ",
"a==3",
"a",
"3",
"M[:y,:]=0",
"M[:y,:]",
"M",
":y",
"y",
"0",
"if a==4:\n M[y:,:]=0\n #print(M)",
"a==4",
"a",
"4",
"M[y:,:]=0",
"M[y:,:]",
"M",
"y:",
"y",
"0",
"print(int(M.sum()))",
"print",
"int(M.sum())",
"int",
"M.sum()",
"M.sum",
"M",
"sum",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"M = np.ones(W*H).reshape(H,W)",
"np.ones(W*H).reshape(H,W)",
"M",
"x,y,a =map(int,input().split())",
"map(int,input().split())",
"x",
"y,a =map(int,input().split())",
"map(int,input().split())",
"y",
"a =map(int,input().split())",
"map(int,input().split())",
"a",
"H,N=map(int,input().split())",
"map(int,input().split())",
"H",
"W,H,N=map(int,input().split())",
"map(int,input().split())",
"W"
] |
import numpy as np
W,H,N=map(int,input().split())
M = np.ones(W*H).reshape(H,W)
for i in range(N):
x,y,a =map(int,input().split())
if a==1:
M[:,:x]=0
if a==2:
M[:,x:]=0
if a==3:
M[:y,:]=0
if a==4:
M[y:,:]=0
#print(M)
print(int(M.sum()))
|
[
7,
41,
28,
13,
4,
13,
17,
4,
39,
31,
4,
13,
13,
4,
18,
13,
13,
0,
39,
13,
13,
13,
13,
31,
13,
0,
13,
21,
22,
17,
17,
22,
17,
13,
22,
17,
17,
22,
17,
13,
28,
13,
13,
14,
2,
18,
13,
17,
17,
0,
18,
13,
18,
13,
17,
4,
13,
18,
13,
17,
18,
13,
18,
13,
17,
14,
2,
18,
13,
17,
17,
0,
18,
13,
18,
13,
17,
4,
13,
18,
13,
17,
18,
13,
18,
13,
17,
14,
2,
18,
13,
17,
17,
0,
18,
13,
18,
13,
17,
4,
13,
18,
13,
17,
18,
13,
18,
13,
17,
14,
2,
18,
13,
17,
17,
0,
18,
13,
18,
13,
17,
4,
13,
18,
13,
17,
18,
13,
18,
13,
17,
4,
13,
2,
8,
2,
18,
13,
17,
18,
13,
17,
2,
18,
13,
17,
18,
13,
17,
17,
8,
2,
18,
13,
17,
18,
13,
17,
2,
18,
13,
17,
18,
13,
17,
17,
10,
21,
13
] |
[
[
4,
3
],
[
3,
15
],
[
22,
18
],
[
22,
23
],
[
167,
26
],
[
42,
41
],
[
41,
46
],
[
55,
50
],
[
168,
51
],
[
41,
53
],
[
41,
58
],
[
168,
61
],
[
41,
63
],
[
41,
68
],
[
77,
72
],
[
168,
73
],
[
41,
75
],
[
41,
80
],
[
168,
83
],
[
41,
85
],
[
41,
90
],
[
99,
94
],
[
168,
95
],
[
41,
97
],
[
41,
102
],
[
168,
105
],
[
41,
107
],
[
41,
112
],
[
121,
116
],
[
168,
117
],
[
41,
119
],
[
41,
124
],
[
168,
127
],
[
41,
129
],
[
168,
137
],
[
168,
140
],
[
168,
144
],
[
168,
147
],
[
168,
153
],
[
168,
156
],
[
168,
160
],
[
168,
163
],
[
167,
168
]
] |
[
"#!/usr/bin/env python3\n(w, h, n), *q = [[*map(int, i.split())] for i in open(0)]\nr = {1: 0, 2: w, 3: 0, 4: h}\nfor i in q:\n if i[2] == 1:\n r[i[2]] = max(i[0], r[i[2]])\n elif i[2] == 2:\n r[i[2]] = min(i[0], r[i[2]])\n elif i[2] == 3:\n r[i[2]] = max(i[1], r[i[2]])\n elif i[2] == 4:\n r[i[2]] = min(i[1], r[i[2]])\nprint(\n (r[2] - r[1] if r[2] > r[1] else 0) * (r[4] - r[3] if r[4] > r[3] else 0))",
"[*map(int, i.split())] for i in open(0)",
"for i in open(0)",
"i",
"open(0)",
"open",
"0",
"for i in open(0)",
"[*map(int, i.split())]",
"*map(int, i.split())",
"map(int, i.split())",
"map",
"int",
"i.split()",
"i.split",
"i",
"split",
"(w, h, n), *q = [[*map(int, i.split())] for i in open(0)]",
"(w, h, n)",
"w",
"h",
"n",
"[[*map(int, i.split())] for i in open(0)]",
"*q",
"q",
"r = {1: 0, 2: w, 3: 0, 4: h}",
"r",
"{1: 0, 2: w, 3: 0, 4: h}",
"1",
"1",
"0",
"2",
"2",
"w",
"3",
"3",
"0",
"4",
"4",
"h",
"for i in q:\n if i[2] == 1:\n r[i[2]] = max(i[0], r[i[2]])\n elif i[2] == 2:\n r[i[2]] = min(i[0], r[i[2]])\n elif i[2] == 3:\n r[i[2]] = max(i[1], r[i[2]])\n elif i[2] == 4:\n r[i[2]] = min(i[1], r[i[2]])",
"i",
"q",
"if i[2] == 1:\n r[i[2]] = max(i[0], r[i[2]])\n elif i[2] == 2:\n r[i[2]] = min(i[0], r[i[2]])\n elif i[2] == 3:\n r[i[2]] = max(i[1], r[i[2]])\n elif i[2] == 4:\n r[i[2]] = min(i[1], r[i[2]])",
"i[2] == 1",
"i[2]",
"i",
"2",
"1",
"r[i[2]] = max(i[0], r[i[2]])",
"r[i[2]]",
"r",
"i[2]",
"i",
"2",
"max(i[0], r[i[2]])",
"max",
"i[0]",
"i",
"0",
"r[i[2]]",
"r",
"i[2]",
"i",
"2",
"elif i[2] == 2:\n r[i[2]] = min(i[0], r[i[2]])\n ",
"i[2] == 2",
"i[2]",
"i",
"2",
"2",
"r[i[2]] = min(i[0], r[i[2]])",
"r[i[2]]",
"r",
"i[2]",
"i",
"2",
"min(i[0], r[i[2]])",
"min",
"i[0]",
"i",
"0",
"r[i[2]]",
"r",
"i[2]",
"i",
"2",
"elif i[2] == 3:\n r[i[2]] = max(i[1], r[i[2]])\n ",
"i[2] == 3",
"i[2]",
"i",
"2",
"3",
"r[i[2]] = max(i[1], r[i[2]])",
"r[i[2]]",
"r",
"i[2]",
"i",
"2",
"max(i[1], r[i[2]])",
"max",
"i[1]",
"i",
"1",
"r[i[2]]",
"r",
"i[2]",
"i",
"2",
"elif i[2] == 4:\n r[i[2]] = min(i[1], r[i[2]])",
"i[2] == 4",
"i[2]",
"i",
"2",
"4",
"r[i[2]] = min(i[1], r[i[2]])",
"r[i[2]]",
"r",
"i[2]",
"i",
"2",
"min(i[1], r[i[2]])",
"min",
"i[1]",
"i",
"1",
"r[i[2]]",
"r",
"i[2]",
"i",
"2",
"print(\n (r[2] - r[1] if r[2] > r[1] else 0) * (r[4] - r[3] if r[4] > r[3] else 0))",
"print",
"(r[2] - r[1] if r[2] > r[1] else 0) * (r[4] - r[3] if r[4] > r[3] else 0)",
"r[2] - r[1] if r[2] > r[1] else 0",
"r[2] > r[1]",
"r[2]",
"r",
"2",
"r[1]",
"r",
"1",
"r[2] - r[1]",
"r[2]",
"r",
"2",
"r[1]",
"r",
"1",
"0",
"r[4] - r[3] if r[4] > r[3] else 0",
"r[4] > r[3]",
"r[4]",
"r",
"4",
"r[3]",
"r",
"3",
"r[4] - r[3]",
"r[4]",
"r",
"4",
"r[3]",
"r",
"3",
"0",
"r = {1: 0, 2: w, 3: 0, 4: h}",
"{1: 0, 2: w, 3: 0, 4: h}",
"r"
] |
#!/usr/bin/env python3
(w, h, n), *q = [[*map(int, i.split())] for i in open(0)]
r = {1: 0, 2: w, 3: 0, 4: h}
for i in q:
if i[2] == 1:
r[i[2]] = max(i[0], r[i[2]])
elif i[2] == 2:
r[i[2]] = min(i[0], r[i[2]])
elif i[2] == 3:
r[i[2]] = max(i[1], r[i[2]])
elif i[2] == 4:
r[i[2]] = min(i[1], r[i[2]])
print(
(r[2] - r[1] if r[2] > r[1] else 0) * (r[4] - r[3] if r[4] > r[3] else 0))
|
[
7,
15,
13,
12,
13,
0,
13,
4,
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,
13,
4,
13,
13,
13,
13,
13,
0,
13,
17,
28,
13,
13,
0,
13,
4,
18,
13,
13,
17,
4,
13,
13,
12,
13,
28,
13,
13,
4,
13,
13,
28,
13,
13,
4,
13,
13,
14,
2,
13,
17,
14,
2,
13,
13,
0,
18,
18,
13,
13,
13,
17,
14,
2,
13,
17,
14,
2,
13,
2,
13,
17,
0,
18,
18,
13,
13,
13,
17,
14,
2,
13,
17,
14,
2,
13,
13,
0,
18,
18,
13,
13,
13,
17,
14,
2,
13,
17,
14,
2,
13,
2,
13,
17,
0,
18,
18,
13,
13,
13,
17,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
29,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
29,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] |
[
[
7,
6
],
[
7,
9
],
[
7,
10
],
[
14,
13
],
[
9,
16
],
[
6,
21
],
[
24,
23
],
[
27,
26
],
[
10,
29
],
[
32,
31
],
[
32,
34
],
[
32,
35
],
[
23,
38
],
[
31,
39
],
[
34,
40
],
[
35,
41
],
[
44,
43
],
[
47,
46
],
[
23,
46
],
[
50,
49
],
[
46,
52
],
[
49,
57
],
[
43,
57
],
[
137,
65
],
[
143,
74
],
[
139,
79
],
[
86,
81
],
[
137,
83
],
[
143,
89
],
[
139,
95
],
[
103,
98
],
[
137,
100
],
[
143,
106
],
[
141,
111
],
[
118,
113
],
[
137,
115
],
[
143,
121
],
[
141,
127
],
[
135,
130
],
[
137,
132
],
[
137,
137
],
[
139,
139
],
[
141,
141
],
[
143,
143
],
[
187,
175
]
] |
[
"# import sys\n# input = sys.stdin.readline\nimport itertools\n\n\n# 持っているビスケットを叩き、1枚増やす\n# ビスケット A枚を 1円に交換する\n# 1円をビスケット B枚に交換する\ndef main():\n w, h, n = input_list()\n zahyou = [[0]*w for _ in range(h)]\n for _ in range(n):\n x, y, a = input_list()\n umeru(zahyou, x, y, a)\n ans = 0\n for hz in zahyou:\n ans += hz.count(0)\n print(ans)\n\ndef umeru(zu, x, y, a):\n for Y, row in enumerate(zu):\n for X, v in enumerate(row):\n if a == 1:\n if X < x:\n zu[Y][X] = 1\n if a == 2:\n if X > x - 1:\n zu[Y][X] = 1\n if a == 3:\n if Y < y:\n zu[Y][X] = 1\n if a == 4:\n if Y > y - 1:\n zu[Y][X] = 1\n\n\ndef input_list():\n return list(map(int, input().split()))\n\n\ndef input_list_str():\n return list(map(str, input().split()))\n\n\nif __name__ == \"__main__\":\n main()",
"import itertools",
"itertools",
"def main():\n w, h, n = input_list()\n zahyou = [[0]*w for _ in range(h)]\n for _ in range(n):\n x, y, a = input_list()\n umeru(zahyou, x, y, a)\n ans = 0\n for hz in zahyou:\n ans += hz.count(0)\n print(ans)",
"main",
"w, h, n = input_list()",
"w",
"input_list()",
"input_list",
"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",
"zahyou = [[0]*w for _ in range(h)]",
"zahyou",
"[[0]*w for _ in range(h)]",
"for _ in range(n):\n x, y, a = input_list()\n umeru(zahyou, x, y, a)\n ",
"_",
"range(n)",
"range",
"n",
"x, y, a = input_list()",
"x",
"input_list()",
"input_list",
"y",
"a",
"umeru(zahyou, x, y, a)",
"umeru",
"zahyou",
"x",
"y",
"a",
"ans = 0",
"ans",
"0",
"for hz in zahyou:\n ans += hz.count(0)\n ",
"hz",
"zahyou",
"ans += hz.count(0)",
"ans",
"hz.count(0)",
"hz.count",
"hz",
"count",
"0",
"print(ans)",
"print",
"ans",
"def umeru(zu, x, y, a):\n for Y, row in enumerate(zu):\n for X, v in enumerate(row):\n if a == 1:\n if X < x:\n zu[Y][X] = 1\n if a == 2:\n if X > x - 1:\n zu[Y][X] = 1\n if a == 3:\n if Y < y:\n zu[Y][X] = 1\n if a == 4:\n if Y > y - 1:\n zu[Y][X] = 1",
"umeru",
"for Y, row in enumerate(zu):\n for X, v in enumerate(row):\n if a == 1:\n if X < x:\n zu[Y][X] = 1\n if a == 2:\n if X > x - 1:\n zu[Y][X] = 1\n if a == 3:\n if Y < y:\n zu[Y][X] = 1\n if a == 4:\n if Y > y - 1:\n zu[Y][X] = 1",
"Y",
"row",
"enumerate(zu)",
"enumerate",
"zu",
"for X, v in enumerate(row):\n if a == 1:\n if X < x:\n zu[Y][X] = 1\n if a == 2:\n if X > x - 1:\n zu[Y][X] = 1\n if a == 3:\n if Y < y:\n zu[Y][X] = 1\n if a == 4:\n if Y > y - 1:\n zu[Y][X] = 1",
"X",
"v",
"enumerate(row)",
"enumerate",
"row",
"if a == 1:\n if X < x:\n zu[Y][X] = 1\n ",
"a == 1",
"a",
"1",
"if X < x:\n zu[Y][X] = 1\n ",
"X < x",
"X",
"x",
"zu[Y][X] = 1",
"zu[Y][X]",
"[Y]",
"zu",
"Y",
"X",
"1",
"if a == 2:\n if X > x - 1:\n zu[Y][X] = 1\n ",
"a == 2",
"a",
"2",
"if X > x - 1:\n zu[Y][X] = 1\n ",
"X > x - 1",
"X",
"x - 1",
"x",
"1",
"zu[Y][X] = 1",
"zu[Y][X]",
"[Y]",
"zu",
"Y",
"X",
"1",
"if a == 3:\n if Y < y:\n zu[Y][X] = 1\n ",
"a == 3",
"a",
"3",
"if Y < y:\n zu[Y][X] = 1\n ",
"Y < y",
"Y",
"y",
"zu[Y][X] = 1",
"zu[Y][X]",
"[Y]",
"zu",
"Y",
"X",
"1",
"if a == 4:\n if Y > y - 1:\n zu[Y][X] = 1",
"a == 4",
"a",
"4",
"if Y > y - 1:\n zu[Y][X] = 1",
"Y > y - 1",
"Y",
"y - 1",
"y",
"1",
"zu[Y][X] = 1",
"zu[Y][X]",
"[Y]",
"zu",
"Y",
"X",
"1",
"zu",
"zu",
"x",
"x",
"y",
"y",
"a",
"a",
"def input_list():\n return list(map(int, input().split()))",
"input_list",
"return list(map(int, input().split()))",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"def input_list_str():\n return list(map(str, input().split()))",
"input_list_str",
"return list(map(str, input().split()))",
"list(map(str, input().split()))",
"list",
"map(str, input().split())",
"map",
"str",
"input().split()",
"().split",
"()",
"input",
"split",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def input_list():\n return list(map(int, input().split()))",
"def input_list():\n return list(map(int, input().split()))",
"input_list",
"def umeru(zu, x, y, a):\n for Y, row in enumerate(zu):\n for X, v in enumerate(row):\n if a == 1:\n if X < x:\n zu[Y][X] = 1\n if a == 2:\n if X > x - 1:\n zu[Y][X] = 1\n if a == 3:\n if Y < y:\n zu[Y][X] = 1\n if a == 4:\n if Y > y - 1:\n zu[Y][X] = 1",
"def umeru(zu, x, y, a):\n for Y, row in enumerate(zu):\n for X, v in enumerate(row):\n if a == 1:\n if X < x:\n zu[Y][X] = 1\n if a == 2:\n if X > x - 1:\n zu[Y][X] = 1\n if a == 3:\n if Y < y:\n zu[Y][X] = 1\n if a == 4:\n if Y > y - 1:\n zu[Y][X] = 1",
"umeru",
"def input_list_str():\n return list(map(str, input().split()))",
"def input_list_str():\n return list(map(str, input().split()))",
"input_list_str",
"def main():\n w, h, n = input_list()\n zahyou = [[0]*w for _ in range(h)]\n for _ in range(n):\n x, y, a = input_list()\n umeru(zahyou, x, y, a)\n ans = 0\n for hz in zahyou:\n ans += hz.count(0)\n print(ans)",
"def main():\n w, h, n = input_list()\n zahyou = [[0]*w for _ in range(h)]\n for _ in range(n):\n x, y, a = input_list()\n umeru(zahyou, x, y, a)\n ans = 0\n for hz in zahyou:\n ans += hz.count(0)\n print(ans)",
"main"
] |
# import sys
# input = sys.stdin.readline
import itertools
# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
w, h, n = input_list()
zahyou = [[0]*w for _ in range(h)]
for _ in range(n):
x, y, a = input_list()
umeru(zahyou, x, y, a)
ans = 0
for hz in zahyou:
ans += hz.count(0)
print(ans)
def umeru(zu, x, y, a):
for Y, row in enumerate(zu):
for X, v in enumerate(row):
if a == 1:
if X < x:
zu[Y][X] = 1
if a == 2:
if X > x - 1:
zu[Y][X] = 1
if a == 3:
if Y < y:
zu[Y][X] = 1
if a == 4:
if Y > y - 1:
zu[Y][X] = 1
def input_list():
return list(map(int, input().split()))
def input_list_str():
return list(map(str, input().split()))
if __name__ == "__main__":
main()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
13,
13,
17,
13,
13,
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,
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,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
134,
2
],
[
134,
11
],
[
134,
12
],
[
122,
14
],
[
132,
15
],
[
125,
16
],
[
101,
18
],
[
108,
19
],
[
104,
20
],
[
24,
23
],
[
135,
26
],
[
116,
28
],
[
116,
37
],
[
116,
38
],
[
114,
41
],
[
98,
44
],
[
126,
47
],
[
99,
47
],
[
117,
48
],
[
114,
51
],
[
128,
54
],
[
123,
57
],
[
129,
57
],
[
117,
58
],
[
114,
61
],
[
110,
64
],
[
105,
67
],
[
111,
67
],
[
96,
68
],
[
114,
71
],
[
119,
74
],
[
102,
77
],
[
120,
77
],
[
96,
78
],
[
129,
86
],
[
123,
86
],
[
99,
87
],
[
126,
87
],
[
120,
92
],
[
102,
92
],
[
111,
93
],
[
105,
93
],
[
116,
96
],
[
98,
99
],
[
108,
101
],
[
101,
102
],
[
104,
105
],
[
134,
108
],
[
110,
111
],
[
116,
114
],
[
116,
117
],
[
119,
120
],
[
132,
122
],
[
122,
123
],
[
125,
126
],
[
128,
129
],
[
134,
132
],
[
134,
135
]
] |
[
"w,h,n=map(int,input().split())\nmax_x,min_x,max_y,min_y=w,0,h,0\nfor i in range(n):\n x,y,a=map(int,input().split())\n if a==1:\n min_x=max(min_x,x)\n elif a==2:\n max_x=min(max_x,x)\n elif a==3:\n min_y=max(min_y,y)\n elif a==4:\n max_y=min(max_y,y)\nprint(max(0,max_x-min_x)*max(0,max_y-min_y))",
"w,h,n=map(int,input().split())",
"w",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"max_x,min_x,max_y,min_y=w,0,h,0",
"max_x",
"w",
"min_x",
"0",
"max_y",
"h",
"min_y",
"0",
"for i in range(n):\n x,y,a=map(int,input().split())\n if a==1:\n min_x=max(min_x,x)\n elif a==2:\n max_x=min(max_x,x)\n elif a==3:\n min_y=max(min_y,y)\n elif a==4:\n max_y=min(max_y,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 min_x=max(min_x,x)\n elif a==2:\n max_x=min(max_x,x)\n elif a==3:\n min_y=max(min_y,y)\n elif a==4:\n max_y=min(max_y,y)",
"a==1",
"a",
"1",
"min_x=max(min_x,x)",
"min_x",
"max(min_x,x)",
"max",
"min_x",
"x",
"elif a==2:\n max_x=min(max_x,x)\n ",
"a==2",
"a",
"2",
"max_x=min(max_x,x)",
"max_x",
"min(max_x,x)",
"min",
"max_x",
"x",
"elif a==3:\n min_y=max(min_y,y)\n ",
"a==3",
"a",
"3",
"min_y=max(min_y,y)",
"min_y",
"max(min_y,y)",
"max",
"min_y",
"y",
"elif a==4:\n max_y=min(max_y,y)",
"a==4",
"a",
"4",
"max_y=min(max_y,y)",
"max_y",
"min(max_y,y)",
"min",
"max_y",
"y",
"print(max(0,max_x-min_x)*max(0,max_y-min_y))",
"print",
"max(0,max_x-min_x)*max(0,max_y-min_y)",
"max(0,max_x-min_x)",
"max",
"0",
"max_x-min_x",
"max_x",
"min_x",
"max(0,max_y-min_y)",
"max",
"0",
"max_y-min_y",
"max_y",
"min_y",
"y,a=map(int,input().split())",
"map(int,input().split())",
"y",
"min_x=max(min_x,x)",
"max(min_x,x)",
"min_x",
"max_y,min_y=w,0,h,0",
"h",
"max_y",
"min_y=w,0,h,0",
"0",
"min_y",
"h,n=map(int,input().split())",
"map(int,input().split())",
"h",
"min_y=max(min_y,y)",
"max(min_y,y)",
"min_y",
"a=map(int,input().split())",
"map(int,input().split())",
"a",
"x,y,a=map(int,input().split())",
"map(int,input().split())",
"x",
"max_y=min(max_y,y)",
"min(max_y,y)",
"max_y",
"max_x,min_x,max_y,min_y=w,0,h,0",
"w",
"max_x",
"min_x,max_y,min_y=w,0,h,0",
"0",
"min_x",
"max_x=min(max_x,x)",
"min(max_x,x)",
"max_x",
"w,h,n=map(int,input().split())",
"map(int,input().split())",
"w",
"n=map(int,input().split())",
"map(int,input().split())",
"n"
] |
w,h,n=map(int,input().split())
max_x,min_x,max_y,min_y=w,0,h,0
for i in range(n):
x,y,a=map(int,input().split())
if a==1:
min_x=max(min_x,x)
elif a==2:
max_x=min(max_x,x)
elif a==3:
min_y=max(min_y,y)
elif a==4:
max_y=min(max_y,y)
print(max(0,max_x-min_x)*max(0,max_y-min_y))
|
[
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,
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,
28,
13,
4,
13,
13,
28,
13,
4,
13,
13,
13,
0,
18,
18,
13,
13,
13,
17,
4,
13,
4,
18,
4,
13,
13,
39,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
155,
2
],
[
155,
11
],
[
155,
12
],
[
16,
15
],
[
144,
18
],
[
156,
23
],
[
146,
25
],
[
29,
28
],
[
138,
31
],
[
152,
33
],
[
152,
42
],
[
152,
43
],
[
153,
46
],
[
50,
49
],
[
150,
52
],
[
55,
54
],
[
144,
57
],
[
64,
59
],
[
147,
61
],
[
54,
62
],
[
49,
63
],
[
153,
67
],
[
71,
70
],
[
150,
73
],
[
156,
74
],
[
77,
76
],
[
144,
79
],
[
86,
81
],
[
147,
83
],
[
76,
84
],
[
70,
85
],
[
153,
89
],
[
93,
92
],
[
156,
95
],
[
98,
97
],
[
141,
100
],
[
107,
102
],
[
147,
104
],
[
97,
105
],
[
92,
106
],
[
110,
109
],
[
156,
112
],
[
115,
114
],
[
141,
117
],
[
144,
118
],
[
125,
120
],
[
147,
122
],
[
114,
123
],
[
109,
124
],
[
147,
132
],
[
155,
138
],
[
152,
141
],
[
155,
144
],
[
146,
147
],
[
152,
150
],
[
152,
153
],
[
155,
156
]
] |
[
"W, H, N = map(int, input().split())\nm = [[0] * W for _ in range(H)]\nfor _ in range(N):\n x, y, a = map(int, input().split())\n if a == 1: \n for w in range(x):\n for h in range(H):\n m[h][w] = 1\n elif a == 2:\n for w in range(x , W):\n for h in range(H):\n m[h][w] = 1\n elif a == 3:\n for w in range(W):\n for h in range(y):\n m[h][w] = 1\n else:\n for w in range(W):\n for h in range(y, H):\n m[h][w] = 1\nprint(sum(m, []).count(0))",
"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",
"m = [[0] * W for _ in range(H)]",
"m",
"[[0] * W for _ in range(H)]",
"for _ in range(N):\n x, y, a = map(int, input().split())\n if a == 1: \n for w in range(x):\n for h in range(H):\n m[h][w] = 1\n elif a == 2:\n for w in range(x , W):\n for h in range(H):\n m[h][w] = 1\n elif a == 3:\n for w in range(W):\n for h in range(y):\n m[h][w] = 1\n else:\n for w in range(W):\n for h in range(y, H):\n m[h][w] = 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 w in range(x):\n for h in range(H):\n m[h][w] = 1\n elif a == 2:\n for w in range(x , W):\n for h in range(H):\n m[h][w] = 1\n elif a == 3:\n for w in range(W):\n for h in range(y):\n m[h][w] = 1\n else:\n for w in range(W):\n for h in range(y, H):\n m[h][w] = 1",
"a == 1",
"a",
"1",
"for w in range(x):\n for h in range(H):\n m[h][w] = 1\n ",
"w",
"range(x)",
"range",
"x",
"for h in range(H):\n m[h][w] = 1\n ",
"h",
"range(H)",
"range",
"H",
"m[h][w] = 1",
"m[h][w]",
"[h]",
"m",
"h",
"w",
"1",
"elif a == 2:\n for w in range(x , W):\n for h in range(H):\n m[h][w] = 1\n ",
"a == 2",
"a",
"2",
"for w in range(x , W):\n for h in range(H):\n m[h][w] = 1\n ",
"w",
"range(x , W)",
"range",
"x",
"W",
"for h in range(H):\n m[h][w] = 1\n ",
"h",
"range(H)",
"range",
"H",
"m[h][w] = 1",
"m[h][w]",
"[h]",
"m",
"h",
"w",
"1",
"elif a == 3:\n for w in range(W):\n for h in range(y):\n m[h][w] = 1\n ",
"a == 3",
"a",
"3",
"for w in range(W):\n for h in range(y):\n m[h][w] = 1\n ",
"w",
"range(W)",
"range",
"W",
"for h in range(y):\n m[h][w] = 1\n ",
"h",
"range(y)",
"range",
"y",
"m[h][w] = 1",
"m[h][w]",
"[h]",
"m",
"h",
"w",
"1",
"for w in range(W):\n for h in range(y, H):\n m[h][w] = 1",
"w",
"range(W)",
"range",
"W",
"for h in range(y, H):\n m[h][w] = 1",
"h",
"range(y, H)",
"range",
"y",
"H",
"m[h][w] = 1",
"m[h][w]",
"[h]",
"m",
"h",
"w",
"1",
"print(sum(m, []).count(0))",
"print",
"sum(m, []).count(0)",
"(m, []).count",
"(m, [])",
"sum",
"m",
"[]",
"count",
"0",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"m = [[0] * W for _ in range(H)]",
"[[0] * W for _ in range(H)]",
"m",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W"
] |
W, H, N = map(int, input().split())
m = [[0] * W for _ in range(H)]
for _ in range(N):
x, y, a = map(int, input().split())
if a == 1:
for w in range(x):
for h in range(H):
m[h][w] = 1
elif a == 2:
for w in range(x , W):
for h in range(H):
m[h][w] = 1
elif a == 3:
for w in range(W):
for h in range(y):
m[h][w] = 1
else:
for w in range(W):
for h in range(y, H):
m[h][w] = 1
print(sum(m, []).count(0))
|
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
13,
31,
13,
0,
13,
4,
18,
13,
13,
39,
13,
13,
0,
13,
13,
28,
13,
13,
13,
4,
13,
18,
13,
39,
17,
18,
13,
39,
17,
17,
18,
13,
39,
17,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
0,
18,
13,
39,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
13,
0,
18,
13,
39,
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,
4,
13,
4,
18,
13,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
124,
4
],
[
124,
17
],
[
124,
18
],
[
124,
19
],
[
118,
22
],
[
32,
31
],
[
59,
58
],
[
66,
63
],
[
119,
64
],
[
73,
72
],
[
125,
76
],
[
81,
78
],
[
119,
79
],
[
88,
87
],
[
95,
92
],
[
119,
93
],
[
87,
94
],
[
98,
97
],
[
122,
101
],
[
106,
103
],
[
119,
104
],
[
97,
105
],
[
119,
113
],
[
124,
116
],
[
118,
119
],
[
124,
122
],
[
124,
125
]
] |
[
"import numpy as np\nw, h, n, *Q = map(int, open(0).read().split())\nB = np.ones((h, w), dtype=int)\nfor x, y, a in zip(Q[::3], Q[1::3], Q[2::3]):\n if a == 1:\n for i in range(x):\n B[:, i] = 0\n elif a == 2:\n for i in range(x, w):\n B[:, i] = 0\n elif a == 3:\n for i in range(y):\n B[i, :] = 0\n else:\n for i in range(y, h):\n B[i, :] = 0\nprint(np.sum(B))",
"import numpy as np",
"numpy",
"w, h, n, *Q = map(int, open(0).read().split())",
"w",
"map(int, open(0).read().split())",
"map",
"int",
"open(0).read().split()",
"(0).read().split",
"(0).read()",
"(0).read",
"(0)",
"open",
"0",
"read",
"split",
"h",
"n",
"*Q",
"Q",
"B = np.ones((h, w), dtype=int)",
"B",
"np.ones((h, w), dtype=int)",
"np.ones",
"np",
"ones",
"(h, w)",
"h",
"w",
"dtype=int",
"dtype",
"int",
"for x, y, a in zip(Q[::3], Q[1::3], Q[2::3]):\n if a == 1:\n for i in range(x):\n B[:, i] = 0\n elif a == 2:\n for i in range(x, w):\n B[:, i] = 0\n elif a == 3:\n for i in range(y):\n B[i, :] = 0\n else:\n for i in range(y, h):\n B[i, :] = 0",
"x",
"y",
"a",
"zip(Q[::3], Q[1::3], Q[2::3])",
"zip",
"Q[::3]",
"Q",
"::3",
"3",
"Q[1::3]",
"Q",
"1::3",
"1",
"3",
"Q[2::3]",
"Q",
"2::3",
"2",
"3",
"if a == 1:\n for i in range(x):\n B[:, i] = 0\n elif a == 2:\n for i in range(x, w):\n B[:, i] = 0\n elif a == 3:\n for i in range(y):\n B[i, :] = 0\n else:\n for i in range(y, h):\n B[i, :] = 0",
"a == 1",
"a",
"1",
"for i in range(x):\n B[:, i] = 0\n ",
"i",
"range(x)",
"range",
"x",
"B[:, i] = 0",
"B[:, i]",
"B",
":",
"0",
"elif a == 2:\n for i in range(x, w):\n B[:, i] = 0\n ",
"a == 2",
"a",
"2",
"for i in range(x, w):\n B[:, i] = 0\n ",
"i",
"range(x, w)",
"range",
"x",
"w",
"B[:, i] = 0",
"B[:, i]",
"B",
":",
"0",
"elif a == 3:\n for i in range(y):\n B[i, :] = 0\n ",
"a == 3",
"a",
"3",
"for i in range(y):\n B[i, :] = 0\n ",
"i",
"range(y)",
"range",
"y",
"B[i, :] = 0",
"B[i, :]",
"B",
"i",
"0",
"for i in range(y, h):\n B[i, :] = 0",
"i",
"range(y, h)",
"range",
"y",
"h",
"B[i, :] = 0",
"B[i, :]",
"B",
"i",
"0",
"print(np.sum(B))",
"print",
"np.sum(B)",
"np.sum",
"np",
"sum",
"B",
"n, *Q = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"n",
"B = np.ones((h, w), dtype=int)",
"np.ones((h, w), dtype=int)",
"B",
"h, n, *Q = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"h",
"w, h, n, *Q = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"w"
] |
import numpy as np
w, h, n, *Q = map(int, open(0).read().split())
B = np.ones((h, w), dtype=int)
for x, y, a in zip(Q[::3], Q[1::3], Q[2::3]):
if a == 1:
for i in range(x):
B[:, i] = 0
elif a == 2:
for i in range(x, w):
B[:, i] = 0
elif a == 3:
for i in range(y):
B[i, :] = 0
else:
for i in range(y, h):
B[i, :] = 0
print(np.sum(B))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
39,
2,
13,
17,
17,
0,
13,
13,
41,
28,
13,
4,
13,
13,
4,
39,
2,
13,
17,
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,
28,
13,
4,
13,
4,
13,
13,
14,
40,
18,
18,
13,
13,
17,
13,
0,
18,
18,
13,
13,
17,
17,
14,
2,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
18,
13,
13,
17,
13,
0,
18,
18,
13,
13,
17,
17,
14,
2,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
40,
18,
18,
13,
13,
17,
13,
0,
18,
18,
13,
13,
17,
17,
14,
2,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
18,
13,
13,
17,
13,
0,
18,
18,
13,
13,
17,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
18,
13,
13,
17,
17,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
18,
13,
13,
17,
17,
0,
13,
17,
4,
13,
2,
13,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13
] |
[
[
236,
2
],
[
236,
11
],
[
236,
12
],
[
16,
15
],
[
237,
18
],
[
15,
22
],
[
242,
26
],
[
31,
30
],
[
213,
33
],
[
30,
37
],
[
218,
41
],
[
45,
44
],
[
222,
47
],
[
233,
49
],
[
233,
58
],
[
233,
59
],
[
225,
62
],
[
66,
65
],
[
243,
70
],
[
243,
75
],
[
65,
76
],
[
234,
78
],
[
85,
80
],
[
243,
82
],
[
65,
83
],
[
225,
88
],
[
92,
91
],
[
243,
96
],
[
243,
101
],
[
91,
102
],
[
234,
104
],
[
111,
106
],
[
243,
108
],
[
91,
109
],
[
225,
114
],
[
118,
117
],
[
219,
122
],
[
219,
127
],
[
117,
128
],
[
228,
130
],
[
137,
132
],
[
219,
134
],
[
117,
135
],
[
225,
140
],
[
144,
143
],
[
219,
148
],
[
219,
153
],
[
143,
154
],
[
228,
156
],
[
163,
158
],
[
219,
160
],
[
143,
161
],
[
245,
165
],
[
239,
168
],
[
172,
171
],
[
243,
176
],
[
243,
181
],
[
171,
182
],
[
215,
186
],
[
190,
189
],
[
219,
194
],
[
219,
199
],
[
189,
200
],
[
230,
204
],
[
216,
209
],
[
246,
209
],
[
231,
210
],
[
240,
210
],
[
236,
213
],
[
215,
216
],
[
218,
219
],
[
236,
222
],
[
233,
225
],
[
233,
228
],
[
230,
231
],
[
233,
234
],
[
236,
237
],
[
239,
240
],
[
242,
243
],
[
245,
246
]
] |
[
"W, H, N = map(int, input().split())\n\nX = [[i+1, \"w\"] for i in range(W)]\nY = [[i+1, \"w\"] for i in range(H)]\nfor i in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n for j in range(len(X)):\n if X[j][0] <= x:\n X[j][1] = \"b\"\n elif a == 2:\n for j in range(len(X)):\n if X[j][0] > x:\n X[j][1] = \"b\"\n elif a == 3:\n for j in range(len(Y)):\n if Y[j][0] <= y:\n Y[j][1] = \"b\"\n elif a == 4:\n for j in range(len(Y)):\n if Y[j][0] > y:\n Y[j][1] = \"b\"\nx_w = 0\ny_w = 0\nfor i in range(len(X)):\n if X[i][1] == \"w\":\n x_w += 1\nfor i in range(len(Y)):\n if Y[i][1] == \"w\":\n y_w += 1\nprint(x_w * y_w)",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"[i+1, \"w\"] for i in range(W)",
"for i in range(W)",
"i",
"range(W)",
"range",
"W",
"for i in range(W)",
"[i+1, \"w\"]",
"i+1",
"i",
"1",
"\"w\"",
"X = [[i+1, \"w\"] for i in range(W)]",
"X",
"[[i+1, \"w\"] for i in range(W)]",
"[i+1, \"w\"] for i in range(H)",
"for i in range(H)",
"i",
"range(H)",
"range",
"H",
"for i in range(H)",
"[i+1, \"w\"]",
"i+1",
"i",
"1",
"\"w\"",
"Y = [[i+1, \"w\"] for i in range(H)]",
"Y",
"[[i+1, \"w\"] for i in range(H)]",
"for i in range(N):\n x, y, a = map(int, input().split())\n if a == 1:\n for j in range(len(X)):\n if X[j][0] <= x:\n X[j][1] = \"b\"\n elif a == 2:\n for j in range(len(X)):\n if X[j][0] > x:\n X[j][1] = \"b\"\n elif a == 3:\n for j in range(len(Y)):\n if Y[j][0] <= y:\n Y[j][1] = \"b\"\n elif a == 4:\n for j in range(len(Y)):\n if Y[j][0] > y:\n Y[j][1] = \"b\"",
"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 j in range(len(X)):\n if X[j][0] <= x:\n X[j][1] = \"b\"\n elif a == 2:\n for j in range(len(X)):\n if X[j][0] > x:\n X[j][1] = \"b\"\n elif a == 3:\n for j in range(len(Y)):\n if Y[j][0] <= y:\n Y[j][1] = \"b\"\n elif a == 4:\n for j in range(len(Y)):\n if Y[j][0] > y:\n Y[j][1] = \"b\"",
"a == 1",
"a",
"1",
"for j in range(len(X)):\n if X[j][0] <= x:\n X[j][1] = \"b\"\n ",
"j",
"range(len(X))",
"range",
"len(X)",
"len",
"X",
"if X[j][0] <= x:\n X[j][1] = \"b\"\n ",
"X[j][0] <= x",
"X[j][0]",
"[j]",
"X",
"j",
"0",
"x",
"X[j][1] = \"b\"",
"X[j][1]",
"[j]",
"X",
"j",
"1",
"\"b\"",
"elif a == 2:\n for j in range(len(X)):\n if X[j][0] > x:\n X[j][1] = \"b\"\n ",
"a == 2",
"a",
"2",
"for j in range(len(X)):\n if X[j][0] > x:\n X[j][1] = \"b\"\n ",
"j",
"range(len(X))",
"range",
"len(X)",
"len",
"X",
"if X[j][0] > x:\n X[j][1] = \"b\"\n ",
"X[j][0] > x",
"X[j][0]",
"[j]",
"X",
"j",
"0",
"x",
"X[j][1] = \"b\"",
"X[j][1]",
"[j]",
"X",
"j",
"1",
"\"b\"",
"elif a == 3:\n for j in range(len(Y)):\n if Y[j][0] <= y:\n Y[j][1] = \"b\"\n ",
"a == 3",
"a",
"3",
"for j in range(len(Y)):\n if Y[j][0] <= y:\n Y[j][1] = \"b\"\n ",
"j",
"range(len(Y))",
"range",
"len(Y)",
"len",
"Y",
"if Y[j][0] <= y:\n Y[j][1] = \"b\"\n ",
"Y[j][0] <= y",
"Y[j][0]",
"[j]",
"Y",
"j",
"0",
"y",
"Y[j][1] = \"b\"",
"Y[j][1]",
"[j]",
"Y",
"j",
"1",
"\"b\"",
"elif a == 4:\n for j in range(len(Y)):\n if Y[j][0] > y:\n Y[j][1] = \"b\"",
"a == 4",
"a",
"4",
"for j in range(len(Y)):\n if Y[j][0] > y:\n Y[j][1] = \"b\"",
"j",
"range(len(Y))",
"range",
"len(Y)",
"len",
"Y",
"if Y[j][0] > y:\n Y[j][1] = \"b\"",
"Y[j][0] > y",
"Y[j][0]",
"[j]",
"Y",
"j",
"0",
"y",
"Y[j][1] = \"b\"",
"Y[j][1]",
"[j]",
"Y",
"j",
"1",
"\"b\"",
"x_w = 0",
"x_w",
"0",
"y_w = 0",
"y_w",
"0",
"for i in range(len(X)):\n if X[i][1] == \"w\":\n x_w += 1",
"i",
"range(len(X))",
"range",
"len(X)",
"len",
"X",
"if X[i][1] == \"w\":\n x_w += 1",
"X[i][1] == \"w\"",
"X[i][1]",
"[i]",
"X",
"i",
"1",
"\"w\"",
"x_w += 1",
"x_w",
"1",
"for i in range(len(Y)):\n if Y[i][1] == \"w\":\n y_w += 1",
"i",
"range(len(Y))",
"range",
"len(Y)",
"len",
"Y",
"if Y[i][1] == \"w\":\n y_w += 1",
"Y[i][1] == \"w\"",
"Y[i][1]",
"[i]",
"Y",
"i",
"1",
"\"w\"",
"y_w += 1",
"y_w",
"1",
"print(x_w * y_w)",
"print",
"x_w * y_w",
"x_w",
"y_w",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"x_w += 1",
"1",
"x_w",
"Y = [[i+1, \"w\"] for i in range(H)]",
"[[i+1, \"w\"] for i in range(H)]",
"Y",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"y_w += 1",
"1",
"y_w",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"y_w = 0",
"0",
"y_w",
"X = [[i+1, \"w\"] for i in range(W)]",
"[[i+1, \"w\"] for i in range(W)]",
"X",
"x_w = 0",
"0",
"x_w"
] |
W, H, N = map(int, input().split())
X = [[i+1, "w"] for i in range(W)]
Y = [[i+1, "w"] for i in range(H)]
for i in range(N):
x, y, a = map(int, input().split())
if a == 1:
for j in range(len(X)):
if X[j][0] <= x:
X[j][1] = "b"
elif a == 2:
for j in range(len(X)):
if X[j][0] > x:
X[j][1] = "b"
elif a == 3:
for j in range(len(Y)):
if Y[j][0] <= y:
Y[j][1] = "b"
elif a == 4:
for j in range(len(Y)):
if Y[j][0] > y:
Y[j][1] = "b"
x_w = 0
y_w = 0
for i in range(len(X)):
if X[i][1] == "w":
x_w += 1
for i in range(len(Y)):
if Y[i][1] == "w":
y_w += 1
print(x_w * y_w)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
13,
17,
13,
17,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
14,
2,
13,
17,
14,
2,
13,
17,
14,
2,
13,
17,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
14,
2,
2,
13,
17,
2,
13,
17,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13
] |
[
[
92,
2
],
[
92,
11
],
[
92,
12
],
[
77,
14
],
[
101,
16
],
[
74,
18
],
[
104,
20
],
[
24,
23
],
[
84,
26
],
[
107,
28
],
[
107,
37
],
[
107,
38
],
[
108,
41
],
[
108,
45
],
[
108,
49
],
[
108,
53
],
[
95,
56
],
[
78,
58
],
[
102,
59
],
[
89,
61
],
[
75,
63
],
[
105,
64
],
[
96,
68
],
[
93,
68
],
[
90,
71
],
[
87,
71
],
[
74,
75
],
[
77,
78
],
[
107,
81
],
[
92,
84
],
[
92,
87
],
[
89,
90
],
[
92,
93
],
[
95,
96
],
[
107,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
]
] |
[
"w,h,n = map(int, input().split())\n\nx1,x2,y1,y2 = 0,0,0,0\nfor _ in range(n):\n x,y,a = map(int, input().split())\n if a == 1: x1 = max(x1, x)\n if a == 2: x2 = max(x2, w-x)\n if a == 3: y1 = max(y1, y)\n if a == 4: y2 = max(y2, h-y)\n\nw -= x1+x2\nh -= y1+y2\nif w > 0 and h > 0: print(w*h)\nelse: print(0)",
"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,0,0,0",
"x1",
"0",
"x2",
"0",
"y1",
"0",
"y2",
"0",
"for _ in range(n):\n x,y,a = map(int, input().split())\n if a == 1: x1 = max(x1, x)\n if a == 2: x2 = max(x2, w-x)\n if a == 3: y1 = max(y1, y)\n if a == 4: y2 = max(y2, h-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: x1 = max(x1, x)\n ",
"a == 1",
"a",
"1",
"if a == 2: x2 = max(x2, w-x)\n ",
"a == 2",
"a",
"2",
"if a == 3: y1 = max(y1, y)\n ",
"a == 3",
"a",
"3",
"if a == 4: y2 = max(y2, h-",
"a == 4",
"a",
"4",
"w -= x1+x2",
"w",
"x1+x2",
"x1",
"x2",
"h -= y1+y2",
"h",
"y1+y2",
"y1",
"y2",
"if w > 0 and h > 0: print(w*h)\nelse: print(0)",
"w > 0 and h > 0",
"w > 0",
"w",
"0",
"h > 0",
"h",
"0",
"y1,y2 = 0,0,0,0",
"0",
"y1",
"x1,x2,y1,y2 = 0,0,0,0",
"0",
"x1",
"x,y,a = map(int, input().split())",
"map(int, input().split())",
"x",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"h,n = map(int, input().split())",
"map(int, input().split())",
"h",
"h -= y1+y2",
"y1+y2",
"h",
"w,h,n = map(int, input().split())",
"map(int, input().split())",
"w",
"w -= x1+x2",
"x1+x2",
"w",
"y,a = map(int, input().split())",
"map(int, input().split())",
"y",
"x2,y1,y2 = 0,0,0,0",
"0",
"x2",
"y2 = 0,0,0,0",
"0",
"y2",
"a = map(int, input().split())",
"map(int, input().split())",
"a"
] |
w,h,n = map(int, input().split())
x1,x2,y1,y2 = 0,0,0,0
for _ in range(n):
x,y,a = map(int, input().split())
if a == 1: x1 = max(x1, x)
if a == 2: x2 = max(x2, w-x)
if a == 3: y1 = max(y1, y)
if a == 4: y2 = max(y2, h-y)
w -= x1+x2
h -= y1+y2
if w > 0 and h > 0: print(w*h)
else: print(0)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
13,
0,
13,
13,
0,
13,
39,
39,
17,
13,
39,
17,
13,
28,
13,
13,
14,
2,
18,
13,
17,
17,
0,
18,
18,
13,
17,
17,
4,
13,
18,
13,
17,
18,
18,
13,
17,
17,
14,
2,
18,
13,
17,
17,
0,
18,
18,
13,
17,
17,
4,
13,
18,
13,
17,
18,
18,
13,
17,
17,
14,
2,
18,
13,
17,
17,
0,
18,
18,
13,
17,
17,
4,
13,
18,
13,
17,
18,
18,
13,
17,
17,
14,
2,
18,
13,
17,
17,
0,
18,
18,
13,
17,
17,
4,
13,
18,
13,
17,
18,
18,
13,
17,
17,
0,
13,
2,
4,
13,
17,
2,
18,
18,
13,
17,
17,
18,
18,
13,
17,
17,
4,
13,
17,
2,
18,
18,
13,
17,
17,
18,
18,
13,
17,
17,
4,
13,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] |
[
[
171,
2
],
[
171,
11
],
[
171,
12
],
[
16,
15
],
[
160,
18
],
[
174,
22
],
[
162,
25
],
[
35,
34
],
[
175,
34
],
[
34,
39
],
[
48,
43
],
[
163,
45
],
[
34,
51
],
[
163,
55
],
[
34,
61
],
[
70,
65
],
[
163,
67
],
[
34,
73
],
[
163,
77
],
[
34,
83
],
[
92,
87
],
[
163,
89
],
[
34,
95
],
[
163,
99
],
[
34,
105
],
[
114,
109
],
[
163,
111
],
[
34,
117
],
[
163,
121
],
[
165,
125
],
[
163,
133
],
[
163,
138
],
[
163,
147
],
[
163,
152
],
[
166,
157
],
[
171,
160
],
[
162,
163
],
[
165,
166
],
[
171,
169
],
[
171,
172
],
[
174,
175
]
] |
[
"w,h,n=map(int,input().split())\na=[[int(i)for i in input().split()]for j in range(n)]\nS=[[0,w],[0,h]]\nfor i in a:\n if i[2]==1:\n S[0][0]=max(i[0],S[0][0])\n\n if i[2]==2:\n S[0][1]=min(i[0],S[0][1])\n\n if i[2]==3:\n S[1][0]=max(i[1],S[1][0])\n\n if i[2]==4:\n S[1][1]=min(i[1],S[1][1])\n\nans=max(0,(S[0][1]-S[0][0]))*max(0,(S[1][1]-S[1][0]))\nprint(ans)",
"w,h,n=map(int,input().split())",
"w",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"[int(i)for i in input().split()]for j in range(n)",
"for j in range(n)",
"j",
"range(n)",
"range",
"n",
"for j in range(n)",
"[int(i)for i in input().split()]",
"a=[[int(i)for i in input().split()]for j in range(n)]",
"a",
"[[int(i)for i in input().split()]for j in range(n)]",
"S=[[0,w],[0,h]]",
"S",
"[[0,w],[0,h]]",
"[0,w]",
"0",
"w",
"[0,h]",
"0",
"h",
"for i in a:\n if i[2]==1:\n S[0][0]=max(i[0],S[0][0])\n\n if i[2]==2:\n S[0][1]=min(i[0],S[0][1])\n\n if i[2]==3:\n S[1][0]=max(i[1],S[1][0])\n\n if i[2]==4:\n S[1][1]=min(i[1],S[1][1])",
"i",
"a",
"if i[2]==1:\n S[0][0]=max(i[0],S[0][0])\n\n ",
"i[2]==1",
"i[2]",
"i",
"2",
"1",
"S[0][0]=max(i[0],S[0][0])",
"S[0][0]",
"[0]",
"S",
"0",
"0",
"max(i[0],S[0][0])",
"max",
"i[0]",
"i",
"0",
"S[0][0]",
"[0]",
"S",
"0",
"0",
"if i[2]==2:\n S[0][1]=min(i[0],S[0][1])\n\n ",
"i[2]==2",
"i[2]",
"i",
"2",
"2",
"S[0][1]=min(i[0],S[0][1])",
"S[0][1]",
"[0]",
"S",
"0",
"1",
"min(i[0],S[0][1])",
"min",
"i[0]",
"i",
"0",
"S[0][1]",
"[0]",
"S",
"0",
"1",
"if i[2]==3:\n S[1][0]=max(i[1],S[1][0])\n\n ",
"i[2]==3",
"i[2]",
"i",
"2",
"3",
"S[1][0]=max(i[1],S[1][0])",
"S[1][0]",
"[1]",
"S",
"1",
"0",
"max(i[1],S[1][0])",
"max",
"i[1]",
"i",
"1",
"S[1][0]",
"[1]",
"S",
"1",
"0",
"if i[2]==4:\n S[1][1]=min(i[1],S[1][1])",
"i[2]==4",
"i[2]",
"i",
"2",
"4",
"S[1][1]=min(i[1],S[1][1])",
"S[1][1]",
"[1]",
"S",
"1",
"1",
"min(i[1],S[1][1])",
"min",
"i[1]",
"i",
"1",
"S[1][1]",
"[1]",
"S",
"1",
"1",
"ans=max(0,(S[0][1]-S[0][0]))*max(0,(S[1][1]-S[1][0]))",
"ans",
"max(0,(S[0][1]-S[0][0]))*max(0,(S[1][1]-S[1][0]))",
"max(0,(S[0][1]-S[0][0]))",
"max",
"0",
"S[0][1]-S[0][0]",
"S[0][1]",
"[0]",
"S",
"0",
"1",
"S[0][0]",
"[0]",
"S",
"0",
"0",
"max(0,(S[1][1]-S[1][0]))",
"max",
"0",
"S[1][1]-S[1][0]",
"S[1][1]",
"[1]",
"S",
"1",
"1",
"S[1][0]",
"[1]",
"S",
"1",
"0",
"print(ans)",
"print",
"ans",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"S=[[0,w],[0,h]]",
"[[0,w],[0,h]]",
"S",
"ans=max(0,(S[0][1]-S[0][0]))*max(0,(S[1][1]-S[1][0]))",
"max(0,(S[0][1]-S[0][0]))*max(0,(S[1][1]-S[1][0]))",
"ans",
"h,n=map(int,input().split())",
"map(int,input().split())",
"h",
"w,h,n=map(int,input().split())",
"map(int,input().split())",
"w",
"a=[[int(i)for i in input().split()]for j in range(n)]",
"[[int(i)for i in input().split()]for j in range(n)]",
"a"
] |
w,h,n=map(int,input().split())
a=[[int(i)for i in input().split()]for j in range(n)]
S=[[0,w],[0,h]]
for i in a:
if i[2]==1:
S[0][0]=max(i[0],S[0][0])
if i[2]==2:
S[0][1]=min(i[0],S[0][1])
if i[2]==3:
S[1][0]=max(i[1],S[1][0])
if i[2]==4:
S[1][1]=min(i[1],S[1][1])
ans=max(0,(S[0][1]-S[0][0]))*max(0,(S[1][1]-S[1][0]))
print(ans)
|
[
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,
14,
2,
18,
13,
17,
17,
14,
2,
18,
13,
17,
13,
0,
13,
18,
13,
17,
14,
2,
18,
13,
17,
17,
14,
2,
18,
13,
17,
13,
0,
13,
18,
13,
17,
14,
2,
18,
13,
17,
17,
14,
2,
18,
13,
17,
13,
0,
13,
18,
13,
17,
14,
2,
18,
13,
17,
13,
0,
13,
18,
13,
17,
0,
13,
8,
2,
13,
13,
2,
13,
13,
17,
0,
13,
8,
2,
13,
13,
2,
13,
13,
17,
4,
13,
2,
13,
13,
10,
18,
13,
10,
8,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
8,
13,
10,
18,
13,
10,
13,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
13,
13,
10,
18,
13,
10,
17,
13
] |
[
[
166,
2
],
[
166,
11
],
[
166,
12
],
[
16,
15
],
[
143,
18
],
[
145,
31
],
[
160,
34
],
[
157,
37
],
[
167,
38
],
[
175,
40
],
[
169,
43
],
[
149,
44
],
[
47,
46
],
[
146,
46
],
[
46,
51
],
[
46,
57
],
[
161,
59
],
[
155,
59
],
[
154,
61
],
[
46,
63
],
[
46,
68
],
[
46,
74
],
[
158,
76
],
[
164,
76
],
[
163,
78
],
[
46,
80
],
[
46,
85
],
[
46,
91
],
[
176,
93
],
[
173,
93
],
[
172,
95
],
[
46,
97
],
[
46,
102
],
[
170,
104
],
[
137,
104
],
[
136,
106
],
[
46,
108
],
[
151,
111
],
[
164,
114
],
[
158,
114
],
[
155,
115
],
[
161,
115
],
[
164,
117
],
[
158,
117
],
[
155,
118
],
[
161,
118
],
[
139,
121
],
[
137,
124
],
[
170,
124
],
[
173,
125
],
[
176,
125
],
[
137,
127
],
[
170,
127
],
[
173,
128
],
[
176,
128
],
[
152,
133
],
[
140,
134
],
[
136,
137
],
[
139,
140
],
[
166,
143
],
[
145,
146
],
[
166,
149
],
[
151,
152
],
[
154,
155
],
[
167,
157
],
[
157,
158
],
[
160,
161
],
[
163,
164
],
[
166,
167
],
[
149,
169
],
[
169,
170
],
[
172,
173
],
[
175,
176
]
] |
[
"W, H, N = map(int, input().split())\npoint_lst = [list(map(int, input().split())) for _ in range(N)]\nx_1 = 0\nx_2 = W\ny_1 = 0\ny_2 = H\n\nfor point in point_lst:\n if point[2] == 1:\n if point[0] > x_1:\n x_1 = point[0]\n\n elif point[2] == 2:\n if point[0] < x_2:\n x_2 = point[0]\n elif point[2] == 3:\n if point[1] > y_1:\n y_1 = point[1]\n else:\n if point[1] < y_2:\n y_2 = point[1]\n\nwidth = x_2 - x_1 if x_2 > x_1 else 0\nheight = y_2 - y_1 if y_2 > y_1 else 0\nprint(width*height)",
"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",
"point_lst = [list(map(int, input().split())) for _ in range(N)]",
"point_lst",
"[list(map(int, input().split())) for _ in range(N)]",
"x_1 = 0",
"x_1",
"0",
"x_2 = W",
"x_2",
"W",
"y_1 = 0",
"y_1",
"0",
"y_2 = H",
"y_2",
"H",
"for point in point_lst:\n if point[2] == 1:\n if point[0] > x_1:\n x_1 = point[0]\n\n elif point[2] == 2:\n if point[0] < x_2:\n x_2 = point[0]\n elif point[2] == 3:\n if point[1] > y_1:\n y_1 = point[1]\n else:\n if point[1] < y_2:\n y_2 = point[1]",
"point",
"point_lst",
"if point[2] == 1:\n if point[0] > x_1:\n x_1 = point[0]\n\n elif point[2] == 2:\n if point[0] < x_2:\n x_2 = point[0]\n elif point[2] == 3:\n if point[1] > y_1:\n y_1 = point[1]\n else:\n if point[1] < y_2:\n y_2 = point[1]",
"point[2] == 1",
"point[2]",
"point",
"2",
"1",
"if point[0] > x_1:\n x_1 = point[0]\n\n ",
"point[0] > x_1",
"point[0]",
"point",
"0",
"x_1",
"x_1 = point[0]",
"x_1",
"point[0]",
"point",
"0",
"elif point[2] == 2:\n if point[0] < x_2:\n x_2 = point[0]\n ",
"point[2] == 2",
"point[2]",
"point",
"2",
"2",
"if point[0] < x_2:\n x_2 = point[0]\n ",
"point[0] < x_2",
"point[0]",
"point",
"0",
"x_2",
"x_2 = point[0]",
"x_2",
"point[0]",
"point",
"0",
"elif point[2] == 3:\n if point[1] > y_1:\n y_1 = point[1]\n ",
"point[2] == 3",
"point[2]",
"point",
"2",
"3",
"if point[1] > y_1:\n y_1 = point[1]\n ",
"point[1] > y_1",
"point[1]",
"point",
"1",
"y_1",
"y_1 = point[1]",
"y_1",
"point[1]",
"point",
"1",
"if point[1] < y_2:\n y_2 = point[1]",
"point[1] < y_2",
"point[1]",
"point",
"1",
"y_2",
"y_2 = point[1]",
"y_2",
"point[1]",
"point",
"1",
"width = x_2 - x_1 if x_2 > x_1 else 0",
"width",
"x_2 - x_1 if x_2 > x_1 else 0",
"x_2 > x_1",
"x_2",
"x_1",
"x_2 - x_1",
"x_2",
"x_1",
"0",
"height = y_2 - y_1 if y_2 > y_1 else 0",
"height",
"y_2 - y_1 if y_2 > y_1 else 0",
"y_2 > y_1",
"y_2",
"y_1",
"y_2 - y_1",
"y_2",
"y_1",
"0",
"print(width*height)",
"print",
"width*height",
"width",
"height",
"y_2 = point[1]",
"point[1]",
"y_2",
"height = y_2 - y_1 if y_2 > y_1 else 0",
"y_2 - y_1 if y_2 > y_1 else 0",
"height",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"point_lst = [list(map(int, input().split())) for _ in range(N)]",
"[list(map(int, input().split())) for _ in range(N)]",
"point_lst",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"width = x_2 - x_1 if x_2 > x_1 else 0",
"x_2 - x_1 if x_2 > x_1 else 0",
"width",
"x_1 = point[0]",
"point[0]",
"x_1",
"x_2 = W",
"W",
"x_2",
"x_1 = 0",
"0",
"x_1",
"x_2 = point[0]",
"point[0]",
"x_2",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"y_2 = H",
"H",
"y_2",
"y_1 = point[1]",
"point[1]",
"y_1",
"y_1 = 0",
"0",
"y_1"
] |
W, H, N = map(int, input().split())
point_lst = [list(map(int, input().split())) for _ in range(N)]
x_1 = 0
x_2 = W
y_1 = 0
y_2 = H
for point in point_lst:
if point[2] == 1:
if point[0] > x_1:
x_1 = point[0]
elif point[2] == 2:
if point[0] < x_2:
x_2 = point[0]
elif point[2] == 3:
if point[1] > y_1:
y_1 = point[1]
else:
if point[1] < y_2:
y_2 = point[1]
width = x_2 - x_1 if x_2 > x_1 else 0
height = y_2 - y_1 if y_2 > y_1 else 0
print(width*height)
|
[
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,
14,
2,
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,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] |
[
[
152,
2
],
[
152,
11
],
[
152,
12
],
[
131,
14
],
[
144,
18
],
[
146,
20
],
[
153,
24
],
[
27,
26
],
[
129,
29
],
[
149,
31
],
[
149,
40
],
[
149,
41
],
[
141,
44
],
[
48,
47
],
[
138,
50
],
[
55,
52
],
[
132,
53
],
[
47,
54
],
[
141,
58
],
[
62,
61
],
[
138,
64
],
[
144,
65
],
[
70,
67
],
[
132,
68
],
[
61,
69
],
[
141,
73
],
[
77,
76
],
[
150,
79
],
[
84,
81
],
[
147,
82
],
[
76,
83
],
[
141,
87
],
[
91,
90
],
[
150,
93
],
[
153,
94
],
[
99,
96
],
[
147,
97
],
[
90,
98
],
[
134,
101
],
[
105,
104
],
[
144,
107
],
[
110,
109
],
[
153,
112
],
[
132,
116
],
[
104,
117
],
[
96,
118
],
[
81,
118
],
[
147,
119
],
[
109,
120
],
[
155,
122
],
[
156,
126
],
[
135,
126
],
[
152,
129
],
[
131,
132
],
[
134,
135
],
[
149,
138
],
[
149,
141
],
[
152,
144
],
[
146,
147
],
[
149,
150
],
[
152,
153
],
[
155,
156
]
] |
[
"W, H, N = map(int,input().split())\n\nX = [True]*W\nY = [True]*H\n\nfor i in range(N):\n x, y, a = map(int,input().split())\n if a == 1:\n for j in range(x):\n X[j] = False\n if a == 2:\n for j in range(x,W):\n X[j] = False\n if a == 3:\n for j in range(y):\n Y[j] = False\n if a == 4:\n for j in range(y,H):\n Y[j] = False\n\nans = 0\nfor i in range(W):\n for j in range(H):\n if X[i] and Y[j]:\n ans += 1\n \nprint(ans)",
"W, H, N = map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"X = [True]*W",
"X",
"[True]*W",
"[True]",
"True",
"W",
"Y = [True]*H",
"Y",
"[True]*H",
"[True]",
"True",
"H",
"for i in range(N):\n x, y, a = map(int,input().split())\n if a == 1:\n for j in range(x):\n X[j] = False\n if a == 2:\n for j in range(x,W):\n X[j] = False\n if a == 3:\n for j in range(y):\n Y[j] = False\n if a == 4:\n for j in range(y,H):\n Y[j] = False",
"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 j in range(x):\n X[j] = False\n ",
"a == 1",
"a",
"1",
"for j in range(x):\n X[j] = False\n ",
"j",
"range(x)",
"range",
"x",
"X[j] = False",
"X[j]",
"X",
"j",
"False",
"if a == 2:\n for j in range(x,W):\n X[j] = False\n ",
"a == 2",
"a",
"2",
"for j in range(x,W):\n X[j] = False\n ",
"j",
"range(x,W)",
"range",
"x",
"W",
"X[j] = False",
"X[j]",
"X",
"j",
"False",
"if a == 3:\n for j in range(y):\n Y[j] = False\n ",
"a == 3",
"a",
"3",
"for j in range(y):\n Y[j] = False\n ",
"j",
"range(y)",
"range",
"y",
"Y[j] = False",
"Y[j]",
"Y",
"j",
"False",
"if a == 4:\n for j in range(y,H):\n Y[j] = False",
"a == 4",
"a",
"4",
"for j in range(y,H):\n Y[j] = False",
"j",
"range(y,H)",
"range",
"y",
"H",
"Y[j] = False",
"Y[j]",
"Y",
"j",
"False",
"ans = 0",
"ans",
"0",
"for i in range(W):\n for j in range(H):\n if X[i] and Y[j]:\n ans += 1\n ",
"i",
"range(W)",
"range",
"W",
"for j in range(H):\n if X[i] and Y[j]:\n ans += 1\n ",
"j",
"range(H)",
"range",
"H",
"if X[i] and Y[j]:\n ans += 1\n ",
"X[i] and Y[j]",
"X[i]",
"X",
"i",
"Y[j]",
"Y",
"j",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"X = [True]*W",
"[True]*W",
"X",
"ans = 0",
"0",
"ans",
"x, y, a = map(int,input().split())",
"map(int,input().split())",
"x",
"a = map(int,input().split())",
"map(int,input().split())",
"a",
"W, H, N = map(int,input().split())",
"map(int,input().split())",
"W",
"Y = [True]*H",
"[True]*H",
"Y",
"y, a = map(int,input().split())",
"map(int,input().split())",
"y",
"H, N = map(int,input().split())",
"map(int,input().split())",
"H",
"ans += 1",
"1",
"ans"
] |
W, H, N = map(int,input().split())
X = [True]*W
Y = [True]*H
for i in range(N):
x, y, a = map(int,input().split())
if a == 1:
for j in range(x):
X[j] = False
if a == 2:
for j in range(x,W):
X[j] = False
if a == 3:
for j in range(y):
Y[j] = False
if a == 4:
for j in range(y,H):
Y[j] = False
ans = 0
for i in range(W):
for j in range(H):
if X[i] and Y[j]:
ans += 1
print(ans)
|
[
7,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
13,
0,
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,
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,
4,
13,
13,
28,
13,
4,
13,
13,
14,
18,
18,
13,
13,
13,
0,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
5,
13
],
[
5,
14
],
[
18,
17
],
[
4,
20
],
[
25,
24
],
[
28,
27
],
[
14,
30
],
[
33,
32
],
[
33,
41
],
[
33,
42
],
[
42,
45
],
[
49,
48
],
[
32,
51
],
[
54,
53
],
[
13,
56
],
[
63,
58
],
[
24,
60
],
[
48,
61
],
[
53,
62
],
[
42,
66
],
[
70,
69
],
[
32,
72
],
[
4,
73
],
[
76,
75
],
[
13,
78
],
[
85,
80
],
[
24,
82
],
[
69,
83
],
[
75,
84
],
[
42,
88
],
[
92,
91
],
[
4,
94
],
[
97,
96
],
[
41,
99
],
[
106,
101
],
[
24,
103
],
[
91,
104
],
[
96,
105
],
[
42,
109
],
[
113,
112
],
[
4,
115
],
[
118,
117
],
[
41,
120
],
[
13,
121
],
[
128,
123
],
[
24,
125
],
[
112,
126
],
[
117,
127
],
[
131,
130
],
[
134,
133
],
[
4,
136
],
[
139,
138
],
[
13,
141
],
[
24,
145
],
[
133,
146
],
[
138,
147
],
[
150,
149
],
[
149,
153
],
[
130,
153
],
[
162,
159
]
] |
[
"def main():\n\tW, H, N = map(int, input().split())\n\tlst = [[True for _ in range(H)] for _ in range(W)]\n\n\tfor _ in range(N):\n\t\tx, y, a = map(int, input().split())\n\n\t\tif a == 1:\n\t\t\tfor i in range(x):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 2:\n\t\t\tfor i in range(x, W):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 3:\n\t\t\tfor i in range(W):\n\t\t\t\tfor j in range(y):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 4:\n\t\t\tfor i in range(W):\n\t\t\t\tfor j in range(y, H):\n\t\t\t\t\tlst[i][j] = False\n\t\t\n\tcnt = 0\n\n\tfor i in range(W):\n\t\tfor j in range(H):\n\t\t\tif lst[i][j]:\n\t\t\t\tcnt += 1\n\n\tprint(cnt)\n\n \nif __name__ == \"__main__\":\n \tmain()",
"def main():\n\tW, H, N = map(int, input().split())\n\tlst = [[True for _ in range(H)] for _ in range(W)]\n\n\tfor _ in range(N):\n\t\tx, y, a = map(int, input().split())\n\n\t\tif a == 1:\n\t\t\tfor i in range(x):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 2:\n\t\t\tfor i in range(x, W):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 3:\n\t\t\tfor i in range(W):\n\t\t\t\tfor j in range(y):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 4:\n\t\t\tfor i in range(W):\n\t\t\t\tfor j in range(y, H):\n\t\t\t\t\tlst[i][j] = False\n\t\t\n\tcnt = 0\n\n\tfor i in range(W):\n\t\tfor j in range(H):\n\t\t\tif lst[i][j]:\n\t\t\t\tcnt += 1\n\n\tprint(cnt)\n\n ",
"main",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"[True for _ in range(H)] for _ in range(W)",
"for _ in range(W)",
"_",
"range(W)",
"range",
"W",
"for _ in range(W)",
"[True for _ in range(H)]",
"lst = [[True for _ in range(H)] for _ in range(W)]",
"lst",
"[[True for _ in range(H)] for _ in range(W)]",
"for _ in range(N):\n\t\tx, y, a = map(int, input().split())\n\n\t\tif a == 1:\n\t\t\tfor i in range(x):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 2:\n\t\t\tfor i in range(x, W):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 3:\n\t\t\tfor i in range(W):\n\t\t\t\tfor j in range(y):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 4:\n\t\t\tfor i in range(W):\n\t\t\t\tfor j in range(y, H):\n\t\t\t\t\tlst[i][j] = False\n\t\t\n\t",
"_",
"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\t\t\tfor i in range(x):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 2:\n\t\t\tfor i in range(x, W):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 3:\n\t\t\tfor i in range(W):\n\t\t\t\tfor j in range(y):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 4:\n\t\t\tfor i in range(W):\n\t\t\t\tfor j in range(y, H):\n\t\t\t\t\tlst[i][j] = False\n\t\t\n\t",
"a == 1",
"a",
"1",
"for i in range(x):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\t",
"i",
"range(x)",
"range",
"x",
"for j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\t",
"j",
"range(H)",
"range",
"H",
"lst[i][j] = False",
"lst[i][j]",
"[i]",
"lst",
"i",
"j",
"False",
"elif a == 2:\n\t\t\tfor i in range(x, W):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\t",
"a == 2",
"a",
"2",
"for i in range(x, W):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\t",
"i",
"range(x, W)",
"range",
"x",
"W",
"for j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\t",
"j",
"range(H)",
"range",
"H",
"lst[i][j] = False",
"lst[i][j]",
"[i]",
"lst",
"i",
"j",
"False",
"elif a == 3:\n\t\t\tfor i in range(W):\n\t\t\t\tfor j in range(y):\n\t\t\t\t\tlst[i][j] = False\n\t\t",
"a == 3",
"a",
"3",
"for i in range(W):\n\t\t\t\tfor j in range(y):\n\t\t\t\t\tlst[i][j] = False\n\t\t",
"i",
"range(W)",
"range",
"W",
"for j in range(y):\n\t\t\t\t\tlst[i][j] = False\n\t\t",
"j",
"range(y)",
"range",
"y",
"lst[i][j] = False",
"lst[i][j]",
"[i]",
"lst",
"i",
"j",
"False",
"elif a == 4:\n\t\t\tfor i in range(W):\n\t\t\t\tfor j in range(y, H):\n\t\t\t\t\tlst[i][j] = False\n\t\t\n\t",
"a == 4",
"a",
"4",
"for i in range(W):\n\t\t\t\tfor j in range(y, H):\n\t\t\t\t\tlst[i][j] = False\n\t\t\n\t",
"i",
"range(W)",
"range",
"W",
"for j in range(y, H):\n\t\t\t\t\tlst[i][j] = False\n\t\t\n\t",
"j",
"range(y, H)",
"range",
"y",
"H",
"lst[i][j] = False",
"lst[i][j]",
"[i]",
"lst",
"i",
"j",
"False",
"cnt = 0",
"cnt",
"0",
"for i in range(W):\n\t\tfor j in range(H):\n\t\t\tif lst[i][j]:\n\t\t\t\tcnt += 1\n\n\t",
"i",
"range(W)",
"range",
"W",
"for j in range(H):\n\t\t\tif lst[i][j]:\n\t\t\t\tcnt += 1\n\n\t",
"j",
"range(H)",
"range",
"H",
"if lst[i][j]:\n\t\t\t\tcnt += 1\n\n\t",
"lst[i][j]",
"[i]",
"lst",
"i",
"j",
"cnt += 1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"if __name__ == \"__main__\":\n \tmain()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n\tW, H, N = map(int, input().split())\n\tlst = [[True for _ in range(H)] for _ in range(W)]\n\n\tfor _ in range(N):\n\t\tx, y, a = map(int, input().split())\n\n\t\tif a == 1:\n\t\t\tfor i in range(x):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 2:\n\t\t\tfor i in range(x, W):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 3:\n\t\t\tfor i in range(W):\n\t\t\t\tfor j in range(y):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 4:\n\t\t\tfor i in range(W):\n\t\t\t\tfor j in range(y, H):\n\t\t\t\t\tlst[i][j] = False\n\t\t\n\tcnt = 0\n\n\tfor i in range(W):\n\t\tfor j in range(H):\n\t\t\tif lst[i][j]:\n\t\t\t\tcnt += 1\n\n\tprint(cnt)\n\n ",
"def main():\n\tW, H, N = map(int, input().split())\n\tlst = [[True for _ in range(H)] for _ in range(W)]\n\n\tfor _ in range(N):\n\t\tx, y, a = map(int, input().split())\n\n\t\tif a == 1:\n\t\t\tfor i in range(x):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 2:\n\t\t\tfor i in range(x, W):\n\t\t\t\tfor j in range(H):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 3:\n\t\t\tfor i in range(W):\n\t\t\t\tfor j in range(y):\n\t\t\t\t\tlst[i][j] = False\n\t\telif a == 4:\n\t\t\tfor i in range(W):\n\t\t\t\tfor j in range(y, H):\n\t\t\t\t\tlst[i][j] = False\n\t\t\n\tcnt = 0\n\n\tfor i in range(W):\n\t\tfor j in range(H):\n\t\t\tif lst[i][j]:\n\t\t\t\tcnt += 1\n\n\tprint(cnt)\n\n ",
"main"
] |
def main():
W, H, N = map(int, input().split())
lst = [[True for _ in range(H)] for _ in range(W)]
for _ in range(N):
x, y, a = map(int, input().split())
if a == 1:
for i in range(x):
for j in range(H):
lst[i][j] = False
elif a == 2:
for i in range(x, W):
for j in range(H):
lst[i][j] = False
elif a == 3:
for i in range(W):
for j in range(y):
lst[i][j] = False
elif a == 4:
for i in range(W):
for j in range(y, H):
lst[i][j] = False
cnt = 0
for i in range(W):
for j in range(H):
if lst[i][j]:
cnt += 1
print(cnt)
if __name__ == "__main__":
main()
|
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
39,
0,
13,
39,
17,
18,
13,
17,
0,
13,
39,
17,
18,
13,
17,
28,
13,
4,
13,
18,
13,
17,
4,
18,
13,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
28,
13,
13,
14,
2,
18,
13,
17,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
18,
13,
17,
14,
2,
18,
13,
17,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
18,
13,
17,
14,
2,
18,
13,
17,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
18,
13,
17,
0,
18,
13,
17,
4,
13,
18,
13,
17,
18,
13,
17,
0,
13,
2,
2,
18,
13,
17,
18,
13,
17,
2,
18,
13,
17,
18,
13,
17,
14,
2,
40,
18,
13,
17,
18,
13,
17,
40,
18,
13,
17,
18,
13,
17,
4,
13,
17,
4,
13,
13,
10,
39,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13,
10,
39,
13
] |
[
[
169,
2
],
[
166,
14
],
[
160,
17
],
[
170,
21
],
[
172,
24
],
[
170,
28
],
[
32,
31
],
[
170,
35
],
[
167,
39
],
[
53,
52
],
[
167,
52
],
[
52,
57
],
[
64,
61
],
[
161,
62
],
[
52,
67
],
[
161,
70
],
[
52,
75
],
[
82,
79
],
[
161,
80
],
[
52,
85
],
[
161,
88
],
[
52,
93
],
[
100,
97
],
[
173,
98
],
[
52,
103
],
[
173,
106
],
[
112,
109
],
[
173,
110
],
[
52,
115
],
[
173,
118
],
[
163,
121
],
[
161,
125
],
[
161,
128
],
[
173,
132
],
[
173,
135
],
[
161,
141
],
[
161,
144
],
[
173,
148
],
[
173,
151
],
[
164,
158
],
[
160,
161
],
[
163,
164
],
[
166,
167
],
[
169,
170
],
[
172,
173
]
] |
[
"whn_list = list(map(int,input().split()))\nx_y_list = []\nx = [0,whn_list[0]]\ny = [0,whn_list[1]]\n\nfor i in range(whn_list[2]):\n x_y_list.append(list(map(int,input().split())))\n\nfor i in x_y_list:\n if i[2] == 1:\n x[0] = max(i[0],x[0])\n elif i[2] == 2:\n x[1] = min(i[0],x[1])\n elif i[2] == 3:\n y[0] = max(i[1],y[0])\n else:\n y[1] = min(i[1],y[1])\n\ns = (x[1]-x[0])*(y[1]-y[0])\n\nif (x[1] <= x[0]) or (y[1] <= y[0]):\n print(0)\nelse:\n print(s)",
"whn_list = list(map(int,input().split()))",
"whn_list",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"x_y_list = []",
"x_y_list",
"[]",
"x = [0,whn_list[0]]",
"x",
"[0,whn_list[0]]",
"0",
"whn_list[0]",
"whn_list",
"0",
"y = [0,whn_list[1]]",
"y",
"[0,whn_list[1]]",
"0",
"whn_list[1]",
"whn_list",
"1",
"for i in range(whn_list[2]):\n x_y_list.append(list(map(int,input().split())))",
"i",
"range(whn_list[2])",
"range",
"whn_list[2]",
"whn_list",
"2",
"x_y_list.append(list(map(int,input().split())))",
"x_y_list.append",
"x_y_list",
"append",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in x_y_list:\n if i[2] == 1:\n x[0] = max(i[0],x[0])\n elif i[2] == 2:\n x[1] = min(i[0],x[1])\n elif i[2] == 3:\n y[0] = max(i[1],y[0])\n else:\n y[1] = min(i[1],y[1])",
"i",
"x_y_list",
"if i[2] == 1:\n x[0] = max(i[0],x[0])\n elif i[2] == 2:\n x[1] = min(i[0],x[1])\n elif i[2] == 3:\n y[0] = max(i[1],y[0])\n else:\n y[1] = min(i[1],y[1])",
"i[2] == 1",
"i[2]",
"i",
"2",
"1",
"x[0] = max(i[0],x[0])",
"x[0]",
"x",
"0",
"max(i[0],x[0])",
"max",
"i[0]",
"i",
"0",
"x[0]",
"x",
"0",
"elif i[2] == 2:\n x[1] = min(i[0],x[1])\n ",
"i[2] == 2",
"i[2]",
"i",
"2",
"2",
"x[1] = min(i[0],x[1])",
"x[1]",
"x",
"1",
"min(i[0],x[1])",
"min",
"i[0]",
"i",
"0",
"x[1]",
"x",
"1",
"elif i[2] == 3:\n y[0] = max(i[1],y[0])\n ",
"i[2] == 3",
"i[2]",
"i",
"2",
"3",
"y[0] = max(i[1],y[0])",
"y[0]",
"y",
"0",
"max(i[1],y[0])",
"max",
"i[1]",
"i",
"1",
"y[0]",
"y",
"0",
"y[1] = min(i[1],y[1])",
"y[1]",
"y",
"1",
"min(i[1],y[1])",
"min",
"i[1]",
"i",
"1",
"y[1]",
"y",
"1",
"s = (x[1]-x[0])*(y[1]-y[0])",
"s",
"(x[1]-x[0])*(y[1]-y[0])",
"x[1]-x[0]",
"x[1]",
"x",
"1",
"x[0]",
"x",
"0",
"y[1]-y[0]",
"y[1]",
"y",
"1",
"y[0]",
"y",
"0",
"if (x[1] <= x[0]) or (y[1] <= y[0]):\n print(0)\nelse:\n print(s)",
"(x[1] <= x[0]) or (y[1] <= y[0])",
"x[1] <= x[0]",
"x[1]",
"x",
"1",
"x[0]",
"x",
"0",
"y[1] <= y[0]",
"y[1]",
"y",
"1",
"y[0]",
"y",
"0",
"print(0)",
"print",
"0",
"print(s)",
"print",
"s",
"x = [0,whn_list[0]]",
"[0,whn_list[0]]",
"x",
"s = (x[1]-x[0])*(y[1]-y[0])",
"(x[1]-x[0])*(y[1]-y[0])",
"s",
"x_y_list = []",
"[]",
"x_y_list",
"whn_list = list(map(int,input().split()))",
"list(map(int,input().split()))",
"whn_list",
"y = [0,whn_list[1]]",
"[0,whn_list[1]]",
"y"
] |
whn_list = list(map(int,input().split()))
x_y_list = []
x = [0,whn_list[0]]
y = [0,whn_list[1]]
for i in range(whn_list[2]):
x_y_list.append(list(map(int,input().split())))
for i in x_y_list:
if i[2] == 1:
x[0] = max(i[0],x[0])
elif i[2] == 2:
x[1] = min(i[0],x[1])
elif i[2] == 3:
y[0] = max(i[1],y[0])
else:
y[1] = min(i[1],y[1])
s = (x[1]-x[0])*(y[1]-y[0])
if (x[1] <= x[0]) or (y[1] <= y[0]):
print(0)
else:
print(s)
|
[
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,
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,
0,
13,
4,
13,
13,
18,
18,
13,
13,
17,
14,
2,
40,
13,
13,
40,
13,
13,
4,
13,
17,
4,
13,
2,
2,
13,
13,
2,
13,
13,
10,
13,
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,
10,
4,
13,
10,
4,
13,
10,
13,
13
] |
[
[
165,
2
],
[
165,
11
],
[
165,
12
],
[
16,
15
],
[
154,
18
],
[
135,
31
],
[
138,
34
],
[
168,
37
],
[
160,
38
],
[
147,
40
],
[
156,
43
],
[
166,
44
],
[
47,
46
],
[
154,
49
],
[
136,
54
],
[
46,
55
],
[
144,
59
],
[
139,
62
],
[
145,
62
],
[
136,
65
],
[
46,
66
],
[
136,
72
],
[
46,
73
],
[
150,
77
],
[
169,
80
],
[
151,
80
],
[
136,
83
],
[
46,
84
],
[
136,
90
],
[
46,
91
],
[
162,
95
],
[
148,
98
],
[
163,
98
],
[
136,
101
],
[
46,
102
],
[
141,
105
],
[
157,
108
],
[
142,
108
],
[
136,
111
],
[
46,
112
],
[
151,
117
],
[
169,
117
],
[
145,
118
],
[
139,
118
],
[
142,
120
],
[
157,
120
],
[
163,
121
],
[
148,
121
],
[
151,
129
],
[
169,
129
],
[
145,
130
],
[
139,
130
],
[
142,
132
],
[
157,
132
],
[
163,
133
],
[
148,
133
],
[
135,
136
],
[
138,
139
],
[
141,
142
],
[
144,
145
],
[
147,
148
],
[
150,
151
],
[
165,
154
],
[
166,
156
],
[
156,
157
],
[
165,
160
],
[
162,
163
],
[
165,
166
],
[
160,
168
],
[
168,
169
]
] |
[
"\nw, h, n = map(int, input().split())\nsquare_info = [list(map(int, input().split())) for _ in range(n)]\n\nmin_x = 0\nmax_x = w\nmin_y = 0\nmax_y = h\n\nfor i in range(n):\n if square_info[i][2] == 1:\n min_x = max(min_x, square_info[i][0])\n elif square_info[i][2] == 2:\n max_x = min(max_x, square_info[i][0])\n elif square_info[i][2] == 3:\n min_y = max(min_y, square_info[i][1])\n else:\n max_y = min(max_y, square_info[i][1])\n\nif max_x <= min_x or max_y <= min_y:\n print(0)\nelse:\n print((max_x - min_x)*(max_y - min_y))",
"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",
"square_info = [list(map(int, input().split())) for _ in range(n)]",
"square_info",
"[list(map(int, input().split())) for _ in range(n)]",
"min_x = 0",
"min_x",
"0",
"max_x = w",
"max_x",
"w",
"min_y = 0",
"min_y",
"0",
"max_y = h",
"max_y",
"h",
"for i in range(n):\n if square_info[i][2] == 1:\n min_x = max(min_x, square_info[i][0])\n elif square_info[i][2] == 2:\n max_x = min(max_x, square_info[i][0])\n elif square_info[i][2] == 3:\n min_y = max(min_y, square_info[i][1])\n else:\n max_y = min(max_y, square_info[i][1])",
"i",
"range(n)",
"range",
"n",
"if square_info[i][2] == 1:\n min_x = max(min_x, square_info[i][0])\n elif square_info[i][2] == 2:\n max_x = min(max_x, square_info[i][0])\n elif square_info[i][2] == 3:\n min_y = max(min_y, square_info[i][1])\n else:\n max_y = min(max_y, square_info[i][1])",
"square_info[i][2] == 1",
"square_info[i][2]",
"[i]",
"square_info",
"i",
"2",
"1",
"min_x = max(min_x, square_info[i][0])",
"min_x",
"max(min_x, square_info[i][0])",
"max",
"min_x",
"square_info[i][0]",
"[i]",
"square_info",
"i",
"0",
"elif square_info[i][2] == 2:\n max_x = min(max_x, square_info[i][0])\n ",
"square_info[i][2] == 2",
"square_info[i][2]",
"[i]",
"square_info",
"i",
"2",
"2",
"max_x = min(max_x, square_info[i][0])",
"max_x",
"min(max_x, square_info[i][0])",
"min",
"max_x",
"square_info[i][0]",
"[i]",
"square_info",
"i",
"0",
"elif square_info[i][2] == 3:\n min_y = max(min_y, square_info[i][1])\n ",
"square_info[i][2] == 3",
"square_info[i][2]",
"[i]",
"square_info",
"i",
"2",
"3",
"min_y = max(min_y, square_info[i][1])",
"min_y",
"max(min_y, square_info[i][1])",
"max",
"min_y",
"square_info[i][1]",
"[i]",
"square_info",
"i",
"1",
"max_y = min(max_y, square_info[i][1])",
"max_y",
"min(max_y, square_info[i][1])",
"min",
"max_y",
"square_info[i][1]",
"[i]",
"square_info",
"i",
"1",
"if max_x <= min_x or max_y <= min_y:\n print(0)\nelse:\n print((max_x - min_x)*(max_y - min_y))",
"max_x <= min_x or max_y <= min_y",
"max_x <= min_x",
"max_x",
"min_x",
"max_y <= min_y",
"max_y",
"min_y",
"print(0)",
"print",
"0",
"print((max_x - min_x)*(max_y - min_y))",
"print",
"(max_x - min_x)*(max_y - min_y)",
"max_x - min_x",
"max_x",
"min_x",
"max_y - min_y",
"max_y",
"min_y",
"square_info = [list(map(int, input().split())) for _ in range(n)]",
"[list(map(int, input().split())) for _ in range(n)]",
"square_info",
"min_x = 0",
"0",
"min_x",
"max_y = min(max_y, square_info[i][1])",
"min(max_y, square_info[i][1])",
"max_y",
"min_x = max(min_x, square_info[i][0])",
"max(min_x, square_info[i][0])",
"min_x",
"min_y = 0",
"0",
"min_y",
"max_x = min(max_x, square_info[i][0])",
"min(max_x, square_info[i][0])",
"max_x",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"max_y = h",
"h",
"max_y",
"w, h, n = map(int, input().split())",
"map(int, input().split())",
"w",
"min_y = max(min_y, square_info[i][1])",
"max(min_y, square_info[i][1])",
"min_y",
"h, n = map(int, input().split())",
"map(int, input().split())",
"h",
"max_x = w",
"w",
"max_x"
] |
w, h, n = map(int, input().split())
square_info = [list(map(int, input().split())) for _ in range(n)]
min_x = 0
max_x = w
min_y = 0
max_y = h
for i in range(n):
if square_info[i][2] == 1:
min_x = max(min_x, square_info[i][0])
elif square_info[i][2] == 2:
max_x = min(max_x, square_info[i][0])
elif square_info[i][2] == 3:
min_y = max(min_y, square_info[i][1])
else:
max_y = min(max_y, square_info[i][1])
if max_x <= min_x or max_y <= min_y:
print(0)
else:
print((max_x - min_x)*(max_y - min_y))
|
[
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,
13,
13,
13,
17,
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,
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,
13,
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,
10,
13,
13,
10,
17,
13,
10,
4,
13
] |
[
[
124,
2
],
[
124,
11
],
[
124,
12
],
[
16,
15
],
[
113,
18
],
[
121,
31
],
[
127,
34
],
[
130,
36
],
[
116,
37
],
[
133,
38
],
[
103,
40
],
[
125,
41
],
[
106,
52
],
[
128,
56
],
[
107,
56
],
[
118,
62
],
[
131,
66
],
[
119,
66
],
[
109,
72
],
[
134,
76
],
[
110,
76
],
[
136,
82
],
[
104,
86
],
[
137,
86
],
[
119,
94
],
[
131,
94
],
[
107,
95
],
[
128,
95
],
[
137,
100
],
[
104,
100
],
[
110,
101
],
[
134,
101
],
[
125,
103
],
[
103,
104
],
[
106,
107
],
[
109,
110
],
[
124,
113
],
[
124,
116
],
[
118,
119
],
[
121,
122
],
[
124,
125
],
[
127,
128
],
[
116,
130
],
[
130,
131
],
[
133,
134
],
[
136,
137
]
] |
[
"w, h, n = map(int, input().split())\nxya = [list(map(int, input().split())) for _ in range(n)]\n\nl, r, b, t = 0, w, 0, h\nfor x, y, a in xya:\n if a == 1:\n l = max(x, l)\n elif a == 2:\n r = min(x, r)\n elif a == 3:\n b = max(y, b)\n elif a == 4:\n t = min(y, t)\nprint(max(0, r - l) * max(0, t - b))",
"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)]",
"l, r, b, t = 0, w, 0, h",
"l",
"0",
"r",
"w",
"b",
"0",
"t",
"h",
"for x, y, a in xya:\n if a == 1:\n l = max(x, l)\n elif a == 2:\n r = min(x, r)\n elif a == 3:\n b = max(y, b)\n elif a == 4:\n t = min(y, t)",
"x",
"y",
"a",
"xya",
"if a == 1:\n l = max(x, l)\n elif a == 2:\n r = min(x, r)\n elif a == 3:\n b = max(y, b)\n elif a == 4:\n t = min(y, t)",
"a == 1",
"a",
"1",
"l = max(x, l)",
"l",
"max(x, l)",
"max",
"x",
"l",
"elif a == 2:\n r = min(x, r)\n ",
"a == 2",
"a",
"2",
"r = min(x, r)",
"r",
"min(x, r)",
"min",
"x",
"r",
"elif a == 3:\n b = max(y, b)\n ",
"a == 3",
"a",
"3",
"b = max(y, b)",
"b",
"max(y, b)",
"max",
"y",
"b",
"elif a == 4:\n t = min(y, t)",
"a == 4",
"a",
"4",
"t = min(y, t)",
"t",
"min(y, t)",
"min",
"y",
"t",
"print(max(0, r - l) * max(0, t - b))",
"print",
"max(0, r - l) * max(0, t - b)",
"max(0, r - l)",
"max",
"0",
"r - l",
"r",
"l",
"max(0, t - b)",
"max",
"0",
"t - b",
"t",
"b",
"t = 0, w, 0, h",
"h",
"t",
"l = max(x, l)",
"max(x, l)",
"l",
"b = max(y, b)",
"max(y, b)",
"b",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"w, h, n = map(int, input().split())",
"map(int, input().split())",
"w",
"r = min(x, r)",
"min(x, r)",
"r",
"xya = [list(map(int, input().split())) for _ in range(n)]",
"[list(map(int, input().split())) for _ in range(n)]",
"xya",
"h, n = map(int, input().split())",
"map(int, input().split())",
"h",
"l, r, b, t = 0, w, 0, h",
"0",
"l",
"r, b, t = 0, w, 0, h",
"w",
"r",
"b, t = 0, w, 0, h",
"0",
"b",
"t = min(y, t)",
"min(y, t)",
"t"
] |
w, h, n = map(int, input().split())
xya = [list(map(int, input().split())) for _ in range(n)]
l, r, b, t = 0, w, 0, h
for x, y, a in xya:
if a == 1:
l = max(x, l)
elif a == 2:
r = min(x, r)
elif a == 3:
b = max(y, b)
elif a == 4:
t = min(y, t)
print(max(0, r - l) * max(0, t - b))
|
[
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,
41,
28,
13,
4,
13,
13,
4,
13,
0,
13,
13,
28,
13,
13,
14,
2,
18,
13,
17,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
18,
13,
17,
0,
18,
18,
13,
13,
13,
17,
14,
2,
18,
13,
17,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
18,
13,
17,
13,
17,
0,
18,
18,
13,
13,
13,
17,
14,
2,
18,
13,
17,
17,
28,
13,
4,
13,
18,
13,
17,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
13,
17,
14,
2,
18,
13,
17,
17,
28,
13,
4,
13,
18,
13,
17,
13,
17,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
13,
17,
0,
13,
17,
28,
13,
13,
0,
13,
4,
18,
13,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13
] |
[
[
186,
2
],
[
186,
11
],
[
186,
12
],
[
16,
15
],
[
178,
18
],
[
180,
31
],
[
36,
35
],
[
175,
38
],
[
183,
42
],
[
46,
45
],
[
181,
45
],
[
45,
50
],
[
55,
54
],
[
175,
57
],
[
60,
59
],
[
45,
63
],
[
71,
66
],
[
184,
68
],
[
54,
69
],
[
59,
70
],
[
45,
75
],
[
80,
79
],
[
175,
82
],
[
85,
84
],
[
45,
88
],
[
187,
90
],
[
98,
93
],
[
184,
95
],
[
79,
96
],
[
84,
97
],
[
45,
102
],
[
107,
106
],
[
45,
110
],
[
114,
113
],
[
187,
116
],
[
123,
118
],
[
184,
120
],
[
106,
121
],
[
113,
122
],
[
45,
127
],
[
132,
131
],
[
45,
135
],
[
175,
137
],
[
141,
140
],
[
187,
143
],
[
150,
145
],
[
184,
147
],
[
131,
148
],
[
140,
149
],
[
168,
152
],
[
156,
155
],
[
184,
155
],
[
171,
158
],
[
155,
161
],
[
169,
162
],
[
172,
162
],
[
172,
166
],
[
169,
166
],
[
168,
169
],
[
171,
172
],
[
186,
175
],
[
186,
178
],
[
180,
181
],
[
183,
184
],
[
186,
187
]
] |
[
"W, H, N = map(int, input().split())\ncheck = [list(map(int, input().split())) for i in range(N)]\n\nrect = [[\"W\" for i in range(W)] for j in range(H)]\n\nfor x in check:\n if x[2] == 1:\n for h1 in range(H):\n for w1 in range(x[0]):\n rect[h1][w1] = \"B\"\n\n elif x[2] == 2:\n for h2 in range(H):\n for w2 in range(x[0], W, 1):\n rect[h2][w2] = \"B\"\n elif x[2] == 3:\n for h3 in range(x[1]):\n for w3 in range(W):\n rect[h3][w3] = \"B\"\n\n elif x[2] == 4:\n for h3 in range(x[1], H, 1):\n for w3 in range(W):\n rect[h3][w3] = \"B\"\n\n\ncount = 0\nfor y in rect:\n count += y.count(\"W\")\nprint(count)",
"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",
"check = [list(map(int, input().split())) for i in range(N)]",
"check",
"[list(map(int, input().split())) for i in range(N)]",
"[\"W\" 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)",
"[\"W\" for i in range(W)]",
"rect = [[\"W\" for i in range(W)] for j in range(H)]",
"rect",
"[[\"W\" for i in range(W)] for j in range(H)]",
"for x in check:\n if x[2] == 1:\n for h1 in range(H):\n for w1 in range(x[0]):\n rect[h1][w1] = \"B\"\n\n elif x[2] == 2:\n for h2 in range(H):\n for w2 in range(x[0], W, 1):\n rect[h2][w2] = \"B\"\n elif x[2] == 3:\n for h3 in range(x[1]):\n for w3 in range(W):\n rect[h3][w3] = \"B\"\n\n elif x[2] == 4:\n for h3 in range(x[1], H, 1):\n for w3 in range(W):\n rect[h3][w3] = \"B\"",
"x",
"check",
"if x[2] == 1:\n for h1 in range(H):\n for w1 in range(x[0]):\n rect[h1][w1] = \"B\"\n\n elif x[2] == 2:\n for h2 in range(H):\n for w2 in range(x[0], W, 1):\n rect[h2][w2] = \"B\"\n elif x[2] == 3:\n for h3 in range(x[1]):\n for w3 in range(W):\n rect[h3][w3] = \"B\"\n\n elif x[2] == 4:\n for h3 in range(x[1], H, 1):\n for w3 in range(W):\n rect[h3][w3] = \"B\"",
"x[2] == 1",
"x[2]",
"x",
"2",
"1",
"for h1 in range(H):\n for w1 in range(x[0]):\n rect[h1][w1] = \"B\"\n\n ",
"h1",
"range(H)",
"range",
"H",
"for w1 in range(x[0]):\n rect[h1][w1] = \"B\"\n\n ",
"w1",
"range(x[0])",
"range",
"x[0]",
"x",
"0",
"rect[h1][w1] = \"B\"",
"rect[h1][w1]",
"[h1]",
"rect",
"h1",
"w1",
"\"B\"",
"elif x[2] == 2:\n for h2 in range(H):\n for w2 in range(x[0], W, 1):\n rect[h2][w2] = \"B\"\n ",
"x[2] == 2",
"x[2]",
"x",
"2",
"2",
"for h2 in range(H):\n for w2 in range(x[0], W, 1):\n rect[h2][w2] = \"B\"\n ",
"h2",
"range(H)",
"range",
"H",
"for w2 in range(x[0], W, 1):\n rect[h2][w2] = \"B\"\n ",
"w2",
"range(x[0], W, 1)",
"range",
"x[0]",
"x",
"0",
"W",
"1",
"rect[h2][w2] = \"B\"",
"rect[h2][w2]",
"[h2]",
"rect",
"h2",
"w2",
"\"B\"",
"elif x[2] == 3:\n for h3 in range(x[1]):\n for w3 in range(W):\n rect[h3][w3] = \"B\"\n\n ",
"x[2] == 3",
"x[2]",
"x",
"2",
"3",
"for h3 in range(x[1]):\n for w3 in range(W):\n rect[h3][w3] = \"B\"\n\n ",
"h3",
"range(x[1])",
"range",
"x[1]",
"x",
"1",
"for w3 in range(W):\n rect[h3][w3] = \"B\"\n\n ",
"w3",
"range(W)",
"range",
"W",
"rect[h3][w3] = \"B\"",
"rect[h3][w3]",
"[h3]",
"rect",
"h3",
"w3",
"\"B\"",
"elif x[2] == 4:\n for h3 in range(x[1], H, 1):\n for w3 in range(W):\n rect[h3][w3] = \"B\"",
"x[2] == 4",
"x[2]",
"x",
"2",
"4",
"for h3 in range(x[1], H, 1):\n for w3 in range(W):\n rect[h3][w3] = \"B\"",
"h3",
"range(x[1], H, 1)",
"range",
"x[1]",
"x",
"1",
"H",
"1",
"for w3 in range(W):\n rect[h3][w3] = \"B\"",
"w3",
"range(W)",
"range",
"W",
"rect[h3][w3] = \"B\"",
"rect[h3][w3]",
"[h3]",
"rect",
"h3",
"w3",
"\"B\"",
"count = 0",
"count",
"0",
"for y in rect:\n count += y.count(\"W\")",
"y",
"rect",
"count += y.count(\"W\")",
"count",
"y.count(\"W\")",
"y.count",
"y",
"count",
"\"W\"",
"print(count)",
"print",
"count",
"count = 0",
"0",
"count",
"count += y.count(\"W\")",
"y.count(\"W\")",
"count",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"check = [list(map(int, input().split())) for i in range(N)]",
"[list(map(int, input().split())) for i in range(N)]",
"check",
"rect = [[\"W\" for i in range(W)] for j in range(H)]",
"[[\"W\" for i in range(W)] for j in range(H)]",
"rect",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W"
] |
W, H, N = map(int, input().split())
check = [list(map(int, input().split())) for i in range(N)]
rect = [["W" for i in range(W)] for j in range(H)]
for x in check:
if x[2] == 1:
for h1 in range(H):
for w1 in range(x[0]):
rect[h1][w1] = "B"
elif x[2] == 2:
for h2 in range(H):
for w2 in range(x[0], W, 1):
rect[h2][w2] = "B"
elif x[2] == 3:
for h3 in range(x[1]):
for w3 in range(W):
rect[h3][w3] = "B"
elif x[2] == 4:
for h3 in range(x[1], H, 1):
for w3 in range(W):
rect[h3][w3] = "B"
count = 0
for y in rect:
count += y.count("W")
print(count)
|
[
7,
15,
15,
15,
15,
13,
15,
13,
12,
13,
29,
4,
13,
4,
13,
12,
13,
29,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
29,
4,
13,
12,
13,
29,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
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,
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,
12,
13,
10,
4,
13,
10,
12,
13,
10,
17,
13,
10,
12,
13,
10,
17,
13,
10,
12,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13
] |
[
[
167,
42
],
[
138,
44
],
[
167,
45
],
[
167,
46
],
[
50,
49
],
[
141,
52
],
[
138,
55
],
[
170,
57
],
[
152,
60
],
[
173,
63
],
[
168,
64
],
[
146,
66
],
[
158,
69
],
[
129,
70
],
[
131,
81
],
[
153,
85
],
[
132,
85
],
[
134,
91
],
[
174,
95
],
[
135,
95
],
[
164,
101
],
[
147,
105
],
[
165,
105
],
[
161,
107
],
[
159,
111
],
[
162,
111
],
[
135,
119
],
[
174,
119
],
[
132,
120
],
[
153,
120
],
[
162,
125
],
[
159,
125
],
[
165,
126
],
[
147,
126
],
[
167,
129
],
[
131,
132
],
[
134,
135
],
[
167,
141
],
[
146,
147
],
[
152,
153
],
[
129,
158
],
[
158,
159
],
[
161,
162
],
[
164,
165
],
[
167,
168
],
[
170,
171
],
[
168,
173
],
[
173,
174
]
] |
[
"from collections import defaultdict\nfrom collections import deque\nfrom collections import Counter\nimport itertools\nimport math\n\ndef readInt():\n return int(input())\ndef readInts():\n return list(map(int, input().split()))\ndef readChar():\n return input()\ndef readChars():\n return input().split()\n\nw,h,n = readInts()\nxya = [readInts() for i in range(n)]\n\nxmin = 0\nxmax = w\nymin = 0\nymax = h\n\nfor x,y,a in xya:\n if a==1:\n xmin = max(x,xmin)\n elif a==2:\n xmax = min(x,xmax)\n elif a==3:\n ymin = max(y,ymin)\n else:\n ymax = min(y,ymax)\n\nprint(max(0,xmax-xmin)*max(0,ymax-ymin))",
"from collections import defaultdict",
"from collections import deque",
"from collections import Counter",
"import itertools",
"itertools",
"import math",
"math",
"def readInt():\n return int(input())",
"readInt",
"return int(input())",
"int(input())",
"int",
"input()",
"input",
"def readInts():\n return list(map(int, input().split()))",
"readInts",
"return list(map(int, input().split()))",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"def readChar():\n return input()",
"readChar",
"return input()",
"input()",
"input",
"def readChars():\n return input().split()",
"readChars",
"return input().split()",
"input().split()",
"().split",
"()",
"input",
"split",
"w,h,n = readInts()",
"w",
"readInts()",
"readInts",
"h",
"n",
"readInts() for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"readInts()",
"readInts",
"xya = [readInts() for i in range(n)]",
"xya",
"[readInts() for i in range(n)]",
"xmin = 0",
"xmin",
"0",
"xmax = w",
"xmax",
"w",
"ymin = 0",
"ymin",
"0",
"ymax = h",
"ymax",
"h",
"for x,y,a in xya:\n if a==1:\n xmin = max(x,xmin)\n elif a==2:\n xmax = min(x,xmax)\n elif a==3:\n ymin = max(y,ymin)\n else:\n ymax = min(y,ymax)",
"x",
"y",
"a",
"xya",
"if a==1:\n xmin = max(x,xmin)\n elif a==2:\n xmax = min(x,xmax)\n elif a==3:\n ymin = max(y,ymin)\n else:\n ymax = min(y,ymax)",
"a==1",
"a",
"1",
"xmin = max(x,xmin)",
"xmin",
"max(x,xmin)",
"max",
"x",
"xmin",
"elif a==2:\n xmax = min(x,xmax)\n ",
"a==2",
"a",
"2",
"xmax = min(x,xmax)",
"xmax",
"min(x,xmax)",
"min",
"x",
"xmax",
"elif a==3:\n ymin = max(y,ymin)\n ",
"a==3",
"a",
"3",
"ymin = max(y,ymin)",
"ymin",
"max(y,ymin)",
"max",
"y",
"ymin",
"ymax = min(y,ymax)",
"ymax",
"min(y,ymax)",
"min",
"y",
"ymax",
"print(max(0,xmax-xmin)*max(0,ymax-ymin))",
"print",
"max(0,xmax-xmin)*max(0,ymax-ymin)",
"max(0,xmax-xmin)",
"max",
"0",
"xmax-xmin",
"xmax",
"xmin",
"max(0,ymax-ymin)",
"max",
"0",
"ymax-ymin",
"ymax",
"ymin",
"h,n = readInts()",
"readInts()",
"h",
"xmin = max(x,xmin)",
"max(x,xmin)",
"xmin",
"xmax = min(x,xmax)",
"min(x,xmax)",
"xmax",
"def readInts():\n return list(map(int, input().split()))",
"def readInts():\n return list(map(int, input().split()))",
"readInts",
"n = readInts()",
"readInts()",
"n",
"def readChar():\n return input()",
"def readChar():\n return input()",
"readChar",
"ymin = 0",
"0",
"ymin",
"def readInt():\n return int(input())",
"def readInt():\n return int(input())",
"readInt",
"xmin = 0",
"0",
"xmin",
"def readChars():\n return input().split()",
"def readChars():\n return input().split()",
"readChars",
"ymax = h",
"h",
"ymax",
"ymax = min(y,ymax)",
"min(y,ymax)",
"ymax",
"ymin = max(y,ymin)",
"max(y,ymin)",
"ymin",
"w,h,n = readInts()",
"readInts()",
"w",
"xya = [readInts() for i in range(n)]",
"[readInts() for i in range(n)]",
"xya",
"xmax = w",
"w",
"xmax"
] |
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math
def readInt():
return int(input())
def readInts():
return list(map(int, input().split()))
def readChar():
return input()
def readChars():
return input().split()
w,h,n = readInts()
xya = [readInts() for i in range(n)]
xmin = 0
xmax = w
ymin = 0
ymax = h
for x,y,a in xya:
if a==1:
xmin = max(x,xmin)
elif a==2:
xmax = min(x,xmax)
elif a==3:
ymin = max(y,ymin)
else:
ymax = min(y,ymax)
print(max(0,xmax-xmin)*max(0,ymax-ymin))
|
[
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,
13,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
134,
2
],
[
134,
11
],
[
134,
12
],
[
104,
14
],
[
101,
16
],
[
108,
17
],
[
116,
18
],
[
95,
20
],
[
111,
21
],
[
24,
23
],
[
135,
26
],
[
131,
28
],
[
131,
37
],
[
131,
38
],
[
132,
41
],
[
113,
44
],
[
105,
47
],
[
114,
47
],
[
123,
48
],
[
132,
51
],
[
119,
54
],
[
102,
57
],
[
120,
57
],
[
123,
58
],
[
132,
61
],
[
128,
64
],
[
117,
67
],
[
129,
67
],
[
126,
68
],
[
132,
71
],
[
98,
74
],
[
96,
77
],
[
99,
77
],
[
126,
78
],
[
120,
86
],
[
102,
86
],
[
114,
87
],
[
105,
87
],
[
99,
92
],
[
96,
92
],
[
129,
93
],
[
117,
93
],
[
111,
95
],
[
95,
96
],
[
98,
99
],
[
108,
101
],
[
101,
102
],
[
104,
105
],
[
134,
108
],
[
134,
111
],
[
113,
114
],
[
116,
117
],
[
119,
120
],
[
131,
123
],
[
131,
126
],
[
128,
129
],
[
131,
132
],
[
134,
135
]
] |
[
"W,H,N=map(int,input().split())\na,b,c,d=0,W,0,H\n\nfor i in range(N):\n x,y,A=map(int,input().split())\n if A==1:\n a=max(a,x)\n if A==2:\n b=min(b,x)\n if A==3:\n c=max(c,y)\n if A==4:\n d=min(d,y)\n \nprint(max(0,b-a)*max(0,d-c))",
"W,H,N=map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"a,b,c,d=0,W,0,H",
"a",
"0",
"b",
"W",
"c",
"0",
"d",
"H",
"for i in range(N):\n x,y,A=map(int,input().split())\n if A==1:\n a=max(a,x)\n if A==2:\n b=min(b,x)\n if A==3:\n c=max(c,y)\n if A==4:\n d=min(d,y)\n ",
"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 a=max(a,x)\n ",
"A==1",
"A",
"1",
"a=max(a,x)",
"a",
"max(a,x)",
"max",
"a",
"x",
"if A==2:\n b=min(b,x)\n ",
"A==2",
"A",
"2",
"b=min(b,x)",
"b",
"min(b,x)",
"min",
"b",
"x",
"if A==3:\n c=max(c,y)\n ",
"A==3",
"A",
"3",
"c=max(c,y)",
"c",
"max(c,y)",
"max",
"c",
"y",
"if A==4:\n d=min(d,y)\n ",
"A==4",
"A",
"4",
"d=min(d,y)",
"d",
"min(d,y)",
"min",
"d",
"y",
"print(max(0,b-a)*max(0,d-c))",
"print",
"max(0,b-a)*max(0,d-c)",
"max(0,b-a)",
"max",
"0",
"b-a",
"b",
"a",
"max(0,d-c)",
"max",
"0",
"d-c",
"d",
"c",
"d=0,W,0,H",
"H",
"d",
"d=min(d,y)",
"min(d,y)",
"d",
"b,c,d=0,W,0,H",
"W",
"b",
"a,b,c,d=0,W,0,H",
"0",
"a",
"W,H,N=map(int,input().split())",
"map(int,input().split())",
"W",
"H,N=map(int,input().split())",
"map(int,input().split())",
"H",
"a=max(a,x)",
"max(a,x)",
"a",
"c,d=0,W,0,H",
"0",
"c",
"b=min(b,x)",
"min(b,x)",
"b",
"x,y,A=map(int,input().split())",
"map(int,input().split())",
"x",
"y,A=map(int,input().split())",
"map(int,input().split())",
"y",
"c=max(c,y)",
"max(c,y)",
"c",
"A=map(int,input().split())",
"map(int,input().split())",
"A",
"N=map(int,input().split())",
"map(int,input().split())",
"N"
] |
W,H,N=map(int,input().split())
a,b,c,d=0,W,0,H
for i in range(N):
x,y,A=map(int,input().split())
if A==1:
a=max(a,x)
if A==2:
b=min(b,x)
if A==3:
c=max(c,y)
if A==4:
d=min(d,y)
print(max(0,b-a)*max(0,d-c))
|
[
7,
15,
13,
0,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
4,
18,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
18,
13,
13,
39,
4,
13,
13,
4,
13,
13,
28,
13,
13,
0,
13,
4,
13,
18,
13,
17,
0,
13,
4,
13,
18,
13,
17,
0,
13,
4,
13,
18,
13,
17,
14,
2,
13,
17,
0,
18,
13,
39,
13,
17,
14,
2,
13,
17,
0,
18,
13,
39,
13,
17,
14,
2,
13,
17,
0,
18,
13,
39,
17,
14,
2,
13,
17,
0,
18,
13,
39,
17,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13
] |
[
[
163,
4
],
[
163,
10
],
[
163,
11
],
[
145,
13
],
[
17,
16
],
[
164,
21
],
[
146,
24
],
[
148,
32
],
[
143,
40
],
[
140,
43
],
[
46,
45
],
[
146,
45
],
[
136,
48
],
[
45,
52
],
[
157,
55
],
[
45,
59
],
[
151,
62
],
[
45,
66
],
[
152,
70
],
[
77,
73
],
[
149,
74
],
[
152,
80
],
[
87,
83
],
[
149,
84
],
[
152,
90
],
[
96,
93
],
[
149,
94
],
[
152,
99
],
[
105,
102
],
[
149,
103
],
[
160,
107
],
[
111,
110
],
[
143,
115
],
[
118,
117
],
[
140,
122
],
[
149,
126
],
[
110,
127
],
[
154,
130
],
[
155,
134
],
[
161,
134
],
[
136,
137
],
[
163,
140
],
[
163,
143
],
[
145,
146
],
[
148,
149
],
[
151,
152
],
[
154,
155
],
[
157,
158
],
[
160,
161
],
[
163,
164
]
] |
[
"import numpy as np\n\nW, H, N = input().split()\ncommands = []\nfor i in range(int(N)):\n commands.append(input().split())\npic = np.zeros((int(W),int(H)))\nfor com in commands:\n x = int(com[0])\n y = int(com[1])\n a = int(com[2])\n if a==1:\n pic[:x,:] = 1\n if a==2:\n pic[x:,:] = 1\n if a==3:\n pic[:,:y] = 1\n if a==4:\n pic[:,y:] = 1\n\narea = 0\n\nfor w in range(int(W)):\n for h in range(int(H)):\n if pic[w,h]==0:\n area += 1\n \nprint(area)",
"import numpy as np",
"numpy",
"W, H, N = input().split()",
"W",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"commands = []",
"commands",
"[]",
"for i in range(int(N)):\n commands.append(input().split())",
"i",
"range(int(N))",
"range",
"int(N)",
"int",
"N",
"commands.append(input().split())",
"commands.append",
"commands",
"append",
"input().split()",
"().split",
"()",
"input",
"split",
"pic = np.zeros((int(W),int(H)))",
"pic",
"np.zeros((int(W),int(H)))",
"np.zeros",
"np",
"zeros",
"(int(W),int(H))",
"int(W)",
"int",
"W",
"int(H)",
"int",
"H",
"for com in commands:\n x = int(com[0])\n y = int(com[1])\n a = int(com[2])\n if a==1:\n pic[:x,:] = 1\n if a==2:\n pic[x:,:] = 1\n if a==3:\n pic[:,:y] = 1\n if a==4:\n pic[:,y:] = 1",
"com",
"commands",
"x = int(com[0])",
"x",
"int(com[0])",
"int",
"com[0]",
"com",
"0",
"y = int(com[1])",
"y",
"int(com[1])",
"int",
"com[1]",
"com",
"1",
"a = int(com[2])",
"a",
"int(com[2])",
"int",
"com[2]",
"com",
"2",
"if a==1:\n pic[:x,:] = 1\n ",
"a==1",
"a",
"1",
"pic[:x,:] = 1",
"pic[:x,:]",
"pic",
":x",
"x",
"1",
"if a==2:\n pic[x:,:] = 1\n ",
"a==2",
"a",
"2",
"pic[x:,:] = 1",
"pic[x:,:]",
"pic",
"x:",
"x",
"1",
"if a==3:\n pic[:,:y] = 1\n ",
"a==3",
"a",
"3",
"pic[:,:y] = 1",
"pic[:,:y]",
"pic",
":",
"1",
"if a==4:\n pic[:,y:] = 1",
"a==4",
"a",
"4",
"pic[:,y:] = 1",
"pic[:,y:]",
"pic",
":",
"1",
"area = 0",
"area",
"0",
"for w in range(int(W)):\n for h in range(int(H)):\n if pic[w,h]==0:\n area += 1\n ",
"w",
"range(int(W))",
"range",
"int(W)",
"int",
"W",
"for h in range(int(H)):\n if pic[w,h]==0:\n area += 1\n ",
"h",
"range(int(H))",
"range",
"int(H)",
"int",
"H",
"if pic[w,h]==0:\n area += 1\n ",
"pic[w,h]==0",
"pic[w,h]",
"pic",
"w",
"0",
"area += 1",
"area",
"1",
"print(area)",
"print",
"area",
"x = int(com[0])",
"int(com[0])",
"x",
"H, N = input().split()",
"input().split()",
"H",
"W, H, N = input().split()",
"input().split()",
"W",
"commands = []",
"[]",
"commands",
"pic = np.zeros((int(W),int(H)))",
"np.zeros((int(W),int(H)))",
"pic",
"a = int(com[2])",
"int(com[2])",
"a",
"area += 1",
"1",
"area",
"y = int(com[1])",
"int(com[1])",
"y",
"area = 0",
"0",
"area",
"N = input().split()",
"input().split()",
"N"
] |
import numpy as np
W, H, N = input().split()
commands = []
for i in range(int(N)):
commands.append(input().split())
pic = np.zeros((int(W),int(H)))
for com in commands:
x = int(com[0])
y = int(com[1])
a = int(com[2])
if a==1:
pic[:x,:] = 1
if a==2:
pic[x:,:] = 1
if a==3:
pic[:,:y] = 1
if a==4:
pic[:,y:] = 1
area = 0
for w in range(int(W)):
for h in range(int(H)):
if pic[w,h]==0:
area += 1
print(area)
|
[
7,
12,
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,
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,
4,
13,
8,
2,
2,
13,
13,
2,
13,
13,
2,
2,
13,
13,
2,
13,
13,
17,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
5,
13
],
[
5,
14
],
[
17,
16
],
[
20,
19
],
[
4,
20
],
[
23,
22
],
[
26,
25
],
[
13,
26
],
[
29,
28
],
[
14,
31
],
[
34,
33
],
[
34,
42
],
[
34,
43
],
[
43,
46
],
[
50,
49
],
[
16,
52
],
[
49,
52
],
[
33,
53
],
[
43,
56
],
[
60,
59
],
[
19,
62
],
[
59,
62
],
[
33,
63
],
[
43,
66
],
[
70,
69
],
[
22,
72
],
[
69,
72
],
[
42,
73
],
[
76,
75
],
[
25,
78
],
[
75,
78
],
[
42,
79
],
[
49,
85
],
[
16,
85
],
[
59,
86
],
[
19,
86
],
[
69,
88
],
[
22,
88
],
[
75,
89
],
[
25,
89
],
[
59,
92
],
[
19,
92
],
[
49,
93
],
[
16,
93
],
[
75,
95
],
[
25,
95
],
[
69,
96
],
[
22,
96
],
[
106,
103
]
] |
[
"def main():\n w, h, n = map(int, input().split())\n\n x_min = 0\n x_max = w\n y_min = 0\n y_max = h\n\n for _ in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n x_min = max(x_min, x)\n elif a == 2:\n x_max = min(x_max, x)\n elif a == 3:\n y_min = max(y_min, y)\n else:\n y_max = min(y_max, y)\n\n print(\n (x_max - x_min) * (y_max - y_min)\n if x_min < x_max and y_min < y_max else 0\n )\n\n\nif __name__ == '__main__':\n main()",
"def main():\n w, h, n = map(int, input().split())\n\n x_min = 0\n x_max = w\n y_min = 0\n y_max = h\n\n for _ in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n x_min = max(x_min, x)\n elif a == 2:\n x_max = min(x_max, x)\n elif a == 3:\n y_min = max(y_min, y)\n else:\n y_max = min(y_max, y)\n\n print(\n (x_max - x_min) * (y_max - y_min)\n if x_min < x_max and y_min < y_max else 0\n )",
"main",
"w, h, n = map(int, input().split())",
"w",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"x_min = 0",
"x_min",
"0",
"x_max = w",
"x_max",
"w",
"y_min = 0",
"y_min",
"0",
"y_max = h",
"y_max",
"h",
"for _ in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n x_min = max(x_min, x)\n elif a == 2:\n x_max = min(x_max, x)\n elif a == 3:\n y_min = max(y_min, y)\n else:\n y_max = min(y_max, y)\n\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",
"if a == 1:\n x_min = max(x_min, x)\n elif a == 2:\n x_max = min(x_max, x)\n elif a == 3:\n y_min = max(y_min, y)\n else:\n y_max = min(y_max, y)\n\n ",
"a == 1",
"a",
"1",
"x_min = max(x_min, x)",
"x_min",
"max(x_min, x)",
"max",
"x_min",
"x",
"elif a == 2:\n x_max = min(x_max, x)\n ",
"a == 2",
"a",
"2",
"x_max = min(x_max, x)",
"x_max",
"min(x_max, x)",
"min",
"x_max",
"x",
"elif a == 3:\n y_min = max(y_min, y)\n ",
"a == 3",
"a",
"3",
"y_min = max(y_min, y)",
"y_min",
"max(y_min, y)",
"max",
"y_min",
"y",
"y_max = min(y_max, y)",
"y_max",
"min(y_max, y)",
"min",
"y_max",
"y",
"print(\n (x_max - x_min) * (y_max - y_min)\n if x_min < x_max and y_min < y_max else 0\n )",
"print",
"(x_max - x_min) * (y_max - y_min)\n if x_min < x_max and y_min < y_max else 0",
"x_min < x_max and y_min < y_max",
"x_min < x_max",
"x_min",
"x_max",
"y_min < y_max",
"y_min",
"y_max",
"(x_max - x_min) * (y_max - y_min)",
"x_max - x_min",
"x_max",
"x_min",
"y_max - y_min",
"y_max",
"y_min",
"0",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n w, h, n = map(int, input().split())\n\n x_min = 0\n x_max = w\n y_min = 0\n y_max = h\n\n for _ in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n x_min = max(x_min, x)\n elif a == 2:\n x_max = min(x_max, x)\n elif a == 3:\n y_min = max(y_min, y)\n else:\n y_max = min(y_max, y)\n\n print(\n (x_max - x_min) * (y_max - y_min)\n if x_min < x_max and y_min < y_max else 0\n )",
"def main():\n w, h, n = map(int, input().split())\n\n x_min = 0\n x_max = w\n y_min = 0\n y_max = h\n\n for _ in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n x_min = max(x_min, x)\n elif a == 2:\n x_max = min(x_max, x)\n elif a == 3:\n y_min = max(y_min, y)\n else:\n y_max = min(y_max, y)\n\n print(\n (x_max - x_min) * (y_max - y_min)\n if x_min < x_max and y_min < y_max else 0\n )",
"main"
] |
def main():
w, h, n = map(int, input().split())
x_min = 0
x_max = w
y_min = 0
y_max = h
for _ in range(n):
x, y, a = map(int, input().split())
if a == 1:
x_min = max(x_min, x)
elif a == 2:
x_max = min(x_max, x)
elif a == 3:
y_min = max(y_min, y)
else:
y_max = min(y_max, y)
print(
(x_max - x_min) * (y_max - y_min)
if x_min < x_max and y_min < y_max else 0
)
if __name__ == '__main__':
main()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
13,
39,
17,
0,
13,
2,
13,
39,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
0,
18,
13,
39,
13,
2,
13,
39,
17,
14,
2,
13,
17,
0,
18,
13,
39,
13,
2,
2,
13,
13,
39,
17,
14,
2,
13,
17,
0,
18,
13,
39,
13,
2,
13,
39,
17,
0,
18,
13,
39,
13,
2,
2,
13,
13,
39,
17,
4,
13,
2,
4,
18,
13,
13,
17,
4,
18,
13,
13,
17,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] |
[
[
129,
2
],
[
129,
11
],
[
129,
12
],
[
111,
14
],
[
115,
16
],
[
123,
20
],
[
118,
22
],
[
27,
26
],
[
130,
29
],
[
126,
31
],
[
126,
40
],
[
126,
41
],
[
127,
44
],
[
51,
47
],
[
112,
48
],
[
121,
52
],
[
127,
57
],
[
64,
60
],
[
112,
61
],
[
115,
66
],
[
121,
67
],
[
127,
72
],
[
79,
75
],
[
124,
76
],
[
109,
80
],
[
88,
84
],
[
124,
85
],
[
118,
90
],
[
109,
91
],
[
112,
99
],
[
124,
104
],
[
126,
109
],
[
111,
112
],
[
129,
115
],
[
129,
118
],
[
126,
121
],
[
123,
124
],
[
126,
127
],
[
129,
130
]
] |
[
"w,h,n = map(int,input().split())\nwidth = w*[1]\nheight = h*[1]\n\nfor _ in range(n):\n x,y,a = map(int,input().split())\n if a == 1:\n width[:x] = x*[0]\n elif a == 2:\n width[x:] = (w-x)*[0]\n elif a == 3:\n height[:y] = y*[0]\n else:\n height[y:] = (h-y)*[0]\n \nprint(width.count(1)*height.count(1))",
"w,h,n = map(int,input().split())",
"w",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"width = w*[1]",
"width",
"w*[1]",
"w",
"[1]",
"1",
"height = h*[1]",
"height",
"h*[1]",
"h",
"[1]",
"1",
"for _ in range(n):\n x,y,a = map(int,input().split())\n if a == 1:\n width[:x] = x*[0]\n elif a == 2:\n width[x:] = (w-x)*[0]\n elif a == 3:\n height[:y] = y*[0]\n else:\n height[y:] = (h-y)*[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",
"if a == 1:\n width[:x] = x*[0]\n elif a == 2:\n width[x:] = (w-x)*[0]\n elif a == 3:\n height[:y] = y*[0]\n else:\n height[y:] = (h-y)*[0]\n ",
"a == 1",
"a",
"1",
"width[:x] = x*[0]",
"width[:x]",
"width",
":x",
"x",
"x*[0]",
"x",
"[0]",
"0",
"elif a == 2:\n width[x:] = (w-x)*[0]\n ",
"a == 2",
"a",
"2",
"width[x:] = (w-x)*[0]",
"width[x:]",
"width",
"x:",
"x",
"(w-x)*[0]",
"w-x",
"w",
"x",
"[0]",
"0",
"elif a == 3:\n height[:y] = y*[0]\n ",
"a == 3",
"a",
"3",
"height[:y] = y*[0]",
"height[:y]",
"height",
":y",
"y",
"y*[0]",
"y",
"[0]",
"0",
"height[y:] = (h-y)*[0]",
"height[y:]",
"height",
"y:",
"y",
"(h-y)*[0]",
"h-y",
"h",
"y",
"[0]",
"0",
"print(width.count(1)*height.count(1))",
"print",
"width.count(1)*height.count(1)",
"width.count(1)",
"width.count",
"width",
"count",
"1",
"height.count(1)",
"height.count",
"height",
"count",
"1",
"y,a = map(int,input().split())",
"map(int,input().split())",
"y",
"width = w*[1]",
"w*[1]",
"width",
"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",
"height = h*[1]",
"h*[1]",
"height",
"a = map(int,input().split())",
"map(int,input().split())",
"a",
"n = map(int,input().split())",
"map(int,input().split())",
"n"
] |
w,h,n = map(int,input().split())
width = w*[1]
height = h*[1]
for _ in range(n):
x,y,a = map(int,input().split())
if a == 1:
width[:x] = x*[0]
elif a == 2:
width[x:] = (w-x)*[0]
elif a == 3:
height[:y] = y*[0]
else:
height[y:] = (h-y)*[0]
print(width.count(1)*height.count(1))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
17,
13,
39,
13,
13,
39,
17,
13,
39,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
13,
0,
13,
2,
4,
13,
13,
4,
13,
13,
0,
13,
2,
4,
13,
13,
4,
13,
13,
14,
2,
2,
13,
17,
2,
13,
17,
0,
13,
17,
0,
13,
2,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
17,
13,
10,
39,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13
] |
[
[
144,
2
],
[
144,
11
],
[
144,
12
],
[
141,
14
],
[
123,
17
],
[
129,
20
],
[
135,
23
],
[
28,
27
],
[
145,
30
],
[
153,
32
],
[
153,
41
],
[
153,
42
],
[
154,
45
],
[
142,
49
],
[
118,
51
],
[
154,
54
],
[
124,
58
],
[
118,
60
],
[
154,
63
],
[
130,
67
],
[
148,
69
],
[
154,
72
],
[
136,
76
],
[
148,
78
],
[
150,
80
],
[
124,
84
],
[
142,
87
],
[
132,
89
],
[
136,
93
],
[
130,
96
],
[
151,
100
],
[
139,
100
],
[
133,
103
],
[
121,
103
],
[
126,
106
],
[
156,
109
],
[
133,
111
],
[
121,
111
],
[
151,
112
],
[
139,
112
],
[
157,
115
],
[
127,
115
],
[
153,
118
],
[
144,
121
],
[
123,
124
],
[
126,
127
],
[
129,
130
],
[
132,
133
],
[
135,
136
],
[
144,
139
],
[
141,
142
],
[
144,
145
],
[
153,
148
],
[
150,
151
],
[
153,
154
],
[
156,
157
]
] |
[
"W,H,N=map(int,input().split())\nA,B,C,D=[0],[W],[0],[H]\n\nfor i in range(N):\n x,y,a=map(int,input().split())\n if a==1:\n A.append(x)\n elif a==2:\n B.append(x)\n elif a==3:\n C.append(y)\n elif a==4:\n D.append(y)\n\nW=min(B)-max(A)\nH=min(D)-max(C)\n\nif W<0 or H<0:\n ans=0\nelse:\n ans=H*W\nprint(ans)",
"W,H,N=map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"A,B,C,D=[0],[W],[0],[H]",
"A",
"[0]",
"0",
"B",
"[W]",
"W",
"C",
"[0]",
"0",
"D",
"[H]",
"H",
"for i in range(N):\n x,y,a=map(int,input().split())\n if a==1:\n A.append(x)\n elif a==2:\n B.append(x)\n elif a==3:\n C.append(y)\n elif a==4:\n D.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:\n A.append(x)\n elif a==2:\n B.append(x)\n elif a==3:\n C.append(y)\n elif a==4:\n D.append(y)",
"a==1",
"a",
"1",
"A.append(x)",
"A.append",
"A",
"append",
"x",
"elif a==2:\n B.append(x)\n ",
"a==2",
"a",
"2",
"B.append(x)",
"B.append",
"B",
"append",
"x",
"elif a==3:\n C.append(y)\n ",
"a==3",
"a",
"3",
"C.append(y)",
"C.append",
"C",
"append",
"y",
"elif a==4:\n D.append(y)",
"a==4",
"a",
"4",
"D.append(y)",
"D.append",
"D",
"append",
"y",
"W=min(B)-max(A)",
"W",
"min(B)-max(A)",
"min(B)",
"min",
"B",
"max(A)",
"max",
"A",
"H=min(D)-max(C)",
"H",
"min(D)-max(C)",
"min(D)",
"min",
"D",
"max(C)",
"max",
"C",
"if W<0 or H<0:\n ans=0\nelse:\n ans=H*W",
"W<0 or H<0",
"W<0",
"W",
"0",
"H<0",
"H",
"0",
"ans=0",
"ans",
"0",
"ans=H*W",
"ans",
"H*W",
"H",
"W",
"print(ans)",
"print",
"ans",
"x,y,a=map(int,input().split())",
"map(int,input().split())",
"x",
"H,N=map(int,input().split())",
"map(int,input().split())",
"H",
"B,C,D=[0],[W],[0],[H]",
"[W]",
"B",
"ans=0",
"0",
"ans",
"C,D=[0],[W],[0],[H]",
"[0]",
"C",
"H=min(D)-max(C)",
"min(D)-max(C)",
"H",
"D=[0],[W],[0],[H]",
"[H]",
"D",
"W,H,N=map(int,input().split())",
"map(int,input().split())",
"W",
"A,B,C,D=[0],[W],[0],[H]",
"[0]",
"A",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"y,a=map(int,input().split())",
"map(int,input().split())",
"y",
"W=min(B)-max(A)",
"min(B)-max(A)",
"W",
"a=map(int,input().split())",
"map(int,input().split())",
"a",
"ans=H*W",
"H*W",
"ans"
] |
W,H,N=map(int,input().split())
A,B,C,D=[0],[W],[0],[H]
for i in range(N):
x,y,a=map(int,input().split())
if a==1:
A.append(x)
elif a==2:
B.append(x)
elif a==3:
C.append(y)
elif a==4:
D.append(y)
W=min(B)-max(A)
H=min(D)-max(C)
if W<0 or H<0:
ans=0
else:
ans=H*W
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
13,
0,
13,
17,
0,
13,
13,
28,
13,
13,
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,
14,
2,
2,
13,
17,
2,
13,
13,
0,
13,
13,
14,
2,
40,
13,
13,
40,
13,
13,
0,
13,
17,
0,
13,
2,
2,
13,
13,
2,
13,
13,
4,
13,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13
] |
[
[
151,
2
],
[
151,
11
],
[
151,
12
],
[
115,
14
],
[
136,
28
],
[
139,
31
],
[
146,
32
],
[
118,
34
],
[
121,
37
],
[
134,
38
],
[
137,
51
],
[
149,
51
],
[
148,
53
],
[
140,
62
],
[
128,
62
],
[
127,
64
],
[
119,
73
],
[
125,
73
],
[
124,
75
],
[
122,
84
],
[
113,
84
],
[
112,
86
],
[
128,
91
],
[
140,
91
],
[
149,
92
],
[
137,
92
],
[
113,
94
],
[
122,
94
],
[
125,
95
],
[
119,
95
],
[
142,
97
],
[
130,
100
],
[
128,
103
],
[
140,
103
],
[
149,
104
],
[
137,
104
],
[
113,
106
],
[
122,
106
],
[
125,
107
],
[
119,
107
],
[
131,
110
],
[
143,
110
],
[
112,
113
],
[
115,
116
],
[
118,
119
],
[
134,
121
],
[
121,
122
],
[
124,
125
],
[
127,
128
],
[
130,
131
],
[
151,
134
],
[
136,
137
],
[
146,
139
],
[
139,
140
],
[
142,
143
],
[
151,
146
],
[
148,
149
],
[
151,
152
]
] |
[
"w, h, n = map(int, input().split())\nxya = list(list(map(int, input().split())) for _ in range(n))\n\nleft = 0\nright = w\ndown = 0\nup = h\n\nfor x, y, a in xya:\n if a == 1 and x > left:\n left = x\n if a == 2 and x < right:\n right = x\n if a == 3 and y > down:\n down = y\n if a == 4 and y < up:\n up = y\n\n\nif right <= left or up <= down:\n ans = 0\nelse:\n ans = (right - left) * (up - down)\n\nprint(ans)",
"w, h, n = map(int, input().split())",
"w",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"xya = list(list(map(int, input().split())) for _ in range(n))",
"xya",
"list(list(map(int, input().split())) for _ in range(n))",
"list",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"left = 0",
"left",
"0",
"right = w",
"right",
"w",
"down = 0",
"down",
"0",
"up = h",
"up",
"h",
"for x, y, a in xya:\n if a == 1 and x > left:\n left = x\n if a == 2 and x < right:\n right = x\n if a == 3 and y > down:\n down = y\n if a == 4 and y < up:\n up = y",
"x",
"y",
"a",
"xya",
"if a == 1 and x > left:\n left = x\n ",
"a == 1 and x > left",
"a == 1",
"a",
"1",
"x > left",
"x",
"left",
"left = x",
"left",
"x",
"if a == 2 and x < right:\n right = x\n ",
"a == 2 and x < right",
"a == 2",
"a",
"2",
"x < right",
"x",
"right",
"right = x",
"right",
"x",
"if a == 3 and y > down:\n down = y\n ",
"a == 3 and y > down",
"a == 3",
"a",
"3",
"y > down",
"y",
"down",
"down = y",
"down",
"y",
"if a == 4 and y < up:\n up = y",
"a == 4 and y < up",
"a == 4",
"a",
"4",
"y < up",
"y",
"up",
"up = y",
"up",
"y",
"if right <= left or up <= down:\n ans = 0\nelse:\n ans = (right - left) * (up - down)",
"right <= left or up <= down",
"right <= left",
"right",
"left",
"up <= down",
"up",
"down",
"ans = 0",
"ans",
"0",
"ans = (right - left) * (up - down)",
"ans",
"(right - left) * (up - down)",
"right - left",
"right",
"left",
"up - down",
"up",
"down",
"print(ans)",
"print",
"ans",
"up = y",
"y",
"up",
"xya = list(list(map(int, input().split())) for _ in range(n))",
"list(list(map(int, input().split())) for _ in range(n))",
"xya",
"down = 0",
"0",
"down",
"up = h",
"h",
"up",
"down = y",
"y",
"down",
"right = x",
"x",
"right",
"ans = (right - left) * (up - down)",
"(right - left) * (up - down)",
"ans",
"h, n = map(int, input().split())",
"map(int, input().split())",
"h",
"left = 0",
"0",
"left",
"right = w",
"w",
"right",
"ans = 0",
"0",
"ans",
"w, h, n = map(int, input().split())",
"map(int, input().split())",
"w",
"left = x",
"x",
"left",
"n = map(int, input().split())",
"map(int, input().split())",
"n"
] |
w, h, n = map(int, input().split())
xya = list(list(map(int, input().split())) for _ in range(n))
left = 0
right = w
down = 0
up = h
for x, y, a in xya:
if a == 1 and x > left:
left = x
if a == 2 and x < right:
right = x
if a == 3 and y > down:
down = y
if a == 4 and y < up:
up = y
if right <= left or up <= down:
ans = 0
else:
ans = (right - left) * (up - down)
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
13,
13,
0,
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,
14,
2,
13,
13,
9,
14,
40,
40,
13,
13,
13,
0,
13,
13,
0,
13,
17,
13,
17,
14,
2,
13,
17,
14,
2,
13,
13,
9,
14,
40,
40,
13,
13,
13,
0,
13,
13,
0,
13,
17,
13,
17,
14,
2,
13,
17,
14,
2,
13,
13,
9,
14,
40,
40,
13,
13,
13,
0,
13,
13,
0,
13,
17,
13,
17,
14,
2,
13,
17,
14,
2,
13,
13,
9,
14,
40,
40,
13,
13,
13,
0,
13,
13,
0,
13,
17,
13,
17,
4,
13,
2,
2,
13,
13,
2,
13,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] |
[
[
199,
2
],
[
199,
11
],
[
199,
12
],
[
175,
14
],
[
193,
16
],
[
191,
17
],
[
163,
19
],
[
145,
21
],
[
200,
22
],
[
25,
24
],
[
179,
27
],
[
184,
29
],
[
184,
38
],
[
184,
39
],
[
149,
42
],
[
182,
46
],
[
176,
47
],
[
197,
47
],
[
152,
47
],
[
143,
47
],
[
176,
52
],
[
197,
52
],
[
152,
52
],
[
143,
52
],
[
182,
53
],
[
194,
54
],
[
155,
54
],
[
158,
54
],
[
203,
54
],
[
142,
56
],
[
182,
57
],
[
151,
59
],
[
202,
61
],
[
149,
65
],
[
194,
69
],
[
155,
69
],
[
158,
69
],
[
203,
69
],
[
182,
70
],
[
176,
75
],
[
197,
75
],
[
152,
75
],
[
143,
75
],
[
182,
76
],
[
194,
77
],
[
155,
77
],
[
158,
77
],
[
203,
77
],
[
157,
79
],
[
182,
80
],
[
196,
82
],
[
154,
84
],
[
149,
88
],
[
185,
92
],
[
164,
93
],
[
170,
93
],
[
161,
93
],
[
167,
93
],
[
164,
98
],
[
170,
98
],
[
161,
98
],
[
167,
98
],
[
185,
99
],
[
146,
100
],
[
206,
100
],
[
188,
100
],
[
173,
100
],
[
166,
102
],
[
185,
103
],
[
160,
105
],
[
172,
107
],
[
149,
111
],
[
185,
115
],
[
146,
116
],
[
206,
116
],
[
188,
116
],
[
173,
116
],
[
164,
121
],
[
170,
121
],
[
161,
121
],
[
167,
121
],
[
185,
122
],
[
146,
123
],
[
206,
123
],
[
188,
123
],
[
173,
123
],
[
187,
125
],
[
185,
126
],
[
169,
128
],
[
205,
130
],
[
155,
136
],
[
158,
136
],
[
203,
136
],
[
194,
136
],
[
197,
137
],
[
152,
137
],
[
143,
137
],
[
176,
137
],
[
206,
139
],
[
188,
139
],
[
173,
139
],
[
146,
139
],
[
170,
140
],
[
161,
140
],
[
167,
140
],
[
164,
140
],
[
182,
142
],
[
142,
143
],
[
200,
145
],
[
145,
146
],
[
184,
149
],
[
151,
152
],
[
154,
155
],
[
182,
157
],
[
157,
158
],
[
160,
161
],
[
163,
164
],
[
185,
166
],
[
166,
167
],
[
169,
170
],
[
172,
173
],
[
175,
176
],
[
199,
179
],
[
184,
182
],
[
184,
185
],
[
185,
187
],
[
187,
188
],
[
199,
191
],
[
191,
193
],
[
193,
194
],
[
196,
197
],
[
199,
200
],
[
202,
203
],
[
205,
206
]
] |
[
"w, h, n = map(int, input().split())\nxl, xr = 0, w\nyd, yu = 0, h\nfor i in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n if x < xl:\n continue\n elif xl <= x <= xr:\n xl = x\n else:\n xl, xr = 0, 0 # 抜けてた...\n elif a == 2:\n if xr < x:\n continue\n elif xl <= x <= xr:\n xr = x\n else:\n xl, xr = 0, 0\n elif a == 3:\n if y < yd:\n continue\n elif yd <= y <= yu:\n yd = y\n else:\n yd, yu = 0, 0\n elif a == 4:\n if y > yu:\n continue\n elif yd <= y <= yu:\n yu = y\n else:\n yd, yu = 0, 0\n\nprint((xr - xl) * (yu - yd))\n\n",
"w, h, n = map(int, input().split())",
"w",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"xl, xr = 0, w",
"xl",
"0",
"xr",
"w",
"yd, yu = 0, h",
"yd",
"0",
"yu",
"h",
"for i in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n if x < xl:\n continue\n elif xl <= x <= xr:\n xl = x\n else:\n xl, xr = 0, 0 # 抜けてた...\n elif a == 2:\n if xr < x:\n continue\n elif xl <= x <= xr:\n xr = x\n else:\n xl, xr = 0, 0\n elif a == 3:\n if y < yd:\n continue\n elif yd <= y <= yu:\n yd = y\n else:\n yd, yu = 0, 0\n elif a == 4:\n if y > yu:\n continue\n elif yd <= y <= yu:\n yu = y\n else:\n yd, yu = 0, 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 if x < xl:\n continue\n elif xl <= x <= xr:\n xl = x\n else:\n xl, xr = 0, 0 # 抜けてた...\n elif a == 2:\n if xr < x:\n continue\n elif xl <= x <= xr:\n xr = x\n else:\n xl, xr = 0, 0\n elif a == 3:\n if y < yd:\n continue\n elif yd <= y <= yu:\n yd = y\n else:\n yd, yu = 0, 0\n elif a == 4:\n if y > yu:\n continue\n elif yd <= y <= yu:\n yu = y\n else:\n yd, yu = 0, 0",
"a == 1",
"a",
"1",
"if x < xl:\n continue\n elif xl <= x <= xr:\n xl = x\n else:\n xl, xr = 0, 0 # 抜けてた...\n ",
"x < xl",
"x",
"xl",
"continue",
"elif xl <= x <= xr:\n xl = x\n ",
"xl <= x <= xr",
"xl <= x",
"xl",
"x",
"xr",
"xl = x",
"xl",
"x",
"xl, xr = 0, 0",
"xl",
"0",
"xr",
"0",
"elif a == 2:\n if xr < x:\n continue\n elif xl <= x <= xr:\n xr = x\n else:\n xl, xr = 0, 0\n ",
"a == 2",
"a",
"2",
"if xr < x:\n continue\n elif xl <= x <= xr:\n xr = x\n else:\n xl, xr = 0, 0\n ",
"xr < x",
"xr",
"x",
"continue",
"elif xl <= x <= xr:\n xr = x\n ",
"xl <= x <= xr",
"xl <= x",
"xl",
"x",
"xr",
"xr = x",
"xr",
"x",
"xl, xr = 0, 0",
"xl",
"0",
"xr",
"0",
"elif a == 3:\n if y < yd:\n continue\n elif yd <= y <= yu:\n yd = y\n else:\n yd, yu = 0, 0\n ",
"a == 3",
"a",
"3",
"if y < yd:\n continue\n elif yd <= y <= yu:\n yd = y\n else:\n yd, yu = 0, 0\n ",
"y < yd",
"y",
"yd",
"continue",
"elif yd <= y <= yu:\n yd = y\n ",
"yd <= y <= yu",
"yd <= y",
"yd",
"y",
"yu",
"yd = y",
"yd",
"y",
"yd, yu = 0, 0",
"yd",
"0",
"yu",
"0",
"elif a == 4:\n if y > yu:\n continue\n elif yd <= y <= yu:\n yu = y\n else:\n yd, yu = 0, 0",
"a == 4",
"a",
"4",
"if y > yu:\n continue\n elif yd <= y <= yu:\n yu = y\n else:\n yd, yu = 0, 0",
"y > yu",
"y",
"yu",
"continue",
"elif yd <= y <= yu:\n yu = y\n ",
"yd <= y <= yu",
"yd <= y",
"yd",
"y",
"yu",
"yu = y",
"yu",
"y",
"yd, yu = 0, 0",
"yd",
"0",
"yu",
"0",
"print((xr - xl) * (yu - yd))",
"print",
"(xr - xl) * (yu - yd)",
"xr - xl",
"xr",
"xl",
"yu - yd",
"yu",
"yd",
"xl = x",
"x",
"xl",
"yu = 0, h",
"h",
"yu",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"xl, xr = 0, 0",
"0",
"xl",
"xr = 0, 0",
"0",
"xr",
"xr = x",
"x",
"xr",
"yd, yu = 0, 0",
"0",
"yd",
"yd, yu = 0, h",
"0",
"yd",
"yd = y",
"y",
"yd",
"yd, yu = 0, 0",
"0",
"yd",
"yu = 0, 0",
"0",
"yu",
"xl, xr = 0, w",
"0",
"xl",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"yu = y",
"y",
"yu",
"w, h, n = map(int, input().split())",
"map(int, input().split())",
"w",
"xr = 0, w",
"w",
"xr",
"xl, xr = 0, 0",
"0",
"xl",
"h, n = map(int, input().split())",
"map(int, input().split())",
"h",
"xr = 0, 0",
"0",
"xr",
"yu = 0, 0",
"0",
"yu"
] |
w, h, n = map(int, input().split())
xl, xr = 0, w
yd, yu = 0, h
for i in range(n):
x, y, a = map(int, input().split())
if a == 1:
if x < xl:
continue
elif xl <= x <= xr:
xl = x
else:
xl, xr = 0, 0 # 抜けてた...
elif a == 2:
if xr < x:
continue
elif xl <= x <= xr:
xr = x
else:
xl, xr = 0, 0
elif a == 3:
if y < yd:
continue
elif yd <= y <= yu:
yd = y
else:
yd, yu = 0, 0
elif a == 4:
if y > yu:
continue
elif yd <= y <= yu:
yu = y
else:
yd, yu = 0, 0
print((xr - xl) * (yu - yd))
|
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
13,
13,
0,
13,
17,
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,
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,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13
] |
[
[
126,
2
],
[
126,
13
],
[
126,
14
],
[
105,
16
],
[
102,
18
],
[
100,
19
],
[
132,
21
],
[
114,
23
],
[
121,
24
],
[
27,
26
],
[
127,
29
],
[
129,
31
],
[
129,
42
],
[
129,
43
],
[
130,
46
],
[
123,
49
],
[
106,
52
],
[
124,
52
],
[
97,
53
],
[
130,
56
],
[
111,
59
],
[
103,
62
],
[
112,
62
],
[
97,
63
],
[
130,
66
],
[
135,
69
],
[
133,
72
],
[
136,
72
],
[
109,
73
],
[
117,
75
],
[
115,
78
],
[
118,
78
],
[
109,
79
],
[
112,
87
],
[
103,
87
],
[
124,
88
],
[
106,
88
],
[
118,
93
],
[
115,
93
],
[
136,
94
],
[
133,
94
],
[
129,
97
],
[
126,
100
],
[
100,
102
],
[
102,
103
],
[
105,
106
],
[
129,
109
],
[
111,
112
],
[
121,
114
],
[
114,
115
],
[
117,
118
],
[
126,
121
],
[
123,
124
],
[
126,
127
],
[
129,
130
],
[
132,
133
],
[
135,
136
]
] |
[
"W, H, N = list(map(int, input().split()))\nx_low, x_up = 0, W\ny_low, y_up = 0, H\nfor _ in range(N):\n x, y, a = list(map(int, input().split()))\n if a == 1:\n x_low = max(x_low, x)\n elif a == 2:\n x_up = min(x_up, x)\n elif a == 3:\n y_low = max(y_low, y)\n else:\n y_up = min(y_up, y)\nprint(max(0, x_up - x_low) * max(0, y_up - y_low))",
"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",
"x_low, x_up = 0, W",
"x_low",
"0",
"x_up",
"W",
"y_low, y_up = 0, H",
"y_low",
"0",
"y_up",
"H",
"for _ in range(N):\n x, y, a = list(map(int, input().split()))\n if a == 1:\n x_low = max(x_low, x)\n elif a == 2:\n x_up = min(x_up, x)\n elif a == 3:\n y_low = max(y_low, y)\n else:\n y_up = min(y_up, y)",
"_",
"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 x_low = max(x_low, x)\n elif a == 2:\n x_up = min(x_up, x)\n elif a == 3:\n y_low = max(y_low, y)\n else:\n y_up = min(y_up, y)",
"a == 1",
"a",
"1",
"x_low = max(x_low, x)",
"x_low",
"max(x_low, x)",
"max",
"x_low",
"x",
"elif a == 2:\n x_up = min(x_up, x)\n ",
"a == 2",
"a",
"2",
"x_up = min(x_up, x)",
"x_up",
"min(x_up, x)",
"min",
"x_up",
"x",
"elif a == 3:\n y_low = max(y_low, y)\n ",
"a == 3",
"a",
"3",
"y_low = max(y_low, y)",
"y_low",
"max(y_low, y)",
"max",
"y_low",
"y",
"y_up = min(y_up, y)",
"y_up",
"min(y_up, y)",
"min",
"y_up",
"y",
"print(max(0, x_up - x_low) * max(0, y_up - y_low))",
"print",
"max(0, x_up - x_low) * max(0, y_up - y_low)",
"max(0, x_up - x_low)",
"max",
"0",
"x_up - x_low",
"x_up",
"x_low",
"max(0, y_up - y_low)",
"max",
"0",
"y_up - y_low",
"y_up",
"y_low",
"x, y, a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"x",
"W, H, N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"W",
"x_up = 0, W",
"W",
"x_up",
"x_low, x_up = 0, W",
"0",
"x_low",
"y, a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"y",
"x_up = min(x_up, x)",
"min(x_up, x)",
"x_up",
"y_up = 0, H",
"H",
"y_up",
"y_up = min(y_up, y)",
"min(y_up, y)",
"y_up",
"H, N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"H",
"x_low = max(x_low, x)",
"max(x_low, x)",
"x_low",
"N = list(map(int, input().split()))",
"list(map(int, input().split()))",
"N",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"y_low, y_up = 0, H",
"0",
"y_low",
"y_low = max(y_low, y)",
"max(y_low, y)",
"y_low"
] |
W, H, N = list(map(int, input().split()))
x_low, x_up = 0, W
y_low, y_up = 0, H
for _ in range(N):
x, y, a = list(map(int, input().split()))
if a == 1:
x_low = max(x_low, x)
elif a == 2:
x_up = min(x_up, x)
elif a == 3:
y_low = max(y_low, y)
else:
y_up = min(y_up, y)
print(max(0, x_up - x_low) * max(0, y_up - y_low))
|
[
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,
14,
2,
13,
17,
28,
13,
4,
13,
13,
13,
0,
18,
13,
13,
17,
4,
13,
2,
4,
13,
13,
4,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] |
[
[
128,
2
],
[
128,
11
],
[
128,
12
],
[
110,
14
],
[
114,
18
],
[
131,
20
],
[
117,
24
],
[
27,
26
],
[
129,
29
],
[
125,
31
],
[
125,
40
],
[
125,
41
],
[
120,
44
],
[
48,
47
],
[
126,
50
],
[
55,
52
],
[
111,
53
],
[
47,
54
],
[
120,
58
],
[
62,
61
],
[
126,
64
],
[
114,
65
],
[
70,
67
],
[
111,
68
],
[
61,
69
],
[
120,
73
],
[
77,
76
],
[
123,
79
],
[
84,
81
],
[
132,
82
],
[
76,
83
],
[
120,
87
],
[
91,
90
],
[
123,
93
],
[
117,
94
],
[
99,
96
],
[
132,
97
],
[
90,
98
],
[
111,
105
],
[
132,
108
],
[
110,
111
],
[
128,
114
],
[
128,
117
],
[
125,
120
],
[
125,
123
],
[
125,
126
],
[
128,
129
],
[
131,
132
]
] |
[
"w, h, n = map(int, input().split())\nW = [1] * w\nH = [1] * h\n\nfor i in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n for j in range(x):\n W[j] = 0\n elif a == 2:\n for j in range(x, w):\n W[j] = 0\n elif a == 3:\n for j in range(y):\n H[j] = 0\n elif a == 4:\n for j in range(y, h):\n H[j] = 0\nprint(sum(W) * sum(H))",
"w, h, n = map(int, input().split())",
"w",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"W = [1] * w",
"W",
"[1] * w",
"[1]",
"1",
"w",
"H = [1] * h",
"H",
"[1] * h",
"[1]",
"1",
"h",
"for i in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n for j in range(x):\n W[j] = 0\n elif a == 2:\n for j in range(x, w):\n W[j] = 0\n elif a == 3:\n for j in range(y):\n H[j] = 0\n elif a == 4:\n for j in range(y, h):\n H[j] = 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 j in range(x):\n W[j] = 0\n elif a == 2:\n for j in range(x, w):\n W[j] = 0\n elif a == 3:\n for j in range(y):\n H[j] = 0\n elif a == 4:\n for j in range(y, h):\n H[j] = 0",
"a == 1",
"a",
"1",
"for j in range(x):\n W[j] = 0\n ",
"j",
"range(x)",
"range",
"x",
"W[j] = 0",
"W[j]",
"W",
"j",
"0",
"elif a == 2:\n for j in range(x, w):\n W[j] = 0\n ",
"a == 2",
"a",
"2",
"for j in range(x, w):\n W[j] = 0\n ",
"j",
"range(x, w)",
"range",
"x",
"w",
"W[j] = 0",
"W[j]",
"W",
"j",
"0",
"elif a == 3:\n for j in range(y):\n H[j] = 0\n ",
"a == 3",
"a",
"3",
"for j in range(y):\n H[j] = 0\n ",
"j",
"range(y)",
"range",
"y",
"H[j] = 0",
"H[j]",
"H",
"j",
"0",
"elif a == 4:\n for j in range(y, h):\n H[j] = 0",
"a == 4",
"a",
"4",
"for j in range(y, h):\n H[j] = 0",
"j",
"range(y, h)",
"range",
"y",
"h",
"H[j] = 0",
"H[j]",
"H",
"j",
"0",
"print(sum(W) * sum(H))",
"print",
"sum(W) * sum(H)",
"sum(W)",
"sum",
"W",
"sum(H)",
"sum",
"H",
"W = [1] * w",
"[1] * w",
"W",
"w, h, n = map(int, input().split())",
"map(int, input().split())",
"w",
"h, n = map(int, input().split())",
"map(int, input().split())",
"h",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"H = [1] * h",
"[1] * h",
"H"
] |
w, h, n = map(int, input().split())
W = [1] * w
H = [1] * h
for i in range(n):
x, y, a = map(int, input().split())
if a == 1:
for j in range(x):
W[j] = 0
elif a == 2:
for j in range(x, w):
W[j] = 0
elif a == 3:
for j in range(y):
H[j] = 0
elif a == 4:
for j in range(y, h):
H[j] = 0
print(sum(W) * sum(H))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
17,
0,
13,
39,
13,
0,
13,
39,
17,
0,
13,
39,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
2,
4,
13,
17,
2,
13,
13,
4,
13,
17,
2,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
39,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13
] |
[
[
142,
2
],
[
142,
11
],
[
142,
12
],
[
136,
14
],
[
139,
18
],
[
154,
22
],
[
157,
26
],
[
31,
30
],
[
122,
33
],
[
160,
35
],
[
160,
44
],
[
160,
45
],
[
161,
48
],
[
137,
52
],
[
134,
54
],
[
161,
57
],
[
140,
61
],
[
134,
63
],
[
161,
66
],
[
155,
70
],
[
146,
72
],
[
161,
75
],
[
158,
79
],
[
146,
81
],
[
124,
83
],
[
137,
86
],
[
148,
88
],
[
140,
91
],
[
127,
93
],
[
155,
96
],
[
163,
98
],
[
158,
101
],
[
151,
103
],
[
149,
109
],
[
125,
110
],
[
164,
115
],
[
128,
116
],
[
152,
119
],
[
142,
122
],
[
124,
125
],
[
127,
128
],
[
142,
131
],
[
160,
134
],
[
136,
137
],
[
139,
140
],
[
142,
143
],
[
160,
146
],
[
148,
149
],
[
151,
152
],
[
154,
155
],
[
157,
158
],
[
160,
161
],
[
163,
164
]
] |
[
"w, h, n = map(int, input().split())\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.append(x)\n elif a == 2:\n x2.append(x)\n elif a == 3:\n y1.append(y)\n elif a == 4:\n y2.append(y)\n\nleft = max(x1)\nright = min(x2)\nbottom = max(y1)\ntop = min(y2)\n\nans =max(0, right - left)*max(0, top - bottom)\nprint(ans)",
"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]",
"0",
"x2 = [w]",
"x2",
"[w]",
"w",
"y1 = [0]",
"y1",
"[0]",
"0",
"y2 = [h]",
"y2",
"[h]",
"h",
"for i in range(n):\n x, y, a = map(int, input().split())\n if a == 1:\n x1.append(x)\n elif a == 2:\n x2.append(x)\n elif a == 3:\n y1.append(y)\n elif a == 4:\n y2.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:\n x1.append(x)\n elif a == 2:\n x2.append(x)\n elif a == 3:\n y1.append(y)\n elif a == 4:\n y2.append(y)",
"a == 1",
"a",
"1",
"x1.append(x)",
"x1.append",
"x1",
"append",
"x",
"elif a == 2:\n x2.append(x)\n ",
"a == 2",
"a",
"2",
"x2.append(x)",
"x2.append",
"x2",
"append",
"x",
"elif a == 3:\n y1.append(y)\n ",
"a == 3",
"a",
"3",
"y1.append(y)",
"y1.append",
"y1",
"append",
"y",
"elif a == 4:\n y2.append(y)",
"a == 4",
"a",
"4",
"y2.append(y)",
"y2.append",
"y2",
"append",
"y",
"left = max(x1)",
"left",
"max(x1)",
"max",
"x1",
"right = min(x2)",
"right",
"min(x2)",
"min",
"x2",
"bottom = max(y1)",
"bottom",
"max(y1)",
"max",
"y1",
"top = min(y2)",
"top",
"min(y2)",
"min",
"y2",
"ans =max(0, right - left)*max(0, top - bottom)",
"ans",
"max(0, right - left)*max(0, top - bottom)",
"max(0, right - left)",
"max",
"0",
"right - left",
"right",
"left",
"max(0, top - bottom)",
"max",
"0",
"top - bottom",
"top",
"bottom",
"print(ans)",
"print",
"ans",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"left = max(x1)",
"max(x1)",
"left",
"bottom = max(y1)",
"max(y1)",
"bottom",
"h, n = map(int, input().split())",
"map(int, input().split())",
"h",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"x1 = [0]",
"[0]",
"x1",
"x2 = [w]",
"[w]",
"x2",
"w, h, n = map(int, input().split())",
"map(int, input().split())",
"w",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"right = min(x2)",
"min(x2)",
"right",
"ans =max(0, right - left)*max(0, top - bottom)",
"max(0, right - left)*max(0, top - bottom)",
"ans",
"y1 = [0]",
"[0]",
"y1",
"y2 = [h]",
"[h]",
"y2",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"top = min(y2)",
"min(y2)",
"top"
] |
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.append(x)
elif a == 2:
x2.append(x)
elif a == 3:
y1.append(y)
elif a == 4:
y2.append(y)
left = max(x1)
right = min(x2)
bottom = max(y1)
top = min(y2)
ans =max(0, right - left)*max(0, top - bottom)
print(ans)
|
[
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,
13,
17,
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,
2,
2,
13,
13,
17,
2,
2,
13,
13,
17,
4,
13,
17,
4,
13,
2,
2,
13,
13,
2,
13,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
18,
13,
10,
17,
13,
10,
18,
13
] |
[
[
175,
2
],
[
175,
11
],
[
175,
12
],
[
16,
15
],
[
167,
18
],
[
169,
31
],
[
184,
34
],
[
160,
36
],
[
40,
39
],
[
167,
42
],
[
170,
48
],
[
39,
49
],
[
185,
53
],
[
182,
53
],
[
170,
56
],
[
39,
57
],
[
181,
60
],
[
170,
63
],
[
39,
64
],
[
170,
71
],
[
39,
72
],
[
173,
76
],
[
179,
76
],
[
170,
79
],
[
39,
80
],
[
178,
83
],
[
170,
86
],
[
39,
87
],
[
170,
94
],
[
39,
95
],
[
161,
99
],
[
164,
99
],
[
170,
102
],
[
39,
103
],
[
163,
106
],
[
170,
109
],
[
39,
110
],
[
170,
117
],
[
39,
118
],
[
176,
122
],
[
188,
122
],
[
170,
125
],
[
39,
126
],
[
187,
129
],
[
170,
132
],
[
39,
133
],
[
179,
139
],
[
173,
139
],
[
182,
140
],
[
185,
140
],
[
188,
144
],
[
176,
144
],
[
164,
145
],
[
161,
145
],
[
179,
154
],
[
173,
154
],
[
182,
155
],
[
185,
155
],
[
188,
157
],
[
176,
157
],
[
164,
158
],
[
161,
158
],
[
160,
161
],
[
163,
164
],
[
175,
167
],
[
169,
170
],
[
175,
173
],
[
175,
176
],
[
178,
179
],
[
181,
182
],
[
184,
185
],
[
187,
188
]
] |
[
"w,h,n = map(int,input().split())\nA = [list(map(int,input().split())) for i in range(n)]\nsx,sy=0,0\nfor j in range(n):\n \n if A[j][2]==1 and sx<A[j][0]:\n sx=A[j][0]\n\n if A[j][2]==2 and w>A[j][0]:\n w=A[j][0]\n\n if A[j][2]==3 and sy<A[j][1]:\n sy=A[j][1]\n\n if A[j][2]==4 and h>A[j][1]:\n h=A[j][1]\n\nif (w-sx)<0 or (h-sy)<0 :\n print(0)\nelse:\n print((w-sx)*(h-sy))",
"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",
"A = [list(map(int,input().split())) for i in range(n)]",
"A",
"[list(map(int,input().split())) for i in range(n)]",
"sx,sy=0,0",
"sx",
"0",
"sy",
"0",
"for j in range(n):\n \n if A[j][2]==1 and sx<A[j][0]:\n sx=A[j][0]\n\n if A[j][2]==2 and w>A[j][0]:\n w=A[j][0]\n\n if A[j][2]==3 and sy<A[j][1]:\n sy=A[j][1]\n\n if A[j][2]==4 and h>A[j][1]:\n h=A[j][1]",
"j",
"range(n)",
"range",
"n",
"if A[j][2]==1 and sx<A[j][0]:\n sx=A[j][0]\n\n ",
"A[j][2]==1 and sx<A[j][0]",
"A[j][2]==1",
"A[j][2]",
"[j]",
"A",
"j",
"2",
"1",
"sx<A[j][0]",
"sx",
"A[j][0]",
"[j]",
"A",
"j",
"0",
"sx=A[j][0]",
"sx",
"A[j][0]",
"[j]",
"A",
"j",
"0",
"if A[j][2]==2 and w>A[j][0]:\n w=A[j][0]\n\n ",
"A[j][2]==2 and w>A[j][0]",
"A[j][2]==2",
"A[j][2]",
"[j]",
"A",
"j",
"2",
"2",
"w>A[j][0]",
"w",
"A[j][0]",
"[j]",
"A",
"j",
"0",
"w=A[j][0]",
"w",
"A[j][0]",
"[j]",
"A",
"j",
"0",
"if A[j][2]==3 and sy<A[j][1]:\n sy=A[j][1]\n\n ",
"A[j][2]==3 and sy<A[j][1]",
"A[j][2]==3",
"A[j][2]",
"[j]",
"A",
"j",
"2",
"3",
"sy<A[j][1]",
"sy",
"A[j][1]",
"[j]",
"A",
"j",
"1",
"sy=A[j][1]",
"sy",
"A[j][1]",
"[j]",
"A",
"j",
"1",
"if A[j][2]==4 and h>A[j][1]:\n h=A[j][1]",
"A[j][2]==4 and h>A[j][1]",
"A[j][2]==4",
"A[j][2]",
"[j]",
"A",
"j",
"2",
"4",
"h>A[j][1]",
"h",
"A[j][1]",
"[j]",
"A",
"j",
"1",
"h=A[j][1]",
"h",
"A[j][1]",
"[j]",
"A",
"j",
"1",
"if (w-sx)<0 or (h-sy)<0 :\n print(0)\nelse:\n print((w-sx)*(h-sy))",
"(w-sx)<0 or (h-sy)<0",
"(w-sx)<0",
"w-sx",
"w",
"sx",
"0",
"(h-sy)<0",
"h-sy",
"h",
"sy",
"0",
"print(0)",
"print",
"0",
"print((w-sx)*(h-sy))",
"print",
"(w-sx)*(h-sy)",
"w-sx",
"w",
"sx",
"h-sy",
"h",
"sy",
"sy=0,0",
"0",
"sy",
"sy=A[j][1]",
"A[j][1]",
"sy",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"A = [list(map(int,input().split())) for i in range(n)]",
"[list(map(int,input().split())) for i in range(n)]",
"A",
"w,h,n = map(int,input().split())",
"map(int,input().split())",
"w",
"h,n = map(int,input().split())",
"map(int,input().split())",
"h",
"w=A[j][0]",
"A[j][0]",
"w",
"sx=A[j][0]",
"A[j][0]",
"sx",
"sx,sy=0,0",
"0",
"sx",
"h=A[j][1]",
"A[j][1]",
"h"
] |
w,h,n = map(int,input().split())
A = [list(map(int,input().split())) for i in range(n)]
sx,sy=0,0
for j in range(n):
if A[j][2]==1 and sx<A[j][0]:
sx=A[j][0]
if A[j][2]==2 and w>A[j][0]:
w=A[j][0]
if A[j][2]==3 and sy<A[j][1]:
sy=A[j][1]
if A[j][2]==4 and h>A[j][1]:
h=A[j][1]
if (w-sx)<0 or (h-sy)<0 :
print(0)
else:
print((w-sx)*(h-sy))
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
39,
17,
13,
0,
13,
2,
39,
17,
13,
0,
13,
2,
39,
17,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
4,
13,
13,
4,
18,
4,
13,
13,
18,
13,
13,
18,
13,
13,
0,
13,
17,
0,
13,
13,
0,
13,
17,
0,
13,
13,
28,
13,
13,
13,
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,
2,
4,
13,
17,
2,
13,
13,
4,
13,
17,
2,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
18,
13,
10,
12,
13
] |
[
[
147,
4
],
[
14,
13
],
[
148,
20
],
[
14,
22
],
[
14,
23
],
[
26,
25
],
[
23,
29
],
[
32,
31
],
[
23,
35
],
[
38,
37
],
[
23,
41
],
[
44,
43
],
[
23,
46
],
[
51,
48
],
[
25,
49
],
[
43,
50
],
[
148,
57
],
[
51,
59
],
[
31,
60
],
[
43,
61
],
[
51,
62
],
[
37,
63
],
[
43,
64
],
[
67,
66
],
[
70,
69
],
[
13,
70
],
[
73,
72
],
[
76,
75
],
[
22,
76
],
[
25,
83
],
[
31,
84
],
[
37,
85
],
[
92,
91
],
[
66,
94
],
[
91,
94
],
[
102,
101
],
[
69,
104
],
[
101,
104
],
[
112,
111
],
[
72,
114
],
[
111,
114
],
[
118,
117
],
[
75,
120
],
[
117,
120
],
[
124,
123
],
[
101,
129
],
[
69,
129
],
[
91,
130
],
[
66,
130
],
[
117,
135
],
[
75,
135
],
[
111,
136
],
[
72,
136
],
[
123,
139
],
[
151,
145
],
[
147,
148
]
] |
[
"import sys\n\ninput = sys.stdin.readline\n\n\ndef main():\n W, H, N = map(int, input().split())\n X = [0] * N\n Y = [0] * N\n A = [0] * N\n for i in range(N):\n X[i], Y[i], A[i] = map(int, input().split())\n\n x_min = 0\n x_max = W\n y_min = 0\n y_max = H\n for x, y, a in zip(X, Y, A):\n if a == 1:\n x_min = max(x_min, x)\n elif a == 2:\n x_max = min(x_max, x)\n elif a == 3:\n y_min = max(y_min, y)\n else:\n y_max = min(y_max, y)\n\n ans = max(0, x_max - x_min) * max(0, y_max - y_min)\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 W, H, N = map(int, input().split())\n X = [0] * N\n Y = [0] * N\n A = [0] * N\n for i in range(N):\n X[i], Y[i], A[i] = map(int, input().split())\n\n x_min = 0\n x_max = W\n y_min = 0\n y_max = H\n for x, y, a in zip(X, Y, A):\n if a == 1:\n x_min = max(x_min, x)\n elif a == 2:\n x_max = min(x_max, x)\n elif a == 3:\n y_min = max(y_min, y)\n else:\n y_max = min(y_max, y)\n\n ans = max(0, x_max - x_min) * max(0, y_max - y_min)\n print(ans)",
"main",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"X = [0] * N",
"X",
"[0] * N",
"[0]",
"0",
"N",
"Y = [0] * N",
"Y",
"[0] * N",
"[0]",
"0",
"N",
"A = [0] * N",
"A",
"[0] * N",
"[0]",
"0",
"N",
"for i in range(N):\n X[i], Y[i], A[i] = map(int, input().split())\n\n ",
"i",
"range(N)",
"range",
"N",
"X[i], Y[i], A[i] = map(int, input().split())",
"X[i]",
"X",
"i",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"Y[i]",
"Y",
"i",
"A[i]",
"A",
"i",
"x_min = 0",
"x_min",
"0",
"x_max = W",
"x_max",
"W",
"y_min = 0",
"y_min",
"0",
"y_max = H",
"y_max",
"H",
"for x, y, a in zip(X, Y, A):\n if a == 1:\n x_min = max(x_min, x)\n elif a == 2:\n x_max = min(x_max, x)\n elif a == 3:\n y_min = max(y_min, y)\n else:\n y_max = min(y_max, y)\n\n ",
"x",
"y",
"a",
"zip(X, Y, A)",
"zip",
"X",
"Y",
"A",
"if a == 1:\n x_min = max(x_min, x)\n elif a == 2:\n x_max = min(x_max, x)\n elif a == 3:\n y_min = max(y_min, y)\n else:\n y_max = min(y_max, y)\n\n ",
"a == 1",
"a",
"1",
"x_min = max(x_min, x)",
"x_min",
"max(x_min, x)",
"max",
"x_min",
"x",
"elif a == 2:\n x_max = min(x_max, x)\n ",
"a == 2",
"a",
"2",
"x_max = min(x_max, x)",
"x_max",
"min(x_max, x)",
"min",
"x_max",
"x",
"elif a == 3:\n y_min = max(y_min, y)\n ",
"a == 3",
"a",
"3",
"y_min = max(y_min, y)",
"y_min",
"max(y_min, y)",
"max",
"y_min",
"y",
"y_max = min(y_max, y)",
"y_max",
"min(y_max, y)",
"min",
"y_max",
"y",
"ans = max(0, x_max - x_min) * max(0, y_max - y_min)",
"ans",
"max(0, x_max - x_min) * max(0, y_max - y_min)",
"max(0, x_max - x_min)",
"max",
"0",
"x_max - x_min",
"x_max",
"x_min",
"max(0, y_max - y_min)",
"max",
"0",
"y_max - y_min",
"y_max",
"y_min",
"print(ans)",
"print",
"ans",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"def main():\n W, H, N = map(int, input().split())\n X = [0] * N\n Y = [0] * N\n A = [0] * N\n for i in range(N):\n X[i], Y[i], A[i] = map(int, input().split())\n\n x_min = 0\n x_max = W\n y_min = 0\n y_max = H\n for x, y, a in zip(X, Y, A):\n if a == 1:\n x_min = max(x_min, x)\n elif a == 2:\n x_max = min(x_max, x)\n elif a == 3:\n y_min = max(y_min, y)\n else:\n y_max = min(y_max, y)\n\n ans = max(0, x_max - x_min) * max(0, y_max - y_min)\n print(ans)",
"def main():\n W, H, N = map(int, input().split())\n X = [0] * N\n Y = [0] * N\n A = [0] * N\n for i in range(N):\n X[i], Y[i], A[i] = map(int, input().split())\n\n x_min = 0\n x_max = W\n y_min = 0\n y_max = H\n for x, y, a in zip(X, Y, A):\n if a == 1:\n x_min = max(x_min, x)\n elif a == 2:\n x_max = min(x_max, x)\n elif a == 3:\n y_min = max(y_min, y)\n else:\n y_max = min(y_max, y)\n\n ans = max(0, x_max - x_min) * max(0, y_max - y_min)\n print(ans)",
"main"
] |
import sys
input = sys.stdin.readline
def main():
W, H, N = map(int, input().split())
X = [0] * N
Y = [0] * N
A = [0] * N
for i in range(N):
X[i], Y[i], A[i] = map(int, input().split())
x_min = 0
x_max = W
y_min = 0
y_max = H
for x, y, a in zip(X, Y, A):
if a == 1:
x_min = max(x_min, x)
elif a == 2:
x_max = min(x_max, x)
elif a == 3:
y_min = max(y_min, y)
else:
y_max = min(y_max, y)
ans = max(0, x_max - x_min) * max(0, y_max - y_min)
print(ans)
if __name__ == "__main__":
main()
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
13,
13,
17,
13,
13,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
14,
2,
13,
13,
14,
2,
13,
17,
14,
2,
13,
13,
14,
2,
13,
17,
14,
2,
13,
13,
14,
2,
13,
17,
14,
2,
13,
13,
14,
2,
40,
2,
13,
13,
17,
40,
2,
13,
13,
17,
4,
13,
17,
4,
13,
2,
2,
13,
13,
2,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13
] |
[
[
139,
4
],
[
130,
18
],
[
140,
25
],
[
130,
27
],
[
130,
28
],
[
121,
30
],
[
113,
31
],
[
142,
32
],
[
133,
34
],
[
128,
35
],
[
115,
36
],
[
40,
39
],
[
131,
42
],
[
136,
44
],
[
140,
51
],
[
136,
53
],
[
136,
54
],
[
119,
57
],
[
116,
61
],
[
125,
62
],
[
119,
65
],
[
134,
69
],
[
125,
70
],
[
119,
73
],
[
143,
77
],
[
137,
78
],
[
119,
81
],
[
122,
85
],
[
137,
86
],
[
134,
91
],
[
116,
92
],
[
122,
96
],
[
143,
97
],
[
134,
106
],
[
116,
107
],
[
122,
109
],
[
143,
110
],
[
130,
113
],
[
115,
116
],
[
136,
119
],
[
113,
121
],
[
121,
122
],
[
136,
125
],
[
130,
128
],
[
130,
131
],
[
128,
133
],
[
133,
134
],
[
136,
137
],
[
139,
140
],
[
142,
143
]
] |
[
"import sys\ninput=sys.stdin.readline\nsys.setrecursionlimit(10**6)\n\nw,h,n=map(int,input().split())\nu,d,r,l=h,0,w,0\nfor _ in range(n):\n x,y,a=map(int,input().split())\n if a==1:\n if l<x: l=x\n elif a==2:\n if r>x: r=x\n elif a==3:\n if d<y: d=y\n elif a==4:\n if u>y: u=y\n\nif r-l<=0 or u-d<=0:\n print(0)\nelse:\n print((r-l)*(u-d))",
"import sys",
"sys",
"input=sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"sys.setrecursionlimit(10**6)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**6",
"10",
"6",
"w,h,n=map(int,input().split())",
"w",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"u,d,r,l=h,0,w,0",
"u",
"h",
"d",
"0",
"r",
"w",
"l",
"0",
"for _ in range(n):\n x,y,a=map(int,input().split())\n if a==1:\n if l<x: l=x\n elif a==2:\n if r>x: r=x\n elif a==3:\n if d<y: d=y\n elif a==4:\n if u>y: 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 if l<x: l=x\n elif a==2:\n if r>x: r=x\n elif a==3:\n if d<y: d=y\n elif a==4:\n if u>y: u=y",
"a==1",
"a",
"1",
"if l<x: l=x\n ",
"l<x",
"l",
"x",
"elif a==2:\n if r>x: r=x\n ",
"a==2",
"a",
"2",
"if r>x: r=x\n ",
"r>x",
"r",
"x",
"elif a==3:\n if d<y: d=y\n ",
"a==3",
"a",
"3",
"if d<y: d=y\n ",
"d<y",
"d",
"y",
"elif a==4:\n if u>y: u=y",
"a==4",
"a",
"4",
"if ",
"u>y",
"u",
"y",
"if r-l<=0 or u-d<=0:\n print(0)\nelse:\n print((r-l)*(u-d))",
"r-l<=0 or u-d<=0",
"r-l<=0",
"r-l",
"r",
"l",
"0",
"u-d<=0",
"u-d",
"u",
"d",
"0",
"print(0)",
"print",
"0",
"print((r-l)*(u-d))",
"print",
"(r-l)*(u-d)",
"r-l",
"r",
"l",
"u-d",
"u",
"d",
"h,n=map(int,input().split())",
"map(int,input().split())",
"h",
"l=h,0,w,0",
"0",
"l",
"a=map(int,input().split())",
"map(int,input().split())",
"a",
"u,d,r,l=h,0,w,0",
"h",
"u",
"x,y,a=map(int,input().split())",
"map(int,input().split())",
"x",
"w,h,n=map(int,input().split())",
"map(int,input().split())",
"w",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"r,l=h,0,w,0",
"w",
"r",
"y,a=map(int,input().split())",
"map(int,input().split())",
"y",
"input=sys.stdin.readline",
"sys.stdin.readline",
"input",
"d,r,l=h,0,w,0",
"0",
"d"
] |
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)
w,h,n=map(int,input().split())
u,d,r,l=h,0,w,0
for _ in range(n):
x,y,a=map(int,input().split())
if a==1:
if l<x: l=x
elif a==2:
if r>x: r=x
elif a==3:
if d<y: d=y
elif a==4:
if u>y: u=y
if r-l<=0 or u-d<=0:
print(0)
else:
print((r-l)*(u-d))
|
[
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,
17,
0,
13,
13,
0,
13,
13,
28,
13,
13,
13,
13,
14,
2,
13,
17,
14,
2,
13,
13,
0,
13,
13,
14,
2,
13,
17,
14,
2,
13,
13,
0,
13,
13,
14,
2,
13,
17,
14,
2,
13,
13,
0,
13,
13,
14,
2,
13,
17,
14,
2,
13,
13,
0,
13,
13,
14,
2,
2,
2,
13,
13,
17,
2,
2,
13,
13,
17,
4,
13,
2,
2,
13,
13,
2,
13,
13,
4,
13,
17,
10,
17,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13
] |
[
[
149,
2
],
[
149,
11
],
[
149,
12
],
[
16,
15
],
[
144,
18
],
[
146,
31
],
[
152,
34
],
[
119,
37
],
[
140,
40
],
[
138,
41
],
[
131,
43
],
[
150,
44
],
[
153,
57
],
[
126,
57
],
[
125,
59
],
[
141,
68
],
[
135,
68
],
[
134,
70
],
[
120,
79
],
[
129,
79
],
[
128,
81
],
[
132,
90
],
[
123,
90
],
[
122,
92
],
[
135,
98
],
[
141,
98
],
[
126,
99
],
[
153,
99
],
[
123,
103
],
[
132,
103
],
[
129,
104
],
[
120,
104
],
[
135,
110
],
[
141,
110
],
[
126,
111
],
[
153,
111
],
[
123,
113
],
[
132,
113
],
[
129,
114
],
[
120,
114
],
[
119,
120
],
[
122,
123
],
[
125,
126
],
[
128,
129
],
[
150,
131
],
[
131,
132
],
[
134,
135
],
[
149,
138
],
[
138,
140
],
[
140,
141
],
[
149,
144
],
[
146,
147
],
[
149,
150
],
[
152,
153
]
] |
[
"w, h, n = map(int, input().split())\np = [tuple(map(int, input().split())) for _ in range(n)]\n\nx1 = 0\ny1 = 0\nx2 = w\ny2 = h\n\nfor x, y, a in p:\n if a == 1:\n if x > x1:\n x1 = x\n elif a == 2:\n if x < x2:\n x2 = x\n elif a == 3:\n if y > y1:\n y1 = y\n elif a == 4:\n if y < y2:\n y2 = y\n\nif x2-x1 > 0 and y2-y1 > 0:\n print((x2-x1)*(y2-y1))\nelse:\n print(0)",
"w, h, n = map(int, input().split())",
"w",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"tuple(map(int, input().split())) for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"tuple(map(int, input().split()))",
"tuple",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"p = [tuple(map(int, input().split())) for _ in range(n)]",
"p",
"[tuple(map(int, input().split())) for _ in range(n)]",
"x1 = 0",
"x1",
"0",
"y1 = 0",
"y1",
"0",
"x2 = w",
"x2",
"w",
"y2 = h",
"y2",
"h",
"for x, y, a in p:\n if a == 1:\n if x > x1:\n x1 = x\n elif a == 2:\n if x < x2:\n x2 = x\n elif a == 3:\n if y > y1:\n y1 = y\n elif a == 4:\n if y < y2:\n y2 = y",
"x",
"y",
"a",
"p",
"if a == 1:\n if x > x1:\n x1 = x\n elif a == 2:\n if x < x2:\n x2 = x\n elif a == 3:\n if y > y1:\n y1 = y\n elif a == 4:\n if y < y2:\n y2 = y",
"a == 1",
"a",
"1",
"if x > x1:\n x1 = x\n ",
"x > x1",
"x",
"x1",
"x1 = x",
"x1",
"x",
"elif a == 2:\n if x < x2:\n x2 = x\n ",
"a == 2",
"a",
"2",
"if x < x2:\n x2 = x\n ",
"x < x2",
"x",
"x2",
"x2 = x",
"x2",
"x",
"elif a == 3:\n if y > y1:\n y1 = y\n ",
"a == 3",
"a",
"3",
"if y > y1:\n y1 = y\n ",
"y > y1",
"y",
"y1",
"y1 = y",
"y1",
"y",
"elif a == 4:\n if y < y2:\n y2 = y",
"a == 4",
"a",
"4",
"if y < y2:\n y2 = y",
"y < y2",
"y",
"y2",
"y2 = y",
"y2",
"y",
"if x2-x1 > 0 and y2-y1 > 0:\n print((x2-x1)*(y2-y1))\nelse:\n print(0)",
"x2-x1 > 0 and y2-y1 > 0",
"x2-x1 > 0",
"x2-x1",
"x2",
"x1",
"0",
"y2-y1 > 0",
"y2-y1",
"y2",
"y1",
"0",
"print((x2-x1)*(y2-y1))",
"print",
"(x2-x1)*(y2-y1)",
"x2-x1",
"x2",
"x1",
"y2-y1",
"y2",
"y1",
"print(0)",
"print",
"0",
"y1 = 0",
"0",
"y1",
"y2 = y",
"y",
"y2",
"x1 = x",
"x",
"x1",
"y1 = y",
"y",
"y1",
"y2 = h",
"h",
"y2",
"x2 = x",
"x",
"x2",
"w, h, n = map(int, input().split())",
"map(int, input().split())",
"w",
"x2 = w",
"w",
"x2",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"p = [tuple(map(int, input().split())) for _ in range(n)]",
"[tuple(map(int, input().split())) for _ in range(n)]",
"p",
"h, n = map(int, input().split())",
"map(int, input().split())",
"h",
"x1 = 0",
"0",
"x1"
] |
w, h, n = map(int, input().split())
p = [tuple(map(int, input().split())) for _ in range(n)]
x1 = 0
y1 = 0
x2 = w
y2 = h
for x, y, a in p:
if a == 1:
if x > x1:
x1 = x
elif a == 2:
if x < x2:
x2 = x
elif a == 3:
if y > y1:
y1 = y
elif a == 4:
if y < y2:
y2 = y
if x2-x1 > 0 and y2-y1 > 0:
print((x2-x1)*(y2-y1))
else:
print(0)
|
[
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,
0,
13,
2,
39,
17,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
4,
13,
13,
4,
18,
4,
13,
13,
18,
13,
13,
18,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
4,
18,
13,
13,
2,
39,
17,
13,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
18,
13,
13,
0,
18,
18,
13,
13,
13,
17,
14,
2,
18,
13,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
18,
13,
13,
13,
0,
18,
18,
13,
13,
13,
17,
14,
2,
18,
13,
13,
17,
28,
13,
4,
13,
18,
13,
13,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
13,
17,
28,
13,
4,
13,
18,
13,
13,
13,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
13,
17,
4,
13,
4,
13,
4,
13,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13
] |
[
[
192,
2
],
[
192,
11
],
[
192,
12
],
[
195,
14
],
[
193,
18
],
[
180,
20
],
[
193,
24
],
[
198,
26
],
[
193,
30
],
[
33,
32
],
[
193,
35
],
[
40,
37
],
[
196,
38
],
[
32,
39
],
[
40,
48
],
[
181,
49
],
[
32,
50
],
[
40,
51
],
[
199,
52
],
[
32,
53
],
[
189,
55
],
[
59,
58
],
[
187,
61
],
[
190,
64
],
[
184,
69
],
[
72,
71
],
[
193,
74
],
[
51,
77
],
[
199,
78
],
[
71,
79
],
[
83,
82
],
[
187,
85
],
[
88,
87
],
[
37,
90
],
[
196,
91
],
[
71,
92
],
[
99,
94
],
[
190,
96
],
[
82,
97
],
[
87,
98
],
[
51,
102
],
[
199,
103
],
[
71,
104
],
[
108,
107
],
[
187,
110
],
[
113,
112
],
[
37,
115
],
[
196,
116
],
[
71,
117
],
[
184,
118
],
[
125,
120
],
[
190,
122
],
[
107,
123
],
[
112,
124
],
[
51,
128
],
[
199,
129
],
[
71,
130
],
[
134,
133
],
[
48,
136
],
[
181,
137
],
[
71,
138
],
[
141,
140
],
[
184,
143
],
[
150,
145
],
[
190,
147
],
[
133,
148
],
[
140,
149
],
[
153,
152
],
[
48,
155
],
[
181,
156
],
[
71,
157
],
[
187,
158
],
[
161,
160
],
[
184,
163
],
[
170,
165
],
[
190,
167
],
[
152,
168
],
[
160,
169
],
[
190,
178
],
[
180,
181
],
[
192,
184
],
[
192,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
]
] |
[
"w,h,n = map(int,input().split())\nx = [0] * n\ny = [0] * n\na = [0] * n\nfor i in range(n):\n x[i], y[i], a[i] = map(int, input().split())\nbox = []\n\nfor i in range(h):\n box.append([1]*w)\nfor i in range(n):\n if a[i] == 1:\n for m in range(h):\n for j in range(x[i]):\n box[m][j] = 0 \n elif a[i] == 2:\n for m in range(h):\n for j in range(x[i],w):\n box[m][j] = 0\n elif a[i] == 3:\n for m in range(y[i]):\n for j in range(w):\n box[m][j] = 0\n else:\n for m in range(y[i],h):\n for j in range(w):\n box[m][j] = 0\nprint(sum(map(sum,box)))",
"w,h,n = map(int,input().split())",
"w",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"x = [0] * n",
"x",
"[0] * n",
"[0]",
"0",
"n",
"y = [0] * n",
"y",
"[0] * n",
"[0]",
"0",
"n",
"a = [0] * n",
"a",
"[0] * n",
"[0]",
"0",
"n",
"for i in range(n):\n x[i], y[i], a[i] = map(int, input().split())",
"i",
"range(n)",
"range",
"n",
"x[i], y[i], a[i] = map(int, input().split())",
"x[i]",
"x",
"i",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"y[i]",
"y",
"i",
"a[i]",
"a",
"i",
"box = []",
"box",
"[]",
"for i in range(h):\n box.append([1]*w)",
"i",
"range(h)",
"range",
"h",
"box.append([1]*w)",
"box.append",
"box",
"append",
"[1]*w",
"[1]",
"1",
"w",
"for i in range(n):\n if a[i] == 1:\n for m in range(h):\n for j in range(x[i]):\n box[m][j] = 0 \n elif a[i] == 2:\n for m in range(h):\n for j in range(x[i],w):\n box[m][j] = 0\n elif a[i] == 3:\n for m in range(y[i]):\n for j in range(w):\n box[m][j] = 0\n else:\n for m in range(y[i],h):\n for j in range(w):\n box[m][j] = 0",
"i",
"range(n)",
"range",
"n",
"if a[i] == 1:\n for m in range(h):\n for j in range(x[i]):\n box[m][j] = 0 \n elif a[i] == 2:\n for m in range(h):\n for j in range(x[i],w):\n box[m][j] = 0\n elif a[i] == 3:\n for m in range(y[i]):\n for j in range(w):\n box[m][j] = 0\n else:\n for m in range(y[i],h):\n for j in range(w):\n box[m][j] = 0",
"a[i] == 1",
"a[i]",
"a",
"i",
"1",
"for m in range(h):\n for j in range(x[i]):\n box[m][j] = 0 \n ",
"m",
"range(h)",
"range",
"h",
"for j in range(x[i]):\n box[m][j] = 0 \n ",
"j",
"range(x[i])",
"range",
"x[i]",
"x",
"i",
"box[m][j] = 0",
"box[m][j]",
"[m]",
"box",
"m",
"j",
"0",
"elif a[i] == 2:\n for m in range(h):\n for j in range(x[i],w):\n box[m][j] = 0\n ",
"a[i] == 2",
"a[i]",
"a",
"i",
"2",
"for m in range(h):\n for j in range(x[i],w):\n box[m][j] = 0\n ",
"m",
"range(h)",
"range",
"h",
"for j in range(x[i],w):\n box[m][j] = 0\n ",
"j",
"range(x[i],w)",
"range",
"x[i]",
"x",
"i",
"w",
"box[m][j] = 0",
"box[m][j]",
"[m]",
"box",
"m",
"j",
"0",
"elif a[i] == 3:\n for m in range(y[i]):\n for j in range(w):\n box[m][j] = 0\n ",
"a[i] == 3",
"a[i]",
"a",
"i",
"3",
"for m in range(y[i]):\n for j in range(w):\n box[m][j] = 0\n ",
"m",
"range(y[i])",
"range",
"y[i]",
"y",
"i",
"for j in range(w):\n box[m][j] = 0\n ",
"j",
"range(w)",
"range",
"w",
"box[m][j] = 0",
"box[m][j]",
"[m]",
"box",
"m",
"j",
"0",
"for m in range(y[i],h):\n for j in range(w):\n box[m][j] = 0",
"m",
"range(y[i],h)",
"range",
"y[i]",
"y",
"i",
"h",
"for j in range(w):\n box[m][j] = 0",
"j",
"range(w)",
"range",
"w",
"box[m][j] = 0",
"box[m][j]",
"[m]",
"box",
"m",
"j",
"0",
"print(sum(map(sum,box)))",
"print",
"sum(map(sum,box))",
"sum",
"map(sum,box)",
"map",
"sum",
"box",
"y = [0] * n",
"[0] * n",
"y",
"w,h,n = map(int,input().split())",
"map(int,input().split())",
"w",
"h,n = map(int,input().split())",
"map(int,input().split())",
"h",
"box = []",
"[]",
"box",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"x = [0] * n",
"[0] * n",
"x",
"a = [0] * n",
"[0] * n",
"a"
] |
w,h,n = map(int,input().split())
x = [0] * n
y = [0] * n
a = [0] * n
for i in range(n):
x[i], y[i], a[i] = map(int, input().split())
box = []
for i in range(h):
box.append([1]*w)
for i in range(n):
if a[i] == 1:
for m in range(h):
for j in range(x[i]):
box[m][j] = 0
elif a[i] == 2:
for m in range(h):
for j in range(x[i],w):
box[m][j] = 0
elif a[i] == 3:
for m in range(y[i]):
for j in range(w):
box[m][j] = 0
else:
for m in range(y[i],h):
for j in range(w):
box[m][j] = 0
print(sum(map(sum,box)))
|
[
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,
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,
0,
13,
2,
2,
13,
13,
2,
13,
13,
14,
2,
2,
40,
13,
17,
2,
13,
13,
2,
13,
13,
4,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
2,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] |
[
[
171,
2
],
[
171,
11
],
[
171,
12
],
[
16,
15
],
[
154,
18
],
[
156,
31
],
[
180,
34
],
[
168,
37
],
[
160,
38
],
[
150,
40
],
[
162,
43
],
[
172,
44
],
[
47,
46
],
[
154,
49
],
[
157,
54
],
[
46,
55
],
[
177,
59
],
[
181,
62
],
[
178,
62
],
[
157,
65
],
[
46,
66
],
[
157,
72
],
[
46,
73
],
[
186,
77
],
[
169,
80
],
[
187,
80
],
[
157,
83
],
[
46,
84
],
[
157,
90
],
[
46,
91
],
[
174,
95
],
[
151,
98
],
[
175,
98
],
[
157,
101
],
[
46,
102
],
[
157,
108
],
[
46,
109
],
[
183,
113
],
[
163,
116
],
[
184,
116
],
[
157,
119
],
[
46,
120
],
[
165,
123
],
[
187,
126
],
[
169,
126
],
[
178,
127
],
[
181,
127
],
[
184,
129
],
[
163,
129
],
[
175,
130
],
[
151,
130
],
[
166,
135
],
[
187,
138
],
[
169,
138
],
[
178,
139
],
[
181,
139
],
[
184,
141
],
[
163,
141
],
[
175,
142
],
[
151,
142
],
[
166,
148
],
[
150,
151
],
[
171,
154
],
[
156,
157
],
[
171,
160
],
[
172,
162
],
[
162,
163
],
[
165,
166
],
[
160,
168
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
],
[
180,
181
],
[
183,
184
],
[
186,
187
]
] |
[
"W, H, N = map(int, input().split())\narray = [list(map(int, input().split())) for i in range(N)]\n\nxmin = 0\nxmax = W\nymin = 0\nymax = H\nfor i in range(N):\n\n if array[i][2] == 1:\n xmin = max(xmin, array[i][0])\n elif array[i][2] == 2:\n xmax = min(xmax, array[i][0])\n elif array[i][2] == 3:\n ymin = max(ymin, array[i][1])\n elif array[i][2] == 4:\n ymax = min(ymax, array[i][1])\narea = (xmax-xmin)*(ymax-ymin)\nif area <= 0 or xmax < xmin or ymax < ymin:\n print(0)\nelse:\n print(area)",
"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",
"array = [list(map(int, input().split())) for i in range(N)]",
"array",
"[list(map(int, input().split())) for i in range(N)]",
"xmin = 0",
"xmin",
"0",
"xmax = W",
"xmax",
"W",
"ymin = 0",
"ymin",
"0",
"ymax = H",
"ymax",
"H",
"for i in range(N):\n\n if array[i][2] == 1:\n xmin = max(xmin, array[i][0])\n elif array[i][2] == 2:\n xmax = min(xmax, array[i][0])\n elif array[i][2] == 3:\n ymin = max(ymin, array[i][1])\n elif array[i][2] == 4:\n ymax = min(ymax, array[i][1])",
"i",
"range(N)",
"range",
"N",
"if array[i][2] == 1:\n xmin = max(xmin, array[i][0])\n elif array[i][2] == 2:\n xmax = min(xmax, array[i][0])\n elif array[i][2] == 3:\n ymin = max(ymin, array[i][1])\n elif array[i][2] == 4:\n ymax = min(ymax, array[i][1])",
"array[i][2] == 1",
"array[i][2]",
"[i]",
"array",
"i",
"2",
"1",
"xmin = max(xmin, array[i][0])",
"xmin",
"max(xmin, array[i][0])",
"max",
"xmin",
"array[i][0]",
"[i]",
"array",
"i",
"0",
"elif array[i][2] == 2:\n xmax = min(xmax, array[i][0])\n ",
"array[i][2] == 2",
"array[i][2]",
"[i]",
"array",
"i",
"2",
"2",
"xmax = min(xmax, array[i][0])",
"xmax",
"min(xmax, array[i][0])",
"min",
"xmax",
"array[i][0]",
"[i]",
"array",
"i",
"0",
"elif array[i][2] == 3:\n ymin = max(ymin, array[i][1])\n ",
"array[i][2] == 3",
"array[i][2]",
"[i]",
"array",
"i",
"2",
"3",
"ymin = max(ymin, array[i][1])",
"ymin",
"max(ymin, array[i][1])",
"max",
"ymin",
"array[i][1]",
"[i]",
"array",
"i",
"1",
"elif array[i][2] == 4:\n ymax = min(ymax, array[i][1])",
"array[i][2] == 4",
"array[i][2]",
"[i]",
"array",
"i",
"2",
"4",
"ymax = min(ymax, array[i][1])",
"ymax",
"min(ymax, array[i][1])",
"min",
"ymax",
"array[i][1]",
"[i]",
"array",
"i",
"1",
"area = (xmax-xmin)*(ymax-ymin)",
"area",
"(xmax-xmin)*(ymax-ymin)",
"xmax-xmin",
"xmax",
"xmin",
"ymax-ymin",
"ymax",
"ymin",
"if area <= 0 or xmax < xmin or ymax < ymin:\n print(0)\nelse:\n print(area)",
"area <= 0 or xmax < xmin or ymax < ymin",
"area <= 0 or xmax < xmin",
"area <= 0",
"area",
"0",
"xmax < xmin",
"xmax",
"xmin",
"ymax < ymin",
"ymax",
"ymin",
"print(0)",
"print",
"0",
"print(area)",
"print",
"area",
"ymin = 0",
"0",
"ymin",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"array = [list(map(int, input().split())) for i in range(N)]",
"[list(map(int, input().split())) for i in range(N)]",
"array",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"ymax = H",
"H",
"ymax",
"area = (xmax-xmin)*(ymax-ymin)",
"(xmax-xmin)*(ymax-ymin)",
"area",
"xmax = W",
"W",
"xmax",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"ymin = max(ymin, array[i][1])",
"max(ymin, array[i][1])",
"ymin",
"xmin = max(xmin, array[i][0])",
"max(xmin, array[i][0])",
"xmin",
"xmin = 0",
"0",
"xmin",
"ymax = min(ymax, array[i][1])",
"min(ymax, array[i][1])",
"ymax",
"xmax = min(xmax, array[i][0])",
"min(xmax, array[i][0])",
"xmax"
] |
W, H, N = map(int, input().split())
array = [list(map(int, input().split())) for i in range(N)]
xmin = 0
xmax = W
ymin = 0
ymax = H
for i in range(N):
if array[i][2] == 1:
xmin = max(xmin, array[i][0])
elif array[i][2] == 2:
xmax = min(xmax, array[i][0])
elif array[i][2] == 3:
ymin = max(ymin, array[i][1])
elif array[i][2] == 4:
ymax = min(ymax, array[i][1])
area = (xmax-xmin)*(ymax-ymin)
if area <= 0 or xmax < xmin or ymax < ymin:
print(0)
else:
print(area)
|
[
7,
15,
13,
4,
18,
13,
13,
17,
15,
13,
15,
13,
0,
13,
4,
13,
17,
15,
15,
13,
15,
13,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
0,
13,
39,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
13,
0,
13,
39,
39,
17,
17,
39,
13,
17,
39,
13,
13,
39,
17,
13,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
0,
18,
18,
13,
17,
17,
4,
13,
18,
18,
13,
17,
17,
18,
13,
13,
0,
18,
18,
13,
17,
17,
4,
13,
18,
18,
13,
17,
17,
18,
13,
13,
14,
2,
18,
13,
13,
17,
0,
18,
18,
13,
17,
17,
4,
13,
18,
18,
13,
17,
17,
18,
13,
13,
0,
18,
18,
13,
17,
17,
4,
13,
18,
18,
13,
17,
17,
18,
13,
13,
14,
2,
18,
13,
13,
17,
0,
18,
18,
13,
17,
17,
4,
13,
18,
18,
13,
17,
17,
18,
13,
13,
0,
18,
18,
13,
17,
17,
4,
13,
18,
18,
13,
17,
17,
18,
13,
13,
0,
18,
18,
13,
17,
17,
4,
13,
18,
18,
13,
17,
17,
18,
13,
13,
0,
18,
18,
13,
17,
17,
4,
13,
18,
18,
13,
17,
17,
18,
13,
13,
0,
13,
2,
18,
18,
13,
17,
17,
18,
18,
13,
17,
17,
0,
13,
2,
18,
18,
13,
17,
17,
18,
18,
13,
17,
17,
14,
2,
40,
13,
17,
40,
13,
17,
4,
13,
17,
29,
4,
13,
2,
13,
13,
14,
2,
13,
17,
4,
13,
10,
4,
13,
10,
12,
13
] |
[
[
293,
13
],
[
26,
25
],
[
26,
34
],
[
26,
35
],
[
38,
37
],
[
41,
40
],
[
44,
43
],
[
47,
46
],
[
35,
49
],
[
52,
51
],
[
52,
60
],
[
52,
61
],
[
37,
64
],
[
51,
66
],
[
40,
69
],
[
60,
71
],
[
43,
74
],
[
61,
76
],
[
79,
78
],
[
94,
93
],
[
35,
96
],
[
43,
100
],
[
93,
101
],
[
109,
104
],
[
78,
106
],
[
78,
113
],
[
37,
117
],
[
93,
118
],
[
125,
120
],
[
78,
122
],
[
78,
129
],
[
37,
133
],
[
93,
134
],
[
43,
138
],
[
93,
139
],
[
147,
142
],
[
78,
144
],
[
78,
151
],
[
37,
155
],
[
93,
156
],
[
163,
158
],
[
78,
160
],
[
78,
167
],
[
37,
171
],
[
93,
172
],
[
43,
176
],
[
93,
177
],
[
185,
180
],
[
78,
182
],
[
78,
189
],
[
40,
193
],
[
93,
194
],
[
201,
196
],
[
78,
198
],
[
78,
205
],
[
40,
209
],
[
93,
210
],
[
217,
212
],
[
78,
214
],
[
78,
221
],
[
40,
225
],
[
93,
226
],
[
233,
228
],
[
78,
230
],
[
78,
237
],
[
40,
241
],
[
93,
242
],
[
245,
244
],
[
78,
248
],
[
78,
253
],
[
258,
257
],
[
78,
261
],
[
78,
266
],
[
244,
272
],
[
257,
275
],
[
244,
284
],
[
257,
285
],
[
297,
291
],
[
293,
294
]
] |
[
"import sys\nsys.setrecursionlimit(4100000)\nimport math\nimport itertools\nINF = float('inf')\nfrom heapq import heapify, heappop, heappush\nimport collections\nimport bisect\n\ndef main():\n w,h,n = map(int, input().split())\n X = []\n Y = []\n A = []\n for i in range(n):\n x,y,a = map(int, input().split())\n X.append(x)\n Y.append(y)\n A.append(a)\n\n plots = [[0,0], [w,0], [w,h], [0,h]]\n for i in range(n):\n if A[i] == 1:\n plots[0][0] = max(plots[0][0], X[i])\n plots[3][0] = max(plots[3][0], X[i])\n elif A[i] == 2:\n plots[1][0] = min(plots[1][0], X[i])\n plots[2][0] = min(plots[2][0], X[i])\n elif A[i] == 3:\n plots[0][1] = max(plots[0][1], Y[i])\n plots[1][1] = max(plots[1][1], Y[i])\n else:\n plots[2][1] = min(plots[2][1], Y[i])\n plots[3][1] = min(plots[3][1], Y[i])\n width = plots[1][0] - plots[0][0]\n height = plots[2][1] - plots[1][1]\n if width <= 0 or height <= 0:\n print(0)\n return\n print(width * height)\n\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"sys.setrecursionlimit(4100000)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"4100000",
"import math",
"math",
"import itertools",
"itertools",
"INF = float('inf')",
"INF",
"float('inf')",
"float",
"'inf'",
"from heapq import heapify, heappop, heappush",
"import collections",
"collections",
"import bisect",
"bisect",
"def main():\n w,h,n = map(int, input().split())\n X = []\n Y = []\n A = []\n for i in range(n):\n x,y,a = map(int, input().split())\n X.append(x)\n Y.append(y)\n A.append(a)\n\n plots = [[0,0], [w,0], [w,h], [0,h]]\n for i in range(n):\n if A[i] == 1:\n plots[0][0] = max(plots[0][0], X[i])\n plots[3][0] = max(plots[3][0], X[i])\n elif A[i] == 2:\n plots[1][0] = min(plots[1][0], X[i])\n plots[2][0] = min(plots[2][0], X[i])\n elif A[i] == 3:\n plots[0][1] = max(plots[0][1], Y[i])\n plots[1][1] = max(plots[1][1], Y[i])\n else:\n plots[2][1] = min(plots[2][1], Y[i])\n plots[3][1] = min(plots[3][1], Y[i])\n width = plots[1][0] - plots[0][0]\n height = plots[2][1] - plots[1][1]\n if width <= 0 or height <= 0:\n print(0)\n return\n print(width * height)",
"main",
"w,h,n = map(int, input().split())",
"w",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"X = []",
"X",
"[]",
"Y = []",
"Y",
"[]",
"A = []",
"A",
"[]",
"for i in range(n):\n x,y,a = map(int, input().split())\n X.append(x)\n Y.append(y)\n A.append(a)\n\n ",
"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",
"X.append(x)",
"X.append",
"X",
"append",
"x",
"Y.append(y)",
"Y.append",
"Y",
"append",
"y",
"A.append(a)",
"A.append",
"A",
"append",
"a",
"plots = [[0,0], [w,0], [w,h], [0,h]]",
"plots",
"[[0,0], [w,0], [w,h], [0,h]]",
"[0,0]",
"0",
"0",
"[w,0]",
"w",
"0",
"[w,h]",
"w",
"h",
"[0,h]",
"0",
"h",
"for i in range(n):\n if A[i] == 1:\n plots[0][0] = max(plots[0][0], X[i])\n plots[3][0] = max(plots[3][0], X[i])\n elif A[i] == 2:\n plots[1][0] = min(plots[1][0], X[i])\n plots[2][0] = min(plots[2][0], X[i])\n elif A[i] == 3:\n plots[0][1] = max(plots[0][1], Y[i])\n plots[1][1] = max(plots[1][1], Y[i])\n else:\n plots[2][1] = min(plots[2][1], Y[i])\n plots[3][1] = min(plots[3][1], Y[i])\n ",
"i",
"range(n)",
"range",
"n",
"if A[i] == 1:\n plots[0][0] = max(plots[0][0], X[i])\n plots[3][0] = max(plots[3][0], X[i])\n elif A[i] == 2:\n plots[1][0] = min(plots[1][0], X[i])\n plots[2][0] = min(plots[2][0], X[i])\n elif A[i] == 3:\n plots[0][1] = max(plots[0][1], Y[i])\n plots[1][1] = max(plots[1][1], Y[i])\n else:\n plots[2][1] = min(plots[2][1], Y[i])\n plots[3][1] = min(plots[3][1], Y[i])\n ",
"A[i] == 1",
"A[i]",
"A",
"i",
"1",
"plots[0][0] = max(plots[0][0], X[i])",
"plots[0][0]",
"[0]",
"plots",
"0",
"0",
"max(plots[0][0], X[i])",
"max",
"plots[0][0]",
"[0]",
"plots",
"0",
"0",
"X[i]",
"X",
"i",
"plots[3][0] = max(plots[3][0], X[i])",
"plots[3][0]",
"[3]",
"plots",
"3",
"0",
"max(plots[3][0], X[i])",
"max",
"plots[3][0]",
"[3]",
"plots",
"3",
"0",
"X[i]",
"X",
"i",
"elif A[i] == 2:\n plots[1][0] = min(plots[1][0], X[i])\n plots[2][0] = min(plots[2][0], X[i])\n ",
"A[i] == 2",
"A[i]",
"A",
"i",
"2",
"plots[1][0] = min(plots[1][0], X[i])",
"plots[1][0]",
"[1]",
"plots",
"1",
"0",
"min(plots[1][0], X[i])",
"min",
"plots[1][0]",
"[1]",
"plots",
"1",
"0",
"X[i]",
"X",
"i",
"plots[2][0] = min(plots[2][0], X[i])",
"plots[2][0]",
"[2]",
"plots",
"2",
"0",
"min(plots[2][0], X[i])",
"min",
"plots[2][0]",
"[2]",
"plots",
"2",
"0",
"X[i]",
"X",
"i",
"elif A[i] == 3:\n plots[0][1] = max(plots[0][1], Y[i])\n plots[1][1] = max(plots[1][1], Y[i])\n ",
"A[i] == 3",
"A[i]",
"A",
"i",
"3",
"plots[0][1] = max(plots[0][1], Y[i])",
"plots[0][1]",
"[0]",
"plots",
"0",
"1",
"max(plots[0][1], Y[i])",
"max",
"plots[0][1]",
"[0]",
"plots",
"0",
"1",
"Y[i]",
"Y",
"i",
"plots[1][1] = max(plots[1][1], Y[i])",
"plots[1][1]",
"[1]",
"plots",
"1",
"1",
"max(plots[1][1], Y[i])",
"max",
"plots[1][1]",
"[1]",
"plots",
"1",
"1",
"Y[i]",
"Y",
"i",
"plots[2][1] = min(plots[2][1], Y[i])",
"plots[2][1]",
"[2]",
"plots",
"2",
"1",
"min(plots[2][1], Y[i])",
"min",
"plots[2][1]",
"[2]",
"plots",
"2",
"1",
"Y[i]",
"Y",
"i",
"plots[3][1] = min(plots[3][1], Y[i])",
"plots[3][1]",
"[3]",
"plots",
"3",
"1",
"min(plots[3][1], Y[i])",
"min",
"plots[3][1]",
"[3]",
"plots",
"3",
"1",
"Y[i]",
"Y",
"i",
"width = plots[1][0] - plots[0][0]",
"width",
"plots[1][0] - plots[0][0]",
"plots[1][0]",
"[1]",
"plots",
"1",
"0",
"plots[0][0]",
"[0]",
"plots",
"0",
"0",
"height = plots[2][1] - plots[1][1]",
"height",
"plots[2][1] - plots[1][1]",
"plots[2][1]",
"[2]",
"plots",
"2",
"1",
"plots[1][1]",
"[1]",
"plots",
"1",
"1",
"if width <= 0 or height <= 0:\n print(0)\n return\n ",
"width <= 0 or height <= 0",
"width <= 0",
"width",
"0",
"height <= 0",
"height",
"0",
"print(0)",
"print",
"0",
"return",
"print(width * height)",
"print",
"width * height",
"width",
"height",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"INF = float('inf')",
"float('inf')",
"INF",
"def main():\n w,h,n = map(int, input().split())\n X = []\n Y = []\n A = []\n for i in range(n):\n x,y,a = map(int, input().split())\n X.append(x)\n Y.append(y)\n A.append(a)\n\n plots = [[0,0], [w,0], [w,h], [0,h]]\n for i in range(n):\n if A[i] == 1:\n plots[0][0] = max(plots[0][0], X[i])\n plots[3][0] = max(plots[3][0], X[i])\n elif A[i] == 2:\n plots[1][0] = min(plots[1][0], X[i])\n plots[2][0] = min(plots[2][0], X[i])\n elif A[i] == 3:\n plots[0][1] = max(plots[0][1], Y[i])\n plots[1][1] = max(plots[1][1], Y[i])\n else:\n plots[2][1] = min(plots[2][1], Y[i])\n plots[3][1] = min(plots[3][1], Y[i])\n width = plots[1][0] - plots[0][0]\n height = plots[2][1] - plots[1][1]\n if width <= 0 or height <= 0:\n print(0)\n return\n print(width * height)",
"def main():\n w,h,n = map(int, input().split())\n X = []\n Y = []\n A = []\n for i in range(n):\n x,y,a = map(int, input().split())\n X.append(x)\n Y.append(y)\n A.append(a)\n\n plots = [[0,0], [w,0], [w,h], [0,h]]\n for i in range(n):\n if A[i] == 1:\n plots[0][0] = max(plots[0][0], X[i])\n plots[3][0] = max(plots[3][0], X[i])\n elif A[i] == 2:\n plots[1][0] = min(plots[1][0], X[i])\n plots[2][0] = min(plots[2][0], X[i])\n elif A[i] == 3:\n plots[0][1] = max(plots[0][1], Y[i])\n plots[1][1] = max(plots[1][1], Y[i])\n else:\n plots[2][1] = min(plots[2][1], Y[i])\n plots[3][1] = min(plots[3][1], Y[i])\n width = plots[1][0] - plots[0][0]\n height = plots[2][1] - plots[1][1]\n if width <= 0 or height <= 0:\n print(0)\n return\n print(width * height)",
"main"
] |
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
import collections
import bisect
def main():
w,h,n = map(int, input().split())
X = []
Y = []
A = []
for i in range(n):
x,y,a = map(int, input().split())
X.append(x)
Y.append(y)
A.append(a)
plots = [[0,0], [w,0], [w,h], [0,h]]
for i in range(n):
if A[i] == 1:
plots[0][0] = max(plots[0][0], X[i])
plots[3][0] = max(plots[3][0], X[i])
elif A[i] == 2:
plots[1][0] = min(plots[1][0], X[i])
plots[2][0] = min(plots[2][0], X[i])
elif A[i] == 3:
plots[0][1] = max(plots[0][1], Y[i])
plots[1][1] = max(plots[1][1], Y[i])
else:
plots[2][1] = min(plots[2][1], Y[i])
plots[3][1] = min(plots[3][1], Y[i])
width = plots[1][0] - plots[0][0]
height = plots[2][1] - plots[1][1]
if width <= 0 or height <= 0:
print(0)
return
print(width * height)
if __name__ == '__main__':
main()
|
[
7,
15,
13,
12,
13,
14,
2,
18,
13,
17,
17,
0,
18,
13,
17,
4,
13,
4,
13,
18,
13,
17,
18,
13,
17,
18,
13,
17,
14,
2,
18,
13,
17,
17,
0,
18,
13,
17,
4,
13,
4,
13,
18,
13,
17,
18,
13,
17,
18,
13,
17,
14,
2,
18,
13,
17,
17,
0,
18,
13,
17,
4,
13,
4,
13,
18,
13,
17,
18,
13,
17,
18,
13,
17,
14,
2,
18,
13,
17,
17,
0,
18,
13,
17,
4,
13,
4,
13,
18,
13,
17,
18,
13,
17,
18,
13,
17,
23,
13,
23,
13,
12,
13,
0,
13,
39,
17,
17,
13,
13,
28,
13,
4,
13,
13,
4,
13,
13,
18,
13,
13,
29,
2,
2,
18,
13,
17,
18,
13,
17,
2,
18,
13,
17,
18,
13,
17,
23,
13,
23,
13,
23,
13,
23,
13,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
0,
13,
13,
4,
13,
4,
13,
13,
13,
13,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13
] |
[
[
100,
8
],
[
15,
12
],
[
98,
13
],
[
98,
20
],
[
100,
23
],
[
98,
26
],
[
100,
31
],
[
38,
35
],
[
98,
36
],
[
98,
43
],
[
100,
46
],
[
98,
49
],
[
100,
54
],
[
61,
58
],
[
98,
59
],
[
98,
66
],
[
100,
69
],
[
98,
72
],
[
100,
77
],
[
84,
81
],
[
98,
82
],
[
98,
89
],
[
100,
92
],
[
98,
95
],
[
98,
98
],
[
100,
100
],
[
105,
104
],
[
112,
111
],
[
142,
114
],
[
210,
116
],
[
104,
117
],
[
144,
119
],
[
111,
120
],
[
104,
125
],
[
104,
128
],
[
104,
132
],
[
104,
135
],
[
138,
138
],
[
140,
140
],
[
142,
142
],
[
144,
144
],
[
215,
146
],
[
215,
162
],
[
215,
163
],
[
167,
166
],
[
201,
169
],
[
203,
189
],
[
213,
194
],
[
207,
195
],
[
216,
196
],
[
201,
197
],
[
204,
198
],
[
215,
201
],
[
203,
204
],
[
215,
207
],
[
215,
216
]
] |
[
"import sys\n\ndef nextrec(coor,pt):\n if pt[2]==1:\n coor[0]=min(max(coor[0],pt[0]),coor[2])\n elif pt[2]==2:\n coor[2]=max(min(coor[2],pt[0]),coor[0])\n elif pt[2]==3:\n coor[1]=min(max(coor[1],pt[1]),coor[3])\n elif pt[2]==4:\n coor[3]=max(min(coor[3],pt[1]),coor[1])\ndef main(w,h,n,pts):\n rec=[0,0,w,h]\n for x in range(n):\n nextrec(rec,pts[x])\n return (rec[0]-rec[2])*(rec[1]-rec[3])\n\nw,h,n=map(int,sys.stdin.readline().strip().split())\npts=[list(map(int,sys.stdin.readline().strip().split())) \\\n for x in range(n)]\n\nprint(main(w,h,n,pts))",
"import sys",
"sys",
"def nextrec(coor,pt):\n if pt[2]==1:\n coor[0]=min(max(coor[0],pt[0]),coor[2])\n elif pt[2]==2:\n coor[2]=max(min(coor[2],pt[0]),coor[0])\n elif pt[2]==3:\n coor[1]=min(max(coor[1],pt[1]),coor[3])\n elif pt[2]==4:\n coor[3]=max(min(coor[3],pt[1]),coor[1])",
"nextrec",
"if pt[2]==1:\n coor[0]=min(max(coor[0],pt[0]),coor[2])\n elif pt[2]==2:\n coor[2]=max(min(coor[2],pt[0]),coor[0])\n elif pt[2]==3:\n coor[1]=min(max(coor[1],pt[1]),coor[3])\n elif pt[2]==4:\n coor[3]=max(min(coor[3],pt[1]),coor[1])",
"pt[2]==1",
"pt[2]",
"pt",
"2",
"1",
"coor[0]=min(max(coor[0],pt[0]),coor[2])",
"coor[0]",
"coor",
"0",
"min(max(coor[0],pt[0]),coor[2])",
"min",
"max(coor[0],pt[0])",
"max",
"coor[0]",
"coor",
"0",
"pt[0]",
"pt",
"0",
"coor[2]",
"coor",
"2",
"elif pt[2]==2:\n coor[2]=max(min(coor[2],pt[0]),coor[0])\n ",
"pt[2]==2",
"pt[2]",
"pt",
"2",
"2",
"coor[2]=max(min(coor[2],pt[0]),coor[0])",
"coor[2]",
"coor",
"2",
"max(min(coor[2],pt[0]),coor[0])",
"max",
"min(coor[2],pt[0])",
"min",
"coor[2]",
"coor",
"2",
"pt[0]",
"pt",
"0",
"coor[0]",
"coor",
"0",
"elif pt[2]==3:\n coor[1]=min(max(coor[1],pt[1]),coor[3])\n ",
"pt[2]==3",
"pt[2]",
"pt",
"2",
"3",
"coor[1]=min(max(coor[1],pt[1]),coor[3])",
"coor[1]",
"coor",
"1",
"min(max(coor[1],pt[1]),coor[3])",
"min",
"max(coor[1],pt[1])",
"max",
"coor[1]",
"coor",
"1",
"pt[1]",
"pt",
"1",
"coor[3]",
"coor",
"3",
"elif pt[2]==4:\n coor[3]=max(min(coor[3],pt[1]),coor[1])",
"pt[2]==4",
"pt[2]",
"pt",
"2",
"4",
"coor[3]=max(min(coor[3],pt[1]),coor[1])",
"coor[3]",
"coor",
"3",
"max(min(coor[3],pt[1]),coor[1])",
"max",
"min(coor[3],pt[1])",
"min",
"coor[3]",
"coor",
"3",
"pt[1]",
"pt",
"1",
"coor[1]",
"coor",
"1",
"coor",
"coor",
"pt",
"pt",
"def main(w,h,n,pts):\n rec=[0,0,w,h]\n for x in range(n):\n nextrec(rec,pts[x])\n return (rec[0]-rec[2])*(rec[1]-rec[3])",
"main",
"rec=[0,0,w,h]",
"rec",
"[0,0,w,h]",
"0",
"0",
"w",
"h",
"for x in range(n):\n nextrec(rec,pts[x])\n ",
"x",
"range(n)",
"range",
"n",
"nextrec(rec,pts[x])",
"nextrec",
"rec",
"pts[x]",
"pts",
"x",
"return (rec[0]-rec[2])*(rec[1]-rec[3])",
"(rec[0]-rec[2])*(rec[1]-rec[3])",
"rec[0]-rec[2]",
"rec[0]",
"rec",
"0",
"rec[2]",
"rec",
"2",
"rec[1]-rec[3]",
"rec[1]",
"rec",
"1",
"rec[3]",
"rec",
"3",
"w",
"w",
"h",
"h",
"n",
"n",
"pts",
"pts",
"w,h,n=map(int,sys.stdin.readline().strip().split())",
"w",
"map(int,sys.stdin.readline().strip().split())",
"map",
"int",
"sys.stdin.readline().strip().split()",
"sys.stdin.readline().strip().split",
"sys.stdin.readline().strip()",
"sys.stdin.readline().strip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"strip",
"split",
"h",
"n",
"list(map(int,sys.stdin.readline().strip().split())) \\\n for x in range(n)",
"for x in range(n)",
"x",
"range(n)",
"range",
"n",
"for x in range(n)",
"list(map(int,sys.stdin.readline().strip().split()))",
"list",
"map(int,sys.stdin.readline().strip().split())",
"map",
"int",
"sys.stdin.readline().strip().split()",
"sys.stdin.readline().strip().split",
"sys.stdin.readline().strip()",
"sys.stdin.readline().strip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"strip",
"split",
"pts=[list(map(int,sys.stdin.readline().strip().split())) \\\n for x in range(n)]",
"pts",
"[list(map(int,sys.stdin.readline().strip().split())) \\\n for x in range(n)]",
"print(main(w,h,n,pts))",
"print",
"main(w,h,n,pts)",
"main",
"w",
"h",
"n",
"pts",
"n=map(int,sys.stdin.readline().strip().split())",
"map(int,sys.stdin.readline().strip().split())",
"n",
"pts=[list(map(int,sys.stdin.readline().strip().split())) \\\n for x in range(n)]",
"[list(map(int,sys.stdin.readline().strip().split())) \\\n for x in range(n)]",
"pts",
"w,h,n=map(int,sys.stdin.readline().strip().split())",
"map(int,sys.stdin.readline().strip().split())",
"w",
"def nextrec(coor,pt):\n if pt[2]==1:\n coor[0]=min(max(coor[0],pt[0]),coor[2])\n elif pt[2]==2:\n coor[2]=max(min(coor[2],pt[0]),coor[0])\n elif pt[2]==3:\n coor[1]=min(max(coor[1],pt[1]),coor[3])\n elif pt[2]==4:\n coor[3]=max(min(coor[3],pt[1]),coor[1])",
"def nextrec(coor,pt):\n if pt[2]==1:\n coor[0]=min(max(coor[0],pt[0]),coor[2])\n elif pt[2]==2:\n coor[2]=max(min(coor[2],pt[0]),coor[0])\n elif pt[2]==3:\n coor[1]=min(max(coor[1],pt[1]),coor[3])\n elif pt[2]==4:\n coor[3]=max(min(coor[3],pt[1]),coor[1])",
"nextrec",
"def main(w,h,n,pts):\n rec=[0,0,w,h]\n for x in range(n):\n nextrec(rec,pts[x])\n return (rec[0]-rec[2])*(rec[1]-rec[3])",
"def main(w,h,n,pts):\n rec=[0,0,w,h]\n for x in range(n):\n nextrec(rec,pts[x])\n return (rec[0]-rec[2])*(rec[1]-rec[3])",
"main",
"h,n=map(int,sys.stdin.readline().strip().split())",
"map(int,sys.stdin.readline().strip().split())",
"h"
] |
import sys
def nextrec(coor,pt):
if pt[2]==1:
coor[0]=min(max(coor[0],pt[0]),coor[2])
elif pt[2]==2:
coor[2]=max(min(coor[2],pt[0]),coor[0])
elif pt[2]==3:
coor[1]=min(max(coor[1],pt[1]),coor[3])
elif pt[2]==4:
coor[3]=max(min(coor[3],pt[1]),coor[1])
def main(w,h,n,pts):
rec=[0,0,w,h]
for x in range(n):
nextrec(rec,pts[x])
return (rec[0]-rec[2])*(rec[1]-rec[3])
w,h,n=map(int,sys.stdin.readline().strip().split())
pts=[list(map(int,sys.stdin.readline().strip().split())) \
for x in range(n)]
print(main(w,h,n,pts))
|
[
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,
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,
14,
2,
2,
13,
13,
2,
13,
13,
4,
13,
17,
4,
13,
2,
2,
13,
13,
2,
13,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13
] |
[
[
143,
2
],
[
143,
11
],
[
143,
12
],
[
110,
14
],
[
122,
16
],
[
144,
17
],
[
125,
18
],
[
134,
20
],
[
117,
21
],
[
24,
23
],
[
132,
26
],
[
119,
28
],
[
119,
37
],
[
119,
38
],
[
105,
42
],
[
114,
45
],
[
111,
46
],
[
108,
46
],
[
107,
48
],
[
114,
49
],
[
105,
53
],
[
114,
56
],
[
123,
57
],
[
138,
57
],
[
137,
59
],
[
114,
60
],
[
105,
64
],
[
120,
67
],
[
126,
68
],
[
141,
68
],
[
140,
70
],
[
120,
71
],
[
105,
75
],
[
120,
78
],
[
135,
79
],
[
129,
79
],
[
128,
81
],
[
120,
82
],
[
108,
86
],
[
111,
86
],
[
138,
87
],
[
123,
87
],
[
141,
89
],
[
126,
89
],
[
129,
90
],
[
135,
90
],
[
138,
98
],
[
123,
98
],
[
108,
99
],
[
111,
99
],
[
129,
101
],
[
135,
101
],
[
141,
102
],
[
126,
102
],
[
119,
105
],
[
114,
107
],
[
107,
108
],
[
110,
111
],
[
119,
114
],
[
143,
117
],
[
119,
120
],
[
144,
122
],
[
122,
123
],
[
125,
126
],
[
120,
128
],
[
128,
129
],
[
143,
132
],
[
117,
134
],
[
134,
135
],
[
114,
137
],
[
137,
138
],
[
120,
140
],
[
140,
141
],
[
143,
144
]
] |
[
"w,h,n=map(int,input().split())\nx1,x2,y1,y2=0,w,0,h\nfor i in range(n):\n x,y,a=map(int,input().split())\n if a==1 and x > x1:\n x1 = x\n elif a==2 and x < x2:\n x2 = x\n elif a==3 and y > y1:\n y1 = y\n elif a==4 and y < y2:\n y2 = y\nif x1 > x2 or y1 > y2:\n print(0)\nelse:\n print((x2 - x1)*(y2 - y1))",
"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 i in range(n):\n x,y,a=map(int,input().split())\n if a==1 and x > x1:\n x1 = x\n elif a==2 and x < x2:\n x2 = x\n elif a==3 and y > y1:\n y1 = y\n elif a==4 and y < y2:\n 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 and x > x1:\n x1 = x\n elif a==2 and x < x2:\n x2 = x\n elif a==3 and y > y1:\n y1 = y\n elif a==4 and y < y2:\n y2 = y",
"a==1 and x > x1",
"a==1",
"a",
"1",
"x > x1",
"x",
"x1",
"x1 = x",
"x1",
"x",
"elif a==2 and x < x2:\n x2 = x\n ",
"a==2 and x < x2",
"a==2",
"a",
"2",
"x < x2",
"x",
"x2",
"x2 = x",
"x2",
"x",
"elif a==3 and y > y1:\n y1 = y\n ",
"a==3 and y > y1",
"a==3",
"a",
"3",
"y > y1",
"y",
"y1",
"y1 = y",
"y1",
"y",
"elif a==4 and y < y2:\n y2 = y",
"a==4 and y < y2",
"a==4",
"a",
"4",
"y < y2",
"y",
"y2",
"y2 = y",
"y2",
"y",
"if x1 > x2 or y1 > y2:\n print(0)\nelse:\n print((x2 - x1)*(y2 - y1))",
"x1 > x2 or y1 > y2",
"x1 > x2",
"x1",
"x2",
"y1 > y2",
"y1",
"y2",
"print(0)",
"print",
"0",
"print((x2 - x1)*(y2 - y1))",
"print",
"(x2 - x1)*(y2 - y1)",
"x2 - x1",
"x2",
"x1",
"y2 - y1",
"y2",
"y1",
"a=map(int,input().split())",
"map(int,input().split())",
"a",
"x1 = x",
"x",
"x1",
"x1,x2,y1,y2=0,w,0,h",
"0",
"x1",
"x,y,a=map(int,input().split())",
"map(int,input().split())",
"x",
"h,n=map(int,input().split())",
"map(int,input().split())",
"h",
"y,a=map(int,input().split())",
"map(int,input().split())",
"y",
"x2,y1,y2=0,w,0,h",
"w",
"x2",
"y1,y2=0,w,0,h",
"0",
"y1",
"y2 = y",
"y",
"y2",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"y2=0,w,0,h",
"h",
"y2",
"x2 = x",
"x",
"x2",
"y1 = y",
"y",
"y1",
"w,h,n=map(int,input().split())",
"map(int,input().split())",
"w"
] |
w,h,n=map(int,input().split())
x1,x2,y1,y2=0,w,0,h
for i in range(n):
x,y,a=map(int,input().split())
if a==1 and x > x1:
x1 = x
elif a==2 and x < x2:
x2 = x
elif a==3 and y > y1:
y1 = y
elif a==4 and y < y2:
y2 = y
if x1 > x2 or y1 > y2:
print(0)
else:
print((x2 - x1)*(y2 - y1))
|
[
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,
13,
13,
13,
13,
13,
17,
28,
13,
13,
0,
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,
4,
13,
2,
4,
13,
2,
13,
13,
17,
4,
13,
2,
13,
13,
17,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13
] |
[
[
138,
2
],
[
138,
11
],
[
138,
12
],
[
16,
15
],
[
112,
18
],
[
126,
31
],
[
141,
34
],
[
114,
36
],
[
136,
37
],
[
117,
38
],
[
139,
39
],
[
123,
40
],
[
44,
43
],
[
127,
43
],
[
144,
46
],
[
43,
47
],
[
144,
48
],
[
144,
49
],
[
145,
52
],
[
129,
55
],
[
142,
58
],
[
130,
58
],
[
103,
59
],
[
145,
62
],
[
132,
65
],
[
115,
68
],
[
133,
68
],
[
103,
69
],
[
145,
72
],
[
108,
75
],
[
124,
78
],
[
109,
78
],
[
121,
79
],
[
105,
81
],
[
118,
84
],
[
106,
84
],
[
121,
85
],
[
106,
92
],
[
118,
92
],
[
109,
93
],
[
124,
93
],
[
133,
98
],
[
115,
98
],
[
130,
99
],
[
142,
99
],
[
43,
102
],
[
144,
103
],
[
105,
106
],
[
108,
109
],
[
138,
112
],
[
136,
114
],
[
114,
115
],
[
139,
117
],
[
117,
118
],
[
43,
120
],
[
144,
121
],
[
123,
124
],
[
126,
127
],
[
129,
130
],
[
132,
133
],
[
138,
136
],
[
138,
139
],
[
141,
142
],
[
43,
144
],
[
144,
145
]
] |
[
"W, H, N = map(int, input().split())\nP = [list(map(int, input().split())) for _ in range(N)]\nL, R, U, D = 0, W, H, 0\nfor p in P:\n x, y, a = p\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)\nprint(max(U-D, 0) * max(R-L, 0))",
"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",
"P = [list(map(int, input().split())) for _ in range(N)]",
"P",
"[list(map(int, input().split())) for _ in range(N)]",
"L, R, U, D = 0, W, H, 0",
"L",
"0",
"R",
"W",
"U",
"H",
"D",
"0",
"for p in P:\n x, y, a = p\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)",
"p",
"P",
"x, y, a = p",
"x",
"p",
"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",
"print(max(U-D, 0) * max(R-L, 0))",
"print",
"max(U-D, 0) * max(R-L, 0)",
"max(U-D, 0)",
"max",
"U-D",
"U",
"D",
"0",
"max(R-L, 0)",
"max",
"R-L",
"R",
"L",
"0",
"x, y, a = p",
"p",
"x",
"U = min(U, y)",
"min(U, y)",
"U",
"D = max(D, y)",
"max(D, y)",
"D",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"R, U, D = 0, W, H, 0",
"W",
"R",
"U, D = 0, W, H, 0",
"H",
"U",
"y, a = p",
"p",
"y",
"D = 0, W, H, 0",
"0",
"D",
"P = [list(map(int, input().split())) for _ in range(N)]",
"[list(map(int, input().split())) for _ in range(N)]",
"P",
"L = max(L, x)",
"max(L, x)",
"L",
"R = min(R, x)",
"min(R, x)",
"R",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"L, R, U, D = 0, W, H, 0",
"0",
"L",
"a = p",
"p",
"a"
] |
W, H, N = map(int, input().split())
P = [list(map(int, input().split())) for _ in range(N)]
L, R, U, D = 0, W, H, 0
for p in P:
x, y, a = p
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)
print(max(U-D, 0) * max(R-L, 0))
|
[
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,
0,
18,
13,
39,
13,
2,
39,
17,
13,
14,
2,
13,
17,
0,
18,
13,
39,
13,
2,
39,
17,
2,
13,
13,
14,
2,
13,
17,
0,
18,
13,
39,
13,
2,
39,
17,
13,
14,
2,
13,
17,
0,
18,
13,
39,
13,
2,
39,
17,
2,
13,
13,
4,
13,
2,
4,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] |
[
[
120,
2
],
[
120,
11
],
[
120,
12
],
[
117,
14
],
[
109,
18
],
[
126,
20
],
[
112,
24
],
[
27,
26
],
[
121,
29
],
[
129,
31
],
[
129,
40
],
[
129,
41
],
[
124,
44
],
[
51,
47
],
[
118,
48
],
[
130,
54
],
[
124,
57
],
[
64,
60
],
[
118,
61
],
[
109,
68
],
[
130,
69
],
[
124,
72
],
[
79,
75
],
[
127,
76
],
[
115,
82
],
[
124,
85
],
[
92,
88
],
[
127,
89
],
[
112,
96
],
[
115,
97
],
[
118,
103
],
[
127,
106
],
[
120,
109
],
[
120,
112
],
[
129,
115
],
[
117,
118
],
[
120,
121
],
[
129,
124
],
[
126,
127
],
[
129,
130
]
] |
[
"W,H,N = map(int,input().split())\n\nXW = [1] * W\nYW = [1] * H\n\nfor i in range(N):\n x,y,a = map(int,input().split())\n if a == 1:\n XW[:x] = [0]*x\n elif a == 2:\n XW[x:] = [0]*(W-x)\n elif a == 3:\n YW[:y] = [0]*y\n elif a == 4:\n YW[y:] = [0]*(H-y)\nprint(sum(XW)*sum(YW))\n \n",
"W,H,N = map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"XW = [1] * W",
"XW",
"[1] * W",
"[1]",
"1",
"W",
"YW = [1] * H",
"YW",
"[1] * H",
"[1]",
"1",
"H",
"for i in range(N):\n x,y,a = map(int,input().split())\n if a == 1:\n XW[:x] = [0]*x\n elif a == 2:\n XW[x:] = [0]*(W-x)\n elif a == 3:\n YW[:y] = [0]*y\n elif a == 4:\n YW[y:] = [0]*(H-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 XW[:x] = [0]*x\n elif a == 2:\n XW[x:] = [0]*(W-x)\n elif a == 3:\n YW[:y] = [0]*y\n elif a == 4:\n YW[y:] = [0]*(H-y)",
"a == 1",
"a",
"1",
"XW[:x] = [0]*x",
"XW[:x]",
"XW",
":x",
"x",
"[0]*x",
"[0]",
"0",
"x",
"elif a == 2:\n XW[x:] = [0]*(W-x)\n ",
"a == 2",
"a",
"2",
"XW[x:] = [0]*(W-x)",
"XW[x:]",
"XW",
"x:",
"x",
"[0]*(W-x)",
"[0]",
"0",
"W-x",
"W",
"x",
"elif a == 3:\n YW[:y] = [0]*y\n ",
"a == 3",
"a",
"3",
"YW[:y] = [0]*y",
"YW[:y]",
"YW",
":y",
"y",
"[0]*y",
"[0]",
"0",
"y",
"elif a == 4:\n YW[y:] = [0]*(H-y)",
"a == 4",
"a",
"4",
"YW[y:] = [0]*(H-y)",
"YW[y:]",
"YW",
"y:",
"y",
"[0]*(H-y)",
"[0]",
"0",
"H-y",
"H",
"y",
"print(sum(XW)*sum(YW))",
"print",
"sum(XW)*sum(YW)",
"sum(XW)",
"sum",
"XW",
"sum(YW)",
"sum",
"YW",
"W,H,N = map(int,input().split())",
"map(int,input().split())",
"W",
"H,N = map(int,input().split())",
"map(int,input().split())",
"H",
"y,a = map(int,input().split())",
"map(int,input().split())",
"y",
"XW = [1] * W",
"[1] * W",
"XW",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"a = map(int,input().split())",
"map(int,input().split())",
"a",
"YW = [1] * H",
"[1] * H",
"YW",
"x,y,a = map(int,input().split())",
"map(int,input().split())",
"x"
] |
W,H,N = map(int,input().split())
XW = [1] * W
YW = [1] * H
for i in range(N):
x,y,a = map(int,input().split())
if a == 1:
XW[:x] = [0]*x
elif a == 2:
XW[x:] = [0]*(W-x)
elif a == 3:
YW[:y] = [0]*y
elif a == 4:
YW[y:] = [0]*(H-y)
print(sum(XW)*sum(YW))
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
15,
15,
15,
15,
15,
15,
15,
12,
13,
12,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
39,
4,
13,
12,
13,
12,
13,
12,
13,
23,
13,
12,
13,
23,
13,
0,
13,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
13,
13,
0,
13,
13,
0,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
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,
13,
17,
0,
13,
4,
13,
13,
13,
4,
13,
2,
4,
13,
2,
13,
13,
17,
4,
13,
2,
13,
13,
17,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
12,
13,
10,
12,
13,
10,
2,
13,
10,
12,
13,
10,
17,
13,
10,
18,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] |
[
[
186,
4
],
[
33,
32
],
[
187,
40
],
[
46,
45
],
[
205,
52
],
[
60,
60
],
[
64,
64
],
[
177,
66
],
[
231,
71
],
[
228,
78
],
[
190,
80
],
[
228,
81
],
[
228,
82
],
[
213,
84
],
[
217,
85
],
[
165,
87
],
[
229,
88
],
[
168,
90
],
[
183,
93
],
[
97,
96
],
[
202,
99
],
[
222,
101
],
[
190,
103
],
[
222,
104
],
[
222,
105
],
[
223,
108
],
[
162,
111
],
[
196,
114
],
[
214,
115
],
[
163,
115
],
[
223,
118
],
[
225,
121
],
[
196,
124
],
[
169,
125
],
[
226,
125
],
[
223,
128
],
[
234,
131
],
[
220,
134
],
[
166,
135
],
[
235,
135
],
[
223,
138
],
[
207,
141
],
[
220,
144
],
[
184,
145
],
[
208,
145
],
[
163,
152
],
[
214,
152
],
[
226,
153
],
[
169,
153
],
[
235,
158
],
[
166,
158
],
[
208,
159
],
[
184,
159
],
[
162,
163
],
[
229,
165
],
[
165,
166
],
[
168,
169
],
[
177,
178
],
[
183,
184
],
[
186,
187
],
[
222,
196
],
[
228,
202
],
[
207,
208
],
[
217,
213
],
[
213,
214
],
[
228,
217
],
[
222,
220
],
[
222,
223
],
[
225,
226
],
[
228,
229
],
[
231,
232
],
[
234,
235
]
] |
[
"# coding: utf-8\n# hello worldと表示する\n#float型を許すな\n#numpyはpythonで\nimport sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nfrom collections import Counter, deque\nfrom collections import defaultdict\nfrom itertools import combinations, permutations, accumulate, groupby, product\nfrom bisect import bisect_left,bisect_right\nfrom heapq import heapify, heappop, heappush\nfrom math import floor, ceil,pi,factorial,sqrt\nfrom operator import itemgetter\ndef I(): return int(input())\ndef MI(): return map(int, input().split())\ndef LI(): return list(map(int, input().split()))\ndef LI2(): return [int(input()) for i in range(n)]\ndef MXI(): return [[LI()]for i in range(n)]\ndef SI(): return input().rstrip()\ndef printns(x): print('\\n'.join(x))\ndef printni(x): print('\\n'.join(list(map(str,x))))\ninf = 10**17\nmod = 10**9 + 7\n\nw,h,n=MI()\nxmx=w\nymx=h\nxmn=0\nymn=0\nfor i in range(n):\n x,y,a=MI()\n if a==2:\n xmx=min(x,xmx)\n if a==1:\n xmn=max(x,xmn)\n if a==4:\n ymx=min(y,ymx)\n if a==3:\n ymn=max(y,ymn)\n #print(xmn,xmx,ymn,ymx)\nprint(max(xmx-xmn,0)*max(ymx-ymn,0))",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"sys.setrecursionlimit(10**7)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**7",
"10",
"7",
"from collections import Counter, deque",
"from collections import defaultdict",
"from itertools import combinations, permutations, accumulate, groupby, product",
"from bisect import bisect_left,bisect_right",
"from heapq import heapify, heappop, heappush",
"from math import floor, ceil,pi,factorial,sqrt",
"from operator import itemgetter",
"def I(): return int(input())",
"I",
"def MI(): return map(int, input().split())",
"MI",
"def LI(): return list(map(int, input().split()))",
"LI",
"int(input()) for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"int(input())",
"int",
"input()",
"input",
"def LI2(): return [int(input()) for i in range(n)]",
"LI2",
"[LI()]for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"[LI()]",
"LI()",
"LI",
"def MXI(): return [[LI()]for i in range(n)]",
"MXI",
"def SI(): return input().rstrip()",
"SI",
"def printns(x): print('\\n'.join(x))",
"printns",
"x",
"x",
"def printni(x): print('\\n'.join(list(map(str,x))))",
"printni",
"x",
"x",
"inf = 10**17",
"inf",
"10**17",
"10",
"17",
"mod = 10**9 + 7",
"mod",
"10**9 + 7",
"10**9",
"10",
"9",
"7",
"w,h,n=MI()",
"w",
"MI()",
"MI",
"h",
"n",
"xmx=w",
"xmx",
"w",
"ymx=h",
"ymx",
"h",
"xmn=0",
"xmn",
"0",
"ymn=0",
"ymn",
"0",
"for i in range(n):\n x,y,a=MI()\n if a==2:\n xmx=min(x,xmx)\n if a==1:\n xmn=max(x,xmn)\n if a==4:\n ymx=min(y,ymx)\n if a==3:\n ymn=max(y,ymn)\n #print(xmn,xmx,ymn,ymx)",
"i",
"range(n)",
"range",
"n",
"x,y,a=MI()",
"x",
"MI()",
"MI",
"y",
"a",
"if a==2:\n xmx=min(x,xmx)\n ",
"a==2",
"a",
"2",
"xmx=min(x,xmx)",
"xmx",
"min(x,xmx)",
"min",
"x",
"xmx",
"if a==1:\n xmn=max(x,xmn)\n ",
"a==1",
"a",
"1",
"xmn=max(x,xmn)",
"xmn",
"max(x,xmn)",
"max",
"x",
"xmn",
"if a==4:\n ymx=min(y,ymx)\n ",
"a==4",
"a",
"4",
"ymx=min(y,ymx)",
"ymx",
"min(y,ymx)",
"min",
"y",
"ymx",
"if a==3:\n ymn=max(y,ymn)\n #print(xmn,xmx,ymn,ymx)",
"a==3",
"a",
"3",
"ymn=max(y,ymn)",
"ymn",
"max(y,ymn)",
"max",
"y",
"ymn",
"print(max(xmx-xmn,0)*max(ymx-ymn,0))",
"print",
"max(xmx-xmn,0)*max(ymx-ymn,0)",
"max(xmx-xmn,0)",
"max",
"xmx-xmn",
"xmx",
"xmn",
"0",
"max(ymx-ymn,0)",
"max",
"ymx-ymn",
"ymx",
"ymn",
"0",
"xmx=min(x,xmx)",
"min(x,xmx)",
"xmx",
"ymx=h",
"h",
"ymx",
"xmn=0",
"0",
"xmn",
"def SI(): return input().rstrip()",
"def SI(): return input().rstrip()",
"SI",
"def MXI(): return [[LI()]for i in range(n)]",
"def MXI(): return [[LI()]for i in range(n)]",
"MXI",
"inf = 10**17",
"10**17",
"inf",
"def I(): return int(input())",
"def I(): return int(input())",
"I",
"ymn=0",
"0",
"ymn",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"def MI(): return map(int, input().split())",
"def MI(): return map(int, input().split())",
"MI",
"def printns(x): print('\\n'.join(x))",
"def printns(x): print('\\n'.join(x))",
"printns",
"x,y,a=MI()",
"MI()",
"x",
"def printni(x): print('\\n'.join(list(map(str,x))))",
"def printni(x): print('\\n'.join(list(map(str,x))))",
"printni",
"n=MI()",
"MI()",
"n",
"def LI(): return list(map(int, input().split()))",
"def LI(): return list(map(int, input().split()))",
"LI",
"ymn=max(y,ymn)",
"max(y,ymn)",
"ymn",
"def LI2(): return [int(input()) for i in range(n)]",
"def LI2(): return [int(input()) for i in range(n)]",
"LI2",
"xmx=w",
"w",
"xmx",
"w,h,n=MI()",
"MI()",
"w",
"y,a=MI()",
"MI()",
"y",
"a=MI()",
"MI()",
"a",
"xmn=max(x,xmn)",
"max(x,xmn)",
"xmn",
"h,n=MI()",
"MI()",
"h",
"mod = 10**9 + 7",
"10**9 + 7",
"mod",
"ymx=min(y,ymx)",
"min(y,ymx)",
"ymx"
] |
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
w,h,n=MI()
xmx=w
ymx=h
xmn=0
ymn=0
for i in range(n):
x,y,a=MI()
if a==2:
xmx=min(x,xmx)
if a==1:
xmn=max(x,xmn)
if a==4:
ymx=min(y,ymx)
if a==3:
ymn=max(y,ymn)
#print(xmn,xmx,ymn,ymx)
print(max(xmx-xmn,0)*max(ymx-ymn,0))
|
[
7,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
13,
0,
13,
39,
39,
17,
39,
13,
39,
17,
39,
13,
28,
13,
4,
13,
17,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
13,
14,
2,
13,
39,
17,
17,
4,
18,
18,
13,
2,
13,
17,
13,
13,
4,
18,
18,
13,
2,
13,
17,
13,
13,
0,
13,
2,
4,
13,
18,
13,
17,
4,
13,
18,
13,
17,
0,
13,
2,
4,
13,
18,
13,
17,
4,
13,
18,
13,
17,
14,
2,
40,
13,
17,
40,
13,
17,
4,
13,
2,
13,
13,
4,
13,
17,
10,
13,
13,
10,
13,
13,
10,
2,
13,
10,
13,
13,
10,
39,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
2,
13
] |
[
[
4,
3
],
[
3,
12
],
[
140,
14
],
[
140,
16
],
[
140,
17
],
[
131,
19
],
[
31,
30
],
[
141,
34
],
[
38,
37
],
[
37,
46
],
[
134,
48
],
[
134,
50
],
[
134,
51
],
[
123,
54
],
[
132,
61
],
[
123,
63
],
[
135,
66
],
[
132,
70
],
[
123,
72
],
[
120,
75
],
[
143,
77
],
[
132,
82
],
[
132,
87
],
[
125,
90
],
[
132,
95
],
[
132,
100
],
[
144,
105
],
[
126,
108
],
[
144,
113
],
[
126,
114
],
[
134,
120
],
[
134,
123
],
[
125,
126
],
[
140,
129
],
[
131,
132
],
[
134,
135
],
[
140,
138
],
[
140,
141
],
[
143,
144
]
] |
[
"W,H,N = (int(T) for T in input().split())\nXYA = [[0],[W],[0],[H]]\nfor TN in range(0,N):\n X,Y,A = (int(T) for T in input().split())\n if A in [1,2]:\n XYA[A-1].append(X)\n else:\n XYA[A-1].append(Y)\nCW = min(XYA[1])-max(XYA[0])\nCH = min(XYA[3])-max(XYA[2])\nif CW>=0 and CH>=0:\n print(CW*CH)\nelse:\n print(0)",
"int(T) for T in input().split()",
"for T in input().split()",
"T",
"input().split()",
"().split",
"()",
"input",
"split",
"for T in input().split()",
"int(T)",
"int",
"T",
"W,H,N = (int(T) for T in input().split())",
"W",
"(int(T) for T in input().split())",
"H",
"N",
"XYA = [[0],[W],[0],[H]]",
"XYA",
"[[0],[W],[0],[H]]",
"[0]",
"0",
"[W]",
"W",
"[0]",
"0",
"[H]",
"H",
"for TN in range(0,N):\n X,Y,A = (int(T) for T in input().split())\n if A in [1,2]:\n XYA[A-1].append(X)\n else:\n XYA[A-1].append(Y)",
"TN",
"range(0,N)",
"range",
"0",
"N",
"int(T) for T in input().split()",
"for T in input().split()",
"T",
"input().split()",
"().split",
"()",
"input",
"split",
"for T in input().split()",
"int(T)",
"int",
"T",
"X,Y,A = (int(T) for T in input().split())",
"X",
"(int(T) for T in input().split())",
"Y",
"A",
"if A in [1,2]:\n XYA[A-1].append(X)\n else:\n XYA[A-1].append(Y)",
"A in [1,2]",
"A",
"[1,2]",
"1",
"2",
"XYA[A-1].append(X)",
"[A-1].append",
"[A-1]",
"XYA",
"A-1",
"A",
"1",
"append",
"X",
"XYA[A-1].append(Y)",
"[A-1].append",
"[A-1]",
"XYA",
"A-1",
"A",
"1",
"append",
"Y",
"CW = min(XYA[1])-max(XYA[0])",
"CW",
"min(XYA[1])-max(XYA[0])",
"min(XYA[1])",
"min",
"XYA[1]",
"XYA",
"1",
"max(XYA[0])",
"max",
"XYA[0]",
"XYA",
"0",
"CH = min(XYA[3])-max(XYA[2])",
"CH",
"min(XYA[3])-max(XYA[2])",
"min(XYA[3])",
"min",
"XYA[3]",
"XYA",
"3",
"max(XYA[2])",
"max",
"XYA[2]",
"XYA",
"2",
"if CW>=0 and CH>=0:\n print(CW*CH)\nelse:\n print(0)",
"CW>=0 and CH>=0",
"CW>=0",
"CW",
"0",
"CH>=0",
"CH",
"0",
"print(CW*CH)",
"print",
"CW*CH",
"CW",
"CH",
"print(0)",
"print",
"0",
"Y,A = (int(T) for T in input().split())",
"(int(T) for T in input().split())",
"Y",
"A = (int(T) for T in input().split())",
"(int(T) for T in input().split())",
"A",
"CH = min(XYA[3])-max(XYA[2])",
"min(XYA[3])-max(XYA[2])",
"CH",
"H,N = (int(T) for T in input().split())",
"(int(T) for T in input().split())",
"H",
"XYA = [[0],[W],[0],[H]]",
"[[0],[W],[0],[H]]",
"XYA",
"X,Y,A = (int(T) for T in input().split())",
"(int(T) for T in input().split())",
"X",
"W,H,N = (int(T) for T in input().split())",
"(int(T) for T in input().split())",
"W",
"N = (int(T) for T in input().split())",
"(int(T) for T in input().split())",
"N",
"CW = min(XYA[1])-max(XYA[0])",
"min(XYA[1])-max(XYA[0])",
"CW"
] |
W,H,N = (int(T) for T in input().split())
XYA = [[0],[W],[0],[H]]
for TN in range(0,N):
X,Y,A = (int(T) for T in input().split())
if A in [1,2]:
XYA[A-1].append(X)
else:
XYA[A-1].append(Y)
CW = min(XYA[1])-max(XYA[0])
CH = min(XYA[3])-max(XYA[2])
if CW>=0 and CH>=0:
print(CW*CH)
else:
print(0)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
2,
39,
17,
13,
4,
18,
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,
28,
13,
13,
14,
2,
18,
13,
17,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
18,
13,
17,
0,
18,
18,
13,
13,
13,
17,
14,
2,
18,
13,
17,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
18,
13,
17,
13,
0,
18,
18,
13,
13,
13,
17,
14,
2,
18,
13,
17,
17,
28,
13,
4,
13,
18,
13,
17,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
13,
17,
14,
2,
18,
13,
17,
17,
28,
13,
4,
13,
18,
13,
17,
13,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
13,
17,
0,
13,
17,
28,
13,
13,
28,
13,
13,
14,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
39,
13,
10,
17,
13,
10,
39,
13,
10,
4,
13,
10,
17,
13
] |
[
[
203,
2
],
[
203,
11
],
[
203,
12
],
[
200,
14
],
[
18,
17
],
[
186,
20
],
[
191,
22
],
[
204,
26
],
[
201,
29
],
[
192,
31
],
[
194,
33
],
[
37,
36
],
[
189,
39
],
[
182,
41
],
[
195,
54
],
[
183,
56
],
[
59,
58
],
[
195,
58
],
[
58,
63
],
[
68,
67
],
[
186,
70
],
[
73,
72
],
[
58,
76
],
[
84,
79
],
[
201,
81
],
[
67,
82
],
[
72,
83
],
[
58,
88
],
[
93,
92
],
[
186,
95
],
[
98,
97
],
[
58,
101
],
[
204,
103
],
[
110,
105
],
[
201,
107
],
[
92,
108
],
[
97,
109
],
[
58,
114
],
[
119,
118
],
[
58,
122
],
[
126,
125
],
[
204,
128
],
[
135,
130
],
[
201,
132
],
[
118,
133
],
[
125,
134
],
[
58,
139
],
[
144,
143
],
[
58,
147
],
[
186,
149
],
[
152,
151
],
[
204,
154
],
[
161,
156
],
[
201,
158
],
[
143,
159
],
[
151,
160
],
[
206,
163
],
[
167,
166
],
[
201,
166
],
[
170,
169
],
[
166,
169
],
[
169,
173
],
[
197,
176
],
[
198,
180
],
[
207,
180
],
[
182,
183
],
[
203,
186
],
[
203,
189
],
[
191,
192
],
[
194,
195
],
[
197,
198
],
[
200,
201
],
[
203,
204
],
[
206,
207
]
] |
[
"w, h, n = map(int, input().split())\n\nxy = []\nfor i in range(h):\n tmp = [0] * w\n xy.append(tmp)\n\n\nlis = []\nfor _ in range(n):\n t = list(map(int, input().split()))\n lis.append(t)\n\nfor i in lis:\n if i[2] == 1:\n for j in range(h):\n for k in range(i[0]):\n xy[j][k] = 1\n elif i[2] == 2:\n for j in range(h):\n for k in range(i[0], w):\n xy[j][k] = 1\n elif i[2] == 3:\n for j in range(i[1]):\n for k in range(w):\n xy[j][k] = 1\n elif i[2] == 4:\n for j in range(i[1], h):\n for k in range(w):\n xy[j][k] = 1\n\nans = 0\nfor i in xy:\n for j in i:\n if j == 0:\n ans += 1\n\nprint(ans)",
"w, h, n = map(int, input().split())",
"w",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"xy = []",
"xy",
"[]",
"for i in range(h):\n tmp = [0] * w\n xy.append(tmp)",
"i",
"range(h)",
"range",
"h",
"tmp = [0] * w",
"tmp",
"[0] * w",
"[0]",
"0",
"w",
"xy.append(tmp)",
"xy.append",
"xy",
"append",
"tmp",
"lis = []",
"lis",
"[]",
"for _ in range(n):\n t = list(map(int, input().split()))\n lis.append(t)",
"_",
"range(n)",
"range",
"n",
"t = list(map(int, input().split()))",
"t",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"lis.append(t)",
"lis.append",
"lis",
"append",
"t",
"for i in lis:\n if i[2] == 1:\n for j in range(h):\n for k in range(i[0]):\n xy[j][k] = 1\n elif i[2] == 2:\n for j in range(h):\n for k in range(i[0], w):\n xy[j][k] = 1\n elif i[2] == 3:\n for j in range(i[1]):\n for k in range(w):\n xy[j][k] = 1\n elif i[2] == 4:\n for j in range(i[1], h):\n for k in range(w):\n xy[j][k] = 1",
"i",
"lis",
"if i[2] == 1:\n for j in range(h):\n for k in range(i[0]):\n xy[j][k] = 1\n elif i[2] == 2:\n for j in range(h):\n for k in range(i[0], w):\n xy[j][k] = 1\n elif i[2] == 3:\n for j in range(i[1]):\n for k in range(w):\n xy[j][k] = 1\n elif i[2] == 4:\n for j in range(i[1], h):\n for k in range(w):\n xy[j][k] = 1",
"i[2] == 1",
"i[2]",
"i",
"2",
"1",
"for j in range(h):\n for k in range(i[0]):\n xy[j][k] = 1\n ",
"j",
"range(h)",
"range",
"h",
"for k in range(i[0]):\n xy[j][k] = 1\n ",
"k",
"range(i[0])",
"range",
"i[0]",
"i",
"0",
"xy[j][k] = 1",
"xy[j][k]",
"[j]",
"xy",
"j",
"k",
"1",
"elif i[2] == 2:\n for j in range(h):\n for k in range(i[0], w):\n xy[j][k] = 1\n ",
"i[2] == 2",
"i[2]",
"i",
"2",
"2",
"for j in range(h):\n for k in range(i[0], w):\n xy[j][k] = 1\n ",
"j",
"range(h)",
"range",
"h",
"for k in range(i[0], w):\n xy[j][k] = 1\n ",
"k",
"range(i[0], w)",
"range",
"i[0]",
"i",
"0",
"w",
"xy[j][k] = 1",
"xy[j][k]",
"[j]",
"xy",
"j",
"k",
"1",
"elif i[2] == 3:\n for j in range(i[1]):\n for k in range(w):\n xy[j][k] = 1\n ",
"i[2] == 3",
"i[2]",
"i",
"2",
"3",
"for j in range(i[1]):\n for k in range(w):\n xy[j][k] = 1\n ",
"j",
"range(i[1])",
"range",
"i[1]",
"i",
"1",
"for k in range(w):\n xy[j][k] = 1\n ",
"k",
"range(w)",
"range",
"w",
"xy[j][k] = 1",
"xy[j][k]",
"[j]",
"xy",
"j",
"k",
"1",
"elif i[2] == 4:\n for j in range(i[1], h):\n for k in range(w):\n xy[j][k] = 1",
"i[2] == 4",
"i[2]",
"i",
"2",
"4",
"for j in range(i[1], h):\n for k in range(w):\n xy[j][k] = 1",
"j",
"range(i[1], h)",
"range",
"i[1]",
"i",
"1",
"h",
"for k in range(w):\n xy[j][k] = 1",
"k",
"range(w)",
"range",
"w",
"xy[j][k] = 1",
"xy[j][k]",
"[j]",
"xy",
"j",
"k",
"1",
"ans = 0",
"ans",
"0",
"for i in xy:\n for j in i:\n if j == 0:\n ans += 1",
"i",
"xy",
"for j in i:\n if j == 0:\n ans += 1",
"j",
"i",
"if j == 0:\n ans += 1",
"j == 0",
"j",
"0",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"t = list(map(int, input().split()))",
"list(map(int, input().split()))",
"t",
"h, n = map(int, input().split())",
"map(int, input().split())",
"h",
"n = map(int, input().split())",
"map(int, input().split())",
"n",
"tmp = [0] * w",
"[0] * w",
"tmp",
"lis = []",
"[]",
"lis",
"ans += 1",
"1",
"ans",
"xy = []",
"[]",
"xy",
"w, h, n = map(int, input().split())",
"map(int, input().split())",
"w",
"ans = 0",
"0",
"ans"
] |
w, h, n = map(int, input().split())
xy = []
for i in range(h):
tmp = [0] * w
xy.append(tmp)
lis = []
for _ in range(n):
t = list(map(int, input().split()))
lis.append(t)
for i in lis:
if i[2] == 1:
for j in range(h):
for k in range(i[0]):
xy[j][k] = 1
elif i[2] == 2:
for j in range(h):
for k in range(i[0], w):
xy[j][k] = 1
elif i[2] == 3:
for j in range(i[1]):
for k in range(w):
xy[j][k] = 1
elif i[2] == 4:
for j in range(i[1], h):
for k in range(w):
xy[j][k] = 1
ans = 0
for i in xy:
for j in i:
if j == 0:
ans += 1
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,
0,
13,
4,
13,
13,
13,
4,
13,
2,
4,
13,
2,
13,
13,
17,
4,
13,
2,
13,
13,
17,
10,
17,
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,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13
] |
[
[
130,
2
],
[
130,
11
],
[
130,
12
],
[
91,
14
],
[
127,
16
],
[
98,
17
],
[
118,
18
],
[
94,
20
],
[
131,
21
],
[
24,
23
],
[
110,
26
],
[
124,
28
],
[
124,
37
],
[
124,
38
],
[
113,
41
],
[
115,
44
],
[
92,
47
],
[
116,
47
],
[
101,
48
],
[
113,
51
],
[
106,
54
],
[
128,
57
],
[
107,
57
],
[
101,
58
],
[
113,
61
],
[
103,
64
],
[
119,
67
],
[
104,
67
],
[
125,
68
],
[
121,
70
],
[
95,
73
],
[
122,
73
],
[
125,
74
],
[
107,
81
],
[
128,
81
],
[
116,
82
],
[
92,
82
],
[
122,
87
],
[
95,
87
],
[
104,
88
],
[
119,
88
],
[
91,
92
],
[
131,
94
],
[
94,
95
],
[
130,
98
],
[
124,
101
],
[
103,
104
],
[
106,
107
],
[
130,
110
],
[
124,
113
],
[
115,
116
],
[
118,
119
],
[
121,
122
],
[
124,
125
],
[
98,
127
],
[
127,
128
],
[
130,
131
]
] |
[
"w,h,n = map(int,input().split())\nb,c,d,e = 0,w,0,h\nfor i in range(n):\n x,y,a = map(int,input().split())\n if a == 1:\n b = max(b,x)\n elif a == 2:\n c = min(c,x)\n elif a == 3:\n d = max(d,y)\n else:\n e = min(e,y)\nprint(max(c-b,0)*max(e-d,0))",
"w,h,n = map(int,input().split())",
"w",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"b,c,d,e = 0,w,0,h",
"b",
"0",
"c",
"w",
"d",
"0",
"e",
"h",
"for i in range(n):\n x,y,a = map(int,input().split())\n if a == 1:\n b = max(b,x)\n elif a == 2:\n c = min(c,x)\n elif a == 3:\n d = max(d,y)\n else:\n e = min(e,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 b = max(b,x)\n elif a == 2:\n c = min(c,x)\n elif a == 3:\n d = max(d,y)\n else:\n e = min(e,y)",
"a == 1",
"a",
"1",
"b = max(b,x)",
"b",
"max(b,x)",
"max",
"b",
"x",
"elif a == 2:\n c = min(c,x)\n ",
"a == 2",
"a",
"2",
"c = min(c,x)",
"c",
"min(c,x)",
"min",
"c",
"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",
"e = min(e,y)",
"e",
"min(e,y)",
"min",
"e",
"y",
"print(max(c-b,0)*max(e-d,0))",
"print",
"max(c-b,0)*max(e-d,0)",
"max(c-b,0)",
"max",
"c-b",
"c",
"b",
"0",
"max(e-d,0)",
"max",
"e-d",
"e",
"d",
"0",
"b,c,d,e = 0,w,0,h",
"0",
"b",
"e = 0,w,0,h",
"h",
"e",
"w,h,n = map(int,input().split())",
"map(int,input().split())",
"w",
"x,y,a = map(int,input().split())",
"map(int,input().split())",
"x",
"d = max(d,y)",
"max(d,y)",
"d",
"c = min(c,x)",
"min(c,x)",
"c",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"a = map(int,input().split())",
"map(int,input().split())",
"a",
"b = max(b,x)",
"max(b,x)",
"b",
"d,e = 0,w,0,h",
"0",
"d",
"e = min(e,y)",
"min(e,y)",
"e",
"y,a = map(int,input().split())",
"map(int,input().split())",
"y",
"c,d,e = 0,w,0,h",
"w",
"c",
"h,n = map(int,input().split())",
"map(int,input().split())",
"h"
] |
w,h,n = map(int,input().split())
b,c,d,e = 0,w,0,h
for i in range(n):
x,y,a = map(int,input().split())
if a == 1:
b = max(b,x)
elif a == 2:
c = min(c,x)
elif a == 3:
d = max(d,y)
else:
e = min(e,y)
print(max(c-b,0)*max(e-d,0))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
0,
13,
39,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
13,
0,
13,
17,
0,
13,
13,
0,
13,
17,
0,
13,
13,
28,
13,
4,
13,
4,
13,
13,
14,
2,
2,
18,
13,
13,
17,
2,
13,
18,
13,
13,
0,
13,
18,
13,
13,
14,
2,
13,
13,
4,
13,
17,
4,
13,
14,
2,
2,
18,
13,
13,
17,
2,
13,
18,
13,
13,
0,
13,
18,
13,
13,
14,
2,
13,
13,
4,
13,
17,
4,
13,
14,
2,
2,
18,
13,
13,
17,
2,
13,
18,
13,
13,
0,
13,
18,
13,
13,
14,
2,
13,
13,
4,
13,
17,
4,
13,
14,
2,
2,
18,
13,
13,
17,
2,
13,
18,
13,
13,
0,
13,
18,
13,
13,
14,
2,
13,
13,
4,
13,
17,
4,
13,
14,
2,
13,
2,
4,
13,
13,
17,
4,
13,
2,
2,
13,
13,
2,
13,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
39,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
39,
13,
10,
18,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
18,
13
] |
[
[
234,
2
],
[
234,
11
],
[
234,
12
],
[
216,
14
],
[
237,
17
],
[
228,
20
],
[
24,
23
],
[
205,
26
],
[
240,
28
],
[
240,
37
],
[
240,
38
],
[
217,
41
],
[
199,
43
],
[
238,
46
],
[
241,
48
],
[
229,
51
],
[
226,
53
],
[
195,
55
],
[
213,
58
],
[
211,
59
],
[
219,
61
],
[
207,
64
],
[
235,
65
],
[
68,
67
],
[
229,
72
],
[
229,
77
],
[
67,
78
],
[
196,
81
],
[
202,
81
],
[
217,
83
],
[
67,
84
],
[
201,
86
],
[
217,
88
],
[
67,
89
],
[
202,
92
],
[
196,
92
],
[
214,
93
],
[
232,
93
],
[
229,
103
],
[
67,
104
],
[
214,
107
],
[
232,
107
],
[
217,
109
],
[
67,
110
],
[
231,
112
],
[
217,
114
],
[
67,
115
],
[
196,
118
],
[
202,
118
],
[
232,
119
],
[
214,
119
],
[
229,
129
],
[
67,
130
],
[
220,
133
],
[
223,
133
],
[
238,
135
],
[
67,
136
],
[
222,
138
],
[
238,
140
],
[
67,
141
],
[
223,
144
],
[
220,
144
],
[
208,
145
],
[
244,
145
],
[
229,
155
],
[
67,
156
],
[
208,
159
],
[
244,
159
],
[
238,
161
],
[
67,
162
],
[
243,
164
],
[
238,
166
],
[
67,
167
],
[
220,
170
],
[
223,
170
],
[
244,
171
],
[
208,
171
],
[
67,
179
],
[
229,
183
],
[
232,
189
],
[
214,
189
],
[
202,
190
],
[
196,
190
],
[
244,
192
],
[
208,
192
],
[
223,
193
],
[
220,
193
],
[
195,
196
],
[
240,
199
],
[
201,
202
],
[
234,
205
],
[
235,
207
],
[
207,
208
],
[
234,
211
],
[
211,
213
],
[
213,
214
],
[
216,
217
],
[
219,
220
],
[
222,
223
],
[
240,
226
],
[
228,
229
],
[
231,
232
],
[
234,
235
],
[
237,
238
],
[
240,
241
],
[
243,
244
]
] |
[
"w,h,n = map(int,input().split())\nxl = []\nyl = []\nal = []\nfor _ in range(n):\n x,y,a = map(int,input().split())\n xl.append(x)\n yl.append(y)\n al.append(a)\n\nsx = 0\ngx = w\nsy = 0\ngy = h\n\nfor i in range(len(al)):\n if al[i] == 1 and sx < xl[i]:\n sx = xl[i]\n if sx > gx:\n print(0)\n exit()\n elif al[i] == 2 and gx > xl[i]:\n gx = xl[i]\n if sx > gx:\n print(0)\n exit()\n elif al[i] == 3 and sy < yl[i]:\n sy = yl[i]\n if sy > gy:\n print(0)\n exit()\n elif al[i] == 4 and gy > yl[i]:\n gy = yl[i]\n if sy > gy:\n print(0)\n exit()\n if i == len(al)-1:\n print((gx-sx)*(gy-sy))\n ",
"w,h,n = map(int,input().split())",
"w",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"xl = []",
"xl",
"[]",
"yl = []",
"yl",
"[]",
"al = []",
"al",
"[]",
"for _ in range(n):\n x,y,a = map(int,input().split())\n xl.append(x)\n yl.append(y)\n al.append(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",
"xl.append(x)",
"xl.append",
"xl",
"append",
"x",
"yl.append(y)",
"yl.append",
"yl",
"append",
"y",
"al.append(a)",
"al.append",
"al",
"append",
"a",
"sx = 0",
"sx",
"0",
"gx = w",
"gx",
"w",
"sy = 0",
"sy",
"0",
"gy = h",
"gy",
"h",
"for i in range(len(al)):\n if al[i] == 1 and sx < xl[i]:\n sx = xl[i]\n if sx > gx:\n print(0)\n exit()\n elif al[i] == 2 and gx > xl[i]:\n gx = xl[i]\n if sx > gx:\n print(0)\n exit()\n elif al[i] == 3 and sy < yl[i]:\n sy = yl[i]\n if sy > gy:\n print(0)\n exit()\n elif al[i] == 4 and gy > yl[i]:\n gy = yl[i]\n if sy > gy:\n print(0)\n exit()\n if i == len(al)-1:\n print((gx-sx)*(gy-sy))\n ",
"i",
"range(len(al))",
"range",
"len(al)",
"len",
"al",
"if al[i] == 1 and sx < xl[i]:\n sx = xl[i]\n if sx > gx:\n print(0)\n exit()\n elif al[i] == 2 and gx > xl[i]:\n gx = xl[i]\n if sx > gx:\n print(0)\n exit()\n elif al[i] == 3 and sy < yl[i]:\n sy = yl[i]\n if sy > gy:\n print(0)\n exit()\n elif al[i] == 4 and gy > yl[i]:\n gy = yl[i]\n if sy > gy:\n print(0)\n exit()\n ",
"al[i] == 1 and sx < xl[i]",
"al[i] == 1",
"al[i]",
"al",
"i",
"1",
"sx < xl[i]",
"sx",
"xl[i]",
"xl",
"i",
"sx = xl[i]",
"sx",
"xl[i]",
"xl",
"i",
"if sx > gx:\n print(0)\n exit()\n ",
"sx > gx",
"sx",
"gx",
"print(0)",
"print",
"0",
"exit()",
"exit",
"elif al[i] == 2 and gx > xl[i]:\n gx = xl[i]\n if sx > gx:\n print(0)\n exit()\n ",
"al[i] == 2 and gx > xl[i]",
"al[i] == 2",
"al[i]",
"al",
"i",
"2",
"gx > xl[i]",
"gx",
"xl[i]",
"xl",
"i",
"gx = xl[i]",
"gx",
"xl[i]",
"xl",
"i",
"if sx > gx:\n print(0)\n exit()\n ",
"sx > gx",
"sx",
"gx",
"print(0)",
"print",
"0",
"exit()",
"exit",
"elif al[i] == 3 and sy < yl[i]:\n sy = yl[i]\n if sy > gy:\n print(0)\n exit()\n ",
"al[i] == 3 and sy < yl[i]",
"al[i] == 3",
"al[i]",
"al",
"i",
"3",
"sy < yl[i]",
"sy",
"yl[i]",
"yl",
"i",
"sy = yl[i]",
"sy",
"yl[i]",
"yl",
"i",
"if sy > gy:\n print(0)\n exit()\n ",
"sy > gy",
"sy",
"gy",
"print(0)",
"print",
"0",
"exit()",
"exit",
"elif al[i] == 4 and gy > yl[i]:\n gy = yl[i]\n if sy > gy:\n print(0)\n exit()\n ",
"al[i] == 4 and gy > yl[i]",
"al[i] == 4",
"al[i]",
"al",
"i",
"4",
"gy > yl[i]",
"gy",
"yl[i]",
"yl",
"i",
"gy = yl[i]",
"gy",
"yl[i]",
"yl",
"i",
"if sy > gy:\n print(0)\n exit()\n ",
"sy > gy",
"sy",
"gy",
"print(0)",
"print",
"0",
"exit()",
"exit",
"if i == len(al)-1:\n print((gx-sx)*(gy-sy))\n ",
"i == len(al)-1",
"i",
"len(al)-1",
"len(al)",
"len",
"al",
"1",
"print((gx-sx)*(gy-sy))",
"print",
"(gx-sx)*(gy-sy)",
"gx-sx",
"gx",
"sx",
"gy-sy",
"gy",
"sy",
"sx = 0",
"0",
"sx",
"x,y,a = map(int,input().split())",
"map(int,input().split())",
"x",
"sx = xl[i]",
"xl[i]",
"sx",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"gy = h",
"h",
"gy",
"w,h,n = map(int,input().split())",
"map(int,input().split())",
"w",
"gx = w",
"w",
"gx",
"xl = []",
"[]",
"xl",
"sy = 0",
"0",
"sy",
"sy = yl[i]",
"yl[i]",
"sy",
"a = map(int,input().split())",
"map(int,input().split())",
"a",
"al = []",
"[]",
"al",
"gx = xl[i]",
"xl[i]",
"gx",
"h,n = map(int,input().split())",
"map(int,input().split())",
"h",
"yl = []",
"[]",
"yl",
"y,a = map(int,input().split())",
"map(int,input().split())",
"y",
"gy = yl[i]",
"yl[i]",
"gy"
] |
w,h,n = map(int,input().split())
xl = []
yl = []
al = []
for _ in range(n):
x,y,a = map(int,input().split())
xl.append(x)
yl.append(y)
al.append(a)
sx = 0
gx = w
sy = 0
gy = h
for i in range(len(al)):
if al[i] == 1 and sx < xl[i]:
sx = xl[i]
if sx > gx:
print(0)
exit()
elif al[i] == 2 and gx > xl[i]:
gx = xl[i]
if sx > gx:
print(0)
exit()
elif al[i] == 3 and sy < yl[i]:
sy = yl[i]
if sy > gy:
print(0)
exit()
elif al[i] == 4 and gy > yl[i]:
gy = yl[i]
if sy > gy:
print(0)
exit()
if i == len(al)-1:
print((gx-sx)*(gy-sy))
|
[
7,
15,
13,
12,
13,
0,
13,
4,
13,
13,
13,
0,
13,
17,
13,
13,
13,
17,
13,
13,
28,
13,
4,
13,
13,
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,
13,
17,
0,
13,
4,
13,
13,
13,
14,
2,
2,
13,
13,
2,
13,
13,
4,
13,
4,
13,
17,
2,
2,
13,
13,
2,
13,
13,
4,
13,
17,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
12,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13
] |
[
[
128,
6
],
[
123,
8
],
[
128,
9
],
[
128,
10
],
[
125,
12
],
[
116,
14
],
[
102,
15
],
[
134,
16
],
[
131,
18
],
[
120,
19
],
[
22,
21
],
[
129,
24
],
[
113,
26
],
[
123,
28
],
[
113,
29
],
[
113,
30
],
[
105,
33
],
[
98,
36
],
[
126,
39
],
[
99,
39
],
[
114,
40
],
[
105,
43
],
[
110,
46
],
[
117,
49
],
[
111,
49
],
[
114,
50
],
[
105,
53
],
[
137,
56
],
[
135,
59
],
[
138,
59
],
[
96,
60
],
[
105,
63
],
[
107,
66
],
[
132,
69
],
[
108,
69
],
[
96,
70
],
[
111,
74
],
[
117,
74
],
[
99,
75
],
[
126,
75
],
[
108,
77
],
[
132,
77
],
[
138,
78
],
[
135,
78
],
[
111,
86
],
[
117,
86
],
[
99,
87
],
[
126,
87
],
[
108,
89
],
[
132,
89
],
[
138,
90
],
[
135,
90
],
[
113,
96
],
[
98,
99
],
[
128,
102
],
[
113,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
],
[
102,
116
],
[
116,
117
],
[
128,
120
],
[
125,
126
],
[
128,
129
],
[
120,
131
],
[
131,
132
],
[
134,
135
],
[
137,
138
]
] |
[
"import sys\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり\n\nW,H,N = LI()\n\ns,t,u,v = 0,W,0,H\nfor i in range(N):\n x,y,a = LI()\n if a == 1:\n s = max(s,x)\n if a == 2:\n t = min(t,x)\n if a == 3:\n u = max(u,y)\n if a == 4:\n v = min(v,y)\n\nif t > s and v > u:\n print(max(0,(t-s)*(v-u)))\nelse:\n print(0)",
"import sys",
"sys",
"def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり",
"LI",
"W,H,N = LI()",
"W",
"LI()",
"LI",
"H",
"N",
"s,t,u,v = 0,W,0,H",
"s",
"0",
"t",
"W",
"u",
"0",
"v",
"H",
"for i in range(N):\n x,y,a = LI()\n if a == 1:\n s = max(s,x)\n if a == 2:\n t = min(t,x)\n if a == 3:\n u = max(u,y)\n if a == 4:\n v = min(v,y)",
"i",
"range(N)",
"range",
"N",
"x,y,a = LI()",
"x",
"LI()",
"LI",
"y",
"a",
"if a == 1:\n s = max(s,x)\n ",
"a == 1",
"a",
"1",
"s = max(s,x)",
"s",
"max(s,x)",
"max",
"s",
"x",
"if a == 2:\n t = min(t,x)\n ",
"a == 2",
"a",
"2",
"t = min(t,x)",
"t",
"min(t,x)",
"min",
"t",
"x",
"if a == 3:\n u = max(u,y)\n ",
"a == 3",
"a",
"3",
"u = max(u,y)",
"u",
"max(u,y)",
"max",
"u",
"y",
"if a == 4:\n v = min(v,y)",
"a == 4",
"a",
"4",
"v = min(v,y)",
"v",
"min(v,y)",
"min",
"v",
"y",
"if t > s and v > u:\n print(max(0,(t-s)*(v-u)))\nelse:\n print(0)",
"t > s and v > u",
"t > s",
"t",
"s",
"v > u",
"v",
"u",
"print(max(0,(t-s)*(v-u)))",
"print",
"max(0,(t-s)*(v-u))",
"max",
"0",
"(t-s)*(v-u)",
"t-s",
"t",
"s",
"v-u",
"v",
"u",
"print(0)",
"print",
"0",
"y,a = LI()",
"LI()",
"y",
"s = max(s,x)",
"max(s,x)",
"s",
"W,H,N = LI()",
"LI()",
"W",
"a = LI()",
"LI()",
"a",
"v = min(v,y)",
"min(v,y)",
"v",
"t = min(t,x)",
"min(t,x)",
"t",
"x,y,a = LI()",
"LI()",
"x",
"t,u,v = 0,W,0,H",
"W",
"t",
"H,N = LI()",
"LI()",
"H",
"def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり",
"def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり",
"LI",
"s,t,u,v = 0,W,0,H",
"0",
"s",
"N = LI()",
"LI()",
"N",
"v = 0,W,0,H",
"H",
"v",
"u,v = 0,W,0,H",
"0",
"u",
"u = max(u,y)",
"max(u,y)",
"u"
] |
import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
W,H,N = LI()
s,t,u,v = 0,W,0,H
for i in range(N):
x,y,a = LI()
if a == 1:
s = max(s,x)
if a == 2:
t = min(t,x)
if a == 3:
u = max(u,y)
if a == 4:
v = min(v,y)
if t > s and v > u:
print(max(0,(t-s)*(v-u)))
else:
print(0)
|
[
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,
0,
13,
4,
13,
13,
13,
14,
2,
40,
13,
13,
40,
13,
13,
4,
13,
17,
4,
13,
2,
2,
13,
13,
2,
13,
13,
10,
17,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13,
10,
17,
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,
4,
13
] |
[
[
135,
2
],
[
135,
11
],
[
135,
12
],
[
111,
14
],
[
105,
17
],
[
124,
18
],
[
99,
20
],
[
102,
23
],
[
127,
24
],
[
27,
26
],
[
136,
29
],
[
138,
31
],
[
138,
40
],
[
138,
41
],
[
118,
44
],
[
129,
47
],
[
112,
50
],
[
130,
50
],
[
139,
51
],
[
118,
54
],
[
132,
57
],
[
106,
60
],
[
133,
60
],
[
139,
61
],
[
118,
64
],
[
114,
67
],
[
100,
70
],
[
115,
70
],
[
109,
71
],
[
120,
73
],
[
103,
76
],
[
121,
76
],
[
109,
77
],
[
130,
81
],
[
112,
81
],
[
133,
82
],
[
106,
82
],
[
115,
84
],
[
100,
84
],
[
121,
85
],
[
103,
85
],
[
133,
93
],
[
106,
93
],
[
130,
94
],
[
112,
94
],
[
121,
96
],
[
103,
96
],
[
115,
97
],
[
100,
97
],
[
99,
100
],
[
127,
102
],
[
102,
103
],
[
124,
105
],
[
105,
106
],
[
138,
109
],
[
111,
112
],
[
114,
115
],
[
138,
118
],
[
120,
121
],
[
135,
124
],
[
135,
127
],
[
129,
130
],
[
132,
133
],
[
135,
136
],
[
138,
139
]
] |
[
"w,h,n=map(int,input().split())\nmix=0\nmx=w\nmiy=0\nmy=h\nfor i in range(n):\n x,y,a=map(int,input().split())\n if a==1:\n mix=max(mix,x)\n elif a==2:\n mx=min(mx,x)\n elif a==3:\n miy=max(miy,y)\n else:\n my=min(my,y)\nif mix>=mx or miy>=my:\n print(0)\nelse:\n print((mx-mix)*(my-miy))",
"w,h,n=map(int,input().split())",
"w",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"mix=0",
"mix",
"0",
"mx=w",
"mx",
"w",
"miy=0",
"miy",
"0",
"my=h",
"my",
"h",
"for i in range(n):\n x,y,a=map(int,input().split())\n if a==1:\n mix=max(mix,x)\n elif a==2:\n mx=min(mx,x)\n elif a==3:\n miy=max(miy,y)\n else:\n my=min(my,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 mix=max(mix,x)\n elif a==2:\n mx=min(mx,x)\n elif a==3:\n miy=max(miy,y)\n else:\n my=min(my,y)",
"a==1",
"a",
"1",
"mix=max(mix,x)",
"mix",
"max(mix,x)",
"max",
"mix",
"x",
"elif a==2:\n mx=min(mx,x)\n ",
"a==2",
"a",
"2",
"mx=min(mx,x)",
"mx",
"min(mx,x)",
"min",
"mx",
"x",
"elif a==3:\n miy=max(miy,y)\n ",
"a==3",
"a",
"3",
"miy=max(miy,y)",
"miy",
"max(miy,y)",
"max",
"miy",
"y",
"my=min(my,y)",
"my",
"min(my,y)",
"min",
"my",
"y",
"if mix>=mx or miy>=my:\n print(0)\nelse:\n print((mx-mix)*(my-miy))",
"mix>=mx or miy>=my",
"mix>=mx",
"mix",
"mx",
"miy>=my",
"miy",
"my",
"print(0)",
"print",
"0",
"print((mx-mix)*(my-miy))",
"print",
"(mx-mix)*(my-miy)",
"mx-mix",
"mx",
"mix",
"my-miy",
"my",
"miy",
"miy=0",
"0",
"miy",
"my=h",
"h",
"my",
"mx=w",
"w",
"mx",
"y,a=map(int,input().split())",
"map(int,input().split())",
"y",
"mix=0",
"0",
"mix",
"miy=max(miy,y)",
"max(miy,y)",
"miy",
"a=map(int,input().split())",
"map(int,input().split())",
"a",
"my=min(my,y)",
"min(my,y)",
"my",
"w,h,n=map(int,input().split())",
"map(int,input().split())",
"w",
"h,n=map(int,input().split())",
"map(int,input().split())",
"h",
"mix=max(mix,x)",
"max(mix,x)",
"mix",
"mx=min(mx,x)",
"min(mx,x)",
"mx",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"x,y,a=map(int,input().split())",
"map(int,input().split())",
"x"
] |
w,h,n=map(int,input().split())
mix=0
mx=w
miy=0
my=h
for i in range(n):
x,y,a=map(int,input().split())
if a==1:
mix=max(mix,x)
elif a==2:
mx=min(mx,x)
elif a==3:
miy=max(miy,y)
else:
my=min(my,y)
if mix>=mx or miy>=my:
print(0)
else:
print((mx-mix)*(my-miy))
|
[
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,
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,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13
] |
[
[
124,
2
],
[
124,
11
],
[
124,
12
],
[
112,
14
],
[
127,
16
],
[
116,
17
],
[
103,
18
],
[
94,
20
],
[
101,
21
],
[
24,
23
],
[
125,
26
],
[
130,
28
],
[
130,
37
],
[
130,
38
],
[
92,
41
],
[
121,
44
],
[
113,
47
],
[
122,
47
],
[
107,
48
],
[
92,
51
],
[
118,
54
],
[
128,
57
],
[
119,
57
],
[
107,
58
],
[
92,
61
],
[
97,
64
],
[
104,
67
],
[
98,
67
],
[
131,
68
],
[
109,
70
],
[
95,
73
],
[
110,
73
],
[
131,
74
],
[
119,
82
],
[
128,
82
],
[
122,
83
],
[
113,
83
],
[
110,
88
],
[
95,
88
],
[
98,
89
],
[
104,
89
],
[
130,
92
],
[
101,
94
],
[
94,
95
],
[
97,
98
],
[
124,
101
],
[
103,
104
],
[
130,
107
],
[
109,
110
],
[
112,
113
],
[
124,
116
],
[
118,
119
],
[
121,
122
],
[
124,
125
],
[
116,
127
],
[
127,
128
],
[
130,
131
]
] |
[
"W,H,N = map(int,input().split())\nL,R,D,U = 0,W,0,H\n\nfor i 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)\n\nprint(max(0,R-L)*max(0,U-D))",
"W,H,N = map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"L,R,D,U = 0,W,0,H",
"L",
"0",
"R",
"W",
"D",
"0",
"U",
"H",
"for i 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)",
"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 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",
"print(max(0,R-L)*max(0,U-D))",
"print",
"max(0,R-L)*max(0,U-D)",
"max(0,R-L)",
"max",
"0",
"R-L",
"R",
"L",
"max(0,U-D)",
"max",
"0",
"U-D",
"U",
"D",
"a = map(int,input().split())",
"map(int,input().split())",
"a",
"U = 0,W,0,H",
"H",
"U",
"D=max(D,y)",
"max(D,y)",
"D",
"H,N = map(int,input().split())",
"map(int,input().split())",
"H",
"D,U = 0,W,0,H",
"0",
"D",
"x,y,a = map(int,input().split())",
"map(int,input().split())",
"x",
"U=min(U,y)",
"min(U,y)",
"U",
"L,R,D,U = 0,W,0,H",
"0",
"L",
"W,H,N = map(int,input().split())",
"map(int,input().split())",
"W",
"R=min(R,x)",
"min(R,x)",
"R",
"L=max(L,x)",
"max(L,x)",
"L",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"R,D,U = 0,W,0,H",
"W",
"R",
"y,a = map(int,input().split())",
"map(int,input().split())",
"y"
] |
W,H,N = map(int,input().split())
L,R,D,U = 0,W,0,H
for i 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)
print(max(0,R-L)*max(0,U-D))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
14,
2,
13,
13,
0,
13,
13,
14,
2,
13,
17,
14,
2,
13,
13,
0,
13,
13,
14,
2,
13,
17,
14,
2,
13,
13,
0,
13,
13,
14,
2,
13,
13,
0,
13,
13,
4,
13,
2,
4,
13,
2,
13,
13,
17,
4,
13,
2,
13,
13,
17,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] |
[
[
121,
2
],
[
121,
11
],
[
121,
12
],
[
115,
14
],
[
112,
16
],
[
20,
19
],
[
98,
22
],
[
118,
24
],
[
118,
33
],
[
118,
34
],
[
119,
37
],
[
116,
41
],
[
125,
41
],
[
92,
42
],
[
124,
44
],
[
92,
45
],
[
119,
48
],
[
110,
52
],
[
95,
52
],
[
92,
53
],
[
94,
55
],
[
92,
56
],
[
119,
59
],
[
113,
63
],
[
104,
63
],
[
107,
64
],
[
103,
66
],
[
107,
67
],
[
122,
70
],
[
101,
70
],
[
107,
71
],
[
100,
73
],
[
107,
74
],
[
95,
81
],
[
110,
81
],
[
125,
82
],
[
116,
82
],
[
101,
87
],
[
122,
87
],
[
104,
88
],
[
113,
88
],
[
118,
92
],
[
92,
94
],
[
94,
95
],
[
121,
98
],
[
107,
100
],
[
100,
101
],
[
107,
103
],
[
103,
104
],
[
118,
107
],
[
121,
110
],
[
112,
113
],
[
115,
116
],
[
118,
119
],
[
121,
122
],
[
92,
124
],
[
124,
125
]
] |
[
"w,h,n=map(int,input().split())\nox,oy=0,0\nfor i in range(n):\n x,y,a=map(int,input().split())\n if a==1:\n if ox<x:\n ox=x\n elif a==2:\n if w>x:\n w=x\n elif a==3:\n if oy<y:\n oy=y\n else:\n if h>y:\n h=y\nprint(max(w-ox,0)*max(h-oy,0))",
"w,h,n=map(int,input().split())",
"w",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"ox,oy=0,0",
"ox",
"0",
"oy",
"0",
"for i in range(n):\n x,y,a=map(int,input().split())\n if a==1:\n if ox<x:\n ox=x\n elif a==2:\n if w>x:\n w=x\n elif a==3:\n if oy<y:\n oy=y\n else:\n if h>y:\n h=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 if ox<x:\n ox=x\n elif a==2:\n if w>x:\n w=x\n elif a==3:\n if oy<y:\n oy=y\n else:\n if h>y:\n h=y",
"a==1",
"a",
"1",
"if ox<x:\n ox=x\n ",
"ox<x",
"ox",
"x",
"ox=x",
"ox",
"x",
"elif a==2:\n if w>x:\n w=x\n ",
"a==2",
"a",
"2",
"if w>x:\n w=x\n ",
"w>x",
"w",
"x",
"w=x",
"w",
"x",
"elif a==3:\n if oy<y:\n oy=y\n ",
"a==3",
"a",
"3",
"if oy<y:\n oy=y\n ",
"oy<y",
"oy",
"y",
"oy=y",
"oy",
"y",
"if h>y:\n h=y",
"h>y",
"h",
"y",
"h=y",
"h",
"y",
"print(max(w-ox,0)*max(h-oy,0))",
"print",
"max(w-ox,0)*max(h-oy,0)",
"max(w-ox,0)",
"max",
"w-ox",
"w",
"ox",
"0",
"max(h-oy,0)",
"max",
"h-oy",
"h",
"oy",
"0",
"x,y,a=map(int,input().split())",
"map(int,input().split())",
"x",
"w=x",
"x",
"w",
"n=map(int,input().split())",
"map(int,input().split())",
"n",
"h=y",
"y",
"h",
"oy=y",
"y",
"oy",
"y,a=map(int,input().split())",
"map(int,input().split())",
"y",
"w,h,n=map(int,input().split())",
"map(int,input().split())",
"w",
"oy=0,0",
"0",
"oy",
"ox,oy=0,0",
"0",
"ox",
"a=map(int,input().split())",
"map(int,input().split())",
"a",
"h,n=map(int,input().split())",
"map(int,input().split())",
"h",
"ox=x",
"x",
"ox"
] |
w,h,n=map(int,input().split())
ox,oy=0,0
for i in range(n):
x,y,a=map(int,input().split())
if a==1:
if ox<x:
ox=x
elif a==2:
if w>x:
w=x
elif a==3:
if oy<y:
oy=y
else:
if h>y:
h=y
print(max(w-ox,0)*max(h-oy,0))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
0,
13,
39,
0,
13,
39,
0,
13,
2,
39,
17,
13,
0,
13,
2,
39,
17,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
13,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
28,
13,
4,
13,
18,
13,
13,
0,
18,
13,
13,
17,
14,
2,
18,
13,
13,
17,
28,
13,
4,
13,
18,
13,
13,
13,
0,
18,
13,
13,
17,
14,
2,
18,
13,
13,
17,
28,
13,
4,
13,
18,
13,
13,
0,
18,
13,
13,
17,
28,
13,
4,
13,
18,
13,
13,
13,
0,
18,
13,
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,
2,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
39,
13
] |
[
[
194,
2
],
[
194,
11
],
[
194,
12
],
[
182,
14
],
[
176,
17
],
[
203,
20
],
[
167,
23
],
[
189,
27
],
[
185,
29
],
[
180,
33
],
[
170,
35
],
[
39,
38
],
[
195,
41
],
[
197,
43
],
[
197,
52
],
[
197,
53
],
[
183,
56
],
[
174,
58
],
[
177,
61
],
[
198,
63
],
[
204,
66
],
[
192,
68
],
[
71,
70
],
[
195,
73
],
[
204,
77
],
[
70,
78
],
[
82,
81
],
[
183,
85
],
[
70,
86
],
[
91,
88
],
[
168,
89
],
[
81,
90
],
[
204,
95
],
[
70,
96
],
[
100,
99
],
[
183,
103
],
[
70,
104
],
[
189,
105
],
[
110,
107
],
[
168,
108
],
[
99,
109
],
[
204,
114
],
[
70,
115
],
[
119,
118
],
[
177,
122
],
[
70,
123
],
[
128,
125
],
[
186,
126
],
[
118,
127
],
[
131,
130
],
[
177,
134
],
[
70,
135
],
[
180,
136
],
[
141,
138
],
[
186,
139
],
[
130,
140
],
[
144,
143
],
[
180,
146
],
[
149,
148
],
[
189,
151
],
[
107,
154
],
[
88,
154
],
[
168,
155
],
[
148,
156
],
[
186,
158
],
[
143,
159
],
[
200,
161
],
[
201,
165
],
[
171,
165
],
[
167,
168
],
[
170,
171
],
[
197,
174
],
[
176,
177
],
[
194,
180
],
[
182,
183
],
[
185,
186
],
[
194,
189
],
[
197,
192
],
[
194,
195
],
[
197,
198
],
[
200,
201
],
[
203,
204
]
] |
[
"W, H, N = map(int, input().split())\nx = []\ny = []\na = []\nX = [1]*W\nY = [1]*H\nans = 0\nfor _ in range(N):\n i, j, k = map(int, input().split())\n x.append(i)\n y.append(j)\n a.append(k)\nfor i in range(N):\n if a[i] == 1:\n for j in range(x[i]):\n X[j] = 0\n elif a[i] == 2:\n for j in range(x[i], W):\n X[j] = 0\n elif a[i] == 3:\n for j in range(y[i]):\n Y[j] = 0\n else:\n for j in range(y[i], H):\n Y[j] = 0\nfor i in range(H):\n for j in range(W):\n if X[j] and Y[i]:\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",
"x = []",
"x",
"[]",
"y = []",
"y",
"[]",
"a = []",
"a",
"[]",
"X = [1]*W",
"X",
"[1]*W",
"[1]",
"1",
"W",
"Y = [1]*H",
"Y",
"[1]*H",
"[1]",
"1",
"H",
"ans = 0",
"ans",
"0",
"for _ in range(N):\n i, j, k = map(int, input().split())\n x.append(i)\n y.append(j)\n a.append(k)",
"_",
"range(N)",
"range",
"N",
"i, j, k = map(int, input().split())",
"i",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"j",
"k",
"x.append(i)",
"x.append",
"x",
"append",
"i",
"y.append(j)",
"y.append",
"y",
"append",
"j",
"a.append(k)",
"a.append",
"a",
"append",
"k",
"for i in range(N):\n if a[i] == 1:\n for j in range(x[i]):\n X[j] = 0\n elif a[i] == 2:\n for j in range(x[i], W):\n X[j] = 0\n elif a[i] == 3:\n for j in range(y[i]):\n Y[j] = 0\n else:\n for j in range(y[i], H):\n Y[j] = 0",
"i",
"range(N)",
"range",
"N",
"if a[i] == 1:\n for j in range(x[i]):\n X[j] = 0\n elif a[i] == 2:\n for j in range(x[i], W):\n X[j] = 0\n elif a[i] == 3:\n for j in range(y[i]):\n Y[j] = 0\n else:\n for j in range(y[i], H):\n Y[j] = 0",
"a[i] == 1",
"a[i]",
"a",
"i",
"1",
"for j in range(x[i]):\n X[j] = 0\n ",
"j",
"range(x[i])",
"range",
"x[i]",
"x",
"i",
"X[j] = 0",
"X[j]",
"X",
"j",
"0",
"elif a[i] == 2:\n for j in range(x[i], W):\n X[j] = 0\n ",
"a[i] == 2",
"a[i]",
"a",
"i",
"2",
"for j in range(x[i], W):\n X[j] = 0\n ",
"j",
"range(x[i], W)",
"range",
"x[i]",
"x",
"i",
"W",
"X[j] = 0",
"X[j]",
"X",
"j",
"0",
"elif a[i] == 3:\n for j in range(y[i]):\n Y[j] = 0\n ",
"a[i] == 3",
"a[i]",
"a",
"i",
"3",
"for j in range(y[i]):\n Y[j] = 0\n ",
"j",
"range(y[i])",
"range",
"y[i]",
"y",
"i",
"Y[j] = 0",
"Y[j]",
"Y",
"j",
"0",
"for j in range(y[i], H):\n Y[j] = 0",
"j",
"range(y[i], H)",
"range",
"y[i]",
"y",
"i",
"H",
"Y[j] = 0",
"Y[j]",
"Y",
"j",
"0",
"for i in range(H):\n for j in range(W):\n if X[j] and Y[i]:\n ans += 1",
"i",
"range(H)",
"range",
"H",
"for j in range(W):\n if X[j] and Y[i]:\n ans += 1",
"j",
"range(W)",
"range",
"W",
"if X[j] and Y[i]:\n ans += 1",
"X[j] and Y[i]",
"X[j]",
"X",
"j",
"Y[i]",
"Y",
"i",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"X = [1]*W",
"[1]*W",
"X",
"ans = 0",
"0",
"ans",
"i, j, k = map(int, input().split())",
"map(int, input().split())",
"i",
"y = []",
"[]",
"y",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"x = []",
"[]",
"x",
"Y = [1]*H",
"[1]*H",
"Y",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"k = map(int, input().split())",
"map(int, input().split())",
"k",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"j, k = map(int, input().split())",
"map(int, input().split())",
"j",
"ans += 1",
"1",
"ans",
"a = []",
"[]",
"a"
] |
W, H, N = map(int, input().split())
x = []
y = []
a = []
X = [1]*W
Y = [1]*H
ans = 0
for _ in range(N):
i, j, k = map(int, input().split())
x.append(i)
y.append(j)
a.append(k)
for i in range(N):
if a[i] == 1:
for j in range(x[i]):
X[j] = 0
elif a[i] == 2:
for j in range(x[i], W):
X[j] = 0
elif a[i] == 3:
for j in range(y[i]):
Y[j] = 0
else:
for j in range(y[i], H):
Y[j] = 0
for i in range(H):
for j in range(W):
if X[j] and Y[i]:
ans += 1
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
17,
41,
28,
13,
4,
13,
13,
4,
13,
0,
13,
13,
42,
2,
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,
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,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
18,
18,
13,
13,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
183,
2
],
[
183,
11
],
[
183,
12
],
[
174,
14
],
[
19,
18
],
[
184,
21
],
[
159,
25
],
[
175,
29
],
[
157,
29
],
[
166,
30
],
[
180,
32
],
[
180,
41
],
[
180,
42
],
[
181,
45
],
[
49,
48
],
[
184,
51
],
[
54,
53
],
[
178,
56
],
[
63,
58
],
[
160,
60
],
[
48,
61
],
[
53,
62
],
[
181,
66
],
[
70,
69
],
[
184,
72
],
[
75,
74
],
[
178,
77
],
[
163,
78
],
[
85,
80
],
[
160,
82
],
[
69,
83
],
[
74,
84
],
[
181,
88
],
[
92,
91
],
[
154,
94
],
[
97,
96
],
[
163,
99
],
[
106,
101
],
[
160,
103
],
[
91,
104
],
[
96,
105
],
[
181,
109
],
[
113,
112
],
[
154,
115
],
[
184,
116
],
[
119,
118
],
[
163,
121
],
[
128,
123
],
[
160,
125
],
[
112,
126
],
[
118,
127
],
[
156,
130
],
[
171,
133
],
[
137,
136
],
[
184,
139
],
[
168,
141
],
[
160,
145
],
[
136,
146
],
[
169,
151
],
[
172,
151
],
[
180,
154
],
[
156,
157
],
[
159,
160
],
[
183,
163
],
[
183,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
180,
178
],
[
180,
181
],
[
183,
184
]
] |
[
"w,h,n = map(int,input().split())\ncnt = 0\nk = [[False for i in range(w)] for j in range(h)]\nwhile(cnt < n):\n x,y,a = map(int,input().split())\n \n if(a == 1):\n for i in range(h):\n for j in range(x):\n k[i][j] = True\n elif(a == 2):\n for i in range(h):\n for j in range(x,w):\n k[i][j] = True\n elif(a == 3):\n for i in range(y):\n for j in range(w):\n k[i][j] = True\n elif(a == 4):\n for i in range(y,h):\n for j in range(w):\n k[i][j] = True\n cnt += 1\nsum = 0\nfor i in range(h):\n sum += k[i].count(False)\nprint(sum)",
"w,h,n = map(int,input().split())",
"w",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"h",
"n",
"cnt = 0",
"cnt",
"0",
"[False 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)",
"[False for i in range(w)]",
"k = [[False for i in range(w)] for j in range(h)]",
"k",
"[[False for i in range(w)] for j in range(h)]",
"while(cnt < n):\n x,y,a = map(int,input().split())\n \n if(a == 1):\n for i in range(h):\n for j in range(x):\n k[i][j] = True\n elif(a == 2):\n for i in range(h):\n for j in range(x,w):\n k[i][j] = True\n elif(a == 3):\n for i in range(y):\n for j in range(w):\n k[i][j] = True\n elif(a == 4):\n for i in range(y,h):\n for j in range(w):\n k[i][j] = True\n cnt += 1",
"cnt < n",
"cnt",
"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 k[i][j] = True\n elif(a == 2):\n for i in range(h):\n for j in range(x,w):\n k[i][j] = True\n elif(a == 3):\n for i in range(y):\n for j in range(w):\n k[i][j] = True\n elif(a == 4):\n for i in range(y,h):\n for j in range(w):\n k[i][j] = True\n ",
"a == 1",
"a",
"1",
"for i in range(h):\n for j in range(x):\n k[i][j] = True\n ",
"i",
"range(h)",
"range",
"h",
"for j in range(x):\n k[i][j] = True\n ",
"j",
"range(x)",
"range",
"x",
"k[i][j] = True",
"k[i][j]",
"[i]",
"k",
"i",
"j",
"True",
"elif(a == 2):\n for i in range(h):\n for j in range(x,w):\n k[i][j] = True\n ",
"a == 2",
"a",
"2",
"for i in range(h):\n for j in range(x,w):\n k[i][j] = True\n ",
"i",
"range(h)",
"range",
"h",
"for j in range(x,w):\n k[i][j] = True\n ",
"j",
"range(x,w)",
"range",
"x",
"w",
"k[i][j] = True",
"k[i][j]",
"[i]",
"k",
"i",
"j",
"True",
"elif(a == 3):\n for i in range(y):\n for j in range(w):\n k[i][j] = True\n ",
"a == 3",
"a",
"3",
"for i in range(y):\n for j in range(w):\n k[i][j] = True\n ",
"i",
"range(y)",
"range",
"y",
"for j in range(w):\n k[i][j] = True\n ",
"j",
"range(w)",
"range",
"w",
"k[i][j] = True",
"k[i][j]",
"[i]",
"k",
"i",
"j",
"True",
"elif(a == 4):\n for i in range(y,h):\n for j in range(w):\n k[i][j] = True\n ",
"a == 4",
"a",
"4",
"for i in range(y,h):\n for j in range(w):\n k[i][j] = True\n ",
"i",
"range(y,h)",
"range",
"y",
"h",
"for j in range(w):\n k[i][j] = True\n ",
"j",
"range(w)",
"range",
"w",
"k[i][j] = True",
"k[i][j]",
"[i]",
"k",
"i",
"j",
"True",
"cnt += 1",
"cnt",
"1",
"sum = 0",
"sum",
"0",
"for i in range(h):\n sum += k[i].count(False)",
"i",
"range(h)",
"range",
"h",
"sum += k[i].count(False)",
"sum",
"k[i].count(False)",
"[i].count",
"[i]",
"k",
"i",
"count",
"False",
"print(sum)",
"print",
"sum",
"y,a = map(int,input().split())",
"map(int,input().split())",
"y",
"cnt += 1",
"1",
"cnt",
"k = [[False for i in range(w)] for j in range(h)]",
"[[False for i in range(w)] for j in range(h)]",
"k",
"w,h,n = map(int,input().split())",
"map(int,input().split())",
"w",
"n = map(int,input().split())",
"map(int,input().split())",
"n",
"sum += k[i].count(False)",
"k[i].count(False)",
"sum",
"sum = 0",
"0",
"sum",
"cnt = 0",
"0",
"cnt",
"x,y,a = map(int,input().split())",
"map(int,input().split())",
"x",
"a = map(int,input().split())",
"map(int,input().split())",
"a",
"h,n = map(int,input().split())",
"map(int,input().split())",
"h"
] |
w,h,n = map(int,input().split())
cnt = 0
k = [[False for i in range(w)] for j in range(h)]
while(cnt < n):
x,y,a = map(int,input().split())
if(a == 1):
for i in range(h):
for j in range(x):
k[i][j] = True
elif(a == 2):
for i in range(h):
for j in range(x,w):
k[i][j] = True
elif(a == 3):
for i in range(y):
for j in range(w):
k[i][j] = True
elif(a == 4):
for i in range(y,h):
for j in range(w):
k[i][j] = True
cnt += 1
sum = 0
for i in range(h):
sum += k[i].count(False)
print(sum)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
39,
0,
13,
39,
0,
13,
39,
0,
13,
39,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
0,
13,
17,
4,
18,
13,
13,
4,
18,
13,
13,
0,
13,
17,
4,
18,
13,
13,
14,
13,
0,
13,
18,
13,
17,
0,
13,
17,
14,
13,
0,
13,
18,
13,
17,
0,
13,
13,
14,
13,
0,
13,
18,
13,
17,
0,
13,
17,
14,
13,
0,
13,
18,
13,
17,
0,
13,
13,
14,
2,
40,
13,
13,
40,
13,
13,
4,
13,
2,
2,
13,
13,
2,
13,
13,
4,
13,
17,
10,
18,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
39,
13,
10,
13,
13,
10,
4,
13,
10,
39,
13,
10,
13,
13,
10,
17,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
17,
13,
10,
39,
13,
10,
4,
13
] |
[
[
208,
2
],
[
208,
11
],
[
208,
12
],
[
205,
14
],
[
199,
17
],
[
169,
20
],
[
178,
23
],
[
27,
26
],
[
176,
29
],
[
193,
31
],
[
193,
40
],
[
193,
41
],
[
161,
44
],
[
206,
48
],
[
194,
50
],
[
161,
53
],
[
200,
57
],
[
194,
59
],
[
161,
62
],
[
170,
66
],
[
167,
68
],
[
179,
71
],
[
167,
73
],
[
206,
76
],
[
80,
79
],
[
200,
83
],
[
170,
87
],
[
91,
90
],
[
179,
94
],
[
157,
99
],
[
206,
101
],
[
202,
104
],
[
187,
109
],
[
200,
111
],
[
181,
114
],
[
197,
115
],
[
190,
119
],
[
170,
121
],
[
184,
124
],
[
163,
129
],
[
179,
131
],
[
172,
134
],
[
209,
135
],
[
182,
139
],
[
188,
139
],
[
203,
140
],
[
158,
140
],
[
173,
142
],
[
164,
142
],
[
185,
143
],
[
191,
143
],
[
182,
148
],
[
188,
148
],
[
203,
149
],
[
158,
149
],
[
173,
151
],
[
164,
151
],
[
185,
152
],
[
191,
152
],
[
157,
158
],
[
193,
161
],
[
163,
164
],
[
193,
167
],
[
169,
170
],
[
209,
172
],
[
172,
173
],
[
208,
176
],
[
178,
179
],
[
197,
181
],
[
181,
182
],
[
184,
185
],
[
187,
188
],
[
190,
191
],
[
193,
194
],
[
208,
197
],
[
199,
200
],
[
202,
203
],
[
205,
206
],
[
208,
209
]
] |
[
"W,H,N = map(int,input().split())\na1 = []\na2 = []\na3 = []\na4 = []\nfor i in range(N):\n x,y,a = map(int,input().split())\n if a == 1:\n a1.append(x)\n elif a == 2:\n a2.append(x)\n elif a == 3:\n a3.append(y)\n else:\n a4.append(y)\na1.sort(reverse=True)\na2.sort()\na3.sort(reverse=True)\na4.sort()\nif a1:\n l = a1[0]\nelse:\n l = 0\nif a2:\n r = a2[0]\nelse:\n r = W\nif a3:\n d = a3[0]\nelse:\n d = 0\nif a4:\n u = a4[0]\nelse:\n u = H\nif r >= l and u >= d:\n print((r-l)*(u-d))\nelse:\n print(0)",
"W,H,N = map(int,input().split())",
"W",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"a1 = []",
"a1",
"[]",
"a2 = []",
"a2",
"[]",
"a3 = []",
"a3",
"[]",
"a4 = []",
"a4",
"[]",
"for i in range(N):\n x,y,a = map(int,input().split())\n if a == 1:\n a1.append(x)\n elif a == 2:\n a2.append(x)\n elif a == 3:\n a3.append(y)\n else:\n a4.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:\n a1.append(x)\n elif a == 2:\n a2.append(x)\n elif a == 3:\n a3.append(y)\n else:\n a4.append(y)",
"a == 1",
"a",
"1",
"a1.append(x)",
"a1.append",
"a1",
"append",
"x",
"elif a == 2:\n a2.append(x)\n ",
"a == 2",
"a",
"2",
"a2.append(x)",
"a2.append",
"a2",
"append",
"x",
"elif a == 3:\n a3.append(y)\n ",
"a == 3",
"a",
"3",
"a3.append(y)",
"a3.append",
"a3",
"append",
"y",
"a4.append(y)",
"a4.append",
"a4",
"append",
"y",
"a1.sort(reverse=True)",
"a1.sort",
"a1",
"sort",
"reverse=True",
"reverse",
"True",
"a2.sort()",
"a2.sort",
"a2",
"sort",
"a3.sort(reverse=True)",
"a3.sort",
"a3",
"sort",
"reverse=True",
"reverse",
"True",
"a4.sort()",
"a4.sort",
"a4",
"sort",
"if a1:\n l = a1[0]\nelse:\n l = 0",
"a1",
"l = a1[0]",
"l",
"a1[0]",
"a1",
"0",
"l = 0",
"l",
"0",
"if a2:\n r = a2[0]\nelse:\n r = W",
"a2",
"r = a2[0]",
"r",
"a2[0]",
"a2",
"0",
"r = W",
"r",
"W",
"if a3:\n d = a3[0]\nelse:\n d = 0",
"a3",
"d = a3[0]",
"d",
"a3[0]",
"a3",
"0",
"d = 0",
"d",
"0",
"if a4:\n u = a4[0]\nelse:\n u = H",
"a4",
"u = a4[0]",
"u",
"a4[0]",
"a4",
"0",
"u = H",
"u",
"H",
"if r >= l and u >= d:\n print((r-l)*(u-d))\nelse:\n print(0)",
"r >= l and u >= d",
"r >= l",
"r",
"l",
"u >= d",
"u",
"d",
"print((r-l)*(u-d))",
"print",
"(r-l)*(u-d)",
"r-l",
"r",
"l",
"u-d",
"u",
"d",
"print(0)",
"print",
"0",
"l = a1[0]",
"a1[0]",
"l",
"a = map(int,input().split())",
"map(int,input().split())",
"a",
"u = a4[0]",
"a4[0]",
"u",
"y,a = map(int,input().split())",
"map(int,input().split())",
"y",
"a3 = []",
"[]",
"a3",
"u = H",
"H",
"u",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"a4 = []",
"[]",
"a4",
"r = W",
"W",
"r",
"d = 0",
"0",
"d",
"r = a2[0]",
"a2[0]",
"r",
"d = a3[0]",
"a3[0]",
"d",
"x,y,a = map(int,input().split())",
"map(int,input().split())",
"x",
"W,H,N = map(int,input().split())",
"map(int,input().split())",
"W",
"a2 = []",
"[]",
"a2",
"l = 0",
"0",
"l",
"a1 = []",
"[]",
"a1",
"H,N = map(int,input().split())",
"map(int,input().split())",
"H"
] |
W,H,N = map(int,input().split())
a1 = []
a2 = []
a3 = []
a4 = []
for i in range(N):
x,y,a = map(int,input().split())
if a == 1:
a1.append(x)
elif a == 2:
a2.append(x)
elif a == 3:
a3.append(y)
else:
a4.append(y)
a1.sort(reverse=True)
a2.sort()
a3.sort(reverse=True)
a4.sort()
if a1:
l = a1[0]
else:
l = 0
if a2:
r = a2[0]
else:
r = W
if a3:
d = a3[0]
else:
d = 0
if a4:
u = a4[0]
else:
u = H
if r >= l and u >= d:
print((r-l)*(u-d))
else:
print(0)
|
[
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,
39,
17,
13,
17,
13,
28,
13,
13,
13,
13,
0,
13,
17,
0,
13,
39,
13,
13,
14,
2,
2,
13,
17,
17,
0,
18,
13,
13,
4,
13,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
13,
4,
13,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
14,
2,
2,
18,
13,
17,
18,
13,
17,
2,
18,
13,
17,
18,
13,
17,
0,
13,
2,
2,
18,
13,
17,
18,
13,
17,
2,
18,
13,
17,
18,
13,
17,
4,
13,
13,
10,
39,
13,
10,
17,
13,
10,
39,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13
] |
[
[
151,
2
],
[
151,
11
],
[
151,
12
],
[
16,
15
],
[
143,
18
],
[
139,
31
],
[
133,
34
],
[
130,
46
],
[
127,
49
],
[
131,
56
],
[
63,
60
],
[
134,
61
],
[
131,
62
],
[
74,
65
],
[
60,
65
],
[
134,
66
],
[
131,
67
],
[
128,
69
],
[
131,
71
],
[
77,
74
],
[
134,
75
],
[
131,
76
],
[
74,
79
],
[
60,
79
],
[
134,
80
],
[
131,
81
],
[
128,
83
],
[
131,
85
],
[
148,
88
],
[
134,
94
],
[
134,
97
],
[
134,
101
],
[
134,
104
],
[
145,
107
],
[
134,
111
],
[
134,
114
],
[
134,
118
],
[
134,
121
],
[
146,
125
],
[
149,
125
],
[
127,
128
],
[
130,
131
],
[
133,
134
],
[
151,
137
],
[
139,
140
],
[
151,
143
],
[
145,
146
],
[
148,
149
],
[
151,
152
]
] |
[
"W,H,N = map(int,input().split())\nXYA = [list(map(int,input().split())) for _ in range(N)]\n\nE = [0,W,0,H]\n\nfor x,y,a in XYA:\n a -= 1\n XY = [x,y]\n if a % 2 == 0:\n E[a] = max(E[a],XY[a//2])\n else:\n E[a] = min(E[a],XY[a//2])\n\nans = 0\nif E[0] < E[1] and E[2] < E[3]:\n ans = (E[1] - E[0]) * (E[3] - E[2])\n \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",
"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)]",
"E = [0,W,0,H]",
"E",
"[0,W,0,H]",
"0",
"W",
"0",
"H",
"for x,y,a in XYA:\n a -= 1\n XY = [x,y]\n if a % 2 == 0:\n E[a] = max(E[a],XY[a//2])\n else:\n E[a] = min(E[a],XY[a//2])",
"x",
"y",
"a",
"XYA",
"a -= 1",
"a",
"1",
"XY = [x,y]",
"XY",
"[x,y]",
"x",
"y",
"if a % 2 == 0:\n E[a] = max(E[a],XY[a//2])\n else:\n E[a] = min(E[a],XY[a//2])",
"a % 2 == 0",
"a % 2",
"a",
"2",
"0",
"E[a] = max(E[a],XY[a//2])",
"E[a]",
"E",
"a",
"max(E[a],XY[a//2])",
"max",
"E[a]",
"E",
"a",
"XY[a//2]",
"XY",
"a//2",
"a",
"2",
"E[a] = min(E[a],XY[a//2])",
"E[a]",
"E",
"a",
"min(E[a],XY[a//2])",
"min",
"E[a]",
"E",
"a",
"XY[a//2]",
"XY",
"a//2",
"a",
"2",
"ans = 0",
"ans",
"0",
"if E[0] < E[1] and E[2] < E[3]:\n ans = (E[1] - E[0]) * (E[3] - E[2])\n ",
"E[0] < E[1] and E[2] < E[3]",
"E[0] < E[1]",
"E[0]",
"E",
"0",
"E[1]",
"E",
"1",
"E[2] < E[3]",
"E[2]",
"E",
"2",
"E[3]",
"E",
"3",
"ans = (E[1] - E[0]) * (E[3] - E[2])",
"ans",
"(E[1] - E[0]) * (E[3] - E[2])",
"E[1] - E[0]",
"E[1]",
"E",
"1",
"E[0]",
"E",
"0",
"E[3] - E[2]",
"E[3]",
"E",
"3",
"E[2]",
"E",
"2",
"print(ans)",
"print",
"ans",
"XY = [x,y]",
"[x,y]",
"XY",
"a -= 1",
"1",
"a",
"E = [0,W,0,H]",
"[0,W,0,H]",
"E",
"W,H,N = map(int,input().split())",
"map(int,input().split())",
"W",
"XYA = [list(map(int,input().split())) for _ in range(N)]",
"[list(map(int,input().split())) for _ in range(N)]",
"XYA",
"N = map(int,input().split())",
"map(int,input().split())",
"N",
"ans = (E[1] - E[0]) * (E[3] - E[2])",
"(E[1] - E[0]) * (E[3] - E[2])",
"ans",
"ans = 0",
"0",
"ans",
"H,N = map(int,input().split())",
"map(int,input().split())",
"H"
] |
W,H,N = map(int,input().split())
XYA = [list(map(int,input().split())) for _ in range(N)]
E = [0,W,0,H]
for x,y,a in XYA:
a -= 1
XY = [x,y]
if a % 2 == 0:
E[a] = max(E[a],XY[a//2])
else:
E[a] = min(E[a],XY[a//2])
ans = 0
if E[0] < E[1] and E[2] < E[3]:
ans = (E[1] - E[0]) * (E[3] - E[2])
print(ans)
|
[
7,
15,
13,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
18,
13,
13,
39,
13,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
13,
0,
13,
2,
13,
13,
14,
2,
13,
17,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
39,
13,
17,
14,
2,
13,
17,
28,
13,
4,
13,
13,
0,
18,
18,
13,
13,
39,
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,
4,
13,
4,
13,
4,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] |
[
[
131,
5
],
[
131,
14
],
[
131,
15
],
[
137,
17
],
[
27,
26
],
[
123,
29
],
[
134,
31
],
[
134,
40
],
[
134,
41
],
[
140,
43
],
[
129,
45
],
[
120,
46
],
[
141,
46
],
[
126,
49
],
[
53,
52
],
[
129,
55
],
[
63,
57
],
[
106,
58
],
[
92,
58
],
[
138,
59
],
[
52,
60
],
[
126,
66
],
[
70,
69
],
[
129,
72
],
[
80,
74
],
[
106,
75
],
[
92,
75
],
[
138,
76
],
[
69,
77
],
[
126,
83
],
[
87,
86
],
[
141,
89
],
[
120,
89
],
[
129,
90
],
[
95,
92
],
[
138,
93
],
[
86,
94
],
[
126,
98
],
[
102,
101
],
[
141,
104
],
[
120,
104
],
[
109,
106
],
[
138,
107
],
[
101,
108
],
[
138,
116
],
[
134,
120
],
[
131,
123
],
[
134,
126
],
[
131,
129
],
[
131,
132
],
[
134,
135
],
[
137,
138
],
[
140,
141
]
] |
[
"import numpy as np\nfrom pprint import pprint\nW, H, N = map(int, input().split())\narea = np.ones((H, W))\n# pprint(area[1][:3])\nfor _ in range(N):\n x, y, a = map(int, input().split())\n y = H - y\n if a == 1:\n for i in range(H):\n area[i][:x] = 0\n elif a == 2:\n for i in range(H):\n area[i][x:] = 0\n elif a == 3:\n for i in range(y, H):\n area[i] = 0\n elif a == 4:\n for i in range(y):\n area[i] = 0\npprint(int(area.sum()))",
"import numpy as np",
"numpy",
"from pprint import pprint",
"W, H, N = map(int, input().split())",
"W",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"H",
"N",
"area = np.ones((H, W))",
"area",
"np.ones((H, W))",
"np.ones",
"np",
"ones",
"(H, W)",
"H",
"W",
"for _ in range(N):\n x, y, a = map(int, input().split())\n y = H - y\n if a == 1:\n for i in range(H):\n area[i][:x] = 0\n elif a == 2:\n for i in range(H):\n area[i][x:] = 0\n elif a == 3:\n for i in range(y, H):\n area[i] = 0\n elif a == 4:\n for i in range(y):\n area[i] = 0",
"_",
"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",
"y = H - y",
"y",
"H - y",
"H",
"y",
"if a == 1:\n for i in range(H):\n area[i][:x] = 0\n elif a == 2:\n for i in range(H):\n area[i][x:] = 0\n elif a == 3:\n for i in range(y, H):\n area[i] = 0\n elif a == 4:\n for i in range(y):\n area[i] = 0",
"a == 1",
"a",
"1",
"for i in range(H):\n area[i][:x] = 0\n ",
"i",
"range(H)",
"range",
"H",
"area[i][:x] = 0",
"area[i][:x]",
"[i]",
"area",
"i",
":x",
"x",
"0",
"elif a == 2:\n for i in range(H):\n area[i][x:] = 0\n ",
"a == 2",
"a",
"2",
"for i in range(H):\n area[i][x:] = 0\n ",
"i",
"range(H)",
"range",
"H",
"area[i][x:] = 0",
"area[i][x:]",
"[i]",
"area",
"i",
"x:",
"x",
"0",
"elif a == 3:\n for i in range(y, H):\n area[i] = 0\n ",
"a == 3",
"a",
"3",
"for i in range(y, H):\n area[i] = 0\n ",
"i",
"range(y, H)",
"range",
"y",
"H",
"area[i] = 0",
"area[i]",
"area",
"i",
"0",
"elif a == 4:\n for i in range(y):\n area[i] = 0",
"a == 4",
"a",
"4",
"for i in range(y):\n area[i] = 0",
"i",
"range(y)",
"range",
"y",
"area[i] = 0",
"area[i]",
"area",
"i",
"0",
"pprint(int(area.sum()))",
"pprint",
"int(area.sum())",
"int",
"area.sum()",
"area.sum",
"area",
"sum",
"y, a = map(int, input().split())",
"map(int, input().split())",
"y",
"N = map(int, input().split())",
"map(int, input().split())",
"N",
"a = map(int, input().split())",
"map(int, input().split())",
"a",
"H, N = map(int, input().split())",
"map(int, input().split())",
"H",
"W, H, N = map(int, input().split())",
"map(int, input().split())",
"W",
"x, y, a = map(int, input().split())",
"map(int, input().split())",
"x",
"area = np.ones((H, W))",
"np.ones((H, W))",
"area",
"y = H - y",
"H - y",
"y"
] |
import numpy as np
from pprint import pprint
W, H, N = map(int, input().split())
area = np.ones((H, W))
# pprint(area[1][:3])
for _ in range(N):
x, y, a = map(int, input().split())
y = H - y
if a == 1:
for i in range(H):
area[i][:x] = 0
elif a == 2:
for i in range(H):
area[i][x:] = 0
elif a == 3:
for i in range(y, H):
area[i] = 0
elif a == 4:
for i in range(y):
area[i] = 0
pprint(int(area.sum()))
|
[
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,
14,
2,
13,
17,
28,
13,
4,
13,
13,
28,
13,
4,
13,
17,
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,
17,
13,
0,
18,
18,
13,
13,
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,
2,
2,
13,
13,
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
] |
[
[
162,
2
],
[
162,
11
],
[
162,
12
],
[
16,
15
],
[
148,
18
],
[
163,
23
],
[
165,
25
],
[
29,
28
],
[
154,
31
],
[
168,
33
],
[
168,
42
],
[
168,
43
],
[
157,
46
],
[
50,
49
],
[
148,
52
],
[
55,
54
],
[
151,
58
],
[
65,
60
],
[
166,
62
],
[
49,
63
],
[
54,
64
],
[
157,
68
],
[
72,
71
],
[
148,
74
],
[
77,
76
],
[
151,
79
],
[
163,
80
],
[
87,
82
],
[
166,
84
],
[
71,
85
],
[
76,
86
],
[
157,
90
],
[
94,
93
],
[
163,
96
],
[
99,
98
],
[
169,
102
],
[
109,
104
],
[
166,
106
],
[
98,
107
],
[
93,
108
],
[
112,
111
],
[
163,
114
],
[
117,
116
],
[
169,
119
],
[
148,
120
],
[
127,
122
],
[
166,
124
],
[
116,
125
],
[
111,
126
],
[
171,
129
],
[
133,
132
],
[
166,
132
],
[
159,
135
],
[
132,
138
],
[
148,
143
],
[
163,
144
],
[
160,
145
],
[
172,
145
],
[
162,
148
],
[
168,
151
],
[
162,
154
],
[
168,
157
],
[
159,
160
],
[
162,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
]
] |
[
"W,H,N=map(int,input().split())\n\nZ=[[0]*W for _ in range(H)]\n\nfor _ in range(N):\n X,Y,a=map(int,input().split())\n\n if a==1:\n for y in range(H):\n for x in range(0,X):\n Z[y][x]=1\n elif a==2:\n for y in range(H):\n for x in range(X,W):\n Z[y][x]=1\n elif a==3:\n for x in range(W):\n for y in range(0,Y):\n Z[y][x]=1\n else:\n for x in range(W):\n for y in range(Y,H):\n Z[y][x]=1\n\nS=0\nfor l in Z:\n S+=sum(l)\nprint(H*W-S)",
"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",
"Z=[[0]*W for _ in range(H)]",
"Z",
"[[0]*W for _ in range(H)]",
"for _ in range(N):\n X,Y,a=map(int,input().split())\n\n if a==1:\n for y in range(H):\n for x in range(0,X):\n Z[y][x]=1\n elif a==2:\n for y in range(H):\n for x in range(X,W):\n Z[y][x]=1\n elif a==3:\n for x in range(W):\n for y in range(0,Y):\n Z[y][x]=1\n else:\n for x in range(W):\n for y in range(Y,H):\n Z[y][x]=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 y in range(H):\n for x in range(0,X):\n Z[y][x]=1\n elif a==2:\n for y in range(H):\n for x in range(X,W):\n Z[y][x]=1\n elif a==3:\n for x in range(W):\n for y in range(0,Y):\n Z[y][x]=1\n else:\n for x in range(W):\n for y in range(Y,H):\n Z[y][x]=1",
"a==1",
"a",
"1",
"for y in range(H):\n for x in range(0,X):\n Z[y][x]=1\n ",
"y",
"range(H)",
"range",
"H",
"for x in range(0,X):\n Z[y][x]=1\n ",
"x",
"range(0,X)",
"range",
"0",
"X",
"Z[y][x]=1",
"Z[y][x]",
"[y]",
"Z",
"y",
"x",
"1",
"elif a==2:\n for y in range(H):\n for x in range(X,W):\n Z[y][x]=1\n ",
"a==2",
"a",
"2",
"for y in range(H):\n for x in range(X,W):\n Z[y][x]=1\n ",
"y",
"range(H)",
"range",
"H",
"for x in range(X,W):\n Z[y][x]=1\n ",
"x",
"range(X,W)",
"range",
"X",
"W",
"Z[y][x]=1",
"Z[y][x]",
"[y]",
"Z",
"y",
"x",
"1",
"elif a==3:\n for x in range(W):\n for y in range(0,Y):\n Z[y][x]=1\n ",
"a==3",
"a",
"3",
"for x in range(W):\n for y in range(0,Y):\n Z[y][x]=1\n ",
"x",
"range(W)",
"range",
"W",
"for y in range(0,Y):\n Z[y][x]=1\n ",
"y",
"range(0,Y)",
"range",
"0",
"Y",
"Z[y][x]=1",
"Z[y][x]",
"[y]",
"Z",
"y",
"x",
"1",
"for x in range(W):\n for y in range(Y,H):\n Z[y][x]=1",
"x",
"range(W)",
"range",
"W",
"for y in range(Y,H):\n Z[y][x]=1",
"y",
"range(Y,H)",
"range",
"Y",
"H",
"Z[y][x]=1",
"Z[y][x]",
"[y]",
"Z",
"y",
"x",
"1",
"S=0",
"S",
"0",
"for l in Z:\n S+=sum(l)",
"l",
"Z",
"S+=sum(l)",
"S",
"sum(l)",
"sum",
"l",
"print(H*W-S)",
"print",
"H*W-S",
"H*W",
"H",
"W",
"S",
"H,N=map(int,input().split())",
"map(int,input().split())",
"H",
"X,Y,a=map(int,input().split())",
"map(int,input().split())",
"X",
"N=map(int,input().split())",
"map(int,input().split())",
"N",
"a=map(int,input().split())",
"map(int,input().split())",
"a",
"S+=sum(l)",
"sum(l)",
"S",
"W,H,N=map(int,input().split())",
"map(int,input().split())",
"W",
"Z=[[0]*W for _ in range(H)]",
"[[0]*W for _ in range(H)]",
"Z",
"Y,a=map(int,input().split())",
"map(int,input().split())",
"Y",
"S=0",
"0",
"S"
] |
W,H,N=map(int,input().split())
Z=[[0]*W for _ in range(H)]
for _ in range(N):
X,Y,a=map(int,input().split())
if a==1:
for y in range(H):
for x in range(0,X):
Z[y][x]=1
elif a==2:
for y in range(H):
for x in range(X,W):
Z[y][x]=1
elif a==3:
for x in range(W):
for y in range(0,Y):
Z[y][x]=1
else:
for x in range(W):
for y in range(Y,H):
Z[y][x]=1
S=0
for l in Z:
S+=sum(l)
print(H*W-S)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.