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<iostream>
#include<math.h>
using namespace std;

int main(){
	
	int n,z;
	double x1,y1,r1;
	double x2,y2,r2;
	
	cin>>n;
	
	for(int i=0;i<n;i++){
		cin >> x1 >> y1 >> r1 ;
		cin >> x2 >> y2 >> r2 ;
		
		double m = sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) ) ;
		
		if( r1 >= m+r2 ) z=2;
		else if( r2 > m+r1 ) z=-2;
		else{
			if( r1+r2 >= m ) z=1;
			else z=0;
		}
		
		cout << z << 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>
using namespace std;

int collision_detection(double x1, double y1, double x2, double y2, double r1, double r2){
	double d = ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
	double sr = ((r1+r2)*(r1+r2));
	double dr = ((r1-r2)*(r1-r2));
	if( d > sr ){
		return 0;
	}else if( d < sr && dr < d){
		return 1;
	}else if(dr > d){
		return (r1>r2)? 2 : -2;
	}else{
		return 1;
	}
}

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

	cin >> n;
	for(int i=0 ; i<n ; i++){
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		ans = collision_detection( xa, ya, xb, yb, ra, rb);
		cout << ans << endl;
	}
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    double xa, ya, ra, xb, yb, rb;
    int n;
    cin >> n;
    rep(i, n)
    {
        cin >> xa >> ya >> ra >> xb >> yb >> rb;
        double d = sqrt(pow((xa - xb), 2) + pow(ya - yb, 2));
        if (d > ra + rb)
            OP(0);
        else
        {
            if (d + rb < ra)
                OP(2);
            else if (d + ra < rb)
                OP(-2);
            else
                OP(1);
        }
    }

    return 0;
}

C++: #include <stdio.h>
#include <math.h>
typedef struct En{
	double x,y,r;
};
int main(){
	En a,b;
	double dist,r;
	int n;
	scanf("%d",&n);
	while(n--){
		scanf("%lf%lf%lf%lf%lf%lf",&a.x,&a.y,&a.r,&b.x,&b.y,&b.r);
		dist = (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
		dist = sqrt(dist);
		//a.r = a.r*a.r;b.r = b.r*b.r;
		if(dist>a.r+b.r) printf("0\n");
		else if(a.r>b.r+dist) printf("2\n");
		else if(b.r>a.r+dist) printf("-2\n");
		else printf("1\n");
	}
	return 0;
}

C++: #include    <iostream>
#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(pow(xa - xb, 2.0) + pow(ya - yb, 2.0));
        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++: #include <iostream>
#include <cmath>
#include <vector>
#include <cstdio>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,r,n) for(int i=r;i<(int)n;i++)
using namespace std;
int in(){int x;cin>>x;return x;}
int n;
vector<int> a,b,c;

int main ()
{
	cin>>n;
	while(n--)
	{
		double ax,ay,ar,bx,by,br;
		cin>>ax>>ay>>ar>>bx>>by>>br;
		double half=sqrt((bx-ax)*(bx-ax)+(by-ay)*(by-ay));
		if(half-ar-br>0)
		{
			cout<<0<<endl;
		}
		else if(half-ar-br<=0&&half-ar-br>min(-1*ar,-1*br))
		{
			cout<<1<<endl;
		}
		else
		{
			if(ar>br)
			{
				cout<<2<<endl;
			}
			else cout<<-2<<endl;
		}
	}

	return 0;
}

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

double dist(double dx, double dy){
	return sqrt(pow(dx, 2) + pow(dy, 2));
}

int main(){
	int N;
	double xa, ya, ra, xb, yb, rb;
	int res;
	double p_d;
	
	scanf("%d", &N);
	
	for(int i = 0; i < N; i++){
		scanf("%lf%lf%lf%lf%lf%lf", &xa, &ya, &ra, &xb, &yb, &rb);
		
		p_d = dist(xa - xb, ya - yb);
		
		if(ra + rb < p_d) res = 0;
		else if(p_d + ra < rb) res = -2;
		else if(p_d + rb < ra) res = 2;
		else res = 1;
		
		printf("%d\n", res);
	}
	
	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
  float x1, y1, r1, x2, y2, r2;
  int n, ans;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    float r = r1 + r2;
    float d = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));

    if(d > r) ans = 0;
    else if(r1 > r2) {
      if(d + r2 < r1) ans = 2;
      else ans = 1;
    }
    else if(r1 < r2) {
      if(d + r1 < r2) ans = -2;
      else ans = 1;
    }
    else if(r1 = r2){
      ans = 1;
    }
    cout << ans << endl;
  }
    
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main (){

  int n,d[1000];
  
  double a[6],b,c;
  
  cin >>n;

  for(int j=0 ; j < n ; j++){
    
    for(int i=0 ; i < 6 ; i++){
      cin >> a[i];
    }
    
    c=(a[0]-a[3])*(a[0]-a[3])+(a[1]-a[4])*(a[1]-a[4]);
    b=sqrt(c);
    
    
    if( a[2]-b> a[5]){
      d[j]=2;
    }else if( a[5]-b > a[2] ){
      d[j]=-2;
    }else if( -b < a[5]-a[2] && a[5]-a[2] < b ){
      d[j]=0;
    }else{
      d[j]=1;
    }
    
  }

  for( int i=0 ; i < n ; i++){
    cout<<d[i]<<endl;
  }
  
  return 0;
  
}