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

Fixed submission:
# coding: utf-8
A, B, K = map(int, input().split())
for i in range(K):
    if i%2 ==0 :
        if A%2 != 0:
            A-=1
        B+=A//2
        A=A//2
    else:
        if B%2 !=0:
            B-=1
        A+=B//2
        B=B//2
print(A, B)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
for i in range(K):
    if i%2 ==0 :
        if A%2 != 0;
            A-=1
        B+=A//2
        A=A//2
    else:
        if B%2 !=0 ;
            B-=1
        A+=B//2
        B=B//2
print(A, B)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
for i in range(K):
    if i%2!=0:
        if A%2!=0;
            A-=1
        B+=A//2
        A=A//2
    else:
        if B%2!=0;
            B-=1
        A+=B//2
        B=B//2
print(A, B)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
for i in range(K):
    if i%2==0:
        if A%2!=0;
            A-=1
        B+=A//2
    else:
        if B%2!=0;
            B-=1
        A+=B//2
print(A, B)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
for i in range(K):
    if i%2!=0:
        if A%2!=0;
            A-=1
        B+=A//2
    else:
        if B%2!=0;
            B-=1
        A+=B//2
print(A, B)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
for _ in range(K):
    if K%2!=0:
        if A%2!=0;
            A-=1
        B+=A//2
    else:
        if B%2!=0;
            B-=1
        A+=B//2
print(A, B)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
If K%2!=0:
    if A%2!=0;
        A-=1
    B+=A//2
else:
    if B%2!=0;
        B-=1
    A+=B//2
print(A, B)
Problem p03244 (python)

Fixed submission:
from collections import Counter, OrderedDict


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


if len(set(lst_v)) == 1:
    ans = n // 2
else:
    lst_odd = [lst_v[i] for i in range(n) if i%2==0]
    lst_even = [lst_v[i] for i in range(n) if i%2!=0]
    cnt_odd = sorted(Counter(lst_odd).items(), key=lambda x: -x[1])
    cnt_even = sorted(Counter(lst_even).items(), key=lambda x :-x[1])

    if cnt_odd[0][0] == cnt_even[0][0]:
        rem_number = max(cnt_odd[0][1] + cnt_even[1][1], cnt_odd[1][1] + cnt_even[0][1])
    else:
        rem_number = cnt_odd[0][1] + cnt_even[0][1]
    sum_odd = sum(t[1] for t in cnt_odd)
    sum_even = sum(t[1] for t in cnt_even)
    ans = sum_odd + sum_even - rem_number


print(ans)

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


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


if len(set(lst_v)) == 1:
    ans = n // 2
else:
    lst_odd = lst_v[::2]
    lst_even = lst_v[1::2]
    cnt_odd = sorted(Counter(lst_odd).items(), key=lambda x: -x[1])
    cnt_even = sorted(Counter(lst_even).items(), key=lambda x :-x[1])
    o1 = cnt_odd[0]
    e1 = cnt_even[0]
    o2 = cnt_odd[1] if cnt_odd[1] else (0, 0)
    e2 = cnt_even[1] if cnt_even[1] else (0, 0)

    if o1[0] == e1[0]:
        rem_number = max(o1[1] + e2[1], o2[1] + e1[1])
    else:
        rem_number = o1[1] + e1[1]
    sum_odd = sum(t[1] for t in cnt_odd)
    sum_even = sum(t[1] for t in cnt_even)
    ans = sum_odd + sum_even - rem_number


print(ans)
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())


for i in range(len(S)):
    if S[i] != "1":
        break


ans = "1" if K-1 < i else S[i]
print(ans)

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


ans = 1
for i in range(len(S)):
    if S[i] != "1":
      ans = S[i]
        break

print(ans)
Problem p03316 (python)

Fixed submission:
# coding: utf-8
N= input()
S = sum(map(int, N))
print("Yes" if int(N)%S==0 else "No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import sys
input = sys.stdin.readline

N= input()
S = sum(map(int, N))
print("Yes" if int(N)%S==0 else "No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import sys
input = sys.stdin.readline

N = input()
S = sum(map(int, N))
print(["No", "Yes"][int(N)%S==0])

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import sys
input = sys.stdin.readline

N = input()
S = sum(map(int, N))
print("Yes" if int(N)%S==0 else "No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import sys
input = sys.stdin.readline

N = input()
S = sum([int(x) for x in N])
print("Yes" if int(N)%S==0 else "No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import sys
input = sys.stdin.readline

N = input()
S = sum(int(x) for x in N)
N = int(N)
print("Yes" if N%S==0 else "No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import sys
input = sys.stdin.readline

N = input()
S = sum(int(x) for x in N)
print("Yes" if int(N)%S==0 else "No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import sys
input = sys.stdin.readline

N = input()
S = sum(int(x) for x in N)
print("Yes" if int(N)%S==0 else "No")
Problem p03339 (python)

Fixed submission:
# 写経

n = int(input())
s = input()


cnt = s[1:].count("E")
ans = cnt
for i in range(1, n):
    if s[i-1] == "W":
        cnt += 1
    if s[i] == "E":
        cnt -= 1
    ans = min(ans, cnt)


print(ans)

Buggy submission (verdict: Runtime Error):
# 写経

n = int(input())
s = input()


cnt = s[1:].count("E")
ans = cnt
for i in range(1, n):
    if s[i-1] == "W":
        cnt_e += 1
    if s[i] == "E":
        cnt_e -= 1
    ans = min(ans, cnt)


print(ans)
Problem p03477 (python)

Fixed submission:
#coding: utf-8
A, B, C, D = map(int, input().split())
print("Balanced" if A+B == C+D else ["Left","Right"][A+B < C+D])

Buggy submission (verdict: Runtime Error):

A, B, C, D = map(int, input().split())
print("Balanced" if A+B == C+D else "Left" if
Problem p03544 (python)

Fixed submission:
# coding: utf-8
N = int(input())
L0 = 2
L1 = 1

if N == 1:
    print(L1)
else:
    for _ in range(N-1):
        L = L0 + L1
        L0 = L1
        L1 = L
    print(L)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
N = int(input())
L0 = 2
L1 = 1
for _ in range(N-1):
    L = L0 + L1
    L0 = L1
    L1 = L
print(L)
Problem p03607 (python)

Fixed submission:
from collections import Counter


N = int(input())
lst_number = [int(input()) for _ in range(N)]
set_number = set(lst_number)
cnt_number = Counter(lst_number)
ans = 0


for key in set_number:
    if cnt_number[key] % 2 == 1:
        ans += 1


print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst_a = [int(input()) for _ in range(N)]
lst_ans = [0] * (10**5 + 2)
lst_a.sort()


for a in lst_a:
    lst_ans[a] += 1
ans = sum(1 for i in lst_ans if i % 2 != 0)


print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst_a = [int(input()) for _ in range(N)]
lst_ans = [0] * (10**5 + 2)
lst_a.sort()


for a in lst_a:
    lst_ans[a] += 1
ans = sum(1 for i in lst_ans if i % 2 == 1)


print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst_a = [int(input()) for _ in range(N)]
lst_ans = [0] * (10**5)
lst_a.sort()


for a in lst_a:
    lst_ans[a] += 1
ans = sum(1 for i in lst_ans if i % 2 == 1)


print(ans)
Problem p03625 (python)

Fixed submission:
N = int(input())
lst_A = list(map(int, input().split()))
lst_A.sort(reverse=True)
cur_a = -1
lst_ans = []


for i, a in enumerate(lst_A):
    if cur_a == a:
        lst_ans.append(a)
        cur_a = -1
        if len(lst_ans) == 2:
            break
    else:
        cur_a = a


ans = lst_ans[0] * lst_ans[1] if len(lst_ans) else 0
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst_A = list(map(int, input().split()))
lst_rod_num = [0] * (N + 1)
a, b = 0, 0
lst_ans = []


for a in lst_A:
    lst_rod_num[a] += 1


cnt = 0
for i in range(N, -1, -1):
    if cnt == 2:
        a = lst_ans[0]
        b = lst_ans[1]
        break
    if lst_rod_num[i] >= 2:
        lst_ans.append(i)
        cnt += 1
ans = a * b


print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst_A = list(map(int, input().split()))
lst_rod_num = [0] * (N + 1)
a, b = 0, 0
lst_ans = []


for a in lst_A:
    lst_rod_num[a] += 1


cnt = 0
for i in range(N - 1, -1, -1):
    if lst_rod_num[i] >= 2:
        lst_ans.append(i)
        cnt += 1
    if cnt == 2:
        a = lst_ans[0]
        b = lst_ans[1]
        break
ans = a * b


print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst_A = list(map(int, input().split()))
lst_rod_num = [0] * (N + 1)
a, b = 0, 0
lst_ans = []


for a in lst_A:
    lst_rod_num[a] += 1


cnt = 0
for i in range(N, -1, -1):
    if lst_rod_num[i] >= 2:
        lst_ans.append(i)
        cnt += 1
    if cnt == 2:
        a = lst_ans[0]
        b = lst_ans[1]
        break
ans = a * b


print(ans)
Problem p03695 (python)

Fixed submission:
N = int(input())
lst_a = list(map(int, input().split()))
lst_color = [0] * 8
cnt_super = 0


for a in lst_a:
    if 1 <= a <= 399:
        lst_color[0] += 1
    elif 400 <= a <= 799:
        lst_color[1] += 1
    elif 800 <= a <= 1199:
        lst_color[2] += 1
    elif 1200 <= a <= 1599:
        lst_color[3] += 1
    elif 1600 <= a <= 1999:
        lst_color[4] += 1
    elif 2000 <= a <= 2399:
        lst_color[5] += 1
    elif 2400 <= a <= 2799:
        lst_color[6] += 1
    elif 2800 <= a <= 3199:
        lst_color[7] += 1
    else:
        cnt_super += 1
cnt_existed = sum(1 for x in lst_color if x!=0)


if cnt_existed == 0:
    ans_min = 1
    ans_max = cnt_super
else:
    ans_min = cnt_existed
    ans_max = cnt_existed + cnt_super


print(ans_min, ans_max)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst_a = list(map(int, input().split()))
lst_color = [0] * 8
cnt_super = 0


for a in lst_a:
    i = a // 400
    if i == 8:
        cnt_super += 1
    else:
        lst_color[i] = 1
cnt_existed = sum(1 for x in lst_color if x!=0)


ans_min = max(cnt_existed, 1)
ans_max = cnt_existed + cnt_super


print(ans_min, ans_max)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst_a = list(map(int, input().split()))
lst_color = [0] * 8
cnt_super = 0


for a in lst_a:
    i = int(a / 400)
    if i == 8:
        cnt_super += 1
    else:
        lst_color[i] += 1
cnt_existed = sum(1 for x in lst_color if x!=0)


ans_min = max(cnt_existed, 1)
ans_max = cnt_existed + cnt_super


print(ans_min, ans_max)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst_a = list(map(int, input().split()))
lst_color = [0] * 8
cnt_super = 0


for a in lst_a:
    i = a // 400
    if i == 8:
        cnt_super += 1
    else:
        lst_color[i] += 1
cnt_existed = sum(1 for x in lst_color if x!=0)


ans_min = max(cnt_existed, 1)
ans_max = cnt_existed + cnt_super


print(ans_min, ans_max)

Buggy submission (verdict: Runtime Error):
N = int(input())
lst_a = list(map(int, input().split()))
lst_color = [0] * 8
cnt_super = 0


for a in lst_a:
    i = a // 400
    if i == 8:
        cnt_super += 1
    else:
        lst_color[i] += 1
cnt_existed = sum(1 for x in lst_color if x!=0)


ans_min = max(cnt_existed, 1)
ans_max = cnt_existed + cnt_super


print(ans_min, ans_max)
Problem p03848 (python)

Fixed submission:
from collections import Counter


N = int(input())
lstA = list(map(int, input().split()))
mod = 10**9 + 7
countA = Counter(lstA)
ans = 0

if N % 2:
    if countA[0] == 1 and all(countA[i] == 2 for i in range(2, N, 2)):
        ans = pow(2, N//2, mod)
else:
    if all(countA[i] == 2 for i in range(1, N, 2)):
        ans = pow(2, N//2, mod)


print(ans)

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


N = int(input())
lstA = list(map(int, input().split()))
mod = 10**9 + 7
countA = Counter(lstA)


if N % 2:
    if countA[0] == 1 and all(countA[i] == 2 for i in range(2, N, 2)):
        ans = pow(2, N//2, mod)
    else:
        ans = 0
else:
    if all(countA[i] == 2 for i in range(1, N, 2)):
        ans = pow(2, N//2, mod)

print(ans)

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


N = int(input())
lstA = list(map(int, input().split()))
mod = 10**9 + 7
countA = Counter(lstA)


if N % 2:
    if countA[0] == 1 and all(countA[i] == 2 for i in range(2, N, 2)):
        ans = 2 ** (N // 2) % mod
    else:
        ans = 0
else:
    if all(countA[i] == 2 for i in range(1, N, 2)):
        ans = 2 ** (N // 2) % mod

print(ans)

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


N = int(input())
lstA = list(map(int, input().split()))
mod = 10**9 + 7
countA = Counter(lstA)


if N % 2:
    if countA[0] == 1 and all(countA[i] == 2 for i in range(2, N, 2)):
        ans = pow(2, N//2) % mod
    else:
        ans = 0
else:
    if all(countA[i] == 2 for i in range(1, N, 2)):
        ans = pow(2, N//2) % mod

print(ans)
Problem p03853 (python)

Fixed submission:
# coding: utf-8
H, W = map(int, input().split())

for _ in range(H):
    l = input()
    print(l)
    print(l)

Buggy submission (verdict: Runtime Error):
 coding: utf-8
H, W = map(int, input().split())

for _ in range(H):
    l = input()
    print(l, l, sep="\n")
Problem p03944 (python)

Fixed submission:
# coding: utf-8
W, H, N = map(int, input().split())
min_x, max_x = 0, W
min_y, max_y = 0, H

for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        if max_x <= x:
            min_x, max_x = 0, 0
        elif min_x <= x:
            min_x = x
    elif a == 2:
        if min_x >= x:
            min_x, max_x = 0, 0
        elif x <= max_x:
            max_x = x
    elif a == 3:
        if max_y <= y:
            min_y, max_y = 0, 0
        elif min_y <= y:
            min_y = y
    else:
        if y <= min_y:
            min_y, max_y = 0, 0
        elif y <= max_y:
            max_y = y
diff_x = max_x - min_x
diff_y = max_y - min_y
print(diff_x * diff_y)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
W, H, N = map(int, input().split())
min_x, max_x = 0, W
min_y, max_y = 0, H

for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        if max_x <= x:
            min_x, max_x = 0, 0
        elif min_x <= x:
            min_x = x
    elif a == 2:
        if min_x >= x:
            min_x, max_x = 0, 0
        elif x <= max_x:
            max_x = x
    elif a == 3:
        if max_y <= y:
            min_y, max_y = 0, 0
        elif min_y <= y:
            min_y = y
    else:
        if y <= min_y:
            min_y, max_y = 0, 0
        elif y <= max_y:
            max_y = T
diff_x = max_x - min_x
diff_y = max_y - min_y
print(diff_x * diff_y)
Problem p04043 (python)

Fixed submission:
#coding: utf-8
li = list(map(int, input().split()))
print("YES" if li.count(5)==2 and li.count(7)==1 else "NO")

Buggy submission (verdict: Runtime Error):
#coding: utf-8
s = input()
print(["NO", "YES"][s.count("5")==2 * s.count("7")==1]
Problem p02811 (python)

Fixed submission:
k, x = map(int,input().split())
if k*500 >= x:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
if 500 * k >= x:
  print('Yse')
else:
  print('No')
Problem p02817 (python)

Fixed submission:
s, t = input().split()
print(t + s)

Buggy submission (verdict: Runtime Error):
s, t = input().split
print(t + s)
Problem p02946 (python)

Fixed submission:
k,x=map(int,input().split())
print(*[num for num in range(x-k+1,x+k)])

Buggy submission (verdict: Runtime Error):
k,x=map(int,input().split())
print([num in range(x-k+1,x)])
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
print((int(input())-1)*(int(input())-1))
Problem p03292 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c=sorted(map(int,input().split())
print(c-a)
Problem p03408 (python)

Fixed submission:
n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))

Buggy submission (verdict: Runtime Error):
n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i]-m.count(l[i]) for i in range(len(l))))))
Problem p03636 (python)

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

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
# スペース区切りの整数の入力
b, c = map(int, input().split())
# 文字列の入力
s = input()
# 出力
print("{} {}".format(a+b+c, s))

Buggy submission (verdict: Runtime Error):
s=Input()
print(s[0]+str(len(s)-2)+s[-1])
Problem p04044 (python)

Fixed submission:
n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
print("".join(s))

Buggy submission (verdict: Runtime Error):
list=sorted[input()]
print(*list,sep="")
Problem p02814 (python)

Fixed submission:
import sys

def gcd(x, y):
    if x % y == 0:
        return y
    return gcd(y, x % y)

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

cur = a[0]
for x in a[1:]:
    g = gcd(cur, x)
    if (cur // 2) % g != (x // 2) % g:
        print(0)
        sys.exit(0)
    else:
        cur = cur // g * x
    if cur > m * 2:
        print(0)
        sys.exit(0)

print((m + cur // 2) // cur)

Buggy submission (verdict: Runtime Error):
import sys
import math

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

cur = a[0]
for x in a[1:]:
    g = math.gcd(cur, x)
    if (cur // 2) % g != (x // 2) % g:
        print(0)
        sys.exit(0)
    else:
        cur = cur // g * x
    if cur > m * 2:
        print(0)
        sys.exit(0)

print((m + cur // 2) // cur)
Problem p02811 (python)

Fixed submission:
input_line = input()
Line = input_line.split()
if 500*int(Line[0]) >= int(Line[1]):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
lenghts = int(input())
document = input()

count = 0
for start in range(lenghts -2):
  if document[start: start+3] == 'ABC':
    count += 1
  
print(count)
Problem p03260 (python)

Fixed submission:
def main():
  A, B = map(int, input().split())
  print('Yes'if (A * B)**2 % 2 == 1 else 'No')
 
 
if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    result = True
    used = {str(input()): 0}
    for order in range(1,n):
        word = str(input())
        if word in used or list(used.keys())[order - 1][-1] != word[0]:
            result = False
            break
        else:
            used.setdefault(word,0)
    print("Yes" if result else "No")
        
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    result = True
    used = {str(input()): 0}
    for order in range(1,n):
        word = str(input())
        if word in used or sorted(used.keys())[order - 1][-1] != word[0]:
            print('NO')
            result = False
            break
        else:
            used.setdefault(word,0)
    if result:
        print('Yes')
        
if __name__ == "__main__":
    main()
Problem p02812 (python)

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

print(s.count('ABC'))

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

if int(n) >= 3 and int(n) =< 50:
    print(s.count('ABC'))
Problem p03687 (python)

Fixed submission:
# _*_ coding:utf-8 _*_

import sys

input = sys.stdin.readline().replace('\n','')
ans  = 1000

for c in input:
	s = input.split(c)
	ma = 0
	for i in range(len(s)):
		if ma < len(s[i]):
			ma = len(s[i])
	
	if ans > ma:
		ans = ma
		
print(ans,end='')

Buggy submission (verdict: Runtime Error):
# _*_ coding:utf-8 _*_

import sys

input = sys.stdin.readline().replace('\n','')
ans  = 1000

for c in input:
	s = input.split(f'{c}')
	ma = 0
	for i in range(len(s)):
		if ma < len(s[i]):
			ma = len(s[i])
	
	if ans > ma:
		ans = ma
		
print(ans,end='')

Buggy submission (verdict: Runtime Error):
# _*_ coding:utf-8 _*_

import sys

input = sys.stdin.readline()
ans  = 1000

for c in input:
	s = input.split(f'{c}')
	ma = 0
	for i in range(len(s)):
		if ma < len(s[i]):
			ma = len(s[i])
	
	if ans > ma:
		ans = ma
		
print(ans)

Buggy submission (verdict: Runtime Error):
# _*_ coding:utf-8 _*_

import sys

input = sys.stdin.readline()
ans  = 1000

for c in input:
	s = input.split(f'{c}')
	max = 0
	for i in range(len(s)):
		if max < len(s[i]):
			max = len(s[i])
	
	if ans > max:
		ans = max
		
print(ans)
Problem p02811 (python)

Fixed submission:
K,X = input().split()

def main(K,X):
  K = int(K)
  X = int(X)
  if K * 500 >= X:
    print('Yes')
  else:
    print('No')
 
if __name__ == '__main__':
  main(K,X)

Buggy submission (verdict: Runtime Error):
K,X = input().split()

def main(K,X):
  if K * 500 >= X:
    print('Yes')
  else:
    print('No')
 
if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
K,X = 2 900

def solve(K,X):
  if K * 500 >= X:
    print('Yes')
  else:
    print('No')
Problem p03605 (python)

Fixed submission:
s=input()
print("Yes" if s/10==9 or s%10==9 else "No")

Buggy submission (verdict: Runtime Error):
from scipy.sparse import*
(N,M,R),r,*t=[map(int,i.split())for i in __import__("sys").stdin]
a,b,c=zip(*t)
l=csgraph.dijkstra(csr_matrix((c,(a,b)),[N+1]*2),0)
print(min(sum(int(l[i][j])for i,j in zip(a[:-1],a[1:]))for a in __import__("itertools").permutations(r)))

Buggy submission (verdict: Runtime Error):
import itertools

N,M,R = map(int, input().split())
r = map(int, input().split())
l = [[1e9 for i in range(N+1)] for i in range(N+1)]

for i in range(M):
    a,b,c = map(int, input().split())
    l[a][b] = l[b][a] = c

for k in range(1,N+1):
    for i in range(1,N+1):
        for j in range(1,N+1):
            t = l[i][k] + l[k][j]
            if l[i][j] > t: l[i][j] = t

ans = 1e9
for a in itertools.permutations(r):
    s = 0
    for i,j in zip(a[:-1],a[1:]):
        s += l[i][j]
    if ans > s: ans = s

print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
print("Yes" if s/10==9 or s%10==9 else "No")
Problem p03682 (python)

Fixed submission:
class UnionFind3:
    def __init__(self, size):
        self.table = [-1 for _ in xrange(size)]

    def find(self, x):
        if self.table[x] < 0:
            return x
        else:
            self.table[x] = self.find(self.table[x])
            return self.table[x]

    def union(self, x, y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 != s2:
            if self.table[s1] <= self.table[s2]:
                self.table[s1] += self.table[s2]
                self.table[s2] = s1
            else:
                self.table[s2] += self.table[s1]
                self.table[s1] = s2
            return True
        return False

uf=UnionFind3(100001)

n = input()
cities = [map(int,raw_input().split(" "))+[i] for i in range(n)]

cities_x = sorted(cities, key=lambda a:a[0])
cities_y = sorted(cities, key=lambda a:a[1])

road = [[cities_x[i+1][0]-cities_x[i][0],cities_x[i][2],cities_x[i+1][2]] for i in range(n-1)]
road +=[[cities_y[i+1][1]-cities_y[i][1],cities_y[i][2],cities_y[i+1][2]] for i in range(n-1)]

sum = 0
for (cost,i,j) in sorted(road):
    if(uf.find(i)!=uf.find(j)):
        uf.union(i,j)
        sum += cost

print sum

Buggy submission (verdict: Runtime Error):
UF=[i for i in range(100001)]
def u(a,b):
    UF[f(a)] = UF[f(b)]

def f(c):
    if(c==UF[c]):
        return c
    else:
        UF[c]=f(UF[c])
        return UF[c]

n = input()
cities = [map(int,raw_input().split(" "))+[i] for i in range(n)]

cities_x = sorted(cities, key=lambda a:a[0])
cities_y = sorted(cities, key=lambda a:a[1])

road = [[cities_x[i+1][0]-cities_x[i][0],cities_x[i][2],cities_x[i+1][2]] for i in range(n-1)]
road +=[[cities_y[i+1][1]-cities_y[i][1],cities_y[i][2],cities_y[i+1][2]] for i in range(n-1)]

sum = 0
for (cost,i,j) in sorted(road):
    if(f(i)!=f(j)):
        u(i,j)
        sum += cost

print sum