Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc074/tasks/arc083_a
# C - Sugar Water
import math
w_A, w_B, s_C, s_D, limit_E, max_F = list(map(int, input().split()))

# それ以上溶かすことができるか
# それ以上重量を増やせるか

# 取りうる水の組み合わせ
w_A_list = [w_A * x * 100 for x in range(math.floor(max_F / (w_A * 100)) + 1)]
w_B_list = [w_B * x * 100 for x in range(math.floor(max_F / (w_B * 100)) + 1)]

# 最悪で3000*3000
w_list = []
for a in w_A_list:
    for b in w_B_list:
        if a + b <= max_F:
            w_list.append(a + b)
w_list = list(set(w_list))  # 3000以下

# 取りうる水の組み合わせ
s_C_list = [s_C * x  for x in range(math.floor(max_F / s_C) + 1)]
s_D_list = [s_D * x  for x in range(math.floor(max_F / s_D) + 1)]

# 最悪で3000*3000
s_list = []
for c in s_C_list:
    for d in s_D_list:
        if c + d <= max_F:
            s_list.append(c + d)
s_list = list(set(s_list))  # 3000以下

max_d = 0
for w in w_list:
    for s in s_list:
        limit_s = w * limit_E / 100
        if w + s <= max_F and w + s != 0 and s <= limit_s:
            d = (s / (w + s)) * 100
            if d > max_d:
                max_d = d
                ans_ws, ans_s = w + s, s

ans = ' '.join([str(ans_ws), str(ans_s)])
print(ans)


Fixed submission:
# https://atcoder.jp/contests/abc074/tasks/arc083_a
# C - Sugar Water
import math
w_A, w_B, s_C, s_D, limit_E, max_F = list(map(int, input().split()))

# それ以上溶かすことができるか
# それ以上重量を増やせるか

# 取りうる水の組み合わせ
w_A_list = [w_A * x * 100 for x in range(math.floor(max_F / (w_A * 100)) + 1)]
w_B_list = [w_B * x * 100 for x in range(math.floor(max_F / (w_B * 100)) + 1)]

# 最悪で3000*3000
w_list = []
for a in w_A_list:
    for b in w_B_list:
        if a + b <= max_F:
            w_list.append(a + b)
w_list = list(set(w_list))  # 3000以下

# 取りうる水の組み合わせ
s_C_list = [s_C * x  for x in range(math.floor(max_F / s_C) + 1)]
s_D_list = [s_D * x  for x in range(math.floor(max_F / s_D) + 1)]

# 最悪で3000*3000
s_list = []
for c in s_C_list:
    for d in s_D_list:
        if c + d <= max_F:
            s_list.append(c + d)
s_list = list(set(s_list))  # 3000以下

max_d = -float('inf')
for w in w_list:
    for s in s_list:
        limit_s = w * limit_E / 100
        if w + s <= max_F and w + s != 0 and s <= limit_s:
            d = (s / (w + s)) * 100
            if d > max_d:
                max_d = d
                ans_ws, ans_s = w + s, s

ans = ' '.join([str(ans_ws), str(ans_s)])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# https://atcoder.jp/contests/abc072/tasks/arc082_a
# C - Together

n = int(input().split()[0])
a_list = list(map(int, input().split()))

a_op_list = [(a-1, a, a+1)for a in a_list]
max_count = 0

for a in set(a_list):
    count = len([x for x in a_list if x in [a+1, a, a-1]])
    max_count = count if count > max_count else max_count

print(max_count)


Fixed submission:
# https://atcoder.jp/contests/abc072/tasks/arc082_a
# C - Together
import itertools
import collections

n = int(input().split()[0])
a_list = list(map(int, input().split()))

a_op_list = [[a-1, a, a+1] for a in a_list]
a_op_list = itertools.chain.from_iterable(a_op_list)
c = collections.Counter(a_op_list)
max_count = max(c.values())

print(max_count)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

N = int(input().split()[0])
p_list = list(map(int, input().split()))
count = 0
for i in range(N):
    index = i + 1
    if index == p_list[i]:
        if i != 0 and i != 1:
            if p_list[i + 1] == index + 1:
                p_list[i] = p_list[i + 1]
                p_list[i + 1] = index
            else:
                p_list[i] = p_list[i - 1]
                p_list[i - 1] = index
        elif i != 0:
            p_list[i] = p_list[i - 1]
            p_list[i - 1] = index
        elif i != 1:
            p_list[i] = p_list[i + 1]
            p_list[i + 1] = index

        count += 1

ans = count
print(ans)


Fixed submission:
#!/usr/bin/env python3

N = int(input().split()[0])
p_list = list(map(int, input().split()))
count = 0
for i in range(N):
    index = i + 1
    if index == p_list[i]:
        if i != 0 and i != N - 1:
            if p_list[i + 1] == index + 1:
                p_list[i] = p_list[i + 1]
                p_list[i + 1] = index
            else:
                p_list[i] = p_list[i - 1]
                p_list[i - 1] = index
        elif i != 0:
            p_list[i] = p_list[i - 1]
            p_list[i - 1] = index
        elif i != N - 1:
            p_list[i] = p_list[i + 1]
            p_list[i + 1] = index

        count += 1

ans = count
print(ans)
Buggy python submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc068/tasks/arc079_a
# C - Cat Snuke and a Voyage

n, m = list(map(int, input().split()))
ab_list = []

for _ in range(m):
    a, b = list(map(int, input().split()))
    ab_list.append((a, b))

ab_dict = {k: [] for k in range(1, m+1)}

for a, b in ab_list:
    # 子供を覚えさせる
    ab_dict[a].append(b)

next_node_list = ab_dict[1]
# 来訪済の島
done_list = []
done_list.append(1)

def search(node_list):
    for node in node_list:
        if node == n:
            return True

    return False

# 深さ優先探索
for node in next_node_list:
    if node not in ab_dict.keys():
        # 行き止まり
        is_ok = False
        continue

    if node == n:
        is_ok = True
    else:
        is_ok = search(ab_dict[node])
    if is_ok:
        break

ans = 'POSSIBLE' if is_ok else 'IMPOSSIBLE'
print(ans)


Fixed submission:
# https://atcoder.jp/contests/abc068/tasks/arc079_a
# C - Cat Snuke and a Voyage

n, m = list(map(int, input().split()))
ab_list = []

for _ in range(m):
    a, b = list(map(int, input().split()))
    ab_list.append((a, b))

ab_dict = {k: [] for k in range(1, m+1)}

# 1と接続している島
via_nodes_1 = set([b for a, b in ab_list if a == 1])
via_nodes_2 = set([a for a, b in ab_list if b == n])

# 積集合があるか
via_nodes = via_nodes_1 & via_nodes_2

if len(via_nodes):
    ans = 'POSSIBLE'
else:
    ans = 'IMPOSSIBLE'

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import copy

N, K = list(map(int, input().split()))
a_list = list(map(int, input().split()))

a_list = sorted(a_list)


def judge(w_list, k):
    w_list = sorted(w_list)

    for i in range(len(w_list) - 1):
        w_list += [abs(w_list[i] - w_list[i + 1])]

    w_list = sorted(list(set(w_list)))

    if k in w_list:
        return True, w_list
    elif 1 in w_list:
        return True, w_list
    elif abs(w_list[0] - w_list[-1]) < K:
        return False, w_list
    elif k % 2 == 0 and 2 in w_list:
        return True, w_list
    else:
        for w in w_list:
            if w + K in w_list:
                return True, w_list

        return False, w_list


w_list = a_list

while True:
    org_w_list = copy.copy(w_list)
    is_ok, w_list = judge(w_list, K)
    if is_ok:
        break
    else:
        if abs(w_list[0] - w_list[-1]) < K:
            break
        if w_list == org_w_list:
            break

ans = "POSSIBLE" if is_ok else "IMPOSSIBLE"

print(ans)


Fixed submission:
#!/usr/bin/env python3
import copy

N, K = list(map(int, input().split()))
a_list = list(map(int, input().split()))

a_list = sorted(a_list)


def judge(w_list, k):
    w_list = sorted(w_list)

    for i in range(len(w_list) - 1):
        w_list += [abs(w_list[i] - w_list[i + 1])]

    w_list = sorted(list(set(w_list)))

    if k in w_list:
        return True, w_list
    elif 1 in w_list:
        return True, w_list
    elif abs(w_list[0] - w_list[-1]) < K:
        return False, w_list
    elif k % 2 == 0 and 2 in w_list:
        return True, w_list
    else:
        ww_list = set([w + K for w in w_list])
        if ww_list & set(w_list):
            return True, w_list
        else:
            return False, w_list


w_list = a_list

while True:
    org_w_list = copy.copy(w_list)
    is_ok, w_list = judge(w_list, K)
    if is_ok:
        break
    else:
        if abs(w_list[0] - w_list[-1]) < K:
            break
        if w_list == org_w_list:
            break

ans = "POSSIBLE" if is_ok else "IMPOSSIBLE"

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import math

N = int(input().split()[0])
a_list = list(map(int, input().split()))

total = sum(a_list)
work_list = []

for i in range(N - 1):
    sunuke = sum(a_list[: i + 1])
    arai = total - sunuke
    work_list.append(abs(sunuke - arai))

ans = min(work_list)
print(ans)


Fixed submission:
#!/usr/bin/env python3
import math

N = int(input().split()[0])
a_list = list(map(int, input().split()))

total = sum(a_list)
work_list = []
sunuke = 0

for i in range(N - 1):
    sunuke += a_list[i]
    arai = total - sunuke
    work_list.append(abs(sunuke - arai))

ans = min(work_list)
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, c = list(map(int, input().split()))
values = sorted(list(set([a, b, c])))
ans = values[0] + values[1]
print(ans)


Fixed submission:
a, b, c = list(map(int, input().split()))
values = sorted([a, b, c])
ans = values[0] + values[1]
print(ans)
Buggy python submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc065/tasks/abc065_b
# B - Trained?
n = int(input().split()[0])

index2number_dict = {}
number2index_dict = {}

for i in range(n):
    a_i = int(input().split()[0])
    index2number_dict[i+1] = a_i
    number2index_dict[a_i] = i+1

# ボタンが光っているときに押すと、
# 今のボタンの光が消える
# 次のボタンが光る
# ボタン2が光っている状態でやめたい
# print(index2number_dict)

start_number = 1
start_index = number2index_dict[start_number]
# print(start_number)
# print(start_index)

step = 0
lighting_number = start_number
lighting_index = start_index
status_list = str(lighting_number)
can_stop = False

while True:
    step += 1
    lighting_number = index2number_dict[lighting_number]
    
    if lighting_number == 2:
        can_stop = True
        break

    status_list += str(lighting_number)

    if len(status_list) % 2 == 0:
        half = len(status_list) // 2
        # print('status(full): {}'.format(status_list))
        # print('status(half): {}'.format(status_list[:half]))

        if status_list == status_list[:half] * 2:
            break

if not can_stop:
    step = -1

# print('===========')
# print(status_list)
print(step)


Fixed submission:
# https://atcoder.jp/contests/abc065/tasks/abc065_b
# B - Trained?
n = int(input().split()[0])

index2number_dict = {}
number2index_dict = {}
button_list = []

for _ in range(n):
    number = int(input().split()[0])
    button_list.append(number)
    

# ボタンが光っているときに押すと、
# 今のボタンの光が消える
# 次のボタンが光る
# ボタン2が光っている状態でやめたい
# print(index2number_dict)

start_index = 1
# print(start_number)
# print(start_index)

step = 0
lighting_index = start_index # 1 - n
status_list = ''
can_stop = False

while True:
    status_list += str(lighting_index)

    lighting_number = button_list[lighting_index - 1]
    lighting_index = lighting_number  # 次のインデックス
    step += 1


    if lighting_index == 2:
        can_stop = True
        break

    if step >= len(button_list):
        break
    # print('i = {}, ai = {}'.format(lighting_index, lighting_number))
    

    # print('Next -> i = {}, a_i = {} '.format(lighting_index, lighting_number))
    

if not can_stop:
    step = -1

# print('===========')
# print(status_list)
print(step)
Buggy python submission (verdict: Runtime Error):
a, b, c = list(input().split())
print('YES' if b - a == c - b else 'NO')


Fixed submission:
a, b, c = list(map(int, input().split()))
print('YES' if b - a == c - b else 'NO')
Buggy python submission (verdict: Runtime Error):
a, b = list(map(int, input().split()))
if a == 'H':
  b = 'D' if b == 'H' else 'H'
print(b)


Fixed submission:
a, b = list(input().split())
if a == 'D':
  b = 'D' if b == 'H' else 'H'
print(b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input().split()[0])
warukazu = 10 ** 9 + 7
x = 1
for i in range(1, n+1):
    x = x * i

print(x % warukazu)

Fixed submission:
n = int(input().split()[0])
warukazu = 10 ** 9 + 7
x = 1
for i in range(1, n+1):
    x = (x * i) % warukazu

print(x % warukazu)
Buggy python submission (verdict: Runtime Error):
import itertools

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

ab_list = []

for _ in range(0, m):
    a, b = list(map(int, input().split()))
    ab_list.append((a, b))
    ab_list.append((b, a))

# 全探索で解く場合
l = range(1, n+1)
count = 0
roots = [v for v in itertools.permutations(l, n) if v[0] == 1]

for v in roots:
    is_ok = True
    for i, _ in enumerate(list(v)[:-1]):
        # 探索対象となるエッジ
        target_edge = (list(v)[i], list(v)[i+1])
        if (target_edge not in ab_list):
            is_ok = False

    if is_ok:
        count += 1

print(count)


Fixed submission:
# https://atcoder.jp/contests/abc054/tasks/abc054_a
# A - One Card Poker
a, b = list(map(int, input().split()))

if a == 1:
    a = 100
if b == 1:
    b = 100

if a == b:
    answer = 'Draw'
elif a < b:
    answer = 'Bob'
elif a > b:
    answer = 'Alice'

print(answer)
Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))

a_list_list = []

for i in range(0, n):
    a_list_list.append(input().split()[0])

b_list_list = []

for i in range(0, m):
    b_list_list.append(input().split()[0])

def is_match(source_list_list, b_list_list, source_start_x):

    for k in range(len(b_list_list)):
        for l in range(len(b_list_list[0])):
            if source_list_list[k][source_start_x + l] != b_list_list[k][l]:
                return False

    return True

# def debug_print(source):
#     print('==============')
#     for row in source:
#         print(row)
#     print('==============')

is_ok = False

# debug_print(b_list_list)

for j, _ in enumerate(a_list_list):
    target_a_list_list = a_list_list[j:j+m]
    for i in range(0, n-m):
        # debug_print(target_a_list_list)
        if is_match(target_a_list_list, b_list_list, i):
            is_ok = True
            break
    if is_ok:
        break

ans = 'Yes' if is_ok else 'No'

print(ans)

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

a_list_list = []

for i in range(0, n):
    a_list_list.append(input().split()[0])

b_list_list = []

for i in range(0, m):
    b_list_list.append(input().split()[0])

def is_match(source_list_list, b_list_list, source_start_x):

    for k in range(len(b_list_list)):
        for l in range(len(b_list_list[0])):
            if source_list_list[k][source_start_x + l] != b_list_list[k][l]:
                return False

    return True

# def debug_print(source):
#     print('==============')
#     for row in source:
#         print(row)
#     print('==============')

is_ok = False

# debug_print(b_list_list)

for j in range(0, n-m+1):
    target_a_list_list = a_list_list[j:j+m]
    for i in range(0, n-m+1):
        # debug_print(target_a_list_list)
        if is_match(target_a_list_list, b_list_list, i):
            is_ok = True
            break
    if is_ok:
        break

ans = 'Yes' if is_ok else 'No'

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split()))

kouho_list = []

for x in range(k+1):
	for y in range(k+1):
		for z in range(k+1):
			tmp_sum = x + y + z
			if tmp_sum == s:
				kouho_list.append(tmp_sum)

print(len(kouho_list))

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

count = 0

for x in range(k+1):
	for y in range(k+1):
		z = s - (x + y)
		if 0 <= z <= k:
			count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
a, op, b = list(input().split())
if op == '+':
  ans = a + b
else:
  ans = a - b
print(ans)


Fixed submission:
a, op, b = list(input().split())
a, b = int(a), int(b)
if op == '+':
  ans = a + b
else:
  ans = a - b
print(ans)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

X = input()
N = len(X)
after_x = ""
next_i = 0
# 連続する箇所で部分文字列を作りたい
if X[0] == "T":
    # Tから始まる場合、最初の連続するTは確定で残る
    for i, x in enumerate(X):
        if x == "T":
            after_x += x
        else:
            break
    next_i = i

if next_i < N - 1:
    # 残りの文字列について操作する（最初のTは処理したので、必ずSから始まる）
    s_count = 0
    t_count = 0
    is_t = False
    for i, char in enumerate(X[next_i:]):
        if i == 0:
            # 最初は確定でSから始まる
            s_count += 1
            continue

        if char == "S":
            # Sの場合
            if X[next_i + i - 1] == "T":
                # T->Sの切り替わりのとき
                if t_count >= s_count:
                    # Sを全て使い切り、余ったTは確定で残る
                    after_x += "T" * (t_count - s_count)
                    t_count -= s_count
                    s_count = 0
                else:
                    # Tを全部使い切り、余ったSは引き継がれる
                    s_count -= t_count
                    t_count = 0
            s_count += 1
        else:
            # Tの場合
            t_count += 1

# 最後に
if t_count >= s_count:
    # Sを全て使い切り、余ったTは確定で残る
    after_x += "T" * (t_count - s_count)
    t_count -= s_count
    s_count = 0
else:
    # Tを全部使い切り、余ったSは引き継がれる
    s_count -= t_count
    t_count = 0
    after_x += "S" * s_count

ans = len(after_x) + s_count
print(ans)


Fixed submission:
#!/usr/bin/env python3

X = input()
N = len(X)
after_x = ""
next_i = 0
# 連続する箇所で部分文字列を作りたい
s_count, t_count = 0, 0
if X[0] == "T":
    # Tから始まる場合、最初の連続するTは確定で残るので切り捨てる
    for i, x in enumerate(X):
        if x == "T":
            after_x += x
        else:
            break
    next_i = i

if len(after_x) != N:
    # 「全ての文字列がT」ではない
    # 残りの文字列について操作する（最初のTは処理したので、必ずSから始まる）
    for i, char in enumerate(X[next_i:]):
        if i == 0:
            # 最初は確定でSから始まる
            s_count += 1
            continue

        if char == "S":
            # Sの場合
            if X[next_i + i - 1] == "T":
                # T->Sの切り替わりのとき
                if t_count >= s_count:
                    # Sを全て使い切り、余ったTは確定で残る
                    after_x += "T" * (t_count - s_count)
                    t_count = 0
                    s_count = 0
                else:
                    # Tを全部使い切り、余ったSは引き継がれる
                    s_count -= t_count
                    t_count = 0
            s_count += 1
        else:
            # Tの場合
            t_count += 1
    last_char = char

    if last_char == "T":
        # Tで終わる場合
        if t_count >= s_count:
            # Sを全て使い切り、余ったTは確定で残る
            after_x += "T" * (t_count - s_count)
            t_count -= s_count
            s_count = 0
        else:
            # Tを全部使い切り、余ったSは引き継がれる
            s_count -= t_count
            t_count = 0
            after_x += "S" * s_count
    else:
        # Sで終わる場合
        after_x += "S" * s_count
# print(after_x)
ans = len(after_x)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

import itertools

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

max_x = max(max(x_list), A)
dp = [[[0 for s in range(N * max_x + 1)] for k in range(N + 1)] for j in range(N + 1)]
dp[0][0][0] = 1
ka_list = []

for j in range(N + 1):  # 何番目の数か
    x = x_list[j - 1]
    for k in range(N + 1):  # k枚選ぶとき
        for s in range(N * max_x + 1):
            if j == 0 and k == 0 and s == 0:
                dp[0][0][0] = 1
            elif j >= 1 and s < x:
                # オーバーするので選べない
                # ひとつ前と同じになる
                dp[j][k][s] = dp[j - 1][k][s]
            elif j >= 1 and k >= 1 and s >= x:
                dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x]
            else:
                dp[j][k][s] = 0

ans = sum([dp[N][k][k * A] for k in range(1, N + 1)])
print(ans)


Fixed submission:
#!/usr/bin/env python3

import itertools

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

max_x = max(max(x_list), A)
dp = [[[0 for s in range(N * max_x + 1)] for k in range(N + 1)] for j in range(N + 1)]
dp[0][0][0] = 1
ka_list = []

for j in range(N + 1):  # 何番目の数か
    x = x_list[j - 1]
    for k in range(N + 1):  # k枚選ぶとき
        for s in range(N * max_x + 1):
            if j == 0 and k == 0 and s == 0:
                dp[0][0][0] = 1
            elif j >= 1 and s < x:
                # オーバーするので選べない
                # ひとつ前と同じになる
                dp[j][k][s] = dp[j - 1][k][s]
            elif j >= 1 and k >= 1 and s >= x:
                dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x]
            else:
                dp[j][k][s] = 0

ans = sum([dp[N][k][k * A] for k in range(1, N + 1)])
print(ans)
Buggy python submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc043/tasks/arc059_a
# C - いっしょ / Be Together
import statistics
N = int(input().split()[0])
a_list = list(map(int, input().split()))

min_a, max_a = min(a_list), max(a_list)
w_list = list(range(min_a, max_a+1))
m1 = statistics.median_low(w_list)
m2 = statistics.median_high(w_list)

cost_1 = 0
cost_2 = 0
for a in a_list:
    cost_1 += (a - m1) ** 2
    cost_2 += (a - m2) ** 2

ans = min(cost_1, cost_2)
print(ans)


Fixed submission:
# https://atcoder.jp/contests/abc043/tasks/arc059_a
# C - いっしょ / Be Together
import statistics
N = int(input().split()[0])
a_list = list(map(int, input().split()))

# たかだか200なので、全探索で間に合う
min_cost = float('inf')

for x in range(-100, 101):
    cost = 0
    for a in a_list:
        cost += (a - x) ** 2
    if cost < min_cost:
        min_cost = cost

print(min_cost)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

N, M = list(map(int, input().split()))
xy_table = []

for _ in range(M):
    x, y = list(map(int, input().split()))
    xy_table.append((x, y))

red_box_list = [1]
# 添字0はダミー
# 添字 = 箱の番号として扱う
n_box_list = [0] + [1] * N

for xy in xy_table:
    x, y = xy
    n_box_list[x] -= 1
    n_box_list[y] += 1
    if x in red_box_list:
        if y not in red_box_list:
            red_box_list.append(y)

        if n_box_list[x] == 0:
            red_box_list.remove(x)

ans = len(red_box_list)

print(ans)


Fixed submission:
#!/usr/bin/env python3

N, M = list(map(int, input().split()))
xy_table = []

for _ in range(M):
    x, y = list(map(int, input().split()))
    xy_table.append((x, y))

red_box_dict = {i: False for i in range(1, N + 1)}
red_box_dict[1] = True
# 添字0はダミー
# 添字 = 箱の番号として扱う
n_box_list = [0] + [1] * N

for xy in xy_table:
    x, y = xy
    n_box_list[x] -= 1
    n_box_list[y] += 1
    if red_box_dict[x]:
        red_box_dict[y] = True

        if n_box_list[x] == 0:
            red_box_dict[x] = False

ans = len([v for v in red_box_dict.values() if v])

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int,input().split())
lis = list()
for i in range(a,b+1):
    for j in range(c,d+1):
        lis.append(i*j)
print(max(lis))

Fixed submission:
a,b,c,d = map(int,input().split())
print(max(a*c , a*d , b * c , b*d))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
n,k = map(int,input().split())
list1 = list(map(int,input().split()))
list2  = []
for i in combinations(list1,k) :
    list2.append(sum(i))
print(min(list2))

Fixed submission:
from itertools import combinations
n,k = map(int,input().split())
list1 = list(map(int,input().split()))
print(sum(sorted(list1)[:k]))
Buggy python submission (verdict: Runtime Error):
    x , y = map(int,input().split())
b = y/2 - x 
a = x - b 
if a >=0 and b>= 0:
    print("Yes")
else:
    print("No")

Fixed submission:
x , y = map(int,input().split())
if y % 2 != 0 :
    print("No")
    quit()
else:
    b = y/2 - x
    a = x - b 
    if a >= 0 and b >= 0:
        print("Yes")
    else:
        print("No")