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

Fixed submission:
import math
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7



if (2 * Y - X) % 3 != 0 or (2 * X - Y) % 3 != 0 or (2 * Y - X) // 3 < 0 or (2 * X - Y) // 3 < 0:
	print(0)
else:
	a = (2 * Y - X) // 3
	b = (2 * X - Y) // 3
	factorial = [1]
	inverse = [1]
	for i in range(1, a + b + 5):
		factorial.append(factorial[-1] * i % MOD)
		inverse.append(pow(factorial[-1], MOD - 2, MOD))
	print(factorial[a + b] * inverse[a] * inverse[b] % MOD)

Buggy submission (verdict: Runtime Error):
import math
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7



if (2 * Y - X) % 3 != 0:
	print(0)
elif (2 * X - Y) % 3 != 0:
	print(0)
else:
	a = (2 * Y - X) // 3
	b = (2 * X - Y) // 3
	factorial = [1]
	for i in range(1, a + b + 5):
		factorial.append(factorial[i-1] * i % MOD)
	print(int(factorial[a + b] // (factorial[a] * factorial[b])) % MOD)

Buggy submission (verdict: Runtime Error):
import math
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7



if (2 * Y - X) % 3 != 0:
	print(0)
elif (2 * X - Y) % 3 != 0:
	print(0)
else:
	a = (2 * Y - X) // 3
	b = (2 * X - Y) // 3
	print(a, b)
	factorial = [1]
	for i in range(1, a + b + 5):
		factorial.append(factorial[i-1] * i % MOD)
	# print(factsorial)
	print(int(factorial[a + b] // (factorial[a] * factorial[b])) % MOD)

Buggy submission (verdict: Runtime Error):
import math
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7



if (2 * Y - X) % 3 != 0:
	print(0)
elif (2 * X - Y) % 3 != 0:
	print(0)
else:
	a = (2 * Y - X) // 3
	b = (2 * X - Y) // 3
	print(a, b)
	factorial = [1]
	for i in range(1, a + b + 5):
		factorial.append(factorial[i-1] * i % MOD)
	# print(factsorial)
	print(factorial[a + b], factorial[a], factorial[b])
	print(int(factorial[a + b] // (factorial[a] * factorial[b])) % MOD)
Problem p03011 (python)

Fixed submission:
A = list(map(int, input().split()))
A = sorted(A)
print(sum(A[:2]))

Buggy submission (verdict: Runtime Error):
import math
 
H, W = list(map(int, input().split()))

# H, W = 4, 6
board = []
L = [[0 for i in range(W)] for i in range(H)]
R = [[0 for i in range(W)] for i in range(H)]
U = [[0 for i in range(W)] for i in range(H)]
D = [[0 for i in range(W)] for i in range(H)]

# board = [['#', '.', '.', '#', '.', '.'], ['.', '.', '.', '.', '.', '#'], ['.', '.', '.', '.', '#', '.'], ['#', '.', '#', '.', '.', '.']]

# insert elements to the board
for i in range(H):
	a = list(input())
	board.append(a)


# high_score is output values
high_score = 0
	
# round robin
for h in range(H):
	for w in range(W):
		# print(h, w)
		# board put light is envolved
		score = 1
		# if not obstacle in board[h][w]
		if board[h][w] != "#":
			# DOWN
			for i in range(1, H):
				if h - i == -1:
					break
				elif board[h - i][w] == "#":
					break
			score += i - 1
			D[h][w] = i - 1
			
			# UP
			if h == 0 or board[h - 1][w] == "#":
				U[h][w] = 0
			else:
				U[h][w] = U[h - 1][w] + 1
			score += U[h][w]
			
			# RIGHT
			for i in range(1, W):
				if w + i == W:
					break
				elif board[h][w + i] == "#":
					break
			score += i - 1
			R[h][w] = i - 1
			
			# LEFT
			if w == 0 or board[h][w - 1] == "#":
				L[h][w] = 0
			else:
				L[h][w] = L[h][w - 1] + 1
			score += L[h][w]
			
			# print(score)
			if score > high_score:
				high_score = score
				
print(high_score)

Buggy submission (verdict: Runtime Error):
import math
 
H, W = list(map(int, input().split()))
board = []
L = [[0 for i in range(W)] for i in range(H)]
R = [[0 for i in range(W)] for i in range(H)]
U = [[0 for i in range(W)] for i in range(H)]
D = [[0 for i in range(W)] for i in range(H)]

# H, W = 4, 6
# board = [['#', '.', '.', '#', '.', '.'], ['.', '.', '.', '.', '.', '#'], ['.', '.', '.', '.', '#', '.'], ['#', '.', '#', '.', '.', '.']]

# insert elements to the board
for i in range(H):
	a = list(input())
	board.append(a)


# high_score is output values
high_score = 0
	
# round robin
for h in range(H):
	for w in range(W):
		# print(h, w)
		# board put light is envolved
		score = 1
		# if not obstacle in board[h][w]
		if board[h][w] != "#":
			# DOWN
			for i in range(1, H):
				if h - i == -1:
					break
				elif board[h - i][w] == "#":
					break
			score += i - 1
			D[h][w] = i - 1
			
			# UP
			if h == 0 or board[h - 1][w] == "#":
				U[h][w] = 0
			else:
				U[h][w] = U[h - 1][w] + 1
			score += U[h][w]
			
			# RIGHT
			for i in range(1, W):
				if w + i == W:
					break
				elif board[h][w + i] == "#":
					break
			score += i - 1
			R[h][w] = i - 1
			
			# LEFT
			if w == 0 or board[h][w - 1] == "#":
				L[h][w] = 0
			else:
				L[h][w] = L[h][w - 1] + 1
			score += L[h][w]
			
			# print(score)
			if score > high_score:
				high_score = score
				
print(high_score)

Buggy submission (verdict: Runtime Error):
A = list(map(int, input().split()))
A = sorted(A)
return sum(A[:2])
Problem p03012 (python)

Fixed submission:
N = int(input())
W = list(map(int, input().split()))
 
minimum = 100000000000000000
for i in range(len(W)):
  abs_value = abs(sum(W[:i]) - sum(W[i:]))
  if abs_value < minimum:
    	minimum = abs_value
print(minimum)

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

minimum = 100000000000000000
for i in range(len(W)):
  abs_value = abs(sum(W[:i]) - sum(W[i:]))
  if abs_value < minimum:
    	minimum = abs_value
print(abs_value)
Problem p03036 (python)

Fixed submission:
r, D, a = map(int, input().split())
 
old = a
for i in range(10):
  print(r * old - D)
  old = r * old - D

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

old = a
for i in range(10):
  	print(r * old - D)
    old = r * old - D
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = str(input())
 
print(S[0 : K - 1] + S.lower()[K - 1 : K] + S[K : ])

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

S[K + 1] = S[K + 1].lower()
print(S)
Problem p03107 (python)

Fixed submission:
S = list(map(int, input()))

print(min(S.count(0), S.count(1)) * 2)

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

i  = 1
counter = 0
length = len(S)
while i < length or length < 2:
	if S[i - 1] != S[i]:
		del(S[i - 1 : i + 1])
		counter += 1
		length -= 2
		i -= 1
	else:
		i += 1
		
print(counter * 2)

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

i  = 1
counter = 0
while i < len(S):
	if S[i - 1] != S[i]:
		del(S[i - 1 : i + 1])
		counter += 1
		i -= 1
	else:
		i += 1
		
print(counter * 2)
Problem p03127 (python)

Fixed submission:
import fractions

N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    if i == 0:
        ans = A[i]
    else:
        ans = fractions.gcd(ans, A[i])
        
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    if i == 0:
        ans = A[i]
    else:
        ans = math.gcd(ans, A[i])
        
print(ans)
Problem p03207 (python)

Fixed submission:
N = int(input())
P = []
maximum_val = 0
maximum_index = 0

for i in range(N):
	a = int(input())
	P.append(a)
	if a > maximum_val:
		maximum_val = a
		maximum_index = i
print(int(sum(P) - P[maximum_index] / 2))

Buggy submission (verdict: Runtime Error):
N = int(input())
P = []
maximum_val = 0
maximum_index = Null

for i in range(N):
  a = int(input())
  P.append(a)
  if a > maximum_val:
    maximum_val = a
    maximum_index = i
print(sum(P) - P[maximum_index])

Buggy submission (verdict: Runtime Error):
N = int(input())
P = []
maximum_val = 0
maximum_index = Null

for i in range(N):
  a = int(input())
  P.append(a)
  if a > maximum:
    maximum_val = a
    maximum_index = i
print(sum(P) - P[maximum_index])
Problem p02779 (python)

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

ans1 = len(set(a))
ans2 = len(a)
if ans1 == ans2:
    print('YES')
else:
    print('NO')

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

l = [0]*(10**9+10)
for i in range(n):
    l[a[i]] += 1

bool = True
for j in range(len(l)):
    if l[j] > 1:
        bool = False
    else:
        continue
        
if bool:
    print('YES')
else:
    print('NO')

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

l = [0]*200010
for i in range(n):
    l[a[i]] += 1

bool = True
for j in range(len(l)):
    if l[j] > 1:
        bool = False
    else:
        continue
        
if bool:
    print('YES')
else:
    print('NO')

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

l = [0]*200010
for i in range(n):
    l[a[i]] += 1

bool = True
for j in range(len(l)):
    if l[j] > 1:
        bool = False
        break
        
if bool:
    print('YES')
else:
    print('NO')

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

l = [0]*200010
for i in range(n):
    l[a[i]] += 1

bool = True
for j in range(len(l)):
    if l[j] > 1:
        bool = False
        break
        
print('YES' if bool else 'NO')
Problem p02785 (python)

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
 
h_ = sorted(h)
 
for i in range(k):
    if len(h_) > 0:
        h_.pop()
    
s = [0]*(len(h_)+1)
for j in range(len(h_)):
    s[j+1] = s[j] + h_[j]

print(s[-1])

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

h_ = sorted(h)

for i in range(k):
    h_.pop()

s = [0]*(len(h_)+1)
for j in range(len(h_)):
    s[j+1] = s[j] + h_[j]

print(s[-1])

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

h_ = sorted(h)

for i in range(k):
    h_.pop()

s = [0]*(len(h_)+1)
for j in range(len(h_)):
    s[i+1] = s[i] + h_[i]

print(s[-1])

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

h_ = sorted(h)

for i in range(k):
  h_.pop()

print(sum(h_))
Problem p02831 (python)

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

def gcd(a, b):
    while b > 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return a*b/gcd(a, b)

print(int(lcm(a, b)))

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

import math
ans = a*b // math.gcd(a, b)
print(ans)
Problem p02880 (python)

Fixed submission:
n = int(input())
bool = False
for i in range(1, 10, 1):
    for j in range(1, 10, 1):
        if i*j == n:
            bool = True
            break
        else: 
            continue
            
if bool == True:
    print("Yes")
else: 
    print("No")

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

l = []
for i in range(n-1, 0, -1):
    if (n/i).is_integer() == True: 
        l.append(i)
        l.append(n/i)
        break
if l[0] < 10 and l[1] < 10:
    print('Yes')
else:
    print("No")

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

l = []
for i in range(n-1, 0, -1):
    if (n/i).is_integer() == True: 
        l.append(i)
        l.append(n/i)
        break
print(l)        
if l[0] < 10 and l[1] < 10:
    print('Yes')
else:
    print("No")

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

l = []
for i in range(n-1, 1, -1):
    if (n/i).is_integer() == True: 
        l.append(i)
        l.append(n/i)
        break
        
if l[0] < 10 and l[1] < 10:
    print('Yes')
else:
    print("No")

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

l = []
for i in range(n-1, 1, -1):
    if (n/i).is_integer() == True: 
        l.append(i)
        l.append(n/i)
        break
        
if l[0] < 10 and l[i] < 10:
    print('Yes')
else:
    print("No")
Problem p02881 (python)

Fixed submission:
n = int(input())

for i in range(1, int(n**(1/2))+2 , 1):
    if n%i == 0:
        j = n//i
i = n//j

ans = i-1 + j-1
print(ans)

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

for i in range(1, int(n**(1/2)) , 1):
    if n%i == 0:
        j = n//i
i = n//j

ans = i-1 + j-1
print(ans)

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

import math
for i in range(1, int(math.sqrt(n)) , 1):
    if n%i == 0:
        j = n//i
i = n//j

ans = i-1 + j-1
print(ans)
Problem p02897 (python)

Fixed submission:
N = int(input())
odd = 0
for i in range(0, N+1, 1):
    if i % 2 == 0:
        continue
    elif i % 2 == 1:
        odd += 1
print(float(odd/N))

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

ans = []
for i in range(1, N+1, 1):
    ans.append(A.index(i)+1)
    
for j in range(N):
    print(ans[j], end=" ")

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

ans = []
for i in range(1, N+1, 1):
    ans.append(A.index(i)+1)
    
for j in range(N):
    print(ans[j], end=" ")
Problem p02916 (python)

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

ans = 0
for i in range(n):
    val = a[i]-1
    ans += b[val]
    if a[i] == a[i-1]+1 and i > 0:
        ans += c[val-1]
        
print(ans)

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

ans = 0
for i in range(n):
    val = a[i]-1
    ans += b[val]
    if a[i+1] == a[i]+1:
        ans += c[i-1]
        
print(ans)
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print('red')

Buggy submission (verdict: Runtime Error):
N = int(input())
v = list(map(int, input().split()))
vsort = sorted(v)
ans = (vsort[0]+vsort[1])/2

for i in range(N):
    if N <= 2:
        break
    else:
        ans = (ans + vsort[i])/2
        
print(ans)
Problem p02987 (python)

Fixed submission:
s = sorted(list(input()))
if s[0] == s[1] == s[2] == s[3]:
    print('No')
elif s[0] == s[1] and s[2] == s[3]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = sorted(list(input()))
if s[0] == s[1] and s[2] == s[3]:
    print('Yes')
elif s[0] == s[1] and s[0] == s[2]
    print('No')
else:
    print('No')
Problem p03265 (python)

Fixed submission:
# B
x1, y1, x2, y2 = map(int, input().split())

od = [x1+y1-y2, y1-x1+x2]
oc = [x2-y2+y1, -x1+x2+y2]

od = map(str, list(od))
oc = map(str, list(oc))

print(' '.join(list(oc)) +' ' + ' '.join(list(od)))

Buggy submission (verdict: Runtime Error):
# B
x1, y1, x2, y2 = map(int, input().split())

import numpy as np
R_90 = np.array([[0, -1], [1, 0]])
oa = np.array([x1, y1])
ab = np.array([x2 - x1, y2 - y1])
ad = R_90 @ ab
od = oa + ad
oc = od + ab

od = map(str, list(od))
oc = map(str, list(oc))

print(' '.join(list(oc)) +' ' + ' '.join(list(od)))

Buggy submission (verdict: Runtime Error):
# B
x1, y1, x2, y2 = map(int, input().split())

import numpy as np
R_90 = np.array([[0, -1], [1, 0]])
oa = np.array([x1, y1])
ab = np.array([x2 - x1, y2 - y1])
ad = R_90 @ ab
od = oa + ad
oc = od + ab

od = map(str, list(od))
oc = map(str, list(oc))

print(' '.join(list(oc)) +' ' + ' '.join(list(od)))
Problem p03775 (python)

Fixed submission:
# ABC 057 C - Digits in Multiplication
# 2020/04/07　20:6-
n = int(input())

def F(a, b):
    A = len(str(a))
    B = len(str(b))
    return max(A, B)

ans = 10**12
for i in range(1, int(n**(1/2))+1):
    j = n / i
    if j%1 == 0:
        j = n // i
        if ans > F(i, j):
            ans = F(i, j)
            
print(ans)

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

def F(a, b):
    return max(len(str(a)), len(str(b)))

ans = 10**10
for i in range(1, n**(1/2)+1):
    j = n / i
    if (n/i)%1 == 0:
        j = n // i
        if ans > F(i, j):
            ans = F(i, j)
        
print(ans)

Buggy submission (verdict: Runtime Error):
# ABC 057 C - Digits in Multiplication
# 2020/04/07　20:6-
n = int(input())

def F(a, b):
    A = len(str(a))
    B = len(str(b))
    return max(A, B)

ans = math.inf
for i in range(1, int(n**(1/2))+1):
    j = n / i
    if j%1 == 0:
        j = n // i
        if ans > F(i, j):
            ans = F(i, j)
            
print(ans)
Problem p02726 (python)

Fixed submission:
import collections 
N,X,Y = map(int,input().split())
d = [[0]*(N+1) for _ in range(N+1)]
for i in range(1,N):#i => j
    for j in range(i+1,N+1):
        if(i>=Y or j<=X):
            d[i][j] = j-i
        elif(i<=X and j>=Y):
            d[i][j] = (X-i)+1+(j-Y)
        else:
            a_path = j-i
            b_path = abs(X-i)+1+abs(Y-j)
            d[i][j] = min(a_path,b_path)

ans = [0]
for i in range(N+1):
    ans += d[i]
c = collections.Counter(ans)
for k in range(1,N): 
    print(c[k])

Buggy submission (verdict: Runtime Error):
import collections 
N,X,Y = map(int,input().split())
d = [[0]*(N+1) for _ in range(N+1)]
for i in range(1,N):#i => j
    for j in range(i+1,N+1):
        if(i>=Y or j<=X):
            d[i][j] = j-i
        elif(i<=X and j>=Y):
            d[i][j] = (X-i)+1+(j-Y)
        else:
            a_path = j-i
            b_path = abs(X-i)+1+abs(Y-j)
            d[i][j] = min(a_path,b_path)

ans = [0]
for i in range(N+1):
    ans += d[i]
c = Counter(ans)
for k in range(1,N): 
    print(c[k])
Problem p02762 (python)

Fixed submission:
import sys
from collections import Counter
N,M,K = map(int,input().split())
f = [[] for _ in range(N+1)]
b = [[] for _ in range(N+1)]
for i in range(M):
    x,y = map(int,input().split())
    f[x].append(y)
    f[y].append(x)

d = [None]*(N+1)
sys.setrecursionlimit(10**9)
def dfs(f,s,id):
    if(d[s] is None):
        d[s] = id
    for i in f[s]:
        if(d[i] is not None):
            continue
        dfs(f,i,id)
         
cnt = -1
for j in range(1,N+1):
    if(d[j] == None):
        cnt += 1
        dfs(f,j,cnt)
    
for i in range(K):
    x,y = map(int,input().split())
    if(d[x] == d[y]):
        b[x].append(y)
        b[y].append(x)

c = Counter(d)
for i in range(1,N+1):
    print(c[d[i]] - len(f[i]) - len(b[i])-1)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N,M,K = map(int,input().split())
f = [[] for _ in range(N+1)]
b = [[] for _ in range(N+1)]
for i in range(M):
    x,y = map(int,input().split())
    f[x].append(y)
    f[y].append(x)

d = [None]*(N+1)

def dfs(f,s,id):
    if(d[s] is None):
        d[s] = id
    for i in f[s]:
        if(d[i] is not None):
            continue
        dfs(f,i,id)
         
cnt = -1
for j in range(1,N+1):
    if(d[j] == None):
        cnt += 1
        dfs(f,j,cnt)
    
for i in range(K):
    x,y = map(int,input().split())
    if(d[x] == d[y]):
        b[x].append(y)
        b[y].append(x)

c = Counter(d)
for i in range(1,N+1):
    print(c[d[i]] - len(f[i]) - len(b[i])-1)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N,M,K = map(int,input().split())
f = [[] for _ in range(N+1)]
b = [[] for _ in range(N+1)]
for i in range(M):
    x,y = map(int,input().split())
    f[x].append(y)
    f[y].append(x)

d = [None]*(N+1)

def dfs(f,s,id):
    if(d[s] is None):
        d[s] = id
    for i in f[s]:
        if(d[i] is not None):
            continue
        dfs(f,i,id)
         
cnt = -1
for j in range(1,N):
    if(d[j] == None):
        cnt += 1
        dfs(f,j,cnt)
    
for i in range(K):
    x,y = map(int,input().split())
    if(d[x] == d[y]):
        b[x].append(y)
        b[y].append(x)
    
c = Counter(d)
for i in range(1,N+1):
    print(c[d[i]] - len(f[i]) - len(b[i])-1)
Problem p02763 (python)

Fixed submission:
from bisect import insort_left, bisect_left
N = int(input())
S = list(input())
Q = int(input())
Query = [input() for _ in range(Q)]
dic = {chr(i+ord("a")):[] for i in range(26)}
for i, s in enumerate(S):
    dic[s].append(i)
for q in Query:
    t,a,b = q.split()
    a = int(a)-1
    if(t == "1"):
        if(S[a]==b):
            continue
        tmp_index = bisect_left(dic[S[a]],a)
        dic[S[a]].pop(tmp_index)
        insort_left(dic[b],a)
        S[a] = b
    elif(t == "2"):
        b = int(b)-1
        cnt = 0
        for li in dic.values():
            if li and a<=li[-1] and li[bisect_left(li, a)] <= b:
                cnt += 1
        print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
Q = int(input())
Query = [input() for _ in range(Q)]
dic = {chr(i+ord("a")):[] for i in range(26)}
for i, s in enumerate(S):
    dic[s].append(i)
for q in Query:
    t,a,b = q.split()
    if(t == "1"):
        a_index = int(a)-1
        if(S[a_index]==b):
            continue
        tmp_index = bisect_left(dic[S[a_index]],a_index)
        dic[s[a]].pop(tmp_index)
        insort.left(dic[b],a)
        s[a] = b
    elif(t == "2"):
        a_index = int(a)-1
        b_index = int(b)-1
        cnt = 0
        for li in dic.values():
            if(li and a_index <= li[-1] and li[bisect_left(li,a_index)] <= b_index):
                    cnt += 1
        print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
Q = int(input())
Query = [input() for _ in range(Q)]
dic = {chr(i+ord("a")):[] for i in range(26)}
for i, s in enumerate(S):
    dic[s].append(i)
for q in Query:
    t,a,b = q.split()
    if(t == "1"):
        a_index = int(a)-1
        dic[S[a_index]].remove(a_index)
        dic[b].append(a_index)
    if(t == "2"):
        a_index = int(a)-1
        b_index = int(b)-1
        cnt = 0
        for i in range(26):
            for d in dic[chr(i+ord("a"))]:
                if(a_index<=d<=b_index):
                    cnt += 1
                    break
        print(cnt)
Problem p02771 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if(A == B && A != C):
    print('Yes')
elif(A == C && A != B):
    print('Yes')
elif(C == B && A != B):
    print('Yes')
else:
    print('No')
Problem p02773 (python)

Fixed submission:
import collections
N = int(input())
S = []

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

SS = collections.Counter(S)
m = max(SS.values())
for i in SS.keys():
    if(SS[i]== m):
        res.append(i)
res.sort()
for i in range(len(res)):
    print(res[i])

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
S = []

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

SS = collections.Counter(S)
for i in range(len(S_dict)):
    if(SS[S[i]]== max(SS.values())):
        res.append(S[i])
res.sort()
for i in range(len(res)):
    print(res[i])