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;

const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);

using Point = complex<double>;
using Polygon = vector<Point>;

inline int sgn(const double &a) { return (a < -EPS ? -1 : (a > EPS ? 1 : 0)); }

inline bool eq(const Point &a, const Point &b) { return abs(a - b) < EPS; }

inline bool operator<(const Point &a, const Point &b){
    if (sgn(a.real() - b.real()))
        sgn(a.real() - b.real()) < 0;
    return sgn(a.imag() - b.imag());
}

double dot(const Point &a, const Point &b) { return real(conj(a) * b); }

double det(const Point &a, const Point &b) { return imag(conj(a) * b); }

struct Line {
    Point p1, p2;

    Line(Point p1 = Point(), Point p2 = Point()) : p1(p1), p2(p2) {}

    bool operator<(const Line &rhs) const {
        if (eq(p2, rhs.p2))
            return p1 < rhs.p1;
        return p2 < rhs.p2;
    }
    bool operator==(const Line &rhs) const {
        return (eq(p1, rhs.p1) && eq(p2, rhs.p2)) ||
               (eq(p1, rhs.p2) && eq(p2, rhs.p1));
    }
};

struct Circle{
    Point p;
    double r;
    Circle(Point p=Point(), double r=0):p(p),r(r){}
};

int intersect_circle(Circle a, Circle b){
    double dsq = norm(a.p - b.p);
    double rs = (a.r + b.r) * (a.r + b.r);
    double rd = (a.r - b.r) * (a.r - b.r);
    if(dsq > rs)return 0;
    else if(dsq <= rs && dsq >= rd)return 1;
    else if(a.r > b.r)return 2;
    else return -2;
}

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;
        cout << intersect_circle(Circle(Point(xa, ya), ra), Circle(Point(xb, yb), rb)) << endl;
    }

    return 0;
}

C++: //Circles Interesection
#include<bits/stdc++.h>
using namespace std;

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

int main(){
  int n;
  cin >> n;
  for(int i=0; i<n; i++){
    double xa, ya, ra, xb, yb, rb, d;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;
    d = dis(xa, ya, xb, yb);
    if(d > ra+rb) cout << "0" << endl;
    else if(d+rb < ra) cout << "2" << endl;
    else if(d+ra < rb) cout << "-2" << endl;
    else cout << "1" << endl;
  }
  return 0;
}

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

int state_circles(const std::vector<double> &a, const std::vector<double> &b){
	double d;
	d = sqrt(pow(a[0] - b[0], 2) + pow(a[1] - b[1], 2));
	if((a[2] + b[2]) < d)
		return 0;
		if(std::abs(a[2] - b[2]) > d){
		if(a[2] > b[2])
			return 2;
		else 
			return 2;
	}
	
	else 
		return 1;
}

int main(){
	std::vector<double> a(3), b(3);
	int data_num;
	std::cin >> data_num;
	for(int i = 0; i < data_num; ++i){ 
		std::cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2];
		std::cout << state_circles(a, b) << std::endl;
	}
	
	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(abs(ra-rb)>sqrt(pow(xa-xb,2)+pow(ya-yb,2))){if(ra>rb)cout<<2<<endl;}else cout<<-2<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

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

using namespace std;

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

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

int main(){
	
	int data;
	
	std::cin >> data;  //dataset
	
	std::array<double, data>xa;
	std::array<double, data>ya;
	std::array<double, data>ra;
	std::array<double, data>xb;
	std::array<double, data>yb;
	std::array<double, data>rb;
	
	for(int i=0; i<data; ++i){
		std::cin >> xa[i];
		std::cin >> ya[i];
		std::cin >> ra[i];
		std::cin >> xb[i];
		std::cin >> yb[i];
		std::cin >> rb[i];
	}
	
	double length;  //a-b length;
	
	length = hypot(abs(xa-xb),abs(ya-yb));
	
	if(length > ra+rb){
		std::cout << 0 << std::endl;
	}else if(length + rb < ra){
		std::cout << 2 << std::endl; 
	}else if(length + ra < rb){
		std::cout << -2 << std::endl; 
	}else{
		std::cout << 1 << std::endl; 
	}
	
	return 0;
}

C++: #include<iostream>
#include<complex>
#include<cmath>
#include<map>
#define fs first
#define sc second
#define EPS 0
using namespace std;


typedef complex<double> P;
typedef pair<P,int> C;

int cpr(C a,C b){
  double d = abs(a.fs-b.fs);
  if(a.sc+b.sc + EPS < d)return -1;      //no intersection (outside)
  if(b.sc+d + EPS < a.sc)return 1;       //no intersection (inside,B in A)
  if(a.sc+d + EPS < b.sc)return 2;       //no intersection (inside,A in B)
  if(abs(a.sc+b.sc - d) < EPS)return -3; //one cross point (outside)
  if(abs(b.sc+d - a.sc) < EPS)return 3;  //one cross point (inside,B in A)
  if(abs(a.sc+d - b.sc) < EPS)return 4;  //one cross point (inside,A in B)
  return 0;                              //two cross point
}


int main(){
  double ax,ay,ar,bx,by,br;

  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin>> ax >> ay >> ar >> bx >> by >> br;
    C a = C(P(ax,ay),ar), b = C(P(bx,by),br);
    int v = cpr(a,b);
    if(v==1)cout <<  2 << endl;
    else if(v==2)cout << -2 << endl;
    else if(v==-1)cout << 0 << endl;
    else cout << 1 << endl;

  }
}

C++: #include <iostream>

using namespace std;


int main()
{
  int i;
  cin>>i;
  for(;i--;)
    {

      double xa,ya,ra,xb,yb,rb;     
      int ans;
      cin>>xa>>ya>>ra>>xb>>yb>>rb;
      double d = (xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
      if(d  > ((ra+rb)*(ra+rb)))
	ans = 0;
      else if (d < ((ra-rb)*(ra-rb)) && ra>rb)
	ans = 2;
      else if (d  < ((rb-ra)*(rb-ra)) && rb>ra)
	ans =-2;
      else
	ans =1;
      cout<<ans<<endl;

    }

}

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)
#define EPS 1e-6

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 = sqr(xa-xb,ya-yb);
		//printf("z:%lf   ra+rb:%lf\n",z,ra+rb);
		if( z > (ra+rb)*(ra+rb) ){
			puts("0");
		}else{
			if( z>ra*ra && z>rb*rb ){
				puts("1");
			}else if( 0>z-(ra*ra) ){
				puts("2");
			}else{
				puts("-2");
			}
		}
	}
	return 0;
}