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

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

typedef complex<double> P;
typedef vector<P> VP;
const double EPF = 1e-9;

#define X real()
#define Y imag()
#define EQ(x,y) (abs(x-y) < EPF)
#define LE(x,y) (x < y + EPF)
#define GE(x,y) (x + EPF > y)

double dot(P a, P b) {
  return (conj(a)*b).X;
}
double cross(P a, P b) {
  return (conj(a)*b).Y;
}
int isparallel(P a, P b, P c, P d) {//ab,cd
  return EQ(cross(a-b, c-d),0);
}
double distPP(P a, P b) {
  return sqrt(dot(a-b,a-b));
}
int relationCC(P c1, double r1, P c2, double r2) {//0..not overlap, 1..intersect, 2..2isin1, -2..1isin2
  double d = distPP(c1,c2);
  if(GE(d , r1+r2)) return 0;
  else if(GE(d , r1-r2) && GE(d , r2-r1)) return 1;
  else if(GE(r1 , r2)) return 2;
  else return -2;
  return -1;
}
P intersection(P a, P b, P c, P d) {//ac , bd
  double d1 = cross(d-b,b-a);
  double d2 = cross(d-b,c-a);
  if(EQ(d1,0) & EQ(d2,0)) return a;
  if(EQ(d2,0)) return a;
  return a + (c-a)*d1/d2;
}
P normal_vector(P a) {
  P b(-a.Y, a.X);
  return b;
}
P polar(double r, double theta) {
  P a(r*cos(theta),r*sin(theta));
  return a;
}


int main() {
  int n;
  scanf("%d",&n);
  REP(i,n) {
    double x,y,r1,r2;
    scanf("%lf %lf %lf", &x, &y, &r1);
    P a(x,y);
    scanf("%lf %lf %lf", &x, &y, &r2);
    P b(x,y);
    printf("%d\n", relationCC(a,r1,b,r2));
  }
  return 0;
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
	double xa,ya,ra,xb,yb,rb,l;
	cin >> xa >> ya >> ra >> xb >> yb >> rb;
	l = sqrt(pow((xa-xb),2)+pow((ya-yb),2));
	if(ra >= l + rb) 
	  cout << '2' << endl;	
	else if(rb >= l + ra) 
	  cout << "-2" << endl;	
	else if(l <=  ra + rb) 
	  cout << '2' << endl;
	else  
	  cout << '0' << endl;
  }
  return 0;
}

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

using namespace std;

double date[2][3];
int n;

int main()
{
	scanf("%d",&n);
	for(int k=0;k<n;k++)
	{
	for(int i=0;i<2;i++)
	{
		for(int j=0;j<3;j++)
		{
			scanf("%lf",&date[i][j]);
		}
	}
	double d = sqrt((date[0][0]-date[1][0])*(date[0][0]-date[1][0])+(date[0][1]-date[1][1])*(date[0][1]-date[1][1]));
	if(date[0][2]-date[1][2]>d) printf("2\n");
	else if(date[1][2]-date[0][2]>d)printf("-2\n");
	else if(date[0][2]+date[1][2]<d)printf("0\n");
	else printf("1\n");
	}
	return 0;

}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    int n;
    cin >> n;
    rep(i, 0, n){
        int ans;
        double x[2], y[2], r[2];
        rep(j, 0, 2) cin >> x[j] >> y[j] >> r[j];
        double d = sqrt(pow(x[0] - x[1], 2) + pow(y[0] - y[1], 2));
        if(r[0] + r[1] < d) ans = 0;
        else if(r[0] > d + r[1]) ans = 2;
        else if(r[1] > d + r[0]) ans = -2;
        else if(fabs(r[0] + r[1] - d) < 1e-15) ans = 1;        
        cout << ans << 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;
}

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;
	for(int i = 0; i < data_set; ++i){
		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 <math.h>

using namespace std;

struct Vector
{
	double x;
	double y;
};

istream& operator>>(istream& stream, Vector& p)
{
	return stream >> p.x >> p.y;
}

template <typename T>
T absolute(T x)
{
	return x > 0 ? x : -x;
}

int main()
{
	int length;
	cin >> length;

	while(length-- > 0)
	{
		Vector a, b;
		double ra, rb;
		cin >> a >> ra >> b >> rb;
		double dist = sqrt((b.x - a.x) * (b.x - a.x) + (b.y - a.y) * (b.y - a.y));

		if(ra + rb < dist)
			cout << 0 << endl;
		else if(dist < absolute(ra - rb))
		{
			if(rb < ra)
				cout << 2 << endl;
			else
				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 * ra + rb * 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 <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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