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 <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio( false );

	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 x = xa - xb;
		double y = ya - yb;
		double d = sqrt( x*x + y*y );

		int result = 0;
		if( d <= ra+rb ) {
			result = 1;

			if( d+ra < rb ) { result = -2; }
			if( d+rb < ra ) { result = 2; }
		}

		cout << result << endl;
	}
}

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

using namespace std;

int main()
{
	int N;
	cin >> N;
	for(size_t i = 0; i < N; i++)
	{
		long double xa , ya , ra , xb , yb , rb;
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		long double l2 = ( xa - xb )*( xa - xb ) + ( ya - yb )*( ya - yb );
		if(( ra + rb )*( ra + rb ) < l2)
		{
			cout << 0 << endl;
		} else
		{
			if(ra*ra + l2 <= rb*rb)
			{
				cout << -2 << endl;
			} else if(rb*rb + l2 <= ra*ra)
			{
				cout << 2 << endl;
			} else
			{
				cout << 1 << endl;
			}
		}
	}
}

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

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

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

	std::deque<int> number;

	for(int i = 0; i < dataSetNum; ++i){
		double xa, ya, ra, xb, yb, rb;
		std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double dis = distance(xa, ya, xb, yb);
		//"0" if A and B do not overlap
		if(dis > ra + rb) number.push_back(0);
		//"2" if B is in A
		else if(ra > rb && (dis + rb <= ra) )  number.push_back(2);
		//"-2" if A is in B
		else if(rb > ra && (dis + ra <= rb) )  number.push_back(-2);
		//"1" if circumference of A and B intersect
		else number.push_back(1);
	}
	for(int i = 0; i < dataSetNum; ++i){
		std::cout << number.front() << std::endl;
		number.pop_front();
	}
	return 0;
	}

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

int main(){
	int n;
	cin >> n;
	for(; n--; ){
		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(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++: //Circles Intersection
//2Ì~ÌSÆ¼aª^¦çê½Æ«A»Ì2ÂÌ~ªðíÁÄ¢é©Aàï³êÄ¢é©AðíçÈ¢©ð»è¹æ

//³Ä³ÄA0,0,1,0,2,1Ý½¢ÉêdÈéªÉÂ¢ÄÍÈÉà¾y³êÄ¢È¢Ì¾ª


#include<iostream>
#include<cmath>
using namespace std;

double Square(double x){return x*x;}
double Distance(double x, double y)
{
	return sqrt(Square(x) + Square(y) );
}

int main(void)
{
	int n;
	cin >> n;
	while(n--)
	{
		double ax, bx, ay, by, ar, br;
		cin >> ax >> ay >> ar >> bx >> by >> br;

		//Ql@http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1251422802

		//à~ÌSðciA¼aðriAO~ÌSðcoA¼aðroÆ·éÆ
		//|ci-co|<=ro-ri@ÈçA®SÉàï·éEEEçµ¢
		double distance = Distance(ax-bx, ay-by);
		if(distance <= br - ar)	//BªAðàï
			cout << -2 << endl;
		else if(distance <= ar - br)	//AªBðàï
			cout << 2 << endl;
		//|ci-co| <= ar+br ËaÆbÍdÈé
		else if(distance < ar+br)
			cout << 1 << endl;
		else
			cout << 0 << endl;
	}
	return 0;
}

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

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

int judge(std::vector<double> ve){
	double 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<double> 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 <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

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

double sqr(double x, double y){
	return x*x + y*y;
}
int main(){
	int n;
	double xa,ya,ra,xb,yb,rb;
	scanf("%d",&n);
	rep(i,n){
		scanf("%lf %lf %lf %lf %lf %lf",
					&xa,&ya,&ra,&xb,&yb,&rb);
		double z = sqrt(sqr(xa-xb,ya-yb));
		//printf("z:%lf   ra+rb:%lf\n",z,ra+rb);
		if( z > ra+rb ){
			puts("0");
		}else{
			if( z > ra && z > rb ){
				puts("1");
			}else if( z-ra<0 ){
				puts("2");
			}else{
				puts("-2");
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	double xa, ya, ra, xb, yb, rb, r;
	while (n--){
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		r = sqrt((xb - xa)*(xb - xa) + (yb - ya)*(yb - ya));
		if (r > ra + rb) cout << 0 << "\n";
		else if (r + ra < rb) cout << -2 << "\n";
		else if (r + rb < ra) cout << 2 << "\n";
		else if (r <= ra + rb) cout << 1 << "\n";
	}
	return 0;
}

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

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

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <cmath>
#include <cfloat>

using namespace std;

int n, out;
double x[2], y[2], r[2], dst;

int main()
{
	
	cin >> n;
	
	while(n--)
	{
		
		for( int i = 0; i < 2; i++)
		{
			cin >> x[i] >> y[i] >> r[i];
		}
		
		dst = sqrt( pow(x[1] - x[0], 2) + pow(y[1] - y[0], 2) );
		
		if( dst > r[0] + r[1] )
			out = 0;
		else if( dst > abs(r[0] - r[1]))
			out = 1;
		else 
			out = r[0] > r[1] ? 2 : -2;
		
		cout << out << endl;
		
	}
	
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#define EPS 0.000000001
using namespace std;

double X[2][60],Y[2][60],R[2][60];
int res[60];
int main(){
	int N;
	cin>>N;
	for(int i=1;i<=N;i++){
		for(int j=0;j<2;j++){
			cin>>X[j][i]>>Y[j][i]>>R[j][i];
		}
	}

	double re;
	for(int i=1;i<=N;i++){
		re=pow(X[0][i]-X[1][i],2)+pow(Y[0][i]-Y[1][i],2);
		if(re>=pow(R[0][i]+R[1][i],2)){
			res[i]=0;
		}
		else if(re>=pow(R[0][i]-R[1][i],2)){
			res[i]=1;
		}
		else if(R[0][i]>R[1][i]){
			res[i]=2;
		}
		else res[i]=-2;
	}
	for(int i=1;i<=N;i++){
		cout<<res[i]<<endl;
	}
	return 0;
}