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>

int judgeIntersection(double distance, double ra, double rb){
    if(distance > (ra + rb))
        return 0;
    else if((distance + ra) < rb)
        return -2;
    else if((distance + rb) < ra)
        return 2;
    else
        return 1;
}

int main(void){
    double xa, ya, ra, xb, yb, rb; 
    int N;
    std::cin >> N;
    while(std::cin >> xa >> ya >> ra >> xb >> yb >> rb){
        double distance = std::sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
        std::cout << judgeIntersection(distance, ra, rb) << std::endl;
    }
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
  double xa,ya,ra,xb,yb,rb;
  int n;
  cin >> n;
  while(n--){
    cin >>  xa >> ya >> ra >> xb >> yb >> rb;
    double d = sqrt(pow(xa - xb,2) + pow(ya - yb,2));
    if(d + rb < ra){
      cout << 2 << endl;
    }else if(d + ra < rb ){
      cout << -2 << endl;
    }else if(ra + rb <= d){
      cout << 0 << endl;
    }else cout << 1 << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
#define PI 3.14
int main(void)
{
  double xa,ya,ra,xb,yb,rb;
  double areaa,areab;
  double len;
  int n;
  
  cin >> n;
  for(int i = n ; i > 0 ; i--){
    cin >> xa >> ya >> ra >> xb >> yb >> rb;
    
    areaa = ra * ra * PI;
    areab = rb * rb * PI;

    len = abs(xa - xb) * abs(xa - xb) + abs(ya - yb) * abs(ya - yb);
    len = sqrt(len);

    if(len > ra + rb) cout << 0 << endl;
    else if(ra + rb > len && len > ra - rb) cout << 1 << endl;
    else if(len < ra - rb && areaa >= areab) cout << 2 << endl;
    else if(len < ra - rb && areab >= areaa) cout << -2 << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <climits>
#include <utility>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 1LL << 25;
double EPS = 1e-9;

// BEGIN //////////////////////////////////////////////////////////////

int main() {
	int N = nextInt();
	double xa, ya, ra, xb, yb, rb;
	REP(i, N) {
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double distance = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
		if (distance < ra - rb) {
			PRINT(2);
		} else {
			if (distance < rb - ra) {
				PRINT(-2);
			} else {
				if (distance <= ra + rb) {
					PRINT(1);
				} else {
					PRINT(0);
				}
			}
		}
	}
	return 0;
}

// END   //////////////////////////////////////////////////////////////

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };


int n;
double x_1, y_1, r_1, x_2, y_2, r_2;

int main() {
	scanf( "%d", &n );
	for ( int i = 0; i < n; i++ ) {
		scanf( "%lf %lf %lf %lf %lf %lf", &x_1, &y_1, &r_1, &x_2, &y_2, &r_2 );
		int ans = 0;
		double _range = sqrt( sq( x_1 - x_2 ) + sq( y_1 - y_2 ) );
		if ( _range < r_1 + r_2 ) {
			ans = 1;
			if ( _range + r_1 <= r_2 ) {
				ans = -2;
			}
			else if ( _range + r_2 <= r_1 ) {
				ans = 2;
			}
		}
		printf( "%d\n", ans );
	}
	return 0;
}

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

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

C++: // #0023
// Time-stamp: <2012-07-10 17:44:59 naga>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){
  // (x, y) r
  double a[3],b[3];
  int n;

  cin >> n;
  while(n > 0){
    // input
    for(int i = 0; i < 3; i++){
      cin >> a[i];
    }
    for(int i = 0; i < 3; i++){
      cin >> b[i];
    }

    // distance
    double distance;
    distance = sqrt(pow(a[0] - b[0], 2) + pow(a[1] - b[1], 2));

    // judgment
    if(distance > a[2] + b[2]){
      cout << "0" << endl;
    }
    else if(distance < a[2] - b[2]){
      cout << "2" << endl;
    }
    else if(distance < b[2] - a[2]){
      cout << "-2" << endl;
    }
    else{
      cout << "1" << endl;
    }
    
    n--;
  }

  return 0;
}

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

int main() {
  double n, xa, ya, ra, xb, yb, rb;
  double x, y, xx, rr, rr2;
  cin >> n;
  while(n--) {
    cin >> xa >> ya >> ra >> xb >> yb >> rb;
    x = xb - xa; y = yb - ya;
    xx = x*x + y*y;
    rr = rb - ra; rr = rr*rr;
    rr2 = rb + ra; rr2 = rr2*rr2;
    if(xx<rr) {
      if(rb<ra) {
        cout << "2" << endl;
      }else {
        cout << "-2" << endl;
      }
    }else if(xx<=rr2 && rr<=xx) {
      cout << "1" << endl;
    }else {
      cout << "0" << endl;
    }
  }
  return 0;
}