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
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

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 long long LL;
typedef unsigned long long ULL;

//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(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   int n;
   double x[2],y[2],r[2];
   cin>>n;
   REP(i,n){
      REP(j,2) cin >> x[j] >> y[j] >> r[j];
      if(sqrt(pow(x[1]-x[0],2)+pow(y[1]-y[0],2))>r[1]+r[0])
         cout << "0" << endl;
      else if(sqrt(pow(x[1]-x[0],2)+pow(y[1]-y[0],2))<r[0]&&r[0]>r[1])
         cout << "2" << endl;
      else if(sqrt(pow(x[1]-x[0],2)+pow(y[1]-y[0],2))<r[1]&&r[1]>r[0])
         cout << "-2" << endl;
      else cout << "1" << endl;
   }
}

C++: #include <iostream>
#include <vector>
 
inline double func(const double x){
	return x * x;
}


int state_circles(const std::vector<double> &a, const std::vector<double> &b){
    double d;
    d = func(a[0] - b[0]) + func(a[1] - b[1]);
    if(func(a[2] + b[2]) < d)
        return 0;
    if(func(a[2] - b[2]) > d){
        if(a[2] > b[2])
            return 2;
        else
            return -2;
    }
     
    else
        return 1;
}
 
int main(){
    std::vector<double> a(3), b(3);
    int data_num;
    std::cin >> data_num;
    for(int i = 0; i < data_num; ++i){ 
        std::cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2];
        std::cout << state_circles(a, b) << std::endl;
    }
     
    return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
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 d = (xb-xa)*(xb-xa)+(yb-ya)*(yb-ya);
		double e = (rb+ra)*(rb+ra);
		if(d<ra*ra) cout << 2 << endl;
		else if(d<rb*rb) cout << -2 << endl;
		else if(d<e) cout << 1 << endl;
		else cout << 0 << endl;
	}
}

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

//２点間の距離
double distance(double x1, double y1, double x2, double y2) {
    double diffx = abs(x1 - x2), diffy = abs(y1 - y2);
    return(sqrt(diffx*diffx + diffy*diffy));
}

//条件
//2
bool isBInclude(double x1, double y1, double r1, double x2, double y2, double r2) {
    return(distance(x1, y1, x2, y2) < r1 - r2);
}
//-2
bool isAInclude(double x1, double y1, double r1, double x2, double y2, double r2) {
    return(distance(x1, y1, x2, y2) < r2 - r1);
}
//1
bool isIntersect(double x1, double y1, double r1, double x2, double y2, double r2) {
    return(distance(x1, y1, x2, y2) <= r1 + r2);
}
//0
bool isFar(double x1, double y1, double r1, double x2, double y2, double r2) {
    return(distance(x1, y1, x2, y2) > r1 + r2);
}


int main(void) {
    int num; cin >> num;
    
    for(int r = 0; r < num; r++) {
        double x1, y1, r1, x2, y2, r2;
        cin >> x1 >> y1 >>  r1 >>  x2 >>  y2 >> r2;
        if(isBInclude(x1, y1, r1, x2, y2, r2)) cout << "2" << endl;
        else if(isAInclude(x1, y1, r1, x2, y2, r2)) cout << "-2" << endl;
        else if(isIntersect(x1, y1, r1, x2, y2, r2)) cout << "1" << endl;
        else if(isFar(x1, y1, r1, x2, y2, r2)) cout << "0" << endl;
    }
    return(0);
}

C++: //円と円の関係
//参考(http://dac.gijodai.ac.jp/it-con/h16_sakuhin/ippan/ippan3/math/3grade/circle/circle4.htm)
#include<cstdio>
#include<cmath>

using namespace std;

int main(void){
	int n,i,ans;
	double xa,ya,ra,xb,yb,rb;
	double menA,menB,data,data2,kyori;

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf",&xa,&ya,&ra,&xb,&yb,&rb);
		//二つの中心点の距離を求める
		data=(xb-xa)*(xb-xa)+(yb-ya)*(yb-ya);
		kyori=sqrt(data);
		//交点の関係
		data=ra+rb;
		data2=fabs(ra-rb);
		if(kyori>data)
			ans=0;
		else if(kyori<data2){
			menA=ra*ra*3.14;	//pi＝円周率
			menB=rb*rb*3.14;
			if(menA>menB)
				ans=2;
			else if(menA<menB)
				ans=-2;
		}
		else
			ans=1;
		printf("%d\n",ans);
	}

	return 0;
}

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

const double EPS = 1e-8;

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, sq(abs(ra - rb)))) {
      cout << 1 << endl;
    } else if (d < sq(ra + rb)) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
}