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++: /*
NOTE :
*min_element(.begin(),.end())
*max_element(.begin(),.end())
stack push pop top
queue push pop front
priority_queue<> pq
 push()  pop() size()  top()
map<>
 find() begin() end() insert(map<>::value_type())
pair<>
sort(.begin(), .end())
sort(arr, arr+N)
sort(a, a+N, greater<int>())
binary_search(vc.begin(), vc.end(), x)  //binary_search???true, false?????????
vector<int>::iterator lit = lower_bound(vc.begin(), vc.end(), x);
  lower_bound?????????????????????"??\???"????????????????????????????????????????????¬???????????????
vector<int>::iterator uit = upper_bound(vc.begin(), vc.end(), x);
  upper_bound????????????????????????"?¶???????"?????????????????????????????????????????¬???????????????
*/
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cassert>
#include <sstream>
#include <algorithm>
#include <valarray>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

#define MAX 100
#define INF 1<<20
#define LLINF 10e12 // 1<<31 // 2^31
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,a,n) for(int i=(a);i<(n);i++)
#define SET(a,c) memset(a,c,sizeof a)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique(ALL((o))), (o).end());
#define SQ(x) ((x)*(x))

using namespace std;
typedef long long ll;
typedef valarray<int> array_t;
/////

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // FROM HERE
  int n; cin >> n;
  REP(i,n)
  {
      double x1, x2, y1, y2, r1, r2;
      cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
      double d = sqrt(SQ(x1-x2)+SQ(y1-y2));
      if(d > r1 + r2) cout << "0" << endl;
      else if(d < fabs(r1-r2)) cout << 2*(r1>r2?1:-1) << endl;
      else cout << "1" << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;

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

  cin>>n;
  rep(i,n){

    cin>>xa>>ya>>ra>>xb>>yb>>rb;
    dist=sqrt( (xa-xb)*(xa-xb)+(ya-yb)*(ya-yb) );

    if(dist>ra+rb)
      cout<<"0"<<endl;
    else if(ra<=dist)
      cout<<"1"<<endl;
    else if(rb<ra)
      cout<<"2"<<endl;
    else if(ra<rb)
      cout<<"-2"<<endl;
  }
}

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

int main(){
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		float xa, ya, ra, xb, yb, rb;
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		complex<float> comp(xa - xb, ya -yb);
		float d = abs(comp);
		float r = ra + rb;
		if(d <= r){
			if(d < ra && rb < ra){
				cout << "2" << endl;
			}
			else if(d < rb && ra < rb){
				cout << "-2" << endl;
			}
			else{
				cout << "1" << endl;
			}
		}
		else{
			cout << "0" << endl;
		}
	}
	return 0;
}

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(!EQ((ra+rb)*(ra+rb),dist)&&(ra+rb)*(ra+rb)<dist)
			cout<<0<<endl;
		// ~üªðíé
		else if(EQ(abs(ra-rb)*abs(ra-rb),dist)||((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>
#include <cstdint>
#include <cmath>

int main()
{
	std::uint32_t n;
	std::cin >> n;
	for (std::uint32_t i = 0; i < n; ++i) {
		double x_a, y_a, r_a, x_b, y_b, r_b;
		std::cin >> x_a >> y_a >> r_a >> x_b >> y_b >> r_b;
		double const dist = std::hypot(x_a - x_b, y_a - y_b);
		if (dist + r_b < r_a) {
			std::cout << 2 << std::endl;
		}
		else if (dist + r_a < r_b) {
			std::cout << -2 << std::endl;
		}
		else if (dist <= r_a + r_b) {
			std::cout << 1 << std::endl;
		}
		else {
			std::cout << 0 << std::endl;
		}
	}
	return 0;
}

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(!EQ((ra+rb)*(ra+rb),dist)&&(ra+rb)*(ra+rb)<dist)
			cout<<0<<endl;
		// ~üªðíé
		else if(EQ(abs(ra-rb)*abs(ra-rb),dist)||((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>
#include<cmath>
using namespace std;
struct circle{
  double x,y,r;
};
int main(){
  int n;
  circle p[2];
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> p[0].x >> p[0].y >> p[0].r >> p[1].x >> p[1].y >> p[1].r;
    double l = sqrt((p[0].x-p[1].x)*(p[0].x-p[1].x) + (p[0].y-p[1].y)*(p[0].y-p[1].y));
    if(fabs(p[0].r-p[1].r) > l ){
      if(p[0].r>p[1].r){ cout <<"2"<< endl;}
      else cout << "-2"<<endl;
    }
    if(fabs(p[0].r-p[1].r) < l && fabs(p[0].r+p[1].r) > l ){
	cout << "1" << endl;
      }
      if(fabs(p[0].r+p[1].r) < l){
	cout <<"0" <<endl;
      }
  }
}

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

#define TIMES(i) while(i--)
#define REP(i, n) for ( int i = 0; i < n; i++ )

using namespace std;

int main() {
    int n;
    cin >> n;

    TIMES(n) {
        // 入力
        double ax, ay, ar, bx, by, br;
        cin >> ax >> ay >> ar >> bx >> by >> br;

        // 距離を求める
        double dis_x = abs(ax-bx),
            dis_y = abs(ay-by),
            dist = sqrt(dis_x * dis_x + dis_y * dis_y);

        // cout << dis_x << " " << dis_y << " " << dist << endl;

        // 離れている
        if ( dist > ar + br ) {
            cout << 0;

        // aが内包されている
        } else if ( dist + ar < br ) {
            cout << -2;

        // bが内包されている
        } else if ( dist + br < ar ) {
            cout << 2;

        // 交わっている
        } else {
            cout << 1;
        }
        cout << endl;
    }

    return 0;
}