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

Fixed submission:
n = int(input())
b = list(map(int, input().split()))
b.reverse()
ans_set = [0]*n
ans = 0

for i in range(n):
    if ans == -1:
        break
    
    for j in range(n):
        if b[j] == n-j:
            ans = b.pop(j)
            ans_set[n-1] = ans
            n -= 1
            break
            
        elif b[j] > n-j:
            ans = -1
            print(ans)
            break

        if n == 0:
            break

if ans != -1:
    for k in ans_set:
        print(k)

Buggy submission (verdict: Runtime Error):
n = int(input())
b = list(map(int, input().split()))
b.reverse()
ans_set = [0]*n

for i in range(n):
    if ans == -1:
        break
    
    for j in range(n):
        if b[j] == n-j:
            ans = b.pop(j)
            ans_set[n-1] = ans
            n -= 1
            break
            
        elif b[j] > n-j:
            ans = -1
            print(ans)
            break

        if n == 0:
            break

if ans != -1:
    for k in ans_set:
        print(k)

Buggy submission (verdict: Runtime Error):
n = int(input())
b = [int(x) for x in input().split]
b.reverse()
b_counts = len(b)

for i in range(n):
    for j in range(n):
        
        if b[j] == b_counts-b.index()+1:
            ans = b.pop(j)
            b_counts -= 1
            print(ans)
        elif b[j] > b_counb_counts-b.index()+1:
            ans = -1
            break
        
        if b_counts == 0:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
b=list(map(int, input().split()))

a=[]

for i in range(N):
  if i+1 < b[i]:
    a=[0]*1
    a[0]= -1
    break
  a.insert(b[i],b[i])

for j in range(N):
  print(a[j])
Problem p03102 (python)

Fixed submission:
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
code = 0

for i in range(n):
    a = list(map(int, input().split()))
    
    for j in range(m):
        code += a[j] * b[j]
    
    code += c
    if code > 0:
        ans += 1
    code = 0
        
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, c = map(int, input.split())
b = list(map(int, input.split()))
ans = 0
code = 0

for i in range(n):
    for j in range(m):
        
        a = list(map(int, input.split()))
        code += a[j] * b[j]
    
    code -= 10
    if code >= 0:
        ans += 1
        
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, c = map(int, input.split())
b = list(map(int, input.split()))
ans = 0
code = 0

for i in range(n):
    for j in range(m):
        
        a = list(map(int, input.split()))
        code += a[i] * b[i]
    
    code -= 10
    if code >= 0:
        ans += 1
        
print(ans)
Problem p03103 (python)

Fixed submission:
# sys.stdin.readline()
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
ab = []
ans = 0
for i in range(n):
    a, b = map(int, input().split())
    ab.append((a,b))
ab = sorted(ab)
for c, d in ab:
    if m >= d:
        ans += c*d
        m -= d
    else:
        ans += c*m
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
match = 0
ans = 0
mini = min(a)

for j in range(n):
    for k in range(b[a.index(mini)]):
        if m <= match:
            break
        ans += mini
        match += 1
    
    b.pop(a.index(mini))
    a.remove(mini)
    mini = min(a)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
match = 0
ans = 0

for j in min(a):
    for k in range(b[a.index(j)]):
        if m <= match:
            break
        ans += j
        match += 1
    
    b.pop(a.index(j))
    a.remove(j)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
match = 0
ans = 0
mini = 0

while 1:
    mini = min(a)
    
    for j in range(b[a.index(mini)]):
        ans += mini
        match += 1
        if m == match:
            break
    
    a.remove(mini)
print(ans)
Problem p03106 (python)

Fixed submission:
a, b, k = map(int, input().split())
mx = max(a, b)
match, ans = 0, 0

for i in range(mx):
    if ((a % (mx - i)) == 0) and ((b % (mx - i)) == 0):
        
        match += 1
        ans = mx - i
        
        if match == k:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
mx = round(max(a, b) * 0.5)
match, ans = 0, 0

for i in range(mx + 1):
    if ((a % (mx - i)) == 0) and ((b % (mx - i)) == 0):
        
        match += 1
        ans = mx - i
        
        if match == k:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
mx = max(a, b) * 0.5
match, ans = 0, 0

for i in range(mx):
    if ((a % (mx - i)) == 0) and ((b % (mx - i)) == 0):
        
        match += 1
        ans = mx - i
        
        if match == k:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
mx = max(a, b) * 0.5
match, ans = 0, 0

for i in range(mx):
    if ((a % (mx - i)) == 0) 
    and ((b % (mx - i)) == 0):
        
        match += 1
        ans = mx - i
        
        if match == k:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
mx = max(a, b) * 0.5
match, ans = 0, 0

for i in range(mx):
    if ((a % (mx - i)) == 0) 
    and ((b % (mx - i)) == 0):
        match += 1
        ans = mx - i
        
        if match == k:
            break
print(ans)
Problem p03110 (python)

Fixed submission:
N = int(input())
x = [0] * N
u = [0] * N
ans = 0

for i in range(N):
    x[i], u[i] = map(str, input().split())
    x[i] = float(x[i])

    if u[i] == 'BTC':
        ans += x[i] * 380000
    else:
        ans += x[i]

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
x = [0] * N
u = [0] * N
ans = 0

for i in range(N):
    x[i], u[i] = map(float, input().split())
    
    if u[i] == 'BTC':
        ans += x[i] * 380000
    else:
        ans += x[i]

print(ans)
Problem p03126 (python)

Fixed submission:
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
ka = []
ans = 0
for i in range(n):
    ka_memo = list(map(int, input().split()))
    ka.append(ka_memo[1:])

for i in range(1, m + 1):
    flg = True
    for j in range(n):
        if i not in ka[j]:
            flg = False
            break
    if flg:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ans = 0
k = [0] * n
a = [0] * n
for i in range(n):
    k[i], a[i] = int(input()), [int(j) for j in input().split()]
    
for match in range(1, m):
    for l in range(n):
        if match in a[i]:
            ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ans = 0
k = [0] * n
a = [0] * n
for i in range(n):
    k[i] = int(input())
    a[i] = [int(input()) for j in range(k[i])]
    
for match in range(1, m):
    for l in range(n):
        if match in a[i]:
            ans += 1

print(ans)
Problem p03128 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
a = list(map(int, readline().split()))
memo = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [''] * (n + 1)
for aa in a:
    if memo[aa] <= n:
        dp[memo[aa]] = max(dp[memo[aa]], str(aa))
for i in range(n):
    if dp[i] == '':
        continue
    for aa in a:
        if i + memo[aa] <= n:
            v = str(aa) + dp[i]
            if len(dp[i + memo[aa]]) < len(v):
                dp[i + memo[aa]] = v
            else:
                dp[i + memo[aa]] = max(dp[i + memo[aa]], v)
print(dp[-1])

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
a = list(map(int, readline().split()))
memo = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [''] * (n + 1)
for aa in a:
    if aa <= n:
        if dp[memo[aa]] < str(aa):
            dp[memo[aa]] = str(aa)
for i in range(n):
    if dp[i] == '':
        continue
    for aa in a:
        if i + memo[aa] <= n:
            v = str(aa) + dp[i]
            if len(dp[i + memo[aa]]) < len(v):
                dp[i + memo[aa]] = v
            else:
                dp[i + memo[aa]] = max(dp[i + memo[aa]], v)
print(dp[-1])

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
a = list(map(int, readline().split()))
memo = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [0] * (n + 1)
for aa in a:
    dp[memo[aa]] = max(dp[memo[aa]], aa)
for i in range(n):
    if dp[i] == 0:
        continue
    for aa in a:
        if i + memo[aa] <= n:
            v = int(str(aa) + str(dp[i]))
            if dp[i + memo[aa]] < v:
                dp[i + memo[aa]] = v
print(dp[-1])
Problem p03138 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, k, *a = map(int, read().split())
v = 0
ans = 0
for i in range(40, -1, -1):
    cnt = 0
    for aa in a:
        if (aa >> i) & 1:
            cnt += 1
    if n - cnt > cnt and v + (1 << i) <= k:
        v += 1 << i
        ans += (n - cnt) * (1 << i)
    else:
        ans += cnt * (1 << i)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, k、*a = map(int, read().split())
v = 0
ans = 0
for i in range(40, -1, -1):
    cnt = 0
    for aa in a:
        if aa >> i & 1:
            cnt += 1
    if n - cnt > cnt and v + 1 << i <= k:
        v += 1 << i
        ans += (n - cnt) * 1 << i
    else:
        ans += cnt * 1 << i
print(ans)
Problem p03160 (python)

Fixed submission:
import sys
input = sys.stdin.readline

n = int(input())
h = list(map(int, input().split()))
cnt = 0
dp = [0]*n
dp[1] = abs(h[1]-h[0])
for i in range(2, n):
    i_1 = dp[i-1] + abs(h[i]-h[i-1])
    i_2 = dp[i-2] + abs(h[i]-h[i-2])
    if i_1 > i_2:
        dp[i] = i_2
    else:
        dp[i] = i_1
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

n, W = map(int, input().split())
dp = [[0 for i in range(W + 1)] for j in range(n + 1)]
wv = [[int(x) for x in input().split()] for _ in range(n)]

for i in range(n):
    for j in range(W + 1):
        if j - wv[i][0] >= 0:
            dp[i + 1][j] = max(dp[i][j - wv[i][0]] + wv[i][1], dp[i + 1][j])
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])

print(max(dp[-1]))
Problem p03211 (python)

Fixed submission:
s = input()
ans_set = [0] * len(s)

for i in range(len(s)):
    x = abs(int(s[i:i+3])-753)
    ans_set[i] = x
ans = min(ans_set)
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans_set = []

for i in range(len(s)):
    x = abs(int(s[i:i+3])-753)
    ans_set[i] = x
ans = min(ans_set)
print(ans)
Problem p03231 (python)

Fixed submission:
import fractions


def binary_search(list, number, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) // 2
        guess = list[mid][0]
        if guess == number:
            if list[mid][1] == item:
                return False
            else:
                return True
        if guess > number:
            high = mid - 1
        else:
            low = mid + 1
    # 見つからなかったとき
    return False


n, m = map(int, input().split())
s = input()
t = input()
check = []
l = n * m // fractions.gcd(n, m)
for i in range(n):
    check.append([i * l // n, s[i]])
for i in range(m):
    if binary_search(check, i * l // m, t[i]):
        print(-1)
        exit()
print(l)

Buggy submission (verdict: Runtime Error):
import fractions

n, m = map(int, input().split())
s = input()
t = input()
check = [''] * (n * m)
l = n * m // fractions.gcd(n, m)
for i in range(n):
    check[i * l // n] = s[i]
for i in range(m):
    if check[i * l // m] != t[i] and check[i * l // m] != '':
        print(-1)
        exit()
print(l)

Buggy submission (verdict: Runtime Error):
import math

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

s_num = [0] * n
t_num = [0] * m
s_num[0], t_num[0] = 1, 1
l = n * m / math.gcd(n, m)

for i in range(1, n):
    s_num[i] = i * l / n + 1

for i in range(1, m):
    t_num[i] = i * l / m + 1

match_num = list(set(s_num) & set(t_num))
ans = l

for i in range(len(match_num)):
    s_str = s[s_num.index(match_num[i])]
    t_str = t[t_num.index(match_num[i])]

    if s_str != t_str:
        print('-1')
        exit()

print(int(ans))

Buggy submission (verdict: Runtime Error):
import math

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

s_num = [0] * n
t_num = [0] * m
s_num[0], t_num[0] = 1, 1
l = n * m / math.gcd(n, m)

for i in range(1, n):
    s_num[i] = i * l / n + 1

for i in range(1, m):
    t_num[i] = i * l / m + 1

match_num = list(set(s_num) & set(t_num))
ans = l

for i in range(len(match_num)):
    s_str = s[s_num.index(match_num[i])]
    t_str = t[t_num.index(match_num[i])]

    if s_str != t_str:
        ans = -1
        break

print(ans)

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

input = sys.stdin.readline

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

s_num = [0] * n
t_num = [0] * m
s_num[0], t_num[0] = 1, 1
l = n * m / math.gcd(n, m)

for i in range(1, n):
    s_num[i] = i * l / n + 1

for i in range(1, m):
    t_num[i] = i * l / m + 1

match_num = list(set(s_num) & set(t_num))
ans = l

for i in range(len(match_num)):
    s_str = s[s_num.index(match_num[i])]
    t_str = t[t_num.index(match_num[i])]

    if s_str != t_str:
        ans = -1
        break

print(ans)
Problem p03274 (python)

Fixed submission:
import sys
input = sys.stdin.readline

n, k = map(int, input().split())
x = list(map(int, input().split()))
ans = float('inf')

for l in range(n - k + 1):
    r = l + k - 1
    ans = min(ans, min(abs(x[l]), abs(x[r])) + x[r] - x[l])
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import bisect
input = sys.stdin.readline

n, k = map(int, input().split())
x = list(map(int, input().split()))
start = bisect.bisect_left(x, 0)
for i in range(start):
    x[i] = abs(x[i])
ans = [0] * (n - start)
if start == 0:
    print(x[k - 1])
    exit()
elif start == n - 1:
    print(x[k - start + 1])
    exit()
else:
    for i in range(n - start):
        ans[i] = min(x[i] * 2 + x[i + start], x[i] + x[i + start] * 2)
print(min(ans))
Problem p03285 (python)

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

if n%7 != 0 and n%4 != 0 and n%11 != 0:
    for a in range(1, 25):
        for b in range(1, 14):
            if n%(7*b + 4*a) == 0:
                print('Yes')
                sys.exit()
else:
    print('Yes')
    sys.exit()
print('No')

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())

if n%7 != 0 and n%4 != 0 and n%11 != 0:
    for a in range(25):
        for b in range(14):
            if n%(7*b + 4*a) == 0:
                print('No')
                sys.exit()
else:
    print('No')
    sys.exit()
print('Yes')
Problem p03290 (python)

Fixed submission:
import sys
import itertools
input = sys.stdin.readline

d, g = map(int, input().split())
pc = []
ans = []
bit = list(itertools.product([0, 1], repeat=d))
cnt_v = 0
cnt = 0

for i in range(d):
    p, c = map(int, input().split())
    pc.append([p, c])

for i in range(2 ** d):
    for j in range(d):
        if bit[i][j] == 1:
            p = pc[j][0]
            c = pc[j][1]
            p_index = j + 1
            cnt_v += p * 100 * p_index + c
            cnt += p

    if cnt_v >= g:
        ans.append(cnt)

    else:
        for j in range(d):
            cnt_check = cnt_v
            if bit[i][j] == 0:
                p = pc[j][0]
                p_index = j + 1

                for k in range(p):
                    if cnt_check >= g:
                        cnt += k
                        ans.append(cnt)
                        cnt -= k
                        break

                    cnt_check += 100 * p_index
    cnt = 0
    cnt_v = 0

print(min(ans))

Buggy submission (verdict: Runtime Error):
import sys
import itertools
input = sys.stdin.readline

d, g = map(int, input().split())
pc = []
ans = []
bit = list(itertools.product([0, 1], repeat=d))
cnt_v = 0
cnt = 0

for i in range(d):
    p, c = map(int, input().split())
    pc.append([p, c])

for i in range(2 ** d):
    for j in range(d):
        if bit[i][j] == 1:
            p = pc[j][0]
            c = pc[j][1]
            p_index = j + 1
            cnt_v += p * 100 * p_index + c
            cnt += p

    for j in range(d):
        cnt_check = cnt_v
        if bit[i][j] == 0:
            p = pc[j][0]
            p_index = j + 1

            for k in range(p):
                if cnt_check >= g:
                    cnt += k
                    ans.append(cnt)
                    cnt -= k
                    break

                cnt_check += 100 * p_index
    cnt = 0
    cnt_v = 0

print(min(ans))
Problem p03292 (python)

Fixed submission:
a_1, a_2, a_3 = map(int, input().split())

maxs = max(a_1, a_2, a_3)
mins = min(a_1, a_2, a_3)
ans = maxs-mins
print(ans)

Buggy submission (verdict: Runtime Error):
a_1, a_2, a_3 = map(int, input().split())
a = [a_1, a_2, a_3]

ad = sorted(a, reverse=True)
ans = (ad[0]-ad[1] + (ad[1]-ad[2])
print(ans)
Problem p03328 (python)

Fixed submission:
a, b = map(int, input().split())
c = [0]
for i in range(1, 1000):
    c.append(c[i-1]+i)
    if c[i-1]-a > 0:
        ans = c[i-1]-a
        if a+ans == c[i-1] and b+ans == c[i]:
            break
        else:
            ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
c = [0]
for i in range(1, 999):
    c.append(c[i-1]+i)
    if c[i-1]-a > 0:
        ans = c[i-1]-a
        break
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
c = [0]
for i in range(1, 999):
    c.append(c[i-1]+i)
    if c[i-1]-a >= 0:
        ans = c[i-1]-a
        break
print(ans)
Problem p03351 (python)

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

if (abs(a-b) <= d and abs(b-c) <= d) or abs(a-c) <= d:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)

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

if (min(abs(a-b)) <= d and min(abs(b-c)) <= d) or min(abs(a-c)) <= d:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)

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

if min(abs(a-b, a-c, b-c)) <= d:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)
Problem p03425 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import Counter
import itertools

n = int(readline())
s = [input()[0] for i in range(n)]
counter = Counter(s)
ans = 0
for i, j, k in itertools.combinations('MARCH', 3):
    ans += counter[i] * counter[j] * counter[k]
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import Counter
from scipy.special import comb

n = int(readline())
s = [input()[0] for i in range(n)]
memo = list(Counter(s).items())
check = ['M', 'A', 'R', 'C', 'H']
cnt = 0
ans = 0
for x, y in memo:
    if x in check:
        ans += y
        if y > 1:
            cnt += n - y
print(comb(ans, 3, exact=True) - cnt)
Problem p03543 (python)

Fixed submission:
# sys.stdin.readline()
import sys
import math
input = sys.stdin.readline

n = input()
if '000' in n or '111' in n or '222' in n or '333' in n or '444' in n or '555' in n or '666' in n or '777' in n or '888' in n or '999' in n:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)

Buggy submission (verdict: Runtime Error):
# sys.stdin.readline()
import sys
import math
input = sys.stdin.readline

n = input()
if n.count('0') >= or n.count('1') >= 3 or n.count('2') >= 3 or n.count('3') >= 3 or n.count('4') >= 3 or n.count('5') >= 3 or n.count('6') >= 3 or n.count('7') >= 3 or n.count('8') >= 3 or n.count('9'):
    ans = 'Yes'
else:
    ans = 'No'
print(ans)
Problem p03547 (python)

Fixed submission:
# sys.stdin.readline()
import sys
import math
input = sys.stdin.readline

x, y = input().split()
hex_x = int(x, 16)
hex_y = int(y, 16)
if hex_x > hex_y:
    ans = '>'
elif hex_x < hex_y:
    ans = '<'
else:
    ans = '='
print(ans)

Buggy submission (verdict: Runtime Error):
# sys.stdin.readline()
import sys
import math
input = sys.stdin.readline

x, y = map(input().split())
hex_x = int(x, 16)
hex_y = int(y, 16)
if hex_x > hex_y:
    ans = '>'
elif hex_x < hex_y:
    ans = '<'
else:
    ans = '='
print(ans)

Buggy submission (verdict: Runtime Error):
# sys.stdin.readline()
import sys
import math
input = sys.stdin.readline

x, y = map(int, input().split())
hex_x = int(x, 16)
hex_y = int(y, 16)
if hex_x > hex_y:
    ans = '>'
elif hex_x < hex_y:
    ans = '<'
else:
    ans = '='
print(ans)
Problem p03555 (python)

Fixed submission:
# sys.stdin.readline()
import sys
import math
input = sys.stdin.readline

a = input()
b = input()
if (a[0] in b[2]) and (a[1] in b[1]) and (a[2] in b[0]):
    ans = 'YES'
else:
    ans = 'NO'
print(ans)

Buggy submission (verdict: Runtime Error):
# sys.stdin.readline()
import sys
import math
input = sys.stdin.readline

bcd = input()
efg = input()
if b == g and c == f and d == e:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)
Problem p03600 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

import numpy as np

n = int(readline())
graph = np.array([list(map(int, readline().split())) for _ in range(n)])
inf = 10 ** 10
ans = 0
for i in range(n):
    graph[i][i] = inf
for i in range(n):
    for j in range(i + 1, n):
        v = np.min(graph[i] + graph[j])
        if graph[i][j] > v:
            print(-1)
            exit()
        elif graph[i][j] < v:
            ans += graph[i][j]
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall

n = int(readline())
memo_graph = [list(map(int, readline().split())) for _ in range(n)]
cost = floyd_warshall(csr_matrix(memo_graph))
cnt_1 = 0
cnt_2 = 0
for i in range(n):
    for j in range(n):
        if int(cost[i][j]) != memo_graph[i][j]:
            print(-1)
            exit()
        if cost[i][j] == 0:
            continue
        cnt_1 += cost[i][j]
s = set()
for k in range(n):
    for i in range(n):
        for j in range(n):
            # 3頂点が異なってかつ、経由のが近い場合は直接の辺は不要
            if i != j and j != k and k != i and cost[i][k] + cost[k][j] == cost[i][j]:
                if (i, j) not in s:
                    s.add((i, j))
                    cnt_2 += cost[i][j]
print((cnt_1 - cnt_2) // 2)
Problem p03624 (python)

Fixed submission:
import sys

s = list(input())
set_s = set(s)
new_s = list(set_s)
new_s.sort()
for i in range(26):
    if ord(new_s[i]) != 97+i:
        print(chr(97+i))
        sys.exit()
    if len(new_s) == i+1:
        if i == 25:
            break
        print(chr(98+i))
        sys.exit()
print('None')

Buggy submission (verdict: Runtime Error):
import sys

s = list(input())
set_s = set(s)
new_s = list(set_s)
new_s.sort()
for i in range(26):
    if ord(new_s[i]) != 97+i:
        print(chr(97+i))
        sys.exit()
print('None')