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;

double eps = 1e-10;

class Point {
public:
	double x, y;
	
	Point(double x = 0, double y = 0) : x(x), y(y) {}
	
	Point operator + (const Point& p) {
		return Point(x + p.x, y + p.y);
	}
	Point operator - (const Point& p) {
		return Point(x - p.x, y - p.y);
	}
	Point operator * (const double& a) {
		return Point(x * a, y * a);
	}
	Point operator / (const double& a) {
		return Point(x / a, y / a);
	}
	
	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;
	}
	
	double abs() {
		return sqrt(norm());
	}
	double norm() {
		return x * x + y * y;
	}
	
};

class Circle {
public:
	Point c;
	double r;
	Circle(Point c = Point(), double r = 0.0) : c(c), r(r) {}
};

int main() {
	int n;
	cin >> n;
	double x1, y1, r1, x2, y2, r2;
	for(int i = 0; i < n; ++i){
		cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
		Circle c1 = Circle(Point(x1, y1), r1);
		Circle c2 = Circle(Point(x2, y2), r2);
		double minr = max(c1.r, c2.r);
		
		if(pow(c2.c.x - c1.c.x, 2.0) + pow(c2.c.y - c1.c.y, 2.0) < pow(minr, 2.0)){
			if(c1.r > c2.r)
				cout << "2" << endl;
			else
				cout << "-2" << endl;
		}
		else if(pow(c2.c.x - c1.c.x, 2.0) + pow(c2.c.y - c1.c.y, 2.0) <= pow(c1.r + c2.r, 2.0)){
			cout << "1" << endl;
		}
		else{
			cout << "0" << endl;
		}
	}
	return 0;
}

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

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-6

double sqr(double x, double y){
	return x*x + y*y;
}
int main(){
	int n;
	double xa,ya,ra,xb,yb,rb;
	scanf("%d",&n);
	rep(i,n){
		scanf("%lf %lf %lf %lf %lf %lf",
					&xa,&ya,&ra,&xb,&yb,&rb);
		double z = sqrt(sqr(xa-xb,ya-yb));
		//printf("z:%lf   ra+rb:%lf\n",z,ra+rb);
		if( z > ra+rb ){
			puts("0");
		}else{
			if( z>ra && z>rb ){
				puts("1");
			}else if( z-rb>z-ra ){
				puts("2");
			}else{
				puts("-2");
			}
		}
	}
	return 0;
}

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

using namespace std;

int main() {
  
  int N; cin >> N;
  double xa, ya, xb, yb, ra, rb;
  while(N--) {
    cin >> xa >> ya >> ra;
    cin >> xb >> yb >> rb;
    double dist2 = pow(xb-xa, 2) + pow(yb-ya, 2);
    
    if(dist2 < pow(ra-rb, 2)&& rb < ra) {
      cout << 2 << endl;
    }
    else if(dist2 < pow(ra-rb, 2) && ra < rb) {
      cout << -2 << endl;
    }
    else if(dist2 < pow(ra+rb, 2)) {
      cout << 1 << endl;
    }
    else {
      cout << 0 << endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include<math.h>
using namespace std;
int main(){
    double xa,xb,ya,yb,ra,rb;
	double x;
	int n,w;
	cin>>n;
	for(int i=0;i<n;i++){
		w=0;
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		x=(xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
		x=sqrt((double)x);
		if(ra+rb<x)
			w=0;
		else if(ra-rb>=x)
			w=2;
		else if(rb-ra>=x)
			w=-2;
		else
			w=1;
		cout<<w<<endl;
	}
	return 0;
}

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

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

#define equals(a, b) (fabs((a)-(b)) < EPS)
const double EPS = (1e-10);

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(x*a, y*a);
    }
    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;
// ??????
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;
}

class Circle {
public:
    Point c;                    // ??????
    double r;                   // ??????
    Circle(Point c = Point(), double r = 0.0): c(c), r(r) {}
};


int intersect(Circle c1, Circle c2) {
    double d = (c2.c - c1.c).abs();

    // ????????£???????????´???
    if (d - (c1.r+c2.r) > EPS) {
        return 0;
    }

    if (c1.r > c2.r && c1.r-c2.r > d) {
        return 2;
    }
    if (c2.r > c1.r && c2.r-c1.r > d) {
        return -2;
    }

    return 1;
}

int main(void) {

    int N; cin >> N;
    for (int i = 0; i < N; i++) {
        Circle ca, cb;
        cin >> ca.c.x >> ca.c.y >> ca.r
            >> cb.c.x >> cb.c.y >> cb.r;

        cout << intersect(ca, cb) << endl;
    }

    return 0;
}

C++: // AOJ 0023
#include<iostream>
#include<cmath>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const long double EPS = 1e-17;

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

long double abs(long double x) {
  return (x > 0 ? x : -x);
}
/*
bool eq(long double x, long double y) {
  return abs(x - y) < EPS;
}*/

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

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

    long double d = sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb));
    
    if (ra - rb > d + EPS) {
      cout << 2 << endl;
    } else if (rb - ra > d + EPS) {
      cout << -2 << endl;
    } else if (d > ra + rb + EPS) {
      cout << 0 << endl;
    } else {
      cout << 1 << endl;
    }
  }
}

C++: #include <iostream>
//#include <algorithm>
//#include "math.h"

#define EPS 1.e-12

using namespace std;

int main(){
	int count;
	double xa,ya,ra,xb,yb,rb;
	cin >> count;
	for(int i=0;i<count;i++){
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double dist2 = (xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
		//		double dist = (xa-xb)*(xa-xb)+(xa-xb)*(xa-xb);
		//cout << dist2 << " " << (ra+rb)*(ra+rb) << endl;
		//cout << ((dist2 -(ra+rb)*(ra+rb))>0) << endl;
		if(dist2>(ra+rb)*(ra+rb)+EPS){
			cout << 0 << endl;
		}
		else if(dist2 >= (ra - rb)*(ra - rb)){
			cout << 1 << endl;
		}
		else if(ra>rb){
			cout << 2 << endl;
		}
		else{
			cout << -2 << endl;
		}
	}
}