Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var xa, ya, ra, xb, yb, rb float64
		fmt.Scan(&xa, &ya, &ra, &xb, &yb, &rb)
		distance := math.Sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya))
		if rb+distance < ra {
			fmt.Println(2)
		} else if ra+distance < rb {
			fmt.Println(-2)
		} else if rb+ra >= distance {
			fmt.Println(1)
		} else {
			fmt.Println(0)
		}
	}
}

C++: #include <iostream>
#include <cmath>
#define absolute(x) x > 0 ? x : -x
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;
		int result;
		double d = sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));
		if (d+rb < ra) result = 2;
		else if (d+ra < rb) result = -2;
		else if (d <= ra+rb) result = 1;
		else result = 0;
		cout << result << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <stdlib.h>
#include <math.h>
using namespace std;
int main()
{
	int N;
	cin>>N;
	while(N--){
		int ans;
		double ax,ay,ar,bx,by,br;
		cin>>ax>>ay>>ar>>bx>>by>>br;
		double x;
		x=sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
		if(x>(ar+br))ans=0;
		else if(abs(ar-br)<=x)ans=1;
		else if(ar>br)ans=2;
		else ans=-2;
		cout<<ans<<endl;
	}
    return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;

int main()
{
  int n,i;
  double xa,ya,ra,xb,yb,rb;
  double dist;

  cin>>n;
  rep(i,n){

    cin>>xa>>ya>>ra>>xb>>yb>>rb;
    dist=sqrt( (xa-xb)*(xa-xb)+(ya-yb)*(ya-yb) );

    if(dist>ra+rb)
      cout<<"0"<<endl;
    else if(rb<dist || ra<dist || dist==0)
      cout<<"1"<<endl;
    else if(rb<ra)
      cout<<"2"<<endl;
    else if(ra<rb)
      cout<<"-2"<<endl;
  }
}

C++: #include <stdio.h>
#include <math.h>
int main() {int N;double x1,x2,y1,y2,r1,r2;while (scanf("%d",&N)!=EOF) {if (!N) return 0;while (N--) {scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&r1,&x2,&y2,&r2);double a1=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));if (fabs(r1-r2)>a1) {if (r1>r2) puts("2"); else if (r1<r2) puts("-2"); else puts("1");} else {(a1<=r1+r2)?puts("1"):puts("0");}}}}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    double o[2][3],d;
    for(int i=0; i<2; i++) for(int j=0; j<3; j++) cin >>o[i][j];
    d = sqrt((o[1][0]-o[0][0])*(o[1][0]-o[0][0])+(o[1][1]-o[0][1])*(o[1][1]-o[0][1]));
    if(o[0][2]+o[1][2]<d) cout <<"0"<<endl;
    else if(o[0][2]>o[1][2]){
      if(o[0][2]-o[1][2] > d) cout <<"2"<<endl;
      else cout <<"1"<<endl;
    }
    else{
      if(o[1][2]-o[0][2] > d) cout <<"-2"<<endl;
      else cout <<"1"<<endl;
    }
  }
  return 0;
}

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

const double PI = 3.141592;

int main(){
	int n, result;
	double xa, ya, ra, xb, yb, rb;
	cin >> n;
	for ( int i = 0; i < n; ++i ){
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		
		double d = sqrt( pow( xa - xb, 2.0 ) + pow( ya - yb, 2.0 ) );

		if ( d > ra + rb ) result = 0;
		else if ( d < ra - rb ) result = 2;
		else if ( d < rb - ra ) result = -2;
		else result = 1;

		cout << result << endl;
	}

	return 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);
}