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

Fixed submission:
N,M = map(int,input().split())
H=list(map(int,input().split()))
ABmap=[[] for i in range(N)]
count=0
for i in range(M):
    A,B=map(lambda x:x-1,map(int,input().split()))
    ABmap[A].append(H[B])
    ABmap[B].append(H[A])
        
for i in range(N):
    if len(ABmap[i])==0:
        count+=1
    elif max(ABmap[i])<H[i]:
        count+=1
   # print(ABmap[i])
print(count)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
H=list(map(int,input().split()))
ABmap=[[] for i in range(N)]
count=0
for i in range(M):
    A,B=map(lambda x:x-1,map(int,input().split()))
    ABmap[A].append(H[B])
    ABmap[B].append(H[A])
        
for i in range(N):
    #print(ABmap[i])
    #print(ABmap.count(H[i]))
    if max(ABmap[i])<H[i]:
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
H=list(map(int,input().split()))
ABmap=[[0 for i in range(N)] for i in range(N)]
count=0
for i in range(M):
    A,B=map(lambda x:x-1,map(int,input().split()))
    ABmap[A][B]=H[B]
    ABmap[B][A]=H[A]
    ABmap[A][A]=H[A]
    ABmap[B][B]=H[B]
    #print(ABmap[A])
    
for i in range(M):
    if max(ABmap[i])==H[i]:
        count+=1
print(count)
Problem p02682 (python)

Fixed submission:
A,B,C,K = map(int,input().split())
if A + B >= K:
	print(min(K,A))
else:
	print(A-(K-(A+B)))

Buggy submission (verdict: Runtime Error):
A,B,C,K = map(int,input().split())
if A + B >= K:
	print(max(K.A))
else:
	print(A-(K-(A+B)))
Problem p02753 (python)

Fixed submission:
S = input()
if S == "AAA" or S == "BBB":
	print("No")
else:
	print("Yes")

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

Line1 = ("b"*A+"r"*B)
Line2 = ("b"*A+"r"*B)
Cnt = 0
while Cnt < N/(A+B):
	Line2 += Line1
	Cnt += 1

print(Line2[:N].count("b"))

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
One_line = ""
Line = ("b"*A+"r"*B)
Cnt = 0
while Cnt < N:
	One_line += Line
	Cnt += (A + B)

print(One_line[:N].count("b"))
Problem p02771 (python)

Fixed submission:
N=input().split()
if N[0] != N[1] and N[0] != N[2] and N[1] != N[2]:
  print("No")
elif N[0] == N[1] and N[0] == N[2] and N[1] == N[2]:
  print("No") 
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N=input().split
if N[0] != N[1] and N[0] != N[2] and N[1] != N[2]:
  print("No")
elif N[0] == N[1] and N[0] == N[2] and N[1] == N[2]:
  print("No") 
else:
  print("Yes")
Problem p02847 (python)

Fixed submission:
N = input()
if N == "SUN":
    print(7)
elif N == "MON":
    print(6)
elif N == "TUE":
    print(5)
elif N == "WED":
    print(4)
elif N == "THU":
    print(3)
elif N == "FRI":
    print(2)
elif N == "SAT":
    print(1)

Buggy submission (verdict: Runtime Error):
Week=["SAT","FRI","THU","WED","TUE","MON","SUN"]
 Day=input()
 print(Week.index(Day)+1)

Buggy submission (verdict: Runtime Error):
Week=["SAT","FRI","THU","WED","TUE","MON","SAN"]
Day=input()
print(Week.index(Day)+1)
Problem p02859 (python)

Fixed submission:
R = input()
print(int(R)*int(R))

Buggy submission (verdict: Runtime Error):
R = input()R = input()
print(int(R)*int(R))
Problem p02759 (python)

Fixed submission:
N = input()
print(int((int(N)+1)/2))

Buggy submission (verdict: Runtime Error):
N =input()
print(int(N+1)/2)

Buggy submission (verdict: Runtime Error):
N = input()
print(N/2)
Problem p02659 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
import math

from decimal import *

def solve(A: int, B: float):
    a = Decimal(A)
    b = Decimal(B)
    # print(math.floor(a * b))
    # return
    if len(str(B)) == 3:
        if str(B)[2] == 0:
            print(math.floor(a*b))
            return
        ans = A * int(str(B)[0])
        ans += Decimal(a * int(str(B)[2]) / 10)
        print(math.floor(ans))
        return

    if len(str(B)) == 4:
        ans = A * int(str(B)[0])
        ans += Decimal(A * int(str(B)[2]) / 10)
        ans += Decimal(A * int(str(B)[3]) / 100)
        print(math.floor(ans))
        return
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = float(next(tokens))  # type: float
    solve(A, B)

if __name__ == '__main__':
    main()

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

from decimal import *

def solve(A: int, B: float):
    # a = Decimal(A)
    # b = Decimal(B)
    print(math.floor(Decimal(a * b)))
    return
    # if len(str(B)) == 3:
    #     if str(B)[2] == 0:
    #         print(math.floor(a*b))
    #         return
    #     ans = A * int(str(B)[0])
    #     ans += Decimal(a * int(str(B)[2]) / 10)
    #     print(math.floor(ans))
    #     return

    # if len(str(B)) == 4:
    #     ans = A * int(str(B)[0])
    #     ans += Decimal(A * int(str(B)[2]) / 10)
    #     ans += Decimal(A * int(str(B)[3]) / 100)
    #     print(math.floor(ans))
    #     return
    # return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = float(next(tokens))  # type: float
    solve(A, B)

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

Fixed submission:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):
    print(YES if 'A' in S and 'B' in S else NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
 
 
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    a = input()
    Q = int(input())
    qs = [input().split() for _ in range(Q)]
    ans = a
    revcount = 0
    for q in qs:
        if len(q) == 1:
            revcount += 1
        else:
            if int(q[1]) == 1:
                if revcount % 2 == 0:
                    ans = q[2] + ans
                else:
                    ans = ans + q[2]
            else:
                if revcount % 2 == 0:
                    ans = ans + q[2]
                else:
                    ans = q[2] + ans
    if revcount % 2 == 1:
        ans = ans[::-1]
    print(ans)
    return
 
 
if __name__ == '__main__':
    main()
Problem p02831 (python)

Fixed submission:
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    print(lcm(A, B))
    return


def lcm(x, y):
    return (x * y) // gcd(x, y)


def gcd(x: int, y: int):
    """xとyの最大公約数を求める"""
    return gcd(y, x % y) if y else x


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
import math


def solve(A: int, B: int):
    print(lcm(A, B))
    return


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

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

Fixed submission:
n,k=map(int,input().split())
d=[0]*k
a=[]
for i in range(k):
    d[i]=int(input())
    a.extend(list(map(int,input().split())))
a=set(a)
print(n-len(a))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
d=[0]*n
a=[]
for i in range(k):
    d[i]=int(input())
    a.extend(list(map(int,input().split())))
a=set(a)
print(n-len(a))
Problem p02701 (python)

Fixed submission:
n=int(input())
s=[0]*n
for i in range(n):
    s[i]=input()
se=set(s)
print(len(se))

Buggy submission (verdict: Runtime Error):
n=input()
s=[0]*n
for i in range(n):
    s[i]=input()
se=set(s)
print(len(se))
Problem p02659 (python)

Fixed submission:
A, B = list(map(str, input().split()))

a = int(A)
b = int(B[0])
b2 = int(B[2:4])
#print(b)
#print(b2)
#print(b)


t = a*b
#print(t)
#b3 = b*100
bb = a*b2
tmp = bb//100
#print(tmp)
#print(a*b)
bef = tmp+t
ans = str(bef)

print(ans)

Buggy submission (verdict: Runtime Error):
A, B = list(map(float, input().split()))
#print(A*B)
print(A*(B*100)+0.005)//100

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

print(int(int(A)*B+0.5)))
Problem p02689 (python)

Fixed submission:
from collections import defaultdict
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
ans = N
tog = defaultdict(list)
arr = set()
cnt = 0

for i in range(M):
    a, b = list(map(int, input().split()))
    tog[a].append(H[b-1])
    tog[b].append(H[a-1])
    '''
    if str(a) not in arr:
        ans -= 1
        arr.add(str(H[a-1]))
    if str(b) not in arr:
        ans -= 1
        arr.add(str(H[b-1]))
    '''
#print(tog)

for ele in tog:
    #print(tog[ele])
    #print(max(tog[ele]))
    if H[ele-1] > max(tog[ele]):
        #print('ok')
        cnt += 1

#print(len(tog))
t = N - len(tog)
#print(t)
#print(len(arr))
#print(len(tog)+N-cnt)
print(cnt+t)

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
ans = 0
arr = []
arr2 = []
cnt = 0
for i in range(M):
    a, b = list(map(int, input().split()))
    if a not in arr2:
        arr2.append(a)
    if b not in arr2:
        arr2.append(b)
    if H[a-1] < H[b-1]:
        if H[a] not in arr:
            arr.append(H[a])
            cnt += 1

not_found = len(H)-len(arr2)
print(N-cnt-not_found)
Problem p02701 (python)

Fixed submission:
N = int(input())
list = {}
for i in range(N):
    A = str(input())
    list[A] = 1

print(len(list))

Buggy submission (verdict: Runtime Error):
N = int(input())
set = {}
for i in range(N):
    A = str(input())
    set.add(A)

print(len(set))
Problem p02773 (python)

Fixed submission:
n = int(input())
dict1 = {}

for _ in range(n):
    s = input()
    if s in dict1:
        dict1[s] += 1
    else:
        dict1[s] = 1

dict_sorted = sorted(list(dict1.items()), key = lambda x: x[0])
dict_sorted.sort(key = lambda x: x[1], reverse = True)

max1 = dict_sorted[0][1]

for i in range(len(dict_sorted)):
    if dict_sorted[i][1] == max1:
        print(dict_sorted[i][0])
    else:
        break

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

for _ in range(n):
    s = input()
    if s in dict1:
        dict1[s] += 1
    else:
        dict1[s] = 1

dict_sorted = sorted(dict1, key = lambda x: x[0])
dict_sorted.sort(key = lambda x: x[1], reverse = True)

max1 = dict_sorted[0][1]

for i in range(len(dict_sorted)):
    if dict_sorted[i][1] == max1:
        print(dict_sorted[i][0])
    else:
        break

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

for _ in range(n):
    s = input()
    if s in dict1:
        dict1[s] += 1
    else:
        dict1[s] = 1

dict1.sort(key = lambda x: x[0])
dict1.sort(key = lambda x: x[1], reverse = True)

max1 = dict1[0][1]

for i in range(len(dict1)):
    if dict1[i][1] == max1:
        print(dict1[i][0])
    else:
        break
Problem p02829 (python)

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

print(6-A-B)

Buggy submission (verdict: Runtime Error):
N, u, v = list(map(int, input().split()))
graph = [[] for _ in range(N+1)]
for i in range(N-1):
  A, B = list(map(int, input().split()))
  graph[A].append(B)
  graph[B].append(A)
#print(graph)

def dfs(v):
  dist = [-1] * (N+1)
  dist[v] = 0
  stack = [v
 # print(dist)
  while stack:
    now = stack.pop()
    dw = dist[now] + 1
#graph[]は隣接している要素
    for ne in graph[now]:
      if dist[ne] >= 0:
        continue
      dist[ne] = dw
      stack.append(ne)
      #print(ne)
  return dist

Taka = dfs(u)
Ao = dfs(v)

ans = 0
for t, a in zip(Takahashi[1:], Aoki[1:]):
  if t < a:
    ans = max(ans, a-1)

print(ans)

Buggy submission (verdict: Runtime Error):
N, u, v = list(map(int, input().split()))
graph = [[] for _ in range(N+1)]
for i in range(N-1):
  A, B = list(map(int, input().split()))
  graph[A].append(B)
  graph[B].append(A)
#print(graph)

def dfs(v):
  dist = [-1] * (N+1)
  dist[v] = 0
  stack = [v]
 # print(dist)
  while stack:
    now = stack.pop()
    dw = dist[now] + 1
#graph[]は隣接している要素
    for ne in graph[now]:
      if dist[ne] >= 0:
        continue
      dist[ne] = dw
      stack.append(ne)

  return dist

Taka = dfs(u)
Ao = dfs(v)

ans = 0
for t, a in zip(Takahashi[1:], Aoki[1:]):
  if t < a:
    ans = max(ans, a-1)

print(ans)

Buggy submission (verdict: Runtime Error):
N, u, v = list(map(int, input().split()))
graph = [[] for _ in range(N+1)]
for i in range(N-1):
  A, B = list(map(int, input().split()))
  graph[A].append(B)
  graph[B].append(A)
#print(graph)

def dfs(v):
  dist = [-1] * (N+1)
  dist[v] = 0
  stack = [v
 # print(dist)
  while stack:
    now = stack.pop()
    dw = dist[now] + 1
#graph[]は隣接している要素
    for ne in graph[now]:
      if dist[ne] >= 0:
        continue
      dist[ne] = dw
      stack.append(ne)
      #print(ne)
  return dist

Taka = dfs(u)
Ao = dfs(v)

ans = 0
for t, a in zip(Takahashi[1:], Aoki[1:]):
  if t < a:
    ans = max(ans, a-1)

print(ans)
Problem p02833 (python)

Fixed submission:
N = int(input())
if N%2 == 1:
  print(0)
else:
  i = N//10
  c = 0
  while i != 0:
    c += i
    i = i//5
  print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
class DFactorial(self, n):
  if N < 2:
    return 1
  else:
    n * DFactorial(n-2)

print(DFactorial(N))
Problem p02834 (python)

Fixed submission:
import sys

n, u, v = map(int, sys.stdin.readline().split())
graph = [[] for _ in range(n+1)]
for i in range(n-1):
    a, b = map(int, sys.stdin.readline().split())
    graph[a].append(b)
    graph[b].append(a)

def dfs(v):
    dist = [-1] * (n+1)
    dist[v] = 0
    stack = [v]
    while stack:
        now = stack.pop()
        dw = dist[now] + 1
        for ne in graph[now]:
            if dist[ne] >= 0:
                continue
            dist[ne] = dw
            stack.append(ne)
    return dist

Takahashi = dfs(u)
Aoki = dfs(v)

ans = 0
for t, a in zip(Takahashi[1:], Aoki[1:]):
    if t < a:
        ans = max(ans, a - 1)

print(ans)

Buggy submission (verdict: Runtime Error):
N, u, v = list(map(int, input().split()))
graph = [[] for _ in range(N+1)]
for i in range(N-1):
  A, B = list(map(int, input().split()))
  graph[A].append(B)
  graph[B].append(A)
#print(graph)

def dfs(v):
  dist = [-1] * (N+1)
  dist[v] = 0
  stack = [v
 # print(dist)
  while stack:
    now = stack.pop()
    dw = dist[now] + 1
#graph[]は隣接している要素
    for ne in graph[now]:
      if dist[ne] >= 0:
        continue
      dist[ne] = dw
      stack.append(ne)
      #print(ne)
  return dist

Taka = dfs(u)
#Ao = dfs(v)

print(Taka)
#print(Ao)

ans = 0
for t, a in zip(Takahashi[1:], Aoki[1:]):
  if t < a:
    ans = max(ans, a-1)

print(ans)
Problem p02897 (python)

Fixed submission:
N=int(input())
cnt=0
for i in range(N):
    if (i+1)%2!=0:
        cnt+=1
print(cnt/N)

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

B = list(range(1,N+1))
ab = []
for i in range(N):
    ab.append([A[i], B[i]])
print(ab)
ab.sort()
print(ab)
for i in range(N):
    print(ab[i][1], end = " ")

print()

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

B = list(range(1,N+1))
ab = []
for i in range(N):
    ab.append([A[i], B[i]])
print(ab)
ab.sort()
print(ab)
for i in range(N):
    print(ab[i][1], end = " ")

print()
Problem p02723 (python)

Fixed submission:
from sys import stdin


def get_result(data):
    S = data[0]
    if S[2] == S[3] and S[4] == S[5]:
       return 'Yes'
    return 'No'


if __name__ == '__main__':
    data = list(map(str, stdin.readline().rstrip('\n').split(' ')))
    result = get_result(data)
    print(result)

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


class BreadthFirstSearch:
    def __init__(self, num_nodes):
        self.n = num_nodes
        self.graph = [[] for _ in range(self.n)]

    # Edge数分回すことを想定
    def add_edge(self, start, end, undirected=True):
        self.graph[start].append(end)
        if undirected:
            self.graph[end].append(start)

    # depth = distance
    def search(self, start_node):
        order = [-1] * self.n # a bfs ordering of each vertex
        parent = [-1] * self.n # parent of each vertex in the bfs search tree
        depth = [-1] * self.n # the depth of each vertex
        q = deque([(start_node, -1, 0)]) # (vertex, parent, depth)
        num = 0 # current ordering
        while len(q) > 0:
            v, p, d = q.popleft()
            if order[v] < 0: # visited v for the first time
                order[v] = num; parent[v] = p; depth[v] = d
                num += 1
                for u in self.graph[v]:
                    if order[u] >= 0: continue
                    q.append((u, v, d+1))
        return order, parent, depth





# BFS pypyでAC
def get_result(data):
    N, X, Y = data
    _data = [[i, i+1] for i in range(1, N)]
    _data += [[X, Y]]
    bfs = BreadthFirstSearch(N)
    for val in _data:
        bfs.add_edge(val[0]-1, val[1]-1)
    dist_cnt = [0 for i in range(N)]
    for i in range(N):
        _, _, depth = bfs.search(i)
        for j in range(i, N):
            dist_cnt[depth[j]] += 1
    for i in range(1, N):
        print(dist_cnt[i])


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip('\n').split(' ')))
    get_result(data)
Problem p02880 (python)

Fixed submission:
N = int(input())
is81 = False
for i in range(1, 10):
    for j in range(1, 10):
        if i*j == N:
            is81 = True

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

Buggy submission (verdict: Runtime Error):
N = int(input())
is81 = false
for i in range(1, 10):
    for j in range(1, 10):
        if i*j == N:
            is81 = True

if is81:
    print('Yes')
else:
    print('No')
Problem p02987 (python)

Fixed submission:
S = list(input())
S = sorted(S)

if S[0] == S[1] and S[2] == S[3] and S[1] != S[3]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S = list(input())
S = sorted(S)

if S[0] == S[1] and S[2] == S[3] and if S[1] != S[3]:
    print('Yes')
else:
    print('No')
Problem p03011 (python)

Fixed submission:
p,q,r = map(int, input().split())
l = [p,q,r]
l = sorted(l, reverse=True)
print(l[1] + l[2])

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

l = W[0]
r = sum(W[1:])
diff = abs(l - r)
for i in range(1, N):
    l += W[i]
    r -= W[i]
    new_diff = abs(l-r)
    if new_diff < diff:
        diff = new_diff
print(diff)
Problem p03036 (python)

Fixed submission:
r,d,x = map(int, input().split())

for i in range(10):
    ans = x * r - d
    print(ans)
    x = ans

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

for i range (10):
    ans = x * r - d
    print(ans)
    x = ans
Problem p03041 (python)

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

for i in range(N):
    if i == K-1:
        S[i] = S[i].lower()

S = ''.join(S)
print(S)

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

for i in range(1,N+1):
    if i == K:
        S[i] == S[i].lower()

print(S)
Problem p03072 (python)

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

highest = L[0]
ans = 0

for i in range(N):
        if L[i] >= highest:
                ans += 1
                highest = L[i]

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(input())
most_highest_data = 0
ans = 0

for i in range(N):
    if int(L[i]) > most_highest_data:
            most_higest_data = L[i]
    if most_highest_data <= int(L[i+1]):
        ans += 1

print(ans)
Problem p03208 (python)

Fixed submission:
N,K = map(int, input().split())
h = [int(input()) for i in range(N)]
h.sort()
ans = min(h[i+K-1] - h[i] for i in range(N-K+1))
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
h = [int(input()) for i in range(N)]
h.sort()
ans = min(h[i+K-1] - h[i] for i in range(N-k+1))
print(ans)
Problem p03307 (python)

Fixed submission:
N = int(input())

if N % 2 == 0:
    print(N)
else :
    print(N * 2)

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

print(max(A)-min(A))
Problem p03327 (python)

Fixed submission:
N = int(input())
if N>=1 and N<1000:
    print('ABC')
else:
    print('ABD')

Buggy submission (verdict: Runtime Error):
N = int(input())
if N>=1 and N<1000:
    print(ABC)
else:
    print(ABD)
Problem p02771 (python)

Fixed submission:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
if (a==b):
    d+=1
if (b==c):
    d+=1
if (c==a):
    d+=1
if (d==1):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d=0
if (a==b):
    d+=1
if (b==c):
    d+=1
if (c==a):
    d+=1
if (d==1):
    print('Yes')
else:
    print('No')
Problem p02659 (python)

Fixed submission:
import math
A,B=input().split()
A=int(A)
B=int(float(B)*1000)
ans=A*B
ans=str(ans)
if len(ans) < 4:
    print(0)
else:
    print(ans[:-3])

Buggy submission (verdict: Runtime Error):
import math
A,B=input().split()
ans=int(A)*int(math.ceil(B))
print(math.floor(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(x) for x in input().split()]
ans=1
for i in range(N):
    ans=ans*A[]
    if ans>10**18:
        print(-1)
        exit
    elif ans==0:
        print(0)
        exit
print(ans)
Problem p02682 (python)

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

if a <= k:
    count += a
else:
    count += k
    print(count)
    exit()
k -= a

if b <= k:
    k -= b
else:
    print(count)
    exit()


count -= k

print(count)

Buggy submission (verdict: Runtime Error):
A,B,C,K=list(map(int,input().split()))
if A>=K:
    print(A)
elif A<K and (A+B)>=K:
    print(A)
elif A<K and (A+B)<K:
    t=A-(K-A-B)
    if t<=0:
        print("0")
    else:
        print(m)
Problem p02987 (python)

Fixed submission:
S = input()
if len(set(S)) != 2 or S.count(S[0]) != 2:
  print('No')
  exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
def comb(n, r):
  if n < 0 or r < 0:
    return 0
  r = min(r, n - r)
  if n == 0 or r == 0:
    return 1
  return (n - r + 1) * comb(n, r - 1) // r

N, K = list(map(int, input().split()))
for i in range(K):
  print(comb(N - K + 1, i + 1) * comb(K - 1, i) % (10 ** 9 + 7))