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


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

  return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int n;
	float x1, y1, r1, x2, y2, r2, u;
	cin >> n;
	
	for(int i = 0; i < n; i++){
		cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
		u = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
		
		if(u+r2 < r1){
			cout << "2" << endl;
		} else if(u+r1 < r2){
			cout << "-2" << endl;
		} else if(u-r1 < r2){
			cout << "1" << endl;
		} else {
			cout << "0" << endl;
		}
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  int n;
  cin>>n;
  while(n--){
    double x,y;
    double ra,rb;
    cin>>x>>y>>ra;
    P a(x,y);
    cin>>x>>y>>rb;
    P b(x,y);
    double dist = abs(b-a);
    if(ra<rb && dist+ra-rb <= 1e-11){
      cout<<-2<<endl;
    }else if(rb<ra && dist+rb-ra <= 1e-11){
      cout<<2<<endl;
    }else if(dist-ra-rb <= 1e-11){
      cout<<-1<<endl;
    }else{
      cout<<0<<endl;
    }
  }
  return 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-7;

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 (d < sq(ra)) {
      cout << 2 << endl;
    } else if (d < sq(rb)) {
      cout << -2 << endl;
    } else if (eq(d, ra) or eq(d, rb)) {
      cout << 1 << endl;
    } else if (d < ra + rb) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
}

C++: #include<iostream>
#include<cmath>


int main(){
  int n;
  double xa,ya,ra,xb,yb,rb,d;
  std::cin >> n;

  for(int i=0;i<n;i++){
    std::cin >> xa >> ya >> ra
             >> xb >> yb >> rb;
    d = std::sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));
    /*if(ra+rb < d){
      std::cout << (int)0 << std::endl;
      break;
    }
    if(ra+d < rb){
      std::cout << (int)-2 << std::endl;
      break;
    }
    if(rb+d < ra){
      std::cout << (int)2 << std::endl;
    }else{
      std::cout << (int)1 << std::endl;
    }*/
    cout << (d<=ra+rb?d+rb>=ra?d+ra>=rb?1:-2:2:0) << endl;
  }
}

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

/* 平面幾何の基本要素 */
 
#define EPS (1e-10)
#define equals(a,b) (fabs((a) - (b)) < EPS )
 
class Point { // 点を表すクラス
public:
  double x,y;
  
  Point(double x=0,double y=0): x(x),y(y) {}
  
  Point operator + (Point p) { return Point(x + p.x, y + p.y); }
  Point operator - (Point p) { return Point(x - p.x, y - p.y); }
  Point operator * (double a) { return Point(a * x, a * y); }
  Point operator / (double a) { return Point(x / a, y / a); }
  
  double abs() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  
  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }
  
  bool operator == (const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }
};

typedef Point Vector; // ベクトルを表す構造体

struct Segment { // 線分を表す構造体
  Point p1,p2;
};

typedef Segment Line; // 直線を表す構造体

class Circle { // 円を表すクラス
public:
  Point c;
  double r;
  Circle(Point c = Point(), double r = 0.0): c(c),r(r) {}
};
typedef vector < Point > Polygon; // 多角形

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;
}

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;
 
int ccw(Point p0, Point p1, Point p2) {
  Vector a = p1 - p0;
  Vector b = p2 - p0;
 
  if( cross(a,b) > EPS ) return COUNTER_CLOCKWISE;
  if( cross(a,b) < -EPS ) return CLOCKWISE;
  if( dot(a,b) < -EPS ) return ONLINE_BACK;
  if( a.norm() < b.norm() ) return ONLINE_FRONT;
 
  return ON_SEGMENT;
}

bool intersect(Point p1,Point p2,Point p3,Point p4){
  return ( ccw(p1,p2,p3) * ccw(p1,p2,p4) <= 0 && 
	   ccw(p3,p4,p1) * ccw(p3,p4,p2) <= 0);
}

bool intersect(Segment s1,Segment s2){
  return intersect(s1.p1,s2.p1,s1.p2,s2.p2);
}

int contains(Polygon g,Point p){
  int n = g.size();
  bool x = false;
  for(int i=0;i<n;i++){
    Point a = g[i] - p, b = g[(i+1)%n] - p;
    if(abs(cross(a,b)) < EPS && dot(a,b) < EPS) return 1;
    if(a.y > b.y) swap(a,b);
    if(a.y < EPS && EPS < b.y && cross(a,b) > EPS) x = !x;
  }
  return (x ? 2 : 0);
}

/*
double distance( Point p1,Point p2){
  return sqrt( (p1.y - p2.y) * (p1.y - p2.y) + (p1.x - p2.x) * (p1.x - p2.x));
}
*/

double distance( double y1, double x1, double y2, double x2){
  return sqrt( (y1 - y2) * (y1 - y2) + (x1 - x2) * (x1 - x2));
}

int main(){
  Point p1,p2,p3,p4;
  double ra,rb;
  int n;
  cin >> n;
  while(n--){
    cin >> p1.x >> p1.y >> ra >> p2.x >> p2.y >> rb;
    double d = distance(p1.y,p1.x,p2.y,p2.x);
    int ret = 1;
    if(d > ra + rb) ret = 0;
    if(d + ra < rb) ret = -2;
    if(d + rb < ra) ret = 2;
    cout << ret << endl;
  }
}

C++: #include <iostream>
#include <cmath>

using namespace std;

int main()
{
    double xa, ya, ra, xb, yb, rb;
    double d;
    int num;

    cin >> num;
    for (int i = 0; i < num; i++) {
        cin >> xa >> ya >> ra >> xb >> yb >> rb;
        
        ra *= ra;
        rb *= rb;
        d = (xa - xb) * (xa - xb) + (ya - yb) * (ya - yb);

        if (d > ra + rb) 
            cout << 0 << endl;
        else {
            if ((abs(ra - rb) < d) && (d < abs(ra + rb)))
                cout << 1 << endl;
            else if (d < abs(ra - rb))
                cout << 2 << endl;
            else
                cout << -2 << endl;
        }
    }

    return 0;
}