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

Fixed submission:
n, m = map(int, input().split())
p = list(map(lambda x: x-1, map(int, input().split())))

follow = [i for i in range(n)]
num = [1]*n
def root_index_of(x):
    r = x
    while follow[r] != r:
        r = follow[r]
    return r

def connected(x, y):
    return root_index_of(x) == root_index_of(y)

def connect(x, y):
    rx = root_index_of(x)
    ry = root_index_of(y)

    if rx == ry:
        return

    if num[rx] < num[ry]:
        follow[rx] = ry
        follow[x] = ry
        num[ry] += num[rx]
    else:
        follow[ry] = rx
        follow[y] = rx
        num[rx] += num[ry]

for i in range(m):
    x, y = map(lambda x: x-1, map(int, input().split()))
    connect(p[x], p[y])

ans = 0
for i in range(n):
    if connected(i, p[i]):
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
p = list(map(lambda x: x-1, map(int, input().split())))
t = [tuple(map(lambda x: x-1, map(int, input().split()))) for _ in range(m)]

a = [set() for _ in range(n)]
for i, j in t:
    a[p[i]].add(p[j])
    a[p[j]].add(p[i])

def dfs(x, v):
    if v[x] == 0:
        v[x] = 1
        for i in a[x]:
            dfs(i, v)

mx = []
for i in range(n):
    v = [0]*n
    dfs(i, v)
    mx.append(v)

ans = 0
for i in range(n):
    tmp = p[i]
    idx = p.index(i)
    if mx[tmp][i]:
        ans += 1
        p[i] = i
        p[idx] = tmp
print(ans)
Problem p03369 (python)

Fixed submission:
s = input()
print(700+s.count("o")*100)

Buggy submission (verdict: Runtime Error):
n, c = map(int, input().split())
x = [tuple(map(int, input().split())) for _ in range(n)]

S_cw = [0]
S_ccw = [0]
S_cw_return = [0]
S_ccw_return = [0]

for i in range(n):
    S_cw.append(S_cw[-1]+x[i][1])
    S_ccw.append(S_ccw[-1]+x[n-1-i][1])

for i in range(n):
    S_cw[i+1] -= x[i][0]
    S_ccw[i+1] -= c-x[n-1-i][0]
    S_cw_return.append(S_cw[i+1] - x[i][0])
    S_ccw_return.append(S_ccw[i+1] - (c-x[n-1-i][0]))

S_cw_return_max = [0]
S_ccw_return_max = [0]
for i in range(n):
    if S_cw_return[i+1] > S_cw_return_max[-1]:
        S_cw_return_max.append(S_cw_return[i+1])
    else:
        S_cw_return_max.append(S_cw_return_max[-1])

    if S_ccw_return[i+1] > S_ccw_return_max[-1]:
        S_ccw_return_max.append(S_ccw_return[i+1])
    else:
        S_ccw_return_max.append(S_ccw_return_max[-1])

ans = 0
for i in range(n+1):
    idx = n-i
    ans = max(ans, S_cw[i]+S_ccw_return_max[idx], S_ccw[i]+S_cw_return_max[idx])
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
print(700+s.count(o)*100)
Problem p03380 (python)

Fixed submission:
from bisect import bisect_left
n = int(input())
a = sorted(list(map(int, input().split())))
if n == 2:
    print(a[1], a[0])
    exit()
m = a.pop()
idx = bisect_left(a, m//2)
if idx == 0:
    print(m, a[0])
    exit()
else: 
    r1 = a[idx-1]
    r2 = a[idx]

    if r1 > m-r2:
        r = r1
    else:
        r = r2

print(m, r)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())))
m = a.pop()

def binary_search(l, value):
    low = 0
    high = len(l)-1
    while low <= high:
        mid = (low + high)//2
        if l[mid] == value:
            print(m, l[mid])
            exit()
        elif l[mid] < value:
            low = mid + 1
        else:
            high = mid - 1
    return low

k = binary_search(a, m//2)
print(m, a[k])
Problem p03416 (python)

Fixed submission:
a, b = map(int, input().split())
ans = 0
for i in range(a, b+1):
  temp = []
  for j in range(5):
    d = 10**(4-j)
    p = i//d
    temp.append(p)
    i -= p*d
  if temp[0] == temp[4] and temp[1] == temp[3]:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
ans = 0
for i in range(a, b+1):
  temp = []
  for j in range(5):
    d = 10**(4-i)
    p = i//d
    temp.append(p)
    i -= p*d
  if temp[0] == temp[4] and temp[1] == temp[3]:
    ans += 1
print(ans)
Problem p03423 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
ans(n//3)
Problem p03424 (python)

Fixed submission:
n = int(input())
s = input().split()
for i in range(n):
  if s[i] == "Y":
    print("Four")
    exit()
print("Three")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(map(int, input().split()))
for i in range(n):
  if s[i] == "Y":
    print("Four")
    exit()
print("Three")
Problem p03455 (python)

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

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

if (a*b)%2:
  print("Even")
  else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
 a,b = map(int, input().split())
  
  if a*b % 2 == 0:
    print("Even")
  else:
    print("Odd")
Problem p03456 (python)

Fixed submission:
from math import sqrt
a, b = input().split()
n = int(a+b)
if sqrt(n) == int(sqrt(n)):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
from math import sqrt
a, b = input().split()
n = int(a+b)
if sqrt(n) == int(sqrt(n)):
  print("Yes")
else
  print("No")
Problem p03485 (python)

Fixed submission:
import math
a, b = map(int, input().split())
print(math.ceil((a+b)/2))

Buggy submission (verdict: Runtime Error):
import Math
a, b = map(int, input().split())
print(Math.ceil((a+b)/2))
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

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

num_list = []
for c in list:
    n = int(c)
    num_list.append(n)

state = True

i = 0

while state:
    for n in num_list:
        if n % 2:
            state = False
        else:
            n /= 2
    if state:
        i += 1

print(i)
Problem p03495 (python)

Fixed submission:
from collections import Counter
n, k = map(int, input().split())
c = Counter(list(map(int, input().split()))).most_common()
l = len(c)
if l >= k:
    m = 0
    for i in range(k):
        m += c[i][1]
    print(n-m)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n, k = map(int, input().split())
c = Counter(list(map(int, input().split()))).most_common()
m = 0
for i in range(k):
    m += c[i][1]
print(n-m)
Problem p03546 (python)

Fixed submission:
h,w = map(int, input().split())
power = [list(map(int,input().split())) for i in range(10)]

#ワーシャルフロイド法
for i in range(10):
    for j in range(10):
        for k in range(10):
            power[j][k] = min(power[j][k], power[j][i] + power[i][k])

ans = 0
for i in range(h):
    wall = list(map(int, input().split()))
    for item in wall:
        if item < 0:
            continue
        ans += power[item][1]

print(ans)

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split())
power = [list(map(int,input().split())) for i in range(10)]

#ワーシャルフロイド法
for i in range(10):
    for j in range(10):
        for k in range(10):
            power[j][k] = min([power[j][k], power[j][i] + power[i][k])

ans = 0
for i in range(h):
    wall = list(map(int, input().split()))
    for item in wall:
        if item < 0:
            continue
        ans += power[item][1]

print(ans)
Problem p03548 (python)

Fixed submission:
x, y, z = map(int, input().split())
i = 0
while x - y*i - z*(i+1) >= 0:
    i += 1
print(i-1)

Buggy submission (verdict: Runtime Error):
x, y, z = map(int, input().split())
i = 0
while True:
  if x - i*y - (i+1)*z >= 0:
    i += 1
  esle:
    break
print(i-1)
Problem p03557 (python)

Fixed submission:
import bisect
n = int(input())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
m = len(c)
ans = 0
for x in b:
    #挿入できる箇所を返す
    p = bisect.bisect_left(a, x)
    q = m - bisect.bisect_right(c, x)
    ans += p*q
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
n = int(input())
a = sorted(list(map(int, input().split())))
ma = min(a)
b = sorted([x for x in map(int, input().split()) if x > ma])
mb = min(b)
c = sorted([x for x in map(int, input().split()) if x > mb])
m = len(c)
ans = 0
for x in b:
    #挿入できる箇所を返す
    p = bisect.bisect_left(a, x)
    q = m - bisect.bisect_right(c, x)
    ans += p*q
print(ans)
Problem p03573 (python)

Fixed submission:
a = list(map(int, input().split()))
for x in a:
  if a.count(x) == 1:
    print(x)
    exit()

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
b = set(a)
for x in a:
  if a.count(x) == b.count(x):
    print(x)
    exit()
Problem p03599 (python)

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

n = f//(100*a)
m = f//(100*b)
p = f//c
q = f//d

mx = 0
state = True
for k in range(p+1):
    for l in range(q+1):
        for i in range(n+1):
            for j in range(m+1):
                if i == 0 and j == 0:
                    continue
                s = 100*a*i+100*b*j
                t = c*k+d*l
                u = 100*t/s
                if s + t> f:
                    continue
                if u > e:
                    continue
                if mx < u:
                    state = False
                    mx = u
                    ans1, ans2 = s+t, t
                    if mx == e:
                        print(ans1, ans2)
                        exit()
if state:
    print(100*a, 0)
else:
    print(ans1, ans2)

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

n = f//(100*a)
m = f//(100*b)
p = f//c
q = f//d

mx = 0
for k in range(p+1):
    for l in range(q+1):
        for i in range(n+1):
            for j in range(m+1):
                if i == 0 and j == 0:
                    continue
                s = 100*a*i+100*b*j
                t = c*k+d*l
                u = 100*t/s
                if s + t> f:
                    continue
                if u > e:
                    continue
                if mx < u:
                    mx = u
                    ans1, ans2 = s+t, t
                    if mx == e:
                        print(ans1, ans2)
                        exit()
print(ans1, ans2)
Problem p03609 (python)

Fixed submission:
x, t = map(int, input().split())
print(max(0, x-t))

Buggy submission (verdict: Runtime Error):
N = int(input())
P = list(map(int, input().split()))
Q = P.copy()
cnt1 = 0
for i in range(N-1):
    if P[i] == i+1:
        tmp = P[i]
        P[i] = P[i+1]
        P[i+1] = tmp
        cnt1 += 1
if P[-1] == N:
    cnt1 += 1

cnt2 = 0
for i in range(N-1, 0, -1):
    if Q[i] == i+1:
        tmp = Q[i]
        Q[i] = Q[i-1]
        Q[i-1] = tmp
        cnt2 += 1
if Q[0] == 1:
    cnt2 += 1
print(min(cnt1, cnt2))
Problem p03623 (python)

Fixed submission:
x, a, b = map(int, input().split())
if abs(x-a) < abs(x-b):
  print("A")
else:
  print("B")

Buggy submission (verdict: Runtime Error):
x, a, b = map(int, input().split())
if abs(x-a) < abs(x-b):
  pirnt("A")
else:
  print("B")
Problem p03633 (python)

Fixed submission:
#import math
from functools import reduce

n = int(input())
a = [int(input()) for _ in range(n)]

def gcd(x, y):
    while y:
        x, y = y, x%y
    return x

def lcm_base(x, y):
    return (x*y)//gcd(x, y)

def lcm(nums):
    #3つ目は初期値
    return reduce(lcm_base, nums, 1)

print(lcm(a))

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

n = int(input())
a = [int(input()) for _ in range(n)]

def lcm_base(x, y):
    return (x*y)//math.gcd(x, y)

def lcm(nums):
    #3つ目は初期値
    return reduce(lcm_base, nums, 1)

print(lcm(a))
Problem p03651 (python)

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

a = sorted(list(set(a)))

if a[-1] < k:
    print("IMPOSSIBLE")
    exit()

n = len(a)

if n > 1:
    m = 10**9
    for i in range(n-1):
        if a[i] != a[i+1]:
            m = min(m, abs(a[i+1]-a[i]))
    for i in range(n):
        if abs(a[i]-k) % m == 0:
            print("POSSIBLE")
            exit()
else:
    if a[0] == k:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
if a[-1] < k:
    print("IMPOSSIBLE")
    exit()
if n > 1:
    m = 10**9
    for i in range(n-1):
        m = min(m, abs(a[i+1]-a[i]))
    for i in range(n):
        if abs(a[i]-k) % m == 0:
            print("POSSIBLE")
            exit()
else:
    if a[0] == k:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
if max(a) < k:
    print("IMPOSSIBLE")
    exit()
m = 10**9
for i in range(n-1):
    m = min(m, abs(a[i+1]-a[i]))
for i in range(n):
    if abs(a[i]-k) % m == 0:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
if max(a) < k:
    print("IMPOSSIBLE")
    exit()
m = 10**9
for i in range(n-1):
    m = min(m, abs(a[i+1]-a[0]))
for i in range(n):
    if abs((a[i]-k)) % m == 0:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")
Problem p03693 (python)

Fixed submission:
r, g, b = input().split()
n = int(r+g+b)
if n % 4:
  print("NO")
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
r, g, b = input().split()
int(r+g+b)
if n % 4:
  print("NO")
else:
  print("YES")
Problem p03695 (python)

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

s = set()
c = 0

for i in range(n):
    if 1 <= a[i] <= 399:
        s.add(1)

    elif 400 <= a[i] <= 799:
        s.add(2)

    elif 800 <= a[i] <= 1199:
        s.add(3)

    elif 1200 <= a[i] <= 1599:
        s.add(4)

    elif 1600 <= a[i] <= 1999:
        s.add(5)

    elif 2000 <= a[i] <= 2399:
        s.add(6)

    elif 2400 <= a[i] <= 2799:
        s.add(7)

    elif 2800 <= a[i] <= 3199:
        s.add(8)

    else:
        c += 1

if len(s):
    print(len(s), len(s)+c)
else:
    print(1, c)

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

s = set()
c = 0

for i in range(n):
    if 1 <= a[i] <= 399:
        s.add(1)

    elif 400 <= a[i] <= 799:
        s.add(2)

    elif 800 <= a[i] <= 1199:
        s.add(3)

    elif 1200 <= a[i] <= 1599:
        s.add(4)

    elif 1600 <= a[i] <= 1999:
        s.add(5)

    elif 2000 <= a[i] <= 2399:
        s.add(6)

    elif 2400 <= a[i] <= 2799:
        s.add(7)

    elif 2800 <= a[i] <= 3199:
        s.add(8)

    else:
        c += 1

if len(s):
    print(len(s), len(s)+c)
elif:
    print(1, c)
Problem p03711 (python)

Fixed submission:
a = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
x,y = map(int, input().split())
for i in range(3):
    if (x in a[i]) and (y in a[i]):
        print('Yes')
        exit()
print('No')

Buggy submission (verdict: Runtime Error):
a = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
x,y = input().split()
for i in range(3):
	if (x and y) in a[i]:
    	print('Yes')
        exit()
print('No')
Problem p03720 (python)

Fixed submission:
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
b = [0]*n
for i in range(m):
  b[a[i][0]-1] += 1
  b[a[i][1]-1] += 1
for i in range(n):
  print(b[i])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
b = [0]*n
for i in range(m):
  b.index(a[i][0]-1) += 1
  b.index(a[i][1]-1) += 1
for i in range(n):
  print(b[i])
Problem p03722 (python)

Fixed submission:
def BellmanFord(edges, num_v, source):
    #グラフの初期化
    inf = float("inf")
    dist = [inf for i in range(num_v)]
    dist[source-1] = 0

    #変の和
    for i in range(num_v):
        for edge in edges:
            if dist[edge[0]-1] != inf and dist[edge[1]-1] > dist[edge[0]-1] + edge[2]:
                dist[edge[1]-1] = dist[edge[0]-1] + edge[2]
                if i == num_v - 1 and edge[1] == num_v:
                    return -1

    return dist

num_v, num_e = map(int, input().split())
edges = []
for _ in range(num_e):
    a, b, c = map(int, input().split())
    edges.append((a, b, -c))

dist = BellmanFord(edges, num_v, 1)
if dist == -1:
    print("inf")
else:
    print(-dist[-1])

Buggy submission (verdict: Runtime Error):
from scipy.sparse.csgraph import bellman_ford
from scipy.sparse.csgraph import NegativeCycleError
from scipy.sparse import csr_matrix

n, m = map(int, input().split())
start = []
goal = []
score = []
for i in range(m):
    a, b, c = map(int, input().split())
    start.append(a-1)
    goal.append(b-1)
    score.append(-c)

path1 = csr_matrix((score, (start, goal)), shape=(n, n), dtype=int)
try:
    score = bellman_ford(path1, indices=0)
    print(-int(score[-1]))
except NegativeCycleError:
    print("inf")
Problem p03739 (python)

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

m = 0
c = 0

for i in range(n):
    m += a[i]

    if i % 2 == 0:
        if m <= 0:
            c += abs(m) + 1
            m += abs(m) + 1
    else:
        if m >= 0:
            c += m + 1
            m -= m + 1

m = 0
d = 0

for i in range(n):
    m += a[i]

    if i % 2 == 1:
        if m <= 0:
            d += abs(m) + 1
            m += abs(m) + 1
    else:
        if m >= 0:
            d += m + 1
            m -= m + 1

print(min(c, d))

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

not_0 = n
for i in range(n):
    if a[i]:
        not_0 = i
        break

if not_0 == n:
    print(1+2*(n-1))
    exit()

ans = 0
if not_0 == 0:
    b = [a[0]]
else:
    if abs(a[not_0]) == 1:
        a[not_0] *= 2
        ans = 2*not_0
    else:
        ans = 1 + 2*(not_0-1)

    if a[not_0] > 0:
        b = [a[not_0] - 1]

    else:
        b = [a[not_0] + 1]

tmp = b[0]
for i in range(not_0+1, n):
    tmp += a[i]
    b.append(tmp)

for i in range(not_0+1, n):
    if b[i-1]*b[i] < 0:
        continue
    else:
        if b[i-1] > 0:
            d = b[i] + 1
            ans += d
            for j in range(i, n):
                b[j] -= d
        else:
            d = -b[i] + 1
            ans += d
            for j in range(i, n):
                b[j] += d
print(ans)
Problem p03773 (python)

Fixed submission:
a, b = map(int, input().split())
print((a+b)%24)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
print((a+b)%24)
Problem p03816 (python)

Fixed submission:
N = int(input())
A = set(list(map(int, input().split())))
if len(A)%2:
    print(len(A))
else:
    print(len(A)-1)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from heapq import heappop, heappush
N = int(input())
A = list(map(int, input().split()))

d = defaultdict(int)
for a in A:
    d[a] += 1

T = []
for a in list(set(A)):
    T.append([a, d[a]])

M = len(T)
T = sorted(T)
i = 1
flag = True
while T[0][1] - 1 > 0:
    if T[i][1] > 1:
        T[i][1] -= 1
        flag = False
        T[0][1] -= 1
    i += 1
    if i == M:
        if flag:
            break
        i = 1
        flag = True

if T[0][1] > 1:
    if T[0][1]%2:
        print(M)
    else:
        print(M-1)
else:
    for i in range(M):
        if T[i][1] > 2:
            if T[i][1]%2:
                T[i][1] = 1
            else:
                T[i][1] = 2
    cnt = 0
    for i in range(M):
        if T[0][1] == 2:
            cnt += 1
    if cnt%2:
        print(M-1)
    else:
        print(M)
Problem p03838 (python)

Fixed submission:
x, y = map(int, input().split())
if x > y:
    if 0 > x:
        ans = x-y+2
    elif x == 0:
        ans = abs(y) + 1
    else:
        if 0 > y:
            ans = abs(abs(y)-x) + 1 
        elif y == 0:
            ans = x + 1
        else:
            ans = abs(x-y) + 2
elif x == y:
    ans = 0
else:
    if 0 > y:
        ans = y-x
    elif y == 0:
        ans = abs(x)
    else:
        if 0 > x:
            ans = abs(y-abs(x)) + 1
        elif x == 0:
            ans = y
        else:
            ans = y-x
print(ans)

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
if x >= y:
    if 0 > x:
        ans = x-y+2
    else:
        if 0 >= y:
            ans = abs(abs(y)-x) + 1 
        else:
            ans(x+y)+1
else:
    if 0 > y:
        ans = y-x
    else:
        if 0 >= x:
            ans = abs(y-abs(x)) + 1
        else:
            ans = y-x
print(ans)
Problem p03852 (python)

Fixed submission:
ch = input()
if (ch == 'a') | (ch == 'i') | (ch == 'u') | (ch == 'e') | (ch == 'o'):
    print('vowel')
else:
    print('consonant')

Buggy submission (verdict: Runtime Error):
ch = input()
if ch == 'a' | ch == 'i' | ch == 'u' | ch == 'e' | ch == 'o':
	print('vowel')
else:
	print('consonant')
Problem p03854 (python)

Fixed submission:
s = input()
while True:
    temp = s
    s5 = temp[-5:]
    s6 = temp[-6:]
    s7 = temp[-7:]

    if (s5 == 'erase') | (s5 == 'dream'): 
        s = temp[:-5]
    elif s6 == 'eraser':
        s = temp[:-6]
    elif s7 == 'dreamer':
        s = temp[:-7]
    else:
        print('NO')
        exit()

    if s == '':
        print('YES')
        exit()

Buggy submission (verdict: Runtime Error):
s = input()
s_list = list(s)
while True:
    l5 = s_list[-5:]
    l6 = s_list[-6:]
    l7 = s_list[-7:]
    s5 = s6 = s7 = ''

    for ch in l5:
        s5 += ch
    print("s5 :", s5)
    for ch in l6:
        s6 += ch
    print("s6 :", s6)
    for ch in l7:
        s7 += ch
    print("s7 :", s7)

    if (s5 == 'erase') | (s5 == 'dream'): 
        s_list = s_list[:-5]
        print("s_list:", s_list)
    elif s6 == 'eraser':
        s_list = s_list[:-6]
        print("s_list:", s_list)
    elif s7 == 'dreamer':
        s_list = s_list[:-7]
        print("s_list:", s_list)
    else:
        print('NO')
        print("s_list:", s_list)
        exit()

    if  s_list == []:
        print('YES')
        exit()
Problem p03860 (python)

Fixed submission:
a = input().split()
s = a[1][0].upper()
print('A'+s+'C')

Buggy submission (verdict: Runtime Error):
a,b,x = map(int, input().split())
if x == 1:
    ans = b-a+1
else:
    if a < b:
        if a % x == 0 and b % x == 0:
            ans = (b-a)//x + 1
        elif a % x == 0 or b % x == 0:
            ans = (b-a+1)//x + 1
        else:
            ans = (b-a+1)//x
    else:
        if a % x:
            ans = 0
        else:
            ans = 1

print(ans)
Problem p03943 (python)

Fixed submission:
a = list(map(int, input().split()))
b = max(a)
a.remove(b)
if sum(a) == b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = map(int, input().split())
b = max(a)
a.remove(b)
if sum(a) == b:
  print("Yes")
else:
  print("No")
Problem p04043 (python)

Fixed submission:
a = list(map(int, input().split()))
a.sort()
if a == [5,5,7]:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a = map(int, input().split())
if a.sort() == [5,5,7]:
  print('Yes')
else:
  print('No')
Problem p02683 (python)

Fixed submission:
n, m, x = map(int,input().split())
CA = [list(map(int,input().split())) for _ in range(n)]

ans = 10**9

for i in range(2**n):
    ls = [0] * m
    tmp = 0
    for j in range(n):
        if (i >> j) & 1:
            ls = [l + a for l, a in zip(ls, CA[j][1:])]
            tmp += CA[j][0]
    if all(i >= x for i in ls):
        ans = min(ans, tmp)
print(ans if ans != 10**9 else -1)

Buggy submission (verdict: Runtime Error):
CA = [list(map(int,input().split())) for _ in range(n)]

ans = 10**9

for i in range(2**n):
    ls = [0] * m
    tmp = 0
    for j in range(n):
        if (i >> j) & 1:
            ls = [l + a for l, a in zip(ls, CA[j][1:])]
            tmp += CA[j][0]
    if all(i >= x for i in ls):
        ans = min(ans, tmp)
print(ans if ans != 10**9 else -1)