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

Fixed submission:
from itertools import permutations


def calc_distance(x1, y1, x2, y2):
    return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5


n = int(input())
xy_array = [[int(x) for x in input().split()] for y in range(n)]
p = permutations([x for x in range(n)])

sum_distance = 0
for order in p:
    for index in range(n - 1):
        x1 = xy_array[order[index]][0]
        x2 = xy_array[order[index + 1]][0]
        y1 = xy_array[order[index]][1]
        y2 = xy_array[order[index + 1]][1]
        sum_distance += calc_distance(x1, y1, x2, y2)
tmp = 1
for i in range(2, n + 1):
    tmp *= i
print(sum_distance / tmp)

Buggy submission (verdict: Runtime Error):
from itertools import permutations

n = int(input())
distance_array = [[0 for x in range(2)] for y in range(n)]
for i in range(n):
    x, y = map(int, input().split())
    distance_array[i][0] = x
    dustance_array[i][1] = y
p = permutations([x for x in range(n)], 8)
print(p)
Problem p02918 (python)

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

cnt = 0
for i, j in zip(s, s[1:]):
    if i == j:
        cnt += 1
print(min(n-1, cnt+2*k))

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

l_array = [0 for x in range(n)]
l_reverse = []
r_array = [0 for x in range(n)]
r_reverse = []

cnt = []
l_cnt = 0
r_cnt = 0
now = s[0]
for index, ss in enumerate(s):
    if ss == "L":
        if now == ss:
            l_cnt += 1
        else:
            cnt.append(r_cnt)
            r_cnt = 0
            l_cnt = 1
            now = "L"
    else:
        if now == ss:
            r_cnt += 1
        else:
            cnt.append(l_cnt)
            l_cnt = 0
            r_cnt = 1
            now = "R"
else:
    cnt.append(max(l_cnt, r_cnt))

len_cnt = len(cnt)
res = []
for i in range(0, len_cnt, 2):
    if i+1>=len_cnt: continue
    res.append(cnt[i]+cnt[i+1])
res = sorted(res, reverse=True)
ans = 0
for j in range(k):
    ans += res[j]
print(ans)
Problem p02928 (python)

Fixed submission:
n, k = map(int, input().split())
a_array = [int(x) for x in input().split()]
INF = 10**9+7

cnt_array = [0 for x in range(2000+1)]
a_array2 = []
ans = 0
for a in a_array:
    cnt_array[a] += 1
    a_array2.append(sum(cnt_array[a+1:]))
a_array3 = []
for i in a_array:
    tmp = 0
    for j in a_array[::-1]:
        if j > i:
            tmp += 1
    a_array3.append(tmp)
for cnt, d in zip(a_array2, a_array3):
    ans += (k*(2*cnt+(k-1)*d))//2
    ans = ans % INF
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a_array = [int(x) for x in input().split()]
INF = 10**9+7

cnt_array = [0 for x in range(n+1)]
a_array2 = []
ans = 0
for a in a_array:
    cnt_array[a] += 1
    a_array2.append(sum(cnt_array[a+1:]))
a_array3 = []
for i in a_array:
    tmp = 0
    for j in a_array[::-1]:
        if j > i:
            tmp += 1
    a_array3.append(tmp)
for cnt, d in zip(a_array2, a_array3):
    ans += (k*(2*cnt+(k-1)*d))//2
    ans = ans % INF
print(ans)
Problem p02947 (python)

Fixed submission:
from collections import Counter

n = int(input())
array = sorted(["".join(sorted(input())) for x in range(n)])
counter = Counter(array)

res = 0
for key, value in counter.items():
    res += value*(value-1)//2
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
array = [sorted(input()) for x in range(n)]
set_array = set()
for i in array:
  set_array.add(i)
print(len(array) - len(set_array))

Buggy submission (verdict: Runtime Error):
n = int(input())
array = [sorted(input()) for x in range(n)]
print(len(set(array)) )

Buggy submission (verdict: Runtime Error):
n = int(input())
array = [sorted(input()) for x in range(n)]
print(len(array) - len(set(array)))
Problem p03000 (python)

Fixed submission:
n, x = map(int, input().split())
l_array = [int(x) for x in input().split()]
cnt = 1
now = 0
for l in l_array:
    now += l
    if now > x:
        break
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l_array = [int(x) for x in input().split()]
d = 0
cnt = 1
for i in range(n+1):
    d = d + l_array[i]
    if d > x:
        break
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l_array = [int(x) for x in input().split()]
d = 0
cnt = 0
while d <= x:
    d = d + l_array[cnt]
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l_array = [int(x) for x in input().split()]
d = 0
cnt = 0
while d <= x:
  d = d+l_array[d]
  cnt += 1
print(cnt)
Problem p03006 (python)

Fixed submission:
from itertools import combinations
from collections import Counter

n = int(input())
xy_array = [[int(x) for x in input().split()] for y in range(n)]
comb_xy = combinations(xy_array, 2)
ans = float("INF")
res_x = 0
res_y = 0

vector = []
for i, j in comb_xy:
    xx = j[0] - i[0]
    yy = j[1] - i[1]
    vector.append((xx, yy))
    xx = i[0] - j[0]
    yy = i[1] - j[1]
    vector.append((xx, yy))

if n == 1:
    print(1)
    exit()
print(n - max(Counter(vector).values()))

Buggy submission (verdict: Runtime Error):
from itertools import combinations

n = int(input())
xy_array = [[int(x) for x in input().split()] for y in range(n)]
comb_xy = combinations(xy_array, 2)
ans = float("INF")
res_x = 0
res_y = 0

for i, j in comb_xy:
    xx = j[0]-i[0]
    yy = j[1]-i[1]
    tmp = 0
    base_x = xy_array[0][0]
    base_y = xy_array[0][1]
    for x, y in xy_array[1:]:
        if base_x + xx == x and base_y + yy == y:
            pass
        else:
            tmp += 1
        base_x = x
        base_y = y
    tmp = min(tmp, ans)
print(tmp+1)
Problem p03150 (python)

Fixed submission:
s = input()
tmp = "keyence"
# if s == "keyence":
#     print("YES")
#     exit()
for i in range(len(s)):
    for j in range(i, len(s)):
        tmp2 = s[:i] + s[j:]
        if tmp2 == "keyence":
            print("YES")
            exit()
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
s = input()
tmp = "keyence"
# if s == "keyence":
#     print("YES")
#     exit()
cnt = 0
aaa = True
for i in s:
    if i == tmp[0]:
        aaa = True
        tmp = tmp[1:]
    else:
        if aaa and cnt == 0:
            aaa = False
            cnt += 1
        elif not aaa and cnt == 1:
            pass
        else:
            break

print("YES" if len(tmp) == 0 else "NO")
Problem p03157 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000000)


h, w = map(int, input().split())
s_array = ["+" * (w + 2)]
for i in range(h):
    s_array.append("+" + input() + "+")
else:
    s_array.append("+" * (w + 2))
moving = [[0, 1], [0, -1], [1, 0], [-1, 0]]
visit = [[False for x in range(w+2)] for x in range(h+2)]


def recursive(mark_point, mark_sharp, row, point):
    # 訪問済みならreturn
    if visit[row][point]:
        return mark_point, mark_sharp
    else:
        visit[row][point] = True

    for x, y in moving:
        # 範囲外かどうかと連結かどうか
        if s_array[row + x][point + y] != "+" and s_array[row + x][point + y] != s_array[row][point]:
            if visit[row+x][point+y]:
                continue
            # 移動先のマークの確認
            if s_array[row + x][point + y] == "#":
                mark_sharp += 1
            else:
                mark_point += 1
            mark_point, mark_sharp = recursive(mark_point, mark_sharp, row + x, point + y)
    else:
        return mark_point, mark_sharp


res = 0
for row in range(1, h + 1):
    for point in range(1, w + 1):
        m, n = recursive(s_array[row][point].count("."), s_array[row][point].count("#"), row, point)
        res += m*n
print(res)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
s_array = ["+" * (w + 2)]
for i in range(h):
    s_array.append("+" + input() + "+")
else:
    s_array.append("+" * (w + 2))
moving = [[0, 1], [0, -1], [1, 0], [-1, 0]]
visit = [[False for x in range(w+2)] for x in range(h+2)]


def recursive(mark, mark_point, mark_sharp, row, point):
    # 訪問済みならreturn
    if visit[row][point]:
        return mark_point, mark_sharp
    else:
        visit[row][point] = True

    for x, y in moving:
        # 範囲外かどうかと連結かどうか
        if s_array[row + x][point + y] != "+" and s_array[row + x][point + y] != s_array[row][point]:
            if visit[row+x][point+y]:
                continue
            # 移動先のマークの確認
            if s_array[row + x][point + y] == "#":
                mark_sharp += 1
            else:
                mark_point += 1
            mark_point, mark_sharp = recursive(mark, mark_point, mark_sharp, row + x, point + y)
    else:
        return mark_point, mark_sharp


res = 0
for row in range(1, h + 1):
    for point in range(1, w + 1):
        m, n = recursive(s_array[1][1], s_array[1][1].count("."), s_array[1][1].count("#"), row, point)
        res += m*n
print(res)
Problem p03241 (python)

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 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)
Problem p03282 (python)

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 submission (verdict: Runtime Error):
s = input()
k = input()

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

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

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

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

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

Fixed submission:
a, b = map(int, input().split())
if a* b == 15:
    print("*")
elif a+ b == 15:
    print("+")
else:
    print("x")

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

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 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))
Problem p03316 (python)

Fixed submission:
n = input()
n_ = sum([int(x) for x in n])
print("Yes" if int(n)%n_ == 0 else "No")

Buggy submission (verdict: Runtime Error):
n = input()
n_ = sum([int(x) for x in n])
print("Yes" if n%n_ == 0 else "No")
Problem p03353 (python)

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 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])
Problem p03363 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
b=[]
sum=0
for i in range(n):
    sum+=a[i]
    b.append(sum)
b=sorted(b)
b.append(float("inf"))
k=0
for i in range(n):
    if b[i]==b[i+1]:
        k+=1
    else:
        if not k==0:
            ans+=k*(k+1)//2
        k=0
for i in range(n):
    if b[i]==0:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
def calc(value):
    tmp = 1
    for i in range(1, value+1):
        tmp *= i
    return tmp//2


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

tmp_sum = 0
sum_array = []

for i in array:
    tmp_sum += i
    sum_array.append(tmp_sum)

sum_dict = {x:sum_array.count(x) for x in set(sum_array)}

minus = 0
if sum_array.count(0) == 1:
    sum_dict[0] += 1
else:
    minus = sum_dict[0]

res = 0
for key, value in sum_dict.items():
    if value >= 2:
        res += calc(value)

print(res-minus)

Buggy submission (verdict: Runtime Error):
def calc(value):
    tmp = 1
    for i in range(1, value+1):
        tmp *= i
    return tmp//2


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

tmp_sum = 0
sum_array = []

for i in array:
    tmp_sum += i
    sum_array.append(tmp_sum)

sum_dict = {x:sum_array.count(x) for x in set(sum_array)}

minus = 0
if sum_array.count(0) == 1:
    sum_dict[0] += 1
else:
    minus = sum_dict[0]

res = 0
for key, value in sum_dict.items():
    if value >= 2:
        res += calc(value)

print(res-minus)
Problem p03399 (python)

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

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

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

print(min(a, b) + min(c, d))
Problem p03403 (python)

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 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]))
Problem p03455 (python)

Fixed submission:
n,m= map(int, input().split())
print("Even" if (n*m)%2 == 0 else "Odd")

Buggy 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;
}
Problem p03471 (python)

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 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)
Problem p03476 (python)

Fixed submission:
import math
import bisect


def is_prime(x):
    if x < 2: return False # 2未満に素数はない
    if x == 2 or x == 3 or x == 5: return True # 2,3,5は素数
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False # 2,3,5の倍数は合成数

    # ためし割り: 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True


if __name__ == '__main__':
    q = int(input())
    array = [[int(x) for x in input().split()] for x in range(q)]
    nearby_2017 = [x for x in range(1, 100000, 2) if is_prime(x) and is_prime((x+1)/2)]
    for i, j in array:
        print(bisect.bisect_right(nearby_2017, j) - bisect.bisect_left(nearby_2017, i))

Buggy submission (verdict: Runtime Error):
import bisect


def primes(n):
    sieve = [True] * n
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i]:
            sieve[i * i::2 * i] = [False] * (int((n - i * i - 1) / (2 * i)) + 1)
    return [2] + [i for i in range(3, n, 2) if sieve[i]]


q = int(input())
array = [[int(x) for x in input().split()] for z in range(q)]

primes_array = primes(10000+1)
res_primes = [0 for x in range(10000+1)]
cum_sum = 0
for x in range(10000+1):
    if x in primes_array and (x+1) // 2 in primes_array:
        cum_sum += 1
    res_primes[x] = cum_sum

for l, r in array:
    res = res_primes[r] - res_primes[l-1]
    print(res)

Buggy submission (verdict: Runtime Error):
import bisect


def primes(n):
    sieve = [True] * n
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i]:
            sieve[i * i::2 * i] = [False] * (int((n - i * i - 1) / (2 * i)) + 1)
    return [2] + [i for i in range(3, n, 2) if sieve[i]]


q = int(input())
array = [[int(x) for x in input().split()] for z in range(q)]

primes_array = primes(10000)
res_primes = [0 for x in range(10000+1)]
cum_sum = 0
for x in range(10000+1):
    if x in primes_array and (x+1) // 2 in primes_array:
        cum_sum += 1
    res_primes[x] = cum_sum

for l, r in array:
    res = res_primes[r] - res_primes[l-1]
    print(res)
Problem p03477 (python)

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 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"))
Problem p03569 (python)

Fixed submission:
s = input()
ns = s.replace('x', '')
if s == s[::-1]:
    print(0)
elif ns != ns[::-1]:
    print(-1)
else:
    cnt = 0
    i = 0
    j = len(s)-1
    while(i<j):
        if s[i]=='x' and s[j]!='x':
            cnt += 1
            j += 1
        elif s[i]!='x' and s[j]=='x':
            cnt += 1
            i -= 1
        i += 1
        j -= 1
    print(cnt)

Buggy submission (verdict: Runtime Error):
def calc(value):
    res = 0
    while True:
        if len(value) == 1:
            break
        elif value[0] != value[-1] and value[0] != "x" and value[-1] != "x":
            res = -1
            break
        elif value[0] == value[-1]:
            value.pop(0)
            value.pop()
        else:
            value.extend("x") if value[0] == "x" else value.insert(0, "x")
            value.pop(0)
            value.pop()
            res += 1
    return res


def main():
    value = list(input())
    print(calc(value))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def calc(value):
    res = 0
    while True:
        if len(value) == 1:
            break
        elif value[0] != value[-1] and value[0] != "x" and value[-1] != "x":
            res = -1
            break
        elif value[0] == value[-1]:
            value.pop(0)
            value.pop()
        else:
            value.extend("x") if value[0] == "x" else value.insert(0, "x")
            res += 1
    return res


def main():
    value = list(input())
    print(calc(value))


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

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 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)
Problem p03578 (python)

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 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")
Problem p03605 (python)

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

Buggy submission (verdict: Runtime Error):
s = input()
print("Yes" if "9" in s else "No)