Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

counter = 0

for i in range(0, a + 1):
	if x - (500 * i) >= 0:
		x_f = x - (500 * i)

		if x_f == 0:
			counter += 1
			break

    	for j in range(0, b + 1):
    		if x_f - (100 * j) >= 0:
    			x_s = x_f - (100 * j)

    			if x_s == 0:
    				counter += 1
    				break

        		for k in range(0, c + 1):
        			if x_s - (50 * k) >= 0:
        				x_t = x_s - (50 * k)

        				if x_t == 0:
        					counter += 1
        					break


print(counter)


Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

counter = 0

for i in range(0, a + 1):
	if x - (500 * i) >= 0:
		x_f = x - (500 * i)

		if x_f == 0:
			counter += 1
			break

		for j in range(0, b + 1):
			if x_f - (100 * j) >= 0:
				x_s = x_f - (100 * j)

				if x_s == 0:
					counter += 1
					break

				for k in range(0, c + 1):
					if x_s - (50 * k) >= 0:
						x_t = x_s - (50 * k)

						if x_t == 0:
							counter += 1
							break


print(counter)
Buggy python submission (verdict: Runtime Error):
l = [int(input()) for _ in range(6)]
N = l[0]
l = l[1:]

c = [0] * 5
for i in range(len(l)):
    if N > l[i]:
        c[i] = N - l[i]
        N = l[i]

res = 0
for i in range(5):
    if c[i] > 0:
        if i == 0:
            res += int(c[i]/l[i]) + 1
            m = c[i] - int(c[i]/l[i]) * l[i]
        else:
            c[i] = max(0,c[i] - l[i] * res)
            c[i] += m
            res += int((c[i])/l[i])
            m = c[i] - int((c[i])/l[i]) * l[i]
    

print(5+res)








Fixed submission:
l = [int(input()) for _ in range(6)]
N = l[0]
l = l[1:]

print(-(-N//min(l))+4)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
res = []
for i in range(N):
    res.append(list(map(int,input().split())))

if N == 1:
    print(res[0][0])
    exit()

s = [0 for i in range(M)]
for i in res:
    for j in i[1:]:
        s[j-1] += 1

count = 0
for i in range(N):
    if s[i] == N:
        count += 1

print(count)

Fixed submission:
N,M = map(int,input().split())
res = []
for i in range(N):
    res.append(list(map(int,input().split())))

if N == 1:
    print(res[0][0])
    exit()

s = [0 for i in range(M)]
for i in res:
    for j in i[1:]:
        #print(j)
        s[j-1] += 1

#print(s)

count = 0
for i in range(M):
    if s[i] == N:
        count += 1

print(count)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
res = []
for i in range(N):
    res.append(list(map(int,input().split())))

if N == 1:
    print(res[0][0])
    exit()

s = [0 for i in range(M)]
for i in res:
    for j in i[1:]:
        s[j-1] += 1

count = 0
for i in range(N):
    if s[i] == N:
        count += 1

Fixed submission:
N,M = map(int,input().split())
res = []
for i in range(N):
    res.append(list(map(int,input().split())))

if N == 1:
    print(res[0][0])
    exit()

s = [0 for i in range(M)]
for i in res:
    for j in i[1:]:
        #print(j)
        s[j-1] += 1

#print(s)

count = 0
for i in range(M):
    if s[i] == N:
        count += 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
H = [int(input()) for _ in range(N)]

H.sort()

#res1 = max(H[:K])-min(H[:K])
#res2 = max(H[N-K:])-min(H[N-K:])

res = 1000000000
for i in range(N-K+1):
    tmp = max(H[i:i+K])-min(H[i:i+K])
    if tmp < res:
        res = tmp
print(res)

Fixed submission:
N,K = map(int,input().split())
H = [int(input()) for _ in range(N)]

H.sort()

res = 1000000000
for i in range(N-K+1):
    #print(H)
    #print(H[i+K-1],H[i])
    tmp = H[i+K-1]-H[i]
    if tmp < res:
        res = tmp
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)] 
 
A = sorted(A)
res = 0
A2 = []
for i in range(len(A)):
    if len(A) == 1:
        if abs(A[0] - A2[0]) < abs(A[0] - A2[-1]):
            A2.append(A[0])
        else:
            A2.insert(0,A[0])
        break
    if i % 2 == 0:
        if i == 0:
            A2.append(A.pop(-1))
        else:
            if abs(A[-1] - A2[0]) < abs(A[-1] - A2[-1]):
                A2.append(A.pop(-1))
            else:
                A2.insert(0,A.pop(-1))
    else:
        #A2.append(A.pop(0))
        if abs(A[0] - A2[0]) < abs(A[0] - A2[-1]):
            A2.append(A.pop(0))
        else:
            A2.insert(0,A.pop(0))
for i in range(len(A2)-1):
    res += abs(A2[i] - A2[i+1])

print(res)

Fixed submission:
N = int(input())
A_in = [int(input()) for _ in range(N)] 
 
A = sorted(A_in)
res1 = 0
A2 = []
for i in range(len(A)):
    if len(A) == 1:
        if abs(A[0] - A2[0]) < abs(A[0] - A2[-1]):
            A2.append(A[0])
        else:
            A2.insert(0,A[0])
        break
    if i % 2 == 0:
        A2.append(A.pop(-1))
    else:
        A2.append(A.pop(0))
for i in range(len(A2)-1):
    res1 += abs(A2[i] - A2[i+1])

A = sorted(A_in,reverse=True)
res2 = 0
A2 = []
for i in range(len(A)):
    if len(A) == 1:
        if abs(A[0] - A2[0]) < abs(A[0] - A2[-1]):
            A2.append(A[0])
        else:
            A2.insert(0,A[0])
        break
    if i % 2 == 0:
        A2.append(A.pop(-1))
    else:
        A2.append(A.pop(0))
for i in range(len(A2)-1):
    res2 += abs(A2[i] - A2[i+1])

print(max(res1,res2))
Buggy python submission (verdict: Runtime Error):
import collections
 
n = int(input())
v = [int(i) for i in input().split()]
 
v1 = [v[i] for i in range(0,n,2)]
v2 = [v[i] for i in range(1,n,2)]
 
count1 = collections.Counter(v1).most_common(2)
count2 = collections.Counter(v2).most_common(2)

if max(count1.values()) != max(count2.values()):
    res = len(v1) - max(count1.values()) + len(v2) - max(count2.values())
    print(res)
else:
    if len(count1) == 1:
        print(len(v1))
    else:
        res1 = len(v1) - count1[0][1] + len(v2) - count2[1][1]
        res2 = len(v1) - count1[1][1] + len(v2) - count2[0][1]
        print(min(res1,res2))


Fixed submission:
N = list(input())

r = []

for i in N:
    if i == '1':
        r.append('9')
    else:
        r.append('1')

print(''.join(r))
Buggy python submission (verdict: Runtime Error):
N,X =[int(i) for i in input().split()]
c = [int(i) for i in input().split()]

c.append(X)
c.sort()

D = float('inf')

for i in range(1,N+1):
    if c[i] - c[i-1] < D:
        D = abs(c[i] - c[i-1])

print(int(D))



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

res = 0
f = False
for i in range(1,4):
    res = a * b * i
    if res % 2 == 1:
        f = True

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

Buggy python submission (verdict: Runtime Error):
N,X =[int(i) for i in input().split()]
c = [int(i) for i in input().split()]

c.append(X)
c.sort()

D = float('inf')

for i in range(1,N+1):
    if c[i] - c[i-1] < D:
        D = abs(c[i] - c[i-1])

print(int(D))

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

res = 0
f = False
for i in range(1,4):
    res = a * b * i
    if res % 2 == 1:
        f = True

if f:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N,X =[int(i) for i in input().split()]
c = [int(i) for i in input().split()]

c.append(X)
c.sort()

index_x = c.index(X)

if len(c) == 2:
    print(abs(c[index_x] - c[index_x - 1]))
else:
    print(min(c[index_x] - c[index_x - 1],c[index_x + 1] - c[index_x]))

Fixed submission:
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


N,X =[int(i) for i in input().split()]
c = [int(i) for i in input().split()]

for i in range(N):
    c[i] = abs(c[i] - X)

print(gcd_list(c))

Buggy python submission (verdict: Runtime Error):
N,X =[int(i) for i in input().split()]
c = [int(i) for i in input().split()]

c.append(X)
c.sort()

D = float('inf')

for i in range(1,N+2):
    if c[i] - c[i-1] < D:
        D = c[i] - c[i-1]

print(int(D))

Fixed submission:
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


N,X =[int(i) for i in input().split()]
c = [int(i) for i in input().split()]

for i in range(N):
    c[i] = abs(c[i] - X)

print(gcd_list(c))
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
X = [int(i) for i in input().split()]

min_cost = float('inf')

for i in range(N-K+1):
    sub_x = X[i:i+K]
    tmp_l = abs(sub_x[0]) + abs(sub_x[-1]-sub_x[0])
    tmp_r = abs(sub_x[-1]) + abs(sub_x[0]-sub_x[-1])
    tmp = min(tmp_l,tmp_r)

    if min_cost > tmp:
        min_cost = tmp

print(min_cost)


Fixed submission:
N,K = map(int,input().split())
X = [int(i) for i in input().split()]

min_cost = float('inf')

for i in range(N-K+1):
    l = X[i]
    r = X[i+K-1]
    tmp_l = abs(l) + abs(r-l)
    tmp_r = abs(r) + abs(l-r)
    tmp = min(tmp_l,tmp_r)

    if min_cost > tmp:
        min_cost = tmp

print(min_cost)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
X = [int(i) for i in input().split()]

X_sub = [[] for i in range(N-K+1)]

for i in range(N-K+1):
    X_sub[i] = X[i:i+K]

min_cost = float('inf')

for i in X_sub:
    tmp_l = abs(i[0]) + abs(i[-1]-i[0])
    tmp_r = abs(i[-1]) + abs(i[0]-i[-1])
    tmp = min(tmp_l,tmp_r)

    if min_cost > tmp:
        min_cost = tmp

print(min_cost)

Fixed submission:
N,K = map(int,input().split())
X = [int(i) for i in input().split()]

min_cost = float('inf')

for i in range(N-K+1):
    l = X[i]
    r = X[i+K-1]
    tmp_l = abs(l) + abs(r-l)
    tmp_r = abs(r) + abs(l-r)
    tmp = min(tmp_l,tmp_r)

    if min_cost > tmp:
        min_cost = tmp

print(min_cost)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
X = [int(i) for i in input().split()]

X_sub = [[] for i in range(N-K+1)]

for i in range(N-K+1):
    X_sub[i] = X[i:i+K]

min_cost = float('inf')

for i in X_sub:
    tmp_l = abs(i[0]) + abs(i[-1]-i[0])
    tmp_r = abs(i[-1]) + abs(i[0]-i[-1])
    tmp = min(tmp_l,tmp_r)

    if min_cost > tmp:
        min_cost = tmp

print(min_cost)

Fixed submission:
N,K = map(int,input().split())
X = [int(i) for i in input().split()]

min_cost = float('inf')

for i in range(N-K+1):
    l = X[i]
    r = X[i+K-1]
    tmp_l = abs(l) + abs(r-l)
    tmp_r = abs(r) + abs(l-r)
    tmp = min(tmp_l,tmp_r)

    if min_cost > tmp:
        min_cost = tmp

print(min_cost)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
X = [int(i) for i in input().split()]

X_sub = []

for i in range(N-K+1):
    X_sub.append(X[i:i+K])

min_cost = float('inf')

for i in X_sub:
    tmp_l = abs(i[0]) + abs(i[-1]-i[0])
    tmp_r = abs(i[-1]) + abs(i[0]-i[-1])
    tmp = min(tmp_l,tmp_r)

    if min_cost > tmp:
        min_cost = tmp

print(min_cost)


Fixed submission:
N,K = map(int,input().split())
X = [int(i) for i in input().split()]

min_cost = float('inf')

for i in range(N-K+1):
    l = X[i]
    r = X[i+K-1]
    tmp_l = abs(l) + abs(r-l)
    tmp_r = abs(r) + abs(l-r)
    tmp = min(tmp_l,tmp_r)

    if min_cost > tmp:
        min_cost = tmp

print(min_cost)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
_input = []
for i in range(M):
    _input.append(list(map(int,input().split())))

_input.sort(key=lambda x: x[1])

removed = []

for a,b in _input:
    flag = False
    for i in removed:
        if a <= i < b:
            flag = True
    if not flag:
        removed.append(b-1)

print(len(removed))

Fixed submission:
N, M = map(int, input().split())
_input = []
for i in range(M):
    _input.append(list(map(int,input().split())))

_input.sort(key=lambda x: x[1])

removed = []

for a,b in _input:
    flag = False
    for i in removed:
        if a <= i < b:
            flag = True
            break
    if not flag:
        removed.append(b-1)

print(len(removed))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
 
sub = [A[i]-(i+1) for i in range(N)]
res = 0

if N % 2 != 0:
    b = sub[int(N-1/2)+1]
    res = 0
    for i in range(N):
        res += abs(A[i]-(b+i+1))
else:
    b1 = sub[int(N-1/2)]
    b2 = sub[int(N-1/2)+1]
    res1 = 0
    for i in range(N):
        res1 += abs(A[i]-(b1+i+1))
    res2 = 0
    for i in range(N):
        res2 += abs(A[i]-(b2+i+1))
    res = min(res1,res2)

print(res)

Fixed submission:
import collections
 
N = int(input())
A = [int(i) for i in input().split()]
 
sub = [A[i]-(i+1) for i in range(N)]
res = 0
sub = sorted(sub)
b = sub[int(N/2)]
 
res = 0
for i in range(N):
    res += abs(A[i]-(b+i+1))
 
print(res)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
 
sub = [A[i]-(i+1) for i in range(N)]
res = 0

if N % 2 != 0:
    b = sub[int(N/2)+1]
    res = 0
    for i in range(N):
        res += abs(A[i]-(b+i+1))
else:
    b1 = sub[int(N/2)]
    b2 = sub[int(N/2)+1]
    res1 = 0
    for i in range(N):
        res1 += abs(A[i]-(b1+i+1))
    res2 = 0
    for i in range(N):
        res2 += abs(A[i]-(b2+i+1))
    res = min(res1,res2)

print(res)

Fixed submission:
import collections
 
N = int(input())
A = [int(i) for i in input().split()]
 
sub = [A[i]-(i+1) for i in range(N)]
res = 0
sub = sorted(sub)
b = sub[int(N/2)]
 
res = 0
for i in range(N):
    res += abs(A[i]-(b+i+1))
 
print(res)

Buggy python submission (verdict: Runtime Error):
import collections
 
N = int(input())
A = [int(i) for i in input().split()]
 
sub = [A[i]-(i+1) for i in range(N)]
res = 0

if N % 2 != 0:
    b = sub[int(N/2)+1]
    res = 0
    for i in range(N):
        res += abs(A[i]-(b+i+1))
else:
    b1 = sub[int(N/2)]
    b2 = sub[int(N/2)+1]
    res1 = 0
    for i in range(N):
        res1 += abs(A[i]-(b1+i+1))
    res2 = 0
    for i in range(N):
        res2 += abs(A[i]-(b2+i+1))
    res = min(res1,res2)

print(res)

Fixed submission:
import collections
 
N = int(input())
A = [int(i) for i in input().split()]
 
sub = [A[i]-(i+1) for i in range(N)]
res = 0
sub = sorted(sub)
b = sub[int(N/2)]
 
res = 0
for i in range(N):
    res += abs(A[i]-(b+i+1))
 
print(res)
Buggy python submission (verdict: Runtime Error):
a,b=[int(i) for i in input().split()]

d = b - a

for i in range(1,d):
    h += i

print(h-a)


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

d = b - a

h = 0
for i in range(1,d):
    h += i

print(h-a)

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

h = 0
i = 0
while h < a and i < 1000:
    i += 1
    h += i

if i > 999
    print(h-b)
else:
    print(h-a)

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

d = b - a

h = 0
for i in range(1,d):
    h += i

print(h-a)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())

minNum = N
for i in range(N):
    cost = 0
    for j in range(N):
        if cost > minNum:
            break
        if i == j:
            continue
        if j < i:
            if S[j] == 'W':
                cost += 1
        else :
            if S[j] == 'E':
                cost += 1
    if minNum > cost:
        minNum = cost

print(cost-1)

Fixed submission:
N = int(input())
S = list(input())

reS = S[::-1]

wSum = [0 for i in range(N)]
eSum = [0 for i in range(N)]

for i in range(N):
    if i == 0:
        if S[i] == 'W':
            wSum[i] = 1
        if reS[i] == 'E':
            eSum[i] = 1
    else:
        if S[i] == 'W':
            wSum[i] = wSum[i-1] + 1
        else:
            wSum[i] = wSum[i-1]
        if reS[i] == 'E':
            eSum[i] = eSum[i-1] + 1
        else:
            eSum[i] = eSum[i-1]

eSum = eSum[::-1]

cost = eSum[1]

for i in range(1,N):
    if i == N - 1:
        if cost > wSum[N-2]:
            cost = wSum[N-2]
    else:
        if cost > wSum[i-1] + eSum[i+1]:
            cost = wSum[i-1] + eSum[i+1]
print(cost)
Buggy python submission (verdict: Time Limit Exceeded):
N = [int(i) for i in input().split()]
A = N[0]
B = N[1]
C = N[2]
K = N[3]

if A == B == C:
    print(0)
else:
    for i in range(K):
        NA = B + C
        NB = A + C
        NC = A + B
        A = NA
        B = NB
        C = NC
    if abs(A-B) > 10 ** 18:
        print('Unfair')
    else:
        print(A-B)

Fixed submission:
N = [int(i) for i in input().split()]
A = N[0]
B = N[1]
C = N[2]
K = N[3]

if K % 2 == 0:
    if abs(A - B) > 10 ** 18:
        print('Unfair')
    else:
        print(A - B)
else :
    if abs(A - B) > 10 ** 18:
        print('Unfair')
    else:
        print(B - A)
Buggy python submission (verdict: Runtime Error):
s = list(input())
k = int(input())
sub = []
sub += s[:]
 
for j in range(2,K+1):
    charGram = [''.join(s[i:i+j]) for i in range(len(s)-1)]
    sub += charGram
sub = list(set(sub))
print(sorted(sub)[k-1])

Fixed submission:
s = list(input())
k = int(input())
sub = []
sub += s[:]
 
for j in range(2,k+1):
    charGram = [''.join(s[i:i+j]) for i in range(len(s)-1)]
    sub += charGram
sub = list(set(sub))
print(sorted(sub)[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = [int(i) for i in input().split()]

sortedX = X[:]
sortedX.sort()
lenX = len(X)

for i in X:
    if sortedX.index(i) > int(lenX/2) - 1:
        print(sortedX[int(lenX/2)-1])
    else:
        print(sortedX[int(lenX/2)])



Fixed submission:
N = int(input())
X = [int(i) for i in input().split()]

sortedX = X[:]
sortedX.sort()
lenX = len(X)

for i in X:
    if i > sortedX[int(lenX/2) - 1]:
        print(sortedX[int(lenX/2)-1])
    else:
        print(sortedX[int(lenX/2)])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
X = [int(i) for i in input().split()]

arrayX = np.array(X)
num = arrayX.size

for i in range(num):
    arrayX = np.delete(arrayX,i)
    print(int(np.median(arrayX)))
    arrayX = np.array(X)

Fixed submission:
N = int(input())
X = [int(i) for i in input().split()]

sortedX = X[:]
sortedX.sort()
lenX = len(X)

for i in X:
    if i > sortedX[int(lenX/2) - 1]:
        print(sortedX[int(lenX/2)-1])
    else:
        print(sortedX[int(lenX/2)])

Buggy python submission (verdict: Runtime Error):
mport numpy as np

N = int(input())
X = [int(i) for i in input().split()]

arrayX = np.array(X)
num = arrayX.size

for i in range(num):
    arrayX = np.delete(arrayX,i)
    print(int(np.median(arrayX)))
    arrayX = np.array(X)

Fixed submission:
N = int(input())
X = [int(i) for i in input().split()]

sortedX = X[:]
sortedX.sort()
lenX = len(X)

for i in X:
    if i > sortedX[int(lenX/2) - 1]:
        print(sortedX[int(lenX/2)-1])
    else:
        print(sortedX[int(lenX/2)])
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C = map(int,input().split())
 
counter = 0
 
while not A == B == C:
    if max([A,B,C])-min([A,B,C]) > 1:
        if A < B and A < C:
            A += 2
        elif B < A and B < C:
            B += 2
        else:
            C += 2
        counter += 1
    else:
        if A < C and B < C:
            A += 1
            B += 1
        elif A < B and C < B:
            A += 1
            C += 1
        else:
            B += 1
            C += 1
        counter += 1
        
print(counter)

Fixed submission:
A,B,C = map(int,input().split())
 
counter = 0
 
while not A == B == C:
    A,B,C = sorted([A,B,C])
    if C - A > 1:
        A += 2
        counter += 1
    else:
        A += 1
        B += 1
        counter += 1
        
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,C = map(int,input().split())

counter = 0

while A != B or B != C or A != C:
    if A - B > 1 or A - C > 1 or B - A > 1 or B - C > 1 or C - A > 1 or C - B > 1:
        if A < B and A < C:
            A += 2
        elif B < A and B < C:
            B += 2
        else:
            C += 2
        counter += 1
    else:
        if A < C and B < C:
            A += 1
            B += 1
        elif A < B and C < B:
            A += 1
            C += 1
        else:
            B += 1
            C += 1
        counter += 1

print(counter)


Fixed submission:
A,B,C = map(int,input().split())
 
counter = 0
 
while not A == B == C:
    A,B,C = sorted([A,B,C])
    if C - A > 1:
        A += 2
        counter += 1
    else:
        A += 1
        B += 1
        counter += 1
        
print(counter)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,C = map(int,input().split())

counter = 0

while A != B or B != C or A != C:
    if max([A,B,C])-min([A,B,C]) > 1:
        if A < B and A < C:
            A += 2
        elif B < A and B < C:
            B += 2
        else:
            C += 2
        counter += 1
    else:
        if A < C and B < C:
            A += 1
            B += 1
        elif A < B and C < B:
            A += 1
            C += 1
        else:
            B += 1
            C += 1
        counter += 1

print(counter)


Fixed submission:
A,B,C = map(int,input().split())
 
counter = 0
 
while not A == B == C:
    A,B,C = sorted([A,B,C])
    if C - A > 1:
        A += 2
        counter += 1
    else:
        A += 1
        B += 1
        counter += 1
        
print(counter)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

A.insert(0,0)
A.append(0)
dist = []
dist_warp = []

for i in range(1,N+2):
    dist.append(abs(A[i]-A[i-1]))
    if i != 1:
        dist_warp.append(abs(A[i]-A[i-2]))

for i in range(1,N+1):
    print(sum(dist)-dist[i-1]-dist[i]+dist_warp[i-1])

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

A.insert(0,0)
A.append(0)

S = 0

for i in range(1,N+2):
    S += abs(A[i]-A[i-1])

for i in range(1,N+1):
    print(S + abs(A[i-1]-A[i+1]) - abs(A[i-1]-A[i]) - abs(A[i]-A[i+1]))
Buggy python submission (verdict: Runtime Error):
A,B=[int(i) for i in input().split()]
S = input()

if S[0:A-1].isdisit() and S[A] == '-' and S[A+1:].isdisit():
    print('Yes')
else:
    print('No')

Fixed submission:
A,B=[int(i) for i in input().split()]
S = input()

if S[A] == '-' and S.count('-') == 1:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]

d = Counter(A).most_common()
d = d[::-1]

reCounter = 0

for i in range(len(d)):
    if d[i][0] < d[i][1]:
        reCounter += d[i][1] - d[i][0]
    if d[i][0] > d[i][1]:
        reCounter += d[i][1]
        
print(reCounter)

Fixed submission:
from collections import Counter

N = int(input())
A = [int(i) for i in input().split()]

d = Counter(A).most_common()
d = d[::-1]

reCounter = 0

for i in range(len(d)):
    if d[i][0] < d[i][1]:
        reCounter += d[i][1] - d[i][0]
    if d[i][0] > d[i][1]:
        reCounter += d[i][1]
        
print(reCounter)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
A = [int(i) for i in input().split()]

counter = 0
d = {}
types = list(set(A))

for i in range(len(types)):
    d[str(types[i])] = A.count(types[i])


for i in range(len(d)-K):
    minKey = min(d, key=d.get)
    counter += d[minKey]
    del d[minKey]

'''
while len(d) > K:
    minKey = min(d, key=d.get)
    counter += d[minKey]
    del d[minKey]
'''
print(counter)




Fixed submission:
from collections import Counter

N,K = map(int,input().split())
A = [i for i in input().split()]

altCounter = 0
d = Counter(A).most_common()
d = d[::-1]

for i in range(len(d)-K):
    altCounter += d[i][1]

print(altCounter)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
A = [int(i) for i in input().split()]

counter = 0
d = {}
types = list(set(A))

for i in range(len(types)):
    d[str(types[i])] = A.count(types[i])

while len(d) > K:
    minKey = min(d, key=d.get)
    counter += d[minKey]
    del d[minKey]
print(counter)

Fixed submission:
from collections import Counter

N,K = map(int,input().split())
A = [i for i in input().split()]

altCounter = 0
d = Counter(A).most_common()
d = d[::-1]

for i in range(len(d)-K):
    altCounter += d[i][1]

print(altCounter)