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

Fixed submission:
n,k = map(int, input().split())
 
str = input()
happy = 0
unhappy = 0
 
for i in range(n-1):
  if(str[i] == str[i+1]):
    happy += 1
  else:
    unhappy += 1
print( min(n-1,(happy + 2 * k )))

# 10 1
# LLLLLRRRRRの時、happy + 2 * kだけやったら10になるけど、幸福になる人数は最高でも9人(n-1人)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
 
str = input()
happy = 0
unhappy = 0
 
for i in range(n-1):
  if(str[i] == str[i+1]):
    happy += 1
  else:
    unhappy += 1
if(str[0] != str[1] and str[n-1] != str[n-2] and k >= 2):
  print(happy + 2 * k - 2)
elif(str[n-1] != str[n-2] or str[0] != str[1]):
  print(happy + 2 * k - 1)
else:
  print(happy + 2 * k )

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
 
str = input()
print(str[0])
happy = 0
unhappy = 0
hashi = 0
 
for i in range(n-1):
  if(str[i] == str[i+1]):
    happy += 1
  else:
    unhappy += 1
if(str[0] != str[1] and str[n-1] != str[n-2]):
  hashi = 2
if(str[n-1] != str[n-2] or str[0] != str[1]):
  hashi = 1
if(k >= 2):
  print(happy + 2 * k - hashi)
if(k == 1):
  print(happy + 2 * k - hashi * k)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
 
str = input()
print(str[0])
happy = 0
unhappy = 0
hashi = 0
 
for i in range(n-1):
  if(str[i] == str[i+1]):
    happy += 1
  else:
    unhappy += 1
if(str[0] != str[1]):
  hashi += 1
if(str[n-1] != str[n-2]):
  hashi += 1
if(k == 1):
  hashi = 1
print(happy + 2 * k - hashi)

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

str = input().split()

happy = 0
unhappy = 0

for i in range(n):
  if(str[i] == str[i+1]):
    happy += 1
  else:
    unhappy += 1
    
print(happy + 2 * k)
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
l = [0,0,0]
for i in range(n-1):
  if h[i] >= h[i + 1]:
    l.insert(i, 1)
  else:
    l.insert(i,0)

con = 0
max = 0
for i in range(n + 1):
  if l[i] == 1:
    con = con + 1
  else:
    if con > max:
      max = con
    con = 0
print(max)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
l = [0,0,0]


for i in range(n-1):
  if h[i] >= h[i + 1]:
    l.insert(i, 1)
 
con = 0
max = 0
for i in range(n + 1):
  if l[i] == 1:
    con += 1
  else:
    if con > max:
      max = con
      con = 0
print(max)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = map(int, input().split())
l = [0,0,0]

for i in range(n):
  if h[i] > h[i + 1]:
    l.insert(i, 1)

con = 0
max = 0
for i in range(n + 1):
  if l[i] == 1:
    con += 1
  else:
    if con > max:
      max = con
      con = 0
print(max)
Problem p02981 (python)

Fixed submission:
str = input().split()
n = int(str[0])
a = int(str[1])
b = int(str[2])

if n * a < b:
  print(n * a)
else :
  print(b)

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

if n * a < b:
  print(n * a)
else:
  print(b)
Problem p03086 (python)

Fixed submission:
str = list(input())
n = len(str)
max = 0
counter = [0,0,0]
for i in range(n):
  if 'A' in str[i] or 'T'in str[i] or 'C' in str[i]or 'G'in str[i]:
    counter.insert(i, counter[i] + 1)
  else:
    counter.append(0)
  

con = 0;    
for i in range(n+1):
  if counter[i] == 1:
    con += 1
    continue
  else :
    if con > max :
      max = con
      con = 0
    
print(max)

Buggy submission (verdict: Runtime Error):
str = input()
n = lent(str)
counter = []
max = 0
for i in range(n):
  counter[i] = 0

for i in range(n):
  if str[i] == "A" or "T" or "C" or "G":
    counter[i] ++
  
  
for i in range(n):
  if counter[i] > max:
    max = counter[i]
    
print(max)
Problem p03105 (python)

Fixed submission:
str = input().split()
a = int(str[0])
b = int(str[1])
c = int(str[2])
 
if b // a > c:
	print(c)
else:
	print(b // a)

Buggy submission (verdict: Runtime Error):
str = int(input()).split()
a = str[0]
b = str[1]
c = str[2]

if b / a > c:
	print(c)

else:
	print(int(b / a))
Problem p03106 (python)

Fixed submission:
a = []
A,B,K  = map(int, input().split())
min = 0
 
if A > B:
	min = B
else:
  min = A
for i in range(1, min + 1):
  if(A % i == 0 and B % i == 0):
    a.append(i)
    
print(a[len(a) - K])

#no 1 is a(len-1)
# no k is a(lent-K)

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

if A > B:
	min = B
else:
  min = A

for i in B:
  if(A % i == 0 && B % i == 0):
    a.append(i)

print(a.get(K-1))
Problem p03110 (python)

Fixed submission:
def exchange(btc):
  return 380000.0 * btc
 
n = int(input())
sum = 0.0
for i in range(n):
  a, b = input().split()
  if "JPY" in b:
    sum += float(a)
  else:
    sum += exchange(float(a))
 
print(sum)

Buggy submission (verdict: Runtime Error):
def exchange(btc):
  return 380000.0 / btc

n = int(input())
sum = 0.0
for i in range(n):
  a, b = input().split()
  if "JPY" in b:
    sum += float(a)
  else:
    sum += exchange(int(a))

print(sum)
Problem p03126 (python)

Fixed submission:
n,m = map(int, input().split()) #n person, m pieces
 
counter = []
ans = 0
for i in range(m):
  counter.append(0)
 
for i in range(n):
  ls = list(map(int, input().split()))
  kazu = ls[0]
  for i in range(1, kazu+1):
    num = counter[ls[i] - 1]
    counter[ls[i]-1] = num + 1
for i in range(m):
  if counter[i] == n:
    ans += 1
print(ans)

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

counter = []
ans = 0
for i in range(m):
  counter.apeend(0)

for i in range(n):
  ls = [map(int, input().split())]
  for i in range(1, ls[0]+1):
    num = counter[ls[i] - 1]
    counter.insert(ls[i]-1, num + 1)
for i in range(m):
  if counter[i] == n:
    ans += 1
print(ans)
Problem p02630 (python)

Fixed submission:
n=int(input())
arr=list(map(int,input().strip().split()))
k=int(input())
d=dict()
for i in range(10**5+1):
    d[i]=0
for i in range(n):
    d[arr[i]]=d[arr[i]]+1
sumi=0
for i in range(n):
    sumi=sumi+arr[i]
for i in range(k):
    a,b=[int(a) for a in input().split()]
    e1=d[a]
    d[b]=d[b]+e1
    sumi=sumi+(e1)*(b-a)
    print(sumi)
    d[a]=0

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=list(map(int,input().strip().split()))
k=int(input())
d=dict()
for i in range(n):
    d[arr[i]]=0
for i in range(n):
    d[arr[i]]=d[arr[i]]+1
sumi=0
for i in range(n):
    sumi=sumi+arr[i]
for i in range(k):
    a,b=[int(a) for a in input().split()]
    e1=d[a]*a
    e2=d[b]*b
    sumi=sumi+e2-e1
    print(sumi)
    d[b]=d[b]+d[a]
    d[a]=0
Problem p02640 (python)

Fixed submission:
n,m=[int(n) for n in input().split()]
if(m>(n*4) or m<(n*2)):
  print("No")
else:
  if(m%2==0):
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,m=[int(n) for n in input().split()]
if(m>(n*4) or m<(n*2)):
  print("No")
else:
  if(m%2==0):
    print("Yes"):
  else:
    print("No")
Problem p02641 (python)

Fixed submission:
x, n = (int(x) for x in input().split())
p_list = list(map(int, input().split()))
 
ans = 0
 
max_ = 0
min_ = 0

for i in range(x, 102, 1) :
 
    if i not in p_list:
        max_ = i
        break
for j in reversed(range(x + 1)) :

 
    if j not in p_list:
        min_ = j
        break
 
if abs (min_ - x) <= abs(max_ - x) :
    ans = min_
else : 
    ans = max_
 
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=[int(n) for n in input().split()]
arr=list(map(int,input().strip().split()))
if(m==0):
    print(n)
else:
    j=n
    while(j>=1):
        flag=0
        for i in range(m):
            if(arr[i]==j):
                flag=1
        if(flag==1):
            j=j-1
        else:
            s1=j
            break
    j=n
    while(j<101):
        flag=0
        for i in range(m):
            if(arr[i]==j):
                flag=1
        if(flag==1):
            j=j+1
        else:
            s2=j
            break
    a=abs(n-s1)
    b=abs(n-s2)
    if(a<=b):
        print(s1)
    else:
        print(s2)
Problem p03730 (python)

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

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

for i in range(1, B + 1):
    if (A * i) % B == C:
        print('YES')
        exit()

print('NO')

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

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

for i in range(1, B + 1)
    if (A * i) % B == C:
        print('YES')
        exit()
        
print('NO')
Problem p02727 (python)

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

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

shoku=[]

for i in range(X):
    shoku.append(p[i])

for j in range(Y):
    shoku.append(q[j])

shoku.sort()

r_num=0
for k in range(len(shoku)):
    if r_num == C:
        break

    if shoku[k] < r[r_num]:
        shoku[k] = r[r_num]
        r_num+=1

print(sum(shoku))

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

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

shoku=[]

for i in range(X):
    shoku.append(p[i])

for j in range(Y):
    shoku.append(q[j])

shoku.sort()

r_num=0
for k in range(C):
    if r_num == C:
        break

    if shoku[k] < r[r_num]:
        shoku[k] = r[r_num]
        r_num+=1

print(sum(shoku))
Problem p02767 (python)

Fixed submission:
N = int(input())
X = list(map(int,input().split()))
 
ans=10**10
for i in range(0,101):
  tmp=0
  for x in X:
    tmp += (i - x)**2
  
  if ans>=tmp:
    ans=tmp
 
print(ans)

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

ans=10**10
for i in range(N):
  for x in X:
    tmp += (i - x)**2
  
  if ans>=tmp:
    ans=tmp

print(ans)
Problem p02802 (python)

Fixed submission:
import sys

def main():
    N, M = list(map(int,input().split()))
    p_S = [None] * M

    wa_cnt = [0] * N
    ac_flags = [0] * N

    for i in range(M):
        p_S[i] = list(input().split())
        p_S[i][0] = int(p_S[i][0])

    wa_ans, ac_ans = 0, 0

    for j in p_S:
        if j[1] == 'WA':
            wa_cnt[j[0] - 1] += 1

        if j[1] == 'AC' and ac_flags[j[0] - 1] == 0:
            wa_ans += wa_cnt[j[0] - 1]
            ac_ans += 1
            ac_flags[j[0] - 1] = 1


    print(ac_ans, wa_ans)

main()

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

def main():
    N, M = map(int, input().split())

    if M == 0:
        print('0 0')
        sys.exit()


    p_S = []
    for i in range(M):
        p_S.append(input().split())

    uniq_ps = np.unique(p_S, axis=0)
    


    ac = 0
    wa = 0
    for arr in uniq_ps:
        if arr[1] == 'AC':
            ac += 1
        else:
            wa += 1

    print(ac, wa)

main()
Problem p02837 (python)

Fixed submission:
import sys

def kensho(x,tlist):
    for lis in tlist:
        if((x>>(lis[1]-1)) & 1 == lis[2]):
            pass
        else:
            return -1

    return bin(x).count('1')


def main():
    N = int(input())
    xy=[]
    ans=0

    for i in range(1,N+1):
        An= int(input())
        for j in range(0,An):
            x, y = map(int, input().split())
            xy.append([i,x,y])

    cnt = N

    tlist=[]
    for x in range (2 ** cnt):
        for y in range(cnt):
            if((x>>y) & 1):
                for z in xy:
                    if(z[0]==y+1):
                        tlist.append(z)

        anstack = kensho(x,tlist)
        if(ans<anstack):
            ans=anstack

        del tlist[:]

    print(ans)

main()

Buggy submission (verdict: Runtime Error):
import sys


def kensho(x,tlist):
    for lis in tlist:
        if((x>>(lis[1]-1)) & 1 == lis[2]):
            pass
        else:
            return -1

    return bin(x).count('1')


def main():
    N = int(input())
    xy=[]
    ans=0

    for i in range(1,N+1):
        An= int(input())
        for j in range(0,An):
            x, y = map(int, input().split())
            xy.append([i,x,y])

    cnt = N

    tlist=[]
    for x in range (2 ** cnt):
        for y in range(cnt):
            if((x>>y) & 1):
                for z in xy:
                    if(z[0]==y+1):
                        tlist.append(z)

        anstack = kensho(x,tlist)
        if(ans<anstack):
            ans=anstack

        tlist.clear()

    print(ans)

main()
Problem p02842 (python)

Fixed submission:
import sys

def main():
    N=int(input())

    for x in range(50001):
        if(int(x*1.08)==N):
            print(x)
            sys.exit()

    print(":(")
main()

Buggy submission (verdict: Runtime Error):
import sys
import math

def main():
    N = int(input())
    N_x = 100*N
    for x in range(N_x-50, N_x+50):
        if(x%108==0):
            print(x//108)
			sys.exit()
    print(":(")

main()

Buggy submission (verdict: Runtime Error):
import sys
import math

def main():
    N = int(input())
    N_x = 100*N
    for x in range(N_x-50, N_x+50):
        if(x%108==0):
            print(x//108)
			sys.exit()
    print(":(")

main()
Problem p02909 (python)

Fixed submission:
S = str(input())
if(S=="Sunny"):
    print("Cloudy")
elif(S=="Cloudy"):
    print("Rainy")
elif(S=="Rainy"):
    print("Sunny")
else:
    exit()

Buggy submission (verdict: Runtime Error):
S = str(input())
if(S=="Sunny"):
    print("Cloudy")
else if(S=="Cloudy"):
    print("Rainy")
else if(S=="Rainy"):
    print("Sunny")
else:
    exit()
Problem p02922 (python)

Fixed submission:
import sys

A, B =map(int, input().split())
x = 0

if(B==1):
    print('0')
    sys.exit()

while True:
    if(A+(A-1)*x>=B):
        print(x+1)
        sys.exit()
    x+=1

Buggy submission (verdict: Runtime Error):
import sys

A, B =map(int, input().split())
count = 1

if(A>=B):
    print('1')
    sys.exit()

B-=A
while True:
    B-=(A-1)
    if(B<=0):
        print(count)
        sys.exit()
    count+=
Problem p02945 (python)

Fixed submission:
A, B = map(int, input().split())
x = A+B
y = A-B
z = A*B

if(x>=y>=z or x>=z>=y):
    print(x)
elif(y>=x>=z or y>=z>=x):
    print(y)
else:
    print(z)

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

if(x>y and x>z):
    print(x)

elif(y>x and y>z):
    print(y)

elif(z>x and z>y):
    print(z)

else:
    exit()
~
Problem p02993 (python)

Fixed submission:
S = list(map(str, input()))
 
if(S[0]==S[1] or S[1]==S[2] or S[2]==S[3]):
  print("Bad")
else:
  print("Good")

Buggy submission (verdict: Runtime Error):
S = list(map(str, input()))

if(S[0]==S[1] or S[1]==S[2] or S[2]==S[3]):
  print("Bad")
else:
  print(Good)
Problem p02995 (python)

Fixed submission:
import sys

def gcd(a, b):
    if a < b:
        a, b = b, a
    while b:
        a, b = b, a % b
    return a



def lcm(a, b):
    return a * b // (gcd(a, b))



def main():
    A, B, C, D = map(int, input().split())
    Aone = A - 1
    CDlcm = lcm(C, D)

    Bc = B // C
    Bd = B // D
    Blcm = B // CDlcm
    Bdec = B - Bc - Bd + Blcm

#    print(Bc,Bd,Blcm)

    Ac = Aone // C
    Ad = Aone // D
    Alcm = Aone // CDlcm
    Adec = Aone - Ac - Ad + Alcm

#    print(Ac,Ad,Alcm)

    print(Bdec - Adec)


main()

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

def main():
    A, B, C, D = list(map(int, input().split()))
    lcm = C * D / math.gcd(C, D)

    Ac = int(A/C)
    if A % C == 0:
        Ac-=1

    Bc = int(B/C)
    cnum = Bc - Ac

    Ad = int(A/D)
    if A % D == 0:
        Ad-=1

    Bd = int(B/D)
    dnum =Bd - Ad

    Alcm = int(A/lcm)
    if A % lcm == 0:
        Alcm-=1

    Blcm = int(B/lcm)
    lcmnum = Blcm - Alcm

    print(B - A + 1 - (cnum + dnum - lcmnum))

main()
Problem p03061 (python)

Fixed submission:
import sys
input = sys.stdin.readline
import fractions


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

    L_gcds = [0] * N
    L_gcd_tmp = L_gcds[0]
    for i in range(1, N):
        L_gcd_tmp = fractions.gcd(L_gcd_tmp, A[i-1])
        L_gcds[i] = L_gcd_tmp

    R_gcds = [0] * N
    R_gcd_tmp = R_gcds[0]
    for j in range(1, N):
        R_gcd_tmp = fractions.gcd(R_gcd_tmp, A[N-j])
        R_gcds[j] = R_gcd_tmp
    R_gcds.reverse()

    LR_gcds = [0] * N
    for k in range(0, N):
        LR_gcds[k] = fractions.gcd(L_gcds[k], R_gcds[k])

    print(max(LR_gcds))

main()

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

import numpy as np
import fractions
from functools import reduce

from copy import deepcopy


def gcd_list(nums):
    return reduce(fractions.gcd, nums)

def main():
    N = int(input())
    A = np.array(list(map(int, input().split())))

    bools = np.ones(N, dtype=bool)

    gcd_val = 0
    ans = 0
    for i in range(N):
        A_cop = deepcopy(A)
        bl_cop = deepcopy(bools)

        fal = [i]
        bl_cop[fal] = False

        gcd_val = gcd_list(A_cop[bl_cop])

        if ans == 0 or ans < gcd_val:
            ans = gcd_val

    print(ans)

main()
Problem p03160 (python)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
 
dp = [None]*n
 
for i in range(n):
  if i == 0:
    dp[0] = 0
    continue
    
  if i == 1:
    dp[1] = abs(h[1] - h[0])
    continue
    
  dp[i] = min(dp[i-2] + abs(h[i] - h[i-2]), dp[i-1] + abs(h[i] - h[i-1]))
  
  
print(dp[n-1])

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

dp = [None]*n

for i in range(n):
  if i == 0:
    dp[i] = 0

  if i == 1:
    dp[1] = abs(h[1] - h[0])

  dp[i] = min(dp[i-2] + abs(h[i] - h[i-2]), dp[i-1] + abs(h[i] - h[i-1]))
  
  
print(dp[n-1])
Problem p03206 (python)

Fixed submission:
def main():
    D = int(input())

    if D == 22:
        print('Christmas Eve Eve Eve')
    if D == 23:
        print('Christmas Eve Eve')
    if D == 24:
        print('Christmas Eve')
    if D == 25:
        print('Christmas')

main()

Buggy submission (verdict: Runtime Error):
def main():
    D = int(input())

    if D = 22:
        print('Christmas Eve Eve Eve')
    if D = 23:
        print('Christmas Eve Eve')
    if D = 24:
        print('Christmas Eve')
    if D = 25:
        print('Christmas')

main()
Problem p03212 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

def stgsn(N, maked_num, now_num):
    if now_num != '':
        if int(now_num) > N:
            return

        maked_num.append(now_num)

    stgsn(N, maked_num, now_num + '7')

    stgsn(N, maked_num, now_num + '5')

    stgsn(N, maked_num, now_num + '3')

    return maked_num


def main():
    N = int(input())


    maked_num = []
    now_num = ''

    maked_num = stgsn(N, maked_num, now_num)

    ans = [s for s in maked_num if '3' in s and '5' in s and '7' in s]
    print(len(ans))


main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
p_y = defaultdict(set)

N,M = map(int,input().split())
PY = [[int(x) for x in input().split()] for _ in range(M)]
for p,y in PY:
        p_y[p].add(y)

def set_rank(retu):
        return {x:i for i,x in enumerate(sorted(retu), 1)}

p_y = {p:set_rank(retu) for p,retu in p_y.items()}
for p,y in PY:
        print('{:06g}{:06g}'.format(p,p_y[p][y]))
Problem p03377 (python)

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

if A <= X <= (A+B):
    print('YES')
else:
    print('NO')

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

if A <= X <= (A+B):
    print('YES')
else:
    print('NO')
Problem p03436 (python)

Fixed submission:
import sys
from collections import deque


def bfs(H, W, maze, visited, sharp):
    queue = deque([[0, 0]])
    visited[0][0] = 0
    while queue:
        y, x = queue.popleft()
        if[y, x] == [H-1, W-1]:
            return ((H*W-sharp)-(visited[y][x]+1))
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y+j, x+k
            if  new_y != -1 and new_y != H and  \
                new_x != -1 and new_x != W and  \
                maze[new_y][new_x] == "." and   \
                visited[new_y][new_x] == -1:
                visited[new_y][new_x] = visited[y][x] + 1
                queue.append([new_y, new_x])

    return -1












def main():
    sharp = 0

    H, W = map(int,input().split())
    maze = [input() for i in range(H)]
    visited = [[-1]*W for j in range(H)]

    for k in range(H):
        sharp += maze[k].count('#')

    print(bfs(H, W, maze, visited, sharp))

main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
 
 
def bfs(H, W, maze, visited, sharp):
    queue = deque([[0, 0]])
    visited[0][0] = 0
    while queue:
        y, x = queue.popleft()
        if[y, x] == [H-1, W-1]:
            return ((H*W-sharp)-(visited[y][x]+1))
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y+j, x+k
            if  new_y != -1 and new_y != H and  \
                new_x != -1 and new_x != W and  \
                maze[new_y][new_x] == "." and   \
                visited[new_y][new_x] == -1:
                visited[new_y][new_x] = visited[y][x] + 1
                queue.append([new_y, new_x])
 
    return -1
 
 
def main():
    sharp = 0
 
    H, W = map(int,input().split())
    maze = [input() for i in range(H)]
    visited = [[-1]*W for j in range(H)]
 
    for k in range(H):
Problem p03545 (python)

Fixed submission:
import sys
import copy

def main():
    ABCD = list(map(str, input()))
    b_digit = len(ABCD)-1

    for i in range(2 ** b_digit):
        signs = ["+"] * b_digit
        for j in range(b_digit):
            if ((i >> j ) & 1):
                signs[b_digit - 1 - j] = "-"

        ABCD_tmp = copy.deepcopy(ABCD)
        for k in range(len(signs)):
            ABCD_tmp.insert(1+k*2,signs[k])
        if(eval("".join(ABCD_tmp))==7):
            print("{}=7".format("".join(ABCD_tmp)))
            sys.exit()

main()

Buggy submission (verdict: Runtime Error):
import sys
import copy

def main():
    ABCD = list(map(str, input()))
    b_digit = len(ABCD)-1

    for i in range(2 ** b_digit):
        signs = ["+"] * b_digit
        for j in range(b_digit):
            if ((i >> j ) & 1):
                signs[b_digit - 1 - j] = "-"

        ABCD_tmp = copy.deepcopy(ABCD)
        for k in range(len(signs)):
            ABCD_tmp.insert(1+k*2,signs[k])
        if(eval("".join(ABCD_tmp))==7):
            print("{}=7".format("".join(ABCD_tmp)))
            sys.exit()

main()
~

Buggy submission (verdict: Runtime Error):
import sys
import copy

def main():
    ABCD = list(map(str, input()))
    b_digit = len(ABCD)-1

    for i in range(2 ** b_digit):
        signs = ["+"] * b_digit
        for j in range(b_digit):
            if ((i >> j ) & 1):
                signs[b_digit - 1 - j] ="-"

        ABCD_tmp = copy.deepcopy(ABCD)
        for k in range(len(signs)):
            ABCD_tmp.insert(1+k*2,signs[k])
            if(eval("".join(ABCD_tmp))==7):
                    print("{}=7".format("".join(ABCD_tmp)))
                    sys.exit()

main()
Problem p03547 (python)

Fixed submission:
X,Y = input().split()
 
if ord(X) < ord(Y):
  print('<')
elif ord(X) > ord(Y):
  print('>')
else:
  print('=')

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

if ord(X) < ord(Y):
  print('<')
elif ord(X) > ord(Y):
  print('>')
else:
  print('=')