jiahuimbzuai/CoQuIR huggingface dataset:
//  [typescript]
// import std = require('tstl')

{
  type Print = void | string | number | string[] | number[]
  let outs: Print[] = []

  const main = (): Print => {
    const r = _io()
    const [N] = r.nn()
    let a = r.nn()

    a.sort((x, y) => x - y)
    const hash = {}
    const dups = {}

    a.forEach((v) => {
      if (hash[v]) dups[v] = true
      hash[v] = true
    })
    a = Object.keys(hash).map(Number)
    const hit = {}
    let pc = 0

    a.forEach((v) => {
      if (!hit[v] && !dups[v]) {
        pc++
      }
      if (hit[v]) {
        return
      }
      for (var i = v; i <= 1000000; i += v) {
        hit[i] = true
      }
    })
    // console.log(a)

    // for (var i = 3; i < 1000000; i += 2) {
    //   if (primes.every((p) => i % p !== 0)) {
    //     primes.push(i)
    //   }
    // }

    // const primes: number[] = []

    // for (let i = 0; i < a.length; i++) {
    //   if (primes.every((p) => a[i] % p !== 0)) {
    //     if (!dups[a[i]]) pc++
    //     primes.push(a[i])
    //   }
    // }
    return pc
  }

  const _io = (i = 0) => {
    const str = require('fs').readFileSync('/dev/stdin', 'utf8')
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')

    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map((v) => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  outs.push(main())

  console.log(
    outs
      .map((line) => (typeof line === 'object' ? line.join(' ') : String(line)))
      .join('\n')
  )
}
//  [typescript]
// https://atcoder.jp/contests/abc170/submissions/14804545at
{
  const run = (input: string) => {
    let split = input.trim().split("\n")
    const n = parseInt(split[0])
    if (n == 1) return 0

    const numbers = split[1].split(" ").map(v => parseInt(v));

    const max = Math.max(...numbers);
    let list = {}
    for (let i = 1; i <= max; i++) {
      list[i] = 0
    }

    numbers.forEach(num => {
      let i = 1
      while (num * i <= max) {
        if (i === 1 && list[num * i] === 1) {
          list[num * i]++;
          break;
        }
        list[num * i]++;
        i++;
      }
    })

    let result = 0
    numbers.forEach(num => {
      if (list[num] == 1) {
        result++
      }
    })

    return result
  }

  const Main = (input: string) => {
    console.log(run(input))
  };

  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}
//  [python]
def A():
    n = int(input())
    print(-(-n//2))
A()
//  [python]
N=int(input())
print(N//2+N%2)
//  [python]
n= int(input())
ans=(n+1)//2
print(ans)
//  [python]
N = int(input())
pritn((N+1)//2)
//  [python]
N=int(input())
if(N%2==0):
  print(N/2)
else:
  print((N+1)/2)
//  [python]
N=int(input())
if(N%2==0):
  print(N/2)
else:
  print(N/2+1)
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	int N = Integer.parseInt(br.readLine());
	if (N % 2 == 1)
	    System.out.println((N + 1) / 2);
	else
	    System.out.println(N / 2);
    }
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //コンソールから入れる際に高速に入れる方法

        String strArr = br.readLine();
        int a = Integer.parseInt(strArr);
        if (a % 2 == 1) {
        	int x = (a/2) + 1;
            System.out.println(x);
        } else {
        	System.out.println(a/2);
        }

    }
}
//  [java]
import java.io.*;
import java.util.*;

class Main{
    public static void main(String args[])throws IOException{
      try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
    
        int N = Integer.parseInt(br.readLine());
        
        if((N % 2) == 0){
          System.out.println(N/2);
        }else{
          System.out.println((N/2) + 1);   
        }

      }
    }
}
//  [java]
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int N=sc.nextInt();
      	
      	if(N%2=0){
         System.out.print(N/2);
      }else{
         System.out.print((N/2)+1);
      }
   }
}
//  [java]
import java.util.ArrayList;
import java.util.*;
import java.lang.*;
//import java.lang.*;
import java.util.regex.*;
public class Main{
     public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
     List<Integer> l=new ArrayList<>();
     List<Integer> search=new ArrayList<>();
     for(int i=0;i<3;i++){
         for(int j=0;j<3;j++)
            l.add(sc.nextInt());
     }
     Collections.sort(l);
   int n=sc.nextInt();
   for(int i=0;i<n;i++)
      search.add(sc.nextInt());
   
   Collections.sort(search);
   
   for(int i=0;i<search.size();i++){
         if(l.contains(search.get(i))){
            System.out.println("Yes");
            System.exit(0);
         }else continue;
   }  
   System.out.println("NO");
   System.exit(0);
   }
}
//  [java]
import java.util.ArrayList;
import java.util.*;
import java.lang.*;
//import java.lang.*;
import java.util.regex.*;
public class CodeChef{
     public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
     List<Integer> l=new ArrayList<>();
     List<Integer> search=new ArrayList<>();
     for(int i=0;i<3;i++){
         for(int j=0;j<3;j++)
            l.add(sc.nextInt());
     }
     Collections.sort(l);
   int n=sc.nextInt();
   for(int i=0;i<n;i++)
      search.add(sc.nextInt());
   
   Collections.sort(search);
   
   for(int i=0;i<search.size();i++){
         if(l.contains(search.get(i))){
            System.out.println("Yes");
            System.exit(0);
         }else continue;
   }  
   System.out.println("NO");
   System.exit(0);
   }
}
//  [cpp]
#include<cstdio>
using namespace std;
int a;
int main()
{
	scanf("%d",&a);
	printf("%d",(a+1)>>1);
	
	
	
 }
//  [cpp]
#include<stdio.h>
int main(){
int n;
  scanf("%d",&n);
  n++;
  printf("%d",n/2);
}
//  [cpp]
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

int main(void)
{
	int n;
	while(scanf("%d", &n)==1)
	{
		int ans=(n+1)/2;
		printf("%d\n", ans);
	}
	return 0;
}
//  [cpp]
#include<stdio.h>
int main() {
  int N;
  scanf("%d", &N);
  if(N%2!=0){
  for(int i=1; i<=100; i++){ 
    if(N%2!=0){
       N=N-2;
       if(N<=1){
         N++;
       }else{}
    }else{
      printf("%d", i);
      break;
    }
  }
  }
  else if(N%2==0){
    printf("%d", N/2);
  }else{}
  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N,a;
  cin >> N;
  
  a = (N+2-1)/2;
  cout << a <, endl;
  
}
//  [cpp]
#include <stdio.h>

int main(){
    
    int n;
    int a;
    scanf("%d", &n);
    
    for(int i = 0 ; i < n ; i++){
        scanf("%d", &a);
        if(i == 0){
            printf("1\n");
        }
        else if(a%2 == 0){
            printf("%d\n", a/2);
        }
        else if(a%2 != 0){
            printf("%d\n", a/2+1);
        }
    }
    
    return 0;
}
//  [c]
#include <stdio.h>

int main(){
  int n;
  scanf("%d",&n);
  printf("%d",(n+1)/2);
  return(0);
}
//  [c]
#include<stdio.h>

int main(){
  int n,a=0;
  scanf("%d",&n);
  if(n%2==0){
    a=n/2;
}
else{
  a=n/2;
  a+=1;
}
printf("%d",a);
return 0;
}
//  [c]
#include <stdio.h>

int main(void)
{
    int N, out;

    scanf("%d",&N);

    if(N % 2)
        out = N/2 + 1;
    
    else
    {
        out = N/2;
    }
    
printf("%d",out);

    return 0;
}
//  [c]

#include <stdio.h>

int main (){
int paper, page;
scanf("%d", &page);
do {
page-=2;
paper++;
} 
while (page > 0);
printf("%d", paper);
return 0;
}

@Isaiah mustinya bener
//  [c]
S2: I - Sum of Digits
#include <stdio.h>

int main() {
  int T;
  char N[6];
  scanf("%d", &T);

  for(int i = 0; i < T; i++) {
    scanf("%s", N);

    int sum = 0;
    for(int j = 0; N[j] != '\0'; j++) {
      sum += N[j] - '0';
    }

    printf("%d\n", sum);
  }

  return 0;
}
//  [c]
#include<stdio.h>
int main(){

int main pages,paper;

scanf("%d",&pages);
paper=pages/2

If(pages%2!=0){
  printf("%d",paper+1);
}

else{
printf("%d",paper);
}


return 0;
}
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
    var n = parseInt(input, 10);
    var kami = parseInt(n/2,10);
    var amari = n%2;

	//出力
	console.log('%d',kami+amari);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
 var a = Math.floor(input / 2);
 var b = input % 2;
 var ans = a + b;
  console.log(ans);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var N = myconv(next(),1);
    myout(Math.ceil(N / 2));
}
//  [javascript]
function main(input){
  var N = parseInt(input[0],10);
  
  if((N % 2) === 0){
    console.log(N / 2);
  }else{
    console.log((N + 1) / 2 );
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
2=a;
N/a
//  [javascript]
function displayDate(input){
	var pageCNT;
 
    input = input.split("\n")
  
  	const N = parseInt(input[0], 10);
	pageCNT = Math.ceil(N/2);
	console.log(pageCNT);
}
 
 
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()

	fmt.Println(n/2 + (n % 2))
}

// ---- readfunc
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	const initialBufSize = 4096
	const maxBufSize = 1000000
	scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	scanner.Split(bufio.ScanWords)
	var N int64
	scanner.Scan()
	N, _ = strconv.ParseInt(scanner.Text(), 10, 64)
	fmt.Println(solve(N))
}
func solve(N int64) int64 {
	papers := N / 2
	if N%2 == 1 {
		papers++
	}
	return papers
}
//  [go]
package main

import "fmt"

func main() {
  var n int
  n = fmt.Scan(&n)
  fmt.Println((n + 1) / 2)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()

	N, err := strconv.Atoi(scanner.Text())
	if err != nil {
		log.Fatal(err)
	}

	if N/2 == 0 {
		fmt.Println(N / 2)
	} else {
		fmt.Println((N / 2) + 1)
	}
}
//  [go]
package main

import (
	"fmt"
)

func main () {
	var n int
	fmt.Scan(&n)
	fmt.Println(n/2+1)
}
//  [ruby]
N = gets.to_i
puts (N / 2.0).ceil
//  [ruby]
n = gets.chomp.to_i
if n%2 == 0 then
  puts n/2
else 
  puts 1+(n/2)
end
//  [ruby]
N = gets.to_i

if N % 2 == 0
    puts "#{N / 2}"
else
    puts "#{(N / 2) + 1}"
end
//  [ruby]
n=gets.to_i
ans=(n/2).round
puts ans
//  [ruby]
n=gets.to_i
ans=(n/2+0.5).round
puts ans
//  [ruby]
n=gets.to_i
ans=(n/2+0.5).to_i
puts ans
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize
    }
    println!("{}", (n + 1) / 2);
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){

    input!{
        n: usize,
    }

    if n%2==0{
        print!("{}", n/2);
    } else {
        println!("{}", n/2+1);
    }

}
//  [rust]
use proconio::input;

fn main() {
    input! {
        n: f32,
    }

    println!("{}", (n / 2.0).ceil());
}
//  [rust]
use std::io::stdin;
use std::io::Read;
use std::str::FromStr;

pub fn solve() -> i32 {
    let n: i32 = read();
    n - (n / 2)
}

fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let token: String = cin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
	println("{}", solve());
}
//  [rust]
use std::io;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).unwrap();
    let n: u32 = buf.trim_end().parse().unwrap();
    println!("{}", (n - 1) / 2 + 1);
}
//  [swift]
import Foundation

// 1
let N = Int(readLine()!)!
if N % 2 == 0 {
  print(N / 2)
} else {
  print((N / 2) + 1)
}
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let n = Int(readLine()!)!
    
    if n % 2 == 0 {
        print(n / 2)
    } else {
        print(n / 2 + 1)
    }
}

main()
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let n = Int(readLine()!)!
    
    print(n % 2 == 0 ? n / 2: n / 2 + 1)
}

main()
//  [swift]
import Foundation
let array = readLine()!.componentsSeparatedByString(" ").map{ Int($0)! }
var a = Double(array[0])
var b = (a+1)/2
print(b)
//  [swift]
import Foundation
let array = readLine()!.componentsSeparatedByString(" ").map{ Int($0)! }
var a = Double(array[0])
var b = ceil(a/2)
print(b)
//  [swift]
var n: Int = Int(readLine())
print((n+1)/2)
//  [typescript]
function main(input) {
  const inputs =input.split('\n')
  const [N] = inputs[0].split(' ').map(Number)

  console.log(Math.ceil(N / 2))
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [typescript]
import * as fs from 'fs';

//in
//
//out
//
const main = (inp: string) => {

    if (parseInt(inp) % 2 ===0) {
        console.log(parseInt(inp) / 2);
    } else {
        console.log(Math.floor(parseInt(inp) / 2)+1);
    }
};

main(fs.readFileSync('/dev/stdin', 'utf8').trim());
//  [typescript]
function Main(input) {
    const lines = input.split("\n");
    const n = lines[0];
    
    console.log(Math.ceil(n / 2));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;

  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n:number):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n:number):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
  f(roop:number, callback:any){
    for(let i=0;i<roop;i++){
      callback(i);
    }
  };
  Yes(){
    console.log('Yes');
  }
  No(){
    console.log('No');
  }
  YES(){
    console.log('YES');
  }
  NO(){
    console.log('NO');
  }
}
const m = () => {
  const o = new AtCoder();
  o.o(o.ceil(o.n()*2))
}
m();
//  [python]
W, a, b = map(int, raw_input().split())
if a <= b and b <= a + W:
    print 0
elif a <= b + W and b + W <= a + W:
    print 0
elif b > a + W:
    print abs(b - a - W)
else:
    print abs(a - b -W)
//  [python]
W,a,b = map(int,input().split())
if a > b:
    temp = b
    b = a
    a = temp
if a+W>=b:
    print(0)
else:
    print(b-(a+W))
//  [python]
W, a, b = map(int, input().split())
print(max(b-W-a, a-W-b, 0))
//  [python]
w,a,b = map(int,input().split())
#print(w,a,b)
if a+w == b:
  print(0)
elif a+w < b:
  print(b-(a+w))
elif a < b and b < a+w:
  print(0)
elif a == b:
  print(0)
//  [python]
w,a,b = map(int,input().split())
#print(w,a,b)
if a+w == b:
  print(0)
elif a+w < b:
  print(b-(a+w))
elif a+w >= b:
  print(0)
elif a == b:
  print(0)
//  [python]
w,a,b = map(int,input().split())
#print(w,a,b)
if a+w == b:
  print(w)
elif a+w < b:
  print(b-(a+w))
elif a+w >= b:
  print(0)
elif a == b:
  print(0)
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;

class Main {
    public static void main(final String[] args) throws Exception {

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            List<String> inputString = Arrays.asList(br.readLine().split(" "));
            int W = Integer.parseInt(inputString.get(0));
            int a = Integer.parseInt(inputString.get(1));
            int b = Integer.parseInt(inputString.get(2));
            int aW = a + W;
            int bW = b + W;

            int ans = 0;
            if (aW< b) {
                ans = b - aW;
            } else if (aW>= b && aW <= bW) {
                ans = 0;
            } else if (bW <= aW && bW >= a) {
                ans = 0;
            } else {
                ans = a - bW;
            }

            System.out.println(ans);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
public class Main {
	static FastScanner stdIn=new FastScanner();
	public static void main(String[] args) {
		int W=stdIn.nextInt();
		int a=stdIn.nextInt();
		int b=stdIn.nextInt();
		if(a<=b&&a+W>=b)
			System.out.println(0);
		else
			if(a<=b+W&&a+W>=b+W)
				System.out.println(0);
			else{
				System.out.println(Math.min(Math.abs(a-(b+W)),Math.abs(b-(a+W))));
			}
	}
}
//  [java]
import java.io.*;
import java.util.*;

public class Main {
  private static int solve(int w, int a, int b) {
    if (a + w < b) {
      return b - a - w;
    } else if (b + w < a) {
      return a - b - w;
    } else {
      return 0;
    }
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int w = reader.nextInt();
    int a = reader.nextInt();
    int b = reader.nextInt();
    out.println(solve(w, a, b));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		System.out.println(Math.abs(b - (a + w)) < 0 ? 0 : Math.max(a - (b + w), b - (a + w)));

		sc.close();

	}

}
//  [java]
import java.util.Scanner;

public class main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a + w <= b)System.out.println(b - (a + w));
        else if(b + w <= a) System.out.println(a - (b + w));
        else System.out.println(0);
    }
}
//  [java]
import java.util.*;

public class Main{
    public static void main (String[] args){
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        if(a < b){
            System.out.println(b-(a+W));
        }else if(b < a){
            System.out.println(a-(b+W));
        }else if(a==b){
            System.out.println("0");
        }
    }
}
//  [cpp]
#include "stdio.h"

int main (void){
	int W, a, b;
	scanf("%d %d %d", &W, &a, &b);
	if(b > a + W){printf("%d\n",b - (a+W));}
	else if(a > b + W){printf("%d\n",a - (b+W));}
	else {printf("0\n");}
	return 0;
}
//  [cpp]
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;

int m,a,b;

int main()
{
	scanf("%d%d%d",&m,&a,&b);
	if(a < b)
	{
		if(a + m >= b) printf("0\n");
		else printf("%d\n",b - a - m);
	}
	else if( a == b) printf("0\n");
    else{
        if(b + m >= a) printf("0\n");
		else printf("%d\n",a - b - m);
	}
	return 0;
}
//  [cpp]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    int n,k,i,t;
    while(scanf("%d %d %d",&n,&k,&i)==3)
    {
        if(k<i)
        {
            t=k;
            k=i;
            i=t;
        }
        if(k-i>n)
            printf("%d\n",k-i-n);
        else
            printf("0\n");
    }
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int main() {
  int W, a, b;
  cin >> W >> a >> b;

  cout << min(0, abs(a - b) - W) << endl;
  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int main() {
  int W, a, b;
  cin >> W >> a >> b;

  cout << min(0, abs(W - abs(a - b))) << endl;
  return 0;
}
//  [cpp]
#include<bits/stdc++.h>

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back


using namespace std;

const int maxm = 1000000000 + 7;

double startTime;
double getCurrentTime() {
  return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}


//----------->CODE BEGINS --------------->



int main()
{

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif


   int w,a,b;
   cin>>w>>a>>b;

   int add1 = w+a;
   int add2 = w+b;

   ll ans = 0;

  if((w+a > b && a<b) || (w+b> a && a>b) ){
    ans = 0;
  }

   else
   {
     ans = min(abs(w+b-a),abs(w+a-b));
   }

   cout<<ans<<endl;

}
//  [c]
#include <stdio.h>
int max(int x, int y) {
	return x > y ? x : y;
}
int main() {
	int w, a, b;
	scanf("%d%d%d", &w, &a, &b);
	printf("%d\n", a + w <= b ? b - a - w : max(0, a - b - w));
	return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>

int main(){
int w,a,b;
scanf("%d%d%d",&w,&a,&b);
if(a+w<=b){
printf("%d",abs(b-(a+w)));
return 0;
}
if(b+w<a){
printf("%d",abs((b+w)-a));
return 0;
}
puts("0");
return 0;
}
//  [c]
#include<stdio.h>
int main ()
{

    int w,a,b,t;
    scanf("%d%d%d",&w,&a,&b);
    if(a>b)
    {
        t=a;
        a=b;
        b=t;
    }
    a=a+w;
    if(a>b)
        printf("0");
    else
        printf("%d",b-a);
    return 0;
}
//  [c]
#include <stdio.h>
int main(void){
    int w, a, b, move;
    scanf("%d%d%d", &w, &a, &b);
    if(a<b && (a+w)>=b) move=0;
    else if(a<b) move=b-(a+w);
    else if(a>b && (b+w)>=a) move=0;
    else if(a>b) move=a-(b+w);
    printf("%d", move);
    return 0;
}
//  [c]
#include <stdio.h>
int main(void){
  int W;
  int a,b;
  scanf("%d %d %d",&W,&a,&b);
  int c;
  c=b-(a+W);
  if(c<=0){
    printf("0\n");
  }
  else{
    printf("%d",c);
  }
  return 0;
}
//  [c]
#include<stdio.h>
int main()
{

    unsigned long long w,a,b;
    scanf("%llu%llu%llu",&w,&a,&b);
    if(a+w<=b)
        printf("%llu\n",b-(a+w));
    else if(b+w<=a)
        printf("%llu\n",a-(b+w));
    if(a+w>b||b+w>a)
        printf("0\n");


    return 0;
}
//  [javascript]
"use strict";
    
const main = arg => {
    arg = arg.split("\n");
    const W = parseInt(arg[0].split(" ")[0]);
    const a = parseInt(arg[0].split(" ")[1]);
    const b = parseInt(arg[0].split(" ")[2]);
    
    if(a <= b && b <= (a + W)) {
        console.log(0);
        return;
    }
    
    if(a <= (b + W) && (b + W) <= (a + W)) {
        console.log(0);
        return;
    }
    
    console.log(a < b ? b - (a + W) : a - (b + W));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input) {
  input = input.split(" ");
  var w = parseInt(input[0]);
  var a = parseInt(input[1]);
  var b = parseInt(input[2]);
  var s;
  if(a>b){
    var c = a;
    a=b;
    b=c;
  }
    if(a+w>=b){
      s=0;
      
    }else{
      s=b-(a+w);
    }

  console.log('%s', s);
}
  
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// ABC056 B - NarrowRectanglesEasy;
'use strict';

function Main(input) {
    const tmp = input.trim().split('\n')[0].split(' ');
    const W = Number(tmp[0]);
    const a = Number(tmp[1]);
    const b = Number(tmp[2]);
    // console.log(W, a, b);

    let result;
    result = Math.abs(a - b) - W;
    if (result < 0) {
        result = 0;
    }
    console.log(result);
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

// Main(`3 2 6`); // 1
// Main(`3 1 3`); // 0
// Main(`5 10 1`); // 4
//  [javascript]
function Main(input) {
    input = input.split(" ").map(Number);
    console.log(Math.max(0,input[2]-input[1]-input[0]))
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
function Main(input) {
    input = input.split(" ").map(Number);
    console.log(Mayh.max(0,input[2]-input[1]-input[0]))
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
"use strict";
    
const main = arg => {
    arg = arg.split("\n");
    const W = parseInt(arg[0].split(" ")[0]);
    const a = parseInt(arg[0].split(" ")[1]);
    const b = parseInt(arg[0].split(" ")[2]);
    
    if((a + W) > b || (b + W) > a) {
        console.log(0);
        return;
    }
    
    console.log(a < b ? b - (a + W) : a - (b + W));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import "fmt"

func main() {
	var w, a, b int
	fmt.Scan(&w, &a, &b)
	if a+w < b {
		fmt.Print(b - (a + w))
	} else if b+w < a {
		fmt.Print(a - (b + w))
	} else {
		fmt.Print(0)
	}
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	W, a, b := nextInt(), nextInt(), nextInt()
	if a > b {
		a, b = b, a
	}
	fmt.Println(MaxOf(0, b-(a+W)))
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	var W, a, b int
	fmt.Scan(&W, &a, &b)
	if a > b {
		a, b = swap(a, b)
	}
	if b > a+W {
		fmt.Println(b - a - W)
	} else {
		fmt.Println(0)
	}
}
func swap(a, b int) (int, int) {
	if a > b {
		t := a
		a = b
		b = t
	}
	return a, b
}
//  [go]
package main

import "fmt"

func main() {
	var W, a, b int
	fmt.Scan(&W, &a, &b)
	ans := 10000000
	if a <= b && b <= a + W {
		ans = 0
	} else if a + W < b {
		ans = b - (a + W)
	} else {
		ans = a - (b - W)
	}
	fmt.Println(ans)
}
//  [go]
package main

import "fmt"

func main() {
	var W, a, b int;

	fmt.Scan(&W, &a, &b);

	if a + W >= b {
		fmt.Println(0)
	}else if a+W < b{
		fmt.Println(b - (a + W))
	}else {
		fmt.Println(a - (b + W))
	}
}
//  [ruby]
# https://atcoder.jp/contests/abc056/tasks/abc056_b



W, a, b = gets.split.map(&:to_i)

puts a < b ? [b - (a + W), 0].max : [a - (b + W), 0].max
//  [ruby]
w, a, b = gets.chomp.split.map(&:to_i)
puts [0, [b - (a + w), a - (b + w)].max].max
//  [ruby]
W, a, b = gets.chomp.split.map(&:to_i)

if (W + a) < b
  puts (b - (W + a)).abs
elsif (W + b) < a
  puts (a - (W + b)).abs
else
  puts "0"
end
//  [ruby]
w,a,b=gets.split.map(&:to_i)
p b-a-w<0?0: b-a-w
//  [ruby]
if b >= (a+w)
  puts b-(a+w)
elsif (b+w) < a
  puts a-(b+w)
else
  puts 0
end
//  [ruby]
w,a,b = gets.split.map(&:to_i)

if (a+w) < b
  puts b-(a+w)
elsif b-(a+w) < 0
 puts w-b
else
  puts 0
end
//  [rust]

use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp::max;

fn main() {
    let w: i64 = read();
    let a: i64 = read();
    let b: i64 = read();
    if a < b {
        if a + w < b {
            println!("{}", b - (w + a));
        } else {
            println!("{}", 0);
        }
    } else {
        if b + w < a {
            println!("{}", a - (b + w));
        } else {
            println!("{}", 0);
        }
    }
}
//  [rust]
use std::cmp::max;
use std::mem::swap;
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        w:i32,
        _a:i32,
        _b:i32
    }
    let mut a = _a;
    let mut b = _b;
    if a > b{
        swap(&mut a, &mut b);
    }
    let mut ans:i32 = b - (a+w);
    println!("{}",max(0, ans));
}
//  [rust]
use std::io;
use std::cmp::min;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let w = v[0];
	let a = v[1];
	let b = v[2];
	if (b >= a && b <= a+w) || (b+w >= a && b+w <= a+w){
		println!("0");
	}else{
		println!("{}", min((b-(a+w)).abs(), (a-(b+w)).abs()));
	}
}
//  [rust]
use std::io;
use std::io::{stdin, Read};
use std::process::exit;
use std::cmp::min;

fn main() {

    let mut scan = stdin();
    let mut line = String::new();

    let _ = scan.read_line(&mut line);
    let inputs: Vec<&str> = line.split_whitespace().collect();

    let w: i32 = inputs[0].parse().unwrap();
    let a: i32 = inputs[1].parse().unwrap();
    let b: i32 = inputs[2].parse().unwrap();

    println!("w:{} a:{} b:{}", w,a,b);

    // (a+w)-b

    let mut v = 0;

    if a+w < b {
        v = (a+w)-b;
    } else if b+w < a{
        v = a-(b+w);
    } else {
        v = 0;
    }

    println!("{}",v.abs());
    
}
//  [rust]

use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp::max;

fn main() {
    let w: i64 = read();
    let a: i64 = read();
    let b: i64 = read();
    println!("{}", max(a - (b + w), b - (w + a)));
}
//  [rust]

use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let w = read::<i64>();
  let a = read::<i64>();
  let b = read::<i64>();

  println!("{}", max(0, b - (w + a)));
}
//  [swift]
let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let (W,a,b) = (input[0],input[1],input[2])
print(max(abs(a-b)-W,0))
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (W, a, b) = (input[0], input[1], input[2])
print(max(max(b-(a+W), 0), max(a-(b+W), 0)))
//  [swift]
let i=readLine()!.characters.split(" ").map{Int(String($0))!};print(max(abs(i[1]-i[2])-i[0],0))
//  [swift]
let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let (W,a,b) = (input[0],input[1],input[2])
print(max(b-a-W,a-b-W))
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (W, a, b) = (input[0], input[1], input[2])
print(min(max(b-(a+W), 0), max(a-(b+W), 0)))