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;

typedef struct{
  double x,y,r;
}Circle_t;


inline double dist(Circle_t a, Circle_t b){
  return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) );
}

int main(){

  int n;
  Circle_t a,b;

  cin >> n;
  for(int i=0; i<n; i++){
    cin >> a.x >> a.y >> a.r >> b.x >> b.y >> b.r;

    if( a.r + b.r < dist(a,b) ) cout << 0 << endl;

    else if(a.r-b.r > dist(a,b)) cout << 2 << endl;

    else if(b.r-a.r > dist(a,b)) cout << -2 << endl;

    else cout << 1 << endl;

  }

  return 0;
}

C++: #include <iostream>
using namespace std;
 
struct circle{
    double x;
    double y;
    double r;
};
 
int judge_intersection(circle ca, circle cb){
    double dis2 = (ca.x - cb.x) * (ca.x - cb.x)
                + (ca.y - cb.y) * (ca.y - cb.y);
    if((ca.r > cb.r) && ((ca.r - cb.r) * (ca.r - cb.r) > dis2)){
        return 2;
    } else if((cb.r > ca.r) && ((ca.r - cb.r) * (ca.r - cb.r) > dis2)){
        return -2;
    } else if((ca.r + cb.r) * (ca.r + cb.r) >= dis2){
        return 1;
    } else {
        return 0;
    }
}
 
int main()
{
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        circle ca, cb;
        cin >> ca.x >> ca.y >> ca.r
            >> cb.x >> cb.y >> cb.r;
        cout << judge_intersection(ca, cb) << endl;
    }
    return 0;
}

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){
		int x = number.front();
		std::cout << x << std::endl;
		number.pop_front();
	}
	return 0;
	}

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

using namespace std;

int check(double *l, double *s);

int main()
{
	int n, ans;
	double a[3], b[3];	//[0]:x[1]:y[2]:r

	cin >> n;

	for (int i=0; i<n; i++)
	{
		cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2];

		if(a[2] > b[2]) {		//aを大きい円、bを小さい円としたとき
			ans = check(&a[0], &b[0]);
		}
		else {					//bを大きい円、aを小さい円としたとき
			ans = check(&b[0], &a[0]);
			ans *= (ans == 2) ? -1 : 1;		//aがbの中にあるときの処理
		}

		cout << ans << endl;
	}

	return 0;
}

int check(double *l, double *s)	//円の重なり・内外を判定
{
	double d = (l[0]-s[0])*(l[0]-s[0]) + (l[1]-s[1])*(l[1]-s[1]);

	d = sqrt(d);

	if(d <= l[2]-s[2]) {	//小さい円が大きい円の内側にあるとき
		return 2;
	}
	else if(l[2]-s[2] < d && d < l[2]+s[2]) {	//円周が交わっているとき
		return 1;
	}
	else {
		return 0;	//外側にあるとき
	}
}

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

int main(){
	int n;
	cin>>n;
	double xa,ya,xb,yb,ra,rb;
	for(int i=0;i<n;i++){
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		if(abs(ra+rb)<sqrt(pow(xa-xb,2)+pow(ya-yb,2))){cout<<0<<endl;}
		else if(abs(ra+rb)>=sqrt(pow(xa-xb,2)+pow(ya-yb,2)) && abs(ra-rb)<=sqrt(pow(xa-xb,2)+pow(ya-yb,2))){cout<<1<<endl;}
		else{if(ra>rb){cout<<2<<endl;}else{cout<<-2<<endl;}}
	}
	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 <cstdio>
#include <cmath>

using namespace std;

int main(void){
	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);
		if(sqrt(pow(xb - xa,2.0) + pow(yb - ya,2.0)) + rb < ra){
			printf("2\n");
		}else if(sqrt(pow(xb - xa,2.0) + pow(yb - ya,2.0)) + ra < rb){
			printf("-2\n");
		}else if(sqrt(pow(xb - xa,2.0) + pow(yb - ya,2.0)) < ra + rb){
			printf("1\n");
		}else{
			printf("0\n");
		}
	}
	return 0;
}

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

using namespace std;

void solve()
{
	double xa, ya, ra;
	double xb, yb, rb;
	int n;
	cin >> n;
	while(n--)
	{
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double dist = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
		if(dist > ra + rb)
		{
			cout << 0 << endl;
		}
		else if(dist + rb < ra)
		{
			cout << 2 << endl;
		}
		else if(dist + ra < rb)
		{
			cout << -2 << endl;
		}
		else
		{
			cout << 1 << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
using namespace std;

#define ISEQ(c) (c).begin(), (c).end()
typedef long long ll;

int main() {
  int n;
  cin >> n;
  double x[2], y[2], r[2];
  const double EPS = 1e-13;
  for (int z = 0; z < n; z++) {
    cin >> x[0] >> y[0] >> r[0];
    cin >> x[1] >> y[1] >> r[1];
    double cdif = sqrt((x[0]-x[1])*(x[0]-x[1]) - (y[0]-y[1])*(y[0]-y[1]));
    if (cdif+r[0]-r[1] < EPS) cout << -2 << endl;
    else if (cdif+r[1]-r[0] < EPS) cout << 2 << endl;
    else if (cdif-r[0]-r[1] < EPS) cout << 1 << endl;
    else cout << 0 << endl;
  }
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
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(ra+rb<d) cout<<0<<endl;
    else if( ra-rb<=d && ra+rb>=d ) cout<<1<<endl;
    else if(ra-rb>d) cout<<2<<endl;
    else cout<<-2<<endl;
  }
  return 0;
}