Go: package main

import (
        "fmt"
        "math"
)

func main() {
        var n int
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                var ax, ay, ar, bx, by, br float64
                fmt.Scanf("%f %f %f %f %f %f", &ax, &ay, &ar, &bx, &by, &br)

                d := math.Sqrt((bx-ax)*(bx-ax) + (by-ay)*(by-ay))
                if d <= ar + br {
                        if ar > br {
                                if ar > br + d {
                                        fmt.Println("2")
                                } else {
                                        fmt.Println("1")
                                }
                        } else {
                                if br > ar + d {
                                        fmt.Println("-2")
                                } else {
                                        fmt.Println("1")
                                }
                        }
                } else {
                        fmt.Println(0)
                }
        }
}

C++: #include <stdio.h>
#include <math.h>
  int main(){
    int n,i;
    double xa,ya,ra,xb,yb,rb;
    scanf("%d",&n);
     for(i=0;i<n;i++){
       scanf("%lf%lf%lf%lf%lf%lf",&xa,&ya,&ra,&xb,&yb,&rb);
	   double q=xa-xb;
	   double r=ya-yb;
	   double s=ra-rb;
       double dis=q*q+r*r;   
       dis = sqrt(dis);
       if(dis>ra+rb){
printf("%d\n",0);
continue;
}else if(dis<ra+rb && dis*dis>s*s){
printf("%d\n",1);
continue;
}else if(dis*dis<s*s){
	if(ra>rb){
printf("%d\n",2);
continue;
	}else{
		printf("%d\n",2);
		continue;
	}
}
else{
	printf("%d\n",1);
	continue;
}
}
return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){
  int n;
  double xa,ya,ra,xb,yb,rb,d;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>xa>>ya>>ra>>xb>>yb>>rb;
    d=sqrt( (xb-xa)*(xb-xa)+(yb-ya)*(yb-ya) );
    if(ra-rb>d) cout<<2<<endl;
    else if(rb-ra>d) cout<<-2<<endl;
    else if( ra-rb<=d && ra+rb>=d ) cout<<1<<endl;
    else cout<<0<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)

int main(){

	int n;
	cin>>n;

	for(int i = 0; i < n; i++){
		double xa,ya,ra,xb,yb,rb;
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		double dist=(ya-yb)*(ya-yb)+(xa-xb)*(xa-xb);
		// AÆBªdÈçÈ¢
		if(!EQ((ra+rb)*(ra+rb),dist)&&(ra+rb)*(ra+rb)<dist){
			cout<<0<<endl;
		}
		// ~üªðíé
		else if(EQ(abs(ra-rb)*abs(ra-rb),dist)||(abs(ra-rb))*(abs(ra-rb))<dist){
			cout<<1<<endl;
		}
		else{
			// Ç¿ç©ªÉ¶Ý·é
			if(ra>rb){
				cout<<2<<endl;
			}
			else
				cout<<-2<<endl;
		}
	}


	return 0;
}

C++: #include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#define ttt template <typename T>
#define pca point<T> const &
ttt struct point { T x, y; };
ttt point<T> operator + (pca a, pca b) { return { a.x+b.x, a.y+b.y }; }
ttt point<T> operator - (pca a, pca b) { return { a.x-b.x, a.y-b.y }; }
ttt point<T> operator - (pca a) { return { -a.x, -a.y }; }
ttt point<T> operator * (T a, pca b) { return { a*b.x, a*b.y }; }
ttt std::pair<T,T> to_pair(pca a) { return { a.x, a.y }; }
ttt bool operator == (pca a, pca b) { return to_pair(a) == to_pair(b); }
ttt bool operator != (pca a, pca b) { return to_pair(a) != to_pair(b); }
ttt bool operator <  (pca a, pca b) { return to_pair(a) <  to_pair(b); }
ttt bool operator <= (pca a, pca b) { return to_pair(a) <= to_pair(b); }
ttt bool operator >= (pca a, pca b) { return to_pair(a) >= to_pair(b); }
ttt bool operator >  (pca a, pca b) { return to_pair(a) >  to_pair(b); }
ttt T length_squared(pca p) { return p.x*p.x + p.y*p.y; }
ttt double length(pca p) { return sqrt(length_squared(p)); }
ttt point<T> normalized(pca a) { return (1 / length(a)) * a; }
ttt T   dot(pca p, pca q) { return p.x * q.x + p.y * q.y; }
ttt T cross(pca p, pca q) { return p.x * q.y - p.y * q.x; }
ttt int ccw(pca a, pca b, pca c) { T x = cross(b - a, c - a); return x > 0 ? 1 : x < 0 ? -1 : 0; }
#undef ttt
#undef pca
template <typename T> std::istream & operator >> (std::istream & input, point<T> & p) { return input >> p.x >> p.y; }
template <typename T> std::ostream & operator << (std::ostream & output, const point<T> & p) { return output << p.x << ' ' << p.y; }
template <typename T> struct circle { point<T> p; T r; };
template <typename T> bool operator == (circle<T> const & a, circle<T> const & b) { return a.p == b.p and a.r == b.r; }
template <typename T> bool operator != (circle<T> const & a, circle<T> const & b) { return not (a == b); }
using namespace std;
int main() {
    int n; cin >> n;
    while (n --) {
        circle<double> a, b;
        cin >> a.p >> a.r >> b.p >> b.r;
        double l = length(a.p - b.p);
        if (a.r + b.r < l) {
            cout << 0 << endl;
        } else if (l + a.r < b.r) {
            cout << - 2 << endl;
        } else if (l + b.r < a.r) {
            cout << 2 << endl;
        } else {
            cout << 1 << endl;
        }
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
int main()
{
	int n;
	std::cin >> n;
	for (int i = 0; i < n; i++)
	{
		double xa, ya, ra, xb, yb, rb;
		std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double d = hypot(xa - xb, ya - yb);
		if (d > ra + rb)
		{
			std::cout << 0 << std::endl;
		}
		else if (d == ra + rb || d > abs(ra - rb))
		{
			std::cout << 1 << std::endl;
		}
		else
		{
			std::cout << 2 * (ra < rb ? -1 : 1) << std::endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;

int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		double xa, ya, ra, xb, yb, rb;
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double dr = sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));
		if(ra >= rb+dr)
			cout << 2 << endl;
		else if(rb >= ra+dr)
			cout << -2 << endl;
		else if(dr < ra + rb)
			cout << 1 << endl;
		else
			cout << 0 << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>

enum JudgeCircleIntersect 
{
	BinA =  2,
	AinB = -2,
	AcrossB = 1,
	AdisB = 0,
	Error = -1
};

struct Circle
{
	Circle()
	{
	}

	Circle(double sx, double sy, double sr):cx(sx), cy(sy), r(sr)
	{
	}

	double cx;

	double cy;

	double r;
};

double Abs(double x)
{
	return x>=0 ?  x : -x;
}

JudgeCircleIntersect Intersect(const Circle& a, const Circle& b)
{
	double distance = sqrt((a.cx-b.cx)*(a.cx-b.cx)+(a.cy-b.cy)*(a.cy-b.cy));


	if(a.r+b.r<distance)
	{
		return AdisB;
	}
	else if((b.r-a.r)>distance && (b.r-a.r)>0)
	{
		return AinB;
	}
	else if((a.r-b.r)>distance && (a.r-b.r)>0)
	{
		return BinA;
	}
	else if(Abs(a.r-b.r)==distance || (a.r+b.r==distance))
	{
		return AcrossB;
	}
	else
	{
		return Error;
	}
}

int main()
{
	int n = 0;
	
	double xa, ya, ra, xb, yb, rb;

	std::cin >> n;

	for(int i=0; i<n; ++i)
	{
		std::cin >> xa >> ya >> ra 
			>> xb >> yb >> rb;

		Circle a(xa, ya, ra);

		Circle b(xb, yb, rb);

		std::cout << Intersect(a,b) << '\n';
	}
}

C++: #include<iostream>
#include<cmath>
int main()
{
    int n;
    std::cin >> n;
    for (int i = 0; i < n; i++)
    {
        double xa, ya, ra, xb, yb, rb;
        std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
        double d = hypot(xa - xb, ya - yb);
        if (d < abs(ra - rb))
        {
            std::cout << 2 * (ra < rb ? -1 : 1) << std::endl;
        }
        else if (d <= ra + rb)
        {
            std::cout << 1 << std::endl;
        }
        else
        {
            std::cout << 0 << std::endl;
        }
    }
    return 0;
}