Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
def f(n):
    tmp = n
    cnt = 0
    for i in range(2,n//1 + 1):
        if tmp < i:
            break
        if tmp % i == 0:
            cnt += 1
            while tmp % i == 0:
                tmp //= i
    if cnt == 0 and tmp != 1:
        cnt += 1
    return cnt

A, B = map(int, input().split())
g = gcd(A, B)
ans = f(g) + 1
print(ans)

Fixed submission:
from fractions import gcd
def f(n):
    tmp = n
    cnt = 0
    i = 2
    while i <= n**0.5 + 1:
        if tmp < i:
            break
        if tmp % i == 0:
            cnt += 1
            while tmp % i == 0:
                tmp //= i
        i += 1
    if tmp != 1:
        cnt += 1
    return cnt

A, B = map(int, input().split())
g = gcd(A, B)
ans = f(g) + 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
def f(n):
    tmp = n
    cnt = 0
    for i in range(2,n//1 + 1):
        if tmp < i:
            break
        if tmp % i == 0:
            cnt += 1
            while tmp % i == 0:
                tmp //= i
    if cnt == 0 and tmp != 1:
        cnt += 1
    return cnt

A, B = map(int, input().split())
g = gcd(A, B)
ans = f(g) + 1
print(ans)

Fixed submission:
from fractions import gcd
def f(n):
    tmp = n
    cnt = 0
    i = 2
    while i <= n**0.5 + 1:
        if tmp < i:
            break
        if tmp % i == 0:
            cnt += 1
            while tmp % i == 0:
                tmp //= i
        i += 1
    if tmp != 1:
        cnt += 1
    return cnt

A, B = map(int, input().split())
g = gcd(A, B)
ans = f(g) + 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
def f(n):
    arr = deque()
    tmp = n
    for i in range(2,n//1 + 1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            arr.append(i)
    if tmp != 1:
        arr.append(tmp)
    if arr == []:
        arr.append(n)
    return arr

A, B = map(int, input().split())
arrA = f(A)
arrB = f(B)
if len(arrA )> len(arrB):
    arrA, arrB = arrB, arrA

cnt = 1
for i in range(len(arrA)):
    if arrA[i] in arrB:
        cnt += 1
print(cnt)

Fixed submission:
from fractions import gcd
def f(n):
    tmp = n
    cnt = 0
    i = 2
    while i <= n**0.5 + 1:
        if tmp < i:
            break
        if tmp % i == 0:
            cnt += 1
            while tmp % i == 0:
                tmp //= i
        i += 1
    if tmp != 1:
        cnt += 1
    return cnt

A, B = map(int, input().split())
g = gcd(A, B)
ans = f(g) + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
	import sys
	sys.setrecursionlimit(700000)
	N, Q = map(int, input().split())
	d = [[] for i in range(N)]

	for i in range(N-1):
		a, b = map(int, input().split())
		a -= 1
		b -= 1
		d[b].append(a)
		d[a].append(b)

	ans = [0]*N

	for i in range(Q):
		p, x = map(int, input().split())
		p -= 1
		ans[p] += x

	def dfs(cur, parent):
		for child in d[cur]:
			if child != parent:
				ans[child] += ans[cur]
				dfs(child,cur)
	dfs(0,-1) 
	print(*ans)
    
main()



Fixed submission:
a = int(input())
s = str(input())
if a < 3200:
    print("red")
else:
    print(s)
Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())
n = int(len(S))
ans = [str(0) for i in range(n)]
cntLo = 0
cntRo = 0
cntLe = 0
cntRe = 0
for i in range(n-1):
    if S[i] == "R" and S[i+1] == "L":
        j = 1
        k = 1
        while i-j >= 0 and S[i-j] == "R":
            if j % 2 == 0:
                cntRe += 1
            else:
                cntRo += 1
            j += 1
        while i+1+k <= n-1 and S[i+1+k] == "L":
            if k % 2 == 0:
                cntLe += 1
            else:
                cntLo += 1
            j += 1
        ans[i] = str(cntRe + cntLo+1)
        ans[i+1] = str(cntRo + cntLe+1)
        cntLo = 0
        cntRo = 0
        cntLe = 0
        cntRe = 0
print(" ".join(ans))

Fixed submission:
S = str(input())
n = int(len(S))
ans = [str(0) for i in range(n)]
cntLo = 0
cntRo = 0
cntLe = 0
cntRe = 0
for i in range(n-1):
    if S[i] == "R" and S[i+1] == "L":
        j = 1
        k = 1
        while i-j >= 0 and S[i-j] == "R":
            if j % 2 == 0:
                cntRe += 1
            else:
                cntRo += 1
            j += 1
        while i+1+k <= n-1 and S[i+1+k] == "L":
            if k % 2 == 0:
                cntLe += 1
            else:
                cntLo += 1
            k += 1
        ans[i] = str(cntRe + cntLo+1)
        ans[i+1] = str(cntRo + cntLe+1)
        cntLo = 0
        cntRo = 0
        cntLe = 0
        cntRe = 0
print(" ".join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
S = int(input())
if S <= 10**9:
    print(0,0,S,0,0,1)
else:
    for i in reversed(range(1,int(S**0.5)+1)):
        if S%i == 0:
            print(0, 0, i, 0, 0, S//i)
            exit()

Fixed submission:
S = int(input())
if S <= 10**9:
    print(0,0,S,0,0,1)
elif S == 10**18:
    print(0,0,10**9,0,0,10**9)
else:
    xb = int(S**0.5 + 1)
    yc = int(S**0.5 + 1)
    xc = xb*yc - S
    print(0, 0, xb, 1, xc, yc)

Buggy python submission (verdict: Time Limit Exceeded):
S = int(input())
if S <= 10**9:
    print(0,0,S,0,0,1)
else:
    l = []
    for i in range(1,int(S**0.5)+1):
        if S%i == 0:
            l.append(i)
    for i in range(len(l)):
        if l[i] <= 10**9 and S//l[i] <= 10**9:
            print(0, 0, l[i], 0, 0, S//l[i])
            exit()

Fixed submission:
S = int(input())
if S <= 10**9:
    print(0,0,S,0,0,1)
elif S == 10**18:
    print(0,0,10**9,0,0,10**9)
else:
    xb = int(S**0.5 + 1)
    yc = int(S**0.5 + 1)
    xc = xb*yc - S
    print(0, 0, xb, 1, xc, yc)
Buggy python submission (verdict: Runtime Error):
N = int(input())
memo = 1
ans = []
tmp = int(input())
for i in range(1,N):
    A = int(input())
    if A <= tmp:
        memo += 1
    else:
        ans.append(memo)
        memo = 1
    tmp = A
ans.append(memo)
print(max(ans))

Fixed submission:
r = int(input())
print(3*(r**2))
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
memo = (N-1)*(N-2)//2
if K <= memo:
    print(((N-1) + memo - K)
    for i in range(2,N+1):
        print("1 " + str(i))
    tmp = 1
    i = 1
    j = i + 1
    while tmp < memo-K:
        while j <= N and tmp < memo-K:
            print(str(i) + " " + str(j))
            j += 1
            tmp += 1
        i += 1
        j = i + 1
else:
    print(-1)

Fixed submission:
N,K = map(int, input().split())
memo = (N-1)*(N-2)//2
if K <= memo:
    print((N-1) + memo - K)
    for i in range(2,N+1):
        print(1,i)
    cnt = 0
    i = 2
    j = i + 1
    while cnt < memo-K:
        while j <= N and cnt < memo-K:
            print(i,j)
            j += 1
            cnt += 1
        i += 1
        j = i + 1
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().sprit())
print(N%K)

Fixed submission:
N,K = map(int, input().split())
if K > 1:
    print(N-K)
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input())
print(N%K)

Fixed submission:
N,K = map(int, input().split())
if K > 1:
    print(N-K)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]
xy.sort()
from collections import defaultdict
d = defaultdict(int)
for i in range(N):
    for j in range(i+1,N):
        tmp = (xy[j][0]-xy[i][0],xy[j][1]-xy[i][1])
        d[tmp] += 1
print(N-max(d.values()))

Fixed submission:
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]
xy.sort()
from collections import defaultdict
d = defaultdict(int)
for i in range(N):
    for j in range(i+1,N):
        tmp = (xy[j][0]-xy[i][0],xy[j][1]-xy[i][1])
        d[tmp] += 1
if N == 1:
    print(1)
else:
    print(N-max(d.values()))
Buggy python submission (verdict: Runtime Error):
import math
N,M = map(int, input().split())
def C(a,b):
    return math.factorial(a+b)/(math.factorial(a)*math.factorial(b))
def pattern(n):
    ans = 0
    i = 0
    while n - 2*i >= 0:
        ans += C(n-i*2,i)
        i += 1
    return ans
ans = 1
mod = 10**9 + 7
l = [0 for i in  range(M)]
for i in range(1,M):
    l[i] = int(input()) - l[i-1] -2
if N-l[M-1]-2 >= 0:
    l.append(N-l[M-1]-2)
l.sort()
for i in range(len(l)):
    if i != 0 and l[i] == l[i-1]:
        ans *= tmp
    else:
        ans *= pattern(l[i])
    ans = ans%mod
    tmp = pattern(l[i])
print(int(ans))

Fixed submission:
N,M = map(int, input().split())
dp = [0 for i in range(N+1)]
dp[0] = 1
dp[1] = 1
for i in range(M):
    dp[int(input())] = None
for i in range(2,N+1):
    if dp[i] != None:
        if dp[i-2] != None:
            dp[i] += dp[i-2]
        if dp[i-1] != None:
            dp[i] += dp[i-1]
mod = 10**9 + 7
print(dp[N]%mod)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
ans = 0
for i in range(N):
    tmp = i
    memo = 0
    while tmp < K:
        memo += 1
        tmp *= 2
    ans += 0.5 ** memo
print(ans)

Fixed submission:
N, K = map(int, input().split())
ans = 0
for i in range(1,N+1):
    tmp = i
    memo = 0
    while tmp < K:
        memo += 1
        tmp *= 2
    ans += 0.5 ** memo
print(ans/N)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
ans = 0
for i in range(N):
    tmp = i
    memo = 0
    while i < K:
        memo += 1
        tmp *= 2
    ans += 0.5 ** memo
print(ans)

Fixed submission:
N, K = map(int, input().split())
ans = 0
for i in range(1,N+1):
    tmp = i
    memo = 0
    while tmp < K:
        memo += 1
        tmp *= 2
    ans += 0.5 ** memo
print(ans/N)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
log = 18
dp = [[0 for i in range(K+1)] for j in range(log)]
for i in range(1,N+1):
    dp[0][i] = 1/N
if  K%2 == 0:
    lim = K//2 - 1
else:
    lim = K//2
for i in range(1,log):
    j = 2
    while j <= K-1:
        dp[i][j] = dp[i-1][j//2] / 2
        j += 2
    dp[i][K] = dp[i-1][K] + sum(dp[i-1][lim+1:K-1])/2
print(dp[log-1][K])

Fixed submission:
N, K = map(int, input().split())
ans = 0
for i in range(1,N+1):
    tmp = i
    memo = 0
    while tmp < K:
        memo += 1
        tmp *= 2
    ans += 0.5 ** memo
print(ans/N)
Buggy python submission (verdict: Runtime Error):
R, G, B, N = map(int, input().split())
ans = 0
r=0
while r*R <= N:
    g=0
    while r*R + g*G <= N:
        if (N - r*R - g*G) % B == 0:
            ans += 1
        g += 1
    r += 1
print(ans)


Fixed submission:
N, K = map(int, input().split())
print(N-K+1)
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
ans = 0
r=0
while r*R <= N:
    g=0
    while r*R + g*G <= N:
        if (N - r*R - g*G) % B == 0:
            ans += 1
        g += 1
    r += 1
print(ans)


Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
r=0
while r*R <= N:
    g=0
    while r*R + g*G <= N:
        if (N - r*R - g*G) % B == 0:
            ans += 1
        g += 1
    r += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
R, G, B, N = map(int, input().split())
ans = 0
r=0
while r*R <= N:
    g=0:
    while r*R + g*G <= N:
        if (r*R + g*G) % B == 0:
            ans += 1
        g += 1
    r += 1
print(ans)


Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
r=0
while r*R <= N:
    g=0
    while r*R + g*G <= N:
        if (N - r*R - g*G) % B == 0:
            ans += 1
        g += 1
    r += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N, R, G, B = map(int, input().split())
ans = 0
for i in range(R):
    for j in range(G):
        if 0 <= N-i-j <= b:
            ans += 1
print(ans)


Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
r=0
while r*R <= N:
    g=0
    while r*R + g*G <= N:
        if (N - r*R - g*G) % B == 0:
            ans += 1
        g += 1
    r += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
print(N*(N+1)*(2*N+1)//6)


Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
r=0
while r*R <= N:
    g=0
    while r*R + g*G <= N:
        if (N - r*R - g*G) % B == 0:
            ans += 1
        g += 1
    r += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
print(N*(N+1)*(2*n+1)//6)

Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
r=0
while r*R <= N:
    g=0
    while r*R + g*G <= N:
        if (N - r*R - g*G) % B == 0:
            ans += 1
        g += 1
    r += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = str(input())
S_list = []
cum_list = [0]
tmp = 1
count = 0
if "0" not in S:
    print(len(S))
else:
    for i in range(N):
        if i == 0:
            if int(S[i]) == tmp:
                count += 1
            else:
                S_list.append(count)
                count = 1
        else:
            if S[i] == S[i - 1]:
                count += 1
                if i == N - 1:
                    S_list.append(count)
            else:
                S_list.append(count)
                count = 1


    if S[-1] == "0":
        S_list.append(0)




    now = 0
    for i in range(len(S_list)):
        now += S_list[i]
        cum_list.append(now)
    def check(x,K):
        answer_list = []
        i = 0
        if i + 2 * K + 1 < len(x):
            while i + 2 * K + 1 < len(x):
                answer_list.append(x[i + 2 * K + 1] - x[i])
                i += 2
            return answer_list
        elif K > 0:
            check(x,K-1)
    answer_list = check(cum_list,K)

    answer = max(answer_list)
    print(answer)

Fixed submission:
A, B = map(int, input().split())
if max(A,B) - min(A,B) >= 1:
    answer = max(A,B) * 2 - 1
else:
    answer = 2 * max(A,B)
print(answer)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10

list_1 = [A, B, C, D, E]
list_2 = [a, b, c, d, e]
list_2_2 = []
for x in list_2:
    if x != 0:
        list_2_2.append(x)

smallest = min(list_2_2)

list_3 = []

count = 0
for i in range(5):
    if list_2[i] == smallest and count % 10 == 0:
        list_3.append(list_1[i])
    elif list_2[i] != 0:
        list_3.append(list_1[i] - list_2[i] + 10)
    else:
        list_3.append(list_1[i])
    count += list_3[i]

sum = 0
for x in list_3:
    sum += x
    
print(sum)




Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10

list_1 = [A, B, C, D, E]
list_2 = [a, b, c, d, e]
list_2_2 = []
for x in list_2:
    if x != 0:
        list_2_2.append(x)
if list_2_2 != []:
	smallest = min(list_2_2)
else:
  	smallest = 10

list_3 = []

count = 0
for i in range(5):
    if list_2[i] == smallest and count % 10 == 0:
        list_3.append(list_1[i])
    elif list_2[i] != 0:
        list_3.append(list_1[i] - list_2[i] + 10)
    else:
        list_3.append(list_1[i])
    count += list_3[i]

sum = 0
for x in list_3:
    sum += x
    
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

member = [A, B, C, D, E]
people = [N, 0, 0, 0, 0, 0]
count = 0
while people[5] < N:
    for i in reversed(range(5)):
        if people[i] >= member[i]:
            people[i+1] += member[i]
            people[i] -= member[i]
        elif people[i] > 0:
            people[i+1] += people[i]
            people[i] = 0
    count += 1
    
print(count)
        

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

member = [A, B, C, D, E]
if N % min(member) == 0:
    answer = N // min(member) + 4
else:
    answer = N // min(member) + 5
print(answer)
Buggy python submission (verdict: Runtime Error):
b = str(input())
if b = "A":
    print("T")
elif b = "T":
    print("A")
elif b = "C":
    print("G")
elif b = "G":
    print("C")

Fixed submission:
b = str(input())
if b == "A":
    print("T")
elif b == "T":
    print("A")
elif b == "C":
    print("G")
elif b == "G":
    print("C")
Buggy python submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = str(input())
position = [0] * (N)
count = 0
for i in range(N):
    if S[i] == "A" and S[i + 1] == "C":
        count += 1
    position[i] = count

for i in range(Q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    answer = position[r] - position[l]
    print[answer]

Fixed submission:
N, Q = map(int, input().split())
S = str(input())
position = [0] * N
count = 0
for i in range(N-1):
    if S[i] == "A" and S[i + 1] == "C":
        count += 1
    position[i+1] = count
answers = []
for i in range(Q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    answer = position[r] - position[l]
    answers.append(answer)
for i in range(Q):
    print(answers[i])

Buggy python submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = str(input())
position = []
for i in range(N):
    if S[i] == "A" and S[i + 1] == "C":
        position.append(i)

answers = []

for i in range(Q):
    l, r = map(int, input().split())
    l -= 1
    r -= 2
    
    low = 0
    high = len(position)
    t = (low + high)//2
   
    while low<=high:
        
        if l == position[t]:
            break
        elif l > position[t]:
            if l < position[t-1]:
                break
            else:
                low = t + 1
        elif l < position[t]:
            high = t - 1
        
        tmp = (low + high) // 2
        if 0 <= tmp <= len(position) - 1:
            t = tmp
        else:
            break
    
     
    low = 0
    high = len(position)
    s = (low + high)//2
    while low<=high:
       
        if r == position[s]:
            break
        elif r > position[s]:
            low = s + 1
        elif r < position[s]:
            if r > position[s+1]:
                break
            else:
                high = s - 1
        tmp = (low + high) // 2
        if 0 <= tmp <= len(position) - 1:
            s = tmp
        else:
            break
    
    answer = s - t + 1
    if s == t:
        if not l <= position[s] <= r:
            answer = 0
    
        
    answers.append(answer)
    
for x in answers:
    print(x)

Fixed submission:
N, Q = map(int, input().split())
S = str(input())
position = [0] * N
count = 0
for i in range(N-1):
    if S[i] == "A" and S[i + 1] == "C":
        count += 1
    position[i+1] = count
answers = []
for i in range(Q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    answer = position[r] - position[l]
    answers.append(answer)
for i in range(Q):
    print(answers[i])
Buggy python submission (verdict: Time Limit Exceeded):
N, M= map(int, input().split())
A = []
B = []
for i in range(N):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)
count = 0
cost = 0
while count < M:
    pos = A.index(min(A))
    cost += A[pos] * min(B[pos],M-count)
    count += min(B[pos],M-count)
    A.pop(pos)
    B.pop(pos)
        
print(cost)

Fixed submission:
N, M= map(int, input().split())
A = []
for i in range(N):
    a = list(map(int, input().split()))
    A.append(a)
A = sorted(A)
count = 0
cost = 0
i = 0
while count < M:
    cost += A[i][0] * min(A[i][1],M-count)
    count += min(A[i][1],M-count)
    i += 1    
print(cost)

Buggy python submission (verdict: Time Limit Exceeded):
N, M= map(int, input().split())
A = []
B = []
for i in range(N):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)
count = 0
cost = 0
while count < M:
    pos = A.index(min(A))
    if B[pos] <= M - count:
        count += B[pos]
        cost += A[pos] * B[pos]
        A.pop(pos)
        B.pop(pos)
    else:
        cost += A[pos] * (M - count)
        count = M
        
print(cost)

Fixed submission:
N, M= map(int, input().split())
A = []
for i in range(N):
    a = list(map(int, input().split()))
    A.append(a)
A = sorted(A)
count = 0
cost = 0
i = 0
while count < M:
    cost += A[i][0] * min(A[i][1],M-count)
    count += min(A[i][1],M-count)
    i += 1    
print(cost)

Buggy python submission (verdict: Time Limit Exceeded):
N, M= map(int, input().split())
A = []
B = []
for i in range(N):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)
count = 0
cost = 0
while count < M:
    cost += min(A)
    count += 1
    pos = A.index(min(A))
    B[pos] -= 1
    if B[pos] <= 0:
        A.pop(pos)
        B.pop(pos)
print(cost)

Fixed submission:
N, M= map(int, input().split())
A = []
for i in range(N):
    a = list(map(int, input().split()))
    A.append(a)
A = sorted(A)
count = 0
cost = 0
i = 0
while count < M:
    cost += A[i][0] * min(A[i][1],M-count)
    count += min(A[i][1],M-count)
    i += 1    
print(cost)
Buggy python submission (verdict: Runtime Error):
N,A,B,C = map(int, input().split())
l = list(map(int, input().split()))
def dfs(cur,a,b,c):
    if cur == N:
        if min(a, b, c) > 0:
                return abs(a-A) + abs(b-B) + abs(c-C) - 30
        else:
                return 10**9
    ret0 = dfs(cur+1, a, b, c)
    ret1 = dfs(cur+1, a + l[cur], b, c) + 10
    ret2 = dfs(cur+1, a, b + l[cur], c) + 10
    ret3 = dfs(cur+1, a, b, c + l[cur]) + 10
    return min(ret0,ret1,ret2,ret3)

print(dfs(0, 0, 0, 0))

Fixed submission:
N,A,B,C = map(int, input().split())
l = [int(input()) for i in range(N) ]
def dfs(cur,a,b,c):
    if cur == N:
        if min(a, b, c) > 0:
                return abs(a-A) + abs(b-B) + abs(c-C) - 30
        else:
                return 10**9
    ret0 = dfs(cur+1, a, b, c)
    ret1 = dfs(cur+1, a + l[cur], b, c) + 10
    ret2 = dfs(cur+1, a, b + l[cur], c) + 10
    ret3 = dfs(cur+1, a, b, c + l[cur]) + 10
    return min(ret0,ret1,ret2,ret3)

print(dfs(0, 0, 0, 0))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
d = [0]*m
for i in range(1,m):
    d[i] = x[i]-x[i-1]
d.sort()
if n < m:
    d = d[1:m-n]
else:
    d = [0]
ans
for i in range(len(d)):
    ans += d[i]
print(ans)

Fixed submission:
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
d = [0]*m
for i in range(1,m):
    d[i] = x[i]-x[i-1]
d.sort()
if n < m:
    d = d[1:m-n+1]
else:
    d = [0]
ans = 0
for i in range(len(d)):
    ans += d[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
d = [0]*m
for i in range(1,m):
    d[i] = x[i]-x[i-1]
d.sort()
ans = 0
if n < m:
    for i in range(0,n+2):
        ans += d[i]
print(ans)

Fixed submission:
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
d = [0]*m
for i in range(1,m):
    d[i] = x[i]-x[i-1]
d.sort()
if n < m:
    d = d[1:m-n+1]
else:
    d = [0]
ans = 0
for i in range(len(d)):
    ans += d[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
d = [0]*m
for i in range(1,m):
    d[i] = x[i]-x[i-1]

for i in range(n-1):
    if d == []:
        break
    else:
        d.remove(max(d))
ans = 0
for i in range(len(d)):
    ans += d[i]
print(ans)

Fixed submission:
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
d = [0]*m
for i in range(1,m):
    d[i] = x[i]-x[i-1]
d.sort()
if n < m:
    d = d[1:m-n+1]
else:
    d = [0]
ans = 0
for i in range(len(d)):
    ans += d[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
c,a,b = map(int, input().split())
printint((a * c / 2))

Fixed submission:
c,a,b = map(int, input().split())
print(int(a * c / 2))