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 <functional>
#include<algorithm>
#include <cmath>
using namespace std;

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

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

double eq(double x,double y){
  double z=abs(x-y);
  return z<EPS;
}
double di(double x1,double y1,double x2,double y2){
  return sqrt(pow(x1-x2,2.0)+pow(y1-y2,2.0));
}


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

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

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

using namespace std;

void Solution()
{
    int n;
    
    cin>>n;
    
    while(n--)
    {
        double xa, ya, ra;
        double xb, yb, rb;
        double d;
        
        cin>>xa>>ya>>ra>>xb>>yb>>rb;
        
        d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb)); // distance of o1 and o2
        
        if ((d < ra - rb) && (ra > rb))
        {
            cout<<2<<endl;
        }
        else if ((d < rb - ra) && (ra < rb))
        {
            cout<<-2<<endl;
        }
        else if (d >= abs(ra - rb) && (d < ra + rb))
        {
            cout<<1<<endl;
        }
        else if (d > ra + rb)
        {
            cout<<0<<endl;
        }
//        else
//        {
//            cout<<1<<endl;
//        }
    }
}

int main()
{
    Solution();
    return 0;
}

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;
}

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

using namespace std;

struct point{
	double x;
	double y;
};

struct circle{
	point o;
	double r;
};

istream& operator >> ( istream& s , circle& x );
void swap( circle *a , circle *b );
double get_distance( const point& a , const point& b );

int main(void)
{
	circle a, b;
	int n;

	cin >> n;

	for( int i = 0 ; i < n ; i++ )
	{
		int flag = 0;
		int result;

		cin >> a >> b;

		if( a.r < b.r )
		{
			swap( a , b ); // 大きいほうの円は常にa
			flag = 1;
		}

		double distance = get_distance( a.o , b.o );
		double add_r = a.r + b.r;

		if( add_r < distance ){
			result = 0;
		}
		else{
			if( distance + b.r < a.r ){
				if( flag == 0 ) result = 2;
				else result = -2;
			}
			else result = 1;
		}
		cout << result << endl;
	}

	return 0;
}

istream& operator >> ( istream& s , circle& x )
{
	return s >> x.o.x >> x.o.y >> x.r;
}

void swap( circle *a , circle *b )
{
	circle temp;

	temp = *a;
	*a = *b;
	*b = temp;

	return;
}

double get_distance( const point& a , const point& b )
{
	return sqrt( pow( a.x-b.x , 2 ) + pow( a.y - b.y , 2 ) );
}

C++: #include<iostream>
#include<vector>
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 == ra + rb || abs(ra - rb) < d)
			{
				std::cout << 1 << std::endl;
			}
			else
			{
				std::cout << 2 * (ra < rb ? -1 : 1) << std::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 <string>
#include <math.h>
using namespace std;
 
int main()
{
   int n;
   double xa,ya,ra,xb,yb,rb;
   cin >> n;
   for (int i=0;i<n;i++){
       cin >> xa >> ya >> ra >> xb >> yb >> rb;
       double d;
       d = sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));
       if (d > ra + rb){
           cout << 0 << endl;  //交わらない
       } else if (d < ra - rb){
           cout << 2 << endl;  //B in A
       } else if (d < rb - ra){
           cout << -2 << endl;  //A in B
       } else {
           cout << 1 << endl;  //交わる
       }
   }
 
    return 0;
}

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

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 = hypot( (a[0] - b[0]) , (a[1] - b[1]) ); //distance a,b

		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 <iostream>
#include <cmath>
#include <vector>

int check_intersection(const double ra, const double rb, const double distance){
	if(distance > (ra + rb)){
		return 0;
	}else if(ra > rb){
		return ((distance + rb) < ra) ? 2 : 1;
	}else{
		return ((distance + ra) < rb) ? -2 : 1;
	}
}

int main(){
	int data_set;
	std::cin >> data_set;
	std::vector<double> xa(data_set), ya(data_set), ra(data_set), xb(data_set), yb(data_set), rb(data_set);
	for(int i = 0; i < data_set; ++i){
		std::cin >> xa[i] >> ya[i] >> ra[i] >> xb[i] >> yb[i] >> rb[i];
	
	double distance;
	
		distance = sqrt(pow(xa.at(i) - xb.at(i), 2) + pow(yb.at(i) - yb.at(i), 2));
		std::cout << check_intersection(ra.at(i), rb.at(i), distance) << std::endl;
	}
	return 0;
}

C++: #include<iostream>
#include<complex>
using namespace std;
#define dff 1e-10
int main(){
  int n;
  cin >>n;
  while(n--){
    complex<double> a,b;
    double ar,br,dr;
    cin >>a.real()>>a.imag()>>ar>>b.real()>>b.imag()>>br;
    dr = abs(a-b);
    if(dr-ar-br>dff) cout <<"0"<<endl;
    else if(ar>br && dr-ar+br < -dff) cout <<"2"<<endl;
    else if(br>ar && dr-br+ar < -dff) cout <<"-2"<<endl;
    else cout <<"1"<<endl;
  }
  return 0;
}