Language: C++

#define equals(a, b) (fabs((a) - (b)) < EPS )
class Point{
public:
  double x, y;
  Point ( double x = 0, double y = 0): x(x), y(y){}
  Point operator + ( Point p ){ return Point(x + p.x, y + p.y); }
  Point operator - ( Point p ){ return Point(x - p.x, y - p.y); }
  Point operator * ( double a ){ return Point(x*a, y*a); }
  Point operator / ( double a ){ return Point(x/a, y/a); }
  double abs() { return sqrt(norm());}
  double norm() { return x*x + y*y; }
  bool operator < ( const Point &p ) const {
    return x != p.x ? x < p.x : y < p.y;
  }
  bool operator == ( const Point &p ) const {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};
class Segment{
public:
  Point p1, p2;
  Segment ( Point p1 = Point(0.0,0.0), Point p2 = Point(0.0,0.0)): p1(p1), p2(p2){}
  double abs() { return sqrt(norm());}
  double norm() { return (p2.x - p1.x)*(p2.x - p1.x) + (p2.y - p1.y)*(p2.y - p1.y); }
};
typedef Point Vector;
typedef Segment Line;
double norm( Vector a ){ return a.x*a.x + a.y*a.y; }
double abs( Vector a ){ return sqrt(norm(a)); }
double dot( Vector a, Vector b ){ return a.x*b.x + a.y*b.y; }
double cross( Vector a, Vector b ){ return a.x*b.y - a.y*b.x; }
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);
}

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

Point p;
double r;
Segment s;

Point rotate( Point a, double si,double co){
  return Point(a.x*co-a.y*si,a.x*si+a.y*co);
}

vector<Point> solve(){
  vector<Point> res;
  Point q=project(s,p);
  double d=sqrt(r*r-abs(p-q)*abs(p-q));
  Vector base=s.p1-s.p2;
  res.push_back(q+base*(d/abs(base)));
  res.push_back(q-base*(d/abs(base)));
  return res;
}

int main(){
  cin>>p.x>>p.y>>r;
  int tc;
  cin>>tc;
  for(int i=0;i<tc;i++){
    cin>>s.p1.x>>s.p1.y>>s.p2.x>>s.p2.y;
    vector<Point> t=solve();
    printf("%.8f %.8f %.8f %.8f\n",t[0].x,t[0].y,t[1].x,t[1].y);
  }
  return 0;
}

Compiler output:
a.cc: In member function 'double Point::abs()':
a.cc:10:25: error: 'sqrt' was not declared in this scope
   10 |   double abs() { return sqrt(norm());}
      |                         ^~~~
a.cc: In member function 'bool Point::operator==(const Point&) const':
a.cc:16:12: error: 'fabs' was not declared in this scope; did you mean 'abs'?
   16 |     return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
      |            ^~~~
      |            abs
a.cc:16:26: error: 'EPS' was not declared in this scope
   16 |     return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
      |                          ^~~
a.cc: In member function 'double Segment::abs()':
a.cc:23:25: error: 'sqrt' was not declared in this scope
   23 |   double abs() { return sqrt(norm());}
      |                         ^~~~
a.cc: In function 'double abs(Vector)':
a.cc:29:32: error: 'sqrt' was not declared in this scope
   29 | double abs( Vector a ){ return sqrt(norm(a)); }
      |                                ^~~~
a.cc: At global scope:
a.cc:55:1: error: 'vector' does not name a type; did you mean 'Vector'?
   55 | vector<Point> solve(){
      | ^~~~~~
      | Vector
a.cc: In function 'int main()':
a.cc:66:3: error: 'cin' was not declared in this scope
   66 |   cin>>p.x>>p.y>>r;
      |   ^~~
a.cc:71:5: error: 'vector' was not declared in this scope; did you mean 'Vector'?
   71 |     vector<Point> t=solve();
      |     ^~~~~~
      |     Vector
a.cc:71:17: error: expected primary-expression before '>' token
   71 |     vector<Point> t=solve();
      |                 ^
a.cc:71:19: error: 't' was not declared in this scope
   71 |     vector<Point> t=solve();
      |                   ^
a.cc:71:21: error: 'solve' was not declared in this scope
   71 |     vector<Point> t=solve();
      |                     ^~~~~
a.cc:72:5: error: 'printf' was not declared in this scope
   72 |     printf("%.8f %.8f %.8f %.8f\n",t[0].x,t[0].y,t[1].x,t[1].y);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #define equals(a, b) (fabs((a) - (b)) < EPS )