Language: C++

#include <iostream>
#include <algorithm>
#include <complex>
#include <vector>
#include <cstdio>

using namespace std;

typedef complex<double> Point;
typedef vector<Point> Polygon;

struct Segment{
  Point p1, p2;
};

typedef Segment Line;

const double EPS = 1e-10;

bool equals(double a, double b){
  return abs(a-b) < EPS;
}

double dot(Point a, Point b){
  return a.real()*b.real() + a.imag()*b.imag();
}

double cross(Point a, Point b){
  return a.real()*b.imag() - a.imag()*b.real();
}

bool isOrthogonal(Point a, Point b){
  return equals(dot(a, b), 0.0);
}

bool isOrthogonal(Point a1, Point a2, Point b1, Point b2){
  return isOrthogonal(a1-a2, b1-b2);
}

bool isOrthogonal(Segment s1, Segment s2){
  return equals(dot(s1.p2-s1.p1, s2.p2-s2.p1), 0.0);
}

bool isParallel(Point a, Point b){
  return equals(cross(a, b), 0.0);
}

bool isParallel(Point a1, Point a2, Point b1, Point b2){
  return isParallel(a1-a2, b1-b2);
}

bool isParallel(Segment s1, Segment s2){
  return equals(cross(s1.p2-s1.p1, s2.p2-s2.p1), 0.0);
}

Point project(Segment s, Point p){
  Point base = s.p2 - s.p1;
  double t = dot(p - s.p1, base) / norm(base);
  return s.p1 + base * t;
}

Point reflect(Segment s, Point p){
  return p + (project(s, p) - p) * 2.0;
}

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

int ccw(Point p0, Point p1, Point p2){
  Point a = p1 - p0;
  Point b = p2 - p0;
  if(cross(a, b) > EPS) return COUNTER_CLOCKWISE;
  if(cross(a, b) < -EPS) return CLOCKWISE;
  if(dot(a, b) < -EPS) return ONLINE_BACK;
  if(norm(a) < norm(b)) return ONLINE_FRONT;
  return ON_SEGMENT;
}

bool isIntersect(Point p1, Point p2, Point p3, Point p4){
  return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 &&
	  ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}

bool isIntersect(Segment s1, Segment s2){
  return isIntersect(s1.p1, s1.p2, s2.p1, s2.p2);
}

Point getCrossPoint(Segment s1, Segment s2){
  assert(isIntersect(s1, s2));
  Point base = s2.p2 - s2.p1;
  double d1 = abs(cross(base, s1.p1 - s2.p1));
  double d2 = abs(cross(base, s1.p2 - s2.p1));
  double t = d1 / (d1 + d2);
  return s1.p1 + (s1.p2 - s1.p1) * t;
}

Point getCrossPointLL(Line& l, Line& m){
  double d = cross(m.p2 - m.p1, l.p2 - l.p1);
  if(abs(d) < EPS); //lines are parallel
  return l.p1 + (l.p2 - l.p1) * cross(m.p2 - m.p1, m.p2 - l.p1) * (1.0 / d);
}

double getDistance(Point a, Point b){
  return abs(a - b);
}

double getDistanceLP(Line s, Point p){
  return abs(cross(s.p2 - s.p1, p - s.p1) / abs(s.p2 - s.p1));
}

double getDistanceSP(Segment s, Point p){
  if(dot(s.p2 - s.p1, p - s.p1) < 0.0) return abs(p - s.p1);
  if(dot(s.p1 - s.p2, p - s.p2) < 0.0) return abs(p - s.p2);
  return getDistanceLP(s, p);
}

double getDistance(Segment s1, Segment s2){
  if(isIntersect(s1, s2)) return 0.0;
  return min(min(getDistanceSP(s1, s2.p1), getDistanceSP(s1, s2.p2)),
	     min(getDistanceSP(s2, s1.p1), getDistanceSP(s2, s1.p2)));
}

double getAreaTri(Point a, Point b, Point c){
  b -= a;
  c -= a;
  return abs(b.real()*c.imag() - b.imag()*c.real()) / 2.0;
}

double kabs(const double a){
  return a>=0 ? a : -a;
}

int getCrossPoint(Point& p1, Point& p2, const Line& li, Point& o, double r){
  double a = (li.p2.imag()-li.p1.imag())/(li.p2.real()-li.p1.real());
  double b = -1.0;
  double c = -a*li.p1.real()+li.p1.imag();
   
  c = a*o.real() + b*o.imag() + c;
 
  const double aabb = a*a + b*b;
  const double ac = a*c;
  const double bc = b*c;
  const double D1 = ac*ac - aabb * (c*c - b*b*r*r);
  const double D2 = bc*bc - aabb * (c*c - a*a*r*r);
 
  if(D1 < 0 || D2 < 0) return 0;
 
  int ret;
 
  if(D1 == 0 && D2 == 0) ret = 1;
  else ret = 2;
   
  if(kabs(b) >= kabs(a)){      
    p1.real() = (-ac + sqrt(D1)) / aabb;
    p1.imag() = -(a*p1.real() + c) / b;
    p2.real() = (-ac - sqrt(D1)) / aabb;
    p2.imag() = -(a*p2.real() + c) / b;
  }else{
    p1.imag() = (-bc + sqrt(D2)) / aabb;
    p1.real() = -(b*p1.imag() + c) / a;
    p2.imag() = (-bc - sqrt(D2)) / aabb;
    p2.real() = -(b*p2.imag() + c) / a;
  }
   
  p1.real() += o.real();  p1.imag() += o.imag();
  p2.real() += o.real();  p2.imag() += o.imag();
   
  return ret;
}

Point rotate(Point p, Point o, double dir){
  Point res;
  dir = M_PI * dir / 180.0;
  p -= o;
  res.real() = p.real() * cos(dir) - p.imag() * sin(dir);
  res.imag() = p.real() * sin(dir) + p.imag() * cos(dir);
  res += o;
  return res;
}

Polygon convexCut(Polygon& polygon, Line line){
  Polygon res;
  int n = polygon.size();
  for(int i=0;i<n;i++){
    int d1 = ccw(line.p1, line.p2, polygon[i]);
    int d2 = ccw(line.p1, line.p2, polygon[(i+1)%n]);
    if(d1 != -1) res.push_back(polygon[i]);
    if(d1 == 1 && d2 == -1 || d1 == -1 && d2 == 1){
      Line tmp = (Line){polygon[i], polygon[(i+1)%n]};
      res.push_back(getCrossPointLL(line, tmp));
    }
  }
  return res;
}

Line perpBisector(Point a, Point b){
  Point m = (a + b) / 2.0;
  Point dir = Point(0);
  dir.imag() = 1;
  dir *= (b - a);
  return (Line){m, m + dir};
}

double getArea(Polygon& polygon){
  int n = polygon.size();
  double res = 0.0;
  if(n < 3) return res;
  for(int i=0;i<n;i++) res += cross(polygon[i], polygon[(i+1)%n]);
  return abs(res) / 2.0;
}

double solve(Point& a, Point& b, Point& c){
  Polygon polygon;
  polygon.push_back(Point(0, 0));
  polygon.push_back(Point(10000, 0));
  polygon.push_back(Point(10000, 10000));
  polygon.push_back(Point(0, 10000));
  polygon = convexCut(polygon, perpBisector(a, b));
  polygon = convexCut(polygon, perpBisector(a, c));
  return getArea(polygon) / (10000 * 10000);
}

main(){
  Point a, b, c;
  int time = 1;
  while(1){
    cin >> a.real() >> a.imag();
    cin >> b.real() >> b.imag();
    cin >> c.real() >> c.imag();
    if(a == Point(0) && b == Point(0) && c == Point(0)) break;
    printf("%d %.5f\n", time++, solve(a, b, c));
  }
  return 0;
}

Compiler output:
a.cc: In function 'Point getCrossPoint(Segment, Segment)':
a.cc:92:3: error: 'assert' was not declared in this scope
   92 |   assert(isIntersect(s1, s2));
      |   ^~~~~~
a.cc:6:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    5 | #include <cstdio>
  +++ |+#include <cassert>
    6 | 
a.cc: In function 'int getCrossPoint(Point&, Point&, const Line&, Point&, double)':
a.cc:157:12: error: lvalue required as left operand of assignment
  157 |     p1.real() = (-ac + sqrt(D1)) / aabb;
      |     ~~~~~~~^~
a.cc:158:12: error: lvalue required as left operand of assignment
  158 |     p1.imag() = -(a*p1.real() + c) / b;
      |     ~~~~~~~^~
a.cc:159:12: error: lvalue required as left operand of assignment
  159 |     p2.real() = (-ac - sqrt(D1)) / aabb;
      |     ~~~~~~~^~
a.cc:160:12: error: lvalue required as left operand of assignment
  160 |     p2.imag() = -(a*p2.real() + c) / b;
      |     ~~~~~~~^~
a.cc:162:12: error: lvalue required as left operand of assignment
  162 |     p1.imag() = (-bc + sqrt(D2)) / aabb;
      |     ~~~~~~~^~
a.cc:163:12: error: lvalue required as left operand of assignment
  163 |     p1.real() = -(b*p1.imag() + c) / a;
      |     ~~~~~~~^~
a.cc:164:12: error: lvalue required as left operand of assignment
  164 |     p2.imag() = (-bc - sqrt(D2)) / aabb;
      |     ~~~~~~~^~
a.cc:165:12: error: lvalue required as left operand of assignment
  165 |     p2.real() = -(b*p2.imag() + c) / a;
      |     ~~~~~~~^~
a.cc:168:10: error: lvalue required as left operand of assignment
  168 |   p1.real() += o.real();  p1.imag() += o.imag();
      |   ~~~~~~~^~
a.cc:168:34: error: lvalue required as left operand of assignment
  168 |   p1.real() += o.real();  p1.imag() += o.imag();
      |                           ~~~~~~~^~
a.cc:169:10: error: lvalue required as left operand of assignment
  169 |   p2.real() += o.real();  p2.imag() += o.imag();
      |   ~~~~~~~^~
a.cc:169:34: error: lvalue required as left operand of assignment
  169 |   p2.real() += o.real();  p2.imag() += o.imag();
      |                           ~~~~~~~^~
a.cc: In function 'Point rotate(Point, Point, double)':
a.cc:178:11: error: lvalue required as left operand of assignment
  178 |   res.real() = p.real() * cos(dir) - p.imag() * sin(dir);
      |   ~~~~~~~~^~
a.cc:179:11: error: lvalue required as left operand of assignment
  179 |   res.imag() = p.real() * sin(dir) + p.imag() * cos(dir);
      |   ~~~~~~~~^~
a.cc: In function 'Line perpBisector(Point, Point)':
a.cc:202:11: error: lvalue required as left operand of assignment
  202 |   dir.imag() = 1;
      |   ~~~~~~~~^~
a.cc: At global scope:
a.cc:226:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  226 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:230:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'double')
  230 |     cin >> a.real() >> a.imag();
      |     ~~~ ^~ ~~~~~~~~
      |     |            |
      |     |            double
      |     std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
                 from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  170 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:170:7: note:   conversion of argument 1 would be ill-formed:
a.cc:230:18: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double'
  230 |     cin >> a.real() >> a.imag();
      |            ~~~~~~^~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  174 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:174:7: note:   conversion of argument 1 would be ill-formed:
a.cc:230:18: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'double'
  230 |     cin >> a.real() >> a.imag();
      |            ~~~~~~^~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:177:7: note:   conversion of argument 1 would be ill-formed:
a.cc:230:18: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'double'
  230 |     cin >> a.real() >> a.imag();
      |            ~~~~~~^~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:181:7: note:   conversion of argument 1 would be ill-formed:
a.cc:230:18: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'double'
  230 |     cin >> a.real() >> a.imag();
      |            ~~~~~~^~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:184:7: note:   conversion of argument 1 would be ill-formed:
a.cc:230:18: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'double'
  230 |     cin >> a.real() >> a.imag();
      |            ~~~~~~^~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:188:7: note:   conversion of argument 1 would be ill-formed:
a.cc:230:18: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'double'
  230 |     cin >> a.real() >> a.imag();
      |            ~~~~~~^~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:192:7: note:   conversion of argument 1 would be ill-formed:
a.cc:230:18: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'double'
  230 |     cin >> a.real() >> a.imag();
      |            ~~~~~~^~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  199 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:199:7: note:   conversion of argument 1 would be ill-formed:
a.cc:230:18: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'double'
  230 |     cin >> a.real() >> a.imag();
      |            ~~~~~~^~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  203 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:203:7: note:   conversion of argument 1 would be ill-formed:
a.cc:230:18: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'double'
  230 |     cin >> a.real() >> a.imag();
      |            ~~~~~~^~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  219 |       operator>>(float& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:219:7: note:   conversion of argument 1 would be ill-formed:
a.cc:230:18: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'double'
  230 |     cin >> a.real() >> a.imag();
      |            ~~~~~~^~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  223 |       operator>>(double& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:223:7: note:   conversion of argument 1 would be ill-formed:
a.cc:230:18: error: cannot bind non-const lvalue reference of type 'double&' to an rvalue of type 'double'
  230 |     cin >> a.real() >> a.imag();
      |            ~~~~~~^~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  227 |       operator>>(long double& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:227:7: note:   convers