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)
		// println(xa, ya, ra, xb, yb, rb)
		dis := math.Sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb))
		if dis + ra < rb {
			fmt.Println(-2)
		} else if dis + rb < ra {
			fmt.Println(2)
		} else if dis > rb + ra {
			fmt.Println(0)
		} else {
			fmt.Println(1)
		}
	}
}

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

int n;

void solve()
{
	double nx,ny,nr,mx,my,mr,pdist;


	cin >> nx >> ny >> nr >> mx >> my >> mr;
	pdist = sqrt(pow((nx-mx), 2.0) + pow((ny-my),2.0));

	if(pdist - nr + mr <= 0.0){
		cout << 2 << endl;
	}
	else if((pdist - mr + nr <= 0.0)){
		cout << -2 << endl;
	}
	else if(pdist - mr - nr > 0.0){
		cout << 0 << endl;
	}
	else {
		cout << 1 << endl;
	}
}

int main(void)
{
	cin >> n;
	while(--n, n>=0){
		solve();
	}
	return 0;
}

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

typedef complex<double>P;

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		double ra,rb;
		P pa,pb;
		
		cin>>pa.real()>>pa.imag()>>ra;
		cin>>pb.real()>>pb.imag()>>rb;
		double d=abs(pa-pb);
		if(d+ra-rb<=EPS)cout<<-2<<endl;
		else if(d+rb-ra<=EPS)cout<<2<<endl;
		else if(d-ra-rb<=EPS)cout<<1<<endl;
		else cout<<0<<endl;
	}
}

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

int main(void){
	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 = sqrt( (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) );

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

	}
	return 0;
}

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

using namespace std;

int main(){
	int n;
	double xa,ya,ra,xb,yb,rb;
	double d;
	
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf",&xa,&ya,&ra,&xb,&yb,&rb);
		d = ((xa-xb)*(xa-xb))+((ya-yb)*(ya-yb));
		if(sqrt(d)+rb<ra)
		printf("2\n");
		else if(sqrt(d)+ra<rb)
		printf("-2\n");
		else if(sqrt(d)<=ra+rb)
		printf("1\n");
		else
		printf("0\n");
	}
}

C++: #include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
using namespace std;

#define ISEQ(c) (c).begin(), (c).end()
typedef long long ll;

int main() {
  int n;
  cin >> n;
  double x[2], y[2], r[2];
  const double EPS = 1e-9;
  for (int z = 0; z < n; z++) {
    cin >> x[0] >> y[0] >> r[0];
    cin >> x[1] >> y[1] >> r[1];
    double cdif = sqrt((x[0]-x[1])*(x[0]-x[1]) - (y[0]-y[1])*(y[0]-y[1]));
    if (cdif+r[0]-r[1] < -EPS) cout << -2 << endl;
    else if (cdif+r[1]-r[0] < -EPS) cout << 2 << endl;
    else if (cdif-r[0]-r[1] < EPS) cout << 1 << endl;
    else cout << 0 << endl;
  }

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

using namespace std;

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

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

int
main(void)
{
	char line[80];
	int n;
	double xa, ya, ra, xb, yb, rb;
	
	while (fgets(line, sizeof line, stdin)) {
		if (sscanf(line, "%d", &n) == 1) {
			for (int i = 0; i < n; i++) {
				if (fgets(line, sizeof line, stdin) == NULL) {
					return 1;
				}
				if (sscanf(line, "%lf %lf %lf %lf %lf %lf",
						   &xa, &ya, &ra, &xb, &yb, &rb) != 6) {
					return 1;
				}

				double d = sqrt((xb - xa)*(xb - xa) + (yb - ya)*(yb - ya));
				
				int rt;
				if (ra + rb < d) {
					rt = 0;
				} else if (abs(ra - rb) <= d) {
					rt = 1;
				} else if (ra - rb > d) {
					rt = 2;
				} else {
					rt = -2;
				}

				printf("%d\n", rt);
			}
		}
	}

	return 0;
}

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

int main(){
	int N;
	std::cin >> N;
	
	std::array<int, 20> 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;
	}
	
	for(int i=0; i<N; ++i)
		std::cout << ans[i] << std::endl;
	
	return 0;
}

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

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

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

C++: #include <iostream>

int check_intersection(const double xa, const double ya, const double ra,
                            const double xb, const double yb, const double rb)
{
    double distance = (xa - xb) * (xa - xb) + (ya - yb) * (ya - yb);
    if(distance < ra * ra || distance < rb * rb){
        if(ra > rb)
            return -2;
        else
            return 2;
    }
    else if(distance > (ra + rb) * (ra + rb))
        return 0;
    else return 1;
}

int main ()
{
    double xa, ya, ra, xb, yb, rb;
    u_int N;
    
    std::cin >> N;
    for(u_int i = 0; i < N; ++i){
        std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
        std::cout << check_intersection(xa, ya, ra, xb, yb, rb) << std::endl;
    }
    
    return 0;
}