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

Fixed submission:
import math

def C(m,n):
    return math.factorial(m)//math.factorial(n)//math.factorial(m-n)

N,K = map(int,input().split())
for i in range(1,K+1):
    if N-K+1>=i:
        print(int(C(K-1,i-1)*C(N-K+1,i))%(10**9+7))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
import math

def C(m,n):
    return math.factorial(m)//math.factorial(n)//math.factorial(m-n)

N,K = map(int,input().split())
for i in range(1,K+1):
    print(int(C(K-1,i-1)*C(N-K+1,i))%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math

def C(m,n):
    return math.factorial(m)/math.factorial(n)/math.factorial(m-n)

N,K = map(int,input().split())
for i in range(1,K):
    print(C(K-1,i-1)*C(N-K+1,i)/(10**9+7))
Problem p02771 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A == B and B == C:
  print("No")
elif A != B and A != C and B != C:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))
c = 0
for i in range(N):
  if L[i] % 2 == 0:
    if L[i] % 3 == 0:
      c += 1
    elif L[i] % 5 == 0:
      c += 1
    else:
      c = 0
      break
  else:
    c += 1

if c == N:
  print("APPROVED")  
else:
  print ("DENIED")
Problem p02707 (python)

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

sub = [0 for i in range(N)]

for a in A:
    sub[a - 1] += 1

for s in sub:
    print(s)

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

sub = [0 for i in range(N)]

for a in A:
    sub[a - 1] += 1

for s in sub:
    print(s)
j
Problem p02726 (python)

Fixed submission:
# https://atcoder.jp/contests/abc160/tasks/abc160_d
N, X, Y = map(int, input().split())

visited = set()

# special case: first advance
for i in range(N - 1):
    visited.add((i, i + 1))
visited.add((X - 1, Y - 1))

print(len(visited))

next_items = visited.copy()
for _ in range(N - 2):
    candidates = []

    for point in next_items:
        x, y = point

        if (x - 1, y) not in visited and x - 1 >= 0:
            visited.add((x - 1, y))
            candidates.append((x - 1, y))

        if (x + 1, y) not in visited and x + 1 != y:
            visited.add((x + 1, y))
            candidates.append((x + 1, y))

        if (x, y - 1) not in visited and x != y - 1:
            visited.add((x, y - 1))
            candidates.append((x, y - 1))

        if (x, y + 1) not in visited and y + 1 < N:
            visited.add((x, y + 1))
            candidates.append((x, y + 1))

    print(len(candidates))
    next_items = candidates

Buggy submission (verdict: Runtime Error):
import sys


def line(N, X, Y):
    X = X - 1
    Y = Y - 1

    queue = [(a, a) for a in range(N - 1)]
    visited = set()

    for i in range(N - 1):
        new_queue = []

        def add_to_queue(x, y):
            if y == N or y < 0:
                return
            if x == N or x < 0:
                return
            if x == y:
                return

            if x > y:
                x, y = y, x

            t = (x, y)
            if t not in visited:
                new_queue.append(t)
                visited.add(t)

        for q in queue:
            add_to_queue(q[0], q[1] + 1)
            add_to_queue(q[0], q[1] - 1)
            add_to_queue(q[0] + 1, q[1])
            add_to_queue(q[0] - 1, q[1])

            if q[1] == X:
                add_to_queue(q[0], Y)
            if q[1] == Y:
                add_to_queue(q[0], X)
            if q[0] == X:
                add_to_queue(Y, q[1])
            if q[0] == Y:
                add_to_queue(X, q[1])

        print(f"{len(new_queue)}")
        # print(f"{len(new_queue)} {new_queue}")
        queue = new_queue


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

# line(5, 2, 4)
# print()
# line(3, 1, 3)
# print()
# line(7, 3, 7)
# print()
# line(10, 4, 8)
Problem p02659 (python)

Fixed submission:
import numpy as np
import math
[A,B] = input().split()
# A = "1000000000000001"
# B = "9.09"
c = 0
if '.' in B:
    c = int(B.find('.'))
c = len(B)-c-1
B = B.replace(".","")
A = np.int64(A)
B = np.int64(B)
C = A*B
if c == 0 or C <=100:
    print(math.floor(C/int(10**c)))
elif c == 1:
    print(str(C)[:-1])
elif c == 2:
    print(str(C)[:-2])
# C = C/int(10**c)
# print(C)
# print(math.floor(C))
# print(9990000000000000)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
[A,B] = input().split()
c = 0
if '.' in B:
    c = int(B.find('.'))
c = len(B)-c-1
B = B.replace(".","")
A = np.int64(A)
B = np.int64(B)
C = A*B
if c == 0 or C <=100:
    print(math.floor(C/int(10**c)))
else c == 1:
    print(str(C)[:-c])
Problem p02729 (python)

Fixed submission:
from math import factorial

n, m = map(int, input().split())

if n > 2 and m > 2:
    print(
        factorial(n) // (factorial(n - 2) * factorial(2))
        + factorial(m) // (factorial(m - 2) * factorial(2))
    )
elif n < 2 and m < 2:
    print(0)
elif n < 2:
    print(factorial(m) // (factorial(m - 2) * factorial(2)))
elif m < 2:
    print(factorial(n) // (factorial(n - 2) * factorial(2)))

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

n, m = map(int, input().split())

print(comb(n, 2, exact=True) + comb(m, 2, exact=True))
Problem p02754 (python)

Fixed submission:
n, a, b = map(int, input().split())
if a == 0:
    print(0)
elif n <= a:
    print(n)
else:
    r = int(n / (a + b))
    if n % (a + b) < a:
        print(n - r * b)
    else:
        print(a * (r + 1))

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
s = "a" * a + "b" * b
S = s * (int(n / (a + b)) + 1)
print(S[:n].count("a"))
Problem p02933 (python)

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

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

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

Buggy submission (verdict: Runtime Error):
s = input()
if len(s) == 1:
    print(0)
else:
    r = 0
    f = s[0]
    for i in s[1:]:
        if i == f:
            r += 1
        	f = '1' if i == '0' else '0'
    	else:
        	f = i
    print(r)

Buggy submission (verdict: Runtime Error):
s = input()
if len(s) == 1:
    print(0)
else:
    r = 0
    f = s[0]
    for i in s[1:]:
        if i == f:
            r += 1
        	f = '1' if i == '0' else '0'
        f = i
    print(r)

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

Buggy submission (verdict: Runtime Error):
s = list(input())
if len(s) == 1:
    print(0)
else:
    r = 0
    for i in range(len(s) - 1):
        if s[i] == s[i+1]:
            r += 1
            s[i+1] = str(abs(int(s[i]) - 1))
print(r)
Problem p03135 (python)

Fixed submission:
list = [int(i) for i in input().split()]
print(list[0]/list[1])

Buggy submission (verdict: Runtime Error):
ist = [int(i) for i in input().split()]
print(list[0]/list[1])
Problem p03137 (python)

Fixed submission:
import numpy as np

n, m = map(int, input().split())

l = [int(i) for i in input().split()]
l.sort()
if n == 1 or m == 1:
    print(l[-1]-l[0])
elif n > m:
    print(0)
else:
    d = [0 for i in range(m - 1)]
    for i in range(m-1):
        d[i] = l[i+1] - l[i]
    d = np.array(d)
    dl = d.argsort()[::-1]
    count = 0
    for i in range(n):
        if i == 0:
            count += l[dl[i]] - l[0]
            index = dl[i]
        elif i == n - 1:
            count += l[-1] - l[index+1]
        else:
            count += l[dl[i]] - l[index+1]
            index = dl[i]
    print(count)

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

n, m = map(int, input().split())

l = [int(i) for i in input().split()]
l.sort()
if n == 1 or m == 1 or m == 2:
    print(l[-1]-l[0])
else:
    d = [0 for i in range(m - 1)]
    for i in range(m-1):
        d[i] = l[i+1] - l[i]
    d = np.array(d)
    dl = d.argsort()[::-1]
    count = 0
    for i in range(n):
        if i == 0:
            count += l[dl[i]] - l[0]
            index = dl[i]
        elif i == n - 1:
            count += l[-1] - l[index+1]
        else:
            count += l[dl[i]] - l[index+1]
            index = dl[i]
    print(count)

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

n, m = map(int, input().split())

l = [int(i) for i in input().split()]
l.sort()
if n == 1 or m == 1:
    print(l[-1]-l[0])
else:
    d = [0 for i in range(m - 1)]
    for i in range(m-1):
        d[i] = l[i+1] - l[i]
    d = np.array(d)
    dl = d.argsort()[::-1]
    count = 0
    for i in range(n):
        if i == 0:
            count += l[dl[i]] - l[0]
            index = dl[i]
        elif i == n - 1:
            count += l[-1] - l[index+1]
        else:
            count += l[dl[i]] - l[index+1]
            index = dl[i]
    print(count)

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

n, m = map(int, input().split())

l = [int(i) for i in input().split()]
l.sort()
d = [0 for i in range(m - 1)]
for i in range(m-1):
    d[i] = l[i+1] - l[i]
d = np.array(d)
dl = d.argsort()[::-1]
count = 0
if n == 1 or m == 1:
    print(l[-1]-l[0])
else:
    for i in range(n):
        if i == 0:
            count += l[dl[i]] - l[0]
            index = dl[i]
        elif i == n - 1:
            count += l[-1] - l[index+1]
        else:
            count += l[dl[i]] - l[index+1]
            index = dl[i]
print(count)
Problem p03207 (python)

Fixed submission:
n = int(input())
highest_price = 0
sum = 0
for i in range(n):
    product = int(input())
    if highest_price < product:
        sum += highest_price/2
        highest_price = product
        sum += highest_price/2
    else:
        sum += product
print(int(sum))

Buggy submission (verdict: Runtime Error):
 = int(input())
highest_price = 0
sum = 0
for i in range(n):
    product = int(input())
    if highest_price < product:
        sum += highest_price/2
        highest_price = product
        sum += highest_price/2
    else:
        sum += product
print(int(sum))
Problem p03835 (python)

Fixed submission:
k, s = map(int, input().split())
n = 0
for i in range(k + 1):
    if (s-i)/2 > k:
        continue
    elif i > s:
        break
    for j in range(k+1):
        z = s - i - j
        if 0<= z <= k:
            n += 1
print(n)

Buggy submission (verdict: Runtime Error):
k, s = map(int, input().split())
n = 0
for i in range(k + 1):
    if (s-i)/2 > k:
        continue
    elif i > s:
        break
    for j in range(s-i+1):
        if s-i-j > k:
            continue
        elif j > k:
            break
        z = s - i - j
        if 0<= z <= k
print(n)

Buggy submission (verdict: Runtime Error):
k, s = map(int, input().split())
n = 0
for i in range(k + 1):
    if (s-i)/2 > k:
        continue
    elif i > s:
        break
    for j in range(s-i+1):
        if s-i-j > k:
            continue
        elif j > k:
            break
        for l in range(s-i-j + 1):
            if i + j + l == s:
                n += 1
            elif i + j + l > s:
                break
print(n)
vv

Buggy submission (verdict: Runtime Error):
\k, s = map(int, input().split())
n = 0
a = k + 1
if k == s:
    n += 3
if k*2 > s:
    n += s*3
for i in range(1,k + 1):
    if (s-i)/2 > k:
        continue
    for j in range(1,k + 1):
        if s-i-j > k:
            continue
        for l in range(1,k + 1):
            if i + j + l == s:
                n += 1
print(n)
Problem p02833 (python)

Fixed submission:
import math
n = input()
n = int(n)
summ=0
count = 0
if(n%2==1): print("0")
else:
    while(n/5>0):
        if(count==0): 
            n=str(n)
            n=n[0:len(n)-1]
            if(len(n)==0): break
            else: n=int(n) 
            count+=1
        else:
            n = n*2
            n=str(n)
            n=n[0:len(n)-1]
            if(len(n)==0): break
            else: n=int(n)            
        #print("n="+str(n))
        summ+=n
    print(summ)
#12499999999999996
#1000000000000000000
#100000000000000010
# 99999999999999990

Buggy submission (verdict: Runtime Error):
import math
n = input()
n = int(n)
summ=0
count = 0
if(n%2==1): print("0")
else:
    while(n/5>0):
        if(count==0): 
            n=str(n)
            n=n[0:len(n)-1]
            n=int(n)
            count+=1
        else: n=int(n/5)
        #print("n="+str(n))
        summ+=n
    print(summ)
#12499999999999996
#1000000000000000000
#100000000000000010
# 99999999999999990
Problem p02711 (python)

Fixed submission:
n = int(input())
a = str(n).find("7")
if a>-1:
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = n.find("7")
if a>-1:
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = n.find("7")
if a>-1:
  print("Yes")
else :
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = n.find("7")
if a>-1:
  print("Yes")
else :
  print("No")
Problem p02712 (python)

Fixed submission:
N1 = int(input())
c = []
for i in range(1,3*N1):
    if i%3 != 0 and i%5 != 0:
        c.append(i)
    if i ==N1:
        break
print(sum(c))

Buggy submission (verdict: Runtime Error):
c = []
for i in range(1,3*N1):
    if i%3 != 0 and i%5 != 0:
        c.append(i)
        print(i)
    if i ==N1:
        break
sum(c)
Problem p03250 (python)

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

Buggy submission (verdict: Runtime Error):
a = sorted(input().split() ,reverse=True)
print(int(a[0]+a[1
Problem p02659 (python)

Fixed submission:
a,b = input().split()
 
a = int(a)
b = list(b)
del b[-3]
b = int(''.join(b))
ans = a*b
print(ans//100)

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

a = int(a)
del b[-3]
b = int(b)
ans = a*b
print(ans//100)
Problem p02676 (python)

Fixed submission:
k = int(input())
s = input()
        
length = len(s)
if length > k:
    s = s[:k]+"..."
print(s)

Buggy submission (verdict: Runtime Error):
k = int(input())
s = input()
        
length = len(s)
if length > K:
    s = s[:K]+"..."
print(s)

Buggy submission (verdict: Runtime Error):
k = int(input())
s = input()
        
length = len(s)
if length > K:
    S = S[:K]+"..."
print(S)
Problem p02711 (python)

Fixed submission:
import math
n = int(input())
for i in range(3):
  if n%10 == 7:
    print('Yes')
    break
  elif n/10 < 1:
    print('No')
  else:
    n = math.floor(n/10)

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(3):
  if n%10 == 7:
    print('Yes')
    break
  elif n/10 < 1:
    print('No')
  else:
    n = math.floor(n/10)
Problem p03775 (python)

Fixed submission:
N = int(input())
ans=[]
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        ans.append(max(len(str(i)),len(str(N//i))))
print(min(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
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_sorted = sorted(divisors)
print(len(str(divisors_sorted[int((len(divisors_sorted)+1)/2)])))

Buggy submission (verdict: Runtime Error):
N = int(input())
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()
print(len(str(divisors[int((len(divisors)+1)/2)])))

Buggy submission (verdict: Runtime Error):
N = int(input())
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()
print(len(str(divisors[int((len(divisors)+1)/2)])))
Problem p03835 (python)

Fixed submission:
import itertools
K,S = map(int,input().split())
ans = 0
for i,j in itertools.product(range(K+1),range(K+1)):
    if 0<=S-i-j and S-i-j<=K:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
ans = 0
for i in range(1,N+1):
    if A<=(i//10)+(i%10) and (i//10)+(i%10)<=B:
        ans+=i
print(ans)
Problem p02659 (python)

Fixed submission:
a, b = map(float, input().split())
A = int(a)
B = int(b*1000)

ans = A * B
print(ans//1000)

Buggy submission (verdict: Runtime Error):
import math

a, b = map(float, input().split())
ans = math.floor(int(a)*b)
print(ans)
Problem p02699 (python)

Fixed submission:
S, W = map(int, input().split())

print('unsafe' if W>=S else 'safe')

Buggy submission (verdict: Runtime Error):
S, W = map(int, input.split())

print('unsafe' if W>=S else 'safe')
Problem p02711 (python)

Fixed submission:
N = input()

print('Yes' if '7' in str(N) else 'No')

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

print('Yes' if '7' str(N) else 'No')

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

print('Yes' if '7' in str(N))
Problem p02712 (python)

Fixed submission:
N = int(input())
S = 0
for i in range(1, N+1):
    if i%3==0 or i%5==0 or (i%3==0 and i%5==0):
        continue
    S+=i
print(S)

Buggy submission (verdict: Runtime Error):
N = input()
S = 0
for i in range(1, N+1):
	if i%3==0 or i%5==0 or (i%3==0 and i%5==0 ):
      continue
    S += i
    
print(S)

Buggy submission (verdict: Runtime Error):
N = input()
S = 0
for i in range(1, N+1):
	if i%3==0 or i%5==0:
      continue
    S += i
    
print(S)
Problem p02759 (python)

Fixed submission:
N = int(input())

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

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

if n%2==0:
  print(N//2)
else:
  print(N//2+1)
Problem p02766 (python)

Fixed submission:
def base_changer(number,base):
    buff=97+abs(base-10)
    dic={};buff2='';buff3=10
    for i in range(97,buff+1):
        dic[buff3]=chr(i)
        buff3+=1   
    while(number>=base):
        mod=int(number%base)
        number=int(number//base)
        if (mod) in dic.keys():
            buff2+=dic[mod]
            continue
        buff2+=str(mod)
    if (number) in dic.keys():
        buff2+=dic[number]
    else:
        buff2+=str(number)

    return buff2[::-1]  
N,K = map(int, input().split())
print(len(base_changer(N,K)))

Buggy submission (verdict: Runtime Error):
import math
N, K = input().split()
print(math.floor(math.log(K) / math.log(N)) + 1)

Buggy submission (verdict: Runtime Error):
import math
N, K = input().split()
print(math.floor(math.log(N) / math.log(K)) + 1)

Buggy submission (verdict: Runtime Error):
N, K = input().split()

print((math.floor(math.log(N) / math.log(K)) + 1))
Problem p02773 (python)

Fixed submission:
from collections import defaultdict
from collections import OrderedDict
N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k]+=1
    else:
        ans.update({k:1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)

Buggy submission (verdict: Runtime Error):
def mostFrequent(L):
  return max(set(L), key = L.count)

N = input()
L = []
for i in range(0,N):
  L.append(input())
print(mostFrequent(L))

Buggy submission (verdict: Runtime Error):
def mostFrequent(L):
  return max(set(A), key = A.count)

N = input()
L = []
for i in range(0,N):
  L.append(input())
print(mostFrequent(L))

Buggy submission (verdict: Runtime Error):
N = input()
L = []
for i in range(0,N):
	L.append(input())
    
def mostFrequent(L):
  return max(set(A), key = A.count)

print(mostFrequent(L))
Problem p02777 (python)

Fixed submission:
S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:    A -= 1
else: B -= 1
print(A, B)

Buggy submission (verdict: Runtime Error):
S, T = input().split()
A , B = input().split()

if S == 'blue' or S=='red':
	print(A-1)
else:
	print(B-1)

Buggy submission (verdict: Runtime Error):
S, T = input().split()
A , B = input().split()

if S == 'blue' or S=='red':
	print(A-1)
else:
  print(B-1)
Problem p02835 (python)

Fixed submission:
a = [int(x) for x in input().split(" ")]
print("bust") if sum(a) >= 22 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")

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 p02693 (python)

Fixed submission:
check=0
K=int(input())
A,B = (int(x) for x in input().split())
if (A>=K and A%K == 0) or (B>=K and B%K==0):
    print('OK')
elif B-A>=K:
    print('OK')
else:
    for i in range(A,B+1,1):
        if i%K == 0:
            check=1
            break
    if check == 1:
        print('OK')
    else:
        print('NG')

Buggy submission (verdict: Runtime Error):
#二分法による非線型方程式の解法プログラム
import numpy as np  #数値計算用モジュール

#解きたい方程式
def func_f(A,B,x):
    return -(int(A*x/B)-A*int(x/B))


#二分法（方程式の関数項、探索区間の左端、探索区間の右端、誤差範囲、最大反復回数）
def bisection(func_f, x_min, x_max, A, B, error=1e-10, max_loop=100):
    #初期値を表示
    num_calc = 0  #計算回数
    #print("{:3d}:  {:.15f} <= x <= {:.15f}".format(num_calc, x_min, x_max))
    
    #中間値の定理の条件を満たすか調べる
    if(0.0 < func_f(A,B,x_min)*func_f(A,B,x_max)):
        #print("error: Section definition is invalid (0.0 < func_f(x_min)*func_f(x_max)).")
        quit()

    #ずっと繰り返す
    while(True):
        #新たな中間値の計算
        x_mid = (x_max +x_min)/2.0
        
        x_mid_max = (x_max +x_mid)/2.0
        x_mid_mim = (x_min +x_mid)/2.0
        
        #探索区間を更新
        if func_f(A,B,x_max) < func_f(A,B,x_mid):
            x_min = x_mid
        elif func_f(A,B,x_min) < func_f(A,B,x_mid):
            x_max = x_mid
        elif func_f(A,B,x_mid_max) < func_f(A,B,x_mid_mim):  #中間と右端の値が同じの時
            x_max = x_mid  #右端を更新
        else:  #中間と左端の値が同じの時
            x_min = x_mid  #左端を更新
        
        #結果を表示
        num_calc += 1  #計算回数を数える
#print("{:3d}:  {:.15f} <= x <= {:.15f}".format(num_calc, x_min, x_max))
        
        #「誤差範囲が一定値以下」または「計算回数が一定値以上」ならば終了
        if((x_max-x_min <= error) or max_loop <= num_calc):
            break

    #最終的に得られた解
    #print("x = {:.15f}".format(x_mid))

    return x_mid


#メイン実行部
if (__name__ == '__main__'):
    A,B,N=(int(x) for x in input().split())
    #二分法で非線型方程式の解を計算
    solution = bisection(func_f, 0, N,A,B)
    print(-func_f(A,B,solution))
Problem p02689 (python)

Fixed submission:
n, m = map(int, input().split())
l = [1] * (n + 1)
l[0] = 0 
h = list(map(int, input().strip().split()))
h.insert(0, 0)
 
for i in range(m):
  a, b = map(int, input().split())
  if h[a] == h[b] :
    l[a] = l[b] = 0
  elif h[a] < h[b]:
    l[a] = 0
  else :
    l[b] = 0
  
 
print(sum(l))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = [1] * (n + 1)
l[0] = 0 
h = list(map(int, input().strip().split())) 
b_a = b_b  = 0
for i in range(m):
  a, b = map(int, input().split())
  if b_a == a and b_b == b :
    l[a] = l[b] = 0
  else if h[a-1] < h[b-1]:
    l[a] = 0
  else if h[a-1] > h[b-1] :
    l[b] = 0
  b_a = a
  b_b = b

print(sum(l))
Problem p02699 (python)

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

Buggy submission (verdict: Runtime Error):
import sys
a = []
for l in sys.stdin:
    a.append(int(l))
p = input() .split()
s = set()
for i in range(1, len(p)):
    s.add(p[i])
print(len(set(s)))