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

Fixed submission:
H,W,K=map(int,input().split())
if W==1:
    print(1)
    quit()

INF=1e9+7
dp=[[0]*W for i in range(H+1)]
dp[0][0]=1
d=W-1
a=max(0,d-1)
b=max(0,d-2)
f=max(0,d-3)
dic={0:0,1:1,2:2,3:4,4:7,5:12,6:20}
a=dic[a]+1
b=dic[b]+1
f=dic[f]+1
def func(w):
    c=dic[w-1]+1
    e=dic[d-w-1]+1
    return c*e
def func1(w):
    c=dic[w-1-1]+1
    e=dic[d-w-1]+1
    return c*e
def func2(w):
    c=dic[w-1]+1
    e=dic[d-w-1-1]+1
    return c*e
for i in range(H):
    for w in range(W):
        if w==0:
            dp[i+1][w]=(dp[i][w]*a)+(dp[i][w+1]*b)
            dp[i+1][w]%=INF
        elif w==W-1:
            dp[i+1][w]=(dp[i][w]*a)+(dp[i][w-1]*b)
            dp[i+1][w]%=INF
        elif w==1 :
            dp[i+1][w]=(dp[i][w]*b)+(dp[i][w-1]*b)+(dp[i][w+1]*f)
            dp[i+1][w]%=INF
        elif w==W-2:
            dp[i+1][w]=(dp[i][w]*b)+(dp[i][w-1]*f)+(dp[i][w+1]*b)
            dp[i+1][w]%=INF
        else:
            dp[i+1][w]=(dp[i][w]*func(w))+(dp[i][w-1]*func1(w))+(dp[i][w+1]*func2(w))
            dp[i+1][w]%=INF

print(int(dp[H][K-1]%INF))

Buggy submission (verdict: Runtime Error):
H,W,K=map(int,input().split())
if W==1:
    print(1)
    quit()

INF=1e9+7
dp=[[0]*W for i in range(H+1)]
dp[0][0]=1
d=W-1
a=max(0,d-1)
b=max(0,d-2)
dic={0:0,1:1,2:2,3:4,4:7,5:12,6:20}
a=dic[a]+1
b=dic[b]+1
def func(w):
    c=dic[w-1]+1
    e=dic[d-w-1]+1
    return c*e
def func1(w):
    c=dic[w-1-1]+1
    e=dic[d-w-1]+1
    return c*e
def func2(w):
    c=dic[w-1]+1
    e=dic[d-w-1-1]+1
    return c*e
for i in range(H):
    for w in range(W):
        if w==0:
            dp[i+1][w]=(dp[i][w]*a)+(dp[i][w+1]*b)
            dp[i+1][w]%=INF
        elif w==W-1:
            dp[i+1][w]=(dp[i][w]*a)+(dp[i][w-1]*b)
            dp[i+1][w]%=INF
        elif w==1 :
            dp[i+1][w]=(dp[i][w]*b)+(dp[i][w-1]*b)+(dp[i][w+1]*func2(w))
            dp[i+1][w]%=INF
        elif w==W-2:
            dp[i+1][w]=(dp[i][w]*b)+(dp[i][w-1]*func1(w))+(dp[i][w+1]*b)
            dp[i+1][w]%=INF
        else:
            dp[i+1][w]=(dp[i][w]*func(w))+(dp[i][w-1]*func1(w))+(dp[i][w+1]*func2(w))
            dp[i+1][w]%=INF

print(int(dp[H][K-1]%INF))
Problem p03265 (python)

Fixed submission:
#S=input()
#N=int(input())
x1,y1,x2,y2=map(int,input().split())
x3=x2-(y2-y1)
y3=y2+(x2-x1)
x4=x3-(y3-y2)
y4=y3+(x3-x2)
print(x3," ",y3," ",x4," ",y4)

Buggy submission (verdict: Runtime Error):
import numpy as np
x1,y1,x2,y2=map(int,input().split())
p1=np.array([x1,y1])
p2=np.array([x2,y2])
d=p2-p1
d=np.array([-d[1],d[0]])
p3=p2+d
d=np.array([-d[1],d[0]])

p4=p3+d
x3=p3[0]
y3=p3[1]
x4=p4[0]
y4=p4[1]
print(x3,y3,x4,y4)
Problem p03286 (python)

Fixed submission:
N=int(input())
if N==0:
    print(0)
    quit()
S=""
i=0
while(N):
    if (N-(-2)**i)%2**(i+1)==0:
        S+="1"
        N-=(-2)**i
    else:
        S+="0"
    i+=1
S=S[::-1]
I=False
t=0
for i in S:
    if i=="1":
        break
    else:
        t+=1
print(S[t:])

Buggy submission (verdict: Runtime Error):
while(N):
    if (N-1)%(-2)==0:
        ans+="1"
        N-=1
        N//=(-2)

    else:
        ans+="0"
        N//=(-2)

print(ans[::-1])
Problem p03426 (python)

Fixed submission:
from math import ceil
H,W,D=map(int,input().split())
A=[[0]*(int(ceil(H*W/D))) for i in range(D)]
for i in range(H):
    Ai=list(map(int,input().split()))
    for j in range(W):
        A[(Ai[j]-1)%D][(Ai[j]-1)//D]=(i,j)
B=[[0]*(int(ceil(H*W/D))+1) for i in range(D)]
for j in range(D):
    for i in range(len(A[j])):
        if  type(A[j][i])!=type((0,0)):
            #B[j][i+1]=B[j][i]
            break
        if i==0:
            B[j][i+1]=A[j][i][0]+A[j][i][1]
            continue
        B[j][i+1]=B[j][i]+abs(A[j][i-1][0]-A[j][i][0])+abs(A[j][i-1][1]-A[j][i][1])
Q=int(input())
for _ in range(Q):
    L,R=map(int,input().split())
    L,R=L-1,R-1
    print(B[R%D][R//D+1]-B[L%D][L//D+1])

Buggy submission (verdict: Runtime Error):
from math import ceil
H,W,D=map(int,input().split())
A=[[0]*(int(ceil(H*W/D))) for i in range(D)]
for i in range(H):
    Ai=list(map(int,input().split()))
    for j in range(W):

        A[Ai[j]%D][Ai[j]//D]=(i,j)
A[0][0]=(0,0)
B=[[0]*(int(ceil(H*W/D))) for i in range(D)]
for j in range(D):
    for i in range(len(A[0])-1):
        if type(A[j][i+1])!=type((0,0)):
            B[j][i+1]=B[j][i]
            continue
        B[j][i+1]=B[j][i]+abs(A[j][i][0]-A[j][i+1][0])+abs(A[j][i][1]-A[j][i+1][1])
Q=int(input())
for _ in range(Q):
    L,R=map(int,input().split())
    print(B[R%D][R//D]-B[L%D][L//D])

Buggy submission (verdict: Runtime Error):
H,W,D=map(int,input().split())
A=[[0]*(int(ceil(H*W/D))) for i in range(D)]
for i in range(H):
    Ai=list(map(int,input().split()))
    for j in range(W):

        A[Ai[j]%D][Ai[j]//D]=(i,j)
A[0][0]=(0,0)
B=[[0]*(int(ceil(H*W/D))) for i in range(D)]
for j in range(D):
    for i in range(len(A[0])-1):
        if type(A[j][i+1])!=type((0,0)):
            B[j][i+1]=B[j][i]
            continue
        B[j][i+1]=B[j][i]+abs(A[j][i][0]-A[j][i+1][0])+abs(A[j][i][1]-A[j][i+1][1])
Q=int(input())
for _ in range(Q):
    L,R=map(int,input().split())
    print(B[R%D][R//D]-B[L%D][L//D])
Problem p03805 (python)

Fixed submission:
import itertools

N,M=map(int,input().split())
ab=[]
for i in range(M):
    a,b=map(int,input().split())
    ab.append([a,b])

per=[i for i in range(2,N+1)]
permu=[]
for i in itertools.permutations(per):
    lst=[1]
    lst.extend(i)
    permu.append(lst)
num=0
for lst in permu:
    can=True
    for i in range(N-1):
        if not([lst[i],lst[i+1]] in ab) and not([lst[i+1],lst[i]] in ab):
            can=False
            break
    if can:
        num+=1
print(num)

Buggy submission (verdict: Runtime Error):
import itertools

N,M=map(int,input().split())
ab=[]
for i in range(N):
    a,b=map(int,input().split())
    ab.append([a,b])

per=[i for i in range(2,N+1)]
permu=[]
for i in itertools.permutations(per):
    lst=[1]
    lst.extend(i)
    permu.append(lst)
num=0
for lst in permu:
    can=True
    for i in range(N-1):
        if not([lst[i],lst[i+1]] in ab) and not([lst[i+1],lst[i]] in ab):
            can=False
            break
    if can:
        num+=1
print(num)
Problem p03017 (python)

Fixed submission:
N,A,B,C,D = map(int,input().split())
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1

Ans = step(A,C) and step(B,D)
 
if C > D:
    pass_path = False
    for b in range(B-1,D):
        if S[b] == '#':
            continue
        if S[b-1] == '.' and S[b+1] == '.':
            pass_path = True
            break
    Ans = step(A,C) and step(B,D) and  pass_path


if Ans == True:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,A,B,C,D = map(int,input().split())
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1
 
 

if C > D:
    pass_path = False
    for b in range(B-1,D):
        if S[b] == '#':
            continue
        if S[b-1] == '.' and S[b+1] == '.':
            pass_path = True
            break


if step(A,C) and step(B,D)  and pass_path == True:
    print('Yes')
else:
    print('No')
if step(A,C) and step(B,D)  and pass_path == True:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,A,B,C,D = map(int,input().split())
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1
 
 
pass_path = False
if C > D:
    for b in range(B-1,D):
        if S[b-1] == '.' and S[b+1] == '.':
             path_pass = True
            continue
        elif S[b] == '#':
            break

if step(A,C) and step(B,D)  and pass_path == True:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1
 
 
pass_path = True

if C > D:
    for b in range(B-1,D):
        if S[b-1] == '.' and S[b+1] == '.':
            continue
        elif S[b] == '#':
            path_pass = False
            break

if step(A,C) and step(B,D)  and pass_path == True:
    print('Yes')
else:
    print('No')
Problem p03835 (python)

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

count = 0
for i in range(K+1):
  for j in range(K+1):
    if  0 <= S - i - j <= K:
      count += 1
print(count)

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

count = 0
for i in range(K+1):
  for j in range(K+1):
    for k in range(K+1):
      if i + J + K == S:
        count += 1

print(count)
Problem p02984 (python)

Fixed submission:
N = int(input())
A =[int(x) for x in input().split()]

sum = 0
for i in range(N):
  sum+=A[i]
X =[0 for x in range(N)]
sum2=0
i=1
while i < N:
  sum2+=A[i]
  i+=2
X[0]=sum-sum2*2

for i in range(1,N):
  X[i]=2*A[i-1]-X[i-1]
for i in range(N):
  X[i]=str(X[i])
print(" ".join(X))

Buggy submission (verdict: Runtime Error):
N = int(input())
A =[int(x) for x in input().split()]

sum = 0
for i in range(N):
  sum+=A[i]
X =[0 for x in range(N)]
sum2=0
i=1
while i < N:
  sum2+=A[i]
  i+=2
X[0]=sum-sum2

for i in range(1,N):
  X[i]=2*A[i-1]-X[i-1]
for i in range(N):
  X[i]=string(X[i])
print(" ".join(X))
Problem p02987 (python)

Fixed submission:
S = input()
l =[S[0]]
for i in S:
  if i not in l:
    l.append(i)
if len(l)==2:
  count1=0
  for i in range(4):
    for j in range (4):
      if S[i]==S[j]:
        count1+=1
  if count1 ==8:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input()
count1=1
count2=0
for i in range(4):
  if S[i] == S[0] :
    count1++
  else:
    count2++
    
if count2==2 and count1 ==2:
  print("Yes")
else:
  print("No")
Problem p02990 (python)

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

mod = 10**9+7
n = N-K+1
print(n)
for i in range(2,K+1):
  n = n * (N-K+2-i)*(K+1-i)//(i*(i-1))
  print(n%mod)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
def pascal(N,K):
  if N == K+1 or K==1:
    return N
  elif K==0 or N==K:
    return 1
  else: return pascal(N-1,K) + pascal(N-1,K-1)
mod = 10**9+7
x=0
for i in range(1,K+1):
  x = pascal(N-K+1,i)*pascal(K-1,i-1)
  print(x%mod)
Problem p03011 (python)

Fixed submission:
P,Q,R=map(int, input().split())
s=[]
s.append(P)
s.append(Q)
s.append(R)
s.sort()
print(s[0]+s[1])

Buggy submission (verdict: Runtime Error):
s=map(int, input().split())
for i in range(3):
    s[i]=int(s[i])
s.sort()
print(s[0]+s[1])
Problem p02948 (python)

Fixed submission:

from heapq import *
n, m = map(int, input().split())

j = []
for _ in range(n):
    a,b = map(int, input().split())
    if a <= m :
        j.append((a,b))
j.sort(reverse=True)

ans = 0
q = []
for i in range(1, m+1):
    while j and j[-1][0] <= i:
        a,b = j.pop()
        heappush(q, -b)
    if q:
        ans -= heappop(q)
print(ans)

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

j = []
for _ in range(n):
    a,b = map(int, input().split())
    if a <= m :
        j.append([a,b])
j.sort(reverse=True)
p = 0
temp = []
for i in range(1, m+1):
    while j and j[-1][0] <= i:
        a,b = j.pop()
        temp.append(b)
    p+=max(temp)
    temp.remove(max(temp))
print(p)

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

j = []
for _ in range(n):
    a,b = map(int, input().split())
    if a <= m :
        j.append([a,b])
j.sort()
p = 0
temp = []
for i in range(1, m+1):
    while j and j[0][0] <= i:
        a,b = j.pop(0)
        temp.append(b)
    p+=max(temp)
    temp.remove(max(temp))
print(p)

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

j = []
for _ in range(n):
  a,b = map(int, input().split())
  if a <= m :
    j.append([a,b])

j.sort()
p = 0
temp = []
for i in range(1, m+1):
  while j and j[0][0] <= i:
      a,b = j.pop(0)
      temp.append(b)
  p+=max(temp)
  temp.remove(max(temp))
print(p)
Problem p03250 (python)

Fixed submission:
str = input().split(" ")
str.sort(reverse=True)
print(int(str[0] + str[1]) + int(str[2]))

Buggy submission (verdict: Runtime Error):
l = input().split(" ").sort()
print(int(l[0] + l[1]) + int(l[2])
Problem p03315 (python)

Fixed submission:
val = 0
for s in list(input()):
  if(s == "+"):
    val+=1
  else:
    val-=1
print(val)

Buggy submission (verdict: Runtime Error):
val = 0
for s in list(input()):
  if(s == '+'):
    val++
  else:
    val--
print(val)

Buggy submission (verdict: Runtime Error):
val = 0
for s in input():
  if(s == '+'):
    val++
  else:
    val--
print(val)
Problem p03327 (python)

Fixed submission:
if(int(input()) < 1000):
  print("ABC")
else:
  print("ABD")

Buggy submission (verdict: Runtime Error):
if(int(input()) 1000):
  print("ABC")
else:
  print("ABD")
Problem p02951 (python)

Fixed submission:

N = input()

A = int(N.split()[0])
B = int(N.split()[1])
C = int(N.split()[2]) 

D = A-B

if D<C:
    print(C-D)

else:
    print(0)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug  8 23:12:25 2019

@author: kohei
"""

N = input()

A = N.split()[0]
B = N.split()[1]
C = N.split()[2] 

print(C-A+B)
Problem p02948 (python)

Fixed submission:
from heapq import heappush,heappop
N, M = map(int, input().split())

X = []

for _ in range(N):
    a, b = map(int, input().split())
    if a <= M:
        X.append((a,b))


X = sorted(X, key=lambda x:(x[0], x[1]), reverse=True)

# print(X)
q = []
ans = 0
for i in range(1, M + 1):
    while X and X[-1][0] <= i:
        _, b = X.pop()
        heappush(q, -b)
    if q:
        ans -= heappop(q)
        
print(ans)

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

X = []

i = 0
while i < N:
    X.append(list(map(int, input().split())))
    i += 1

X = np.asarray(X)

X_ind = np.lexsort((X[:,0], -X[:,1]), axis=0)[::-1]
X = X[X_ind]
# print(X)
least = M - 1
p = 0
while least >= 0:
    last, X = X[-1], X[:-1]
    # print(last, X)
    if (M - least) >= last[0]:
        p += last[1]
        least -= 1

print(p)
Problem p03107 (python)

Fixed submission:
L = list(input())
L_ = []
a = L.pop(0)
cnt = 0

while True:
    if len(L) == 0:
        break
    else:
        b = L.pop(0)
    if a is not b:
        cnt += 1
        if len(L_) != 0:
            a = L_.pop()
        elif len(L) == 0:
            break  
        else:
            a = L.pop(0)
    elif a is b:
        L_.append(a)
        a = b
    # print(L_, a,  L)

print(cnt * 2)

Buggy submission (verdict: Runtime Error):
L = list(input())
L_ = []
a = L.pop(0)
cnt = 0

while True:
    if len(L) == 0:
        break
    else:
        b = L.pop(0)
    if a is not b:
        cnt += 1
        if len(L_) != 0:
            a = L_.pop()
        else:
            a = L.pop(0)
    elif a is b:
        L_.append(a)
        a = b
    # print(L_, a,  L)

print(cnt * 2)

Buggy submission (verdict: Runtime Error):
L = list(input())
L_ = []
a = L.pop(0)
cnt = 0

while True:
    if len(L) == 0:
        break
    else:
        b = L.pop(0)
    if a is not b:
        cnt += 1
        L = L_ + L
        L_ = []
        a = L.pop(0)
    elif a is b:
        L_.append(a)
        a = b
    # print(L_, a,  L)

print(cnt * 2)
Problem p02951 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(str(max(c-a+b,0)))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(str(max(c-a+b,0))
Problem p02951 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a, b, c = map(int, input().split())
# 文字列の入力
# 出力
print("{}".format(c-(a-b) if (c-(a-b)) > 0 else 0))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a, b, c = map(int, input().split())
# 文字列の入力
s = input()
# 出力
print("{}".format(c-(a-b)))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
a, b, c = map(int, input().split())
print("{}".c-(a-b))
Problem p02948 (python)

Fixed submission:
from collections import deque
import heapq

n, m = map(int, input().split(' '))
works = [[] for _ in range(100001)]

for i in range(n):
    a, b = map(int, input().split(' '))
    works[a].append(b)

ans = 0
h = []
for day in range(1, m + 1):
    for gain in works[day]:
        heapq.heappush(h, -gain)


    if h:
        gain = -heapq.heappop(h)
        ans += gain


print(ans)

Buggy submission (verdict: Runtime Error):
import heapq

n, m = map(int, input().split(' '))
works = [[] for _ in range(100001)]

for i in range(n):
    a, b = map(int, input().split(' '))
    heapq[a].append(b)

ans = 0
h = []
for day in range(1, m + 1):
    for gain in works[day]:
        heapq.heappush(h, -gain)

    if h:
        gain = -heapq.heappop(h)
        ans += gain

print(ans)
Problem p02951 (python)

Fixed submission:
A,B,C=map(int,input().split())
can=(A-B)
if (C-can)>0:
    print(C-can)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
A,B,C=map(input().split())
can=(A-B)
if (C-can)>0:
    print(C-can)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
A,B,C=map(input().strip())
can=(A-B)
if (C-can)>0:
    print(C-can)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
A,B,C=map(input().strip())
print(C-A+B)
Problem p02987 (python)

Fixed submission:
s = input()

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

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
dif = np.array(list(map(int, input().split())))
divide = 0
for k in range(min(dif), max(dif)+1):
    count_over = 0
    count_under = 0
    for i in range(len(dif)):
        if dif[i] >= k:
            count_over += 1
        else:
            count_under += 1
    if count_over == count_under:
        divide += 1
print(divide)
Problem p02987 (python)

Fixed submission:
letters = list(input())
x = 1
for letter in letters:
        if letters.count(letter) == 2:
            x *= 1
        else:
            x *= 0
print(["No","Yes"][x])

Buggy submission (verdict: Runtime Error):
while True:
    letters = list(input())
    x = 1
    for letter in letters:
        if letters.count(letter) == 2:
            x *= 1
        else:
            x *= 0
    print(["No","Yes"][x])

Buggy submission (verdict: Runtime Error):
while True:
    letters = list(input("input"))
    x = 1
    for letter in letters:
        if letters.count(letter) == 2:
            x *= 1
        else:
            x *= 0
    print(["No","Yes"][x])

Buggy submission (verdict: Runtime Error):
letters = list(input())
true_false = 1
for letter in letters:
  if letters.count(letter) == 2:
    true_false　*= 1
  else:
    true_false *= 0
print(["No","Yes"][true_false])

Buggy submission (verdict: Runtime Error):
letters = list(input())
a = letters[0]
if letters.count(a) == 2:
  if letters[1] == a:
    if letters[2] == letters[3]:
      print("Yes")
    else print("No")
  else:
    b = letters[1]
    if letters.count(b) == 2:
      print("Yes")
    else:
      print("No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
letters = list(S)
a = letters[0]
if letters.count(a) == 2:
  if letters[1] == a:
    if letters[2] == letters[3]:
      print("Yes")
    else print("No")
  else:
    b = letters[1]
    if letters.count(b) == 2:
      print("Yes")
    else:
      print("No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
return "Yes"

Buggy submission (verdict: Runtime Error):
S = list(input())
return "Yes"

Buggy submission (verdict: Runtime Error):
letters = list(S)
a = letters[0]
if letters.count(a) == 2:
  if letters[1] == a:
    if letters[2] == letters[3]:
      return "Yes"
    else return "No"
  else:
    b = letters[1]
    if letters.count(b) == 2:
      return "Yes"
    else:
      return "No"
else:
  return "No"

Buggy submission (verdict: Runtime Error):
letters = list(S)
a = letters[0]
if letters.count(a) == 2:
  if letters[1] == a:
    if letters[2] == letters[3]:
      return "Yes"
    else return "No"
  else:
    b = letters[1]
    if letters.count(b) == 2:
      return "Yes"
    else:
      return "No"

Buggy submission (verdict: Runtime Error):
S = input()
letters = list(S)
a = letters[0]
if letters.count(a) == 2:
  if letters[1] == a:
    if letters[2] == letters[3]:
      return "Yes"
    else return "No"
  else:
    b = letters[1]
    if letters.count(b) == 2:
      return "Yes"
    else:
      return "No"
Problem p02989 (python)

Fixed submission:
n = int(input())
d = list(map(int,input().split()))
d.sort()
ans = d[int(n/2)] - d[int(n/2)-1]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
d.sort()
ans = d[n/2] - d[(n/2)-1]
print(ans)
Problem p03011 (python)

Fixed submission:
p,q,r = map(int, input().split())
ans = min(p+q, q+r, r+p)
print(ans)

Buggy submission (verdict: Runtime Error):
p,q,r = map(int, input().split())
print(min(p+q, q+r, r+s))

Buggy submission (verdict: Runtime Error):
p,q,r = map(int, input().split())
print(min(p+q,q+r,r+s))
Problem p03013 (python)

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

halls = {}
for i in range(M):
    index = int(input())
    halls[index] = True

dp = [1] * (N + 1)

for i in range(1, N + 1):
    if i in halls:
        dp[i] = 0
        continue
    if i == 1:
        continue
    dp[i] = dp[max(0, i - 1)] + dp[max(0, i - 2)]
    
print(dp[N] % 1000000007)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

def routeCombCount(distance):
  comb_count = 1
  max_skippable_count = distance // 2

  if max_skippable_count == 0:
    return 1

  for skippable_count in range(1, max_skippable_count + 1):
    step_count = distance - skippable_count
    comb_count += comb(step_count, skippable_count, exact=True)

  return comb_count

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

count = 1
aim_stage = N
now_stage = 0
before_broken = -1
for i in range(M):
  broken = int(input())
  if broken == before_broken + 1:
    count = 0
    break

  aim_stage = broken - 1
  distance = aim_stage - now_stage

  count *= routeCombCount(distance)

  before_broken = broken
  now_stage = broken + 1

distance = N - now_stage
count *= routeCombCount(distance)

print(count % 1000000007)
Problem p02951 (python)

Fixed submission:
A, B, C= map(int, input().split())
if C < (A-B):
    print("0")
else:
    print(C-(A-B))

Buggy submission (verdict: Runtime Error):
A, B, C= map(int, input().split())
if C < (A-B):
    print("0")
else  
    print(C-(A-B))
Problem p03242 (python)

Fixed submission:
a=input()
print(a.replace("1","x").replace("9","1").replace("x","9"))

Buggy submission (verdict: Runtime Error):
a=list(input())
print(a.replace("1","9").replace("9","1"))
Problem p03315 (python)

Fixed submission:
print(4-input().count("-")*2)

Buggy submission (verdict: Runtime Error):


s = raw_input()
print(s.count("+")-s.count("-"))

Buggy submission (verdict: Runtime Error):


s=raw_input()
print(s.count("+")-s.count("-"))

Buggy submission (verdict: Runtime Error):
a=raw_input()
print(a.count("+")-a.count("-"))

Buggy submission (verdict: Runtime Error):
a=raw_input()
print((a.count("+")-(a.count("-"))

Buggy submission (verdict: Runtime Error):
print(int(input().count("+"))+(-1*int(input().count("-"))))
Problem p03327 (python)

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

Buggy submission (verdict: Runtime Error):
a=int(input())
if a>999:
  print("ABC"+a)
else:
  print("ABD"+a%999)
Problem p03803 (python)

Fixed submission:
s=[13,1,2,3,4,5,6,7,8,9,10,11,12]
a,b=map(int,input().split())
if s[a-1]==s[b-1]:
  print("Draw")
elif s[a-1]<s[b-1]:
  print("Bob")
else:
  print("Alice")

Buggy submission (verdict: Runtime Error):
s=[13,1,2,3,4,5,6,7,8,9,10,11,12]
a,b=map(int,input().split())
if s[a-1]==s[b-1]:
  print("Draw")
elif s[a-1]<s[b-1]
  print("Bob")
else:
  print("Alice")
Problem p03834 (python)

Fixed submission:
print(input().replace(","," "))

Buggy submission (verdict: Runtime Error):
print(input().replace(","," ")

Buggy submission (verdict: Runtime Error):
print(input().replace(","." "))