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

Fixed submission:
s = input().split(" ")
L = int(s[0])
R = int(s[1])
d = int(s[2])
cnt = 0
for i in range(L, R+1):
  if i%d == 0:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
s = input().split(" ")
L = int(s[0])
R = int(s[1])
d = int(s[2])
cnt = 0
for i in range(L:R+1):
  if i%d == 0:
    cnt += 1
print(cnt)
Problem p03076 (python)

Fixed submission:
t = [int(input()) for i in range(5)]
r = [x%10 for x in t]
if all(x==0 for x in r):
  print(sum(t))
else:
  y = min(set(r)-{0})
  print(sum(x if x%10==0 else 10*(1+x//10) for x in t) -10+y)

Buggy submission (verdict: Runtime Error):
t = [int(input()) for i in range(5)]
r = [x%10 for x in t]
if all(x%10==0 for x in r):
  print(sum(t))
else:
  y = sorted(set(r))[1]
  print(sum(x if x%10==0 else 10*(1+x//10) for x in t) -10+y)

Buggy submission (verdict: Runtime Error):
t = [int(input()) for i in range(5)]
r = [x%10 for x in t]
if all(x==0 for x in r):
  print(sum(t))
else:
  y = sorted(set(r))[1]
  print(sum(x if x%10==0 else 10*(1+x//10) for x in t) -10+y)
Problem p03282 (python)

Fixed submission:
for i,n in enumerate(input()):
  if n!= '1':
    break
print(n if i<int(input()) else 1)

Buggy submission (verdict: Runtime Error):
for i,n in enumerate(int(input())):
  if n!= 1:
    break
print(n if i<int(input()) else 1)

Buggy submission (verdict: Runtime Error):
for i,n in enumerate(int(input())):
  if n!= 1:
    break
print(n if i<input() else 1)

Buggy submission (verdict: Runtime Error):
S = input()
K = input()
for i,n in enumerate(S):
  if n!= 1:
    break
print(n if i<K else 1)
Problem p02630 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC= [list(map(int, input().split()))]
for _ in range(1,Q):
    BC.append(list(map(int, input().split())))

num = [0]*10**5

#Aの要素の数を管理するリストnumを作成
for k in range(len(A)):
    num[A[k]-1] += 1

counter = 0 #Biと一致した要素の数
s = sum(A) #合計を初期化

for q in range(Q):
    counter = num[BC[q][0]-1]
    num[BC[q][1]-1] += counter #Ciの数に加える
    num[BC[q][0]-1]=0 #Biと等しい値を0個に
    s += (BC[q][1]- BC[q][0])*counter
    print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC= [list(map(int, input().split()))]
for i in range(1,Q):
    BC.append(list(map(int, input().split())))

num = [0]*10**5

#Aの要素の数を管理するリストnumを作成
for k in range(len(A)):
    num[A[k]+1] += 1

counter = 0 #Biと一致した要素の数
s = sum(A) #合計を初期化

for q in range(Q):
    counter = num[BC[q][0]+1]
    num[BC[q][1]+1] += counter #Ciの数に加える
    num[BC[q][0]+1]=0 #Biと等しい値を0個に
    s += (BC[q][1]- BC[q][0])*counter
    print(s)
Problem p02641 (python)

Fixed submission:
# -*- coding: utf-8 -*-

def main():

    X, N = map(int, input().split())
    p = list(map(int, input().split()))

    for i in range(101):
        if (X - i) not in p:
            ans = X - i
            break

        elif (X + i) not in p:
            ans = X + i
            break

    print(ans)


if __name__ == "__main__":
    main()

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

def main():

    X, N = map(int, input().split())
    p = list(map(int, input().split()))

    listNotP = []

    if N == 0:
        ans = 0

    for i in range(0, 101):
        if i not in p:
            listNotP.append(i)

    listNotP.sort()

    for i in range(len(listNotP) - 1):
        if abs(listNotP[i] - X) < abs(listNotP[i + 1] - X):
            ans = listNotP[i]
            break

        elif abs(listNotP[i] - X) == abs(listNotP[i + 1] - X):
            ans = listNotP[i]
            break

    print(ans)


if __name__ == "__main__":
    main()

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

def main():

    X, N = map(int, input().split())
    p = list(map(int, input().split()))

    listNotP = []

    if N == 0:
        ans = 0

    for i in range(1, 101):
        if i not in p:
            listNotP.append(i)

    listNotP.sort()

    for i in range(len(listNotP) - 1):
        if abs(listNotP[i] - X) < abs(listNotP[i + 1] - X):
            ans = listNotP[i]
            break

        elif abs(listNotP[i] - X) == abs(listNotP[i + 1] - X):
            ans = listNotP[i]
            break

    print(ans)


if __name__ == "__main__":
    main()
Problem p02658 (python)

Fixed submission:
# -*- coding: utf-8 -*-

def main():

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

    ans = 1

    if 0 not in A:
        for i in A:
            ans *= i
            if ans > 10 ** 18:
                ans = -1
                break

    else:
        ans = 0

    print(ans)


if __name__ == "__main__":
    main()

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

def main():

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

    ans = 1

    for i in A:
        if A == 0:
            ans = 0
            break
        ans *= i
            if ans > 10 ** 18:
            ans = -1

    print(ans)


if __name__ == "__main__":
    main()
Problem p02909 (python)

Fixed submission:
# -*- coding: utf-8 -*-

def main():

    S = input()

    if S == 'Sunny':
        ans = 'Cloudy'

    elif S == 'Cloudy':
        ans = 'Rainy'

    else:
        ans = 'Sunny'

    print(ans)


if __name__ == "__main__":
    main()

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

def main():

    S = input()

    if S == 'Sunny':
        ans = 'Cloudy'

    elif S == 'Cloudy':
        ams = 'Rainy'

    else:
        ans = 'Sunny'

    print(ans)


if __name__ == "__main__":
    main()
Problem p03280 (python)

Fixed submission:
# -*- coding: utf-8 -*-

def main():

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

    ans = (A-1) * (B-1)

    print(ans)


if __name__ == "__main__":
    main()

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

def main():

    N = int(input())

    ans = 0

    for i in range(1, N+1):
        if i % 2 == 1:

            count = 0

            for j in range(1, i+1):
                if i % j == 0:
                    count +=1
                if count == 8:
                    ans += 1
        
    print(ans)


if __name__ == "__main__":
    main()
Problem p04030 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# B - バイナリハックイージー

s = input()
listAns = []

set1 = ['0', '1']
set2 = ['B']

listS = list(s)

# print(listS)

for i in listS:
    if i in set1:
        listAns.append(i)

    elif i in set2:
        if len(listAns) != 0:
            listAns.pop()

ans = "".join(listAns)

print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# B - バイナリハックイージー

s = input()
listAns = []

set1 = ['0', '1']
set2 = ['B']

listS = list(s)

print(listS)

for i in listS:
    if i in set1:
        listAns.append(i)

    elif i in set2:
        if len(listAns) != 0:
            listAns.pop()

ans = reduce(lambda x, y: x + y, [str(x) for x in listAns])

print(ans)
Problem p04043 (python)

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

counter5 = 0
counter7 = 0

for num in l:
    if num == 5:
        counter5+=1
    
    if num == 7:
        counter7+=1

if counter5 == 2 and counter7 == 1:
    print("YES")

else:
    print("NO")

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

    counter5 = 0
    counter7 = 0

    for num in l:
        if num == 5:
            counter5+=1
        
        if num == 7:
            counter7+=1

    if counter5 == 2 and counter7 == 1:
        print("Yes")
    
    else:
        print("No")

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

    counter5 = 0
    counter7 = 0

    for num in input:
        if num == 5:
            counter5+=1
        
        if num == 7:
            counter7+=1

    if counter5 == 2 and counter7 == 1:
        print("Yes")
    
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
def main():
    # input = "5 7 7"
    input = list(map(int, input().split()))
    print(input)

    counter5 = 0
    counter7 = 0

    for num in input:
        if num == 5:
            counter5+=1
        
        if num == 7:
            counter7+=1

    if counter5 == 2 and counter7 == 1:
        print("Yes")
    
    else:
        print("No")



if __name__ == "__main__":
    main()
Problem p04045 (python)

Fixed submission:
# -*- coding: utf-8 -*-

def main():


    N, K = map(int, input().split())
    D = list(map(int, input().split()))

    numList = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

    num = set()
        
    for i in numList:
        if i not in D:
            num.add(i)
    

    for i in range(N, N * 10 + 1):
        setI = set(int(x) for x in list(str(i)))
        if len(num | setI) <= len(num):
            ans = i
            break
                
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# C - こだわり者いろはちゃん

N, K = map(int, input().split())
D = list(map(int, input().split()))
numList = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
listAns = []

num = []
listN = [int(x) for x in list(str(N))]

# print(listN)

for i in numList:
    if i not in D:
        num.append(i)

# print(num)

for i in listN:
    for j in num:
        if j >= i:
            listAns.append(j)
            break
            
# print(listAns)
ans = int(reduce(lambda x, y: x + y, [str(x) for x in listAns]))
print(ans)
Problem p02606 (python)

Fixed submission:
l, r, d = map(int, input().split())
print(r//d - (l-1)//d)

Buggy submission (verdict: Runtime Error):
l, r, d = input().split()
print(r//d -(l-1)//d)

Buggy submission (verdict: Runtime Error):
l, r, d = input().split()
t1 = int(r/d)
t2 = int(l/d)
print(t1-t2)
Problem p02607 (python)

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

count = 0

for i in range(0,N,2):
  jd = a[i]
  if jd % 2 == 1:
    count += 1

print(count)

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

count = 0

for i in range(int(N/2)+1):
  cd = 2 * i
  jd = a[cd]
  if jd % 2 == 1:
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = []
a = input().split()

count = 0

for i in range(int(N/2) + 1):
  cd = 2 * i - 2
  jd = int(a[cd])
  if jd % 2 == 1:
    count += 1
    

print(count)
Problem p02882 (python)

Fixed submission:
import numpy as np

a,b,x = input().split()
a = int(a)
b = int(b)
x = int(x)
ans = 0
if 2*x/(a**2) < b:
  l = 2*x/(a*b)
  ans = np.arctan(l/b)
else:
  l = 2 * (b - x/(a**2))
  if l == 0:
    ans = np.pi/2
  else:
    ans = np.arctan(a/l)

ans = 90 - np.rad2deg(ans)
print('{:.10f}'.format(ans))

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

a,b,x = input().split()
a = int(a)
b = int(b)
x = int(x)
ans = 0.000000000
if 2*x/(a**2) < b:
  l = 2*x/(a*b)
  ans = np.arctan(l/b)
else:
  l = 2 * (b - x/(a**2))
  ans = np.arctan(a/l)

ans = 90 - np.rad2deg(ans)
print('{:.10f}'.format(ans))
Problem p02606 (python)

Fixed submission:
L,R,d = (int(x) for x in input().split())
cnt=0
for i in range(L,R+1):
 if i%d==0:
        cnt+=1

print(cnt)

Buggy submission (verdict: Runtime Error):
L,R,d = (int(x) for x in input().split())

for i in range(R):
    if d*i>=R:
      max=i
      break

for i in range(L):
    if d*i>=L:
        min=i-1
        break

print(str(max-min))

Buggy submission (verdict: Runtime Error):
L,R,d = (int(x) for x in input().split())

for i in range(R):
    if d*i>=R:
      max=i
      break

for i in range(L):
    if d*i>L:
        min=i
        break

print(str(max-min))

Buggy submission (verdict: Runtime Error):
L=input("始まりの数")
L=int (L)
R=input("終わりの数")
R=int (R)
d=input("倍数の元となる数")
d=int(d)
for i in range(R):
    if d*i>=R:
      max=i
      break

for i in range(L):
    if d*i>=L:
        min=i
        break

print(str(max-min))
Problem p02639 (python)

Fixed submission:
input=input()
x = input.split()
for i in range(5):
    if(x[i]=='0'):
        print(i+1)
        break

Buggy submission (verdict: Runtime Error):
length=int(input())
list=list(map(int,input().split()))
list.sort()
max=list[-1]
dp=[True]*(max+1)
ret=0
for num in list:
    if dp[num]:
        if list.count(num)!=1:
            dp[num]=False
        else:
            ret=ret+1
            i=2
            num2=num*i
            while num2<max+1:
                if num2 in list:
                    dp[num2]=False
                i=i+1
                num2=num*i
print(ret)

Buggy submission (verdict: Runtime Error):
input=[input().split() for i in range(2)]
length=int(input[0][0])
list=[]
for i in range(length):
    list.append(int(input[1][i]))
ret=0
list.sort()
for i in range(length):
    flg=True
    num=list[i]
    if list.count(num)==1:
        for j in range(i):
            if i!=j and num%list[j]==0:
                flg=False
                break
        if flg:
            ret=ret+1
print(ret)

Buggy submission (verdict: Runtime Error):
input=[input().split() for i in range(2)]
length=int(input[0][0])
list=[]
for i in range(length):
    list.append(int(input[1][i]))
ret=0
list.sort()
for i in range(length):
    flg=True
    num=list[i]
    if list.count(num)==1:
        for j in range(i+1):
            if i!=j and num%list[j]==0:
                flg=False
                break
        if flg:
            ret=ret+1
print(ret)
Problem p02658 (python)

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

flg=True
if 0 in list:
  print(0)
  flg=False
else:
  prod=1
  for a in list:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      flg=False
      break
if flg:
  print(prod)

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

if 0 in list:
  print(0)
else:
  prod=1
  for a in list:
    flg=True
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      flg=False
      break
if flg:
  print(prod)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
n=input()
list=list(map(int,input().split()))
list=np.array(list,'int64')
ans=np.prod(list)
p=math.log10(ans)
if p>=18:
  print(-1)
else:
  print(np.prod(list))

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
n=input()
list=list(map(int,input().split()))
list=np.array(list,int)
ans=np.prod(list)
p=math.log10(ans)
if p>=18:
  print(-1)
else:
  print(np.prod(list))

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
n=input()
list=list(map(int,input().split()))
list=np.array(list,int)

p=math.log10(list)
p=p.sum()
if p>=18:
  print(-1)
else:
  print(np.prod(list))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
ans=a*b
p=math.log10(ans)
if p>=18:
  print(-1)
else:
  print(ans)
Problem p02761 (python)

Fixed submission:
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for _ in range(m)]
a=[0]*(n+1)
if n!=1:
    a[1]=1
d=[-1]*(n+1)
flg=True
for i in range(m):
    s=sc[i][0]
    c=sc[i][1]
    if d[s]==-1 or a[s]==c:
        a[s]=c
        d[s]=0
    else:
        flg=False
ans=int("".join(map(str,a)))
if ans>=10**(n-1) and flg:
    print(ans)
elif n==1 and ans==0:
    print(ans)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
def main():
    n,m=map(int,input().split())
    sc=[list(map(int,input().split())) for _ in range(m)]
    a=[0]*(n+1)
    if n==3:
        a[1]=1
    elif n==2:
        a[2]=1
    d=[-1]*(n+1)
    for i in range(m):
        s=sc[i][0]
        c=sc[i][1]
        if d[s]==-1 or a[s]==c:
            a[s]=c
            d[s]=0
        else:
            print(-1)
            return
    ans=100*a[1]+10*a[2]+a[3]
    if ans>=10**(n-1):
        print(ans)
        return
    else:
        print(-1)
        return
main()
Problem p02719 (python)

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

tmp = n%k
print(min(tmp, abs(tmp-k)))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
tmp = min(n,k)
n = max(n, k)
k = tmp

def calc(n, k):
  if n < k:
    return abs(n-k)
  else:
    return calc(abs(n-k), k)
 
if k == 1:
  print(0)
else:
  print(calc(n,k))
Problem p02743 (python)

Fixed submission:
from decimal import Decimal
a, b, c = map(int, input().split())

a = Decimal(a).sqrt()
b = Decimal(b).sqrt()
c = Decimal(c).sqrt()

if a + b < c:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print("Yes" ((c-a-b) > 0 and 4*a*b < (c-a-b)**2) if else "No")
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())
digit = [list(map(int, input().split())) for _ in range(m)]

for i in range(10**n):
  tmp = str(i)
  if len(tmp) == n:
    flag = True
    for s, c in digit:
      if tmp[s-1] != str(c):
        flag = False
        break
    if flag:
      print(i)
      exit()
print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
digit = [[] for i in range(n)]
for i in range(m):
  s, c= map(str, input().split())
  digit[int(s)-1].append(c)

flag = True
for i in range(n):
  if len(digit[i]) > 1:
    digit[i] = list(set(digit[i]))
  if len(digit[i]) > 1:
    flag = False

if n == 3:
  if len(digit[0]) > 0:
    if digit[0][0] == "0":
      flag= False
if n == 2:
  if len(digit[0]) > 0:
    if digit[0][0] == "0":
      flag = False

      
if flag:
  ans = []
  for i in range(10**(n-1),10**n):
    tmp = 0
    count =10**(n-1)
    for j in range(len(digit)):
      if len(digit[j]) > 0:
        tmp+=count*int(digit[j][0])
      count/=10
    if i == tmp:
      ans.append(i)
  print(min(ans))
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
digit = [[] for i in range(n)]
for i in range(m):
  s, c= map(str, input().split())
  digit[int(s)-1].append(c)

flag = True
for i in range(n):
  if len(digit[i]) > 1:
    digit[i] = list(set(digit[i]))
  if len(digit[i]) > 1:
    flag = False

if flag:
  ans = []
  for i in range(10**(n-1),10**n):
    tmp = 0
    count =10**(n-1)
    for j in range(len(digit)):
      if len(digit[j]) > 0:
        tmp+=count*int(digit[j][0])
      count/=10
    if i == tmp:
      ans.append(i)
  print(min(ans))  
else:
  print(-1)

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

tmp = ["0" for i in range(n)]
digit = [[] for i in range(n)]
for i in range(m):
  s, c= map(str, input().split())
  digit[int(s)-1].append(c)
for i in range(n):
  if len(digit[i]) == 0:
    digit[i].append("0")
  

ans = []
if n == 3:
  for i in range(len(digit[0])):
    for j in range(len(digit[1])):
      for k in range(len(digit[2])):
        t = int(digit[0][i] + digit[1][j]+digit[2][k])
        if len(str(t)) == n:
          ans.append(t)  
if n ==2:
  for i in range(len(digit[0])):
    for j in range(len(digit[1])):
      t = int(digit[0][i] + digit[1][j]+digit[2][k])
      if len(str(t)) == n:
        ans.append(t)
if n == 1:
  for i in range(len(digit[0])):
    t = int(digit[0][i])
    ans.append(t)
    
if len(ans) == 0:
  print(-1)
else:
  print(min(ans))
Problem p02922 (python)

Fixed submission:
import math
A, B = map(int, input().split())

print(math.ceil((B-1)/(A-1)))

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

if(count > 0):
  if count//(A-1) == 0:
	print(1 + count//(A-1))
  else:
    print(2 + count//(A-1))
else:
	print(1)
Problem p02947 (python)

Fixed submission:
N = int(input())
s = [sorted(input()) for i in range(N)]

ans = 0
aDict = {}
for i in s:
  if str(i) not in aDict:
    aDict[str(i)] = 1
  else:
  	aDict[str(i)] += 1
    
for n in aDict.values():
    ans += (n*(n-1)//2)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [sorted(input()) for i in range(N)]

ans = 0
aDict = {}
for i in s:
  if str(i) not in aDict:
    aDict[str(i)] = 1
  else
  	aDict[str(i)] += 1
    
for n in aDict.values():
    ans += (n*(n-1)//2)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [list(input()) for i in range(N)]

ans = 0
aDict = {}
for i in s:
  i.sort()
  if str(i) not in aDict:
    aDict[str(i)] = 1
  else:
    ans += aDict[str(i)] 
    aDict[str(i)] += 1
    
print(ans)
Problem p03106 (python)

Fixed submission:
a, b, k = map(int, input().split())

ans = []
for i in range(1, max(a,b)+1):
  if a % i == 0 and b % i == 0:
    ans.append(i)
print(ans[len(ans)- k])

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

ans = []
for i in range(1, max(a,b)):
  if a % i == 0 and b % i == 0:
    ans.append(i)
    
print(ans[len(ans)- k])
Problem p03425 (python)

Fixed submission:
N = int(input())
name = [input() for i in range(N)]
nameList = [0 for i in range(5)]

P = [0 ,0 ,0 ,0 ,0 ,0 ,1 ,1 ,1 ,2]
Q = [1 ,1 ,1 ,2 ,2 ,3 ,2 ,2 ,3 ,3]
R = [2 ,3 ,4 ,3 ,4 ,4 ,3 ,4 ,4 ,4]

for n in name:
  if n[0] == 'M':
    nameList[0] += 1
  elif n[0] == 'A':
    nameList[1] += 1
  elif n[0] == 'R':
    nameList[2] += 1
  elif n[0] == 'C':
    nameList[3] += 1
  elif n[0] == 'H':
    nameList[4] += 1

ans = 0
for i in range(10):
  ans += nameList[P[i]] * nameList[Q[i]] * nameList[R[i]]
    
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
name = [input() for i in range(N)]
nameList = [0 for i in range(5)]

for n in name:
  if n[0] == 'M':
    nameList[0] += 1
  elif n[0] == 'A':
    nameList[1] += 1
  elif n[0] == 'R':
    nameList[2] += 1
  elif n[0] == 'C':
    nameList[3] += 1
  elif n[0] == 'H':
    nameList[4] += 1

ans = [i for i in nameList if i != 0]
n = len(ans)
r = 3
a = 0
if len(ans) > 0:
	a = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in ans:
  a *= i
print(a)
Problem p03611 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = [0 for i in range(max(a)+3)]

for i in a:
  ans[i]+=1
  ans[i+1]+=1
  ans[i-1]+=1
    
print(max(ans))

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

ans = [0 for i in range(max(a))]

for i in a:
  ans[i-1]+=1
  if i <max(a):
    ans[i]+=1
  if i-2 >= 0:
    ans[i-2]+=1
print(max(ans))
Problem p03838 (python)

Fixed submission:
x, y = map(int, input().split())
diff = abs(abs(x)-abs(y))

if abs(x) < abs(y):
  if x < 0:
    diff += 1
  if y < 0:
    diff += 1
else:
  if x > 0:
    diff += 1
  if y > 0:
    diff += 1
print(diff)

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
diff = abs(abs(x)-abs(y))

elif abs(x) < abs(y):
  if x < 0 and y < 0:
    diff += 2
  elif x > 0 and y < 0:
    diff += 1
  elif x < 0 and y > 0:
    diff += 1
else:
  if x > 0 and y > 0:
    diff += 2
  elif x < 0 and y > 0:
    diff += 1
  elif x > 0 and y < 0:
    diff += 1
  

print(diff)
Problem p03998 (python)

Fixed submission:
def nextTurn(a):
  if a == "a":
    return 0
  elif a == "b":
    return 1
  else:
    return 2
    
hand = [list(input()) for i in range(3)]
turn = nextTurn(hand[0].pop(0))
while(True):
  if len(hand[turn]) == 0:
    if turn == 0:
      print("A")
    elif turn == 1:
      print("B")
    else:
      print("C")
    break
  turn = nextTurn(hand[turn].pop(0))

Buggy submission (verdict: Runtime Error):
def nextTurn(a):
  if a == "a":
    return 0
  elif a == "b":
    return 1
  else:
    return 2
    
hand = [list(input()) for i in range(3)]
turn = nextTurn(hand[0].pop(0))
while(True):
  turn = nextTurn(hand[turn].pop(0))
  if len(hand[turn]) == 0:
    if turn == 0:
      print("A")
    elif turn == 1:
      print("B")
    else:
      print("C")
    break

Buggy submission (verdict: Runtime Error):
def nextTurn(a):
  if a == "a":
    return 0
  elif a == "b":
    return 1
  else:
    return 2
    
hand = [list(input()) for i in range(3)]
turn = nextTurn(hand[0].pop(0))
while(True):
  tmp = turn
  turn = nextTurn(hand[turn].pop(0))
  if len(hand[tmp]) == 0:
    if tmp == 0:
      print("A")
    elif tmp == 1:
      print("B")
    else:
      print("C")
    break

Buggy submission (verdict: Runtime Error):
def nextTurn(a):
  if a == "a":
    return 0
  elif a == "b":
    return 1
  else:
    return 2
    
hand = [list(input()) for i in range(3)]
turn = nextTurn(hand[0].pop(0))
while(True):
  tmp = turn
  turn = nextTurn(hand[turn].pop(0))
  if len(hand[turn]) == 0:
    if tmp == 0:
      print("A")
    elif tmp == 1:
      print("B")
    else:
      print("C")
    break