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

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

from fractions import gcd
from functools import reduce

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcma = lcm_list(an)
ans = 0
for i in range(n):
    ans += (lcma//an[i])
mod=10**9+7
print(ans%mod)

Buggy submission (verdict: Runtime Error):
n = int(input())
an = list(map(int, input().split()))
import sys
sys.setrecursionlimit(100000000) 

from fractions import gcd
from functools import reduce

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcma = lcm_list(an)
bn = []
for a in an:
    bn.append(lcma / a)

sumbn = int(sum(bn) % 1000000007)

print(sumbn)

Buggy submission (verdict: Runtime Error):
n = int(input())
an = list(map(int, input().split()))
import sys
sys.setrecursionlimit(100000000000) 

from fractions import gcd
from functools import reduce

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcma = lcm_list(an)
bn = []
for a in an:
    bn.append(lcma / a)

sumbn = int(sum(bn) % 1000000007)

print(sumbn)

Buggy submission (verdict: Runtime Error):
n = int(input())
an = list(map(int, input().split()))
import sys
sys.setrecursionlimit(100000) 

from fractions import gcd
from functools import reduce

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcma = lcm_list(an)
bn = []
for a in an:
    bn.append(lcma / a)

sumbn = int(sum(bn) % 1000000007)

print(sumbn)

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


from fractions import gcd
from functools import reduce

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcma = lcm_list(an)
bn = []
for a in an:
    bn.append(lcma / a)

sumbn = int(int(sum(bn)) % 1000000007)

print(sumbn)

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


from fractions import gcd
from functools import reduce

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcma = lcm_list(an)
bn = []
for a in an:
    bn.append(lcma / a)

sumbn = int(sum(bn) % 1000000007)

print(sumbn)

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


from fractions import gcd
from functools import reduce

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcma = lcm_list(an)
bn = []
for a in an:
    bn.append(lcma / a)

sumbn = sum(bn) % 1000000007

print(sumbn)
Problem p02819 (python)

Fixed submission:
import math
n = int(input())
div = math.floor(math.sqrt(n))
def sosu(n):
    if n <= 1:
        return False
    for i in range(2,div+1):
        if n%i==0:
            return False
    return True
while True:
    if sosu(n):
        print(n)
        break
    else:
        n+=1

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
div = math.floor(math.sqrt(n))
while True:
  for i in range(2,div+1):
    if i == div+1:
      ans = n
      break
    if n%i==0:
      n+=1
      break
  break
print(ans)
Problem p03207 (python)

Fixed submission:
n = int(input())
arr = [0]*n
for i in range(n):
    arr[i]=int(input())
arr.sort()
ans = arr[-1]//2+sum(arr[:-1])
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = []
for i in range(n):
  arr[i]=int(input())
arr.sort()
ans = arr[-1]//2+sum(arr[:-1])
print(ans)
Problem p03315 (python)

Fixed submission:
s = input()
ans = 0
for i in s:
  if i == '+':
    ans += 1
  else:
    ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = int(input())
ans = 0
for i in s:
  if i == '+':
    ans += 1
  else:
    ans -= 1
print(ans)
Problem p03631 (python)

Fixed submission:
n = input()
if n[0]==n[2]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = input()
if n[0]=n[2]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = input()
if n[0]=n[2]:
  priint('Yes')
else:
  print('No')
Problem p03803 (python)

Fixed submission:
a,b = map(int,input().split())
if a==b:
  print('Draw')
elif a==1:
  print('Alice')
elif b==1:
  print('Bob')
elif a>b:
  print('Alice')
else:
  print('Bob')

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a==b:
  print('Draw')
elif a==1:
  print('Alice')
elif b==1:
  print('Bob')
elif a>b:
  print('Alice')
else b>a:
  print('Bob')
Problem p02990 (python)

Fixed submission:
from math import factorial

n, k = map(int, input().split(' '))

def binom_fac(n,k):
    return factorial(n) // (factorial(n-k) * factorial(k))

def f(n,k):
    if n < k:
        return 0
    if n == 0 & k == 0:
        return 1
    if k < 1:
        return 0
    
    return binom_fac(n-1, k-1)

for i in range(1,k+1):
    S = f(n-k, i-1) + 2 * f(n-k, i) + f(n-k, i+1)
    out = int(f(k, i) * S)
    
    print(out % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

n, k = map(int, input().split(' '))

def f(x,y):
    return comb(x-1, y-1)

for i in range(1,k+1):
    S = f(n-k, i-1) + 2 * f(n-k, i) + f(n-k, i+1)
    print(int(f(k, i) * S))
Problem p03013 (python)

Fixed submission:
# ABC 129, c
n, m = map(int, input().split())
dp = [0 for i in range(n+1)]
dp[0] = 1
dp[1] = 1
for j in [int(input()) for j in range(m)]:
    dp[j] = -1
for i in range(n + 1):
    if i < 2:
        if dp[i] == -1:
            dp[i] = 0
    else:
        if dp[i] == -1:
            dp[i] = 0
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % 1000000007
print(dp[n])

Buggy submission (verdict: Runtime Error):
# ABC 129, c
n, m = map(int, input().split())
dp = [int(el) for el in input().split(' ')]
dp[0] = 1
dp[1] = 1
for j in [int(input()) for j in range(m)]:
    dp[j] = -1
for i in range(n + 1):
    if i < 2:
        if dp[i] == -1:
            dp[i] = 0
    else:
        if dp[i] == -1:
            dp[i] = 0
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % 1000000007
print(dp[n])
Problem p03426 (python)

Fixed submission:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
INF = float("inf")
import sys
sys.setrecursionlimit(10000)

def manhattan(y1, x1, y2, x2): return abs(y1 - y2) + abs(x1 - x2)


def solve(H, W, D, A, query):
    num_pos = dict()
    for y in range(H):
        for x in range(W):
            num_pos[A[y][x]] = (y, x)

    dp = [None] * (H * W + 1)
    for i in range(1, D + 1):
        dp[i] = 0
        for j in range(i + D, len(dp), D):
            y1, x1 = num_pos[j - D]
            y2, x2 = num_pos[j]
            dp[j] = dp[j - D] + manhattan(y1, x1, y2, x2)

    for q in query:
        L, R = q
        print(dp[R] - dp[L])


def main():
    H, W, D = map(int, input().split())
    A = []
    for _ in range(H):
        A.append(list(map(int, input().split())))
    Q = int(input())
    query = []
    for _ in range(Q):
        query.append(list(map(int, input().split())))

    solve(H, W, D, A, query)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
INF = float("inf")
import sys
sys.setrecursionlimit(10000)

def manhattan(y1, x1, y2, x2): return abs(y1 - y2) + abs(x1 - x2)


def solve(H, W, D, A, query):
    num_pos = dict()
    for y in range(H):
        for x in range(W):
            num_pos[A[y][x]] = (y, x)

    dp = [None] * (H * W + 1)
    for i in range(1, D + 1):
        dp[i] = 0
        for j in range(i + D, len(dp), D):
            dp[j] = dp[j - D] + manhattan(*num_pos[j - D], *num_pos[j])

    for q in query:
        L, R = q
        print(dp[R] - dp[L])


def main():
    H, W, D = map(int, input().split())
    A = []
    for _ in range(H):
        A.append(list(map(int, input().split())))
    Q = int(input())
    query = []
    for _ in range(Q):
        query.append(list(map(int, input().split())))

    solve(H, W, D, A, query)


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

Fixed submission:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def main():
    N = int(input())
    a_list = list(map(int, input().split()))

    ans = 0
    state = None
    for i in range(N - 1):
        if a_list[i] == a_list[i + 1]:
            continue

        now = a_list[i] < a_list[i + 1]
        if state is None:
            state = now
            continue
        if state != now:
            ans += 1
            state = None

    print(ans + 1)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def main():
    N, M = map(int, input().split())
    graph = defaultdict(list)

    for _ in range(M):
        A, B = map(int, input().split())
        graph[A].append(B)
        graph[B].append(A)

    route = deque()
    used = set()
    route.appendleft(1)
    used.add(1)
    for n in graph[1]:
        route.append(n)
        used.add(n)
        break

    while True:
        start, end = route[0], route[-1]
        start_ok = True
        for n in graph[start]:
            if n not in used:
                start_ok = False
                route.appendleft(n)
                used.add(n)
                break

        end_ok = True
        for n in graph[end]:
            if n not in used:
                end_ok = False
                route.append(n)
                used.add(n)
                break

        if start_ok and end_ok:
            break

    print(len(route))
    print(*route, sep=" ")


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def main():
    N, M = map(int, input().split())
    graph = defaultdict(list)
    route = []
    for _ in range(M):
        A, B = map(int, input().split())
        if not route:
            route += [A, B]
        graph[A].append(B)
        graph[B].append(A)

    while True:
        start, end = route[0], route[-1]
        start_ok = True
        for n in graph[start]:
            if n not in route:
                start_ok = False
                route = [n] + route
                break

        end_ok = True
        for n in graph[end]:
            if n not in route:
                end_ok = False
                route.append(n)
                break

        if start_ok and end_ok:
            break

    print(len(route))
    print(*route, sep=" ")


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

Fixed submission:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def main():
    N = int(input())
    a_list = list(sorted(list(map(int, input().split()))))
    print(sum([a_list[-i * 2 - 2] for i in range(0, N)]))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache, reduce
from operator import xor
INF = float("inf")
sys.setrecursionlimit(10**7)

# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]


def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W


color, depth, graph = [], [], {}
def func(v, d, c):
    if not color[v]:
        color[v] = c
    if depth[v] >= d or d == 0:
        return

    for u in graph[v]:
        func(u, d - 1, c)


def main():
    global color, depth, graph
    N, M = map(int, input().split())
    graph = [[] for _ in range(N)]
    for _ in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        graph[a].append(b)
        graph[b].append(a)

    Q = int(input())
    q = []
    for _ in range(Q):
        v, d, c = map(int, input().split())
        q.append((v - 1, d, c))

    color = [0] * N
    depth = [0] * N
    for i in range(Q - 1, -1, -1):
        func(q[i][0], q[i][1], q[i][2])
    print(*color, sep="\n")

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

Fixed submission:
from collections import defaultdict
from fractions import Fraction

INF = int(1e14)


def main():
    N, Ma, Mb = map(int, input().split())
    l = []
    for _ in range(N):
        l.append(tuple(map(int, input().split())))

    ans = INF
    dp = [[[INF] * 401 for i in range(401)] for j in range(N + 1)]
    dp[0][0][0] = 0

    max_a, max_b = 1, 1
    for i in range(N):

        for a in range(max_a, -1, -1):
            for b in range(max_b, -1, -1):
                if dp[i][a][b] != INF:
                    dp[i + 1][a + l[i][0]][b + l[i][1]] = min(dp[i + 1][a + l[i][0]][b + l[i][1]], dp[i][a][b] + l[i][2])
                    dp[i + 1][a][b] = min(dp[i + 1][a][b], dp[i][a][b])

                    max_a = max(max_a, a + l[i][0])
                    max_b = max(max_b, b + l[i][1])

    for a in range(1, len(dp[0])):
        for b in range(1, len(dp[1])):
            if a * Mb == b * Ma:
                ans = min(ans, dp[N][a][b])

    print((-1 if ans == INF else ans))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from fractions import Fraction

memo = {}
gl_ans = 10 ** 10

def dfs(i, a, b, c):
    global gl_ans
    if a != 0 and b != 0 and Fraction(a, b) == Fraction(Ma, Mb):
        gl_ans = min(gl_ans, c)
        return c

    if i == N:
        return 10 ** 10

    if (i, a, b, c) in memo:
        return memo[(i, a, b)]

    if c > gl_ans:
        return 10 ** 10

    ans = dfs(i + 1, a + l[i][0], b + l[i][1], c + l[i][2])
    ans = min(ans, dfs(i + 1, a, b, c))

    memo[(i, a, b, c)] = ans

    return ans


if __name__ == '__main__':

    N, Ma, Mb = map(int, input().split())
    l = []
    for _ in range(N):
        a, b, c = map(int, input().split())
        l.append((a, b, c))

    s = dfs(0, 0, 0, 0)
    if s >= 10 ** 10:
        print(-1)
    else:
        print(s)
Problem p02659 (python)

Fixed submission:
A, B = input().split()
A = int(A)
B = float(B)
print(int(A*int(round(B*100))//100))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print((A*(B*100))//100)
Problem p03038 (python)

Fixed submission:
def cD():
    D = []
    for bc in BC:
        for i in range(bc[1]):
            D.append(bc[0])
            if len(D) > N:
                return D
    return D


N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
BC = []
for _ in range(M):
    b, c = map(int, input().split())
    BC.append([c, b])
BC.sort(reverse=True)
D = cD()
for i in range(min(len(A), len(D))):
    if A[i] < D[i]:
        A[i] = D[i]
    else:
        break
print(sum(A))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
D = []
for _ in range(M):
    b, c = map(int, input().split())
    for i in range(b):
        D.append(c)
D.sort(reverse=True)
for i in range(len(A)):
    if A[i] < D[i]:
        A[i] = D[i]
    else:
        break
print(sum(A))
Problem p03127 (python)

Fixed submission:
import fractions
n = int(input())
a_list = list(map(int, input().split()))
num = a_list[0]

for i in range(n):
    num = fractions.gcd(num, a_list[i])
print(num)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a_list = list(map(int, input().split()))
num = a_list[0]

for i in range(n):
    num = math.gcd(num, a_list[i])
print(num)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int, input().split()))
num = a_list[0]

for i in range(n):
    num = math.gcd(num, a_list[i])
print(num)
Problem p03208 (python)

Fixed submission:
n, k = map(int, input().split())
h = [int(input()) for _ in range(n)]
h.sort()
min = h[k-1] - h[0]
for i in range(len(h)-k+1):
    dif = h[i+k-1] - h[i]
    if dif < min:
        min = dif
print(min)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = [int(input()) for _ in range(n)]
h.sort()
min = h[k-1] - h[0]
for i in range(len(h)-k+1):
    dif = h[i+k-1] - h[i]
    if t < min:
        min = t
print(min)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = [int(input()) for _ in range(n)]
h.sort()
min = '100000'
for i in range(len(h)-k+1):
    if h[i+k-1] - h[i] < min:
        min = h[i+k-1] - h[i]
print(min)
Problem p03317 (python)

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

ans = 1
N = N - K
ans += ceil(N/(K-1))
print(ans)

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

ans = 0
if index != 0:
    p = index - K + 1
    ans += 1
    if p < 0:
        index = index + (-1 * p)
    elif p > 0:
        while p > 0:
            p = p - K + 1
            ans += 1
if index < (N - 1):
    ans += 1
    index = index + K - 1
    while index < (N - 1):
        index = index + K - 1
        ans += 1

print(ans)
Problem p02596 (python)

Fixed submission:
K = int(input())
a1 = 7
ai = 0
for i in range(K + 1):
  if i == 0:
    ai = a1 % K
  else:
    ai = (ai * 10 + 7) % K
  if ai == 0:
    break
else:
    i = -2
print(i + 1)

Buggy submission (verdict: Runtime Error):
K = int(input())
a1 = 7
ai = 0
for i in range(K + 1):
        ai = a1 % K
        a1 = (a1 * 10 + 7)
    if ai == 0:
        break
 
print(i + 1)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
A,B = map(str, input().split())
A = int(A)
B = Decimal(B)
print(int(A * B))

Buggy submission (verdict: Runtime Error):
from decimal import *
A, B = map(float, input().split())
B = int(B * 100)
A = int(A)
ans = A * B
ans = // 10
ans = // 10
print(ans)
Problem p02707 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(N-1):
  ans[A[i] - 1] += 1
for i in range(N):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
import math
R, G, B, N = map(int, input().split())
ans = 0
cr = math.ceil(N/R)
cg = math.ceil(N/G)
cb = math.ceil(N/B)
for i in range(cr + 1):
    for j in range(cg + 1):
        tmp =  i * R + j * G
        if N - tmp >= 0 and (N - tmp) % B == 0:
           ans += 1
        elif N - tmp < 0:
          break
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(N):
  ans[A[i] - 1] += 1
for i in range(N):
  print(ans[i])
Problem p02753 (python)

Fixed submission:
S = input()
if S[0] == S[1] and S[1] == S[2] :
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
import sys
S = input()
Q = int(input())
pin = 0
for i in range(Q):
  t = list(sys.stdin.readline().split())
  if int(t[0]) == 1:
    if pin == 1:
      pin = 0
    else:
      pin = 1
  else:
    if int(t[1]) % 2 == pin :
      S = S + t[2]
    else:
      S = t[2] + S
if pin == 1:
  S = S[::-1]
print(S)
Problem p02773 (python)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
S.sort()
maxi = 0
tmp = 1
ans = []
for i in range(N-1):
  if S[i] == S[i+1]:
    tmp += 1
  else:
    if tmp > maxi:
      maxi = tmp
      ans.clear()
      ans.append(S[i])
    elif tmp == maxi:
      ans.append(S[i])
    tmp = 1
  if i == N-2:
      if S[i] == S[i+1]:
        if tmp > maxi:
          maxi = tmp
          ans.clear()
          ans.append(S[i])
        elif tmp == maxi:
          ans.append(S[i])
      else:
        if maxi == 1:
          ans.append(S[N-1])
for i in range(len(ans)):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]
S.sort()
maxi = 0
ans = []
total_count = 0
while total_count != N:
  tmp = S.count(S[total_count])
  total_count += tmp
  if maxi < tmp:
    maxi = tmp
    ans.clear()
    ans.append(S[total_count])
  elif maxi == tmp:
    ans.append(S[total_count])
for i in range(len(ans)):
  print(ans[i])
Problem p02779 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = "YES"
for i in range(1,N):
    if A[i-1] == A[i]:
        ans = "NO"
        break
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 'YES'
for i in range(N-1):
  if a[i] == a[i+1]:
    ans = 'NO'
    break
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 'YES'
for i in range(n-1):
  if a[i] == a[i+1]:
    ans = 'NO'
    break
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
def yabaton(A):
  for i in range(0,n-1):
    for j in range(i+1,n):
      if A[i] == A[j]:
        return 'NO'
  return 'YES'
yabaton(A)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
for i in range(0,n-1):
  for j in range(i+1,n):
    if A[i] == A[j]:
      return 'NO'
return 'YES'

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
for i in range(0,n-1):
  for j in range(i+1,n):
    if A[i] != A[j]:
      return 'NO'
return 'YES'
Problem p02785 (python)

Fixed submission:
N, K = map(int,input().split())
H = list(map(int,input().split()))
if K >= N:
  print(0)
else:
  H.sort()
  print(sum(H[0:N-K]))

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
H = list(map(int,input().split()))
if K >= N:
  print(0)
else:
  H.sort
  print(sum(H[0:N-K])