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(void){
	int n;
	cin >> n;
	for(int i=0; i<n; i++){

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

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

		if( ra+rb < d )
			cout << 0 << endl;
		else if( d+ra < rb )
			cout << 2 << endl;
		else if( d+rb < ra )
			cout << -2 << endl;
		else
			cout << 1 << endl;

	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

#define EPS 1e-8

int main(){

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

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

enum JudgeCircleIntersect 
{
	BinA =  2,
	AinB = -2,
	AcrossB = 1,
	AdisB = 0,
	Error = -1
};

struct Circle
{
	Circle()
	{
	}

	Circle(double sx, double sy, double sr):cx(sx), cy(sy), r(sr)
	{
	}

	double cx;

	double cy;

	double r;
};

double Abs(double x)
{
	return x>=0 ?  x : -x;
}

JudgeCircleIntersect Intersect(const Circle& a, const Circle& b)
{
	double distance = sqrt((a.cx-b.cx)*(a.cx-b.cx)+(a.cy-b.cy)*(a.cy-b.cy));


	if(a.r+b.r<distance)
	{
		return AdisB;
	}
	else if((b.r-a.r)>distance && (b.r-a.r)>0)
	{
		return AinB;
	}
	else if((a.r-b.r)>distance && (a.r-b.r)>0)
	{
		return BinA;
	}
	else if(Abs(a.r-b.r)<=distance && (a.r+b.r>=distance))
	{
		return AcrossB;
	}
	else
	{
		return Error;
	}
}

int main()
{
	int n = 0;
	
	double xa, ya, ra, xb, yb, rb;

	std::cin >> n;

	for(int i=0; i<n; ++i)
	{
		std::cin >> xa >> ya >> ra 
			>> xb >> yb >> rb;

		Circle a(xa, ya, ra);

		Circle b(xb, yb, rb);

		std::cout << Intersect(a,b) << '\n';
	}


	/*
	Circle a(20.0,40.0,30.0); // 位置(20,40), 半径 30 の円

	Circle b(30.0,50.0,20.0); // 位置(40,50), 半径 20 の円

	if(Intersect(a,b))
	{
		std::cout << "a と b は交差している\n";
	}
	else
	{
		std::cout << "a と b は交差していない\n";
	}
	*/
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;


double xa, ya, ra, xb, yb, rb, d;
ll n;

int main(){
	cin >> n;
	REP(i, n){
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		if (xa == xb&&ya == yb) d = 0;
		else if (xa == xb) d = abs(ya - yb);
		else if (ya == yb) d = abs(xa - xb);
		else d = sqrt(pow(xa - xb, 2) + pow(ya - yb, 2));
		if (d <= abs(ra - rb)){
			if (ra > rb){
				cout << 2 << endl;
			}
			else{
				cout << -2 << endl;
			}
		}
		else if (d <= ra + rb){
			cout << 1 << endl;
		}
		else{
			cout << 0 << endl;
		}
	}
}

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

struct POINT_DOUBLE {
  double x;
  double y;
};

struct CIRCLE_DOUBLE {
  POINT_DOUBLE center;
  double radius;
};

std::istream& operator >> (std::istream& is, POINT_DOUBLE& p)
{
  is >> p.x >> p.y;
  return is;
}

std::istream& operator >> (std::istream& is, CIRCLE_DOUBLE& circle)
{
  is >> circle.center >> circle.radius;
  return is;
}

static double GetDistance(const POINT_DOUBLE& pt1, const POINT_DOUBLE& pt2)
{
  return std::sqrt(std::pow(pt1.x - pt2.x, 2) + std::pow(pt1.y - pt2.y, 2));
}

int main(void)
{
  int n;
  std::cin >> n;

  for (int i = 0; i < n; i++) {
    CIRCLE_DOUBLE circleA, circleB;
    std::cin >> circleA >> circleB;
    bool isSwapped = false;
    if (circleA.radius < circleB.radius) {
      std::swap(circleA, circleB);
      isSwapped = true;
    }

    double centerDis = GetDistance(circleA.center, circleB.center);
    if (centerDis > circleA.radius + circleB.radius) {
      std::cout << 0 << std::endl;
    }
    else if (circleA.radius > centerDis + circleB.radius) {
      if (isSwapped) {
        std::cout << -2 << std::endl;
      }
      else {
        std::cout << 2 << std::endl;
      }
    }
    else {
      std::cout << 1 << std::endl;
    }

  }

  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        float x[2], y[2], r[2];
        
        for(int j = 0; j < 2; j++)
            cin >> x[j] >> y[j] >> r[j];
        
        // 2??????????????????????????¢
        float d = sqrt((x[1]-x[0])*(x[1]-x[0])+(y[1]-y[0])*(y[1]-y[0]));
        
        // ??????????????¢??¨???B?????????????????????A????????????????°?????????´?????????B??????A????????¨?????????
        if(d + r[0] < r[1])
            cout << "-2" << endl;
        // ?????????
        else if(d + r[1] < r[0])
            cout << "2" << endl;
        // 2?????????????????????????????????????????¢??????????°?????????´??????2????????????????????£?????????
        else if(d < r[0]+ r[1])
            cout << "1" << endl;
        // ?????????
        else
            cout << "0" << endl;

    }
}

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

int main()
{
	int n;
	double xa, ya, ra, xb, yb, rb;
	
	cin >> n;
	while(n--){
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		//B in A
		if( hypot(xa - xb, ya - yb) + rb < ra )
			cout << 2 << endl;
		//A in B
		else if( hypot(xa - xb, ya - yb) + ra < rb )
			cout << -2 << endl;
		//A intersect B
		else if( hypot(xa - xb, ya - yb) < ra + rb )
			cout << 1 << endl;
		else
			cout << 0 << endl;
	}
	return 0;
}