Harryxun/stf_run huggingface dataset:
num1, num2, num3 = input().split(" ")
numList = [int(num1),int(num2),int(num3)]
numList.sort(reverse=True)
maxNum = numList[0]
midNum = numList[1]
minNum = numList[2]

count = 0

def check():
    count += (midNum - minNum) // 2
    count += (maxNum - midNum)

if midNum % 2 == 0 and minNum % 2 == 0:
    #count += (midNum - minNum) // 2
    #count += (maxNum - midNum)
    check()
elif midNum % 2 == 1 and minNum % 2 == 1:
    if maxNum % 2 == 0:
        maxNum += 2
        midNum += 2
        midNum += 2
        #count += (midNum - minNum) // 2
        #count += (maxNum - midNum)
        check()
        count += 2
    else:
        check()
        #count += (midNum - minNum) // 2
        #count += (maxNum - midNum)
else:
    if midNum % 2 == 0:
        maxNum += 1
        minNum += 1
        check()
        #count += (midNum - minNum) // 2
        #count += (maxNum - midNum)
        count += 1
    else:
        maxNum += 1
        midNum += 1
        check()
        #count += (midNum - minNum) // 2
        #count += (maxNum - midNum)
        count += 1
print(count)




### FIXED CODE ###

num1, num2, num3 = input().split(" ")
numList = [int(num1),int(num2),int(num3)]
numList.sort(reverse=True)
maxNum = numList[0]
midNum = numList[1]
minNum = numList[2]

count = 0
if maxNum % 2 == 0:
    if midNum % 2 == 0 and minNum % 2 == 0:
        count += (midNum - minNum) // 2
        count += (maxNum - midNum)
    elif midNum % 2 == 1 and minNum % 2 == 1:
        maxNum += 2
        midNum += 2
        midNum += 2
        count += (midNum - minNum) // 2
        count += (maxNum - midNum)
        count += 2
    else:
        if midNum % 2 == 0:
            maxNum += 1
            minNum += 1
            count += (midNum - minNum) // 2
            count += (maxNum - midNum)
            count += 1
        else:
            maxNum += 1
            midNum += 1
            count += (midNum - minNum) // 2
            count += (maxNum - midNum)
            count += 1
else:
    if midNum % 2 == 0 and minNum % 2 == 0:
        count += (midNum - minNum) // 2
        count += (maxNum - midNum)
    elif midNum % 2 == 1 and minNum % 2 == 1:
        count += (midNum - minNum) // 2
        count += (maxNum - midNum)
    else:
        if midNum % 2 == 0:
            maxNum += 1
            minNum += 1
            count += (midNum - minNum) // 2
            count += (maxNum - midNum)
            count += 1
        else:
            maxNum += 1
            midNum += 1
            count += (midNum - minNum) // 2
            count += (maxNum - midNum)
            count += 1
print(count)
n = int(input())
dict = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
for _ in range(n):
    s = input()
    if s in dict:
        dict[s] = dict[s] + 1
for k, l  in dict.items():
    print(k + ' x ' + str(l))

### FIXED CODE ###

n = (input())
x, y = divmod(int(n), 1000)
if y == 0:
    print(0)
else:
    ans = (1000 * (x + 1)) - int(n)
    print(ans)
s = int(input())
num = [[0 for i in range(10)] for j in range(10)]

ans = 0

for _ in range(n):
    i = _ + 1
    if i < 10:
        num[i][i] += 1
    elif i % 10 != 0:
        moji = str(i)
        num[int(moji[0])][int(moji[len(moji)-1])] += 1
    else:
        pass

for i in range(1, 10):
    for j in range(1, 10):
        ans += num[i][j] * num[j][i]

print(ans)

### FIXED CODE ###

n = int(input())
num = [[0 for i in range(10)] for j in range(10)]

ans = 0

for _ in range(n):
    i = _ + 1
    if i < 10:
        num[i][i] += 1
    elif i % 10 != 0:
        moji = str(i)
        num[int(moji[0])][int(moji[len(moji)-1])] += 1
    else:
        pass

for i in range(1, 10):
    for j in range(1, 10):
        ans += num[i][j] * num[j][i]

print(ans)
n,k,q = map(int, input().split())

scores = []

for i in range(n):
  scores.append(n-k)

for i in range(q):
  a = int(input()) #Ai
  scores.insert(a-1, scores[a-1]+1)
  
  
for i in range(n):
  if(scores[i] > 0):
    print("Yes")
  elif:
    print("No")

### FIXED CODE ###

n,k,q = map(int, input().split())
 
scores = []
 
for i in range(n):
  scores.append(k-q)
 
for i in range(q):
  a = int(input()) #Ai
  scores[a-1] = scores[a-1]+1
  
for i in range(n):
  if(scores[i] > 0):
    print("Yes")
  else:
    print("No")
X,Y,Z,K = map(int, input().split())
a_list = [int(i) for i in input().split()]
b_list = [int(i) for i in input().split()]
c_list = [int(i) for i in input().split()]
a_list.sort(reverse = True)
b_list.sort(reverse = True)
c_list.sort(reverse = True)
total_list = [0 for _ in range(min(106307,X*Y*Z))]
for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if (i+1)*(j+1)*(k+1) <= K:
                total_list[i*(Z*Y)+j*Z+k] = (a_list[i] + b_list[j] + c_list[k])
            else:
                break
print(total_list)
total_list =  sorted(total_list, reverse = True)
for i in range(K):
    print(total_list[i])

### FIXED CODE ###

from heapq import heappush, heappop

# input
X,Y,Z,K = map(int, input().split())
a_list = [int(i) for i in input().split()]
b_list = [int(i) for i in input().split()]
c_list = [int(i) for i in input().split()]
a_list.sort(reverse = True)
b_list.sort(reverse = True)
c_list.sort(reverse = True)

#solve
hq = []
arg_hash = {}
val = a_list[0] + b_list[0] + c_list[0]
heappush(hq, (-val,0,0,0))

for i in range(K):
    ans, a, b, c = heappop(hq)
    print(-ans)

    arg_a = (a+1, b, c)
    arg_b = (a, b+1, c)
    arg_c = (a, b, c+1)

    if a < X-1 and arg_a not in arg_hash:
        arg_hash[arg_a] = 1
        heappush(hq, (-(a_list[a+1]+b_list[b]+c_list[c]),)+arg_a)
    if b < Y-1 and arg_b not in arg_hash:
        arg_hash[arg_b] = 1
        heappush(hq, (-(a_list[a]+b_list[b+1]+c_list[c]),)+arg_b)
    if c < Z-1 and arg_c not in arg_hash:
        arg_hash[arg_c] = 1
        heappush(hq, (-(a_list[a]+b_list[b]+c_list[c+1]),)+arg_c)
N = int(input())
L = list(map(int,input().split()))
L.sort(reverse=True)
count = 0
for n in np.array(range(N)):
    print(f"N:{n}")
    if n != N-1:
        L_s = L[n+1:]
    else:
        L_s = L[n:]
    print(f"L_s:{L_s}")
    for l_s in L_s:
        print(l_s)
        if L[n]%l_s == 0:
            break
    else:
        count += 1

print(count)

### FIXED CODE ###

n = int(input())
data = list(map(int, input().split()))
mx = max(data)
marked = [0]*(mx + 1)
for a in data:
    for x in range(a, mx+1, a):
        marked[x] += 1
ans = 0
for a in data:
    if marked[a] == 1:
        ans += 1
print(ans)
n=int(input())
count=0
for i in range(4):
    if n[i]==2:
        count+=1
print(count)


### FIXED CODE ###

n=input()
count=0
for i in range(4):
    if n[i]=="2":
        count+=1
print(count)
S_dash = list(map(str, input()))
T = list(map(str, input()))


for i in reversed(range(len(S_dash) - len(T) + 1)):
	flg = 1
	for j in range(len(T)):
		if S_dash[i + j] != "?" and S_dash[i + j] != T[j]:
			flg = 0
			break
	if flg:
		for j in range(len(T)):
			S_dash[i + j] = T[j]
		break
		
if flg:
	for i in range(len(S_dash)):
		pass
		# if S_dash[i] == "?":
			# print("a", end = "")
		# else:
			# print(S_dash[i], end = "")
else:
	print("UNRESTORABLE")


### FIXED CODE ###

S_prime = list(map(str, input()))
T = list(map(str, input()))

len_S = len(S_prime)
len_T = len(T)

un = 1

for i in reversed(range(0, len_S - len_T + 1)):
	match = 1
	for j in range(i, i + len_T):
		# print(S_prime[j], T[j - i])
		if S_prime[j] == "?": continue
		if not S_prime[j] == T[j - i]:
			match = 0
			break
	if match:
		un = 0
		# print(i)
		init = i
		break
		
if un:
	print("UNRESTORABLE")
else:
	for i in range(init, init + len_T):
		S_prime[i] = T[i - init]
	
	for i in range(len_S):
		if S_prime[i] == "?":
			print("a", end = "")
		else:
			print(S_prime[i], end = "")
if input() in ['a','e','i','o','u'] print('vowel') else print('constant')


### FIXED CODE ###

if input() in ['a','e','i','o','u']:
    print('vowel')
else:
    print('consonant')
c=list(map(int, input().split()))

W = c[0]
H = c[1]
x = c[2]
y = c[3]



if W*y < W*H / 2:
    S1 = W*y
elif W*y == W*H / 2:
    pass
else:
    S1 = W*H - W*y

if H*x < W*H / 2:
    S2 = H*x
elif H*x == W*H / 2:
    pass
else:
    S2 = W*H - H*x

if S1 < S2:
    Sm = S2
    co = 0
elif S1 > S2:
    Sm = S1
    co = 0
else:
    Sm = S1
    co = 1
    
print(Sm,co)

### FIXED CODE ###

x,a = map(int, input().split())

if x < a:
    print(0)
else:
    print(10)
def div_count(a):
  i= 0
  while a%2 == 0:
    a = a/2
    i+=1
  return i
N = int(input())
list = int(input().split())
count=[]
for u in range(N):
  count.append(div_count(list[u]))
print(max(count))

  
     

### FIXED CODE ###

def div_count(a):
  i= 0
  while a%2 == 0:
    a = a/2
    i+=1
  return i
N = int(input())
numbers = list(map(int,input().split()))
count=[]
for u in range(N):
  count.append(div_count(numbers[u]))
print(min(count))
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

N = int(input())
L = []
for i in range(N):
    c, p = input().split()
    p = int(p)
    L.append([i+1, c, p])
L = sorted(L, lambda x: (x[1], -x[2]))
for i in range(N):
    print(L[i][0])


### FIXED CODE ###

# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

N = int(input())
L = []
for i in range(N):
    c, p = input().split()
    p = int(p)
    L.append([i+1, c, p])
L = sorted(L, key=lambda x: (x[1], -x[2]))
for i in range(N):
    print(L[i][0])
def dfs(u, cnt):
    cnt += point[u]
    counter[u] = cnt
    color[u] = GRAY
    for v in M[u]:
        if color[v] == WHITE:
            dfs(v, cnt)
    color[u] = BLACK


n, q = map(int, input().split())
M = [[] for _ in range(n)]
point = [0] * n
for i in range(n-1):
    a, b = map(int, input().split())
    M[a-1].append(b-1)
    M[b-1].append(a-1)
for i in range(q):
    p, x = map(int, input().split())
    point[p-1] += x
#print(M, point)
    
WHITE, GRAY, BLACK = 0, 1, 2
color = [WHITE] * n

counter = [0] * n
dfs(0, 0)

print(*counter)


### FIXED CODE ###

def dfs(u, cnt):
    cnt += point[u]
    counter[u] = cnt
    color[u] = GRAY
    for v in M[u]:
        if color[v] == WHITE:
            dfs(v, cnt)
    color[u] = BLACK

import sys
sys.setrecursionlimit(1000000)

n, q = map(int, input().split())
M = [[] for _ in range(n)]
point = [0] * n
for i in range(n-1):
    a, b = map(int, input().split())
    M[a-1].append(b-1)
    M[b-1].append(a-1)
for i in range(q):
    p, x = map(int, input().split())
    point[p-1] += x
#print(M, point)
    
WHITE, GRAY, BLACK = 0, 1, 2
color = [WHITE] * n

counter = [0] * n
dfs(0, 0)

print(*counter)
import bisect
a,b,q = map(int,input().split())
s = [-10**11]+[int(input()) for _ in range(a)]+[10**11]
t = [-10**11]+[int(input()) for _ in range(b)]+[10**11]
for i in range(q):
  ans = 10**11
  x = int(input())
  l = bisect.bisect(s,x)
  m = bisect.bisect(t,x)
  arr = [[s[l-1],s[l]],[t[m-1],t[m]]]
  for i in range(4):
    S = 0
    now = x
    for j in range(2):
      S += (now-arr[j][i >> j & 1])*(-1)**(((now-arr[j][i >> j & 1])<0))
      now = arr[j][i >> j & 1]
    if ans > S:
      ans = S
  for i in range(4):
    S = 0
    now = x
    for j in range(2):
      S += (now-arr[1-j][i >> j & 1])*((-1)**((now-arr[1-j][i >> j & 1])<0))
      now = arr[1-j][i >> j & 1]
    if ans > S:
      ans = S
  print(ans)

### FIXED CODE ###

if int(input()[5:7]) >= 5:
  print("TBD")
else:
  print("Heisei")
N, Z, W = map(int, input().split())
a = [int(i) for i in input().split()]
print(max(abs(a[-1] - W), abs(a[-2] - a[-1])))

### FIXED CODE ###

N, Z, W = map(int, input().split())
a = [int(i) for i in input().split()]
if len(a) > 1:
    print(max(abs(a[-1] - W), abs(a[-2] - a[-1])))
else:
    print(abs(a[-1] - W))
N=int(input())
array=list(map(int,input()))
array1=array.sort()
import itertools
list1=itertools.combinations(array1,3)
ans=0
for n in range(len(list1)):
  if list[n][0]!=list[n][1] and list[n][1]!=list[n][2]:
    if list[n][0]+list[n][1]>list[n][2]:
      ans=ans+1
print(ans)

### FIXED CODE ###

import itertools
n = int(input())
data = list(map(int, input().split()))
data1=sorted(data)
a = list(itertools.combinations(data1,3))
ans=0
for m in range(len(a)):
  if a[m][0]!=a[m][1] and a[m][1]!=a[m][2]:
    if a[m][0]+a[m][1]>a[m][2]:
      ans=ans+1
print(ans)
N, M, x= map(int, input().split())
dp=[[0 for i in range(N+1)] for j in range(M+1)]
nap = []
dp[0][0]=0
answ = [10]*M
for _ in range(N):
    nap.append(list(map(int, input().split()))) 

mon=[]
value=[]
for x in nap:
    mon.append(x[0])
for y in nap:
    value.append(y[1:])

ans = []
for i in range(N):
    for j in range(M):
        dp[i+1][j+1] = dp[i][j]+value[i][j]
for m in range(M):
    if answ[m] > ans[m]:
        print(-1)
        exit()


return dp[N][W]

### FIXED CODE ###


import itertools
import sys
import numpy as np
INF = float("inf")
N, M, X = list(map(int, sys.stdin.buffer.readline().split()))
A = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(N)]
 
A = np.array(A, dtype=int)
mat = A[:, 1:]
C = A[:, 0]
 
ans = INF
for choices in itertools.product((True, False), repeat=N):
    choices = np.array(list(choices), dtype=bool)
    if np.all(mat[choices, :].sum(axis=0) >= X):
        ans = min(ans, C[choices].sum())
if ans == INF:
    print(-1)
else:
    print(ans)
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
  tmp = input()
  if(tmp == "AC"):
    AC += 1
  if(tmp == "WA"):
    WA += 1
  if(tmp == "TLE"):
    TLE += 1
  if(tmp == "RE")
    RE += 1
print("AC x "+str(AC))
print("WA x " +str(WA))
print("TLE x " +str(TLE))
print("RE x " +str(RE))

### FIXED CODE ###

N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
  tmp = input()
  if(tmp == "AC"):
    AC += 1
  if(tmp == "WA"):
    WA += 1
  if(tmp == "TLE"):
    TLE += 1
  if(tmp == "RE"):
    RE += 1
print("AC x "+str(AC))
print("WA x " +str(WA))
print("TLE x " +str(TLE))
print("RE x " +str(RE))
x, y = map(int, input().split())
print(x*y/2)


### FIXED CODE ###

x, y, z = map(int, input().split())
print(x*y//2)
input_data = []
data = input()


memory="first"
i=0
k=0

#最後二つが同じなら削除
if data[-1]==data[-2]:
    k+=1
    data=data[:-2]

max_len=len(data)
while max_len!=i:
    if data[i] != memory:
        memory=data[i]
        i+=1             
    else:
   
        memory=data[i:i+2]
        i+=2
    k+=1
    
print(k)

### FIXED CODE ###

input_data = []
data = input()


memory="first"
i=0
k=0

#最後二つが同じなら削除
if data[-1]==data[-2]:
    k+=1
    data=data[:-2]

max_len=len(data)
while max_len!=i:
    try:
        if data[i] != memory:
            memory=data[i]
            i+=1             
        else:
            memory=data[i:i+2]
            i+=2
    except:
        break
    k+=1
    
print(k)
N, A, B = map(int, input().split())

print(sum(i for i in range(1,N+1) if A<= sum(map(int, str(i))) <= B)


### FIXED CODE ###

N, A, B = map(int, input().split())

print(sum(i for i in range(1,N+1) if A<= sum(map(int, str(i))) <= B))
n = int(input())

if n%2 == 0: print({}.format(n/2))
else:        print({}.format(n/2+1))

### FIXED CODE ###

from decimal import Decimal, ROUND_HALF_UP

n = int(input())
print(Decimal(n/2).quantize(Decimal(0), rounding=ROUND_HALF_UP))
import sys
import math
import copy
a = int(input());
b = [int(input()) for i in range(a)];
c = 0;
first = max(b);
g = b.copy();
h = list(g.index(first));
del g[h];
second = max(g);

for i in range(a):
    if max(b) > b[i]:
        print(first);
    elif first == b[i]:
        print(second);


### FIXED CODE ###

import sys
import math
import copy
a = int(input());
b = [int(input()) for i in range(a)];
c = 0;
first = max(b);
g = b.copy();
h = g.index(first);
del g[h];
second = max(g);

for i in range(a):
    if first > b[i]:
        print(first);
    elif first == b[i]:
        print(second);
N = int(input())
A, B = map(int, input().split())
P = listans1 = 0
ans2 = 0
ans3 = 0  
for i in P:
    if A>=i:
        ans1 = ans1 + 1
    if A+1 <= i <= B+1:
        ans2 = ans2 + 1
    if B+1 <= i:
        ans3 = ans3 + 1 


print(min(ans1,ans2,ans3))

### FIXED CODE ###

N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
ans1 = 0
ans2 = 0
ans3 = 0  
for i in P:
    if A>=i:
        ans1 = ans1 + 1
    if A+1 <= i <= B:
        ans2 = ans2 + 1
    if B+1 <= i:
        ans3 = ans3 + 1 


print(min(ans1,ans2,ans3))
N = int(input())
 
t = [int(input()) for i in range(N)]
 
M = int(input())
 
a = []
for k in range(M):
    a.append(map(int, input().split()))       
 
cal = sum(t)
 
for j in range(M):
    print(cal - t[a[j][0] - 1] + a[j][1])

### FIXED CODE ###

N = int(input())
 
t = list(map(int, input().split()))
 
M = int(input())
 
cal = sum(t)
 
for j in range(M):
    p, x = map(int, input().split())
    print(cal - t[p - 1] + x)
import sys
sys.setrecursionlimit(10000)

ls = [0,4,8,12,3,7,11,2,6,10,1,5,9]
S = input()
dp = [[None]*13 for _ in range(len(S))]
mod = 10**9+7
def f(i, r):
    if dp[i][r] != None:
        return dp[i][r]
    if i == 0:
        if S[0] == "?":
            dp[i][r] = 1 if r <= 9 else 0
            return dp[i][r]
        else:
            dp[i][r] = 1 if int(S[0]) == r else 0
            return dp[i][r]
    if S[i] != "?":
        c = int(S[i])
        tmp = (r-c) % 13
        dp[i][r] = f(i-1, ls[tmp]) % mod 
        return dp[i][r]
    else:
        ans = 0
        for j in range(10):
            tmp = (r-j) % 13
            ans = (ans +f(i-1, ls[tmp])) % mod
        dp[i][r] = ans % mod
        return dp[i][r]

print(f(len(S)-1, 5))


### FIXED CODE ###

S = input()
dp = [[0]*13 for _ in range(len(S))]
mod = 10**9+7
for i in range(13):
    if S[0] == "?":
        dp[0][i] = 1 if i <= 9 else 0
    else:
        dp[0][i] = 1 if int(S[0]) == i else 0
for i in range(1,len(S)):
    if S[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i][(k*10+j) % 13] = (dp[i][(k*10+j) % 13]+dp[i-1][k])%mod
    else:
        j = int(S[i])
        for k in range(13):
            dp[i][(k*10+j)%13] = (dp[i][(k*10+j)%13]+dp[i-1][k])%mod
print(dp[len(S)-1][5])
l,r = map(int,input().split())
li = []
if r-l>=2019:
    print(0)
elif r-l<2019:
    for i in range(l,r):
        for j in range(i+1,r+1):
            li.append(i*j%2019)
            if i*j$2019 == 0:
                break
        if i*j$2019 == 0:
            break
                
print(min(li))

### FIXED CODE ###

l,r = map(int,input().split())
ans = 10**20
if r-l>=2019:
    print(0)
    exit()
elif r-l<2019:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans = min(ans,i*j%2019)
            if i*j%2019 == 0:
                break
print(ans)
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path, csgraph_from_dense
def main():
    H, W = map(int, input().split())
    S = [input() for _ in range(H)]
    m = [[0] * (W * H) for _ in range(W * H)]
    def loc(h, w):
        return h * W + w
    def con(h1, w1, h2, w2):
        m[loc(h1, w1)][loc(h2, w2)] = 1
        m[loc(h2, w2)][loc(h1, w1)] = 1

    for h in range(H):
        for w in range(W):
            if S[h][w] == '#':
                continue
            if h > 0:
                if S[h - 1][w] == '.':
                    con(h, w, h - 1, w)
            if h < H - 1:
                if S[h + 1][w] == '.':
                    con(h, w, h + 1, w)
            if w > 0:
                if S[h][w - 1] == '.':
                    con(h, w, h, w - 1)
            if w < W - 1 and S[h][w + 1] == '.':
                con(h, w, h, w + 1)
    EE = shortest_path(csgraph_from_dense(m, null_value=0))
    print(int(np.max(EE[~np.isinf(EE)])))


main()


### FIXED CODE ###

import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path, csgraph_from_dense, floyd_warshall
def main():
    H, W = map(int, input().split())
    S = [input() for _ in range(H)]
    m = [[0] * (W * H) for _ in range(W * H)]
    def loc(h, w):
        return h * W + w
    def con(h1, w1, h2, w2):
        m[loc(h1, w1)][loc(h2, w2)] = 1
        m[loc(h2, w2)][loc(h1, w1)] = 1

    for h in range(H):
        for w in range(W):
            if S[h][w] == '#':
                continue
            if h > 0:
                if S[h - 1][w] == '.':
                    con(h, w, h - 1, w)
            if h < H - 1:
                if S[h + 1][w] == '.':
                    con(h, w, h + 1, w)
            if w > 0:
                if S[h][w - 1] == '.':
                    con(h, w, h, w - 1)
            if w < W - 1 and S[h][w + 1] == '.':
                con(h, w, h, w + 1)
    g = csgraph_from_dense(m)
    EE = floyd_warshall(g)
    print(int(np.max(EE[~np.isinf(EE)])))


main()
# -*- coding: utf-8 -*-
import collections

N, M = map(int,input().split())
A = list(map(int,input().split()))
sort_A = sorted(A, reverse=True)
L = []
for i in range(N):
  L.append(len(bin(sort_A[i])))

count_discount = [0]*M
for i in range(M):
  index = L.index(max(L))
  L[index] = L[index] -1
  count_discount[index] += 1

sum = 0
for i in range(N):
  if count_discount[i] >= 1:
    q, mod = divmod(sort_A[i], (2*count_discount[i]))
    sum += q
  else:
    sum += sort_A[i]
print(sum)

### FIXED CODE ###

import heapq
n,m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)
 
for i in range(m):
	target = heapq.heappop(a)
	heapq.heappush(a, (-1)*(-target//2))
	
print(-sum(a))
s = input()
MOD = 2019
r = [0]*MOD
r[0] = 1
z = 0
t = 0
for i in reversed(s):
    z = int(i) * pow(10,t,m) + z
    z %= MOD
    r[z] += 1
    t += 1
print(sum(i*(i-1)//2 for i in r))


### FIXED CODE ###

s = input()
n = len(s)
m = 2019

a = 0
r = [0 for _ in range(m+1)]
r[0] = 1
z = 0
j = 1
for i in range(0,n):
    j = j * 10 % m
    ss = int(s[n-i-1])*j + z
    z = ss%m



    a += r[z]
    r[z] += 1

print(a)
n=int(input())
s=input()
t=s[0]
ans=1
for i in range(1,n):
    if t!=s[i]:
        ans+=1
        t=s[i]
print(ans)

### FIXED CODE ###

a,b=map(int,input().split())
if a-2*b<0:
    print('0')
else:
    print(a-2*b)