Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(x) for x in input().split()]

cumsum = [0] * N
cumsum[0] = a[0]
for i in range(1, N):
    cumsum[i] = cumsum[i-1] + a[i]

dp = [[0] * N for _ in range(N)]

for j in range(1, N):
    for i in range(N-1):
        if i + j >= N:
            break
        minimum = float('inf')
        for k in range(j):
            #print('i:',i,' j:',j,' k:',k,' i+k:',i+k,' j-k:',j-k)
            temp = dp[i][k] + dp[i+k+1][j-k-1]
            if minimum > temp:
                minimum = temp
        dp[i][j] = minimum + (cumsum[i+j] - cumsum[i-1] if i > 0 else cumsum[i+j])

print(dp[0][N-1])

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]

cumsum = [0] * N
cumsum[0] = a[0]
for i in range(1, N):
    cumsum[i] = cumsum[i-1] + a[i]

dp = [[0] * N for _ in range(N)]

for j in range(1, N):
    for i in range(N-1):
        if i + j >= N:
            break
        minimum = float('inf')
        for k in range(j):
            #print('i:',i,' j:',j,' k:',k,' i+k:',i+k,' j-k:',j-k)
            temp = dp[i][k] + dp[i+k+1][j-k-1]
            if minimum > temp:
                minimum = temp
        dp[i][j] = minimum + (cumsum[i+j] - cumsum[i-1] if i > 0 else cumsum[i+j])

print(dp[0][N-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
h = [int(x) - 1 for x in input().split()]
a = [int(x) for x in input().split()]

l2N = 0
n = N
while n > 1:
    n = -(-n//2)
    l2N += 1
N = 2**l2N

seg = [0] * (2 * 2**l2N - 1)

def update(H, x):
    H += 2**l2N - 1
    seg[H] = x
    while H > 0:
        H = (H - 1) // 2
        seg[H] = max(seg[H*2+1], seg[H*2+2])

def maxSrch(a, b, k, l, r):
    if r <= a or b <= l:
        return 0
    if a <= l and r <= b:
        return seg[k]
    else:
        vl = maxSrch(a, b, k*2+1, l, (l+r)//2)
        vr = maxSrch(a, b, k*2+2, (l+r)//2, r)
        return max(vl, vr)

for H,A in zip(h,a):
    update(H, maxSrch(0,H,0,0,N) + A)
print(seg[0])

Fixed submission:
N = int(input())
h = [int(x) - 1 for x in input().split()]
a = [int(x) for x in input().split()]

l2N = 0
n = N
while n > 1:
    n = -(-n//2)
    l2N += 1
N = 2**l2N

seg = [0] * (2 * 2**l2N - 1)

def update(H, x):
    H += 2**l2N - 1
    seg[H] = x
    while H > 0:
        H = (H - 1) // 2
        seg[H] = max(seg[H*2+1], seg[H*2+2])

def maxSrch(a, b, k, l, r):
    if r <= a or b <= l:
        return 0
    if a <= l and r <= b:
        return seg[k]
    else:
        vl = maxSrch(a, b, k*2+1, l, (l+r)//2)
        vr = maxSrch(a, b, k*2+2, (l+r)//2, r)
        return max(vl, vr)

for H,A in zip(h,a):
    update(H, maxSrch(0,H,0,0,N) + A)
print(seg[0])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
h = [int(x) - 1 for x in input().split()]
a = [int(x) for x in input().split()]

dp = [0] * N
for i,j in zip(h,a):
    if i == 0:
        dp[i] = j
    else:
        dp[i] = max(dp[0:i]) + j
print(max(dp))

Fixed submission:
N = int(input())
h = [int(x) - 1 for x in input().split()]
a = [int(x) for x in input().split()]

l2N = 0
n = N
while n > 1:
    n = -(-n//2)
    l2N += 1
N = 2**l2N

seg = [0] * (2 * 2**l2N - 1)

def update(H, x):
    H += 2**l2N - 1
    seg[H] = x
    while H > 0:
        H = (H - 1) // 2
        seg[H] = max(seg[H*2+1], seg[H*2+2])

def maxSrch(a, b, k, l, r):
    if r <= a or b <= l:
        return 0
    if a <= l and r <= b:
        return seg[k]
    else:
        vl = maxSrch(a, b, k*2+1, l, (l+r)//2)
        vr = maxSrch(a, b, k*2+2, (l+r)//2, r)
        return max(vl, vr)

for H,A in zip(h,a):
    update(H, maxSrch(0,H,0,0,N) + A)
print(seg[0])
Buggy python submission (verdict: Time Limit Exceeded):
D, G = [int(i) for i in input().split()]
pc = [list(map(lambda x: int(x), input().split())) for i in range(D)]
pc.insert(0,[])
ans = float('inf')

def f(score, i, kaitousu):
	global ans
	if i <= D:
		for j in range(pc[i][0] + 1):
			if j == pc[i][0]:
				newScore = score + 100 * i * j + pc[i][1]
			else:
				newScore = score + 100 * i * j
			newKaitousu = kaitousu + j
			if newScore >= G:
				if newKaitousu < ans:
					ans = newKaitousu
				break
			else:
				f(newScore, i + 1, newKaitousu)

f(0, 1, 0)
print(ans)

Fixed submission:
D, G = map(int, input().split())
P = [0]
C = [0]
ans = 0
for _ in range(D):
    p, c = map(int, input().split())
    P.append(p)
    C.append(c)
    ans += p

for i in range(1<<D):
    point = 0
    count = 0
    for j in range(D, 0, -1):
        if i>>j-1&1:
            point += j * 100 * P[j] + C[j]
            count += P[j]
    for k in range(D, 0, -1):
        if not i>>k-1&1 and P[k] > 1:
            for _ in range(P[k]-1):
                if point < G:
                    point += k * 100
                    count += 1
                else:
                    break
            if point >= G:
                ans = min(ans, count)
            break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
C = []
S = []
F = []

for _ in range(N - 1):
	tmp = list(map(int, input().split()))
	C.append(tmp[0])
	S.append(tmp[1])
	F.append(tmp[2])

def func(i, t):
	if i == N - 1:
		return t
	else:
		T = S[i]
		while T < t:
			T += F[i]
		return func(i + 1, T + C[i])

for i in range(N):
	print(func(i, 0))

Fixed submission:
N = int(input())
C = []
S = []
F = []

for _ in range(N - 1):
	tmp = list(map(int, input().split()))
	C.append(tmp[0])
	S.append(tmp[1])
	F.append(tmp[2])

for i in range(N):
	t = 0
	for j in range(i, N - 1):
		if t < S[j]:
			t = S[j]
		elif t % F[j] != 0:
			t += F[j] - (t % F[j])
		t += C[j]
	print(t)
Buggy python submission (verdict: Runtime Error):
array = [int(i) for i in list(input())]
flag = False
fugou = ['+', '-']

for i in fugou:
	if i == '+':
		tmp = array[0] + array[1]
	else:
		tmp = array[0] - array[1]
	for j in fugou:
		if j == '+':
			tmp2 = tmp + array[2]
		else:
			tmp2 = tmp - array[2]
		for k in fugou:
			if k == '+':
				if tmp2 + array[3] == 7:
					print(str(array[0])
							+ i + str(array[1])
							+ j + str(array[2])
							+ k + str(array[3]))
							+ '=7')
					flag = True
					break
			else:
				if tmp2 - array[3] == 7:
					print(str(array[0])
							+ i + str(array[1])
							+ j + str(array[2])
							+ k + str(array[3])
							+ '=7')
					flag = True
					break
		if flag: break
	if flag: break

Fixed submission:
array = [int(i) for i in list(input())]
flag = False
fugou = ['+', '-']

for i in fugou:
	if i == '+':
		tmp = array[0] + array[1]
	else:
		tmp = array[0] - array[1]
	for j in fugou:
		if j == '+':
			tmp2 = tmp + array[2]
		else:
			tmp2 = tmp - array[2]
		for k in fugou:
			if k == '+':
				if tmp2 + array[3] == 7:
					print(str(array[0])
							+ i + str(array[1])
							+ j + str(array[2])
							+ k + str(array[3])
							+ '=7')
					flag = True
					break
			else:
				if tmp2 - array[3] == 7:
					print(str(array[0])
							+ i + str(array[1])
							+ j + str(array[2])
							+ k + str(array[3])
							+ '=7')
					flag = True
					break
		if flag: break
	if flag: break
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [[int(x) for x in input().split()] for _ in range(N)]

flag = True
for k in range(N):
	for i in range(N):
		for j in range(i):
			if A[i][j] > A[i][k] + A[k][j]:
				flag = False
				break
		if not flag:
			break
	if not flag:
		break

ans = 0
if flag:
	for i in range(N):
		for j in range(i):
			flag = True
			for k in range(N):
				if k != i and k != j:
					if A[i][j] == A[i][k] + A[k][j]:
						flag = False
						break
			if flag:
				ans += A[i][j]
	print(ans)
else:
	print(-1)

Fixed submission:
N = int(input())
A = [[int(x) for x in input().split()] for _ in range(N)]

flag = True
for k in range(N):
	for i in range(N):
		for j in range(i):
			if A[i][j] > A[i][k] + A[k][j]:
				flag = False
				break
		if not flag:
			break
	if not flag:
		break

ans = 0
if flag:
	for i in range(N):
		for j in range(i):
			flag = True
			for k in range(N):
				if k != i and k != j:
					if A[i][j] == A[i][k] + A[k][j]:
						flag = False
						break
			if flag:
				ans += A[i][j]
	print(ans)
else:
	print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

S = []

for _ in range(N):
	A = int(input())
	if A in S:
		S.remove(A)
	else:
		S.append(A)

print(len(S))

Fixed submission:
N = int(input())

S = set()

for _ in range(N):
	A = int(input())
	if A in S:
		S.remove(A)
	else:
		S.add(A)

print(len(S))
Buggy python submission (verdict: Runtime Error):
from collections import deque
N, M = map(int, input().split())

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

visited = [False for _ in range(N)]
ans = deque()

def dfs(p, one):
    if visited[p]:
        return False
    visited[p] = True
    for i in E[p]:
        if dfs(i, one):
            break
    if one:
        ans.appendleft(p+1)
    else:
        ans.append(p+1)
    return True

dfs(0, True)
for i in E[0]:
    if dfs(i, False):
        break

print(len(ans))
for i in ans:
    print(i)

Fixed submission:
import sys
sys.setrecursionlimit(100005)

N, M = map(int, input().split())

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

visited = [False for _ in range(N)]
ans = []

def dfs(p, one):
    if visited[p]:
        return False
    visited[p] = True
    if not one:
        ans.append(p+1)
    for i in E[p]:
        if dfs(i, one):
            break
    if one:
        ans.append(p+1)
    return True

dfs(0, True)
for i in E[0]:
    if dfs(i, False):
        break
print(len(ans))
for i in ans:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(x) for x in input().split()]
lines = [input().split() for _ in range(M)]

ans = ['1']

while(True):
	start = ans[0]
	for i in range(M):
		for j in range(2):
			if lines[i][j] == start:
				if j == 0:
					n = 1
				else:
					n = 0
				if lines[i][n] not in ans:
					ans.insert(0,lines[i][n])
					break
		if start != ans[0]:
			break
	if start == ans[0]:
		break

while(True):
	end = ans[len(ans) - 1]
	for i in range(M):
		for j in range(2):
			if lines[i][j] == end:
				if j == 0:
					n = 1
				else:
					n = 0
				if lines[i][n] not in ans:
					ans.append(lines[i][n])
					break
		if end != ans[len(ans) - 1]:
			break
	if end == ans[len(ans) - 1]:
		break

print(len(ans))
for i in range(len(ans)):
	print(ans[i],end='')
	if i < len(ans) - 1:
		print(' ',end='')
	else:
		print()


Fixed submission:
import sys
sys.setrecursionlimit(100005)

N, M = map(int, input().split())

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

visited = [False for _ in range(N)]
ans = []

def dfs(p, one):
    if visited[p]:
        return False
    visited[p] = True
    if not one:
        ans.append(p+1)
    for i in E[p]:
        if dfs(i, one):
            break
    if one:
        ans.append(p+1)
    return True

dfs(0, True)
for i in E[0]:
    if dfs(i, False):
        break
print(len(ans))
for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
#include<iostream>
#include <string>
using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	
	string A[55];
	string B[55];
	
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}
	for(int j = 0; j < M; j++){
		cin >> B[j];
	}
	
	bool judge = false;
	
	for(int i = 0; i < N - M + 1; i++){
		for(int j = 0; j < N - M + 1; j++){
			for(int k = 0; k < M; k++){
				if(B[k] != A[i + k].substr(j, M)){
					break;
				}
				if(k == M - 1){
					judge = true;
				}
			}
		}
	}
	if(judge){
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}


Fixed submission:
N, M = [int(x) for x in input().split()]

A = []
B = []

for _ in range(N):
	A.append(input())

for _ in range(M):
	B.append(input())

judge = False
	
for i in range(N - M + 1):
	for j in range(N - M + 1):
		for k in range(M):
			if B[k] != A[i + k][j: j + M]:
				break
			if k == M - 1:
				judge = True

if judge:
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 10**19

for i in itertools.permutations(p,k):
    s = sum(i)
    if s < ans:
        ans = s

print(ans)

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

q = sorted(p)

print(sum(q[:k]))
Buggy python submission (verdict: Time Limit Exceeded):

n,m = map(int,input().split())
h = list(map(int,input().split()))
x = []
ab = []
c = 0
for i in range(m):
    ab.extend(list(map(int,input().split())))
for j in range(n):
    p = ab.count(j+1)
    if p == 0:
        x[len(x):len(x)] = [0]
    else:
        x[len(x):len(x)] = [p]
for k in range(m):
    if h[(ab[2*k+1])-1] - h[(ab[2*k])-1] > 0:
        x[(ab[2*k+1])-1] -= 1
    elif h[(ab[2*k])-1] - h[(ab[2*k+1])-1] > 0:
        x[(ab[2*k])-1] -= 1

for l in range(len(x)):
    if x[l] == 0:
        c += 1

print(c)

Fixed submission:
n,m = map(int,input().split())
h = list(map(int,input().split()))
target = [0 for _ in range(n)]
win = [0 for _ in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    target[a-1] += 1
    target[b-1] += 1
    if h[a-1] > h[b-1]:
        win[a-1] += 1
    elif h[b-1] > h[a-1]:
        win[b-1] += 1

count = 0
for j in range(n):
    if target[j] == win[j]:
        count += 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

for i in range(1,n+1):
    print(a.count(i))

Fixed submission:
import collections
n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
for i in range(1,n+1):
    print(c[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

for i in range(n):
    print(a.count(i+1))

Fixed submission:
import collections
n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
for i in range(1,n+1):
    print(c[i])
Buggy python submission (verdict: Time Limit Exceeded):
import math
k = int(input())
s = 0
for i in range(k):
    a = i+1
    for j in range(k):
        b = j+1
        for l in range(k):
            c = l+1
            s += math.gcd(math.gcd(a,b),c)

print(s)

Fixed submission:
import math
k = int(input())
s = 0
for i in range(k):
    a = i+1
    for j in range(k):
        b = j+1
        for l in range(k):
            c = l+1
            s += math.gcd(math.gcd(a,b),c)

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n,k = map(int,input().split())
m = n
c = 0
r = True
if n%k == 0:
    print(0)
    sys.exit()
while r == True:
    if k >= 2*m:
        r = False
    elif k >= m:
        c += 1
        r = False
    else:
        c += 1
        m -= k

print(abs(n-(c*k)))

Fixed submission:
n,k = map(int,input().split())
a = [n%k,abs(n%k-k)]
print(min(a))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n,k = map(int,input().split())
m = n
c = 0
r = True
while r == True:
    if k >= 2*m:
        r = False
    elif k >= m:
        c += 1
        r = False
    else:
        c += 1
        m -= k

print(abs(n-(c*k)))

Fixed submission:
n,k = map(int,input().split())
a = [n%k,abs(n%k-k)]
print(min(a))
Buggy python submission (verdict: Runtime Error):
k = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(k[input()-1])

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
p = [i+j for i in a for j in b]
for _ in range(M):
    x,y,c = map(int,input().split())
    p.append(a[x-1]+b[y-1]-c)

print(min(p))

Fixed submission:
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
p = [min(a) + min(b)]
for _ in range(M):
    x,y,c = map(int,input().split())
    p.append(a[x-1]+b[y-1]-c)

print(min(p))

Buggy python submission (verdict: Time Limit Exceeded):
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
p = []
for _ in range(M):
    x,y,c = map(int,input().split())
    p.append(a[x-1]+b[y-1]-c)
for i in range(A):
    for j in range(B):
        p.append(a[i]+b[j])
print(min(p))

Fixed submission:
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
p = [min(a) + min(b)]
for _ in range(M):
    x,y,c = map(int,input().split())
    p.append(a[x-1]+b[y-1]-c)

print(min(p))
Buggy python submission (verdict: Runtime Error):
s = [input()]
q = int(input())

for _ in range(q):
    a = list(input().split())
    if len(a) == 1:
        s.reverse()
    else:
        if a[1] == "1":
            s.reverse()
            s += a[-1]
            s.reverse()
        else:
            s += a[-1]
print("".join(s))

Fixed submission:
s = list(input())
if s[0] == s[1] and s[1] == s[2]:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
n,r=map(int,input().split())

if n=>10:
  print(r)
else:
  print(r+1000-100*n)


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

if n>=10:
  print(r)
else:
  print(r+1000-100*n)

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

if n=>10:
  print(r)
else:
  print(r+10000-100*n)

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

if n>=10:
  print(r)
else:
  print(r+1000-100*n)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split(" "))
if a == b:
    if a == c:
        print("No")
    else:
        print("Yes")
else
    if b == c:
        print("Yes")
    else:
        if a == c:
            print("Yes")
        else:
            print("No")

Fixed submission:
a,b,c = map(int,input().split(" "))
if a == b:
    if a == c:
        print("No")
    else:
        print("Yes")
else:
    if b == c:
        print("Yes")
    else:
        if a == c:
            print("Yes")
        else:
            print("No")
Buggy python submission (verdict: Runtime Error):
s,t=input().split(" ")
a,b.=map(int,input().split(" "))
u=input()
 
if s==u:
  print(a-1, b)
else:
  print(a, b-1)

Fixed submission:
s,t=input().split(" ")
a,b=map(int,input().split(" "))
u=input()
 
if s==u:
  print(a-1, b)
else:
  print(a, b-1)

Buggy python submission (verdict: Runtime Error):
s,t=input().split(" ")
a,b.=map(int,input().split(" "))
u=input()
 
if s==u:
  print(int(a-1)" "int(b))
else:
  print(int(a)" "int(b-1))

Fixed submission:
s,t=input().split(" ")
a,b=map(int,input().split(" "))
u=input()
 
if s==u:
  print(a-1, b)
else:
  print(a, b-1)

Buggy python submission (verdict: Runtime Error):
s,t=input().split(" ")
a,b.=map(int,input().split(" "))
u=input()
 
if s==u:
  print(a-1,b.split(" "))
else:
  print(a,b-1.split(" "))

Fixed submission:
s,t=input().split(" ")
a,b=map(int,input().split(" "))
u=input()
 
if s==u:
  print(a-1, b)
else:
  print(a, b-1)

Buggy python submission (verdict: Runtime Error):
s,t=input().split(" ")
a,b.=map(int,input().split(" "))
u=input()

if s==u:
  print(a-1,b)
else:
  print(a,b-1)

Fixed submission:
s,t=input().split(" ")
a,b=map(int,input().split(" "))
u=input()
 
if s==u:
  print(a-1, b)
else:
  print(a, b-1)

Buggy python submission (verdict: Runtime Error):
s,t=input().split()
a,b=map(int,input().split())
u=str(input())

if s==u:
  print(a-1 b)
else:
  print(a b-1)

Fixed submission:
s,t=input().split(" ")
a,b=map(int,input().split(" "))
u=input()
 
if s==u:
  print(a-1, b)
else:
  print(a, b-1)

Buggy python submission (verdict: Runtime Error):
s,t=map(str,input().split(" "))
a,b=map(int,input().split(" "))
u=str(input())

if s==u:
  print(a-1" "b)
else:
  print(a" "b-1)

Fixed submission:
s,t=input().split(" ")
a,b=map(int,input().split(" "))
u=input()
 
if s==u:
  print(a-1, b)
else:
  print(a, b-1)
Buggy python submission (verdict: Runtime Error):
h,a = map(int,input().split())
b = h/a
if b%1 = 0:
    print(b)
elif b%1 < 0:
    print(1)
else:
    print(b//1)

Fixed submission:
h,a = map(int,input().split())
n = -((-h)//a)
print(n)

Buggy python submission (verdict: Runtime Error):
h,a=map(int,input().split(" "))

if h%a==0:
  print(h/a)
else:
  primt((h//a)+1)

Fixed submission:
h,a = map(int,input().split())
n = -((-h)//a)
print(n)

Buggy python submission (verdict: Runtime Error):
h,a=map(int,input().split(" "))

if h%a==0:
  print(h/a)
else:
  primt(h//a+1)

Fixed submission:
h,a = map(int,input().split())
n = -((-h)//a)
print(n)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = list(map(int,input().split()))

if n > k:
    for i in range(k):
        h.remove(max(h))
    print(sum(h))
else:
    print(0)

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse=True)

if n > k:
    del h[:k]
    print(sum(h))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse=True)

if n > k:
    for i in range(k):
        h.pop(0)
    print(sum(h))
else:
    print(0)

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse=True)

if n > k:
    del h[:k]
    print(sum(h))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
,b = map(int,input().split())
s = 0
if a <= b:
    for i in range(0,b):
        s += a*(10**i)

else:
    for i in range(0,a):
        s += b*(10**i)

print(s)

Fixed submission:
a,b = map(int,input().split())
s = 0
if a <= b:
    for i in range(0,b):
        s += a*(10**i)

else:
    for i in range(0,a):
        s += b*(10**i)

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int,input().split()))
c = 0
for i in range(n):
    q = p[0:i+1]
    if min(q) == p[i]:
        c += 1

print(c)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
c = 0
m = p[0]
for i in range(n):
    if p[i] <= m :
        m = p[i]
        c += 1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int,input().split()))
c = 0
for i in range(n):
    q = p[0:i+1]
    if min(q) == p[i]:
        c += 1

print(c)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
c = 0
m = p[0]
for i in range(n):
    if p[i] <= m :
        m = p[i]
        c += 1
print(c)
Buggy python submission (verdict: Runtime Error):
S=input()
alpha='abcdefghijklmnopqrstuvwxyz'
ans=''
P=[]
for i in range(26):
    P.append([alpha[i],1])


cnt=0
if len(S)==26:
    l=[]
    poe=S[::-1]
    for i in range(25):
        if poe[i]<poe[i+1]:
            cnt+=1
            l.append(poe[i])
        else:
            ans=poe[:i+1:-1]+min(l)
            break
    if cnt==25:
        ans='-1'
else:
    for i in range(len(S)):
        for j in range(26):
            if S[i]==P[j][0]:
                P[j][1]=0
        for i in range(26):
            if P[i][1]==1:
                ans=S+P[i][0]
                break

print(ans)

Fixed submission:
S=list(input())
m=list('abcdefghijklmnopqrstuvwxyz')[::-1]

if len(S)<26:
    for i in m[::-1]:
        if i not in S:
            S.append(i)
            break
    print(''.join(S))
else:
    x=S[-1]
    for i in range(25)[::-1]:
        if x>S[i]:
            y=m.index(S[i])
            S=S[:i]
            for j in range(y)[::-1]:
                if m[j] not in S:
                    S.append(m[j])
                    break
            break
        else:
            x=S[i]
        
        if i==0:
            print(-1)
            exit()
    print(''.join(S))