Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

dp = [float('inf')] * (1 << N)
dp[0] = 0

u = 1 << N
for i in range(M):
    a, b = map(int, input().split())
    c = sum(1 << (x - 1) for x in map(int, input().split()))

    for j in range(u):
        dp[c | j] = min(dp[c | j], dp[j] + a)


if dp[-1] != float('inf'):
    print(dp[-1])
else:
    print(-1)


Fixed submission:
N, M = map(int, input().split())

dp = [float('inf')] * (1 << N)
dp[0] = 0

u = 1 << N
for i in range(M):
    a, b = map(int, input().split())
    c = sum(1 << (x - 1) for x in map(int, input().split()))

    for j in range(u):
        dp[c | j] = min(dp[c | j], dp[j] + a)


if dp[-1] != float('inf'):
    print(dp[-1])
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())

print(int((N * (N - 1)) // 2))

Fixed submission:
S = input()
T = input()


cnt = 0
for i in range(3):
    if S[i] == T[i]:
        cnt += 1

print(cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())

print(int((N * (N - 1)) / 2))


Fixed submission:
S = input()
T = input()


cnt = 0
for i in range(3):
    if S[i] == T[i]:
        cnt += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

c = 0
for i in range(1, N):
    c += i

print(c)


Fixed submission:
N = int(input())
print(N * (N - 1) // 2)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
import itertools

N = int(input())
moji = [input() for _ in range(N)]

check = [[0] * N for _ in range(N)]


cnt = 0
for i in range(N):
    c = []
    x = collections.Counter(moji[i])

    c.append(i)

    for j in range(i + 1, N):
        if check[i][j] == 1:
            continue

        y = collections.Counter(moji[j])

        if x == y:
            c.append(j)

    if len(c) > 1:
        for u, v in itertools.combinations(c, 2):
            check[u][v] = 1
            cnt += 1

print(cnt)


Fixed submission:
N = int(input())
moji_lst = [input() for _ in range(N)]

dic = {}
cnt = 0

for moji in moji_lst:
    x = ''.join(sorted(moji))

    if x in dic:
        dic[x] += 1
        cnt += dic[x]
    else:
        dic[x] = 0


print(cnt)

Buggy python submission (verdict: Runtime Error):
import collections
import numpy as np
import itertools

N = int(input())

moji = [input() for _ in range(N)]

check = np.zeros((N, N))


for i in range(N):
    c = []
    x = collections.Counter(moji[i])

    c.append(i)

    for j in range(i + 1, N):
        if check[i, j] == 1:
            continue

        y = collections.Counter(moji[j])

        if x == y:
            c.append(j)

    for v in itertools.combinations(c, 2):
        check[v] = 1

print(int(np.sum(check)))


Fixed submission:
N = int(input())
moji_lst = [input() for _ in range(N)]

dic = {}
cnt = 0

for moji in moji_lst:
    x = ''.join(sorted(moji))

    if x in dic:
        dic[x] += 1
        cnt += dic[x]
    else:
        dic[x] = 0


print(cnt)

Buggy python submission (verdict: Runtime Error):
import collections
import numpy as np
# import math
import itertools

N = int(input())

moji = [input() for _ in range(N)]

check = np.zeros((N, N))


for i in range(N):
    c = []
    x = collections.Counter(moji[i])

    c.append(i)

    for j in range(i + 1, N):
        if check[i, j] == 1:
            continue

        y = collections.Counter(moji[j])

        if x == y:
            c.append(j)

    for v in itertools.combinations(c, 2):
        check[v] = 1

# print(check)
print(int(np.sum(check)))

Fixed submission:
N = int(input())
moji_lst = [input() for _ in range(N)]

dic = {}
cnt = 0

for moji in moji_lst:
    x = ''.join(sorted(moji))

    if x in dic:
        dic[x] += 1
        cnt += dic[x]
    else:
        dic[x] = 0


print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heapify, heappop, heappush

N, M = map(int, input().split())

lst = [list(map(int, input().split())) for s in range(N)]
lst = sorted(lst, key=lambda x: (x[0], -x[1]))

heap = []
heapify(heap)
r = 0
for i in range(1, M + 1):
    # i日後
    while lst and lst[0][0] <= i:
        v = lst.pop(0)[1]
        heappush(heap, -v)

    if len(heap) != 0:
        r += heappop(heap) * (-1)

print(r)

Fixed submission:
from heapq import heapify, heappop, heappush
from collections import defaultdict

N, M = map(int, input().split())

lst = [list(map(int, input().split())) for s in range(N)]

dic = defaultdict(list)
for a, b in lst:
    dic[a].append(b)

heap = []
heapify(heap)

r = 0
for i in range(1, M + 1):
    can = dic[i]
    while can:
        heappush(heap, -can.pop(0))

    if len(heap) != 0:
        r += heappop(heap) * (-1)

print(r)
Buggy python submission (verdict: Runtime Error):
x = 1000000007

S = input()
S = [int(s) if s != '?' else s for s in S]
S = S[::-1]

dp = [[0 for j in range(13)] for i in range(len(S) + 1)]

dp[0][0] = 1

for i, s in enumerate(S):
    for j in range(10):
        if s != '?' and s != j:
            continue

        digit_r = ((10 ** i) * j) % 13

        for k in range(13):
            r = (digit_r + k) % 13
            dp[i + 1][r] += dp[i][k]

    dp[i + 1][r] %= x

print(int(dp[-1][5] % x))


Fixed submission:
A, B = map(int, input().split())

K = (A + B) / 2

if int(K) == K:
    print(int(K))
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
import numpy as np

x = 1000000007

S = input()
S = [int(s) if s != '?' else s for s in S]
S = S[::-1]

r = np.zeros((13,))
new_r = np.zeros((13,))

r[0] = 1

for i, s in enumerate(S):
    for j in range(10):
        if s != '?' and s != j:
            continue

        digit_r = ((10 ** i) * j) % 13

        for k in range(13):
            new_r[(digit_r + k) % 13] += r[k]

    new_r %= x

    r = new_r
    new_r = np.zeros((13,))

print(int(r[5] % x))


Fixed submission:
A, B = map(int, input().split())

K = (A + B) / 2

if int(K) == K:
    print(int(K))
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
arr = np.array([int(input()) for _ in range(n)])

a_max = arr.max()

idx = np.where(arr == a_max)[0]

if len(idx) > 1:
    for i in range(n):
        print(a_max)

    exit()

not_arr = arr[arr != a_max]

if len(not_arr) != 0:
    b_max = not_arr.max()

for i in range(n):
    if i in idx:
        print(b_max)
    else:
        print(a_max)

Fixed submission:
import numpy as np

n = int(input())
arr = np.array([int(input()) for _ in range(n)])

a_max = arr.max()

idx = np.where(arr == a_max)[0]

if len(idx) > 1:
    for i in range(n):
        print(a_max)

    exit()

not_arr = arr[arr != a_max]

b_max = not_arr.max()

t = idx[0]
for i in range(n):
    if i == t:
        print(b_max)
    else:
        print(a_max)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
arr = np.array([int(input()) for _ in range(n)])

a_max = arr.max()

idx = np.where(arr == a_max)[0]

not_arr = arr[arr != a_max]

if len(not_arr) != 0:
    b_max = not_arr.max()

if len(idx) > 1:
    for i in range(n):
        print(a_max)
else:
    for i in range(n):
        if i in idx:
            print(b_max)
        else:
            print(a_max)


Fixed submission:
import numpy as np

n = int(input())
arr = np.array([int(input()) for _ in range(n)])

a_max = arr.max()

idx = np.where(arr == a_max)[0]

if len(idx) > 1:
    for i in range(n):
        print(a_max)

    exit()

not_arr = arr[arr != a_max]

b_max = not_arr.max()

t = idx[0]
for i in range(n):
    if i == t:
        print(b_max)
    else:
        print(a_max)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))

B = np.array([0] * N)

for idx in range(N, 0, -1):
    a = A[idx - 1]

    q = N // idx

    target = [idx * i - 1 for i in range(2, q + 1)]
    r = sum(B[target]) % 2

    if a == 0:
        if r == 1:
            B[idx - 1] = 1
        else:
            B[idx - 1] = 0
    else:
        if r == 1:
            B[idx - 1] = 0
        else:
            B[idx - 1] = 1

g = sum(B)
print(g)

if g != 0:
    print(*list(np.where(B == 1)[0] + 1))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

B = [0] * N

out = []
for idx in range(N, 0, -1):
    a = A[idx - 1]

    q = N // idx

    cnt = 0
    for j in range(2, q + 1):
        if B[idx * j - 1] == 1:
            cnt += 1

    r = cnt % 2

    if a == 0:
        if r == 1:
            B[idx - 1] = 1
            out.append(idx)
        else:
            B[idx - 1] = 0
    else:
        if r == 1:
            B[idx - 1] = 0
        else:
            B[idx - 1] = 1
            out.append(idx)

g = sum(B)
print(g)

if g != 0:
    print(*out)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))

B = np.array([0] * N)

for n in range(N):
    idx = N - n

    a = A[idx - 1]

    q = N // idx

    target = [idx * i - 1 for i in range(2, q + 1)]
    r = sum(B[target]) % 2

    if a == 0:
        if r == 1:
            B[idx - 1] = 1
        else:
            B[idx - 1] = 0
    else:
        if r == 1:
            B[idx - 1] = 0
        else:
            B[idx - 1] = 1

g = sum(B)
print(g)

if g != 0:
    print(*list(np.where(B == 1)[0] + 1))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

B = [0] * N

out = []
for idx in range(N, 0, -1):
    a = A[idx - 1]

    q = N // idx

    cnt = 0
    for j in range(2, q + 1):
        if B[idx * j - 1] == 1:
            cnt += 1

    r = cnt % 2

    if a == 0:
        if r == 1:
            B[idx - 1] = 1
            out.append(idx)
        else:
            B[idx - 1] = 0
    else:
        if r == 1:
            B[idx - 1] = 0
        else:
            B[idx - 1] = 1
            out.append(idx)

g = sum(B)
print(g)

if g != 0:
    print(*out)
Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())

all_mod =[]

cnt1 = 0
for i in range(l, r, 1):
    cnt = 0
    for j in range(l + 1, r + 1, 1):
        mod = (i * j) % 2019
        all_mod.append(mod)

        cnt += 1

        if cnt > 2019:
            break

    cnt1 += 1
    if cnt1 > 2019:
        break

print(min(all_mod))

Fixed submission:
x, y, z = input().split()

n = int(x)
a = int(y)
b = int(z)

sum = n * a
print(min(sum, b))

Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())

all_mod =[]

cnt1 = 0
for i in range(l, r, 1):
    cnt = 0
    for j in range(l + 1, r + 1, 1):
        mod = (i * j) % 2019
        all_mod.append(mod)

        cnt += 1

        if cnt > 2019:
            break

    cnt1 += 1
    if cnt1 > 2019:
        break

print(min(all_mod))


Fixed submission:
x, y, z = input().split()

n = int(x)
a = int(y)
b = int(z)

sum = n * a
print(min(sum, b))
Buggy python submission (verdict: Time Limit Exceeded):
l, r = map(int, input().split())

all_mod = []

for i in range(l, r, 1):
    cnt = 0
    for j in range(l + 1, r + 1, 1):
        mod = (i * j) % 2019
        all_mod.append(mod)

        cnt += 1

        if cnt > 2019:
            break
            
print(min(all_mod))

Fixed submission:
l, r = map(int, input().split())


all_mod = []

cnt1 = 0
for i in range(l, r, 1):
    cnt = 0
    for j in range(l + 1, r + 1, 1):
        mod = (i * j) % 2019

        all_mod.append(mod)

        if mod == 0:
            break

        cnt += 1

        if cnt > 2019:
            break

    if mod == 0:
        break

    cnt1 += 1
    if cnt1 > 2019:
        break

print(min(all_mod))

Buggy python submission (verdict: Time Limit Exceeded):
x, y = input().split()

l = int(x)
r = int(y)

all_mod = []

for i in range(l, r, 1): # l <= i < r - 1

    for j in range(l + 1, r + 1, 1):

        p = i * j
        mod = p % 2019
        all_mod.append(mod)


print(min(all_mod))

Fixed submission:
l, r = map(int, input().split())


all_mod = []

cnt1 = 0
for i in range(l, r, 1):
    cnt = 0
    for j in range(l + 1, r + 1, 1):
        mod = (i * j) % 2019

        all_mod.append(mod)

        if mod == 0:
            break

        cnt += 1

        if cnt > 2019:
            break

    if mod == 0:
        break

    cnt1 += 1
    if cnt1 > 2019:
        break

print(min(all_mod))
Buggy python submission (verdict: Runtime Error):
from numpy.linalg import inv
from numpy import zeros, dot

n = int(input())

x = input().split(' ')

a = [int(v) for v in x]

Z = zeros((n, n))

for i in range(n):
    Z[i, i:i + 1] = 0.5

Z[0, 1] = 0
Z[0, n - 1] = 0.5

N = dot(inv(Z), a).astype('int')

N = [str(p) for p in N]

print(' '.join(N))

Fixed submission:
n = int(input())
x = input().split(' ')
a = [int(v) for v in x]

ret_lst = []

S = sum(a)

a_even = a[1::2]

m1 = S - 2 * sum(a_even)
ret_lst.append(m1)

for i in range(1, n):
    next_m = 2 * a[i - 1] - ret_lst[-1]

    ret_lst.append(next_m)

N = [str(n) for n in ret_lst]

print(' '.join(N))
Buggy python submission (verdict: Runtime Error):
from fractions import gcd

a, b, c, d = map(int, input().split())


def cnt_div(a, b, x):
    q, r = divmod(a, x)

    if r == 0:
        m = q - 1
    else:
        m = q

    n = b // x

    return n - m


num_c = cnt_div(a, b, c)
num_d = cnt_div(a, b, d)
lcm = int((c * d) / gcd(c, d))
num_c_d_gcd = cnt_div(a, b, lcm)

print((b - a + 1) - (num_c + num_d - num_c_d_gcd))


Fixed submission:
S = input()

l = len(S)

for i in range(1, l):
    if S[i - 1] == S[i]:
        print("Bad")
        break
    else:
        if i == l - 1:
            print("Good")
            break
        else:
            continue
Buggy python submission (verdict: Runtime Error):
from math import gcd

a, b, c, d = map(int, input().split())


def cnt_div(a, b, x):
    q, r = divmod(a, x)

    if r == 0:
        m = q - 1
    else:
        m = q

    n = b // x

    return n - m


num_c = cnt_div(a, b, c)
num_d = cnt_div(a, b, d)
lcm = int((c * d) / gcd(c, d))
num_c_d_gcd = cnt_div(a, b, lcm)

print((b - a + 1) - (num_c + num_d - num_c_d_gcd))


Fixed submission:
from fractions import gcd

a, b, c, d = map(int, input().split())


def cnt_div(a, b, x):
    q, r = divmod(a, x)

    if r == 0:
        m = q - 1
    else:
        m = q

    n = b // x

    return n - m


num_c = cnt_div(a, b, c)
num_d = cnt_div(a, b, d)
lcm = int((c * d) / gcd(c, d))
num_c_d_gcd = cnt_div(a, b, lcm)

print((b - a + 1) - (num_c + num_d - num_c_d_gcd))
Buggy python submission (verdict: Runtime Error):
H = [0] + H
cnt = 0
for i in range(1, N + 1):
    cnt += max(H[i] - H[i - 1], 0)


print(cnt)


Fixed submission:
N = int(input())
H = list(map(int, input().split()))

ans = 0
zero = 0

for h in H:
    if h == 0:
        zero += 1

while zero < N:
    flg = False
    cnt = 0

    for i in range(N):
        if H[i] > 0:
            flg = True
            H[i] -= 1

            if H[i] == 0:
                zero += 1
        else:
            if flg:
                cnt += 1
                flg = False

    if flg:
        cnt  += 1

    ans += cnt


print(ans)
Buggy python submission (verdict: Runtime Error):
import math

N, X = map(int, input().split())
X_lst = list(map(int, input().split()))

if len(X_lst) == 1:
    print(abs(X_lst[0] - X))
    exit()

u = 0
if X_lst[0] == X:
    u = float('inf')

for i, x in enumerate(X_lst[1:], start=1):
    if x == X:
        u = float('inf')

    if X_lst[i - 1] < X < x:
        u = [X - u, x - X]

    if i == 1:
        g = X_lst[1] - X_lst[0]
    else:
        g = math.gcd(g, x - X_lst[i - 1])


if u == 0:
    u = [X - X_lst[-1]]
elif u != float('inf'):
    g = max(math.gcd(g, u[0]), math.gcd(g, u[1]))

print(g)


Fixed submission:
import math

N, X = map(int, input().split())
X_lst = list(map(int, input().split()))

if len(X_lst) == 1:
    print(abs(X_lst[0] - X))
    exit()

u = 0
if X_lst[0] == X:
    u = float('inf')

for i, x in enumerate(X_lst[1:], start=1):
    if x == X:
        u = float('inf')

    if X_lst[i - 1] < X < x:
        u = [X - X_lst[-1], x - X]

    if i == 1:
        g = X_lst[1] - X_lst[0]
    else:
        g = math.gcd(g, x - X_lst[i - 1])


if u == 0:
    u = [X - X_lst[-1]]
elif u != float('inf'):
    g = max(math.gcd(g, u[0]), math.gcd(g, u[1]))

print(g)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

s = input()
K = int(input())

seq_dic = defaultdict(list)
cnt_dic = defaultdict(int)
l = len(s)

for i, x in enumerate(s):
    target = s[i:]

    cnt = 0
    if x not in seq_dic:
        cnt += len(target)
    else:
        for r in seq_dic[x]:
            for j in range(min(len(target), len(r))):
                if target[j] != r[j]:
                    cnt += len(target) - j
                    break

    seq_dic[x].append(target)
    cnt_dic[x] += cnt

cnt = 0
prev_cnt = 0
moji = ''
for i in range(26):
    moji = chr(97 + i)
    c = cnt_dic[moji]
    cnt += c

    if K <= cnt:
        break

    prev_cnt = cnt


seq = set()
for i, n in enumerate(s):
    if n == moji:
        for j in range(i + 1, l + 1):
            seq.add(s[i:j])

seq = list(seq)
seq.sort()

print(seq[K - prev_cnt - 1])

Fixed submission:
s = input()
K = int(input())

seq = set()
l = len(s)
for i in range(l):
    for j in range(1, K + 1):
        seq.add(s[i:i + j])

seq = list(seq)
seq.sort()
print(seq[K - 1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())

l = len(s)

seq = set()
for i in range(l):
    for j in range(i + 1, l + 1):
        seq.add(s[i:j])

seq = list(seq)
seq.sort()

print(seq[K - 1])


Fixed submission:
s = input()
K = int(input())

seq = set()
l = len(s)
for i in range(l):
    for j in range(1, K + 1):
        seq.add(s[i:i + j])

seq = list(seq)
seq.sort()
print(seq[K - 1])
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

score = a[0]
newscore = 0
for i in range(1, n):
    if i < k:
        score = score*a[i]
    else:
        newscore = score*a[i]//a[i-k]
        if newscore > score:
            print("Yes")
        else:
            print("No")
            

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))

score = a[0]
newscore = 0
for i in range(1, n):
    if i >= k:
        if a[i] > a[i-k]:
            print("Yes")
        else:
            print("No")
Buggy python submission (verdict: Runtime Error):
if a[n-1] >= a[n-2]:
    peak.append(n-1)
for i in range(1, n-1):
    if a[i] >= a[i-1] and a[i] > a[i+1]:
        peak.append(i)
    if a[i] <= a[i-1] and a[i] < a[i+1]:
        botom.append(i)

for i in range(n):
    if i in botom:
        kabu = money//a[i]
        money %= a[i]
    if i in peak:
        money += kabu*a[i]
        kabu = 0

print(money)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
money = 1000
peak = []
botom = []
kabu = 0

if a[0] < a[1]:
    botom.append(0)
if a[n-1] >= a[n-2]:
    peak.append(n-1)
for i in range(1, n-1):
    if a[i] >= a[i-1] and a[i] > a[i+1]:
        peak.append(i)
    if a[i] <= a[i-1] and a[i] < a[i+1]:
        botom.append(i)

for i in range(n):
    if i in botom:
        kabu += money//a[i]
        money %= a[i]
    if i in peak:
        money += kabu*a[i]
        kabu = 0

print(money)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 1
for i in a:
  ans *= i
  if ans == 0:
    print(0)
    exit()
if ans > 10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

if 0 in a:
    print(0)
    exit()
    
ans = 1
for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        exit()
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 1
for i in a:
  ans *= i
if ans > 10**18:
  print(-1)
  exit()  
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

if 0 in a:
    print(0)
    exit()
    
ans = 1
for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
max = max(a)

ans = 0
for i in range(n-2):
    h = a[i]
    for j in range(i+h, min(n, i+max+h+1)):
        if abs(i-j) == h+a[j]:
            ans += 1

print(ans)


Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
ans = 0
l=[]
for i in range(n):
    l.append(i-a[i])
cnt = Counter(l)
for i in range(n):
    ans += cnt[i+a[i]]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        if abs(i-j) == a[i]+a[j]:
            ans += 1

print(ans)

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
ans = 0
l=[]
for i in range(n):
    l.append(i-a[i])
cnt = Counter(l)
for i in range(n):
    ans += cnt[i+a[i]]

print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

if a+b > c:
    print("No"):
elif (c-a-b)**2 > 4*a*b:
    print("Yes")
else:
    print("No")


Fixed submission:
a, b, c = map(int, input().split())

if a+b > c:
    print("No")
elif (c-a-b)**2 > 4*a*b:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
from math import sqrt
a, b, c = map(int, input().split())

if a+b > c:
    print("No"):
elif (c-a-b)/2 > sqrt(a*b):
    print("Yes")
else:
    print("No")


Fixed submission:
a, b, c = map(int, input().split())

if a+b > c:
    print("No")
elif (c-a-b)**2 > 4*a*b:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = []
b = []
for i in range(3):
    ai = list(map(int, input().split()))
    a.append(ai)
n = int(input())
for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                a[j][k] = 0

for i in range(3):
    if a[i][0] == 0 and a[i][1] == 0 and a[i][2] == 0:
        print("Yes")
        break
else:
    for i in range(3):
        if a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0:
            print("Yes")
            break
    else:
        if c[0][0] == 0 and c[1][1] == 0 and c[2][2] == 0:
            print("Yes")
        elif a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0:
            print("Yes")
        else:
            print("No")

Fixed submission:
a = []
for i in range(3):
    ai = list(map(int, input().split()))
    a.append(ai)
n = int(input())
for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                a[j][k] = 0

ans = "No"
if sum(a[0]) == 0:
    ans = "Yes"
elif sum(a[1]) == 0:
    ans = "Yes"
elif sum(a[2]) == 0:
    ans = "Yes"
elif a[0][0] + a[1][0] + a[2][0] == 0:
    ans = "Yes"
elif a[0][1] + a[1][1] + a[2][1] == 0:
    ans = "Yes"
elif a[0][2] + a[1][2] + a[2][2] == 0:
    ans = "Yes"
elif a[0][0] + a[1][1] + a[2][2] == 0:
    ans = "Yes"
elif a[0][2] + a[1][1] + a[2][0] == 0:
    ans = "Yes"
print(ans)