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

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

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

C++: #include<bits/stdc++.h>
using namespace std;
signed main(void){
	ios::sync_with_stdio(false);
	int T;
	cin>>T;
	double x1,x2,y1,y2,r1,r2,d;
	for(int t=1;t<=T;t++){
		cin>>x1>>y1>>r1
		   >>x2>>y2>>r2;
		d=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
		if(d-(r1+r2)>=1e-10)
			cout<<0<<endl;
		else if(d-fabs(r1-r2)<=1e-10){
			if(r1>r2)
				cout<<2<<endl;
			else
				cout<<-2<<endl;
		}
		else
			cout<<1<<endl;
	}
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
typedef long long int ll;
double ab(double a){
	if(a>=0)return a;
	return -a;
}
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 a=sqrt((yb-ya)*(yb-ya)+(xb-xa)*(xb-xa));
	if(a>ra+rb){
		printf("0\n");
	}
	else if(ab(ra-rb)<a){
		printf("1\n");
	}
	else if(ra>rb)printf("2\n");
	else printf("-2\n");
	}
    return 0;
}

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

int main()
{
	double Xa,Ya,Xb,Yb,Ra,Rb,d;

	int N;

	std::cin >> N;

	for(int i=0;i<N;++i)
	{
		
		std::cin >> Xa >> Ya >> Ra >> Xb >> Yb >> Rb;

		d=sqrt((Xa-Xb)*(Xa-Xb)+(Ya-Yb)*(Ya-Yb));

		if(d<Ra-Rb)
			std::cout << '2' << '\n';

		else if(d<Rb-Ra)
			std::cout << '-2' << '\n';

		else if(Ra+Rb<d)
			std::cout << '0' << '\n';

		else
			std::cout << '1' << '\n';
	}
}

C++: #include <iostream>
#include <cmath>
#include <array>
#include <list>
#include <vector>
 
int main(){
    int N;
    std::cin >> N;
     
    //std::array<int, 20> ans;
    std::list<int> ans; //change
    //std::vector<int> ans;
     
    for(int i=0; i<N; ++i){
        double xa, ya, ra, xb, yb, rb;
        std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
         
        double d = pow((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb), 0.5);
        
        /*
        if(ra > rb && d < ra-rb) ans[i] = 2;
        else if(rb > ra && d < rb-ra) ans[i] = -2;
        else if(d <= ra+rb) ans[i] = 1;
        else if(d > ra+rb) ans[i] = 0;
        */
        
        if(ra > rb && d < ra-rb) ans.push_back(2);
        else if(rb > ra && d < rb-ra) ans.push_back(-2);
        else if(d <= ra+rb) ans.push_back(1);
        else if(d > ra+rb) ans.push_back(0);
    }
    
    /*
    for(int i=0; i<N; ++i)
        std::cout << ans[i] << std::endl;
    */
    
    for(std::list<int>::iterator it = ans.begin(); it != ans.end(); ++it){
    	std::cout << *it << std::endl;
	}
	
    return 0;
}

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

int main(int argc, char *argv[]) {
	int dataN;
	scanf("%d", &dataN);
	for (int i = 0; i < dataN; i++) {
		float ax, ay, ra, bx, by, rb;
		scanf("%f %f %f %f %f %f", &ax, &ay, &ra, &bx, &by, &rb);
		double d = abs(ax-bx)*abs(ax-bx) + abs(ay-by)*abs(ay-by);
		d = sqrt(d);
		if (d > ra+rb) puts("0");
		else if (d < rb) puts("2");
		else if (d < ra) puts("-2");
		else puts("1");
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)

int main(){

	int n;
	cin>>n;

	for(int i = 0; i < n; i++){
		double xa,ya,ra,xb,yb,rb;
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		double dist=(ya-yb)*(ya-yb)+(xa-xb)*(xa-xb);
		// AÆBªdÈçÈ¢
		if(!EQ((ra+rb)*(ra+rb),dist)&&(ra+rb)*(ra+rb)<dist){
			cout<<0<<endl;
		}
		// ~üªðíé
		else if(EQ(abs(ra-rb)*abs(ra-rb),dist)&&(abs(ra-rb))*(abs(ra-rb))<dist){
			cout<<1<<endl;
		}
		else{
			// Ç¿ç©ªÉ¶Ý·é
			if(ra>rb){
				cout<<2<<endl;
			}
			else
				cout<<-2<<endl;
		}
	}


	return 0;
}

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

using namespace std;

int main()
{
	double x1,x2,y1,y2,r1,r2,d;
	int n,i;
	
	cin >> n ;
	
	for(i=0;i<n;i++)
	{
		cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2 ;
		
		d=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
		
		if(d-r1-r2>0.0)
			cout << "0" << endl;
		else if(r1-d-r2>0.0)
			cout << "2" << endl;
		else if(r2-d-r1<0.0)
			cout << "-2" << endl;
		else
			cout << "1" << endl;
	}
}

C++: #include <iostream>
#include <cmath>
#include <math.h>
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;
}