AtCoder Beginner Contest 143 - Curtain

The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)
We will close the window so as to minimize the total horizontal length of the uncovered part of the window.
Find the total horizontal length of the uncovered parts of the window then.

-----Constraints-----
 - 1 \leq A \leq 100
 - 1 \leq B \leq 100
 - A and B are integers.

-----Input-----
Input is given from Standard Input in the following format:
A B

-----Output-----
Print the total horizontal length of the uncovered parts of the window.

-----Sample Input-----
12 4

-----Sample Output-----
4

We have a window with a horizontal length of 12, and two curtains, each of length 4, that cover both ends of the window, for example. The uncovered part has a horizontal length of 4.

Source: atcoder | Difficulty: EASY


Solutions:
(a, b) = list(map(int, input().split()))
k = max(0, a - 2 * b)
print(k)


(n, m) = map(int, input().split())
print(max(0, n - 2 * m))


(a, b) = map(int, input().split())
print(max(a - b * 2, 0))


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


(A, B) = map(int, input().split())
r = max(0, A - 2 * B)
print(r)


(x, y) = map(int, input().split())
print(max(0, x - 2 * y))


(X, Y) = map(int, input().split())
print(max(0, X - Y * 2))


(a, b) = [int(i) for i in input().split()]
print(max([0, a - 2 * b]))


from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(500000)
INF = float('inf')
(YES, Yes, yes, NO, No, no) = ('YES', 'Yes', 'yes', 'NO', 'No', 'no')
(dy4, dx4) = ([0, 1, 0, -1], [1, 0, -1, 0])
(dy8, dx8) = ([0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1])

def inside(y, x, H, W):
	return 0 <= y < H and 0 <= x < W

def ceil(a, b):
	return (a + b - 1) // b

def sum_of_arithmetic_progression(s, d, n):
	return n * (2 * s + (n - 1) * d) // 2

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	g = gcd(a, b)
	return a / g * b

def solve():
	(A, B) = list(map(int, input().split()))
	print(max(0, A - 2 * B))

def main():
	solve()

def __starting_point():
	main()
__starting_point()


(a, b) = [int(i) for i in input().split()]
if a >= b * 2:
	print(a - b * 2)
else:
	print(0)


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


(n, k) = map(int, input().split())
print(max(0, n - 2 * k))


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


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


A = list(map(int, input().split()))
print(max(0, A[0] - 2 * A[1]))


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


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


(A, B) = list(map(int, input().split()))
print(max(0, A - 2 * B))


(a, b) = [int(x) for x in input().split()]
print(max(0, a - 2 * b))


print(max(0, eval(input().replace(' ', '-2*'))))


(a, b) = map(lambda x: int(x), input().split())
print(max([0, a - b * 2]))


(あ, い) = map(int, input().split())
print(max(0, あ - い * 2))


(a, b) = [int(_) for _ in input().split()]
print(max(0, a - 2 * b))


(A, B) = (int(x) for x in input().split())
print(max(0, A - 2 * B))


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


(a, b) = [int(s) for s in input().split()]
print(max([0, a - 2 * b]))


(a, b) = [int(j) for j in input().split()]
print(max(a - 2 * b, 0))


(a, b) = list(map(int, input().split()))
print(max(a - b - b, 0))


(N, M) = map(int, input().split())
print(max(N - M * 2, 0))


(A, B) = map(int, input().split())
print(max([0, A - B - B]))


(A, B) = map(int, input().split())
ans = max(0, A - B * 2)
print(ans)


(total, l) = map(int, input().split(' '))
print(max(0, total - 2 * l))


(n, m) = [int(i) for i in input().split()]
print(max(0, n - 2 * m))


(A, B) = [int(n) for n in input().split()]
print(max(0, int(A - 2 * B)))


(A, B) = map(int, input().split())
c = A - 2 * B
print(max(0, c))


(A, B) = map(int, input().split())
res = max(0, A - B * 2)
print(res)


n = [int(x) for x in input().split()]
print(max(0, n[0] - n[1] * 2))


n = eval(input().replace(' ', '-2*'))
print(n if n > 0 else 0)


(a, s) = map(int, input().split())
print(max(a - 2 * s, 0))


(a, b) = map(int, input().split())
x = a - (b + b)
print(x if x >= 0 else 0)


(i, j) = map(int, input().split())
print(i - 2 * j if i - 2 * j > 0 else 0)


(w, k) = map(int, input().split())
print(max(0, w - k * 2))


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


(A, B) = map(int, input().split())
print([A - 2 * B, 0][A <= 2 * B])


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


(a, b) = map(int, input().split())
ans = max(0, a - b - b)
print(ans)


(a, b) = list(map(int, input().strip().split()))
res = max(0, a - 2 * b)
print(res)


(A, B) = map(int, open(0).read().split())
print(max(0, A - 2 * B))


(A, B) = map(int, input().strip().split())
print(max(A - 2 * B, 0))


(N, K) = map(int, input().split())
print(max(0, N - 2 * K))


(A, B) = map(int, input().split())
print(A - min(2 * B, A))


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


li = [int(x) for x in input().split()]
if 2 * li[1] >= li[0]:
	print('0')
else:
	print(li[0] - 2 * li[1])


(A, B) = [int(i) for i in input().split()]
print(max(0, A - 2 * B))


a = list(map(int, input().split()))
print(max(0, a[0] - a[1] * 2))


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


(a, b) = [int(v) for v in input().split()]
print(max(a - 2 * b, 0))


(A, B) = map(int, input().split())
a = max(A - 2 * B, 0)
print(a)