s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s274649082
p03943
u107077660
1507942480
Python
Python (3.4.3)
py
Runtime Error
19
2940
108
a, b, c = [int(i) for i in input().split()] if(max(a,b,c)*2 == sum(a,b,c)): print("Yes") else: print("No")
s875442495
p03943
u785205215
1505688414
Python
Python (3.4.3)
py
Runtime Error
17
2940
104
n= (int(i) for i in input().split()) n.sort() if n[0]+n[1]==n[2]: print("Yes") else: print("No")
s454295129
p03943
u785205215
1505688352
Python
Python (3.4.3)
py
Runtime Error
17
2940
103
n = list(int(i) in input().split()) n.sort() if n[0]+n[1]==n[2]: print("Yes") else: print("No")
s039537994
p03943
u914001098
1500609350
Python
Python (3.4.3)
py
Runtime Error
17
2940
179
candy = int(input()) x = candy.split() i = 0 for v in x if max(x) == v and (i+1)%3 + (i+2)%3 = v: print('YES') break i ++ if i >= 2 print('NO')
s767859618
p03943
u012693733
1483825041
Python
Python (2.7.6)
py
Runtime Error
17
2568
201
#prepare f = True List = [] #input List.append(map(int,raw_input().split())) #evaluate List.sort() if not List[0]+List[1] == List[2]: f = False #output if f: print 'YES' else: print 'NO'
s163002036
p03943
u231928431
1481864185
Python
Python (2.7.6)
py
Runtime Error
16
2568
83
a=input() b=input() c=input() if (a+b+c)%3==0: print "Yes" else: print "No"
s152077559
p03943
u113430839
1480947481
Python
Python (2.7.6)
py
Runtime Error
18
2568
225
# -*- config: utf-8 -*- while(1): a,b,c = map(int,raw_input().split()) j = 0 if a + b == c or a + c == b or b + c== a: j=1 if(j == 1): print 'Yes' else: print 'No'
s297704944
p03943
u113430839
1480946929
Python
Python (2.7.6)
py
Runtime Error
16
2568
235
# -*- config: utf-8 -*- for i in range(10): a,b,c = map(int,raw_input().split()) j = 0 if a + b == c or a + c == b or b + c== a: j=1 if(j == 1): print 'Yes' else: print 'No'
s001304333
p03943
u192908410
1480857759
Python
Python (3.4.3)
py
Runtime Error
23
3064
136
input() A=list(map(int,input().split())) d,c,s=0,0,A[0] for x in A[1:]: if x-s<d: d,c=x-s,c elif x-s==d: c+=1 s=min(s,x) print(c)
s906667922
p03943
u113430839
1480793030
Python
Python (2.7.6)
py
Runtime Error
17
2568
227
# -*- config: utf-8 -*- for i in range(10): a,b,c = map(int,raw_input().split()) j = 0 if a + b == c or a + c == b or b + c== a: j=1 if(j == 1): print 'YES' else: print 'NO'
s462298456
p03943
u113430839
1480792841
Python
Python (2.7.6)
py
Runtime Error
17
2568
217
# -*- config: utf-8 -*- while(1): a,b,c = map(int,raw_input().split()) j = 0 if a + b == c or a + c == b or b + c== a: j=1 if(j == 1): print 'YES' else: print 'NO'
s413523306
p03943
u113430839
1480788956
Python
Python (2.7.6)
py
Runtime Error
15
2568
211
# -*- config: utf-8 -*- a = 0 b = 0 c = 0 a = input('>>>') b = input('>>>') c = input('>>>') if a+b == c: j=1 if a+c == b: j=1 if b+c == a: j=1 if(j == 1): print 'YES' else: print 'NO'
s704409001
p03943
u113430839
1480788818
Python
Python (2.7.6)
py
Runtime Error
17
2692
211
# -*- config: utf-8 -*- a = 0 b = 0 c = 0 a = input('>>>') b = input('>>>') c = input('>>>') if a+b == c: j=1 if a+c == b: j=1 if b+c == a: j=1 if(j == 1): print 'YES' else: print 'NO'
s450572241
p03943
u235979006
1480734891
Python
Python (3.4.3)
py
Runtime Error
23
3064
170
candy = map(int, raw_input().split()) mx = max(candy) total = 0 for n in candy: if n != mx: total += n if total == mx: print("Yes") else: print("No")
s111222270
p03943
u486686490
1480376019
Python
Python (3.4.3)
py
Runtime Error
24
3188
97
l = sum(map(int, input().split())) n = sum(l)%3 if n == 0: print("Yes") else: print("No")
s025678445
p03943
u486686490
1480375964
Python
Python (3.4.3)
py
Runtime Error
23
3064
97
l = sum(map(int, input().split())) n = sum(l)%3 if n == 0: print("YES") else: print("NO")
s054664990
p03943
u080412864
1480362812
Python
Python (3.4.3)
py
Runtime Error
23
3064
445
W, H, N = [int(x) for x in input().strip().split()] x_min = 0 y_min = 0 for i in range(N): x, y, a = [int(x) for x in input().strip().split()] result = 0 if W < x_min or H < y_min: W - x_min == 0 break if a == 1 and x_min < x: x_min = x elif a == 2 and W > x: W = x elif a == 3 and y_min < y: y_min = y elif a == 4 and H > y: H = y print((W - x_min)*(H - y_min))
s134783634
p03943
u080412864
1480362552
Python
Python (3.4.3)
py
Runtime Error
23
3192
448
W, H, N = [int(x) for x in input().strip().split()] x_min = 0 y_min = 0 for i in range(N): x, y, a = [int(x) for x in input().strip().split()] result = 0 if W < x_min or H < y_min: W - x_min == 0 continue if a == 1 and x_min < x: x_min = x elif a == 2 and W > x: W = x elif a == 3 and y_min < y: y_min = y elif a == 4 and H > y: H = y print((W - x_min)*(H - y_min))
s123336005
p03943
u080412864
1480345012
Python
Python (3.4.3)
py
Runtime Error
23
3064
316
N, T= list(map(int, input().split())) A = [int(x) for x in input().strip().split()] result = 0 diff = 0 for i in range(N - 1): counter = 0 if max(A[i+1:]) - A[i] < 0: continue elif max(A[i+1:]) - A[i] > diff: diff = max(A[i+1:]) - A[i] result += 1 counter += 1 print(result)
s783399810
p03943
u443512298
1480308006
Python
Python (3.4.3)
py
Runtime Error
23
3064
202
#coding: utf-8 def solve(a, b, c): if a == b + c: return "Yes" elif b == c + a: return "Yes" elif c == a + b: return "Yes" return "No" print(solve(list(map(int, input().split()))))
s871807806
p03943
u371573282
1479881995
Python
Python (3.4.3)
py
Runtime Error
24
3064
305
from itertools import combinations N,T=[int(x) for x in input().split()] towns=list([int(x) for x in input().split()]) com=combinations(list(range(0,N)),2) bene=[] for c in com: bene.append(towns[c[1]]-towns[c[0]]) max_bene=max(bene) print(len([item for item in [x for x in bene if x==max_bene]]))
s893749868
p03943
u371573282
1479876968
Python
Python (3.4.3)
py
Runtime Error
23
3064
56
print(len(re.sub("B+","B",re.sub("W+","W",input())))-1)
s344232669
p03943
u759581240
1479863673
Python
Python (3.4.3)
py
Runtime Error
23
3064
119
i = list(map(lambda x:int(x),list(input().split(' ')))).sort() if i[0] is i[1]+i[2]: print('Yes') else: print('No')
s757990078
p03943
u759581240
1479863131
Python
Python (3.4.3)
py
Runtime Error
24
3064
81
i = list(input().split(' ')).map(lambda x:int(x) x,y,z = i a =x+y+z if a%3 is 0:
s565596152
p03943
u443512298
1479606735
Python
Python (3.4.3)
py
Runtime Error
23
3064
280
# coding: utf-8 """Fighting over Candies @author: hijiri.n @modified: 11-19-2016 """ def solve(): candies = list(map(int, input().split())) ach = sum(candies) // 2 for c in candies: if c == ach: return "Yes" return "No" print(solve_a())
s922901414
p03943
u443512298
1479412921
Python
Python (3.4.3)
py
Runtime Error
23
3064
356
# coding: utf-8 w, h, N = list(map(int, input().split())) rect = [0, w, 0, h] for i in range(N): x, y, a = list(map(int, input().split())) rect[a - 1] = (lambda c, r, p: [r, c][p * (c - r) < 0])([x, y][a > 2], rect[a - 1], int(not a % 2) - int(a % 2)) length = lambda x: [x, 0][x < 0] print(length(rect[1] - rect[0]) * length(rect[3] - rect[2]))
s903857483
p03943
u443512298
1479412342
Python
Python (3.4.3)
py
Runtime Error
23
3064
343
# coding: utf-8 w, h, N = list(map(int, input().split())) rect = [0, w, 0, h] for i in range(N): x, y, a = list(map(int, input().split())) rect[a - 1] = (lambda c, r, p: [r, c][p * (c - r) < 0])([x, y][a > 2], rect[a - 1], [1, -1][a % 2]) length = lambda x: [x, 0][x < 0] print(length(rect[1] - rect[0]) * length(rect[3] - rect[2]))
s656788498
p03943
u922952729
1479326867
Python
Python (3.4.3)
py
Runtime Error
23
3064
175
line=input() line.split(" ") a=int(line[0]) b=int(line[1]) c=int(line[2]) if a+b==c: print("Yes") elif b+c==a: print("Yes") elif c+a==b: print("Yes") else: print("No")
s773618921
p03943
u922952729
1479326433
Python
Python (3.4.3)
py
Runtime Error
23
3064
97
if a+b==c: print("yes") elif b+c==a: print("yes") elif a+c==b: print("yes") else: print("no")
s248095149
p03943
u749791080
1479022299
Python
Python (3.4.3)
py
Runtime Error
22
3064
225
# -*- coding: utf-8 -*- # 整数の入力 import sys for line in sys.stdin: a,b,c = type(int(line.split())) # 判定 if (a+b==c) or (a+c==b) or (b+c== a) : print("Yes") else : print("No")
s701550714
p03943
u749791080
1479022177
Python
Python (3.4.3)
py
Runtime Error
22
3064
204
# 整数の入力 import sys for line in sys.stdin: a,b,c = type(int(input().split())) # 判定 if (a+b==c) or (a+c==b) or (b+c== a) : print("Yes") else : print("No")
s629066322
p03943
u749791080
1479020017
Python
Python (3.4.3)
py
Runtime Error
22
3064
168
# -*- coding: utf-8 -*- # 整数の入力 a,b,c = map(int, raw_input().split()) # 判定 if (a+b==c) or (a+c==b) or (b+c==a): print("Yes") else : print("No")
s740980038
p03943
u984351908
1478905286
Python
Python (3.4.3)
py
Runtime Error
24
3064
676
w, h, n = list(map(int, input().split())) xya = [] for i in range(n): xya.append(list(map(int, input().split()))) min_x_1 = w max_x_2 = 0 min_y_3 = h max_y_4 = 0 for i in range(n): ai = xya[i][2] if ai == 1: if xya[i][0] < min_x_1: min_x_1 = xya[i][0] if ai == 2: if xya[i][0] > max_x_2: max_x_2 = xya[i][0] if ai == 3: if xya[i][1] < min_y_3: min_y_3 = xya[i][1] if ai == 4: if xya[i][1] > max_y_4: max_y_4 = xya[i][1] x = min_x_1 - max_x_2 if x <= 0: print("0") else: y = min_y_3 - max_y_4 if y <= 0: print("0") else: print(str(x * y))
s226431618
p03943
u984351908
1478905182
Python
Python (3.4.3)
py
Runtime Error
23
3064
676
w, h, n = list(map(int, input().split())) xya = [] for i in range(n): xya.append(list(map(int, input().split()))) min_x_1 = w max_x_2 = 0 min_y_3 = h max_y_4 = 0 for i in range(n): ai = xya[i][2] if ai == 1: if xya[i][0] < min_x_1: min_x_1 = xya[i][0] if ai == 2: if xya[i][0] > max_x_2: max_x_2 = xya[i][0] if ai == 3: if xya[i][1] < min_y_3: min_y_3 = xya[i][1] if ai == 4: if xya[i][1] > max_y_4: max_y_4 = xya[i][1] x = max_x_2 - min_x_1 if x <= 0: print("0") else: y = max_y_4 - min_y_3 if y <= 0: print("0") else: print(str(x * y))
s068362149
p03943
u601378575
1478901871
Python
Python (3.4.3)
py
Runtime Error
22
3064
74
a,b,c = [int(x) for x input().split()] print('Yes' if (a+b+c)%2 else 'No')
s832147040
p03943
u123849480
1478901314
Python
Python (3.4.3)
py
Runtime Error
33
3188
116
seq = map(int, input().split) seq.sort() a, b, c = seq if a + b == c: print('Yes') else: print('No')
s789468901
p03943
u123849480
1478900650
Python
Python (3.4.3)
py
Runtime Error
23
3064
121
a, b, c = map(int, input().split) if a + b == c or b + c == a or c + a == b: print('Yes') else: print('No')
s061234765
p03943
u182418221
1478757857
Python
Python (3.4.3)
py
Runtime Error
23
3064
120
input = raw_input() a,b,c = map(int,raw_input.split()) if (a + b + c) % 3 == 0: return 'Yes' else: return 'No'
s415869753
p03943
u546700081
1478752485
Python
Python (2.7.6)
py
Runtime Error
16
2568
195
N,_=map(int,raw_input().split()) A=map(int,raw_input().split()) difflist=[A[i]-A[j] for i in range(0,len(A)) for j in range(0,len(A)) if i>j] print len([1 for x in difflist if x==max(difflist)])
s520512307
p03943
u675044240
1478631437
Python
Python (3.4.3)
py
Runtime Error
23
3064
95
a = input() b = input() c = input() if (a+b+c) % 2 == 0: print('Yes\n') else: print('No\n')
s807503069
p03943
u675044240
1478631204
Python
Python (3.4.3)
py
Runtime Error
22
3064
97
a = input() b = input() c = input() if (a+b+c) % 2 == 0: print('Yes') else: print('No')
s484998604
p03943
u830390742
1478620165
Python
Python (2.7.6)
py
Runtime Error
16
2568
59
print 'No' if sum(map(int, raw_input().split())9 else 'Yes'
s332326370
p03943
u089636269
1478495201
Python
Python (3.4.3)
py
Runtime Error
23
3064
180
# coding: UTF8 #input = "10 49 30" l = map(int, input().split()) # l = map(int, input.split()) l.sort() a = l[0] b = l[1] c = l[2] if a + b == c: print("Yes") else: print("No")
s768379644
p03943
u831695469
1478490557
Python
Python (3.4.3)
py
Runtime Error
23
3064
1240
w, h, n = input().split() w, h, n = int(w), int(h), int(n) x = [] y = [] a = [] for _ in range(n): x_, y_, a_ = input().split() x.append(int(x_)) y.append(int(y_)) a.append(int(a_)) W = w H = h w_r = w w_l = 0 h_u = h h_l = 0 for i in range(n): if a[i] is 1 and x[i]>w_l: w_l = x[i] if a[i] is 2 and x[i]<w_r: w_r = x[i] if a[i] is 3 and y[i]>h_l: h_l = y[i] if a[i] is 4 and y[i]<h_u: h_u = y[i] ans = (w_r - w_l)*(h_u - h_l) if (w_r - w_l) < 0 or (h_u - h_l) < 0: ans = 0 print(ans)
s350138653
p03943
u713023102
1478489403
Python
Python (2.7.6)
py
Runtime Error
17
2568
332
dat = raw_input() (N,T) = dat.split(" ") N = int(N) T = int(T) dat = raw_input() A = map(int,dat.split(" ")) diffno = 0 mind = A[0] maxd = 0 for x in range(1,len(A)): if maxd < (A[x] - mind): maxd = A[x] - mind diffno = 1 elif maxd == (A[x] - mind): diffno += 1 if mind > A[x]: mind = A[x] print diffno
s338199811
p03943
u253644417
1478488743
Python
Python (3.4.3)
py
Runtime Error
23
3064
310
N, T = list(map(int, input().split())) A = list(map(int, input().split())) benefit = -1 cost = 1 for i in range(N - 1): for j in range(i + 1, N): if benefit == A[j] - A[i]: cost += 1 if benefit < A[j] - A[i]: cost = 1 benefit = A[j] - A[i] print(cost)
s431722012
p03943
u272496669
1478488145
Python
Python (3.4.3)
py
Runtime Error
24
3064
394
list1 = input().split() n = int(list1[0]) t = int(list1[1]) a = input().split() list = [] l = 0 i = 0 while l < n: i = l + 1 if i == n: list.append(int(a[i-1])-int(a[l])) break else: while i < n: if a[i-1]<a[i]: i += 1 else: list.append(int(a[i-1])-int(a[l])) break l += 1 print(list.count(max(list)))
s077181544
p03943
u253644417
1478486849
Python
Python (3.4.3)
py
Runtime Error
23
3064
416
W, H, N = list(map(int, input().split())) min_x = 0 min_y = 0 max_x = W max_y = H for i in range(N): x, y, a = list(map(int, input().split())) if a == 1: min_x = max(min_x, x) if a == 2: max_x = min(max_x, x) if a == 3: min_y = max(min_y, y) if a == 4: max_y = min(max_y, y) ans_W = max(0, (max_x - min_x)) ans_H = max(0, (max_y - min_y)) print(ans_W * ans_H)
s566052710
p03943
u822353071
1478486710
Python
Python (2.7.6)
py
Runtime Error
16
2568
372
# import time # starttime=time.clock() A,B,C =input().split() a=int(A) b=int(B) c=int(C) print(a+c) if a>b: temp = a a = b b = temp if b>c: temp = b b = c c = temp if (a+b)==c: print("Yes") # endtime = time.clock() # print(endtime-starttime) else: print("No") # endtime = time.clock() # print(endtime-starttime) #
s974455306
p03943
u253644417
1478486479
Python
Python (3.4.3)
py
Runtime Error
22
3064
386
W, H, N = list(map(int, input().split())) min_x = 0 min_y = 0 max_x = W max_y = H for i in range(N): x, y, a = list(map(int, input().split())) if a == 1: min_x = max(min_x, x) if a == 2: max_x = min(max_x, x) if a == 3: min_y = max(min_y, y) if a == 4: max_y = min(max_y, y) print(max(0, (max_x - min_x)) * max(0, (max_y - min_y)))
s598510539
p03943
u253644417
1478486148
Python
Python (3.4.3)
py
Runtime Error
23
3064
419
W, H, N = list(map(int, input().split())) min_x = 0 min_y = 0 max_x = W max_y = H for i in range(N): x, y, a = list(map(int, input().split())) if a == 1: min_x = max(min_x, min(max_x, x)) if a == 2: max_x = min(max_x, max(min_x, x)) if a == 3: min_y = max(min_y, min(max_y, y)) if a == 4: max_y = min(max_y, max(min_y, y)) print((max_x - min_x) * (max_y - min_y))
s892653233
p03943
u822353071
1478486023
Python
Python (2.7.6)
py
Runtime Error
16
2568
176
a,b,c = map(int, input().split()) if a>b: temp = a a = b b = temp if b>c: temp = b b = c c = temp if (a+b)==c: print("Yes") else: print("No")
s822743278
p03943
u436484848
1478484892
Python
Python (2.7.6)
py
Runtime Error
16
2568
172
def read(): return [int(i) for i in input().split(' ')] L = read() if(L[0] + L[1] == L[2] or L[0] + L[2] == L[1] or L[1] + L[2] == L[3]): print('Yes') else: print('No')
s185394297
p03943
u436484848
1478484683
Python
Python (3.4.3)
py
Runtime Error
22
3064
172
def read(): return [int(i) for i in input().split(' ')] L = read() if(L[0] + L[1] == L[2] or L[0] + L[2] == L[1] or L[1] + L[2] == L[3]): print('Yes') else: print('No')
s637245997
p03944
u503111914
1599714894
Python
Python (3.8.2)
py
Runtime Error
112
27280
426
import numpy as np W,H,N = map(int, input().split()) X = np.zeros((H,W)) print(X) x1 = 0 x2 = W y1 = 0 y2 = H for i in range(N): x,y,a = map(int,input().split()) if a == 1:#より左黒 x1 = max(x1,x-1) elif a == 2: x2 = min(x2,x-1) elif a == 3:#より下黒 y1 = max(y1,y-1) else: y2 = max(y2,y-1) X[:][::x1] = 1 X[x2:][:] = 1 print(X) #X[y1:][:] = 1 X[y2:][:] = 1 print(X)
s423280422
p03944
u629540524
1599674522
Python
PyPy3 (7.3.0)
py
Runtime Error
89
74808
278
w,h,n = map(int,input().split()) b,c,d,e = 0,w,0,h for i in range(a): 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))
s032237096
p03944
u629540524
1599674461
Python
PyPy3 (7.3.0)
py
Runtime Error
86
74756
278
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))
s775668812
p03944
u629540524
1599674406
Python
PyPy3 (7.3.0)
py
Runtime Error
87
74632
278
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))
s550384321
p03944
u629540524
1599674400
Python
Python (3.8.2)
py
Runtime Error
27
8980
278
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))
s918251852
p03944
u411923565
1599604469
Python
PyPy3 (7.3.0)
py
Runtime Error
84
74828
774
# 63 B - すぬけ君の塗り絵 2 イージー W,H,N = map(int,input().split()) X = [] Y = [] A = [] for _ in range(N): x,y,a = map(int,input().split()) x -= 1;y -= 1 X.append(x) Y.append(y) A.append(a) mtrx = [['.']*W for _ in range(H)] for a,(x,y) in zip(A,zip(X,Y)): if a == 1: for i in range(H): for j in range(x+1): mtrx[i][j] = '#' if a == 2: for i in range(H): for j in range(x+1,W): mtrx[i][j] = '#' if a == 3: for i in range(y+1): mtrx[i] = ['#']*W if a == 4: for i in range(y+1,W): mtrx[i] = ['#']*W ans = 0 for i in range(H): for j in range(W): if mtrx[i][j] == '.': ans += 1 print(ans)
s947703129
p03944
u771405286
1598414111
Python
Python (3.8.2)
py
Runtime Error
27
9132
441
#prepare L = [] Q = [] #input W, H, N, = map(int,raw_input().split()) for i in range(N): L.append(map(int,raw_input().split())) x1=0 x2=W y1=0 y2=H #calculate Q = [row[2] for row in L] for k in range(N): if Q[k] == 1: x1 = max(x1,L[k][0]) elif Q[k] == 2: x2 = min(x2,L[k][0]) elif Q[k] == 3: y1 = max(y1,L[k][1]) elif Q[k] == 4: y2 = min(y2,L[k][1]) print(max(0,x2-x1) * max(0,y2-y1))
s050708619
p03944
u771405286
1598414054
Python
Python (3.8.2)
py
Runtime Error
26
9092
440
#prepare L = [] Q = [] #input W, H, N, = map(int,raw_input().split()) for i in range(N): L.append(map(int,raw_input().split())) x1=0 x2=W y1=0 y2=H #calculate Q = [row[2] for row in L] for k in range(N): if Q[k] == 1: x1 = max(x1,L[k][0]) elif Q[k] == 2: x2 = min(x2,L[k][0]) elif Q[k] == 3: y1 = max(y1,L[k][1]) elif Q[k] == 4: y2 = min(y2,L[k][1]) print max(0,x2-x1) * max(0,y2-y1)
s935799042
p03944
u222668979
1597889517
Python
PyPy3 (7.3.0)
py
Runtime Error
82
74672
330
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, u) print(max(0, r - l) * max(0, t - b))
s658977742
p03944
u481250941
1597509427
Python
Python (3.8.2)
py
Runtime Error
70
16312
1374
# # 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))*max((H-oy), 0)) if __name__ == "__main__": # unittest.main() resolve()
s866291845
p03944
u434966508
1595704368
Python
PyPy3 (7.3.0)
py
Runtime Error
101
74692
288
import numpy as np W,H,N = map(int,input().split()) l = np.zeros((H,W)) for i in range(N): x,y,a = map(int,input().split()) if a==1: l[:,:x] = 1 #print(l[:,x:]) elif a==2: l[:,x:] = 1 elif a==3: l[:y,:] = 1 elif a==4: l[y:,:] = 1 print(H*W-int(l.sum()))
s385966192
p03944
u113255362
1595392990
Python
Python (3.8.2)
py
Runtime Error
25
9060
515
W,H,N=map(int,input().split()) List = [] for i in range (N): List.append(list(map(int, input().split()))) WRange = [0,W] HRange = [0,H] for i in range(N): if List[i][2] == 1: WRange[0] = List[i][0] elif List[i][2] == 2: WRange[1] = List[i][0] elif List[i][2] == 3: HRange[0] = List[i][1] else List[i][2] == 4: HRange[1] = List[i][1] if WRange[1]-WRange[0] >0: W = WRange[1]-WRange[0] else: W = 0 if HRange[1]-HRange[0] >0: H = HRange[1]-HRange[0] else: H = 0 res = H * W print(res)
s363846921
p03944
u351892848
1594687759
Python
PyPy3 (7.3.0)
py
Runtime Error
201
68680
329
import numpy as np W, H, N = map(int, input().split()) area = np.ones((W, H)) for _ in range(N): x, y, a = map(int, input().split()) if a == 1: area[:x, :] = 0 elif a == 2: area[x:, :] = 0 elif a == 3: area[:, :y] = 0 elif a == 4: area[:, y:] = 0 print(int(np.sum(area)))
s227292639
p03944
u786020649
1594442758
Python
Python (3.8.2)
py
Runtime Error
21
8928
592
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,pt[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))
s854513479
p03944
u062999487
1594240794
Python
PyPy3 (7.3.0)
py
Runtime Error
97
74744
340
import numpy as np W,H,N = map(int,input().split()) l = np.zeros((H,W)) # 要素0のH×W配列 for i in range(N): x,y,a = map(int,input().split()) if a==1: l[:,:x] = 1 #print(l[:,x:]) elif a==2: l[:,x:] = 1 elif a==3: l[:y,:] = 1 elif a==4: l[y:,:] = 1 #print(H*W-int(l.sum().sum())) print(H*W-int(l.sum()))
s471213575
p03944
u578580291
1593740940
Python
Python (3.8.2)
py
Runtime Error
25
8976
1266
def p_grid(w, h): for i in range(h): for j in range(w): print(grid[j + w*i], end='') print() def coloring(): line = input() words = line.split() W = int(words[0]) H = int(words[1]) N = int(words[2]) x = 0 y = 0 w = W h = H grid = [] for i in range(h): for j in range(w): grid.append(0) for i in range(N): s = input() ws = s.split() x = int(ws[0]) y = int(ws[1]) a = int(ws[2]) if a == 1 or a==3: #rect = x * y for i in range(y): for j in range(x): grid[j + w * i] = 1 for i in range(h): for j in range(w): print(grid[j + w*i], end='') print() if a == 2: #rect = (w - x) * y for i in range(y): for j in range(x,w): grid[j + w*i] = 1 for i in range(h): for j in range(w): print(grid[j + w*i], end='') print() if a == 4: #rect = x * (h - y) for i in range(y,h): for j in range(x): grid[j + w*i] = 1 for i in range(h): for j in range(w): print(grid[j + w*i], end='') print() print(grid.count(0)) coloring()
s800660580
p03944
u849029577
1593724421
Python
PyPy3 (7.3.0)
py
Runtime Error
96
74760
336
w, h, n = map(int, input().split()) ans_list = [0,0,w,h] for i in range(n): x, y, a = map(int, input().split()) if a == 1: ans_list[0] = x elif a == 2: ans_list[2] = x elif a == 3: ans_list[1] = y else: ans_list[3] = y print(max((ans_list[2]-ans_list[0])*(ans_list[3]-ans_list[1])),0)
s962168423
p03944
u583799976
1593654352
Python
Python (3.8.2)
py
Runtime Error
26
8948
235
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))
s535810614
p03944
u583799976
1593654307
Python
Python (3.8.2)
py
Runtime Error
24
9012
219
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))
s859381452
p03944
u193927973
1593452173
Python
Python (3.8.2)
py
Runtime Error
27
9196
372
W, H, N=map(int, input().split()) hen=[0,W,0,H] for _ in range(N): x, y, a=map(int, input().split()) if a==1: heb[a-1]=max(hen[a-1], x) elif a==2: hen[a-1]=min(hen[a-1], x) elif a==3: hen[a-1]=max(hen[a-1], y) elif a==4: hen[a-1]=min(hen[a-1], y) yoko=hen[1]-hen[0] tate=hen[3]-hen[2] if yoko<0 or tate<0: ans=0 else: ans=yoko*tate print(ans)
s290874693
p03944
u088488125
1593354723
Python
Python (3.8.2)
py
Runtime Error
26
9176
431
w,h,n=map(int, input().split()) x=[] y=[] a=[] for i in range(n): s=map(int, input().split()) x.append(s[0]) y.append(s[1]) a.append(s[2]) x_l=0 x_h=w y_l=0 y_h=h for i in range(n): if a[i]==1: if x_l<x[i]: x_l=x[i] elif a[i]==2: if x_h>x[i]: x_h=x[i] elif a[i]==3: if y_l<y[i]: y_l=y[i] else: if y_h>y[i]: y_h=y[i] s=(x_h-x_l)*(y_h-y_l) if s>0: print(s) else: print("0")
s190369735
p03944
u790012205
1593084050
Python
PyPy3 (7.3.0)
py
Runtime Error
84
74608
571
W, H, N = map(int, input().split()) xya = [list(map(int, input().split())) for _ in range(N)] S = [[1] * W for _ in range(H)] for x, y, a in xya: if a == 1: for i in range(H): for j in range(x): S[i][j] = 0 elif a == 2: for i in range(x, W): for j in range(x, W) S[i][j] = 0 elif a == 3: for i in range(y): for j in range(W): S[i][j] = 0 else: for i in range(y, H): for j in range(W): S[i][j] = 0 print(sum(S))
s149559832
p03944
u790012205
1593083968
Python
Python (3.8.2)
py
Runtime Error
26
8840
571
W, H, N = map(int, input().split()) xya = [list(map(int, input().split())) for _ in range(N)] S = [[1] * W for _ in range(H)] for x, y, a in xya: if a == 1: for i in range(H): for j in range(x): S[i][j] = 0 elif a == 2: for i in range(x, W): for j in range(x, W) S[i][j] = 0 elif a == 3: for i in range(y): for j in range(W): S[i][j] = 0 else: for i in range(y, H): for j in range(W): S[i][j] = 0 print(sum(S))
s821652797
p03944
u046158516
1592529786
Python
PyPy3 (7.3.0)
py
Runtime Error
89
74612
275
w,h,n=map(int,input().split()) x1=0 x2=w y1=0 y2=h for i in range(n): x,y,a=map(int,input().split()) if a==1: x1=max(x1,x) if a==2: x2=min(x2,x) if a==3: y1=max(y1,y) if a==4: y2=min(y2,y) if x2<x1 or y2<y1 print(0) else: print((x2-x1)*(y2-y1))
s067191692
p03944
u627803856
1592253538
Python
PyPy3 (2.4.0)
py
Runtime Error
172
38384
723
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 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))
s222129640
p03944
u871841829
1591911200
Python
Python (3.4.3)
py
Runtime Error
18
3064
705
W, H, N = list(map(int, input().split())) X = [0] * N Y = [0] * N A = [0] * N for _ in range(N): X[_], Y[_], A[_] = list(map(int, input().split())) # print("test") # print(W,H,N) #solve xb = 0 xe = W yb = 0 ye = H for _ in range(N): if A[_] == 1: # Xiより小さいを黒 xb = max(xb, X[_]) elif A[_] == 2: # Xiより大きいを黒 xe = min(xe, X[_]) elif A[_] == 3: # Yiより小さいを黒 yb = max(yb, Y[_]) else: # Yiより大きいを黒 ye = min(ye, [_]) # check if (xe - xb) <= 0 or (ye - yb) <= 0: print(0) import sys sys.exit() ans = (xe - xb) * (ye - yb) print(ans)
s543152192
p03944
u126844573
1591718386
Python
Python (3.4.3)
py
Runtime Error
17
2940
418
w, h, n = map(int, input().split()) ll_x, ll_y, tr_x, tr_y = 0, 0, w, h for q in range(n): x, y, a = map(int, input().split()) if a == 1: ll_x = max(ll_x, x) elif a == 2: tr_x = min(tr_x, x) elif a == 3: ll_y = max(ll_y, y) elif a == 4: tr_y = min(tr_y, y) print(f"({ll_x}, {ll_y}), ({tr_x}, {tr_y})") ans = (tr_x - ll_x) * (tr_y - ll_y) print(ans if ans > 0 else 0)
s769364236
p03944
u378157957
1590896830
Python
Python (3.4.3)
py
Runtime Error
122
3064
744
w, h, n = map(int, input().split()) m = [[1 for i in range(w)] for j in range(h)] for i in range(n): x, y, a = map(int, input().split()) if a == 1: for j in range(h): for i in range(w): if i < x: m[3-j][i] = 0 elif a == 2: for j in range(h): for i in range(w): if i >= x: m[3-j][i] = 0 elif a == 3: for j in range(h): if j < y: for i in range(w): m[3-j][i] = 0 elif a == 4: for j in range(h): if j >= y: for i in range(w): m[3-j][i] = 0 total = 0 for row in m: total += sum(row) print(total)
s617139502
p03944
u366541443
1590763862
Python
PyPy3 (2.4.0)
py
Runtime Error
175
38384
435
w,h,n = list(map(int, input().split())) data = Zeros(h,w) for i in range(n): q = list(map(int, input().split())) a,b,c,d = 0,w,0,h if(q[2]==1): b = q[0] elif(q[2]==2): a = q[0] elif(q[2]==3): d = q[1] elif(q[2]==4): c = q[1] for j in range(a,b): for k in range(c,d): data[k][j]=1 #print(data) print(w*h-sum([sum(data[j]) for j in range(h)]))
s036573421
p03944
u294721290
1590117650
Python
Python (3.4.3)
py
Runtime Error
18
3064
277
w,h,n = map(int,input().split()) ww=hh = 0 for _ in [0]*N: x,y,a = map(int,input().split()) if a == 1: ww = max(ww,x) elif a == 2: w = min(w,x) elif a == 3: hh = max(hh,y) else: h = min(h,y) print((w-ww)*(h-hh)*(w>ww)*(h>hh))
s579092715
p03944
u203669169
1589999588
Python
Python (3.4.3)
py
Runtime Error
18
3064
395
W, H, N = [int(_) for _ in input().split()] xya = [[int(_) for _ in input().split()] for i in range(N)] d = [[0], [W], [0], [H]] for x, y, a in xya: if a == 1 or a == 2: d[a-1] += [x] else: d[a-1] += [y] if (max(d[0]) - min(d[1])) > 0 and (max(d[2]) - min(d[3]) > 0: ret = (max(d[0]) - min(d[1])) * (max(d[2]) - min(d[3])) print(max(ret, 0)) else: print(0)
s397760278
p03944
u103902792
1589814292
Python
Python (3.4.3)
py
Runtime Error
17
3064
294
w,h,n = map(int,input().split()) d = {1:0,2:h,3:0,4:w} for _ in range(n): x,y,a = map(int,input().split()) if a %2: d[a] = max(d[a],[x,y][a//2]) else: d[a] = min(d[a],[x,y][a//2]) if d[1] > d[2] or d[3] > d[4]: print(0) else: ans = (d[2]-d[1]+1) * (d[4]-d[3]+1) print(ans)
s107840970
p03944
u792512290
1589811348
Python
Python (3.4.3)
py
Runtime Error
18
3064
631
w, h, n = map(int, input().split(" ")) grouped_dots = {1: [], 2: [], 3: [], 4: []} for _ in range(n): dot = append(list(map(int, input().split(" ")))) if dot[-1] in (1, 2): grouped_dots[dot[-1]].append(dot[0]) else: grouped_dots[dot[-1]].append(dot[1]) x_min = max(grouped_dots[1]) if len(grouped_dots[1]) > 1 else 0 x_max = min(grouped_dots[2]) if len(grouped_dots[2]) > 1 else w y_min = max(grouped_dots[3]) if len(grouped_dots[3]) > 1 else 0 y_max = min(grouped_dots[4]) if len(grouped_dots[4]) > 1 else h x = 0 if x_max - x_min < 0 else x_max - x_min y = 0 if y_max - y_min < 0 else y_max - y_min print(x * y)
s078711531
p03944
u792512290
1589811104
Python
Python (3.4.3)
py
Runtime Error
18
3064
517
w, h, n = map(int, input().split(" ")) grouped_dots = {1: [], 2: [], 3: [], 4: []} dots = [] for _ in range(n): dots.append(list(map(int, input().split(" ")))) for dot in dots: if dot[-1] in (1, 2): grouped_dots[dot[-1]].append(dot[0]) else: grouped_dots[dot[-1]].append(dot[1]) x_min = max(grouped_dots[1]) x_max = min(grouped_dots[2]) y_min = max(grouped_dots[3]) y_max = min(grouped_dots[4]) x = 0 if x_max - x_min < 0 else x_max - x_min y = 0 if y_max - y_min < 0 else y_max - y_min print(x * y)
s296059458
p03944
u792512290
1589811045
Python
Python (3.4.3)
py
Runtime Error
19
3064
517
w, h, n = map(int, input().split(" ")) grouped_dots = {1: [], 2: [], 3: [], 4: []} dots = [] for _ in range(n): dots.append(list(map(int, input().split(" ")))) for dot in dots: if dot[-1] in (1, 2): grouped_dots[dot[-1]].append(dot[0]) else: grouped_dots[dot[-1]].append(dot[1]) x_min = max(grouped_dots[1]) x_max = min(grouped_dots[2]) y_min = max(grouped_dots[3]) y_max = min(grouped_dots[4]) x = 0 if x_max - x_min < 0 else x_max - x_min y = 0 if y_max - y_min < 0 else y_max - y_min print(x * y)
s152385807
p03944
u792512290
1589810363
Python
Python (3.4.3)
py
Runtime Error
18
3064
484
w, h, n = map(int, input().split(" ")) grouped_dots = {1: [], 2: [], 3: [], 4: []} for _ in range(n): dot = list(map(int, input().split(" "))) if dot[-1] in (1, 2): grouped_dots[dot[-1]].append(dot[0]) else: grouped_dots[dot[-1]].append(dot[1]) x_min = max(grouped_dots[1]) x_max = min(grouped_dots[2]) y_min = max(grouped_dots[3]) y_max = min(grouped_dots[4]) x = 0 if x_max - x_min < 0 else x_max - x_min y = 0 if y_max - y_min < 0 else y_max - y_min print(x * y)
s793015952
p03944
u792512290
1589810326
Python
Python (3.4.3)
py
Runtime Error
18
3064
500
w, h, n = map(int, input().split(" ")) grouped_dots = {1: [], 2: [], 3: [], 4: []} for _ in range(n): dot = list(map(int, input().split(" "))) print(dot) if dot[-1] in (1, 2): grouped_dots[dot[-1]].append(dot[0]) else: grouped_dots[dot[-1]].append(dot[1]) x_min = max(grouped_dots[1]) x_max = min(grouped_dots[2]) y_min = max(grouped_dots[3]) y_max = min(grouped_dots[4]) x = 0 if x_max - x_min < 0 else x_max - x_min y = 0 if y_max - y_min < 0 else y_max - y_min print(x * y)
s631550445
p03944
u792512290
1589810243
Python
Python (3.4.3)
py
Runtime Error
18
3064
493
w, h, n = map(int, input().split(" ")) grouped_dots = {1: [], 2: [], 3: [], 4: []} for _ in range(n): dot = list(map(int, input().split(" "))) print(dot) if dot[-1] in (1, 2): grouped_dots[dot[-1]].append(dot[0]) else: grouped_dots[dot[-1]].append(dot[1]) x_min = max(grouped_dots[1]) x_max = min(grouped_dots[2]) y_min = max(grouped_dots[3]) y_max = min(grouped_dots[4]) x = 0 if x_max - x_min < 0 else x_max - x_min y = 0 if y_max - y_min < 0 else y_max - y_min print(x * y)
s611513998
p03944
u357867755
1589685152
Python
Python (3.4.3)
py
Runtime Error
17
3064
496
w, h, n = map(int, input().split()) lis = [] for i in range(n): lis.append(list(map(int, input().split()))) x=0 y=0 for i in lis: if i[2] == 1: if x < i[0]: x=i[0] elif i[2] == 2: if i[0] < w: w=i[0] elif i[2] == 3: if y < i[1]: y=i[1] else: if i[1] < h: h=i[1] x_a = w-x y_a= h-y if x_a < 0 or y_a < 0: print(0) exit() print(x_a*y_a) if i[1] < y: h=i[1] x_a = w-x y_a= h-y if x_a < 0 or y_a < 0: print(0) exit() print(x_a*y_a)
s055561050
p03944
u156383602
1589594332
Python
Python (3.4.3)
py
Runtime Error
18
3064
287
w,h,n=map(int,input().split()) w1=0 w2=w h1=0 h2=h for i in range(n): a,b,c=map(int,input().split()) if c==1: w1=a elif c==2: w2=a elif c==3: h1=b elif c==4: h2=b if w2<=w1 or h2<=h1: print(0) else: print(max(0,(w2-w1)*(h2-h1))
s125549671
p03944
u379716238
1588995169
Python
Python (3.4.3)
py
Runtime Error
17
3064
397
W, H, N = list(map(int, input().split())) A = [] for _ in range(N): A.append(list(map(int, input().split()))) xmax, xmin, ymax, ymin = W, 0, H, 0 for a in A: if a[2] == 1: xmin = max(xmin, a[0]) if a[2] == 2: xmax = min(xmax, a[0]) if a[2] == 3: ymin = max(ymin, a[1]) if a[2] == 4: ymax = min(ymax, a[1])D S = (xmax-xmin) * (ymax-ymin) if S < 0: S = 0 print(S)
s767874528
p03944
u029000441
1588712798
Python
PyPy3 (2.4.0)
py
Runtime Error
169
38384
188
w,h,n=MI() rect=[0,w,0,h] for i in range(n): a,b,c=MI() if c<=2: rect[c-1]=a else: rect[c-1]=b #print(rect) print(max(0,rect[3]-rect[2])*max(0,rect[1]-rect[0]))
s038806863
p03944
u549161102
1588432984
Python
Python (3.4.3)
py
Runtime Error
17
3064
236
W,H,N = int(input()) p = 0 q = W l = 0 m = H for i in range(N): x,y,a = map(int.split()) if a == 1: p = max(p,x) if a == 2: q = min(q,x) if a == 3: l = max(l,y) if a == 4: m = min(m,y) S = (q-p)*(m-l) print(S)
s252799089
p03944
u549161102
1588432902
Python
Python (3.4.3)
py
Runtime Error
18
3064
244
W,H,N = int(input()) p = 0 q = W l = 0 m = H for i in range(N): x,y,a = map(int.split()) if a == 1: p = max(p,x) if a == 2: q = min(q,x) if a == 3: l = max(l,y) if a == 4: m = min(m,x) S = (q-p)*(l-m) print(S)
s709348876
p03944
u121698457
1588389226
Python
Python (3.4.3)
py
Runtime Error
17
2940
372
W, H, N = map(int,input().split()) p = 0 q = W r = 0 s = H for i in range(N): x, y, a = map(int,input().split()) if a == 1: if x > p: p = x if a == 2: if x < q: q = x if a == 3: if y > r: r = y if a == 4: if y < s: s = y ans = (q-p)*(s-r) if ans < 0 ans = 0 print(ans)
s757183288
p03944
u884323674
1587439094
Python
Python (3.4.3)
py
Runtime Error
18
3064
594
W, H, N = map(int, input().split()) white = [0, W, 0, H] points = [[int(i) for i in input().split()] for j in range(N)] for point in points: if point[2] == 1: if point[0] > white[0]: white[0] = point[0] if point[2] == 2: if point[0] < white[1]: white[1] = point[0] if point[2] == 3: if point[1] > white[2]: white[2] = point[1] if point[2] == 4: if point[1] < white[3]: white[3] = point[1] w = white[1] - white[0] h = white[3] - white[2] if w > 0 and h > 0: print(result) else: print(0)