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

Fixed submission:
import numpy as np
s = 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)
        if len(str(divisors[-1]))<=9:
            break
    return divisors

if s != 1000000000000000000:
    tmp = int(np.ceil(np.sqrt(s)))
    tmp2 = tmp*(tmp) - s
    if tmp2<=1:
        tmp2 = tmp*(tmp+1) - s
        y3 = tmp +1
    else:
        y3 = tmp
    div = make_divisors(tmp2)[-2:]

    x1 = 0
    y1 = 0
    x2 = tmp
    y2 = div[0]
    try:
        x3 = div[1]
    except:
        x3 = div[0]
    if x2==x3 and y2==y3:
        dummy = y2
        y2 = x3
        x3 = dummy
else:
    x1, y1, x2, y2, x3, y3 = 0, 0, 0, 1000000000, 1000000000, 0
    
print(x1, y1, x2, y2, x3, y3)

Buggy submission (verdict: Runtime Error):
import numpy as np
s = 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)
        if len(str(divisors[-1]))<=9:
            break
    raise ValueError("error!")
    return divisors

tmp = int(np.ceil(np.sqrt(s)))
tmp2 = tmp*(tmp) - s
if tmp2<=1:
    tmp2 = tmp*(tmp+1) - s
    y3 = tmp + 1
else:
    y3 = tmp
div = make_divisors(tmp2)[-2:]

x1 = 0
y1 = 0
x2 = tmp
y2 = div[0]
try:
    x3 = div[1]
except:
    x3 = div[0]
    
print(x1, y1, x2, y2, x3, y3)

Buggy submission (verdict: Runtime Error):
import numpy as np
s = 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)
        if len(str(divisors[-1]))<=9:
            break
    return divisors

tmp = int(np.ceil(np.sqrt(s)))
tmp2 = tmp*(tmp) - s
if tmp2<=1:
    tmp2 = tmp*(tmp+1) - s
    y3 = tmp +1
else:
    y3 = tmp
div = make_divisors(tmp2)[-2:]

x1 = 0
y1 = 0
x2 = tmp
y2 = div[0]
x3 = div[1]

print(x1, y1, x2, y2, x3, y3)
Problem p03006 (python)

Fixed submission:
n = int(input()) 
X = [[int(i) for i in input().split()] for i in range(n)] 

from collections import Counter
def cal_diff(x1, x2):
    return (x1[0] - x2[0], x1[1] - x2[1])

if n != 1:
  hoge = [cal_diff(x1, x2) for x1 in X for x2 in X if x1 != x2]
  minus = Counter(hoge).most_common(1)[0][1]
  ans = n - minus
  print(ans)
elif n == 1:
  print(1)

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

from collections import Counter
def cal_diff(x1, x2):
    return (x1[0] - x2[0], x1[1] - x2[1])

hoge = [cal_diff(x1, x2) for x1 in X for x2 in X if x1 != x2]
minus = Counter(hoge).most_common(1)[0][1]
ans = n - minus
print(ans)
Problem p03031 (python)

Fixed submission:
import numpy as np
n, m = (int(_) for _ in input().split())  
skp = [[int(i) for i in input().split()] for i in range(m+1)]
sk, p = skp[:-1], skp[-1]

def judge(sw_status, sk, p):
    sk = (np.array(sk) - 1).tolist()
    num = sw_status[[sk[1:]]].sum()%2
    if num == p:
        light = 1
    else:
        light = 0
    return light

ans = 0
for i in range(2**n):
    sw_status = np.array([j for j in bin(i)[2:].zfill(n)]).astype(int)
    for SK, P in zip(sk, p):
        j = judge(sw_status, SK, P)
        if j is 0:
            break
    if j is 1:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n, m = (int(_) for _ in input().split())  
skp = [[int(i) for i in input().split()] for i in range(m+1)]
sk, p = skp[:-1], skp[-1]

def judge(sw_status, sk, p):
  sk = np.array(sk) - 1
  num = sw_status[sk[1:]].sum()%2
  if num == p:
    light = 1
  else:
    light = 0
  return light

# sw_status = np.array([0 for i in range(n)])
ans = 0
for i in range(2**n):
  sw_status = [j for j in bin(i)][2:]
  for SK, P in zip(sk, p):
  	j = judge(sw_status, SK, P)
    if j==0:
      break
    else:
      ans += 1

print(ans)
Problem p03035 (python)

Fixed submission:
a, b = [int(i) for i in input().split()]

if a >= 13:
  print(b)
elif a>=6 and a<=12:
  print(int(b/2))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a, b = [i for i in input().split()]

if a >= 13:
  print(b)
elif a>=6 and a<=12:
  print(b/2)
else:
  print(0)
Problem p03043 (python)

Fixed submission:
n, k = (int(i) for i in input().split())
 
def win_num(f, k):
    i = 0
    F = f
    while F<k:
        F = f
        F = F*(2**i)
        i += 1
    if i == 0:
        return i
    else:
        return i - 1

ls = []
for f in range(n):
    wn = win_num(f+1, k)
    ls.append((1/n) * (1/2)**wn)
print(sum(ls))

Buggy submission (verdict: Runtime Error):
s = input()
a, b = int(s[:2]), int(s[2:])

def func(i):
  if (i==0) | (i>12):
    return 'YY'
  else:
    return 'MM'
  
ans  = func(a) + func(b)
if (ans=='YYMM') | (ans=='MMYY'):
  print (ans)
elif ans=='MMMM':
  print ('AMBIGUOUS')
else:
  print('NA')
Problem p02687 (python)

Fixed submission:
x=input()
if x=='ABC':
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
x=intput()
if x=='ABC':
    print("ARC")
else:
    print("ABC")
Problem p02909 (python)

Fixed submission:
A = input()

if A == "Sunny":
    print("Cloudy")
elif A == "Cloudy":
    print("Rainy")
else:
    print("Sunny")

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

if A == "Sunny":
    print("Cloudy")
else A == "Cloudy":
    print("Rainy")
else:
    print("Sunny")
Problem p02910 (python)

Fixed submission:
S = list(input())

for c in range(1,len(S)+1):
    if c%2==1: 
        if S[c-1] == 'L':
            print('No')
            break
    else:
        if S[c-1] == 'R':
            print('No')
            break
else:
    print('Yes')

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

for c in range(1,len(S)+1):
    if c%2==1: 
        if S[c] == 'L':
            print('No')
            break
    else:
        if S[c] == 'R':
            print('No')
            break
else:
    print('Yes')
Problem p02981 (python)

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

if N*A < B:
    print(N*A)
else:
    print(B)

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())

mod = []
if R+1-L<=2019:
    for i in range(L,R):
        for j in range(i+1,R+1):
            mod.append((i*j)%2019)

else:
    for i in range(L, L+2019):
        for j in range(i, L+2019+1):
            mod.append((i*j)%2019)


if len(mod)==0:
    print((L*R)%2019)
else:
    print(min(mod))
Problem p03076 (python)

Fixed submission:
def rest(num):
    return num % 10

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
Foods = [A,B,C,D,E]
res = 0

poplist=[]
for idx in range(5):
    if Foods[idx]%10==0:
        res += Foods[idx]
        poplist.append(idx)
while len(poplist)>0:
    idx = max(poplist)
    Foods.pop(idx)
    poplist.pop(poplist.index(idx))

while len(Foods) > 0:
    idx = Foods.index(max(Foods, key=rest))
    if len(Foods)>1:
        res += (Foods[idx]//10)*10+10
    else:
        res += Foods[idx]
    Foods.pop(idx)



print(res)

Buggy submission (verdict: Runtime Error):
def rest(num):
    return num % 10

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
Foods = [A,B,C,D,E]
res = 0

poplist=[]
for idx in range(5):
    if Foods[idx]%10==0:
        res += Foods[idx]
        poplist.append(idx)
while len(poplist)>0:
    idx = max(poplist)
    Foods.pop(idx)
    poplist.pop(idx)

while len(Foods) > 0:
    idx = Foods.index(max(Foods, key=rest))
    if len(Foods)>1:
        res += (Foods[idx]//10)*10+10
    else:
        res += Foods[idx]
    Foods.pop(idx)



print(res)
Problem p03085 (python)

Fixed submission:

b = input()

if b == "A":
  print("T")
elif b == "T":
  print("A")
elif b == "G":
  print("C")
elif b == "C":
  print("G")

Buggy submission (verdict: Runtime Error):

N, Q = map(int, input().split())
S = list(input())

AClist = [0]
counter = 0

i=0
while i+1 < N:
    if S[i:i+2] == "AC":
        counter+=1

    AClist.append(counter)
    i+=1


while Q > 0:
    l, r = input().split()
    r = int(r) 
    l = int(l)

    print(AClist[r-1]-AClist[l-1])

    Q -= 1
Problem p03086 (python)

Fixed submission:

S = list(input())
ACGT = []
lentemp = 0
while len(S)>0:
    s = S.pop(0)

    if s == "A" or s == "C" or s == "G" or s == "T":
        lentemp += 1

    else:
        ACGT.append(lentemp)
        lentemp = 0
ACGT.append(lentemp)

print(max(ACGT))

Buggy submission (verdict: Runtime Error):

S = list(input())
ACGT = []
lentemp = 0
while len(S)>0:
    s = S.pop(0)

    if s == "A" or s == "C" or s == "G" or s == "T":
        lentemp += 1

    else:
        ACGT.append(lentemp)
        lentemp = 0

print(max(ACGT))
Problem p02818 (python)

Fixed submission:
a,b,k = map(int, input().split())
out = 0
if k>a+b:
    print("0 0")    
elif k>a:
    out = a+b-k
    print("0 "+str(out))
else:
    print(str(a-k)+" "+str(b))

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

if k>a+b:
    print("0 0")    
elif k>a:
    print("0 "+str(a+b-k))
else:
    print(str(a-k)+" "+str(b))
Problem p03433 (python)

Fixed submission:

N = input()
A = input()

N = int(N)
A = int(A)

rest = N % 500

if rest<=A:
    print("Yes")

else:
    print("No")

Buggy submission (verdict: Runtime Error):
temp1 = input()
r1 = temp1.split()
for j in range(len(r1)):
    r1[j] = int(r1[j])
temp2 = input()
r2 = temp2.split()
for j in range(len(r2)):
    r2[j] = int(r2[j])
temp3 = input()
r3 = temp3.split()
for j in range(len(r3)):
    r3[j] = int(r3[j])

r_d1 = [i for i in range(3)]
r_d2 = [i for i in range(3)]
for i in range(3):
    r_d1[i] = r2[i]-r1[i]
    r_d2[i] = r3[i]-r1[i]
if r_d1.count(r_d1[0]) == 3:
    flag = 1
else:flag = 0

if r_d2.count(r_d2[0]) == 3:
    flag = flag*1
else:flag = flag*0

if flag == 1:
    print("Yes")
else:print("No")
Problem p02720 (python)

Fixed submission:
from collections import deque

k = int(input())

que = deque([1,2,3,4,5,6,7,8,9])

for n in range(0, k):
  x = que.popleft()
  if x % 10 != 0:
    que.append(x * 10 + x % 10 - 1)
  que.append(x * 10 + x % 10)
  if x % 10 != 9:
    que.append(x * 10 + x % 10 + 1)

print(x)

Buggy submission (verdict: Runtime Error):
from collections import deque

k = int(input())

que = deque([1,2,3,4,5,6,7,8,9])

for n in range(0, k):
  x = que.popleft()
  if x % 10 != 0:
    que.append(x * 10 + x % 10 - 1)
  q.append(c * 10 + c % 10)
  if x % 10 != 9:
    que.append(x * 10 + x % 10 + 1)

print(x)
Problem p02713 (python)

Fixed submission:
import math
K=int(input())
sum=0
for i in range(1,K+1):
    for j in range(1,K+1):
        tmp=math.gcd(i,j)
        for l in range(1,K+1):
            sum+=math.gcd(tmp,l)
print(sum)

Buggy submission (verdict: Runtime Error):
def sort_2(a,b):
    if b<a:
        c=a
        a=b
        b=c
    return [a,b]


def GCDbase(a,b):
    D=b//a
    if b==D*a:
        return a
    else:
        return GCD(b-a*D,a)
    
def GCD(a,b):
    ab=sort_2(a,b)
    return GCDbase(ab[0],ab[1])
    
    

K=int(input())
sum=0
for i in range(1,K+1):
    for j in range(1,K+1):
	t=GCD(i,j)
        for l in range(1,K+1):

            sum+=GCD(t,l)
print(sum)
Problem p02934 (python)

Fixed submission:
N = int(input())
li = list(map(int,input().split()))
li2 = []
for i in li:
    li2.append(1/i)
print(1/sum(li2))

Buggy submission (verdict: Runtime Error):
N = int(input)
li = list(map(int,input().split()))
li2 = []
for i in li:
    li2.append(1/i)
print(sum(li2))
Problem p02953 (python)

Fixed submission:
N = int(input())
li = list(map(int,input().split()))
li2 = []
key =[0] #key ０でおｋ　１で1下げ
cnt = 0
flg = True
if N == 1:
    ans ="Yes"
    flg = False
while flg :
    cur1 = li[cnt]
    cur2 = li[cnt+1]
    sa = cur2 - cur1
    if key[cnt] == 0:
        if sa < -1:
            ans = "No"
            flg = False
        elif sa == -1:
            key.append(1)
            cnt += 1
        else:
            key.append(0)
            cnt += 1
    else:
        if sa < 0:
            ans = "No"
            flg = False
        elif sa == 0:
            key.append(1)
            cnt += 1
        else:
            key.append(0)
            cnt += 1
    if cnt == len(li)-1:
        ans = "Yes"
        flg = False
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
li = list(map(int,input().split()))
li2 = []
key =[0] #key ０でおｋ　１で1下げ
cnt = 0
flg = True
if N == 1:
    ans ="Yes"
    flg = False
while flg :
    cur1 = li[cnt]
    cur2 = li[cnt+1]
    sa = cur2 - cur1
    if key[cnt] == 0:
        if sa < -1:
            ans = "No"
            flg = False
        elif sa == -1:
            key.append(1)
        else:
            key.append(0)
    else:
        if sa < 0:
            ans = "No"
            flg = False
        else:
            key.append(0)
    if cnt == len(li)-1:
        ans = "Yes"
        flg = False
    cnt += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
li = list(map(int,input().split()))
li2 = []
key =[0] #key ０でおｋ　１で1下げ
cnt = 0
flg = True
while flg :
    cur1 = li[cnt]
    cur2 = li[cnt+1]
    sa = cur2 - cur1
    if key[cnt] == 0:
        if sa < -1:
            ans = "No"
            flg = False
        elif sa == -1:
            key.append(1)
        else:
            key.append(0)
    else:
        if sa < 0:
            ans = "No"
            flg = False
        else:
            key.append(0)
    cnt += 1
    if cnt == len(li)-1:
        ans = "Yes"
        flg = False
print(ans)
Problem p02957 (python)

Fixed submission:
A,B = map(int,input().split())
C = A+B
if C % 2 == 0:
    K = int(C/2)
else:
    K = "IMPOSSIBLE"
print(K)

Buggy submission (verdict: Runtime Error):
A,B = int(input().split())
C = A+B
if C % 2 == 0:
    K = int(C/2)
else:
    K = "IMPOSSIBLE"
print(K)

Buggy submission (verdict: Runtime Error):
A,B = int(input().split())
C = A+B
if C % 2 == 0:
    K = int(C/2)
else:
    K = "IMPOSSIBLE"
Problem p02971 (python)

Fixed submission:
N = int(input())
li = []
for _ in range(N):
    r = int(input())
    li.append(r)
li_uniq = list(set(li))
li_uniq.sort(reverse = True)
if len(li_uniq) == 1:
    Max1 = li_uniq[0]
    Max2 = li_uniq[0]
else:
    Max1 = li_uniq[0]
    Max2 = li_uniq[1]
if li.count(Max1) > 1:
    for i in li:
        print(Max1)
else:
    for i in li:
        if i == Max1:
            print(Max2)
        else:
            print(Max1)

Buggy submission (verdict: Runtime Error):
N = int(input())
li = []
for _ in range(N):
    r = int(input())
    li.append(r)
li_uniq = list(set(li))
li_uniq.sort(reverse = True)
Max1 = li_uniq[0]
Max2 = li_uniq[1]
for i in li:
    if i == Max1:
        print(Max2)
    else:
        print(Max1)
Problem p02981 (python)

Fixed submission:
N,A,B = map(int,input().split())
print(min(A*N,B))

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input()split())
print(min(A*N,B))
Problem p03037 (python)

Fixed submission:
N, M = map(int, input().split())
list = []
for i in range(M):
    L, R = map(int, input().split())
    list.append([L,R])
anslist = [list[0][0],list[0][1]]
arukadouka = True
cnt = 0
for i in range(1,M):
    if arukadouka == True:
        if anslist[0] > list[i][1]:
            arukadouka = False
        elif anslist[1] < list[i][0]:
            arukadouka = False
        elif list[i][0] == list[i][1]:
            anslist[0] = list[i][0]
            anslist[1] = list[i][1]
        else:
            if (anslist[0]<=list[i][0]) and (anslist[1]<=list[i][1]):
                anslist[0] = list[i][0]
            elif (anslist[0]<=list[i][0]) and (anslist[1]>=list[i][1]):
                anslist[0] = list[i][0]
                anslist[1] = list[i][1]
            elif (anslist[0]>=list[i][0]) and (anslist[1]<=list[i][1]):
                pass
            elif (anslist[0]>=list[i][0]) and (anslist[1]>=list[i][1]):
                anslist[1] = list[i][1]
        cnt += 1
if arukadouka == True:
    ans = anslist[1]-anslist[0]+1
else:
    ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
list = []
for i in range(M):
    L, R = map(int, input().split())
    list.append([L,R])
anslist = [list[0][0],list[0][1]]
arukadouka = True
if M = 1:
    arukadouka = False
cnt = 0
for i in range(1,M):
    if arukadouka == True:
        if anslist[0] > list[i][1]:
            arukadouka = False
        elif anslist[1] < list[i][0]:
            arukadouka = False
        else:
            if (anslist[0]<=list[i][0]) and (anslist[1]<=list[i][1]):
                anslist[0] = list[i][0]
            elif (anslist[0]<=list[i][0]) and (anslist[1]>=list[i][1]):
                anslist[0] = list[i][0]
                anslist[1] = list[i][1]
            elif (anslist[0]>=list[i][0]) and (anslist[1]<=list[i][1]):
                pass
            elif (anslist[0]>=list[i][0]) and (anslist[1]>=list[i][1]):
                anslist[1] = list[i][1]
        cnt += 1
print(anslist[1]-anslist[0]+1)
Problem p03106 (python)

Fixed submission:
A,B,K = map(int,input().split())
def gcd(a, b):
    while b:
    	a, b = b, a % b
    return a
GcD = gcd(A,B)
li = []
for i in range(GcD+1):
    if GcD % (i+1) == 0:
        li.append(i+1)
li.sort(reverse=True)
print(li[K-1])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
import math
GcD = math.gco(A,B)
li = []
for i in range(1,GcD):
    if GcD % i == 0:
        li.append(i)
li.sort(reverse=True)
print(li[K-1]
Problem p03110 (python)

Fixed submission:
N = int(input())
sum = 0
for i in range(N):
    x,u = input().split()
    x = float(x)
    if u == "JPY":
        sum += x
    else:
        sum += x*380000.0
print(sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
sum = 0
for i in range(N):
    x,u = input().split()
    x = float(x)
    if u = "JPY":
        sum += x
    else:
        sum += x*380000.0
print(sum)
Problem p03125 (python)

Fixed submission:
data = input().split()
A = int(data[0])
B = int(data[1])
C = B%A
if C == 0 :
    ANS = A+B
else:
    ANS = B - A
print(ANS)

Buggy submission (verdict: Runtime Error):
data = input().split()
A = data[0]
B = data[1]
if (B % A) == 0 :
    ANS = A+B
else:
    ANS = B - A
print(ANS)
Problem p03136 (python)

Fixed submission:
N = int(input())
li = list(map(int,input().split()))
Ma = max(li)
li.remove(Ma)
if Ma >= sum(li):
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
li = list(map(int,input().split()))
Ma = max(li)
li.pop(Ma)
if Ma >= sum(li):
    print("No")
else:
    print("Yes")
Problem p03280 (python)

Fixed submission:
lst = list(map(int,input().split()))
A = lst[0]
B = lst[1]
S = (A-1)*(B-1)
print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N < 105:
    S = 0
elif N < 135:
    S = 1
elif N < 165:
    S = 2
elif N < 189:
    S = 3
elif N < 195:
    S= 4
else:
    S = 5
print(S)
Problem p03281 (python)

Fixed submission:
N = int(input())
if N < 105:
    S = 0
elif N < 135:
    S = 1
elif N < 165:
    S = 2
elif N < 189:
    S = 3
elif N < 195:
    S= 4
else:
    S = 5
print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N < 105:
    S = 0
elif N < 135:
    S = 1
elif N < 165:
    S = 2
elif N < 189:
    S = 3
elif N < 195:
    s = 4
else:
    s = 5
print(S)
Problem p03324 (python)

Fixed submission:
S = input().split()
D = int(S[0])
N = int(S[1])
if N != 100:
    Ans = N*(100**D)
else:
    Ans = (N+1)*(100**D)
print(Ans)

Buggy submission (verdict: Runtime Error):
S = input().split()
D = int(S[0])
N = int(S[1])
if N <> 100:
    Ans = N*(100**D)
else:
    Ans = (N-1)*(100**D)
print(Ans)
Problem p03325 (python)

Fixed submission:
N = int(input())
nums = list(map(int, input().split()))
cnt = 0
cntlst = []
for i in range(0,N):
    taisyouN = nums[i]
    while taisyouN %2 == 0:
        taisyouN = taisyouN/2
        cnt = cnt+1
    cntlst.append(cnt)
    cnt = 0
print(sum(cntlst))

Buggy submission (verdict: Runtime Error):
N = input()
nums = list(map(int, input().split()))
cnt = 0
cntlst = []
for i in range (0,N-1):
    taisyouN = nums[i]
    while taisyouN %2 == 0:
        taisyouN = taisyouN/2
        cnt = cnt+1
print(cnt)

Buggy submission (verdict: Runtime Error):
N = input()
nums = list(map(int, input().split()))
cnt = 0
for i in range(0,n-1):
    taisyouN = nums[i]
    while taisyouN %2 == 0:
        taisyouN = taisyouN/2
        cnt = cnt+1
print(cnt)
Problem p03351 (python)

Fixed submission:
l = list(map(int, input().split()))
a = l[0]
b = l[1]
c = l[2]
d = l[3]
if abs( c - a ) <= d:
    print("Yes")
elif abs(c - b) <= d:
    if abs(b-a) <= d:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
X = int(input())
flag = True
num = 31
lst = []
i = 2
while i <= 10:
    while flag:
        if num**i <= X:
            z = num**i
            lst.append(z)
            break
        elif num == 0:
            break
        else:
            num -= 1
    num= 31
    i += 1
print(max(lst))
Problem p02747 (python)

Fixed submission:
S = input()
hantei = True

for i in range(0,len(S)-1,2):
  if S[i]+S[i+1] != 'hi':
    hantei = False
if len(S) % 2 == 1:
  hantei = False
    
if hantei == True:
  print('Yes')
else:
  print('No')

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

for i in range(0,len(S),2):
  if S[i]+S[i+1] != 'hi':
    hantei = False

if hantei == True:
  print('Yes')
else:
  print('No')
Problem p02801 (python)

Fixed submission:
C = input()
alpha = 'abcdefghijklmnopqrstuvwxyz'
index = alpha.index(C)
print(alpha[index + 1])

Buggy submission (verdict: Runtime Error):
    N, M = map(int, input().split())
     
    seikai = 0
    miss = 0
     
    seikai_list = []  ##既に正解した問題番号のリスト
    input_list = [[0 for i in range(2)] for j in range(M)]  ##入力のリスト 問題番号と正誤
     
    for i in range(M):
      tmp = input().split()
      input_list[i][0] = tmp[0]
      input_list[i][1] = tmp[1]
     
    a = False
     
    for i in range(M):
      if input_list[i][1] =='AC':
          if (input_list[i][0] in seikai_list) == False:   ##正解リストの中に無ければ
            seikai += 1
            
            for k in range(i):
              if input_list[k][0] == input_list[i][0]:
                if input_list[k][1] == 'WA':
                  miss += 1
                    
            seikai_list.append(input_list[i][0])
                
    print("{} {}".format(seikai, miss))
Problem p02900 (python)

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

def main():
    A,B = map(int,input().split())
    C = fractions.gcd(A,B)
    Cn = prime_factorize(C)
    Cn = list(set(Cn))
    print(len(Cn)+1)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
def main():
    A,B = map(int,input().split())
    C = math.gcd(A,B)
    Cn = prime_factorize(C)
    print(len(Cn)+1)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

if __name__ == '__main__':
    main()