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>
#include <cmath>
#include <cstdlib>

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 dsq = pow( xb - xa, 2.0 ) + pow( yb - ya, 2.0 );
    if( sqrt( dsq ) > ra + rb ) {
      cout << 0 << endl;
      continue;
    }
//     b in a
    if( sqrt( dsq ) <= ra - rb ) {
      cout << 2 << endl;
      continue;
    }

//     a in b 
    if( sqrt( dsq ) <= rb - ra ) {
      cout << -2 << endl;
      continue;
    }

    cout << 1 << endl;
  }

  return EXIT_SUCCESS;
}

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

const long double EPS = 0;

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 = sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb));
    
    if (ra - rb > d + EPS) {
      cout << 2 << endl;
    } else if (rb - ra > d + EPS) {
      cout << -2 << endl;
    } else if (d > ra + rb + EPS) {
      cout << 0 << endl;
    } else {
      cout << 1 << endl;
    }
  }
}

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((ra+rb)*(ra+rb)<dist)
			cout<<0<<endl;
		// ~üªðíé
		else if(((abs(ra-rb))*(abs(ra-rb))<dist&&(ra+rb)*(ra+rb)>dist))
			cout<<1<<endl;
		else if(abs(ra-rb)*abs(ra-rb)>dist){
			// Ç¿ç©ªÉ¶Ý·é
			if(ra>rb)
				cout<<2<<endl;
			else
				cout<<-2<<endl;
		}
		else
			cout<<1<<endl;
	}

	return 0;
}

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

struct circle{
	double x;
	double y;
	double r;
};

int judge_intersection(circle ca, circle cb){
	double dis2 = (ca.x - cb.x) * (ca.x - cb.x)
				+ (ca.y - cb.y) * (ca.y - cb.y);
	if((ca.r > cb.r) && ((ca.r - cb.r) * (ca.r - cb.r) > dis2)){
		return 2;
	} else if((cb.r > ca.r) && ((ca.r - cb.r) * (ca.r - cb.r) > dis2)){
		return -2;
	} else if((ca.r + cb.r) * (ca.r + cb.r) >= dis2){
		return 1;
	} else {
		return 0;
	}
}

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		circle ca, cb;
		cin >> ca.x >> ca.y >> ca.r
			>> cb.x >> cb.y >> cb.r;
		cout << judge_intersection(ca, cb) << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
#define EPS (1e-10)
#define equals(a,b) (fabs((a) - (b)) < EPS)
class Point{
public:
  double x,y;
  Point(double x = 0, double y = 0):x(x), y(y) {}
  Point operator + (Point p){
    return Point(x+p.x,y+p.y);
  }
  Point operator - (Point p){
    return Point(x-p.x,y-p.y);
  }
  Point operator * (double k){
    return Point(x*k,y*k);
  }
  Point operator / (double k){
    return Point(x/k,y/k);
  }
  bool operator == (const Point &p) const{
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};
typedef Point Vector;
double norm(Vector a){
  return pow(a.x,2.0)+pow(a.y,2.0);
}
double abs(Vector a){
  return sqrt(norm(a));
}
int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    Point a,b;
    double r1,r2;
    cin >> a.x >> a.y >> r1 >> b.x >> b.y >> r2;
    double d1 = abs(b-a);
    int res;
    if(d1+r2-r1<0) res=2;
    else if(d1+r1-r2<0) res=-2;
    else if(d1<r1+r2) res= 1;
    else res= 0;
    cout << res << endl;
  }
  return 0;
}

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

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

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

using namespace std;

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

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define EPS 1e-9

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

double calc_dis (double x1, double y1, double x2, double y2 )
{
	return sqrt ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2 ) );
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.CI", "r", stdin );
	int n;
	scanf ("%d", &n );
	rep (i, n ){
		double xa, ya, ra, xb, yb, rb;
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double d = calc_dis (xa, ya, xb, yb );
//		cerr << "d: " << d << endl;
		int res = -1;
		if (ra + rb + EPS < d ){	// A and B do not overlap
			res = 0;
		}else
		if (fabs (ra + rb - d ) < EPS || (ra + rb + EPS > d  && fabs (ra - rb ) < d ) ){ // if circumference of A and B intersect
			res = 1;
		}else
		if (ra > rb ){	// if B is in A, 
			res = 2;
		}else
		if (ra < rb ){	// if A is in B,
			res = -2;
		} // end if
		cout << res << endl;
	} // end rep
		
	return 0;
}