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

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

a = [[0] * m for j in range(n)]
c = [0] * n

ans = 10**10

for i in range(n):
    arr = list(map(int, input().split()))
    c[i] = arr[0]
    a[i] = arr[1:]

# bit全探索
import itertools
for bit in itertools.product([0,1], repeat=n):
    arr = [0] * m
    cost = 0
    for i in range(n):
        if bit[i] == 1:
            for k in range(len(a[i])):
                arr[k] += a[i][k]
            cost += c[i]

    NG = False
    for i in range(len(arr)):
        if arr[i] < x:
            NG = True
            
    if NG:
        pass
    else:
        ans = min(ans,cost)

if ans != 10**10:
    print(ans)
else:
    print(-1)

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

a = [[0] * m for j in range(n)]
c = [0] * n

ans = 10**10

for i in range(n):
    arr = list(map(int, input().split()))
    c[i] = arr[0]
    a[i] = arr[1:]

# bit全探索
import itertools
for bit in itertools.product([0,1], repeat=10):
    arr = [0] * m
    cost = 0
    for i in range(n):
        if bit[i] == 1:
            for k in range(len(a[i])):
                arr[k] += a[i][k]
            cost += c[i]

    NG = False
    for i in range(len(arr)):
        if arr[i] < x:
            NG = True
            
    if NG:
        pass
    else:
        ans = min(ans,cost)

if ans != 10**10:
    print(ans)
else:
    print(-1)
Problem p02727 (python)

Fixed submission:
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
p.reverse()
q = list(map(int, input().split()))
q.sort()
q.reverse()
r = list(map(int, input().split()))
r.sort()
r.reverse()

p = p[:x]
q = q[:y]


arr = p + q
arr.sort()
#print(arr)
#print(r)

for i in range(min(len(arr),len(r))):
    if arr[i] <= r[i]:
        arr[i] = r[i]

print(sum(arr))

Buggy submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
p.reverse()
q = list(map(int, input().split()))
q.sort()
q.reverse()
r = list(map(int, input().split()))
r.sort()
r.reverse()

p = p[:x]
q = q[:y]


arr = p + q
arr.sort()
#print(arr)
#print(r)

for i in range(len(r)):
    if arr[i] <= r[i]:
        arr[i] = r[i]

print(sum(arr))
Problem p02731 (python)

Fixed submission:
l = int(input())
       
print((l/3) ** 3)

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

arr = []
for a in range(1,l):
    for b in range(1,l):
        c = l - a - b
        if a + b + c == l:
            arr.append(a*b*c)

print(max(arr))
Problem p02732 (python)

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

nums = [0] * (max(a) + 1)
for i in range(len(a)):
    nums[a[i]] += 1

from scipy.special import comb

all = 0
for i in range(len(nums)):
    all += comb(nums[i], 2, exact=True)

for k in range(n):
    print(all - (nums[a[k]] - 1))

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

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

from scipy.misc import comb

c = [0]*(n+1)
for i in range(n+1):
    c[i] = int(comb(arr[i],2))

d = [0]*(n+1)
for i in range(n+1):
    d[i] = int(comb(arr[i]-1,2))


for k in range(n):
    ans = sum(c[:a[k]]) + sum(c[a[k]+1:]) + d[a[k]]
    print(ans)

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

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

from scipy.special import comb
base = comb(5, 3, exact=True)

c = [0]*(n+1)
for i in range(n+1):
    c[i] = int(comb(arr[i],2))

d = [0]*(n+1)
for i in range(n+1):
    d[i] = int(comb(arr[i]-1,2))


for k in range(n):
    ans = sum(c[:a[k]]) + sum(c[a[k]+1:]) + d[a[k]]
    print(ans)
Problem p02761 (python)

Fixed submission:
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 = False

if n == 1:
    x = list(str(0))
    flag = True
    for i in range(m):
        if int(x[s[i]-1]) == c[i]:
            pass
        else:
            flag = False

    if flag:
        print(int(''.join(x)))
        ans = True
        
for x in range(10 ** (n - 1), 10 ** n):
    x = list(str(x))
    flag = True
    for i in range(m):
        if int(x[s[i]-1]) == c[i]:
            pass
        else:
            flag = False

    if flag and ans == False:
        print(int(''.join(x)))
        ans = True
        break


    
if ans == False:
    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 = False
for x in range(10 ** (n - 1), 10 ** n):
    x = list(str(x))
    flag = True
    for i in range(m):
        if int(x[s[i]-1]) == c[i]:
            pass
        else:
            flag = False

    if flag:
        print(int(''.join(x)))
        ans = True
        break

if n == 1:
    x = list(str(0))
    flag = True
    for i in range(m):
        if int(x[s[i]-1]) == c[i]:
            pass
        else:
            flag = False

    if flag:
        print(int(''.join(x)))
        ans = True
        break
    
if ans == False:
    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 = False
for x in range(10 ** (n - 1), 10 ** n):
    x = list(str(x))
    flag = True
    for i in range(m):
        if int(x[s[i]-1]) == c[i]:
            pass
        else:
            flag = False

    if flag:
        print(int(''.join(x)))
        ans = True
        break

if n == 1:
    x = list(str(0))
        flag = True
    for i in range(m):
        if int(x[s[i]-1]) == c[i]:
            pass
        else:
            flag = False

    if flag:
        print(int(''.join(x)))
        ans = True
        break
    
if ans == False:
    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 = False
for x in range(10 ** (n - 1), 10 ** n):
    x = list(str(x))
    flag = True
    for i in range(m):
        if int(x[s[i]-1]) == c[i]:
            pass
        else:
            flag = False

    if flag:
        print(int(''.join(x)))
        ans = True
        break

if n = 1:
    x = list(str(0))
        flag = True
    for i in range(m):
        if int(x[s[i]-1]) == c[i]:
            pass
        else:
            flag = False

    if flag:
        print(int(''.join(x)))
        ans = True
        break
    
if ans == False:
    print(-1)
Problem p02784 (python)

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

if sum(a) >= h:
    print('Yes')
else:
    print('No')

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

if sum(a) >= h:
    print('Yes')
else:
    print('No')

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

if sum(a) >= h:
    print('Yes')
else:
    print('No')
Problem p02909 (python)

Fixed submission:
s = str(input())
if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')

Buggy submission (verdict: Runtime Error):
s = str(input())
if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy'):
    print('Rainy')
else:
    print('Sunny')
Problem p02993 (python)

Fixed submission:
s = list(str(input()))

if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print('Bad')
else:
    print('Good')

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

if s[0] == s[1] or a[1] == s[2] or s[2] == s[3]:
    print('Bad')
else:
    print('Good')

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

if s[0] == s[1] and a[1] == s[2] and s[2] == s[3]:
    print('Bad')
else:
    print('Good')
Problem p02995 (python)

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


x = b // c
y = b // d


import fractions
e = int(c * d / fractions.gcd(c,d))


z = b // e

x2 = (a-1) // c
y2 = (a-1) // d


e2 = int(c * d / fractions.gcd(c,d))


z2 = (a-1) // e2


print((b - (x + y - z)) - (a - 1 - (x2 + y2 - z2)))

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


x = ((b+1) // c) - ((a+1) // c)
y = ((b+1) // d) - ((a+1) // d)


import math
e = int(c * d / math.gcd(c,d))


z = ((b+1) // e) - ((a+1) // e)


print((b-a) - (x+y-z) + 1)
Problem p03087 (python)

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


t = [0] * (n+1)
for i in range(n):
    if s[i:i+2] == 'AC':
        t[i+1] = t[i] + 1
    else:
        t[i+1] = t[i]

        
for i in range(q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

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


t = [0] * (n+1)
for i in range(n):
    if s[i] == 'A' and s[i+1] == 'C':
        t[i+1] = t[i] + 1
    else:
        t[i+1] = t[i]
        

for i in range(q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

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


t = [0] * (n+1)
for i in range(n):
    if s[i] == 'A' and s[i+1] == 'C':
        t[i+1] = t[i] + 1
    else:
        t[i+1] = t[i]
        

for i in range(q):
    l, r = map(int,input().split())
    print(t[r-1] - t[l-1])
Problem p03145 (python)

Fixed submission:
arr = list(map(int,input().split()))
print(int(arr[0]*arr[1]*0.5))

Buggy submission (verdict: Runtime Error):
arr = list(map(int,input()))
print(int(arr[0]*arr[1]*0.5))
Problem p03240 (python)

Fixed submission:
n = int(input())

x = [0] * n
y = [0] * n
h = [0] * n

for i in range(n):
    x[i], y[i], h[i] = map(int, input().split())

for cx in range(101):
    for cy in range(101):
        H = -1
        for i in range(n):
            if h[i] == 0:
                pass
            else:
                tmp = h[i] + abs(x[i]-cx) + abs(y[i]-cy)
                H = tmp
                break
        flag = True
        for i in range(n):
            if h[i] != max(H-abs(x[i]-cx)-abs(y[i]-cy),0):
                flag = False
                break
        if flag:
            print(cx,cy,H)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
    x[i], y[i], h[i] = map(int, input().split())

ans = []
for X in range(101):
    for Y in range(101):
        flag = True
        height = []
        for i in range(n):
            height.append(h[i]+abs(x[i]-X)+abs(y[i]-Y))
        for i in range(n):
            if height[i] != height[0]:
                flag = False

        if flag:
            ans.append(X)
            ans.append(Y)
            ans.append(height[0])
            break

print(ans[0], ans[1], ans[2])

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
    x[i], y[i], h[i] = map(int, input().split())

ans = []
for X in range(101):
    for Y in range(101):
        flag = True
        height = []
        for i in range(n):
            height.append(max(h[i]+abs(x[i]-X)+abs(y[i]-Y),0))
        for i in range(n):
            if height[i] != height[0]:
                flag = False

        if flag:
            ans.append(X)
            ans.append(Y)
            ans.append(height[0])
            break

print(ans[0], ans[1], ans[2])

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
    x[i], y[i], h[i] = map(int, input().split())

ans = []
for X in range(101):
    for Y in range(101):
        flag = True
        height = []
        for i in range(n):
            height.append(h[i]+abs(x[i]-X)+abs(y[i]-Y))
        for i in range(len(height)):
            if height[i] != height[0]:
                flag = False

        if flag:
            ans.append(X)
            ans.append(Y)
            ans.append(height[0])
            break

print(ans[0], ans[1], ans[2])
Problem p03260 (python)

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

flag = False
for c in range(1,4):
    if a*b*c % 2 == 1:
        flag = True

if flag:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
k = int(input())
if k % 2 == 0:
    print((k//2) * (k//2))
else:
    print((k//2) * (k//2+1))
Problem p03309 (python)

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

arr = []
for i in range(n):
    arr.append(a[i] - (i+1))

arr.sort()

ans = []

s = 0
b = arr[n//2]
for i in range(n):
    s += abs(a[i] - (b + (i+1)))
ans.append(s)

if n == 1:
    print(ans[0])
    exit()
    
s = 0
b = arr[n//2 + 1]
for i in range(n):
    s += abs(a[i] - (b + (i+1)))
ans.append(s)

print(min(ans))

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

arr = []
for i in range(n):
    arr.append(a[i] - (i+1))

arr.sort()

ans = []

s = 0
b = arr[n//2]
for i in range(n):
    s += abs(a[i] - (b + (i+1)))
ans.append(s)

s = 0
b = arr[n//2 + 1]
for i in range(n):
    s += abs(a[i] - (b + (i+1)))
ans.append(s)

print(min(ans))
Problem p03377 (python)

Fixed submission:
arr = input().split()
arr = list(map(int, arr))
a = arr[0]
b = arr[1]
x = arr[2]

if a <= x and x <= a+b:
    print('YES')
else:
    print('NO')

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

if a <= x and x <= a+b:
    print('YES')
else:
    print('NO')
Problem p03386 (python)

Fixed submission:
a,b,k = (int(i) for i in input().split())
x = set()
y = []
for i in range(a,min(b+1,a+k)):
    x.add(i)
for i in range(b,max(a-1,b-k),-1):
    x.add(i)
for i in x:
    y.append(i)
y.sort()
for ans in y:
    print(ans)

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
     
ans=[]
     
for i in range(k):
    if a <= a+i <= b:
        ans.append(a+i)
    if a <= b-i <= b:    
        ans.append(b-i)
     
ans.sort(list(set(ans)))
     
for x in ans:
    print(x)

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

arr = []

x = list(range(a,b+1))

for i in range(k):
    arr.append(x[i])

for i in range(k):
    arr.append(x[-1-i])

arr = list(set(arr))

arr.sort()

for i in range(len(arr)):
    print(arr[i])

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

arr = []

whole = list(range(a,b+1))
arr = whole[:k] + whole[len(whole)-k:]
arr = list(set(arr))
arr.sort()
for i in range(len(arr)):
    print(arr[i])
Problem p03730 (python)

Fixed submission:
arr = input().split()
arr = list(map(int,arr))
a = arr[0]
b = arr[1]
c = arr[2]

flag = False
for k in range(a,b*a+1):
    if (k*a) % b == c:
        flag = True

if flag == True:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
#! -*- coding:utf-8 -*-
a,b,c = map(int,input().split())

if a % 2 == 0 and b % 2 == 0 and c % 2 == 1:
    print('NO')    
elif a % 2 == 1 and b % 2 == 0 and c %2 == 0:
    print('NO')
elif c == 0:
    print('YES')
elif a == 1:
    print('YES')
elif a % 2 == 0 and b % 2 == 1 and c % 2 = 1:
    print('NO')
#elif a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
#    if a % b == 0:
#        if (c/2) % (a/b) == 0:
#            print('YES')
#        else:
#            print('NO')
#    else:
#        print('YES')
else:
    print('YES')

Buggy submission (verdict: Runtime Error):
#! -*- coding:utf-8 -*-
a,b,c = map(int,input().split())

if a % 2 == 0 and b % 2 == 0 and c % 2 == 1:
    print('NO')    
elif a % 2 == 1 and b % 2 == 0 and c %2 == 0:
    print('NO')
elif a == 1:
    print('YES')
elif a % 2 ==0 and b % 2 == 0 and a >= c:
    pritn('NO')
else:
    print('YES')
Problem p03759 (python)

Fixed submission:
#! -*- coding:utf-8 -*-
import math
import sys
a,b,c = map(int,input().split())
x = b - a
y = c - b
if x == y:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
#! -*- coding:utf-8 -*-
import math
import sys
a,b,c = map(int,input().split())
x = b - a
y = c - b
if x/y == 1:
    print('YES')
else:
    print('NO')
Problem p03760 (python)

Fixed submission:
#! -*- coding:utf-8 -*-
O = str(input())
E = str(input())
O = list(O)
E = list(E)
n = 0
arr = []
for i in range(len(O)*2):
    if n % 2 == 0:
        try:
            arr.append(O.pop(0))
        except:
            pass
    else:
        try:
            arr.append(E.pop(0))
        except:
            pass        
    n += 1
try:
    arr.append(O.pop(0))
except:
    pass

for i in range(len(arr)-1):
    print(arr[i],end = '')

print(arr[-1])

Buggy submission (verdict: Runtime Error):
#! -*- coding:utf-8 -*-
O = str(input())
E = str(input())
O = list(O)
E = list(E)
n = 0
arr = []
for i in range(len(O)*2):
    if n % 2 == 0:
        arr.append(O.pop(0))
    else:
        arr.append(E.pop(0))
    n += 1
    
for i in range(len(arr)-1):
    print(arr[i],end = '')
print(arr[-1])
Problem p03777 (python)

Fixed submission:
arr = input().split()
arr = list(map(str,arr))
a = arr[0]
b = arr[1]
if a == 'H' and b == 'H':
    print('H')
elif a == 'D' and b == 'H':
    print('D')
elif a == 'D' and b == 'D':
    print('H')
elif a == 'H' and b == 'D':
    print('D')

Buggy submission (verdict: Runtime Error):
arr = input().split()
arr = list(map(str,arr))
if a == 'H' and b == 'H':
    print('H')
elif a == 'D' and b == 'H':
    print('D')
elif a == 'D' and b == 'D':
    print('H')
elif a == 'H' and b == 'D':
    print('D')
Problem p03826 (python)

Fixed submission:
a,b,c,d = map(int,input().split())
s1 = a*b
s2 = c*d
if s1 >= s2:
    print(s1)
else:
    print(s2)

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

def mark(s, x):
    for i in range(x + x, len(s), x):
        s[i] = False

def sieve(n):
    s = [True] * n
    for x in range(2, int(n**0.5) + 1):
        if s[x]: mark(s, x)
    return [i for i in range(0,n) if s[i] and i > 1]

n = int(input())
p = sieve(n)
arr = [0]*len(p)
n = math.factorial(n)

for i in range(len(p)):
    flag = 1
    k = p[i]
    while flag:
        if n%k == 0:
            k = k*p[i]
            arr[i] += 1
        else:
            flag = 0

x = 1
for i in range(len(arr)):
    if arr[i] != 0:
        x *= (arr[i]+1)
if ( n = 6):
    print(4)
else:
    print(x%(10**9+7))
Problem p03828 (python)

Fixed submission:
n = int(input())

arr = [0] * (n+1)

for i in range(1,n+1):
    x = []
    while i % 2 == 0:
        x.append(2)
        i = i // 2
    f = 3
    while f * f <= i:
        if i % f == 0:
            x.append(f)
            i = i // f
        else:
            f += 2
    if i != 1:
        x.append(i)

    for k in range(len(x)):
        arr[x[k]] += 1

ans = 1
for i in range(len(arr)):
    ans *= (arr[i] + 1)
print(ans % (10**9 + 7))

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

def mark(s, x):
    for i in range(x + x, len(s), x):
        s[i] = False

def sieve(n):
    s = [True] * n
    for x in range(2, int(n**0.5) + 1):
        if s[x]: mark(s, x)
    return [i for i in range(0,n) if s[i] and i > 1]

n = int(input())
p = sieve(n)
arr = [0]*len(p)
n = math.factorial(n)

for i in range(len(p)):
    flag = 1
    k = p[i]
    while flag:
        if n%k == 0:
            k = k*p[i]
            arr[i] += 1
        else:
            flag = 0

x = 1
for i in range(len(arr)):
    if arr[i] != 0:
        x *= (arr[i]+1)
if ( n = 6):
    print(4)
else:
    print(x%(10**9+7))
Problem p02536 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**5)

n,m=map(int,input().split())
g=[[] for i in range(10**5+10)]
for i in range(m):
  a,b=map(lambda x:int(x)-1, input().split())
  g[a].append(b)
  g[b].append(a)
chk=[-1]*n

def dfs(s,cnt):
  for u in g[s]:
    if chk[u]>-1: continue;
    chk[u]=cnt
    dfs(u,cnt)

cnt=0
for i in range(n):
  if chk[i]==-1:
    chk[i]=cnt
    dfs(i,cnt)
    cnt+=1
    
print(max(chk))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**5)

n,m=map(int,input().split())
g=[[] for i in range(10**5+10)]
for i in range(m):
  a,b=map(lambda x:int(x)-1, input().split())
  g[a].append(b)
  g[b].append(a)
chk=[-1]*n

def dfs(s,v,cnt):
  for u in g[s]:
    if u==v: continue;
    chk[u]=cnt
    dfs(u,s,cnt)

cnt=0
for i in range(n):
  if chk[i]==-1:
    chk[i]=cnt
    dfs(i,-1,cnt)
    cnt+=1
    
print(max(chk))
Problem p02639 (python)

Fixed submission:
print(input().split().index('0')+1)

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

if N==0:
  print(X)
  exit(0)
  
p = [int(i) for i in input().split()]

for i in range(X+1):
  for s in [-1,1]:
    a = X + i*s
    if a not in p:
      print(a)
      exit(0)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
A, B = int(input()), int(input())
print(A*B)
Problem p02677 (python)

Fixed submission:
import math

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

# for one minute
A_deg=H*(360/12) + M*(360/12/60)
B_deg=M*(360/60)
deg=abs(A_deg-B_deg)

ans = math.sqrt(
  A**2+
  B**2-
  2*A*B*math.cos(math.radians(deg))
)

print(ans)

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

N,M=map(int,input().split())
G=[[] for _ in range(N+1)]
for i in range(M):
  a,b=map(int,input().split())
  G[a].append(b)
  G[b].append(a)

ans=[0]*(N+1)
d=deque([1])
while d:
  c=d.popleft()
  for g in G[c]:
    if not ans[g]:
      d.append(g)
      ans[g]=c

print('Yes')
for i in range(2, N+1):
  print(ans[i])
Problem p02720 (python)

Fixed submission:
from collections import deque

def main():
  N=int(input())
  for n in range(N):
    x=ans.popleft()
    if x%10!=0:
      ans.append(10*x+(x%10)-1) # x equal y-1
    ans.append(10*x+(x%10)) # x equal y
    if x%10!=9:
      ans.append(10*x+(x%10)+1) # x equal y+1
  print(x)
  
if __name__=='__main__':
  ans=deque([1,2,3,4,5,6,7,8,9])
  main()

Buggy submission (verdict: Runtime Error):
def main():
  N, K, C=map(int, input().split())
  S = input()
  
  S=S[::-1]
  R=set()
  n, k=0, 0
  while k < K:
    if S[n]=='o':
      R.add(N-n)
      k+=1
      n += C
    n+=1
  #print(R)
  
  S=S[::-1]
  n, k=0, 0
  while k < K:
    if S[n]=='o':
      if n+1 in R:
        print(n+1)
      k+=1
      n += C
    n+=1
  #print(L)
  

  
if __name__=='__main__':
  main()
Problem p02732 (python)

Fixed submission:
def main():
  N=int(input())
  A=[int(a) for a in input().split()]
  Acnt, Aprob={}, {}
  for a in A:
    Acnt[a] = Acnt.get(a, 0) + 1
  sumA=0
  for k, a in Acnt.items():
    Aprob[k]=a*(a-1)//2
    sumA+=Aprob[k]
  #Acnt=[A.count(n) for n in range(N+1)]
  #Aprob=[Acnt[n]*(Acnt[n]-1)//2 for n in range(N+1)]
  #sumA=sum(Aprob)

  for a in A:
    ans=(Acnt[a]-1)*(Acnt[a]-2)//2
    print(ans+sumA-Aprob[a])
  
main()

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(a) for a in input().split()]
Acnt=[A.count(n) for n in range(N)]
Aprob=[Acnt[n]*(Acnt[n]-1)//2 for n in range(N)]
sumA=sum(Aprob)  

for a in A:
  """
  ai=[]
  ai=A[:n]+A[n+1:]
  #print(ai)
  Adic[A[n]]-=1
  ans=0
  for i,v in Adic.items():
    ans+=v*(v-1)//2
  """
  ans=(Acnt[a]-1)*(Acnt[a]-2)//2
  print(ans+sumA-Aprob[a])
Problem p02765 (python)

Fixed submission:
N, R = map(int, input().split())
print(R if N>=10 else R+100*(10-N))

Buggy submission (verdict: Runtime Error):
N, R = map(int, input().split())
print(R if N>=10 else R-100*(10-K))
Problem p02789 (python)

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

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
print('Yes' if N==M else 'No)