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<bits/stdc++.h>
using namespace std;
signed main(void){
	ios::sync_with_stdio(false);
	int T;
	cin>>T;
	double x1,x2,y1,y2,r1,r2,d;
	for(int t=1;t<=T;t++){
		cin>>x1>>y1>>r1
		   >>x2>>y2>>r2;
		d=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
		if(d-(r1+r2)>=1e-10)
			cout<<0<<endl;
		else if(d-fabs(r1-r2)<=1e-10){
			if(r1>r2)
				cout<<2<<endl;
			else
				cout<<-2<<endl;
		}
		else
			cout<<1<<endl;
	}
}

C++: #include<iostream>
#include<complex>
#include<cmath>
#include<map>
#define fs first
#define sc second
#define EPS 0
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<a.sc && d + EPS < a.sc-b.sc)return 1;       //no intersection (inside,B in A)
  if(a.sc<b.sc && d + EPS < b.sc-a.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 <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;

double tb(double n){
	return n * n;
}
int main(void){

int nm,ans;
double xa,ya,ra,xb,yb,rb;

	cin >> nm;
//		if(nm == 0) break;
		rep(i,nm){
			cin >> xa >> ya >> ra;
			cin >> xb >> yb >> rb;
			
			double xy = sqrt(tb(xa-xb) + tb(ya-yb));
			if( xy > ra+rb) ans = 0;
			else if( xy + rb < ra ) ans = 2;
			else if( xy + ra < rb ) ans = -2;
			else ans = 1;
			cout << ans << endl;
		}
	
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )

#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

const double EPS = 1e-8;

struct Point
{
	double x, y;

	Point() : x( 0 ), y( 0 ) {}
	Point( const double x, const double y ) : x( x ), y( y ) {}
	Point( const Point &a ) : x( a.x ), y( a.y ) {}
	
	const Point operator + ( const Point &a ) const
	{
		return Point( x + a.x, y + a.y );
	}

	Point& operator += ( const Point &a ) 
	{
		x += a.x;
		y += a.y;

		return *this;
	}

	const Point operator - ( const Point &a ) const
	{
		return Point( x + ( -a.x ), y + ( -a.y ) );
	}

	Point& operator -= ( const Point &a )
	{
		x -= a.x;
		y -= a.y;

		return *this;
	}

	const Point operator * ( const double a ) const
	{
		return Point( x * a, y * a );
	}

	Point& operator *= ( const double a )
	{
		x *= a;
		y *= a;

		return *this;
	}

	const Point operator / ( const double a ) const
	{
		return Point( x / a, y / a );
	}

	Point& operator /= ( const double a )
	{
		x /= a;
		y /= a;

		return *this;
	}

	bool operator < ( const Point &a ) const
	{
		return x == a.x ? y < a.y : x < a.x;
	}

	double abs() const
	{
		return sqrt( pow( x, 2. ) + pow( y, 2. ) );
	}

	const Point unitVector() const
	{
		return *this / abs();
	}

	const Point normalVector1() const
	{
		return Point( y, -x );
	}

	const Point normalVector2() const
	{
		return Point( -y, x );
	}
};

// 二点間の距離
double distance( const Point &a, const Point &b )
{
	return ( a - b ).abs();
}

// 二つの円 ( p1, r1 ) と ( p2, r2 ) の位置関係
// 交差しない : 0
// 交わる：1
// 1 が 2 を含む : 2
// 2 が 1 を含む : 3
// その他 4
int circles_relation( const Point &p1, const double r1, const Point &p2, const double r2 )
{
	const double dist = distance( p1, p2 );
	if ( r1 + r2 + EPS < dist )
	{
		return 0;
	}
	else if ( abs( r1 - r2 ) <= dist + EPS && dist <= r1 + r2 + EPS )
	{
		return 1;
	}
	else if ( dist <= abs( r1 - r2 ) + EPS )
	{
		return 2;
	}
	else if ( dist <= abs( r2 - r1 ) + EPS )
	{
		return 3;
	}
	else
	{
		return 4;
	}
}

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

	REP( casenum, 0, n )
	{
		double xa, ya, ra, xb, yb, rb;
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		
		int res = circles_relation( Point( xa, ya ), ra, Point( xb, yb ), rb );
		
		switch ( res )
		{
			case 0:
				cout << 0 << endl;
				break;
			case 1:
				cout << 1 << endl;
				break;
			case 2:
				cout << 2 << endl;
				break;
			case 3:
				cout << 3 << endl;
				break;
		}
	}

	return 0;
}

C++: #include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))

int main(){
	int n,a=0;
	double x[2],y[2],r[2],d;
	scanf("%d",&n);
	rep(i,n){
		rep(j,2)scanf("%lf%lf%lf",x+j,y+j,r+j);
		d=(x[0]-x[1])*(x[0]-x[1])+(y[0]-y[1])*(y[0]-y[1]);
		if(d<(r[0]-r[1])*(r[0]-r[1])){
			if(r[0]>r[1])a=2;
			else a=-2;
		}else if(d>(r[0]+r[1])*(r[0]+r[1]))a=0;
		else a=1;
		printf("%d\n",a);
	}
	return 0;
}