Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, k = input().split()
print(n, k)
N = int(n)
K = int(k)

h_array = []
for i in range(N):
    tree = int(input())
    h_array.append(tree)

h_array.sort()

#最小値を更新していくので、初期値を無限として設定しておく
result = float("inf")
#indexに注意
for i in range(k - 1, N):
    result = min(result, h_array[i] - h_array[i - k + 1])

print(result)


Fixed submission:
n, k = map(int, input().split())
array = sorted([int(input()) for x in range(n)])
tmp = float("inf")
for i in range(k-1, n):
    tmp = min(tmp, array[i]-array[i-k+1])
print(tmp)

Buggy python submission (verdict: Runtime Error):
n, k = input().split()
N = int(n)
K = int(k)

h_array = []
for i in range(N):
    tree = int(input())
    h_array.append(tree)

h_array.sort()

#最小値を更新していくので、初期値を無限として設定しておく
result = float("inf")
#indexに注意
for i in range(k - 1, n):
    result = min(result, h_array[i] - h_array[i - k + 1])

print(result)

Fixed submission:
n, k = map(int, input().split())
array = sorted([int(input()) for x in range(n)])
tmp = float("inf")
for i in range(k-1, n):
    tmp = min(tmp, array[i]-array[i-k+1])
print(tmp)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import math

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

res = 0
tmp = math.ceil(m/n)
for i in range(1, tmp+1):
    res = (max(res, fractions.gcd(i, m-((n-1)*i))))
print(res)


Fixed submission:
import math

n, m = map(int, input().split())
array = []
for i in range(1, int(math.sqrt(m)+1)):
    if m % i == 0:
        array.append([i, m//i])

diff = float("inf")
res = 0
for i, j in array:
    if i >= n:
        res = max(res, j)
    if j >= n:
        res = max(res, i)
print(res)

Buggy python submission (verdict: Runtime Error):
import fractions

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

res = 0
tmp = math.ceil(m/n)
for i in range(1, tmp+1):
    res = (max(res, fractions.gcd(i, m-((n-1)*i))))
print(res)


Fixed submission:
import math

n, m = map(int, input().split())
array = []
for i in range(1, int(math.sqrt(m)+1)):
    if m % i == 0:
        array.append([i, m//i])

diff = float("inf")
res = 0
for i, j in array:
    if i >= n:
        res = max(res, j)
    if j >= n:
        res = max(res, i)
print(res)
Buggy python submission (verdict: Runtime Error):
s = input()
k = input()

print(s[0] if s[0] != "1" else s[1])

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

#A = int(l[0])


length_1 = len(S)
K = int(K)

i =int(S)
v_1 = []
#cnt = []
while i > 0:
    v_1.append( i % 10 )
    #cnt.append(1)
    i //= 10 # 必須
v_1.reverse()

length_n = 0
target_v_num = 0

while length_n < K:
    V = v_1[target_v_num]
    length_n = length_n + 1
    if V > 1:
        length_n = length_n + K
    target_v_num = target_v_num + 1


print(V)

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

print(s[0] if s[0] != 1 else s[1])

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

#A = int(l[0])


length_1 = len(S)
K = int(K)

i =int(S)
v_1 = []
#cnt = []
while i > 0:
    v_1.append( i % 10 )
    #cnt.append(1)
    i //= 10 # 必須
v_1.reverse()

length_n = 0
target_v_num = 0

while length_n < K:
    V = v_1[target_v_num]
    length_n = length_n + 1
    if V > 1:
        length_n = length_n + K
    target_v_num = target_v_num + 1


print(V)

Buggy python submission (verdict: Runtime Error):
s = int(input())
k = int(inout())

print(s[0] if s[0] != 1 else s[1])

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

#A = int(l[0])


length_1 = len(S)
K = int(K)

i =int(S)
v_1 = []
#cnt = []
while i > 0:
    v_1.append( i % 10 )
    #cnt.append(1)
    i //= 10 # 必須
v_1.reverse()

length_n = 0
target_v_num = 0

while length_n < K:
    V = v_1[target_v_num]
    length_n = length_n + 1
    if V > 1:
        length_n = length_n + K
    target_v_num = target_v_num + 1


print(V)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a* b == 15:
    print("*")
elif a+ b == 15:
    print("+")
else:
    print(x)

Fixed submission:
a, b = map(int, input().split())
if a* b == 15:
    print("*")
elif a+ b == 15:
    print("+")
else:
    print("x")
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
array = [int(x) for x in input().split()]
array2 = [array[x]-(x+1) for x in range(n)]

b_ = array2[n//2]
b_1 = array2[n//2+1]
b_2 = array2[n//2-1]

res = [abs(array[x]-(b_+x+1)) for x in range(n)]
res1 = [abs(array[x]-(b_1+x+1)) for x in range(n)]
res2 = [abs(array[x]-(b_2+x+1)) for x in range(n)]
print(min(sum(res)), sum(res1), sum(res2))



Fixed submission:
n = int(input())
array = [int(x) for x in input().split()]
array2 = [x-(i+1) for i, x in enumerate(array)]

b_ = sorted(array2)[n//2]

res = [abs(array[x]-(b_+x+1)) for x in range(n)]
print(sum(res))
Buggy python submission (verdict: Runtime Error):
n = input()
n_ = sum([int(x) for x in n])
print("Yes" if n%n_ == 0 else "No")

Fixed submission:
n = input()
n_ = sum([int(x) for x in n])
print("Yes" if int(n)%n_ == 0 else "No")
Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
s = input()

res = float("inf")

for i in range(n):
    tmp_res = 0
    tmp = s[:i]
    tmptmp = s[i+1:]
    tmp_dict = collections.Counter(tmp)
    tmptmp_dict = collections.Counter(tmptmp)
    tmp_res += tmp_dict["W"]
    tmp_res += tmptmp_dict["E"]

    if tmp_res < res:
        res = tmp_res

print(res)



Fixed submission:
import collections

n = int(input())
s = input()
s_w = s.count("W")
s_e = s.count("E")

w_array = [0 for x in range(n)]
e_array = [0 for x in range(n)]
w_tmp = 0
e_tmp = 0

for i in range(n):
    if s[i] == "W":
        w_tmp += 1
    else:
        e_tmp += 1
    w_array[i] += w_tmp
    e_array[i] += s_e - e_tmp

res = min(s[1:].count("E"), s[:-1].count("W"))

for count in range(1, n-1):
    if w_array[count]+e_array[count+1] < res:
        res = w_array[count]+e_array[count]

print(res)

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

res = float("inf")

for i in range(n):
    tmp_res = 0
    tmp = s[:i]
    tmptmp = s[i+1:]
    tmp_res += tmp.count("W")
    tmp_res += tmptmp.count("E")

    if tmp_res < res:
        res = tmp_res

print(res)



Fixed submission:
import collections

n = int(input())
s = input()
s_w = s.count("W")
s_e = s.count("E")

w_array = [0 for x in range(n)]
e_array = [0 for x in range(n)]
w_tmp = 0
e_tmp = 0

for i in range(n):
    if s[i] == "W":
        w_tmp += 1
    else:
        e_tmp += 1
    w_array[i] += w_tmp
    e_array[i] += s_e - e_tmp

res = min(s[1:].count("E"), s[:-1].count("W"))

for count in range(1, n-1):
    if w_array[count]+e_array[count+1] < res:
        res = w_array[count]+e_array[count]

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

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

if k % 2 != 1:
    print(a - b if abs(math.log10(abs(a-b))) <= 18 else "Unfair")
else:
    print(b - a if abs(math.log10(abs(a-b))) <= 18 else "Unfair")


Fixed submission:
import math

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

if k % 2 != 1:
    if a-b == 0:
        print(0)
    else:
        print(a - b if abs(math.log10(abs(a-b))) <= 18 else "Unfair")
else:
    if a-b == 0:
        print(0)
    else:
        print(b - a if abs(math.log10(abs(a-b))) <= 18 else "Unfair")

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

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

if k % 2 != 1:
    print(a - b if abs(math.log10(a-b)) <= 18 else "Unfair")
else:
    print(b - a if abs(math.log10(a-b)) <= 18 else "Unfair")


Fixed submission:
import math

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

if k % 2 != 1:
    if a-b == 0:
        print(0)
    else:
        print(a - b if abs(math.log10(abs(a-b))) <= 18 else "Unfair")
else:
    if a-b == 0:
        print(0)
    else:
        print(b - a if abs(math.log10(abs(a-b))) <= 18 else "Unfair")
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

array = []
for i in range(0, k):
    for j in range(0, len(s)-i):
        array.append(s[j:j+i+1])
print(sorted(set(array))[4])

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

array = []
for i in range(0, k):
    for j in range(0, len(s)-i):
        array.append(s[j:j+i+1])

print(sorted(set(array))[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

for i in range(a, b+1):
    if abs(a-i) < k or abs(b-i) < k:
        print(i)

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

res = []

for i in range(a, min(a+k, b+1)):
    res.append(i)

for j in range(max(a, b-k+1), b+1):
    res.append(j)

for k in sorted(set(res)):
    print(k)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())

print(min(a, b) + min(c, d))


Fixed submission:
a= int(input())
b= int(input())
c= int(input())
d= int(input())

print(min(a, b)+min(c,d))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
array = [int(x) for x in input().split()]

tmp_res = 0
tmp_ici = 0
tmp_array = []
for i in array:
    tmp_array.append(abs(tmp_ici-i))
    tmp_ici = i
tmp_array.append(abs(tmp_ici-0))

array = [0] + array + [0]
for i in range(n):
    c = array[i]
    cc = array[i+2]
    a = tmp_array[:i]
    b = tmp_array[i+2:]
    print(sum(a)+abs(c-cc)+sum(b))

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

tmp_res = 0
tmp_ici = 0
tmp_array = []
for i in array:
    tmp_array.append(abs(tmp_ici-i))
    tmp_ici = i
tmp_array.append(abs(tmp_ici-0))
tmp_sum = sum(tmp_array)

array = [0] + array + [0]
for i in range(n):
    c = array[i]
    cc = array[i+2]
    a = sum(tmp_array[i:i+2])
    print(tmp_sum-a+abs(c-cc))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
array = [int(x) for x in input().split()]

tmp_res = 0
tmp_ici = 0
tmp_array = []
for i in array:
    tmp_array.append(abs(tmp_ici-i))
    tmp_ici = i
tmp_array.append(abs(tmp_ici-0))

array = [0] + array + [0]
for i in range(n):
    c = array[i]
    cc = array[i+2]
    a = tmp_array[:i]
    b = tmp_array[i+2:]
    print(sum(a)+abs(c-cc)+sum(b))

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

tmp_res = 0
tmp_ici = 0
tmp_array = []
for i in array:
    tmp_array.append(abs(tmp_ici-i))
    tmp_ici = i
tmp_array.append(abs(tmp_ici-0))
tmp_sum = sum(tmp_array)

array = [0] + array + [0]
for i in range(n):
    c = array[i]
    cc = array[i+2]
    a = sum(tmp_array[i:i+2])
    print(tmp_sum-a+abs(c-cc))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
array = [int(x) for x in input().split()]

for i in range(n):
    tmp = list(array)
    tmp.remove(tmp[i])
    res = 0
    ichi = 0
    for j in tmp:
        res += abs(ichi-j)
        ichi = j

    print(res+abs(ichi))


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

tmp_res = 0
tmp_ici = 0
tmp_array = []
for i in array:
    tmp_array.append(abs(tmp_ici-i))
    tmp_ici = i
tmp_array.append(abs(tmp_ici-0))
tmp_sum = sum(tmp_array)

array = [0] + array + [0]
for i in range(n):
    c = array[i]
    cc = array[i+2]
    a = sum(tmp_array[i:i+2])
    print(tmp_sum-a+abs(c-cc))
Buggy python submission (verdict: Runtime Error):
n = int(input())
array = [int(x) for x in input().split()]
sum_array = [0 for x in range(n+1)]
now = 0
for i in range(n):
  sum_array[i] = abs(array[i]-now)
  now = array[i]
else:
  sum_array[-1] = abs(now)

for j in range(n):
  if j == 0:
    print(sum_array[-1])
  elif j == n-1:
    print(sum_array[-2]+abs(array[-2]))
  else:
    print(sum_array[-1]-(sum_array[j]-sum_array[j-1])-(sum_array[j+1]-sum_array[j])+(abs(array[j+1]-array[j-1]))

Fixed submission:
n = int(input())
array = [int(x) for x in input().split()]
sum_array = [0]
now = 0
for i in range(n):
    sum_array.append(sum_array[i] + abs(array[i] - now))
    now = array[i]
else:
    sum_array.append(sum_array[-1] + abs(array[-1] - 0))

for j in range(n):
    if j == 0:
        print(sum_array[-1] -
              (sum_array[j + 1] - sum_array[j]) -
              (sum_array[j + 2] - sum_array[j + 1]) +
              (abs(array[j + 1] - 0))
              )
    elif j == n - 1:
        print(sum_array[-3] + abs(array[-2]))
    else:
        print(sum_array[-1] -
              (sum_array[j + 1] - sum_array[j]) -
              (sum_array[j + 2] - sum_array[j + 1]) +
              (abs(array[j + 1] - array[j - 1]))
              )
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n = int(input())

array = []
dict = {}
dict["M"] = dict["A"] = dict["R"] = dict["C"] = dict["H"] = 0
for i in range(n):
    tmp = input()
    dict[tmp[0]] = dict.get(tmp[0], 0) + 1

if dict["M"] == 0 and dict["A"] == 0 and dict["R"] == 0 and dict["C"] == 0 and dict["H"] == 0:
    print(0)
else:
    tmp = []
    for i in [dict["M"], dict["A"], dict["R"], dict["C"], dict["H"]]:
        if i != 0:
            tmp.append(i)
    judge = 0
    for l in tmp:
        if l != 0 and l != 1:
            tmp2 = list(tmp)
            tmp2.remove(l)
            judge += (l-1)*len(tmp2)

    res = len(list(itertools.combinations(range(sum(tmp)), 3))) - judge

    print(res)


Fixed submission:
import itertools
n = int(input())

array = []
dict = {}
dict["M"] = dict["A"] = dict["R"] = dict["C"] = dict["H"] = 0
for i in range(n):
    tmp = input()
    dict[tmp[0]] = dict.get(tmp[0], 0) + 1

m = dict["M"]
a = dict["A"]
r = dict["R"]
c = dict["C"]
h = dict["H"]
print(m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+
      a*r*c+a*r*h+a*c*h+r*c*h)
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if (a*b %2 == 0){
        printf("Even");
    } else{
        printf("Odd");
    }

    return 0;
}

Fixed submission:
n,m= map(int, input().split())
print("Even" if (n*m)%2 == 0 else "Odd")
Buggy python submission (verdict: Time Limit Exceeded):
import sys

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

for i in range(m//1000+1):
    for j in range((m-1000*i)//5000+1):
        if i % 1 == 0 and j % 1 == 0:
            if n-(i+j) >= 0 and i*1000 + j* 5000 + (n-(i+j))*10000 == m:
                print(n-(i+j), j, i)
                sys.exit()
print(-1, -1, -1)


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

flag = False

for z in range(N + 1)[::-1]:
    rem1 = N - z + 1
    for y in range(rem1)[::-1]:
        x = N - z - y
        val = 10000 * x + 5000 * y + 1000 * z
        if val == Y:
            flag = True
            break
    if flag:
        break

if not flag:
    x = -1
    y = -1
    z = -1

print(x, y, z)

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

flag = False

for z in range(n + 1)[::-1]:
    rem1 = n - z + 1
    for y in range(rem1)[::-1]:
        x = n - z - y
        val = 10000 * x + 5000 * y + 1000 * z
        if val == y:
            flag = True
            break
    if flag:
        break

if not flag:
    x, y, z = -1

print(x, y, z)


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

flag = False

for z in range(N + 1)[::-1]:
    rem1 = N - z + 1
    for y in range(rem1)[::-1]:
        x = N - z - y
        val = 10000 * x + 5000 * y + 1000 * z
        if val == Y:
            flag = True
            break
    if flag:
        break

if not flag:
    x = -1
    y = -1
    z = -1

print(x, y, z)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(input().split())

if (a+b > c+d):
    print("Left")
elif (a + b < c + d):
    print("Right")
else:
    print(("Balanced"))

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

if (a[0]+a[1] > a[2]+a[3]):
    print("Left")
elif (a[0]+a[1] < a[2]+a[3]):
    print("Right")
else:
    print(("Balanced"))
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n = int(input())

a = sorted([int(x) for x in input().split()])
b = sorted([int(x) for x in input().split()])
c = sorted([int(x) for x in input().split()])

res = 0
for cc in c:
    b_res = bisect.bisect_left(b, cc)
    for bb in b[:b_res]:
        res += (bisect.bisect_left(a, bb))

print(res)

Fixed submission:
import bisect

num = int(input())
top = sorted([int(x) for x in input().split()])
middle = sorted([int(x) for x in input().split()])
bottom = sorted([int(x) for x in input().split()])


# middleの配列でループを回したほうが早い(topとbottomを同時に処理できるため)
res = 0
for i in middle:
    index = bisect.bisect_left(top, i)
    index2 = len(bottom)-bisect.bisect_right(bottom, i)
    res += index*index2

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

num = int(input())
top = sorted([int(x) for x in input().split()])
middle = sorted([int(x) for x in input().split()])
bottom = sorted([int(x) for x in input().split()])


res = 0
for i in top:
    index = bisect.bisect_right(middle, i)
    if index != len(middle):
        for j in middle[index:]:
            index2 = bisect.bisect_right(bottom, j)
            if index2 != len(bottom):
                res += len(bottom) - index2
print(res)

Fixed submission:
import bisect

num = int(input())
top = sorted([int(x) for x in input().split()])
middle = sorted([int(x) for x in input().split()])
bottom = sorted([int(x) for x in input().split()])


# middleの配列でループを回したほうが早い(topとbottomを同時に処理できるため)
res = 0
for i in middle:
    index = bisect.bisect_left(top, i)
    index2 = len(bottom)-bisect.bisect_right(bottom, i)
    res += index*index2

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
kind = int(input())
top = input().split()
top = [int(x) for x in top]
top.sort()
middle = input().split()
middle = [int(x) for x in middle]
middle.sort()
down = input().split()
down = [int(x) for x in down]
down.sort()

res = 0
for i in range(0, len(down)):
    for j in range(0, len(middle)):
        if middle[j] >= down[i]:
            break
        for k in range(0, len(top)):
            if top[k] >= middle[j]:
                break
            elif top[k] < middle[j] < down[i]:
                res += 1
print(res)


Fixed submission:
import bisect

num = int(input())
top = sorted([int(x) for x in input().split()])
middle = sorted([int(x) for x in input().split()])
bottom = sorted([int(x) for x in input().split()])


# middleの配列でループを回したほうが早い(topとbottomを同時に処理できるため)
res = 0
for i in middle:
    index = bisect.bisect_left(top, i)
    index2 = len(bottom)-bisect.bisect_right(bottom, i)
    res += index*index2

print(res)
Buggy python submission (verdict: Runtime Error):
import copy


def dfs(array, pos, res_array):
    res = False
    if False not in res_array:
        return True
    elif res_array[pos]:
        return False
    else:
        res_array[pos] = True
        for i in array[pos]:
            if dfs(array, i, res_array):
                res = True
    return res


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

array = [[int(x) for x in input().split()] for x in range(m)]
res_array = [True] + [False for x in range(n)]

res = 0
for i in range(len(array)):
    adj_array = [[] for x in range(n + 1)]
    tmp_array = array[:i] + [[]] + array[i+1:]
    for item in tmp_array:
        if len(item) == 0:
            continue
        adj_array[item[0]].append(item[1])
        adj_array[item[1]].append(item[0])
    res += 1 ^ dfs(adj_array, -i-1, copy.copy(res_array))

print(res)


Fixed submission:
def dfs(array, visited, next):
    if visited[next] is not True and len(array[next]) != 0:
        visited[next] = True
        for next_node in array[next]:
            visited = dfs(array, visited, next_node)
    else:
        return visited
    return visited


n, m = map(int, input().split())
edge_array = []
for i in range(m):
    edge_array.append([int(x) for x in input().split()])

cnt = 0
for _ in edge_array:
    remove_edge = edge_array[0]
    edge_array.remove(remove_edge)
    node_array = [[] for x in range(n + 1)]
    # 隣接リストの作成
    for edge in edge_array:
        node_array[edge[0]].append(edge[1])
        node_array[edge[1]].append(edge[0])
        visited = [False]*(n+1)
    res = dfs(node_array, visited, 1)
    if res.count(False) != 1:
        cnt += 1
    edge_array.append(remove_edge)

print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
d_array = [int(x) for x in input().split()]
d_dict = {}
for i in range(200000+1):
    d_dict[i] = 0
for d in d_array:
    d_dict[d] += 1
m = int(input())
t_array = sorted([int(x) for x in input().split()])

for t in t_array:
    if d_dict[t] > 0:
        d_dict[t] -= 1
    else:
        print("NO")
        break
else:
    print("YES")


Fixed submission:
n = int(input())
d_array = [int(x) for x in input().split()]
d_dict = {}
for d in d_array:
    d_dict.setdefault(d, 0)
    d_dict[d] += 1
m = int(input())
t_array = sorted([int(x) for x in input().split()])

try:
    for t in t_array:
        if d_dict[t] > 0:
            d_dict[t] -= 1
        else:
            print("NO")
            break
    else:
        print("YES")
except KeyError:
    print("NO")
    exit()

Buggy python submission (verdict: Time Limit Exceeded):
value = int(input())
have_array = input().split()
have_array = [int(x) for x in have_array]

value2 = int(input())
problem_array = input().split()
problem_array = [int(x) for x in problem_array]


error = True
for i in range(0, value2):
    if have_array.count(problem_array[i]) < problem_array.count(problem_array[i]):
        error = False
        break
print("YES" if error == True else "NO")

Fixed submission:
n = int(input())
d_array = [int(x) for x in input().split()]
d_dict = {}
for d in d_array:
    d_dict.setdefault(d, 0)
    d_dict[d] += 1
m = int(input())
t_array = sorted([int(x) for x in input().split()])

try:
    for t in t_array:
        if d_dict[t] > 0:
            d_dict[t] -= 1
        else:
            print("NO")
            break
    else:
        print("YES")
except KeyError:
    print("NO")
    exit()

Buggy python submission (verdict: Time Limit Exceeded):
value = int(input())
have_array = input().split()
have_array = [int(x) for x in have_array]

value2 = int(input())
problem_array = input().split()
problem_array = [int(x) for x in problem_array]

try:
    for i in range(0, value2):
        have_array.remove(problem_array[i])
except ValueError:
    print("NO")

if len(have_array) == value - len(problem_array):
    print("YES")


Fixed submission:
n = int(input())
d_array = [int(x) for x in input().split()]
d_dict = {}
for d in d_array:
    d_dict.setdefault(d, 0)
    d_dict[d] += 1
m = int(input())
t_array = sorted([int(x) for x in input().split()])

try:
    for t in t_array:
        if d_dict[t] > 0:
            d_dict[t] -= 1
        else:
            print("NO")
            break
    else:
        print("YES")
except KeyError:
    print("NO")
    exit()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
if n == 1:
    print(1, 1, 1)
    exit()
for i in range(1, 3500 + 1):
    for j in range(1, 3500 + 1):
        if 4 * i * j - n * i - n * j == 0:
            continue
        w = n * i * j / (4 * i * j - n * i - n * j)
        if w % 1 == 0 and w > 0:
            print(i, j, int(w))
            exit()

Fixed submission:
n = int(input())
if n == 1:
    print(1, 1, 1)
    exit()
for i in range(1, 3500 + 1):
    for j in range(1, 3500 + 1):
        if 4 * i * j - n * i - n * j == 0:
            continue
        w = n * i * j / (4 * i * j - n * i - n * j)
        if w % 1 == 0 and w > 0:
            print(i, j, int(w))
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    num = int(input())
    value_array = []
    for i in range(0, num):
        value = input().split()
        value_array.append([int(x) for x in value])
        value_array.sort(key=lambda x:x[0])
    print(value_array[len(value_array)-1][0]+value_array[len(value_array)-1][1])



if __name__ == '__main__':
    main()


Fixed submission:
def main():
    num = int(input())
    value_array = []
    for i in range(0, num):
        value = input().split()
        value_array.append([int(x) for x in value])
    max_array = max(value_array)
    print(max_array[0] + max_array[1])


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
s = input()
print("Yes" if "9" in s else "No)

Fixed submission:
value = int(input())
if value // 10 == 9 or value % 10 == 9:
	print("Yes")
else:
	print("No")