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 <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);

#include <complex>
typedef complex<double> P;

struct L {
	P a, b;
	L(const P &a, const P &b) : a(a), b(b) { }
};

struct C {
	P p; double r;
	C(const P p, double r) : p(p), r(r) { }
};

double dot(P a, P b) {
	return real(conj(a)*b);
}

double cross(P a, P b) {
	return imag(conj(a)*b);
}

bool LLcross(L l1, L l2) {
	return abs(cross(l1.b-l1.a, l2.b-l2.a)) > EPS || abs(cross(l1.b-l1.a, l2.b-l1.a)) < EPS;
}

double dist(P p1, P p2) {
	return sqrt((p2.real()-p1.real())*(p2.real()-p1.real()) + (p2.imag()-p1.imag())*(p2.imag()-p1.imag()));
}

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

	REP(i, n) {
		double x, y, r;
		cin >> x >> y >> r;
		C c1(P(x, y), r);

		cin >> x >> y >> r;
		C c2(P(x, y), r);

		double d = dist(c1.p, c2.p);
		int ans;
		
		if(c2.r-d-c1.r > EPS) {
			ans = -2;
		} else if (c1.r-d-c2.r > EPS){
			ans = 2;
		} else if (d-c2.r-c1.r < EPS) {
			ans = 1;
		} else {
			ans = 0;
		}

		cout << ans << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<double> xa,ya,ra,xb,yb,rb;
	for(int i=0;i<n;i++){
		double o,p,q,r,s,t;
		cin>>o>>p>>q>>r>>s>>t;
		xa.push_back(o);
		ya.push_back(p);
		ra.push_back(q);
		xb.push_back(r);
		yb.push_back(s);
		rb.push_back(t);
	}
	for(int j=0;j<n;j++){
		double l = (xb[j]-xa[j])*(xb[j]-xa[j]) + (yb[j]-ya[j])*(yb[j]-ya[j]);
		if(ra[j]>rb[j] && l<(ra[j]-rb[j])*(ra[j]-rb[j])){
			cout<<"2"<<endl;
		}else if(ra[j]<rb[j] && l<(rb[j]-ra[j])*(rb[j]-ra[j])){
			cout<<"-2"<<endl;
		}else if(l<(ra[j]+rb[j])*(ra[j]+rb[j])){
			cout<<"1"<<endl;
		}else{
			cout<<"0"<<endl;
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
int n, r;
double xa, ya, ra, xb, yb, rb, d;

int main() {
	scanf("%d",&n);
	while (n--) {
		scanf("%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);
		d = sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb));
		if (d+ra<rb) r = -2;
		else if (d+rb<ra) r = 2;
		else if (d>ra+rb) r = 0;
		else r = 1;
		printf("%d\n",r);
	}
}

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>
#include <cassert>
#include <cmath>
#include <complex>
using namespace std;


typedef complex<double> P;

#define EPS			(1e-10)
#define PI			(3.14159265358979323846)


#define X(a)		( (a).real() )
#define Y(a)		( (a).imag() )
#define EQ(a,b)		( -EPS<(a)-(b) && (a)-(b)<EPS )
#define EQV(a,b)	( EQ(X(a),X(b)) && EQ(Y(a),Y(b)) )

#define unit(a)		( (a)/abs(a) )
#define normal(a)	( (a)*P(0,1) )
#define dot(a,b)	( X((a)*conj(b)) )
#define cross(a,b)	( Y(conj(a)*(b)) )


int hitStateCC(P a, double ra, P b, double rb)
{	
	double cc=abs(a-b);

	if( EQ(cc,ra+rb) )	return  1;	// OÚ
	if( EQ(cc,abs(ra-rb)) )
	{
		if(EQ(ra,rb))	return -1;	// àÚ Ca==Cb
		if(ra>rb)		return  3;	// àÚ Ca>=Cb
		else			return -3;	// àÚ Ca<=Cb
	}

	if(cc>ra+rb)		return  0;	// £êÄ¢é
	if(cc<abs(ra-rb))
	{
		if(ra>rb)		return  4;	// àï Ca>Cb
		else			return -4;	// àï Ca<Cb
	}

	return 2;						// ð·
}

int main()
{
	int n; double a,b,c,d,e,f;
	
	cin >> n;
	while(n--)
	{
		cin >> a >> b >> c >> d >> e >> f;
		switch(hitStateCC(P(a,b),c,P(d,e),f))
		{
			case 0:
			cout << 0 << endl; break;

			case 1: case -1: case 2: case 3: case -3:
			cout << 1 << endl; break;

			case  4: cout <<  2 << endl;  break;
			case -4: cout << -2 << endl;  break;
		}
	}
}

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

int main(){
	int n;
	cin>>n;
	long double xa,ya,xb,yb,ra,rb;
	for(int i=0;i<n;i++){
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		if(abs(ra+rb)<sqrt(pow(xa-xb,2)+pow(ya-yb,2))){cout<<0<<endl;}
		else if(abs(ra+rb)>=sqrt(pow(xa-xb,2)+pow(ya-yb,2)) && abs(ra-rb)<=sqrt(pow(xa-xb,2)+pow(ya-yb,2))){cout<<1<<endl;}
		else if(abs(ra-rb)>sqrt(pow(xa-xb,2)+pow(ya-yb,2))){if(ra>rb)cout<<2<<endl;}else{cout<<-2<<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 ax,ay,ar,bx,by,br; 
 		cin >> ax >> ay >> ar >> bx >> by >> br; 
 		double dd = (ax-bx)*(ax-bx) + (ay-by)*(ay-by); 
 		double rsum = (ar+br)*(ar+br); 
 		double rdiff = (ar-br)*(ar-br); 
 		if (dd > rsum) 
 			cout << 0 << endl; 
 		else if (dd < rsum && dd > rdiff) 
 			cout << 1 << endl; 
 		else if (dd < rdiff) 
 			cout << (ar > br ? 2 : -2) << endl; 
 		else 
 			cout << 1 << endl; 
 	} 
 	return 0; 
 }