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<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int n;
    double xa, ya, ra, xb, yb, rb;
    cin >> n;
    while(n--){
        cin >> xa >> ya >> ra >> xb >> yb >> rb;
        double distance = sqrt( (xb - xa) * (xb - xa) + (yb - ya) * (yb - ya) );
        if(distance > ra + rb)
            cout << 0 << endl;
        else if(distance + rb <= ra)
            cout << 2 << endl;
        else if(distance + ra <= rb)
            cout << -2 << endl;
        else
            cout << 1 << 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<iostream>
#include<iomanip>
#include<memory>
#include<array>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>

using namespace std;

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

  cin >> n;

  for ( int i = 0; i < 2; ++i )
    {
      cin >> xa >> ya >> ra >> xb >> yb >> rb;

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

      if ( pp > ra + rb )
        cout << 0 << endl;
      else if ( ra > pp + rb )
        cout << 2 << endl;
      else if ( rb > pp + ra )
        cout << -2 << endl;
      else
        cout << 1 << endl;
    }
  
  return 0;
}

C++: #include <iostream> 
#include <cmath> 
#include <string> 
#include <vector>
  
 using namespace std; 
  int main() { 
    int n; 
    cin >> n; 
    for (int i = 0; i < n; i++) { 
        double ax,ay,ar,bx,by,br; 
        cin >> ax >> ay >> ar >> bx >> by >> br; 
        double dis_x = abs(ax-bx), 
        double dis_y = abs(ay-by), 
double dist = sqrt(dis_x * dis_x + dis_y * dis_y);
        if ( dist > ar + br ) { 
             cout << 0;  } 
else if ( dist + ar < br ) { 
             cout << -2;  }
 else if ( dist + br < ar ) { 
             cout << 2;  } 
else { 
             cout << 1; 
         } 
         cout << endl; 
     }
    return 0; 
 }

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

double distance(double x1, double y1, double x2, double y2){
    return sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}

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 dis = distance(xa, ya, xb, yb);;
        if(dis + rb < ra)
            std::cout << "2" << std::endl;
        else if(dis + ra < rb)
            std::cout << "-2" << std::endl;
        else if(dis == ra + rb)
            std::cout << "1" << std::endl;
        else
            std::cout << "0" << std::endl;
    }
    return 0;
}

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

double distance(double x1, double y1, double x2, double y2){
    return sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}

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 dis = distance(xa, ya, xb, yb);
        if(dis + rb < ra)
            std::cout << "2" << std::endl;
        else if(dis + ra < rb)
            std::cout << "-2" << std::endl;
        else if(ra + rb > dis)
            std::cout << "0" << std::endl;
        else if(ra + rb <= dis)
            std::cout << "1" << std::endl;
    }
    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( dst > max(r[0], r[1]))
			out = 1;
		else 
			out = r[0] > r[1] ? 2 : -2;
		
		cout << out << endl;
		
	}
	
	return 0;
}

C++: /*
中心が (xa, ya) で半径 ra の円 A と、中心が (xb, yb) で半径 rb の円 B が与えられたとき、
 B が A の中にあるとき 2、
 A が B の中にあるとき -2、
 A の円周と B の円周が交わっている場合 1、
 A と B が重なっていないとき 0
を出力して終了するプログラムを作成して下さい。なお A と B は同じものではないとします。
xa ya ra xb yb rb
*/
#include <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  ifstream cin("../test.txt");
  int n;
  cin >> n;
  while (n--) {
    double xa, ya, ra, xb, yb, rb;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;
    double d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
    int res;
    if (rb + d < ra) {
      res = 2;
    } else if (ra + d < rb) {
      res = -2;
    } else if (d <= ra + rb) {
      res = 1;
    } else {
      res = 0;
    }
    cout << res << endl;
  }
}

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

int main(){
	int N;
	std::cin >> N;
	
	std::array<int, 20> ans;
	
	for(int i=0; i<N; ++i){
		double xa, ya, ra, xb, yb, rb;
		std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
		
		double d = pow((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb), 0.5);
		
		if(ra > rb && d <= ra-rb) ans[i] = 2;
		else if(ra < rb && d <= rb-ra) ans[i] = -2;
		else if(d <= ra+rb) ans[i] = 1;
		else ans[i] = 0;
	}
	
	for(int i=0; i<N; ++i)
		std::cout << ans[i] << std::endl;
	
	return 0;
}

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

int main(){
	int n;
	double xa,ya,ra,xb,yb,rb;
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf", &xa,&ya,&ra,&xb,&yb,&rb);
		double d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
		int a = 0;
		if(d <= ra + rb){
			a++;
		}
		if(d + rb < ra){
			a++;
		}
		if(d + ra < rb){
			a++;
			a *= -1;
		}
		printf("%d\n", a);
	}
}