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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
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

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

W,a,b = inputIL()

if a < b:
  if a+W < b:
    print(b-(a+W))
    exit()
if b < a:
  if b+W < a:
    print(a-(b+W))
    exit()
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 abs(b-a) > w:
    print(min(abs(b1-a2),abs(b2-a1)))

else:
    print(0)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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

if __name__ == '__main__':
    main()

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+W:
    ans = a - (b+W)

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
W, a, b = map(int, input().split())
mv = 0
if a < b:
    mv = max(0, b - (a + W))
elif b < a:
    mv = max(0, a - (b + W))
print(mv)

Submission status: Accepted

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

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

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(max(0,max(a,b)-w-min(a,b)))

Submission status: Accepted

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

Submission status: Accepted

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

ans = b - (a + w)
ans1 = a - (b + w)

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

Submission status: Accepted

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

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 = list(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, max(a,b) - w - min(a,b)))

Submission status: Accepted

Solution code:
def main():
    w, a, b = map(int, input().split())
    a1, a2 = a, a+w
    b1, b2 = b, b+w
    if a1 <= b1 and b1 <= a2:
        ans = 0
    elif a1 <= b2 and b2 <= a2:
        ans = 0
    else:
        if b2 <= a1:
            ans = a1 - b2
        elif a2 <= b1:
            ans = b1 - a2
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

dx = abs(a-b)
print(max(dx-w,0))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 14:36:38 2020

@author: shinba
"""

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = [int(e) for e in input().split()]
if(N[2]+N[0] <= N[1]):
    ans = N[1] - (N[2]+N[0])
else:
    ans = N[2] - (N[1]+N[0])
if(ans > 0):
    print(ans)
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:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

Submission status: Accepted

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

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]


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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

w,a,b=MI()
if b+w<a:
    ans=a-b-w
elif b>a+w:
    ans=b-a-w
else:
    ans=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())
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)
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,b] = [b,a]

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

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

w,a,b = map(int,input().split())
l = max(a,b)
s = min(a,b)
print(max(l-s-w,0))

Submission status: Accepted

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



if '__main__' == __name__:
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

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

print(a - (b + x) if a > b else max(0, b - (a + x)))

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

Submission status: Accepted

Solution code:
x, y, z = map(int,input().split())
ans = abs(y-z)-x
print(ans) if ans > 0 else print(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

A=min(a,b)

B=max(a,b)

if A+w<B:
  print(B-A-w)
else:
  print(0)

Submission status: Accepted

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


def solve(W: int, a: int, b: int):
    if a < b:
        if a+W >= b:
            return 0
        else:
            return b-(a+W)
    else:
        if b+W >= a:
            return 0
        else:
            return a-(b+W)

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    W = int(next(tokens))  # type: int
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    print(solve(W, a, b))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

if a > b:
    c = a
    a = b
    b = c

ans = b - (a+w)

if ans < 0:
    ans = 0

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

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

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


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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m, k = map(int, input().split())
if m > k:
    m, k = k, m
print(max(0, k-(m+n)))

Submission status: Accepted

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

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

print (ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

ans1=b-a-w
ans2=a-b-w

print(min(abs(ans1),abs(ans2)))

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

Submission status: Accepted

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

l = min([a, b])
r = max([a, b])

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

Submission status: Accepted

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

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

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

A2W = (a, a+W)
B2W = (b, b+W)

if (A2W[0] <= B2W[0] and B2W[0] <= A2W[1]) or (A2W[0] <= B2W[1] and B2W[1] <= A2W[1]):
    print(0)
elif B2W[0] > A2W[1]:
    print(B2W[0]-A2W[1])
else:
    print(A2W[0]-B2W[1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 056: B – NarrowRectanglesEasy
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)
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 + w < b:
    ans = b - (a + w)
elif b + w >= a and a + w >= b:
    ans = 0
else:
    ans = a - (b + w)
print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
w,a,b=[int(i) for i 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())

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

Submission status: Accepted

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

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:

import math
import itertools
import statistics
#import numpy as np
import collections
#n = int(input())
w, a, b = list(map(int, input().split()))
#a = list(map(int, input().split()))
a_end = a+w
b_end = b+w

if a_end < b:
    print(b-a_end)
elif (a <= b and b <= a_end) or (b <= a and a <= b_end):
    print(0)
else:
    print(a-b_end)

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 b>a+w:
  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())
right = min(a, a+w, b, b+w)
left = max(a, a+w, b, b+w)

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

Submission status: Accepted

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

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

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)