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<complex>
#include<cmath>
#include<map>
#define fs first
#define sc second
#define EPS (1e-6)
using namespace std;


typedef complex<double> P;
typedef pair<P,double> C;

int cpr(C a,C b){
  double d = abs(a.fs-b.fs);
  if(a.sc+b.sc + EPS < d)return -1;      //no intersection (outside)
  if(b.sc<a.sc && d + EPS < a.sc-b.sc)return 1;       //no intersection (inside,B in A)
  if(a.sc<b.sc && d + EPS < b.sc-a.sc)return 2;       //no intersection (inside,A in B)
  if(abs(a.sc+b.sc - d) < EPS)return -3; //one cross point (outside)
  if(abs(b.sc+d - a.sc) < EPS)return 3;  //one cross point (inside,B in A)
  if(abs(a.sc+d - b.sc) < EPS)return 4;  //one cross point (inside,A in B)
  return 0;                              //two cross point
}


int main(){
  double ax,ay,ar,bx,by,br;

  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin>> ax >> ay >> ar >> bx >> by >> br;
    C a = C(P(ax,ay),ar), b = C(P(bx,by),br);
    int v = cpr(a,b);
    if(v==-1)cout <<  0 << endl;
    else if(v==1)cout << 2 << endl;
    else if(v==2)cout << -2 << endl;
    else cout << 1 << endl;
  }
}

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

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 d; // 中心間距離
        d = sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));

        if( d > ra + rb ) cout << "0\n";
        else if( ra - d > rb ) cout << "2\n";
        else if( rb - d > ra )cout << "-2\n";
        else cout << "1\n";
    }

    return 0;
}

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

int main(){
	int num ;
	cin >> num;
	for(int j = 1;j<= num; j++){
	double x[2],y[2],r[2],r2[2];
	for(int i =0;i<=1;i++){
		cin >> x[i];
		cin >> y[i];
		cin >> r[i];
	}
	double d;
	d = sqrt((x[0]-x[1])*(x[0]-x[1])+(y[0]-y[1])*(y[0]-y[1]));
	if((r[0]+r[1])<d) cout << 0 << endl;
	else if(r[0]+d < r[1]) cout << -2 << endl;
	else if(r[1]+d < r[0]) cout << 2 << endl;
	else cout << 1 << 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";
    else if (d < (rb - ra)) cout << "-2";
    else if (d < (ra - rb)) cout << "2";
    else cout << "1";
    cout << endl;
  }

  return 0;
}

C++: #include <cstdio>
#include <cmath>
#include <iostream>
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 = (ax-bx)*(ax-bx) + (ay-by)*(ay-by);

		d = sqrt(d);

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

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

int main(){
  double x1,y1,r1,x2,y2,r2,ans;
  int n;
  cin >> n;
  while(n--){
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    double len = sqrt(pow(x1-x2,2) + pow(y1-y2,2));
    if( len + r2 < r1){
      ans = 2;
    } else if(len + r1 < r2){
      ans = -2;
    } else if(len <= r1 + r2){
      ans = 1;
    } else {
      ans = 0;
    }
    cout << ans << endl;
  }
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
signed main(){
	int n;
	scanf("%lld",&n);
	for(int i=0;i<n;i++){
		double xa,ya,ra,xb,yb,rb;
		scanf("%lf %lf %lf %lf %lf %lf",&xa, &ya, &ra, &xb, &yb, &rb);
		double d = sqrt(pow(xa-xb,2)+pow(ya-yb,2));
		if( rb+d < ra ) cout << "2" << endl;
		else if( ra+d < rb ) cout << "-2" << endl;
		else if( d < ra+rb) cout << "1" << endl;
		else cout << "0" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

#define rep(i, n)      for (int i=0; i<int(n); i++)
#define rep3(i, s, n)  for (int i=int(s); i<int(n); i++)
#define rev_rep(i, n)  for (int i=int(n)-1; i>=0; i-=1)

int N;

int main() {
  cin >> N;
  rep(i, N) {
    double xa, ya, ra, xb, yb, rb;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;
    double dist_p = (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb);
    int ans = 0;
    if (dist_p < (ra+rb)*(ra+rb)) ans = 1;
    if (ra > rb && dist_p <= (ra-rb)*(ra-rb)) ans =  2;
    if (ra < rb && dist_p <= (rb-ra)*(rb-ra)) ans = -2;
    cout << ans << "\n";
  }
  return 0;
}

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

int main(){
	int N;
	std::cin >> N;
	
	while(N--){
		double xa, ya, ra, xb, yb, rb;
		std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double d = hypot((xa - xb), (ya - yb)); //distance
		
		if(d > ra + rb)
			std::cout << 0 << std::endl;
		else if(d < fabs(ra - rb))
			std::cout << (ra > rb ? 2 : -2) << std::endl;
		else
			std::cout << 1 << std::endl;
	}
    return 0;
}