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 <vector>
#include <cmath>

int main(int argc, char* argv[]){

	using namespace std;

	int N;
	vector<int> result;
	cin >> N;
	for (int i=0; i<N; ++i){
		double xa,ya,ra,xb,yb,rb;
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double distance = sqrt(pow((yb - ya),2) + pow((xb - xa), 2));
		if (distance > (ra + rb)){
			result.push_back(0);
		}
		else if (distance < fabs(ra - rb)){
			result.push_back(2);
		}
		else{
			result.push_back(1);
		}
	}
	vector<int>::iterator it = result.begin();
	while (it != result.end()){
		cout << *it << endl;
		++it;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
using namespace std;

int main(){

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

    if( ra > d + rb ) ans = 2;
    else if( rb > d + ra ) ans = -2;
    else if( (ra)+(rb) >= d ) ans = 1;


    cout << ans << endl;
  }

  return 0;
}

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

double get_distance( double xa, double ya, double xb, double yb )
{
	return sqrt( ( xb - xa ) * ( xb - xa ) + ( yb - ya ) * ( yb - ya ) );
}

bool is_collision( double xa, double ya, double ra, double xb, double yb, double rb )
{
	double distance = get_distance( xa, ya, xb, yb );
	return distance <= ra + rb ? true : false;
}

int check( double xa, double ya, double ra, double xb, double yb, double rb )
{
	double distance = get_distance( xa, ya, xb, yb );
	if ( distance + rb < ra ) return 2;
	else if ( distance + ra < rb ) return -2;
	else return 1;
}

int main( void )
{
	double xa, ya, ra, xb, yb, rb;
	int n; cin >> n;
	for ( int i = 0; i < n; i++ )
	{
		cin >> xa >> ya >> ra >> xb >> yb >> rb;

		if ( is_collision( xa, ya, ra, xb, yb, rb ) )
		{
			cout << check( xa, ya, ra, xb, yb, rb ) << endl;
		}
		else
		{
			cout << 0 << endl;
		}

	}
	return 0;
}

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

using namespace std;

double distance( double y1, double x1, double y2, double x2){
  return sqrt( (y1 - y2) * (y1 - y2) + (x1 - x2) * (x1 - x2));
}
int main(){
  int q;
  cin >> q;
  while(q--){
    double xa, ya, ra, xb, yb, rb;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;
    double d = distance( ya, xa, yb, xb);

    int ret = 0;
    if( d < ra - rb) ret = 2;
    else if( d < rb - ra) ret = -2;
    else if( d == ra + rb || d == ra - rb) ret = 1;

    cout << ret << endl;
  }
}

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 double abs(double x)
 {
   if(x<0) return -x;
   else return x;       
 }
  
 int main()
 {
   int n;
   int result;
   cin>>n;
   double xa,ya,ra,xb,yb,rb;
   while(n--)
   {
     cin>>xa>>ya>>ra>>xb>>yb>>rb;
     double dis=sqrt(pow(yb-ya,2)+pow(xb-xa,2));
     if(dis>ra+rb) result=0;
     else if(dis>abs(ra-rb)) result=1;
     else
     {
       if(dis+ra<=rb) result=-2;
       else if(dis+rb<=ra) result=2;    
     }        
   }
   cout<<result<endl;
   //while(1);      
   return 0;    
 }

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.ci", "r", stdin);
	string str = "";
	int n;

	getline (cin, str );
	stringstream ssn(str);
	ssn >> n;

	int i;
	for (i = 0; i < n; ++i){
		getline (cin, str );
		vector <double> cx (2, 0.0);
		vector <double> cy (2, 0.0);
		vector <double> r  (2, 0.0);
		stringstream ss(str);
		ss >> cx[0] >> cy[0] >> r[0] >> cx[1] >> cy[1] >> r[1];

		double d = sqrt ( (cx[1] - cx[0])*(cx[1] - cx[0]) + (cy[1] - cy[0])*(cy[1] - cy[0]) );
		if (d >= 0 && d < fabs (r[1] - r[0])){
			if (r[0] > r[1]){ // B in A
				cout << "2" << endl;
			}else if (r[0] < r[1]){ // A in B
				cout << "-2" << endl;
			}else{ // if (r[0] == r[1])
				cout << "1" << endl;
			} // end if
		}else if ( ( d >= fabs(r[1] - r[0]) ) && ( d <= r[0] + r[1] ) ){
			cout << "1" << endl;
		}else{
			cout << "0" << endl;
		} // end if
	} // end for
		
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <cmath>
#include <cfloat>

using namespace std;

int n, out;
double x[2], y[2], r[2], dst;

int main()
{
	
	cin >> n;
	
	while(n--)
	{
		
		for( int i = 0; i < 2; i++)
		{
			cin >> x[i] >> y[i] >> r[i];
		}
		
		dst = sqrt( pow(x[1] - x[0], 2) + pow(y[1] - y[0], 2) );
		
		if( dst > r[0] + r[1] )
			out = 0;
		else if( abs(r[0] + r[1]) > dst && dst > abs(r[0] - r[1]))
			out = 1;
		else 
			out = r[0] > r[1] ? 2 : -2;
		
		cout << out << endl;
		
	}
	
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main(void){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
	double x[2],y[2],r[2],h;
		for(int j=0;j<2;j++){
			cin>>x[j]>>y[j]>>r[j];
		}
		h=hypot(abs(x[0]-x[1]),abs(y[0]-y[1]));
		if(r[1]+h<r[0])puts("2");
		else if(r[0]+h<r[1])puts("-2");
		else if(h<=r[0]+r[1])puts("1");
		else puts("0");
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

using namespace std;
int main(){
	int N;
	cin >> N;
	for(int i = 0;i < N;i++){
		double xa, ya, ra;
		double xb, yb, rb;
		double d, R;

		cin >> xa >> ya >> ra;
		cin >> xb >> yb >> rb;

		d = sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb));
		R = fabs(ra-rb);
		if(ra+rb < d){
			cout << "0" << endl;
		}
		else if(ra+rb == d || (R < d && d < ra+rb)){
			cout << "1" << endl;
		}
		else if(R >= d && ra > rb){
			cout << "2" << endl;
		}
		else if(R >= d && ra < rb){
			cout << "-2" << endl;
		}

	}

	
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int num;
	double xa,xb,ya,yb,ra,rb;
	double dist;
	cin >> num;
	for( int i = 0; i < num; i++ ) {
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		
		dist = (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb);
		if( dist > ra + rb ) {
			cout << 0 << endl;
		}
		else if( ra - dist > rb) {
				cout << 2 << endl;
		}
		else if( rb - dist > ra) {
				cout << -2 << endl;
		}
		else
			cout << 1 << endl;
	}

	return 0;
}