Problem:
Circles Intersection You are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$. Write a program which prints:  "2" if $B$ is in $A$,  "-2" if $A$ is in $B$,  "1" if circumference of $A$ and $B$ intersect, and  "0" if $A$ and $B$ do not overlap.  You may assume that $A$ and $B$ are not identical. Input The input consists of multiple datasets. The first line consists of an integer $N$ ($N \leq 50$), the number of datasets. There will be $N$ lines where each line represents each dataset. Each data set consists of real numbers:  $x_a$ $y_a$ $r_a$ $x_b$ $y_b$ $r_b$  Output For each dataset, print 2, -2, 1, or 0 in a line. Sample Input 2
0.0 0.0 5.0 0.0 0.0 4.0
0.0 0.0 2.0 4.1 0.0 2.0 Output for the Sample Input 2
0

Solution (Python):
for i in range(int(input())):
    xa, ya, ra, xb, yb, rb = map(float, input().split(' '))
    ab_length = ((xa - xb) ** 2 + (ya - yb) ** 2) ** 0.5
    if ra > rb:
        max_r, min_r, min_c = ra, rb, 2
    else:
        max_r, min_r, min_c = rb, ra, -2

    if ab_length > ra + rb:
        ans = 0
    elif ab_length <= ra + rb:
        if ab_length + min_r < max_r:
            ans = min_c
        else:
            ans = 1
    print(ans)

Solution (Python):



import sys

input()

for s in sys.stdin:
  d = map(float,s.split())
  xa,ya,ra,xb,yb,rb = d[0],d[1],d[2],d[3],d[4],d[5]
  if ((xa-xb)**2+(ya-yb)**2)**0.5 > ra + rb:
    print 0
  elif ((xa-xb)**2+(ya-yb)**2)**0.5 + rb < ra :
    print 2
  elif ((xa-xb)**2+(ya-yb)**2)**0.5 + ra < rb :
    print -2
  else:
    print 1

Solution (Python):
import sys
f = sys.stdin

n = int(f.readline())
for _ in range(n):
    xa, ya, ra, xb, yb, rb = map(float, f.readline().split())
    xya, xyb = xa + ya * 1j, xb + yb * 1j
    dist =  abs(xya - xyb)
    if ra + rb < dist:
        print(0)
    elif ra > rb + dist:
        print(2)
    elif rb > ra + dist:
        print(-2)
    else:
        print(1)

Solution (Python):
import math

n = int(input())

for _ in range(n):
    xa,ya,ra,xb,yb,rb = map(float, input().split())
    len=math.sqrt((xa-xb)**2+(ya-yb)**2)

    if len + rb < ra:
        print("2")
    elif len + ra < rb:
        print("-2")
    elif len <= ra + rb:
        print("1")
    else:
        print("0")

Solution (Python):
for a,b,r,c,d,s in[map(float,raw_input().split())for i in range(input())]:
	d=((a-c)**2+(b-d)**2)**0.5
	if d>r+s:print 0
	elif d+min(r,s)>=max(r,s):print 1
	elif r>s:print 2
	else:print -2

Solution (Python):
import math

def calculate():
    if ra + rb < d:
        print 0
    elif abs(ra - rb) <= d <= ra + rb:
        print 1
    elif rb > ra and d < rb - ra:
        print -2
    elif ra > rb and d < ra - rb:
        print 2
        
N = int(raw_input())

for i in range(N):
    xa, ya, ra, xb, yb, rb = map(float, raw_input().split())
    d = math.sqrt((xb-xa)**2 + (yb-ya)**2)
    calculate()

Solution (Python):
import sys
import math

n = int(input())

for _ in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())

    distance = math.sqrt((xa-xb)**2 + (ya-yb)**2)
    if ra + rb >= distance:
        if (distance + ra < rb):
            print(-2)
        elif (distance + rb < ra):
            print(2)
        else:
            print(1)
    else:
        print(0)

Solution (Python):
n = int(input())
for i in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    d = ((xa - xb)**2 + (ya - yb)**2)**0.5
    if d > ra + rb:
        print(0)
    elif ra + d < rb:
        print(-2)
    elif rb + d < ra:
        print(2)
    else:
        print(1)

Solution (Python):


def main():
    import math
    for i in range(int(input())):
        xa,ya,ra,xb,yb,rb=map(float,input().split())
        d=math.sqrt((xa-xb)**2+(ya-yb)**2)
        if d>ra+rb:
            print(0)

        elif ra+rb>=d and d>=abs(ra-rb):
            print(1)

        elif d<abs(ra-rb):
            if ra>rb:
                print(2)
            elif ra<rb:
                print(-2)
        
            
    
        
if __name__ == '__main__':
    main()

Solution (Python):
import math

n = int(raw_input())

for i in range(0, n):
	xa,ya,ra,xb,yb,rb = map(float,raw_input().split())
	
	distance = math.hypot(xa - xb, ya - yb)
	
	if distance + rb < ra:
		print 2
	elif distance + ra < rb:
		print -2
	elif ra + rb >= distance:
		print 1
	elif ra + rb < distance:
		print 0

Solution (Python):
n=int(raw_input())
for i in range(n):
    xa,ya,ra,xb,yb,rb=map(float,raw_input().split())
    d=((xa-xb)**2+(ya-yb)**2)**0.5
    if ra+rb<d:
        print 0
    elif ra>=rb:
        print 2 if d+rb<ra else 1
    else:
        print -2 if d+ra<rb else 1

Solution (Python):
n = int(input())
for i in range(n):
    x1, y1, r1, x2, y2, r2 = map(float, input().split())
    a = complex(x1, y1)
    b = complex(x2, y2)
    d = abs(a - b)
    if d < r1 - r2:
        print(2)
    elif d < r2 - r1:
        print(-2)
    elif d <= r1 + r2:
        print(1)
    else:
        print(0)

Solution (Python):
from math import sqrt

n = int(input())
while n:
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    d = sqrt((xb - xa) ** 2 + (yb - ya) ** 2)
    if ra > d + rb:
        print(2)
    elif rb > d + ra:
        print(-2)
    elif d > ra + rb:
        print(0)
    else:
        print(1)

    n -= 1

Solution (Python):
for _ in range(int(input())):
    xa, ya, ra, xb, yb, rb = list(map(float,input().split()))
    dAB = ((xa - xb) ** 2 + (ya - yb) ** 2) ** 0.5
    if ra + rb < dAB:
        print('0')
    elif dAB + rb < ra:
        print('2')
    elif dAB + ra < rb:
        print('-2')
    else:
        print('1')

Solution (Python):
import math
x = input()

for i in xrange(x):
	x1,y1,r1,x2,y2,r2 = map(float, raw_input().split())
	d = math.sqrt((x1 - x2)**2 + (y1 - y2)**2)

	if d > (r1 + r2):
		print "0"
	elif abs(r1 - r2) <= d <= r1 + r2:
		print "1"
	elif d < abs(r1 + r2):
		if r1 > r2:
			print "2"
		else:
			print "-2"

Solution (Python):


import math

n = int(raw_input())
for i in range(n):
    x1, y1, r1, x2, y2, r2 = map(float, raw_input().split())
    d = math.sqrt(math.pow(x2-x1, 2) + math.pow(y2-y1, 2))
    if r2+d < r1:
        print '2'
    elif r1+d < r2:
        print '-2'
    elif r1+r2 >= d:
        print '1'
    else:
        print '0'

Solution (Python):
n = int(input())
for i in range(n):
    xa, ya, ra, xb, yb, rb, = map(float, input().split())
    dsq = (xa - xb)**2 + (ya -yb)**2
    if dsq > (ra + rb)**2:
        print('0')
    elif dsq < (ra - rb)**2:
        if ra > rb:
            print('2')
        else:
            print('-2')
    else:
        print('1')

Solution (Python):
import math
for i in range(int(input())):
    xa, ya, ra, xb, yb, rb = list(map(float, input().split()))

    d1 = (xa - xb) ** 2 + (ya - yb) ** 2
    d2 = (ra + rb) ** 2
    dr = (ra-rb) ** 2

    if d1 <= d2:
        if dr > d1:
            print(2 if ra > rb else -2)
        else:
            print(1)
    else:
        print(0)

Solution (Python):
import math
for _ in range(int(input())):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    d = math.hypot(xb - xa, yb- ya)
    if d > ra + rb:
        print(0)
    elif abs(ra - rb) <= d:
        print(1)
    else:
        print(2 if rb < ra else -2)

Solution (Python):
import math

n = input()
for i in xrange(n):
    xa, ya, ra, xb, yb, rb = map(float, raw_input().split())
    d = math.sqrt(((xa - xb) ** 2) + ((ya - yb) ** 2))
    if ra + rb < d: print 0
    elif ra + rb >= d and abs(ra - rb) <= d: print 1
    else: print 2 if ra > rb else -2

Solution (Python):
import math

N = int(input())
for i in range(N):
    x1,y1,r1,x2,y2,r2 = map(float,input().split())
    d = math.sqrt(pow(x1 - x2,2.0) + pow(y1 - y2,2.0))
    if d < abs(r2 - r1):
        if r1 > r2:
            print(2)
        else:
            print(-2)
    elif d <= r1 + r2:
        print(1)
    else:
        print(0)

Solution (Python):
from fractions import Fraction as F
for _ in xrange(input()):
    x1, y1, r1, x2, y2, r2 = map(F, raw_input().split())
    d = (x1-x2)**2+(y1-y2)**2 
    if d < (r1-r2)**2:
        print 2 if r1 > r2 else -2
    elif (r1-r2)**2 <= d <= (r1+r2)**2:
        print 1
    else:
        print 0

Solution (Python):
n = int(input())
for i in range(n):
    xa,ya,ra,xb,yb,rb = map(float,input().split())
    dis = (xa - xb)**2 + (ya - yb)**2
    if dis > (ra + rb)**2:
        print(0)
    elif rb > ra and dis < (rb - ra)**2:
        print(-2)
    elif ra > rb and dis < (ra - rb)**2:
        print(2)
    else:
        print(1)

Solution (Python):
import math
n=int(input())
for i in range(n):
    ax,ay,ar,bx,by,br=[float(i) for i in input().split()]
    ab=abs(math.sqrt(pow(ax-bx,2)+pow(ay-by,2)))
    if ar>ab and (ar-ab)>br:
        print(2)
    elif br>ab and(br-ab)>ar:
        print(-2)
    elif ab<=(ar+br):
        print(1)
    else:
        print(0)

Solution (Python):
import math
n = int(raw_input())

for i in range(n):
    xa, ya, ra, xb, yb, rb = map(float, raw_input().split(' '))
    d = math.sqrt((xa-xb)**2 + (ya-yb)**2)
    if d+rb < ra:
        print 2
    elif d+ra < rb:
        print -2
    elif d > ra+rb:
        print 0
    else:
        print 1

Solution (Python):
import math

def check_intersect(x1,y1,r1,x2,y2,r2):
    d = math.sqrt((x2-x1)**2 + (y2-y1)**2)    

    if d > r1+r2:
        print('0')
    elif d < math.sqrt((r1-r2)**2):
        if r1 > r2:
            print('2')
        else:print('-2')
    else:
        print('1')
        
n = int(input())
for i in range(n):
    x1,y1,r1,x2,y2,r2 = map(float,input().split())
    check_intersect(x1,y1,r1,x2,y2,r2)

Solution (Python):
def f():
    ax,ay,ar,bx,by,br=map(float,input().split())
    d=((ax-bx)* (ax - bx))+((ay-by)*(ay-by))
    r1=(ar+br)*(ar+br)
    r2=(ar-br)*(ar-br)
    if d<=r1 and d>=r2:return 1;
    elif d<r2 and ar>=br:return 2
    elif d < r2 and ar <= br:return -2
    else:return 0

for _ in range(int(input())):print(f())

Solution (Python):
def f():
    ax,ay,ar,bx,by,br=map(float,input().split())
    d=(ax-bx)**2+(ay-by)**2
    r1=(ar+br)*(ar+br)
    r2=(ar-br)*(ar-br)
    if d<=r1 and d>=r2:return 1;
    elif d<r2 and ar>=br:return 2
    elif d < r2 and ar <= br:return -2
    else:return 0

for _ in range(int(input())):print(f())

Solution (Python):
import math

def to_f(e):
  return float(e)

n = int(raw_input().rstrip())

for i in range(n):
  line = raw_input().rstrip()
  l = map(to_f, line.split(" "))
  xa = l[0]
  ya = l[1]
  ra = l[2]
  xb = l[3]
  yb = l[4]
  rb = l[5]
  dist = math.sqrt((xa-xb)**2 + (ya-yb)**2)
  if ra > rb and dist < ra-rb:
    print 2
  elif rb > ra and dist < rb-ra:
    print -2
  elif dist <= ra + rb and dist >= ra-rb:
    print 1
  else:
    print 0

Solution (Python):
import math
def aux(v):
    [xa,ya,ra,xb,yb,rb] = v
    ab = math.sqrt((xb-xa)**2 + (yb-ya)**2)
    if ab > ra + rb:
        rst = 0
    elif ab + rb < ra:
        rst = 2
    elif ab + ra < rb:
        rst = -2
    else:
        rst = 1      
    return(rst)    

if __name__ == "__main__": 
    n = int(input())
    for i in range(n):
        v = list(map(float, input().split()))
        print(aux(v))

Solution (Python):
n = int(input())
for i in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    distsq = (xa-xb)**2 + (ya-yb)**2
    if distsq < (ra-rb)**2:
        if ra < rb:
            print(-2)
        else:
            print(2)
    elif (ra-rb)**2 <= distsq <= (ra+rb)**2:
        print(1)
    else:
        print(0)

Solution (Python):


import sys
import os
import math

N = int(input())

for i in range(N):
    ax, ay, ar, bx, by, br = map(float, input().split())

    between_center = math.sqrt( (ax-bx)**2 + (ay-by)**2 )

    
    if between_center > ar + br:
        print(0)

    
    else:
        
        if ar > between_center + br:
            print(2)

        
        elif br > between_center + ar:
            print(-2)

        else:
            print(1)

Solution (Python):


import sys
import os
import math


N = int(input())

for i in range(N):
    ax, ay, ar, bx, by, br = map(float, input().split())

    between_center = math.sqrt( (ax-bx)**2 + (ay-by)**2 )

    
    if between_center > ar + br:
        print(0)

    
    else:
        
        if ar > between_center + br:
            print(2)

        
        elif br > between_center + ar:
            print(-2)

        else:
            print(1)

Solution (Python):


import sys
import os
import math


N = int(input())

for i in range(N):
    ax, ay, ar, bx, by, br = map(float, input().split())

    between_center = math.hypot(ax - bx, ay - by)

    
    if between_center > ar + br:
        print(0)

    
    else:
        
        if ar > between_center + br:
            print(2)

        
        elif br > between_center + ar:
            print(-2)

        else:
            print(1)

Solution (Python):


import math 

num = int(input())
for i in range(num):
    ax,ay,ar,bx,by,br=map(float,input().split())
    d = ((ax-bx)* (ax - bx))+((ay-by)*(ay-by))
    r1 = (ar+br)*(ar+br)
    r2 = (ar-br)*(ar-br)
    if d <= r1 and d >= r2:
        print(1);
    elif d<r2 and ar>=br:
        print(2)
    elif d < r2 and ar <= br:
        print(-2)
    else:
        print(0)

Solution (Python):
n = int(input())
for i in range(n):
    k = input()
    xa, ya, ra, xb, yb, rb = list(map(float, k.split(" ")))
    d = abs(complex(xb-xa, yb-ya))
    if ra + rb < d:
        print("0")
    elif abs(rb-ra) <= d <= ra+rb:
        print("1")
    else:
        print("2" if ra > rb else "-2")

Solution (Python):

N=int(input())
x_a=[0]*N
y_a=[0]*N
r_a=[0]*N
x_b=[0]*N
y_b=[0]*N
r_b=[0]*N
for i in range(N):
    x_a[i],y_a[i],r_a[i],x_b[i],y_b[i],r_b[i]=map(float,input().split())
for i in range(N):
    AB=((x_a[i]-x_b[i])**2+(y_a[i]-y_b[i])**2)**(1/2)
    r_diff=abs(r_a[i]-r_b[i])
    if AB > r_a[i]+r_b[i]:
        print(0)
    elif r_a[i]+r_b[i] >= AB and AB >= r_diff:
        print(1)
    else:
        if r_a[i] > r_b[i]:
            print(2)
        else:
            print(-2)

Solution (Python):
def dist(P, Q):
    return ((P[0] - Q[0]) ** 2 + (P[1] - Q[1]) ** 2) ** 0.5

n = int(input())
for _ in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    A, B = (xa, ya), (xb, yb)
    if dist(A, B) > ra + rb:
        print(0)
    elif dist(A, B) + ra < rb:
        print(-2)
    elif dist(A, B) + rb < ra:
        print(2)
    else:
        print(1)

Solution (Python):
import sys

def solve(circleA, circleB):
    xa, ya, ra = circleA
    xb, yb, rb = circleB
    
    if ra <= rb:
        if distancePow2(xa, ya, xb, yb) < pow(rb - ra, 2):
            return -2
    else:
        if distancePow2(xa, ya, xb, yb) < pow(rb - ra, 2):
            return 2

    
    if pow(rb - ra, 2) <= distancePow2(xa, ya, xb, yb) <= pow(rb + ra, 2):
        return 1

    return 0

def distancePow2(xa, ya, xb, yb):
    return pow(xb - xa, 2) + pow(yb - ya, 2)

n = int(input())
for i in range(0, n):
    inStr = input()
    circleAInfo = [float(data) for data in inStr.split(" ")[0:3]]
    circleBInfo = [float(data) for data in inStr.split(" ")[3:6]]
    print(solve(circleAInfo, circleBInfo))

Solution (Python):

def plus(a, b):
    return a + b


def minus(a, b):
    return abs(a - b)


def distance(x1, y1, x2, y2):
    r2 = (x1 - x2)**2 + (y1 - y2)**2
    return pow(r2, 0.5)


def flag(l):
    rp = plus(l[2], l[5])
    rm = minus(l[2], l[5])
    d = distance(l[0], l[1], l[3], l[4])
    if rp < d:
        return 0
    elif d < rm:
        if l[5] < l[2]:
            return 2
        else:
            return -2
    else:
        return 1


N = int(input())
for i in range(N):
    a = list(map(float, input().split()))
    print(flag(a))

Solution (Python):


import sys, math, os


PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def check_circles(xa, ya, ra, xb, yb, rb):
    dist = math.sqrt((xa - xb)**2 + (ya - yb)**2)
    if dist > ra + rb:
        return 0
    if ra > rb and dist < ra - rb:
        return 2
    if rb > ra and dist < rb - ra:
        return -2
    return 1
    
N = int(input())
for n in range(N):
    xa, ya, ra, xb, yb, rb = [float(_) for _ in input().split()]
    print(check_circles(xa, ya, ra, xb, yb, rb))

Solution (Python):

"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0023&lang=jp

"""
import sys
from sys import stdin
from math import sqrt
input = stdin.readline


def main(args):
    N = int(input())
    for _ in range(N):
        x_a, y_a, r_a, x_b, y_b, r_b = map(float, input().split())

        distance = sqrt((x_a - x_b) ** 2 + (y_a - y_b) ** 2)
        if r_a + r_b < distance:
            result = 0
        elif r_a > distance + r_b:
            result = 2
        elif r_b > distance + r_a:
            result = -2
        else:
            result = 1
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
n = input()
for i in range(n):
	xa,ya,ra,xb,yb,rb = map(float, raw_input().split())
	if abs(ra-rb) <= ((xa-xb)**2+(ya-yb)**2)**0.5 <= ra+rb: print 1
	elif abs(ra-rb) >= ((xa-xb)**2+(ya-yb)**2)**0.5:
		if rb < ra: print 2
		else: print -2
	else: print 0

Solution (Python):
import math

n = int(input())
for i in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    d = math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2)
    if d < ra - rb:
        print(2)
    elif d < rb - ra:
        print(-2)
    elif abs(rb - ra) <= d and d <= ra + rb:
        print(1)
    else:
        print(0)

Solution (Python):
import math

n = int(input())
for i in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    d = math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2)
    if d < ra - rb:
        print(2)
    elif d < rb - ra:
        print(-2)
    elif d <= ra + rb:
        print(1)
    else:
        print(0)

Solution (Python):
n=int(input())
for i in range(n):
    points = input().split()
    p = list(map(float,points))
    if (p[3]-p[0])**2 + (p[4]-p[1])**2 < (p[2]-p[5])**2:
        if p[5]>p[2]:
            print(-2)
        else:
            print(2)
    elif (p[0]-p[3])**2 + (p[1]-p[4])**2 >= (p[2]-p[5])**2 and (p[0]-p[3])**2 + (p[1]-p[4])**2 <= (p[2]+p[5])**2:
        print(1)
    else:
        print(0)

Solution (Python):

import math


def square(number: float) -> float:
    return number * number


if __name__ == '__main__':
    N = int(input())
    for i in range(N):
        xa, ya, ra, xb, yb, rb = map(float, input().split())
        distance = math.sqrt(square(xb - xa) + square(yb - ya))
        if distance > (ra + rb):
            print(0)
        elif distance >= math.fabs(ra - rb):
            print(1)
        elif distance < math.fabs(ra - rb):
            if ra > rb:
                print(2)
            elif ra < rb:
                print(-2)
        else:
            pass

Solution (Python):
n = int(input())

for _ in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    dist = ((xa - xb)**2 + (ya - yb)**2)**.5
    if ra + rb < dist:
        print('0')
    elif abs(ra - rb) <= dist:
        print('1')
    elif (rb < ra):
        print('2')
    elif (ra < rb):
        print('-2')

Solution (Python):
import math
count = int(input())
for i in range(count):
    x1,y1,r1,x2,y2,r2 =map(float,input().split())
    depth=(x1-x2)**2+(y1-y2)**2
    if depth> (r1+r2)**2:
        print(0)
    elif depth <(r1-r2)**2:
        if r1>r2:
            print(2)
        else:
            print(-2)
    else:
        print(1)

Solution (Python):
import math

n = int(input())
for i in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())

    d = math.sqrt((xa - xb)**2 + (ya - yb)**2)

    if ra > d + rb:
        print("2")
    elif rb > d + ra:
        print("-2")
    elif d > ra + rb:
        print("0")
    else:
        print("1")

Solution (Python):
n=int(raw_input())
for i in range(n):
    x1,y1,r1,x2,y2,r2=map(float,raw_input().split())
    d = ((x2-x1)**2+(y2-y1)**2)**0.5
    if d+r2< r1:
        print 2
    elif d+r1<r2:
        print -2
    elif r1+r2<d:
        print 0
    else:
        print 1

Solution (Python):
for _ in[0]*int(input()):
 x,y,r,s,t,u=map(float,input().split())
 d=((x-s)**2+(y-t)**2)**.5
 print([[[1,-2][d<u-r],[1,2][d<r-u]][r>u],0][r+u<d])

Solution (Python):
for _ in[0]*int(input()):
 x,y,r,s,t,u=map(float,input().split())
 d=((x-s)**2+(y-t)**2)**.5
 print([[[1,0][r+u<d],-2][d<u-r],2][d<r-u])

Solution (Python):
import math
n=int(input())
for _ in range(n):
    l=[float(i) for i in input().split()]
    d=math.hypot(l[3]-l[0],l[4]-l[1])
    print([2,-2,1,0][[d<l[2]-l[5],d<l[5]-l[2],d<=l[2]+l[5],d>l[2]+l[5]].index(True)])

Solution (Python):
import math
for _ in range(int(input())):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    d = math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2)
    if ra + rb < d:
        print(0)
    elif d + ra < rb:
        print(-2)
    elif d + rb < ra:
        print(2)
    else:
        print(1)

Solution (Python):
import math

def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = int(input())
for l in range(N):

    xa,ya,ra,xb,yb,rb = [float(i) for i in input().split()]
    d = math.sqrt((xa-xb)**2 + (ya-yb)**2)
    if d < ra-rb:
        print(2)
    elif d < rb-ra:
        print(-2)
    elif d > ra+rb:
        print(0)
    else:
        print(1)

Solution (Python):
import math
N = int(input())
for _ in [0]*N:
    x1, y1, r1, x2, y2, r2 = map(float, input().split())
    dist = math.hypot(x2-x1, y2-y1)
    if dist+r2 < r1:
        print(2)
    elif dist+r1 < r2:
        print(-2)
    elif dist <= r1+r2:
        print(1)
    else:
        print(0)

Solution (Python):



n = int(input())
for i in range(n):
	xa, ya, ra, xb, yb, rb = list(map(float, input().split()))
	ans = 1
	d = (xa - xb)*(xa - xb) + (ya - yb)*(ya - yb);
	if d > (ra + rb)*(ra + rb): ans = 0
	elif d < (ra - rb)*(ra - rb):
		ans = 2 if ra > rb else -2
	print(ans)

Solution (Python):
import sys
import math
N = int(sys.stdin.readline().strip())

def calc(xa, ya, ra, xb, yb, rb):
    dist = math.sqrt((yb - ya) **2 + (xb - xa) **2)
    if dist > (ra + rb):
        return 0
    elif abs(ra - rb) <= dist <= (ra + rb):
        return 1
    elif dist < abs(ra - rb):
        if ra > rb:
            return 2
        else:
            return -2

for i in xrange(N):
    line = sys.stdin.readline().strip()
    xa, ya, ra, xb, yb, rb = map(float, line.split())
    print calc(xa, ya, ra, xb, yb, rb)

Solution (Python):
for i in range(input()):
    xa,ya,ra,xb,yb,rb=map(float,raw_input().split())
    d=((xa-xb)**2+(ya-yb)**2)**0.5
    if ra>rb+d:print 2
    elif rb>ra+d:print -2
    elif d>ra+rb:print 0
    else: print 1

Solution (Python):
import math
for i in range(int(raw_input())):
    (xa, ya, ra, xb, yb, rb) = map(float,raw_input().split())
    dist = math.sqrt((xa-xb)**2 + (ya-yb)**2)
    if dist > ra + rb:
        print 0
    elif dist + rb < ra:
        print 2
    elif dist + ra < rb:
        print -2
    else:
        print 1

Solution (Python):
import sys
import math
N = int(sys.stdin.readline().strip())
 
def calc(xa, ya, ra, xb, yb, rb):
    dist = math.sqrt((yb - ya) **2 + (xb - xa) **2)
    if dist > (ra + rb):
        return 0
    elif abs(ra - rb) <= dist <= (ra + rb):
        return 1
    elif dist < abs(ra - rb):
        if ra > rb:
            return 2
        else:
            return -2
 
for i in xrange(N):
    line = sys.stdin.readline().strip()
    xa, ya, ra, xb, yb, rb = map(float, line.split())
    print calc(xa, ya, ra, xb, yb, rb)

Solution (Python):
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin
from math import hypot, copysign

for n in xrange(int(stdin.readline())):
    xa, ya, ra, xb, yb, rb = (float(s) for s in stdin.readline().split())

    distance = hypot(xa - xb, ya - yb)
    diff = ra - rb

    if ra + rb < distance:
        print('0')
    elif abs(diff) <= distance:
        print('1')
    else:
        print(int(copysign(2, diff)))

Solution (Python):
from decimal import Decimal

def dist(x1, y1, x2, y2):
    return ((x1 - x2)**2 + (y1 - y2)**2)**Decimal('0.5')

N = int(raw_input())
while (N):
    N -= 1
    xa, ya, ra, xb, yb, rb = map(Decimal, raw_input().split())
    d = dist(xa, ya, xb, yb)
    sr = ra + rb
    dr = abs(ra - rb)
    if d > sr:
        s = 0
    elif d < sr and dr < d:
        s = 1
    elif dr > d:
        s = 2 if ra > rb else -2
    else:
        s = 1
    print s

Solution (Python):
import math
N = input()
answers = []
for val in range(1,N+1):
	x = map(float,raw_input().split(' '))
	d = (x[0]-x[3])**2 + (x[1]-x[4])**2
	d = math.sqrt(d)
	d = math.fabs(d)
	s = x[2]+x[5]
	r = math.fabs(x[2]-x[5])
	if d > s:
		answers.append(0)
	elif d == s:
		answers.append(1)
	elif d < s:
		if d < r:
			if x[2] > x[5]:
				answers.append(2)
			else:
				answers.append(-2)
		elif d >= r:
			answers.append(1)
for val in answers:
	print val

Solution (Python):

import sys
import math


class Circle:
    def __init__(self, x, y, r):
        self.x = x
        self.y = y
        self.r = r

    def distance(self, other):
        dx = self.x - other.x
        dy = self.y - other.y
        return math.sqrt(dx ** 2 + dy ** 2)

    def intersection(self, other):
        d = self.distance(other)
        if self.r > d + other.r:
            return 2
        elif other.r > d + self.r:
            return -2
        elif d <= self.r + other.r:
            return 1
        else:
            return 0




sys.stdin.readline()

for line in sys.stdin:
    (xa, ya, ra, xb, yb, rb) = tuple(map(float, line.split(' ')))
    ca = Circle(xa, ya, ra)
    cb = Circle(xb, yb, rb)
    print ca.intersection(cb)

Solution (Python):
import math

n = input()
for i in range(n):
    xa, ya, ra, xb, yb, rb = map(float, raw_input().split())
    r = ((xa-xb)**2 + (ya-yb)**2)**.5
    if ra+rb<r: print 0
    elif abs(ra-rb)<=r: print 1
    elif ra-rb>r: print 2
    else: print -2

Solution (Python):
n = input()
for i in range(n):
    xa, ya, ra, xb, yb, rb = map(float, raw_input().split())
    r = ((xa-xb)**2 + (ya-yb)**2)**.5
    if ra+rb<r: print 0
    elif ra-rb>r: print 2
    elif rb-ra>r: print -2
    else: print 1

Solution (Python):
import sys
import math
N = int(sys.stdin.readline().strip())
 
def calc(xa, ya, ra, xb, yb, rb):
    dist = math.sqrt((yb - ya) **2 + (xb - xa) **2)
    if dist > (ra + rb):
        return 0
    elif abs(ra - rb) <= dist <= (ra + rb):
        return 1
    elif dist < abs(ra - rb):
        if ra > rb:
            return 2
        else:
            return -2
 
for i in xrange(N):
    line = sys.stdin.readline().strip()
    xa, ya, ra, xb, yb, rb = map(float, line.split())
    print calc(xa, ya, ra, xb, yb, rb)

Solution (Python):
n = int(raw_input())
for _ in range(n):
    xa,ya,ra,xb,yb,rb = map(float, raw_input().split())
    d = ((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb))
    sr = ((ra + rb) * (ra + rb))
    dr = ((ra - rb) * (ra - rb))
    if d > sr:
        print 0
    elif (d < sr and dr < d):
        print 1
    elif dr > d:
        if ra > rb:
            print 2
        else:
            print -2
    else:
        print 1

Solution (Python):
import math


n = int(raw_input())

for i in xrange(n):
    data = map(float, raw_input().strip().split())
    xa = data[0]
    ya = data[1]
    ra = data[2]
    xb = data[3]
    yb = data[4]
    rb = data[5]

    d = math.sqrt((xa - xb)**2 + (ya - yb)**2)
    if d < ra - rb:
        print 2

    elif d < rb - ra:
        print -2

    elif d <= ra + rb:
        print 1
    else:
        print 0

Solution (Python):
import math
n = int(raw_input())

for i in range(n):
    xa,ya,ra,xb,yb,rb = map(float, raw_input().split())
    d = math.sqrt((xa-xb)**2+(ya-yb)**2)
    if ra+rb < d:
        print 0
    elif ra >= rb:
        if d+rb < ra:
            print 2
        else:
            print 1
    elif ra < rb:
        if d+ra < rb:
            print -2
        else:
            print 1

Solution (Python):
n = input()
while n:
    xa, ya, ra, xb, yb, rb = map(float, raw_input().split())
    r = ((xa-xb)**2 + (ya-yb)**2)**.5
    if ra+rb<r: x=0
    elif ra-rb>r: x=2
    elif rb-ra>r: x=-2
    else: x=1
    print x
    n-=1

Solution (Python):
import math

def length(xa, ya, xb, yb):
  return math.sqrt((xa - xb)**2 + (ya - yb)**2)

n = int(raw_input())
for s in range(0, n):
  xa, ya, ra, xb, yb, rb = map(float, raw_input().split(' '))
  d = length(xa, ya, xb, yb)

  if ra > rb + d:
    print 2
  elif rb > ra + d:
    print -2
  elif d > ra + rb:
    print 0
  else:
    print 1

Solution (Python):

import math

n = int(input())
for i in range(n):
	xa, ya, ra, xb, yb, rb = [float(x) for x in input().split(" ")]
	distance = math.sqrt((xb-xa)**2 + (yb-ya)**2)

	if distance > ra+rb:
		print(0)
	elif distance < abs(ra-rb):
		if ra > rb:
			print(2)
		elif ra < rb:
			print(-2)
		else:
			print(1)
	elif distance <= ra+rb:
		print(1)

Solution (Python):
import math

n = input()
for i in xrange(n):
    xa, ya, ra, xb, yb, rb = map(float, raw_input().split())
    l = math.hypot(xa - xb, ya - yb)
    if l + rb < ra:
        print 2
    elif l + ra < rb:
        print -2
    elif l <= ra + rb:
        print 1
    else:
        print 0

Solution (Python):
from math import hypot

n = int(input())
for i in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    d = hypot(xb - xa, yb - ya)
    if ra + rb < d:
        print(0)
    elif abs(ra - rb) <= d:
        print(1)
    elif rb < ra:
        print(2)
    else:
        print(-2)

Solution (Python):
import math
num = int(input())
for i in range(num):
    lst = list(map(float, input().split()))
    xa, ya, ra = lst[0], lst[1], lst[2]
    xb, yb, rb = lst[3], lst[4], lst[5]

    d = math.sqrt((xa - xb)**2 + (ya - yb)**2)

    if ra + rb < d:
        print(0)

    elif d + min(ra, rb) < max(ra, rb):
        if ra < rb:
            print(-2)
        else:
            print(2)

    else:
        print(1)

Solution (Python):
import sys
readline = sys.stdin.readline
write = sys.stdout.write
EPS = 1e-9
def solve():
    xa, ya, ra, xb, yb, rb = map(float, readline().split())
    d = ((xa - xb)**2 + (ya - yb)**2)**.5
    if d < rb - ra:
        write("-2\n")
    elif d < ra - rb:
        write("2\n")
    elif d > ra + rb:
        write("0\n")
    else:
        write("1\n")
T = int(readline())
for i in range(T):
    solve()

Solution (Python):
import math

n = int(input())
for i in range(0,n):
    x1,y1,r1,x2,y2,r2 = (float(x) for x in input().split())
    ans = 1
    
    
    
    
    
    l = math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))
    if l < abs(r1 - r2):
        if r1 > r2:
            ans = 2
        elif r2 > r1:
            ans = -2
    if l > r1 + r2:
        ans = 0
    print(ans)

Solution (Python):
import math
n=int(input())
i=1
while n>=i:                                                     
    s=list(map(float,input().split()))
    
    d=math.sqrt((s[3]-s[0])*(s[3]-s[0])+(s[4]-s[1])*(s[4]-s[1]))
    
    if d>s[2]+s[5]:                                             
        print(0)
    elif abs(s[5]-s[2])<=d<=s[2]+s[5]:                          
        print(1)
    elif d<s[2]-s[5]:                                           
        print(2)
    elif d<s[5]-s[2]:                                           
        print(-2)
    i+=1

Solution (Python):
n = int(input())
for _ in range(n):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    d = ((xa - xb) ** 2 + (ya - yb) ** 2)**(1/2)
    if d > ra + rb:
        print(0)
    else:
        if d + rb < ra:
            print(2)
        elif d + ra < rb:
            print(-2)
        else:
            print(1)