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

Fixed submission:
from heapq import heappop, heappush

N, M = map(int, input().split())
A = list(map(lambda x: (-1)*int(x), input().split()))

H = []

for i in A:
  heappush(H, i)

for _ in range(M):
  m = (-1) * heappop(H)
  m //= 2
  heappush(H, (-1)*m)

print((-1)*sum(H))

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

def rev():
  global A
  for i in range(N):
    a, b = A[-(2+i)], A[-(1+i)]
    if a > b:
      A[-(2+i)] = b
      A[-(1+i)] = a
    else:
      break

for _ in range(M):
  A[-1] = A[-1]//2
  rev()

print(sum(A))
Problem p02984 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = []

x1 = 0
for i in range(N):
  if i % 2 == 0:
    x1 += A[i]
  else:
    x1 -= A[i]

ans.append(x1)

for i in range(N-1):
  ans.append(2*A[i] - ans[i])

print(*ans)

Buggy submission (verdict: Runtime Error):
import scipy.linalg as linalg

N = int(input())
b = np.array(list(map(int, input().split())))

A = np.zeros(N**2).reshape(N, N)
for i in range(N):
    for j in range(N):
        if i == j or i+1 == j:
            A[i, j] = 1
        else:
            continue
A[N-1, 0] = 1
A = A / 2
A_inv = linalg.inv(A)

x = np.dot(A_inv, b)
print(*x)
Problem p02552 (python)

Fixed submission:
a = int(input())
print("1" if(a == 0) else "0")

Buggy submission (verdict: Runtime Error):
print(~input())
Problem p02580 (python)

Fixed submission:
from collections import Counter
H, W, M = [int(i) for i in input().split()]
g = set()
h = [0] * M
w = [0] * M
for i in range(M):
    h[i], w[i] = [int(j) for j in input().split()]
    g.add((h[i],w[i]))

ch = Counter(h)
cw = Counter(w)

chm = max(ch.values())
cwm = max(cw.values())
hi = [i for i in ch.keys() if ch[i] == chm]
wi = [i for i in cw.keys() if cw[i] == cwm]

for i in hi:
    for j in wi:
        if (i,j) not in g:
            print(ch[i] + cw[j])
            exit()
print(ch[hi[0]] + cw[wi[0]] - 1)

Buggy submission (verdict: Runtime Error):
from collections import Counter
H, W, M = [int(i) for i in input().split()]
g = [[0] * W for i in range(H)]
h = [0] * M
w = [0] * M
for i in range(M):
    h[i], w[i] = [int(j) for j in input().split()]
    g[h[i]-1][w[i]-1] = 1

ch = Counter(h)
cw = Counter(w)

hi = [i for i in ch.keys() if ch[i] == max(ch.values())]
wi = [i for i in cw.keys() if cw[i] == max(cw.values())]

for i in hi:
    for j in wi:
        if g[i-1][j-1] == 0:
            print(ch[i] + cw[j])
            exit()
print(ch[hi[0]] + cw[wi[0]] - 1)

Buggy submission (verdict: Runtime Error):
from collections import Counter
H, W, M = [int(i) for i in input().split()]
g = [[0] * W for i in range(H)]
h = [0] * M
w = [0] * M
for i in range(M):
    h[i], w[i] = [int(j) for j in input().split()]
    g[h[i]-1][w[i]-1] = 1

ch = Counter(h)
cw = Counter(w)

hi = [i for i in ch.keys() if ch[i] == max(ch.values())]
wi = [i for i in cw.keys() if cw[i] == max(cw.values())]

for i in hi:
    for j in wi:
        if g[i-1][j-1] == 0:
            print(ch[i] + cw[j])
            exit()
print(ch[hi[0]] + cw[wi[0]] - 1)

Buggy submission (verdict: Runtime Error):
from collections import Counter
H, W, M = [int(i) for i in input().split()]
g = [[0] * M for i in range(M)]
h = [0] * M
w = [0] * M
for i in range(M):
    h[i], w[i] = [int(j) for j in input().split()]
    g[h[i]-1][w[i]-1] = 1

ch = Counter(h)
cw = Counter(w)

hi = [i for i in ch.keys() if ch[i] == max(ch.values())]
wi = [i for i in cw.keys() if cw[i] == max(cw.values())]

for i in hi:
    for j in wi:
        if g[i-1][j-1] == 0:
            print(ch[i] + cw[j])
            exit()
print(ch[hi[0]] + cw[wi[0]] - 1)
Problem p02633 (python)

Fixed submission:
i = 1
x = int(input())
while True:
  if (360 * i) % x == 0:
    print(360 * i // x)
    break
  i += 1

Buggy submission (verdict: Runtime Error):
print(360 // input())
Problem p02659 (python)

Fixed submission:
from math import floor
a, b = [i for i in input().split()]
p = int(b[0] + b[2] + b[3])
print(int(a) * p // 100)

Buggy submission (verdict: Runtime Error):
from math import floor
a, b = [i for i in input().split()]
p = int(b[0] + b[2] + b[3])
print(a * p // 100)

Buggy submission (verdict: Runtime Error):
from math import floor
a, b = [float(i) for i in input().split()]
b = b * 100
p = int(str(b)[0])
q = int(str(b)[1])
r = int(str(b)[2])
print(floor(a * p + (a * q) / 10 + (a * r)/100))
Problem p02759 (python)

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

Buggy submission (verdict: Runtime Error):
print(int(input() + 1) // 2)
Problem p02771 (python)

Fixed submission:
a, b, c = input().split()
count = 0
if(a == b): count += 1
if(b == c): count += 1
if(c == a): count += 1

print("Yes" if(count == 1) else "No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s_list = [input() for i in range(n)]
s_set = set(s_list)
max = 0
max_elements = []
for i in s_set:
    c = s_list.count(i)
    if c > max:
        max = c
        max_elements = [i]
    if c == max and i not in max_elements:
        max_elements.append(i)

for i in sorted(max_elements):
    print(i)

Buggy submission (verdict: Runtime Error):
n = int(input())
s_list = [input() for i in range(n)]
s_set = set(s)
max = 0
max_elements = []
for i in s_set:
    c = s_list.count(i)
    if c > max:
        max = c
        max_elements = [i]
    if c == max and i not in max_elements:
        max_elements.append(i)

for i in sorted(max_elements):
    print(i)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split() if i % 2 == 0]
for i in a:
    if i % 3 != 0 and i % 5 != 0:
            print("DENIED")
            exit()
print("APPROVED")
Problem p02790 (python)

Fixed submission:
a, b = [i for i in input().split()]
print(max(int(a * int(b)), int(b * int(a))))

Buggy submission (verdict: Runtime Error):
a, b = [i for i in input().split()]
print(max(int(a * int(b)), int(b * int(a)))
Problem p02847 (python)

Fixed submission:
week = ['SUN','MON','TUE','WED','THU','FRI','SAT']
print(7 - week.index(input()))

Buggy submission (verdict: Runtime Error):
week = ['SUN','MON','TUE','WED','THU','FRI','SAT']
print(7 - index(input()))
Problem p03013 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)

n, m = [int(i) for i in input().split()]
fibo_l = [1] + [None] * n
a = set([int(input()) for i in range(m)])

def fibo(x):
    if x not in a and x >= 0:
            if fibo_l[x] is None:
                fibo_l[x] = fibo(x-1) % 1000000007 + fibo(x-2) % 1000000007
            return fibo_l[x]
    else: return 0
    
print(fibo(n) % 1000000007)

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
fibo_l = [1, 1] + [None] * (n + 100)
a = [int(input()) for i in range(m)]

def fibo(x):
    if x not in a and x >= 0:
            if fibo_l[x] is None:
                fibo_l[x] = fibo(x - 1) + fibo(x - 2)
            return fibo_l[x]
    else: return 0
    
print(fibo(n) % 1000000007)

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
fibo_l = [1, 1] + [None] * (n + 1)
a = [int(input()) for i in range(m)]

def fibo(x):
    if x not in a and x >= 0:
            if fibo_l[x] is None:
                fibo_l[x] = fibo(x - 1) + fibo(x - 2)
            return fibo_l[x]
    else: return 0
    
print(fibo(n) % 1000000007)

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
fibo_l = [1, 1] + [None] * (n - 1)
a = [int(input()) for i in range(m)]

def fibo(x):
    if x not in a and x >= 0:
            if fibo_l[x] is None:
                fibo_l[x] = fibo(x - 1) + fibo(x - 2)
            return fibo_l[x]
    else: return 0
    
print(fibo(n) % 1000000007)

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
fibo_l = [1, 1] + [None] * (n - 2)
a = [int(input()) for i in range(m)]

def fibo(x):
    if x not in a and x >= 0:
            if fibo_l[x] is None:
                fibo_l[x] = fibo(x - 1) + fibo(x - 2)
            return fibo_l[x]
    else: return 0
    
print(fibo(n) % 1000000007)

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
fibo_l = [1, 1] + [None] * n
a = [int(input()) for i in range(m)]

def fibo(x):
    if x not in a and x >= 0:
            if fibo_l[x] is None:
                fibo_l[x] = fibo(x - 1) + fibo(x - 2)
                return fibo_l[x]
            else: return fibo_l[x]
    else: return 0
    
print(fibo(n) % 1000000007)

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
fibo_l = [1, 1] + [None] * n
a = [int(input()) for i in range(m)]

def fibo(x):
    if x not in a and x >= 0:
            if fibo_l[x] is None:
                fibo_l[x] = fibo(x - 1) + fibo(x - 2)
                return fibo_l[x]
            else: return fibo_l[x]
    else: return 0
    
print(fibo(n) % 1_000_000_007)
Problem p03073 (python)

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

a = "10" * (n // 2) + ("1" if n % 2 == 1 else "")
b = "01" * (n // 2) + ("0" if n % 2 == 1 else "")

sum_a = 0
for i in range(n):
    if s[i] != a[i]: sum_a += 1

sum_b = 0
for i in range(n):
    if s[i] != b[i]: sum_b += 1

print(min(sum_a, sum_b))

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

a = "10" * (n // 2) + ("1" if n % 2 == 0 or n == 1 else "")
b = "01" * (n // 2) + ("0" if n % 2 == 0 or n == 1 else "")

sum_a = 0
for i in range(n):
    if s[i] != a[i]: sum_a += 1

sum_b = 0
for i in range(n):
    if s[i] != b[i]: sum_b += 1

print(min(sum_a, sum_b))
Problem p03135 (python)

Fixed submission:
t, x = [int(i) for i in input().split()]
print(t / x)

Buggy submission (verdict: Runtime Error):
t, x = [int(i)for i in input()]
print(t / x)
Problem p02580 (python)

Fixed submission:
import sys
H, W, M = map(int, input().split())
Hb = [0] * H
Wb = [0] * W
B = set()
for _ in range(M):
    h, w = map(int, input().split())
    Hb[h - 1] += 1
    Wb[w - 1] += 1
    B.add((h - 1, w - 1))
HB = max(Hb)
WB = max(Wb)
x = set()
y = set()
for i in range(H):
    if Hb[i] == HB:
        y.add(i)
for i in range(W):
    if Wb[i] == WB:
        x.add(i)
for i in y:
    for j in x:
        if (i, j) not in B:
            print(HB + WB)
            sys.exit()
print(HB + WB - 1)

Buggy submission (verdict: Runtime Error):
import sys
H, W, M = map(int, input().split())
Hb = [0] * H
Wb = [0] * W
B = [[0] * W for _ in range(H)]
for _ in range(M):
    h, w = map(int, input().split())
    Hb[h - 1] += 1
    Wb[w - 1] += 1
    B[h - 1][w - 1] = 1
HB = max(Hb)
WB = max(Wb)
BB = [0] * W
for i in range(H):
    if Hb[i] == HB:
        for j in range(W):
            if B[i][j] == 1:
                BB[j] = 1
for i in range(W):
    if Wb[i] == WB:
        if BB[i] == 0:
            print(HB + WB)
            sys.exit()
print(HB + WB - 1)

Buggy submission (verdict: Runtime Error):
import sys
H, W, M = map(int, input().split())
Hb = [0] * H
Wb = [0] * W
B = [[0] * W for _ in range(H)]
for _ in range(M):
    h, w = map(int, input().split())
    Hb[h - 1] += 1
    Wb[w - 1] += 1
    B[h - 1][w - 1] = 1
HB = max(Hb)
WB = max(Wb)
print(HB + WB)
BB = [0] * W
for i in range(H):
    if Hb[i] == HB:
        for j in range(W):
            if B[i][j] == 1:
                BB[j] = 1
for i in range(W):
    if Wb[i] == WB:
        if BB[i] == 0:
            print(HB + WB)
            sys.exit()
print(HB + WB - 1)

Buggy submission (verdict: Runtime Error):
import sys
H, W, M = map(int, input().split())
Hb = [0] * H
Wb = [0] * W
B = [[0] * W for _ in range(H)]
for _ in range(M):
    h, w = map(int, input().split())
    Hb[h - 1] += 1
    Wb[w - 1] += 1
    B[h - 1][w - 1] = 1
HB = max(Hb)
WB = max(Wb)
x = set()
y = set()
for i in range(H):
    if Hb[i] == HB:
        y.add(i)
for i in range(W):
    if Wb[i] == WB:
        x.add(i)
for i in y:
    for j in x:
        if B[i][j] == 0:
            print(HB + WB)
            sys.exit()
print(HB + WB - 1)
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
a.sort(reverse=True)
dp = [0] * (N + 1)
dp[0] = 1
if len(a) > 0:
    A = a.pop()
else:
    A = -1

if A == 1:
    dp[1] = 0
    if len(a) > 0:
        A = a.pop()
    if A == 2:
        dp[2] = 0
    else:
        dp[2] = 1
else:
    dp[1] = 1
for i in range(2, N + 1):
    if i == A:
        if len(a) > 0:
            A = a.pop()
        continue
    if dp[i - 1] != 0 and dp[i - 2] != 0:
        dp[i] = (dp[i - 1] + dp[i - 2])  % 1000000007
    elif dp[i - 1] != 0:
        dp[i] = dp[i - 1]  % 1000000007
    elif dp[i - 2] != 0:
        dp[i] = dp[i - 2]  % 1000000007
    else:
        dp[i] = 0
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
a.sort(reverse=True)
dp = [0] * (N + 1)
dp[0] = 1
A = a.pop()
if A == 1:
    dp[1] = 0
    A = a.pop()
    if A == 2:
        dp[2] = 0
    else:
        dp[2] = 1
else:
    dp[1] = 1
for i in range(2, N + 1):
    if i == A:
        if len(a) > 0:
            A = a.pop()
        continue
    if dp[i - 1] != 0 and dp[i - 2] != 0:
        dp[i] = (dp[i - 1] + dp[i - 2])  % 1000000007
    elif dp[i - 1] != 0:
        dp[i] = dp[i - 1]  % 1000000007
    elif dp[i - 2] != 0:
        dp[i] = dp[i - 2]  % 1000000007
    else:
        dp[i] = 0
print(dp[-1])
Problem p03775 (python)

Fixed submission:
N = int(input())
n = 10
for A in range(1, 100001):
    if N % A != 0:
        continue
    B = int(N / A)
    a = len(str(A))
    b = len(str(B))
    m = max(a, b)
    n = min(n, m)
print(n)

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

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

L = make_divisors(N)
l = len(L)
if l % 2 == 0:
    a1 = str(L[l // 2] - 1)
    a2 = str(L[l // 2])
    print(max(len(a1), len(a2)))
else:
    a1 = str(L[l // 2 - 1])
    a2 = str(L[l // 2])
    a3 = str(L[l // 2 + 1])
    print(max(len(a1), len(a2), len(a3)))
Problem p02577 (python)

Fixed submission:
n = int(input())

total = 0
n = str(n)
for i in range(len(n)):
    total += int(n[i])

if total % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
if n == 0:
    print('No')
    exit()

d = int(math.log10(n)+1)

total = 0
n = str(n)
for i in range(d):
    total += int(n[i])

if total % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
d = int(math.log10(n)+1)

total = 0
n = str(n)
for i in range(d):
    total += int(n[i])

if total % 9 == 0:
    print('Yes')
else:
    print('No')
Problem p02688 (python)

Fixed submission:
n, k = map(int, input().split())
n = list(map(str, range(1, n+1)))

for i in range(k):
    _ = input()
    a = input().split()
    for ai in a:
        for ni in n:
            if ai == ni:
                n.remove(ai)
print(len(n))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
n = list(map(str, range(1, n+1)))

for i in range(k):
    _ = input()
    a = input().split()
    for ai in a:
        n.remove(ai)
print(len(n))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
n = list(map(str, range(1, n+1)))

for i in range(k):
    _ = input()
    a = input().split()
    print(a)
    for ai in a:
        n.remove(ai)
print(len(n))
Problem p02729 (python)

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

def solve(n):
    if n == 0:
        return 1
    return n * solve(n - 1)

if n <= 1:
    n_ans = 0
else:
    n_ans = solve(n) // (solve(n - 2) * 2)
if m <= 1:
    m_ans = 0
else:
    m_ans = solve(m) // (solve(m - 2) * 2)
ans = n_ans + m_ans
print(ans)

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

def solve(n):
    if n == 0:
        return 1
    return n * solve(n - 1)

if n == 1:
    n_ans = 0
else:
    n_ans = solve(n) // (solve(n - 2) * 2)
if m == 1:
    m_ans = 0
else:
    m_ans = solve(m) // (solve(m - 2) * 2)
ans = n_ans + m_ans
print(ans)
Problem p02557 (python)

Fixed submission:
from collections import Counter, deque

(N,) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

freqA = Counter(A)
freqB = Counter(B)
for k in freqA.keys() & freqB.keys():
    if freqA[k] + freqB[k] > N:
        print("No")
        exit()

B = deque(B)
while True:
    rotate = 0
    for i in range(N):
        while A[(i + rotate) % N] == B[i]:
            rotate += 1
    bad = False
    B.rotate(rotate)
    for a, b in zip(A, B):
        if a == b:
            bad = True
    if not bad:
        break

print("Yes")
print(" ".join(map(str, B)))

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

(N,) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

freqA = Counter(A)
freqB = Counter(B)
for k in freqA.keys() & freqB.keys():
    if freqA[k] + freqB[k] > N:
        print("No")
        exit()

rotate = 0
for i in range(N):
    while A[(i + rotate) % N] == B[i]:
        rotate += 1
for i in range(N):
    while A[(i + rotate) % N] == B[i]:
        rotate += 1
for i in range(N):
    while A[(i + rotate) % N] == B[i]:
        rotate += 1
B = deque(B)
B.rotate(rotate)

for a, b in zip(A, B):
    if a == b:
        assert False
print("Yes")
print(" ".join(map(str, B)))
Problem p02769 (python)

Fixed submission:
from functools import lru_cache


CHECK = False

N, K = list(map(int, input().split()))

MOD = 10 ** 9 + 7


@lru_cache(maxsize=None)
def modInverse(a, p):
    # Fermat's little theorem, a**(p-1) = 1 mod p
    return pow(a, p - 2, p)


if N - 1 <= K or CHECK:
    fact = [1]
    for i in range(1, 2 * N + 1):
        fact.append((fact[-1] * i) % MOD)

    def nCr(n, r, p=MOD):
        # Modulo binomial coefficients
        return (fact[n] * modInverse(fact[r], p) * modInverse(fact[n - r], p)) % p


if N - 1 <= K:
    # Any combo is achievable so this is stars and bars
    # N people into N rooms, which means N - 1 dividers
    stars = N
    bars = N - 1
    print(nCr(stars + bars, bars))
else:
    # Group by number of empty rooms
    # With K moves there can only be at most K empty rooms
    # Max of N - 1 empty rooms in general
    assert K + 1 < N
    tot = 0
    comb1 = 1
    comb2 = 1
    for numEmpty in range(K + 1):
        way3 = comb1 * comb2
        if CHECK:
            numNonEmpty = N - numEmpty
            stars = numEmpty  # Everyone moving into an occupied room
            bars = numNonEmpty - 1  # Number of dividers
            way1 = nCr(stars + bars, bars) * nCr(N, numEmpty)

            way2 = nCr(N, numEmpty) * nCr(N - 1, numEmpty)

            assert way1 % MOD == way2 % MOD == way3 % MOD
        tot += way3

        j = numEmpty + 1
        invJ = modInverse(j, MOD)
        comb1 = (N + 1 - j) * comb1 * invJ % MOD
        comb2 = (N - j) * comb2 * invJ % MOD
    print(tot % MOD)

Buggy submission (verdict: Runtime Error):
from functools import lru_cache


CHECK = False

N, K = list(map(int, input().split()))

MOD = 10 ** 9 + 7


@lru_cache(maxsize=None)
def modInverse(a, p):
    # Fermat's little theorem, a**(p-1) = 1 mod p
    return pow(a, p - 2, p)


if CHECK:
    fact = [1]
    for i in range(1, 2 * N + 1):
        fact.append((fact[-1] * i) % MOD)

    def nCr(n, r, p=MOD):
        # Modulo binomial coefficients
        return (fact[n] * modInverse(fact[r], p) * modInverse(fact[n - r], p)) % p


if N - 1 <= K:
    # Any combo is achievable so this is stars and bars
    # N people into N rooms, which means N - 1 dividers
    stars = N
    bars = N - 1
    print(nCr(stars + bars, bars))
else:
    # Group by number of empty rooms
    # With K moves there can only be at most K empty rooms
    # Max of N - 1 empty rooms in general
    assert K + 1 < N
    tot = 0
    comb1 = 1
    comb2 = 1
    for numEmpty in range(K + 1):
        way3 = comb1 * comb2
        if CHECK:
            numNonEmpty = N - numEmpty
            stars = numEmpty  # Everyone moving into an occupied room
            bars = numNonEmpty - 1  # Number of dividers
            way1 = nCr(stars + bars, bars) * nCr(N, numEmpty)

            way2 = nCr(N, numEmpty) * nCr(N - 1, numEmpty)

            assert way1 % MOD == way2 % MOD == way3 % MOD
        tot += way3

        j = numEmpty + 1
        invJ = modInverse(j, MOD)
        comb1 = (N + 1 - j) * comb1 * invJ % MOD
        comb2 = (N - j) * comb2 * invJ % MOD
    print(tot % MOD)
Problem p02785 (python)

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

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = map(int, input().split())
H = H[:-K]
print(sum(H))
Problem p02594 (python)

Fixed submission:
if int(input())<30: print('No')
else: print('Yes')

Buggy submission (verdict: Runtime Error):
if(int(input())<30: print('No')
else: print('Yes')

Buggy submission (verdict: Runtime Error):
if int(input())<30: print('No')
  else: print('Yes')
Problem p02873 (python)

Fixed submission:
s = input()
l, count = [], 0
for i in s:
    if i=='>': count+=1
    else:
        if count: l.append(count)
        count = 0
if count: l.append(count); count = 0
j = 0
ans = []
if s[0]=='<': ans.append(0)
else:
    ans.append(l[0])
    l[0]-=1

for i in range(len(s)):
    if s[i]=='<': ans.append(ans[-1]+1)
    else:
        if i==0: ans.append(ans[-1]-1); continue
        if l[j]==0: j+=1
        if ans[-1]>=l[j]:
            l[j]-=1
            ans.append(l[j])
                
        else:
            ans[-1]=l[j]
            l[j]-=1
            ans.append(l[j])
print(sum(ans))

Buggy submission (verdict: Runtime Error):
s = input()
l, count = [], 0
for i in s:
    if i=='>': count+=1
    else:
        if count: l.append(count)
        count = 0
if count: l.append(count); count = 0
j = 0
ans = []
if s[0]=='<':
    ans.append(0)
    for i in range(len(s)):
    if s[i]=='<': ans.append(ans[-1]+1)
    else:
        if l[j]==0: j+=1
        if ans[-1]>=l[j]:
            l[j]-=1
            ans.append(l[j])
                
        else:
            ans[-1]=l[j]
            l[j]-=1
            ans.append(l[j])
    print(sum(ans))

else:
    ans.append(l[j])
    l[j]-=1
    for i in range(len(s)):
    if s[i]=='<': ans.append(ans[-1]+1)
    else:
        if l[j]==0: j+=1
        if j<len(l):
            
            if ans[-1]>=l[j]:
                ans.append(l[j])
                l[j]-=1
                
                    
            else:
                ans[-1]=l[j]
                ans.append(l[j])
                l[j]-=1
                
        else: ans.append(0)
    print(sum(ans))

Buggy submission (verdict: Runtime Error):
'''
    TC_1 : 0<2>1>0 : sum : 3
    TC_2 : 0<2>1>0>1<2<3>0<1<2<3<4<5>2>1>0<1 : sum : 28
'''
s = input()
l, count = [], 0
for i in s:
    if i=='>': count+=1
    else:
        if count: l.append(count)
        count = 0
if count: l.append(count); count = 0
j = 0
ans = []
if s[0]=='<': ans.append(0)
else:
    ans.append(l[j])
    l[j]-=1
for i in range(len(s)):
    if s[i]=='<': ans.append(ans[-1]+1)
    else:
        if l[j]==0: j+=1
        if ans[-1]>=l[j]:
            l[j]-=1
            ans.append(l[j])
                
        else:
            ans[-1]=l[j]
            l[j]-=1
            ans.append(l[j])
print(sum(ans))
Problem p02987 (python)

Fixed submission:
s = input()
s1 = set(s)
if len(s1)==2:
  if s.count(list(s1)[0])==2 and s.count(list(s1)[1])==2: print('Yes')
  else: print('No')
else: print('No')

Buggy submission (verdict: Runtime Error):
s = input()
s1 = set(input())
if len(s1)==2:
  if s.count(list(s1)[0])==2 and s.count(list(s1)[1])==2: print('YES')
  else: print('NO')
else: print('NO')
Problem p02771 (python)

Fixed submission:
if len(set(input().split()))==2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
if len(input().split().set())==2:
  print("Yes")
else:
  print("No")