Problem:
Score : 100 points

Problem Statement

The window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)

We will close the window so as to minimize the total horizontal length of the uncovered part of the window.
Find the total horizontal length of the uncovered parts of the window then.

Constraints

1 \leq A \leq 100

1 \leq B \leq 100

A and B are integers.

Input

Input is given from Standard Input in the following format:

A B

Output

Print the total horizontal length of the uncovered parts of the window.

Sample Input 1

12 4

Sample Output 1

4

We have a window with a horizontal length of 12, and two curtains, each of length 4, that cover both ends of the window, for example. The uncovered part has a horizontal length of 4.

Sample Input 2

20 15

Sample Output 2

0

If the window is completely covered, print 0.

Sample Input 3

20 30

Sample Output 3

0

Each curtain may be longer than the window.

Solution in Rust (1.15.1) (judge verdict: Accepted)

#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(unknown_lints)]
#![allow(unused_variables)]
#![allow(unused_must_use)]
#![allow(unused_mut)]
#![allow(dead_code)]
#![allow(unused_assignments)]

use std::cmp;
use std::process::exit;
use std::collections::{
    HashMap,
    VecDeque,
    HashSet
};
use std::io::{
    stdin,
    stdout,
    stderr,
    Read,
    Write,
    BufReader,
    BufWriter
};

macro_rules! debug {
    (($t:expr, $e:expr)) => {
        #[cfg(debug_assertions)]
        {
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", $t, $e).unwrap()
        }
    };
    ($e:expr) => {
        #[cfg(debug_assertions)]
        {
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        }
    };
}

macro_rules! d {
    ($($tt:tt),*) => {
        #[cfg(debug_assertions)]
        $({
            debug!($tt);
        })*
    };
}

macro_rules! e {
    ($($arg:tt)*) => {
        #[cfg(debug_assertions)]
        {
            let mut err = stderr();
            let e = format!($($arg)*);
            write!(err, "\x1B[32m{}\x1B[0m", e).unwrap()
        }
    };
}

macro_rules! eln {
    ($($arg:tt)*) => {
        #[cfg(debug_assertions)]
        {
            let mut err = stderr();
            let e = format!($($arg)*);
            writeln!(err, "\x1B[32m{}\x1B[0m", e).unwrap()
        }
    };
}

macro_rules! stdin {
    () => ({
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    })
}

macro_rules! test {
    (name = $name:ident, $($input:expr => $output:expr),* $(,)*) => (
        #[test]
        fn $name() {
            $(
                assert_eq!(solve($input.to_string()), $output);
            )*
        }
    );
    ($($input:expr => $output:expr),* $(,)*) => (
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input.to_string()), $output);
            )*
        }
    );
}

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));
        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")
    };
}

pub trait VecUtils<T: Clone> {
    fn npop(&mut self, n: usize) -> Result<Vec<T>, String>;
    fn nget(&self, n: usize) -> Result<Vec<T>, String>;
    fn is_valid_range(&self, idx_a: usize, idx_b: usize) -> bool;
    fn get_range(&self, idx_a: usize, idx_b: usize) -> Result<Vec<T>, String>;
    fn pop_range(&mut self, idx_a: usize, idx_b: usize) -> Result<Vec<T>, String>;
    fn mul(&self, n: usize) -> Vec<T>;
}

pub trait StrUtils {
    fn npop(&mut self, n: usize) -> Result<String, String>;
    fn nget(&self, n: usize) -> Result<String, String>;
    fn is_valid_range(&self, idx_a: usize, idx_b: usize) -> bool;
    fn get_range(&self, idx_a: usize, idx_b: usize) -> Result<String, String>;
    fn pop_range(&mut self, idx_a: usize, idx_b: usize) -> Result<String, String>;
    fn mul(&self, n: usize) -> String;
}

impl<T: Clone> VecUtils<T> for Vec<T> {
    fn npop(&mut self, n: usize) -> Result<Vec<T>, String> {
        let len = self.len();
        if n > len {
            return Err("too large num".to_string());
        }
        let mut res: Vec<T> = Vec::new();
        for _ in 0..n {
            let x = self.pop().ok_or("".to_string())?;
            res.push(x);
        }
        res.reverse();
        Ok(res)
    }

    fn nget(&self, n: usize) -> Result<Vec<T>, String> {
        let len = self.len();
        if n > len {
            return Err("too large num".to_string());
        }
        let mut res: Vec<T> = Vec::new();
        for i in 0..n {
            res.push(self[len - 1 - i].clone());
        }
        Ok(res)
    }

    fn is_valid_range(&self, idx_a: usize, idx_b: usize) -> bool {
        let mut can = true;
        let self_len = self.len();
        if self_len < idx_a {
            can = false;
        }
        if self_len < idx_b {
            can = false;
        }
        can
    }

    fn get_range(&self, idx_a: usize, idx_b: usize) -> Result<Vec<T>, String> {
        if ! self.is_valid_range(idx_a, idx_b) {
            return Err("invalid range".to_string());
        }
        let mut res: Vec<T> = Vec::new();
        for (i,x) in self.into_iter().enumerate() {
            let i = i;
            if i < idx_a {
                continue;
            }
            if idx_b <= i {
                break;
            }
            res.push(x.clone());
        }
        Ok(res)
    }

    fn pop_range(&mut self, idx_a: usize, idx_b: usize) -> Result<Vec<T>, String> {
        if ! self.is_valid_range(idx_a, idx_b) {
            return Err("invalid range".to_string());
        }
        let mut res: Vec<T> = Vec::new();
        let mut pop_idxs: Vec<usize> = Vec::new();
        for (i,x) in self.iter().enumerate() {
            let i = i;
            if i < idx_a {
                continue;
            }
            if idx_b <= i {
                break;
            }
            res.push(x.clone());
            pop_idxs.push(i);
        }
        for _ in 0..pop_idxs.len() {
            match pop_idxs.pop() {
                Some(idx) => {
                    self.remove(idx as usize);
                },
                None => {}
            }
        }
        Ok(res)
    }

    fn mul(&self, n: usize) -> Vec<T> {
        let mut res: Vec<T> = Vec::new();
        for _ in 0..n {
            for x in self {
                res.push(x.clone());
            }
        }
        res
    }
}

impl StrUtils for String {
    fn npop(&mut self, n: usize) -> Result<String, String> {
        let mut self_chars: Vec<char> = self.chars().collect();
        match self_chars.npop(n) {
            Ok(poped) => {
                *self = self_chars.into_iter().collect::<String>();
                Ok(poped.into_iter().collect::<String>())
            },
            Err(e) => {
                Err(e)
            }
        }
    }

    fn nget(&self, n: usize) -> Result<String, String> {
        let self_chars: Vec<char> = self.chars().collect();
        match self_chars.nget(n) {
            Ok(v) => {
                Ok(v.into_iter().collect::<String>())
            },
            Err(e) => {
                Err(e)
            }
        }
    }

    fn is_valid_range(&self, idx_a: usize, idx_b: usize) -> bool {
        let self_chars: Vec<char> = self.chars().collect();
        self_chars.is_valid_range(idx_a, idx_b)
    }

    fn get_range(&self, idx_a: usize, idx_b: usize) -> Result<String, String> {
        let self_chars: Vec<char> = self.chars().collect();
        match self_chars.get_range(idx_a, idx_b) {
            Ok(v) => {
                Ok(v.into_iter().collect::<String>())
            },
            Err(e) => {
                Err(e)
            }
        }
    }

    fn pop_range(&mut self, idx_a: usize, idx_b: usize) -> Result<String, String> {
        let mut self_chars: Vec<char> = self.chars().collect();
        match self_chars.pop_range(idx_a, idx_b) {
            Ok(poped) => {
                *self = self_chars.into_iter().collect::<String>();
                Ok(poped.into_iter().collect::<String>())
            },
            Err(e) => {
                Err(e)
            }
        }
    }

    fn mul(&self, n: usize) -> String {
        let mut res: String = String::new();
        for _ in 0..n {
            res.push_str(self);
        }
        res
    }
}

fn main() {
    print!("{}", solve(stdin!()));
}

/* TEMPLATE END */

fn solve(src: String) -> String {
    let mut res = String::from("");
    input!{
        source = src,
        a: i32,
        b: i32
    }
    eln!("###########################################");
    d!(a);
    d!(b);
    eln!("-------------------------------------------");

    let num = cmp::max(0, a - 2*b);

    res.push_str(&num.to_string());

    d!(res);
    res.push_str("\n");
    res
}

test! {
r"12 4
"
=>
r"4
",
r"20 15
"
=>
r"0
",
r"20 30
"
=>
r"0
"
}