pt operator&(const line &l1, const line &l2) {
  double d = l1.a * l2.b - l1.b * l2.a;
  assert(fabs(d) > eps);
  pt res(
    (l1.b * l2.c - l1.c * l2.b) / d,
    (l1.a * l2.c - l1.c * l2.a) / -d
  );
  assert(l1.side(res) == 0);
  assert(l2.side(res) == 0);
  return res;
}
void check_cross(const pt &cent, const double &r, const line &l, int need_cnt) {
  vector<pt> res = cross(cent, r, l);
  printf("check circle&line\n");
  for (int i = 0; i < sz(res); i++) {
    printf("  %.2lf %.2lf\n", res[i].x, res[i].y);
    assert(l.side(res[i]) == 0);
    assert(fabs((cent - res[i]).dist2() - r * r) < eps);
  }
  assert(sz(res) == need_cnt);
}
vector<pt> cross(const pt &center, double r,
                 const line &l) {
  double di = l.distz(center);
  double d2 = l.norm2();
  assert(fabs(d2) > eps);
  pt mid = center + pt(l.a, l.b) * (-di / d2);
  #ifdef DEBUG
  assert(l.side(mid) == 0);
  #endif

  double s = r * r - di * di / d2;
  if (s < -eps) return vector<pt>();
  if (fabs(di * di - r * r * d2) < eps)
    return vector<pt>(1, mid);

  pt off = pt(-l.b, l.a) * sqrt(s / d2);
  assert(fabs(off.dist2() - s) < eps);
  vector<pt> res;
  res.pb(mid + off);
  res.pb(mid - off);
  return res;
}