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 <string>
#include <vector>
#include <cmath>
using namespace std;

int main() {
    int n;
    cin >> n;
    double xa, ya, ra, xb, yb, rb;
    while (n--) {
        cin >> xa >> ya >> ra >> xb >> yb >> rb;
        double d = sqrt((xb - xa) * (xb - xa) + (yb - ya) * (yb - ya));
        if (ra + rb <= d - 1e-9) {
            cout << 0 << endl;
        } else if (d + ra < rb + 1e-9) {
            cout << -2 << endl;
        } else if (d + rb < ra + 1e-9) {
            cout << 2 << endl;
        } else {
            cout << 1 << endl;
        }
    }
    return 0;
}

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

using namespace std;

double dis(long double x1,long double y1,long double x2,long double y2);

int main(){
	long double x1,y1,r1;
	long double x2,y2,r2;
	long double ans;
	double r[2];
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x1>>y1>>r1;
		cin>>x2>>y2>>r2;
		
		ans=dis(x1,y1,x2,y2);
		
		if(ans>r1+r2){
			cout<<"0"<<endl;
		}else if(ans<=r1+r2){
				if(r2>ans+r1){
					cout<<"-2"<<endl;
					continue;
				}else if(r1>ans+r2){
					cout<<"2"<<endl;
					continue;
				}
			
			cout<<"-1"<<endl;
		}
	
	}
}

double dis(long double x1,long double y1,long double x2,long double y2){
	return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;


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

int main(){
	cin >> n;
	REP(i, n){
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		if (xa == xb&&ya == yb){
			if (ra > rb){
				cout << 2 << endl;
			}
			else{
				cout << -2 << endl;
			}
			continue;
		}
		if (sqrt(pow(xa - xb, 2) + (ya - yb, 2)) > ra + rb){
			cout << 0 << endl;
		}
		else if (sqrt(pow(xa - xb, 2) + (ya - yb, 2)) == ra + rb){
			cout << 1 << endl;
		}
		else{
			if (sqrt(pow(xa - xb, 2) + (ya - yb, 2)) == abs(ra - rb)){
				if (ra > rb){
					cout << 2 << endl;
				}
				else{
					cout << -2 << endl;
				}
			}
		}
	}
}

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

int main(void){
    int n;
    double xa,ya,ra,xb,yb,rb;
    double dx,dy,dr;
    
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        scanf("%lf %lf %lf", &xa, &ya, &ra);
        scanf("%lf %lf %lf", &xb, &yb, &rb);
        dx = xa - xb;
        dy = ya - yb;
        dr = sqrt(dx*dx + dy*dy);
        
        if (dr > ra + rb){
            printf("0\n");
        } else if (dr + ra < rb){
            printf("-2\n");
        } else if (dr + rb < ra){
            printf("2\n");
        } else {
            printf("1\n");
        }
    }
    
    return 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;
}