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:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
from decimal import Decimal
from operator import mul

INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)


# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 組合せnCr
def combinations_count(n, r):
    if n < r:
        return 0
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# 素数判定
def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True


# limit以下の素数を列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

# 同じものを含む順列
def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]



# ここから書き始める
w, a, b = map(int, input().split())
ans = 0
if b > a + w:
    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(max(abs(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 - (b + w))
else:
    print(0)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    W, a, b = mi()
    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())
if a + w <= b:
    print(b - (a + w))
elif b + w <= a:
    print(a - (b + w))
else:
    print(0)

Submission status: Accepted

Solution code:
def main():
    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)


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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if a >= b: 
  if b+W >= a:
    print(0)
  else :
    print(a-(b+W))
else :
  if a+W >= b:
    print(0)
  else :
    print(b-(a+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 = [int(i) for i in input().split()]
result = 0
if abs(a-b) - W >= 0:
    result = abs(a-b) - W

print(result)

Submission status: Accepted

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

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

if (a + W) < b: # bが右側にいるか判定
    print(b - (a + W))
elif (b + W) < a: # bが左側にいるか判定
    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 + 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 or a<=b+W<=a+W: print("0")
else: print(min(abs(a+W-b),abs(b+W-a)))

Submission status: Accepted

Solution code:

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




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

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<=b<=a+W or b<=a<=b+W:
    print(0)
else:
    A=[a,a+W]
    B=[b,b+W]
    ans=10**9
    for u in A:
        for v in B:
            ans=min(abs(u-v),ans)
    print(ans)

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

Submission status: Accepted

Solution code:
import sys
W,a,b = map(int,input().split())
if W < 0 or W > 100000:
    sys.exit()
if a < 0 or a > 100000:
    sys.exit()
if b < 0 or b > 100000:
    sys.exit()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

W, a, b = mapint()
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 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+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())
aw = w+a
bw = w+b

if a > b:
    if bw >= a:
        print(0)
    else:
        print(a-bw)
else:
    if aw >= b:
        print(0)
    else:
        print(b-aw)

Submission status: Accepted

Solution code:
W, A, B = map(int, input().split())
if A <= B <= A + W or A <= B + W <= A + W or B <= A <= B + W or B <= A + W <= B + W:
    print('0')
    exit()
right_dis = max(0, abs(B - A + W))
left_dis = max(0, abs(A - B + W))
print(min(right_dis, left_dis))

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())
ans=0
if a<b and a+W<b:
  ans=b-(W+a)
elif a>b and b+W<a:
  ans=a-(W+b)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

xa = abs(a - b-W)
xb = abs(b - a-W)

if (a <= b <=a+W) or (b <= a <= b+W):
    print("0")
else:
    print(min(xa,xb))

Submission status: Accepted

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

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

Submission status: Accepted

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

if (a<=b<=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())
print(max(abs(a-b) - w, 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)
    exit()
if a < b:
    x = b - (a + w)
    print(x)
elif a > b:
    x = a - (b + w)
    print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def translate(W, a, b) : 
  if (a <= b <= a + W) or (a <= b + W <= a + W) :
    return 0
  else :
    if a <= b : 
      return b - (a + W)
    
    else : 
      return a - (b + W)


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

print(translate(W, a, b))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if a<b:
    l = a
    r = b
else:
    l = b
    r = a

if W+l>=r:
    print(0)
else:
    print(r-(W+l))

Submission status: Accepted

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

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

Submission status: Accepted

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

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())

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

Submission status: Accepted

Solution code:
s = list(map(int, input().split()))
d=abs(s[2]-s[1])
if d>s[0]:
    print(d-s[0])
else:
    print(0)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

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

if a > b:
  temp = a
  a = b
  b = temp
if a == b or a+w == b or w == b:
  ans = 0
  print(ans)
  sys.exit()
else:
  if b > a+w:
    ans = abs(b-(a+w))
  else:
    ans = abs((a+w)-b)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
W,a,b = [int(i) for i in input().split()]
if a <= b and b <= a + 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
if ans<=0:
    print(0)
else:
    print(ans)

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

Solution code:
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
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, b - (a + w), a - (b + w)))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    a11 = a[1]
    a12=a11+a[0]

    a21 = a[2]
    a22 = a21 + a[0]

    if (a11 <= a21 and a12 >= a21) or (a11 <= a22 and a12 >= a22):
        print(0)
    elif a11 <= a21 and a22 <=a22:
        print(abs(a12 -a21))
    else:
        print(abs(a11-a22))

Submission status: Accepted

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

Submission status: Accepted

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

if a+w < 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 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 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 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 <= a + W or a <= b + W <= a + W:
  print(0)
  quit()

print(min(abs(a+W - b), abs(b+W - a)))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np

def main():

  W, A, B = map(int, input().split())
  
  A_ = A + W
  B_ = B + W
  
  if (A <= B and B <= A_) or (A <= B_ and B_ <= A_):
    print(0)
    return

  print(min(abs(A_ - B), abs(A - B_)))

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

Submission status: Accepted

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

    a1 = a
    a2 = a + w

    b1 = b
    b2 = b + w

    ans = 0
    if a2 < b1:
        ans = b1 - a2
    elif b2 < a1:
        ans = a1 - b2
    else:
        ans = 0
    
    print(ans)

resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    w, a, b = mi()
    a, b = min(a,b), max(a,b)
    print(max(0, b-(a+w)))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
W, A, B = map(int, input().split())
def Main(W, A, B):
    if A+W < B:
        return B-A-W
    elif B+W < A:
        return A-B-W
    else:
        return 0
    
print(Main(W, A, B))

Submission status: Accepted

Solution code:
w, a, b = list(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)

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

Submission status: Accepted

Solution code:
def main():
    H, a,b = list(map(int, input().split()))
    ans = max(a,b) - (min(a,b) + H)
    print(ans) if ans >= 0 else print(0)

if __name__ == '__main__':
    main()