Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var xa, ya, ra, xb, yb, rb float64
		fmt.Scan(&xa, &ya, &ra, &xb, &yb, &rb)
		distance := math.Sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya))
		if rb+distance < ra {
			fmt.Println(2)
		} else if ra+distance < rb {
			fmt.Println(-2)
		} else if rb+ra >= distance {
			fmt.Println(1)
		} else {
			fmt.Println(0)
		}
	}
}

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

int main(void){
	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 d = sqrt( (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) );

		if( ra+rb < d )
			cout << 0 << endl;
		else if( d+ra < rb )
			cout << 2 << endl;
		else if( d+rb < ra )
			cout << -2 << endl;
		else
			cout << 1 << endl;

	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

#define EPS 1e-8

int main(){

	int n;
	cin >> n;
	while(n--){
		double xa, ya, ra, xb, yb, rb;
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double d2 = (xa - xb) * (xa - xb) + (ya - yb) * (ya - yb);
		if(d2 > (ra + rb) * (ra + rb)) cout << 0 << endl;
		else if(d2 == (ra + rb) * (ra + rb) cout << 1 << endl;
		else if(d2 == (ra - rb) * (ra - rb)) cout << 1 << endl;
		else if(ra > rb) cout << 2 << endl;
		else cout << -2 << 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';
	}


	/*
	Circle a(20.0,40.0,30.0); // 位置(20,40), 半径 30 の円

	Circle b(30.0,50.0,20.0); // 位置(40,50), 半径 20 の円

	if(Intersect(a,b))
	{
		std::cout << "a と b は交差している\n";
	}
	else
	{
		std::cout << "a と b は交差していない\n";
	}
	*/
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;


double xa, ya, ra, xb, yb, rb, d;
ll n;

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

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<algorithm>
#include<cmath>
using namespace std;
int main(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        float x[2], y[2], r[2];
        
        for(int j = 0; j < 2; j++)
            cin >> x[j] >> y[j] >> r[j];
        
        // 2??????????????????????????¢
        float d = sqrt((x[1]-x[0])*(x[1]-x[0])+(y[1]-y[0])*(y[1]-y[0]));
        
        // ??????????????¢??¨???B?????????????????????A????????????????°?????????´?????????B??????A????????¨?????????
        if(d + r[0] < r[1])
            cout << "-2" << endl;
        // ?????????
        else if(d + r[1] < r[0])
            cout << "2" << endl;
        // 2?????????????????????????????????????????¢??????????°?????????´??????2????????????????????£?????????
        else if(d < r[0]+ r[1])
            cout << "1" << endl;
        // ?????????
        else
            cout << "0" << endl;

    }
}

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

int main()
{
	int n;
	double xa, ya, ra, xb, yb, rb;
	
	cin >> n;
	while(n--){
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		//B in A
		if( hypot(xa - xb, ya - yb) + rb < ra )
			cout << 2 << endl;
		//A in B
		else if( hypot(xa - xb, ya - yb) + ra < rb )
			cout << -2 << endl;
		//A intersect B
		else if( hypot(xa - xb, ya - yb) < ra + rb )
			cout << 1 << endl;
		else
			cout << 0 << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

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

int main()
{
	int n;
	cin >> n;
	
	rep(i, n)
	{
		Circle a, b;
		cin >> a.x >> a.y >> a.r >> b.x >> b.y >> b.r;

		double d = sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));

		if(a.r + b.r < d)
			cout << 0 << endl;
		else if(d < a.r - b.r)
			cout << 2 << endl;
		else if(d < b.r - a.r)
			cout << -2 << endl;
		else
			cout << 1 << endl;
	}
}