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

Fixed submission:
import sys
sys.setrecursionlimit(500000)
K = int(input())

ans_list = []

def dfs(l):
    if len(l)==1 and l[0]!="0":
        ans_list.append(int("".join(l)))
    if l!=[] and l[0]=="0":
        return
    if l!=[] and int("".join(l))>3234566667:
        return
    for i in ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]:
        l.append(i)
        #ここで絶対値1以下になるものだけdfs
        if len(l)==1:
            dfs(l)
            l.pop()
        elif abs(int(l[len(l)-2])-int(l[len(l)-1]))<=1:
            dfs(l)
            ans_list.append(int("".join(l)))
            l.pop()
        else:
            l.pop()

    return

dfs([])
ans_list.sort()
print(ans_list[K-1])

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(500000)
K = int(input())

ans_list = []
def dfs(A):
    if len(A)!=0 and int("".join(A))<=10**6:
        ans_list.append(int("".join(A)))
    elif len(A)!=0 and int("".join(A))>10**6:
        return
    if len(A)==0:
        for i in range(1, 10, 1):
            A.append(str(i))
            dfs(A)
            A.pop()
        return

    for i in range(0, 10, 1):
        if abs(int(A[-1])-i)<=1:
            A.append(str(i))
            dfs(A)
            A.pop()
    return
dfs([])
ans_list.sort()
print(ans_list[K-1])

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(500000)
K = int(input())

ans_list = []
def dfs(A):
    if len(A)!=0 and int("".join(A))<=10**5:
        ans_list.append(int("".join(A)))
    elif len(A)!=0 and int("".join(A))>10**5:
        return
    if len(A)==0:
        for i in range(1, 10, 1):
            A.append(str(i))
            dfs(A)
            A.pop()
        return

    for i in range(0, 10, 1):
        if abs(int(A[-1])-i)<=1:
            A.append(str(i))
            dfs(A)
            A.pop()
    return
dfs([])
ans_list.sort()
print(ans_list[K-1])

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

ans_list = []
def dfs(A):
    if len(A)!=0 and int("".join(A))<=10**5:
        ans_list.append(int("".join(A)))
    elif len(A)!=0 and int("".join(A))>10**5:
        return
    if len(A)==0:
        for i in range(1, 10, 1):
            A.append(str(i))
            dfs(A)
            A.pop()
        return

    for i in range(0, 10, 1):
        if abs(int(A[-1])-i)<=1:
            A.append(str(i))
            dfs(A)
            A.pop()
    return
dfs([])
ans_list.sort()
print(ans_list[K-1])
Problem p02830 (python)

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

s=""
for i in range(N):
  s = s + S[i] + T[i]
  
print(s)

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

s=""
for i in range(N):
  s = s + S[i] + T[i]
  
print(s)
Problem p02861 (python)

Fixed submission:
N = int(input())
import math
import itertools

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

A = list(itertools.permutations(A))

sum = 0

for i in A:
    for j in range(N):
        if j+1==N:
            break
        sum = sum + (((i[j][0]-i[j+1][0])**2+(i[j][1]-i[j+1][1])**2)**0.5).real

print((sum/math.factorial(N)).real)

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

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

A = list(itertools.permutations(A))

sum = 0

for i in A:
    sum = sum + ((i[0][0]-i[1][0])**2+(i[0][1]-i[1][1]**2))**0.5+((i[1][0]-i[2][0])**2+(i[1][1]-i[2][1]**2))**0.5

print((sum/math.factorial(N)).real)
Problem p02887 (python)

Fixed submission:
N = int(input())
S = input()
count = 0
b = " "
for i in range(N):
	    
    if b != S[i]:
        count = count + 1
        b = S[i]

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = int(input())
count = 0
b = " "
for i in range(N):
	
	if b == S[i]:
		count = count + 1
        b = S[i]

print(count)
Problem p02923 (python)

Fixed submission:
N = int(input())
*H, = map(int, input().split())


count_max = 0
count_temp = 0
flg = 0
#全探索
for i in range(0, len(H)-1, 1):

    if H[i] < H[i+1]:
        if count_max < count_temp:
            count_max = count_temp
        count_temp = 0
        flg = 1
        continue

    count_temp = count_temp + 1

    if H[i+1]==H[len(H)-1]:
        if count_max < count_temp:
            count_max = count_temp
        flg = 1

if flg == 1:
    print(count_max)
else:
    print(0)

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

*H, = map(int, input().split())

max = 0
count = 0
def dfs(node):
    global max
    global count

    if (node+1)==N:
        if max<count:
            max = count
        return 
    if H[node]<H[node+1]:
        if max<count:
            max = count
        return 
    count = count + 1
    dfs(node+1)

for node in range(N):
    dfs(node)
    count = 0
print(max)
Problem p02924 (python)

Fixed submission:
N = int(input())

print((N*(N-1))//2)

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

N = int(input())

N_list = np.arange(1, N)

N_np   = np.sum(N_list)

print(N_np)

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

N = int(input())

N_list = np.arange(1, N)

N_np   = np.sum(N_list)

print(int(N_np))
Problem p02946 (python)

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

K = S[0]
X = S[1]


A = X-K+1
B = X+K

for i in range(A, B, 1):
  print(i, end="")
  print(" ", end="")

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

K = S[0]
X = S[1]


A = abs(X-K)+1
B = X+K

if i in range(A, B, 1):
  print(i, end="")
Problem p02947 (python)

Fixed submission:
N = int(input())

lst = []

for i in range(N):
    lst.append("".join(sorted(list(input()))))


d={}
count = 0

for i in lst:
  if not i in d:
    d[i] = 1
    continue
  else:
    d[i] = d[i] + 1
    count = count + d[i]-1


print(count)

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

list = []

for i in range(N):
  list.append(list(input().sort()))
  
dct = {}
count = 0
for i in list:
  if i in dct:
    dct[i] = 1
    count = count + 1
    continue
  else:
    dct[i] = dct + 1
    count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst = []
count = 0
st = []

for i in range(N):
  if i==0:
    in_pu = input()
    l = list(in_pu)
    lst.append(in_pu)
    st.append(set(l))
    continue
    
  in_pu = input()
  l = list(in_pu)
  lst.append(list(in_pu))
  
  if set(l) in st:
    count = count + 1 
print(count+len(list(set(lst))))

Buggy submission (verdict: Runtime Error):
N = int(input())
lst = []
count = 0
st = []

for i in range(N):
  if i==0:
  	in_pu = input()
  	l = list(in_pu)
  	lst.append(list(input()))
    st.append(set(l))
    continue
    
  in_pu = input()
  l = list(in_pu)
  lst.append(list(input()))
  
  if set(l) in st:
    count = count + 1
print(count)
Problem p02953 (python)

Fixed submission:

N = int(input())

H = list(map(int, input().split()))

if len(H) != 1:
    for i in range(0, N-1, 1):
        if H[i] > H[i+1]:
            H[i+1]=H[i+1]+1

    check_list = sorted(H)

    if check_list==H:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):

N = int(input())

H = list(map(int, input().split()))


for i in range(0, len(H), 1):
    if H[i] > H[i+1]:
        H[i]=H[i]-1

check_list = sorted(H)

if check_list==H:
    print("Yes")
else:
    print("No")
Problem p02957 (python)

Fixed submission:
S = input()

S = list(map(int, S.split()))

A = S[0]
B = S[1]

f = (A+B) / 2

if f.is_integer():
    print(int(f))
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
S = input()

S = list(map(int, S.split()))

A = S[0]
B = S[1]

f = (A+B) / 2

if f.is_integer():
    print(int(f))
else:
    print(IMPOSSIBLE)
Problem p02981 (python)

Fixed submission:
S = input()

S = S.split()

N = int(S[0])
A = int(S[1])
B = int(S[2])


train_cost = N*A
taxi_cost  = B

if train_cost >= taxi_cost:
    print(taxi_cost)
else:
    print(train_cost)

Buggy submission (verdict: Runtime Error):
in = input()

in = in.split()

N = in[0]
A = in[1]
B = in[2]


train_cost = N*A
taxi_cost  = B

if N*A > B:
    print(B)
elif:
    print(N*A)
Problem p02982 (python)

Fixed submission:
import numpy as np

S      = input()
S      = S.split()
N      = int(S[0])
D      = int(S[1])
matrix = np.zeros([N, D])
count  = 0


for i in range(0, N, 1):
    X_vector = input()
    X_vector = X_vector.split()
    for j in range(0, D, 1):
        matrix[i][j] = int(X_vector[j])

for i in range(0, N, 1):
    a_vector = matrix[i]
    for j in range(i+1, N, 1):
        b_vector = matrix[j]
        length = np.linalg.norm(b_vector-a_vector)
        if length.is_integer():
            count = count + 1
print(count)

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

S      = input()
S      = S.split()
N      = int(S[0])
D      = int(S[1])
matrix = np.zeros([N, D])
count  = 0


for i in range(0, N, 1):
    X_vector = input()
    X_vector = X_vector.split()
    for j in range(0, D, 1):
        matrix[i][j] = int(X_vector[j])

for i in range(0, N, 1):
    a_vector = matrix[i]
    for j in range(i+1, N, 1):
        b_vector = matrix[j]
        length = np.linalg.norm(b_vector-a_vector)
        if length.is_integer()):
            count = count + 1
print(count)

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

S      = input()
S      = S.split()
N      = int(S[0])
D      = int(S[1])
matrix = np.zeros([N, D])
count  = 0


for i in range(0, N, 1):
    X_vector = input()
    X_vector = X_vector.split()
    for j in range(0, D, 1):
        matrix[i][j] = int(X_vector[j])

for i in range(0, N, 1):
    a_vector = matrix[i]
    for j in range(i+1, N, 1):
        b_vector = matrix[j]
        length = np.linalg.norm(b_vector-a_vector)
        if isinstance(length, int):
            count++
print(count)

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

S      = input()
S      = S.split()
N      = int(S[0])
D      = int(S[1])
matrix = np.zeros([N, D])
count  = 0


for i in range(0, N, 1):
    X_vector = input()
    X_vector = X_vector.split()
    for j in range(0, D, 1):
        matrix[i][j] = int(X_vector[j])

for i in range(0, N, 1):
    a_vector = matrix[i]
    for j in range(i+1, N, 1):
        b_vector = matrix[j]
        length = np.linalg.norm(b_vector-a_vector)
        if float(length) / float(length) == 0.0:
            count++

print(count)

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

S      = input()
S      = S.split()
N      = int(S[0])
D      = int(S[1])
matrix = np.zeros([N, D])
count  = 0


for i in range(0, N, 1):
    X_vector = input()
    for j in range(0, D, 1):
        matrix[i][j] = int(X_vector[j])

for i in range(0, N, 1):
    a_vector = matrix[i]
    for j in range(i+1, N, 1):
        b_vector = matrix[j]
        length = np.linalg.norm(b_vector-a_vector)
        if float(length) / float(length) == 0.0:
            count++

print(count)
Problem p02983 (python)

Fixed submission:

S = input()

S = S.split()

L = int(S[0])
R = int(S[1])
min = 2 * (10**10)

flg = 0

for i in range(L, R, 1):
    if flg ==0:
        for j in range(i+1, R+1, 1):
            mod = (i*j) % 2019
            if mod < min:
                min = mod
                if min == 0:
                    flg = 1
                    break
    else:
        break

print(min)

Buggy submission (verdict: Runtime Error):
from goto import goto, label

S = input()

S = S.split()

L = int(S[0])
R = int(S[1])
min = 2 * (10**10)

flg = 0

for i in range(L, R, 1):
    for j in range(i+1, R+1, 1):
        mod = (i*j) % 2019
        if mod < min:
            min = mod

print(min)

Buggy submission (verdict: Runtime Error):
from goto import goto, label

S = input()

S = S.split()

L = int(S[0])
R = int(S[1])
min = 2 * (10**10)

flg = 0

for i in range(L, R, 1):
    if flg == 0:
        for j in range(i+1, R+1, 1):
            mod = (i*j) % 2019
            if mod < min:
                min = mod
                if min == 0:
                    flg = 1
                    break
    elif:
        break
print(min)

Buggy submission (verdict: Runtime Error):
from goto import goto, label

S = input()

S = S.split()

L = int(S[0])
R = int(S[1])
min = 2 * (10**10)

flg = 0

for i in range(L, R, 1):
    if flg == 0:
        for j in range(i+1, R+1, 1):
            mod = (i*j) % 2019
            if mod < min:
                min = mod
                if min == 0:
                    flg = 1
                    break
    elif:
        break
print(min)

Buggy submission (verdict: Runtime Error):
from goto import goto, label

S = input()

S = S.split()

L = int(S[0])
R = int(S[1])
min = 2 * (10**10)

for i in range(L, R, 1):
    for j in range(i+1, R+1, 1):
        mod = (i*j) % 2019
        if mod < min:
            min = mod
            if min == 0:
                goto .END
label .END
print(min)
Problem p02993 (python)

Fixed submission:
S = input()

flg = 0
temp = 0

for i in range(len(S)-1):
    if S[i] == S[i+1]:
        print("Bad")
        flg = 1
        break

if flg == 0:
    print("Good")

Buggy submission (verdict: Runtime Error):
S = input()

S = list(map(S.split()))

flg = 0
temp = 0

for i in range(len(S)-1):
    if S[i] == S[i+1]:
        print(Bad)
        flg = 1
        break

if flg == 0:
    print(Good)
Problem p02995 (python)

Fixed submission:
import fractions

A,B,C,D = map(int, input().split())

E = (C*D)//fractions.gcd(C,D)

B_count = B-((B//C)+(B//D)-(B//E))
A_count = (A-1)-(((A-1)//C)+((A-1)//D)-((A-1)//E))

print(B_count-A_count)

Buggy submission (verdict: Runtime Error):
import math

A,B,C,D = map(int, input().split())

E = (C*D)//math.gcd(C,D)

B_count = B-((B//C)+(B//D)-(B//E))
A_count = (A-1)-(((A-1)//C)+((A-1)//D)-((A-1)//E))

print(B_count-A_count)
Problem p03005 (python)

Fixed submission:

S = list(map(int, input().split()))

N = S[0]
K = S[1]


if N % K == 0:
    print(0)
else:
    print(N-K)

Buggy submission (verdict: Runtime Error):
S = input()

S = list(map(int, input().split()))

N = S[0]
K = S[1]


if N % K == 0:
    print(0)
else:
    print(N-K)
Problem p03068 (python)

Fixed submission:
N = int(input())
S = list(input())
K = int(input())

for i in range(N):
  if S[i] != S[K-1]:
    S[i] = "*"
    
print(*S, sep="")

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

for i in range(N):
  if S[i] != S[K]:
    S[i] = "*"
    
print(*S, sep="")

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

for i in range(N):
  if S[i] != S[K]:
    S[i] = *
    
print(S)
Problem p03087 (python)

Fixed submission:
N,Q = map(int, input().split())
S = input()
Query = []
for _ in range(Q):
    l,r = map(int, input().split())
    Query.append([l,r])

A = [0]*N

for i in range(N-2+1):
    if S[i]=="A" and S[i+1]=="C":
        A[i] = 1
s = [0]*(N+1)
for i in range(0,N,1):
    s[i+1] = A[i] + s[i]

for i in range(Q):
    l,r = Query[i]
    print(s[r-1]-s[l-1])

Buggy submission (verdict: Runtime Error):
N,Q = map(int, input().split())
S = input()
Query = []
for _ in range(Q):
    l,r = map(int, input().split())
    Query.append([l,r])

A = [0]*8

for i in range(N-2+1):
    if S[i]=="A" and S[i+1]=="C":
        A[i] = 1
s = [0]*(N+1)
for i in range(0,N,1):
    s[i+1] = A[i] + s[i]

for i in range(Q):
    l,r = Query[i]
    print(s[r-1]-s[l-1])
Problem p03105 (python)

Fixed submission:
S = input()
 
S = list(map(int, S.split()))
 
A = S[0]
B = S[1]
C = S[2]
 
D = int(B/A)
        
if D > C:
  print(C)
else:
  print(D)

Buggy submission (verdict: Runtime Error):
S = input()

S = list(map(int, S.split()))

A = S[0]
B = S[1]
C = S[2]

D = int(A/B)
        
if D > C:
  print(C)
else D < C:
  print(D)
Problem p03106 (python)

Fixed submission:
S = input()

S = S.split()

S = list(map(int, S))

A = S[0]
B = S[1]
K = S[2]

list = []

if A >= B:
  C = B
else:
  C = A

for i in range(1, C+1, 1):
  if ((A % i)==0) and ((B % i) == 0):
    list.append(i)

print(list[len(list)-K])

Buggy submission (verdict: Runtime Error):
S = input()

S = S.split()

S = list(map(int, S))

A = S[0]
B = S[1]
K = S[2]

list = []

if A > B:
  C = A
else:
  C = B

for i in range(1, C, 1):
  if (A % i==0) and (B % i == 0):
    list.append(i)

print(list[K])

Buggy submission (verdict: Runtime Error):
S = input()

S = S.split()

S = list(map(int, S))

A = S[0]
B = S[1]
K = S[2]

list = []

if A > B:
  C = A
else:
  C = B

for i range(C):
  if (A % i==0) and (B % i == 0):
    list.append(i)

print(list[K])
Problem p03110 (python)

Fixed submission:
N = int(input())

sum = 0.0

for i in range(N):
    S = input()
    S = S.split()

    x = float(S[0])
    u = S[1]

    if u == "JPY":
        sum = sum + x
    else:
        sum = sum + x * 380000

print(sum)

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

sum = 0.0

for i in range(N):
    x = float(input())
    u = input()

    if u == "JPY":
        sum = sum + x
    else:
        sum = sum + x * 380000

print(sum)
Problem p03126 (python)

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

ans = [0]*M

for i in range(N):
    K, *A = map(int, input().split())
    for j in range(K):
        ans[A[j]-1] = ans[A[j]-1] + 1

count = 0

for i in range(M):
    if ans[i]==N:
        count = count + 1

print(count)

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

ans = [0]*M

for i in range(N):
    K, *A = map(int, input().split())
    for j in range(K):
        ans[A[j]] = ans[A[j]] + 1

count = 0

for i in range(M):
    if ans[i]==N:
        count = count + 1

print(count)
Problem p03160 (python)

Fixed submission:
N = int(input())
*h, = map(int, input().split())

dp = [0] * N

for i in range(1, N, 1):
        if i==1:
                dp[i]=abs(h[i]-h[i-1])
        else:
                dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))

print(dp[N-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
*H, = map(int, input().split())
dp  = [-1]*N

def dfs(n):#足場nまでにたどり着くための最小コスト
    
    if n==0:
        return 0
    if n-1==0:
        return abs(H[n]-H[n-1])
    if dp[n]!=-1:
        return dp[n]
    ans = min(abs(H[n]-H[n-1])+dfs(n-1), abs(H[n]-H[n-2])+dfs(n-2))
    dp[n] = ans
    return ans

print(dfs(N-1))

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

dp = [-1]*N

#動的計画法
#メモ化再帰
def dfs(n):#足場nまでにたどり着くのに必要なコスト
    if dp[n]!=-1:
        return dp[n]

    if n==0:
        return 0
    if n-1==0:
        return abs(H[n]-H[n-1])

    ret = min(abs(H[n]-H[n-1])+dfs(n-1), abs(H[n]-H[n-2])+dfs(n-2))
    dp[n] = ret
    return ret

print(dfs(N-1))

Buggy submission (verdict: Runtime Error):
#深さ優先探索
N = int(input())
*H, = map(int, input().split())

def dfs(n):#nまでにたどり着くにに必要なコスト
    if n==0:
        return 0
    if n-1==0:
        return abs(H[n]-H[n-1])
    ret = min(abs(H[n]-H[n-1])+dfs(n-1), abs(H[n]-H[n-2])+dfs(n-2))
    return ret

print(dfs(N-1))

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

dp = [0]*N

for i in range(1, N, 1):
  if i==1:
    dp[i] = abs(H[i-1]-H[i])
      cost1 = dp[i-1]+abs(H[i-1]-H[i])
      cost2 = dp[i-2]+abs(H[i-2]-H[i])
      dp[i] = min(dp[i-1], dp[i-2])

   
print(dp[N-1])
Problem p03262 (python)

Fixed submission:
import fractions

def gcd_list(a):
    ans = a[0]
    for i in range(1, N):
        ans = fractions.gcd(ans, a[i])
    return ans

N,X = map(int, input().split())
*x, = map(int, input().split())

dl = []
for i in range(N):
    dl.append(abs(x[i]-X))

print(gcd_list(dl))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

N,X = map(int, input().split())
*x, = map(int, input().split())

dl = []
for i in range(N):
    dl.append(abs(x[i]-X))

print(gcd_list(dl))
Problem p03292 (python)

Fixed submission:
import itertools

*A,  = map(int, input().split())

L = itertools.permutations(A)

min = float('inf')

for l in L:
    temp = abs(l[1]-l[0])+abs(l[2]-l[1])
    if min > temp:
        min = temp
print(min)

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

min = float('inf')

for i in range(3):
	for j in range(3):
		if i==j:
          break
        min = min(abs(A[i]-A[j]), min)

print(min)
Problem p03353 (python)

Fixed submission:
S = input()
K = int(input())

ans = []
table ={}

for i in range(len(S)):
    for j in range(6):
        if i==j:
            s = S[i]
            if s in table:
                continue
            table[s] = 1
            ans.append(s)
            continue
        if S[i:i+j]=="":
            continue
        s = S[i:i+j]
        if s in table:
            continue
        table[s] = 1
        ans.append(s)

ans = sorted(ans)
print(ans[K-1])

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())

ans = set()

for i in range(len(S)):
    for j in range(len(S)+1):
        if (j-i)>=5:
            break
        if i==j:
            ans.add(S[i])
            continue
        if S[i:j]=="":
            continue
        ans.add(S[i:j])
ans = sorted(list(ans))
print(ans[K-1])
Problem p03474 (python)

Fixed submission:
import sys

A,B = map(int, input().split())
S = input()

str_len = len(S)

for i in range(str_len):

    a = S[i]
    if i==A:
        if a=="-":
            continue
        else:
            print("No")
            sys.exit()
    if str.isdecimal(a)==False:
        print("No")
        sys.exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys

A,B = map(int, input().split())
S = input()

str_len = len(S)

for i in range(str_len):

    a = S[i]
    if i==A:
        if a=="-"
            break
        else:
            print("No")
            sys.exit()
    if str.isdecimal(a)==False:
        print("No")
        sys.exit()
print("Yes")
Problem p03543 (python)

Fixed submission:
l = input()

print("Yes" if l[0]==l[1]==l[2] or l[1]==l[2]==l[3] else "No")

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

print("Yes" if a=b=c or b=c=d else "No")
Problem p03545 (python)

Fixed submission:
import sys

E = list(input())

A,B,C,D = map(int, E)

sum = 0
for i in range(2**3):

    op_list = ['-', '-', '-']
    sum1 = 0
    for j in range(len(E)):
        if (i>>j) & 1:
            op_list[j]  = '+'
    sum = eval(E[0]+op_list[0]+E[1]+op_list[1]+E[2]+op_list[2]+E[3])

    if sum==7:
        print(A,op_list[0],B,op_list[1],C,op_list[2],D,"=7", sep="")
        sys.exit()

Buggy submission (verdict: Runtime Error):
S = input()
A = S[0]
B = S[1]
C = S[2]
D = S[3]


for i in range(2**(len(S)-1)):
    op_list = ['+']*(len(S)-1)
    for j in range(len(S)-1):

        if (i>>j)&1:
            op_list[j]='-'
    s = ""
    for j in range(len(S)-1):
        s = s + S[j] + op_list[j]

    s = s + S[len(S)-1]

    if 7==eval(s):
        print(s,"=7", sep="")
        sys.exit()
Problem p03548 (python)

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


print((X-Z)//(Z+Y))

Buggy submission (verdict: Runtime Error):
X, Y, Z = int(input().split())

print((X-1)//(Y+Z))

Buggy submission (verdict: Runtime Error):
X, Y, Z = int(input().split())

print((x-1)//(Y+Z))