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

Fixed submission:
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
ans = 0
for i in range(n):
  tmp=0
  for j in range(n):
    if s[i] == s[j]:
      tmp+=1
  for j in range(m):
    if s[i] == t[j]:
      tmp-=1
  ans=max(ans,tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
ans=len(s)

for i in range(n):
  for j in range(m):
    if s[i] == s[j]:
      ans-=1
if ans < 0:
  print("0")
else:
  print(ans)
Problem p03416 (python)

Fixed submission:
a,b=map(int,input().split())
c=0
for i in range(a,b+1):
  if str(i)[::-1] == str(i):
    c += 1
print(c)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=0
for i in range(a,b+1):
  if str(i)[::0] == str(i):
    c += 1
print(c)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=0
for i range(a,b+1):
  if str(i)[::0] == str(i):
    c += 1
print(c)
Problem p03434 (python)

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

a.sort(reverse=True)
print(sum(a[::2])-sum(a[1::2]))

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

a.sort(reverse=True)
print(sun(a[::2])-sun(a[1::2]))
Problem p03447 (python)

Fixed submission:
X = int(input())
A = int(input())
B = int(input())

tmp=X-A

while tmp >= B:
  tmp=tmp-B
print(tmp)

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

tmp=X-A

while tmp => B:
  tmp=tmp-B
print(tmp)
Problem p03448 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if d == 500*i + 100*j + 50*k:
        ans += 1
print(ans)

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

b = input()
b = int(b)

c = input()
c = int(c)

d = input()
d = int(d)

ans = 0

for i in range(0, a+1):
  for j in range(0, b+1):
    for k in range(0, c+1):
      if x == i*500 + j*100 + k*50:
        ans = ans + 1
Problem p03455 (python)

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

if(a*b)%2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())
if a*b%2==0:
  print("Even")
else:
  print("Odd")
Problem p03471 (python)

Fixed submission:
N,Y = map(int,input().split())
for i in range(N+1):
  for j in range(N-i+1):
    k = N-i-j
    if i*10000 + j*5000 + k*1000 == Y:
      print(i,j,k)
      exit()
print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())
ans = "-1 -1 -1"
for i in range(1,N+1):
  for j in range(1,N+1):
    k = N-i-j
    if i*10000 + j*5000 + k*1000 == Y:
      ans=(i + " " + j + " " + k)
      break
    else:
      continue
print(ans)

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())
ans = "-1 -1 -1"
for i in range(N):
  for j in range(N):
    k = N-i-j
    if i*10000 + j*5000 + k*1000 == Y:
      ans=(i + " " + j + " " + k)
      break
print(ans)

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())
for i in range(N):
  for j in range(N):
    for k in range(N):
      if i*10000 + j*5000 + k*1000 == Y:
        print(i + " " + j + " " + k)
        break
else:
  print("-1 -1 -1")
Problem p03478 (python)

Fixed submission:
n,a,b=map(int,input().split())
cnt = 0
for i in range(1,n+1):
  s= i%10 + i//10%10 + i//100%10 + i//1000%10 + i//10000%10
  if a<=s<=b:
    cnt+=i
print(cnt)

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

Fixed submission:
S=input()
T=input()

s = ''.join(sorted(list(S)))
t = ''.join(sorted(list(T), reverse=True))

if s < t:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S=input()
T=input()

s = ''.join(sorted(list(S))
t = ''.join(sorted(list(T), reverse=True))

if s < t:
  print('Yes')
else:
  print('No')
Problem p03494 (python)

Fixed submission:
input()

A = list(map(int, input().split(" ")))
B = 0

while all(a%2 == 0 for a in A):
  A = [a/2 for a in A]
  B += 1

print(B)

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

while all(i%2 == 0 for i in A):
  A = [i/2 for i in A]
  cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[input() for i in range(N)]
cnt=0

while all(i%2 == 0 for i in A):
  A = [i/2 for i in A]
  cnt+=1
print(cnt)
Problem p03632 (python)

Fixed submission:
A,B,C,D=map(int,input().split())
ans = min(B,D) - max(A,C)
if ans < 0:
  print(0)
else:
  print(ans)

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

if B > C and C < D: # normal
  print(B-C)
elif B > C and B > D:
  print(D-C)
elif:
  print(0)
  
#elif B < C:
#  print(0)
Problem p03636 (python)

Fixed submission:
a = input()
print(a[:1]+str(len(a)-2)+a[-1:])

Buggy submission (verdict: Runtime Error):
a = input()
print([:1]+str(len(a)-2)+[-1:])

Buggy submission (verdict: Runtime Error):
a = input()
print([:1]+(len(a)-2)+[-1:])
Problem p03814 (python)

Fixed submission:
s = input()
head = s.find("A")
tail = s.rfind("Z")
print(tail - head +1)

Buggy submission (verdict: Runtime Error):
s = input()
head = s.fine("A")
tail = s.rfind("Z")
print(tail - head +1)
Problem p03853 (python)

Fixed submission:
H,W=map(int,input().split())
for i in range(H):
  x = input()
  print(x)
  print(x)

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
for i in range(a):
  x = input()
  print(x)
  print(x)
Problem p04044 (python)

Fixed submission:
N,L=map(int,input().split())
S=[input() for i in range(N)]
S.sort()
print(*S,sep="")

Buggy submission (verdict: Runtime Error):
N,L=map(int,input())
S=[input() for i in range(N)]
S.sort()
print(*S,sep="")

Buggy submission (verdict: Runtime Error):
N,L=map(int,input())
S=sorted(list(map(int,input())))
ans = ""
for x in S:
  ans += x
print(ans)
Problem p02678 (python)

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

g=[[] for i in range(N+1)]

for i in range(M):
	a,b=list(map(int,input().split()))
	g[a].append(b)
	g[b].append(a)

from collections import deque

queue = deque([1])
d = [None] * (N+1)
while queue:
	v = queue.popleft()
	for i in g[v]:
		if d[i] is None:
			d[i] = v
			queue.append(i)

print("Yes")
for i in range(2,N+1):
	print(d[i])

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

g=[[] for i in range(M+1)]

for i in range(M):
	a,b=list(map(int,input().split()))
	g[a].append(b)
	g[b].append(a)

from collections import deque

queue = deque([1])
d = [None] * (N+1)
d[1] = 0
while queue:
	v = queue.popleft()
	for i in g[v]:
		if d[i] is None:
			d[i] = v
			queue.append(i)

print("Yes")
for i in range(2,N+1):
	print(d[i])
Problem p02645 (python)

Fixed submission:
s = input()

nm = s[0:3]

print(nm)

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

for i in range(k):
    
    b = [0] * (n+1)
    #print(b)
    for j in range(n):
        l = max(0, j-a[j])
        r = min(j+a[j]+1, n)
        b[l] += 1
        b[r] -= 1
        print(b)
    for j in range(n):
        b[j+1] += b[j]
    b.pop()
    if(a == b):
        break
    a = b
        
ans = " ".join(map(str, a))
print(ans)
Problem p02677 (python)

Fixed submission:
import math

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

# 角度を求める
a_angle = (h/12 + m/(60*12)) *360
b_angle = m/60*360

#print(a_angle)
#print(b_angle)

line = 0

if a_angle > b_angle:
    angle = a_angle - b_angle
elif a_angle < b_angle:
    angle = b_angle - a_angle 
else:
    angle = 0


    
if angle >=180:
    angle = 360-angle

#print(angle)

c2 = pow(a,2) + pow(b,2) - 2 * a * b * math.cos(math.radians(angle))

c = pow(c2, 1/2)
print(c)

Buggy submission (verdict: Runtime Error):
import math

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

# 角度を求める
a_angle = (h/12 + m/(60*12)) *360
b_angle = m/60*360

#print(a_angle)
#print(b_angle)

line = 0

if a_angle > b_angle:
    angle = a_angle - b_angle
elif a_angle < n_angle:
    angle = b_angle - a_angle 
else:
    angle = 0


    
if angle >=180:
    angle = 360-angle

#print(angle)

c2 = pow(a,2) + pow(b,2) - 2 * a * b * math.cos(math.radians(angle))

c = pow(c2, 1/2)
print(c)
Problem p02678 (python)

Fixed submission:
from collections import deque

n,m = map(int, input().split())
dic = {}

AB = [map(int, input().split()) for _ in range(m)]

dic = [[] for _ in range(n + 1)]

for a,b in AB:
    a -= 1
    b -= 1

    dic[a].append(b)
    dic[b].append(a)

#dist = {}
queue = deque([0])
visited = []
pre = [-1] * (n+1)

#dist[0] = 0 
queue.append(0)

while queue:
    v = queue.popleft()
    
    for i in dic[v]:
        if pre[i] == -1:
        #dist[i] = dist[v] + 1
            pre[i]= v
            queue.append(i)

print("Yes")
for i in range(n):
    ans = 0
    
    if(i == 0):
        continue
    
    ans = pre[i]
    ans += 1
    print(ans)

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

n,m = map(int, input().split())
dic = {}

AB = [map(int, input().split()) for _ in range(m)]

dic = [[] for _ in range(n + 1)]

for a,b in AB:
    a -= 1
    b -= 1

    dic[a].append(b)
    dic[b].append(a)

#dist = {}
queue = deque([0])
visited = []
pre = {}

dist[0] = 0 
#queue.append(0)

while queue:
    v = queue.popleft()
    
    for i in dic[v]:
        if i in visited:
            continue
        
        visited.append(i)
        #dist[i] = dist[v] + 1
        pre[i]= v
        queue.append(i)

print("Yes")
for i in range(n):
    ans = 0
    
    if(i == 0):
        continue
    
    ans = pre[i]
    ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
dic = {}

AB = [map(int, input().split()) for _ in range(m)]

links = [[] for _ in range(N + 1)]

for a,b in AB:
    a -= 1
    b -= 1

    links[a].append(b)
    links[b].append(a)

dist = {}
queue = []
visited = []
pre = {}

dist[0] = 0 
queue.append(0)

while len(queue) > 0:
    v = queue.pop(0)
    
    for i in dic[v]:
        if i in visited:
            continue
        
        visited.append(i)
        dist[i] = dist[v] + 1
        pre[i]= v
        queue.append(i)


print("Yes")
for i in range(n):
    ans = 0
    
    if(i == 0):
        continue
    
    ans = pre[i]
    ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
dic = {}
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    
    if a in dic.keys():
        tmp = dic[a]
        tmp.append(b)
        dic[a] = tmp
    else:
        tmp = [b]
        dic[a] = tmp
    
    if b in dic:
        tmp = dic[b]
        tmp.append(a)
        dic[b] = tmp
    else:
        tmp = [a]
        dic[b] = tmp

dist = {}
queue = []
visited = []
pre = {}

dist[0] = 0 
queue.append(0)

while len(queue) > 0:
    v = queue.pop(0)
    
    for i in dic[v]:
        if i in visited:
            continue
        
        visited.append(i)
        dist[i] = dist[v] + 1
        pre[i]= v
        queue.append(i)


print("Yes")
for i in range(m):
    ans = 0
    
    if(i == 0):
        continue
    
    ans = pre[i]
    ans += 1
    print(ans)
Problem p02706 (python)

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

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

days = 0

for i in range(m):
    days += a[i]

remaining = n-days

if remaining < 0:
    print(-1)
else:
    print(remaining)

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

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

days = 0

for i in range(m):
    days += a[i]

remaining = n-days

if remaining < 0:
    print(-1)
else:
    print(remainig)
Problem p03493 (python)

Fixed submission:
str = input()
 
count = 0
if str[0] == "1":
  count+=1
if str[1] == "1":
  count+=1
if str[2] == "1":
  count+=1
 
print(count)

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

count = 0
flag = True

while(flag):
    tmp_a = []
    for i in a:
        if i % 2 !=0:
            flag = False
            break
        tmp_a.append(i/2)
    a = tmp_a
    if flag == True:
        count += 1

print(count)

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

count = 0
if str[0] == "1":
  count+=1
if str[1] == "1":
  count+=1
if str[2] == "1":
  count+=1

printt(count)
Problem p02641 (python)

Fixed submission:
x, n =map(int, input().split())  #複数数値入力
list_p = list(map(int, input().split()))  #リスト入力


if n == 0:
    print(x)
else:
    i = 0
    while True:
        if x - i not in list_p:
            print(x-i)
            break
        elif x + i not in list_p:
            print(x+i)
            break
        else:
            i += 1

Buggy submission (verdict: Runtime Error):

import copy
n = int(input())
list_a = list(map(int, input().split()))  #リスト入力

list_a = list(set(list_a))
list_a.sort(reverse=True)
# print(list_a)

count = 0
if len(list_a) == 1:
    print(0)
else:
    for i in range(len(list_a)):
        ai = list_a[i] 
        new_list = list_a[i+1:]  #  全くの別物としてコピー
#         print(new_list)
        data2 = []
        booler = True
        for j in range(len(new_list)):
            aj = new_list[-j]
#             print(ai, aj, ai%aj)
            if ai % aj == 0:

                booler = False
                break
        if booler == True:
            count += 1


    print(count)
Problem p02641 (python)

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

x,n=map(int,input().split())
p=list(map(int,input().split()))

# num=[i for i in range(1,101)]
# for i in p:
#     num[i-1]=-1

# num.append(0)
# num.append(101)
# num.sort()
# while True:
#     if num[0]!=-1:
#         break
#     num.pop(0)
# print(num)

# min=1000
# for i in num:
#     if min>abs(x-i):
#         min=abs(x-i)
#         ans=i
# print(ans)

i=0
while True:
    if not x-i in p :
        print(x-i)
        break
    elif not x+i in p:
        print(x+i)
        break
    i+=1

# num=[]
# for i in range(101):
#     num.append(x-i)
#     num.append(x+i)

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

x,n=map(int,input().split())
p=list(map(int,input().split()))

num=[i for i in range(1,101)]
for i in p:
    num[i-1]=0

num.append(-1)
num.sort()
while True:
    if num[1]!=0:
        break
    num.pop(1)
# print(num)

min=1000
for i in num:
    if min>abs(x-i):
        min=abs(x-i)
        ans=i
print(ans)

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

x,n=map(int,input().split())
p=list(map(int,input().split()))

num=[i for i in range(1,101)]
for i in p:
    num[i-1]=0

num.sort()
while True:
    if num[0]!=0:
        break
    num.pop(0)
# print(num)

min=1000
for i in num:
    if min>abs(x-i):
        min=abs(x-i)
        ans=i
print(ans)

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

x,n=map(int,input().split())
p=list(map(int,input().split()))

num=[i for i in range(1,101)]
for i in p:
    num[i-1]=0

num.sort()
# print(num)
min=1000
for i in num:
    if min>abs(x-i):
        min=abs(x-i)
        ans=i
print(ans)import sys
input = sys.stdin.readline

x,n=map(int,input().split())
p=list(map(int,input().split()))

num=[i for i in range(1,101)]
for i in p:
    num[i-1]=0

num.sort()
# print(num)
min=1000
for i in num:
    if min>abs(x-i):
        min=abs(x-i)
        ans=i
print(ans)
Problem p02742 (python)

Fixed submission:
h,w=map(int,input().split())
if h==1 or w==1:
  print(1)
elif h%2==0 or w%2==0:
  print(h*w//2)
else:
  print((h*w+1)//2)

Buggy submission (verdict: Runtime Error):
1000000000 1000000000
Problem p02755 (python)

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

a,b=map(int,input().split())
ans=-1
for i in range(1,1001):
  if i*0.08//1 == a and i*0.1//1 == b:
    ans=i
    break
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
A=[]
B=[]
for i in range(9):
  A.append(a+i/10)
  B.append(b+i/10)
for i in range(len(A)):
  A[i]=A[i]/0.08
  B[i]=B[i]/0.1
ans=[]
for i in range(len(A)):
  for j in range(len(A)):
    if math.isclose(A[i],B[j]):
      ans.append(A[i])
      break
if ans==[]:
  print(-1)
else:
  print(int(ans[0]))
Problem p02923 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N=int(input())
H=list(map(int,input().split()))
counts=[]
count=0
for i in range(N-1):
  if H[i] >= H[i+1]:
    count+=1
    if i==N-2:
      counts.append(count)
  elif H[i] < H[i+1]:
    counts.append(count)
    count=0
counts.sort()
if N==1:
  print(0)
else:
  print(counts[-1])

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N=int(input())
H=list(map(int,input().split()))
counts=[]
count=0
for i in range(N-1):
  if H[i] >= H[i+1]:
    count+=1
    if i==N-2:
      counts.append(count)
  elif H[i] < H[i+1]:
    counts.append(count)
    count=0
counts.sort()
print(counts[-1])
Problem p02995 (python)

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())
l=c*d//fractions.gcd(c,d)
B=b//c+b//d-b//l
A=(a-1)//c+(a-1)//d-(a-1)//l
print((b-B)-(a-1-A))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
l=c*d//math.gcd(c,d)
B=b//c+b//d-b//l
A=(a-1)//c+(a-1)//d-(a-1)//l
print((b-B)-(a-1-A))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
l=c*d//math.gcd(c,d)
B=b//c+b//d-b//l
A=(a-1)//c+(a-1)//d-(a-1)//l
print((b-B)-(a-1-A))
Problem p03212 (python)

Fixed submission:
N = int(input())

def dfs(s):
    if int(s) > N:
        return 0
    #sが7,5,3をそれぞれ一つ以上含んでいる場合、+1、 else 0
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0
    #sに7,5,3のいずれかを付け足す
    for c in '753':
        ret += dfs(s + c)
    return ret

print(dfs('0'))

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

def dfs(s):
    if int(s) > N:
        return 0
    #sが7,5,3をそれぞれ一つ以上含んでいる場合、+1、 else 0
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0
    #sに7,5,3のいずれかを付け足す
    for c in '753':
        ret += dfs(s + c)
    return ret

print(dfs(''))
Problem p02713 (python)

Fixed submission:
import math

n=int(input())
 
def diffs(n):
  total=0
  for k in range(1,n):
    for l in range(k+1,n):
      total+=math.gcd(n,math.gcd(k,l))*6
  for k in range(1,n):
    total+=math.gcd(n,k)*6
  total += n
  return total

sum=0
for i in range(1,n+1):
  sum += diffs(i)

print(sum)

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

total=0
for nn in range(1,n+1):
  for k in range(1,n+1):
    for l in range(1,n+1):
      total+=math.gcd(nn,math.gcd(k,l))

print(total)
Problem p02761 (python)

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

ans = [0]*n
ans[0] = 1

misnot = 0

if m == 0:
  misnot=1

s = [0]*m
c = [0]*m
for i in range(m):
  s[i],c[i] = map(int,input().split())

flag = 0
if misnot == 0:
  if n == 1:
    for i in range(m-1):
      if c[0]!=c[i+1]:
        flag=-1
        break
    if flag == 0:
      print(c[0])
    else: 
      print(-1)

  if n == 2:
    for i in range(m):
      ans[s[i]-1]=c[i]
    for i in range(m):
      if ans[s[i]-1]!=c[i]:
        flag=-1
        break
    if ans[0] == 0:
      print(-1)
    elif flag == 0:
      print(ans[0]*10+ans[1])
    else: 
      print(-1)

  if n == 3:
    for i in range(m):
      ans[s[i]-1]=c[i]
    for i in range(m):
      if ans[s[i]-1]!=c[i]:
        flag=-1
        break
    if ans[0]==0:
      print(-1)
    elif flag == 0:
      print(ans[0]*100+ans[1]*10+ans[2])
    else: 
      print(-1)
else:
  if n == 1:
    print(0)
  elif n == 2:
    print(10)
  elif n == 3:
    print(100)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
s = [0]*m
c = [0]*m
for i in range(m):
  s[i],c[i] = map(int,input().split())
ans = [0]*n
ans[0] = 1

flag = 0

if n == 1:
  for i in range(m-1):
    if c[0]!=c[i+1]:
      flag=-1
      break
  if flag == 0:
    print(c[0])
  else: 
    print(-1)
      
if n == 2:
  for i in range(m):
    ans[s[i]-1]=c[i]
  for i in range(m):
    if ans[s[i]-1]!=c[i]:
      flag=-1
      break
  if ans[0] == 0:
    print(-1)
  elif flag == 0:
    print(ans[0]*10+ans[1])
  else: 
    print(-1)

if n == 3:
  for i in range(m):
    ans[s[i]-1]=c[i]
  for i in range(m):
    if ans[s[i]-1]!=c[i]:
      flag=-1
      break
  if ans[0]==0:
    print(-1)
  elif flag == 0:
    print(ans[0]*100+ans[1]*10+ans[2])
  else: 
    print(-1)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
s = [0]*m
c = [0]*m
for i in range(m):
  s[i],c[i] = map(int,input().split())
ans = [0]*n

flag = 0

if n == 1:
  for i in range(m-1):
    if c[0]!=c[i+1]:
      flag=-1
      break
  if flag == 0:
    print(c[0])
  else: print(-1)
      
if n == 2:
  for i in range(m):
    ans[s[i]-1]=c[i]
  for i in range(m):
    if ans[s[i]-1]!=c[i]:
      flag=-1
      break
  if ans[0] == 0:
    print(-1)
  elif flag == 0:
    print(ans[0]*10+ans[1])
  else: print(-1)

if n == 3:
  for i in range(m):
    ans[s[i]-1]=c[i]
  for i in range(m):
    if ans[s[i]-1]!=c[i]:
      flag=-1
      break
  if ans[0]==0:
    print(-1)
  elif flag == 0:
    print(ans[0]*100+ans[1]*10+ans[2])
  else: print(-1)
Problem p02811 (python)

Fixed submission:
K, X = input().split()
K = int(K)
X = int(X)
print("Yes" if K * 500 >= X else "No")

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

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

first_a = a
a -= k if k < a else a
k -= first_a if a == 0 else 0
b -= 0 if a != 0 else k
b = 0 if b < 0 else b

print(a, end=" ")
print(b)

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

first_a = a
a -= k if k < a else a
k -= first_a if a == 0 else 0
b -= k

print(a + " " + b)

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

first_a = a
a -= k if k < a else a
k -= first_a if a == 0 else 0
b -= k

print(f"{a} {b}")

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

first_a = a
a -= k if k < a else a
k -= first_a if a == 0 else 0
b -= k

print(f"{a} {b}")
Problem p02630 (python)

Fixed submission:

n=int(input())
arr=list(map(int,input().split()))
sumv=0
d={}
for i in arr:
    sumv+=i
    try:
        d[i]+=1
    except:
        d[i]=1

q=int(input())

while q:
    
    b,c=map(int,input().split())
    if b in d:
        sumv+=(c-b)*d[b]
   
        try:
            d[c]+=d[b]
        except:
            d[c]=d[b]
    d[b]=0
    print(sumv)


    q-=1

Buggy submission (verdict: Runtime Error):

n=int(input())
arr=list(map(int,input().split()))
sumv=0
d={}
for i in arr:
    sumv+=i
    try:
        d[i]+=1
    except:
        d[i]=1

q=int(input())

while q:
    
    b,c=map(int,input().split())
    sumv+=(c-b)*d[b]
    try:
        d[c]+=d[b]
    except:
        d[c]=d[b]
    d[b]=0
    print(sumv)


    q-=1