Problem:


Score : 200 points

Problem Statement

AtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W.
If we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of [0,1] and the horizontal range of [a,a+W], and the second rectangle covers the vertical range of [1,2] and the horizontal range of [b,b+W], as shown in the following figure:

AtCoDeer will move the second rectangle horizontally so that it connects with the first rectangle.
Find the minimum distance it needs to be moved.

Constraints

All input values are integers.

1≤W≤10^5

1≤a,b≤10^5

Input

The input is given from Standard Input in the following format:

W a b

Output

Print the minimum distance the second rectangle needs to be moved.

Sample Input 1

3 2 6

Sample Output 1

1

This input corresponds to the figure in the statement. In this case, the second rectangle should be moved to the left by a distance of 1.

Sample Input 2

3 1 3

Sample Output 2

0

The rectangles are already connected, and thus no move is needed.

Sample Input 3

5 10 1

Sample Output 3

4



Sample input:
3 2 6


Sample output:
1

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
if a+w < b:
    print(b-a-w)
elif b+w < a:
    print(a-b-w)
elif a <= b <= a+w:
    print(0)
else:
    print(0)

Submission status: Accepted

Solution code:
w,a,c=map(int,input().split())

b=w+a
d=w+c

if a>c:
  if a>d:
    print(abs(d-a))
  else:
    print('0')

else:
  if c>b:
    print(abs(c-b))
  else:
    print('0')

Submission status: Accepted

Solution code:
w,a,b = map(int,input().split())
aw = a+w
bw =b+w
print(max(0,a-bw,b-aw))

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
print(max(0, b - a - w, a - b - w))

Submission status: Accepted

Solution code:
lst = input().split()

W = int(lst[0])
a = int(lst[1])
b = int(lst[2])

if b-W <= a <= b+W:
   print(0)
else:
   print(max([b - (a + W), a - (b + W)]))

Submission status: Accepted

Solution code:
W, a, b = map(int, input().split())

if a + W < b:
    print(abs(a + W - b))
elif b + W < a:
    print(abs(b + W - a))
else:
    print(0)

Submission status: Accepted

Solution code:
W,a,b = map(int,input().split())

ans = max(b-a-W,a-b-W,0)
print(ans)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())

print(max(a, b) - min(a, b) - w) if abs(a -  b) > w else print(0)

Submission status: Accepted

Solution code:
# import math
# import statistics
# import itertools
# a=int(input())
# b=input()
# c=[]
# for i in a:
#     c.append(int(i))
W,a,b= map(int,input().split())
# f = list(map(int,input().split()))
# g = [int(input()) for _ in range(N)]
# h = []
# for i in range(a):
#     h.append(list(map(int,input().split())))
# a = [[0] for _ in range(H)]#nizigen

ans1=b-(a+W)
ans2=a-(b+W)

if a+W<b or b+W<a:
    print(min(abs(ans1),abs(ans2)))
else:
    print(0)

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
print(max(0,abs(a-b)-w))

Submission status: Accepted

Solution code:
W, a, b = list(map(int, input().split()))

if abs(a - b) <= W:
    print(0)
else:
    print(abs(a - b) - W)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
res = max(0, abs(a - b) - w)
print(res)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
if b + w < a:
    res = a - (b + w)
elif a <= b + w <= a + 2 * w:
    res = 0
else:
    res = b - (a + w)

print(res)

Submission status: Accepted

Solution code:
w,a,b = map(int,input().split())
if b < a:
    temp = a
    a = b
    b = temp
if b >= a + w:
    print(b - a -w)
else:
    print(0)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
if a <= b:
    if a+w < b:
        print(b-a-w)
    else:
        print(0)
else:
    if b+w < a:
        print(a-b-w)
    else:
        print(0)

Submission status: Accepted

Solution code:
w,a,b = map(int,input().split())
if a <= b <= a+w or a <= b+w <= a+w:
  print(0)
else:
  print(min(abs(a+w-b),abs(b+w-a)))

Submission status: Accepted

Solution code:
w,a,b = map(int,input().split())
if b - a - w >= 0:
    print(b - a - w)
elif a - b - w>=0:
    print(a - b - w)
else:
    print(0)

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if len(sorted(set(range(a,a+w+1)) & set(range(b,b+w+1)))) !=0:
  print("0")
elif b>=a+w:
  print(b-a-w)
elif a>=b+w:
  print(a-b-w)

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if a>b:a,b=b,a
print(max(0,b-a-w))

Submission status: Accepted

Solution code:
W, a, b = map(int, input().split())

if abs(b - a) - W <= 0:
    print(0)
else:
    print(abs(b - a) - W)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
a, b = min(a, b), max(a, b)
if a+w >= b:
    print(0)
else:
    print(b-(a+w))

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
if a <= b:
    print(b - w - a if b - w - a > 0 else 0)
else :
    print(a - w - b if a - w - b > 0 else 0)

Submission status: Accepted

Solution code:
W,a,b = map(int,input().split())
print(max(0,b-(a+W),a-(b+W)))

Submission status: Accepted

Solution code:
w,a,b = map(int,input().split())

min_side = min(a,b)
max_side = max(a,b)

t = max_side - (min_side + w)
t = max(t,0)

print(t)

Submission status: Accepted

Solution code:
W,a,b=map(int,input().split())
print(max(abs(a-b)-W,0))

Submission status: Accepted

Solution code:
W, a, b = map(int, input().split())
if a > b:
  k = b
  b = a
  a = k
if a + W >= b:
  print(0)
else:
  print(b - (a + W))

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if abs(a-b) <= abs(w):
  print(0)
else:
  print(abs(a-b)-w)

Submission status: Accepted

Solution code:
w,a,b = map(int, input().split())
print(max(abs(a-b)-w,0))

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if b>=a+w:
    print(b-a-w)
else:
    if b+w>=a:
        print('0')
    else:
        print(a-b-w)

Submission status: Accepted

Solution code:
def main():
    w, a, b = map(int, input().split())

    if a <= b <= a + w or a <= b + w <= a + w:
        print(0)
    elif b <= a <= b + w or b <= a + w <= b + w:
        print(0)
    else:
        print(min(abs(a + w - b), abs(b + w - a)))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
w,a,b=map(int,input().split())
if b>a:
    if b-w-a>0:
        print(b-w-a)
    else:
        print(0)
if a>b:
    if a-w-b>0:
        print(a-w-b)
    else:
        print(0)
if a==b:
    print(0)

Submission status: Accepted

Solution code:
W,A,B = map(int,input().split())
print(max(abs(A-B)-W,0))

Submission status: Accepted

Solution code:
W,a,b=list(map(int,input().split()))
print(0 if W>abs(a-b) else abs(a-b)-W)

Submission status: Accepted

Solution code:
w,a,b = map(int,input().split())
aw = a + w
bw = b + w
if a == bw or b == aw or a == b:
    print(0)
elif a < b < aw or b < a < bw:
    print(0)
else:
    if aw < b:
        print(b-aw)
    if bw < a:
        print(a-bw)

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if ((a<=b and b<=a+w) or (a<=b+w and b<=a)):
    print(0)
elif a+w<b:
    print(b-a-w)
else:
    print(a-b-w)

Submission status: Accepted

Solution code:
w,a,b = map(int, input().split())
print(max(0,b-a-w) if b >= a else max(0,a-b-w))

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

w, a, b = rm()
if a < b:
    print(max(b-(a+w), 0))
else:
    print(max(a-(b+w), 0))

Submission status: Accepted

Solution code:
w,a,b = map(int, input().split())
if b >= a:
    print(max(0,b-(a+w)))
else:
    print(max(0,a-(b+w)))

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    w, a, b = i_map()

    if a + w < b:
        print(b-a-w)
    elif b + w < a:
        print(a-b-w)
    else:
        print(0)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
W, A, B = map(int, input().split())
print(max(abs(B-A)-W, 0))

Submission status: Accepted

Solution code:
w, a, b = map(int,input().split())
if a > b:
    a, b = b, a

print(max(b - a - w, 0))

Submission status: Accepted

Solution code:
W, a, b = map(int, input().split())
f = lambda x:x if x > 0 else 0
print(f(abs(a-b)-W))

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    W, a, b = map(int, readline().split())

    if b + W < a:
        print(a - (b + W))
    elif a + W < b:
        print(b - (a + W))
    else:
        print(0)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# B - NarrowRectanglesEasy
def main():
    W, a, b = map(int, input().split())

    if a > b:
        print(max(0, a-b-W))
    else:
        print(max(0, b-a-W))
        
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
import collections
import bisect

def main():
    w,a,b = map(int, input().split())

    if ((a+w)<b) or ((b+w)<a):
        print(min(abs(a+w-b), abs(b+w-a)))
    else:
        print(0)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if a<b:
  if a+w<b:
    print(b-a-w)
  else:
    print(0)
elif a>b:
  if b+w<a:
    print(a-b-w)
  else:
    print(0)
else:
  print(0)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())

if a + w < b:
    print(b - a - w)
elif  a < b + w:
    print(0)
else:
    print(a - b - w)

Submission status: Accepted

Solution code:
W, a, b = map(int, input().split())
if b+W < a:
    print(a-(b+W))
elif b > a+W:
    print(b-(a+W))
else:
    print(0)

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
print(0 if b<=a<=b+w or a<=b<=a+w else min(abs(b-a-w),abs(a-b-w)))

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())

if a + w < b:
  print(abs(b - (a+w)))
elif b + w < a:
  print(abs(a - (b+w)))
else:
  print(0)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())

if a <= b <= a+w  or b <= a <= b+w:
    ans = 0
elif a < b:
    ans = b-a-w
else:
    ans = a-b-w

print(ans)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())

if b > a + w:
    print(b - a - w)
elif b + w < a:
    print(a - b - w)
else:
    print(0)

Submission status: Accepted

Solution code:
W,a,b=map(int, input().split())

dis = max(0, abs(a-b)-W)
print(dis)

Submission status: Accepted

Solution code:
W,a,b=map(int,input().split())
if b>a:
  if b-(a+W)<=0:
  	print(0)
  	exit()
  print(b-(a+W))
else:
  if a-(b+W)<=0:
  	print(0)
  	exit()
  print(a-(b+W))

Submission status: Accepted

Solution code:
W,a,b=map(int,input().split());print([abs(a-b)-W,0][abs(a-b)<=W])

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    w, a, b = MI()
    if b < a:
        temp = a
        a = b
        b = temp
    ans = max(0, b-a-w)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
w,a,b = map(int,input().split())
if a+w < b:
    print(b-a-w)
elif b+w < a:
    print(a-b-w)
else:
    print(0)

Submission status: Accepted

Solution code:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if b<=c:
  if a+b>=c:
    print(0)
  else:
    print(c-b-a)
else:
  if a+c>=b:
    print(0)
  else:
    print(b-c-a)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
if a <= b:
    if a + w >= b:
        print(0)
    else:
        print(b - a - w)
else:
    if b + w >= a:
        print(0)
    else:
        print(a - b - w)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())

if w >= abs(a-b):
    print(0)
else:
    if a > b:
        print(a-(b+w))
    else:
        print(b-(a+w))

Submission status: Accepted

Solution code:
W,a,b=map(int,input().split())
if b+W<=a:
    print(a-b-W)
elif a+W<=b:
    print(b-a-W)
else:
    print(0)

Submission status: Accepted

Solution code:
W,a,b=map(int,input().split())
if a>b:
    if a<=b+W:
        print('0')
    else :
        print(a-b-W)
elif b>a:
    if b<=a+W:
        print('0')
    else :
        print(b-a-W)
else:
    print('0')

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
if a + w < b:
  print(b - (a + w))
elif b + w < a:
  print(a - (b + w))
else:
  print(0)

Submission status: Accepted

Solution code:
W, a, b = map(int, input().split())

if a + W < b:
    print(b - (a + W))
elif a > b + W:
    print(a - (b + W))
else:
    print(0)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
l = max(a, b) - min(a, b)
print(l - w if l > w else 0)

Submission status: Accepted

Solution code:
w,a,b = map(int, input().split())

if (a <= b <= a+w) or (a <= b+w <= a+w):
    print(0)
elif a+w < b:
    print(b-a-w)
elif b+w < a:
    print(a-b-w)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())

if a < b:
    if a + w > b:
        print(0)
    else:
        print(b - a - w)
else:
    if b + w > a:
        print(0)
    else:
        print(a - b - w)

Submission status: Accepted

Solution code:
W,a,b=list(map(int, input().split()))
ar=a+W
br=b+W
if 0 <= ar-b <= W or 0 <= br-a <=W:
  print(0)
else:
  print(min(abs(br-a), abs(ar-b)))

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if a<b:
  if a+w>b:
    print(0)
  else:
    print(b-a-w)
elif b<a:
  if b+w>a:
    print(0)
  else:
    print(a-b-w)
else:
  print(0)

Submission status: Accepted

Solution code:
w, a, b = list(map(int, input().split()))
if abs(a - b) <= w:
  print(0)
else:
  print(abs(a -b) - w)

Submission status: Accepted

Solution code:
W,a,b=map(int,input().split())
ans=0
if a+W<b:
    ans=b-(a+W)
elif b+W<a:
    ans=a-(b+W)
print(ans)

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())

if a<=b:
  if a+w<b:
    print(b-a-w)
  else:
    print(0)
    
else:
  if b+w<a:
    print(a-b-w)
  else:
    print(0)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
W, a, b = map(int, input().split())

a_l = a
a_r = a + W
b_l = b
b_r = b + W

if b_r < a_l:
    print(abs(b_r - a_l))
elif a_r < b_l:
    print(abs(a_r - b_l))
else:
    print(0)

Submission status: Accepted

Solution code:
w,a,b = map(int, raw_input().split())

def f(a,b,w):
	if a > b:
		return f(b,a,w)
	return max(0, b - (a + w))

print f(a, b,w)

Submission status: Accepted

Solution code:
w,a,b = (int(T) for T in input().split())
if a+w<b:
    print(b-(a+w))
elif a<=b<=a+w:
    print(0)
else:
    print(a-(b+w))

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
#a,a+w b,b+w
if b<=a<=b+w or a<=b<=a+w:
  print(0)
else:
  print(min(abs(b-a-w),abs(b+w-a)))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def main():
    W, a, b = map(int, input().split())
    if a + W < b:
        print(b - a - W)
    elif a < b + W:
        print(0)
    else:
        print(a - b - W)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
w,a,b = map(int,input().split())
if b>=a:
  print(max(0,b-(a+w)))
else:
  print(max(0,a-(b+w)))

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())

if a+w < b:
    ans = b-(a+w)
elif b+w < a:
    ans = a-(b+w)
else:
    ans = 0

print(ans)

Submission status: Accepted

Solution code:
W,a,b = map(int, input ().split ())
if a < b:
  A,B = W+a,b
  if A >= B:
    print (0)
  else:
    print (B-A)
else:
  A,B = a,W+b
  if B >= A:
    print (0)
  else:
    print (A-B)

Submission status: Accepted

Solution code:
W, a, b = map(int, input().split())

print(max(abs(b-a)-W, 0))

Submission status: Accepted

Solution code:
W,a,b =map(int,input().split())
if b>=a:
    if b-(a+W)<0:print(0)
    else:print(b-(a+W))
else :
    if a-(b+W)<0:print(0)
    else:print(a-(b+W))

Submission status: Accepted

Solution code:
W, a, b = map(int, input().split())
if abs(a-b) < W:
    ans = 0
else:
    ans = abs(a-b) - W
print(ans)

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
A=[i for i in range(a,a+w+1)]
B=[i for i in range(b,b+w+1)]
if a in B or b in A:
    print(0)
else:
    print(min(abs(a+w-b),abs(b+w-a)))

Submission status: Accepted

Solution code:
W,a,b = map(int,input().split())
if a-W <= b <= a+W:
    print(0)
elif b+W < a:
    print(a-(b+W))
else:
    print(b-(a+W))

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if a<b:
    print(b-a-w if b-a-w>0 else 0)
else:
    print(a-b-w if a-b-w>0 else 0)

Submission status: Accepted

Solution code:
w, a, b = list(map(int, input().split()))
ans = abs(a - b) - w
print(ans) if ans > 0 else print(0)

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if a<=b:
  print(max(0,b-(a+w)))
else:
  print(max(0,a-(b+w)))

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
print(0) if a+w >= b and b+w >= a else print(b-a-w) if a+w < b else print(a-b-w)

Submission status: Accepted

Solution code:
w,a,b = map(int,input().split())
if a+w < b:
    print(b-(a+w))
elif b+w < a:
    print(a-(b+w))
else:
    print(0)

Submission status: Accepted

Solution code:
w,a,b = map(int,input().split())
if abs(a - b) <= w:
    print(0)
else:
    print(abs(a - b) - w)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())

if a + w < b:
  print(b - (a + w))
elif b + w < a:
  print(a - (b + w))
else:
  print(0)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    W, a, b = map(int, readline().split())
    print(max(max(a,b)-(min(a,b)+W),0))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
W,a,b=map(int,input().split())
print(max(0,b-a-W,a-b-W))

Submission status: Accepted

Solution code:
W, a, b = list(map(lambda x: int(x), input().split(" ")))
m = min([a,b])
M = max([a,b])

if M - m > W:
  print(M - m - W)
else:
  print(0)

Submission status: Accepted

Solution code:
W, a, b = map(int, input().split())

if (a <= b <= a + W) or (a <= b + W <= a + W):
    print(0)
    exit()

if a + W < b:
    print(b - (a + W))
    exit()
else:
    print(a - (b + W))

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]


W,a,b = map(int, input().split())

if (b+W < a):
    print(a-(b+W))
elif (a+W < b):
    print(b-(a+W))
else:
    print(0)

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
aa=a+w
bb=b+w
if b>=a:
  d=b-aa
  if d<=0:
    print(0)
  else:
    print(d)
else:
  d=a-bb
  if d<=0:
    print(0)
  else:
    print(d)

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
w, a, b = M()
x = abs(a-b)
print(max(0, x-w))

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if a+w<b:
    print(b-a-w)
elif b+w<a:
    print(a-b-w)
else:
    print(0)

Submission status: Accepted

Solution code:
W, a, b = map(int,input().split())
if b > a+W:
    print(abs(b-(a+W)))
elif b <= a+W and b+W >= a:
    print(0)
else:
    print(abs(b+W-a))

Submission status: Accepted

Solution code:
import sys
import math
W,a,b = map(int,input().split())
al = [[a,0],[a,1],[a+W,0],[a+W,1]]
bl = [[b,1],[b,2],[b+W,1],[b+W,2]]
box = []
if (b <= a and a <= b+W) or (a <= b <= a+W and a <= b+W <=a+W) or (a <= b and b <= a+W):
  print(0)
  sys.exit()
for i in range(4):
  for j in range(4):
    num = math.sqrt((al[i][0]-bl[j][0])**2 + (al[i][1]-bl[j][1])**2)
    box.append(int(num))
print(min(box))

Submission status: Accepted

Solution code:
w, a, b = [int(x) for x in input().split()]
ans = 0
if a + w < b:
    ans = b - (a + w)
elif b + w < a:
    ans = a - (b + w)
print(ans)

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
print(abs(a-b)-w if abs(a-b)>w else 0)

Submission status: Accepted

Solution code:
W,a,b = map(int,input().split())

if a<=b<=a+W:
    print(0)
elif a+W < b:
    print(b-(a+W))
else:
    print(a-(b+W))

Submission status: Accepted

Solution code:
W,a,b = map(int,input().split())

if a<=b<=a+W:
    print(0)
elif a+W < b:
    print(b-(a+W))
else:
    print(a-(b+W))

Submission status: Accepted

Solution code:
W,a,b = map(int, input().split())
 
print(max(0, abs(a-b) - W))

Submission status: Accepted

Solution code:
W,a,b = map(int, input().split())

print(max(0, abs(a-b) - W))

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
d=max(a,b)
c=min(a,b)
if d-c<=w:
  ans=0
else:
  ans=d-c-w
print(ans)

Submission status: Accepted

Solution code:
W,a,b=map(int,input().split())
print(max(max(a,b)-W-min(a,b),0))

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if a<b:
    dis=b-(a+w)
else:
    dis=a-(b+w)
print(dis if dis>=0 else 0)

Submission status: Accepted

Solution code:


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    W, a, b = read_ints()
    if a+W <= b:
        return abs(a+W-b)
    if b+W <= a:
        return abs(b+W-a)
    return 0


if __name__ == '__main__':
    print(solve())

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
if a + w < b:
    print(b-a-w)
elif b + w < a:
    print(a-b-w)
else:
    print(0)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
p, q = 0, 0
if a > b:
  p = a
  q = b
else:
  p = b
  q = a
if q + w > p:
  print(0)
else:
  print(p - q - w)

Submission status: Accepted

Solution code:
# such silly mistakes i am noob
w, a, b = map(int , input().split())
if b>=a and b<=w+a:
	print(0)
elif b+w>=a and b+w<=a+w:
	print(0)
elif b+w<a:
	print(a-(b+w))
elif a+w<b:
	print(b-(a+w))

Submission status: Accepted

Solution code:
w, a, b = map(int , input().split())
if b>=a and b<=w+a:
	print(0)
elif b+w>=a and b+w<=a+w:
	print(0)
elif b+w<a:
	print(a-(b+w))
elif a+w<b:
	print(b-(a+w))

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())

if a + w < b:
    print(b - a - w)
elif b + w < a:
    print(a - b - w)
else:
    print(0)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

def main():

    W, a, b = map(int, input().split())

    if a + W < b:
        ans = b - (a + W)

    elif b + W < a:
        ans = a - (b + W)
    
    else:
        ans = 0

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
if a <= b:
  if a+w < b :
    print(b-(a+w))
  else:
    print(0)
else:
  if b +w < a:
    print(a- (b+w))
  else:
    print(0)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
print(max(0, a-(b+w), b-(a+w)))

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if a<=b<=a+w or b<=a<=b+w:
  ans=0
else:
  ans=min(abs(b-a-w),abs(b+w-a))
print(ans)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    W, a, b = map(int, readline().split())

    if a <= b <= a + W or a <= b + W <= a + W:
        ans = 0
    else:
        ans = min(abs(a - b), abs(a + W - b), abs(a - b - W), abs(a + W - b - W))

    print(ans)

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if abs(a-b)<=w:
    print(0)
else:
    print(abs(a-b)-w)

Submission status: Accepted

Solution code:
W,a,b=map(int,input().split())
thre =0 
res =0
if a<=b:
  thre = a+W
  if thre >= b:
    res = 0
  else:
    res = b-thre
else:
  thre=b+W
  if thre >= a:
    res = 0
  else:
    res = a-thre
print(res)

Submission status: Accepted

Solution code:
W,a,b=map(int,input().split())
print(0 if(a<=b and b<=a+W)or(a<=b+W and b+W<=a+W)else abs(a-b)-W)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
l = [0, b - a - w, a - b - w, 0]
print(l[(a + w < b) + ((b + w < a) << 1)])

Submission status: Accepted

Solution code:
W,a,b=map(int,input().split())

print(max(0,a-b-W,b-a-W))

Submission status: Accepted

Solution code:
W,a,b=map(int,input().split())
if b<=a<=b+W or b<=a+W<=b+W:
  print(0)
elif b>a+W:
  print(b-a-W)
else:
  print(a-b-W)

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if a+w < b:
  print(b-w-a)
elif a > b+w:
  print(a-w-b)
else:
  print(0)

Submission status: Accepted

Solution code:
MM = input().split()
W = int(MM[0])
a = int(MM[1])
b = int(MM[2])
if a+W < b:
  print(b-(a+W))
elif (b+W) < a:
  print(a -(b+W))
else:
  print(0)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

W,a,b = I()
if a >= b:
    print(max(0,a-b-W))
else:
    print(max(0,b-a-W))

Submission status: Accepted

Solution code:
W,a,b = map(int,input().split())
if a+W<b:print(b-a-W)
elif b+W<a:print(a-b-W)
else:print(0)

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
if a <= b and b <= a+w:
    print(0)
elif b <= a+w and a <= b:
    print(0)
else:
    print(min(abs(a-b-w), abs(a+w-b)))

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())

if b <= a+w <= b+w:
    print(0)
else:
    print(min(abs(a+w-b), abs(a-b-w)))

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
x = max(a, b)
y = min(a, b)
print(max((x - (y + w)), 0 ))

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())

if a < b:
    print(max(0, b-a-w))
else:
    print(max(0, a-b-w))

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())

if a < b:
    ans = b - (a+w)
    if ans <= 0:
        print(0)
    else:
        print(ans)
else:
    ans = a - (b+w)
    if ans <= 0:
        print(0)
    else:
        print(ans)

Submission status: Accepted

Solution code:
w,a,b = map(int,input().split())

if a < b:
    print(max(0,b-a-w))
else:
    print(max(0,a-b-w))

Submission status: Accepted

Solution code:
w,a,b = map(int, input().split())
ans = 0
if a < b: ans = b-a-w
else: ans = a-b-w
print(0 if  ans < 0 else ans)

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

x = 0 if A <= B <= A + W or A <= B + W <= A + W or B <= A <= B + W or B <= A + W <= B + W else 1 << 28
y = abs(A - (B + W))
z = abs(B - (A + W))
print(min(x, y, z))

Submission status: Accepted

Solution code:
s = input().split()

w = int(s[0])
a = int(s[1])
b = int(s[2])

answer = 0

if a + w < b:
    answer = b - (a + w)
else:
    answer = a - (b + w)

if (a <= b and b <= a + w) or (a <= b + w and b + w <= a + w):
    answer = 0
    
print(answer)