Problem:
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Common Tangent

Find common tangent lines of two circles $c1$ and $c2$.

Input

Center coordinates ($cix$, $ciy$) and radii $cir$ of two circles $c1$ are $c2$ are given in the following format.

$c1x \; c1y \; c1r$

$c2x \; c2y \; c2r$

All input values are given in integers.

Output

Print coordinates of the tangent points on circle $c1$ based on the following rules.

Print the coordinate with smaller $x$ first. In case of a tie, print the coordinate with smaller $y$ first.

The output values should be in a decimal fraction with an error less than 0.00001.

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

0.6153846154 1.9230769231
1.0000000000 0.0000000000
1.4183420913 1.9082895434
1.7355040625 0.3224796874

Sample Input 2

1 2 1
4 2 2

Sample Output 2

0.6666666667 1.0571909584
0.6666666667 2.9428090416
2.0000000000 2.0000000000

Sample Input 3

1 2 1
3 2 2

Sample Output 3

0.5000000000 1.1339745962
0.5000000000 2.8660254038

Sample Input 4

0 0 1
1 0 2

Sample Output 4

-1.0000000000 0.0000000000

Sample Input 5

0 0 1
0 0 2

Sample Output 5

No output.

Solution in C# (judge verdict: Wrong Answer)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static readonly double EPS = 1E-10;

        static void Main(string[] args)
        {
            double[] input;
            Circle c1, c2;

            input = Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse);
            c1 = new Circle(new Point(input[0], input[1]), input[2]);

            input = Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse);
            c2 = new Circle(new Point(input[0], input[1]), input[2]);

            List<Point> ans = CommonTangent(c1, c2);
            ans.Sort();

            StringBuilder sb = new StringBuilder();
            foreach (var point in ans) sb.AppendLine(point.ToString());
            Console.Write(sb);
        }

        static List<Point> CommonTangent(Circle a, Circle b)
        {
            double ar = a.r, br = b.r;
            Point ac = a.p, bc = b.p;
            double d = (ac - bc).Abs, dr = Math.Abs(ar - br), sr = Math.Abs(ar + br);

            List<Point> ret = new List<Point>();

            if (d > sr)
            {
                Point cp = (ac * br + bc * ar) / sr;
                Point[] ats = Tangent(a, cp);
                ret.AddRange(ats);
            }
            else if (Math.Abs(d - sr) < EPS)
            {
                Point cp = (ac * br + bc * ar) / sr;
                ret.Add(cp);
            }

            if (d > dr)
            {
                if (dr < EPS)
                {
                    Point v = (bc - ac) / d;
                    v.x = 0.0;
                    ret.Add(ac + v);
                    ret.Add(ac - v);
                }
                else
                {
                    Point cp = ac + (bc - ac) * ar / (ar - br);
                    Point[] ats = Tangent(a, cp);
                    ret.AddRange(ats);
                }
            }
            else if (Math.Abs(d - dr) < EPS)
            {
                Point cp = (bc - ac) * ar / (ar - br);
                ret.Add(cp);
            }

            return ret;
        }

        static Point[] Tangent(Circle c, Point p)
        {
            Point cp = p - c.p;
            double d = Math.Sqrt(cp.Norm - c.r * c.r);
            double k = c.r / cp.Norm;
            double r = c.r * k, ds = d * k;

            double ax = c.p.x + cp.x * r - cp.y * ds;
            double ay = c.p.y + cp.y * r + cp.x * ds;
            double bx = c.p.x + cp.x * r + cp.y * ds;
            double by = c.p.y + cp.y * r - cp.x * ds;

            Point[] ret = new Point[] { new Point(ax, ay), new Point(bx, by) };
            return ret;
        }
    }

    class Point : IComparable
    {
        static readonly double EPS = 1E-10;

        internal double x, y;

        public Point(double x, double y)
        {
            this.x = x;
            this.y = y;
        }

        public double Abs { get { return Math.Sqrt(Norm); } }
        public double Norm { get { return x * x + y * y; } }

        public double Dot(Point p) { return x * p.x + y * p.y; }
        public double Cross(Point p) { return x * p.y - y * p.x; }
        public double Distance(Point p) { return (this - p).Abs; }

        public static Point operator +(Point a, Point b) { return new Point(a.x + b.x, a.y + b.y); }
        public static Point operator -(Point a, Point b) { return new Point(a.x - b.x, a.y - b.y); }
        public static Point operator *(Point p, double d) { return new Point(p.x * d, p.y * d); }
        public static Point operator /(Point p, double d) { return new Point(p.x / d, p.y / d); }
        public static bool operator <(Point a, Point b) { return Math.Abs(a.x - b.x) > EPS ? a.x < b.x : a.y < b.y; }
        public static bool operator >(Point a, Point b) { return Math.Abs(a.x - b.x) > EPS ? a.x > b.x : a.y > b.y; }
        public static bool operator ==(Point a, Point b) { return Math.Abs(a.x - b.x) < EPS && Math.Abs(a.y - b.y) < EPS; }
        public static bool operator !=(Point a, Point b) { return Math.Abs(a.x - b.x) >= EPS || Math.Abs(a.y - b.y) >= EPS; }

        public int CompareTo(object obj)
        {
            var other = obj as Point;
            if (obj == null) return -1;

            ComparerX compX = new ComparerX();
            return compX.Compare(this, other);
        }

        public override bool Equals(object obj)
        {
            var other = obj as Point;
            return Math.Abs(x - other.x) < EPS && Math.Abs(y - other.y) < EPS;
        }

        public override int GetHashCode()
        {
            return x.GetHashCode() ^ y.GetHashCode();
        }

        public override string ToString()
        {
            return string.Format("{0:f10} {1:f10}", x, y);
        }
    }

    class ComparerX : IComparer<Point>
    {
        static readonly double EPS = 1E-10;

        public int Compare(Point a, Point b)
        {
            if (a.x - b.x < -EPS) return -1;
            if (a.x - b.x > EPS) return 1;
            if (a.y - b.y < -EPS) return -1;
            if (a.y - b.y > EPS) return 1;
            return 0;
        }
    }

    class ComparerY : IComparer<Point>
    {
        static readonly double EPS = 1E-10;

        public int Compare(Point a, Point b)
        {
            if (a.y - b.y < -EPS) return -1;
            if (a.y - b.y > EPS) return 1;
            if (a.x - b.x < -EPS) return -1;
            if (a.x - b.x > EPS) return 1;
            return 0;
        }
    }

    class Segment
    {
        internal Point p1, p2;

        public Segment(Point p1, Point p2)
        {
            this.p1 = p1;
            this.p2 = p2;
        }
    }

    class Circle
    {
        internal Point p;
        internal double r;

        public Circle(Point p, double r)
        {
            this.p = p;
            this.r = r;
        }
    }
}