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++: #include<iostream>
#include<cmath>

int main()
{
	double Xa,Ya,Xb,Yb,Ra,Rb,d;

	int N;

	std::cin >> N;

	for(int i=0;i<N;++i)
	{
		
		std::cin >> Xa >> Ya >> Ra >> Xb >> Yb >> Rb;

		d=sqrt((Xa-Xb)*(Xa-Xb)+(Ya-Yb)*(Ya-Yb));

		if(d<Ra-Rb)
			std::cout << '2' << '\n';

		else if(d<Rb-Ra)
			std::cout << '-2' << '\n';

		else if(Ra+Rb<d)
			std::cout << '0' << '\n';

		else
			std::cout << '1' << '\n';
	}
}

C++: #include <iostream>
#include <cmath>
#include <array>
#include <list>
#include <vector>
 
int main(){
    int N;
    std::cin >> N;
     
    //std::array<int, 20> ans;
    std::list<int> ans; //change
    //std::vector<int> ans;
     
    for(int i=0; i<N; ++i){
        double xa, ya, ra, xb, yb, rb;
        std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
         
        double d = pow((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb), 0.5);
        
        /*
        if(ra > rb && d < ra-rb) ans[i] = 2;
        else if(rb > ra && d < rb-ra) ans[i] = -2;
        else if(d <= ra+rb) ans[i] = 1;
        else if(d > ra+rb) ans[i] = 0;
        */
        
        if(ra > rb && d < ra-rb) ans.push_back(2);
        else if(rb > ra && d < rb-ra) ans.push_back(-2);
        else if(d <= ra+rb) ans.push_back(1);
        else if(d > ra+rb) ans.push_back(0);
    }
    
    /*
    for(int i=0; i<N; ++i)
        std::cout << ans[i] << std::endl;
    */
    
    for(std::list<int>::iterator it = ans.begin(); it != ans.end(); ++it){
    	std::cout << *it << std::endl;
	}
	
    return 0;
}

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

int main(int argc, char *argv[]) {
	int dataN;
	scanf("%d", &dataN);
	for (int i = 0; i < dataN; i++) {
		float ax, ay, ra, bx, by, rb;
		scanf("%f %f %f %f %f %f", &ax, &ay, &ra, &bx, &by, &rb);
		double d = abs(ax-bx)*abs(ax-bx) + abs(ay-by)*abs(ay-by);
		d = sqrt(d);
		if (d > ra+rb) puts("0");
		else if (d < rb) puts("2");
		else if (d < ra) puts("-2");
		else puts("1");
	}
	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){
			cout<<1<<endl;
		}
		else{
			// Ç¿ç©ªÉ¶Ý·é
			if(ra>rb){
				cout<<2<<endl;
			}
			else
				cout<<-2<<endl;
		}
	}


	return 0;
}

C++: #include<iostream>
#include<math.h>

using namespace std;

int main()
{
	double x1,x2,y1,y2,r1,r2,d;
	int n,i;
	
	cin >> n ;
	
	for(i=0;i<n;i++)
	{
		cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2 ;
		
		d=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
		
		if(d-r1-r2>0.0)
			cout << "0" << endl;
		else if(r1-d-r2>0.0)
			cout << "2" << endl;
		else if(r2-d-r1<0.0)
			cout << "-2" << endl;
		else
			cout << "1" << endl;
	}
}

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

float d(float x, float y, float z, float w){
	float ret;
	ret = pow(x - z, 2) + pow(y - w, 2);
	return sqrtf(ret);
}

int main(){
	int n;
	float x[2], y[2], r[2], dd;
	cin >> n;
	for(int i = 0;i<n;i++){
		cin >> x[0] >> y[0] >> r[0] >> x[1] >> y[1] >> r[1];
		dd = d(x[0], y[0], x[1], y[1]);
		if(dd > r[0]+r[1]){
			cout << 0 << endl;
		}
		else if(dd + r[0] <= r[1]){
			cout << -2 << endl;
		}
		else if (dd + r[1] <= r[0]) {
			cout << 2 << endl;
		}
		else {
			cout << 1 << endl;
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

double eps = 1e-10;

class Point {
public:
	double x, y;
	
	Point(double x = 0, double y = 0) : x(x), y(y) {}
	
	Point operator + (const Point& p) {
		return Point(x + p.x, y + p.y);
	}
	Point operator - (const Point& p) {
		return Point(x - p.x, y - p.y);
	}
	Point operator * (const double& a) {
		return Point(x * a, y * a);
	}
	Point operator / (const double& a) {
		return Point(x / a, y / a);
	}
	
	bool operator < (const Point& p) const {
		return x != p.x ? x < p.x : y < p.y;
	}
	bool operator == (const Point& p) const {
		return fabs(x - p.x) < eps && fabs(y - p.y) < eps;
	}
	
	double abs() {
		return sqrt(norm());
	}
	double norm() {
		return x * x + y * y;
	}
	
};

class Circle {
public:
	Point c;
	double r;
	Circle(Point c = Point(), double r = 0.0) : c(c), r(r) {}
};

int main() {
	int n;
	cin >> n;
	double x1, y1, r1, x2, y2, r2;
	for(int i = 0; i < n; ++i){
		cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
		Circle c1 = Circle(Point(x1, y1), r1);
		Circle c2 = Circle(Point(x2, y2), r2);
		double minr = min(c1.r, c2.r);
		double maxr = max(c1.r, c2.r);
		
		if(pow(c2.c.x - c1.c.x, 2.0) + pow(c2.c.y - c1.c.y, 2.0) + pow(minr, 2.0) < pow(maxr, 2.0)){
			if(c1.r > c2.r)
				cout << "2" << endl;
			else
				cout << "-2" << endl;
		}
		else if(pow(c2.c.x - c1.c.x, 2.0) + pow(c2.c.y - c1.c.y, 2.0) <= pow(c1.r + c2.r, 2.0)){
			cout << "1" << endl;
		}
		else{
			cout << "0" << endl;
		}
	}
	return 0;
}

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

using namespace std;

double X1,Y1,r1,X2,Y2,r2;

int main()
{
    int n; scanf( "%d\n", &n );
    while( n > 0 ){
        scanf("%lf %lf %lf %lf %lf %lf\n", &X1, &Y1, &r1, &X2, &Y2, &r2 );
        double dx = X2 - X1, dy = Y2 - Y1;
        double dis = sqrt( dx * dx + dy * dy );


        if( dis < r1 - r2 )
        {
            printf( "%d\n", 2 );
        }
        else if( dis < r2 - r1 )
        {
            printf( "%d\n", -2 );
        }
        else if( abs( r2 - r1 ) <= dis && dis <= r2 + r1 )
        {
            printf( "%d\n", 1 );
        }
        else
        {
            printf( "%d\n", 0 );
        }
        n--;
    }
    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-8;

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

C++: #include<stdio.h>
#include<math.h>

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

	scanf("%d",&n);
	for(x=0;x<n;x++)
	{
		scanf("%lf %lf %lf %lf %lf %lf",&xa,&ya,&ra,&xb,&yb,&rb);

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

		if(ra+rb<d)
		{
			printf("0\n");
		}
		else if(ra<rb&&d<rb-ra)
		{
			printf("-2\n");
		}
		else if(rb<ra&&d<ra-rb)
		{
			printf("2\n");
		}
		else
		{
			printf("1\n");
		}
		return 0;
	}
}