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

Fixed submission:
n, m = list(map(int, input().split(' ')))

broken = [False] * (n + 1)
for i in range(m):
    broken[int(input())] = True

mod = 1000000007

dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 0 if broken[1] else 1

for i in range(2, n + 1):
    if broken[i]:
        dp[i] = 0
    else:
        c = dp[i - 1] + dp[i - 2]
        if c > mod:
            c = c % mod
        dp[i] = c

print(dp[n])

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

broken = [False] * (n + 1)
for i in range(m):
    broken[int(input())] = True

mod = 1_000_000_007

dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 0 if broken[1] else 1

for i in range(2, n + 1):
    if broken[i]:
        dp[i] = 0
    else:
        c = dp[i - 1] + dp[i - 2]
        if c > mod:
            c = c % mod
        dp[i] = c

print(dp[n])
Problem p02835 (python)

Fixed submission:
A,B,C = map(lambda x: int(x),input().split())
if A+B+C >21:
  print("bust")
else:
  print("win")

Buggy submission (verdict: Runtime Error):
A,B,C = map(lambda x: int(x),input().split())
if A+B+C >21:
  print("bust")
else:
  orint("win")
Problem p03017 (python)

Fixed submission:
N,A,B,C,D = list(map(lambda x: int(x),input().split()))
S = " "+input()
def isAble():
    if "##" in S[A:C+1] or "##" in S[B:D+1]:
        return "No"
    if C>D:
        if "..." not in S[B-1:D+2]:
            return "No"
    return "Yes"

print(isAble())

Buggy submission (verdict: Runtime Error):

N = int(input())
A = list(map(lambda x: int(x),input().split()))

judge=False
#print(A)

for i in range(1,N):
    left = A[0]
    right = A[i]
    tmp_1=A[:]
    #print(tmp_1)
    tmp_1.remove(right)
    tmp_1.remove(left)
    tmp_2=[]
    isAble=True
    while isAble:
        #print(tmp_1)
        #print(tmp_2)
        x = right ^ left
        #print(x)
        if x in tmp_1:
            #print(x)
            left = right
            right = x
            tmp_1.remove(x)
            tmp_2.append(x)
        else:
            isAble=False

    if len(tmp_1)==0:
        judge=True
        break
    else:
        continue


ans = 'Yes' if judge else 'No'
print(ans)
Problem p03107 (python)

Fixed submission:
S=input()

zero_count=0
one_count=0
for c in S:
    if c=='1':
        one_count+=1
    else:
        zero_count+=1

print(min(zero_count,one_count)*2)

Buggy submission (verdict: Runtime Error):
S=input()
def union(s):
    answer_str = s
    for i in range(len(s)-1):
        if s[i]!=s[i+1]:
            if i!=len(s)-2:
                return union(s[:i]+s[i+2:])
            else:
                return union(s[:i])
    
    return answer_str
 
print(len(S)-len(union(S)))
Problem p02820 (python)

Fixed submission:
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

ret = 0
for i in range(1, K+1):
    prev = '?'
    for j in range(len(T) // K + 1):
        if i + K*j - 1 >= len(T):
            continue
        now = T[i + K*j - 1]
        
        if prev == now:
            prev = '?'
        else:
            prev = now
            if now == 'r':  
                ret += P
            elif now == 's':
                ret += R
            else:
                ret += S
            
print(ret)

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

ret = 0
for i in range(1, K+1):
    prev = '?'
    for j in range(len(T) // K + 1):
        if i + K*j - 1 >= len(T):
            continue
        now = T[i + K*j - 1]
        print(i + K*j - 1)
        count+=1
        if prev == now:
            prev = '?'
        else:
            prev = now
            if now == 'r':  
                ret += P
            elif now == 's':
                ret += R
            else:
                ret += S
            
print(ret)
Problem p02829 (python)

Fixed submission:
A = int(input())
B = int(input())

print(6 - A - B)

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

print(6 - A - B)
Problem p02847 (python)

Fixed submission:
import sys

week = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
today = input()

for i, day in enumerate(week):
	if day == today:
		print(7 - i)
		sys.exit()

Buggy submission (verdict: Runtime Error):
import sys

week = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
today = input()

for i, day in enumerate(week):
  if day == today:
    print(7 - i)
	sys.exit()
Problem p02860 (python)

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

if len(S) % 2 != 0:
    print("No")
else:
    if S[:(len(S) // 2)] == S[(len(S) // 2) :]:
        print("Yes")
    else:
        print("No")

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

if len(S) % 2 != 0:
    print("No")
else:
    if S[:(len(S) / 2)] == S[(len(S) / 2) :]:
        print("Yes")
    else:
        print("No")
Problem p02862 (python)

Fixed submission:
import numpy as np


MOD = 10**9 + 7

X, Y = map(int, input().split())

if (X + Y) % 3 != 0:
    print(0)

else:
    if (Y < X/2) or (Y > 2*X):
        print(0)
    
    else:
      
        h = (2 * X - Y) // 3
        v = (2 * Y - X) // 3

        def extgcd(a, b):
            if b == 0:
                x = 1
                y = 0
            else:
                y, x = extgcd(b, a%b)
                y -= a//b * x
            return x, y

        def low_inverse(a):
            ret, _ = extgcd(a, MOD)
            return ret

        def low_combination(m, n):
            # calculate (m+n)!/n!m!
            ret = 1
            numerator = m + n
            for i in range(min(m, n)):
                inv_i = low_inverse(i + 1)
                ret = ret * (numerator - i) * inv_i % MOD
            return ret

        print(low_combination(h, v))

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


MOD = 10**9 + 7

X, Y = map(int, input().split())

if (X + Y) % 3 != 0:
    print(0)

    if (Y < X/2) or (Y > 2*X):
        print(0)
	else:
      
        h = (2 * X - Y) // 3
        v = (2 * Y - X) // 3

        def extgcd(a, b):
            if b == 0:
                x = 1
                y = 0
            else:
                y, x = extgcd(b, a%b)
                y -= a//b * x
            return x, y

        def low_inverse(a):
            ret, _ = extgcd(a, MOD)
            return ret

        def low_combination(m, n):
            # calculate (m+n)!/n!m!
            ret = 1
            numerator = m + n
            for i in range(min(m, n)):
                inv_i = low_inverse(i + 1)
                ret = ret * (numerator - i) * inv_i % MOD
            return ret

        print(low_combination(h, v))
Problem p02682 (python)

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

Buggy submission (verdict: Runtime Error):
A,B,C,K=map(int,input().split())
m=0
if A-K>=0:
  print(A):
else:
  K=K-A
  if B>=K:
    print(A)
  else:
    K=K-B
    print(A-K)
Problem p02689 (python)

Fixed submission:
N,M=map(int,input().split())
L=list(map(int,input().split()))
B=[1]*N
for i in range(M):
  a,b=map(int,input().split())
  if L[a-1]<L[b-1]:
    B[a-1]=0
  elif L[a-1]==L[b-1]:
    B[a-1]=0
    B[b-1]=0
  else:
    B[b-1]=0
print(sum(B))

Buggy submission (verdict: Runtime Error):
N,M=int(input())
L=list(map(int,input().split()))
B=[1]*N
for i in range(M):
  a,b=map(int,input().split())
  if L[a-1]<L[b-1]:
    B[a-1]==0
  elif L[a-1]==L[b-1]:
    B[a-1]=0
    B[b-1]=0
  else:
    B[b-1]=0
print(sum(B))
Problem p02693 (python)

Fixed submission:
K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
  if i%K==0:
    print("OK")
    exit()
print("NG")

Buggy submission (verdict: Runtime Error):
A,B,N=map(int,input().split())
x=min(B-1,N)
print(int(A*x/B)-A*int(x/B))
Problem p02701 (python)

Fixed submission:
N=int(input())
L=[]
for i in range(N):
  L.append(str(input()))
A=list(set(L))
print(len(A))

Buggy submission (verdict: Runtime Error):
N=int(input())
L=[]
for i for range(N):
  L.append(str(input()))
A=list(set(L))
print(len(A))
Problem p02723 (python)

Fixed submission:
S=str(input())
if S[2]==S[3] and S[4]==S[5]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
K,N=int(map(int,input().split()))
A=list(map(int,input().split()))
m=K
for j in range(len(a)):
  m=min(m,min(K-abs(A[j]-A[j-1]),K-abs(A[j]-A[j+1])))
print(m)
Problem p02725 (python)

Fixed submission:
K,N=map(int,input().split())
A=list(map(int,input().split()))
m=K
for i in range(N):
  if i==0:
    m=min(m,A[N-1]-A[0])
  else:
    b=A[N-1]-A[i]+K-A[N-1]+A[i-1]
    m=min(m,b)
print(m)

Buggy submission (verdict: Runtime Error):
K,N=int(map(int,input().split()))
A=list(map(int,input().split()))
m=K
for j in range(len(A)):
  m=min(m,min(K-abs(A[j]-A[j-1]),K-abs(A[j]-A[j+1])))
print(m)

Buggy submission (verdict: Runtime Error):
K,N=int(map(int,input().split()))
A=list(map(int,input().split()))
m=K
for j in range(len(N)):
  m=min(m,min(K-abs(N[j]-N[j-1]),K-abs(N[j]-N[j+1])))
print(m)
Problem p02726 (python)

Fixed submission:
N,X,Y=map(int,input().split())
A=[0]*(N+1)
for i in range(1,N):
  for j in range(i+1,N+1):
    m=min(j-i,abs(Y-j)+abs(X-i)+1)
    A[m]+=1
for k in range(1,N):
  print(A[k])

Buggy submission (verdict: Runtime Error):
N,X,Y=map(int,input().split())
N=[0]*(N+1)
for i in range(1,N):
  for j in range(i+1,N+1):
    m=min(j-i,abs(Y-j)+abs(X-i)+1)
    N[m]+=1
for k in range(1,N):
  print(A[k])

Buggy submission (verdict: Runtime Error):
N=int(input())
N=[0]*(N+1)
for i in range(1,N):
  for j in range(i+1,N+1):
    m=min(j-i,abs(Y-j)+abs(X-i)+1)
    N[m]+=1
for k in range(1,N):
  print(A[k])

Buggy submission (verdict: Runtime Error):
N=int(input())
N=[0]*(N+1)
for i in range(1,N):
  for j in range(i+1,N+1):
    m=min(j-i,abs(Y-j)+abs(X-i)+1)
    N[m]+=1
for k in range(1,N+1):
  print(A[k])
Problem p02833 (python)

Fixed submission:
N=int(input())
if N%2==1:
  print(0)
  exit()
m=10
a=0
while m<=N:
  a+=N//m
  m=m*5
print(a)

Buggy submission (verdict: Runtime Error):
N=int(input())
import numpy as np
if N<=10:
  if N==7 or N==9 or N==10:
    print(1)
    exit()
  else:
    print(0)
    exit()
if N%2==0:
  A=[2]
else:
  A=[1]
i=A[0]+2
while i<=N:
  A.append(i)
  i+=2
A=np.array(A)
a=0
m=1
while len(A)!=0:
    A=A[A%(5**m)==0]
    a+=len(A)
    m+=1
print(a)

Buggy submission (verdict: Runtime Error):
N=int(input())
import numpy as np
if N<=10:
  if N==7 or N==9 or N==10:
    print(1)
    exit()
  else:
    print(0)
    exit()
if N%2==0:
  A=[2]
else:
  A=[1]
i=A[0]+2
while i<=N:
  A.append(i)
  i+=2
A=np.array(A)
a=0
m=1
while len(A)!=0:
    A=A[A%(5**m)==0]
    a+=len(A)
    m+=1
print(a)
Problem p02880 (python)

Fixed submission:
N=int(input())
for j in range(1,10):
    for i in range(1,10):
        if N==i*j:
            print("Yes")
            exit()
print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
if N>81:
  print("No")
else:
  i=1
  while N%i!=0 and i<10
    i+=1
  if i==10:
    print("No")
  else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N=int(input())
if N>81:
  print("No")
else:
  i=1
  while N%i!=0 and i<10
    i+1
  if i==10:
    print("No")
  else:
    print("Yes")
Problem p02881 (python)

Fixed submission:
import math
N=int(input())
m=N+1
for j in range(2,int(math.sqrt(N))+1):
    if N%j==0:
        a=j
        b=N//j
        if a>b:
            break
        else:
            m=min(m,(a+b))

print(m-2)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
m=N+1
for j in range(2,math.sqrt(N)):
    if N%j==0:
        a=j
        b=N//j
        if a>b:
            break
        else:
            m=min(m,(a+b))

print(m-2)
Problem p02915 (python)

Fixed submission:
N=int(input())
print(N**3)

Buggy submission (verdict: Runtime Error):
print(N**3)

Buggy submission (verdict: Runtime Error):
def n:
  return n**3
Problem p02935 (python)

Fixed submission:
N=int(input())
v=list(map(int,input().split()))
v.sort()
s=v[0]
for j in range(1,N):
    s=(s+v[j])/2
print(s)

Buggy submission (verdict: Runtime Error):
N=int(input())
v=list(map(int,input().split()))
v.sort()
if len(v)==1:
    print(v[0])
elif len(v)==2:
    print((v[0]+v[1])/2)
else:
    s+=0
    s+=(v[0]+v[1])/2
    for j in range(2,N):
        s+=v[j]/(2**(N+1-j))    
    print(s)

Buggy submission (verdict: Runtime Error):
N=int(input())
v=list(map(int,input().split()))
v.sort()
if len(v)==1:
    print(v[0])
elif len(v)==2:
    print((v[0]+v[1])/2)
else:
    s+=0
    s+=(v[0]+v[1])/2
    for j in range(2,N):
        s+=v[j]/(2**(N+1-j))    
    print(s)

Buggy submission (verdict: Runtime Error):
N=int(input())
v=list(map(int,input().split()))
v.sort()
if len(v)==1:
    print(v[0])
elif len(v)==2:
    print(float((v[0]+v[1])/2))
else:
    s=(float((v[0]+v[1])/2))
    for j in range(2,N):
        s=float((s+v[j])/2) 
print(s)

Buggy submission (verdict: Runtime Error):
N=int(input())
v=list(map(int,input().split()))
s=0
v.sort()
if len(v)==1:
  print(v[0])
elif len(v)==2:
  print(sum(v)/2)
else:
  s+=(v[0]+[1])/(2**N-1)
  for j in range(2,N):
    s+=v[j]/(2**N-j)
print(s)

Buggy submission (verdict: Runtime Error):
N=int(input())
v=list(map(int,input().split()))
s=0
v.sort()
if len(v)=1:
  print(v[0])
elif len(v)=2:
  print(sum(v)/2)
else:
  s+=(v[0]+[1])/(2**N-1)
  for j in range(2,N):
    s+=v[j]/(2**N-j)
print(s)
Problem p02989 (python)

Fixed submission:
N=int(input())
D=list(map(int,input().split()))
D.sort()
mi=D[0]
ma=D[N-1]
point=0
for j in range(mi,ma+1): #Kはj
    if D[N//2-1]<j<=D[N//2]:
        point+=1
print(point)

Buggy submission (verdict: Runtime Error):
N=int(input())
D=list(map(int,input().split()))
D.sort()
mi=D[0]
ma=D[N-1]
point=0
for j in range(mi,ma+1): #Kはj
  i,s=0
  while D[i]<j and s<N//2:
    i+=1
    s+=1
  if s==N//2:
    point+=1
print(point)

Buggy submission (verdict: Runtime Error):
N=int(input())
D=list(map(int,input().split()))
D.sort()
mi=D[0]
ma=D[N-1]
point=0
for j in range(mi,ma+1): #Kはj
  i=0
  while a[i]<j and i+1<N//2+1:
    i+=1
  if i==N//2:
    point+=1
print(point)
Problem p03011 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(min(a+b,b+c,c+a)
Problem p03041 (python)

Fixed submission:
N,K=map(int,input().split())
S=input()
s=""
for j in range(N):
  if j==K-1:
    s+=str.lower(S[K-1])
  else:
    s+=S[j]
print(s)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
import math
s=0
if N-K>=0:
  N-=(N-K+1)
for j in range(1,N+1):
  if (K/j)%2==0:
    s+=math.log(K//j,2)
  else:
    s+=int(math.log(K/j),2)+1
print(float(N/(s+N)))
Problem p03775 (python)

Fixed submission:
import math
N=int(input())
m=int(len(str(N)))
for j in range(1,int(math.sqrt(N))+2):
    if N%j==0:
        a=j
        b=N//j
        m1=len(str(max(a,b)))
        m=min(m,m1)
print(m)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
m=int(len(str(N)))
for j in range(2,math.int(sqrt(N))+1):
  a=j
  b=N//j
  m1=len(str(max(a,b)))
  m=min(m,m1)
print(m)
Problem p02820 (python)

Fixed submission:
N,K = map(int, input().split())
R,S,P = map(int, input().split())
T = input()

ans = 0

a = -(-N//K)
r = N%K
T2 = T + 'x'*(K - r)

li = []
for i in range(K):
    st = ''
    for j in range(a):
        c = T2[j*K + i]
        if st == '':
            st += c
        elif st[0] == c:
            st += c
        else:
            li.append(st)
            if st[0] == 'r':
                ans += -(-len(st)//2)*P
            elif st[0] == 's':
                ans += -(-len(st)//2)*R
            elif st[0] == 'p':
                ans += -(-len(st)//2)*S
            st = c
        if j == a-1:
            li.append(st)
            if st[0] == 'r':
                ans += -(-len(st)//2)*P
            elif st[0] == 's':
                ans += -(-len(st)//2)*R
            elif st[0] == 'p':
                ans += -(-len(st)//2)*S

print(ans)

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

ans = 0

a = -(-N//K)
r = N%K
T2 = T + 'x'*r

li = []
for i in range(K):
    st = ''
    for j in range(a):
        c = T2[j*K + i]
        if st == '':
            st += c
        elif st[0] == c:
            st += c
        else:
            li.append(st)
            if st[0] == 'r':
                ans += -(-len(st)//2)*P
            elif st[0] == 's':
                ans += -(-len(st)//2)*R
            elif st[0] == 'p':
                ans += -(-len(st)//2)*S
            st = c
        if j == a-1:
            li.append(st)
            if st[0] == 'r':
                ans += -(-len(st)//2)*P
            elif st[0] == 's':
                ans += -(-len(st)//2)*R
            elif st[0] == 'p':
                ans += -(-len(st)//2)*S

print(ans)
Problem p02954 (python)

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

li = [0]
char = 'R'
for i in S:
    n = len(li)
    if i == char:
        li[n-1] += 1
    else:
        li.append(1)
        char = i
n = len(li)
ans = []
for i in range(n//2):
    k = li[2*i] + li[2*i+1]
    for j in range(li[2*i] - 1):
        ans.append(0)
    if (k%2 == 0):
        ans.append(int(k/2))
        ans.append(int(k/2))
    else:
        if li[2*i]%2 == 0:
            ans.append(int(k//2))
            ans.append(int(k//2) + 1)
        else:
            ans.append(int(k//2) + 1)
            ans.append(int(k//2))
    for j in range(li[2*i+1] - 1):
        ans.append(0)

print(*ans)

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

li = [0]
char = 'R'
for i in S:
    n = len(li)
    if i == char:
        li[n-1] += 1
    else:
        li.append(1)
        char = i
n = len(li)
ans = []
for i in range(len(li)//2):
    k = li[2*i] + li[2*i+1]
    for i in range(li[2*i] - 1):
        ans.append(0)
    if (k%2 == 0):
        ans.append(int(k/2))
        ans.append(int(k/2))
    else:
        if li[2*i]%2 == 0:
            ans.append(int(k//2))
            ans.append(int(k//2) + 1)
        else:
            ans.append(int(k//2) + 1)
            ans.append(int(k//2))
    for i in range(li[2*i+1] - 1):
        ans.append(0)

print(*ans)
Problem p03291 (python)

Fixed submission:
S = input()
memo = [[0,0,0,0] for i in range(len(S))]
Q = 0
memo[0][0] = 1
if S[0] == 'A':
  memo[0][1] = 1
elif S[0] == '?':
  memo[0][0] = 3
  memo[0][1] = 1
l = 1
while l < len(S):
  s = S[l]
  if s == 'A':
    memo[l][0] = memo[l-1][0]
    memo[l][1] = memo[l-1][1] + memo[l-1][0]
    memo[l][2] = memo[l-1][2]
    memo[l][3] = memo[l-1][3]
  elif s == 'B':
    memo[l][0] = memo[l-1][0]
    memo[l][1] = memo[l-1][1]
    memo[l][2] = memo[l-1][2] + memo[l-1][1]
    memo[l][3] = memo[l-1][3]
  elif s == 'C':
    memo[l][0] = memo[l-1][0]
    memo[l][1] = memo[l-1][1]
    memo[l][2] = memo[l-1][2]
    memo[l][3] = memo[l-1][3] + memo[l-1][2]
  else:
    memo[l][0] = memo[l-1][0]*3
    memo[l][1] = memo[l-1][1]*3 + memo[l-1][0]
    memo[l][2] = memo[l-1][2]*3 + memo[l-1][1]
    memo[l][3] = memo[l-1][3]*3 + memo[l-1][2]
    Q += 1
  memo[l] = [i%(10**9+7) for i in memo[l]]
  l += 1
print(int(memo[l-1][3]))

Buggy submission (verdict: Runtime Error):
S = input()
l = len(S)
Q = S.count('?')
ans = 0
for i in range(l-2):
    for j in range(l-i-2):
        for k in range(l-i-j-2):
            d = 3**Q
            s1 = S[i]; s2 = S[i+j+1]; s3 = S[i+j+k+2]
            if s1 == 'A' or s1 == '?':
                if s1 == '?':
                    d /= 3
                if s2 == 'B' or s2 == '?':
                    if s2 == '?':
                        d /= 3
                    if s3 == 'C' or s3 == '?':
                        if s3 == '?':
                            d /= 3
                        d %= 10**9 + 7
                        ans += d
                        ans = ans%(10**9+7)
print(int(ans))

Buggy submission (verdict: Runtime Error):
S = input()
l = len(S)
Q = S.count('?')
ans = 0
for i in range(l-2):
    for j in range(l-i-2):
        for k in range(l-i-j-2):
            d = 3**Q
            s1 = S[i]; s2 = S[i+j+1]; s3 = S[i+j+k+2]
            if s1 == 'A' or s1 == '?':
                if s1 == '?':
                    d /= 3
                if s2 == 'B' or s2 == '?':
                    if s2 == '?':
                        d /= 3
                    if s3 == 'C' or s3 == '?':
                        if s3 == '?':
                            d /= 3
                        ans += d
                        ans = ans%(10**9+7)
print(int(ans))

Buggy submission (verdict: Runtime Error):
S = input()
l = len(S)
Q = S.count('?')
ans = 0
for i in range(l):
    for j in range(l-i-1):
        for k in range(l-i-j-2):
            d = 3**Q
            s1 = S[i]; s2 = S[i+j+1]; s3 = S[i+j+k+2]
            if s1 == 'A' or s1 == '?':
                if s1 == '?':
                    d /= 3
                if s2 == 'B' or s2 == '?':
                    if s2 == '?':
                        d /= 3
                    if s3 == 'C' or s3 == '?':
                        if s3 == '?':
                            d /= 3
                        ans += d
                        ans = ans%(10**9+7)
print(int(ans))
Problem p02831 (python)

Fixed submission:
import collections
import math
import operator as op
from functools import reduce
import numpy as np
import math
import bisect

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

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

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

    ans = lcm(A, B)

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import collections
import math
import operator as op
from functools import reduce
import numpy as np
import math
import bisect


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

    lcm = (A * B) // math.gcd(A, B)

    print(lcm)


if __name__ == '__main__':
    main()
Problem p02699 (python)

Fixed submission:
n,w=map(int,input().split())
if w>=n:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
n,w=map(int,input().split())
if w>=n:
  print('unsafe')
 else:
  print('safe')
Problem p02831 (python)

Fixed submission:
import sys
import fractions

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A, B = lr()
print(lcm(A, B))

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

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
    
A, B = lr()
print(lcm(A, B))
Problem p03803 (python)

Fixed submission:
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    A = 14 if A == 1 else A
    B = 14 if B == 1 else B
    if A == B:
        print("Draw")
    elif A > B:
        print("Alice")
    else:
        print("Bob")
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    A = 14 if A == 1 else A
    B = 14 if B == 1 else B
    if A == B:
        print("Draw")
    elif A > B:
        print("Alice")
    else:
        print("Bob")
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()