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++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

struct Circle
{
	double x, y;
	double r;
};

int hit(Circle c0, Circle c1)
{
	double x = (c1.x - c0.x);
	double y = (c1.y - c0.y);

	double d = sqrt(x * x + y * y);
	if (d <= c0.r + c1.r)
	{
		if (c0.r + d < c1.r)
		{
			return -2;
		}
		else if (c1.r + d < c0.r)
		{
			return 2;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 0;
	}
}

int main()
{
	int n;
	for (cin >> n; n--;)
	{
		Circle c0, c1;
		cin >> c0.x >> c0.y >> c0.r;
		cin >> c1.x >> c1.y >> c1.r;

		cout << hit(c0, c1) << endl;
	}
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
int main(){
    pdd a,b; double ar,br; int n;
    cin>>n;
    rep(i,n){
        cin>>a.first>>a.second>>ar>>b.first>>b.second>>br;
        if((b.first-br<a.first-ar)&&(a.first+ar<b.first+br)//x
           &&(b.second+br>a.second+ar)&&(b.second-br<a.second-ar))return puts("-2")*0;
        swap(a,b); swap(ar,br);
        if((b.first-br<a.first-ar)&&(a.first+ar<b.first+br)//x
           &&(b.second+br>a.second+ar)&&(b.second-br<a.second-ar))return puts("2")*0;
        swap(a,b); swap(ar,br);
        if(abs(a.first-b.first)<(ar+br)&&max(ar,br)-min(ar,br)<abs(a.first-b.first))return puts("1")*0;
        swap(a.first,a.second); swap(b.first,b.second);
        if(abs(a.first-b.first)<(ar+br)&&max(ar,br)-min(ar,br)<abs(a.first-b.first))return puts("1")*0;
        puts("0");
        
    }
}

C++: #include <iostream>

int check_intersection(const double xa, const double ya, const double ra,
                            const double xb, const double yb, const double rb)
{
    double distance = (xa - xb) * (xa - xb) + (ya - yb) * (ya - yb);
    if(distance < ra || distance < rb){
        if(ra > rb)
            return 2;
        else
            return -2;
    }
    else if(distance > (ra + rb) * (ra + rb))
        return 0;
    else return 1;
}

int main ()
{
    double xa, ya, ra, xb, yb, rb;
    u_int N;
    
    std::cin >> N;
    for(u_int i = 0; i < N; ++i){
        std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
        std::cout << check_intersection(xa, ya, ra, xb, yb, rb) << std::endl;
    }
    
    return 0;
}

C++: #include <iostream>
#include <array>
#include <math.h>

int main(){

	std::array<double, 3> a; //0:xa 1:ya 2:ra
	std::array<double, 3> b;

	int N;

	std::cin >> N;

	for(int i = 0; i < N; ++i){
		
		for(int j = 0; j < 3; ++j)
			std::cin >> a[j];

		for(int j = 0; j < 3; ++j)
			std::cin >> b[j];

		double ab = sqrt( (a[0] * b[0]) + (a[1] * b[1]) );

		if( ab > (a[2] + b[2]) )
			std::cout << 0 << std::endl;
		
		else if ( a[2] > ab + b[2] )
			std::cout << 2 << std::endl;

		else if ( b[2] > ab + a[2] )
			std::cout << -2 << std::endl;

		else
			std::cout << 1 << std::endl;

		}
	}

	return 0;

}

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

struct Circle2D {
	double x, y, r;
	static int Intersection(Circle2D &a, Circle2D &b);
};

int Circle2D::Intersection(Circle2D &a, Circle2D &b) {
	double diffABx = b.x - a.x, diffABy = b.y - a.y;
	double distanceCenterAB2 = diffABx * diffABx + diffABy * diffABy;
	double distanceCenterAB = sqrt(distanceCenterAB2);
	if (distanceCenterAB < a.r + b.r) {
		if (a.r > b.r && a.r > b.r + distanceCenterAB) {
			return 2;
		}
		if (b.r > a.r && b.r > a.r + distanceCenterAB) {
			return -2;
		}
		return 1;
	}
	return 0;
}

int main() {
	int dataSet;
	Circle2D ca, cb;
	for (std::cin >> dataSet; dataSet > 0; --dataSet) {
		std::cin >> ca.x >> ca.y >> ca.r >> cb.x >> cb.y >> cb.r;
		std::cout << Circle2D::Intersection(ca, cb) << '\n';
	}
	return 0;
}

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

struct POINT_DOUBLE {
  double x;
  double y;
};

struct CIRCLE_DOUBLE {
  POINT_DOUBLE center;
  double radius;
};

std::istream& operator >> (std::istream& is, POINT_DOUBLE& p)
{
  is >> p.x >> p.y;
  return is;
}

std::istream& operator >> (std::istream& is, CIRCLE_DOUBLE& circle)
{
  is >> circle.center >> circle.radius;
  return is;
}

static double GetDistance(const POINT_DOUBLE& pt1, const POINT_DOUBLE& pt2)
{
  return std::sqrt(std::pow(pt1.x - pt2.x, 2) + std::pow(pt1.y - pt2.y, 2));
}

int main(void)
{
  int n;
  std::cin >> n;

  for (int i = 0; i < n; i++) {
    CIRCLE_DOUBLE circleA, circleB;
    std::cin >> circleA >> circleB;
    bool isSwapped = false;
    if (circleA.radius < circleB.radius) {
      std::swap(circleA, circleB);
      isSwapped = true;
    }

    double centerDis = GetDistance(circleA.center, circleB.center);
    if (centerDis > circleA.radius + circleB.radius) {
      std::cout << 0 << std::endl;
    }
    else if (circleA.radius >= centerDis + circleB.radius) {
      if (isSwapped) {
        std::cout << -2 << std::endl;
      }
      else {
        std::cout << 2 << std::endl;
      }
    }
    else {
      std::cout << 1 << std::endl;
    }

  }

  return 0;
}

C++: #include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main(){
	double xa,ya,ra,xb,yb,rb;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		double s=(xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
		s=(double)sqrt((double)s);
		int t=1;
		if(ra+s<rb)
			t=-2;
		if(rb+s<ra)
			t=2;
		if(s>ra+rb)
			t=0;
		cout<<t<<endl;
	}
	return 0;
}

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

inline double distance(double x1,double y1,double x2,double y2){
	return sqrt( (x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2) );
}

int main(){
	int dataSetNum;
	std::cin >> dataSetNum;

	std::deque<int> number;

	for(int i = 0; i < dataSetNum; ++i){
		double xa, ya, ra, xb, yb, rb;
		std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double dis = distance(xa, ya, xb, yb);
		//"0" if A and B do not overlap
		if(dis > ra + rb) number.push_buck( 0 );
		//"2" if B is in A
		else if(ra > rb && dis + rb <= ra) number.push_buck( 2 );
		//"-2" if A is in B,
		else if(rb > ra && dis + ra <= rb) number.push_buck( -2 );
		//"1" if circumference of A and B intersect
		else number.push_buck( 1 );
	}
	for(int i = 0; i < dataSetNum; ++i){
		std::cout << number.front() << std::endl;
		number.pop_front();
	}
	return 0;
	}