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;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

template<typename T> T add(T x, T y){ if(abs(x+y) < EPS*(abs(x)+abs(y))) return 0; return x + y; }
template<typename T> inline bool semieq(T x, T y){ return abs(x - y) < EPS; }
template<typename T> inline bool semige(T x, T y){ return y - x < -EPS; }
template<typename T> inline bool semile(T x, T y){ return x - y < -EPS; }


struct Point : public complex<double>
{
public:
  Point() { this->real(0);  this->imag(0); }
  Point(const double& x, const double& y) { this->real(x);  this->imag(y); }
  Point(const complex<double> w)  { this->real(w.real());  this->imag(w.imag()); }
  inline double dot(Point p){ return (conj(*this) * p).real(); }  // ??????
  inline double det(Point p){ return (conj(*this) * p).imag(); }  // ??????
};

namespace std
{
  bool operator < (const Point& a, const Point& b)
  {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
typedef vector<Point> Polygon;
#define currPoint(P, i) P[i]
#define nextPoint(P, i) P[(i+1)%P.size()]

struct Circle : Point
{
private:
  Point p;
  double r;

public:
  Circle(Point& p, double r) : p(p), r(r) {}
  Circle(double x, double y, double r) : p(Point(x, y)), r(r) {}
  inline Point center(){ return this->p; }
  inline double radius(){ return this->r; }
};

int circlesIntersection(Circle& A, Circle& B)
{
  double d = abs(A.center() - B.center());
  if(semile(d, A.radius() - B.radius())) return  1;  // B in A
  if(semile(d, B.radius() - A.radius())) return -1;  // A in B
  if(semieq(d, A.radius() - B.radius())) return  2;  // B in A????????\???
  if(semieq(d, B.radius() - A.radius())) return -2;  // A in B????????\???
  if(semige(d, A.radius() + B.radius())) return  3;  // ???????????????
  if(semieq(d, A.radius() + B.radius())) return -3;  // ?????\
  return 4;  // ????????£?????????
}

int n;
double x, y, r;

Point N(0.0, 0.0);

int main()
{
  cin >> n;

  while(n--){
    cin >> x >> y >> r;  Circle A(x, y, r);
    cin >> x >> y >> r;  Circle B(x, y, r);

    int res = circlesIntersection(A, B);
    if(res ==  1){ puts("2");   continue; }
    if(res == -1){ puts("-2");  continue; }
    if(res == -3){ puts("1");   continue; }
    if(res ==  3){ puts("0");   continue; }
  }

  return 0;
}

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

using namespace std;

inline double sq (double a) {
    return a * a;
}

inline double dist (double x1, double y1, double x2, double y2) {
    return sqrt(sq(x1 - x2) + sq(y1 - y2));
}

int main (void) {
    int N;
    cin >> N;
    while (N--) {
        double _xa, _ya, _ra, _xb, _yb, _rb;
		int xa, ya, ra, xb, yb, rb;
        cin >> _xa;
        cin >> _ya;
        cin >> _ra;
        cin >> _xb;
        cin >> _yb;
        cin >> _rb;
		xa = _xa * 1000;
		ya = _ya * 1000;
		ra = _ra * 1000;
		xa = _xa * 1000;
		ya = _ya * 1000;
		ra = _ra * 1000;
        double d = dist(xa, ya, xb, yb);
        int s;
        if (d + rb <= ra) s = 2;
        else if (d + ra <= rb) s = -2;
        else if (d <= ra + rb) s = 1;
        else s = 0;
        cout << s << endl;
    }
    return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void) {

  double xa,ya,ra;
  double xb,yb,rb;

  int n;
  
  double d,dr,sr;
  int i;


  scanf("%d",&n);

  for(i=0;i<n;i++) {

    scanf("%lf %lf %lf %lf %lf %lf",&xa,&ya,&ra,&xb,&yb,&rb);

    d=(xb-xa)*(xb-xa)+(yb-ya)*(yb-ya);

    dr=(rb-ra)*(rb-ra);

    sr=(ra+rb)*(ra+rb);

    if(d>sr) printf("0\n");

    else if(d<sr && d>dr) printf("1\n");

    else if(dr>d && ra>rb) printf("2\n");

    else if(dr>d && rb>ra) printf("-2\n");

    else printf("1\n");

  }

  return 0;

}

C++: #include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>

using namespace std;

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

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <set>
using namespace std;
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<n;i++)

class C{
public:
	double x;
	double y;
	double r;
};

double euc(C a,C b){
	a.x -= b.x;
	a.y -= b.y;
	return sqrt(a.x*a.x+a.y*a.y);
}

int main(){
	int n;
	C a,b;
	cin >> n;
	while(n--){
		cin >> a.x >> a.y >> a.r >> b.x >> b.y >> b.r;
		if( euc(a,b)+b.r <= a.r && a.r > b.r ){
			cout << 2 << endl;
		
		}else if( euc(a,b)+a.r < b.r && b.r > a.r ){
			cout << -2 << endl;
		}else if(euc(a,b) < b.r ){
			cout << 1 << endl;
		}else{
			cout << 0 << endl;
		}
	}
}

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

float d(float x, float y, float z, float w){
	float ret;
	ret = pow(x - z, 2) + pow(y - w, 2);
	return sqrtf(ret);
}

int main(){
	int n;
	float x[2], y[2], r[2], dd;
	cin >> n;
	for(int i = 0;i<n;i++){
		cin >> x[0] >> y[0] >> r[0] >> x[1] >> y[1] >> r[1];
		dd = d(x[0], y[0], x[1], y[1]);
		if(dd>r[0]+r[1]){
			cout << 0 << endl;
		}
		else if(dd + r[0] <= r[1]){
				cout << -2 << endl;
			}
		else if (dd + r[1] <= r[0]) {
				cout << 2 << endl;
		}
		else {
			cout << 1 << endl;
		}
	}
	return 0;
}