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<algorithm>
#include<math.h>
#include<string>
#include<cstdlib>
#include<cmath>

using namespace std;
int n,a[50];
int solve(int i){
    if(i==1||i==0)return 1;
    return solve(i-1)+solve(i-2);
}
int main(){
    int nl;
    cin>>nl;
    for(int i=0; i<nl; i++){
        double xa,ya,ra,xb,yb,rb;
    cin>>xa>>ya>>ra>>xb>>yb>>rb;
    double k=(xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
    double s=sqrt(k);
    
    if(ra+rb<s)cout<<0<<endl;
    else if(ra+rb>=s&&s>=abs(ra-rb))cout<<1<<endl;
    else if(ra-rb>s)cout<<2<<endl;
    else if(rb-ra>s)cout<<-2<<endl;
    }
    return 0;
}

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

using namespace std;

double dis(long double x1,long double y1,long double x2,long double y2);

int main(){
	long double x1,y1,r1;
	long double x2,y2,r2;
	long double ans;
	double r[2];
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x1>>y1>>r1;
		cin>>x2>>y2>>r2;
		
		ans=dis(x1,y1,x2,y2);
		
		if(ans>r1+r2){
			cout<<"0"<<endl;
		}else if(ans<=r1+r2){
				if(r2>ans+r1){
					cout<<"-2"<<endl;
					continue;
				}else if(r1>ans+r2){
					cout<<"2"<<endl;
					continue;
				}
			
			cout<<"1"<<endl;
		}
	
	}
}

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

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

using namespace std;

int main()
{
	int n;
	double x1, y1, r1, x2, y2, r2, u;
	cin >> n;
	
	while(n--){
		cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
		u = sqrt((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(r1+r2 == u){
			cout << "0" << endl;
		} else {
			cout << "1" << endl;
		}
	}
	
	return 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("0");   continue; }
    puts("0");
  }

  return 0;
}

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

struct Circle2D {
	double x, y, r;
	static int Intersection(Circle2D &a, Circle2D &b);
};

int Circle2D::Intersection(Circle2D &a, Circle2D &b) {
	double diffABx = b.x - a.x, diffABy = b.y - a.y;
	double distanceCenterAB2 = diffABx * diffABx + diffABy * diffABy;
	double distanceCenterAB = sqrt(distanceCenterAB2);
	if (distanceCenterAB2 <= (a.r + b.r) * (a.r + b.r)) {
		if (a.r > b.r + distanceCenterAB) {
			return 2;
		}
		if (b.r > a.r + distanceCenterAB) {
			return -2;
		}
		return 1;
	}
	return 0;
}

int main() {
	int dataSet;
	Circle2D ca, cb;
	for (std::cin >> dataSet; dataSet > 0; --dataSet) {
		std::cin >> ca.x >> ca.y >> ca.r >> cb.x >> cb.y >> cb.r;
		std::cout << Circle2D::Intersection(ca, cb) << '\n';
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
  double xa, ya, ra, xb, yb, rb;
  int n, ans;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> xa >> ya >> ra >> xb >> yb >> rb;
    double d = sqrt( (xb-xa)*(xb-xa) + (yb-ya)*(yb-ya) );
    double r = ra + rb;
     
    if(d > r)
        ans = 0;
    else if(d <= r && d >= fabs(ra - rb))
        ans = 1;
    else{
      if(max(ra,rb) == ra)
        ans = 2;
      else
        ans = -2;
    }
    cout << ans << endl;
  }
}