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 itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

# Written by NoKnowledgeGG @YlePhan

#import math
mod = 10**9+7



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

Submission status: Accepted

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

result = 0
if a < b :
    hantei = b - a - w
else:
    hantei = a - b - w 

for i in range(1,10**5):
    #print("hantei",hantei)
    if hantei <= 0:
        print(result)
        exit()
    else:
        hantei -= 1
        result += 1

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

output = 0
if a < b:
    dist = b - (a+W)
    if dist > 0:
        output = dist
else :
    dist = a - (b+W)
    if dist > 0 :
        output = dist
        
print(output)

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

w,a,b = iim()

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# B - Narrow Rectangles Easy
# 標準入力の取得
W,a,b = list(map(int, input().split()))

# すでに連結しているかどうかで場合分け
is_connected = (a <= b + W) and (b <= a + W)
if is_connected:
    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 a <= b <= a + w or a - w <= 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())
if min(a,b)+w<max(a,b):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 <= a+w or a <= b+w <= a+w:
    print(0)
else:
    res = float("inf")
    res = min(res, abs(b-(a+w)))
    res = min(res, abs(a-(b+w)))
    print(res)

Submission status: Accepted

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

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

if ans>0:
    print(ans)
else:
    print("0")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(ans if ans > 0 else 0)

Submission status: Accepted

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

Submission status: Accepted

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

aw = a+w
bw = b+w

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

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:
#ABC056.B
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 b >= a:
  d = b - (a + W)
else:
  d = a - (b + W)

if d >= 1:
  print(d)
else:
  print(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())
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())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    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


def main():
    w, a, b = map(int, input().strip().split())
    print(max(a, b) - (min(a, b)+w) if max(a, b) - (min(a, b)+w) >= 0 else 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 a>=b+W:
    print(a-(b+W))
else:
    print(0)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
W,a,b=map(int,input().split())
Max=max(a,b)
Min=min(a,b)

ans=Max-(Min+W)
if ans<0:
    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 = [int(x) for x in input().split()]
if abs(a - b) <= w:
    res = 0
else:
    res = min(abs(a + w - b), abs(b + w - a))
print(res)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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(0)
else:
  print(d-c-w)

Submission status: Accepted

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

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



resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    W,a,b=MI()
    d1=max(0,b-(a+W))
    d2=max(0,a-(b+W))
    print(max(d1,d2))

main()

Submission status: Accepted

Solution code:
# import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools
# import collections # queue
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

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

if __name__=='__main__':
    main()

Submission status: Accepted

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

A = a + W
if b > a:
    if b - A <= 0:
        print(0)
    else:
        print(b - A)
else:
    B = b + W
    if a - B <= 0:
        print(0)
    else:
        print(a-B)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
w, a, b = map(int,input().split())
if a < b:
    if a <= b <= a + w:
        print(0)
    else:
        print(abs(a+w-b))
    
else:
    if b <= a <= b + w:
        print(0)
    else:
        print(abs(b+w-a))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc056/tasks/abc056_b

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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())
s=0

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

if s<0:
    print(0)
else:
    print(s)

Submission status: Accepted

Solution code:
w,a,b = map(int,input().split())
a1 = a+w
b1 = b+w
x = min(a,b)

if x == a:
    ans = b-a1
elif x == b:
    ans = a-b1

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

Submission status: Accepted

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

W,a,b = list(map(int, input().rstrip().split()))
#-----
d = abs(a-b) - W
if d >= 0:
  print(d)
else:
  print("0")

Submission status: Accepted

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

if a > b:
    a, b = b, a

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

Submission status: Accepted

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


def solve(W: int, a: int, b: int):
    print(max(0, abs(a - b) - W))


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
    solve(W, a, b)


if __name__ == '__main__':
    main()

Submission status: Accepted

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


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

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

Submission status: Accepted

Solution code:
#056_B
w,a,b=map(int,input().split())
print(0 if abs(b-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 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())
print((a+w<b)*(b-a-w) or (b+w<a)*(a-b-w) or 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:
#ABC056

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
w,a,b = 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())
print(max(0,abs(b-a)-W))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
w,a,b = map(int,readline().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())
a, b = sorted([a, b])
a += w
if a < b:
    print(b-a)
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(a+w-b),abs(b+w-a)))

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
W, a, b = map(int, input().split())
if (a > b):
    a_left = a
    b_right = b + W
    if (b_right >= a_left):
        print("0")
    else:
        ans = a_left - b_right
        print(ans)
else:
    b_left = b
    a_right = a + W
    
    if (a_right >= b_left):
        print("0")
    else:
        ans = b_left - a_right
        print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

d = 0

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 56

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

dif = abs(A-B)

A = [A, A+W]
B = [B, B+W]

if dif <= W:
  print(0)
elif min(B) - min(A) > 0:
  print(min(B)-max(A))
else:
  print(min(A)-max(B))

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

if b>=a:
  p=b-(W+a)
  if p>=0:
    print(p)
  else:print(0)
else:
  q=a-(W+b)
  if q>=0:
    print(q)
  else:print(0)

Submission status: Accepted

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

a1=abs(l-b)
a2=abs(r-a)
if b<=l:
    if a<=r:
        print(0)
        exit()
ans=min(a1,a2)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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



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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    W, A, B = map(int, input().split())
    if abs(W + A - B) < abs(W + B - A):
        print(max(B - W - A, 0))
    else:
        print(max(A - W - B, 0))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
W,a,b = [int(i) for i in input().split()]
k = max(a,b)
l = min(a,b)
a = k
b = l
if a <= b+W:
    print(0)
    exit()
else :
    print(a-(b+W))

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

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

main()

Submission status: Accepted

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

def move(W, A, B):
    if A > B: return move(W, B, A)
    elif B <= A + W: return 0
    else: return B - (A + W)

print(move(w, a, b))

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:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

Submission status: Accepted

Solution code:
def wab(w,a,b):
    ans = 0
    if w+a >= b and a <= b or a <= b+w and a >= b:
        return ans
    ans = b - (w + a) if a < b else a - (w + b)
    return ans

def main():
    W , a , b = map(int, input().split())
    print(wab(W , a , b))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
w, a, b = map(int,input().split())
hidari = min(a,b)
migi = max(a,b)
sa = migi - hidari
r = 0

if sa <= w:
  r = 0
else:
  r = sa - w
print(r)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 31, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

W, A, B = map(int, readline().decode('utf8').split())
mi = min(A, B)
ma = max(A + W, B + W)
print(max(0, ma - mi - 2 * W))