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++: // AOJ 0023
#include<iostream>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const double EPS = 1e-8;

double sq(double x) {
  return x * x;
}

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

bool eq(double x, double y) {
  return abs(x - y) < EPS;
}

double dist(int xa, int ya, int xb, int yb) {
  return sq(xa - xb) + sq(ya - yb);
}

int main() {
  int n;
  cin >> n;
  REP(i, n) {
    double xa, ya, ra, xb, yb, rb;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;

    double d = dist(xa, ya, xb, yb);
    
    if (sq(ra) > d + EPS) {
      cout << 2 << endl;
    } else if (sq(rb) > d + EPS) {
      cout << -2 << endl;
    } else if (eq(sq(ra + rb), d)) {
      cout << 1 << endl;
    } else if (d + EPS < sq(ra + rb)) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
}

C++: #pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

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

typedef complex<double> Point, Vector;
typedef pair<Point, Point> Segment, Line;
typedef pair<Point, double> Circle;

#define X real()
#define Y imag()
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

double dot(Vector a, Vector b){
    return a.X * b.X + a.Y * b.Y;
}

double cross(Vector a, Vector b){
    return a.X * b.Y - a.Y * b.X;
}

double norm(Vector a){
    return a.X * a.X + a.Y * a.Y;
}

double abs(Vector a){
    return sqrt(norm(a));
}

// 円と円の関係（共通接線数）
int intersection(Circle c1, Circle c2){
    double dist = abs(c1.first - c2.first);
    if(c1.second + c2.second < dist) return 4;
    if(equals(c1.second + c2.second, dist)) return 3;
    if(abs(c1.second - c2.second) < dist && dist < c1.second + c2.second) return 2;
    if(equals(abs(c1.second - c2.second), dist)) return 1;
    else return 0;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin>>n;
    while(n--){
        double x1, y1, r1, x2, y2, r2; cin>>x1>>y1>>r1>>x2>>y2>>r2;
        Circle c1 = {Point(x1, y1), r1}, c2 = {Point(x2, y2), r2};
        int num = intersection(c1, c2);

        int ans = -1;
        if(num == 4) ans = 0;
        else if(1 <= num) ans = 1;
        else{
            if(r1 < r2) ans = -2;
            else ans = 2;
        }

        cout << ans << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<complex>
#include<cmath>
#include<map>
#define fs first
#define sc second
#define EPS (1e-10)
using namespace std;


typedef complex<double> P;
typedef pair<P,double> C;

int cpr(C a,C b){
  double d = abs(a.fs-b.fs);
  if(a.sc+b.sc + EPS < d)return -1;      //no intersection (outside)
  if(b.sc+d + EPS < a.sc)return 1;       //no intersection (inside,B in A)
  if(a.sc+d + EPS < b.sc)return 2;       //no intersection (inside,A in B)
  if(abs(a.sc+b.sc - d) < EPS)return -3; //one cross point (outside)
  if(abs(b.sc+d - a.sc) < EPS)return 3;  //one cross point (inside,B in A)
  if(abs(a.sc+d - b.sc) < EPS)return 4;  //one cross point (inside,A in B)
  return 0;                              //two cross point
}


int main(){
  double ax,ay,ar,bx,by,br;

  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin>> ax >> ay >> ar >> bx >> by >> br;
    C a = C(P(ax,ay),ar), b = C(P(bx,by),br);
    int v = cpr(a,b);
    if(v==-1)cout <<  0 << endl;
    else if(v==1)cout << 2 << endl;
    else if(v==2)cout << -2 << endl;
    else cout << 1 << endl;
  }
}

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

int main(){
	int n;
	scanf(" %d", &n);
	for(int i=0; i<n; ++i){
		double xa, ya, ra, xb, yb, rb;
		scanf(" %lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);
		double dist=pow(xb-xa, 2) + pow(yb-ya, 2);
		double p, q;
		bool biga=true;
		if(ra>rb){ p=ra; q=rb; }
		else { q=rb; p=ra; biga=false; }
		
		int ans;
		if(dist>pow(p+q, 2)) ans=0;
		else if(pow(p-q, 2)<=dist && dist<=pow(p+q, 2)) ans=1;
		else{
			if(biga) ans=2;
			else ans=-2;
		}
		
		printf("%d\n", ans);
	}
}

C++: #include <iostream>
#include <math.h>
using namespace std;

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>

using namespace std;

const double eps=1e-10;

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 d2=(xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
		double r2=(ra+rb)*(ra+rb);

		if(d2>r2) cout<<0<<endl;
		else if(d2+rb*rb<ra*ra) cout<<2<<endl;
		else if(d2+ra*ra<rb*rb) cout<<-2<<endl;
		else cout<<1<<endl;
	}


	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <cctype>
#include <cstdlib>
using namespace std;

#define INF (1 << 20)
#define EPS (1e-10)
#define EQ(a,b) (fabs((a)-(b)) < EPS)

int main(){
	long long 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 ab = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
		if (ab + rb - ra <= -EPS) cout << 2 << endl;
		else if (ab + ra - rb <= -EPS) cout << -2 << endl;
		else if (ab - ra - rb >= EPS) cout << 0 << endl;
		else cout << 1 << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>

typedef long long ll;
using namespace std;

int main()
{
	int N;
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		double xa,ya,ra,xb,yb,rb;
		scanf("%lf %lf %lf %lf %lf %lf",&xa,&ya,&ra,&xb,&yb,&rb);
		double dist = sqrt(pow((xa-xb),2.0) + pow((ya-yb),2.0));

		int res=1;
		if(dist > ra + rb){
			res=0;
		}
		else if(dist <= ra+ rb){
			if(ra > dist +rb){
				res=2; 
			}
			else if(rb > dist + ra){
				res=-2;
			}
		}

		cout << res << endl;
	}
}