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 <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 = hypot( (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 <iostream>
#include <cmath>
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;
    double d = sqrt((xb-xa)*(xb-xa)+(yb-ya)*(yb-ya));

    int ans;
    if(d+ra < rb) ans = -2;
    else if(d+rb < ra) ans = 2;
    else if(d < ra+rb) ans = 1;
    else ans = 0;

    cout << ans << endl;
  }
}

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

#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 d = sqrt( (xb-xa)*(xb-xa) + (yb-ya)*(yb-ya) );
        if (ra + rb < d) {
            cout << 0 << endl;
            continue;
        } 
        if (ra > rb) {
            if (ra - rb > d) {
                cout << 2 << endl;
                continue;
            } else {
                cout << 1 << endl;
                continue;
            }
        } else {
            if (rb - ra > d) {
                cout << -2 << endl;
                continue;
            } else {
                cout << 1 << endl;
                continue;
            }
        }
    }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  int n;
  cin>>n;
  while(n--){
    double x,y;
    double ra,rb;
    cin>>x>>y>>ra;
    P a(x,y);
    cin>>x>>y>>rb;
    P b(x,y);
    double dist = abs(b-a);
    if(dist+ra < rb){
      cout<<-2<<endl;
    }else if(dist+rb < ra){
      cout<<2<<endl;
    }else if(ra+rb>dist){
      cout<<-1<<endl;
    }else{
      cout<<0<<endl;
    }
  }
  return 0;
}

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

int collision_detection(double x1, double y1, double x2, double y2, double r1, double r2){
	double d = ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
	double sr = ((r1+r2)*(r1+r2));
	double dr = ((r1-r2)*(r1-r2));
	if( d > sr ){
		return 0;
	}else if( d < sr && dr < d){
		return 1;
	}else if(dr > d){
		return (r1>r2)? 2 : -2;
	}else{
		return 1;
	}
}

int main(){
	int n, ans;
	double xa, ya, ra, xb, yb, rb;

	cin >> n;
	for(int i=0 ; i<n ; i++){
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		ans = collision_detection( xa, ya, xb, yb, ra, rb);
		cout << ans << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  int n;
  cin>>n;
  while(n--){
    double x,y;
    double ra,rb;
    cin>>x>>y>>ra;
    P a(x,y);
    cin>>x>>y>>rb;
    P b(x,y);
    double dist = abs(b-a);
    if(dist+ra-rb <= 1e-11){
      cout<<-2<<endl;
    }else if(dist+rb-ra <= 1e-11){
      cout<<2<<endl;
    }else if(dist-ra-rb <= 1e-11){
      cout<<-1<<endl;
    }else{
      cout<<0<<endl;
    }
  }
  return 0;
}

C++: #include<iostream>
#include<complex>
#define EPS 1e-15
using namespace std;

typedef complex<double>P;

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		double ra,rb;
		P pa,pb;
		
		cin>>pa.real()>>pa.imag()>>ra;
		cin>>pb.real()>>pb.imag()>>rb;
		double d=abs(pa-pb);
		if(d+ra-rb<EPS)cout<<-2<<endl;
		else if(d+rb-ra<EPS)cout<<2<<endl;
		else if(d-ra-rb<EPS)cout<<1<<endl;
		else cout<<0<<endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>

#define PI 3.1415926535897932384626433
#define ToRadian(r) ((r)/180.0*PI)
#define ToDegree(r) ((r)*180.0/PI)
#define pow2(x) ((x) * (x))

using namespace std;

int main ( void )
{
	int n;
	
	while ( cin >> n )
	{
		while (n--)
		{
			double xa, ya, ra, xb, yb, rb;
			cin >> xa >> ya >> ra;
			cin >> xb >> yb >> rb;
			
			double dist_sq = pow2(xa - xb) + pow2(ya - yb);
			double dist_r_sq = pow2(ra + rb);
			
			if ( dist_sq > dist_r_sq )
			{
				cout << 0 << endl;
			}
			else
			{
				double dist = sqrt(dist_sq);
				double dist_a = dist + ra;
				double dist_b = dist + rb;
				int ans = 1;
				if (dist_b < ra)
					ans = 2;
				if (dist_a < rb)
					ans = -2;
				cout << ans << endl;
			}
		}
	}
	return 0;
}

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

using namespace std;



int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		double ax,ay,ar,bx,by,br;
		cin >> ax >> ay >> ar >> bx >> by >> br;
		double dd = (ax-bx)*(ax-bx) + (ay-by)*(ay-by);
		double rsum = (ar+br)*(ar+br);
		double rdiff = (ar-br)*(ar-br);
		if (dd > rsum)
			cout << 0 << endl;
		else if (dd < rsum && dd > rdiff)
			cout << 1 << endl;
		else if (dd < rdiff)
			cout << (ar > br ? 2 : -2) << endl;
		else
			cout << 1 << endl;
	}
	return 0;
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		double ax,ay,ar,bx,by,br;
		cin >> ax >> ay >> ar >> bx >> by >> br;
		double d = sqrt((ax-bx)*(ax-bx) + (ay-by)*(ay-by)); 
		if (ar > br && ar-d > br)
			cout << 2 << endl;
		else if (br > ar && br-d > ar)
			cout << -2 << endl;
		else if (d < ar+br)
			cout << 1 << endl;
		else
			cout << 0 << endl;
	}
	return 0;
}