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	<cstdio>
#include	<cmath>

using namespace std;

int main(void) {
	while(1) {
		int ds;
		cin >> ds;
		if( cin.eof() )		break;
		
		for(int i = 0; i < ds; i++) {
			double d, r1[3], r2[3];
			for(int j = 0; j < 3; j++)
				cin >> r1[j];
			for(int j = 0; j < 3; j++)
				cin >> r2[j];
			
			d = (r2[0] - r1[0]) * (r2[0] - r1[0]) + (r2[1] - r1[1]) * (r2[1] - r1[1]);
			
			if( d < abs(r1[2] - r2[2]) ) {
				cout << "2" << endl;
			}else if( d < abs(r2[2] - r1[2]) ) {
				cout << "-2" << endl;
			}else if( (abs(r1[2] - r2[2]) < d && d < r1[2] + r2[2]) || d == r1[2] + r2[2] ) {
				cout << "1" << endl;
			}else {
				cout << "0" << endl;
			}
		}
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
#define EPS 1e-9
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( (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) < (ra-rb)*(ra-rb) && rb < ra )
			puts("2");
		//AがB中にあるか(境界ふくまない)
		else if( (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) < (ra-rb)*(ra-rb) && 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 <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

int main(void){
	double x[2],y[2],r[2];
	int n;
	cin >> n;
	rep(i,n){
		rep(j,2) cin >> x[j] >> y[j] >> r[j];
		double D=norm(x[1]-x[0])+norm(y[1]-y[0]);
		double RG=norm(r[1]+r[0]);
		double RL=norm(r[1]-r[0]);
		if(RG<D)
			cout << 0 << endl;
		else if(RL<=D && D<=RG)
			cout << 1 << endl;
		else{
			if(r[0]<r[1])
				cout << -2 << endl;
			else
				cout << 2 << endl;
		}
	}
}

C++: #include<iostream>
#include<complex>
using namespace std;
typedef complex<double> P;

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )

int main(){
	P x,y;
	double r1,r2,dis;
	int n;
	cin>>n;
	while(n--){
		cin>>x.real()>>x.imag()>>r1>>y.real()>>y.imag()>>r2;
		dis=abs(x-y);
		if(dis>r1+r2){
			cout<<"0"<<endl;
		}else if(dis<=r1){
			cout<<"2"<<endl;
		}else if(dis<=r2){
			cout<<"-2"<<endl;
		}else{
			cout<<"1"<<endl;
		}
	}
	return 0;
}

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

inline float distance_pow2(float xa, float ya, float xb, float yb){
	return (xa - xb)*(xa - xb) + (ya - yb)*(ya - yb);
}

inline int judge(std::vector<float> ve){
	float center_dis = distance_pow2(ve[0], ve[1], ve[3], ve[4]);
	float r_dis = (ve[2] + ve[5])*(ve[2] + ve[5]);
	if(center_dis > r_dis){
		return 0;	
	}else{
		if(center_dis <= ve[2]*ve[2] || center_dis <= ve[5]*ve[5]){
			return ve[2] > ve[5] ? 2 : -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++: // AOJ 0023
#include<iostream>
#include<cmath>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const long double EPS = 1e-6;

long double sq(long double x) {
  return x * x;
}

long double abs(long double x) {
  return (x > 0 ? x : -x);
}
/*
bool eq(long double x, long double y) {
  return abs(x - y) < EPS;
}*/

long double dist(long double xa, long double ya, long double xb, long double yb) {
  return sq(xa - xb) + sq(ya - yb);
}

int main() {
  int n;
  cin >> n;
  REP(i, n) {
    long double xa, ya, ra, xb, yb, rb;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;

    long double d = sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb));
    
    if (ra - rb > d + EPS) {
      cout << 2 << endl;
    } else if (rb - ra > d + EPS) {
      cout << -2 << endl;
    } else if (d > ra + rb + EPS) {
      cout << 0 << endl;
    } else {
      cout << 1 << endl;
    }
  }
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

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

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

int n;

void solve()
{
	double nx,ny,nr,mx,my,mr,pdist;


	cin >> nx >> ny >> nr >> mx >> my >> mr;
	pdist = sqrt(pow((nx-mx), 2.0) + pow((ny-my),2.0));

	if(pdist - nr + mr <= 0.0){
		cout << 2 << endl;
	}
	else if((pdist - mr + nr <= 0.0)){
		cout << -2 << endl;
	}
	else if(pdist - mr - nr > 0.0){
		cout << 0 << endl;
	}
	else {
		cout << 1 << endl;
	}
}

int main(void)
{
	cin >> n;
	while(--n, n>=0){
		solve();
	}
	return 0;
}

C++: #include<iostream>
#include<complex>
#define EPS 0
using namespace std;

typedef complex<double>P;

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		double ra,rb;
		P pa,pb;
		
		cin>>pa.real()>>pa.imag()>>ra;
		cin>>pb.real()>>pb.imag()>>rb;
		double d=abs(pa-pb);
		if(d+ra-rb<=EPS)cout<<-2<<endl;
		else if(d+rb-ra<=EPS)cout<<2<<endl;
		else if(d-ra-rb<=EPS)cout<<1<<endl;
		else cout<<0<<endl;
	}
}

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

int main(void){
	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 = sqrt( (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) );

		if( ra+rb < d )
			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;
}

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

using namespace std;

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