Buggy python submission (verdict: Time Limit Exceeded):
N, W, H = [int(x) for x in input().split()]

map_x = [False] * W
map_y = [False] * H

for _ in range(N):
    x, y, r = [int(x) for x in input().split()]

    for a in [b for b in range(x - r, x + r) if 0 <= b < W]:
        map_x[a] = True

    for a in [b for b in range(y - r, y + r) if 0 <= b < H]:
        map_y[a] = True

ans = False
for x in map_x:
    if not x:
        break
else:
    ans = True

for x in map_y:
    if not x:
        break
else:
    ans = True

print('Yes' if ans else 'No')

Fixed submission:
N, W, H = [int(x) for x in input().split()]

map_x = [0] * W
map_y = [0] * H

for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    mx = max(0, x - w)
    map_x[mx] = max(map_x[mx], x + w - mx)
    my = max(0, y - w)
    map_y[my] = max(map_y[my], y + w - my)


def check_wifi(wifi):
    m = 0
    end = len(wifi)

    for i, x in enumerate(wifi):
        if x and i + x > m:
            m = i + x

        if m >= end:
            return True

        if i < m:
            continue

        return False

    return False


print('Yes' if check_wifi(map_x) or check_wifi(map_y) else 'No')

Buggy python submission (verdict: Time Limit Exceeded):
N, W, H = [int(x) for x in input().split()]

map_x = [False] * W
count_x = 0
map_y = [False] * H
count_y = 0

for _ in range(N):
    x, y, r = [int(x) for x in input().split()]

    for a in [b for b in range(x - r, x + r) if 0 <= b < W]:
        if not map_x[a]:
            map_x[a] = True
            count_x += 1

    if count_x >= W:
        break

    for a in [b for b in range(y - r, y + r) if 0 <= b < H]:
        if not map_y[a]:
            map_y[a] = True
            count_y += 1

    if count_y >= H:
        break

print('Yes' if count_x >= W or count_y >= H else 'No')

Fixed submission:
N, W, H = [int(x) for x in input().split()]

map_x = [0] * W
map_y = [0] * H

for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    mx = max(0, x - w)
    map_x[mx] = max(map_x[mx], x + w - mx)
    my = max(0, y - w)
    map_y[my] = max(map_y[my], y + w - my)


def check_wifi(wifi):
    m = 0
    end = len(wifi)

    for i, x in enumerate(wifi):
        if x and i + x > m:
            m = i + x

        if m >= end:
            return True

        if i < m:
            continue

        return False

    return False


print('Yes' if check_wifi(map_x) or check_wifi(map_y) else 'No')

Buggy python submission (verdict: Time Limit Exceeded):
N, W, H = [int(x) for x in input().split()]

map_x = [False] * W
count_x = 0
map_y = [False] * H
count_y = 0

for _ in range(N):
    x, y, r = [int(x) for x in input().split()]

    for a in [b for b in range(x - r, x + r) if 0 <= b < W and not map_x[b]]:
        map_x[a] = True
        count_x += 1

    if count_x >= W:
        break

    for a in [b for b in range(y - r, y + r) if 0 <= b < H and not map_y[b]]:
        map_y[a] = True
        count_y += 1

    if count_y >= H:
        break

print('Yes' if count_x >= W or count_y >= H else 'No')

Fixed submission:
N, W, H = [int(x) for x in input().split()]

map_x = [0] * W
map_y = [0] * H

for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    mx = max(0, x - w)
    map_x[mx] = max(map_x[mx], x + w - mx)
    my = max(0, y - w)
    map_y[my] = max(map_y[my], y + w - my)


def check_wifi(wifi):
    m = 0
    end = len(wifi)

    for i, x in enumerate(wifi):
        if x and i + x > m:
            m = i + x

        if m >= end:
            return True

        if i < m:
            continue

        return False

    return False


print('Yes' if check_wifi(map_x) or check_wifi(map_y) else 'No')

Buggy python submission (verdict: Time Limit Exceeded):
N, W, H = [int(x) for x in input().split()]

map_x = [False] * W
count_x = 0
map_y = [False] * H
count_y = 0

wifi = []
for _ in range(N):
    w = [int(x) for x in input().split()]
    wifi.append(w)


def check_x(l):
    for x, _, r in wifi:
        if x - r <= l < x + r:
            return True

    return False


def check_y(l):
    for _, y, r in wifi:
        if y - r <= l < y + r:
            return True

    return False


ans_x = True
for x in range(W):
    if not check_x(x):
        ans_x = False
        break

if not ans_x:
    for y in range(H):
        if not check_y(y):
            print('No')
            exit()

print('Yes')

Fixed submission:
N, W, H = [int(x) for x in input().split()]

map_x = [0] * W
map_y = [0] * H

for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    mx = max(0, x - w)
    map_x[mx] = max(map_x[mx], x + w - mx)
    my = max(0, y - w)
    map_y[my] = max(map_y[my], y + w - my)


def check_wifi(wifi):
    m = 0
    end = len(wifi)

    for i, x in enumerate(wifi):
        if x and i + x > m:
            m = i + x

        if m >= end:
            return True

        if i < m:
            continue

        return False

    return False


print('Yes' if check_wifi(map_x) or check_wifi(map_y) else 'No')

Buggy python submission (verdict: Time Limit Exceeded):
N, W, H = [int(x) for x in input().split()]

map_x = [False] * W
count_x = 0
map_y = [False] * H
count_y = 0

wifi = []
for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    wifi.append((x - w, x + w, y - w, y + w))


def check_x(l):
    for x1, x2, _, _ in wifi:
        if x1 <= l < x2:
            return True
    return False


def check_y(l):
    for _, _, y1, y2 in wifi:
        if y1 <= l < y2:
            return True
    return False


ans_x = True
for x in range(W):
    if not check_x(x):
        ans_x = False
        break

if not ans_x:
    for y in range(H):
        if not check_y(y):
            print('No')
            exit()

print('Yes')

Fixed submission:
N, W, H = [int(x) for x in input().split()]

map_x = [0] * W
map_y = [0] * H

for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    mx = max(0, x - w)
    map_x[mx] = max(map_x[mx], x + w - mx)
    my = max(0, y - w)
    map_y[my] = max(map_y[my], y + w - my)


def check_wifi(wifi):
    m = 0
    end = len(wifi)

    for i, x in enumerate(wifi):
        if x and i + x > m:
            m = i + x

        if m >= end:
            return True

        if i < m:
            continue

        return False

    return False


print('Yes' if check_wifi(map_x) or check_wifi(map_y) else 'No')

Buggy python submission (verdict: Time Limit Exceeded):
N, W, H = [int(x) for x in input().split()]

map_x = [False] * W
count_x = 0
map_y = [False] * H
count_y = 0

wifi_x = []
wifi_y = []
for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    wifi_x.append((x - w, x + w))
    wifi_y.append((y - w, y + w))


def check_x(l):
    for x1, x2 in wifi_x:
        if x1 <= l < x2:
            return True
    return False


def check_y(l):
    for y1, y2 in wifi_y:
        if y1 <= l < y2:
            return True
    return False


ans_x = True
for x in range(W):
    if not check_x(x):
        ans_x = False
        break

if not ans_x:
    for y in range(H):
        if not check_y(y):
            print('No')
            exit()

print('Yes')

Fixed submission:
N, W, H = [int(x) for x in input().split()]

map_x = [0] * W
map_y = [0] * H

for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    mx = max(0, x - w)
    map_x[mx] = max(map_x[mx], x + w - mx)
    my = max(0, y - w)
    map_y[my] = max(map_y[my], y + w - my)


def check_wifi(wifi):
    m = 0
    end = len(wifi)

    for i, x in enumerate(wifi):
        if x and i + x > m:
            m = i + x

        if m >= end:
            return True

        if i < m:
            continue

        return False

    return False


print('Yes' if check_wifi(map_x) or check_wifi(map_y) else 'No')

Buggy python submission (verdict: Runtime Error):
test_file = open('C:\\Users\\nanashi\Downloads\\2600-in21.txt')

input = lambda: test_file.readline().rstrip()


N, W, H = [int(x) for x in input().split()]

map_x = [False] * W
count_x = 0
map_y = [False] * H
count_y = 0

wifi_x = []
wifi_y = []
for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    wifi_x.append((x - w, x + w))
    wifi_y.append((y - w, y + w))
wifi_x.sort(key=lambda a: a[1], reverse=True)
wifi_y.sort(key=lambda a: a[1], reverse=True)


def check_wifi(wifi, l):
    for x1, x2 in wifi:
        if x1 <= l < x2:
            return x2
    return None


ans_x = True
b = 0
for x in range(W):
    if x < b:
        continue

    b = check_wifi(wifi_x, x)
    if not b:
        ans_x = False
        break

if not ans_x:
    b = 0
    for y in range(H):
        if y < b:
            continue

        b = check_wifi(wifi_y, y)
        if not b:
            print('No')
            exit()

print('Yes')

Fixed submission:
N, W, H = [int(x) for x in input().split()]

map_x = [0] * W
map_y = [0] * H

for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    mx = max(0, x - w)
    map_x[mx] = max(map_x[mx], x + w - mx)
    my = max(0, y - w)
    map_y[my] = max(map_y[my], y + w - my)


def check_wifi(wifi):
    m = 0
    end = len(wifi)

    for i, x in enumerate(wifi):
        if x and i + x > m:
            m = i + x

        if m >= end:
            return True

        if i < m:
            continue

        return False

    return False


print('Yes' if check_wifi(map_x) or check_wifi(map_y) else 'No')

Buggy python submission (verdict: Time Limit Exceeded):
N, W, H = [int(x) for x in input().split()]

map_x = [False] * W
count_x = 0
map_y = [False] * H
count_y = 0

wifi_x = []
wifi_y = []
for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    wifi_x.append((x - w, x + w))
    wifi_y.append((y - w, y + w))
wifi_x.sort(key=lambda a: a[1], reverse=True)
wifi_y.sort(key=lambda a: a[1], reverse=True)


def check_wifi(wifi, l):
    for x1, x2 in wifi:
        if x1 <= l < x2:
            return x2
    return None


ans_x = True
b = 0
for x in range(W):
    if x < b:
        continue

    b = check_wifi(wifi_x, x)
    if not b:
        ans_x = False
        break

if not ans_x:
    b = 0
    for y in range(H):
        if y < b:
            continue

        b = check_wifi(wifi_y, y)
        if not b:
            print('No')
            exit()

print('Yes')

Fixed submission:
N, W, H = [int(x) for x in input().split()]

map_x = [0] * W
map_y = [0] * H

for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    mx = max(0, x - w)
    map_x[mx] = max(map_x[mx], x + w - mx)
    my = max(0, y - w)
    map_y[my] = max(map_y[my], y + w - my)


def check_wifi(wifi):
    m = 0
    end = len(wifi)

    for i, x in enumerate(wifi):
        if x and i + x > m:
            m = i + x

        if m >= end:
            return True

        if i < m:
            continue

        return False

    return False


print('Yes' if check_wifi(map_x) or check_wifi(map_y) else 'No')