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

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-6

double sqr(double x, double y){
	return x*x + y*y;
}
int main(){
	int n;
	double xa,ya,ra,xb,yb,rb;
	scanf("%d",&n);
	rep(i,n){
		scanf("%lf %lf %lf %lf %lf %lf",
					&xa,&ya,&ra,&xb,&yb,&rb);
		double z = sqrt(sqr(xa-xb,ya-yb));
		//printf("z:%lf   ra+rb:%lf\n",z,ra+rb);
		if( z > ra+rb + EPS ){
			puts("0");
		}else{
			if( z>ra+EPS && z>rb+EPS ){
				puts("1");
			}else if( 0>z-ra-EPS ){
				puts("2");
			}else{
				puts("-2");
			}
		}
	}
	return 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;
}