Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var xa, ya, ra, xb, yb, rb float64
		fmt.Scan(&xa, &ya, &ra, &xb, &yb, &rb)
		distance := math.Sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya))
		if rb+distance < ra {
			fmt.Println(2)
		} else if ra+distance < rb {
			fmt.Println(-2)
		} else if rb+ra >= distance {
			fmt.Println(1)
		} else {
			fmt.Println(0)
		}
	}
}

C++: #include <iostream>
#include <array>
#include <math.h>

int main(){

	std::array<double, 3> a; //0:xa 1:ya 2:ra
	std::array<double, 3> b;

	int N;

	std::cin >> N;

	for(int i = 0; i < N; ++i){
		
		for(int j = 0; j < 3; ++j)
			std::cin >> a[j];

		for(int j = 0; j < 3; ++j)
			std::cin >> b[j];

		double ab = sqrt( (a[0] * b[0]) + (a[1] * b[1]) );

		if( ab > (a[2] + b[2]) )
			std::cout << 0 << std::endl;
		
		else if ( a[2] > ab + b[2] )
			std::cout << 2 << std::endl;

		else if ( b[2] > ab + a[2] )
			std::cout << -2 << std::endl;

		else
			std::cout << 1 << std::endl;

		}
	}

	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 (distanceCenterAB < a.r + b.r) {
		if (a.r > b.r && a.r > b.r + distanceCenterAB) {
			return 2;
		}
		if (b.r > a.r && 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 <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<string>
#include<math.h>
using namespace std;
int main(){
	double xa,ya,ra,xb,yb,rb;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		double s=(xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
		s=(double)sqrt((double)s);
		int t=1;
		if(ra+s<rb)
			t=-2;
		if(rb+s<ra)
			t=2;
		if(s>ra+rb)
			t=0;
		cout<<t<<endl;
	}
	return 0;
}

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

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

int main(){
	int dataSetNum;
	std::cin >> dataSetNum;

	std::deque<int> number;

	for(int i = 0; i < dataSetNum; ++i){
		double xa, ya, ra, xb, yb, rb;
		std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double dis = distance(xa, ya, xb, yb);
		//"0" if A and B do not overlap
		if(dis > ra + rb) number.push_buck( 0 );
		//"2" if B is in A
		else if(ra > rb && dis + rb <= ra) number.push_buck( 2 );
		//"-2" if A is in B,
		else if(rb > ra && dis + ra <= rb) number.push_buck( -2 );
		//"1" if circumference of A and B intersect
		else number.push_buck( 1 );
	}
	for(int i = 0; i < dataSetNum; ++i){
		std::cout << number.front() << std::endl;
		number.pop_front();
	}
	return 0;
	}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int main(){
    int mod=1000000007;
    int n;
    int ans;
    double xa,ya,ra,xb,yb,rb;
    scanf("%d",&n);
    for (int i=0;i<n;i++) {
        scanf("%lf %lf %lf %lf %lf %lf",&xa,&ya,&ra,&xb,&yb,&rb);
        double tmp=sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));
        if ((tmp+rb)<ra) {
            printf("2\n");
        } else if ((tmp+ra)<rb) {
            printf("-2\n");
        } else if ((tmp)<(ra+rb)) {
            printf("1\n");
        } else {
            printf("0\n");
        }
    }
    return 0;
}

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

double get_distance( double xa, double ya, double xb, double yb )
{
	return sqrt( ( xb - xa ) * ( xb - xa ) + ( yb - ya ) * ( yb - ya ) );
}

bool is_collision( double xa, double ya, double ra, double xb, double yb, double rb )
{
	double distance = get_distance( xa, ya, xb, yb );
	return distance <= ra + rb ? true : false;
}

int check( double xa, double ya, double ra, double xb, double yb, double rb )
{
	double distance = get_distance( xa, ya, xb, yb );
	if ( distance + rb <= ra ) return 2;
	else if ( distance + ra <= rb ) return -2;
	else return 1;
}

int main( void )
{
	double xa, ya, ra, xb, yb, rb;
	int n; cin >> n;
	for ( int i = 0; i < n; i++ )
	{
		cin >> xa >> ya >> ra >> xb >> yb >> rb;

		if ( is_collision( xa, ya, ra, xb, yb, rb ) )
		{
			cout << check( xa, ya, ra, xb, yb, rb ) << endl;
		}
		else
		{
			cout << 0 << endl;
		}

	}
	return 0;
}

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

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

int main(){
	int dataSetNum;
	std::cin >> dataSetNum;

	std::deque<int> number;

	for(int i = 0; i < dataSetNum; ++i){
		double xa, ya, ra, xb, yb, rb;
		std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double dis = distance(xa, ya, xb, yb);
		//"0" if A and B do not overlap
		if(dis > ra + rb) number.push_back(0);
		//"2" if B is in A
		else if(dis + rb < ra) number.push_back(2);
		//"-2" if A is in B
		else if(dis + ra < rb) number.push_back(-2);
		//"1" if circumference of A and B intersect
		else number.push_back(1);
	}
	for(int i = 0; i < dataSetNum; ++i){
		std::cout << number.front() << std::endl;
		number.pop_front();
	}
	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 (d < sq(ra + rb)) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
}

C++: #include<iostream>
using namespace std;
int main(){
	int c;
	double ax,ay,ar,bx,by,br;
	cin>>c;
	for(int i=0;i<c;i++){
		cin>>ax>>ay>>ar>>bx>>by>>br;
		if((ax+ar>bx+br&&ax-ar<bx-br) && (ay+ar>by+br&&ay-ar<by-br))
			cout<<"2"<<endl;
		else if((bx+br>ax+ar&&bx-br<ax-ar) && (by+br>ay+ar&&by-br<ay-ar))
			cout<<"-2"<<endl;
		else if((ax-bx)*(ax-bx)+(ay-by)*(ay-by)<(ar+br)*(ar+br))
			cout<<"1"<<endl;
		else cout<<"0"<<endl;
	}				
}