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

Fixed submission:
import math
N = int(input())
A_array = list(map(int, input().split()))

A_array.sort()

ans = 0

if A_array[0] == 1:
    if N >= 2 and A_array[1] != 1 or N == 1:
        print(1)
    else:
        print(0)
    exit()


ng_array = [0] * (10 ** 6)


for i, a in enumerate(A_array):
    if i != 0 and a == A_array[i - 1]:
        continue
    j = 2
    while a * j <= 10 ** 6:
        ng_array[a * j - 1] = 1
        j += 1


for i in range(N):
    a = A_array[i]
    if i != 0:
        if A_array[i] == A_array[i - 1]:
            continue
    if i != N - 1:
        if A_array[i] == A_array[i + 1]:
            continue
    if ng_array[a-1] == 0:
        ans += 1
print(ans)

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

A_array.sort()

use_array = [0] * A_array[-1]

ans = 0

for i in range(N):
    if i != 0:
        if A_array[i] == A_array[i - 1]:
            use_array[a - 1] = 1
            continue
    if i != N - 1:
        if A_array[i] == A_array[i + 1]:
            use_array[a - 1] = 1
            continue
    a = A_array[i]
    for j in range(1, int(math.sqrt(a)) + 1):
        if a % j == 0:
            if use_array[j - 1] == 1 or use_array[a // j - 1] == 1:
                break
    else:
        ans += 1
    use_array[a - 1] = 1

print(ans)
Problem p02992 (python)

Fixed submission:
import math
N, K = map(int, (input().split()))

mod = 10**9 + 7

ans_array = []
divide_max = N
divide_count = []

for i in range(2, math.floor(math.sqrt(N)) + 2):
    divide = math.floor(N / i)
    ans_array.append(divide_max - divide)
    divide_count.append(divide_max - divide)
    divide_max = divide

for i in range(divide):
    ans_array.append(1)
ans_array = ans_array[::-1]
# print(ans_count)
ans_length = len(ans_array)
ans_acc = [0] * ans_length

for k in range(2, K + 1):
    ans_acc[0] = ans_array[0]
    for i in range(1, ans_length):
        ans_acc[i] = (ans_acc[i - 1] + ans_array[i]) % mod
    # print(ans_array)
    # print(ans_acc)
    for i in range(divide):
        ans_array[i] = ans_acc[ans_length - i - 1]
    for i in range(divide, ans_length):
        ans_array[i] = ans_acc[ans_length - i - 1] * divide_count[
            ans_length - 1 - i] % mod

ans_acc[0] = ans_array[0]
for i in range(1, ans_length):
    ans_acc[i] = (ans_acc[i - 1] + ans_array[i]) % mod

print(ans_acc[-1])

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

mod = 10**9 + 7

ans_array = []
divide_max = N
for i in range(2, math.floor(math.sqrt(N)) + 1):
    divide = math.floor(N / i)
    ans_array.append(divide_max - divide)
    divide_max = divide

for i in range(divide):
    ans_array.append(1)
ans_array = ans_array[::-1]
ans_count = copy.deepcopy(ans_array)
# print(ans_count)
ans_length = len(ans_array)
ans_acc = [0] * ans_length

for k in range(2, K + 1):
    ans_acc[0] = ans_array[0]
    for i in range(1, ans_length):
        ans_acc[i] = (ans_acc[i - 1] + ans_array[i]) % mod
    # print(ans_array)
    # print(ans_acc)
    for i in range(ans_length):
        ans_array[i] = ans_acc[ans_length-i-1] * ans_count[i] % mod

ans_acc[0] = ans_array[0]
for i in range(1, ans_length):
    ans_acc[i] = (ans_acc[i - 1] + ans_array[i]) % mod

print(ans_acc[-1])
Problem p03006 (python)

Fixed submission:
import collections
N = int(input())
xy_array = [list(map(int, input().split())) for i in range(N)]
if N == 1:
    print(1)
    exit()
# print(xy_array)
distance_array = []
for i in range(N):
    x_i, y_i = xy_array[i]
    for j in range(N):
        if i == j:
            continue
        x_j, y_j = xy_array[j]
        distance_array.append((x_i - x_j, y_i - y_j))

ans_array = collections.Counter(distance_array)
max_count = ans_array.most_common()[0][1]
print(N - max_count)

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
xy_array = [list(map(int, input().split())) for i in range(N)]
# print(xy_array)
distance_array = []
for i in range(N):
    x_i, y_i = xy_array[i]
    for j in range(N):
        if i == j:
            continue
        x_j, y_j = xy_array[j]
        distance_array.append((x_i - x_j, y_i - y_j))

ans_array = collections.Counter(distance_array)
max_count = ans_array.most_common()[0][1]
print(N - max_count)
Problem p03044 (python)

Fixed submission:
N = int(input())
node_array = [list(map(int, input().split())) for i in range(N - 1)]
# print(node_array)
tree_num_array = [-1] * N
# print(tree_num_array)

tree_num_max = -1
tree = {}
last_tree_num = -1
for node in node_array:
    # print(tree)
    i, j, w = node
    i = i - 1
    j = j - 1
    if tree_num_array[i] == -1 and tree_num_array[j] == -1:
        # print(i, j, "added")
        tree_num_max += 1
        tree[tree_num_max] = {i: 0, j: w}
        tree_num_array[i] = tree_num_max
        tree_num_array[j] = tree_num_max
        last_tree_num = tree_num_max
        continue
    elif tree_num_array[i] == -1:
        # print(i, "added")
        tree_num_added = tree_num_array[j]
        tree[tree_num_added][i] = tree[tree_num_added][j] + w
        tree_num_array[i] = tree_num_added
        last_tree_num = tree_num_added
    elif tree_num_array[j] == -1:
        # print(j, "added")
        tree_num_added = tree_num_array[i]
        tree[tree_num_added][j] = tree[tree_num_added][i] + w
        tree_num_array[j] = tree_num_added
        last_tree_num = tree_num_added
    else:
        tree_num_i = tree_num_array[i]
        tree_num_j = tree_num_array[j]
        # print(tree_num_i, tree_num_j, "unite")
        if len(tree[tree_num_i]) > len(tree[tree_num_j]):
            tree_main_num = tree_num_i
            tree_main_value = tree[tree_main_num][i]
            tree_sub_num = tree_num_j
            tree_sub_value = tree[tree_sub_num][j]
        else:
            tree_main_num = tree_num_j
            tree_main_value = tree[tree_main_num][j]
            tree_sub_num = tree_num_i
            tree_sub_value = tree[tree_sub_num][i]

        for key, value in tree[tree_sub_num].items():
            tree[tree_main_num][
                key] = tree_main_value + w + abs(value - tree_sub_value)
            tree_num_array[int(key)] = tree_main_num
        last_tree_num = tree_main_num
# print(tree)
ans_dict = sorted(tree[last_tree_num].items(), key=lambda x: int(x[0]))
# print(ans_dict)
for distance in ans_dict:
    print(distance[1] % 2)

Buggy submission (verdict: Runtime Error):
def dfs(i, d):
    # print(i, d)
    for j, w in node_array[i]:
        if color_array[j] == -1:
            color_array[j] = (d + w) % 2
            dfs(j, d + w)


N = int(input())
node_array = [[] for i in range(N)]
color_array = [-1] * N

for _ in range(N - 1):
    i, j, w = map(int, input().split())
    node_array[i - 1].append((j - 1, w))
    node_array[j - 1].append((i - 1, w))

color_array[0] = 0
dfs(0, 0)

for i in range(N):
    print(color_array[i])

Buggy submission (verdict: Runtime Error):
def dfs(i, d):
    # print(i, d)
    for j, w in node_array[i]:
        if color_array[j] == -1:
            color_array[j] = (d + w) % 2
            dfs(j, d + w)


N = int(input())
node_array = [[] for i in range(N)]
color_array = [-1] * N

for _ in range(N - 1):
    i, j, w = map(int, input().split())
    node_array[i - 1].append((j - 1, w))
    node_array[j - 1].append((i - 1, w))

color_array[0] = 0
dfs(0, 0)

for i in range(N):
    print(color_array[i])
Problem p03078 (python)

Fixed submission:
import heapq
X, Y, Z, K = map(int, input().split())
A_array = list(map(int, input().split()))
B_array = list(map(int, input().split()))
C_array = list(map(int, input().split()))

A_array.sort()
B_array.sort()
C_array.sort()

use_array = []
sum_array = []

candidate = []
heapq.heapify(candidate)

max_sum = A_array[-1] + B_array[-1] + C_array[-1]

heapq.heappush(candidate, (0, X - 1, Y - 1, Z - 1))
use_array.append((X - 1, Y - 1, Z - 1))

for i in range(K):
    s, x, y, z = heapq.heappop(candidate)

    sum_array.append(s)
    if x != 0 and (x - 1, y, z) not in use_array:
        use_array.append((x - 1, y, z))
        diff = A_array[x] - A_array[x - 1]
        heapq.heappush(candidate, (s + diff, x - 1, y, z))

    if y != 0 and (x, y - 1, z) not in use_array:
        use_array.append((x, y - 1, z))
        diff = B_array[y] - B_array[y - 1]
        heapq.heappush(candidate, (s + diff, x, y - 1, z))

    if z != 0 and (x, y, z - 1) not in use_array:
        use_array.append((x, y, z - 1))
        diff = C_array[z] - C_array[z - 1]
        heapq.heappush(candidate, (s + diff, x, y, z - 1))

for ans in sum_array:
    print(max_sum - ans)

Buggy submission (verdict: Runtime Error):
import heapq
X, Y, Z, K = map(int, input().split())
A_array = list(map(int, input().split()))
B_array = list(map(int, input().split()))
C_array = list(map(int, input().split()))

A_array.sort()
B_array.sort()
C_array.sort()

use_array = []
sum_array = []

candidate = []
heapq.heapify(candidate)

max_sum = A_array[-1] + B_array[-1] + C_array[-1]

heapq.heappush(candidate, (0, X - 1, Y - 1, Z - 1))
use_array.append((X - 1, Y - 1, Z - 1))
for i in range(K):

    s, x, y, z = heapq.heappop(candidate)

    sum_array.append(s)
    if x != 0 and (X - 1, Y, Z) not in use_array:
        use_array.append((X - 1, Y, Z))
        diff = A_array[x] - A_array[x - 1]
        heapq.heappush(candidate, (s + diff, x - 1, y, z))

    if y != 0 and (X, Y - 1, Z) not in use_array:
        use_array.append((X, Y - 1, Z))
        diff = B_array[y] - B_array[y - 1]
        heapq.heappush(candidate, (s + diff, x, y - 1, z))

    if z != 0 and (X, Y, Z - 1) not in use_array:
        use_array.append((X, Y, Z - 1))
        diff = C_array[z] - C_array[z - 1]
        heapq.heappush(candidate, (s + diff, x, y, z - 1))

for ans in sum_array:
    print(max_sum - ans)
Problem p03112 (python)

Fixed submission:
INF = 10**11


def binary_search(array, value):
    start = 0
    end = len(array) - 1
    while end - start >= 2:
        tmp = (start + end) // 2
        # print(start, end, tmp)
        if array[tmp] <= value:
            start = tmp
        else:
            end = tmp
        # print(start, end, tmp)
    return start


A, B, Q = map(int, input().split())
s_array = [int(input()) if i != 0 else -INF for i in range(A + 1)]
s_array.append(INF)
t_array = [int(input()) if i != 0 else -INF for i in range(B + 1)]
t_array.append(INF)
q_array = [int(input()) for i in range(Q)]

# print(s_array, t_array, q_array)

ans_array = []
for q in q_array:
    s_index = binary_search(s_array, q)
    t_index = binary_search(t_array, q)
    method_a = q - min(s_array[s_index], t_array[t_index])
    method_b = max(s_array[s_index + 1], t_array[t_index + 1]) - q
    method_c = (q - s_array[s_index]) + (t_array[t_index + 1] - q) + min(
        (q - s_array[s_index]), (t_array[t_index + 1] - q))
    method_d = (q - t_array[t_index]) + (s_array[s_index + 1] - q) + min(
        (q - t_array[t_index]), (s_array[s_index + 1] - q))
    ans_array.append(min(method_a, method_b, method_c, method_d))

for ans in ans_array:
    print(ans)

Buggy submission (verdict: Runtime Error):
INF = 10**11
from bisect import bisect

A, B, Q = map(int, input().split())
s_array = [int(input()) if i != 0 else -INF for i in range(A + 1)]
s_array.append(INF)
t_array = [int(input()) if i != 0 else -INF for i in range(B + 1)]
t_array.append(INF)
q_array = [int(input()) for i in range(Q)]

# print(s_array, t_array, q_array)

ans_array = []
for q in q_array:
    s_index = bisect(s_array, q)
    t_index = bisect(t_array, q)
    method_a = q - min(s_array[s_index], t_array[t_index])
    method_b = max(s_array[s_index + 1], t_array[t_index + 1]) - q
    method_c = (q - s_array[s_index]) + (t_array[t_index + 1] - q) + min(
        (q - s_array[s_index]), (t_array[t_index + 1] - q))
    method_d = (q - t_array[t_index]) + (s_array[s_index + 1] - q) + min(
        (q - t_array[t_index]), (s_array[s_index + 1] - q))
    ans_array.append(min(method_a, method_b, method_c, method_d))

for ans in ans_array:
    print(ans)
Problem p02697 (python)

Fixed submission:
from collections import deque

N,M = map(int, input().split())
N = 2 * M + 1

lis = [i for i in range(1,N+1)]
lis1 = deque(lis[:N//2+1])
lis2 = deque(lis[N//2+1:])
if M % 2 == 0:
    
    for i in range(M//2):
        a = lis1.popleft()
        b = lis1.pop()
        print(a,b)
    for i in range(M//2):
        a = lis2.popleft()
        b = lis2.pop()
        print(a,b)
else:
    for i in range(M//2+1):
        a = lis1.popleft()
        b = lis1.pop()
        print(a,b)
    for i in range(M//2):
        a = lis2.popleft()
        b = lis2.pop()
        print(a, b)

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

N,M = map(int, input().split())
N = 2 * M + 1

lis = [i for i in range(1,N+1)]
lis1 = deque(lis[:N//2+1])
lis2 = deque(lis[N//2+1:])
if M % 2 == 0:
    
    for i in range(M//2):
        a = lis1.popleft
        b = lis1.pop()
        print(a,b)
    for i in range(M//2):
        a = lis2.popleft
        b = lis2.pop()
        print(a,b)
else:
    for i in range(M//2+1):
        a = lis1.popleft
        b = lis1.pop()
        print(a,b)
    for i in range(M//2):
        a = lis2.popleft
        b = lis2.pop()
        print(a, b)
Problem p03457 (python)

Fixed submission:
N = int(input())

tprev = 0
xprev = 0
yprev = 0

result = 'Yes'

for i in range(N):
    t, x, y = map(int, input().split())

    xlen = abs(x - xprev)
    ylen = abs(y - yprev)
    
    time = t - tprev

    length = xlen + ylen

    if time%2 == length%2 and time >= length:
        tprev = t
        xprev = x
        yprev = y

    else:
        result = 'No'
        break
print(result)

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

tprev = 0
xprev = 0
yprev = 0

result = 'YES'

for i in range(N):
    t, x, y = map(int, input())

    xlen = x - xprev
    ylen = y - yprev
    
    time = t - tprev

    length = xlen + ylen

    if time%2 == length%2 and time >= length:
        tprev = t
        xprev = x
        yprev = y

    else:
        result = 'NO'
        break
print(result)
Problem p03682 (python)

Fixed submission:
import sys
import pprint
sys.path.append('C:\\ARIHON')

# from Kraskal import compute_mst_kruskal
# import UnionFind
import array
import collections
from operator import itemgetter

class UnionFind(object):
 
    def __init__(self, number_of_nodes):  # 初期化
        self.par = array.array("L", range(number_of_nodes))
        self.rank = array.array("L", (0 for i in range(number_of_nodes)))
 
    def root(self, node):  # 根を求める
        if self.par[node] == node:
            return node
        else:
            r = self.root(self.par[node])
            self.par[node] = r  # 経路圧縮
            return r
 
    def in_the_same_set(self, node1, node2):  # 同じ集合に属するか
        return self.root(node1) == self.root(node2)
 
    def unite(self, node1, node2):  # 属する集合を併合
        x = self.root(node1)
        y = self.root(node2)
        if x == y:
            pass
        elif self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
 
 
# Kruskal法により最小全域木を求める
def compute_mst_kruskal(max_v, edges):
    edges.sort(key=lambda edge: edge.weight)
    uf = UnionFind(max_v)
    mst = []
    for edge in edges:
        if not uf.in_the_same_set(edge.start, edge.end):
            uf.unite(edge.start, edge.end)
            mst.append(edge)
    return mst
 
Edge = collections.namedtuple("Edge", "start end weight")

def main():
    n = int(input())
    l = []
    for i in range(n):
        x,y = map(int,input().split())
        l.append((x,y,i))
    
    edges = []

    lxsort = sorted(l,key=itemgetter(0))
    for i in range(n-1):
        edges.append(Edge(lxsort[i][2],lxsort[i+1][2],lxsort[i+1][0]-lxsort[i][0]))
    
    lysort = sorted(l,key=itemgetter(1))
    for i in range(n-1):
        edges.append(Edge(lysort[i][2],lysort[i+1][2],lysort[i+1][1]-lysort[i][1]))
    
    mst = compute_mst_kruskal(n,edges)

    print(sum(edge.weight for edge in mst))
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import pprint
sys.path.append('C:\\ARIHON')

from Kraskal import compute_mst_kruskal
import UnionFind
import array
import collections
from operator import itemgetter
 
Edge = collections.namedtuple("Edge", "start end weight")

def main():
    n = int(input())
    l = []
    for i in range(n):
        x,y = map(int,input().split())
        l.append((x,y,i))
    
    edges = []

    lxsort = sorted(l,key=itemgetter(0))
    for i in range(n-1):
        edges.append(Edge(lxsort[i][2],lxsort[i+1][2],lxsort[i+1][0]-lxsort[i][0]))
    
    lysort = sorted(l,key=itemgetter(1))
    for i in range(n-1):
        edges.append(Edge(lysort[i][2],lysort[i+1][2],lysort[i+1][1]-lysort[i][1]))
    
    mst = compute_mst_kruskal(n,edges)

    print(sum(edge.weight for edge in mst))
 
if __name__ == '__main__':
    main()
Problem p04048 (python)

Fixed submission:
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

def solve(n,x):
    res = 3 * (n - gcd(n,x))
    return res



if __name__ == '__main__':
    n,x = map(int,input().split())
    print(solve(n,x))

Buggy submission (verdict: Runtime Error):
def milor(a,b):
    if a == b:
        return a
    if a > b:
        a,b = b,a
    return milor(b-a,a) + 2*a

def solve(n,x):
    res = n + milor(x,n-x)
    return res



if __name__ == '__main__':
    n,x = map(int,input().split())
    print(solve(n,x))
Problem p02614 (python)

Fixed submission:
  
import copy
from itertools import combinations
h, w, k = map(int, input().split())
c =[input() for i in range(h)]
ans = 0
y = []
for i in range(h):
    y.append(i)
x = []
for i in range(w):
    x.append(i)
for i in range(h+1):
    ty = list(combinations(y, i))
    for j in range(w+1):
        tx = list(combinations(x, j))
        for l in ty:
            for m in tx:
                cnt = 0
                for p in l:
                    for q in m:
                        if c[p][q] == '#':
                            cnt += 1
                if cnt == k:
                    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

h, w, k = map(int, input().split())
s = 0
l= []
for _ in range(h):
    a = list(map(int, input().split()))
    s += a.count("#")
    l.append(a)
if (k > s):
    print(0)
else:
    ans=0
    for pair in itertools.combinations([0, 1], h + w):
        hx = pair[:h]
        wx = pair[h + 1 :]
        if (sum(wx) == 0):
         ans=ans+1
    print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

h, w, k = map(int, input().split())
s = 0
l= []
for _ in range(h):
    a = list(map(int, input().split()))
    s += a.count("#")
    l.append(a)
if (k > s):
    print(0)
else:
    for pair in itertools.combinations([0, 1], h + w):
        hx = pair[:h]
        wx = pair[h + 1 :]
        if (sum(wx) == 0):
Problem p02681 (python)

Fixed submission:
b=input()
a=input()
# print(a[:-1])
if len(a)==(len(b)+1) and a[:-1]==b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,m,k=list(map(int,input().split()))
ans=0
curr=1
t=m-n+k+1
for i in range(n-k):
    curr=(curr*t)%998244353
    t+=1
t=m-n+k+1   
ans=max(0,curr)
for i in range(k+1):
    t-=1
    if t>0:
        curr=(curr*t)%998244353
    if curr>0:
        ans=(ans+curr)%998244353
print(ans)
Problem p02612 (python)

Fixed submission:
import math as m
money=int(input())
if(m.ceil(money/1000.0)==m.floor(money/1000.0)):
  print("0")
elif(m.ceil(money/1000.0)<m.floor(money/1000.0)):
  print(money%1000)
else:
  print(1000-(money%1000))

Buggy submission (verdict: Runtime Error):
money=int(input())
if(ceil(money/1000.0)==floor(money/1000.0)):
  print("0")
elif(ceil(money/1000.0)>floor(money/1000.0)):
  print(money%1000)
else:
  print(1000-(money%1000))
Problem p02641 (python)

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

d={}
for i in range(110):
    d[str(i)]=0
for i in range(110):
    d[str(-i)]=0
 
 
if xn[1]!=0:
    p = list(map(int, input().split()))
    
    for i in range(xn[1]):
        d[str(p[i])]=1
    for i in range(101):
        if d[str(xn[0]-i)]==0:
            miflag=1
            mi=i
            print(xn[0]-mi)
            break
        if d[str(xn[0]+i)]==0:
            maflag=1
            ma=i
            print(xn[0]+ma)
            break
else:
    print(xn[0])

Buggy submission (verdict: Runtime Error):
xn = list(map(int, input().split()))
d={}
for i in range(101):
    d[str(i)]=0
for i in range(101):
    d[str(-i)]=0


if xn[1]!=0:
    p = list(map(int, input().split()))
    for i in range(xn[1]):
        d[str(p[i])]=1
    for i in range(101):
        if d[str(xn[0]-i)]==0:
            miflag=1
            mi=i
            print(xn[0]-mi)
            break
        if d[str(xn[0]+i)]==0:
            maflag=1
            ma=i
            print(xn[0]+ma)
            break
else:
    print(xn[0])
Problem p02658 (python)

Fixed submission:
n=input()
a = list(map(int, input().split()))
ans=1
az=a.count(0)

if az>0:
    print(0)
else:
    for i in range(len(a)):
        ans*= a[i]
    
        if ans>=1000000000000000001:
            ans=-1
            break
    print(ans)

Buggy submission (verdict: Runtime Error):
n=input()
a = list(map(int, input().split()))
ans=1
az=a.index(0)

for i in range(len(a)):
    ans*= a[i]

    if az>0:
        ans=0
        break
    if ans>=1000000000000000001:
        ans=-1
        break

print(ans)

Buggy submission (verdict: Runtime Error):
n=input()
a = list(map(int, input().split()))
ans=1
a0=a.index(0)

for i in range(len(a)):
    ans*= a[i]

    if a0>0:
        ans=0
        break
    if ans>=1000000000000000001:
        ans=-1
        break

print(ans)
Problem p02718 (python)

Fixed submission:
nm = list(map(int, input().split()))
a = list(map(int, input().split()))
Sum=0
flag=0

for i in range(len(a)):
    Sum+=a[i]

a.sort(reverse=True)

for i in range(nm[1]):
    if a[i]<Sum/(4*nm[1]):
        flag=1
        break

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

Buggy submission (verdict: Runtime Error):
nm = list(map(int, input().split()))
a = list(map(int, input().split()))
Sum=0
flag=0

for i in range(len(a)):
    Sum+=a[i]

a.sort(reverse=True)

for i in range(nm[1]):
    if a[i]<sum/(4*nm[1]):
        flag=1
        break

if flag==1:
    print(No)
else:
    print(Yes)
Problem p02789 (python)

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

if i[0] == i[1]:
  print('Yes')
else:
  print('No')

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

if i[0] = i[1]:
  print('Yes')
else:
  print('No')
Problem p02841 (python)

Fixed submission:
# coding: utf-8
# Your code here!

one = input().split()

two = input().split()

if one[0] != two[0]:
    print(1)
else:
    print(0)

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

if B <= A *5:
    print(1)
else:
    print(0)
Problem p02628 (python)

Fixed submission:
from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

n, k = inpl()
p = inpl()
p = sorted(p)
ans = 0
for i in range(n):
    ans += p[i]
    if i+1 == k:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = inpl()
p = inpl()
p = sorted(p)
ans = 0
for i in range(n):
    ans += p[i]
    if i+1 == k:
        break
print(ans)