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

Fixed submission:
from collections import deque
import itertools

def bfs(graph, sh, sw):
    td = deque([[sh, sw]])
    graph[sh][sw] = "0"
    while td:
        h, w = td.popleft()
        num = int(graph[h][w])
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_h, new_w = h + j, w + k
            if new_h == gy and new_w == gx:
                return num + 1
                break
            
            if new_h < 0 or new_h >= H or new_w < 0 or new_w >= W:
                continue
            elif graph[new_h][new_w] == ".":
                graph[new_h][new_w] = str(num + 1)
                td.append([new_h, new_w])

    return -1

H, W = map(int, input().split())
ls = [[_ for _ in input()] for _ in range(H)]

sy, sx = 0, 0
gy, gx = H - 1, W - 1

bcnt = 0

for s, t in itertools.product(range(H), range(W)):
    if ls[s][t] == "#":
        bcnt += 1

nurazu = bfs(ls, sy, sx)
nurazu = nurazu + 1

if nurazu == 0:
    print(-1)
else:
    print(H * W - (bcnt + nurazu))

Buggy submission (verdict: Runtime Error):
from collections import deque
import itertools

def bfs(graph, sh, sw):
    td = deque([[sh, sw]])
    graph[sh][sw] = "0"
    while td:
        h, w = td.popleft()
        num = int(graph[h][w])
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_h, new_w = h + j, w + k
            if new_h == gy and new_w == gx:
                return num + 1
            
            if new_h < 0 or new_h >= H or new_w < 0 or new_w >= W:
                continue
            elif graph[new_h][new_w] == ".":
                graph[new_h][new_w] = str(num + 1)
                td.append([new_h, new_w])

H, W = map(int, input().split())
ls = [[_ for _ in input()] for _ in range(H)]

sy, sx = 0, 0
gy, gx = H - 1, W - 1

bcnt = 0

for s, t in itertools.product(range(H), range(W)):
    if ls[s][t] == "#":
        bcnt += 1

nurazu = bfs(ls, sy, sx)
nurazu = nurazu + 1

print(H * W - (bcnt + nurazu))
Problem p03627 (python)

Fixed submission:
import collections

n = int(input())
ls = list(map(int, input().split()))

c = collections.Counter(ls)

ls_s = c.most_common()
ls_s.sort(reverse=True)

mul = []

for i in range(len(ls_s)):
    if ls_s[i][1] >= 4:
        if len(mul) == 0:
            print(ls_s[i][0] ** 2)
            break
        elif len(mul) == 1:
            print(ls_s[i][0] * mul[0])
            break
    elif ls_s[i][1] >= 2:
        mul.append(ls_s[i][0])
    
    if len(mul) >= 2:
        print(mul[0] * mul[1])
        break
    elif i == len(ls_s) - 1:
        print(0)

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
ls = list(map(int, input().split()))

c = collections.Counter(ls)

ls_s = c.most_common()
ls_s.sort(reverse=True)

mul = []

for i in range(len(ls_s)):
    if ls_s[i][1] >= 4:
        if len(mul) == 0:
            print(ls_s[i][0] ** 2)
            break
        elif len(mul) == 1:
            print(ls_s[i][0] * mu;[0])
            break
    elif ls_s[i][1] >= 2:
        mul.append(ls_s[i][0])
    
    if len(mul) >= 2:
        print(mul[0] * mul[1])
        break
    elif i == len(ls_s) - 1:
        print(0)
Problem p03633 (python)

Fixed submission:
import fractions
from functools import reduce

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_ls(num):
    return reduce(lcm, num, 1)

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

print(lcm_ls(ls))

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

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

def lcm_ls(num):
    return reduce(lcm, num, 1)

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

print(lcm_ls(ls))
Problem p03729 (python)

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

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

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

if a[-1] == b[0] and b[-1] == c[0]:
    print("Yes")
else:
    print("No")
Problem p03797 (python)

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

if 2 * n >= m:
    print(min(n, m//2))
else:
    print((2 * n + m) // 4)

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

if 2 * n >= m:
    print(min(n, m//2)
else:
    print((2 * n + m) // 4)
Problem p02612 (python)

Fixed submission:
N = int(input())
print(1000 - N%1000 if N%1000!=0 else 0)

Buggy submission (verdict: Runtime Error):
N = int(input())
print(1000 - N%1000 if N%1000!=0 else 0)a
Problem p02720 (python)

Fixed submission:
def resolve():
	from collections import deque
	K = int(input())
	q = deque(str(i) for i in range(1, 10))
	cnt = 9
	if K < 10:
		print(K); return
	while True:
		tmp = q.popleft()
		las = int(tmp[-1])
		for i in range(las-1, las+2):
			if 0<=i<=9:
				q.append(tmp + str(i))
				cnt += 1
				if cnt==K:
					print(q.pop()); return
resolve()

Buggy submission (verdict: Runtime Error):
from numba import jit

@njit
def resolve():
	from collections import deque
	K = int(input())
	q = deque(str(i) for i in range(1, 10))
	cnt = 9
	if K < 10:
		print(K); return
	while True:
		tmp = q.popleft()
		las = int(tmp[-1])
		for i in range(las-1, las+2):
			if 0<=i<=9:
				q.append(tmp + str(i))
				cnt += 1
				if cnt==K:
					print(q.pop()); return
resolve()

Buggy submission (verdict: Runtime Error):
from collections import deque
K = int(input())
q = deque(str(i) for i in range(1, 10))
cnt = 9
if K < 10:
    print(K); return
while True:
    tmp = q.popleft()
    las = int(tmp[-1])
    for i in range(las-1, las+2):
        if 0<=i<=9:
            q.append(tmp + str(i))
            cnt += 1
            if cnt==K:
                print(q.pop()); return
Problem p02741 (python)

Fixed submission:
k = int(input())
s =  "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1,  51"
l = s.split(",")
print(int(l[k-1]))

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
a = x*y/2
if (x%2 != 0) and (y%2 != 0):
    a += 1
print(int(a))

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
a = x*y/2
if (x%2 != 1) and (y%2 != 1):
    a += 1
print(int(a))

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
a = x*y/2
if (x%2 != 0) and (y%2 != 0):
    a += 1
print(int(a))

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
a = x*y/2
if (x%2 != 0) and (y%2 != 0):
    a += 1
print(int(a))

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
a = x*y/2
if not a%2 == 0:
    a += 1
print(int(a))
Problem p02848 (python)

Fixed submission:
n = int(input())
s = list(input())
num_list = [ord(i)+n for i in s] #ord(A)は65
ans_num = [(i-65)%26 + 65 for i in num_list]
ans_str = [chr(i) for i in ans_num]
ans = "".join(ans_str)
print(ans)

Buggy submission (verdict: Runtime Error):
sl = [i for i in list(__import__('string').ascii_uppercase)] #string list
nl = list(range(26)) #number list
sd = dict(zip(nl, ul)) #                 {0:A}
sd_inv = {i:j for j,i in sd.items()} #  {A:0}

n = int(input()) #問題の入力
s = list(input()) #問題の入力

orig_num = [sd_inv[i]+n for i in s]
ans_num = []
for i in orig_num:
    if i>25:
        a = i-26
    else:
        a = i
    ans_num.append(a)
ans_list = [sd[i] for i in ans_num]
ans = "".join(ans_list)
print(ans)

Buggy submission (verdict: Runtime Error):
ul = [i for i in list(__import__('string').ascii_uppercase)]
nl = list(range(26))
ad = dict(zip(nl, ul))
ad_inv = {i:j for j,i in ad.items()}

n = int(input())
s = list(input())
ans = [ad_inv[i]+n for i in s]
ans = [ad[i] for i in ans]
ans = "".join(ans)
print(ans)

Buggy submission (verdict: Runtime Error):
ul = [i for i in list(__import__('string').ascii_uppercase)]
nl = list(range(26))
ad = dict(zip(nl, al))
ad_inv = {i:j for j,i in ad.items()}

n = int(input())
s = list(input())
ans = [ad_inv[i]+n for i in s]
ans = [ad[i] for i in ans]
ans = "".join(ans)
print(ans)

Buggy submission (verdict: Runtime Error):
ll = [i for i in list(__import__('string').ascii_lowercase)]
ul = [i for i in list(__import__('string').ascii_uppercase)]
al = ll + ul
nl = list(range(52))
ad = dict(zip(nl, al))
ad_inv = {i:j for j,i in ad.items()}

n = int(input())
s = list(input())
ans = [ad_inv[i]+n for i in s]
ans = [ad[i] for i in ans]
ans = "".join(ans)
print(ans)
Problem p02936 (python)

Fixed submission:
import sys
import io
#sys.stdin = io.StringIO(input_string)
sys.setrecursionlimit(10 ** 6)
def input():
    return sys.stdin.readline()[:-1]
    
def resolve():
	from collections import deque
	
	n, q = map(int, input().split())
	adj = [[] for i in range(n+1)]
	for i in range(n-1):
		a, b = map(int, input().split())
		adj[a-1].append(b-1)
		adj[b-1].append(a-1)
	ans = [0 for i in range(n)]
	for i in range(q):
		p, x = map(int, input().split())
		p -= 1
		ans[p] += x
#	print(f"{adj=}\n{ans=}")

	def dfs(now, prv):
		for next in adj[now]:
#			print(f"{now=}, {next=}")
			if next == prv:
				continue
			ans[next] += ans[now]
			dfs(next, now)

	dfs(0, 0)
	print(*ans)

resolve()

Buggy submission (verdict: Runtime Error):
import sys
import io
#sys.stdin = io.StringIO(input_string)
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def resolve():
	from collections import deque
	
	n, q = map(int, input().split())
	adj = [[] for i in range(n+1)]
	for i in range(n-1):
		a, b = map(int, input().split())
		adj[a-1].append(b-1)
		adj[b-1].append(a-1)
	ans = [0 for i in range(n)]
	for i in range(q):
		p, x = map(int, input().split())
		p -= 1
		ans[p] += x
#	print(f"{adj=}\n{ans=}")

	def dfs(now, prv):
		for next in adj[now]:
#			print(f"{now=}, {next=}")
			if nextinput = sys.stdin.readline == prv:
				continue
			ans[next] += ans[now]
			dfs(next, now)

	dfs(0, 0)
	print(*ans)

resolve()

Buggy submission (verdict: Runtime Error):
def input():
  	import sys
	return sys.stdin.readline()[:-1]

def resolve():
	from collections import deque
	
	n, q = map(int, input().split())
	adj = [[] for i in range(n+1)]
	for i in range(n-1):
		a, b = map(int, input().split())
		adj[a].append(b)
		adj[b].append(a)
	p = [list(map(int, input().split())) for i in range(q)]
	
	ans = [0 for i in range(n+1)]
	tmp = [0 for i in range(n+1)]
	for i in range(q):
		tmp[p[i][0]] += p[i][1]

	for start, point in enumerate(tmp):
		q = deque([start])
		while q:
			node = q.popleft()
			ans[node] += tmp[start]
			for i in list(filter(lambda x: x>node, adj[node])):
				q.append(i)

	for i in ans[1:]:
		print(i, end=" ")

#resolve()
Problem p02612 (python)

Fixed submission:
import math
N = int(input())
print(str((math.ceil((N)/1000))*1000 - (N)))

Buggy submission (verdict: Runtime Error):
N = int(input())
print(str(math.ceil(N) - (N)))
Problem p02613 (python)

Fixed submission:
N = int(input())
result = []
for i in range(0,(N)):
    A = input()
    if A:
        result.append(A)
AC = result.count("AC")
WA = result.count("WA")
TLE = result.count("TLE")
RE = result.count("RE")
print(f"AC x {AC}\nWA x {WA}\nTLE x {TLE}\nRE x {RE}\n")

Buggy submission (verdict: Runtime Error):
N = input()
result = []
for i in range(0,(N)):
    A = input()
    if A:
        result.append(A)
AC = result.count("AC")
WA = result.count("WA")
TLE = result.count("TLE")
RE = result.count("RE")
print(f"AC x {AC}\nWA x {WA}\nTLE x {TLE}\nRE x {RE}\n")
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
A,B = map(float,input().split())
print(int(((A)*100(B)*100))/10000)

Buggy submission (verdict: Runtime Error):
def main ():
N = int(input())
A = list(map(int,input().split()))
if 0 in A: print (0)
return
prod = 1 for a in A:
prod *= a
if prod > 1000000000000000000:
print(-1) return
print(prod) main ()

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))
import numpy as np
X = np.prod(A)
if X < 10**18 :
    print(X)
else :
    print('-1')

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))
import numpy as np
X = np.prod(A)
if X <= 10**18 :
    print(X)
else :
    print('-1')

Buggy submission (verdict: Runtime Error):
A = input() B = input()
C = A *B
print(C)
Problem p02675 (python)

Fixed submission:
N = int(input())
n = N%10
if n == 3:
    print('bon')
elif n == 0 or n == 1 or n == 6 or n == 8:
    print('pon')
else:
    print('hon')

Buggy submission (verdict: Runtime Error):
N =int(input())
amari = N % 10
if |m == 2||m ~~ 4||m == 5||m == 7||m == 9| in str(amari) :
    print ('hon')

Buggy submission (verdict: Runtime Error):
amari = N % 10
if 2 and 4 and 5 and 7 and 9 in amari :
        print str(N) + 'hon'
elif 0 and 1 and 6 and 8 in amari :
    print str(N) + 'pon' 
else print str(N) + 'bon'
Problem p02657 (python)

Fixed submission:
#A
a, b = map(int,input().split())
print(a*b)

Buggy submission (verdict: Runtime Error):
Problem p02658 (python)

Fixed submission:
#B
def main ():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
main ()

Buggy submission (verdict: Runtime Error):
#B
unti()

def unti():
    N = int(input())
    A = list(map(int, input().split()))
    result = 1
    if 0 in A:
        print(0)
        return
    for a in A:
        if 0 in A:
            print(0)
            break
        result *= a
    if result >10**18:
        print(-1)
    else:
        print(result)
Problem p02761 (python)

Fixed submission:
#157
def main():
    N, M = map(int,input().split())
    num = [-1]*N
    for i in range(M):
        s, c = map(int,input().split())
        if(s==1 and c==0 and N!=1):
            print(-1)
            return
        if(num[s-1]==-1 or num[s-1]==c):
            num[s-1] = c
        else:
            print(-1)
            return
    result = ''
    for i in range(N):
        if(num[i]!=-1):
            result+=str(num[i])
        else:
            if(N==1):
                result+='0'
            elif(i==0):
                result+='1'
            else:
                result+='0'
    print(result)

main()

Buggy submission (verdict: Runtime Error):
#157
def main():
    N, M = map(int,input().split())
    num = [-1]*N
    for i in range(M):
        s, c = map(int,input().split())
        if(s==1 and c==0 and N!=1):
            print(-1)
            return
        if(num[s-1]==-1 or num[s-1]==c):
            num[s-1] = c
        else:
            print(-1)
            return
    result = ''
    for i in ramge(N):
        if(num[i]!=-1):
            result+=str(num[i])
        else:
            if(N==1):
                result+='0'
            elif(i==0):
                result+='1'
            else:
                result+='0'
    print(result)

main()
Problem p02576 (python)

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

if X >= N:
    print(T)
elif N % X == 0:
    print(N//X*T)
else:
    print((N//X+1)*T)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = int(input())
T = int(input())

if X >= N:
    print(T)
elif N % X == 0:
    print(N//X*T)
else:
    print((N//X*T)+T)
Problem p02613 (python)

Fixed submission:
n = int(input())
a=b=c=d=0
for i in range(n):
  e = input()
  if e == 'AC':
    a+=1
  elif e == 'WA':
    b +=1
  elif e == 'TLE':
    c+=1
  else:
    d+=1

    

print('AC x '+str(a)+'\n'+'WA x ' +str(b) + '\n'
      +'TLE x '+str(c) +'\n' + 'RE x '+str(d))

Buggy submission (verdict: Runtime Error):
n = int(input())
a,b,c,d =0
for i in range(n):
  e = input()
  if e == 'AC':
    a+=1
  elif e == 'WA':
    b +=1
  elif e == 'TLE':
    c+=1
  else:
    d+=1

print('AC ×'+str(a)+'\n'+'WA ×' +str(b) + '\n'
      +'TLE ×'+str(c) +'\n' + 'RE ×'+str(d))
Problem p02628 (python)

Fixed submission:
n,k = map(int,input().split())
if n==1:
    print(int(input()))
else:
    total = 0
    lis = list(map(int,input().split()))
    lis.sort()
    for i in range(k):
        total += lis[i]
    print(total)

Buggy submission (verdict: Runtime Error):
import numpy as np
from itertools import combinations
if n==1:
    print(int(input()))
else:
    n,k = map(int,input().split())
    lis = input().split()
    total =np.inf

    for i in combinations(lis,k):
        ml =0

        for a in i:

            ml += int(a)

        total = min(total,ml)


    print(total)
Problem p02717 (python)

Fixed submission:
X,Y,Z = input().split()
print(Z,X,Y)

Buggy submission (verdict: Runtime Error):
X,Y,Z = input().split()
print(Z X Y)
Problem p02887 (python)

Fixed submission:
from itertools import groupby
n= input()
s = input()
G = groupby(s)

print(len(list(G)))

Buggy submission (verdict: Runtime Error):
n= input()
s = input()
G = groupby(s)

print(len(list(G)))
Problem p03031 (python)

Fixed submission:
import numpy as np
from itertools import combinations
n,m = map(int,input().split())
card =[[0]*n for _ in range(m)]
for i in range(m):
    switch = list(map(int,input().split()))[1:]
    for k in switch:
        card[i][k-1] = 1
##どこに繋がっているかを配列で表現

#print(card)


ans =list(map(int,input().split()))
cnt=0
from itertools import combinations
##全通りを調べる
for epoch in range(1,n+1):
    
    for j in combinations(range(1,n+1),epoch):
        sco =[]
        for lisa in card:##一つずつの照明について調べる
            score =0
            for l in j:
                score += lisa[l-1]
                
            sco.append(score)
        #print(sco)
        if list(np.array(sco)%2) == ans:
            cnt+=1
    

if ans == [0]*m:
    cnt+=1
        
print(cnt)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
card =[[0]*n for _ in range(m)]
for i in range(m):
    switch = list(map(int,input().split()))[1:]
    for k in switch:
        card[i][k-1] = 1
##どこに繋がっているかを配列で表現

#print(card)


ans =list(map(int,input().split()))
cnt=0
from itertools import combinations
##全通りを調べる
for epoch in range(1,n+1):
    
    for j in combinations(range(1,n+1),epoch):
        sco =[]
        for lisa in card:##一つずつの照明について調べる
            score =0
            for l in j:
                score += lisa[l-1]
                
            sco.append(score)
        #print(sco)
        if list(np.array(sco)%2) == ans:
            cnt+=1
            
print(cnt)
Problem p03035 (python)

Fixed submission:
a,b= map(int,input().split())
if a >= 13:
    print(b)
elif a > 5:
    print(b//2)
elif a <= 5:
    print(0)

Buggy submission (verdict: Runtime Error):
a,b= map(int,input().split())
if A >= 13:
    print(b)
elif 6<=A:
    print(b/2)
else:
    print(0)
Problem p03262 (python)

Fixed submission:
from functools import reduce
from fractions import gcd
N,X=map(int,input().split())
x=[abs(X-int(i)) for i in input().split()]
print(reduce(gcd,x))

Buggy submission (verdict: Runtime Error):
import functools
from math import gcd
n,x =map(int,input().split())
lis = list(map(int,input().split()))
for i in range(n):
lis[i] = abs(lis[i]-x)
print(functools.reduce(gcd,lis))

Buggy submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
n,x =map(int,input().split())
if n==1:
    c = abs(int(input())-x)
    print(c)
else:
    lis = list(map(int,input().split()))
    for i in range(n):
        lis[i] = abs(lis[i]-x)
    print(reduce(gcd,lis))

Buggy submission (verdict: Runtime Error):
import functools
from math import gcd
n,x =map(int,input().split())
if n==1:
    print(abs(int(input())-x))
else:
    lis = list(map(int,input().split()))
    for i in range(n):
        lis[i] = abs(lis[i]-x)
    print(functools.reduce(gcd,lis))

Buggy submission (verdict: Runtime Error):
import math,functools

n,x =map(int,input().split())
if n==1:
    print(abs(int(input())-x))
else:
    lis = list(map(int,input().split()))
    for i in range(n):
        lis[i] = abs(lis[i]-x)
    print(functools.reduce(math.gcd,lis))

Buggy submission (verdict: Runtime Error):
import math,functools

n,x =map(int,input().split())
if n==1:
    print(abs(int(input())-x))
else:
    lis = list(map(int,input().split()))
    for i in range(n):
        lis[i] = abs(lis[i]-x)
    print(functools.reduce(math.gcd,lis))
Problem p03281 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n+1,2):
  res = 0
  for j in range(1,i+1):
    if i % j == 0:
      res +=1
    if res == 8:
      ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1,n+1):
  res = 0
  for j in range(i+1):
    if i % j ==0:
      res +=1
    if res == 8 :
      ans +=1

print(ans)
Problem p03369 (python)

Fixed submission:
top = input()
count = 0
for i in range(len(top)):
  if top[i] == 'o':
    count += 1

sum = 700 + count*100
print(sum)

Buggy submission (verdict: Runtime Error):
top = input()
count = 0
for i in len(str(top)):
  if top[i] == 'o':
    count += 1

sum = 700 + count*100
print(sum)

Buggy submission (verdict: Runtime Error):
top = input()
count = 0
for i in len(str(top)):
  if top[i] == 'o':
    count += 1

sum = 700 + int(count)*100
print(sum)

Buggy submission (verdict: Runtime Error):
top = input()
count = 0
for i in len(str(top)):
  if top[i] == 'o':
    count += 1

print(count)
Problem p03469 (python)

Fixed submission:
s= input()
print(s.replace('2017','2018'))

Buggy submission (verdict: Runtime Error):
s= input()
print(s.replace('2017','2018')

Buggy submission (verdict: Runtime Error):
s = input()
m = s.replace(2017,2018)
print(m)
Problem p03471 (python)

Fixed submission:
N,Y = map(int,input().split())
for a in range(N+1):
    for b in range (N+1-a):
        if a*10000+b*5000+1000*(N-a-b) == Y:
            print(a,b,N-a-b)
            exit()
print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())
if N*10000 == Y:
    print(N,0,0)
else:
    for a in range(N):
        for b in range (N+1-a):
            if a*10000+b*5000+1000*(N-a-b) == Y:
                print(a,b,N-a-b)
                break
        if a*10000+b*5000+1000*(N-a-b) == Y:
            break

if a == N-1 and  b == 1 and (N-1)*10000 + 5000 < Y:
    print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())
if N*10000 == Y:
    print(N,0,0)
else:
    for a in range(N):
        for b in range (N-a):
            if a*10000+b*5000+1000*(N-a-b) == Y:
                print(a,b,N-a-b)
                break
        if a*10000+b*5000+1000*(N-a-b) == Y:
            break

if a == N-1 and  b == 1 and a*10000 + b*5000 < Y:
    print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())
if N*10000 == Y:
    print(N,0,0)
else:
    for a in range(N):
        for b in range (N+1-a):
            if a*10000+b*5000+1000*(N-a-b) == Y:
                print(a,b,N-a-b)
                break
        if a*10000+b*5000+1000*(N-a-b) == Y:
            break

if a == N-1 and  b == 1 and a*10000 + b*5000 < Y:
    print(-1,-1,-1)
Problem p03487 (python)

Fixed submission:
from collections import Counter
n = int(input())
A = Counter(list(map(int,input().split())))
keys,counts = zip(*A.most_common())
total = 0
for key,count in zip(keys,counts):
    if key > count:
        total += count
    else:
        total += count-key
print(total)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = Counter(list(map(int,input().split())))
keys,counts = zip(*A.most_common())
total = 0
for key,count in zip(keys,counts):
    if key > count:
        total += count
    else:
        total += count-key
print(total)
Problem p03493 (python)

Fixed submission:
a = input()
n = 0
if a[0] == '1':
  n = n+1
if a[1] == '1':
  n = n+1
if a[2] == '1':
  n = n+1
  
print(n)

Buggy submission (verdict: Runtime Error):
a = string(input())
n = 0
if a[0] == '1':
  n = n+1
if a[1] == '1':
  n = n+1
if a[2] == '1':
  n = n+1
  
print(n)

Buggy submission (verdict: Runtime Error):
a = string(input())
n = 0
if a[0] == 1:
  n = n+1
if a[1] == 1:
  n = n+1
if a[2] == 1:
  n = n+1
  
print(n)