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>

//2つの円の状態を調べる関数
int check_two_circles(const double xa, const double ya, const double ra,
					  const double xb, const double yb, const double rb);

int main(){
	
	int count;
	std::cin >> count;
	
	for(int i = 0; i < count; ++i){
		double xa, ya, ra, xb, yb, rb;
		std::cin >> xa >> ya >> ra
				 >> xb >> yb >> rb;
		
		std::cout << check_two_circles(xa, ya, ra, xb, yb, rb) << std::endl;
	}
	
	return 0;
}

int check_two_circles(const double xa, const double ya, const double ra,
					  const double xb, const double yb, const double rb){
	
	const double square_dist = (xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
	
	//(xa-xb)^2 + (ya-yb)^2 > (ra+rb)^2 ならば2つの円は重ならず離れている
	if(square_dist > (ra+rb)*(ra+rb)) return 0;
	//(xa-xb)^2 + (ya-yb)^2 < (ra-rb)^2 ならば片方の円がもう片方の中にある
	else if(square_dist < (ra-rb)*(ra-rb)){
		if(ra > rb) return 2;
		else return -2;
	}
	//いずれでもない場合，AとBは交わっている
	else return 1;
	
}

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);
		//printf("%f\n", d);
		if (d > ra+rb) puts("0");
		else {
			if (d < ra || d < rb) {
				if (ra > rb) puts("2");
				else puts("-2");
			}
			else puts("1");
		}
	}
	return 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;
}