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 <cmath>
#include <iostream>
using namespace std;
#define EPS 1e-12
int main()
{
    int n; cin >> n;
    while (n--) {
        double xa, ya, ra, xb, yb, rb;
        cin >> xa >> ya >> ra >> xb >> yb >> rb;
        double d = hypot(xa-xb, yb-yb);
        int res = 1;
        if (ra > rb) {
            if (d < ra - rb + EPS) res = 2;
            else if (d > ra + rb) res = 0;
        }
        else {
            if (d < rb - ra + EPS) res = -2;
            else if (d > ra + rb) res = 0;
        }
        cout << res << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

struct Vector {
  double x, y;
  Vector() {}
  Vector(double x, double y): x(x), y(y) {}
  Vector operator+(Vector v) { return Vector(x + v.x, y + v.y); }
  Vector operator-(Vector v) { return Vector(x - v.x, y - v.y); }
  Vector operator*(double k) { return Vector(x * k, y * k); }
  Vector operator/(double k) { return Vector(x / k, y / k); }
  bool operator==(Vector v)  { return abs(x - v.x) < 1e-10 && abs(y - v.y) < 1e-10; }
  friend void input(Vector &v) { cin >> v.x >> v.y; }
  friend double norm(Vector v) { return dot(v, v); }
  friend double  abs(Vector v) { return sqrt(norm(v)); }
  friend double   dot(Vector v1, Vector v2) { return v1.x * v2.x + v1.y * v2.y; }
  friend double cross(Vector v1, Vector v2) { return v1.x * v2.y - v1.y * v2.x; }
  friend void show(Vector v) { if (abs(v.x) < 1e-10) v.x = 0.0; if (abs(v.y) < 1e-10) v.y = 0.0; printf("%.10f %.10f\n", v.x, v.y); }
  friend bool ccw(Vector v, Vector v1, Vector v2) { return cross(v1 - v, v2 - v) > 1e-10; }
  friend bool  cw(Vector v, Vector v1, Vector v2) { return cross(v1 - v, v2 - v) < -1e-10; }
  friend bool parallel(Vector v1, Vector v2) { return abs(cross(v1, v2)) < 1e-10; }
  friend bool onLine(Vector v, Vector v1, Vector v2) { return v == v1 || v == v2 || (parallel(v1 - v, v2 - v) && dot(v1 - v, v2 - v) < -1e-10); }
  friend int direct(Vector v1, Vector v2, Vector v) { if (ccw(v1, v2, v)) return  1; if (cw(v1, v2, v)) return -1; if (dot(v2 - v1, v - v1) < -1e-10) return  2; if (dot(v1 - v2, v - v2) < -1e-10) return -2; return 0; }
};
typedef Vector Point;

struct Circle {
  Point c;
  double r;
  Circle() {}
  Circle(Point c, double r): c(c), r(r) {}
  friend void input(Circle &c) { cin >> c.c.x >> c.c.y >> c.r; }
  friend int intersect(Circle c1, Circle c2) { if (abs(c1.c - c2.c) - c1.r - c2.r > 1e-10) return 0; if (c1.r - c2.r - abs(c1.c - c2.c) > 1e-10) return 2; if (c2.r - c1.r - abs(c1.c - c2.c) > 1e-10) return -2; return 1; }
};

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

  for (int i = 0; i < n; i++) {
    Circle a, b;
    input(a);
    input(b);
    cout << intersect(a, b) << endl;
  }

  return 0;
}

C++: #include <cmath>
#include <cstdio>
int n; double xa, ya, ra, xb, yb, rb;
int main() {
	scanf("%d", &n);
	for(int i = 0; i < n; i++) {
		scanf("%lf%lf%lf%lf%lf%lf", &xa, &ya, &ra, &xb, &yb, &rb);
		double dist = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
		if(dist >= ra + rb - 1e-9) {
			printf("0\n");
		}
		else if(dist <= ra - rb + 1e-9) {
			printf("2\n");
		}
		else if(dist <= rb - ra + 1e-9) {
			printf("-2\n");
		}
		else  {
			printf("1\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-7;

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 {
      cout << 0 << endl;
    }
  }
}

C++: #include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define F first
#define S second
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl

double a[6];

void solve(){
	double ab=sqrt((a[0]-a[3])*(a[0]-a[3])+(a[1]-a[4])*(a[1]-a[4]));
	if(ab>a[2]+a[5])cout<<0<<endl;
	else if(ab+a[5]<a[2])cout<<2<<endl;
	else if(ab+a[2]<a[5])cout<<-2<<endl;
	else cout<<1<<endl;
	
}

int main(){
	li n;
	cin>>n;
	rin{
		rep(j,6)cin>>a[j];
		solve();
	}
	
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>
#include <set>

#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;


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

	cin >> n;
	REP(i, n){
		cin >> xa >> ya >> ra >> xb >> yb >> rb;

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

		dx = sqrt(dx);

		if (dx > (ra + rb)){
			cout << 0 << endl;
			continue;
		}

		if (dx < (rb-ra)){
			cout << -2 << endl;
			continue;
		}

		if (dx < (ra - rb)){
			cout << 2 << endl;
			continue;
		}

		cout << 1 << endl;
	}
	return 0;

}

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

using namespace std;

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