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++: /*
 *	
 *	Created by Ziyi Tang
 *	
 */

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
using namespace std;
#define INF (int)1E9
#define INFL (long)1E18
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef vector<vpi> vvpi;
const int dir[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};


int main(){
	int test;
	cin >> test;
	while(test--){
		double x1,y1,r1,x2,y2,r2;
		cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
		double up1 = y1+r1;
		double down1 = y1-r1;
		double left1 = x1-r1;
		double right1 = x1+r1;

		double up2 = y2+r2;
		double down2 = y2-r2;
		double left2 = x2-r2;
		double right2 = x2+r2;
		int flag = -10;

		if ((left1 >= left2 && right1 < right2 && up1 < up2 && down1 > down2) ||
			(left1 > left2 && right1 <= right2 && up1 < up2 && down1 > down2) ||
			(left1 > left2 && right1 < right2 && up1 <= up2 && down1 > down2) ||
			(left1 > left2 && right1 < right2 && up1 < up2 && down1  > down2)){
				flag = -2;
		}
		if ((left1 <= left2 && right1 > right2 && up1 > up2 && down1 < down2) ||
			 (left1 < left2 && right1 >= right2 && up1 > up2 && down1 < down2) ||
			 (left1 < left2 && right1 > right2 && up1 >= up2 && down1 < down2) ||
			 (left1 < left2 && right1 > right2 && up1 > up2 && down1  < down2)){
				flag = 2;
		}
		if (flag == -10){
			double dis = -1 ;
			dis = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
			if (dis > r1+r2){
				flag = 0;
			}
			else{
				flag = 1;
			}
		}
		
		cout << flag << endl;
	}





	return 0;
}

C++: #include <iostream>
int main()
{
  int n;
  double xa, ya, ra, xb, yb, rb;
  std::cin >> n;
  while (n--) {
    std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
    double d = (xa - xb) * (xa - xb) + (ya - yb) * (ya - yb);
    if (d - (ra + rb) * (ra + rb) > 0) {
      std::cout << 0 << std::endl;
    } else if (d < (ra * ra > rb * rb ? ra: rb)) {
      if (ra < rb) {
        std::cout << -2 << std::endl;
      } else if (ra > rb) {
        std::cout << 2 << std::endl;
      }
    } else {
      std::cout << 1 << std::endl;
    }
  }
}

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

int main(int argc, char *argv[]) {
	int dataN;
	scanf("%d", &dataN);
	//cin>>dataN;
	for (int i = 0; i < dataN; i++) {
		double ax, ay, ra, bx, by, rb;
		scanf("%f %f %f %f %f %f", &ax, &ay, &ra, &bx, &by, &rb);
		//cin>>ax>>ay>>ra>>bx>>by>>rb;
		double d = (ax-bx)*(ax-bx) + (ay-by)*(ay-by);

		d = sqrt(d);

		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++: //#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <iomanip>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <functional>
//#include <time.h>
//#include <sstream>
//#include <queue>

using namespace std;


int main(){

	int n, ans;
	double xa, ya, ra, xb, yb, rb;
	double R;

	cin >> n;

	while (n--){
		cin >> xa >> ya >> ra >> xb >> yb >> rb;

		R = sqrt((xa - xb)*(xa - xb) + (ya - yb)*(ya - yb));

		if (R > ra + rb){
			ans = 0;
		}
		else{
			ans = 1;
			if (ra > R + rb)ans = 2;
			if (rb > R + ra)ans = -2;
		}

		cout << ans << endl;

	}

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