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 <cmath>

double dist(double xa, double ya, double xb, double yb)
{
    return sqrt((xb - xa) * (xb - xa) + (yb - ya) * (yb - ya));
}

int main()
{
    int n;
    std::cin >> n;

    for (int i = 0; i < n; ++i) {
        double xa, ya, ra, xb, yb, rb;
        std::cin >> xa >> ya >> ra >> xb >> yb >> rb;

        double d = dist(xa, ya, xb, yb);
        if (d > ra + rb) std::cout << "0\n";
        else {
            if (d + rb < ra) std::cout << "2\n";
            else if (d + ra < rb) std::cout << "-2\n";
            else std::cout << "1\n";
        }
    }
}

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

int main()
{
	int n, t;
	double x1, y1, r1, x2, y2, r2;
	double d;

	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &r1, &x2, &y2, &r2);

		d = (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1);
		if (d < (r2-r1)*(r2-r1)){
			if (r2 < r1) t = 2;
			else if (r2 > r1) t = -2;
		}else if (d >= (r1 + r2)*(r1 + r2)) t = 0;
		else if (d == (r1 + r2)*(r1 + r2) || d == (r2 - r1)*(r2 - r1)) t = 1;

		printf("%d\n", t);
	}

	return 0;
}

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

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


#define X real()
#define Y imag()
typedef complex<double> P;

int main(){
	  
	while(1){
		int n;
		cin>>n;
		
		double xa,ya,ra,xb,rb,yb;
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		
		P a = P(xa,ya);
		P b = P(xb,yb);
		
		double c = abs(a-b);
		
		if(c<=ra && c<=rb){
			if(ra>rb)puts("2");
			else puts("-2");
			continue;
		}
		if(ra+rb<c){
			puts("0");
			continue;
		}
		puts("1");
	}
	
}

C++: #include <iostream>
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 = (xb - xa) * (xb - xa) + (yb - ya) * (yb - ya);
		if (d <= (rb - ra)*(rb - ra)){
			cout << -2 << endl;
		}
		else if (d <= (ra - rb)*(ra - rb)){
			cout << 2 << endl;
		}
		else if (d >(ra + rb)*(ra + rb)){
			cout << 0 << endl;
		}
		else{
			cout << 1 << 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-9;

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 (sq(ra) > d + EPS) {
      cout << 2 << endl;
    } else if (sq(rb) > d + EPS) {
      cout << -2 << endl;
    } else if (eq(sq(ra + rb), d)) {
      cout << 1 << endl;
    } else if (d < sq(ra + rb)) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
}

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

inline float distance(float xa, float ya, float xb, float yb){
	return std::sqrt(pow(xa - xb, 2) + pow(ya - yb, 2));
}

int judge(std::vector<float> ve){
	float center_dis = distance(ve[0], ve[1], ve[3], ve[4]);
	if(center_dis > ve[2] + ve[5]){
		return 0;	
	}else if(ve[2] >= center_dis + ve[5]){
		return 2;
	}else if(ve[5] >= center_dis + ve[2]){
		return -2;
	}else{
		return 1;
	}
}

int main(void){
	int num;
	std::vector<float> ve(6);

	std::cin >> num;

	for(int i = 0; i < num; ++i){
		std::cin >> ve[0] >> ve[1] >> ve[2] >> ve[3] >> ve[4] >> ve[5];
		
		std::cout << judge(ve) << std::endl;
	}
	return 0;
}

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

using namespace std;
int main(void)
{
	double xa, ya, ra, xb, yb, rb;
	int n;
	
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);
		
		if ((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb) <= (ra + rb) * (ra + rb)){
			
			if ((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb) + rb * rb <= ra * ra){
				printf("2\n");
			} 
			else if ((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb) + ra * ra <= rb * rb){
				printf("-2\n");
			}
			else printf("1\n");
		}
		else {
			printf("0\n");
		}
	}
			
	
	
	return (0);
}

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

#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) REP (i, 0, n)
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;

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

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=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
		if(d>r1+r2)
			cout<<0<<endl;
		else if(d<r1-r2)
			cout<<2<<endl;
		else if(d<r2-r1)
			cout<<-2<<endl;
		else
			cout<<1<<endl;
	}
}

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

int main(){
	double x[2];
	double y[2];
	double r[2];
	double dist;
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> x[0] >> y[0] >> r[0] >> x[1] >> y[1] >> r[1];
		dist = hypot(x[0] - x[1], y[0] - y[1]);
		if(r[0] > dist + r[1]){
			printf("2\n");
		}else if(r[1] > dist + r[0]){
			printf("-2\n");
		}else if(r[0] + r[1] < dist){
			printf("0\n");
		}else{
			printf("1\n");
		}
	}
	return 0;
}

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

int main(){
    int N;
    double xa, ya, ra, xb, yb, rb;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >>xa>>ya>>ra>>xb>>yb>>rb;

        double rsum = (ra+rb)*(ra+rb), rdiff = ra-rb;
        ra-rb < 0 ? rdiff = -rdiff*rdiff : rdiff = rdiff*rdiff;
        double cntr_dst = (xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
        if(rdiff>cntr_dst){
            cout << 2;
        }else if(-rdiff>cntr_dst){
            cout << -2;
        }
        else if(rsum>cntr_dst && cntr_dst>fabs(rdiff)){
            cout << 1;
        }
        else if(rsum<cntr_dst){
            cout << 0;
        }
        cout << endl;
    }
    return 0;
}