Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02708 (python)

Fixed submission:
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
import math
import bisect
import numpy as np
from collections import defaultdict, deque
from operator import itemgetter
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
MOD = 10**9 + 7

def main():
    n, k = map(int, input().split())
    ans = 0
    for i in range(k, n + 2):
        ans += i * (n - i + 1) + 1
    print(ans%MOD)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
import math
import bisect
import numpy as np
from collections import defaultdict, deque
from operator import itemgetter
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def main():
    n, k = map(int, input().split())
    ans = 0
    for i in range(k, n + 2):
        ans += i * (n - i + 1) + 1
    print(ans%MOD)


if __name__ == '__main__':
    main()
Problem p02768 (python)

Fixed submission:
n, a, b = map(int, input().split())
mod = 10 ** 9 + 7

# 逆元配列の作成
inv = [1] * (2 * (10 ** 5)+1)
for i in range(2, 2 * (10 ** 5)+1):
    inv[i] = -inv[mod % i] * (mod // i)
    inv[i] %= mod


def comb(n, a):
    res = 1
    for i in range(a):
        res *= n - i  # 分子
        res *= inv[i + 1]  # 分母
        res %= mod  # modで割ったあまり
    return res


ans = pow(2, n, mod) - 1 - comb(n, a) - comb(n, b)

ans %= mod
if ans < 0:
    ans += mod

print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
mod = 10 ** 9 + 7

# 逆元配列の作成
inv = [1] * (2 * (10 ** 5))
for i in range(2, 2 * (10 ** 5)):
    inv[i] = -inv[mod % i] * (mod // i)
    inv[i] %= mod


def comb(n, a):
    res = 1
    for i in range(a):
        res *= n - i  # 分子
        res *= inv[i + 1]  # 分母
        res %= mod  # modで割ったあまり
    return res


ans = pow(2, n, mod) - 1 - comb(n, a) - comb(n, b)

ans %= mod
if ans < 0:
    ans += mod

print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
mod = 10 ** 9 + 7
total = pow(2, n, mod) - 1

N = 2 * (10 ** 5)
inv = [1] * N
for i in range(2, N):
    inv[i] = -inv[mod % i] * (mod // i)
    inv[i] %= mod


def comb(n, r):
    res = 1
    for i in range(r):
        res *= n - i
        res *= inv[i + 1]
        res %= mod
    return res


ans = total - comb(n, a) - comb(n, b)
if ans < 0:
    ans += mod
print(ans)
Problem p02780 (python)

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

kitaiti = [0 for _ in range(n)]
ruisekiwa = [0 for _ in range(n)]
r = k - 1
max = 0
now = 0
ans_list = []

for i in range(n):
    kitaiti[i] = (p[i]+1) / 2
    if i == 0:
        ruisekiwa[0] = kitaiti[0]
    else:
        ruisekiwa[i] = ruisekiwa[i-1] + kitaiti[i]
    if i == r:
        now = ruisekiwa[i]
    elif i > r:
        now = ruisekiwa[i] - ruisekiwa[i-r-1]
    if now > max:
        max = now
print(max)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))

kitaiti = [0 for _ in range(n)]
ruisekiwa = [0 for _ in range(n)]
r = k - 1
max = 0
ans_list = []

for i in range(n):
    kitaiti[i] = (p[i]+1) / 2
    if i == 0:
        ruisekiwa[0] = kitaiti[0]
    else:
        ruisekiwa[i] = ruisekiwa[i-1] + kitaiti[i]
    if i == r:
        now = ruisekiwa[i]
    elif i > r:
        now = ruisekiwa[i] - ruisekiwa[i-r-1]
    if now > max:
        max = now
print(max)
Problem p02865 (python)

Fixed submission:
n = int(input())
if n % 2 == 1:
    ans = (n-1) // 2
else:
    ans = (n-2) // 2
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_mat = np.array(A)
B_mat = np.array(B)
C_mat = B_mat - A_mat
C = C_mat.tolist()
x = 10 ** 10
num = 0
for i in range(len(C)):
    if 0 <= C[i] < x:
        x = C[i]
        num = i
if x == 10 ** 10:
    print('No')
else:
    A.pop(num)
    B.pop(num)

    A.sort()
    B.sort()

    A1_mat = np.array(A)
    B1_mat = np.array(B)

    C1_mat = B1_mat - A1_mat
    if np.all(C1_mat >= 0):
        print('Yes')
    else:
        print('No')
Problem p02923 (python)

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

tmp = 0
m = 0
for i in range(n-1):
    if H[i] >= H[i+1]:
        tmp += 1
    else:
        m = max(tmp, m)
        tmp = 0
print(max(m, tmp))

Buggy submission (verdict: Runtime Error):
n = int(input())
H = list(map(int, input().split()))
A = []


def f(x):
    cnt = 0
    while x < n-1:
        if H[x] >= H[x+1]:
            cnt += 1
            x += 1
        else:
            break
    return cnt


for i in range(n-1):
    A.append(f(i))
print(max(A))
Problem p02936 (python)

Fixed submission:
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
import math
import bisect
import numpy as np
from collections import defaultdict, deque
from operator import itemgetter
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N, Q = map(int, input().split())
    G = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = [int(i) - 1 for i in input().split()]
        G[a].append(b)
        G[b].append(a)
    A = [0] * N  # 頂点数分だけ準備する
    for _ in range(Q):
        p, x = map(int, input().split())
        p -= 1
        A[p] += x
    que = deque([[-1, 0]])
    while que:
        par, vi = que.popleft()
        for vj in G[vi]:
            if vj == par:  # 探索が親の時はスルー
                continue
            A[vj] += A[vi]  # 数値を追加する
            que.append([vi, vj])  # queに(親，子)を追加する
    print(*A)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
# import numpy as np

# 入力
N, Q = map(int, input().split())
g = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    g[a].append(b)
    g[b].append(a)
point = [0] * N
for _ in range(Q):
    p, x = map(int, input().split())
    p -= 1
    point[p] += x
ans = [0] * N
# 探索
def dfs(pre, now):
    # ansを更新
    ans[now] = ans[pre] + point[now]
    # 隣接頂点を探索
    for nxt in g[now]:
        if nxt == pre:
            continue
        dfs(now, nxt)
dfs(0, 0)
print(*ans)
Problem p03044 (python)

Fixed submission:
import sys

sys.setrecursionlimit(100000000)


def dfs(u, c):  # 引数には頂点の番号と色を入れる
    ans[u] = c  # 探索済みにする
    for v, w in G[u]:
        if ans[v] != -1:  # 探索していた時はスルー
            continue
        if ans[v] != c and w % 2 == 0:  # 距離が偶数で、未訪問あるいは色が違う時は同じ色にする
            dfs(v, c)
        elif ans[v] != c and w % 2 != 0:  # 距離が奇数で、未訪問あるいは色が違う時、違う色にする。
            dfs(v, 1-c)


n = int(input())
G = [[] for _ in range(n)]  # 頂点の個数分準備
for i in range(n-1):  # 辺の数はn-1
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    G[u].append([v, w])
    G[v].append([u, w])
ans = [-1] * n
dfs(0, 0)
for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
n = int(input())
G = [[] for _ in range(n)]  # 頂点の個数分準備
for i in range(n - 1):  # 辺の数はn-1
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    G[u].append([v, w])
    G[v].append([u, w])
ans = [-1] * n
ans[0] = 0
que = deque([0])
while que:
    tmp = que.popleft()  # 幅優先探索
    for u, w in G[tmp]:
        if ans[u] != -1:  # すでに訪問済みの時
            continue
        ans[u] = ans[tmp] + w  # 辺の長さを追加
        que.append(u)  # queに追加

for c in ans:
    if c % 2 == 0:
        print(0)
    else:
        print(1)
Problem p03061 (python)

Fixed submission:
# 最大公約数
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


n = int(input())
A = list(map(int, input().split()))

L = [0 for _ in range(n)]
R = [0 for _ in range(n)]
L[0] = A[0]
R[-1] = A[-1]

for i in range(1, n):
    L[i] = gcd(L[i-1], A[i])
    R[n - i - 1] = gcd(R[n - i], A[n - i - 1])
ans = 1
for i in range(n):
    if i == 0:
        ans = R[i + 1]
    elif i == n-1:
        ans = max(ans, L[i-1])
    else:
        ans = max(ans, gcd(L[i - 1], R[i+1]))

print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
from functools import reduce


def gcd_list(numbers):
    return reduce(fractions.gcd(), numbers)


n = int(input())
num_list = list(map(int,input().split()))
gcd = [1 for _ in range(n-1)]
for i in range(n-1):
    num = num_list[:i] + num_list[(i + 1):]
    gcd[i] = gcd_list(num)

print(max(gcd))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


n = int(input())
num_list = list(map(int,input().split()))
gcd = [1 for _ in range(n-1)]
for i in range(n-1):
    num = num_list[:i] + num_list[(i + 1):]
    gcd[i] = gcd_list(num)

print(max(gcd))
Problem p03160 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
INF = float('inf')
dp = [INF] * (1 + 10 ** 5)
dp[0] = 0
for i in range(n):
    dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
    if i < 2:
        continue
    dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
def rec(i):
    if dp[i] < INF:
        return dp[i]
    if i == 0:
        return 0
    dp[i] = min(dp[i], rec(i-1) + abs(h[i] - h[i - 1]))
    if i > 1:
        dp[i] = min(dp[i], rec(i-2) + abs(h[i] - h[i - 2]))
    return dp[i]


INF = float('inf')
dp = [INF] * (10 ** 5 + 10)
h = [0] * (10 ** 4 + 10)

N = int(input())
h = list(map(int, input().split())) + h

print(rec(N-1))
Problem p03161 (python)

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
INF = float('inf')
dp = [INF] * (1 + 10 ** 5)
dp[0] = 0
for i in range(n):
    for j in range(1, k + 1):
        if i - j < 0:
            continue
        dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
INF = float('inf')
dp = [INF] * (10**5 + 10)
dp[0] = 0
h = [0] * (10 ** 4)
N, K = map(int, input().split())
h = list(map(int, input().split())) + h
for i in range(N+1):
    for k in range(1, K+1):
        dp[i+k] = min(dp[i+k], dp[i] + abs(h[i] - h[i+k]))
print(dp[N-1])

Buggy submission (verdict: Runtime Error):
INF = float('inf')
dp = [INF] * (10**5 + 10)
dp[0] = 0
h = [0] * (10 ** 4)
N, K = map(int, input().split())
h = list(map(int, input().split())) + h
for i in range(N):
    for k in range(1, K+1):
        dp[i+k] = min(dp[i+k], dp[i] + abs(h[i] - h[i+k]))
print(dp[N-1])
Problem p03353 (python)

Fixed submission:
s = input()
K = int(input())
l = []
if len(s) == 1:
    print(s)
    exit()
for i in range(len(s)):
    for j in range(i, len(s)):
        d = s[i:j+1]
        l.append(d)
        if len(d) >= K:
            break
l = list(set(l))
l.sort()
print(l[K-1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
l = []
if len(s) == 1:
    print(s)
    exit()
for i in range(len(s) - 1):
    for j in range(i, len(s)):
        d = s[i:j+1]
        l.append(d)
l = list(set(l))
l.sort()
print(l[K-1])
Problem p03423 (python)

Fixed submission:
n = int(input())
print(n//3)

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
from math import pi, gcd, ceil, floor
import numpy as np
from collections import defaultdict, deque
from operator import itemgetter
from bisect import bisect_left, bisect_right, insort_left, insort_right
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
# INF = float("inf")



def main():
    n = int(input())
    print(n // 3)

if __name__ == '__main__':
    main()
Problem p03495 (python)

Fixed submission:
import collections

n, k = map(int, input().split())
a = list(map(int, input().split()))
a_cnt = collections.Counter(a).most_common()[::-1]
ans = 0
n = len(list(set(a)))
if n <= k:
    print(0)
    exit()
for v in range(n):
    ans += a_cnt[v][1]
    n -= 1
    if n <= k:
        print(ans)
        exit()

Buggy submission (verdict: Runtime Error):
import collections

n, k = map(int, input().split())
a = list(map(int, input().split()))
k, v = zip(*collections.Counter(a).most_common()[::-1])
v_list = [i for i in v]
diff = max(0, len(v_list - k))
ans = sum(v_list[:diff])
print(ans)
Problem p03575 (python)

Fixed submission:
from collections import defaultdict, deque
import sys
input = sys.stdin.readline


def bfs(s, n, g):
    dist = [-1] * n
    dist[s] = 0
    que = deque([])
    que.append(s)
    while que:
        v = que.popleft()
        for nv in g[v]:
            if dist[nv] != -1:
                continue
            dist[nv] = dist[v] + 1
            que.append(nv)
    if -1 in dist:
        return True
    else:
        return False


def main():
    n, m = map(int, input().split())
    g = [[] for _ in range(n)]
    gg = []
    for _ in range(m):
        a, b = [int(i) - 1 for i in input().split()]
        g[a].append(b)
        g[b].append(a)
        gg.append((a, b))
    ans = 0
    for a, b in gg:
        g[a].remove(b)
        g[b].remove(a)
        if bfs(0, n, g):
            ans += 1
        g[a].append(b)
        g[b].append(a)
    print(ans)
    return


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
import math
import bisect
import numpy as np
from collections import defaultdict, deque
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
# MOD = 10 ** 9 + 7
INF = float("inf")


def dijkstra(s, n, graph):
    dist = [INF] * n
    visited = [False] * n
    dist[s] = 0
    hq = [(0, s)]  # (重み，頂点)
    while hq:
        di, pi = heappop(hq)
        visited[pi] = True
        for dj, pj in graph[pi]:
            if visited[pj]:
                continue
            if dist[pj] > di + dj:
                dist[pj] = di + dj
                heappush(hq, (dist[pj], pj))
    return dist


def main():
    N, M = map(int, input().split())
    graph = [[] for _ in range(N)]
    edge = []
    for _ in range(M):
        a, b = map(int, input().split())
        a, b = a - 1, b - 1
        graph[a].append((1, b))
        graph[b].append((1, a))
        edge.append((a, b))
    cnt = 0
    for a, b in edge:
        graph[a].remove((1, b))
        graph[b].remove((1, a))
        d = dijkstra(0, N, graph)
        if INF in d:
            cnt += 1
        graph[b].append((1, a))
        graph[a].append((1, b))
    print(cnt)


if __name__ == '__main__':
    main()
Problem p03579 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

# 二部グラフ判定
def dfs(u, c):
    color[u] = c  # 訪問したら指定の色で塗る
    for v in G[u]:  # uからつながっている頂点を順に取り出す
        if color[v] != -1:  # すでに訪問していた場合
            if color[v] == c:
                return False  # 隣接する頂点が同じ色のときはFalse
            else:
                continue
        else:  # 未訪問の時は色は違う色にしてDFSで再帰的に探索
            if not dfs(v, 1 - c):  # FalseだったらFalseを返す
                return False
    return True


# 頂点数と辺数を入力
N, M = map(int, input().split())
# グラフの入力
G = [[] for _ in range(N)]  # 頂点数Nだけ準備
color = [-1] * N  # 未訪問は-1とする
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)
# 探索
flag = True
for i in range(N):
    if color[i] == -1:
        if not dfs(i, 0):
            flag = False
            break
if flag:
    ans = color.count(1) * color.count(0) - M
else:
    ans = N * (N - 1) // 2 - M
print(ans)

Buggy submission (verdict: Runtime Error):
# 二部グラフ判定
def dfs(u, c):
    color[u] = c  # 訪問したら指定の色で塗る
    for v in G[u]:  # uからつながっている頂点を順に取り出す
        if color[v] != -1:  # すでに訪問していた場合
            if color[v] == c:
                return False  # 隣接する頂点が同じ色のときはFalse
            else:
                continue
        else:  # 未訪問の時は色は違う色にしてDFSで再帰的に探索
            if not dfs(v, 1 - c):  # FalseだったらFalseを返す
                return False
    return True


# 頂点数と辺数を入力
N, M = map(int, input().split())
# グラフの入力
G = [[] for _ in range(N)]  # 頂点数Nだけ準備
color = [-1] * N  # 未訪問は-1とする
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)
# 探索
flag = True
for i in range(N):
    if color[i] == -1:
        if not dfs(i, 0):
            flag = False
            break
if flag:
    ans = color.count(1) * color.count(0) - M
else:
    ans = N * (N - 1) // 2 - M
print(ans)
Problem p03635 (python)

Fixed submission:
n, m = map(int,input().split())
if n <= 1 or m <= 1:
    print(0)
else:
    print((n-1) * (m-1))

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
if n <= 1 or m <= 1:
    print(0)
else:
    print((n-1) * (m-1)
Problem p03658 (python)

Fixed submission:
n, k = map(int, input().split())
L = list(map(int, input().split()))
new_list = sorted(L, reverse=True)
ans = 0
for i in range(k):
    ans += new_list[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
L = list(map(int, input().split()))
L.sort()
L.reverse()
print(L[0] + L[1] + L[2])
Problem p03695 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
color = [0] * 8
select = 0
for i in range(N):
    for j in range(8):
        if 400 * j <= A[i] < 400 * (j + 1):
            color[j] += 1
            break
        elif 400 * (j + 1) == 3200:
            select += 1
            break
ans = 0

for k in range(8):
    if color[k] != 0:
        ans += 1
print(max(ans, 1), ans + select)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
INF = float("inf")

def main():
    n = int(input())
    A = list(map(int, input().split()))
    color = [0] * 8
    god = 0
    for i in A:
        if i < 400:
            color['gray'] = 1
        elif i < 800:
            color['brown'] = 1
        elif i < 1200:
            color['green'] = 1
        elif i < 1600:
            color['light_blue'] = 1
        elif i < 2000:
            color['blue'] = 1
        elif i < 2400:
            color['yellow'] = 1
        elif i < 2800:
            color['orange'] = 1
        elif i < 3200:
            color['red'] = 1
        else:
            god += 1
    # print(color)
    print(len(color), len(color) + god)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
from math import pi, ceil, floor
import numpy as np
from collections import defaultdict, deque, Counter
from operator import itemgetter
from bisect import bisect_left, bisect_right, insort_left, insort_right
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    n = int(input())
    A = list(map(int, input().split()))
    color = [0] * 8
    god = 0
    for i in A:
        if i < 400:
            color['gray'] = 1
        elif i < 800:
            color['brown'] = 1
        elif i < 1200:
            color['green'] = 1
        elif i < 1600:
            color['light_blue'] = 1
        elif i < 2000:
            color['blue'] = 1
        elif i < 2400:
            color['yellow'] = 1
        elif i < 2800:
            color['orange'] = 1
        elif i < 3200:
            color['red'] = 1
        else:
            god += 1
    # print(color)
    print(len(color), len(color) + god)


if __name__ == '__main__':
    main()
Problem p03730 (python)

Fixed submission:
a, b, c = map(int, input().split())
num = a
for i in range(b):
    if num % b == c:
        print('YES')
        break
    num += a
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
from math import pi, gcd, ceil, floor
import numpy as np
from collections import defaultdict, deque
from operator import itemgetter
from bisect import bisect_left, bisect_right, insort_left, insort_right
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
# INF = float("inf")


def main():
    a, b, c = map(int, input().split())
    num = a
    for i in range(b):
        if num % b == c:
            print("YES")
            exit()
        num += a
    print("NO")


if __name__ == '__main_':
    main()

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
from math import pi, gcd, ceil, floor
import numpy as np
from collections import defaultdict, deque
from operator import itemgetter
from bisect import bisect_left, bisect_right, insort_left, insort_right
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
# INF = float("inf")

def main():
    a, b, c = map(int, input().split())
    num = a
    r = []
    while True:
        if num % b == c:
            print("YES")
            exit()
        if num % b in r:
            break
        r.append(num % b)
        num += a
    print('NO')

if __name__ == '__main__':
    main()
Problem p03777 (python)

Fixed submission:
a, b = map(str, input().split())
if a == b:
    print('H')
else:
    print('D')

Buggy submission (verdict: Runtime Error):
a, b = map(str, input.split())
if a == b:
    print('H')
else:
    print('D')
Problem p03943 (python)

Fixed submission:
l = list(map(int, input().split()))
S = sum(l)
if l[0] + l[1] == l[2] or l[0] + l[2] == l[1] or l[2] + l[1] == l[0]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
W, H, N = map(int, input().split())
x_min = 0
x_max = W
y_min = 0
y_max = H
for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1 and x > x_min:
        x_min = x
    elif a == 2 and x < x_max:
        x_max = x
    elif a == 3 and y > y_min:
        y_min = y
    elif a == 4 and y < y_max:
        y_max = y
if (x_max - x_min) > 0 or (y_max - y_min) > 0:
    S = (x_max - x_min) * (y_max - y_min)
else:
    S = 0
print(S)

Buggy submission (verdict: Runtime Error):
W, H, N = map(int, input().split())
x_min = 0
x_max = W
y_min = 0
y_max = H
for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1 and x > x_min:
        x_min = x
    elif a == 2 and x < x_max:
        x_max = x
    elif a == 3 and y > y_min:
        y_min = y
    elif a ==4 and y < y_max:
        y_max = y
if (x_max - x_min) <= 0 or (y_max - y_min) < 0:
    S = 0
else:
    S = (x_max - x_min) * (y_max - y_min)
print(S)
Problem p03998 (python)

Fixed submission:
A = list(input())
B = list(input())
C = list(input())
x = 'a'
while True:
    if x == 'a':
        if len(A) == 0:
            print('A')
            break
        x = A[0]
        A.remove(x)
    elif x == 'b':
        if len(B) == 0:
            print('B')
            break
        x = B[0]
        B.remove(x)
    else:
        if len(C) == 0:
            print('C')
            break
        x = C[0]
        C.remove(x)

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
from math import pi, gcd, ceil, floor
import numpy as np
from collections import defaultdict, deque
from operator import itemgetter
from bisect import bisect_left, bisect_right, insort_left, insort_right
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
# INF = float("inf")


def main():
    qa = deque(input())
    qb = deque(input())
    qc = deque(input())
    s = qa.popleft()
    while qa or qb or qc:
        if s == 'a':
            s = qa.popleft()
            if not qa:
                print('A')
                exit()
        elif s == 'b':
            s = qb.popleft()
            if not qb:
                print('B')
                exit()
        else:
            s = qc.popleft()
            if not qc:
                print('C')
                exit()

if __name__ == '__main__':
    main()