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

Fixed submission:
s = input()
for c in s:
  if c == '1': print('9', end='')
  elif c == '9': print('1', end='')

print()

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input().strip())
a = list(map(int, input().strip().split()))
cnt1 = Counter(a[::2]).most_common(2)
c11, c12 = (cnt1 if len(cnt1) == 2 else cnt1+[('', 0)])
cnt2 = Counter(a[1::2]).most_common(2)
c21, c22 = (cnt2 if len(cnt2) == 2 else cnt2+[('', 0)])

if c11[0] != c21[0]:
    print(n - c11[1] - c21[1])
else:
    print(n - max(c11[1]+c22[1], c12[1]+c21[1]))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input().strip())
a = list(map(int, input().strip().split()))

c1 = Counter(a[::2])
c2 = Counter(a[1::2])
c1f1 = max(c1, key = lambda k:c1[k])
c2f1 = max(c2, key = lambda k:c2[k])

if c1f1 != c2f1:
  return n - c1[c1f1] - c2[c2f1]
else:
  if c1[c1f1] > c2[c2f1]:
    del c2[c2f1]
    if not c2: return n-c1[c1f1]
    c2f1 = max(c2, key = lambda k:c2[k])
    return n-c1[c1f1] - c2[c2f1]
  else:
    del c1[c1f1]
    if not c1: return n-c2[c2f1]
    c1f1 = max(c1, key = lambda k:c1[k])
    return n-c1[c1f1] - c2[c2f1]
Problem p03774 (python)

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

    ST = []
    for _ in range(N):
        ST.append(tuple(map(int, input().split())))

    CP = []
    for _ in range(M):
        CP.append(tuple(map(int, input().split())))

    # print(N, M)
    # print(ST)
    # print(CP)

    return N, M, ST, CP


def solve(N, M, ST, CP):
    def get_dist(xy1, xy2):
        x1, y1 = xy1
        x2, y2 = xy2

        return abs(x1 - x2) + abs(y1 - y2)

    res = []
    for st in ST:
        min_cp, min_dist = 0, float("inf")
        for i, cp in enumerate(CP):
            dist = get_dist(st, cp)
            if dist < min_dist:
                min_dist = dist
                min_cp = i
        res.append(min_cp + 1)

    return res


if __name__ == '__main__':
    ans = solve(*args())
    for a in ans:
        print(a)

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

    ST = []
    for _ in range(N):
        ST.append(tuple(map(int, input().split())))

    CP = []
    for _ in range(M):
        CP.append(tuple(map(int, input().split())))

    # print(N, M)
    # print(ST)
    # print(CP)

    return N, M, ST, CP


def solve(N, M, ST, CP):
    def get_dist(xy1, xy2):
        x1, y1 = xy1
        x2, y2 = xy2

        return abs(x1 - x2) + abs(y1 - y2)

    res = []
    for st in ST:
        min_cp, min_dist = None, 1000
        for i, cp in enumerate(CP):
            dist = get_dist(st, cp)
            if dist < min_dist:
                min_dist = dist
                min_cp = i
        res.append(min_cp + 1)

    return res


if __name__ == '__main__':
    ans = solve(*args())
    for a in ans:
        print(a)
Problem p03785 (python)

Fixed submission:
if __name__ == '__main__':
    [N, C, K] = [int(i) for i in input().split()]

    T = []
    for i in range(N):
        T.append(int(input()))
    T.sort()

    counter = 1

    num_people = 0

    flag = False

    for num in T:
        num_people += 1
        if flag:
            if num - first_time <= K and num_people <= C:
                continue
            else:
                counter += 1
                num_people = 1
                first_time = num

        else:
            first_time = num
            flag = True

    print(counter)

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    [N, C, K] = [int(i) for i in input().split()]

    T = []
    for i in range(K):
        T.append(int(input()))
    T.sort()

    counter = 1

    num_people = 0

    flag = False

    for num in T:
        print(num)
        print(flag)
        num_people += 1
        if flag:
            if num - first_time <= K and num_people <= C:
                continue
            else:
                counter += 1
                num_people = 1
                flag = False
                print('inc')
        else:
            first_time = num
            flag = True
        

    print(counter)
Problem p03804 (python)

Fixed submission:
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False

for i in range(n-m+1):
    for j in range(n-m+1):
        p = []
        for k in range(m):
            p.append(a[i:i+m][k][j:j+m])
        if p == b:
            exits = True

print('Yes' if exits else 'No')

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False

for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(n):
            match = False
            if a[i][k: k+m] == b[j] and not exits:
                for l in range(1, m):
                    if a[i+l][k: k+m] == b[l]:
                        match = True
                    else:
                        match = False
                        break
            if match:
                exits = True

print('Yes' if exits else 'No')

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False

for i in range(n):
    for j in range(m):
        for k in range(n):
            match = False
            if a[i][k: k+m] == b[j] and not exits:
                for l in range(1, m):
                    if a[i+l][k: k+m] == b[l]:
                        match = True
                    else:
                        match = False
                        break
            if match:
                exits = True

print('Yes' if exits else 'No')

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False

for i in range(n):
    for j in range(n):
        for k in range(n):
            match = False
            if a[i][k: k+m] == b[j] and not exits:
                for l in range(1, m):
                    if a[i+l][k: k+m] == b[l]:
                        match = True
                    else:
                        match = False
                        break
            if match:
                exits = True

print('Yes' if exits else 'No')

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
exits = False

for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(n):
            match = False
            if a[i][k: k+m] == b[j] and not exits:
                for l in range(1, m):
                    if a[l][k: k+m] == b[l]:
                        match = True
                    else:
                        match = False
                        break
            if match:
                exits = True

print('Yes' if exits else 'No')
Problem p03315 (python)

Fixed submission:
s = list(input())
print (s.count('+')-s.count('-'))

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
a = list(map(int, input().split()))
 
ind = a.index(1)
 
left = ind
right = n-1-ind
import math
if left<k-1 or right<k-1:
	print (n//(k-1))
else:
	if k>=n:
		print (1)
	else:
		print(int(math.ceil(left/(k-1))+math.ceil(right/(k-1))))
Problem p03242 (python)

Fixed submission:
n = int(input())
p = 1110

print(p-n)

Buggy submission (verdict: Runtime Error):
from collections import Counter
a,b,n = 0,0,int(input())
n1 = n//2 + n%2
n2 = n//2
z = list(map(int,input().split()))
a,b = Counter(z[0::2]).most_common(2),Counter(z[1::2]).most_common(2)

if a[0] == b[0]:
	print(n2)
elif len(a) == 1 and len(b) == 1:
    print(int(n/2))
else:
	print(n1 - a[0][1]+n2 - b[0][1])
Problem p03307 (python)

Fixed submission:
n = int(raw_input())
 
if n % 2 == 0:
    print n
else:
    print 2*n

Buggy submission (verdict: Runtime Error):
n = int(raw_input())

if n % 2 == 0:
    return n
else:
    return 2*n
Problem p03315 (python)

Fixed submission:
x = input()
print(x.count('+') - x.count('-'))

Buggy submission (verdict: Runtime Error):
x = input()
print(x.count('+') - count('-'))
Problem p03785 (python)

Fixed submission:
n,c,k=map(int,input().split())
t=sorted([int(input()) for i in range(n)])
st,p,ans=-k,0,0
for i in t:
	if st+k<i or p==c:
		ans+=1
		p=1
		st=i
	else:
		p+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

class TailRecurseException:
	def __init__(self, args, kwargs):
		self.args = args
		self.kwargs = kwargs

def tail_call_optimized(g):
	def func(*args, **kwargs):
		f = sys._getframe()
		if f.f_back and f.f_back.f_back and f.f_back.f_back.f_code == f.f_code:
			raise TailRecurseException(args, kwargs)
		else:
			while 1:
				try:
					return g(*args, **kwargs)
				except TailRecurseException, e:
					args = e.args
					kwargs = e.kwargs
	func.__doc__ = g.__doc__
	return func

n,m=map(int,raw_input().split())
vis,ci,cb,cc=[0]*(n+1),0,0,0
g=[[] for i in range(n+1)]
def dfs(x,col):
	if vis[x]:
		return vis[x]==col
	vis[x],flag=col,True
	for i in g[x]:
		flag&=dfs(i,3-col)
	return flag
for i in range(m):
	u,v=map(int,raw_input().split())
	g[u]+=[v]
	g[v]+=[u]
for i in range(1,n+1):
	if vis[i]==0:
		if len(g[i])==0:
			ci+=1
		else:
			if dfs(i,1):
				cb+=1
			else:
				cc+=1
print ci*ci+2*ci*(n-ci)+cc*cc+2*cb*cc+2*cb*cb
Problem p03186 (python)

Fixed submission:
import sys
a, b, c = (int(i) for i in input().split())  
print(1 + min(a + b, c - 1) + b)

Buggy submission (verdict: Runtime Error):
import sys
print(1 + min(sys.argv[0] + sys.argv[1], sys.argv[2] - 1) + sys.argv[1])

Buggy submission (verdict: Runtime Error):
import sys
print(1 + min(sys.argv[1] + sys.argv[2], sys.argv[3] - 1) + sys.argv[2])
Problem p03186 (python)

Fixed submission:
input_str = input()

a, b, c = input_str.split()
a = int(a)
b = int(b)
c = int(c)

if a + b >= c:
    print(b + c)
else:
    print((a+b)*2 +1 - a)

Buggy submission (verdict: Runtime Error):
#input_str = input()
input_str = '8 8 1'
A, B, C = input_str.split()
A = int(A)
B = int(B)
C = int(C)

if A + B > C + 1:
    print(C*2+1)
else
	print((A+B)*2+1
Problem p03186 (python)

Fixed submission:
a, b, c = map(int,input().split())
r = 0
if c <= a + b + 1:
  r = b + c
else:
  r = a + 2 * b + 1
print(r)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
r = 0
     
if a + b >= c:
  r = b + c
else:
  r = a + b

print(r)

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

if a + b >= c:
  r = b + c
else:
  r = a + b

print(r)
Problem p03186 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a+b > c-1:
  print(b+c)
else:
  print(a+2*b+1)

Buggy submission (verdict: Runtime Error):
a = int(input())
# スペース区切りの整数の入力
b, c = map(int, input().split())
# 文字列の入力
s = input()
# 出力
print("{} {}".format(a+b+c, s))
Problem p03250 (python)

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

if a>=b and a>=c:
  a = a*10
  print(a+b+c)
elif b>=a and b>=c:
  b = b*10
  print(a+b+c)
else:
  c = c*10
  print(a+b+c)

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

if a>=b and a>=c:
  a=a*10
  print(a+b+c)
elif b>=a and b>=c:
  b=b*10
  print(a+b+c)
else
  c=c*10
  print(a+b+c)
Problem p03186 (python)

Fixed submission:
i=input()
i_s=i.split(" ")
a=int(i_s[0])
b=int(i_s[1])
c=int(i_s[2])
if(a+b>c-1):
  print(c+b)
else:
  print(b+(a+b+1))

Buggy submission (verdict: Runtime Error):
A, B, C = [int(_) for _ in input().split()]
if(A+B<C-1){
  print(B+C)
else{
  print(A+2*B+1)

Buggy submission (verdict: Runtime Error):
i=input()
is=i.split(" ")
a=int(is[0])
b=int(is[1])
c=int(is[2])
if(a+b>c-1){
  print(c+b)
else{
  print(b+(a+b+1))
Problem p03186 (python)

Fixed submission:
ipt = input().split()

a = int(ipt[0])
b = int(ipt[1])
c = int(ipt[2])

if c <= a + b + 1:
  print(c + b)
else:
  print(a + b + 1 + b)

Buggy submission (verdict: Runtime Error):
ipt = input().split()

a = ipt[0]
b = ipt[1]
c = ipt[2]

if c <= a + b + 1:
  print(c + b)
else:
  print(a + b + 1 + b)
Problem p03186 (python)

Fixed submission:
# 入力データの数値化
nums = list(map(int, input().split()))
A = nums[0] 
B = nums[1]
C = nums[2]

count=0

if C-1-B <= 0 or C-1-B <=A:
  print(C+B)
else:
  print(1+2*B+A)

Buggy submission (verdict: Runtime Error):
# １行の入力データを分割
data = input().split() # "1 2 3"と入力
# 入力データの数値化
nums = list(map(int, input().split()))
A = nums[0] 
B = nums[1]
C = nums[2]

count=0

while (C>0):
  C = C - 1
  count = count +1
  if B>0:
    B = B-1
    count  = count +1
  elif A>0:
    A = A-1
  else:
    while(B>0):
      B = B -1
      count = count +1
    break
print(count)
Problem p03186 (python)

Fixed submission:
nums = input().split(' ')

BadCookie = int(nums[0])
GoodCookie = int(nums[1])
GoodPoson = int(nums[2])
if GoodCookie + BadCookie > GoodPoson:
    print(GoodCookie+GoodPoson)
elif GoodCookie + BadCookie < GoodPoson:
    print(GoodCookie+BadCookie+GoodCookie+1)
else:
    print(GoodCookie+GoodPoson)

Buggy submission (verdict: Runtime Error):
line = list(input())
nums = [int(n) for n in line]
BadCookie = nums[0]
GoodCookie = nums[1]
GoodPoson = nums[2]

print(GoodCookie+(GoodPoson-(GoodCookie+BadCookie)))
Problem p03208 (python)

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

tree_list = []
sort_list = []
for x in range(N):
    tree_list.append(int(input()))

sort_list = sorted(tree_list)

min_heigt = sort_list[M-1] - sort_list[0]

for x in range(N-M+1):
    nagasa =sort_list[x+M-1] - sort_list[x] 
    if min_heigt > nagasa:
        min_heigt = nagasa

print(min_heigt)

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

tree_list = []
sort_list = []
for x in range(N):
    tree_list.append(int(input()))

sort_list = sorted(tree_list)

min_heigt = sort_list[2] - sort_list[0]

for x in range(N-M+1):
    nagasa =sort_list[x+2] - sort_list[x] 
    if min_heigt > nagasa:
        min_heigt = nagasa

print(min_heigt)
Problem p03426 (python)

Fixed submission:
import collections
import itertools
from pprint import pprint as pp

H,W,D = tuple(map(int, input().split()))
A = [tuple(map(int, input().split())) for _ in range(H)]
Q = int(input())
LR = [tuple(map(int, input().split())) for _ in range(Q)]

Arev = [None] * (H*W+1)
for h in range(H):
  for w in range(W):
    Arev[A[h][w]] = (h,w)

tbl = []
for i in range(D):
  ary = []
  mp = 0
  start = Arev[i+1]
  for x in range(i, H*W, D):
    next_ = Arev[x+1]
    mp += abs(start[0]-next_[0]) + abs(start[1]-next_[1])
    ary.append((x+1,mp))
    start = next_
  tbl.append(ary)
#pp(A)
#pp(tbl)
for L,R in LR:
  col1, row = divmod(L, D)
  col2 = R // D
  if row == 0:
    col1 -= 1
    col2 -= 1
  row -= 1
  #pp((row,col1,col2))
  print(tbl[row][col2][1] - tbl[row][col1][1])

Buggy submission (verdict: Runtime Error):
import collections
import itertools
from pprint import pprint as pp

H,W,D = tuple(map(int, input().split()))
A = [tuple(map(int, input().split())) for _ in range(H)]
Q = int(input())
LR = [tuple(map(int, input().split())) for _ in range(Q)]

Arev = [None] * (H*W+1)
for h in range(H):
  for w in range(W):
    Arev[A[h][w]] = (h,w)

tbl = []
for i in range(D):
  i += 1
  ary = []
  mp = 0
  start = Arev[i]
  for x in range(i, H*W, D):
    next_ = Arev[x]
    mp += abs(start[0]-next_[0]) + abs(start[1]-next_[1])
    ary.append((x,mp))
    start = next_
  tbl.append(ary)
for L,R in LR:
  col1, row = divmod(L, D)
  col2 = R // D
  if row == 0:
    col1 -= 1
    col2 -= 1
  row -= 1
  print(tbl[row][col2][1] - tbl[row][col1][1])

Buggy submission (verdict: Runtime Error):
import collections
import itertools
from pprint import pprint as pp

H,W,D = tuple(map(int, input().split()))
A = [tuple(map(int, input().split())) for _ in range(H)]
Q = int(input())
LR = [tuple(map(int, input().split())) for _ in range(Q)]

Arev = [None] * (H*W+1)
for h in range(H):
  for w in range(W):
    Arev[A[h][w]] = (h,w)

tbl = []
for i in range(D):
  i += 1
  ary = []
  mp = 0
  start = Arev[i]
  for x in range(i, H*W, D):
    next_ = Arev[x]
    mp += abs(start[0]-next_[0]) + abs(start[1]-next_[1])
    ary.append((x,mp))
    start = next_
  tbl.append(ary)
pp(tbl)
for L,R in LR:
  col1, row = divmod(L, D)
  col2 = R // D
  if row == 0:
    col1 -= 1
    col2 -= 1
  row -= 1
  pp((row,col1,col2))
  print(tbl[row][col2][1] - tbl[row][col1][1])
Problem p03250 (python)

Fixed submission:
C,A, B = sorted(map(int,input().split()))
if A>B:
  print(A*10 +B+C)
elif A<B:
  print(A+B*10+C)
else:
  print(A+B*10+C)

Buggy submission (verdict: Runtime Error):
A, B, C = map(int,input().split())
if A>B:
	print(A*10 +B+C)
elif A<B:
    print(A+B*10+C)
else:
	if A*10+B+C>A+B*10+C:
        print(A*10+B+C)
    else:
        print(A+B*10+C)
Problem p03327 (python)

Fixed submission:
N=int(input())
if N <= 999:
    print("ABC")
else:
    print("ABD")

Buggy submission (verdict: Runtime Error):
N=int(input())
if N =<999:
    print("ABC")
else:
    print("ABD")
Problem p03201 (python)

Fixed submission:
import bisect
ans = 0
N = int(input())
a = list(map(int,input().split()))
b = [True for _ in range(N)]
c = [True for _ in range(N)]
a.sort()
digit = 40
y = 2 ** (digit+1) -1
while len(a)>1:
    if b[-1]==False:
        a.pop(-1)
        b.pop(-1)
        continue
    x = a.pop(-1)
    b.pop(-1)
    while x < 2**digit:
        digit -= 1
        y = 2 ** (digit+1) -1
    z = x^y
    z += 1
    ll =  bisect.bisect_left(a,z)
    rr =  bisect.bisect_right(a,z)
    if rr-ll>0:
        rr -= 1
        if b[ll]==False:
            pass
        elif b[rr]==True:
            b[rr]=False
            ans += 1
        else:
            lll = ll
            rrr = rr
            while rrr-lll>1:
                if b[(rrr+lll)//2]:
                    lll = (rrr+lll)//2
                else:
                    rrr = (rrr+lll)//2
            b[lll] = False
            ans += 1           
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
ans = 0
N = int(input())
a = list(map(int,input().split()))
b = [True for _ in range(N)]
a.sort()
digit = 40
y = 2 ** (digit+1) -1
while len(a)>1:
    if b[-1]==False:
        a.pop(-1)
        b.pop(-1)
        continue
    x = a.pop(-1)
    b.pop(-1)
    while x < 2**digit:
        digit -= 1
        y = 2 ** (digit+1) -1
    z = x^y
    z += 1
    ll =  bisect.bisect_left(a,z)
    rr =  bisect.bisect_right(a,z)
    if rr-ll>0:
        rr -= 1
        while b[rr] == False:
            rr -= 1
        if rr>=ll:
            b[rr] = False
            ans += 1           
print(ans)
Problem p03207 (python)

Fixed submission:
N = int(input())
p = []
max = 0
for i in range(N):
  p.append(int(input()))
p.sort()
sum = 0
for i in range(N-1):
  sum += p[i]
sum += p[N-1]/2
print(int(sum))

Buggy submission (verdict: Runtime Error):
N = input()
p = []
max = 0
for i in range(N):
  p.append(int(input()))
  if(p[i]>max):
    maxi = i
sum = 0
for i in range(N):
  if(i == maxi):
    sum += p[i]/2
  else:
    sum += p[i]
print(sum)
Problem p03208 (python)

Fixed submission:
N, K = map(int, input().split())
h = []
for i in range(N):
  h.append(int(input()))
h.sort()
mini = 1e9
for i in range(N-K+1):
  sub = h[i+K-1] - h[i]
  if(sub < mini):
    mini = sub
print(mini)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = []
for i in range(N):
  h.append(int(input()))
h.sort()
mini = 1e9
for i in range(N-K+1):
  sub = h[i+K-1] - h[i]
  if(sub < mini){
    mini = sub
print(mini)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input())
h = []
for i in range(N):
  h.append(int(input()))
h.sort()
mini = 1e9
for i in range(N-K+1):
  sub = h[i+K-1] - h[i]
  if(sub < mini){
    mini = sub
print(mini)
Problem p03242 (python)

Fixed submission:
n = list(input())
for i in range(len(n)):
  n[i] = "1" if n[i]=="9" else "9"
ans = ''.join(n)
print(ans)

Buggy submission (verdict: Runtime Error):
n = list(input())
for i range(len(n)):
  n[i] = "1" if n[i]==9 else "9"
ans = ','.join(n)
print(ans)
Problem p03464 (python)

Fixed submission:
import math
K = int(input())
A = list(map(int,input().split()))
a = 1
L,S = 2,2 

while a <= K:
    if math.ceil(S/A[-a])*A[-a] < S or L < math.ceil(S/A[-a])*A[-a]:
        print('-1')
        exit()
    S = math.ceil(S/A[-a])*A[-a]
    L = math.floor(L/A[-a])*A[-a] + A[-a] -1
    a += 1
print(S,L)

Buggy submission (verdict: Runtime Error):
K = int(input())
A = list(map(int,input().split()))
a = K-1
p = 2
while 0 <= a:
    if A[a-1] > A[a]*2:
        print('-1')
        exit()
    num = 1
    if A[a] < p:
        while A[a]*num < p:
            num += 1
    p = num*A[a]
    a -= 1
pmax = p
while pmax < A[1]*2:
    pmax += A[0]
pmax -= A[0]
print(p,pmax)
Problem p03804 (python)

Fixed submission:
def solve(n, m, NUM):
    for i in range(len(m)):
        if n[NUM + i] is not m[i]:
            return -1
    return 1


N, M = [int(i) for i in input().split()]
n_pic = [input() for i in range(N)]
m_pic = [input() for i in range(M)]
num = 0
if M is 1:
    for n in n_pic:
        if -1 is not n.find(m_pic[0]):
            print('Yes')
            exit()
    print('No')
    exit()

for n in range(N - M + 1):
    for n_len in range(N - M + 1):
        while -1 is not solve(n_pic[n + num], m_pic[num], n_len):
            num += 1
            if num is M:
                print('Yes')
                exit()
        num = 0
print('No')

Buggy submission (verdict: Runtime Error):
def solve(n, m, NUM):
    for i in range(len(m)):
        if n[NUM + i] is not m[i]:
            return -1
    return 1


N, M = [int(i) for i in input().split()]
n_pic = [input() for i in range(N)]
m_pic = [input() for i in range(M)]
num = 0
if M is 1:
    for n in n_pic:
        if -1 is not n.find(m_pic[0]):
            print('Yes')
            exit()
    print('No')
    exit()

for n in range(len(n_pic)):
    for n_len in range(N - M + 1):
        while -1 is not solve(n_pic[n+num], m_pic[num], n_len):
            num += 1
            print(num)
            if num is M:
                print('Yes')
                exit()
        num = 0
print('No')

Buggy submission (verdict: Runtime Error):
def solve(n, m, NUM):
    for i in range(len(m)):
        if n[NUM + i] is not m[i]:
            return -1
    return 1


N, M = [int(i) for i in input().split()]
n_pic = [input() for i in range(N)]
m_pic = [input() for i in range(M)]
num = 0
if M is 1:
    for n in n_pic:
        if -1 is not n.find(m_pic[0]):
            print('Yes')
            exit()
    print('No')
    exit()

for n in n_pic:
    for n_len in range(N - M + 1):
        while -1 is not solve(n, m_pic[num], n_len):
            num += 1
        if num is M - 1:
            print('Yes')
            exit()
        num = 0
print('No')
Problem p03207 (python)

Fixed submission:
N = int(input())
max_item = 0
sum_item = 0
for _ in range(N):
  c = int(input())
  sum_item += c
  max_item = max(c, max_item)

sum_item -= max_item // 2 
print(sum_item)

Buggy submission (verdict: Runtime Error):
N = int(input())
num = N+1price = []
for i in range (1,num):
  price.append(int(input()))
else:
  exp = max(price)//2
  total = sum(price) - exp
  print(total)
Problem p03208 (python)

Fixed submission:
import numpy as np

N,K = list(map(int, input().split()))
h = []
for _ in range(N):
    h.append(int(input()))
h = sorted(h)
res = h[N-1] - h[0]
for i in np.arange(0,N-K+1,1):
    tmp = h[i+K-1] - h[i]
    if res > tmp:
        res = tmp
    
print(res)

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

N,K = list(map(int, input().split(",")))
h = []
for _ in range(N):
    h.append(int(input()))
h = sorted(h)
res = h[N-1] - h[0]
for i in np.arange(0,N-K+1,1):
    tmp = h[i+K-1] - h[i]
    if res > tmp:
        res = tmp
    
print(res)