Problem:
Score : 500 points

Problem Statement

#nck {
width: 30px;
height: auto;
}

Snuke received a triangle as a birthday present.
The coordinates of the three vertices were (x_1, y_1), (x_2, y_2), and (x_3, y_3).

He wants to draw two circles with the same radius inside the triangle such that the two circles do not overlap (but they may touch).
Compute the maximum possible radius of the circles.

Constraints

0 ≤ x_i, y_i ≤ 1000

The coordinates are integers.

The three points are not on the same line.

Input

The input is given from Standard Input in the following format:

x_1 y_1
x_2 y_2
x_3 y_3

Output

Print the maximum possible radius of the circles.
The absolute error or the relative error must be at most 10^{-9}.

Sample Input 1

0 0
1 1
2 0

Sample Output 1

0.292893218813

Sample Input 2

3 1
1 5
4 9

Sample Output 2

0.889055514217

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.Remoting.Contexts;
using System.Security.Cryptography.X509Certificates;

namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;
        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }
            var res = line[index];
            index++;
            return res;
        }
        public int NextInt()
        {
            return int.Parse(Next());
        }
        public long NextLong()
        {
            return long.Parse(Next());
        }
        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }
        public int[] IntArray()
        {
            var array = Array();
            var result = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = int.Parse(array[i]);
            }

            return result;
        }
        public long[] LongArray()
        {
            var array = Array();
            var result = new long[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = long.Parse(array[i]);
            }

            return result;
        }
    }

    struct P
    {
        public double X, Y;

        public P(double x, double y)
        {
            X = x;
            Y = y;
        }
    }

    class Program
    {
        private P A, B, C;
        private double a, b, c;
        private void Scan()
        {
            var sc = new Scanner();
            A = new P(sc.NextInt(), sc.NextInt());
            B = new P(sc.NextInt(), sc.NextInt());
            C = new P(sc.NextInt(), sc.NextInt());
        }

        public void Solve()
        {
            Scan();
            a = Dist(B, C);
            b = Dist(C, A);
            c = Dist(A, B);
            double s = S(A, B, C);
            double r = s / (a + b + c) * 2;
            double min = 0;
            double max = r;
            double l = Math.Max(Math.Max(a, b), c);
            for (int i = 0; i < 10000; i++)
            {
                double mid = (min + max) / 2;
                if (mid * 2 < l * (1 - (mid / r)))
                {

                    min = mid;
                }
                else
                {
                    max = mid;
                }
            }
            Console.WriteLine(min);
        }

        private double S(P one, P two, P three)
        {
            return S(new P(two.X - one.X, two.Y - one.Y), new P(three.X - one.X, three.Y - one.Y));
        }

        private double S(P one, P two)
        {
            return Math.Abs(one.X * two.Y - one.Y * two.X) / 2;
        }

        private double Dist(P one, P two)
        {
            return Math.Sqrt((one.X - two.X) * (one.X - two.X) + (one.Y - two.Y) * (one.Y - two.Y));
        }

        static void Main(string[] args)
        {
            new Program().Solve();
        }
    }
}