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 <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;
}

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

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

typedef complex<double> P;
typedef vector<P> VP;
const double EPF = 1e-1;

#define X real()
#define Y imag()
#define EQ(x,y) (abs(x-y) < EPF)
#define LE(x,y) (x < y + EPF)
#define GE(x,y) (x + EPF > y)

double dot(P a, P b) {
  return (conj(a)*b).X;
}
double cross(P a, P b) {
  return (conj(a)*b).Y;
}
int isparallel(P a, P b, P c, P d) {//ab,cd
  return EQ(cross(a-b, c-d),0);
}
double distPP(P a, P b) {
  return sqrt(dot(a-b,a-b));
}
int relationCC(P c1, double r1, P c2, double r2) {//0..not overlap, 1..intersect, 2..2isin1, -2..1isin2
  double d = distPP(c1,c2);
  if(GE(d , r1+r2)) return 0;
  else if(GE(d , r1-r2) && GE(d , r2-r1)) return 1;
  else if(GE(r1 , r2)) return 2;
  else return -2;
  return -1;
}
P intersection(P a, P b, P c, P d) {//ac , bd
  double d1 = cross(d-b,b-a);
  double d2 = cross(d-b,c-a);
  if(EQ(d1,0) & EQ(d2,0)) return a;
  if(EQ(d2,0)) return a;
  return a + (c-a)*d1/d2;
}
P normal_vector(P a) {
  P b(-a.Y, a.X);
  return b;
}
P polar(double r, double theta) {
  P a(r*cos(theta),r*sin(theta));
  return a;
}


int main() {
  int n;
  scanf("%d",&n);
  REP(i,n) {
    double x,y,r1,r2;
    scanf("%lf %lf %lf", &x, &y, &r1);
    P a(x,y);
    scanf("%lf %lf %lf", &x, &y, &r2);
    P b(x,y);
    printf("%d\n", relationCC(a,r1,b,r2));
  }
  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, xb, xr;
		double ya, yb, yr;

		cin >> xa >> xb >> xr;
		cin >> ya >> yb >> yr;

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

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

	return 0;
}