Problem:
Intersection of Circles For given two circles $c1$ and $c2$, print 4 if they do not cross (there are 4 common tangent lines), 3 if they are circumscribed (there are 3 common tangent lines), 2 if they intersect (there are 2 common tangent lines), 1 if a circle is inscribed in another (there are 1 common tangent line), 0 if a circle includes another (there is no common tangent line). Input Coordinates and radii of $c1$ and $c2$ are given in the following format. $c1x \; c1y \; c1r$ $c2x \; c2y \; c2r$ $c1x$, $c1y$ and $c1r$ represent the center coordinate and radius of the first circle.
  $c2x$, $c2y$ and $c2r$ represent the center coordinate and radius of the second circle.
  All input values are given in integers. Output Print "4", "3", "2", "1" or "0" in a line. Constraints  $-1,000 \leq c1x, c1y, c2x, c2y \leq 1,000$  $1 \leq c1r, c2r \leq 1,000$  $c1$ and $c2$ are different  Sample Input 1 1 1 1
6 2 2 Sample Output 1 4 Sample Input 2 1 2 1
4 2 2 Sample Output 2 3 Sample Input 3 1 2 1
3 2 2 Sample Output 3 2 Sample Input 4 0 0 1
1 0 2 Sample Output 4 1 Sample Input 5 0 0 1
0 0 2 Sample Output 5 0

Solution (Python):
x1, y1, r1 = map(int, raw_input().split())
x2, y2, r2 = map(int, raw_input().split())
rr = (x1 - x2)**2 + (y1 - y2)**2
ro = (r1 + r2)**2
ri = (r1 - r2)**2
if rr > ro:
    print 4
elif rr == ro:
    print 3
elif ri < rr < ro:
    print 2
elif ri == rr:
    print 1
else: 
    print 0

Solution (Python):




"""
input:
1 2 1
4 2 2

output:
3
"""

import sys
from collections import namedtuple


class CircleIntersections(object):
    def __init__(self, ):
        _input = sys.stdin.readlines()
        x1, y1, r1 = map(int, _input[0].split())
        x2, y2, r2 = map(int, _input[1].split())

        Circle = namedtuple('Circle', ('centre', 'radius'))
        self.c1 = Circle(centre=x1 + y1 * 1j, radius=r1)
        self.c2 = Circle(centre=x2 + y2 * 1j, radius=r2)

    def calc_intersection(self):
        c_distance = abs(self.c2.centre - self.c1.centre)
        r1, r2 = self.c1.radius, self.c2.radius

        if c_distance > r1 + r2:
            return 4
        elif c_distance == r1 + r2:
            return 3
        elif abs(r1 - r2) < c_distance < r1 + r2:
            return 2
        elif c_distance == abs(r1 - r2):
            return 1
        else:
            return 0


if __name__ == '__main__':
    case = CircleIntersections()
    print(case.calc_intersection())

Solution (Python):




"""
input:
1 2 1
4 2 2

output:
3
"""

import sys
from collections import namedtuple


class CircleIntersections(object):
    def __init__(self, in_data):
        x1, y1, r1 = map(int, in_data[0].split())
        x2, y2, r2 = map(int, in_data[1].split())

        Circle = namedtuple('Circle', ('centre', 'radius'))
        self.c1 = Circle(centre=x1 + y1 * 1j, radius=r1)
        self.c2 = Circle(centre=x2 + y2 * 1j, radius=r2)

    def calc_intersection(self):
        c_distance = abs(self.c2.centre - self.c1.centre)
        r1, r2 = self.c1.radius, self.c2.radius

        if c_distance > r1 + r2:
            return 4
        elif c_distance == r1 + r2:
            return 3
        elif abs(r1 - r2) < c_distance < r1 + r2:
            return 2
        elif c_distance == abs(r1 - r2):
            return 1
        else:
            return 0


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    case = CircleIntersections(in_data=_input)
    print(case.calc_intersection())

Solution (Python):
def dist(ax,ay,bx,by):
    return ((bx-ax)**2 + (by-ay)**2)**0.5

x1,y1,r1 = map(float,input().split())
x2,y2,r2 = map(float,input().split())

d = dist(x1,y1,x2,y2)
if d > r1 + r2:
    print(4)
elif d == r1+r2:
    print(3)
elif d + r1 == r2 or d + r2 == r1:
    print(1)
elif d + r1 < r2 or d + r2 < r1:
    print(0)
else:
    print(2)

Solution (Python):
from math import sqrt

c1x, c1y, c1r = map(int, input().split())
c2x, c2y, c2r = map(int, input().split())
d = sqrt((c2x - c1x) ** 2 + (c2y - c1y) ** 2)
sr, dr = c1r + c2r, abs(c1r - c2r)
eps = 1e-6
if d - sr > eps:
    print(4)
elif abs(d - sr) < eps:
    print(3)
elif d - dr > eps:
    print(2)
elif abs(d - dr) < eps:
    print(1)
else:
    print(0)

Solution (Python):

cx1, cy1, r1 = map(float, input().split())
cx2, cy2, r2 = map(float, input().split())

import math
distance = math.sqrt( math.pow(cx1-cx2, 2) + math.pow(cy1-cy2, 2) )
rsum = r1 + r2
rmax = max(r1, r2)
rmin = min(r1, r2)

import sys
if distance > rsum:
  print(4)
elif abs(distance - rsum) < sys.float_info.epsilon:
  print(3)
else:
  if rmax < distance + rmin:
    print(2)
  elif abs(rmax - distance - rmin) < sys.float_info.epsilon:
    print(1)
  else:
    print(0)

Solution (Python):
from math import sqrt

x1, y1, r1 = map(float, input().split())
x2, y2, r2 = map(float, input().split())

d = sqrt((x1 - x2)**2 + (y1 - y2)**2)
g = max(r1 - r2, r2 - r1)

if d <  g:
    print(0)

if d == g:
    print(1)

if d >  g:
    if d <  r1 + r2: print(2)
    if d == r1 + r2: print(3)
    if d >  r1 + r2: print(4)

Solution (Python):

import math

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

def Exchange(c1, c2):
    return list((c2, c1))

data = list(map(int, input("").split()))
c1 = Circle(data[0],data[1],data[2])

data = list(map(int, input("").split()))
c2 = Circle(data[0],data[1],data[2])

if c1.r < c2.r:
    [c1, c2] = Exchange(c1, c2)
 
d = math.sqrt((c1.x - c2.x)**2 + (c1.y - c2.y)**2)

if d > c1.r + c2.r:
    print(4)
elif d == c1.r + c2.r:
    print(3)
elif c1.r - c2.r < d and d < c1.r + c2.r:
    print(2)
elif d == c1.r - c2.r:
    print(1)
elif d < c1.r - c2.r:
    print(0)

Solution (Python):
import math

c1x,c1y,c1r = [int(i) for i in input().split()]
c2x,c2y,c2r = [int(i) for i in input().split()]

d = math.sqrt(pow(c1x-c2x, 2) +  pow(c1y-c2y, 2))

s = c1r + c2r

if d > s:
    print(4)
elif d == s:
    print(3)
else:
    if c1r > c2r:
        if d + c2r > c1r:
            print(2)
        elif d + c2r == c1r:
            print(1)
        else:
            print(0)
    else:
        if d + c1r > c2r:
            print(2)
        elif d + c1r == c2r:
            print(1)
        else:
            print(0)

Solution (Python):
import math

c1x,c1y,c1r = [int(i) for i in input().split()]
c2x,c2y,c2r = [int(i) for i in input().split()]

d = math.sqrt(pow(c1x-c2x, 2) +  pow(c1y-c2y, 2))

bcr = 0
scr = 0

if c1r > c2r:
    bcr = c1r
    scr = c2r
else:
    bcr = c2r
    scr = c1r


if d > bcr + scr:
    print(4)
elif d == bcr + scr:
    print(3)
elif d + scr > bcr:
    print(2)
elif d + scr == bcr:
    print(1)
else:
    print(0)

Solution (Python):
import math
from enum import Enum, auto

class TwoCircle(Enum):
    DISTANT = auto()
    CIRCUMCSCRIBING = auto()
    INTERSECTING = auto()
    INSCRIBING = auto()
    CONTAINING = auto()

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

    def distance(self, pnt):
        return math.sqrt((self.x - pnt.x)**2 + (self.y - pnt.y)**2)

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

    def is_intersected(self, cir):
        d = self.c.distance(cir.c)
        if d > self.r + cir.r:
            return TwoCircle.DISTANT
        elif d == self.r + cir.r:
            return TwoCircle.CIRCUMCSCRIBING
        elif d == abs(self.r - cir.r):
            return TwoCircle.INSCRIBING
        elif d < abs(self.r - cir.r):
            return TwoCircle.CONTAINING
        else:
            return TwoCircle.INTERSECTING

x1, y1, r1 = list(map(int, input().split(' ')))
x2, y2, r2 = list(map(int, input().split(' ')))
cir1 = Circle(x1, y1, r1)
cir2 = Circle(x2, y2, r2)

judged = cir1.is_intersected(cir2)
if judged == TwoCircle.DISTANT: print(4)
elif judged == TwoCircle.CIRCUMCSCRIBING: print(3)
elif judged == TwoCircle.INTERSECTING: print(2)
elif judged == TwoCircle.INSCRIBING: print(1)
elif judged == TwoCircle.CONTAINING: print(0)

Solution (Python):
if __name__=='__main__' :
    c1=input().split()
    c2=input().split()

    cx1 = int(c1[0])
    cy1 = int(c1[1])
    cr1 = int(c1[2])

    cx2 = int(c2[0])
    cy2 = int(c2[1])
    cr2 = int(c2[2])

    d = ((cx1-cx2)**2+(cy1-cy2)**2)**(1/2)
    if d > cr1+cr2 :
        print(4)
    elif d == cr1+cr2 :
        print(3)
    elif (d < cr1+cr2) and (abs(cr1-cr2) < d) :
        print(2)
    elif  abs(cr1-cr2) == d :
        print(1)
    elif d < abs(cr1-cr2) :
        print(0)

Solution (Python):
import sys
import math

cx1,cy1,cr1 = (int(x) for x in input().split())
cx2,cy2,cr2 = (int(x) for x in input().split())


distance = math.sqrt((cx1 - cx2)**2 + (cy1 - cy2)**2)

if(distance > cr1+cr2):
    result = 4
elif(distance == cr1+cr2):
    result = 3
elif((distance<cr1 and (distance+cr2 == cr1)) or (distance<cr2 and (distance+cr1 == cr2))):
    result = 1
elif((distance<cr1 and (distance+cr2 < cr1)) or (distance<cr2 and (distance+cr1< cr2))):
    result = 0
elif(distance < cr1+cr2):
    result = 2



print(result)

Solution (Python):
c1x, c1y, c1r = map(int, input().split())
c2x, c2y, c2r = map(int, input().split())

distance = (pow(c1y - c2y, 2) + pow(c1x - c2x, 2)) ** 0.5
if distance > c1r + c2r:
    print(4)
elif distance == c1r + c2r:
    print(3)
elif distance == abs(c1r - c2r):
    print(1)
elif distance < abs(c1r - c2r):
    print(0)
else:
    print(2)

Solution (Python):
import math

c1x, c1y, c1r = map(int, input().split())
c2x, c2y, c2r = map(int, input().split())

d = math.sqrt((c1x-c2x)**2 + (c1y-c2y)**2)
if d > c1r + c2r:
    print(4)
elif d == c1r + c2r:
    print(3)
elif d+c1r==c2r or d+c2r==c1r:
    print(1)
elif d+c1r<c2r or d+c2r<c1r:
    print(0)
else:
    print(2)

Solution (Python):
import math

listC1=list(map(int,input().split()))
listC2=list(map(int,input().split()))
output = 0


dist = math.sqrt((listC1[0]-listC2[0])**2+(listC1[1]-listC2[1])**2)
if dist > (listC1[2]+listC2[2]):
	output = 4
elif dist == (listC1[2]+listC2[2]):
	output = 3
elif abs(listC1[2]-listC2[2]) < dist < (listC1[2]+listC2[2]):
	output = 2
elif dist == abs(listC1[2]-listC2[2]):
	output = 1
elif dist < abs(listC1[2]-listC2[2]):
	output = 0


print(output)

Solution (Python):
from math import sqrt

c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))

d = sqrt((c1[0]-c2[0])**2 + (c1[1]-c2[1])**2)
lsum = c1[2] + c2[2]
lsub = abs(c1[2] - c2[2])

if d>lsum: print('4')
if d == lsum: print('3')
if lsub<d<lsum: print('2')
if d == lsub: print('1')
if d<lsub: print('0')

Solution (Python):
from math import pi, cos, sin, atan2
EPS = 10**(-9)

def eq(value1, value2):
    return abs(value1-value2) <= EPS

class Point():
    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.arg = atan2(y, x) 
    
    def __str__(self):
        return "{0:.8f} {1:.8f}".format(self.x, self.y)
    
    def __add__(self, other):
        return Point(self.x + other.x, self.y + other.y)
    
    def __sub__(self, other):
        return Point(self.x - other.x, self.y - other.y)
    
    def __mul__(self, scal):
        return Point(self.x*scal, self.y*scal)
    
    def __truediv__(self, scal):
        return Point(self.x/scal, self.y/scal)
    
    def __eq__(self, other):
        return eq(self.x, other.x) and eq(self.y, other.y)

    
    def __abs__(self):
        return (self.x**2+self.y**2)**0.5
    

def Rotation(vec: Point, rad):
    return Point(vec.x*cos(rad)-vec.y*sin(rad), vec.x*sin(rad)+vec.y*cos(rad))


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


class Line():
    
    def __init__(self, a, b):
        self.a = a
        self.b = b
        self.arg = (a-b).arg % pi
    
    def __str__(self):
        return "[({0}, {1}) - ({2}, {3})]".format(self.a.x, self.a.y, self.b.x, self.b.y)

    
    def par(self, point):
        return Line(point, point+(self.a-self.b))

    
    def tan(self, point):
        return Line(point, point + Rotation(self.a-self.b, pi/2))


class Segment(Line):
    def __init__(self, a, b):
        super().__init__(a, b)



def cross(vec1: Point, vec2: Point):
    return vec1.x*vec2.y - vec1.y*vec2.x


def dot(vec1: Point, vec2: Point):
    return vec1.x*vec2.x + vec1.y*vec2.y


def ccw(a, b, c):
    if cross(b-a, c-a) > EPS: return +1 
    if cross(b-a, c-a) < -EPS: return -1 
    if dot(c-a, b-a) < -EPS: return +2 
    if abs(b-a) < abs(c-a): return -2 
    return 0 



def projection(l, p):
    t = dot(l.b-l.a, p-l.a) / abs(l.a-l.b)**2
    return l.a + (l.b-l.a)*t


def reflection(l, p):
    return p + (projection(l, p) - p)*2

def isPararell(l1, l2):
    return eq(cross(l1.a-l1.b, l2.a-l2.b), 0)

def isVertical(l1, l2):
    return eq(dot(l1.a-l1.b, l2.a-l2.b), 0)


def isIntersect_lp(l, p):
    return abs(ccw(l.a, l.b, p)) != 1

def isIntersect_ll(l1, l2):
    return not isPararell(l1, l2) or isIntersect_lp(l1, l2.a)

def isIntersect_sp(s, p):
    return ccw(s.a, s.b, p) == 0

def isIntersect_ss(s1, s2):
    return ccw(s1.a, s1.b, s2.a)*ccw(s1.a, s1.b, s2.b) <= 0 and ccw(s2.a, s2.b, s1.a)*ccw(s2.a, s2.b, s1.b) <= 0

def isIntersect_ls(l, s):
    return cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < EPS

def isIntersect_cp(c, p):
    return abs(abs(c.p - p) - c.r) < EPS

def isIntersect_cl(c, l):
    return distance_lp(l, c.p) <= c.r + EPS

def isIntersect_cs(c, s):
    pass

def intersect_cc(c1, c2):
    if c1.r < c2.r:
        c1, c2 = c2, c1
    d = abs(c1.p - c2.p)
    if eq(c1.r + c2.r, d): return 3 
    if eq(c1.r - c2.r, d): return 1 
    if c1.r + c2.r < d: return 4 
    if c1.r - c2.r < d: return 2 
    return 0 


def distance_pp(p1, p2):
    return abs(p1-p2)

def distance_lp(l, p):
    return abs(projection(l,p)-p)

def distance_ll(l1, l2):
    return 0 if isIntersect_ll(l1, l2) else distance_lp(l1, l2.a)

def distance_sp(s, p):
    r = projection(s, p)
    if isIntersect_sp(s, r): return abs(r-p)
    return min(abs(s.a-p), abs(s.b-p))

def distance_ss(s1, s2):
    if isIntersect_ss(s1, s2): return 0
    return min([distance_sp(s1, s2.a), distance_sp(s1, s2.b), distance_sp(s2, s1.a), distance_sp(s2, s1.b)])

def distance_ls(l, s):
    if isIntersect_ls(l, s): return 0
    return min(distance_lp(l, s.a), distance_lp(l, s.b))


def crosspoint_ll(l1, l2):
    A = cross(l1.b - l1.a, l2.b - l2.a)
    B = cross(l1.b - l1.a, l1.b - l2.a)
    if eq(abs(A), 0) and eq(abs(B), 0): return l2.a
    return l2.a + (l2.b - l2.a) * B / A

def crosspoint_ss(s1, s2):
    return crosspoint_ll(s1, s2)

def crosspoint_lc(l, c):
    if eq(distance_lp(l, c.p), c.r): return [c.p]
    p = projection(l, c.p)
    e = (l.b - l.a) / abs(l.b-l.a)
    dis = (c.r**2-abs(p-c.p)**2)**0.5
    return [p + e*dis, p - e*dis]

def crosspoint_sc(s, c):
    pass

def crosspoint_cc(c1, c2):
    d = abs(c1.p-c2.p)
    if not abs(c1.r-c2.r) <= d <= c1.r+c2.r:
        return []
    mid_p = (c2.p * (c1.r**2-c2.r**2+d**2) + c1.p * (c2.r**2-c1.r**2+d**2)) / (2*d**2)
    tanvec = Rotation(c1.p-c2.p, pi/2)
    return crosspoint_lc(Line(mid_p, mid_p+tanvec), c1)



def tangent_cp(c, p):
    return crosspoint_cc(c, Circle(p, (abs(p-c.p)**2 - c.r**2)**0.5))





import sys
input = sys.stdin.readline

def verify_1A():
    p1x, p1y, p2x, p2y = map(int, input().split())
    l = Line(Point(p1x, p1y), Point(p2x, p2y))
    Q = int(input())
    Query = [list(map(int, input().split())) for _ in range(Q)]
    for px, py in Query:
        p = Point(px, py)
        print(projection(l, p))

def verify_1B():
    p1x, p1y, p2x, p2y = map(int, input().split())
    l = Line(Point(p1x, p1y), Point(p2x, p2y))
    Q = int(input())
    Query = [list(map(int, input().split())) for _ in range(Q)]
    for px, py in Query:
        p = Point(px, py)
        print(reflection(l, p))

def verify_1C():
    p1x, p1y, p2x, p2y = map(int, input().split())
    p1 = Point(p1x, p1y); p2 = Point(p2x, p2y)
    Q = int(input())
    Query = [list(map(int, input().split())) for _ in range(Q)]
    for px, py in Query:
        p = Point(px, py)
        result = ccw(p1, p2, p)
        if result == 1:
            print("COUNTER_CLOCKWISE")
        elif result == -1:
            print("CLOCKWISE")
        elif result == 2:
            print("ONLINE_BACK")
        elif result == -2:
            print("ONLINE_FRONT")
        else:
            print("ON_SEGMENT")

def verify_2A():
    Q = int(input())
    Query = [list(map(int, input().split())) for _ in range(Q)]
    for p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y in Query:
        l1 = Line(Point(p0x, p0y), Point(p1x, p1y))
        l2 = Line(Point(p2x, p2y), Point(p3x, p3y))
        if isPararell(l1, l2):
            print(2)
        elif isVertical(l1, l2):
            print(1)
        else:
            print(0)

def verify_2B():
    Q = int(input())
    Query = [list(map(int, input().split())) for _ in range(Q)]
    for p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y in Query:
        s1 = Segment(Point(p0x, p0y), Point(p1x, p1y))
        s2 = Segment(Point(p2x, p2y), Point(p3x, p3y))
        if isIntersect_ss(s1, s2):
            print(1)
        else:
            print(0)


def verify_2C():
    Q = int(input())
    Query = [list(map(int, input().split())) for _ in range(Q)]
    for p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y in Query:
        s1 = Segment(Point(p0x, p0y), Point(p1x, p1y))
        s2 = Segment(Point(p2x, p2y), Point(p3x, p3y))
        print(crosspoint_ss(s1, s2))  

def verify_2D():
    Q = int(input())
    Query = [list(map(int, input().split())) for _ in range(Q)]
    for p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y in Query:
        s1 = Segment(Point(p0x, p0y), Point(p1x, p1y))
        s2 = Segment(Point(p2x, p2y), Point(p3x, p3y))
        print("{:.8f}".format(distance_ss(s1, s2)))

def verify_7A():
    c1x, c1y, c1r = map(int, input().split())
    c2x, c2y, c2r = map(int, input().split())
    print(intersect_cc(Circle(Point(c1x, c1y), c1r), Circle(Point(c2x, c2y), c2r)))

verify_7A()