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++: /*
中心が (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);
	}
}

C++: // AOJ 0023
#include<iostream>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const double EPS = 1e-7;

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 (d < sq(ra)) {
      cout << 2 << endl;
    } else if (d < sq(rb)) {
      cout << -2 << endl;
    } else if (eq(d, sq(abs(ra - rb)))) {
      cout << 1 << endl;
    } else if (d < sq(ra + rb)) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
}

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>
using namespace std;

struct circle{
	double x;
	double y;
	double r;
};

int judge_intersection(circle ca, circle cb){
	double dis2 = (ca.x - cb.x) * (ca.x - cb.x)
				+ (ca.y - cb.y) * (ca.y - cb.y);
	if((ca.r > cb.r) && ((ca.r - cb.r) * (ca.r - cb.r) > dis2)){
		return 2;
	} else if((cb.r > ca.r) && ((ca.r - cb.r) * (ca.r - cb.r) > dis2)){
		return -2;
	} else if((ca.r + cb.r) * (ca.r + cb.r) > dis2){
		return 1;
	} else {
		return 0;
	}
}

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		circle ca, cb;
		cin >> ca.x >> ca.y >> ca.r
			>> cb.x >> cb.y >> cb.r;
		cout << judge_intersection(ca, cb) << endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
  int N;
  scanf("%d ", &N);
  
  for (int i = 0; i < N; i++) {
    double xa, ya, ra, xb, yb, rb;
    scanf("%d %d %d %d %d %d ", &xa, &ya, &ra, &xb, &yb, &rb);
    complex<double> A(xa, ya), B(xb, yb);

    double k1 = fabs(ra - rb), k2 = ra + rb;
    double d = abs(A - B);
    int num;
    if (d < k1) {
      if (ra > rb) {
	num = 2;
      } else {
	num = -2;
      }
    } else if (k1 <= d && d <= k2) {
      num = 1;
    } else if (k2 < d) {
      num = 0;
    }
    
    printf("%d\n", num);
  }
  return 0;
}

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

using namespace std;

int main() {
    int n;
    cin>>n;
    double xa,ya,ra,xb,yb,rb;
    
    while((cin>>xa>>ya>>ra>>xb>>yb>>rb)){
        double l = (xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
        if(l>(ra+rb)*(ra+rb)){
            cout<<0<<endl;
        }else if(l<=(ra+rb)*(ra+rb)&&l+rb*rb<=ra*ra){
            cout<<2<<endl;
        }else if(l<=(ra+rb)*(ra+rb)&&l+ra*ra<=rb*rb){
            cout<<-2<<endl;
        }else if(l<=(ra+rb)*(ra+rb)&&l<=ra*ra&&l>rb*rb){
            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-8;

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 (d < sq(ra + rb)) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
}