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

Fixed submission:
s=input()
 
cnt=0
 
for i in range(4):
	if s[i]=='+':
		cnt+=1

res=cnt*2-4
 
print(res)

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

cnt=0

for i in range(4):
	if s[i]=='+':
	cnt+=1

res=2*i-4

print(res)
Problem p02951 (python)

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

Buggy submission (verdict: Runtime Error):
A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
ans = C-(A-B)
if ans > 0:
  print(ans)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
A, B, C = stdin.readline().rstrip().split()
ans = C-(A-B)
if ans > 0:
  print(ans)
else:
  print(0)
Problem p02831 (python)

Fixed submission:
import sys
import fractions

str = sys.stdin.readline()

a = int(str.split()[0])
b = int(str.split()[1])

print((a * b) // fractions.gcd(a,b))

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

str = sys.stdin.readline()

a = int(str.split()[0])
b = int(str.split()[1])

print((a * b) // math.gcd(a,b))

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

str = sys.stdin.readline()

a = int(str.split()[0])
b = int(str.split()[1])

print(int(a * b / math.gcd(a,b)))

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

str = sys.stdin.readlines()

a = int(str[0].split()[0])
b = int(str[0].split()[1])

print(int(a * b / math.gcd(a,b)))
Problem p02989 (python)

Fixed submission:
n = int(input())
p = sorted(list(map(int, input().split())))
mid = n // 2
print(p[mid] - p[mid-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
p = sorted(list(map(int, input().split())))
mid = n // 2
ans = 0
for i in range(p[mid-1], p[mid+1]):
  if len([j for j in p if j > i]) == (n//2):
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = sorted(list(map(int, input().split())))
mid = n // 2
ans = 0
for i in range(p[mid-1], p[mid+1]):
  if len([j for j in p if j > i]) == (n//2):
    ans += 1
print(ans)
Problem p02951 (python)

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

Buggy submission (verdict: Runtime Error):
A, B, C = input().split()
temp = C-A-B
if temp < 0:
  temp = 0
print(temp)
Problem p02879 (python)

Fixed submission:
A,B = map(int,input().split())
o = -1
if A >= 10 or B >= 10:
    print(o)
else:
    print(A*B)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
o = -1
if A >= 10 or B >= 10:
    print(o)
else:
print(A*B)
end:

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
o = -1
if A >= 10 or B>=10
    print(o)
else:
print(A*B)

Buggy submission (verdict: Runtime Error):
A,B = int(input())
o = -1
if A >= 10 or B>=10
    print(o)
else:
print(A*B)

Buggy submission (verdict: Runtime Error):
A,B = input()
o = -1
if A >= 10 or B>=10
    print(o)
else:
print(A*B)
Problem p02829 (python)

Fixed submission:
one_two_three=[1,2,3]
a=int(input())
b=int(input())
one_two_three.remove(a)
one_two_three.remove(b)
print(one_two_three[0])

Buggy submission (verdict: Runtime Error):
import math

A,B=map(int,(input().split()))    
ABgcd=math.gcd(A,B)
answer=A*B//ABgcd
print(answer)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B=map(int,(input().split()))    
print(lcm(A, B))
Problem p02831 (python)

Fixed submission:
import fractions

A,B=map(int,(input().split()))    
ABgcd=fractions.gcd(A,B)
answer=A*B//ABgcd
print(answer)

Buggy submission (verdict: Runtime Error):
import math

A,B=map(int,(input().split()))    
ABgcd=math.gcd(A,B)
answer=A*B//ABgcd
print(answer)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B=map(int,(input().split()))    
print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B=map(int,(input().split()))    
print(lcm(A, B))
Problem p02835 (python)

Fixed submission:
s=list(map(int,input().split()))
point=sum(s)
if point >= 22:
  print("bust")
else:
  print("win")

Buggy submission (verdict: Runtime Error):
A1=int(input())
A2=int(input())
A3=int(input())
point=A1+A2+A3
if point >= 22:
  print("bust")
else:
  print("win")

Buggy submission (verdict: Runtime Error):
A1=int(input())
A2=int(input())
A3=int(input())
point=A1+A2+A3
if point >= 22:
  print("bust")
else:
  print("win")
Problem p02835 (python)

Fixed submission:
if __name__ == "__main__":
	A1, A2, A3 = map(int, input().split())
	if A1 + A2 + A3 <= 21:
		print("win")
	else:
		print("bust")

Buggy submission (verdict: Runtime Error):
import numpy as np
mod = 10 ** 9 + 7

if __name__ == "__main__":
	N = int(input())
	L = list(map(int, input().split()))
	L = np.array(L)
	ans = 0
	for i in range(60 + 2):
		A = L % 2
		L = L // 2
		ans += np.sum(A) * (N - np.sum(A)) * (2 ** i) % mod
	print(ans % mod)
Problem p02862 (python)

Fixed submission:
MOD = 10 ** 9 + 7

def modPow(a, x, p):
	res = 1
	while x > 0:
		if x % 2 != 0:
			res = res * a % p
		a = a * a % p
		x = x // 2
	return res
 
def modInverse(a, p):
	return modPow(a, p - 2, p)
 
def modBinomial(n, k, p):
	numerator = 1
	for i in range(k):
		numerator = (numerator * (n - i)) % p
	denominator = 1
	for i in range(1, k + 1):
		denominator = (denominator * i) % p
	return (numerator * modInverse(denominator, p)) % p


if __name__ == "__main__":
	X, Y = map(int, input().split())
	if (X + Y) % 3 != 0 or Y > 2 * X or Y < X / 2.:
		print("0")
	else:
		n = (X + Y) // 3
		k = Y - n
		print(modBinomial(n, k, MOD))

Buggy submission (verdict: Runtime Error):
# import numpy as np
import sys
sys.setrecursionlimit(10000)
e = 1000000000 + 7
N = 1000000 // 3
# dp = np.zeros((N, N))
memo = {}
for n in range(N):
	s = "n: {}, k: {}".format(n, 0)
	memo[s] = 1
	s = "n: {}, k: {}".format(n, n)
	memo[s] = 1
	# dp[n][0] = 1
	# dp[n][n] = 1

def pascal(n, k):
	# if dp[n][k] == 0:
	# 	dp[n][k] = pascal(n - 1, k - 1) % e + pascal(n - 1, k) % e
	# return dp[n][k] % e
	s = "n: {}, k: {}".format(n, k)
	if s not in memo:
		memo[s] = pascal(n - 1, k - 1) % e + pascal(n - 1, k) % e
	return memo[s] % e

# print(pascal(6, 3))

if __name__ == "__main__":
	X, Y = map(int, input().split())
	if (X + Y) % 3 != 0:
		print("0")
	else:
		n = (X + Y) // 3
		k = Y - n
		print(pascal(n, k))
Problem p02831 (python)

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

a,b=map(int,input().split(" "))
print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math

a,b=map(int,input().split(" "))
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))
#print(math.gcd(a, b))
# 2
Problem p03107 (python)

Fixed submission:
# coding: utf-8
# Your code here
# coding: utf-8
# Your code here!

a =input()
N=list(a)
b=0
r=0
for i in N:
    if(i=="0"):
        b+=1
    else:
        r+=1
ans=r
if(r>b):
    ans=b
print(ans*2)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

a =input()
N=list(a)

count=[]
def search(x):
    n=len(N)
    if(x+1>=n):
        return 
    
    if(N[x]=="0" and N[x+1]=="1"):
        #print(N)
        del N[x]
        del N[x+1]
        #print(N)
        count.append(0)
        x=0
    if(N[x]=="1" and N[x+1]=="0"):
        #print(N)
        del N[x]
        del N[x+1]
        #print(N)
        count.append(0)
        x=0    
        
    search(x+1)
ans=search(0)
#print(N)
if(len(count)!=0):
    print(len(count)*2+2)
else:
    print(0)
Problem p03127 (python)

Fixed submission:
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
x=gcd(a[0],a[1])
for i in range(2,len(a)):
  x=gcd(x,a[i])
print(x)

Buggy submission (verdict: Runtime Error):
 = int(input())
mon =[int(i)for i in input().split()]

def gcd(x,y):
    if y ==0:
        return x
    else:
        return gcd(y,x%y)
mon.sort()
mini = mon[0]
for i in range(1,N):
    ans = gcd(mini,mon[i])
print(ans)
Problem p02879 (python)

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

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
  
primelist=make_divisors(A)
S = primelist[-1]
G = int(A/S)
print((G-1)+(S-1))
Problem p03038 (python)

Fixed submission:
from operator import itemgetter
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
K = [[int(i) for i in input().split()] for j in range(M)]
K.sort()
K.sort(key=itemgetter(1))
#B_C = list(map(list, zip(*K)))
A.sort()

changed = []
for i in K[::-1]:
    changed += [i[1]]*i[0]
    if len(changed) < N:
        continue
    else:
        while(len(changed) > N):
            changed.pop()
        break
if len(changed) < N:
    changed += [0]*(N-len(changed))
#print(changed.__len__(),A.__len__())
for i in range(N):
    if changed[i] <= A[i]:
        SUM = sum(changed[:i]) + sum(A[i:])
        print(SUM)
        exit()
else:
    print(sum(changed))

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
K = [[int(i) for i in input().split()] for j in range(M)]
K.sort()
K.sort(key=itemgetter(1))
#B_C = list(map(list, zip(*K)))
A.sort()

ans = 0
changed = []
for i in K[::-1]:
    changed += [i[1]]*i[0]
    if len(changed) < N:
        continue
    else:
        while(len(changed) > N):
            changed.pop()
        break

print(changed.__len__(),A.__len__())
for i in range(N):
    if changed[i] <= A[i]:
        SUM = sum(changed[:i]) + sum(A[i:])
        print(SUM)
        exit()
else:
    print(sum(changed))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
K = [[int(i) for i in input().split()] for j in range(M)]

K.sort()
K.sort(key=lambda x:x[1])
#B_C = list(map(list, zip(*K)))
A.sort()

ans = 0
changed = []
for i in K[::-1]:
    changed += [i[1]]*i[0]
    if len(changed) < N:
        continue
    else:
        while(len(changed) > N):
            changed.pop()
        break

#print(changed,A)
SUM = [sum(changed[:i+1] + A[i+1:]) for i in range(N-1)]
#print(SUM)
print(max(max(SUM), sum(A), sum(changed)))
Problem p03077 (python)

Fixed submission:
N = int(input())
L = [int(input()) for _ in range(5)]

m = min(L)
print(4 + (N+m-1)//m)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [int(input()) for _ in range(5)]

m = min(L)
print(4 + (L+m-1)//m)
Problem p03252 (python)

Fixed submission:
S = input()
T = input()
ls = [0]*26
lt = [0]*26
al = [chr(ord('a')+i) for i in range(26)]
for i in range(S.__len__()):
    si = al.index(S[i])
    ti = al.index(T[i])
    ls[si] += 1
    lt[ti] += 1
ls.sort()
lt.sort()
if ls == lt:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
ch_S = input()
ch_T = input()

ind_S = []
ind_T = []
for i in list("abcdefghijklmnopqrstuvwxyz"):
    L = [ch_S.find(i)]
    ind_S.append(L, )
    R = [ch_T.find(i)]
    ind_T.append(R,)

if set(ind_S) == set(ind_T):
    print("Yes")
else:
    print("No")
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
    print(s)

else:
    print("red")

Buggy submission (verdict: Runtime Error):
#-*- coding: UTF-8 -*-

a = int(input())
s = input()

if a => 3200:
    print(s)

elif:
    print("red")

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

if a => 3200:
    print(s)

elif:
    print("red")
Problem p02859 (python)

Fixed submission:
import sys

input = sys.stdin.readline

R = int(input())

print(int(R ** 2))

Buggy submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline

R = int(input())

print(int(R ** 2))_
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
if a >= 3200:
    print(s)
else:
    print('red')

Buggy submission (verdict: Runtime Error):
a = input()
s = input()
if a >= 3200:
    print(s)
else:
    print('red')
Problem p02987 (python)

Fixed submission:
s = str(input())

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

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

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

Fixed submission:
n, k = map(int, input().split())
ans = [0] * (k + 2)
S = 0

def cmb(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

mod = 10**9+7 #出力の制限
N = 10**4
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 )


for i in range(1, k+1):
    if i > n - k + 1:
        print(0)
    else:
        ans[i] = cmb( (k-1), (i-1) , mod ) * cmb( (n - k + 1), (i) , mod ) % mod
        if ans[i] < 0:
            ans[i] + mod
        print(ans[i])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
ans = [0] * (k + 2)
S = 0

def cmb(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

mod = 10**9+7 #出力の制限


for i in range(1, k+1):
    if i > n - k + 1:
        print(0)
    else:
        ans[i] = cmb( (k-1), (i-1) , mod ) * ( cmb( (n-k+i), (n-k) , mod) - S )
        S += ans[i] 
        if ans[i] < 0:
            ans[i] + mod
        print(ans[i])

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

n, k = map(int, input().split())
MOD = 1000000007
ans = [0] * (k + 2)
S = 0

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]


for i in range(1, k+1):
    ans[i] = comb( (k-1), (i-1) , exact=True) * ( comb( (n-k+i), (n-k) , exact=True) - S )
    S += ans[i] 
    print(ans[i] % MOD)

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

n, k = map(int, input().split())
MOD = 1000000007
ans = [0] * (k + 2)
S = 0

for i in range(1, k+1):
    ans[i] = comb( (k-1), (i-1) , exact=True) * ( comb( (n-k+i), (n-k) , exact=True) - S )
    S += ans[i] 
    print(ans[i] % MOD)
Problem p02831 (python)

Fixed submission:
a,b = [int(i) for i in input().split()]
a_ = []
b_ = []
for i in range(1,a+1):
    if a%i == 0:
        a_.append(i)

for i in range(1,b+1):
    if b%i == 0:
        b_.append(i)

for i in a_[::-1]:
    if i in b_:
        m = i
        break


print(a*b//m)

Buggy submission (verdict: Runtime Error):
import math
a,b = [int(i) for i in input().split()]
print(a*b//math.gcd(a,b))
Problem p02833 (python)

Fixed submission:
import copy

n = int(input())
def calc(N):
    n_ = (N - N%10)//10
    c = 1
    s = copy.deepcopy(n_)
    while n_//(5**c) >= 1:
        c +=1
    c -= 1
    for i in range(1,c+1):
        s += n_//5**i
    return s

if n%2 == 1 or n == 0:
    print(0)
else:
    print(calc(n))

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

def func(n_):
    if n_ < 2:
        return 1
    else:
        return func(n_-2)*n_
c = 0
for i in list(str(func(n)))[::-1]:
    if i == "0":
        c += 1
    else:
        break
print(c)

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

def func(n_):
    if n_ < 2:
        return 1
    else:
        return func(n_-2)*n_
c = 0
for i in list(str(func(n)))[::-1]:
    if i == "0":
        c += 1
    else:
        break
print(c)
Problem p02891 (python)

Fixed submission:
from itertools import groupby

def count(s):
    l = []
    c = 0
    for key,value in groupby(s):
        l.append(list(value))
    for i in l:
        c += len(i)//2
    return c
s = list(input())
k =int(input())
if k <= 10**5:
    print(count(s*k))
else:
    d2 = count(s*3)-count(s*2)
    d3 = count(s*4)-count(s*3)
    if d2 != d3:
        if k%2 == 1:
            print(d2*((k-2)//2+1) + count(s*2) + d3*((k-2)//2))
        else:
            print(d2*((k-2)//2) + count(s*2) + d3((k-2)//2))
    else:
        print(d2*(k-2) + count(s*2))

Buggy submission (verdict: Runtime Error):
from itertools import groupby

def count(s):
    l = []
    c = 0
    for key,value in groupby(s):
        l.append(list(value))
    for i in l:
        c += len(i)//2
    return c
s = list(input())
k =int(input())
print(count(s*k))

Buggy submission (verdict: Runtime Error):
from itertools import groupby

def count(s):
    l = []
    c = 0
    for key,value in groupby(s):
        l.append(list(value))
    for i in l:
        c += len(i)//2
    return c


if __name__=="__main__":
    s = list(input())
    k = int(input())
    c = 0
    l = []
    c += count(s*k)
    print(c)

Buggy submission (verdict: Runtime Error):
from itertools import groupby

def count(s):
    l = []
    c = 0
    for key,value in groupby(s):
        l.append(list(value))
    for i in l:
        c += len(i)//2
    return c


if __name__=="__main__":
    s = list(input())
    k = int(input())
    c = 0
  	c += count(s*k)
    print(c)
Problem p02897 (python)

Fixed submission:
N=int(input())

if(N%2==0):
    p=0.5
else:
    p=(N+1)/(2*N)
print(p)

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

def get_cd(x1,x2):
    cd=[]
    for i in range(1,min(x1,x2)+1):
        if x1%i==0 and x2%i==0:
            cd.append(i)
    return cd

cd_AB=get_cd(A,B)

for j in range (0,len(cd_AB)-1):
    for k in range(j+1,len(cd_AB)):
            if(len(get_cd(cd_AB[j],cd_AB[k]))>1):
                cd_AB[k]=0

print(len(cd_AB)-cd_AB.count(0))
Problem p02912 (python)

Fixed submission:
import heapq
N,M=map(int,input().split())
A=list(map(lambda x:int(x)*(-1),input().split()))
heapq.heapify(A)
    
for i in range(0,M):
    tmp=heapq.heappop(A)
    heapq.heappush(A,-int(-tmp/2))
print(-sum(A))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=[int(x) for x in input().split()]
A.sort(reverse=True)
print(A)
for i in range(0,M):
    A[0]=int(A[0]/2)
    A.sort(reverse=True)
    print(A)

print(sum(A))
Problem p02935 (python)

Fixed submission:
import heapq

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

heapq.heapify(v)
work = heapq.heappop(v)

for _ in range(n - 1):
    work += heapq.heappop(v)
    work /= 2

print(work)

Buggy submission (verdict: Runtime Error):
3
500 300 200
Problem p02862 (python)

Fixed submission:
MAX = 1000000
MOD = 1000000007

fac = [None] * MAX
finv = [None] * MAX
inv = [None] * MAX


def comb_init():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD


def comb(n, k):
    if n < 0 or k < 0 or n < k:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


comb_init()
x, y = [int(x) for x in input().split()]


def solve(x, y):

    if (x + y) % 3 != 0:
        return 0

    n = (2 * y - x) // 3
    m = (2 * x - y) // 3
    if n < 0 or m < 0:
        return 0

    return comb(n + m, n)


print(solve(x, y))

Buggy submission (verdict: Runtime Error):
x, y = [int(x) for x in input().split()]
 
def c(n, r):
    u = 1
    l = 1
    for i in range(min(r, n - r)):
        u = u * (n - i) / (i + 1)
    return int(u)
 
def solve(x, y):
    if (x + y) % 3 != 0:
        return 0
    if x * 2 < y or y * x < x:
        return 0
    
    n = (x + y) // 3
    r = ((x - y) + n) // 2
    return c(n, r)

print(solve(x, y) % 1000000007)
Problem p02831 (python)

Fixed submission:
def computeGCD(x, y):
    if x > y:
        small = y
    else:
        small = x
    for i in range(1, small + 1):
        if ((x % i == 0) and (y % i == 0)):
            gcd = i

    return gcd
a,b = map(int,input().split())
gcd = computeGCD(a,b)
print((a*b)//gcd)

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
gcd = math.gcd(a,b)
print((a*b)//gcd)
Problem p03018 (python)

Fixed submission:
s = input()
s= s.replace('BC','D')
a=0
d=0
ans=0
t=''
for i in range(len(s)):
    if s[i] =='A':
        a+=1
    elif s[i]=='D':
        ans+=a
    else:
        a=0
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
n = len(s)
s = s+['z','z']
mem = []
c = 0
run = 0
i=0
while(i<n):
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
        c+=1
        s[i] = 'B'
        s[i + 1] = 'C'
        s[i + 2] = 'A'
        mem.append(i+2)
        run=1
        i+=3
    else:
        i+=1
        if s[i]=='A':
            mem.append(i)

while(run):
    run = 0
    m = -1
    for i in range(len(mem)):
        idex = mem[i]
        if s[idex] == 'A' and s[idex + 1] == 'B' and s[idex + 2] == 'C' and i>m:
            c += 1
            s[idex] = 'B'
            s[idex + 1] = 'C'
            s[idex + 2] = 'A'
            mem.append(i + 2)
            run = 1
            mem[i]= idex+2
            m=idex+2
print(c)

Buggy submission (verdict: Runtime Error):
s = list(input())
n = len(s)
s = s+['z','z']
mem = []
c = 0
run = 0
i=0
while(i<n):
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
        c+=1
        s[i] = 'B'
        s[i + 1] = 'C'
        s[i + 2] = 'A'
        mem.append(i+2)
        run=1
        i+=3
    else:
        i+=1
        if s[i]=='A':
            mem.append(i)

while(run):
    run = 0
    m = -1
    for i in range(len(mem)):
        idex = mem[i]
        if s[idex] == 'A' and s[idex + 1] == 'B' and s[idex + 2] == 'C' and i>m:
            c += 1
            s[idex] = 'B'
            s[idex + 1] = 'C'
            s[idex + 2] = 'A'
            mem.append(i + 2)
            run = 1
            mem[i]= idex+2
            m=idex+2
print(c)

Buggy submission (verdict: Runtime Error):
s = list(input())
n = len(s)
s = s+['z','z']
mem = []
c = 0
run = 0
i=0
while(i<n):
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
        c+=1
        s[i] = 'B'
        s[i + 1] = 'C'
        s[i + 2] = 'A'
        mem.append(i+2)
        run=1
        i+=3
    else:
        i+=1
        if s[i]=='A':
            mem.append(i)
while(run):
    run = 0
    for i in range(len(mem)):
        idex = mem[i]
        if s[idex] == 'A' and s[idex + 1] == 'B' and s[idex + 2] == 'C':
            c += 1
            s[idex] = 'B'
            s[idex + 1] = 'C'
            s[idex + 2] = 'A'
            mem.append(i + 2)
            run = 1
            mem[i]= idex+2
print(c)
Problem p02836 (python)

Fixed submission:
s = input()
cnt = 0
for i in range((len(s)+1)//2):
  if s[i] != s[-i-1]:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
s = input()
cnt = 0
for i in range((n+1)//2):
  if s[i] != s[n-i-1]:
    cnt += 1
print(cnt)
Problem p02847 (python)

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

Buggy submission (verdict: Runtime Error):
days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
day = input()
i = 7 - days.indexOf(day)
print(i)