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

Fixed submission:
A, B = map(int,input().split())
num = B / A
i = 0
if B == 1:
  print(int(0))
else:
  while True:
    if B == 1:
        print(0)
        break
    if A * i - (i - 1) >= B:
        print(i)
        break
    i += 1

Buggy submission (verdict: Runtime Error):
A, B = map(int, split())
num = B / A

if B == 0 or B == 1:
  print(int(0))
elif B % A == 0:
  print(int(num))
else:
  print(int(num + 1))

Buggy submission (verdict: Runtime Error):
A, B = map(int(input()))

num = B / A

if B == 0:
  print(int(0))
elif B % A == 0:
  print(int(num))
else:
  print(int(num + 1))

Buggy submission (verdict: Runtime Error):
A B = map(int(input()))

num = B / A

if B == 0:
  print(int(0))
elif B % A == 0:
  print(int(num))
else:
  print(int(num + 1))

Buggy submission (verdict: Runtime Error):
A B = map(int(input()))

num = B / A
if B == 1:
  print("0")
else if B % A == 0:
  print(int(num))
else:
  print(int(num + 1))

Buggy submission (verdict: Runtime Error):
A, B = map(int(input()))

num = B / A

if B % A == 0:
  print(int(num))
else:
  print(int(num + 1))
Problem p02628 (python)

Fixed submission:
n, k = map(int, input().split())
j=0
p=0
fruits= list(map(int, input().split()))
fruits.sort()
for j in range(k):
	p+=fruits[j]
print(p)

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

p.sort()
print(sum(p[0:k])

Buggy submission (verdict: Runtime Error):
length= int(input())
num=int(input())
i=0
j=0
p=0
fruits=[]
for i in range(length):
	fruits.append(int(input())
fruits.sort()
for j in range(num):
	p+=fruits[j]
print(p)
# for x in fruits:
# 	print(x)
Problem p02639 (python)

Fixed submission:
books1= list(map(int, input().split()))
i=0
while(i<len(books1)):
  if(books1[i]==0):
    break
  i+=1
print(i+1)

Buggy submission (verdict: Runtime Error):
books1= list(map(int, input().split()))
i=0
while(i<len(books)):
  if(books1[i]==0):
    print(i+1)
    break
    i+=1

Buggy submission (verdict: Runtime Error):
books1= list(map(int, input().split()))
i=0
while(i<len(books)):
  if(books[i]==0):
    print(i+1)
    break
    i+=1

Buggy submission (verdict: Runtime Error):
books1= list(map(int, input().split()))
i=0
while(i<len(books)):
  if(books[i]==0):
    print(i)
    break
    i+=1
Problem p02612 (python)

Fixed submission:
N = 0
try:
  N = int(input())
except:
  pass
if N == 0:
  print(0)
else:
  print((((N - 1) // 1000) + 1) * 1000 - N)

Buggy submission (verdict: Runtime Error):
N = 0
try:
  N = int(input())
except:
  pass
if N == 0:
  print(0)
else:
  print(((N - 1) / 1000) + 1) * 1000 - N)

Buggy submission (verdict: Runtime Error):
import sys

N = sys.argv[1]
if N == 0:
  print(0)
else:
  print(((N - 1) / 1000) + 1) * 1000 - N)
Problem p02617 (python)

Fixed submission:
N = 0
a = 0

try:
    N = int(input())
    for i in range(N + 1):
        a += i * (i + 1) // 2
    for i in range(N - 1):
        line = input().split()
        u = min(int(line[0]), int(line[1])) - 1
        v = max(int(line[0]), int(line[1])) - 1
        a -= (u + 1) * (N - v)        
except:
  pass

print(a)

Buggy submission (verdict: Runtime Error):
N = 0
nodes = {}

try:
    N = int(input())
    for i in range(N - 1):
        line = input().split()
        u = int(line[0])
        v = int(line[1])
        if u > v:
            t = u
            u = v
            v = t
        if u - 1 in nodes:
            nodes[u - 1].append(v - 1)
        else:
            nodes[u - 1] = [v - 1]
        if v - 1 in nodes:
            nodes[v - 1].append(u - 1)
        else:
            nodes[v - 1] = [u - 1]
except:
  pass

#print(nodes)

nSubGraphs = 0
for l in range(N):
    for r in range(l, N):
        #print(l, r)
        checked = []
        for s in range(l, r + 1):
            if s not in checked:
                checked.append(s)
                #print(s)
                reachableNodes = [n for n in nodes[s] if n >= l and n <= r]
                while len(reachableNodes) > 0:
                    nextReachableNodes = []
                    for i in reachableNodes:
                        nextReachableNodes += [n for n in nodes[i] if n not in checked and n >= l and n <= r]
                    #print(reachableNodes, nextReachableNodes)
                    checked += reachableNodes
                    reachableNodes = nextReachableNodes
                nSubGraphs += 1
            
print(nSubGraphs)
Problem p03485 (python)

Fixed submission:
a,b = map(int,input().split())
if (a + b)%2 ==0:
    print(round((a + b) / 2))
else:
    print(round((a + b + 1) / 2))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if (a + b)%2 ==0:
    print(round((a + b) / 2))
else: 
    print(round((a + b + 1) / 2)
Problem p02612 (python)

Fixed submission:
N = int(input())

if N%1000 == 0:
  n = N//1000
else:
  n = N//1000 + 1

ans = 1000*n - N
print(ans)

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

N = int(input())
list_s = []
for i in range(N):
    S = input()
    list_s.append(S)

D = Counter(list_s)

print("AC x " + str(D["AC"]))
print("WA x " + str(D["WA"]))
print("TLE x " + str(D["TLE"]))
print("RE x " + str(D["RE"]))
Problem p02677 (python)

Fixed submission:
import math

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

def angle():
  wa = 0.5
  wb = 6
  w = wb-wa
  t = H*60 + M
  wnew = (w*t)%360
  if wnew>=180:
    wnew = 360 - wnew
  return wnew


cos_angle = math.cos(math.radians(angle()))
distance = A**2 + B**2 - 2*A*B*cos_angle
answer = distance**0.5
print(answer)

Buggy submission (verdict: Runtime Error):
import math
A = int(input())
B = int(input())
H = int(input())
M = int(input())

def angle():
  wa = 0.5
  wb = 6
  w = wb-wa
  t = H*60 + M
  wnew = (w*t)%360
  if wnew>=180:
    wnew = 360 - wnew
  return wnew

cos_angle = math.cos(math.radians(angle()))
distance = A**2 + A**2 - 2*A*B*cos_angle
answer = distance**0.5
print(answer)
Problem p03260 (python)

Fixed submission:
arg = input().split()

num = int(arg[0]) * int(arg[1])

if (num % 2) == 0:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
arg = raw_input().split()

num = int(arg[0]) * int(arg[1])

if (num % 2) == 0:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
arg = raw_input().split()

num = int(arg[0]) * int(arg[1])

if num % 2 == 0:
  print('No')
else:
  print('Yes')

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

Buggy submission (verdict: Runtime Error):
N = raw_input().split()
print(N)
Problem p03447 (python)

Fixed submission:
a = [int(input()) for i in range(3)]
print((a[0]-a[1])%a[2])

Buggy submission (verdict: Runtime Error):
a = [int(input()) for i in range(4)]
yen500 = a[0]
yen100 = a[1]
yen50 = a[2]
target = a[3]

count = 0
for i1 in yen500:
  for i2 in yen100:
    for i3 in yen50:
      if i1 + i2 + i3 == target:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
a = [input() for i in range(3)]
print(a[0]-a[1]-a[2])
Problem p02612 (python)

Fixed submission:
int = int(input())
y = 1000
for i in range(1,11):
    z = y*i
    if int <= z:
        o = z - int
        break;
    else:
        pass

print(o)

Buggy submission (verdict: Runtime Error):
int = int(input())
y = 1000
for i in range(10):
    z = y*i
    if int <= z:
        o = z - int
        break;
    else:
        pass

print(o)

Buggy submission (verdict: Runtime Error):
import sys
x = sys.stdin
y = 1000
for i in range(10):
    z = y*i
    if x <= z:
        o = z -x
        break;
    else:
        pass

print(o)
Problem p03035 (python)

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

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

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

if a >= 13:
    print(b)
elif a <= 5:
    print(0)
else:
    print(b/2)
Problem p03210 (python)

Fixed submission:
x = int(input())

if x == 3 or x == 5 or x == 7:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):

x = input()

if x == 3 or x == 5 or x == 7:
  print("YES")
else:
  print("NO)
Problem p03698 (python)

Fixed submission:
n = input()

m = list(n)

#print(m)
if len(set(m)) == len(m):
  print("yes")
else:
  print("no")

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

m = list(n.copy)

#print(m)
if len(set(m)) == len(m):
  print("yes")
else:
  print("no")
Problem p04011 (python)

Fixed submission:
n = int(input())
k = int(input())
x = int(input())
y = int(input())

ans = 0
for i in range(1,n+1):
  if i >= k+1:
    ans += y
  else:
    ans += x
    
print(ans)

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

for i in range(n):
  if i == k+1:
    ans += y;
  else:
    ans += x
    
print(ans)
Problem p04029 (python)

Fixed submission:
n = int(input())

a = []
a = [i for i in range(1, n+1)]
print(sum(a))

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

a = [i for in range(1, n+1)]
b = sum(a)
  
print(a)
Problem p02613 (python)

Fixed submission:
N = int(input())
C_0 = C_1 = C_2 = C_3 = 0
for i in range(N):
  c = input()
  if c == 'AC':
    C_0 += 1
  elif c == 'WA':
    C_1 += 1
  elif c == 'TLE':
    C_2 += 1
  else:
    C_3 += 1

print('AC x ' + str(C_0))
print('WA x ' + str(C_1))
print('TLE x ' + str(C_2))
print('RE x ' + str(C_3))

Buggy submission (verdict: Runtime Error):
N= int(input())
C0 = C1 = C2 = C3 = 0
for i in range(N):
	if input() == 'AC':
		C0 += 1
	elif input() == 'WA':
		C1 += 1
	elif input() == 'TLE':
		C2 += 1
	elif input() == 'RE':
		C3 += 1

print('AC x ' + str(C0))
print('WA x ' + str(C1))
print('TLE x ' + str(C2))
print('RE x ' + str(C3))

Buggy submission (verdict: Runtime Error):
N= int(input())
C0 = C1 = C2 = C3 = 0
for i in range(N):
	if input() == 'AC':
		C0 += 1
	elif input() == 'WA':
		C1 += 1
	elif input() == 'TLE':
		C2 += 1
	else:
		C3 += 1

print('AC x ' + str(C0))
print('WA x ' + str(C1))
print('TLE x ' + str(C2))
print('RE x ' + str(C3))
Problem p02639 (python)

Fixed submission:
def test(total):
  if total == 14:
    print('1')
  elif total == 13:
    print('2')
  elif total == 12:
    print('3')
  elif total == 11:
    print('4')
  else:
    print('5')

x1, x2, x3, x4, x5 = input().split()
test(int(x1) + int(x2) + int(x3) + int(x4) + int(x5))

Buggy submission (verdict: Runtime Error):
def test(X, N, P):
  P_int = []
  
  for i in P:
    P_int.append(int(i))

  lis = []
  
  for i in list(range(101)):
    if i not in P_int:
      lis.append(i)
  
  min_adv = 1000
  min_num = 1000
  
  for i in lis:
    rec_adv = abs(X - i)
    if rec_adv < min_adv:
      min_num = i
      min_adv = rec_adv
      
  print(min_num)

X, N = input().split()
P = input().split()

test(int(X), int(N), P)

Buggy submission (verdict: Runtime Error):
def test(X, N, P):
  P_int = []
  
  for i in P:
    P_int.append(int(i))

  
  lis = []
  
  for i in list(range(101)):
    if i not in P_int:
      lis.append(i)
  
  min_adv = 1000
  min_num = 1000
  
  for i in lis:
    rec_adv = abs(X - i)
    
    if rec_adv < min_adv:
      min_num = i      
      min_adv = rec_adv
      
  print(min_num)

X, N = input().split()
P = input().split()

test(int(X), int(N), P)
Problem p02657 (python)

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

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

Buggy submission (verdict: Runtime Error):
print(int(input())*int(input()))
Problem p02612 (python)

Fixed submission:
n = int(input())
rem = n%1000
if rem!=0:
  print(1000-rem)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
rem = n%1000
if rem!=0:
  return 1000-rem
return 0
Problem p02718 (python)

Fixed submission:
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
if a[m-1] >= sum(a) / (4 * m):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
if a[m] >= sum(a) / (4 * m):
    print("Yes")
else:
    print("No")
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
max_value = 0
cnt = 0
for i in range(1, n):
	if h[i-1] >= h[i]:
		cnt += 1
	else:
		max_value = max(max_value, cnt)
		cnt = 0

if cnt > max_value:
	max_value = cnt
print(max_value)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(input().split())
max_value = 0
cnt = 0
for i in range(1, n+1):
	if h[i-1] >= h[i]:
		cnt += 1
	else:
		max_value = max(max_value, cnt)
		cnt = 0
if cnt > max_value:
	max_value = cnt
print(max_value)
Problem p02988 (python)

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

for i in range(1, n-1):
		if pn[i-1]<pn[i]<=pn[i+1] or pn[i+1]<pn[i]<=pn[i-1]:
			cnt += 1
print(cnt)

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

a = 9999
b = 9999
c = 9999
cnt = 0

for i in range(n):
	c = pn[i]
	if i >= 2
		if (a<b and b<c) or (c<b and b<a) or (a==b and b>c) or (b==a and b>c)or(a==c and b>a):
			cnt += 1
	a = b
	b = c

print(cnt)
Problem p02999 (python)

Fixed submission:
x, a = input().split()
x = int(x)
a = int(a)
if x < a:
	print(0)
else:
	print(10)

Buggy submission (verdict: Runtime Error):
x, a = input()
x = int(x)
a = int(a)
if x < a:
	print(0)
else:
	print(10)
Problem p02684 (python)

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

n = 1
order = [n]
order_set = set([n])

for i in range(1, K + 1):
    n = A[n - 1]
    if n in order_set:
        Li = order.index(n)
        Ri = len(order)
        idx = Li + (K - Li) % (Ri - Li)
        print(order[idx])
        exit()
    else:
        order.append(n)
        order_set.add(n)
        continue
print(n)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
    
n = 1
order = [n]
order_set = set([n])

for i in range(1, K + 1):
    n = A[n - 1]
    if n in order_set:
        Li = order.index(n)
        Ri = len(order)
        idx = Li + (K - Li) % (Ri - Li)
        print(order[idx])
        break
    else:
        order.append(n)
        order_set.add(n)
        continue
else:
    print(s)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
    
n = 1
order = [n]
order_set = set([n])

for i in range(1, K + 1):
    n = A[n - 1]
    if n in order_set:
        Li = order.index(n)
        Ri = len(order)
        idx = Li + (K - Li) % (Ri - Li)
        print(order[idx])
        break
    else:
        order.append(n)
        order_set.add(n)
        continue
else:
    print(s)
Problem p02690 (python)

Fixed submission:

X = int(input())


for i in range(-120, 120):
    for j in range(-120,120):
        if i ** 5 - j ** 5 == X:
            print(i, j)
            exit()

Buggy submission (verdict: Runtime Error):
from numba import jit
import math
X = int(input())


@jit
def solver(X):
    sol = []
    i = 2
    while i <= math.sqrt(X)+1:
        if X % i == 0:
            sol.append(i)
        i += 1
    return sol


if X == 1:
    print(0, -1)
    exit()
sol = solver(X)


for i in sol:
    for s in range(-130 130):
        t = s - i
        if s ** 5 - t ** 5 == X:
            print(s, t)
            break
Problem p02691 (python)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

Y = [int(i + A[i - 1]) for i in range(1, N + 1)]
Y = Counter(Y)

cnt = 0
for i in range(1, N+1):
    X = i - A[i - 1]
    if X in Y.keys():
        cnt += Y[X]
print(cnt)

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

    Y = [int(i + A[i - 1]) for i in range(1, N + 1)]
    Y = Counter(Y)

    cnt = 0
    for i in range(1, N+1):
        X = i - A[i - 1]
        if X in Y.keys():
            cnt += Y[X]
    print(cnt)
Problem p02713 (python)

Fixed submission:
import math
from numba import jit

K = int(input())


@jit
def apt(N):
    cnt = 0
    for i in range(1, K+1):
        for j in range(1, K + 1):
            for k in range(1, K + 1):
                cnt += math.gcd(k, math.gcd(i, j))
    return cnt


print(apt(K))

Buggy submission (verdict: Runtime Error):
import math


K = int(input())
cnt = 0
for i in range(1, K+1):
    for j in range(1, K + 1):
        for k in range(1, K + 1):
            cnt += math.gcd(k, math.gcd(i, j))


print(apt(K))

Buggy submission (verdict: Runtime Error):
import math

K = int(input())



cnt = 0
  for i in range(1, K+1):
      for j in range(1, K + 1):
          for k in range(1, K + 1):
              cnt += math.gcd(k, math.gcd(i, j))


print(apt(K))
Problem p02732 (python)

Fixed submission:
import collections
import math

N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
cnt = 0


sumall = 0
for x, y in c.items():
    sumall += (y*(y-1)//2)

for i in range(N):
    print(sumall - c[A[i]] + 1)

Buggy submission (verdict: Runtime Error):
import collections
import math

N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
cnt = 0
ansx = []
ansy = []
ansy2 = []

for x, y in c.items():
    sumall += (y*(y-1)//2)
    ansy2.append(y-1)
    ansx.append(x)

for i in A:
    print(sumall - ansy2[ansx.index(i)])

Buggy submission (verdict: Runtime Error):
import collections
import math

N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
cnt = 0
ansx = []
ansy = []
ansy2 = []

for x, y in c.items():
    sumall += (y*(y-1)//2))
    ansy2.append(y-1)
    ansx.append(x)

for i in A:
    print(sumall - ansy2[ansx.index(i)])
Problem p02789 (python)

Fixed submission:

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

if N == M:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from numba import jit
N = int(input())


@jit
def main(N):
    cnt = 0
    for i in range(1, N):
        for j in range(1, N):
            i = str(i)
            j = str(j)
            if i[-1] == j[0] and i[0] == j[-1]:
                cnt = cnt + 1
    return cnt


print(main(N))
Problem p02795 (python)

Fixed submission:
H = int(input())
W = int(input())
N = int(input())

i = 0
j = 0
if H > W:
    while i < N:
        j = j + 1
        i = H + i
elif H < W:
    while i < N:
        j = j + 1
        i = W + i
else:
    while i < N:
        j = j + 1
        i = H + i
print(j)

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

i = 0
j = 1

elif H > W:
    while i < N:
        i = (H * j) + i
        j = j + 1
elif H < W:
    while i < N:
        i = (W * j) + i
        j = j + 1
else:
    while i < N:
        i = (H * j) + i
        j = j + 1
print(j-1)
Problem p02887 (python)

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

sumx = 0
mem = ""

for i in S:
    if i != mem:
        sumx += 1
        mem = i
    else:
        mem = i

print(sumx)

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

sumx = 0
for i in range(N-2):
    if S[i] != S[i + 1]:
        sumx += 1

if S[-2] != S[-1]:
    sumx += 2
elif S[-2] == S[-1]:
    sumx += 1

print(sumx)

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

newS = []
for i in range(N-2):
    if S[i] != S[i + 1]:
        newS.append(S[i])

if S[-2] != S[-1]:
    newS.append(S[-2])
    newS.append(S[-1])
elif S[-2] == S[-1]:
    newS.append(S[-2])
print(len(newS))
Problem p02910 (python)

Fixed submission:
N = list(input())
N.insert(0, '')
even = N[2::2]
odd = N[1::2]
if ('R' in even or 'L' in odd):
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
ULURU
Problem p03106 (python)

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

answer = []
ans = 1
max_ans = fractions.gcd(A, B)
while ans <= max_ans:
    if A % ans == 0 and B % ans == 0:
        answer.append(ans)
        ans += 1
    else:
        ans += 1
answer = sorted(answer, reverse=True)

print(answer[K-1])

Buggy submission (verdict: Runtime Error):
import math
A, B, K = map(int, input().split())

answer = []
ans = 1
max_ans = math.gcd(A, B)
while ans <= max_ans:
    if A % ans == 0 and B % ans == 0:
        answer.append(ans)
        ans += 1
    else:
        ans += 1
answer = sorted(answer, reverse=True)

print(answer[K-1])
Problem p03474 (python)

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

fwd = S[0:A]
bwd = S[A+1:]
flag = 0
if fwd.isdigit() == True:
    if S[A] == '-':
        if bwd.isdigit() == True:
            flag = 1
if flag == 1:
    print('Yes')
else:
    print('No')

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

if S[B] == '-':
    for i in range(8):
        if i == B:
            continue
        else:
            if S[i] == '-':
                print('No')
                break
    print('Yes')
else:
    print('No')

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

if S[B] == '-':
    for i in range(8):
        if i == B:
            continue
        else:
            if S[i] == '-':
                print('No')
                exit()
    print('Yes')
else:
    print('No')
Problem p03476 (python)

Fixed submission:
import numpy as np
N = int(input())
queue = [list(map(int, input().split())) for _ in range(N)]


max_N = 100100
prime = list(np.ones(max_N, dtype=int))
a = list(np.zeros(max_N, dtype=int))
b = list(np.zeros(max_N+1, dtype=int))

prime[0], prime[1] = 0, 0
for i in range(2, max_N):
    if i == 0:
        continue
    for j in range(i*2, max_N, i):
        prime[j] = 0

for i in range(1, max_N):
    if i % 2 == 0:
        continue
    if prime[i] == 1 and prime[int((i + 1) / 2)] == 1:
        a[i] = 1
for i in range(0, max_N):
    b[i + 1] = a[i] + b[i]

for i in queue:
    print(b[i[1]+1]-b[i[0]])

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
queue = [list(map(int, input().split())) for _ in range(N)]


max_N = 100100
prime = np.ones(max_N, dtype=int)
a = np.zeros(max_N, dtype=int)
b = np.zeros(max_N+1, dtype=int)

prime[0], prime[1] = 0, 0
for i in range(2, max_N):
    if i == 0:
        continue
    for j in range(i*2, max_N, i):
        prime[j] = 0

for i in range(1, max_N):
    if i % 2 == 0:
        continue
    if prime[i] == 1 and prime[int((i + 1) / 2)] == 1:
        a[i] = 1
for i in range(0, max_N):
    b[i + 1] = a[i] + b[i]

for i in queue:
    print(b[i[1]+1]-b[i[0]])
Problem p03624 (python)

Fixed submission:
S = input()
S = sorted(list(set(S)))

n = 97
for i in range(len(S)):
    if ord(S[i]) == n:
        n += 1
    else:
        break

if n == 123:
    print('None')
else:
    print(chr(n))

Buggy submission (verdict: Runtime Error):
S = list(input())
S = sorted(S)
num = len(set(S))
newS = sorted(list(set(S)))

if num == 26:
    print('None')
else:
    for i in range(26):
        if newS[i] != chr(i+97):
            print(chr(i+97))
            break
Problem p02613 (python)

Fixed submission:
n = int(input())
a = [0]*4

for i in range(n):
    s = input()
    if s == "AC":
        a[0] += 1
    elif s == "WA":
        a[1] += 1
    elif s == "TLE":
        a[2] += 1
    else:
        a[3] += 1
        
print("AC x",a[0])
print("WA x",a[1])
print("TLE x",a[2])
print("RE x",a[3])

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

n = int(input())
a = [0]*4

for i in range(n):
    s = input().strip()
    if s == "AC":
        a[0] += 1
    elif s == "WA":
        a[1] += 1
    elif s == "TLE":
        a[2] += 1
    else:
        a[3] += 1
        
print("AC x "*a[0])
print("WA x "*a[1])
print("TLE x "*a[2])
print("RE x "*a[3])