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

Fixed submission:
#文字列の入力
S = input()
 
#listを一文字ずつのlistに
S_list = list(S)
 
AorB = S_list[0]
counter = 0
for i in range(len(S_list)):
  if(AorB == S_list[i]):
    counter = counter + 1
 
if(counter == len(S_list)):
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
#文字列の入力
S = input()

#listを一文字ずつのlistに
list_S = list(S)

AorB = S_list[0]
counter = 0
for i in range(len(S_list)):
  if(AorB == S_list[i]):
    counter =+ 1

if(counter == len(S_list)):
  print("No")
else:
  print("Yes")
Problem p02759 (python)

Fixed submission:
N = int(input())
ans = 0

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

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

if(N%2 == 0):
  ans = N/2
else:
  ans = math.floor(N/2) + 1
  
print(ans)

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

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

ans = 0

while(N >= 1):
    N= N/K
    ans += 1
  
  
print(ans)

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

ans = 0

while(n_k > 1):
  n_k = N/K
  ans += 1
  
  
print(ans)
Problem p02777 (python)

Fixed submission:
S, T = map(str,input().split())
A, B = map(int, input().split())
U = input()
ans = 0

if(S == U):
  ans = A - 1
  print(ans,B)
else:
  ans = B - 1
  print(A,ans)

Buggy submission (verdict: Runtime Error):
S, T = map(input().split())
A, B = map(int, input().split())
U = input()
ans = 0

if(S == U):
  ans = A - 1
  print(ans,B)
else:
  ans = B - 1
  print(A,ans)

Buggy submission (verdict: Runtime Error):
S, T = map(input().split())
A, B = map(int, input().split())
U = input()
ans = 0

if(S == U):
  ans = A - 1
  print(ans,B)
else:
  ans = B - 1
  print(A,ans)
Problem p02790 (python)

Fixed submission:
#スペース区切りの整数の入力
A, B = map(int, input().split())

ans = ""
if(A>B):
  for i in range(A):
    ans = ans + str(B)
else:
  for i in range(B):
    ans = ans + str(A)
    
    
    
print(ans)

Buggy submission (verdict: Runtime Error):
#スペース区切りの整数の入力
A, B = map(int, input().split())

ans = ""
if(A>B):
  for i in range(A):
    ans = ans + B
else:
  for i in range(B):
    ans = ans + A
    
    
    
print(ans)
Problem p02836 (python)

Fixed submission:
#文字列の入力
S = input()

#listを一文字ずつのlistに
S_list = list(S)
ans = 0
#偶数文字の場合
if(len(S_list)%2==0):
  #文字数/2回for文
  for i in range(int(len(S_list)/2)):
    #i文字目と後ろからi文字目が一緒なら何もしない
    #print(i,len(S_list)-i-1)
    if(S_list[i]==S_list[len(S_list)-i-1]):
      ans = ans + 0
    #一緒じゃ無い場合
    else:
      ans = ans + 1
else:
  for i in range(int(len(S_list)/2)):
    #print(i,len(S_list)-i-1)
    if(S_list[i]==S_list[len(S_list)-i-1]):
      ans = ans + 0
    else:
      ans = ans + 1
print(ans)

Buggy submission (verdict: Runtime Error):
#文字列の入力
S = input()

#listを一文字ずつのlistに
S_list = list(S)

if(len(S_list)%2==0):
  for i in range(len(S_list)/2):
    if(S_list[i]==S_list[len(S_list)-1]):
      ans = ans + 0
    else:
      ans = ans + 1
  for i in range(len(S_list)/2 + 1):
    if(S_list[i]==S_list[len(S_list)-1]):
      ans = ans + 0
    else:
      ans = ans + 1
print(ans)
Problem p02847 (python)

Fixed submission:
S = input()
day_list = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

day_num = day_list.index(S)

print(7-day_num)

Buggy submission (verdict: Runtime Error):
S = input()
day_list = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

day_num = day_list.index(S)

print(day_list[day_num+1])
Problem p02879 (python)

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

if((A <= 9 )and(B <= 9)):
  ans = A*B
else:
  ans = -1
  
print(ans)

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

if((A <= 9 )&&(B <= 9)):
  ans = A*B
else:
  ans = -1
  
print(ans)
Problem p02831 (python)

Fixed submission:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)

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

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

a, b = map(int, input().split())
print(int(a * b / math.gcd(a, b)))
Problem p02847 (python)

Fixed submission:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

day = ['SUN', 'MON','TUE','WED','THU','FRI','SAT']
s = input()
for x in range(len(day)):
    if day[x] == s:
        print(7 - x)
        sys.exit()

Buggy submission (verdict: Runtime Error):
day = ['SUN', 'MON','TUE','WED','THU','FRI','SAT']
s = input()
for x in range(len(day)):
    if day[x] == s:
        print(7 - x)
        sys.exit()
Problem p02897 (python)

Fixed submission:
a = input().split()
N = int(a[0])
ans = 0.5
if N%2 == 0:
    pass
else:
    ans = (N+1)/(2*N)

print(ans)

Buggy submission (verdict: Runtime Error):
a = input().split()
N = int(a)
ans = 0.5
if N%2 == 0:
    pass
else:
    ans = (N+1)/(2*N)

print(ans)

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

ans = 0.5
if N%2 == 0:
    pass
else:
    ans = (N+1)/(2*N)

print(ans)

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

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

print(ans)
Problem p02659 (python)

Fixed submission:
# coding: utf-8


def main():
    a, b = map(str, input().split())
    # print(b)

    a = int(a)
    b = str(b)
    # print(b)
    if len(b) == 1:
        b = b[0] + "00"
    elif len(b) == 3:
        b = b[0] + b[2] + "0"
    else:
        b = b[0] + b[2] + b[3]
    # b = b[0] + b[2] + b[3]
    b = int(b)
    # print(b)
    # exit()
    
    return a*b // 100


print(main())

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


def main():
    a, b = map(float, input().split())

    a = int(a)
    b = str(b)
    # print(b)
    b = b[0] + b[2] + b[3]
    b = int(b)
    # print(b)
    # exit()
    
    return a*b // 100


print(main())
Problem p02726 (python)

Fixed submission:
# coding: utf-8

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

n_k = [0] * (N+1)

for i in range(1, N):
    for j in range(i+1, N+1):
        n_k[min(abs(j-i), abs(X-i) + 1 + abs(j-Y))] += 1

for k in range(1, N):
    print(n_k[k])

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

from copy import deepcopy

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

neighbor = {}
for i in range(1, X):
    neighbor[i] = [i+1]
for i in range(Y+1, N):
    neighbor[i] = [i+1]
for i in range(X+1, Y):
    neighbor[i] = [i-1, i+1]
neighbor[X] = [X+1, Y]
neighbor[Y] = [Y-1, Y+1]
neighbor[N] = [] if Y < N else [N-1]

# print(neighbor)

# neighbor = {i: [i-1, i+1] for i in range(2, N)}
# neighbor[1] = [2]
# neighbor[N] = [N-1]
# neighbor[X].append(Y)
# neighbor[Y].append(X)

appeared_st = set([])


def rec(n, dist, s, k, appeared):
    # print(appeared_st)
    if dist == k:
        if s < n and "{}.{}".format(s, n) not in appeared_st:
            appeared_st.add("{}.{}".format(s, n))

    toes = [node for node in neighbor[n] if node not in appeared]
    for to in toes:
        appeared_copy = deepcopy(appeared)
        appeared_copy.add(to)
        rec(to, dist+1, s, k, appeared_copy)

    
for k in range(1, N):
    tmp = len(appeared_st)

    for s in range(1, N+1):
        rec(s, 0, s, k, {s})

    print(len(appeared_st) - tmp)

# print(appeared_st)
# print(len(appeared_st))
Problem p02990 (python)

Fixed submission:
# coding: utf-8

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

kaijo_d = {0: 1}


def f(n):
    if n in kaijo_d.keys():
        return kaijo_d[n]

    already = max(kaijo_d.keys())

    output = kaijo_d[already]

    for i in range(already+1, n+1):
        output *= i
        kaijo_d[i] = output

    return output


for i in range(1, K+1):
    print((f(K-1) * f(N-K+1)) // (f(i-1) * f(K-i) * f(i) * f(N-K+1-i)) % (10**9 + 7))

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

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

kaijo_d = {0: 1}
already_max = 0


def f(n):
    global already_max
    if n < already_max:
        return kaijo_d[n]

    output = kaijo_d[already_max]

    for i in range(already_max+1, n+1):
        output *= i
        kaijo_d[i] = output

    already_max = n

    return output


for i in range(1, K+1):
    print((f(K-1) * f(N-K+1)) // (f(i-1) * f(K-i) * f(i) * f(N-K+1-i)) % (10**9 + 7))
Problem p03221 (python)

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

# from time import time
# 
# start = time()


def six(n):
    n_str = str(n)
    while len(n_str) < 6:
        n_str = "0" + n_str

    return n_str


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

id_list = [None] * M
dic_P = {}
info = []
info_idx = 0

for i in range(M):
    P, Y = map(int, input().split())
    id_list[i] = [P, Y, ""]
    if P in dic_P.keys():
        info[dic_P[P]].append([i, P, Y])
    else:
        dic_P[P] = info_idx
        info_idx += 1
        info.append([[i, P, Y]])

for group in info:
    group.sort(key=lambda a_i: a_i[2], reverse=False)
    for i, pair in enumerate(group):
        id = six(pair[1]) + six(i+1)
        id_list[pair[0]] = id

for id in id_list:
    print(id)

# print(time() - start)

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

import math

N, M = map(int, input().split())
P = [None] * M
Y = [None] * M
for i in range(M):
    p, y = map(int, input().split())
    P[i] = p
    Y[i] = y

ken = [None] * N
for i in range(N):
    ken[i] = []

for i in range(M):
    ken[P[i] - 1].append(Y[i])


# < M * log(N)
for i in range(N):
    ken[i] = sorted(ken[i])


def close_twopower(n):
    output = 2
    while output < n:
        output = output * 2
    return output


def comp(tr, node, x, i):
    if tr[i] is None:
        return i
    elif x < tr[i][0]:
        return comp(tr, node, x, 2 * i + 1)
    else:
        return comp(tr, node, x, 2 * i + 2)


# 木構造
def create_bitree(a):
    # a = [[int, hoge, ...], ...]
    n = len(a)
    output = [None] * int(math.pow(2, n))

    for i in range(n):
        # output = comp(output, a[i], a[i][0], 0)
        output[comp(output, a[i], a[i][0], 0)] = a[i]

    return output


city_info = [None] * M
k = 0

# count M
while(k < M):
    for l in range(N):
        for m in range(len(ken[l])):
            # ken[l][m]の値によって二分木を作る
            # create_bitree()

            city_info[k] = [ken[l][m], l + 1, m + 1]
            k += 1

bi_city_info = create_bitree(city_info)


def create_id(p, x):
    output_p = str(p)
    output_x = str(x)
    p_len = len(output_p)
    x_len = len(output_x)
    while p_len < 6:
        output_p = "0" + output_p
        p_len += 1
    while x_len < 6:
        output_x = "0" + output_x
        x_len += 1

    return output_p + output_x


def comp2(tr, x, i):
    if tr[i][0] == x:
        return i
    elif x < tr[i][0]:
        return comp2(tr, x, 2 * i + 1)
    else:
        return comp2(tr, x, 2 * i + 2)

    return 0  # dummy


def bi_search(tr, x):
    # tr is [[int. hoge, ...]
    return comp2(tr, x, 0)


# 律速
# M^2
for i in range(M):
    # Y[i]を探してきてprint
    j = bi_search(bi_city_info, Y[i])
    print(create_id(bi_city_info[j][1], bi_city_info[j][2]))
Problem p02793 (python)

Fixed submission:
import sys
import fractions
input = sys.stdin.readline


def gcd(x, y):
    while y > 0:
        r = x%y
        x = y
        y = r
    return x
 
def lcm(x, y):
    return x//fractions.gcd(x, y)*y
 
n = int(input())
a = list(map(int, input().split()))
 
l = 1
for x in a:
    l = lcm(x, l)
 
ans = 0
for x in a:
    ans += l//x
 
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
import sys
import fractions
import math
input = sys.stdin.readline

N = int(input())

#a, b, c = (int(i) for i in input().split())  
a = [int(i) for i in input().split()] 
#e = [[int(i) for i in input().split()] for i in range(n)] 

ans = a[0]
total = 0
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])

for j in range(N):
    total += ans/a[j]

print(int(total%(10**9+7)))
Problem p03135 (python)

Fixed submission:
T, X = (int(i) for i in input().split())

print(T/X)

Buggy submission (verdict: Runtime Error):
import sys
N, M = (int(i) for i in input().split())
X = [int(i) for i in input().split()]
X.sort()

pos = [[0] * 2 for i in range(N)]
total = 0

if M <= N:
    print(0)
    sys.exit()

for i in range(N):
    pos[i][0] = i
    pos[i][1] = abs(X[i+1] - X[i])
    total = total + pos[i][1]

pos = sorted(pos, key=lambda x:(x[1]))

for j in range(N, M-1):
    dim = abs(X[j+1]-X[j])
    total = total + dim
    if pos[0][1] < dim:
        pos[0][0] = j
        pos[0][1] = dim
        pos = sorted(pos, key=lambda x:(x[1]))



pos = sorted(pos, key=lambda x:(x[1]), reverse = True)
for i in range(N-1):
    total = total - pos[i][1]

print(total)
Problem p03137 (python)

Fixed submission:
import sys
N, M = (int(i) for i in input().split())
X = [int(i) for i in input().split()]
X.sort()

L = []

for i in range(1, M):
    L.append(X[i]-X[i-1])

L = sorted(L, reverse=True)

print(X[M-1]-X[0]-sum(L[:N-1]))

Buggy submission (verdict: Runtime Error):
import sys
N, M = (int(i) for i in input().split())
X = [int(i) for i in input().split()]
X.sort()

pos = [[0] * 2 for i in range(N)]
total = 0

if N > M:
    print(0)
    sys.exit()

for i in range(N):
    pos[i][0] = i
    pos[i][1] = abs(X[i+1] - X[i])
    total = total + abs(X[i+1] - X[i])


for j in range(N, M-1):
    total = total + abs(X[j+1]-X[j])
    pos = sorted(pos, key=lambda x:(x[1]))
    if pos[0][1] < abs(X[j+1]-X[j]):
        pos[0][0] = j
        pos[0][1] = abs(X[j+1]-X[j])



pos = sorted(pos, key=lambda x:(x[1]), reverse = True)
for i in range(N-1):
    total = total - pos[i][1]

print(total)
Problem p02693 (python)

Fixed submission:
a = int(input())

low, hi = map(int, input().split())

start = a * int(low//a)

boolean = False

while not (start > hi):
  if low <= start <= hi: 
    boolean = True
    break
  start += a

if boolean: print("OK")
else: print("NG")

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

low, hi = map(int, input().split())

start = a * low//a

boolean = False

while not (start > hi):
  if lo <= start <= hi: 
    boolean = True
    break

if boolean: print("OK")
else: print("NG")
Problem p02729 (python)

Fixed submission:
even,odd = map(int, input().split())

  
print(int(even * (even-1)/2 + odd * (odd-1)/2))

Buggy submission (verdict: Runtime Error):
even,odd = map(int, input().split())

def f(n):
  if n == 1 or n == 0:
    return 1
  else:
    return n*f(n-1)
  
print(int(f(even)/(f(even-2)*2) + f(odd)/(f(odd-2)*2)))

Buggy submission (verdict: Runtime Error):
even,odd = map(int, input().split())

def f(n):
if n == 1 or n ==0:
   return 1
else:
   return n*f(n-1)
  
print(f(even) + f(odd))
Problem p02753 (python)

Fixed submission:
s = input()

if s == "BBB" or s == "AAA": print("No")
else: print("Yes")

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

if s = "BBB" or s = "AAA": print("No")
else: print("Yes")
Problem p02759 (python)

Fixed submission:
n = int(input())

print(int(n//2) + n % 2)

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

print int(n//2) + n % 2
Problem p02766 (python)

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

ans = 0

while n > 0:
  n /= k
  n = int(n)
  ans += 1
  
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(str, input().split())
k = int(k)
num = 0

for i in range(0, len(n)):
  sum += int(n[i]) * k^(len(n)-i)
  
print(len(str(sum)))
Problem p02771 (python)

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

ans = "No"

if (a == b or a== c or b == c) and not (a==b==c): ans = "Yes"
  
print(ans)

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

ans = "No"

if (a == b or a== c or b == c) and not (a==b==c): ans = "Yes"
  
print(ans)
Problem p02897 (python)

Fixed submission:
a = int(input())

if a % 2 == 1: print( ((a-1)/2 + 1)/a )
else: print(0.5)

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

if a % 2 == 1: print( ((a-1)/2 + 1)/a )
else: print 0.5
Problem p02916 (python)

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

score = 0
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i == prev + 1: score += bonuses[i-2]
  prev = i

print(score)

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

score = 0
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i == prev + 1: score += bonuses[i-1]
  prev = i

print(score)

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

score = 0
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i == prev + 1: score += bonuses[i-1]
  prev = i

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

score = 
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i == prev + 1: score += bonuses[i-1]
  prev = i

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

score = 
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i = prev + 1: score += bonuses[i-1]
  prev = i
Problem p02970 (python)

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

ans = a//(2*b+1)

if a%(2*b+1) == 0: pass
else: ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
from math import ceil

a,b=map(int,input().split())

print(math.ceil(a//(2*b+1)))
Problem p03012 (python)

Fixed submission:
count = int(input())
arr = input().split()
s1 = 0
s2 = 0
for i in arr:
  s2 += int(i)
minimum_diff = s2
for i in range(0, count):
  s1 += int(arr[i])
  s2 -= int(arr[i])
  minimum_diff = min(minimum_diff, abs(s1-s2))
  
print(minimum_diff)

Buggy submission (verdict: Runtime Error):
count = int(input())
arr = input().split()
s1 = 0
s2 = 0
for i in arr:
  s2 += int(i)
minimum_diff = s2
for i in range(0, count):
  s1 += arr[i]
  s2 -= arr[i]
  minimum_diff = min(minimum_diff, abs(s1-s2))
Problem p03036 (python)

Fixed submission:
arr = input().split()
r = int(arr[0])
d = int(arr[1])
x = int(arr[2])

for i in range(0,10):
  x = r*x - d
  print(x)

Buggy submission (verdict: Runtime Error):
arr = input.split()
r = int(arr[0])
d = int(arr[1])
x = int(arr[2])

for i in range(0,10):
  x = r*x - d
  print(x)
Problem p03041 (python)

Fixed submission:
nk = input().split()
index = int(nk[1]) -1
s = input()
c = 0
for i in s:
  if c == index: print(i.lower(),end="")
  else: print(i,end="")
  c+= 1

Buggy submission (verdict: Runtime Error):
nk = input().split()
s = input().split()
s[int(nk[1])-1] = s[int(nk[1])-1].lower()
Problem p03042 (python)

Fixed submission:
YYMM = False
MMYY = False
f = input()
h1 = f[0] + f[1]
h2 = f[2] + f[3]

if 1 <= int(h2) <= 12:
  YYMM = True
if 1 <= int(h1) <= 12:
  MMYY = True

def ret(c1,c2):
  if c1 and c2:
    return "AMBIGUOUS"
  elif c1:
    return "YYMM"
  elif c2:
    return "MMYY"
  else:
    return "NA"
  
print(ret(YYMM,MMYY))

Buggy submission (verdict: Runtime Error):
YYMM = False
MMYY = False
f = input()
h1 = f[0] + f[1]
h2 = f[2] + f[3]

if 1 <= h2 <= 12:
  YYMM = True
if 1 <= h1 <= 12:
  MMYY = True

def ret(c1,c2):
  if c1 and c2:
    return "AMBIGUOUS"
  elif c1:
    return "YYMM"
  elif c2:
    return "MMYY"
  else:
    return "NA"
  
print(ret(YYMM,MMYY))
Problem p02688 (python)

Fixed submission:
import numpy as np

x = input().split()

n = int(x[0])
k = int(x[1])
ds = []
bool_array = [0]*n

for num in range(k):
  di = int(input())
  ajs_input = input().split(' ')
  for j in range(di):
     bool_array[int(ajs_input[j])-1] = 1
      
print(n - np.array(bool_array).sum())

Buggy submission (verdict: Runtime Error):
x = input().split()

n = int(x[0])
k = int(x[1])
ds = []
bool_array = [0]*n

for num in range(k):
  di = int(input())
  ajs_input = input().split(' ')
  for j in range(di):
     bool_array[int(ajs_input[j])-1] = 1
      
print(n - np.array(bool_array).sum())
Problem p02661 (python)

Fixed submission:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,*ab = map(int, read().split())

    AB = []
    for a, b in zip(*[iter(ab)]*2):
        AB.append((a, b))

    if N % 2 == 0:
        AB.sort()
        a1, _ = AB[N // 2 - 1]
        a2, _ = AB[N // 2]
    
        AB.sort(key=lambda x: x[1])
        _, b1 = AB[N // 2 - 1]
        _, b2 = AB[N // 2]

        ans = b1 + b2 - (a1 + a2) + 1
    
    else:
        AB.sort()
        a, _ = AB[N // 2]
    
        AB.sort(key=lambda x: x[1])
        _, b = AB[N // 2]
        
        ans = b - a + 1
    
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from bisect import bisect_right
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,*ab = map(int, read().split())

    AB = []
    for a, b in zip(*[iter(ab)]*2):
        AB.append((a, b))

    ans = 0
    AB.sort()
    a, b = AB[N // 2]
    ans += bisect_right(list(range(a, b+1)), AB[min(N // 2 + 1, N-1)][1])
    
    AB.sort(key=lambda x: x[1])
    a, b = AB[N // 2]
    ans += b - a + 1 - bisect_right(list(range(a, b+1)), AB[N // 2 - 1][0])
    
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from bisect import bisect_right
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,*ab = map(int, read().split())

    AB = []
    for a, b in zip(*[iter(ab)]*2):
        AB.append((a, b))

    ans = 0
    AB.sort()
    a, b = AB[N // 2]
    ans += bisect_right(list(range(a, b+1)), AB[min(N // 2 + 1, N-1)][1])
    
    AB.sort(key=lambda x: x[1])
    a, b = AB[N // 2]
    ans += b - a + 1 - bisect_right(list(range(a, b+1)), AB[max(N // 2 - 1, 0)][1])
    
    print(ans)


if __name__ == "__main__":
    main()