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++: // AOJ 0023
#include<iostream>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const double EPS = 1e-9;

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

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

using namespace std;

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

  cin >> n;

  while(n--){
    cin >> xa >> ya >> ra >> xb >> yb >> rb;
    d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));

    int out;

    if(ra + rb < d) out = 0;
    else if(ra + d < rb)  out = -2;
    else if(rb + d < ra)  out = 2;
    else  out = 1;

    cout << out << endl;
  }
}

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

using namespace std;

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

    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(d + rb < ra)          { cout << "2"  << endl; }
        else if(d + ra < rb) { cout << "-2" << endl; }
        else if(d <= ra + rb)    { cout << "1"  << endl; }
        else                    { cout << "0"  << endl; }
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;


double xa, ya, ra, xb, yb, rb, d;
ll n;

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

C++: #include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main(){
	double xa,ya,ra,xb,yb,rb;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		double s=(xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
		s=(double)sqrt((double)s);
		int t=1;
		if(ra+s<=rb)
			t=-2;
		if(rb+s<=ra)
			t=2;
		if(s>ra+rb)
			t=0;
		cout<<t<<endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <math.h>
typedef struct En{
	double x,y,r;
};
int main(){
	En a,b;
	double dist,r;
	int n;
	scanf("%d",&n);
	while(n--){
		scanf("%lf%lf%lf%lf%lf%lf",&a.x,&a.y,&a.r,&b.x,&b.y,&b.r);
		dist = (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
		r = (a.r+b.r)*(a.r+b.r);
		a.r = a.r*a.r;b.r = b.r*b.r;
		if(dist>r) printf("0\n");
		else if(a.r>b.r+dist) printf("2\n");
		else if(b.r>a.r+dist) printf("-2\n");
		else printf("1\n");
	}
	return 0;
}

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

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 dis = sqrt(pow((xa - xb), 2) + pow((ya - yb), 2));
    if(fabs(ra - rb) >= dis)
      if(ra > rb)
	cout << "2" << endl;
      else
	cout << "-2" << endl;
    else if(fabs(ra - rb) < dis && ra + rb >= dis)
      cout << "1" << endl;
    else
      cout << "0" << endl;
  }
}

C++: #include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

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

int main() {
	// your code goes here
	int n;
	double x1,x2,y1,y2,r1,r2;
	cin>>n;
	for(int j=0;j<n;j++){
		cin>>x1>>y1>>r1>>x2>>y2>>r2;
		
		if(r(x1,y1,x2,y2)>(r1+r2)){
			cout<<0<<endl;
		}
		else if(r(x1,y1,x2,y2)>fabs(r1-r2)&&r(x1,y1,x2,y2)<r1+r2){
			cout<<1<<endl;
		}
		else if(r1>r2){
			cout<<2<<endl;
		}
		else if(r2>r1){
		cout<<-2<<endl;	
		
		}
		
		
	}
	
	return 0;
}

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

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 dis = sqrt(pow((xa - xb), 2) + pow((ya - yb), 2));
    if(fabs(ra - rb) >= dis)
      if(ra > rb)
	cout << "2" << endl;
      else
	cout << "-2" << endl;
    else if(fabs(ra - rb) < dis && ra + rb > dis)
      cout << "1" << endl;
    else
      cout << "0" << endl;
  }
}

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

using namespace std;

void Solution()
{
    int n;
    
    cin>>n;
    
    while(n--)
    {
        float xa, ya, ra;
        float xb, yb, rb;
        float d;
        
        cin>>xa>>ya>>ra>>xb>>yb>>rb;
        
        d = sqrt((xb - xa) * (xb - xa) + (yb - ya) * (yb - ya)); // distance of o1 and o2
        
        if ((d < ra - rb) && (ra > rb))
        {
            cout<<2<<endl;
        }
        else if ((d < rb - ra) && (ra < rb))
        {
            cout<<-2<<endl;
        }
        else if (d >= abs(ra - rb) && (d < ra + rb))
        {
            cout<<1<<endl;
        }
        else if (d > ra + rb)
        {
            cout<<0<<endl;
        }
//        else
//        {
//            cout<<1<<endl;
//        }
    }
}

int main()
{
    Solution();
    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-9;

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