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 <vector>
#include <algorithm>
#include <map>
#include <math.h>
#include <complex>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = (1e-10);    // 許容誤差。問題によって変える
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

// 内積　dot(a,b) = |a||b|cosθ
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
  return (conj(a)*b).Y;
}

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;
    P a = P(xa, ya);
    P b = P(xb, yb);

    if (LE(ra+rb, abs(a-b))) {
      std::cout << 0 << std::endl;
      continue;
    }

    if (LE(abs(a-b)+ra, rb)) {
      std::cout << -2 << std::endl;
    }else if (LE(abs(a-b)+rb, ra)) {
      std::cout << 2 << std::endl;
    }else {
      std::cout << 1 << std::endl;
    }
  }

  
  return 0;
}

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

using namespace std;

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

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

struct circle
{
    double x;
    double y;
    double r;
};

double getDistance(circle a, circle b)
{
    return sqrt(pow(a.x - b.x ,2)
            +pow(a.y - b.y ,2));
}

int main()
{
    int n;
    circle a, b;
    double distance;
    cin >> n;
    for(int c = 0; c < n; c++)
    {
        cin >> a.x >> a.y >> a.r
            >> b.x >> b.y >> b.r;
        distance = getDistance(a, b);
        if(a.r - b.r > distance)
            cout << 2 << endl;
        else if(abs(a.r + b.r) < distance)
            cout << 0 << endl;
        else if(abs(a.r - b.r) > distance && a.r + b.r > distance)
            cout << 1 << endl;
        else if(b.r - a.r > distance)
            cout << -2 << endl;
    }
    return EXIT_SUCCESS;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  double x1,x2,y1,y2,r1,r2;

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

C++: #include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
 
 
#define TIMES(i) while(i--) 
#define REP(i, n) for ( int i = 0; i < n; i++ ) 
 
 
 using namespace std;
 
 int main() { 
     int n; 
     cin >> n; 
 
     TIMES(n) { 
         // ??\??? 
         double ax, ay, ar, bx, by, br; 
         cin >> ax >> ay >> ar >> bx >> by >> br; 
 
         // ?????¢????±??????? 
         double dis_x = abs(ax-bx), 
           dis_y = abs(ay-by), 
             dist = sqrt(dis_x * dis_x + dis_y * dis_y); 
 
         // cout << dis_x << " " << dis_y << " " << dist << endl; 
 
         // ??¢???????????? 
         if ( dist > ar + br ) { 
             cout << 0; 
 
         // a???????????????????????? 
         } else if ( dist + ar < br ) { 
             cout << -2; 
 
         // b???????????????????????? 
         } else if ( dist + br < ar ) { 
             cout << 2; 
 
         // ????????£????????? 
         } else { 
             cout << 1; 
         } 
         cout << endl; 
     } 
 
 
     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 if (d < sq(ra + rb)) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  int n;
  cin>>n;
  while(n--){
    double x,y;
    double ra,rb;
    cin>>x>>y>>ra;
    P a(x,y);
    cin>>x>>y>>rb;
    P b(x,y);
    double dist = abs(b-a);
    if(ra<rb && dist+ra-rb <= 1e-11){
      cout<<-2<<endl;
    }else if(rb<ra && dist+rb-ra <= 1e-11){
      cout<<2<<endl;
    }else if(dist-ra-rb <= 1e-11){
      cout<<1<<endl;
    }else{
      cout<<0<<endl;
    }
  }
  return 0;
}

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

using namespace std;

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

  while (n--) {
    cin >> xa >> ya >> ra >> xb >> yb >> rb;
    d = sqrt((xb-xa)*(xb-xa)+(yb-ya)*(yb-ya));
    if (d > (ra + rb)) 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;
}