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)
		distance := math.Sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya))
		if rb+distance < ra {
			fmt.Println(2)
		} else if ra+distance < rb {
			fmt.Println(-2)
		} else if rb+ra >= distance {
			fmt.Println(1)
		} else {
			fmt.Println(0)
		}
	}
}

C++: #include<iostream>
#include<cmath>
int main()
{
	int n;
	std::cin >> n;
	for (int i = 0; i < n; i++)
	{
		double xa, ya, ra, xb, yb, rb;
		std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double d = hypot(xa - xb, ya - yb);
		if (d < std::abs(ra - rb))
		{
			std::cout << 2 * (ra < rb ? -1 : 1) << std::endl;
		}
		else if (d <= ra + rb)
		{
			std::cout << 1 << std::endl;
		}
		else
		{
			std::cout << 0 << std::endl;
		}
	}
	return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const double INF = 1e12;


int main(){
	int n;
	cin>>n;
	long double xa,ya,ra,xb,yb,rb;
	REP(i,n){
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		long double d=sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));
		if(d<=ra-rb){
			cout<<2<<endl;
		}else if(d<=rb-ra){
			cout<<-2<<endl;
		}else if(d<=(ra+rb)){
			cout<<1<<endl;
		}else{
			cout<<0<<endl;
		}
	}
	return 0;
}
/*
2
0.0 0.0 5.0 0.0 0.0 4.0
0.0 0.0 3.0 4.1 0.0 2.0
*/

C++: #include <iostream>
using namespace std;
int main(){
	int n, a;
	cin >> n;
	while(n--){
		double x[2], y[2], r[2], d2;
		for(int i = 0; i < 2; i++) cin >> x[i] >> y[i] >> r[i];
		d2 = (x[1]-x[0])*(x[1]-x[0]) - (y[1]-y[0])*(y[1]-y[0]);	//??????????£?????????¢
		if(d2 > (r[0]+r[1])*(r[0]+r[1]) ) a = 0;			// d > ra+rb: ???????????????
		else if(d2 >= (r[0]-r[1])*(r[0]-r[1]) ) a = 1;	// ra+rb >= d >= ra-rb: ?????????
		else  r[0]>r[1] ? a = 2 : a = -2;							// ra-rb > d : ??????
		cout << a << endl;
	}
	return 0;
}

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


int main(){
  int n;
  double xa,ya,ra,xb,yb,rb,d;
  std::cin >> n;

  for(int i=0;i<n;i++){
    std::cin >> xa >> ya >> ra
             >> xb >> yb >> rb;
    d = std::sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));
    if(ra+rb < d){
      std::cout << 0 << std::endl;
      continue;
    }
    if(ra+d < rb){
      std::cout << -2 << std::endl;
      continue;
    }
    if(rb+d < ra){
      std::cout << 2 << std::endl;
    }else{
      std::cout << 1 << std::endl;
    }
    //cout << (d<=ra+rb?d+rb>=ra?d+ra>=rb?1:-2:2:0) << endl;
  }
}

C++: //52
#include<iostream>

using namespace std;

#define S(X) ((X)*(X))

int main(){
  int N;
  cin>>N;
  while(N--){
    double x[2],y[2],r[2];
    for(int i=0;i<2;i++){
      cin>>x[i]>>y[i]>>r[i];
    }
    double ds=S(x[0]-x[1])+S(y[0]-y[1]);
    int ans;
    if(r[0]>r[1]&&ds<S(r[0]-r[1])){
      ans=2;
    }else if(r[1]>r[0]&&ds<S(r[1]-r[0])){
      ans=-2;
    }else if(ds<=S(r[0]+r[1])){
      ans=1;
    }else{
      ans=0;
    }
    cout<<ans<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>
#include <cmath>	// require fabs, sqrt
using namespace std;

int main()
{
	string str = "";
	int n;

	getline (cin, str );
	stringstream ssn(str);
	ssn >> n;

	for (int i = 0; i < n; ++i){
		getline (cin, str );
		vector <double> cx (2, 0.0), cy (2, 0.0), r (2, 0.0);
		stringstream ss(str);

		ss >> cx[0] >> cy[0] >> r[0] >> cx[1] >> cy[1] >> r[1];
		double d = sqrt ( (cx[1] - cx[0])*(cx[1] - cx[0]) + (cy[1] - cy[0])*(cy[1] - cy[0]) );

		if (d >= 0 && d < fabs (r[1] - r[0])){
			if (r[0] > r[1]){		// B in A
				cout << "2" << endl;
			}else if (r[0] < r[1]){	// A in B
				cout << "-2" << endl;
			}else{
				cout << "1" << endl;
			} // end if
		}else if ( ( d >= fabs(r[1] - r[0]) ) && ( d <= r[0] + r[1] ) ){
			cout << "1" << endl;
		}else{
			cout << "0" << endl;
		} // end if
	} // end for
		
	return 0;
}

C++: #include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
using namespace std;

#define ISEQ(c) (c).begin(), (c).end()
typedef long long ll;

int main() {
  int n;
  cin >> n;
  double x[2], y[2], r[2];
  const double EPS = 1e-9;
  for (int z = 0; z < n; z++) {
    cin >> x[0] >> y[0] >> r[0];
    cin >> x[1] >> y[1] >> r[1];
    double cdif = sqrt((x[0]-x[1])*(x[0]-x[1]) - (y[0]-y[1])*(y[0]-y[1]));
    if (cdif+r[0]-r[1] < EPS) cout << -2 << endl;
    else if (cdif+r[1]-r[0] < EPS) cout << 2 << endl;
    else if (cdif-r[0]-r[1] < EPS) cout << 1 << endl;
    else cout << 0 << endl;
  }
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int n;
	float x1, y1, r1, x2, y2, r2, u;
	cin >> n;
	
	for(int i = 0; i < n; i++){
		cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
		u = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
		
		if(u+r2 < r1){
			cout << "2" << endl;
		} else if(u+r1 < r2){
			cout << "-2" << endl;
		} else if(r1+r2 <= u){
			cout << "1" << endl;
		} else {
			cout << "0" << endl;
		}
	}
	
	return 0;
}

C++: #include <iostream>
#include <cmath>
#define double long double
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( hypotl(xa - xb, ya - yb) + rb < ra )
			cout << 2 << endl;
		//A in B
		else if( hypotl(xa - xb, ya - yb) + ra < rb )
			cout << -2 << endl;
		//A intersect B
		else if( hypotl(xa - xb, ya - yb) <= ra + rb )
			cout << 1 << endl;
		else
			cout << 0 << endl;
	}
	return 0;
}