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

Fixed submission:
n,m=[int(i) for i in input().split()]
x=[int(i) for i in input().split()]
x.sort()
a=[]
if m==1 or n>=m:
    print("0")
else:
    for i in range(m-1):
        a.append(x[i+1]-x[i])
    a.sort(reverse=True)
    if n==1:
        print(max(x)-min(x))
    else:
        result=0
        for i in range(n-1):
            result+=a[i]
        print(max(x)-min(x)-result)

Buggy submission (verdict: Runtime Error):
n,m=[int(i) for i in input().split()]
x=[int(i) for i in input().split()]
x.sort()
a=[]
if m==1:
    print("0")
else:
    for i in range(m-1):
        a.append(x[i+1]-x[i])
    a.sort(reverse=True)
    if n==1:
        print(max(x)-min(x))
    else:
        result=0
        for i in range(n-1):
            result+=a[i]
        print(max(x)-min(x)-result)

Buggy submission (verdict: Runtime Error):
n,m=[int(i) for i in input().split()]
x=[int(i) for i in input().split()]
x.sort()
a=[]
if m==1:
    print("0")
else:
    for i in range(m-1):
        a.append(x[i+1]-x[i])
    a.sort(reverse=True)
    result=0
    for i in range(n-1):
        result+=a[i]
    print(max(x)-min(x)-result)

Buggy submission (verdict: Runtime Error):
n,m=[int(i) for i in input().split()]
x=[int(i) for i in input().split()]
x.sort()
a=[]
if m==1:
    print("0")
else:
    for i in range(m-1):
        a.append(x[i+1]-x[i])
    a.sort(reverse=True)
    result=0
    print("0")
    for i in range(n-1):
        result+=a[i]
    print(max(x)-min(x)-result)
Problem p03209 (python)

Fixed submission:
n,x=[int(i)  for i in input().split()]
a=[1]
p=[1]
for i in range(n):
    a.append(a[i]*2+3)
    p.append(p[i]*2+1)
def f(n,x):
    if n==0:
        if x==0:
            return 0
        else:
            return 1
    elif n>=1:
        if x==1:
            return 0
        elif 1<x<=1+a[n-1]:
            return f(n-1,x-1)
        elif x==a[n-1]+2:
            return p[n-1]+1
        elif 2+a[n-1]<x<=2*a[n-1]+2:
            return p[n-1]+1+f(n-1,x-2-a[n-1])
        else:
            return 2*p[n-1]+1

print(f(n,x))

Buggy submission (verdict: Runtime Error):
n,x=[int(i) for i in input().split()]
A=["B","P","B"]
B=["P","P"]
for i in range(n):
    ans=A[0]+B[0]+A[1]+B[1]+A[2]
    B[0]=ans
    B[1]=ans
result=0
for i in range(x):
    if ans[i]=="P":
        result+=1
print(result)
Problem p02847 (python)

Fixed submission:
s=input()

if s=='SUN':
    ans='7'
elif s=='MON':
    ans='6'
elif s=='TUE':
    ans='5'
elif s=='WED':
    ans='4'
elif s=='THU':
    ans='3'
elif s=='FRI':
    ans='2'
elif s=='SAT':
    ans='1'

print(ans)

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

if s='SUN':
    ans='7'
elif s='MON':
    ans='6'
elif s='TUE':
    ans='5'
elif s='WED':
    ans='4'
elif s='THU':
    ans='3'
elif s='FRI':
    ans='2'
elif s='SAT':
    ans='1'

print(ans)
Problem p02847 (python)

Fixed submission:
week_cicle = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
day_of_week = input()
first = week_cicle.index(day_of_week)
print(7 - first)

Buggy submission (verdict: Runtime Error):
week_cicle = ["SUN, "MON", "TUE", "WED", "THU", "FRI", "SAT"]
day_of_week = input()
first = week_cicle.index(day_of_week)
print(7 - first)
Problem p02859 (python)

Fixed submission:
r = int(input())
print (r*r)

Buggy submission (verdict: Runtime Error):
r = input()
print ( r * r )
Problem p02879 (python)

Fixed submission:
a,b =  (int(x) for x in input().split())
if a<10 and b<10:
    print (a*b)
else:
    print('-1')

Buggy submission (verdict: Runtime Error):
N = int(input())
kuku= [1, 2, 3, 4, 5, 6, 7, 8, 9]
c = 0

for a in kuku:
    for b in kuku:
        if a*b == N:
            c+=1
if c>=1:
    print('Yes')
else:
    print('No')
Problem p02880 (python)

Fixed submission:
N = int(input())
kuku= [1, 2, 3, 4, 5, 6, 7, 8, 9]
c = 0

for a in kuku:
    for b in kuku:
        if a*b == N:
            c+=1
if c>=1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
kuku= [1, 2, 3, 4, 5, 6, 7, 8, 9]
c = 0

for a in kuku:
    for b in kuku:
        if a*b == N:
            c+=1
if c>=1:
    print('Yes')
else:
    print('No')
Problem p02897 (python)

Fixed submission:
a = int(input())
if (a % 2)== 0:
  result = 0.5
else:
  result = ((a-1)/2 +1)/a
  
print(result)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
def prime_number_set(n):
  N = n
  result = set()
  for i in range(2,int(N**0.5)+1):
    while n%i == 0:
      n /= i
      result.add(i)
    if n <= 1:
      break
  return result

arrayA = prime_number_set(A)
arrayB = prime_number_set(B)
array = arrayA & arrayB
print(len(array)+1)
Problem p02912 (python)

Fixed submission:
import heapq
N,M = map(int,input().split())
prices = list(map(int,input().split()))
for i in range(len(prices)):
  prices[i] *= -1

heapq.heapify(prices)
for i in range(M):
  temp = heapq.heappop(prices)
  temp *= -1
  temp //= 2
  temp *= -1
  heapq.heappush(prices,temp)

print(sum(prices)*-1)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
prices = list(map(int,input().split()))
prices.sort(reverse=True)
big = prices[:M]
small = prices[M:]

discounted = [int(big[0]/2)]
i = 1
if N > 1 and M > 1:
  temp = big[1]
  for m in range(1,M):
    for index in range(len(discounted)):
      if discounted[index]/2 > temp/2:
        discounted[index] = int(discounted[index]/2)
        break
    else:
      discounted.append(int(temp/2))
      i += 1
      temp = big[i]
else:
  for m in range(1,M):
    discounted[0] = int(discounted[0]/2)
  
result = sum(small) + sum(big[i:]) + sum(discounted)
print(result)
Problem p02859 (python)

Fixed submission:
r = int(input())

print(r * r)

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

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

print(a**)

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

print(a**)
Problem p02847 (python)

Fixed submission:
w = ['SAT', 'FRI', 'THU', 'WED', 'TUE', 'MON', 'SUN']
s = input()
for num, i in enumerate(w):
  if i == s:
    print(num+1)

Buggy submission (verdict: Runtime Error):
 ['SAT', 'FRI', 'THU', 'WED', 'TUE', 'MON', 'SUN']
s = input()
for num, i in enumerate(w):
  if i == s:
    print(num+1)

Buggy submission (verdict: Runtime Error):
 ['SAT', 'FRY', 'TUE', 'WED', 'THU', 'MON', 'SAN']
s = input()
for num, i in enumerate(w):
  if i == s:
    print(num+1)
Problem p02859 (python)

Fixed submission:
print(int(input())**2)

Buggy submission (verdict: Runtime Error):
print(input()**2)
Problem p02847 (python)

Fixed submission:
day = input()
if day == "SUN":
  print(7)
elif day == "MON":
  print(6)
elif day == "TUE":
  print(5)
elif day == "WED":
  print(4)
elif day == "THU":
  print(3)
elif day == "FRI":
  print(2)
elif day == "SAT":
  print(1)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
day = input()
if day == "SUN":
  return 7
elif day == "MON":
  return 1
elif day == "TUE":
  return 2
elif day == "WED":
  return 3
elif day == "THU":
  return 4
elif day == "FRI":
  return 5
elif day == "SAT":
  return 6
else:
  return -1
Problem p03077 (python)

Fixed submission:
import numpy as np
#int(input())
n=int(input())
ae=[]
for _ in range(5):
    ae.append(int(input()))
ae=np.array(ae)
min_ae=min(ae)
num_ae=-(-n//ae)-1
#num_ae=-(-ae//min_ae)
print(5+max(num_ae))

Buggy submission (verdict: Runtime Error):
import numpy as np
#int(input())
n=int(input())
ae=[]
for _ in range(n):
    ae.append(int(input()))
ae=np.array(ae)
min_ae=min(ae)
num_ae=-(-n//ae)-1
#num_ae=-(-ae//min_ae)
print(5+max(num_ae))
Problem p03107 (python)

Fixed submission:
S=input()
num_one=S.count('1')
num_zero=S.count('0')
ans = 2*min(num_one,num_zero)
print(ans)

Buggy submission (verdict: Runtime Error):
def pickup(S,ans):
    l = len(S)
    if l<2:
        return ans
    for i in range(l-1):
        if S[i] != S[i+1]:
            S.pop(i)
            S.pop(i)
            check_dif = True
            ans += pickup(S,ans)
            break
    if check_dif:
        ans+=2
    return ans   
S=input()
l = len(S)
S_list = [S[i] for i in range(l)]
ans =0
print(pickup(S_list,ans))

Buggy submission (verdict: Runtime Error):
def pickup(S,ans):
    l = len(S)
    if l<2:
        return ans
    for i in range(l-1):
        if S[i] != S[i+1]:
            S.pop(i)
            S.pop(i)
            ans += pickup(S,ans)
            return ans+2
S=input()
l = len(S)
S_list = [S[i] for i in range(l)]
ans =0
print(pickup(S_list,ans))

Buggy submission (verdict: Runtime Error):
def pickup(S,ans):
    l = len(S)
    if l<2:
        return ans
    check_dif = False
    #print(S)
    for i in range(l-1):
        if S[i] != S[i+1]:
            S.pop(i)
            S.pop(i)
            #print(S)
            check_dif = True
            ans += pickup(S,ans)
            break
    if check_dif:
        ans+=2
    return ans   
S=input()
l = len(S)
S_list = [S[i] for i in range(l)]
ans =0
print(pickup(S_list,ans))

Buggy submission (verdict: Runtime Error):
def pickup(S,ans):
    l = len(S)
    if l<2:
        return ans
    check_dif = False
    #print(S)
    for i in range(l-1):
        if S[i] != S[i+1]:
            S.pop(i)
            S.pop(i)
            #print(S)
            check_dif = True
            ans += pickup(S,ans)
            break
    if not check_dif:
        return ans
    else:
        return ans+2
    
S=input()
l = len(S)
S_list = [S[i] for i in range(l)]
ans =0
print(pickup(S_list,ans))

Buggy submission (verdict: Runtime Error):
def pickup(S,ans):
    l = len(S)
    if l<2:
        return ans
    check_dif = False
    #print(S)
    for i in range(l-1):
        if i+1
        if S[i] != S[i+1]:
            S.pop(i)
            S.pop(i)
            #print(S)
            check_dif = True
            ans += pickup(S,ans)
            break
    if not check_dif:
        return ans
    else:
        return ans+2
    
S=input()
l = len(S)
S_list = [S[i] for i in range(l)]
ans =0
print(pickup(S_list,ans))

Buggy submission (verdict: Runtime Error):
def pickup(S,ans):
    l = len(S)
    if l<2:
        return ans
    check_dif = False
    #print(S)
    for i in range(l-1):
        if S[i] != S[i+1]:
            S.pop(i)
            S.pop(i)
            #print(S)
            check_dif = True
            ans += pickup(S,ans)
            break
    if not check_dif:
        return ans
    else:
        return ans+2
    
S=input()
S_list = []
l = len(S)
for i in range(l):
    S_list.append(S[i])
ans =0
print(pickup(S_list,ans))
Problem p03209 (python)

Fixed submission:
def L(N):
    if N==0:
        return 1
    else:
        prev_L = L(N-1)
        return 1+prev_L+1+prev_L+1
def numP(N):
    if N==0:
        return 1
    else:
        prev_P = numP(N-1)
        return 2*prev_P+1
def eated_P(N,X):
    ans = 0
    fh=int(L(N)/2)
    if X<=0:
        return 0
    elif N==0:
        return 1
    elif fh<X:
        ans = numP(N-1)+1+eated_P(N-1,X-fh-1)
        return ans
    else:
        rem = X-1
        ans = eated_P(N-1,rem)
        return ans
N,X = map(int,input().split())
print(eated_P(N,X))

Buggy submission (verdict: Runtime Error):
def L(N):
    if N==0:
        return 1
    else:
        prev_L = L(N-1)
        return 1+prev_L+1+prev_L+1
def numP(N):
    if N==0:
        return 1
    else:
        prev_P = numP(N-1)
        return 2*prev_P+1
def eated_P(N,X):
    ans = 0
    fh=int(L(2)/2)
    if X==0:
        return 0
    elif N==0:
        return 1
    elif fh<X:
        ans = numP(N-1)+1+eated_P(N-1,X-fh-1)
        return ans
    else:
        ans = eated_P(N-1,X-N-1)
        return ans
N,X = map(int(), input().split())
print(eated_P(N,X))
Problem p02847 (python)

Fixed submission:
inputs = input()
num = 0
if inputs == "SUN":
    num = 7
elif inputs == "MON":
    num = 6
elif inputs == "TUE":
    num = 5
elif inputs == "WED":
    num = 4
elif inputs == "THU":
    num = 3
elif inputs == "FRI":
    num = 2
elif inputs == "SAT":
    num = 1

print(num)

Buggy submission (verdict: Runtime Error):
import math as ma
inputs = input().split(" ")
A = int(inputs[0])
B = int(inputs[1])
X = int(inputs[2])

# １桁
max_num = 0
for x in range(1, 19):
    k = ma.floor((X - x*B) / A)
    # print(x, k)
    if len(list(str(k))) == x:
        max_num = k
        break
    elif len(list(str(k))) < x:
        break
    elif len(list(str(k))) > x:
        pass
if max_num > 1000000000:
    max_num = 1000000000
print(max_num)
Problem p02860 (python)

Fixed submission:
def samestring():
  N=int(input())
  S=list(input())
  if N % 2 != 0:
    print('No')
  else:
    S1 = S[0:int(N/2)]
    S2 = S[int(N/2):]

    if S1 == S2:
      print('{}'.format('Yes'))
    else:
      print('{}'.format('No'))

samestring()

Buggy submission (verdict: Runtime Error):
def samestring():
  N=int(input())
  S=list(input())
  if N % 2 != 0:
    print('No')
  else:
    S1 = S[0:int(N/2)]
    S2 = S[int(N/2):]

  if S1 == S2:
    print('{}'.format('Yes'))
  else:
    print('{}'.format('No'))

samestring()
Problem p02880 (python)

Fixed submission:
N = int(input())
ans = 'No'
for i in range(9):
    q, mod = divmod(N, i+1)
    if mod == 0:
        if q <= 9:
            ans = 'Yes'
            break
print(ans)

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

ans = -1

if A <= 9:
    if B <= 9:
        ans = A * B

print(ans)
Problem p02860 (python)

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

# 整数 > 整数型
def I(): return int(input())

# 整数列 '1 2 3 4' > 整数型リスト
def IsIl(): return list(map(lambda x: int(x), input().split()))

# 改行挟む整数列　'1/n 2/n 3/n' > 整数型りすと
def InIl(n): return [input() for i in range(n)]

# 整数列 '1 2' > 整数型タプル
def IsIt(): return map(lambda x: int(x), input().split())

# 改行挟む整数列　'1\n 2\n 3\n' > 整数型たぷる
def InIl(n): return map(input() for i in range(n))

# 文字列 'abcd' > 文字型リスト
def SsSl(): return list(map(lambda x: x, input()))

# 整数 '1234' > 整数型リスト

# 文字列 'aba' > 辞書（文字型:個数）{'a':2,'b':1}
def SSd():
    from collections import defaultdict
    A = input() # [int(i) for i in input().split()]
    dd=defaultdict(int)
    for a in A:
        dd[a]+=1
    return dd

#リストにn個要素を読み込む

# その他アルゴリズムテンプレート
# https://qiita.com/chun1182/items/ddf2b6cba932b2bb0d4e
n = int(input())

string = input()

if n%2 != 0:
  print('No')
else:
  if string[:int(n/2)] == string[int(n/2):]:
    print('Yes')
  else:
    print('No')

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

string = input()

if n%2 /= 0:
  print('No')
else:
  if string[:n/2] == string[n/2:]:
    print('Yes')
  else:
    print('No')
Problem p02847 (python)

Fixed submission:
week = ['SUN','MON','TUE','WED','THU','FRI','SAT']
x = input()
print(7-week.index(x))

Buggy submission (verdict: Runtime Error):
week = ['SUN','MON','TUE','WED','THU','FRI','SAT']
x = input()
week.index(x)
print(7-x)
Problem p02847 (python)

Fixed submission:
S=input()
if S=="SUN":
  print(7)
elif S=="MON":
  print(6)
elif S=="TUE":
  print(5)
elif S=="WED":
  print(4)
elif S=="THU":
  print(3)
elif S=="FRI":
  print(2)
elif S=="SAT":
  print(1)

Buggy submission (verdict: Runtime Error):
A,B,X=map(int,input().split())
a=[]
for i in range(1,11):
  rest=X-B*i
  if rest>0 and len(str(int(rest/A)))==i:
      a.append(rest//A)
a.sort()
if a==[]:
    print(0)
else:
    print(a[len(a)-1])

Buggy submission (verdict: Runtime Error):
A,B,X=map(int,input().split())
a=[]
for i in range(1,10):
  rest=X-B*i
  if rest>0 and len(str(int(rest/A)))==i:
      a.append(rest//A)
a.sort()
if a==[]:
    print(0)
else:
    print(a[len(a)-1])

Buggy submission (verdict: Runtime Error):
S=input()
if S="SUN":
  print(7)
elif S="MON":
  print(6)
elif S="TUE":
  print(5)
elif S="WED":
  print(4)
elif S="THU":
  print(3)
elif S="FRI":
  print(2)
elif S="SAT":
  print(1)
Problem p02860 (python)

Fixed submission:
N=int(input())
S=input()
if N%2!=0:
  print("No")
else:
  half=N//2-1
  T1=[]
  T2=[]
  for i in range(half+1):
    T1.append(S[i])
  for j in range(half+1,len(S)):
    T2.append(S[j])
  if T1==T2:
      print("Yes")
  else:
      print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
count=0
if N%2!=0:
  print("No")
else:
  for i in range(len(S)/2):
    if S[i]!=S[len(S)/2+i]:
      print("No")
      break
    count+=1
  if count==len(S)/2:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
count=0
if N%2!=0:
  print("No")
else:
  for i in range(len(S)/2):
    if S[i]!=S[len(S)/2+i]:
      print("No")
      break
    count+=1
  if count=len(S)/2:
    print("Yes")
Problem p02879 (python)

Fixed submission:
A,B=map(int,input().split())
if A<=9 and B<=9:
  print(A*B)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
A,B=map(int.input(),split())
if A<=9 and B<=9:
  print(A*B)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input(),split())
if A<=9 and B<=9:
  print(A*B)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input(),split())
if A,B<=9:
  print(A*B)
else:
  print(-1)

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

if A,B<=9:
  print(A*B)
else:
  print(-1)
Problem p02881 (python)

Fixed submission:
n=int(input())
end=int(n**(1/2))
for i in range(end,0,-1):
  if n%i==0:
    j=n//i
    print(i+j-2)
    break

Buggy submission (verdict: Runtime Error):
n=int(input())
end=n**(1/2)
for i in range(end,0,-1):
  if n%i==0:
    j=n//i
    print(i+j-2)
    break

Buggy submission (verdict: Runtime Error):
n=int(input())
end=n**(1/2)
for i in range(end,1,-1):
  if n%i==0:
    j=n//i
    print(i*j-2)
    break
Problem p02860 (python)

Fixed submission:
N = input()
row = input()
unit1, unit2 = row[:len(row)//2], row[len(row)//2:]
if unit1 == unit2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N, row = input().split()
unit1, unit2 = row[:len(row)//2], row[len(row)//2:]
if unit1 == unit2:
    print('Yes')
else:
    print('No')
Problem p02862 (python)

Fixed submission:
def multiple_of_n(x, y, n=3):
    return (x - y) % n == 0

def combination(g1, g2, inverse, n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min([r, n - r])
    return g1[n] * g2[r] * g2[n - r] % mod

def make_inv(mod, N):
    g1 = [1, 1]
    g2 = [1, 1]
    inverse = [0, 1]
    for i in range(2, N + 1):
        g1.append((g1[-1] * i) % mod)
        inverse.append((- inverse[mod % i] * (mod // i)) % mod)
        g2.append((g2[-1] * inverse[-1]) % mod)
    return g1, g2, inverse

mod = 10 ** 9 + 7

x, y = map(int, input().split())
if multiple_of_n(2 * x, y) and multiple_of_n(2 * y, x):
    vertical = (2 * y - x) // 3
    horizontal = (2 * x - y) // 3
    total = vertical + horizontal
    g1, g2, inverse = make_inv(mod, total)
    print(combination(g1, g2, inverse, total, horizontal, mod))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from functools import reduce

def combination(n, r):
    return reduce(lambda x, y: x * y, range(n - r, n + 1)) // reduce(lambda x, y: x * y, range(1, r + 1))
eps = 10**9 + 7

x, y = map(int, input().split())
if (2 * x - y) % 3 != 0 or (2 * y - x) % 3 != 0:
    print(0)
elif 2 * y - x < 0 or 2 * x - y < 0:
    print(0)
else:
    vertical = (2 * y - x) // 3
    horizontal = (2 * x - y) // 3
    total = vertical + horizontal
    print(int(combination(total, horizontal) % eps))

Buggy submission (verdict: Runtime Error):
def factrial(n):
    if n == 1:
        return 1
    else:
        return n * factrial(n - 1)

def combination(n, r):
    return factrial(n) // (factrial(n - r) * factrial(r))

x, y = map(int, input().split())
if (2 * x - y) % 3 != 0 or (2 * y - x) % 3 != 0:
    print(0)
# elif 2 * y - x < 0 or 2 * x - y < 0:
#     print(0)
else:
    vertical = (2 * y - x) // 3
    horizontal = (2 * x - y) // 3
    total = vertical + horizontal
    print(combination(total, horizontal))

Buggy submission (verdict: Runtime Error):
def factrial(n):
    if n == 1:
        return 1
    else:
        return n * factrial(n - 1)

def combination(n, r):
    return factrial(n) // (factrial(n - r) * factrial(r))

x, y = map(int, input().split())
if (2 * x - y) % 3 != 0 or (2 * y - x) % 3 != 0:
    print(0)
elif 2 * y - x < 0 or 2 * x - y < 0:
    print(0)
else:
    vertical = (2 * y - x) // 3
    horizontal = (2 * x - y) // 3
    total = vertical + horizontal
    print(combination(total, horizontal))

Buggy submission (verdict: Runtime Error):
def factrial(n):
    if n == 1:
        return 1
    else:
        return n * factrial(n - 1)

def combination(n, r):
    return factrial(n) // (factrial(n - r) * factrial(r))

x, y = map(int, input().split())
if (x - y) % 3 != 0:
    print(0)
elif 2 * y - x < 0 or 2 * x - y < 0:
    print(0)
else:
    vertical = (2 * y - x) // 3
    horizontal = (2 * x - y) // 3
    total = vertical + horizontal
    print(combination(total, horizontal))
Problem p03013 (python)

Fixed submission:
def main():
    n,m = map(int, input().split())
    stairs = [1]*(n+1)
    mod = 1000000007
    for _ in range(m):
        stairs[int(input())] = 0
    for i in range(2, n+1):
        stairs[i] = (stairs[i-2] + stairs[i-1]) * stairs[i]
    print(stairs[n] % mod)
    
if __name__ == '__main__':
    main()

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

def fib(n):
    if n == 0:
        return 0
    else:
        a0 = 0
        a1 = 1
        for i in range(n-1):
            b = a1
            a1 += a0
            a0 = b
        return a1

count = 1
b = 0
for i in range(m):
    a = int(input())
    if a == 1:
        b = 1
        continue
    if num == 1:
        count *= 0
        break
    if b == 0:
        num = a - b
    else:
        num = a - b - 1
    count *= fib(num)
    b = a 
#     print(b, count, num)
    
count *= fib(n - b)

print(count%1000000007)
Problem p02847 (python)

Fixed submission:
s = input()
lst = ['SUN','MON','TUE','WED','THU','FRI','SAT']

for i in range(len(lst)):
  if lst[i] == s:
    print(7 - i)

Buggy submission (verdict: Runtime Error):
s = input()
lst = ['SUN','MON','TUE','WED','THU','FRI','SAT']

for i in range(len(lst)):
  if lst[i] = s:
    print(7 - i)
Problem p02860 (python)

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

if N % 2 ==1:
    print("No")
else:
    if S[:int(N/2)]==S[int(N/2):]:
        print("Yes")
    else:
        print("No")

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

if N % 2 ==1:
    print("No")
else:
    if S[:int(N/2)]==S[int(N/2):]:
        print("Yes")
    else:
        print("No")

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

if N % 2 ==1:
  print("No")
else:
  if S[:int(N/2)]==S[int(N/2):]:
    print("Yes")
  else:
    print("No")
Problem p02987 (python)

Fixed submission:
S = input()

if (S[0] == S[1] and S[1] != S[2] and S[2] ==S[3]):
    print('Yes')
elif (S[0] == S[2] and S[2] != S[1] and S[1] == S[3]):
    print('Yes')
elif (S[0] == S[3] and S[3] != S[1] and S[1] == S[2]):
    print('Yes')
else:
    print('No')

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

li = S.split()
if ((li[0] == li[1] and li[2] ==li[3]) or (li[0] == li[2] and li[1] == li[3])
    or (li[0] ==li[3] and li[1] == li[2]):
    print('Yes')
else:
    print('No')