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

Fixed submission:
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
  
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
  
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
 
def minus(n):
  return 128-n

s = input()
total = 0
new_s = s.replace("BC", "D")
new_s_list = list(new_s)
new_s_list.append("G")
tmp_start = 0
for i in range(len(new_s_list)):
  if new_s_list[i] in {'B', 'C', 'G'}:
    ppp = list(map(minus, map(ord, new_s_list[tmp_start:i])))
    bit = Bit(128)
    ans = 0
    for j, p in enumerate(ppp):
      bit.add(p, 1)
      ans += j + 1 - bit.sum(p)
    total += ans
    tmp_start = i+1

print(total)

Buggy submission (verdict: Runtime Error):

def bubble_sort(A):
    cnt = 0
    for i in range(len(A)):
        for j in range(len(A)-1, i, -1):
            if A[j] == 'D' and A[j-1] == 'A':
                A[j], A[j-1] = A[j-1], A[j]
                cnt += 1
    return cnt

s = input()
total = 0
new_s = s.replace("BC", "D")
new_s_list = list(new_s).append("G")
tmp_start = 0
for i in range(len(new_s_list)):
  if new_s_list[i] in {'B', 'C', 'G'}:
    total += bubble_sort(new_s_list[tmp_start:i])
    tmp_start = i

print(total)

Buggy submission (verdict: Runtime Error):
def dfs(string, idx):
  tmp_s = string[0:idx]+"BCA"+string[idx+3:]
  # left
  if len(string[0:idx]) >= 1 and tmp_s[idx-1:idx+2] == "ABC":
    left_translated, left_count = dfs(tmp_s[:idx+2], idx-1)
  else:
    left_translated = tmp_s[:idx+2]
    left_count = 0
  #print("left:"+left_translated)
  if len(string[idx+3:]) >= 2 and tmp_s[idx+2:idx+5] == "ABC":
    right_translated, right_count = dfs(tmp_s[idx+2:], 0)
  else:
    right_translated = tmp_s[idx+2:]
    right_count = 0
    #print("right:"+right_translated)
  return left_translated + right_translated, left_count + right_count + 1


s = input()
total = 0
idx = s.find("ABC") 
while idx != -1:
  s, count = dfs(s, idx)
  total += count
  idx = s.find("ABC")
  
print(total)
Problem p03073 (python)

Fixed submission:
s=input()
l = []
l.append(s[0])
c = 0
for i in range(1, len(s)):
  if s[i] == l[i-1]:
    c += 1
    l.append(str(-(int(s[i])-1)))
  else:
    l.append(s[i])
print(c)

Buggy submission (verdict: Runtime Error):
s=input()
l = []
l.append(s[0])
c = 0
for i in range(1, n):
  if s[i] == l[i-1]:
    c += 1
    l.append(str(abs(int(s[i])-1)))
  else:
    l.append(s[i])
print(c)

Buggy submission (verdict: Runtime Error):
s=input()
l = []
l.append(s[0])
c = 0
for i in range(1, n):
  if s[i] == l[i-1]:
    c += 1
    l.append(str(-(int(s[i])-1)))
  else:
    l.append(s[i])
print(c)
Problem p03127 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
while len(a) > 1:
  m = min(a)
  a = [a[i]%m for i in range(len(a)) if a[i]%m > 0]
  a.append(m)
print(m)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
while len(a) > 0:
  m = min(a)
  a = [a[i]%m for i in range(n) if a[i]%m > 0]
print(m)
Problem p03209 (python)

Fixed submission:
n, x = map(int, input().split())

def count_p(n, x):
  if x == 0:
    return 0
  elif n == 0:
    return 1
  elif x > 2**(n+1)-2:
    return 2**(n)-1 + 1 + count_p(n-1, min(x-(2**(n+1)-1), 2**(n+1)-3))
  else:
    return count_p(n-1, x-1)
  
print(count_p(n,x))

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = ["P"]
def lvup(n):
  if n == 0:
    pass
  else:
    lvup(n-1)
    l.append("B"+l[n-1]+"P"+l[n-1]+"B")
lvup(n)
print(l[n][0:x].count("P"))

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = ["P"]
def lvup(n):
  if n == 0:
    pass
  else:
    lvup(n-1)
    l.append("B"+l[n-1]+"P"+l[n-1]+"B")
print(l[n][0:x].count("P"))
Problem p03221 (python)

Fixed submission:
n,m=map(int, input().split())
p=[1]*(n+1)
c=[]
for i in range(m):
  pi,x =map(int, input().split())
  c.append([i+1, pi, x, 0])
  #p[pi].append(x)
#for i in range(n):
# p[i]=sorted(p[i])
x_order = sorted(c, key=lambda e: e[2])
for e in x_order:
  e[3] = p[e[1]]
  p[e[1]] += 1

i_order = sorted(x_order)

for e in i_order:
  id=e[1]*1000000+e[3]
  print(str(id).zfill(12))

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
p=[1]*(n+1)
c=[]
for i in range(m):
  pi,x =map(int, input().split())
  c.append([i+1, pi, x, 0])
  #p[pi].append(x)
#for i in range(n):
# p[i]=sorted(p[i])
x_order = sorted(c, key=lambda e: e[2])
for e in range(x_order):
  e[3] = p[pi]
  p[pi] += 1

i_order = sorted(x_order)
for e in i_order:
  id=e[1]*1000000+e[3]
  print(str(id).zfill(12))

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
p=[[] for i in range(n+1)]
c=[]
for i in range(m):
  pi,x =map(int, input().split())
  c.append((pi,x))
  p[pi].append(x)
for i in range(n):
  p[i]=sorted(p[i])
for e in c:
  id=e[0]*1000000+p[e[0]].index(e[1])+1
  proud(str(id).zfill(12))
Problem p03250 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(max(a,b,c)*9+sum([a,b,c]))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(max(a,b,c)*9+sum(a,b,c))
Problem p02570 (python)

Fixed submission:
# Dは距離　Tは制限時間　速度はS
Information_Lists = input().split()
#.split("文字列")で、文字列ごとに分けることができる。"文字列"を入れないとスペースで分けられる。
D = int(Information_Lists[0])
T = int(Information_Lists[1])
S = int(Information_Lists[2])
if D > T * S:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
# Dは距離　Tは制限時間　速度はS
D = int(input())
T = int(input())
S = int(input())
if D > T * S:
    print("No")
else:
    print("Yes")
Problem p02970 (python)

Fixed submission:
n,s=map(int,input().split())

count=n//(2*s+1)

if n%(2*s+1)==0:
    print(count)
else:
    print(count+1)

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

count=n//(2*d+1)

if n%(2*d+1)==0:
    print(count)
else:
    print(count+1)
Problem p02578 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n-1):
    if a[i] <= a[i+1]:
        pass
    else:
        ans += a[i] - a[i+1]
        a[i+1] = a[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
MAX = max(a)
ans = 0
maxflg = False
minflg = False
for i in range(n):
    if a[i] == MAX:
        maxflg = True
        if i == 0:
            index = i + 1
        leftMAX = max(a[:index])
    if maxflg:
        ans += MAX - a[i]

for i in range(n):
    if a[i] == MAX:
        break
    else:
        ans += leftMAX - a[i] 
print(ans)
Problem p02627 (python)

Fixed submission:
a = input()
if a.isupper():
    print('A')
else:
    print('a')

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = ''
while n > 0:
    n -= 1
    ans += chr(97 + n%26)
    n //= 26
print(ans[::-1])
Problem p02699 (python)

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

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

Fixed submission:
a = int(input())
b = int(input())
if a + b == 3:
    print(3)
elif a+b == 4:
    print(2)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
import numpy as np
a,b= map(int,input().split())
lcm = np.lcm(a, b)
print(lcm)
Problem p02831 (python)

Fixed submission:

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

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

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

Buggy submission (verdict: Runtime Error):
import numpy as np
a,b= map(int,input().split())
lcm = np.lcm(a, b)
print(lcm)

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

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

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

Fixed submission:
a,b,c = map(int,input().split())
if(a+b+c>=22):
    print('bust')
else:
    print('win')

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

if(a+b+c>=22):
    print('bust')
else:
    print('win')
Problem p02881 (python)

Fixed submission:
import math
n = int(input())
r = list()
for a in range(1,int(math.sqrt(10**12)+1)):
    if n % a == 0:
        b = n//a
        r.append(a+b-2)
print(min(r))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
r = list()
for a in range(1,int(math.sqrt(n))):
    if n % a == 0:
        b = n//a
        r.append(a+b-2)
print(min(r))
Problem p02987 (python)

Fixed submission:
s=input()
s=sorted(s)

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

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

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

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

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

Buggy submission (verdict: Runtime Error):
s=input()
s=sorted(s)
if s[0]==s[1] and s[2]==s[3]:
　print("Yes")
else:
　print("No")
Problem p03073 (python)

Fixed submission:
s=input()
sento1 = 0
sento0 = 0
for i in range(len(s)):

  if i % 2 == 0:
    
    if s[i] == '1':
      sento1 += 1
      
    elif s[i] == '0':
      sento0 += 1
      
  else:
    if s[i] == '0':
      sento1 += 1
    elif s[i] == '1':
      sento0 += 1
      
print(min(sento1,sento0))

Buggy submission (verdict: Runtime Error):
s=input()
sento1 = 0
sento0 = 0
for i in range(len(s)):

  if i % 2 == 0:
    
    if s[i] == '1':
      sento1 += 1
      
    elif s[i] == '0':
      sento0 += 1
      
  else:
    if s[i] == '0':
      sento1 += 1
    elif s[i] == '1'
      sento0 += 1
      
print(min(sento1,sento0))
Problem p03242 (python)

Fixed submission:
n=input()
for i in range(3):
  if int(n[i]) == 1:print(9,end='')
  else:print(1,end='')

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(3):
  if n[i] == 1:print(9,end='')
  else:print(print(1,end=''))

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(len(n)):
  if n[i] == 1:print(9,end='')
  else:print(print(1,end=''))
Problem p03250 (python)

Fixed submission:
a=list(input().split())
a=sorted(a)
print(int(a[0])+int(a[2]+a[1]))

Buggy submission (verdict: Runtime Error):
a=list(input().split())
a=sorted(a)
print(int(a[2])+int(a[0]+a[1])))

Buggy submission (verdict: Runtime Error):
a=list(input().split()))
a=sorted(a)
print(int(a[2])+int(a[0]+a[1])))
Problem p03315 (python)

Fixed submission:
sum = 0
a = {'-':-1,'+':1}
s=input()
for i in range(len(s)):
  sum+=a[s[i]]
print(sum)

Buggy submission (verdict: Runtime Error):
sum = 0
a = {'-':-1,'+':1}
s=input()
for i in len(s):
  sum+=a[s[i]]
print(sum)

Buggy submission (verdict: Runtime Error):
sum = 0
a = ['-':-1,'+':1]
s=input()
for i in len(s):
  sum+=a[s[i]]
print(sum)
Problem p02701 (python)

Fixed submission:
N=int(input())
A=set(input() for i in range(N))
print(len(A))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=map(chr,input().split())
print(len(set(A)))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=map(input().split())
print(len(set(A)))
Problem p02707 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
l = [0]*N
for i in range(N-1):
  l[A[i]-1] += 1
for i in range(N):
  print(l[i])

Buggy submission (verdict: Runtime Error):
A = list(map(int,input().split()))
l = [0]*int(input())
for i in A:
  l[i-1] += 1
print(*l)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
l = [0]*N
for i in range(N+1):
  l[A[i]-1] += 1
for i in range(N):
  print(l[i])
Problem p02595 (python)

Fixed submission:
#------------------------------------------------------
import numpy as np
N,D = map(int, input().split())
#複数行
xy_list = [list(map(int, input().split())) for i in range(N)]
sum=0
for xy in xy_list:
    if np.sqrt(xy[0]*xy[0]+xy[1]*xy[1])<=D:
        sum+=1
print(sum)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,D = map(int, input().split())
#複数行
xy = [list(map(int, input().split())) for i in range(N)]
sum=0
for x,y in zip(xy):
    if np.sqrt(x*x+y*y)<=D:
        sum+=1
print(sum)
Problem p02759 (python)

Fixed submission:
N=int(input())

if N%2==1:
	print(int(N/2)+1)
else:
	print(int(N/2))

Buggy submission (verdict: Runtime Error):
A11,A12,A13 = map(int, input().split())
A21,A22,A23 = map(int, input().split())
A31,A32,A33 = map(int, input().split())
N = int(input())
b = [int(input()) for _ in range(N)]

cnt11=0
cnt12=0
cnt13=0
cnt21=0
cnt22=0
cnt23=0
cnt31=0
cnt32=0
cnt33=0

for i in range(N):
    if b[i]==A11:
        cnt11+=1
    elif b[i]==A12:
        cnt12+=1
    elif b[i]==A13:
        cnt13+=1
    elif b[i]==A21:
        cnt21+=1
    elif b[i]==A22:
        cnt22+=1
    elif b[i]==A23:
        cnt23+=1
    elif b[i]==A31:
        cnt31+=1
    elif b[i]==A32:
        cnt32+=1
    elif b[i]==A33:
        cnt33+=1
    else:
        pass

bingo=0
if cnt11>0:
    if((cnt12>0 and cnt13>0)or(cnt22>0 and cnt33>0)or(cnt21>0 and cnt31>0)):
        bingo+=1
    else:
        pass
elif cnt12>0:
    if (cnt22>0 and cnt32>0):
        bingo+=1
    else:
        pass
elif cnt13>0:
    if((cnt22>0 and cnt31>0)or(cnt23>0 and cnt33>0)):
        bingo+=1
    else:
        pass
elif cnt21>0:
    if(cnt22>0 and cnt23>0):
        bingo+=1
    else:
        pass
elif cnt31>0:
    if(cnt32>0 and cnt33>0):
        bingo+=1
    else:
        pass
else:
    pass
if bingo>0:
    print('Yes')
else:
    print('No')
Problem p02860 (python)

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

cnt=0
if N%2==1:
    print('No')
else:
    for i in range(int(N/2)):
        if S[i]==S[int(N/2)+i]:
            cnt+=1
        else:
            print('No')
            break
    if cnt==int(N/2):
        print('Yes')

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

cnt=0
if N%2==1:
    print('No')
else:
    for i in range(int(N/2)):
        if S[i]==S[int(N/2)+i]:
            cnt+=1
        else:
            print('No')
            break
    if cnt==int(N/2):
    print('Yes')
Problem p02879 (python)

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

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import sys

N = int(input())

for i in range(1,10):
  #print(N,i,N%i,len(str(int(N/i))))
  if N%i == 0 and len(str(int(N/i))) == 1:
    print('Yes')
    sys.exit()
print('No')
Problem p02987 (python)

Fixed submission:
S = str(input())
s = list(S)
s.sort()
if s[0]==s[1] and s[2]==s[3] and s[1]!=s[2]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S = str(input())
cnt1=0
cnt2=0
for i in range(len(S)):
    if i==0:
        list1=S[0]
        cnt1+=1
    elif i==1:
        if S[i]==list1:
            cnt1+=1
        else:
            list2=S[i]
            cnt2+=1
    else:
        if S[i]==list1:
            cnt1+=1
        elif S[i]==list2:
            cnt2+=1
        else:
            pass
if cnt1==2 and cnt2==2:
    print('Yes')
else:
    print('No')
#print(cnt1,cnt2)

Buggy submission (verdict: Runtime Error):
S = str(input())
cnt1=0
cnt2=0
for i in range(len(S)):
    if i==0:
        list1=S[0]
        cnt1+=1
    elif i==1:
        if S[i]==list1:
            cnt1+=1
        else:
            list2=S[i]
            cnt2+=1
    else:
        if S[i]==list1:
            cnt1+=1
        elif S[i]==list2:
            cnt2+=1
        else:
            pass
if cnt1==2 and cnt2==2:
    print('Yes')
else:
    print('No')
Problem p02622 (python)

Fixed submission:
s = input()
t = input()
n = len(s)
ans = 0
for i in range(n):
    if s[i] != t[i]:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
n = len(s)
s.split()
t.split()
ans = 0
for i in range(n):
    if s[i] != t[i]:
        s[i] = t[i]
    else:
        pass
print(ans)
Problem p02627 (python)

Fixed submission:
a = input()
if a == a.upper():
    print("A")
else:
    print("a")

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
a = sorted(list(map(int,input().split())))
print(sum(a[:k]))

Buggy submission (verdict: Runtime Error):
a = input()
if a.upper() == a
    print("A")
else:
    print("a")
Problem p02699 (python)

Fixed submission:
s,w = map(int,input().split())
if s <= w :
    print("unsafe")
else :
    print("safe")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = set(map(int,input().split()))
a = len(s)
print(a)
Problem p02777 (python)

Fixed submission:
S, T = map(str,input().split())
A, B = map(int,input().split())
U = input()
 
if S == U: A -= 1
if T == U: B -= 1
print("{0} {1}".format(A,B))

Buggy submission (verdict: Runtime Error):
s, t = map(str,input.split())
a, b = map(int,input.split())
u = input()
if s == u:
    a -= 1
if t == u:
    b -= 1
print("{0} {1}".format(a,b))

Buggy submission (verdict: Runtime Error):
s,t = map(str,input.split())
a,b = map(int,input.split())
u = str(input())
if s == u:
    a -= 1
if s == u :
    b -= 1
print("{0} {1}".format(a,b))

Buggy submission (verdict: Runtime Error):
S,T = map(str,input.split())
A,B = map(int,input.split())
u = str(input())
if s == u:
    a -= 1
else :
    b -= 1
print("{0} {1}".format(a,b))

Buggy submission (verdict: Runtime Error):
s,t = map(str,input.split())
a,b = map(int,input.split())
u = str(input())
if s == u:
    a -= 1
else :
    b -= 1
print("{0} {1}".format(a,b))
Problem p02835 (python)

Fixed submission:
W,E,R = map(int,input().split())
if W + E + R >= 22:
    ans="bust"
else :
    ans="win"
print(ans)

Buggy submission (verdict: Runtime Error):
W,E,R = map(int,input().split())
if W + E + R >= 22:
    ans("bust")
else :
    ans("win")
print(ans)

Buggy submission (verdict: Runtime Error):
W,E,R = map(int,input().split())
if W + E + R >= 22:
    ans("bust")
else :
    ans("win")
print(ans)
Problem p02859 (python)

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

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

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

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
if A < 10 and B <10:
  ans = (A * B)
else:
  ans = int(-1)
print(ans)
Problem p02897 (python)

Fixed submission:
N = int(input())
if N%2 == 0:
  ans = 0.5
else:
  ans = (N // 2 + 1) / N
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
x = N += 1
if N % 0:
  ans = (0.5)
else:
  ans = (x / 2)
print(ans)
Problem p02570 (python)

Fixed submission:
D,T,S=map(int,input().split())
if 1<=D<=10000 and 1<=T<=10000 and 1<=S<=10000:
  if (D/S)>T:
    print("No")
  else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
D,T,S=int(input())
if 1<=D<=10000 and 1<=T<=10000 and 1<=S<=10000:
  if (D/S)>T:
    print("He will be late")
  else:
    print("Yes")
Problem p02916 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=sum(b)
for i in range(n-1):
  if a[i]+1==a[i+1]:
    s+=c[a[i]-1]
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=sum(b)
for i in range(n-1):
  if a[i]+1==a[i+1]:
    s+=c[a[i]]
print(s)
Problem p02707 (python)

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

ans = [0]*N

for i in A:
    ans[i-1] += 1

for j in ans:
    print(j)

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

ans = [0]*N

for i in A:
    ans[i-1] += 1

for j in ans:
    print(j)
Problem p02729 (python)

Fixed submission:
import sys

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

def com(n,r):
    ans1 = 1
    ans2 = 1
    tmp = r
    while r != 0:
        ans1 = ans1 * (n)
        ans2 = ans2 * r
        n -= 1
        r -= 1

    return ans1/ans2

print(int(com(N,2)+com(M,2)))

Buggy submission (verdict: Runtime Error):
import sys

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

def com(n,r):
    ans1 = 1
    ans2 = 1
    tmp = r
    while r != 0:
        ans1 = ans1 * (n)
        ans2 = ans2 * r
        n -= 1
        r -= 1

    return ans1/ans2

print(int(com(N,2)+com(M,2))

Buggy submission (verdict: Runtime Error):
import sys

N = int(input()) #偶数の球の数
M = int(input()) #奇数の球の数

def combination(n,r):
    if n == 1:
        ans = 0

    if r != 1:
        ans = n/r * combination(n-1,r-1)
    elif r == 1:
        ans = n/r

    return ans

print(combination(N,2)+combination(M,2))

Buggy submission (verdict: Runtime Error):
import sys

N = int(sys.argv[1]) #偶数の球の数
M = int(sys.argv[2]) #奇数の球の数

def combination(n,r):
    if n == 1:
        ans = 0

    if r != 1:
        ans = n/r * combination(n-1,r-1)
    elif r == 1:
        ans = n/r

    return ans

print(combination(N,2)+combination(M,2))
Problem p02753 (python)

Fixed submission:
S = list(input())

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

Buggy submission (verdict: Runtime Error):
import math

A, B = map(int,input().split())

pricemax_A = math.floor((A+1)/0.08)
pricemin_A = math.floor(A/0.08)

pricemax_B = math.floor((B+1)/0.1)
pricemin_B = math.floor(B/0.1)

if pricemin_A >= pricemax_B or pricemax_A =< pricemin_B:
    print(-1)
elif pricemin_A >= pricemin_B:
    print(pricemin_A)
elif pricemin_A < pricemin_B:
    print(pricemin_B)
Problem p02847 (python)

Fixed submission:
S = input()
week = {'SUN':7,'MON':6,'TUE':5,'WED':4,'THU':3,'FRI':2,'SAT':1}
print(week[S])

Buggy submission (verdict: Runtime Error):
S = input()
week = {'SUN':7,'MON':6,'TUE':5,'WED':4,'THR':3,'FRI':2,'SAT':1}
print(week[S])
Problem p02754 (python)

Fixed submission:
N,A,B = [int(i) for i in input().split(" ")]


def check(N,A,B):
    if A == 0:
        return 0
    r  = N//(A+B)
    x = N-r*(A+B)
    if x > A:
        return r*A+A
    else:
        return r*A+x
print(check(N,A,B))

Buggy submission (verdict: Runtime Error):
N,A,B = [int(i) for i in input().split(" ")]


def check(N,A,B):
    if A == 0:
        return 0
    text = ("b"*A)+("r"*B)
    text =  (text*((A+B)*N))
    return text[:N].count("b")
    
print(check(N,A,B))
Problem p02831 (python)

Fixed submission:
import fractions

A,B = [int(i) for i in input().split(" ")]

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

print(lcm(A,B))

Buggy submission (verdict: Runtime Error):
import math

A,B = [int(i) for i in input().split(" ")]

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

print(lcm(A,B))
Problem p03307 (python)

Fixed submission:
N = int(input())
i = N
while True:
    if i % 2 == 0 and i % N ==0:
        print(i)
        break
    i+=i

Buggy submission (verdict: Runtime Error):
i = N
while True:
    if i % 2 == 0 and i % N ==0:
        print(i)
        break
    i+=i
Problem p02571 (python)

Fixed submission:
s=input()
t=input()
ans=len(t)
for i in range(len(s)-len(t)+1):
	p=s[i:i+len(t)]
	cur = 0
	for j in range(len(t)):
		if t[j] != p[j]:
			cur += 1
	ans=min(ans,cur)
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
ans=len(t)
for i in range(len(s)-len(t)+1):
	p=s[i:i+len(t)]
	cur = 0
	for j in range(len(t)):
		if t[j] != t[i + j]:
			cur += 1	
	ans=max(ans,cur)
print(ans)
Problem p03107 (python)

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

count = 0
for i in range(N):
    if S[i] == "0":
        count += 1

ans = min(count, N - count) * 2
print(ans)

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

count = 0
for i in range(N):
    if S[i] == 0:
        count += 1

ans = min(count, N - count)
print(ans)