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)
		// println(xa, ya, ra, xb, yb, rb)
		dis := math.Sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb))
		if dis + ra < rb {
			fmt.Println(-2)
		} else if dis + rb < ra {
			fmt.Println(2)
		} else if dis > rb + ra {
			fmt.Println(0)
		} else {
			fmt.Println(1)
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef long double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
typedef pair<Real, Real> P; // Point
typedef pair<P, P> L; // segment or line
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}
template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

/* inner dot */
Real dot(P&a, P&b) {
  return car(a) * car(b) + cdr(a) * cdr(b);
}
Real operator*(P&a, P&b) {
  return car(a) * car(b) + cdr(a) * cdr(b);
}

/* scalar multiple */
P operator*(P a, Real c) {
  return cons(c * car(a), c * cdr(a));
}
P operator*(Real c, P a) {
  return cons(c * car(a), c * cdr(a));
}

P operator/(P a, Real d) {
  return cons(car(a) / d, cdr(a) / d);
}

Real det(P a, P b) {
  return car(a) * cdr(b) - cdr(a) * car(b);
}

/* vector operator */
P operator+(P a, P b) {
  return cons(car(a) + car(b), cdr(a) + cdr(b));
}

P operator-(P a) {
  return cons(-car(a), -cdr(a));
}

P operator-(P a, P b) {
  return cons(car(a) - car(b), cdr(a) - cdr(b));
}

/* distance */
Real Manhattan(P a, P b) {
  return abs(car(a) - car(b)) + abs(cdr(a) - cdr(b));
}
Real Euclidean(P a, P b) {
  P p = a - b;
  return sqrt(pow(car(p), 2) + pow(cdr(p), 2));
}

/* equality with EPS (default: 1e-9) */
bool eq(Real x, Real y) {
  return abs(x - y) < EPS;
}
bool operator==(P a, P b) {
  return eq(car(a), car(b)) && eq(cdr(a), cdr(b));
}

int sign(Real a) {
  if (eq(a, 0)) return 0;
  return a > 0 ? 1 : -1;
}

enum CCW {
  FRONT,
  BACK,
  RIGHT,
  LEFT,
  ON
};
CCW ccw(L&l, P&p) {
  P u = car(l);
  P v = cdr(l);

  P dif = p - u;
  P dir = v - u;

  if (eq(0, car(dir))) {
    if (eq(0, car(dif))) {
      Real k = cdr(dif) / cdr(dir);
      if (k > 1.0) return FRONT;
      if (k < 0.0) return BACK;
      return ON;
    } else {
      if (det(dir, dif) > 0.0) {
        return LEFT;
      }
      return RIGHT;
    }
  }

  Real k = car(dif) / car(dir);
  if (eq(cdr(dir) * k, cdr(dif))) {
    if (k > 1.0) return FRONT;
    if (k < 0.0) return BACK;
    return ON;
  } else {
    if (det(dir, dif) > 0.0) {
      return LEFT;
    }
    return RIGHT;
  }
}

Real magnitude(P&a) {
  return sqrt(pow(car(a), 2) + pow(cdr(a), 2));
}

Real arg(P&a, P&b) {
  Real x = dot(a, b) / magnitude(a) / magnitude(b);
  x = min<Real>(1, max<Real>(-1, x));
  return acos(x);
}

struct C {
  P o;
  Real r;
  C(P o, Real r) : o(o), r(r) {}
  C(Real x, Real y, Real r) : o(cons(x, y)), r(r) {}
};

enum circle_rel {
  SUB, SUP,
  TAN, INT,
  APT
};

circle_rel
circle_intersect(C a, C b) {
  Real d = Euclidean(a.o, b.o);
  //trace(cons(d, cons(a.r, b.r)));
  if (d + a.r < b.r) return SUB; // a is in b
  if (a.r > d + b.r) return SUP; // b is in a
  if (d < a.r + b.r) return INT;
  if (d <= a.r + b.r + EPS) return TAN;
  return APT;
}

int main() {
  int n; cin >> n;
  rep (_, n) {
    Real x1,y1,r1,
         x2,y2,r2;
    cin >> x1 >> y1 >> r1;
    cin >> x2 >> y2 >> r2;
    C c1(x1, y1, r1);
    C c2(x2, y2, r2);

    auto a = circle_intersect(c1, c2);
    cout << (a == SUB ? -2
           : a == SUP ? 2
           : a == APT ? 0 : 1) << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define COUNT(i, n) for(int i = 1; i <= n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;

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

    for(double xa, ya, ra, xb, yb, rb, d; n -- && cin >> xa >> ya >> ra >> xb >> yb >> rb; cout << (d > 0 ? 0:d < 0 ? ra < rb ? -2:ra > rb ? 2:1:1) << endl)
        d = sqrt(pow(xb - xa, 2) + pow(yb - ya, 2)) - (ra + rb);

    return 0;
}

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

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

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

struct circle
{
    double x;
    double y;
    double r;
};

double getDistance(circle a, circle b)
{
    return sqrt(pow(a.x - b.x ,2)
            +pow(a.y - b.y ,2));
}

int main()
{
    int n;
    circle a, b;
    double distance;
    cin >> n;
    for(int c = 0; c < n; c++)
    {
        cin >> a.x >> a.y >> a.r
            >> b.x >> b.y >> b.r;
        distance = getDistance(a, b);
        if(abs(a.r + b.r) < distance)
            cout << 0 << endl;
        else {
            if(a.r - b.r > distance)
                cout << 2 << endl;
            else if(abs(a.r - b.r) > distance && a.r + b.r > distance)
                cout << 1 << endl;
            else if(b.r - a.r > distance)
                cout << -2 << endl;
        }
    }
    return EXIT_SUCCESS;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
double EPS=1e-10;
double add(double a, double b)
{
	if(abs(a+b)<EPS*(abs(a)+abs(b)) ) return 0;
	else return a+b;
}
int main()
{
	int n ; cin >> n ;
	while(n--)
	{
		double x[2],y[2],r[2];
		for(int i=0;i<2;i++) cin >> x[i] >> y[i] >> r[i] ;
		double dist2=add( (x[1]-x[0])*(x[1]-x[0]),(y[1]-y[0])*(y[1]-y[0]) );
		int ans=0;
		if(dist2<r[0]*r[0]) ans=2;
		else if(dist2<r[1]*r[1]) ans=-2;
		else if(dist2<=add(r[0],r[1])*add(r[0],r[1])) ans=1;
		cout << ans << '\n' ;
	}
}