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

C++: #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#include <bits/stdc++.h>
using namespace std;
  

int main() {
  int n;
  cin>>n;
  
  double xa,ya,ra,xb,yb,rb;
  double D,R1,R2;
  rep(i,n){
    cin>>xa>>ya>>ra>>xb>>yb>>rb;
    
    D=(xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
    R1=(ra+rb)*(ra+rb);
    R2=(ra-rb)*(ra-rb);
    
    if(D>R1) cout<<0<<endl;
    else if(D>=R2 && D<=R1) cout<<1<<endl;
    else{
      if(ra>rb) cout<<2<<endl;
      else cout<<-2<<endl;
    }
  }
  
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
signed main(void){
	ios::sync_with_stdio(false);
	int T;
	cin>>T;
	double x1,x2,y1,y2,r1,r2,d;
	for(int t=1;t<=T;t++){
		cin>>x1>>y1>>r1
		   >>x2>>y2>>r2;
		d=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
		if(d>(r1+r2))
			cout<<0<<endl;
		else if(d<abs(r1-r2)){
			if(r1>r2)
				cout<<2<<endl;
			else
				cout<<-2<<endl;
		}
		else
			cout<<1<<endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
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((xb-xa)*(xb-xa)+(yb-ya)*(yb-ya));
		if(d>ra+rb)cout<<0<<endl;
		else if(ra-rb>d)cout<<2<<endl;
		else if(rb-ra>d)cout<<-2<<endl;
		else cout<<1<<endl;
	}
	return 0;
}

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

int n;
double xa,ya,ra,xb,yb,rb;

int main(){
	int i;
	scanf("%d",&n);
	
	for( i = 0;i < n;i++ ){
		scanf("%lf%lf%lf%lf%lf%lf",&xa,&ya,&ra,&xb,&yb,&rb);
		
		//BがA中にあるか(境界ふくむ)
		if( sqrt( (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) ) + sqrt(rb*rb) <= ra )
			puts("2");
		//AがB中にあるか(境界ふくむ)
		else if( sqrt( (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) ) + sqrt(ra*ra) <= rb )
			puts("-2");
		//AとBが交わっているか
		else if( (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) <= (ra+rb)*(ra+rb) )
			puts("1");
		else
			puts("0");
	}
	return 0;
}

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)
        return 2;
    else if(distance < rb * rb)
        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 <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 epsilon = numeric_limits<double>::epsilon();
bool a_lt_b(double a, double b) {
  return (b - a) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon * epsilon);
}

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 = 1;
    if (a_lt_b((ra+rb)*(ra+rb), dist_p)) ans = 0;
    if (ra > rb && a_lt_b(dist_p, (ra-rb)*(ra-rb))) ans =  2;
    if (ra < rb && a_lt_b(dist_p, (rb-ra)*(rb-ra))) ans = -2;
    cout << ans << "\n";
  }
  return 0;
}