Problem:
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Circles Intersection

You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$.

Write a program which prints:

"2" if $B$ is in $A$,

"-2" if $A$ is in $B$,

"1" if circumference of $A$ and $B$ intersect, and

"0" if $A$ and $B$ do not overlap.

You may assume that $A$ and $B$ are not identical.

Input

The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:

$x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$

Output

For each dataset, print 2, -2, 1, or 0 in a line.

Sample Input

2
0.0 0.0 5.0 0.0 0.0 4.0
0.0 0.0 2.0 4.1 0.0 2.0

Output for the Sample Input

2
0

Solution in C# (judge verdict: Wrong Answer)

using System;
using System.Collections.Generic;
using System.Linq;

namespace P0023_CirclesIntersection
{
    class Program
    {
        static void Main(string[] args)
        {
            var lines = new List<List<string>>();
            var n = int.Parse(Console.ReadLine());
            for (int i = 1; i <= n; i++)
            {
                var sp = Console.ReadLine().Split(' ').ToList<string>();
                lines.Add(sp);
            }

            foreach (var line in lines)
            {
                var xa = decimal.Parse(line[0]);
                var ya = decimal.Parse(line[1]);
                var ra = decimal.Parse(line[2]);
                var xb = decimal.Parse(line[3]);
                var yb = decimal.Parse(line[4]);
                var rb = decimal.Parse(line[5]);

                var xaL = xa - ra;
                var xaR = xa + ra;

                var yaB = ya - ra;
                var yaU = ya + ra;

                var xbL = xb - rb;
                var xbR = xb + rb;

                var ybB = yb - rb;
                var ybU = yb + rb;

                var d2 = ((xa - xb) * (xa - xb)) + ((ya - yb) * (ya - yb));

                //var d = Math.Sqrt(Math.Pow(xa - xb, 2) - Math.Pow(ya - yb, 2));
                
                if (xaL <= xbL && xaR >= xbR && yaB <= ybB && yaU >= ybU) 
                {
                    Console.WriteLine("2");
                }
                else if (xaL >= xbL && xaR <= xbR && yaB >= ybB && yaU <= ybU)
                {
                    Console.WriteLine("-2");
                }
                else if (d2 <= (ra + rb) * (ra + rb))
                {
                    Console.WriteLine("1");
                }
                else 
                {
                    Console.WriteLine("0");
                }
                
            }


        }
    }
}