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++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
#define EPS 1e-15
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

double lg(double x1,double y1){
  return sqrt(x1*x1+y1*y1);
}

int main(){
  double x[3],y[3];
  for(int i=0;i<3;i++)cin>>x[i]>>y[i];
  
  double vx[3],vy[3];
  for(int i=0;i<3;i++){
    int i1=(i+1)%3;
    int i2=(i+2)%3;

    vx[i]=x[i1]+x[i2]-2.0*x[i];
    vy[i]=y[i1]+y[i2]-2.0*y[i];
    double l=lg(vx[i],vy[i]);

    vx[i]/=l;
    vy[i]/=l;
  }
  /*
  for(int i=0;i<3;i++){
    dbg(vx[i]);
    dbg(vy[i]);
    cout<<endl;
  }
  //*/

  double ma=0;
  for(int i=0;i<3;i++){
    int ni=(i+1)%3;
    ma=max(ma,lg(x[i]-x[ni],y[i]-y[ni]));
  }

  //dbg(ma);
  
  double ok=0,ng=ma/4.0,mid;
  while(ng-ok>EPS){
    mid=(ok+ng)/2.0;
    
    /*
    cout<<endl;
    dbg(mid);
    //*/

    double px[3],py[3];
    for(int i=0;i<3;i++){
	 int i1=(i+1)%3;
	 double tx=x[i1]-x[i];
	 double ty=y[i1]-y[i];
	 
	 double co2=vx[i]*tx+vy[i]*ty;
	 co2/=lg(vx[i],vy[i])*lg(tx,ty);

	 double l=abs(mid/sqrt(1.0-co2*co2));
	 px[i]=x[i]+vx[i]*l;
	 py[i]=y[i]+vy[i]*l;

	 /*
	 dbg(i);
	 dbg(px[i]);
	 dbg(py[i]);
	 //*/
    }

    int f=0;
    for(int i=0;i<3;i++){
	 for(int j=i+1;j<3;j++){
	   double l=lg(px[i]-px[j],py[i]-py[j]);
	   if(l>=mid*2.0)f=1;
	 }
    }

    if(f)ok=mid;
    else ng=mid;
  }

  printf("%.10lf\n",ok);
  
  return 0;
}