Harryxun/stf_run huggingface dataset:
N, K = map(int, input().split())
 
if K % 2:
  print(pow(int(N / K), 3)
else:
  even = int(N / K)
  odd = int(N / int(K / 2)) - even
  print(even, odd)
  print(pow(even, 3) + pow(odd, 3))

### FIXED CODE ###

N, K = map(int, input().split())
 
if K % 2 == 1:
  print(pow(int(N / K), 3))
else:
  even = int(N / K)
  odd = int(N / int(K / 2)) - even
  print(pow(even, 3) + pow(odd, 3))
N, M = map(int, input().split())
valuesDict = {}
for i in range(N):
  today = i + 1
  A, B = map(int, input().split())
  valuesDict[today+A] += B
answer = 0
for i in range(M):
  today = i + 1
  answer += valuesDict[today]

print(answer)


### FIXED CODE ###

import heapq
N, M = map(int,input().split())
reward = [[] for _ in range(M)]
for i in range(N):
  A,B = map(int,input().split())
  if A <= M:
    reward[A-1].append(B)
q = []
ans = 0
for day in range(M):
  for r in reward[day]:
    heapq.heappush(q,-r)
  if len(q) >0:
    ans += -heapq.heappop(q)
print(ans)
a,b,c=input().split()
print(a+c if b=='+' else a-c)

### FIXED CODE ###

A, op, B = input().split()
if op == '+':
    print(int(A) + int(B))
else:
    print(int(A) - int(B))
n,k = map(int, raw_input().split())
score,d,cd = 0,None,0
for i,l in enumerate(raw_input()):
	if d != l:
		cd +=1
		d = l
	if i and s[i-1] == s[i]:  score += 1


if cd > 2:
	t = min(k,((cd - 2)+1)/2)
	k -= t
	score += 2 * t 
	cd -= 2 * t
if cd == 2 and k:
	score +=1
	cd -= 1
print score

### FIXED CODE ###

n,k = map(int, raw_input().split())
s = raw_input()
cd = 0
d = None
for l in s:
	if d != l:
		cd +=1
		d = l
score = 0
for u,v in zip(s,s[1:]):
	if u == v:
		score +=1

while(k and cd > 1):

	if cd > 2:
		score += 2 
		cd -= 2
	elif cd == 2:
		score +=1
		cd -= 1
	k -=1
print score
from functools import reduce
import fractions

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input().rstrip())
As = input().rstrip().split(" ")
As = [int(p) for p in As]

cand = lcm_list(As)

ans = sum([l // x for x in a]) % int(1e9+7)
print(sum)


### FIXED CODE ###

from functools import reduce
import fractions

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input().rstrip())
As = input().rstrip().split(" ")
As = [int(p) for p in As]

cand = lcm_list(As)

sum = 0

for num in As:
    sum = sum + cand // num

print(sum % int(1e9+7) )
N,M = map(int,input().split())
ab = {}
for i in range(N):
    a,b = map(int,input().split())
    ab[a] = b

keys = sorted(ab.keys())

ans = 0
honsu = 0
money = 0
pre_money = 0
for i in keys:
    if honsu >= M:
        money = pre_money
        break
    ans += ab[i] * i
    honsu += ab[i]
    if honsu >= M:
        money = i
        break
    pre_money = i

for j in range(ab[money]):
    if honsu == M:
        break
    honsu -= 1
    ans -= money

print(ans)


### FIXED CODE ###

N,M = map(int,input().split())
ab = {}
for i in range(N):
    a,b = map(int,input().split())
    if a in ab.keys():
        ab[a] += b
        continue
    ab[a] = b

keys = sorted(ab.keys())

ans = 0
kosu = 0
for k in keys:
    kosu += ab[k]
    if kosu >= M:
        kosu -= ab[k]
        break
    ans += k * ab[k]

for i in range(ab[k]):
    if kosu == M:
        break
    kosu += 1
    ans += k
print(ans)
import itertools
N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))

A = itertools.permutation(range(1,N))
for i in N:
  if P == A[i]:
    cnt_a = i
  if Q == A[i]:
    cnt_b = i

print(abs(a-b))

### FIXED CODE ###

import itertools

N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))

A = list(itertools.permutations(range(1,N+1)))
cnt_a = 0
cnt_b = 0
for i in range(len(A)):
  if P == A[i]:
    cnt_a += i
  if Q == A[i]:
    cnt_b += i

print(abs(cnt_a - cnt_b))
n = int(input())
a = list(map(int, input()))
ca = []
cnt = 0
for i in range(len(a)-1):
  if(a[i]<a[i+1]):
    ca.append(cnt)
    cnt = 0
  else:
    cnt += 1
if(a[len(a)-2]>a[len(a)-1]):
  cnt += 1
ans = max(max(ca), cnt)
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ca = []
cnt = 0
for i in range(len(a)-1):
  if(a[i]<a[i+1]):
    ca.append(cnt)
    cnt = 0
  else:
    cnt += 1
ca.append(0)
ans = max(max(ca), cnt)
print(ans)
N = list(map(int,input().split()))
math = N[0] * N[1]
 if math % 2 == 1
 return Odd
 else 
 return Even

### FIXED CODE ###

N = list(map(int,input().split()))
math = N[0] * N[1]
if math % 2 == 1:
  print("Odd")
else:
  print("Even")
import sys
n,k = map(str, input().split())
s = list(str(input()))

zero_count_list = []
zero_count = 0
one_count_list = []
one_count = 0
s_size = len(s)

for index, i in enumerate(s):
    if i == "0":
        zero_count += 1
    else:
        if zero_count != 0:
            zero_count_list.append(zero_count)
        zero_count = 0
    if index == s_size - 1:
        if zero_count != 0:
            zero_count_list.append(zero_count)

for index, i in enumerate(s):
    if i == "1":
        one_count += 1
    else:
        if one_count != 0:
            one_count_list.append(one_count)
        one_count = 0
    if index == s_size - 1:
        if one_count != 0:
            one_count_list.append(one_count)
if k => len(zero_count_list):
    print(s_size)
    sys.exit(0)

### FIXED CODE ###

s = list(input())
first_zero = []
first_one = []
s_size = len(s)
for i in range(s_size):
    if i % 2 == 0:
        first_zero.append("0")
        first_one.append("1")
    else:
        first_zero.append("1")
        first_one.append("0")

count_zero = 0
count_one = 0

for index,number in enumerate(s):
    if number == first_zero[index]:
        pass
    else:
        count_zero += 1

    if number == first_one[index]:
        pass
    else:
        count_one += 1

if count_one > count_zero:
    print(count_zero)
else:
    print(count_one)
from itertools import accumulate
from bisect import bisect_left, bisect_right

n = int(input())
xs = [int(x) for x in input().split()]

ys = [0] + list(accumulate(xs))

rs = range(2, n-2)
v = []
for i in rs:
    j = bisect_left(ys, ys[i]//2)
    min1, max1 = sorted([ys[j], ys[i] - ys[j]])
    min2, max2 = sorted([ys[j-1], ys[i] - ys[j-1]])
    max_, min_ = (max1, min1) if max1 - min1 < max2 - min2 else (max2, min2)

    k = bisect_left(ys, (ys[-1] - ys[i])//2 + ys[i])
    min1, max1 = sorted([ys[k] - ys[i], ys[-1] - ys[k]])
    min2, max2 = sorted([ys[k-1] - ys[i], ys[-1] - ys[k-1]])
    max__, min__ = (max1, min1) if max1 - min1 < max2 - min2 else (max2, min2)

    minn, _, _, maxx = sorted([max_, min_, max__, min__])
    v.append(maxx - minn)

print(min(v))

### FIXED CODE ###

from itertools import accumulate, islice
from bisect import bisect_left

n = int(input())
xs = [int(x) for x in input().split()]
ys = list(accumulate(xs))
zs, total = ys[:-1], ys[-1]

rs = range(2, n-2)
v = []
for i, z in islice(enumerate(zs), 1, n-1):
    j = bisect_left(zs, z//2)
    splits = ((zs[j+k], z - zs[j+k]) for k in (-1, 0, 1) if 0 <= j+k <= i)
    a, b = min(splits, key=lambda s:abs(s[0]-s[1]))

    j = bisect_left(zs, (total - z)//2 + z)
    splits = ((zs[j+k] - z, total - zs[j+k]) for k in (-1, 0, 1) if i <= j+k <= n-2)
    c, d = min(splits, key=lambda s:abs(s[0]-s[1]))

    minn, _, _, maxx = sorted((a,b,c,d))
    v.append(maxx - minn)

print(min(v) if v else max(xs) - min(xs))
n,k = map(int, input().split())

str = input().split()

happy = 0
unhappy = 0

for i in range(n):
  if(str[i] == str[i+1]):
    happy += 1
  else:
    unhappy += 1
    
print(happy + 2 * k)


### FIXED CODE ###

n,k = map(int, input().split())
 
str = input()
happy = 0
unhappy = 0
 
for i in range(n-1):
  if(str[i] == str[i+1]):
    happy += 1
  else:
    unhappy += 1
print( min(n-1,(happy + 2 * k )))

# 10 1
# LLLLLRRRRRの時、happy + 2 * kだけやったら10になるけど、幸福になる人数は最高でも9人(n-1人)
# coding: UTF-8
from collections import deque
N, M = map(int,input().split())
p = {}
link = set()
q = {}

for u in range(1,N+1):
  q[u] = deque()

for j in range(M):
  L,R,D = map(int,input().split())
  link.add((L,R,D))
  q[L].append((R,D))
  q[R].append((L,-D))
  
def depthfirstsearch(start):
  while q[start]:
    target,d = q[start].pop()
    if target not in p:
      p[target] = p[start] + d
      depthfirstsearch(target)

for s in range(1,N+1):
  if s not in p:
    p[s] = 0
    depthfirstsearch(s)

yes = True
for L,R,D in link:
  if p[R] != p[L] + D:
    print("No")
    yes = False
if yes:
  print("Yes")


### FIXED CODE ###

# coding: UTF-8
from collections import deque
N,M = map(int,input().split())
link = [ [] for _ in range(N+1)]
value = [ -1 for _ in range(N+1)]

for _ in range(M):
  L,R,D = map(int,input().split())
  link[L].append((R,D))
  link[R].append((L,-D))

searched = set()
queue = deque()
for u in range(N+1):
  if u not in searched:
    queue.append(u)
    searched.add(u)
    value[u] = 0
    while queue:
      v = queue.popleft()
      for w,d in link[v]:
        if w not in searched:
          value[w] = value[v] + d
          queue.append(w)
          searched.add(w)

#verification
for v in range(N+1):
  for w,d in link[v]:
    if value[w] != value[v] + d:
      print("No")
      exit()
print("Yes")
import itertools

dx = (0, 0, 0, 1,-1, 1, 1,-1,-1,-2, 2, 0, 0)
dy = (0, 1,-1, 0, 0, 1,-1, 1,-1, 0, 0,-2, 2)
dd = (5, 9, 13)

def drop(fab, used, size_list):
    for xy in range(100):
        y = xy%10
        x = xy//10
        size = size_list[used]
        check = True
        for i in range(size):
            if fab[y + dy[i] + 2][x + dx[i] + 2] == 0:
                check = False
        if check:
            for i in range(size):
                fab[y + dy[i] + 2][x + dx[i] + 2] -= 1
            if sum(map(sum, fab)):
                result = drop(fab, used + 1, size_list)
                if result:
                    result.append([x, y, dd.index(size) + 1])
                    return result
                for i in range(size):
                    fab[y + dy[i] + 2][x + dx[i] + 2] += 1
            else:
                return [[x, y, dd.index(size) + 1]]
    return False

fab = [[0 for i in range(14)] for j in range(14)]

n = int(input())

for i in range(10):
    fab[i + 2][2:12] = list(map(int, input().split()))

s = sum(map(sum, fab))
d_all = list(itertools.combinations_with_replacement([5,9,13], n))
d_list = [l for l in d_all if sum(l) == s]

ans = [0 for i in range(n)]
for d in d_list:
#    d_tmp = sorted(d)[::-1]
    d_tmp = d
    ans = drop(fab, 0, d_tmp)
    if ans:
        for a in ans:
            print(*a)
        break



### FIXED CODE ###

import itertools

dx = (0, 0, 0, 1,-1, 1, 1,-1,-1,-2, 2, 0, 0)
dy = (0, 1,-1, 0, 0, 1,-1, 1,-1, 0, 0,-2, 2)
dd = (5, 9, 13)

def drop(fab, start, used, size_list):
    for xy in range(start, 100):
        y = xy%10
        x = xy//10
        size = size_list[used]
        for i in range(size):
            if not fab[y + dy[i] + 2][x + dx[i] + 2]:
                break
        else:
            for i in range(size):
                fab[y + dy[i] + 2][x + dx[i] + 2] -= 1
            if sum(map(sum, fab)):
                if size == size_list[used + 1]:
                    result = drop(fab, xy, used + 1, size_list)
                else:
                    result = drop(fab, 0, used + 1, size_list)
                if result:
                    result.append([x, y, dd.index(size) + 1])
                    return result
                for i in range(size):
                    fab[y + dy[i] + 2][x + dx[i] + 2] += 1
            else:
                return [[x, y, dd.index(size) + 1]]
    return False

fab = [[0 for i in range(14)] for j in range(14)]

n = int(input())

for i in range(10):
    fab[i + 2][2:12] = list(map(int, input().split()))

s = sum(map(sum, fab))
d_all = list(itertools.combinations_with_replacement([5,9,13], n))
d_list = [l for l in d_all if sum(l) == s]

ans = [0 for i in range(n)]
for d in d_list:
    d_tmp = sorted(d)[::-1]
    ans = drop(fab, 0, 0, d_tmp)
    if ans:
        for a in ans:
            print(*a)
        break
n,m=map(int, input().split())
a=[list(map(int, input().split())) for i in range(m)]
a.sort()
end=n
ans=0
for i in range(m):
    if a[i][0]>=end:
        ans+=1
        end=n
    end=min(a[i][1],end)
    count+=1
    #print(end,ans)
print(ans+1)

### FIXED CODE ###

n,m=map(int, input().split())
a=[list(map(int, input().split())) for i in range(m)]
a.sort()
end=n
ans=0
for i in range(m):
    if a[i][0]>=end:
        ans+=1
        end=n
    end=min(a[i][1],end)
print(ans+1)
a, b = map(int, input().split())
s = input()
import sys
if len(s) != a + b + 1:
  print('No')
else:
  for i in range(a):
    if !(s[i].isdigit()):
      print('No')
      sys.exit(0)
  for i in range(b):
    if !(s[len(a)+i+1].isdigit()):
      print('No')
      sys.exit(0)
  if s[len(a)] != '-':
    print('No')
  else:
    print('Yes')

### FIXED CODE ###

a, b = map(int, input().split())
s = input()
import sys
if len(s) != a + b + 1:
  print('No')
else:
  for i in range(a):
    if s[i].isdigit() == False:
      print('No')
      sys.exit(0)
  for i in range(b):
    if s[a+i+1].isdigit() == False:
      print('No')
      sys.exit(0)
  if s[a] != '-':
    print('No')
  else:
    print('Yes')
n, k = map(int, input().split())
Ds = list(map(int, input().split()))

for i in range(n, n*11):
  for d in Ds:
    if d in int(list(str(i))):
      break
  else:
    print(i)
    exit(0)

### FIXED CODE ###

n, k = map(int, input().split())
Ds = list(map(int, input().split()))

for i in range(n, n*11):
  for d in Ds:
    if d in list(map(int, list(str(i)))):
      break
  else:
    print(i)
    exit(0)
import math
import sys


def parse(file):
    n = int(file.readline().strip())
    nums = map(int, file.readline().split())
    return n, nums


def main(n, nums):
    minimum_abs = math.inf
    negatives = 0
    ans = 0

    for num in nums:
        if num < 0:
            a = - num
            negatives += 1
        else:
            a = num

        if a < minimum_abs:
            minimum_abs = a
        ans += a

    if negatives % 2 == 1:
        ans -= (minimum_abs * 2)

    return ans


if __name__ == '__main__':
    print(main(*parse(sys.stdin)))

### FIXED CODE ###


import sys


def parse(file):
    n = int(file.readline().strip())
    nums = map(int, file.readline().split())
    return n, nums


def main(n, nums):
    minimum_abs = 1e20
    negatives = 0
    ans = 0

    for num in nums:
        if num < 0:
            a = - num
            negatives += 1
        else:
            a = num

        if a < minimum_abs:
            minimum_abs = a
        ans += a

    if negatives % 2 == 1:
        ans -= (minimum_abs * 2)

    return ans


if __name__ == '__main__':
    print(main(*parse(sys.stdin)))
n = int(input())
i = 0
total = 0
while i < n:
  date = input().split()
  m = int(date[0])
  t = date[1]
  if t == "JPY":
    total += m
  else:
    total += m * 380000.0
  i += 1
  
print(total)
    

    



### FIXED CODE ###

n = float(input())
i = 0
total = 0
while i < n:
  date = input().split()
  m = float(date[0])
  t = date[1]
  if date[1] == "JPY":
    total += m
  else:
    total += m * 380000
  i += 1
  
print(total)
n=input()
a=list(map(int,input().split()))
print(a.max()-a.min())

### FIXED CODE ###

n=input()
a=list(map(int,input().split()))
print(max(a)-min(a))
a, b, c = map(int, input().split())
low = 0
high  = 0
 
for i in input().split():
    if int(i) < c:
        low += 1
    else:
        high += 1
 
print(min(low, high))

### FIXED CODE ###

a, b, c = map(int, input().split())
print('YES' if a <= c <= a + b else 'NO')
import sys
readline = sys.stdin.readline
li = []
for i, s in enumerate(readline().replace("_").strip()):
    if s == "\\":
        li.append([i, 0])
    elif s == "/":
        if li:
            if li[-1][1] == 0:
                li[-1][1] = i - li[-1][0]
            else:
                for j in range(len(li) - 1, -1, -1):
                    if li[j][1] == 0:
                        li = li[:j] + [[li[j][0], sum(tuple(zip(*li[j + 1:]))[1]) + i - li[j][0]]]
                        break
ans = []
for a in li:
    if a[1] != 0:
        ans.append(a[1])
print(sum(ans))
print(len(ans), *ans)



### FIXED CODE ###

li1 = []
li2 = []
for i, s in enumerate(input()):
    if s == "\\":
        li1.append(i)
    elif s == "/" and li1:
        j = li1.pop()
        c = i - j
        while li2 and li2[-1][0] > j:
            c += li2[-1][1]
            li2.pop()
        li2.append((j, c))
if li2:
    li3 = list(zip(*li2))[1]
    print(sum(li3))
    print(len(li3), *li3)
else:
    print(0, 0, sep="\n")
n = int(input())
s0=list(str(n))
ans=0

if len(s0)==1:
    print(n)
    exit()

for i in range(1,n+1):
    s1=list(str(i))
    if s1[-1]=='0':
        continue
    if s1[0]==s1[-1]:
        ans+=1
    for j in range(2,len(s0)):#nより小さい桁数のものを足す
        ans+=10**(j-2)
    if int(s0[0])>int(s1[-1]):#nより入れ替えた数の最高位数が小さいとき、全て足す
        ans+=10**(len(s0)-2)
    elif s0[0]==s1[-1]:#nと入れ替えた数の最高位数が同じ時
        ans+=int(''.join(s0[1:len(s0)-1]))+1
        if int(s0[-1])<int(s1[0]):
            ans-=1
print(ans)


### FIXED CODE ###

n = int(input())
s0=list(str(n))
ans=0

if len(s0)==1:
    print(n)
    exit()

if len(s0)==2:
    for i in range(1,n+1):
        s1=list(str(i))
        if s1[-1]=='0':
            continue
        if s1[0]==s1[-1]:
            ans+=1
        if int(s1[-1])*10+int(s1[0])<=n:
            ans+=1
    print(ans)
    exit()

for i in range(1,n+1):
    s1=list(str(i))
    if s1[-1]=='0':
        continue
    if s1[0]==s1[-1]:
        ans+=1
    for j in range(2,len(s0)):#nより小さい桁数のものを足す
        ans+=10**(j-2)
    if int(s0[0])>int(s1[-1]):#nより入れ替えた数の最高位数が小さいとき、全て足す
        ans+=10**(len(s0)-2)
    elif s0[0]==s1[-1]:#nと入れ替えた数の最高位数が同じ時
        ans+=int(''.join(s0[1:len(s0)-1]))+1
        if int(s0[-1])<int(s1[0]):
            ans-=1
print(ans)
v

### FIXED CODE ###

n = int(input())
P = [int(input()) for _ in range(n)]

P.sort()
print(int(P[n-1]/2) + sum(P[:n-1]))
n = int(input())
a,b, = map(int,input().split())

if n == 1:
    print("Hello World")
else:
    print(a+b)

### FIXED CODE ###

n = int(input())
if n == 2:
    a = int(input())
    b = int(input())


if n == 1:
    print("Hello World")
else:
    print(a+b)
print(eval(input())

### FIXED CODE ###

x = input()
print(eval(x))
import collections
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


n=int(input())

arr=[]
for i in range(n):
    a,b=(map(int, input().split()))
    arr.append([a,b])
arr=sorted(arr, key=lambda x: x[1], reverse=True)
arr=sorted(arr, key=lambda x: x[0])

tmparr=[]
for num in range(len(arr)-1):
    #print(num)
    #tmparr=[]
    #for nn,i in enumerate(arr):
    for nn,i in enumerate(arr[num+1:]):
        #if nn==num:
        #    continue
        g=gcd(arr[num][0]-i[0],arr[num][1]-i[1])
        tmparr.append(((arr[num][0]-i[0]),(arr[num][1]-i[1])))
        #print(tmparr)
    #print(tmparr)
#print(set(tmparr))
c = collections.Counter(tmparr)
print(n-c.most_common()[0][1])


### FIXED CODE ###

import collections

n=int(input())

if n==1:
    a,b=(map(int, input().split()))
    print(1)
else:

    arr=[]
    for i in range(n):
        a,b=(map(int, input().split()))
        arr.append([a,b])
    arr=sorted(arr, key=lambda x: x[1], reverse=True)
    arr=sorted(arr, key=lambda x: x[0])
    
    tmparr=[]
    for num in range(len(arr)-1):
        #print(num)
        #tmparr=[]
        #for nn,i in enumerate(arr):
        for nn,i in enumerate(arr[num+1:]):
            #if nn==num:
            #    continue
            #g=gcd(arr[num][0]-i[0],arr[num][1]-i[1])
            tmparr.append(((arr[num][0]-i[0]),(arr[num][1]-i[1])))
            #print(tmparr)
        #print(tmparr)
    #print(set(tmparr))
    c = collections.Counter(tmparr)
    print(n-c.most_common()[0][1])
rootList = [-1 for i in range(n)]
parent = [0 for i in range(n)]
lenList = [0 for i in range(n)]

def getRoot(x):
    r = rootList[x]
    if r < 0:
        rootList[x] = x
    elif r != x:
        rootList[x] = getRoot(r)
    return rootList[x]


edgeList.sort(key=lambda x: x[0])
flag = True
while flag:
    flag = False
    for e in edgeList:    # weight:e[0], e[1]->e[2]
        if e[2] == 0:
            continue
        x = getRoot(e[1])
        y = getRoot(e[2])
        if x == 0 != y:
            parent[e[2]] = e[1]
            lenList[e[2]] += lenList[e[1]] + e[0]
            rootList[y] = 0
            flag = True
            break

for i, j in zip(range(n), lenList):
    print(i, j)

### FIXED CODE ###

n = int(input())
edgeList = []
for i in range(n):
    a = list(map(int, input().split()))
    for j in range(a[1]):
        edgeList.append([a[2*j+3], i, a[2*j+2]])
 
 
rootList = [-1 for i in range(n)]
parent = [0 for i in range(n)]
lenList = [float("inf") for i in range(n)]
lenList[0] = 0
def getRoot(x):
    r = rootList[x]
    if r < 0:
        rootList[x] = x
    elif r != x:
        rootList[x] = getRoot(r)
    return rootList[x]
 
flag = True
while flag:
    flag = False
    edgeList.sort(key=lambda x: (x[0] + lenList[x[1]]))
    for e in edgeList:    # weight:e[0], e[1]->e[2]
        if e[2] == 0:
            continue
        x = getRoot(e[1])
        y = getRoot(e[2])
        if x == 0 != y:
            parent[e[2]] = e[1]
            lenList[e[2]] = lenList[e[1]] + e[0]
            rootList[y] = 0
            flag = True
            break
 
for i, j in zip(range(n), lenList):
    print(i, j)
while 1:
    n,m=list(map(int,input().split()))
    if n==0 and m==0:break
    l=range(1,1+n)
    st=m-1
    while len(l)!=1:
        del l[st]
        st+=(m-1)
        while 1:
            if st>=len(l):
                st=st-len(l)
            if st<len(l):break  
    print(l[0])



### FIXED CODE ###

while 1:
    n,m=list(map(int,input().split()))
    if n==0 and m==0:break
    l=list(range(1,1+n))
    st=m-1
    while len(l)!=1:
        del l[st]
        st+=(m-1)
        while 1:
            if st>=len(l):
                st=st-len(l)
            if st<len(l):break  
    print(l[0])
n, d = map(int, input().split())
cnt = 0

for i in range(n):
    Z = list(map(int, input().split()))
    X = Z[0]
    Y = Z[1]

    if X**2 + Y**2 <= D**2:
        cnt += 1
print(cnt)


### FIXED CODE ###

N, D = map(int, input().split())
cnt = 0

for i in range(N):
    Z = input()
    Z = Z.split()
    X = int(Z[0])
    Y = int(Z[1])
    if X**2 + Y**2 <= D**2:
        cnt += 1
print(cnt)
S=input()
key="keyence"

exclude=0
now=False
count=0
for i in range(len(S)):
    s=S[i]
    if s==key[count]:
        if now:
            now=False
        count+=1
    else:
        if (not now) and exclude>0:
            print("NO")
            exit()
        if not now:
            exclude+=1
            now=True
if count!=len(S)-1:
    print("NO")
else:
    print("YES")


### FIXED CODE ###

S=input()
key="keyence"

if S.find(key)!=-1:
    print("YES")
    exit()


count=0
for i in range(7):
    s=S[i]
    if s==key[count]:
        count+=1
    else:
        break

for i in range(-1,-8,-1):
    s=S[i]
    if s==key[i]:
        count+=1
    else:
        break
if count>=7:
    print("YES")
else:
    print("NO")
n,a,b,c,d=map(int,input().split())
s=input()
for i in range(n-1):
	if s[i]==s[i+1]=="#":
		print("No")
		exit()
three=0
s="#"+s
for i in range(b,d+1):
	if s[i]==s[i+1]==s[i-1]==".":
		three=True
if c<d:
	print("Yes")
elif three==True:
	print("Yes")
else:
	print("No")

### FIXED CODE ###

n,a,b,c,d=map(int,input().split())
s=input()
for i in range(a,d-1):
	if s[i]==s[i+1]=="#":
		print("No")
		exit()
three=0
s="#"+s+"#"
for i in range(b,d+1):
	if s[i]==s[i+1]==s[i-1]==".":
		three=True
if c<d:
	print("Yes")
elif three==True:
	print("Yes")
else:
	print("No")
N = int(input())
L = sorted(map(int,input().split()),reverse=True)
num = 0

for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            array = [L[i],L[j],L[k]]
            if(array[0]>=array[1]+array[2]):
                break
            else:
                num += 1
print(num)


### FIXED CODE ###

A,B = map(int,input().split())
if(A>=2*B):
    print(A-2*B)
else:
    print(0)