Real obtuse

All submissions for this problem are available.
Read problems statements in mandarin chinese, russian and vietnamese as well.
On the occasion of the birthday, Chef bought a large circular cake and decorated it with k candles placed equally spaced around the circumference of the cake, i.e. the lengths of the arcs that connect any two adjacent candles are equal.
Chef enumerated the candles from 1 to k in clockwise manner. He then chose two candles, say A and B and lit them up. Now, he left the kitchen and decided to come back in some time with friends to celebrate the birthday.
Meanwhile Chef's little brother came to the kitchen and saw the cake. He wants to light up one of the not lit candles C such that angle ACB is an obtuse angle. He believes that such a pattern of lit candles will be auspicious. Can you find out how many candles C he can light up?
Input
The first line contains a single integer T, the number of test cases. Each test case is described by a single line containing three spaceseparated integers k, A, B.
Output
For each test case, output a single line containing one integer: the answer for the test case.
Constraints
 1 ≤ T ≤ 10^{5}
 3 ≤ k ≤ 10^{9}
 1 ≤ A, B ≤ k
 A ≠ B
Example
Input: 3 6 1 3 6 1 4 10 1 5 Output: 1 0 3
Explanation
Example case 1. Only candle with number 2 is suitable.
Example case 2. No matter how we choose C the angle would have 90 degrees.
Example case 3. Candles with numbers 2,3,4 are suitable.
Author:  melnik 
Tester:  kingofnumbers 
Editorial  https://discuss.codechef.com/problems/OBTTRNGL 
Tags  cook85, easy, math, melnik 
Date Added:  17082017 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, 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, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 