Problem p03240 (python)

Fixed submission:
N = int(input())
hxy = []
for _ in range(N):
        x,y,h = map(int,input().split())
        hxy.append([h,x,y])
hxy.sort(reverse=True)
xy = [[x,y] for x in range(101) for y in range(101)]
for i in range(len(hxy) - 1):
        h1,x1,y1 = hxy[i]
        for j in range(i + 1,len(hxy)):
                h2,x2,y2 = hxy[j]
                xy_copy = xy.copy()
                if h1 == 0 and h2 == 0:
                        xy.remove([x1,y1])
                        xy.remove([x2,y2])
                        if len(xy) == 1:
                                x,y = xy[0]
                                print(x,' ',y,' ',h1 + abs(x - x1) + abs(y - y1))
                                exit()
                        continue
                elif h1 == 0:
                        for x,y in xy_copy:
                                if abs(x - x2) + abs(y - y2) - abs(x - x1) - abs(y - y1) + h2 > 0:
                                        xy.remove([x,y])
                        if len(xy) == 1:
                                x,y = xy[0]
                                print(x,' ',y,' ',h1 + abs(x - x1) + abs(y - y1))
                                exit()
                        continue
                elif h2 == 0:
                        for x,y in xy_copy:
                                if abs(x - x1) + abs(y - y1) - abs(x - x2) - abs(y - y2)  + h1 > 0:
                                        xy.remove([x,y])
                        if len(xy) == 1:
                                x,y = xy[0]
                                print(x,' ',y,' ',h1 + abs(x - x1) + abs(y - y1))
                                exit()
                        continue
                

                for x,y in xy_copy:
                        if abs(x - x1) + abs(y - y1) - abs(x - x2) - abs(y - y2) != h2 - h1:
                                xy.remove([x,y])
                if len(xy) == 1:
                        x,y = xy[0]
                        print(x,' ',y,' ',h1 + abs(x - x1) + abs(y - y1))
                        exit()

Buggy submission (verdict: Runtime Error):
N = int(input())
hxy = []
for _ in range(N):
        x,y,h = map(int,input().split())
        hxy.append([h,x,y])
hxy.sort(reverse=True)
xy = [[x,y] for x in range(101) for y in range(101)]
for i in range(len(hxy) - 1):
        h1,x1,y1 = hxy[i]
        for j in range(i + 1,len(hxy)):
                h2,x2,y2 = hxy[j]
                xy_copy = xy.copy()
                if h1 == 0 and h2 == 0:
                        xy.remove([x1,y1])
                        xy.remove([x2,y2])
                        continue
                elif h1 == 0:
                        for x,y in xy_copy:
                                if abs(x - x2) + abs(y - y2) - abs(x - x1) - abs(y - y1) + h2 > 0:
                                        xy.remove([x,y])
                                        if len(xy) == 1:
                                                x,y = xy[0]
                                                print(x,' ',y,' ',h1 + abs(x - x1) + abs(y - y1))
                                                exit()
                                        continue
                elif h2 == 0:
                        for x,y in xy_copy:
                                if abs(x - x1) + abs(y - y1) - abs(x - x2) - abs(y - y2)  + h1 > 0:
                                        xy.remove[x,y]
                                        if len(xy) == 1:
                                                x,y = xy[0]
                                                print(x,' ',y,' ',h1 + abs(x - x1) + abs(y - y1))
                                                exit()
                                        continue
                

                for x,y in xy_copy:
                        if abs(x - x1) + abs(y - y1) - abs(x - x2) - abs(y - y2) != h2 - h1:
                                xy.remove([x,y])
                if len(xy) == 1:
                        x,y = xy[0]
                        print(x,' ',y,' ',h1 + abs(x - x1) + abs(y - y1))
                        exit()

Buggy submission (verdict: Runtime Error):
N = int(input())
hxy = []
for _ in range(N):
        x,y,h = map(int,input().split())
        hxy.append([h,x,y])
hxy.sort(reverse=True)
xy = [[x,y] for x in range(101) for y in range(101)]
for i in range(len(hxy) - 1):
        h1,x1,y1 = hxy[i]
        for j in range(i + 1,len(hxy)):
                h2,x2,y2 = hxy[j]
                xy_copy = xy.copy()
                if h1 == 0 and h2 == 0:
                        xy.remove([x1,y1])
                        xy.remove([x2,y2])
                        continue
                elif h1 == 0:
                        for x,y in xy_copy:
                                if abs(x - x2) + abs(y - y2) - abs(x - x1) - abs(y - y1) + h2 > 0:
                                        xy.remove([x,y])
                                        continue
                elif h2 == 0:
                        for x,y in xy_copy:
                                if abs(x - x1) + abs(y - y1) - abs(x - x2) - abs(y - y2)  + h1 > 0:
                                        xy.remove[x,y]
                                        continue
                

                for x,y in xy_copy:
                        if abs(x - x1) + abs(y - y1) - abs(x - x2) - abs(y - y2) != h2 - h1:
                                xy.remove([x,y])
                if len(xy) == 1:
                        x,y = xy[0]
                        print(x,' ',y,' ',h1 + abs(x - x1) + abs(y - y1))
                        exit()

Buggy submission (verdict: Runtime Error):
N = int(input())
hxy = []
for _ in range(N):
        x,y,h = map(int,input().split())
        hxy.append([h,x,y])
hxy.sort(reverse=True)
xy = [[x,y] for x in range(101) for y in range(101)]
for i in range(len(hxy) - 1):
        h1,x1,y1 = hxy[i]
        for j in range(i + 1,len(hxy)):
                h2,x2,y2 = hxy[j]
                xy_copy = xy.copy()
                if h1 == 0 or h2 == 0:
                        if h1 == 0:
                                for x,y in xy_copy:
                                        if h1 + abs(x - x1) + abs(y - y1) > 0:
                                                xy.remove[x,y]
                        xy_copy = xy.copy()
                        if h2 == 0:
                                for x,y in xy_copy:
                                        if h2 + abs(x - x2) + abs(y - y2) > 0:
                                                xy.remove[x,y]
                        if len(xy) == 1:
                                x,y = xy[0]
                                print(x,' ',y,' ',h1 + abs(x - x1) + abs(y - y1))
                                exit()
                        continue

                for x,y in xy_copy:
                        if abs(x - x1) + abs(y - y1) - abs(x - x2) - abs(y - y2) != h2 - h1:
                                xy.remove([x,y])
                if len(xy) == 1:
                        x,y = xy[0]
                        print(x,' ',y,' ',h1 + abs(x - x1) + abs(y - y1))
                        exit()

Buggy submission (verdict: Runtime Error):
N = int(input())
hxy = []
for _ in range(N):
        x,y,h = map(int,input().split())
        hxy.append([h,x,y])
hxy.sort(reverse=True)
xy = [[x,y] for x in range(101) for y in range(101)]
for i in range(len(hxy) - 1):
        h1,x1,y1 = hxy[i]
        for j in range(i + 1,len(hxy)):
                h2,x2,y2 = hxy[j]
                xy_copy = xy.copy()
                if h1 == 0 or h2 == 0:
                        if h1 == 0:
                                for x,y in xy_copy:
                                        if h1 + abs(x - x1) + abs(y - y1) > 0:
                                                xy.remove[x,y]
                        xy_copy = xy.copy()
                        if h2 == 0:
                                for x,y in xy_copy:
                                        if h2 + abs(x - x2) + abs(y - y2) > 0:
                                                xy.remove[x,y]
                        continue

                for x,y in xy_copy:
                        if abs(x - x1) + abs(y - y1) - abs(x - x2) - abs(y - y2) != h2 - h1:
                                xy.remove([x,y])
                if len(xy) == 1:
                        x,y = xy[0]
                        print(x,' ',y,' ',h1 + abs(x - x1) + abs(y - y1))
                        exit()

Buggy submission (verdict: Runtime Error):
N = int(input())
hxy = []
hxy2 = []
for _ in range(N):
	x,y,h = map(int,input().split())
	if h == 0:
		hxy2.append([h,x,y])
		continue
	hxy.append([h,x,y])
hxy.sort(reverse=True)
xy = [[x,y] for x in range(101) for y in range(101)]
for i in range(len(hxy) - 1):
	h1,x1,y1 = hxy[i]
	for j in range(i + 1,len(hxy)):
		h2,x2,y2 = hxy[j]
		xy_copy = xy.copy()
		for x,y in xy_copy:
			if abs(x - x1) + abs(y - y1) - abs(x - x2) - abs(y - y2) != h2 - h1:
				xy.remove([x,y])
		if len(xy) == 1:
			x,y = xy[0]
			print(x,' ',y,' ',h1 + abs(x - x1) + abs(y - y1))
			exit()
for x,y in xy:
	for h1,x1,y1 in hxy2:
		if h1 + abs(x - x1) + abs(y - y1) - abs(x - x1) - abs(y - y1) >= 0:
			xy.remove([x,y])
	if len(xy) == 1:
			x,y = xy[0]
			print(x,' ',y,' ',h1 + abs(x - x1) + abs(y - y1))
			exit()