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

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

if a >= 3200:
    print(s)
else:
    print('red')

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

if len(a) >= 3200:
    print(s)
else:
    print("red")
Problem p02915 (python)

Fixed submission:
N = int(input())
if N >= 1 and N <= 9:
  print(N**3)

Buggy submission (verdict: Runtime Error):
def check(N):
    if type(N) == int and N >= 1 and N <= 9:
        return(N**3)       
check(N)

Buggy submission (verdict: Runtime Error):
def check(N):
    if type(N) == int and N >= 0 and N <= 9:
        print(N**3)
check(N)
Problem p03011 (python)

Fixed submission:
p,q,r = input().split()
p = int(p)
q = int(q)
r = int(r)
print((p + q + r) - max(p,q,r))

Buggy submission (verdict: Runtime Error):
p,q,r = input().split()
print(sum(p,q,r) - max(p,q,r))
Problem p03221 (python)

Fixed submission:
n,m=map(int,input().split())
s = []
for i in range(m):
    pref,year=map(int,input().split())
    s.append([pref,year,i])
s.sort()
rank = 1
for i in range(m):
    if s[i][0] != s[i-1][0]:
        rank = 1
    s[i][1]=rank
    rank += 1
s.sort(key=lambda x: x[2]) 
for i in range(m):
    print("0"*(6-len(str(s[i][0])))+str(s[i][0])+"0"*(6-len(str(s[i][1])))+str(s[i][1]))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s = []
r = []
for n in range(n):
    s.append(list(map(int,input().split())))
for i in range(n):
    rank = 1
    for j in range(n):
        if s[i][0] == s[j][0] and s[i][1] > s[j][1]:
            rank += 1
    prefString = str(s[i][0])
    rankString = str(rank)
    Number1st = "0" * (6-len(prefString)) + prefString 
    Number2nd = "0" * (6-len(rankString)) + rankString
    print(Number1st+Number2nd)
Problem p03250 (python)

Fixed submission:
a= list(map(int,input().split()))
a.sort()
print(a[2] * 10 + a[1] + a[0])

Buggy submission (verdict: Runtime Error):
a= list(map(int,input()))
a.sort()
print(a[2] * 10 + a[1] + a[0])
Problem p03072 (python)

Fixed submission:
s = int(input())
List=list(map(int,input().split()))
a = 0
b=List[0]
for i in range(s):
    if b <= List[i]:
        a +=1
        b = List[i]

print(a)

Buggy submission (verdict: Runtime Error):
s = int(input())
List=list(map(int,input().split()))
a = 1
b=List[0]
for i in range(s):
    if b <= List[i+1]:
        a +=1
        b = List[i+1]
print(a)
Problem p03073 (python)

Fixed submission:
List=input()
s = len(List)
a = [0] * s
b = [0] * s
b[1::2] = [1] * (s//2)
if s % 2 == 0:
	a[0::2] = [1] * (s//2)
else:
	a[0::2] = [1] * (s//2 + 1)

c1 = 0
c2 = 0

for (i,j) in zip(List,a):
	if int(i) != int(j):
		c1 += 1

for (i,j) in zip(List,b):
	if int(i) != int(j):
		c2 += 1

if c1 >= c2:
	print(c2)
else:
    print(c1)

Buggy submission (verdict: Runtime Error):
List=input()
s = len(List)
a = [0] * s
b = [0] * s
b[1::2] = [1] * (s//2)
if s % 2 == 0:
	a[0::2] = [1] * (s//2)
else:
	a[0::2] = [1] * (s//2 + 1)

c1 = 0
c2 = 0

for i,j = zip(List,a):
	if i != j:
      c1 += 1

for i,j = zip(List,b):
	if i != j:
      c2 += 1

if c1 >= c2:
	print(c2)
else:
    print(c1)

Buggy submission (verdict: Runtime Error):
List=[int(i) for i in input().split()] 
s = len(List)
a = [0] * s
b = [0] * s
b[1::2] = [1] * (s//2)
if s % 2 == 0:
	a[0::2] = [1] * (s//2)
else:
	a[0::2] = [1] * (s//2 + 1)

c1 = 0
c2 = 0

for i,j = zip(List,a):
	if i != j:
      c1 += 1

for i,j = zip(List,b):
	if i != j:
      c2 += 1

if c1 >= c2:
	print(c2)
else:
    print(c1)

Buggy submission (verdict: Runtime Error):
List=list(map(int,input().split()))
s = len(List)
a = [0] * s
b = [0] * s
b[1::2] = [1] * (s//2)
if s % 2 == 0:
	a[0::2] = [1] * (s//2)
else:
	a[0::2] = [1] * (s//2 + 1)

c1 = 0
c2 = 0

for i,j = zip(List,a):
	if i != j:
      c1 += 1

for i,j = zip(List,b):
	if i != j:
      c2 += 1

if c1 >= c2:
	print(c2)
else:
    print(c1)

Buggy submission (verdict: Runtime Error):
List=list(map(int,input().split()))
s = len(List)
a = [0] * s
b = [0] * s
b[1::2] = [1] * (s//2)
if s % 2 == 0:
	a[0::2] = [1] * (s//2)
else:
	a[0::2] = [1] * (s//2 + 1)

c1 = 0
c2 = 0

for i,j = zip(List,a):
	if i != j:
      c1 += 1

for i,j = zip(List,b):
	if i != j:
      c2 += 1

if a >= b:
	print(b)
else:
    print(a)

Buggy submission (verdict: Runtime Error):
List=list(map(int,input().split()))
s = len(List)
a = [0] * s
b = [0] * s
b[1::2] = [1] * (s//2)
if s % 2 == 0:
	a[0::2] = [1] * (s//2)
else:
	a[0::2] = [1] * (s//2 + 1)

c1 = 0
c2 = 0

for i,j = zip(List,a):
	if i != j:
      c1 += 1

for i,j = zip(List,b):
	if i != j:
      c2 += 1

if a >= b:
	print(b)
else:
    print(a)
    
    
print(a)
Problem p02935 (python)

Fixed submission:
a = int(input())
b= [int(s) for s in input().split()]
b=sorted(b)

t = (b[0] + b[1])/2

if a!=2:
	for i in range(a-2):
  		k = (t + b[i+2])/2
  		t=k

print(t)

Buggy submission (verdict: Runtime Error):
a = int(input())
b= [int(s) for s in input().split()]
b=sorted(b)

t = (b[0] + b[1])/2
for i in range(a-2):
  k = (t + b[i+2])/2
  t=k
  
print(k)
Problem p02912 (python)

Fixed submission:
import heapq
from functools import reduce

n, m = map(int, input().split())
h = list(map(lambda a: -int(a), input().split()))
heapq.heapify(h)  # input().split()))

for i in range(m):
    mx = -(-heapq.heappop(h) // 2)
    heapq.heappush(h, mx)

print(-reduce(lambda a, b: a+b, h))

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

n, m = map(int, input().split())
alist = list(map(int, input().split()))
alist.sort(reverse=True)

for i in range(m):
    alist[0] //= 2
    if alist[0] < alist[1]:
        alist[0], alist[1] = alist[1], alist[0]

print(reduce(add, alist))
Problem p02912 (python)

Fixed submission:
from heapq import heappush,heappop
N,M=input().split(" ")
N=int(N)
M=int(M)
Alist=input().split(" ")
# Alist = [-float(A) for A in Alist]
hAqueue=[]
for A in Alist:
    heappush(hAqueue,-float(A))

for m in range(M):
    tmp=heappop(hAqueue)
    heappush(hAqueue,tmp/2)
Alist = [-int(A) for A in hAqueue]
print(sum(Alist))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M=input().split(" ")
N=int(N)
M=int(M)
Alist=input().split(" ")
Alist = [float(A) for A in Alist]
Aarray=np.array(Alist)

for m in range(M):
    i=Aarray.argmax()
    Aarray[i]=Aarray[i]/2
    if Aarray[i]==0:
        break
    # print(Alist)
Aarray_i=Aarray.atype(np.int)

print(np.sum(Aarray))
Problem p02915 (python)

Fixed submission:
def main():
  i=int(input())
  print(i*i*i)
  
main()

Buggy submission (verdict: Runtime Error):
def main():
i=int(input())
print(i*i*i)

main()

Buggy submission (verdict: Runtime Error):
N=input(">>")
print N*N*N
Problem p02948 (python)

Fixed submission:
import heapq

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

table = [list(map(int, input().split())) for _ in range(n)]
table.sort(reverse=True)

ans = 0
pay = []

for day in range(1, m+1):
    while table and table[-1][0] <= day:
        tmp = table.pop()
        heapq.heappush(pay, -tmp[1])
   
    if pay:
        ans -= heapq.heappop(pay)

print(ans)

Buggy submission (verdict: Runtime Error):
import heapq

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

table = [list(map(int, input().split())) for k in range(n)]
table.sort()

ans = 0
pay = []

for day in range(1, m+1):
    for t in table:
        if t[0] <= day:
            heapq.heappush(pay, -t[1])
            choice = t
        else:
            break
    if pay:
        ans -= heapq.heappop(pay)
        table.remove(choice)

print(ans)
Problem p03075 (python)

Fixed submission:
# -*- coding: utf-8 -*-

antena = [0]*5
for i in range(5):
    antena[i] = int(input())
    
k = int(input())
if max(antena) - min(antena) > k:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

#input
import numpy as np
[X,Y,Z,K] = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

D = []
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

#make list
for i in range(min(K,X)):
    for j in range(min((K//(i+1))+1,Y)):
        for k in range(min(((K//(i+1))+1)//(j+1),Z)):
                D.append(A[i]+B[j]+C[k])
D.sort(reverse=True)
for i in range(K):
    print(int(D[i]))
Problem p03108 (python)

Fixed submission:
# -*- coding: utf-8 -*-

# -*- coding: utf-8 -*-


class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [1]* (n+1)
        self.size = [1]* (n+1)
        
    # search parents of tree
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    
    # union tree
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        # parent same
        if x == y:
            return False
        
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
            return True
        else:
            self.par[y] = x
            self.size[x] += self.size[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            return True
    # check
    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    # size
    def sizes(self, x):
        x = self.find(x)
        return self.size[x]
    
#[N,M] = [6,5]
#A = [2, 1, 5, 3, 4]
#B = [3, 2, 6, 4, 5]
[N,M] = list(map(int,input().split()))
A = [0]*M
B = [0]*M
for i in range(M):
    [a,b] = list(map(int,input().split()))
    A[i], B[i] = a, b

A.reverse()
B.reverse()
uf = UnionFind(N)
ans_list = [0]*M
ans_list[0] = (N*(N-1))//2
ans = ans_list[0]
for i in range(M-1):
    if uf.same(A[i], B[i]) == True:
        ans = ans
    else:
        ans = ans - uf.sizes(A[i])*uf.sizes(B[i])
    uf.unite(A[i],B[i])
    ans_list[i+1] = ans
    
ans_list.reverse()
for i in range(M):
    print(ans_list[i])

Buggy submission (verdict: Runtime Error):
6 5
2 3
1 2
5 6
3 4
4 5
Problem p02948 (python)

Fixed submission:
def main():
    from collections import defaultdict
    from heapq import heappush, heappop
    _, m, *ab = map(int, open(0).read().split())
    works = defaultdict(list)
    # == zip(ab[0::2], ab[1::2])
    for a, b in zip(*[iter(ab)]*2):
        # 最大値が欲しいが、heappopは最小値を取り出すので-1倍しておく
        works[a].append(-b)

    candidates, pay = [], []
    for day in range(1, m+1):
        for x in works[day]:
            heappush(candidates, x)
        if candidates:
            pay.append(heappop(candidates))
    print(-sum(pay))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    _, m, ab = map(int, open(0).read().split())
    ab = zip(ab[0::2], ab[1::2])
    pay = 0
    day = 0
    for t in reversed(sorted(ab, key=lambda x: (x[1], x[0]))):
        a, b = t

        # 目標日以降
        if day > m:
            break
        # 報酬が受け取れない
        if a > m or day+a > m:
            continue

        pay += b
        day += 1

    print(pay)


if __name__ == "__main__":
    main()
Problem p02916 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
add_s = 0
for idx in range(N-1):
  cur_f = A[idx]
  nxt_f = A[idx+1]
  add_s += C[cur_f-1] if nxt_f == cur_f + 1 else 0

print(sum(B) + add_s)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())
B = map(int, input().split())
C = map(int, input().split())
add_s = 0
for order in range(N-1):
  cur_f = A[order]
  nxt_f = A[order+1]
  add_s += C[order] if nxt_f == cur_f + 1 else 0
  
print(sum(B) + add_s)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())
B = map(int, input().split())
C = map(int, input().split())

s = 0
prev = 0
for f in A:
  if prev != 0:
    s += B[f-1]
    s += C[prev-1]
  else:
    s += B[f-1]
  prev = f
print(s)
Problem p02912 (python)

Fixed submission:
import heapq
 
L1 = input().split(" ")
L2 = input().split(" ")
tickets = int(L1[1])
L2int = [-int(s) for s in L2]
 
heapq.heapify(L2int)
 
for t in range(tickets):
    heapq.heappush(L2int,-(-heapq.heappop(L2int)//2))
print(-sum(L2int))

Buggy submission (verdict: Runtime Error):
import heapq

L1 = input().split(" ")
L2 = input().split(" ")
tickets = int(L1[1])
L2int = [-int(s) for s in L2]

heapq.heapify(L2int)

for t in range(tickets):
    heapq.heappush(L2int,heapq.heappop//2)
print(-sum(L2int))
Problem p02984 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
X = []
for i in range(N):
    X.append(sum(A) - 2 * sum([x for j, x in enumerate(A) if j % 2 != 0]) if i == 0 else 2 * A[i-1] - X[i-1])
print(' '.join(list(map(str, X))).strip())

Buggy submission (verdict: Runtime Error):
import numpy as np

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

X = []
for i in range(N):
    x = [0 for _ in range(N)]
    for j in range(i, i+2):
        if j >= N:
            continue
        x[j] = 1
    if i == N - 1:
        x[0] = 1
    X.append(x)

Y = A
X = np.matrix(X)
Y = np.matrix(Y).reshape(-1, 1)
ans = np.linalg.solve(X,Y) * 2
ans = list(map(lambda x: str(int(x)), ans))
print(' '.join(ans).strip())
Problem p02990 (python)

Fixed submission:
import math


def combinations_count(n, r):
    if n >= r:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    else:
        return 0


N, K = map(int, input().split())
mod = int(1e+9 + 7)
for i in range(1, K+1):
    print(int(combinations_count(N-K+1, i) * combinations_count(K-1, i-1) % mod))

Buggy submission (verdict: Runtime Error):
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N, K = map(int, input().split())
mod = int(1e+9 + 7)
for i in range(1, K+1):
    print(int(combinations_count(N-K+1, i) * combinations_count(K-1, i-1) % mod))

Buggy submission (verdict: Runtime Error):
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N, K = map(int, input().split())
mod = int(1e+9 + 7)
print(mod)
for i in range(1, K+1):
    print(int(combinations_count(N-K+1, i) * combinations_count(K-1, i-1) % mod))

Buggy submission (verdict: Runtime Error):
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N, K = map(int, input().split())
mod = 1e+9 + 7

for i in range(1, K+1):
    print(int(combinations_count(N-K+1, i) * combinations_count(K-1, i-1) % mod))
Problem p02933 (python)

Fixed submission:
a = input()
s = raw_input()

if a >= 3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
a = input()
s = input()

if a >= 3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
a = input()
s = input()

if a >= 3200:
    print(s)
else:
    print("red")
Problem p03013 (python)

Fixed submission:
# -*- coding: utf-8 -*-

def fb(num):
    fblist = []
    x, y = 1, 0
    for _ in range(num):
        fblist.append(x)
        x, y = x + y, x
    return fblist

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

l = fb(n + 1)

now = 0
p_cnt = []
for i in range(m):
    a = int(input())
    if now == a:
        print(0)
        exit()
    p_cnt.append(l[a - 1 - now])
    now = a + 1

# print(n)
# print(now)
# print(l)
p_cnt.append(l[n - now])

# print(p_cnt);
ans = 1
for j in range(len(p_cnt)):
    # print(ans)
    ans *= p_cnt[j]
    # print(ans)
    
print(ans %  1000000007)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def fb(num):
    fblist = []
    x, y = 1, 0
    for _ in range(num):
        fblist.append(x)
        x, y = x + y, x
    return fblist



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

l = fb(n)

now = 0
p_cnt = []
for i in range(m):
    a = int(input())
    if now == a:
        print(0)
        exit()
    p_cnt.append(l[a - 1 - now])
    now = a + 1

p_cnt.append(l[n - now])

# print(p_cnt);
ans = 1
for j in range(len(p_cnt)):
    # print(ans)
    ans *= p_cnt[j]
    # print(ans)
    
print(ans %  1000000007)
Problem p02951 (python)

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

if c > a-b:
    ans = c-a+b
else:
    ans = 0
print(ans)

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

if c > a-b:
    ans = c-a+b
else:
    ans = 0
Problem p03803 (python)

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

if a==1:
    a = 14
if b==1:
    b = 14

if a>b:
    print("Alice")
elif a<b:
    print("Bob")
else:
    print("Draw")

Buggy submission (verdict: Runtime Error):
a, b = input().stlip()

if a==1:
    a = 14
if b==1:
    b = 14

if a>b:
    print("Alice")
elif a<b:
    print("Bob")
else:
    print("Draw")

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

if a==1:
    a = 14
if b==1:
    b = 14

if a>b:
    print("Alice")
elif a<b:
    print("Bob")
else:
    print("Draw")
Problem p03834 (python)

Fixed submission:
a = input()
a = a.replace(",", " ")
print(a)

Buggy submission (verdict: Runtime Error):
a = input().str()

a = a.replace(",", " ")

print(a)
Problem p02912 (python)

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

N,M = (int(x) for x in input().split())
A = list(map(int, input().split()))
A = [-i for i in A]
# print(A)
heapq.heapify(A)
# print(heapq.heappop(A))

# t1 = time.time()
for i in range(M):
    a = -heapq.heappop(A) // 2
    heapq.heappush(A, -a)
    # j = A.index(max(A))
    # A[j] = a
    # A[0] = A[0]//2
    # A.sort(reverse=True)
    # if sum(A) <1:
    #     break

print(-sum(A))

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

N,M = (int(x) for x in input().split())
A = list(map(int, input().split()))
# A.sort(reverse=True)

# t1 = time.time()
for i in range(M):
    a = max(A) // 2
    j = A.index(max(A))
    A[j] = a
	if sum(A) <1:
		break

print(sum(A))
Problem p02915 (python)

Fixed submission:
N = int(input())
print(N**3)

Buggy submission (verdict: Runtime Error):
N = input()
print(N^3)
Problem p02951 (python)

Fixed submission:
A, B, C=map(int, input().split())


ans = C-(A-B)
if ans<0:
  ans = 0
  
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
flag = 0
No = 0

for i in range(N-1):
    diff = H[i+1]-H[i]   
    
    if diff < -1 or (diff == -1 and flag ==1):
        No = 1
    elif diff == -1 and flag == 0:
        flug = 1
    elif diff > 0:
        flug = 0    
        
if No == 0: print("Yes")
else: print("No")
Problem p02912 (python)

Fixed submission:
import math
import heapq

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

a_minus = [a[i] * (-1) for i in range(n)]

heapq.heapify(a_minus)

for i in range(m):
    value = heapq.heappop(a_minus)
    value /= 2
    heapq.heappush(a_minus, value)

count = 0
for i in range(n):
    value = heapq.heappop(a_minus) * -1
    count += math.floor(value)

print(count)

Buggy submission (verdict: Runtime Error):
import math
import sys
n, m = map(int, input().split(" "))
a = list(map(int, input().split(" ")))

sortedA = sorted(a, reverse=True)

x = 0
y = 0
me = 0
while True:
    while sortedA[y] > sortedA[y + 1] and x != m:
        sortedA[y] /= 2
        x += 1
        if me < sortedA[y]:
            me = sortedA[y]
    y += 1
    if me > sortedA[y]:
        y = 0

    if x == m:
        count = 0
        for i in range(n):
            count += math.floor(sortedA[i])

        print(count)
        sys.exit()

count = 0
for i in range(n):
    count += math.floor(sortedA[i])

print(count)
Problem p02916 (python)

Fixed submission:
n = 0
a = []
b = []
c = []

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

sum = 0
tmp = 0
cc = 0

for m in range(n):
    i = a[m]
    if i-1 <=0:
        cc = 0
    elif tmp == i-1:
        cc = c[i-2]
    else:
        cc = 0
    sum += b[i-1]
    sum += cc
    tmp = i

print(sum)

Buggy submission (verdict: Runtime Error):
n = 0
a = []
b = []
c = []

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

# print(n)
# print(a)
# print(b)
# print(c)

sum = 0
tmp = 0
cc = 0

for m in range(n):
    i = a[m]
    print(f"i = {i}")
    print(f"tmp = {tmp}")
    if tmp == i-1:
        cc = c[i-2]
        print(f"cc = {cc}")
    else:
        cc = 0
    sum += b[i-1]
    sum += cc
    tmp = i

print(sum)
Problem p03075 (python)

Fixed submission:
import sys
a, b, c, d, e, k = map(int,sys.stdin.readlines())
if e - a > k:
  print(":(")
else:
  print("Yay!")

Buggy submission (verdict: Runtime Error):
a, b, c, d, e, k = map(int, input().split())
if (e - a) >= k:
  print(":(")
else:
  print("Yay!")

Buggy submission (verdict: Runtime Error):
a, b, c, d, e, k = map(int, input().split())
if e - a >= k:
  print(":(")
else:
  print("Yay!")
Problem p03053 (python)

Fixed submission:
from collections import deque
import copy
 
def main():
    h, w = map(int, input().split())
    a = [[j == "#" for j in input()] for _ in range(h)]
 
 
    que = deque([(i, j) for i in range(h) for j in range(w) if a[i][j]])
 
    count = 0
    while True:
        count += 1
        nque = deque()
        while que:
            y, x = que.popleft()
            if x > 0 and not a[y][x-1]:
                a[y][x-1] = True
                nque.append((y,x-1))
            if x < w-1 and not a[y][x+1]:
                a[y][x+1] = True
                nque.append((y,x+1))
            if y > 0 and not a[y-1][x]:
                a[y-1][x] = True
                nque.append((y-1,x))
            if y < h-1 and not a[y+1][x]:
                a[y+1][x] = True
                nque.append((y+1,x))
 
        if nque:
            que = copy.copy(nque)
        else:
            break
 
    print(count - 1)

if __name__ == "__main__":
    main()

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

black = []
distance = [[-1 for _ in range(H)] for _ in range(W)]
for i in range(H):
  for j in range(W):
    if M[i][j] == '#':
      black.append((i, j))
      distance[i][j] = 0
      
while black:
  bi, bj = black.pop(0)
  for i, j in [(bi - 1, bj), (bi + 1, bj), (bi, bj - 1), (bi, bj + 1)]:
    if i >= 0 and i < H and j >= 0 and j < W:
      if M[i][j] == '.' and distance[i][j] == -1:
        M[i][j] = '#'
        black.append((i, j))
        distance[i][j] = distance[bi][bj] + 1
print(max([x for d in distance for x in d]))

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

black = []
distance = [[-1 for _ in range(H)] for _ in range(W)]
for i in range(H):
  for j in range(W):
    if M[i][j] == '#':
      black.append((i, j))
      distance[i][j] = 0
      
while black:
  bi, bj = black.pop(0)
  for i, j in [(bi - 1, bj), (bi + 1, bj), (bi, bj - 1), (bi, bj + 1)]:
    if i >= 0 and i < H and j >= 0 and j < W:
      if M[i][j] == '.' and distance[i][j] == -1:
        M[i][j] = '#'
        black.append((i, j))
        distance[i][j] = distance[bi][bj] + 1
print(max([max(d) for d in distance]))
Problem p03018 (python)

Fixed submission:
import re
S = input()
N1 = S.replace('A','0').replace('BC','1')
S_li = re.split('B|C',N1)
 
count = 0
for l in S_li:
    a = sum([i for i,x in enumerate(l) if '1' in x])
    su=sum([x for x in range(l.count('1'))])
    count += (a-su)
print(str(count))

Buggy submission (verdict: Runtime Error):
import re
S = input()
N1 = S.replace('A','0').replace('BC','1')
S_li = re.split('[BC]')

count = 0
for l in S_li:
    if len(l):
        while True:
            a = l.find('0')
            if a<0:
                break
            bc = l.rfind('1')
            if a < bc:
                l = l[a+1:bc]
                count += (bc-a)
            else:
                break

print(str(count))