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;

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

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

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

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
using namespace std;

int main(){

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

    int ans = 0;

    if( ra*ra >= (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) + rb*rb ) ans = 2;
    else if( rb*rb >= (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) + ra*ra ) ans = -2;
    else if( (ra*ra)+(rb*rb) >= (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) ) ans = 1;


    cout << ans << endl;
  }

  return 0;
}

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

class Point
{
public:
	double m_X;
	double m_Y;
	Point(double x, double y)
		: m_X(x)
		, m_Y(y)
	{}
};

class LineSegment
{
private:
	Point m_Start;
	Point m_End;
public:
	LineSegment(Point start, Point end)
		: m_Start(start)
		, m_End(end)
	{}
	double Distance()
	{
		return(std::sqrt(std::pow(m_End.m_X - m_Start.m_X, 2.0) + std::pow(m_End.m_Y - m_Start.m_Y, 2.0)));
	}
	double CalcSlope()
	{
		if (m_End.m_Y == m_Start.m_Y)
		{
			return 0.0;
		}

		if (m_End.m_X == m_Start.m_X)
		{
			return 9999999999.0;
		}

		return((m_End.m_Y - m_Start.m_Y) / (m_End.m_X - m_Start.m_X));
	}
};

int main()
{
	int n = 0;
	std::cin >> n;

	while (n--)
	{
		double x1, y1, r1, x2, y2, r2;
		std::cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;

		Point p1{ x1, y1 };
		Point p2{ x2, y2 };
		LineSegment line{ p1, p2 };
		double dist_center = line.Distance();

		if ((r1 + r2) < dist_center)
		{
			std::cout << 0 << std::endl;
			continue;
		}

		if ((r1 + r2) >= dist_center)
		{
			if (dist_center + r1 < r2)
			{
				std::cout << -2 << std::endl;
				continue;
			}
			if (dist_center + r2 < r1)
			{
				std::cout << 2 << std::endl;
				continue;
			}
			std::cout << 1 << std::endl;
			continue;
		}
	}

	return 0;
}

C++: #include <iostream>
#include <string>
#include <cctype>
#include <vector>
#include <complex>
#include <cstdio>
using namespace std;

#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef complex<double> vec;

int main(){
    int n; cin >> n;
    rep(i,n){
        double xa,ya,ra,xb,yb,rb;
        cin>> xa>>ya>>ra>>xb>>yb>>rb;
        double dx=xa-xb, dy=ya-yb;
        double d=sqrt(dx*dx+dy*dy);
        int ans;
        if(d>ra+rb){
            ans=0;
        }else if(d+ra<rb){
            ans=-2;
        }else if(d+rb<ra){
            ans=2;
        }else{
            ans=1;
        }
        cout << ans << endl;
    }
}

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

int main()
{
	int n, t;
	double x1, y1, r1, x2, y2, r2;
	double d;

	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &r1, &x2, &y2, &r2);

		d = (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1);

		if (d < (r2-r1)*(r2-r1)){
			if (r2 < r1) t = 2;
			else if (r2 > r1) t = -2;
		}else if (d >= (r1 + r2)*(r1 + r2)) t = 0;
		else if (d <= (r1 + r2)*(r1 + r2)) t = 1;

		printf("%d\n", t);
	}

	return 0;
}

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

using namespace std;

typedef complex<double> P;

int main(void){
  int n; cin >> n;
  while(n--){
    double ra, rb;
    P a,b;
    cin  >> a.real() >> a.imag() >> ra >> b.real() >> b.imag() >> rb;
    double d = abs(a-b);
    int ans;
    if(0){}
    else if(d + rb < ra) ans = 2;
    else if(d + ra < rb) ans = -2;
    else if(d > ra + rb) ans = 0;
    else ans = 1;
    cout << ans << endl;
  }
  return 0;
}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N=in();
	REP(i,N){
		double x[2],y[2],r[2];
		cin>>x[0]>>y[0]>>r[0]>>x[1]>>y[1]>>r[1];
		double dist = hypot(x[1]-x[0],y[1]-y[0]);

		if(dist>r[0]+r[1]){
			out(0);
		}
		else if(r[0]<r[1] && dist<r[1]-r[0]){
			out(-2);
		}
		else if(r[1]<r[0] && dist<r[0]-r[1]){
			out(2);
		}
		else out(1);
	}
	
	return 0;
}