Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var xa, ya, ra, xb, yb, rb float64
		fmt.Scan(&xa, &ya, &ra, &xb, &yb, &rb)
		// println(xa, ya, ra, xb, yb, rb)
		dis := math.Sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb))
		if dis + ra < rb {
			fmt.Println(-2)
		} else if dis + rb < ra {
			fmt.Println(2)
		} else if dis > rb + ra {
			fmt.Println(0)
		} else {
			fmt.Println(1)
		}
	}
}

C++: // AOJ 0023
#include<iostream>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const double EPS = 1e-6;

double sq(double x) {
  return x * x;
}

double abs(double x) {
  return (x > 0 ? x : -x);
}

bool eq(double x, double y) {
  return abs(x - y) < EPS;
}

double dist(int xa, int ya, int xb, int yb) {
  return sq(xa - xb) + sq(ya - yb);
}

int main() {
  int n;
  cin >> n;
  REP(i, n) {
    double xa, ya, ra, xb, yb, rb;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;

    double d = dist(xa, ya, xb, yb);
    
    if (d < sq(ra)) {
      cout << 2 << endl;
    } else if (d < sq(rb)) {
      cout << -2 << endl;
    } else if (eq(d, ra) or eq(d, rb)) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
}

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

using namespace std;




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

C++: #include <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define IREP(it,array) for(vector<int>::iterator it=array.begin(); it!=array.end(); ++it)
#define SREP(it,array) for(vector<string>::iterator it=array.begin(); it!=array.end(); ++it)
#define MP make_pair
typedef long long LL;
#define EPS (1e-6)
double zero(double d){
  return d < EPS ? 0.0 : d;
}

typedef pair<int,int> P;


int main()
{
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(7);
  int INF = 1000000;

  int N;
  while(cin>>N){
    double x1,y1,r1,x2,y2,r2;
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;

    double dis = sqrt( pow((x1-x2),2) + pow((y1-y2),2) );
    if( dis > r1+r2 )
      cout << "0" << endl;
    else if( r1 > r2+dis )
      cout << "2" << endl;
    else if( r2 > r1+dis )
      cout << "-2" << endl;
    else
      cout << "1" << endl;
  }

  return 0;
}

C++: // AOJ 0023
#include<iostream>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const long double EPS = 1e-10;

long double sq(long double x) {
  return x * x;
}

long double abs(long double x) {
  return (x > 0 ? x : -x);
}

bool eq(long double x, long double y) {
  return abs(x - y) < EPS;
}

long double dist(long double xa, long double ya, long double xb, long double yb) {
  return sq(xa - xb) + sq(ya - yb);
}

int main() {
  int n;
  cin >> n;
  REP(i, n) {
    long double xa, ya, ra, xb, yb, rb;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;

    long double d = dist(xa, ya, xb, yb);
//    cout << d << endl;
    
    if (sq(ra) > d + EPS) {
      cout << 2 << endl;
    } else if (sq(rb) > d + EPS) {
      cout << -2 << endl;
    } else if (d > sq(ra + rb) + EPS) {
      cout << 0 << endl;
    } else {
      cout << 1 << endl;
    }
  }
}

C++: #include<stdio.h>
#include<math.h>
#define EPS 1e-9
int n;
double xa,ya,ra,xb,yb,rb;

int main(){
	int i;
	scanf("%d",&n);
	
	for( i = 0;i < n;i++ ){
		scanf("%lf%lf%lf%lf%lf%lf",&xa,&ya,&ra,&xb,&yb,&rb);
		
		//BがA中にあるか(境界ふくむ)
		if( (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) <= (ra-rb)*(ra-rb) && rb < ra )
			printf("2\n");
		//AがB中にあるか(境界ふくむ)
		else if( (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) <= (ra-rb)*(ra-rb) && ra < rb )
			printf("-2\n");
		//AとBが交わっているか(境界ふくむ)
		else if( (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) <= (ra+rb)*(ra+rb) )
			printf("1\n");
		else
			printf("0\n");
	}
	return 0;
}

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

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

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

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

C++: #include <iostream>
#include <math.h>
using namespace std;

int main(){
	int num ;
	cin >> num;
	for(int j = 1;j<= num; j++){
	double x[2],y[2],r[2],r2[2];
	for(int i =0;i<=1;i++){
		cin >> x[i];
		cin >> y[i];
		cin >> r[i];
	}
	double d;
	d = sqrt((x[0]-x[1])*(x[0]-x[1])+(y[0]-y[1])*(y[0]-y[1]));
	if(r[0]+r[1]<d) cout << 0 << endl;
	else if(d > r[0]|| d > r[1]) cout << 1 << endl;
	else if(r[0]<r[1]) cout << -2 << endl;
	else cout << 2 << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<complex>
using namespace std;
typedef complex<double> P;

int jud(P a, P b, int ra, int rb);
int dis(P a, P b);

int main(){
    int n;
    cin >>n;
    for(int i = 0; i < n; i++){
        P a, b;
        int ra, rb;
        cin >>a.real() >>a.imag() >>ra >>b.real() >>b.imag() >>rb;
        cout <<jud(a, b, ra, rb) <<endl;
    }
    return 0;
}

int jud(P a, P b, int ra, int rb){
    int disab = dis(a, b), ret;
    if(disab < (ra - rb * 2)){
        ret = 2;
    } else if(disab < (rb - ra * 2)){
        ret = -2;
    } else if(disab < ra || disab < rb){
        ret = 1;
    } else{
        ret = 0;
    }
    return ret;
}

int dis(P a, P b){
    return abs((a.imag() - a.real()) * (a.imag() - a.real()) + (b.imag() - b.real()) * (b.imag() - b.real()));
}

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;
        }
        
        if ((d <= rb - ra) && (ra < rb))
        {
            cout<<"-2"<<endl;
        }
        
        if (d >= abs(ra - rb) && (d < ra + rb))
        {
            cout<<"1"<<endl;
        }
        
        if (d > ra + rb)
        {
            cout<<"0"<<endl;
        }

    }
}

int main()
{
    Solution();
    return 0;
}