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 = tuple(map(int, input().split()))


if a < b:
    a_right = a + W
    width = b - a_right
else:
    b_right = b + W
    width = a - b_right

if width <= 0:
    print("0")
else:
    print(width)

Submission status: Accepted

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

Submission status: Accepted

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

    # print(W, a, b)

    return W, a, b

def solve(W, a, b):
    a_tail = a + W
    b_tail = b + W

    if a <= b <= a_tail:
        return 0
    elif a <= b_tail <= a_tail:
        return 0
    else:
        return min(abs(b - a_tail), abs(a - b_tail))


if __name__ == '__main__':
    res = solve(*args())
    print(res)

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 b>a+w:
    print(b-a-w)
else:
    print(a-b-w)

Submission status: Accepted

Solution code:
def main(w, a, b):
    if a <= w and b <= w:
        print(0)
    elif a <= b:
        print(b - (w + a))
    else:
        print(a - (w + b))


if __name__ == "__main__":
    w, a, b = map(int, input().split())

    main(w, a, b)

Submission status: Accepted

Solution code:
w, a, b = [int(x) for x in input().split()]

left = min(a, b)
right = max(a+w, b+w)

if right-left <= 2*w:
    ans = 0
else:
    ans = right-left-2*w
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
arr = input().split()
arr = list(map(int,arr))
w = arr[0]
a = arr[1]
b = arr[2]

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 b >= a and b <= a + W:
    print(0)
else:
    ans = min(abs(b - a - W), abs(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 < 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 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(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())
if a <= b <= a+w or b <= a <= b+w:
    print(0)
elif a < b:
    print(b-a-w)
else:
    print(a - b - w)

Submission status: Accepted

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

c = max(a, b)-(min(a, b)+w)

if c > 0:
  print(c)
else:
  print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
w,a,b = map(int, input().split())
if a+w <= 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 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())
x = [0]*(max(a+w, b+w)+1)

for i in range(a, a+w):
    x[i] += 1

for i in range(b, b+w):
    x[i] += 1

ans = 0
for i in range(min(a,b), max(a+w, b+w)):
    if x[i] == 0:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
aw=a+n
bw=b+n
print(min(abs(b-aw), abs(a-bw)) if abs(b - a) >= n else 0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#python3

def main():
    w, a, b = map(int, input().split())
    x = min(abs(a-b), abs((a+w)-b))
    y = min(abs((b+w)-(a+w)), abs((b+w)-a))
    ans = min(x, y)
    if (a <= b) & (b <= a+w):
        print(0)
    elif (a <= b+w) & (b+w <= a+w):
        print(0)
    else:
        print(ans)
main()

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    w,a,b=INTM()
    if a>=b+w:
        ans=a-(b+w)
    elif b>=a+w:
        ans=b-(a+w)
    else:
        ans=0
        
    print(ans)
if __name__ == '__main__':
    do()

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:
    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())
print(0 if abs(a-b)<=w else abs(a-b)-w)

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(b - (a + W) if b > a + W else a - (b + W))

Submission status: Accepted

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

a, b = sorted([a,b])

print(max(b-(a+W),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())

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

Submission status: Accepted

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

if abs(b - a) <= W:
    print(0)
else:
    print(min(abs(b - a + W), abs(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(abs(b - (a + w)))
else:
    print(abs((b + w) - a))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
W, a, b = [int(x) for x in 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())
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+w:
  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 b <= a <=b+w or b<= a+w <=b+w:
    print(0)
else:
    print(min(abs(b-a-w),abs(b+w-a)))

Submission status: Accepted

Solution code:


import numpy as np
import math


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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

if (d <= 0):
   print(0)
else:
   print(d)

Submission status: Accepted

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

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())
print(0 if b-w<=a<=b else abs(a-b)-w)

Submission status: Accepted

Solution code:
#coding:utf-8
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:
# -*- coding: utf-8 -*-

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())
if a+W<b:
    print(b-a-W)
elif b+W<a:
    print(a-W-b)
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 <= 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())
aa=[a,a+w]
bb=[b,b+w]
if aa[1]<bb[0]:
  print(bb[0]-aa[1])
elif bb[1]<aa[0]:
  print(aa[0]-bb[1])
else:
  print(0)

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if a<=b+w<=a+w or a<=b<=a+w:
    print(0)
else:
    if 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 and a+W >= b:
    print(0)

elif a<b:
    print(b-(a+W))

elif a>=b and b+W >= a:
    print(0)
    exit()

elif a>b:
    print(a-(b+W))

Submission status: Accepted

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

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

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

if a>=b and b+W >= a:
    print(0)
    exit()

if a>b:
    print(a-(b+W))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
# マイナスはa~a+Wの範囲にかかっている
if a < b: 
  ans = max(0, b-(a+W))
else:
  ans = max(0, a-(b+W))
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

ans = 0

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

print(ans)

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())
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:
    ans = max(b-(a+w), 0)
else:
    ans = max(a-(b+w), 0)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd
# from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
from bisect import *
import itertools
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
# input = sys.stdin.readline


def main():
    w, a, b = map(int, input().split())
    if b > a + w or a > b + w:
        print(min(abs(b - (a+w)) , abs(a -w-b)))
    else:
        print(0)
    


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
w,a,b = map(int, sys.stdin.readline().split())

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1

w,a,b=map(int,input().split())
if (a<=b<=a+w or b<=a<=b+w):
    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:
    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 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:
    print(max(0,(b-a-w)))
if b<a:
    print(max(0,(a-b-w)))

Submission status: Accepted

Solution code:
import sys

w, a, b = map(int, sys.stdin.readline().split())

def main():
    if a + w < b:
        return b - (a + w)
    elif b + w < a:
        return a - (b + w)
    else:
        return 0

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

a1 = a
a2 = a+w
b1 = b
b2 = b+w

if a1==b1 and a2==b2 :
	print(0)
elif a1<=b2<=a2 :
	print(0)
elif a1<=b1<=a2 :
	print(0)
elif a2 < b1 :
	print(abs(b1 - a2))
elif a1 > b2 :
	print(abs(b2 - a1))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
Wab=list(map(int,input().split()))
W=Wab[0]
a=Wab[1]
b=Wab[2]

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

Submission status: Accepted

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

aw = a + w
bw = b + w
l = max(aw, bw) - min(a, b) - 2 * w
print(max(l, 0))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
w,a,b = map(int, input().split())
if a+w>=b>=a or b+w>=a>=b:
  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<=a+W or a-W<=b<=a: 
  print(0)
else:
  print(min(abs(b+W-a), abs(b-(a+W))))

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()
candi = [abs(b - a), abs(b + W - a), abs(b - a - W)]
print(min(candi))

Submission status: Accepted

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

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:
W, a, b = map(int, input().split())

dist = abs(a - b)

if dist > W:
    print(dist - W)
else:
    print(0)

Submission status: Accepted

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

if abs(a - b) > W:
    ans = abs(a - b) - W
else:
    ans = 0

print(ans)

Submission status: Accepted

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

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

if ans <= 0:
    print(0)
else:
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

w,a,b = [int(x) for x in stdin.readline().rstrip().split()]

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

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())
ans=max(a,b)-(min(a,b)+w)
print(ans if ans>=0 else 0)

Submission status: Accepted

Solution code:
w,a,b = [int(i) for i in input().split()]

c = abs(b - (a+w))
d = abs(a-(b+w))

if a + w > b and  b + w > a:
    print(0)
else:
    print(min(c,d))

Submission status: Accepted

Solution code:
w, *ab = [int(i) for i in input().split()]
a, b = sorted(ab)
if a + w < b:
  print(b - (a + w))
else:
  print(0)

Submission status: Accepted

Solution code:
##### 解けた #####

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

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

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    W,a,b = MI()
    if (b-(a+W)) * ((b+W)-a) < 0:
        print(0)
    else:
        print(min(abs(a+W-b), abs(b+W-a)))
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
W,a,b = map(int, input().split())
a1 = a
a2 = a+W
b1 = b
b2 = b+W
if b1 <= a <= b2 or b1 <= a2 <= b2:
  print(0)
else:
  if a2 < b1:
    print(b1 - a2)
  else:
    print(a1 - b2)

Submission status: Accepted

Solution code:
w,a,b = map(int,input().split())
al = a
ar = a+w
bl = b
br = b+w

if al <= bl <= ar or al <= br <= ar:
	print(0)
else:
	print(min(abs(ar-bl),abs(br-al)))

Submission status: Accepted

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

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())
A = [a,a+W]
B = [b,b+W]
if A[0] <= B[0] <= A[1] or A[0] <= B[1] <= A[1] or B[0] <= A[0] <= B[1] or B[0] <= A[1] <= B[1]:
    print(0)
    exit()
print(max(B[0]-A[1],A[0]-B[1]))

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())
if(abs(b-a) < W):
    print(0)
else:
    ans = abs(b - a) - W
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
w, a, b = map(int, input().split())
if (a <= b and b <= a + w) or (a >= b and a <= b + 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 + 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: a, b = b, a
print(max(b-a-W, 0))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    [W, a_left, b_left] = string_to_int(inputs[0])
    a_right = a_left + W
    b_right = b_left + W

    if a_right < b_left:
        return b_left - a_right
    elif a_left > b_right:
        return a_left - b_right
    return 0


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

d = abs(a-b)
ans = max(0, d-W)

print(ans)

Submission status: Accepted

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

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

print(max(0, ans))

Submission status: Accepted

Solution code:
#NarrowRectanglesEasy
W, p, q = map(int,input().split())
a = min(p,q)
b = max(p,q)
d = 0

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

Submission status: Accepted

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

print(max(0, b - (a+W)) if a < b else max(0, 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())

aa = a + W
bb = b + W

if aa < b:
  print(b - aa)
elif bb < a:
  print(a - bb)
elif a < b:
  print(0)
else:
  print(0)

Submission status: Accepted

Solution code:
w,a,b =[int(i) for i in input().split()]
if(b+w>=a):
    if(b>a):
        if(a+w>=b):#2
            print(0)
        else:#1
            print(b-(a+w))
    else:#4
        print(0)
else:#3
    print(a-(b+w))

Submission status: Accepted

Solution code:
w,a,b=map(int,input().split())
if abs(a-b)<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+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())

ans = max(0, b - (a + w), a - (b + w))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def examB():
    W, a, b =LI()
    ans = max(max(a,b)-(min(a,b)+W),0)
    print(ans)

import sys
import copy
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Submission status: Accepted

Solution code:
# ABC 056: B – NarrowRectanglesEasy
w, a, b = [int(s) for s in input().split()]

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

Submission status: Accepted

Solution code:
W,a,b=map(int,input().split())
if b<=a<=b+W or a<=b<=a+W:
    print(0)
else:
    print(min(abs(a-(b+W)),abs(b-(a+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())
ans = abs(a - b) - w
print(ans if ans > 0 else 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<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:
  a=A
  b=B
else:
  a=B
  b=A
print(b-a-W if a+W<b else int(0))

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

w,a,b = inpl()
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 b > a + W:
    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())
big, small = max(a, b), min(a, b)
if big == small or (big - small) + 1 == W:
    print(0)
else:
    print(big - (small + W))

Submission status: Accepted

Solution code:
# ABC056 B - NarrowRectanglesEasy
# 2019/11/07

w, a, b = map(int, open(0).read().split())
# print(w,a,b)
print(max(b-(a+w), a-(b+w), 0))

Submission status: Accepted

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

Submission status: Accepted

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

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())
a_tail = a + w
b_tail = b + w

if (a >= b and a <= b_tail) or (a_tail >= b and a_tail <= b_tail):
    ans = 0
else:
    ans = min(abs(a + w -b), abs(b + w - a))

print(ans)

Submission status: Accepted

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

r = 0
if a > b + w:
    r = a - (b + w)
elif b > a + w:
    r = b - (a + w)

print(r)

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):
	wb = b
	wa = a + w
	if(wa >= wb ):
		print (0)
	else:
		print (wb - wa)
else:
	wa = a
	wb = b + w
	if(wb >= wa ):
		print (0)
	else:
		print (wa - wb)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
f=lambda x:max(abs(x[2]-x[1])-x[0],0)
print(f(list(map(int,input().split()))))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
w, a, b = [int(x) for x in input().split()]


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

print(ans)

Submission status: Accepted

Solution code:
W,a,b = map(int,input().split())
if (b <= a+W and a <= b) 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(max(0,b-W-a),max(0,a-W-b)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC056 B - Rain Flows into Dams
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

W,a,b = nl()

ans = 0
if b+W<a:
    ans = a-(b+W)
elif b+W>=a and b<=a+W:
    ans = 0
elif b>W+a:
    ans = b-(W+a)

print(ans)