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

Fixed submission:
s = input()
l,r,ans = 0,len(s)-1,0
while l<r:
	if s[l]==s[r]: l,r = l+1,r-1
	elif s[l]=="x": l,ans = l+1,ans+1
	elif s[r]=="x": r,ans = r-1,ans+1
	else: break
if l>=r: print(ans)
else: print(-1)

Buggy submission (verdict: Runtime Error):
s = input()
l,r,ans = 0,len(s)-1,0
while l!=r:
	if s[l]==s[r]: l,r = l+1,r-1
	elif s[l]=="x": l,ans = l+1,ans+1
	elif s[r]=="x": r,ans = r-1,ans+1
	else: break
if l==r: print(ans)
else: print(-1)
Problem p03573 (python)

Fixed submission:
x = [int(i) for i in input().split()]
x.sort()
if x[0]==x[1]: print(x[2])
else: print(x[0])

Buggy submission (verdict: Runtime Error):
def connect(blist, a):
	x = []
	for i in range(len(blist)):
		if blist[i][0]==a:
			x.append(blist[i][1])
		elif blist[i][0]>a:
			break
	for j in range(len(blist)):
		if blist[j][1]==a:
			x.append(blist[j][0])
	return(x)

n,m = (int(i) for i in input().split())
y = [[int(i) for i in input().split()] for i in range(m)]
answer = 0
for j in range(len(y)):
	y2,z = [],set()
	for k in range(1,n+1):
		y2.append(connect(y[:j]+y[min(j+1,len(y)):],k))
	for j2 in y2[y[j][0]-1]:
		z.add(j2)
	num = 0
	while y[j][1] not in z and len(z) != num:
		num,z2 = len(z),list(z)
		for k in z2:
			for k2 in y2[k-1]:
				z.add(k2)
	if y[j][1] not in z:
		answer += 1
print(answer)
Problem p03597 (python)

Fixed submission:
n = int(input())
a = int(input())
print(n**2-a)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f = (int(i) for i in input().split())
w,s,num,answer = set(),set(),0,[a*100,0]
for i in range((f-f%(a*100))//(a*100)+1):
	for j in range((f-f%(b*100))//(b*100)+1):
		if i*a*100+j*b*100 <= f:
			w.add(i*a*100+j*b*100)
		else:
			break
smax = int(e*f/((100+e)*1.0))
for i in range((smax-smax%c)//c+1):
	for j in range((smax-smax%d)//d+1):
		if i*c+j*d <= smax:
			s.add(i*c+j*d)
		else:
			break
w2,s2 = sorted(list(w))[::-1],sorted(list(s))[::-1]
for i in w2:
	for j in s2:
		if 0 < i+j <= f and e*i>=100*j and num<(j/((i+j)*1.0)):
			num =  j/((i+j)*1.0)
			answer = [i,j]
print(sum(answer),answer[1])
Problem p03600 (python)

Fixed submission:
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
n = int(input())
a = np.array([[int(i) for i in input().split()] for i in range(n)])
d,ans = floyd_warshall(a,directed=False),0
if any(a[i][j]!=d[i][j] for i in range(n) for j in range(n)): ans = -1
else:
	inf = 10**10
	for i in range(n): a[i][i] = inf
	for i in range(n):
		for j in range(i+1,n):
			num = np.min(a[i]+a[j])
			if num>a[i][j]: ans+=a[i][j]
print(int(ans))

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
n = int(input())
a = np.array([[int(i) for i in input().split()] for i in range(n)])
d,ans = floyd_warshall(a,directed=False),0
if any(a[i][j]!=d[i][j] for i in range(n) for j in range(n)): ans = -1
else:
	inf = float("inf")
	for i in range(n): a[i][i] = inf
	for i in range(n):
		for j in range(i+1,n):
			num = np.min(a[i]+a[j])
			if num>a[i][j]: ans+=a[i][j]
print(int(ans))
Problem p03626 (python)

Fixed submission:
n = int(input())
x = input()
y = input()
if x[0]==y[0]: num,flag,place = 3,True,1
else: num,flag,place = 6,False,2
while place!=n:
	if flag:
		num = (num*2)%(10**9+7)
		if x[place]!=y[place]:
			flag = False
			place += 2
		else: place+=1
	else:
		if x[place]==y[place]:
			flag = True
			place += 1
		else:
			num = (num*3)%(10**9+7)
			place += 2
print(num)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = input()
y = input()
place = 0
if x[0]==y[0]: num,flag = 3,True
else: num,flag = 6,False
while place<n-1:
	if flag:
		place += 1
		num = (num*2)%(10**9+7)
		if x[place]!=y[place]: flag = False
	else:
		place += 2
		if x[place]==y[place]: flag=True
		else: num=(num*3)%(10**9+7)
print(num)
Problem p03638 (python)

Fixed submission:
h,w = (int(i) for i in input().split())
n = int(input())
a = [int(i) for i in input().split()]
x,num = [],0
for i in range(n):
	for j in range(a[i]):
		x.append(str(i+1))
while x != []:
	num += 1
	if num%2==1:
		print(" ".join(x[:w]))
		x = x[w:]
	else:
		print(" ".join(x[:w][::-1]))
		x = x[w:]

Buggy submission (verdict: Runtime Error):
h,w = (int(i) for i in input().split())
n = int(input())
a = [int(i) for i in input().split()]
x,num = "",0
for i in range(n):
	x += str(i+1)*a[i]
while x != "":
	num += 1
	y = ""
	if num%2==1:
		for i in range(w-1):
			y += x[i]+" "
		y += x[w-1]
		print(y)
		x = x[w:]
	else:
		for i in range(w-1,0,-1):
			y += x[i]+" "
		y += x[0]
		print(y)
		x = x[w:]
Problem p03645 (python)

Fixed submission:
n,m = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(m)]
a ,b= [],[]
for i in x:
	if i[0]==1:
		a.append(i[1])
	if i[1]==n:
		b.append(i[0])
if len(a)+len(b) == len(set(a+b)): print("IMPOSSIBLE")
else: print("POSSIBLE")

Buggy submission (verdict: Runtime Error):
n,m = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(n)]
x.sort()
a = []
for i in x:
	if i[0]==1:
		a.append(i[1])
	else:
		break
for j in a:
	if [j,n] in x:
		m = 0
		print("POSSIBLE")
		break
if m != 0:
	print("IMPOSSIBLE")
Problem p03693 (python)

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

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

Fixed submission:
a,b,c = (int(i) for i in input().split())
if a<=c and c<=b: print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
n,k = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(n)]
x.sort()
num = 0
for i in x:
	num += i[1]
	if num>=k:
		print(i[0])
		break
Problem p03737 (python)

Fixed submission:
a,b,c = (i for i in input().split())
x = a[0]+b[0]+c[0]
x = x.upper()
print(x)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a>b: print("GREATER")
elif a<b: print("LESS")
else: print("EQUAL")
Problem p03739 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
num,answer1= a[0],0
if a[0]==0:
	num,answer1 = 1,1
for i in range(1,n):
	if num*(num+a[i]) >= 0:
		x = (-num)//abs(num)
		answer1 += abs((x-num)-a[i])
		num = x
	else:
		num += a[i]
if a[0]==0: num,answer2 = -1,1
else: num,answer2 = -a[0]//abs(a[0]),abs(a[0]-(-a[0]//abs(a[0])))
for i in range(1,n):
	if num*(num+a[i]) >= 0:
		x = (-num)//abs(num)
		answer2 += abs((x-num)-a[i])
		num = x
	else:
		num += a[i]
print(min(answer1,answer2))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
num,answer = a[0],0
for i in range(1,n):
	if num*(num+a[i]) >= 0:
		x = (-num)//abs(num)
		answer += abs((x-num)-a[i])
		num = x
	else:
		num += a[i]
print(answer)
Problem p03828 (python)

Fixed submission:
n = int(input())
x,answer = [2],1
if n != 1:
	for i in range(2,n+1):
		if all(i%j != 0 for j in x):
			x.append(i)
	for i in x:
		num,num2 = 1,0
		while i**num<=n:
			a = i**num
			num2 += (n-n%a)//a
			num += 1
		answer = answer*(num2+1)%(10**9+7)
print(answer)

Buggy submission (verdict: Runtime Error):
n,a,b = (int(i) for i in input().split())
x = [int(i) for i in input().split()]
answer = 0
for i in range(n-1):
	if (x[i+1]-x[i])*a < b: answer += (x[i+1]-x[i])*a
	else: answer += b
print(answer)
Problem p03838 (python)

Fixed submission:
x,y = (int(i) for i in input().split())
if abs(x)>abs(y):
	if x<0 and y<=0: answer = y-x
	elif (x<0 and y>0) or (x>0 and y<=0): answer = abs(x)-abs(y)+1
	elif x>0 and y>0: answer = abs(x)-abs(y)+2
elif abs(x)==abs(y): answer = 1
elif abs(x)<abs(y):
	if x>=0 and y>0: answer = y-x
	elif (x>=0 and y<0) or (x<0 and y>0): answer = abs(y)-abs(x)+1
	elif x<0 and y<0: answer = abs(y)-abs(x)+2
print(answer)

Buggy submission (verdict: Runtime Error):
a = [int(i) for i in input().split()]
f = lambda x: max(0,x-x%2)
print(max(a[1]+f(a[0])+f(a[3])+f(a[4]),a[1]+f(a[0]-1)+f(a[3]-1)+f(a[4]-1)+3))

Buggy submission (verdict: Runtime Error):
x,y = (int(i) for i in input().split())
if abs(x)>abs(y):
	if x<0 and y<=0: answer = y-x
	elif (x<0 and y>0) or (x>0 and y<=0): answer = abs(x)-abs(y)+1
	elif x>0 and y>0: answer = abs(x)-abs(y)+2
elif abs(x)==abs(y): answer = 1
elif abs(x)<abs(y):
	if x>=0 and y>0: answer = y-x
	elif (x>0 and y<0) or (x<=0 and y>0): answer = abs(y)-abs(x)+1
	elif x<0 and y<0: answer = abs(y)-abs(x)+2
print(answer)
Problem p03988 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
m,s = a[-1],a[0]
if m!=a[-2] or (m+1)//2!=s or (m%2 and s-a[1]) or ((not m%2) and s==a[1]) or any(a.count(i)<2 for i in range(s+1,m)) or (n!=2 and s==a[1]==a[2]): print("Impossible")
else: print("Possible")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
m,s = a[-1],a[0]
if m!=a[-2] or (m+1)//2!=s or (m%2 and s-a[1]) or ((not m%2) and s==a[1]) or any(a.count(i)<2 for i in range(s+1,m)) or s==a[1]==a[2]: print("Impossible")
else: print("Possible")
Problem p04014 (python)

Fixed submission:
from math import sqrt
n = int(input())
s = int(input())
def f(x,y):
	if y<x: return y
	else: return f(x,y//x)+(y%x)
if s==n: ans = n+1
elif n<s: ans = -1
else:
	ans = -1
	for i in range(2,int(sqrt(n))+1):
		if f(i,n)==s:
			ans = i
			break
	if ans==-1:
		for i in range(int(sqrt(n)),0,-1):
			b = (n-s)/i+1
			if b==int(b) and f(int(b),n)==s:
				ans = int(b)
				break
print(ans)

Buggy submission (verdict: Runtime Error):
from math import sqrt
n = int(input())
s = int(input())
def f(x,y):
	if y<x: return y
	else: return f(x,y//x)+(y%x)
if s==n: ans = n+1
else:
	ans = -1
	for i in range(2,int(sqrt(n))+1):
		if f(i,n)==s:
			ans = i
			break
	if ans==-1:
		for i in range(int(sqrt(n)),0,-1):
			b = (n-s)/i+1
			if b==int(b) and f(int(b),n)==s:
				ans = int(b)
				break
print(ans)
Problem p03455 (python)

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

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

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

if (a*b)%2 == 0 :
  print("Even")
else:
  print("Odd")
Problem p02945 (python)

Fixed submission:
a,b = map(int, input().split())
c=a+b
d=a-b
e=a*b
print(max(c, d, e))

Buggy submission (verdict: Runtime Error):
a,b =map(int, input().split())
print(max[a+b, a-b, a*b])

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

c= a+b
d= a-b
e= a*b
max = [c,d,e]
print(max)
Problem p02911 (python)

Fixed submission:
import numpy as np
Nn, Kk, Qq = input().split()
N, K, Q = int(Nn), int(Kk), int(Qq)
a = []
for q in range(Q):
    a.append(int(input()))
result = np.ones(N) * (K - Q)
for i in a:
    result[i-1] += 1
result = result > 0
for r in result:
    if r:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
Nn, Kk, Qq = input().split()
N, K, Q = int(Nn), int(Kk), int(Qq)
a = []
for q in range(Q):
    a.append(int(input()))
result = np.ones(N) * (K - Q)
for i in a:
    result[i-1] += 1
result = result > 0
for r in result:
    if r:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
Nn, Kk, Qq = input().split()
N, K, Q = int(Nn), int(Kk), int(Qq)
a = []
for q in range(Q):
    a.append(int(input()))
r = (np.ones(N) * K).astype(int)
for i in a:
    b = np.ones(N)
    b[i-1] = 0
    r = r - b
print("\n".join(["Yes" if rr > 0 else "No" for rr in r]))
Problem p02921 (python)

Fixed submission:
import numpy as np
S = np.array(list(input()))
T = np.array(list(input()))
print((S == T).sum())

Buggy submission (verdict: Runtime Error):
import numpy as np[]
S = np.array(list(input()))
T = np.array(list(input()))
print((S == T).sum())
Problem p02923 (python)

Fixed submission:
import numpy as np
N = input()
a = np.array(input().split()).astype(int)
flags = (np.diff(a) <= 0).astype(int)
result = 0
max_result = 0
for i, flag in enumerate(flags):
    if flag == 0:
        if result > max_result:
            max_result = result
        result = 0
    else:
        result += 1
    if i == len(flags) - 1:
        if result > max_result:
            max_result = result
print(max_result)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = input()
a = np.array(input().split()).astype(int)
flags = (np.diff(a) <= 0).astype(int)
result = 0
max_result = 0
for i, flag in enumerate(flags):
    if flag == 0:
        if result > max_result:
            max_result = result
        result = 0
    else:
        result += 1
    if i == len(flags) - 1:
        if result > max_result:
            max_result = result
print(max_result)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = input()
a = np.array(input().split()).astype(int)
flags = (np.diff(a) <= 0).astype(int)
result = 0
results = []
for i, flag in enumerate(flags):
    if flag == 0:
        results.append(result)
        result = 0
    else:
        result += 1
    if i == len(flags) - 1:
        results.append(result)
print(np.max(results))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = input()
a = np.array(input().split()).astype(int)
flags = (np.diff(a) <= 0).astype(int)
result = 0
results = []
for i, flag in enumerate(flags):
    if flag == 0:
        results.append(result)
        result = 0
    else:
        result += 1
    if i == len(flags) - 1:
        results.append(result)
print(np.max(results))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = input()
a = np.array(input().split()).astype(int)
flags = (np.diff(a) <= 0).astype(int)
result = 0
results = []
for i, flag in enumerate(flags):
    if flag == 0:
        results.append(result)
        result = 0
    elif flag == 1 and i != len(flags) - 1:
        result += 1
    else:
        result += 1
        results.append(result)
print(max(results))

Buggy submission (verdict: Runtime Error):
import numpy as np
a = np.array(input().split()).astype(int)
flags = (np.diff(a) <= 0).astype(int)
result = 0
results = []
for i, flag in enumerate(flags):
    if flag == 0:
        results.append(result)
        result = 0
    elif flag == 1 and i != len(flags) - 1:
        result += 1
    else:
        result += 1
        results.append(result)
print(max(results))
Problem p02921 (python)

Fixed submission:
S = list(input())
T = list(input()) 

ans =  0
for i in range(3):
    if S[i] == T[i]:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
S = list(input().split())
T = list(input().split())

ans =  0
for i in range(3):
    if S[i] == T[i]:
        ans += 1

print(ans)
Problem p02945 (python)

Fixed submission:
A, B = map(int, input().split())
print(max(A+B, A-B, A*B))

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

print(max(A+B, A-B, int(A*B)))

Buggy submission (verdict: Runtime Error):
A, B = map(int(), input().split())
 
print(max(A+B, A-B, A*B))

Buggy submission (verdict: Runtime Error):
A, B = int(input())

print(max(A+B, A-B, A*B))
Problem p02947 (python)

Fixed submission:
ans = 0
N = int(input())
s_list = [''.join(sorted(input())) for _ in range(N)]
s_list.sort()

count = 1
for i in range(1, N):
    if s_list[i] == s_list[i-1]:
        count += 1
    else:
        ans += (count*(count-1))/2
        count = 1

    if i == N-1:
        ans += (count*(count-1))/2

print(int(ans))

Buggy submission (verdict: Runtime Error):
S_dict = {}
N = int(input())
for _ in range(N):
    s = ''.join(sorted(input()))
    if s not in S_dict.keys():
        S_dict[s] = 0
    else:
        S_dict[s] += S_dict[s] + 1
print(sum(map(long, S_dict.values())))
Problem p03000 (python)

Fixed submission:
N, X = map(int, input().split())
L_list = list(map(int, input().split()))
D = 0
ans = 1
for i in range(N):
    D += L_list[i]
    if D > X:
        break
    else:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L_list = list(map(int, input().split()))
D = 0
ans = 0
for i in range(N+1):
    if D > X:
        break
    else:
        D += L_list[i]
        ans += 1
print(ans)
Problem p03086 (python)

Fixed submission:
S = list(input())
ans = 0
count = 0
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        count += 1
    else:
        if ans < count:
            ans = count
        else:
            pass
        count = 0
if ans < count:
    ans = count
else:
    pass
print(ans)

Buggy submission (verdict: Runtime Error):
S = list(input())
ans = 0
count = 0
for i in len(S):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        count += 1
    else:
        if ans < count:
            ans = count
        else:
            pass
        count = 0
print(ans)
Problem p03145 (python)

Fixed submission:
AB, BC, CD = map(int, input().split())

print(int(AB*BC*0.5))

Buggy submission (verdict: Runtime Error):
AB BC CD = map(int, input().split())

print(int(AB*BC*0.5))
Problem p03238 (python)

Fixed submission:
N = int(input())

if N == 1:
	print('Hello World')
else:
	A = int(input())
	B = int(input())
	print(A+B)

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

if N == 1:
	print('Hello World')
else:
	for i in range(2):
		A = int(input())
		B = int(input())
		print(A+B)
Problem p03408 (python)

Fixed submission:
N = int(input())

N_list = []
M_list = []
answer = 0

for i in range(N):
	s = input()
	N_list.append(s)

M = int(input())

for i in range(M):
	t = input()
	M_list.append(t)

for i in range(N):
	S = N_list[i]
	plus  = N_list.count(S)
	minus = M_list.count(S)
	if answer < (plus - minus):
		answer = (plus - minus)

print(answer)

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

N_list = []
M_list = []
answer = -100

for i in range(N):
	s = input()
	N_list.append(s)

N = int(input())

for i in range(M):
	t = input()
	M_list.append(s)

for i in range(N):
	S = N_list[i]
	plus  = N_list.count(S)
	minus = M_list.count(S)
	if answer < (plus - minus):
		answer = (plus - minus)

print(answer)
Problem p03059 (python)

Fixed submission:
import math
A,B,T = map(int,input().split())

def main(A,B,T):
    sum = B*(math.floor(T/A))
    print(sum)
    return 0

main(A,B,T)

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

def main(A,B,T):
    time = A
    sum = 0
    while time <= T+0.5:
        if time%A == 0:
            sum += B
            time += 1
    print(sum)
    return 0
Problem p02971 (python)

Fixed submission:
#Coding:Utf-8

N=int(input())
A=[int(input()) for i in range(N)]
B=sorted(A,reverse=True)

for l in range(N):
    if A[l]!=B[0]:
        print(B[0])
    else:
        print(B[1])

Buggy submission (verdict: Runtime Error):
#Coding:Utf-8
import sys
input=sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
ans=[0 for i in range(N)]

for i in range(N):
    ans[(A[i]-1)]=i+1

for l in range(N):
    print(ans[l],end=" ")

print("")
Problem p02972 (python)

Fixed submission:
#Coding:Utf-8

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

check=[0 for i in range(N)]
M=0
b=[]
for j in reversed(range(1,N+1)):
    total=0
    for k in range(1,int(N/j)+1):
        total+=check[int(j*k)-1]
    if a[j-1]!=total%2:
        M+=1
        check[j-1]=1
        b.append(j)

print(M)
for l in range(len(b)):
    print(b[l],end=' ')
else:
    print()

Buggy submission (verdict: Runtime Error):
#Coding:Utf-8
N=int(input())
A=list(map(int,input().split()))
Box=[0 for i in range(N)]
BoxNum=[]

for l in reversed(range(N)):
    Incount=0
    for m in range(1,int(N/(l+1))):
        Incount+=Box[A[l]*m]
    if Incount%2!=A[l]:
        Box[A[l]]+=1
        BoxNum.append(l+1)

print(len(BoxNum))
if len(BoxNum)!=0:
    print(" ".join(map(str,BoxNum)))
Problem p03062 (python)

Fixed submission:
#Conding: Utf-8

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

count=num=total=0
b=[]

for i in a:
    if i<0:
        count+=1
    elif i==0:
        num+=1

if count%2==0 or num>0:
    for j in a:
        total=total+abs(j)
    print(total)
else:
    for k in a:
        total=total+abs(k)
    for l in a:
        b.append(abs(l))

    print(total-2*min(b))

Buggy submission (verdict: Runtime Error):
# Coding: Utf-8

N=in(input())
a=list(map(int, input().split()))
count=0
zero=0
total=0

for i in range(N):
  if a[i]<0:
    count+=count
    total=toal+abs(a[1])
  if a[1]<0:
    zero+=zero
    
if count%2==0 or zero>0:
  print(total)
else:
  print(total-np.abs(a))
Problem p02837 (python)

Fixed submission:
import itertools

n = int(input())
array = []
for i in range(n):
    t = int(input())
    array.append([])
    for j in range(t):
        tmp = list(map(int, input().split(" ")))
        array[i].append(tmp)

allcombs = list(itertools.product([0, 1], repeat=n))
max_val = 0
for comb in allcombs:

    if sum(comb) <= max_val:
        continue

    tmp = []
    for i, j in enumerate(comb):
        if j == 1:
            tmp += array[i]
            
    if all([comb[t[0]-1]==t[1] for t in tmp]):
        max_val = max(max_val, sum(comb))

print(max_val)

Buggy submission (verdict: Runtime Error):
import itertools

n = input()
array = []
for i in range(n):
  t = input()
  array.append(set())
  for j in range(t):
    tmp = list(map(int, input().split(" ")))
    if tmp[1] == 1:
      array[i].add(tmp[0])
      
allcombs = list(itertools.product([0, 1], repeat=n))
max_val = 0
for comb in allcombs:
  
  if sum(comb) <= max_val:
    continue
  
  for i, j in enumerate(comb):
    broke = False
    if j == 1:
      for k in array[i]:
        if comb[k] == 0:
          broke = True
          break
    if broke:
      break
  if not broke:
    max_val = max(max_val, sum(comb))
   
        
        
print(max_val)
Problem p02885 (python)

Fixed submission:
a,b = map(int,input().split())
print(max(0,(a-2*b)))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(max(0,(a-2b)))
Problem p02921 (python)

Fixed submission:
a = input()
b = input()
c = 0
for i in range(3):
  if a[i] == b[i]:
    c += 1
print(c)

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
ans=0
for i in range(3):
	if S[i] == T[i]:
  	ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
ans=0
for i in range(3):
	if S[i] == T[i]:
  	ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
ans=0
for i in range(3):
	if S[i] == T[i]:
  	ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
ans=0
for i in range(3)
	if S[i] == T[i]
  	ans += 1
    print(ans)
Problem p02945 (python)

Fixed submission:
a,b=map(int,input().split())
print(max(a+b,a-b,a*b))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=a+b
d=a-b
e=a*b
print(max(c,d,e)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(a+b,a-b,a*b)
Problem p03407 (python)

Fixed submission:
a,b,c=map(int,input().split())
print("Yes" if a+b >= c else "No")

Buggy submission (verdict: Runtime Error):
a,b,c=int(input())
print("Yes" if (a+b) > c "No" else)
Problem p03447 (python)

Fixed submission:
x,a,b=[int(input()) for _ in range(3)]
print((x-a)%b)

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
print((x-a)%b)
Problem p03469 (python)

Fixed submission:
s=input()
print("2018"+s[4:])

Buggy submission (verdict: Runtime Error):
S=int(input())
print(2018+S[4::])
Problem p03597 (python)

Fixed submission:
N=int(input())
A=int(input())
print((N*N)-A)

Buggy submission (verdict: Runtime Error):
N,A=map(int,input().split())
print((N*N)-A)
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=list(map(int,input().split()))
A.sort()
if A =[5,5,7]:
       print("YES")
else:
       print("NO")

Buggy submission (verdict: Runtime Error):
A=list(map(int,input().split())
A.sort()
if A =[5,5,7]:
       print("YES")
else:
       print("NO")