Problem p00079 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <vector>

using namespace std;

//-------------------------------------------------------------------------
// geometric library

namespace geometry {

#define EPS 1E-10 ///< 0とみなすサイズ。適当

struct point {
  double x;
  double y;

  point &operator+=(const point &rhs) {
    x += rhs.x;
    y += rhs.y;
    return *this;
  }
  point &operator-=(const point &rhs) {
    x -= rhs.x;
    y -= rhs.y;
    return *this;
  }
  point &operator/=(double factor) {
    x /= factor;
    y /= factor;
    return *this;
  }
  point &operator*=(double factor) {
    x *= factor;
    y *= factor;
    return *this;
  }
  bool operator==(const point &rhs) const {
    return (std::abs(x - rhs.x) < EPS) && (std::abs(y - rhs.y) < EPS);
  }
  bool operator!=(const point &rhs) const { return !(*this == rhs); }
  bool operator<=(const point &rhs) const {
    return x < rhs.x || (x == rhs.x && y <= rhs.y);
  }
  bool operator>=(const point &rhs) const {
    return x > rhs.x || (x == rhs.x && y >= rhs.y);
  }
  bool operator<(const point &rhs) const { return !(*this >= rhs); }
  bool operator>(const point &rhs) const { return !(*this <= rhs); }
};

enum rotate_dir { rotate_None = 0, rotate_CW = 1, rotate_CCW = -1 };

point operator+(const point &p1, const point &p2) {
  point p(p1);
  p += p2;
  return p;
}

point operator/(const point &p1, double factor) {
  point p(p1);
  p /= factor;
  return p;
}

point operator-(const point &p1, const point &p2) {
  point p(p1);
  p -= p2;
  return p;
}

///! 2点の距離
double get_distance(const point &p1, const point &p2) {
  return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
}

} // namespace geometry

//-------------------------------------------------------------------------
// solution

using namespace geometry;

double get_area_of_triangle(const point &p1, const point &p2, const point &p3) {
  double a = get_distance(p1, p2);
  double b = get_distance(p2, p3);
  double c = get_distance(p3, p1);
  double z = (a + b + c) / 2;

  return sqrt(z * (z - a) * (z - b) * (z - c));
}

double get_area_of_convex(const vector<point> &points) {
  double S = 0.0;

  for (int i = 2; i < points.size(); i++) {
    S += get_area_of_triangle(points[0], points[i - 1], points[i]);
  }
  return S;
}

int main(void) {
  vector<point> points;
  point p;
  char sep;

  while (cin >> p.x >> sep >> p.y) {
    points.push_back(p);
  }

  cout << get_area_of_convex(points);
  return 0;
}

Error: WA

Fixed submission:

#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <vector>

using namespace std;

//-------------------------------------------------------------------------
// geometric library

namespace geometry {

#define EPS 1E-10 ///< 0とみなすサイズ。適当

struct point {
  double x;
  double y;

  point &operator+=(const point &rhs) {
    x += rhs.x;
    y += rhs.y;
    return *this;
  }
  point &operator-=(const point &rhs) {
    x -= rhs.x;
    y -= rhs.y;
    return *this;
  }
  point &operator/=(double factor) {
    x /= factor;
    y /= factor;
    return *this;
  }
  point &operator*=(double factor) {
    x *= factor;
    y *= factor;
    return *this;
  }
  bool operator==(const point &rhs) const {
    return (std::abs(x - rhs.x) < EPS) && (std::abs(y - rhs.y) < EPS);
  }
  bool operator!=(const point &rhs) const { return !(*this == rhs); }
  bool operator<=(const point &rhs) const {
    return x < rhs.x || (x == rhs.x && y <= rhs.y);
  }
  bool operator>=(const point &rhs) const {
    return x > rhs.x || (x == rhs.x && y >= rhs.y);
  }
  bool operator<(const point &rhs) const { return !(*this >= rhs); }
  bool operator>(const point &rhs) const { return !(*this <= rhs); }
};

enum rotate_dir { rotate_None = 0, rotate_CW = 1, rotate_CCW = -1 };

point operator+(const point &p1, const point &p2) {
  point p(p1);
  p += p2;
  return p;
}

point operator/(const point &p1, double factor) {
  point p(p1);
  p /= factor;
  return p;
}

point operator-(const point &p1, const point &p2) {
  point p(p1);
  p -= p2;
  return p;
}

///! 2点の距離
double get_distance(const point &p1, const point &p2) {
  return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
}

} // namespace geometry

//-------------------------------------------------------------------------
// solution

using namespace geometry;

double get_area_of_triangle(const point &p1, const point &p2, const point &p3) {
  double a = get_distance(p1, p2);
  double b = get_distance(p2, p3);
  double c = get_distance(p3, p1);
  double z = (a + b + c) / 2;

  assert(z > a && z > b && z > c); // 3角形であるための条件

  return sqrt(z * (z - a) * (z - b) * (z - c));
}

double get_area_of_convex(const vector<point> &points) {
  double S = 0.0;

  for (int i = 2; i < points.size(); i++) {
    S += get_area_of_triangle(points[0], points[i - 1], points[i]);
  }
  return S;
}

int main(void) {
  vector<point> points;
  point p;
  char sep;

  while (cin >> p.x >> sep >> p.y) {
    points.push_back(p);
  }

  cout << get_area_of_convex(points);
  return 0;
}