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

Fixed submission:
a, b = map(int,input().split())
if a + b == 15:
  print("+")
elif a * b == 15:
  print("*")
else:
  print("x")

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().split())
if a + b = 15:
  print("+")
elif a * b = 15:
  print("*")
else:
  print("x")
Problem p03303 (python)

Fixed submission:
S = input()
w = int(input())
for i in range(len(S)):
  if w != 1 and (i + 1) % w == 1 :
    print(S[i], end = "")
  elif w == 1:
    print(S[i], end = "")

Buggy submission (verdict: Runtime Error):
S = list(print(""))
w = int(input())
for i in range(len(S)):
  if (i + 1) % w == 1:
    print(S[i]),
Problem p03478 (python)

Fixed submission:
N, A, B = map(int,input().split())
ans = 0
for i in range(N + 1):
  i = str(i)
  count = 0
  for j in i:
    count += int(j)
  if A <= count and B >= count:
    ans += int(i)
print(ans)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int,input().split())
ans = 0
for i in range(len(N)):
  i = str(i)
  count = 0
  for j in i:
    count += int(j)
  if A <= count and B >= count:
    ans += int(i)
print(ans)
Problem p03635 (python)

Fixed submission:
n, m = list(map(int,input().split(" ")))
print((n - 1) * (m - 1))

Buggy submission (verdict: Runtime Error):
n = int(input())
m = int(input())
print((n - 1) * (m - 1))
Problem p03671 (python)

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

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
min = min{a + b, b + c, c + a}
print(min)
Problem p03672 (python)

Fixed submission:
import sys
S = input()

for i in range(1, len(S)):
  s = S[:-i]
  l = len(s) // 2
  if s[:l] == s[l:]:
    print(len(s))
    sys.exit()

Buggy submission (verdict: Runtime Error):
S = input()
for i in range(1, len(S)):
  s = S[:-i]
  l = len(s) / 2
  if s[:l] == s[l:]:
    print(len(s))

Buggy submission (verdict: Runtime Error):
s = input()
for i in range(int(len(s) + 1) / 2):
  if s[i] != s[int(len(s) + 1) / 2]:
    del[len(s) - 1]
print(len(s) + 1)
Problem p03711 (python)

Fixed submission:
x, y = map(int,input().split())
S1 = [1, 3, 5, 7, 8, 10, 12]
S2 = [4, 6, 9, 11]
ans = False
for i in range(len(S1)):
  for j in range(len(S1)):
    if S1[i] == x and S1[j] == y:
      ans = True
for i in range(len(S2)):
  for j in range(len(S2)):
    if S2[i] == x and S2[j] == y:
      ans = True
if ans:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x, y = map(int,input().split())
S1 = [1, 3, 5, 7, 8, 10, 12]
S2 = [4, 6, 9, 11]
for i in range(len(S1)):
  for j in range(len(S1)):
    if (S1[i] == x and s1[j] == y) or (S2[i] == x adn S2[j] == y):
      print("Yes")
    else:
      print("No")
Problem p03844 (python)

Fixed submission:
A, op, B = input().split()
if op == '-':
  print(int(A) - int(B))
else:
  print(int(A) + int(B))

Buggy submission (verdict: Runtime Error):
A, op, B = input().split()
if op == '-':
  print(int(A) - int(B))
else:
  print(int(A) + (B))

Buggy submission (verdict: Runtime Error):
A, op, B = input().split()
if op = '-':
  print(A - B)
else:
  print(A + B)

Buggy submission (verdict: Runtime Error):
A, op, B = list(map(int,input().split()))
if op = '+':
  print(A + B)
else:
  print(A - B)
Problem p02536 (python)

Fixed submission:
from sys import setrecursionlimit
from collections import Counter
import networkx as nx
setrecursionlimit(1000000)
def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]

def find_components(n, connectors):
    g = nx.Graph()
    for i in range(n): g.add_node(i+1)
    g.add_edges_from(connectors)
    return len(list(nx.connected_components(g)))


n, m = m_in(int)
ab = [list(m_in(int)) for _ in range(m)]

ans = find_components(n, ab) - 1

print(ans)

Buggy submission (verdict: Runtime Error):
from sys import setrecursionlimit
setrecursionlimit(1000000)
def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]

n, m = m_in(int)
ab = [list(m_in(int)) for _ in range(m)]

nodes = [i for i in range(n)]
for a, b in ab:
    nodes.pop(b-1)

ans = len(nodes)-1

print(ans)
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a + a**2 + a ** 3)

Buggy submission (verdict: Runtime Error):
A = int(input())
print(a + a**2 + a ** 3)
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))
i, ans = 0, 0
a = 1
while a:
    if x not in p: print(x); break
    for i in range(max(p)+2):
        if x+i not in p:
            if x-i not in p:
                ans=x-i
                break
            ans=x+i
            break
        if x-i not in p:
            ans=x-i
            break
    print(ans)
    a = 0

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))
i, ans = 0, 0
for i in range(max(p)+2):
    if x+i not in p:
        if x-i not in p:
            ans=x-i
            break
        ans=x+i
        break
    if x-i not in p:
        ans=x-i
        break
print(ans)
Problem p02642 (python)

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

A = max(a)

cnt = [0]*(A+1)
uq = []

for i in a:
    cnt[i] += 1

for i in range(A+1):
    if cnt[i] == 1:
        uq.append(i)

cnt = [0]*((10**6)+1)
cnt1 = 0


a = list(set(a))

# for i in a:
#     for j in range(2,A+1):
#         if i*j<=A+1:
#             cnt[i*j] = 1

for elem in a:
    for m in range(elem * 2, (10 ** 6) + 1, elem):
        cnt[m] = 1

for i in uq:
    if cnt[i] == 0:
        cnt1 += 1

print(cnt1)

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

A = max(a)

cnt = [0]*(A+1)
uq = []

for i in a:
    cnt[i] += 1

for i in range(A+1):
    if cnt[i] == 1:
        uq.append(i)

cnt = [0]*((10**6)+1)
cnt1 = 0


a = list(set(a))



for i in a:
    for j in range(2,A+1):
        cnt[i*j] = 1


for i in uq:
    if cnt[i] == 0:
        cnt1 += 1

print(cnt1)

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

A = max(a)

cnt = [0]*(A+1)
uq = []

for i in a:
    cnt[i] += 1

for i in range(A+1):
    if cnt[i] == 1:
        uq.append(i)

cnt = [0]*((10**6)+1)
cnt1 = 0


a = list(set(a))



for i in a:
    for j in range(2,A+1):
            cnt[i*j] = 1


for i in uq:
    if cnt[i] == 0:
        cnt1 += 1

print(cnt1)
Problem p02696 (python)

Fixed submission:
# a,b,n=map(int,input().split())
# max=0
# for i in range(1,n+1):
#     if a%b*i%b<i%b:
#         ans=a*i//b -a*(i//b)
#         if max<ans:
#             max=ans

# print(max)

a,b,n=map(int,input().split())
max=0

if b>n:
    x=n
    ans=(a*x)//b -a*(x//b)

else:
    x=b-1
    ans=(a*x)//b -a*(x//b)

print(ans)

Buggy submission (verdict: Runtime Error):
a,b,n=map(int,input().split())
max=0
for i in range(1,n+1):
    if a%b*i%b!=0:
        if a%b*i%b<a%b
            ans=a*i//b -a*(i//b)
            if max<ans:
                max=ans

print(max)
Problem p03076 (python)

Fixed submission:
li=[]
for i in range(5):
    li.append(int(input()))

min=9

min_f=0

for i in range(5):
    if min> li[i]%10 >0:
        min=li[i]%10
        min_f=i

cnt=0

for i in range(5):
    if i==min_f:
        continue
    if li[i]%10==0:
        cnt+=li[i]
    else:
        cnt+=li[i]+10-li[i]%10
print(cnt+li[min_f])

Buggy submission (verdict: Runtime Error):
li=[]
for i in range(5):
    li.append(int(input()))

min=9

for i in range(5):
    if min> li[i]%10 >0:
        min=li[i]%10
        min_f=i

cnt=0

for i in range(5):
    if i==min_f:
        continue
    if li[i]%10==0:
        cnt+=li[i]
    else:
        cnt+=li[i]+10-li[i]%10
print(cnt+li[min_f])
Problem p03815 (python)

Fixed submission:
x = int(input())
 
ans = (x//11)*2
remainder = x%11
if remainder == 0:
    print(ans)
elif 1 <= remainder <= 6:
    print(ans+1)
else:
    print(ans+2)

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

if x>0:
    if x%11>5:
        ans=(x//11)*2+2


    elif 1<=x%11<=5:
        ans=(x//11)*2+1
else:
    ans==(x//11)*2

print(ans)

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

if x>0:
    if x%11>5:
        ans=(x//11)*2+2


    elif 1<=x%11<=5:
        ans=(x//11)*2+1
else:
    ans==(x//11)*2

print(ans)

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

if x>0:
    if x%11>5:
        ans=(x//11)*2+2


    elif 1<=x%11<=5:
        ans=(x//11)*2+1

print(ans)

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


if x>0:
    if x%11>5:
        ans=(x//11)*2+2

    elif 1<=x%11<=5:
        ans=(x//11)*2+1

print(ans)

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


if x>0:
    if x%11>=6:
        ans=(x//11)*2+2

    elif 1<=x%11<=5:
        ans=(x//11)*2+1


print(ans)

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


if x>0:
    if x%11>=7:
        ans=(x//11)*2+2

    elif 1<=x%11<=6:
        ans=(x//11)*2+1


print(ans)
Problem p02631 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
 
xor = 0
for i in A:
    xor ^= i
 
for j in range(N):
    print(xor^A[j], end=' ')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
 
xor = 0
for i in A:
    A ^= i
 
for j in range(N):
    print(A^a[i], end=' ')
Problem p02642 (python)

Fixed submission:
N = int(input())
A = sorted(list(map(int, input().split())))
max = A[-1]
memo = ['Yes'] * (10**6+1)
ans = 0
 
for i, A_i in enumerate(A):
    if memo[A_i] == 'No':
        continue
    for j in range(A_i, max+1, A_i):
        memo[j] = 'No'
    if i != N-1 and A_i == A[i+1]:
        continue
    ans += 1
 
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())
A = sorted(list(map(int, input().split())))

if N == 1:
    print(1)
    sys.exit()
max = A[-1]
memo = ['Yes'] * (10**6+1)
ans = 0
 
for i, A_i in enumerate(A):
    if memo[A_i] == 'No':
        continue
    for j in range(A_i, max+1, A_i):
        memo[j] = 'No'
    if A_i == A[i+1]:
        continue
    ans += 1
 
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())

A = list(map(int, input().split()))
A = [x for x in set(A) if A.count(x) == 1]
if len(A) <= 1:
    print(len(A))
    sys.exit()

A = np.array(sorted(A))
B = np.array([A[0]])
 
for i in range(len(A)-1):
    if np.all(A[i+1] % B != 0):
        B = np.append(B, A[i+1])
print(len(B))

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())

if N == 1:
    print(1)
    sys.exit()
    
A = sorted(set(map(int, input().split())))

if len(A) == 1:
    print(0)
    sys.exit()
    
max = A[-1]
memo = ['Y'] * (10**6+1)
ans = 0
 
for i, A_i in enumerate(A):
    if memo[A_i] == 'N':
        continue
    for j in range(A_i, max+1, A_i):
        memo[j] = 'N'
    if i != N-1 and A_i == A[i+1]:
        continue
    ans += 1
    
print(ans)
Problem p02664 (python)

Fixed submission:
T = input()
ans = 0

if T[0] == "?":
    if len(T) == 1:
        ans = "D"
    elif T[1] == "D":
        ans = "P"
    else:
        ans = "D"
else:
    ans = T[0]

for i in range(len(T)-2):
    if T[i+1] == "?":
        if ans[i]  == "P":
            ans += "D"
        else:
            if T[i+2] == "P":
                ans += "D"
            else:
                ans += "P"
    else:
        ans += T[i+1]

if len(T) > 1:
    if T[-1] == "?":
        ans += "D"
    else:
        ans += T[-1]
            
print(ans)

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

if T[0] == "?":
    if T[1] == "P":
        ans = "D"
    else:
        ans = "P"
else:
    ans = T[0]

for i in range(len(T)-1):
    if T[i+1] == "?":
        if ans[i]  == "P":
            ans += "D"
        else:
            if T[i+2] == "P":
                ans += "D"
            else:
                ans += "P"
    else:
        ans += T[i+1]
        
print(ans)
Problem p02731 (python)

Fixed submission:
from decimal import Decimal

L = input()

l = Decimal(L) / 3

print(l ** 3)

Buggy submission (verdict: Runtime Error):
L = input()
 
l = L / 3
 
print(l ** 3)
Problem p02837 (python)

Fixed submission:
N = int(input())
xy = []
for i in range(N):
    A = int(input())
    xy.append([])
    for j in range(A):
        xy[i].append(tuple(map(int, input().split())))
 
ans = 0
 
for i in range(2 ** N):
    h = [0] * N
 
    for j in range(N):
        if (i >> j) & 1:
            h[j] = 1
    
    flag = False
    for i in range(N):
        if h[i] == 1:
            for x, y in xy[i]:
                if h[x-1] != y:
                    flag = True
                    break
            if flag:
                break
    
    if not flag:
        ans = max(ans, sum(h))
 
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

N = int(input())

evidence_dit = {}

for i in range(N):
    A = int(input())
    x_y = []
    for j in range(A):
        x_y.append(list(map(int,input().split())))
        
        evidence_dit[i] = x_y 

attribute = [0,1]
ans = 0

for i in itertools.product(attribute,repeat=N):
    flag = False
    
    for j in range(N):
        if i[j] == 1:
            for k in evidence_dit[j]:
                if i[k[0]-1] != k[1]:
                    flag = True
                    break
            if flag:
                break

    if flag == False:
        ans = max(ans,sum(i))
             

print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

N = int(input())

evidence_dit = {}

for i in range(N):
    A = int(input())
    x_y = []
    for j in range(A):
        x_y.append(list(map(int,input().split())))
        
        evidence_dit[i] = x_y 

attribute = [0,1]
ans = []

for i in itertools.product(attribute,repeat=N):
    flag = False
    
    for j in range(N):
        if i[j] == 1:
            for k in evidence_dit[j]:
                if i[k[0]-1] != k[1]:
                    flag = True
                    break
            if flag:
                break

    if flag == False:
        ans.append(i.count(1))
             

print(max(ans))

Buggy submission (verdict: Runtime Error):
import itertools

N = int(input())

evidence_dit = {}

for i in range(N):
    A = int(input())
    x_y = []
    for j in range(A):
        x_y.append(list(map(int,input().split())))
        
        evidence_dit[i+1] =  x_y

attribute = [0,1]
ans = []

for i in itertools.product(attribute,repeat=N):
    for j in range(N):
        if i[j] == 1:
            for k in evidence_dit[j+1]:
                if i[k[0]-1] != k[1]:
                    break
            else:
        
                continue
            break
    else:
        ans.append(i.count(1))
                

print(max(ans))
Problem p02845 (python)

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

c = [0]*3

a = 1

for i in A:
    if c.count(i) != 0:
        a *= c.count(i)
        c[c.index(i)] += 1
    
    else:
        print(0)
        break
else:
    print(a%1000000007)

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

c = [0]*3

a = 1

for i in A:
    a *= c.count(i)
    c[c.index(i)] += 1
    
print(a%1000000007)
Problem p02887 (python)

Fixed submission:
n = int(input())
s = list(input())

ans = 1

for i in range(n-1):
    if s[i] == s[i+1]:
        continue
    else:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

n = int(input())
l = list(map(int,input().split()))


a = list(itertools.combinations(l, 3))
b = []

for i in a:
    b.append(tuple(sorted(i)))

c = list(set(b))

count = 0

for i in c:
    if i[0] < i[1] + i[2] and i[1] < i[0] + i[2] and i[2] < i[0] + i[1]:
        count += 1

print(count)
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()
c = 0
for i in range(2,n):
  if s[i-2] == "A" and s[i-1] == "B" and s[i] == "C":
    c += 1
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
c = 0
if n <= 2:
  print(0)
else:
  for i in range(2,n+1):
    if s[i-2] == "A" and s[i-1] == "B" and s[i] == "C":
      c += 1
  print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
c = 0
for i in range(2,n+1):
  if s[i-2] == "A" and s[i-1] == "B" and s[i] == "C":
    c += 1
print(c)
Problem p03359 (python)

Fixed submission:
a,b = map(int, input().split())
if a <= b:
  print(a)
else:
  print(a-1)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d):
  print("Yes")
else:
  print("No")
Problem p02714 (python)

Fixed submission:
import sys
#sys.exit()
#sorted( ,reverse=True)
N = int(input())
S = str(input())
r = S.count("R")
g = S.count("G")
b = S.count("B")
ans = (r*g*b)
for i in range (N-2):
    for j in range (i+1,N-1):
        k = 2*j-i
        if k < N and S[i]!=S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -=1
                #print(r2[i],g2[j],b2[k])
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
#sys.exit()
#sorted( ,reverse=True)
N = int(input())
#S,T = map(int, input().split())
#A = list(map(int, input().split()))
#print(N)
#print(S,T)
#print(A)
S = str(input())
r = S.count("R")
g = S.count("G")
b = S.count("B")
ans = (r*g*b)
#r2 = [i for i, x in enumerate(S) if x == 'R']
#g2 = [i for i, x in enumerate(S) if x == 'G']
#b2 = [i for i, x in enumerate(S) if x == 'B']
ans = (len(r2)*len(g2)*len(b2))
for i in range (N-2):
    for j in range (i+1,N-1):
        k = 2*j-i
        if k < N and S[i]!=S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -=1
                #print(r2[i],g2[j],b2[k])
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
#sys.exit()
#sorted( ,reverse=True)
N = int(input())
#S,T = map(int, input().split())
#A = list(map(int, input().split()))
#print(N)
#print(S,T)
#print(A)
S = str(input())
r = S.count("R")
g = S.count("G")
b = S.count("B")
ans = (r*g*b)
#r2 = [i for i, x in enumerate(S) if x == 'R']
#g2 = [i for i, x in enumerate(S) if x == 'G']
#b2 = [i for i, x in enumerate(S) if x == 'B']
ans = (len(r2)*len(g2)*len(b2))
for i in range (N-2):
    for j in range (i+1,N-1):
        k = 2*j-i
        if k < N and S[i]!=S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -=1
                #print(r2[i],g2[j],b2[k])
print(ans)
Problem p02717 (python)

Fixed submission:
X, Y, Z = map(int, input().split())
print(Z,X,Y)

Buggy submission (verdict: Runtime Error):
 X, Y, Z = map(int, input().split())
print(Z,X,Y)

Buggy submission (verdict: Runtime Error):
 X, Y, Z = map(int, input().split())
print(Z,X,Y)
Problem p02755 (python)

Fixed submission:
A, B = map(int, input().split())
ans1 = int(A *100// 8) 
ans2 = int(B *100 // 10)
ans1_2 = int((A+1) *100 // 8)
ans2_2 = int((B+1) *100 // 10)
list1 = []
list2 = []

for i in range(ans1,ans1_2):
    if int(i * 0.08) == A: 
        list1.append(int(i))
for j in range(ans2,ans2_2):
    if int(j * 0.1) == B:
        list2.append(int(j))
if list1[0] == list2[0]:
    print(list1[0])
elif list1[0] > list2[0]:
    if list1[0] in list2:
        print(list1[0])
    else:
        print(-1)
elif list1[0] < list2[0]:
    if list2[0] in list1:
        print(list2[0])
    else:
        print(-1)

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

ans1 = int(A *100// 8) 
ans2 = int(B *100 // 10)

if ans1 = ans2:
    print(ans1)

elif ans1 > ans2:
    ans2_2 = int((B+1) *100 // 10)
    list = [int(ans2)]

    for i in range(ans2+1,ans2_2):
        list.append(int(i)) 
    
    if int(ans1) in list:
        print(ans1)
    else:
        print(-1)
elif ans1 < ans2:
    ans1_2 = int((A+1) *100 // 8)
    list = [int(ans1)]

    for i in range(ans1+1,ans1_2):
        list.append(int(i)) 
    
    if int(ans2) in list:
        print(ans2)
    else:
        print(-1)

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

ans1 = int(A *100// 8) 
ans2 = int(B *100 // 10)

if ans1 = ans2:
    print(ans1)

elif ans1 > ans2:
    ans2_2 = int((B+1) *100 // 10)
    list = [int(ans2)]

    for i in range(ans2+1,ans2_2):
        list.append(int(i)) 
    
    if int(ans1) in list:
        print(ans1)
    else:
        print(-1)
elif: ans1 < ans2:
    ans1_2 = int((A+1) *100 // 8)
    list = [int(ans1)]

    for i in range(ans1+1,ans1_2):
        list.append(int(i)) 
    
    if int(ans2) in list:
        print(ans2)
    else:
        print(-1)
Problem p02761 (python)

Fixed submission:
import sys
N,M = map(int, input(). split())

s = [0,]*M
c = [0,]*M
ans =[10,]*N



for i in range(M):
    s[i], c[i] = map(int, input(). split())
    if ans[s[i]-1] != 10 and ans[s[i]-1] != c[i]:
        print(-1)
        sys.exit()
    else:
        ans[s[i]-1] = c[i]       
if N >= 2:
        
    A = 0        
    if ans[0] == 0:
        print(-1)
        sys.exit()
    elif ans[0] == 10:
        ans[0] = 1
        for j in range(N):
            if ans[j] == 10:
                ans[j] = 0
        for k in range(N):
            A += 10**(N-k-1)*ans[k] 
    
        print(A)
        
    else:
        for j in range(N):
            if ans[j] == 10:
                ans[j] = 0
        for k in range(N):
            A += 10**(N-k-1)*ans[k] 
        print(A)
else:
    A = 0
    if ans[0] == 0 or ans[0] == 10:
        print(0)
    else:
        print(ans[0])

Buggy submission (verdict: Runtime Error):
import sys
N,M = map(int, input(). split())
s = [0,]*M
c = [0,]*M
ans =[10,]*N
for i in range(M):
    s[i], c[i] = map(int, input(). split())
    if ans[s[i]-1] != 10 and ans[s[i]-1] != c[i]:
        print(-1)
        sys.exit()
    else:
        ans[s[i]-1] = c[i]
if ans[0] == 0:
    print(-1)
    sys.exit()
elif ans[0] == 10:
    ans[0] = 1
    A = 0
    for j in range(N):
        if ans[j] == 10:
            ans[j] = 0
    for k in range(N):
        A += 10**(M-k)*ans[k] 
    print(A)
        
else:
    A = 0
    for j in range(N):
        if ans[j] == 10:
            ans[j] = 0
    for k in range(N):
        A += 10**(M-k)*ans[k] 
    print(A

Buggy submission (verdict: Runtime Error):
import sys
N,M = map(int, input(). split())
s = [0,]*M
c = [0,]*M
ans =[10,]*M 
for i in range(M):
    s[i], c[i] = map(int, input(). split())
    if ans[s[i]-1] != 10 and ans[s[i]-1] != c[i]:
        print(-1)
        sys.exit()
    else:
        ans[s[i]-1] = c[i]

if ans[0] == 0:
    print(-1)
    sys.exit()
elif ans[0] == 10:
    ans[0] = 1
    A = 0
    for j in range(N):
        if ans[j] == 10:
            ans[j] = 0
    for k in range(N):
        A += 10**(M-(k+1))*ans[k] 
    print(A)
        
else:
    A = 0
    for j in range(N):
        if ans[j] == 10:
            ans[j] = 0
    for k in range(N):
        A += 10**(M-(k+1))*ans[k] 
    print(A)

Buggy submission (verdict: Runtime Error):
import sys
N,M = map(int, input(). split())
s = [0,]*M
c = [0,]*M
ans =[10,]*M 
for i in range(M):
    s[i], c[i] = map(int, input(). split())
    if ans[s[i]-1] != 10 and ans[s[i]-1] != c[i]:
        print(-1)
        sys.exit()
    else:
        ans[s[i]-1] = c[i]

if ans[0] == 0:
    print(-1)
    sys.exit()
else:
    A = 0
    for j in range(N):
        if ans[j] == 10:
            ans[j] = 0
    for k in range(N):
        A += 10**(M-(k+1))*ans[k] 
    print(A)
Problem p02789 (python)

Fixed submission:
N, M = map(int, input().split())
if N == M:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
P = list(map(int, input().split()))
cnt = 1
for i in range(1,N):
    if P[i] < min(P[0:i]): cnt += 1
print(cnt)
Problem p02801 (python)

Fixed submission:
l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',]
C = input()
print(l[l.index(C)+1])

Buggy submission (verdict: Runtime Error):
K,X = map(int, input().split())
if K*500 >= X:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
K,X = map(int, input().split())
if K*500 >= X:
    print('Yes')
else:
    print('No')