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

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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)

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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)

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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)

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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)

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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)

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

if a == b == c:
    print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
    print(2)

else:
    print(3)

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

if a == b == c:
  print(1)

elif (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
  print(2)

else:
  print(3)

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

if a == b == c:
	print(1)

if (a==b and b!=c) or (b==c and a!=b) or (a==c and b!=a):
	print(2)

else:
	print(3)
Problem p04011 (python)

Fixed submission:
N = int(input()) #5
K = int(input()) #3
X = int(input())
Y = int(input())

total = 0
for a in range(1, N+1): #6 , 1, 2, 3, 4, 5
    if a <= K:
        total += X
    else:
        total += Y

print(total)

Buggy submission (verdict: Runtime Error):
N = int(input()) #5
K = int(input()) #3
X = int(input())
Y = int(input())

total = 0
for a in range(1, N+1): #6 , 1, 2, 3, 4, 5
	if a < K:
		total += X
    else:
		total += Y

print(total)

Buggy submission (verdict: Runtime Error):
N = int(input()) #5
K = int(input()) #3
X = int(input())
Y = int(input())

total = 0
for a in range(1, N+1): #6 , 1, 2, 3, 4, 5
	if a < K:
      total += X
    else:
      total += Y

print(total)

Buggy submission (verdict: Runtime Error):
N = int(input()) #5
K = int(input()) #3
X = int(input())
Y = int(input())

total = 0
for a in range(1, 6): #6 , 1, 2, 3, 4, 5
	if a <= K:
      total += X
    else:
      total += Y

print(total)

Buggy submission (verdict: Runtime Error):
N = int(input()) #5
K = int(input()) #3
X = int(input())
Y = int(input())

total = 0
for a in range(1, 6): #6 , 1, 2, 3, 4, 5
	if a < K:
      total += X
    else:
      total += Y

print(total)
Problem p04043 (python)

Fixed submission:
a, b, c = map(int, input().split())
if (a ==5 and b==5 and c ==7) or (a==5 and b==7 and c==5) or (a==7 and b==5 and c==5):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if (a ==5 and b==5 and c ==7) or (a==5 and b==7 and c==5) or (a==7 and b==5 and C==5):
    print('YES')
else:
    print('NO')
Problem p03674 (python)

Fixed submission:
# ------ combination -------
N, MOD = 10**5 + 1, 10**9 + 7
fc, ifc = [0] * (N+1), [0] * (N+1)

def power(n, a):
    res, exp = 1, n
    while(a):
        if a & 1:
            res = res * exp % MOD
        exp = exp * exp % MOD
        a = a >> 1
    return res

fc[0] = 1
for i in range(1, N+1):
    fc[i] = fc[i-1] * i % MOD
ifc[N] = power(fc[N], MOD-2)
for i in range(N-1, -1, -1):
    ifc[i] = ifc[i+1] * (i+1) % MOD

def Comb(n, r):
    if n < 0 or r < 0 or n < r:
        return 0
    return fc[n] * ifc[r] % MOD * ifc[n-r] % MOD

# --------------------------

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

num = [-1] * (n+1)
l = r = -1
for i in range(len(a)):
    if num[a[i]] != -1:
        l, r = num[a[i]], i
        break
    num[a[i]] = i

for k in range(1, len(a)+1):
    ans = Comb(len(a), k) - Comb(l+len(a)-r-1, k-1)
    while ans < 0:
        ans += MOD
    print(ans)

Buggy submission (verdict: Runtime Error):
import scipy.misc as scm
mod = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))

num = [-1] * (n+1)
l = r = -1
for i in range(len(a)):
    if num[a[i]] != -1:
        l, r = num[a[i]], i
        break
    num[a[i]] = i

for k in range(1, len(a)+1):
   print(scm.comb(len(a), k, True) % mod - scm.comb(l+len(a)-r-1, k-1, True) % mod)
Problem p03574 (python)

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

m = []

for i in range(h):
    l = list(input())
    m.append([ '#' if i=='#' else 0 for i in l])

for i in range(h):
    for j in range(w):
        if m[i][j] == '#':
            for u in range(3):
                for v in range(3):
                    if u==1 and v==1:
                        pass
                    else:
                        try:
                            y = i+u-1
                            x = j+v-1
                            if y < 0 or x < 0:
                                continue

                            if m[y][x] != '#':
                                m[y][x] += 1

                        except:
                            pass

for l in m:
    s = map(str, l)
    print(''.join(s))

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



m = []

for i in range(h):
    l = list(input())
    m.append([ '#' if i=='#' else 0 for i in l])

for i in range(h):
    for j in range(w):
        if m[i][j] == '#':
            for u in range(3):
                for v in range(3):
                    if u==1 and v==1:
                        pass
                    else:
                        try:
                            m[i + u -1][j + v-1] += 1
                        except:
                            pass





for l in r:
    s = map(str, l)
    print(''.join(s))
Problem p03573 (python)

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

#A-B B-C C-A 同じもの以外を出力

if (a == b):
    print(c)
    exit()
if (b == c):
    print(a)
    exit()
if (a == c):
    print(b)
    exit()

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

if (a == b):
    print(c)
    exit()
if (b == c):
    print(a)
    exit()
if (a == c):
    print(b)
    exit()
Problem p03605 (python)

Fixed submission:
a = int(input())
 
if (a//10 == 9 or a%10 == 9):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = map(int,list(input()))
if (a[0] == 9 or a[1] == 9):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = map(int,list(input()))
if (a[0] == 9 or a[1] == 9):
    print("Yes")
else:
    print("No")

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

if (a//10 == 9 || a%10 == 9):
    print("yes")
else:
    print("No")

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

if (a/10 == 9 || a%10 == 9):
    print("yes")
else:
    print("No")
Problem p03657 (python)

Fixed submission:
def main():
    a, b = map(int, input().split())
    goats = 3
    if a%goats == 0 or b%goats == 0 or (a+b)%goats == 0:
        print("Possible")
    else:
        print("Impossible")


if __name__ == "__main__":
        main()

Buggy submission (verdict: Runtime Error):
        def main():
            goats =3
            n = input()
            list = [int(i) for i in input().split()]
            if (list[0]%3==0 or list[1] %3==0  or (list[0]+list[1])%3==0):
               print('Possible')
            else:
               print("Impossible")
         
         
        if __name__ == "__main__":
            main()

Buggy submission (verdict: Runtime Error):
    def main():
        goats =3
        n = input()
        list = [int(i) for i in input().split()]
        if (list[0]%3==0 or list[1] %3==0  or (list[0]+list[2])%3==0):
           print('Possible')
        else:
           print("Impossible")
     
     
    if __name__ == "__main__":
        main()
Problem p03643 (python)

Fixed submission:
#!/usr/bin
# -*- coding="utf-8" -*-
 
a = input()
print ("ABC" + a )

Buggy submission (verdict: Runtime Error):
#!/usr/bin
# -*- coding="utf-8" -*-

a = raw_input()
print ("ABC" + a )
Problem p03644 (python)

Fixed submission:
#!/usr/bin
# -*- coding="utf-8" -*-
 
n = int(input())
if n >= 64:
  a = 64
elif n >= 32:
  a = 32
elif n >= 16:
  a = 16
elif n >= 8:
  a= 8
elif n >= 4:
  a = 4
elif n >= 2:
  a = 2
else:
  a = 1
print(a)

Buggy submission (verdict: Runtime Error):
#!/usr/bin
# -*- coding="utf-8" -*-
 
n = raw_input()
if n >= 64:
  a = 64
elif n >= 32:
  a = 32
elif n >= 16:
  a = 16
elif n >= 8:
  a= 8
elif n >= 4:
  a = 4
elif n >= 2:
  a = 2
else:
  a = 1
print(a)
Problem p03645 (python)

Fixed submission:
#!/usr/bin
# -*- coding="utf-8" -*-
c1 = []
c2 = []
q = input().split()
n = [input().split() for i in range(int(q[1]))]
 
for m in n:
  if m[0] == "1":
    c1.append(m[1])
  if m[1] == q[0]:
    c2.append(m[0])
if set(c1) & set(c2):
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
#!/usr/bin
# -*- coding="utf-8" -*-

c1 = []
c2 = []
q = input().split()
for i in range(int(q[1])):
  n = input()
for j in range(n):
  m = j.split()
  if m[0] == "1":
    c1.append(m[1])
  if m[1] == q[0]:
    c2.append(m[0])

if set(c1) & set(c2):
  print("POSSIBLE")
else:
  print("INPOSSIBLE")

Buggy submission (verdict: Runtime Error):
#!/usr/bin
# -*- coding="utf-8" -*-

c1 = []
c2 = []
q = input().split()
n = [input() for i in range(int(q[1]))]
for j in range(n):
  m = j.split()
  if m[0] == "1":
    c1.append(m[1])
  if m[1] == q[0]:
    c2.append(m[0])
if set(c1) & set(c2):
  print("POSSIBLE")
else:
  print("INPOSSIBLE")

Buggy submission (verdict: Runtime Error):
#!/usr/bin
# -*- coding="utf-8" -*-

c1 = []
c2 = []
q = input().split()
n = [input() for i in range(int(q[1]))]
for j in range(n):
  m = j.split()
  if m[0] == "1":
    c1.append(m[1])
  if m[1] == q[0]:
    c2.append(m[0])
if set(c1).intersection(c2):
  print("POSSIBLE")
else:
  print("INPOSSIBLE")

Buggy submission (verdict: Runtime Error):
#!/usr/bin
# -*- coding="utf-8" -*-

c1 = []
c2 = []
q = input().split()
n = [input() for i in range(q[1])]
for j in range(n):
  m = j.split()
  if m[0] == "1":
    c1.append(m[1])
  if m[1] == q[0]:
    c2.append(m[0])
for l in len(c2):
  if c1[l] in c2:
    print("POSSIBLE")
    break
print("INPOSSIBLE")
Problem p03646 (python)

Fixed submission:
#!/usr/bin
# -*- coding="utf-8" -*-
 
K = int(input())
if K >= 50:
  N = 50
  a = K % N
  if a == 0:
    n = [K // N + 49] * N
  else:
    n = [K // N + (49 - a)] * N
    for i in range(a):
      n[i] = n[i] + N
elif K == 0:
  N = 2
  n = ["1", "1"]
else:
  N = K + 1
  n = [0] * N
  n[0] = K**2 + K*2
n = ' '.join(list(map(str, n)))
print(N)
print(n)

Buggy submission (verdict: Runtime Error):
#!/usr/bin
# -*- coding="utf-8" -*-
 
K = int(input())
N = K + 1
n = [0] * N
n[0] = K**2 + K*2
n = ' '.join(list(map(str, n)))
print(N)
print(n)
Problem p03658 (python)

Fixed submission:
#!/usr/bin
# -*- cording: "utf-8" -*-
 
a, b = map(int, input().split())
c = list(map(int, input().split()))
c.sort(reverse=True)
x = 0
for i in range(b):
  x = x + c[i]
print(x)

Buggy submission (verdict: Runtime Error):
#!/usr/bin
# -*- cording: "utf-8" -*-
 
a, b = map(int, input().split())
c = list(map(int, input().split()))
c.sort(reverse=true)
for i in range(b):
  x = x + c[i]
print(x)

Buggy submission (verdict: Runtime Error):
!/usr/bin
# -*- cording: "utf-8" -*-

a, b = map(int, input().split())
c = list(map(int, input().split()))
c.sort(reverse=true)
for i in range(b):
  x = x + c[i]
print(x)
Problem p03672 (python)

Fixed submission:
#!/usr/bin
# -*- coding="utf-8" -*-
 
s = input()[:-1]
sn = len(s)

if sn % 2 == 1:
  sn = sn -1
for i in range(sn, 0, -2):
  if s[:i//2] == s[i//2:i]:
    break
print(len(s[:i]))

Buggy submission (verdict: Runtime Error):
#!/usr/bin
# -*- coding:"utf-8" -*-

s = input()
sn = len(s)

if sn % 2 == 1:
  sn = sn -1
for i in range(sn, 0, -2)
  if s[:i/2] == s[i/2:]:
    break
print(s[:i])
Problem p04011 (python)

Fixed submission:
a = [int(input()) for i in range(4)]
print(a[2]*min(a[0],a[1])+max(0,(a[0]-a[1])*a[3]))

Buggy submission (verdict: Runtime Error):
n, k, x, y = map(int, input())
print(x*min(n, k)+y*max(0, n-k))
Problem p04032 (python)

Fixed submission:
s = input()
tc = [ chr(i)*2 for i in range(ord('a'), ord('z')+1) ]  + [ chr(i)+chr(j)+chr(i) for i in range(ord('a'), ord('z')+1) for j in range(ord('a'), ord('z')+1)]
x=y=-1
t = "0"
for i in tc:
  if i in s:
    t = i
for i in range(len(s)-len(t)+1):
    if s[i:i+len(t)] == t:
      x = i+1
      y = i+len(t)
print(x, y)

Buggy submission (verdict: Runtime Error):
s = input()
tc = [ chr(i)*2 for i in range(ord('a'), ord('z')+1) ]  + [ chr(i)+chr(j)+chr(i) for i in range(ord('a'), ord('z')+1) for j in range(ord('a'), ord('z')+1)]
for i in tc:
  if i in s:
    t = i
    break
  else:
    t = 0
if t == 0:
  x=y=-1
for i in range(len(s)-len(t)+1):
      if s[i:i+len(t)] == t:
          x = i+1
          y = i+len(t)
print(x, y)
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")
Problem p04045 (python)

Fixed submission:
N, K = map(int, input().split())
D = list(map(int, input().split()))
L = [i for i in range(10) if i not in D]
A = []
for i in L:
  A.append(i)
for i in L:
  for j in L:
    A.append(10*i+j)
for  i in L:
  for j in L:
    for k in L:
      A.append(100*i+10*j+k)
for i in L:
  for j in L:
    for k in L:
      for l in L:
        A.append(1000*i+100*j+10*k+l)

for i in L:
  for j in L:
    for k in L:
      for l in L:
        for m in L:
          A.append(\
10000*i+1000*j+100*k+10*l+m)

for i in A:
  if i >= N:
    print(i)
    break

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
D = list(map(int, input().split()))
L = [i for i in range(10) if i not in D]
A = []
for i in L:
  A.append(i)
for i in L:
  for j in L:
    A.append(10*i+j)
for  i in L:
  for j in L:
    for k in L:
      A.append(100*i+10*j+k)
for i in L:
  for j in L:
    for k in L:
      for l in L:
        A.append(1000*i+100*j+10*k+l)

for i in L:
  for j in L:
    for k in L:
      for l in L:
        for m in L:
A.append(10000*i+1000*j+100*k+10*l+m)

for i in A:
  if i >= N:
    print(i)
    break
Problem p03574 (python)

Fixed submission:
h, w = map(int, input().split())
s = [list(input()) for i in range(h)]

dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1,  0,  1, -1, 1,-1, 0, 1]

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            continue
        elif s[i][j] == '.':
            num = 0
            for a in range(8):
                ni = i + dx[a]
                nj = j + dy[a]

                if (0 <= ni < h) and (0 <= nj < w) and (s[ni][nj] == '#'):
                    num += 1
            s[i][j] = num

[print(*i,sep='') for i in s]

Buggy submission (verdict: Runtime Error):
def incre(a, i, j):
    if a[i][j] != '#':
        a[i][j] += 1


h, w = map(int, input().split())
s = [list(input()) for i in range(h)]

a = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            a[i][j] = '#'

for i in range(h):
    for j in range(w):
        if (s[i][j] == '#'):
            if i == 0:
                if j == 0:
                    incre(a, i, j+1)
                    incre(a, i+1, j)
                    incre(a, i+1, j+1)
                elif 0 < j < w - 1:
                    incre(a, i, j-1)
                    incre(a, i, j+1)
                    incre(a, i+1, j-1)
                    incre(a, i+1, j)
                    incre(a, i+1, j+1)

                elif j == w-1:
                    incre(a, i, j-1)
                    incre(a, i-1, j-1)
                    incre(a, i+1, j)
            elif 0 < i < h - 1:
                if j == 0:
                    incre(a, i-1, j)
                    incre(a, i-1, j+1)
                    incre(a, i, j+1)
                    incre(a, i+1, j)
                    incre(a, i+1, j+1)
                elif 0 < j < w - 1:
                    incre(a, i-1, j-1)
                    incre(a, i-1, j)
                    incre(a, i-1, j+1)
                    incre(a, i, j-1)
                    incre(a, i, j+1)
                    incre(a, i+1, j-1)
                    incre(a, i+1, j)
                    incre(a, i+1, j+1)
                elif j == w-1:
                    incre(a, i-1, j)
                    incre(a, i-1, j-1)
                    incre(a, i, j-1)
                    incre(a, i+1, j-1)
                    incre(a, i+1, j)
            elif i == h-1:
                if j == 0:
                    incre(a, i-1, j)
                    incre(a, i-1, j+1)
                    incre(a, i, j+1)
                elif 0 < j < w - 1:
                    incre(a, i-1, j-1)
                    incre(a, i-1, j)
                    incre(a, i-1, j+1)
                    incre(a, i, j-1)
                    incre(a, i, j+1)
                elif j == w-1:
                    incre(a, i-1, j-1)
                    incre(a, i-1, j)
                    incre(a, i, j-1)

[print(*i, sep="") for i in a]
Problem p03577 (python)

Fixed submission:
z=input()
print(z[:-8])

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter
candnum=int(input())
candiff=list(map(int,input().split()))
pronum=int(input())
candiff=Counter(candiff)
prodiff=list(map(int,input().split()))
prodiff=Counter(candiff)

for k,v in prodiff.items():
    if k in candiff:
        if candiff[k]<v:
            print("NO")
            sys.exit()
    else:
        print("NO")
        sys.exit()
print("YES")

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter
candnum=int(input())
candiff=list(map(int,input().split()))
pronum=int(input())
candiff=Counter(candiff)
prodiff=list(map(int,input().split()))
prodiff=Counter(candiff)
#if pronum>candnum:
#    print("NO")
#    sys.exit()
for k,v in prodiff.items():
    if k in candiff:
        if candiff[k]<v:
            print("NO")
            sys.exit()
    else:
        print("NO")
        sys.exit()
print("YES")

Buggy submission (verdict: Runtime Error):
z=input
print(z[:-8])

Buggy submission (verdict: Runtime Error):
z=input().split()
return z[:-8]
Problem p03582 (python)

Fixed submission:
def work(a,b,c,A,B,C):
 if A==0:
  return work(b,c,'',B,C,0)
 if B==0:
  if C==0:
   return a*A
  else:
   return work(a,c,'',A,C,0)
 if C==0:
  return work(a+b*(B/A),a+b*(B/A+1),'',A-B%A,B%A,0)
 cmod = C%A
 if B <= A-cmod:
  return work(a+c*(C/A),a+c*(C/A)+b,a+c*(C/A+1),A-cmod-B,B,cmod)
 else:
  bmod = B%(A-cmod)
  return work(a+c*(C/A)+b*(B/(A-cmod)),a+c*(C/A)+b*(B/(A-cmod)+1),a+c*(C/A+1),A-bmod-cmod,bmod,cmod)

if __name__ == '__main__':
 s = raw_input()
 a,b,c = [int(i) for i in s.split()]
 print(work('a','b','c',a,b,c))

Buggy submission (verdict: Runtime Error):
def work(a,b,c,A,B,C):
    if A==0:
        return work(b,c,'',B,C,0)
    if B==0:
        if C==0:
            return a*A
        else:
            return work(a,c,'',A,C,0)
    if C==0:
        return work(a+b*(B/A),a+b*(B/A+1),'',A-B%A,B%A,0)
    cmod = C%A
	if B <= A-cmod:
		return work(a+c*(C/A),a+c*(C/A)+b,a+c*(C/A+1),A-cmod-B,B,cmod)
	else:
		B = B - (A-cmod)
		bmod = B%A
		if bmod>=cmod:
			return work(a+c*(C/A)+b*(B/A+1),a+c*(C/A)+b*(B/A+2),a+c*(C/A+1)+b*(B/A+1),A-bmod,bmod-cmod,cmod)
		else:
			return work(a+c*(C/A)+b*(B/A+1),a+c*(C/A+1)+b*(B/A),a+c*(C/A+1)+b*(B/A+1),A-cmod,cmod-bmod,bmod)

if __name__ == '__main__':
    s = raw_input()
    a,b,c = [int(i) for i in s.split()]
    print(work('a','b','c',a,b,c))
Problem p03659 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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

ls = []
A = sum(ax[:1])
B = sum(ax[1:])

for i in range(1, N):
    sub = abs(A-B)
    ls.append(sub)
    if(sub is 0):
        break
    A += ax[i]
    B -= ax[i]

print(sorted(ls)[0])

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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

ls = []
A = sum(ax[:1])
B = sum(ax[1:])

for i in range(2, N):
    sub = abs(A-B)
    print(sub)
    ls.append(sub)
    if(sub is 0):
        break
    A -= ax[i]
    B += ax[i]

print(sorted(ls)[0])
Problem p04032 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

s = input()


def search(s):
    for i in range(len(s)-1):
        if s[i] == s[i+1]:
            return i+1, i+2
        if len(s) > i+2 and s[i] == s[i+2]:
            return i+1, i+3
    return -1, -1


if __name__ == "__main__":
    a, b = search(s)
    if a == -1:
        print("-1 -1")
    else:
        print(a, end="")
        print(' ', end="")
        print(b, end="")

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

s = input()


def search(s):
    for i in range(len(s)-1):
        if s[i] == s[i+1]:
            return i+1, i+2
        if s[i] == s[i+2]:
            return i+1, i+3
    return -1, -1


if __name__ == "__main__":
    a, b = search(s)
    if a == -1:
        print("-1 -1")
    else:
        print(a, end="")
        print(' ', end="")
        print(b, end="")
Problem p03591 (python)

Fixed submission:
S = input()
if len(S) < 4:
    print("No")
elif S[0:4] == "YAKI":
    print("Yes")
else:
    print("No")

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

def foo():
	H, W = map(int, input().split())
	s = ""
	for _ in range(H):
		s += input()

	counter = defaultdict(int)
	for c in s:
		counter[c] += 1

	x1, x2 = H // 2, H % 2
	y1, y2 = W // 2, W % 2

	n = x1 * y1
	k = 0
	for c in counter:
		if k == n:
			break
		if counter[c] >= 4:
			k += 1
			counter[c] -= 4

	if k != n:
		print("No")
		return

	if x2 == 1:
		n = x1
		k = 0
		for c in counter:
			if k == n:
				break
			if counter[c] >= 2:
				k += 1
				counter[c] -= 2
		if k != n:
			print("No")
			return
	if y2 == 1:
		n = y1
		k = 0
		for c in counter:
			if k == n:
				break
			if counter[c] >= 2:
				k += 1
				counter[c] -= 2
		if k != n:
			print("No")
			return
	print("Yes")

foo()

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

def foo():
	H, W = map(int, input().split())
	s = ""
	for _ in range(H):
		s += input()

	counter = defaultdict(int)
	for c in s:
		counter[c] += 1

	x1, x2 = H // 2, H % 2
	y1, y2 = W // 2, W % 2

	n = x1 * y1
	k = 0
	for c in counter:
		if k == n:
			break
		if counter[c] >= 4:
			k += 1
			counter[c] -= 4

	if k != n:
		print("No")
		return

	if x2 == 1:
		n = y1
		k = 0
		for c in counter:
			if k == n:
				break
			if counter[c] >= 2:
				k += 1
				counter[c] -= 2
		if k != n:
			print("No")
			return
	if y2 == 1:
		n = x1
		k = 0
		for c in counter:
			if k == n:
				break
			if counter[c] >= 2:
				k += 1
				counter[c] -= 2
		if k != n:
			print("No")
			return
	print("Yes")

foo()

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

def foo():
	H, W = map(int, input().split())
	s = ""
	for _ in range(H):
		s += input()

	counter = defaultdict(int)
	for c in s:
		counter[c] += 1

	x1, x2 = H // 2, H % 2
	y1, y2 = W // 2, W % 2

	n = x1 * y1
	k = 0
	for c in counter:
		if k == n:
			break
		if counter[c] >= 4:
			k += 1
			counter[c] -= 4

	if k != n:
		print("No")
		return

	if x2 == 1:
		n = y1
		k = 0
		for c in counter:
			if k == n:
				break
			if counter[c] >= 2:
				k += 1
				counter[c] -= 2
		if k != n:
			print("No")
			return
	if y2 == 1:
		n = x1
		k = 0
		for c in counter:
			if k == n:
				break
			if counter[c] >= 2:
				k += 1
				counter[c] -= 2
		if k != n:
			print("No")
			return
	print("Yes")

foo()