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

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

# ループする数を求める
loop_num = 2 * 10 ** 5
loop_start_point = -1
point = 1
count_list = [-1] * N

for i in range(K):
    #print("point:", point)
    count_list[point - 1] = i
    nextPoint = Alist[point - 1]

    if count_list[nextPoint - 1] != -1:
        loop_start_point = nextPoint
        loop_num = i - count_list[loop_start_point - 1] + 1
        break
    
    point = nextPoint

if loop_start_point == -1:
    print(point)
else:
    point = loop_start_point
    progress_num = (K - count_list[loop_start_point-1]) % loop_num
    for i in range(progress_num):
        point = Alist[point - 1]
    #print("pro:", progress_num)
    #print("ls:", loop_start_point)
    #print("ln:", loop_num)
    print(point)

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

# ループする数を求める
loop_num = 2 * 10 ** 5
loop_start_point = -1
point = 1
count_list = [-1] * N

for i in range(K):
    #print("point:", point)
    count_list[point - 1] = i
    nextPoint = Alist[point - 1]

    if count_list[nextPoint - 1] != -1:
        loop_start_point = nextPoint
        loop_num = i - count_list[loop_start_point - 1] + 1
        break
    
    point = nextPoint

if loop_start_point == -1:
    #print(point)
else:
    point = loop_start_point
    progress_num = (K - count_list[loop_start_point-1]) % loop_num
    for i in range(progress_num):
        point = Alist[point - 1]
    #print("pro:", progress_num)
    #print("ls:", loop_start_point)
    #print("ln:", loop_num)
    print(point)

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

# ループする数を求める
loop_num = 0
loop_start_index = 0
point = 1
route_list = [1]

for i in range(K):
    point = Alist[point - 1]
    if point in route_list:
        loop_start_index = route_list.index(point)
        loop_num = i + 1 - loop_start_index
        break

    route_list.append(point)

print(route_list[loop_start_index  + ((K-loop_start_index) % loop_num)])
Problem p02741 (python)

Fixed submission:
k = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])

Buggy submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = input()
print(a[k-1])
Problem p02742 (python)

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

if H == 1 or W == 1:
    k = 1
elif H*W % 2 == 1:
    k = int(H / 2) + (int(W / 2)) * H + 1
else:
    k = int(H * W / 2)

print(k)

Buggy submission (verdict: Runtime Error):
H, W = (int(x) for x in input().split())
if H * W % 2 == 0:
    k = H * W / 2
else:
    if H == 1 or W == 1:
        a = list(filter(lambda x: x != 1, [H, W]))
        k = int(a[0] / 2) + 1
    else:
        k = int(H/2) + (int(W/2))*H + 1
print(k)

Buggy submission (verdict: Runtime Error):
H, W = (int(x) for x in input().split())
if H * W % 2 == 0:
    k = H * W / 2
else:
    if H == 1 or W == 1:
        a = map(lambda x: x != 1, [H, W])
        k = int(a / 2) + 1
    else:
        k = int(H/2) + (int(W/2))*H + 1
print(k)
Problem p02761 (python)

Fixed submission:
def main():
    N, M = (int(x) for x in input().split())
    SC = [list(map(int, input().split())) for _ in range(M)]
    for i in range(10 ** N):
        _str = str(i)
        k = True
        if len(_str) == N:
            for j in range(M):
                if _str[SC[j][0]-1] != str(SC[j][1]):
                    k = False
            if k:
                return print(i)
    return print('-1')

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
N, M = (int(x) for x in input().split())
k = {}
j = True
ans = []

for i in range(M):
    a, b = input().split()
    a = int(a)
    ans.append("0")
    if a not in k.keys():
        k[a] = b
    else:
        if k[a] != b:
            j = False
            break

for n in range(N):
    if n + 1 in k.keys():
        ans[n] = k[n + 1]

if j:
    f = int("".join(ans))
    print(f)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N, M = (int(x) for x in input().split())
k = {}
j = True
ans = []

for i in range(M):
    ans.append("0")
    a, b = input().split()
    a = int(a)
    if a not in k.keys():
        k[a] = b
    else:
        if k[a] != b:
            j = False
            break

for n in range(N):
    if n + 1 in k.keys():
        ans[n] = k[n + 1]

if j:
    f = "".join(ans)
    print(int(f))
else:
    print(-1)
Problem p02767 (python)

Fixed submission:
def main():
    N = int(input())
    X = [int(x) for x in input().split()]
    ans = []
    mini = min(X)
    maxi = max(X)
    if mini != maxi:
        for i in range(mini, maxi):
            a = map(lambda x: (x-i)**2, X)
            ans.append(sum(a))
    else:
        ans.append(0)
    return print(min(ans))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    X = [int(x) for x in input().split()]
    ans = []
    for i in range(min(X), max(X)):
        a = map(lambda x: (x-i)**2, X)
        ans.append(sum(a))
    return print(min(ans))


if __name__ == "__main__":
    main()
Problem p02909 (python)

Fixed submission:
S = input()

if S == "Sunny":
    print("Cloudy")
elif S == "Cloudy":
    print("Rainy")
elif S == "Rainy":
    print("Sunny")

Buggy submission (verdict: Runtime Error):
N, K, Q = (int(x) for x in input().split())
A = [int(input()) for i in range(Q)]
ans = [K-Q for i in range(N)]

for a in A:
    ans[a-1] += 1

for b in ans:
    if b > 0:
        print("Yes")
    else:
        print("No")
Problem p02921 (python)

Fixed submission:
def main():
    S = input()
    T = input()
    ans = 0
    for i in range(3):
        if S[i] == T[i]:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    B = [int(x) for x in input().split()]
    A = [0] * N
    A[0] = B[0]
    A[N-1] = B[-1]
    for i in range(1, N-1):
        if B[i - 1] <= B[i]:
            A[i] = B[i - 1]
        else:
            A[i] = B[i]
    print(sum(A))


if __name__ == "__main__":
    main()
Problem p02923 (python)

Fixed submission:
def main():
    N = int(input())
    H = [int(x) for x in input().split()]
    ans = 0
    count = 0

    if N == 2:
        if H[0] >= H[1]:
            ans = 1
    elif N > 2:
        for i in range(1, N):
            j = i + 1
            if H[-i] <= H[-j]:
                count += 1
                if j == N:
                    if ans <= count:
                        ans = count
            else:
                if ans <= count:
                    ans = count
                count = 0
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    H = [int(x) for x in input().split()]
    ans = []
    count = 0
    if N > 2:
        for i in range(1, N):
            j = i + 1
            if H[-i] <= H[-j]:
                count += 1
            else:
                ans.append(count)
                count = 0
    elif N == 2:
        if H[0] >= H[1]:
            ans.append(1)
    elif N == 1:
        ans.append(1)

    print(max(ans))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    H = [int(x) for x in input().split()]
    ans = []
    count = 0
    if N > 1:
        for i in range(1, N):
            if H[-i] <= H[-(i + 1)]:
                count += 1
            else:
                ans.append(count)
                count = 0
    else:
        ans.append(0)

    print(max(ans))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    H = [int(x) for x in input().split()]
    ans = []
    count = 0
    if N > 2:
        for i in range(1, N):
            if H[-i] <= H[-(i + 1)]:
                count += 1
            else:
                ans.append(count)
                count = 0
    else:
        ans.append(0)

    print(max(ans))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    H = [int(x) for x in input().split()]
    ans = []
    count = 0
    for i in range(1, N):
        if H[-i] <= H[-(i + 1)]:
            count += 1
        else:
            ans.append(count)
            count = 0
    print(max(ans))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    H = [int(x) for x in input().split()]
    ans = []
    for i in range(N - 1):
        count = 0
        for k in range(i, N - 1):
            if H[k] >= H[k + 1]:
                count += 1
                if k + 1 == N - 1:
                    ans.append(count)
                    break
            else:
                ans.append(count)
                break
    print(max(ans))


if __name__ == "__main__":
    main()
Problem p02993 (python)

Fixed submission:
def main():
    S = input()
    if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
        print("Bad")
    else:
        print("Good")


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    S = sorted(int(input()))
    if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
        print("Bad")
    else:
        print("Good")


if __name__ == "__main__":
    main()
Problem p02995 (python)

Fixed submission:
from fractions import gcd


def main():
    A, B, C, D = [int(x) for x in input().split()]
    l = (C * D) // gcd(C, D)
    b = B - anti(B, C, D, l)
    a = (A - 1) - anti((A - 1), C, D, l)
    print(int(b - a))


def anti(x, y, z, l):
    return (x // y) + (x // z) - (x // l)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math


def main():
    A, B, C, D = [int(x) for x in input().split()]
    N = B - A + 1
    g = math.gcd(C, D)
    l = (C * D) / g
    b = anti(B, C, D, l)
    a = anti((A-1), C, D, l)
    print(N - (b - a))


def anti(x, y, z, l):
    return int(x / y) + int(x / z) - int(x / l)


if __name__ == "__main__":
    main()
Problem p03076 (python)

Fixed submission:
def main():
    K = [int(input()) for _ in range(5)]
    ans = []
    A = [0]
    for k in K:
        a = k % 10
        if a == 0:
            ans.append(k)
        else:
            ans.append(k + (10 - a))
            A.append(10 - a)
    print(sum(ans) - max(A))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    K = [int(input()) for _ in range(5)]
    ans = []
    A = []
    for k in K:
        a = k % 10
        if a == 0:
            ans.append(k)
        else:
            ans.append(k + (10 - a))
            A.append(a)
    print(sum(ans) - (10 - min(A)))


if __name__ == "__main__":
    main()
Problem p02714 (python)

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

r = S.count('R')
g = S.count('G')
b = S.count('B')
total = r * g * b

k = 0
count = 0
for i in range(N):
    for j in range(N):
        k = 2 * j - i
        if(i>=j or j >=k or i >=k): continue
        if(i==j or j==k or k==i or k<0 or k>=N): continue
        if(S[i] == S[j] or S[j] == S[k] or S[k] == S[i]): continue
        
        count += 1
        
print(total - count)

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

r = S.count('R')
g = S.count('G')
b = S.count('B')
total = r * g * b

k = 0
count = 0
for i in range(N):
    for j in range(N):
        k = 2 * j - i
        if(i>=j or j >=k or i >=k): continue
        if(i==j or j==k or k==i or k<0 or k>=N): continue
        if(S[i] == S[j] or S[j] == S[k] or S[k] == S[i]): continue
        
        count += 1
        
print(total - count)

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

r = S.count('R')
g = S.count('G')
b = S.count('B')
total = r * g * b

k = 0
count = 0
for i in range(N):
    for j in range(N):
        k = 2 * j - i
        if(i>=j or j >=k or i >=k): continue
        if(i==j or j==k or k==i or k<0 or k>=N): continue
        if(S[i] == S[j] or S[j] == S[k] or S[k] == S[i]): continue
        
        count += 1
        
print(total - count)

Buggy submission (verdict: Runtime Error):
N = int(input())
lis = str(input())
a = []
b = []
for pair in itertools.combinations(lis, 3):
    #if(pair[0]!=pair[1] and pair[1]!=pair[2] and pair[2]!=pair[0]):
    a.append(list(pair))
    print(list(pair))

lis_num = range(len(lis))
for i in itertools.combinations(lis_num, 3):
    b.append(list(i))
    print(i)

count = 0
for i in range(len(a)):
    if (a[i][0]!=a[i][1] and a[i][1]!=a[i][2] and a[i][2] != a[i][0] and b[i][0]!=b[i][1] and b[i][1] != b[i][2]):
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
lis = str(input())
a = []
b = []
for pair in itertools.combinations(lis, 3):
    a.append(list(pair))
    print(list(pair))

lis_num = range(len(lis))
for i in itertools.combinations(lis_num, 3):
    b.append(list(i))
    print(i)
    
count = 0
for i in range(len(a)):
    if (a[i][0]!=a[i][1] and a[i][1]!=a[i][2] and a[i][2] != a[i][0] and b[i][0]!=b[i][1] and b[i][1] != b[i][2]):
        count += 1
print(count)
Problem p03448 (python)

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

total=0
count=0

for l in range(A+1):
    for m in range(B+1):
        for n in range(C+1):
            total=500*l + 100*m + 50*n
            if(total==X): count += 1
                
print(count)

Buggy submission (verdict: Runtime Error):
total=0
count=0

for l in range(A+1):
    for m in range(B+1):
        for n in range(C+1):
            total=500*l + 100*m + 50*n
            print(total)
            if(total==X): count += 1
                
print(count)
Problem p03502 (python)

Fixed submission:
def calc_sum_digits(n):
    sumd = 0
    while(int(n) > 0):
        sumd += int(n%10)
        n /= 10
    return sumd

N = int(input())
sumd = calc_sum_digits(N)
if(N%sumd == 0):
     print('Yes')
else:
     print('No')

Buggy submission (verdict: Runtime Error):
def calc_sum_digits(n):
    sumd = 0
    while(n > 1):
        sumd += int(n%10)
        n /= 10
        
    return sumd

N = int(input())
sumd = 0
sumd = calc_sum_digits(N)
if(N%sumd == 0):
     print('yes')
else:
     print('No')

Buggy submission (verdict: Runtime Error):
def calc_sum_digits(n):
    sumd = 0
    while(n > 1):
        sumd += int(n%10)
        n /= 10
        
    return sumd
 

 N = int(input())
sumd = 0
 
sumd = calc_sum_digits(N)
if(N%sumd == 0): print('yes')
else: print('No')

Buggy submission (verdict: Runtime Error):
def calc_sum_digits(n):
    sumd = 0
    while(n > 1):
        sumd += int(n%10)
        n /= 10
        
    return sumd

N = int(input())
sumd = 0

sumd = calc_sum_digits(N)
if(N%sumd == 0): print('yes')
else: print('No')
Problem p02717 (python)

Fixed submission:
x, y, z = map(int, input().split())
a = y
b = x
c = z
a = c
c = y
print(a, b, c)

Buggy submission (verdict: Runtime Error):
lun_luns = [1, 2, 3, 4, 5, 6, 7, 8, 9]
k = int(input())
index = 0
while True:
	if len(lun_luns) >= k:
		break
	num = lun_luns.pop(index)
	lun_luns.insert(index, num)
	mod = num % 10
	n = num * 10
	if mod == 9:
		lun_luns.extend([n+mod-1, n+mod])
	else:
		lun_luns.extend([n+mod-1, n+mod, n+mod+1])
	index += 1
print(lun_luns[k-1])
Problem p03679 (python)

Fixed submission:
x, a, b = map(int, input().split())
e = b - a
r = 'safe'
if e > x:
	r = 'dangerous'
elif e < 1:
	r = 'delicious'
print(r)

Buggy submission (verdict: Runtime Error):
def test():
	mod = 10**9 + 7
	n, m = map(int, input().split())
	if abs(n-m) > 1:
		print(0)
		exit()
	i_n = n
	i_m = m
	np = 1
	mp = 1
	while True:
		np = (np%mod) * (i_n%mod)
		mp = (mp%mod) * (i_m%mod)
		i_n -= 1
		i_m -= 1
		if i_n < 1:
			i_n = 1
		if i_m < 1:
			i_m = 1
		if i_n == 1 and i_m == 1:
			break
	s = 2 if n == m else 1
	r = (mp*np*s) % (10**9 + 7)
	print(r)
test()
Problem p03680 (python)

Fixed submission:
n = int(input())
a_list = []
for i in range(n):
	a_list.append(int(input()))
r = -1
num = 1
count = 0
while True:
	num = a_list[num-1]
	count += 1
	if num == 2:
		r = count
		break
	if count == n:
		break
print(r)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = []
for i in range(n):
	a_list.append(int(input()))
r = -1
num = 1
count = 0
nums = []
while True:
	num = a_list[num-1]
	if num in nums:
		break
	nums.append(num))
	count += 1
	if num == 2:
		r = count
		break
print(r)
Problem p03681 (python)

Fixed submission:
import math

n, m = map(int, input().split())
if abs(n-m) > 1:
	print(0)
	exit()
s = 2 if n == m else 1
np = math.factorial(n)
mp = math.factorial(m)
r = (mp*np*s) % (10**9 + 7)
print(r)

Buggy submission (verdict: Runtime Error):
def test():
	mod = 10**9 + 7
	n, m = map(int, input().split())
	if abs(n-m) > 1:
		print(0)
		exit()
	t_l = max([n, m])
	p_l = 1
	for i in range(t_l):
		if i == t_l-1:
			break
		p = p * (t_l-i)
	p_s = p / t_l
	s = 2 if n == m else 1
	r = (p_l*p_s*s) % (10**9 + 7)
	print(r)
test()
Problem p03759 (python)

Fixed submission:
a, b, c = map(int, input().split())
r = 'YES' if b - a == c - b else 'NO'
print(r)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
r = 'YES' if b - a == c - b else 'N
Problem p03796 (python)

Fixed submission:
n = int(input())
r = 1
for i in range(n):
	r = (r * (i + 1)) % (10**9 + 7)
print(r)

Buggy submission (verdict: Runtime Error):
n = int(input())
r = 1
for i in range(n):
	r = r * (i + 1)
r = r / (10**9 + 7)
print(r)
Problem p03860 (python)

Fixed submission:
s = input().split()[1]
print('A'+s[0]+'C')

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
count = len(list(filter(lambda t: t % x == 0, list(range(a, b + 1)))))
print(count)
Problem p03861 (python)

Fixed submission:
a, b, x = map(int, input().split())
br = b//x
ar = (a-1)//x
print(br-ar)

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
count = len(list(filter(lambda t: t % x == 0, list(range(a, b + 1)))))
print(count)
Problem p03943 (python)

Fixed submission:
nums = sorted(list(map(int, input().split())))
result = 'Yes' if (nums[0] + nums[1] == nums[2]) else 'No'
print(result)

Buggy submission (verdict: Runtime Error):
w, h, n = map(int, input().split())
nums_list=[list(map(int, input().split())) for i in range(n)]
minX = 0
maxX = w
minY = 0
maxY = h
for nums in nums_list:
	x, y, a = map(int, nums)
	if a == 1:
		minX = minX if (minX > x) else x
	elif a == 2:
		maxX = maxX if (maxX < x) else x
	elif a == 3:
		minY = minY if (minY > y) else y
	elif a == 4:
		maxY = maxY if (maxY < y) else y
width = maxX-minX
width = width if (width > 0) else 0
height = maxY-minY
height = height if (height > 0) else 0
v = width*height
print(v)

Buggy submission (verdict: Runtime Error):
w, h, n = map(int, input().split())
nums_list=[list(map(int, input().split())) for i in range(n)]
minX = 0
maxX = w
minY = 0
maxY = h
for nums in nums_list:
	x, y, a = map(int, nums)
	if a == 1:
		minX = minX if (minX > x) else x
	elif a == 2:
		maxX = maxX if (maxX < x) else x
	elif a == 3:
		minY = minY if (minY > y) else y
	elif a == 4:
		maxY = maxY if (maxY < y) else y
width = maxX-minX if (maxX-minX > 0) else 0
height = maxY-minY if (maxY-minY > 0) else 0
v = width*height
print(v)
Problem p03331 (python)

Fixed submission:
n = int(input())
a = 0
b = n
total = []

def digitSum(number):
    sum = 0
    while number > 0:
        sum += number % 10
        number //= 10
    return sum

for i in range(1, n + 1):
    a = i
    b = n - a
    if b < a:
        break
    total.append(digitSum(a) + digitSum(b))
print(min(total))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = 0
b = n
total = []

def digitSum(number):
    sum = 0
    while number > 0:
        sum += number % 10
        number //= 10
    return sum

for i in range(2, n + 1):
    a = i
    b = n - a
    if b < a:
        break
    total.append(digitSum(a) + digitSum(b))
print(min(total))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = 0
b = n
total = []

def digitSum(number):
    sum = 0
    while number > 0:
        sum += number % 10
        number //= 10
    return sum

for i in range(3, n + 1):
    a = i
    b = n - a
    if b < a:
        break
    total.append(digitSum(a) + digitSum(b))
print(min(total))
Problem p03455 (python)

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

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

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

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

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

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

Fixed submission:
import numpy as np
import networkx as nx
g = nx.Graph()

n,m = map(int, input().split())

for _ in range(m):
    a, b = map(int, input().split())
    g.add_edge(a, b)

res = np.array([0] * 2 + [-1] * (n-1))

from collections import deque
q = deque([1])

while q:
    vis = q.popleft() # visit
    #     print(vis)
    cands = list(nx.all_neighbors(g, vis)) # next visit

    if cands:
        for c in cands:
            if res[c] == -1:
                res[c] = vis # mark
                q.append(c) # should append

if (res == -1).sum():
    print('No')
else:
    print('Yes')
    for i in res[2:]:
        print(i)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
import numpy as np
G = np.zeros((n, n))
for _ in range(m):
    a, b = map(int, input().split())
    G[a-1, b-1] = G[b-1, a-1] = 1

res = np.array([0] + [-1] *(n -1))

from collections import deque
q = deque([0])

while q:
    vis = q.popleft() # visit
    #     print(vis)
    cands = np.where(G[vis])[0] # next visit

    for c in cands:
        if res[c] == -1:
            res[c] = vis # mark
            q.append(c) # shoul append

if (res == -1).sum():
    print('No')
else:
    print('Yes')
    for i in res[1:]:
        print(i +1)
Problem p02727 (python)

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

print(sum(sorted(sorted(p)[-x:] + sorted(q)[-y:] + r)[-(x+y):]))

Buggy submission (verdict: Runtime Error):
def merge(left, right):
    merged = []
    l_i, r_i = 0, 0

    # ソート済み配列をマージするため、それぞれ左から見ていくだけで良い
    while l_i < len(left) and r_i < len(right):
        # ここで=をつけることで安定性を保っている
        if left[l_i] <= right[r_i]:
            merged.append(left[l_i])
            l_i += 1
        else:
            merged.append(right[r_i])
            r_i += 1

    # 上のwhile文のどちらかがFalseになった場合終了するため、あまりをextendする
    if l_i < len(left):
        merged.extend(left[l_i:])
    if r_i < len(right):
        merged.extend(right[r_i:])
    return merged


x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

import numpy as np
p = np.sort(p)[-x:]
q = np.sort(q)[-y:]
r = np.sort(r)

pq = np.array(merge(p, q))
f = True
i = 1
while True:
    f = (r[-i:] >= pq[:i]).all()
    if not f:
        break
    else:
        i += 1

i -= 1
if i:
    print(np.r_[r[-i:], pq[i:]].sum())
else:
    print(pq.sum())
Problem p02743 (python)

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

d = c - a - b
if d > 0 and d**2 > 4 * a * b:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
from math import isqrt
if 2 * isqrt(a * b) < c - a - b:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
def int_sqrt2(n):
    def f(prev):
        while True:
            m = (prev + n / prev) / 2
            if m >= prev:
                return prev
            prev = m

    return f(int(sqrt(n) * (1 + 1e-10)))

if 2 * int_sqrt2(a * b) < c - a - b:
    print('Yes')
else:
    print('No')