Minimum Distance

All submissions for this problem are available.
In Wolf town there are 2 big markets S and T. The distance between these markets is D. Chef Ciel would like to run 2 restaurants in Wolf town, where the first restaurant will be supplied by the market S and the second one will be supplied by the market T. The markets run delivery service without charge within some distance, D_{S} and D_{T} respectively. Near these markets there are many rival restaurants. So Ciel decides to build one of her restaurants exactly at the distance D_{S} from the market S, and build the other restaurant exactly at the distance D_{T} from the market T.
Chef Ciel would like to build her restaurants as close as possible to each other for convenient communication. Your task is to calculate the minimum distance that could be achieved between her restaurants.
Note. Wolf town can be considered as an infinite 2D Cartesian plane. The markets and Ciel's restaurants should be considered as points on a plane. The distance between the two points A and B, whose coordinates are (A_{x}, A_{y}) and (B_{x}, B_{y}) respectively, is defined by Dist(A, B) = ((A_{x} − B_{x})^{2} + (A_{y} − B_{y})^{2})^{1/2}.
Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. The only line of each test case contains three spaceseparated integers D_{S}, D_{T} and D.
Output
For each test case, output a single line containing the minimum possible distance between Ciel's restaurants that could be achieved. The output must have an absolute or relative error at most 0.000001 (10^{−6}). Please, note that your output should not have more than 1000 digits after the decimal point, otherwise you may (or may not) get wrong answer or runtime error (SIGXFSZ).
Note also that the answer could be 0, which means that two Ciel's restaurants should be located at the same building.
Constraints
 1 ≤ T ≤ 2013
 1 ≤ D_{S}, D_{T}, D ≤ 2013
Example
Input: 4 15 15 50 15 15 18 43 88 200 2013 2013 2013 Output: 20.000 0.0 69.00000 0
Explanation
Example case 1. The distance between markets S and T is 50. Assume for simplicity that S has coordinates (0, 0) and T has coordinates (50, 0). Then Ciel could build her first restaurant R_{S} at the point (15, 0) and the second restaurant R_{T} at the point (35, 0). This will ensure that the distance between S and R_{S} is D_{S} = 15 and the distance between T and R_{T} is D_{T} = 15. The distance between restaurants appear to be 20 in this scenario. One can prove that this is the minimum possible distance.
Example case 2. Here Ciel can locate both her restaurants at the same place. Indeed, if S = (0, 0) and T = (18, 0) then Ciel could locate both her restaurants at the point R = (9, 12). To check this note that Dist(R, S) = ((9 − 0)^{2} + (12 − 0)^{2})^{1/2} = (81 + 144)^{1/2} = 225^{1/2} = 15. Similarly it can be verified that Dist(R, T) = 15.
Example case 3. It is similar to the example case 1. If S = (0, 0) and T = (200, 0) then the best way is to locate Ciel's restaurants at the points R_{S} = (43, 0) and R_{T} = (112, 0). You can easily check by yourself that Dist(S, R_{S}) = 43, Dist(T, R_{T}) = 88 and Dist(R_{S}, R_{T}) = 69.
Just to reiterate, your output can have any number of digits after the decimal point unless it is too long (more than 1000 digits after decimal point). However your output must have an absolute or relative error at most 10^{−6}.
Author:  laycurse 
Tester:  anton_lunyov 
Editorial  http://discuss.codechef.com/problems/CIELDIST 
Tags  cakewalk, cook30, laycurse, simplemath 
Date Added:  2012013 
Time Limit:  2.013 sec 
Source Limit:  50000 Bytes 
Languages:  C, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions