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 <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||EQ((ra+rb)*(ra+rb),dist))
			cout<<1<<endl;
		else
			// Ç¿ç©ªÉ¶Ý·é
			if(ra>rb)
				cout<<2<<endl;
			else
				cout<<-2<<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 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()
{
  ll n,i;
  ld xa,ya,ra,xb,yb,rb;
  ld dist;

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

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

    ld lr=max(ra,rb);//?????????????????????
    ld sr=min(ra,rb);//?????????????????????

    if(dist>lr+sr)//AB?????¢??????????????¨???
      cout<<"0"<<endl;
    else{
      if(sr<dist || lr==sr || (dist<sr && dist+sr>lr))//?????????????????¢??????????????????????????§??????
	cout<<"1"<<endl;
      else if(rb<ra && dist<ra)
	cout<<"2"<<endl;
      else if(ra<rb && dist<rb)
	cout<<"-2"<<endl;
    }
  }
}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

struct Circle
{
	double x, y;
	double r;
};

int hit(Circle c0, Circle c1)
{
	double x = (c1.x - c0.x);
	double y = (c1.y - c0.y);

	double d = sqrt(x * x + y * y);
	if (d <= c0.r + c1.r)
	{
		if (c0.r + d <= c1.r)
		{
			return -2;
		}
		else if (c1.r + d <= c0.r)
		{
			return 2;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 0;
	}
}

int main()
{
	int n;
	for (cin >> n; n--;)
	{
		Circle c0, c1;
		cin >> c0.x >> c0.y >> c0.r;
		cin >> c1.x >> c1.y >> c1.r;

		cout << hit(c0, c1) << endl;
	}
}

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

using namespace std;

int main(void) {
	int ds;
	cin >> ds;
	
	for(int i = 0; i < ds; i++) {
		double d, r1[3], r2[3];
		for(int j = 0; j < 3; j++)
			cin >> r1[j];
		for(int j = 0; j < 3; j++)
			cin >> r2[j];
		
		d = (r2[0] - r1[0]) * (r2[0] - r1[0]) + (r2[1] - r1[1]) * (r2[1] - r1[1]);
		
		if( d < abs(r1[2] - r2[2]) ) {
			cout << "2" << endl;
		}else if( d < abs(r2[2] - r1[2]) ) {
			cout << "-2" << endl;
		}else if( (abs(r1[2] - r2[2]) < d && d < r1[2] + r2[2]) || d == r1[2] + r2[2] ) {
			cout << "1" << endl;
		}else {
			cout << "0" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
#include<vector>
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 a.x*a.x+a.y*a.y;
}
double abs(Vector a){
  return sqrt(norm(a));
}
class Circle{
public:
  Point c;
  double r;
  Circle(Point c = Point(),double r = 0.0):c(c),r(r){}
};
int check(Circle a,Circle b){
  double d1 = abs(b.c-a.c) , d2 = (a.r+b.r);
  
  if(d1+b.r-a.r<EPS) return 2;
  if(d1+a.r-b.r<EPS) return -2;
  if(d1-d2<=EPS) return 1;
  return 0;
}
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;
    Circle c1(a,r1),c2(b,r2);
    cout << check(c1,c2) << endl;
  }
  return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;

	while(n > 0){
		double xa, ya, ra;
		double xb, yb, rb;

		cin >> xa >> ya >> ra;
		cin >> xb >> yb >> rb;

		double d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));

		if(d > ra + rb) cout << 0 << endl;
		else if(ra > rb && d < ra - rb) cout << 2 << endl;
		else if(rb > ra && d < rb - ra) cout << -2 << endl;
		else cout << 1 << endl;
		--n;
	}

	return 0;
}

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

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

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

C++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>

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

	return 0;
}

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

int main(){
	int n;cin >> n;
	double x1, y1, r1, x2, y2, r2;
	while(n--){
		cin >>x1>>y1>>r1>>x2>>y2>>r2;
		double d = pow(y2-y1, 2)+pow(x2-x1, 2);
		d = sqrt(d);
		if(r1 + r2 >= d){
			int f = 0;
			if(d < r1){
				if(d+r1 <= r2)cout << -2 << endl;
				f = 1;
			}
			if(d < r2){
				if(d+r2 <= r1)cout << 2 << endl;
				f = 1;
			}
			if(!f)cout << 1 << endl;
		}else{
			cout << 0 << endl;
		}
		//cout << d << endl;
	}
	return 0; 
}