Language: C++

#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<climits>
#include<cfloat>

using namespace std;

double EPS = 1e-10;
const double PI = acos(-1);

double add(double a, double b){
if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
return a+b;
}

struct point{
double x, y;
point(){}
point(double x,double y) : x(x) , y(y){}

point operator + (point p){
return point(add(x,p.x), add(y,p.y));
}

point operator - (point p){
return point(add(x,-p.x), add(y,-p.y));
}

point operator * (double d){
return point(x*d,y*d);
}

point operator / (double d){
return point(x/d,y/d);
}

bool operator == ( const point &p ) const {
return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
}
};

struct circle{ point p; double r; };

double dot(point a, point b) { return (a.x * b.x + a.y * b.y); }

double cross(point a, point b) { return (a.x * b.y - a.y * b.x); }


double vec_abs(point a){
return sqrt(a.x*a.x+a.y*a.y);
}

double distance_ls_p(point a, point b, point c) {
if ( dot(b-a, c-a) < EPS ) return vec_abs(c-a);
if ( dot(a-b, c-b) < EPS ) return vec_abs(c-b);
return abs(cross(b-a, c-a)) / vec_abs(b-a);
}

double dist(point a,point b){
return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}

int is_point_on_line(point a, point b, point c) {
return cross(b-a, c-a)==0.0 &&
(dot(b-a, c-a) > -EPS) &&
(dot(a-b, c-b) > -EPS);
}

int is_intersected_ls(point a1, point a2, point b1, point b2) {

if(cross(a1-a2,b1-b2)==0){
return is_point_on_line(a1,a2,b1) || is_point_on_line(a1,a2,b2)
|| is_point_on_line(b1,b2,a1) || is_point_on_line(b1,b2,a2);
}
else {
return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}

}

int crossCS(point a, point b, circle c){
double res=distance_ls_p(a,b,c.p);
double ac=dist(a,c.p);
double bc=dist(b,c.p);

if(res>c.r || (ac else if(c.r-res=c.r)||(ac>=c.r && bc else return 2;
}

int inside(point p, vector ps, int n){
point a,b;
a=b=p;
b.x=DBL_MAX;
ps.push_back(ps[0]);
double ymx=-DBL_MAX,ymn=DBL_MAX;
for(int i=0;i ymx=max(ymx,ps[i].y);
ymn=min(ymn,ps[i].y);
}
if(a.y<=ymn||a.y>=ymx)return 0;

for(int i=0;i if(is_point_on_line(ps[i],ps[i+1],p))return 1;
}

int cnt1=0;
for(int i=0;i if(is_point_on_line(a,b,ps[i]))cnt1++;

int cnt=0;
for(int i=0;i if(is_intersected_ls(ps[i],ps[i+1],a,b))cnt++;

return (cnt-cnt1)%2;
}

int crossCP(vector t, circle C){

double ans=0;
int tsz=t.size();

for(int i=0;i double tmp=dist(t[i],C.p);
if(tmp>ans)ans=tmp;
}

if(C.r>=ans)return 2;

int res1=inside(C.p,t,tsz);
double res2=DBL_MAX;

t.push_back(t[0]);

for(int i=0;i res2=min(res2,distance_ls_p(t[i],t[i+1],C.p));

if(res1 && C.r<=res2)return 1;
else if(!res1 && C.r else return 3;
}

int main(void){
point p;
vector t;
circle C;
string ans="zabcd";

while(true){
t.clear();
for(int i=0;i<3;i++){
cin >> p.x >> p.y;
if(p.x==0 && p.y==0)return 0;
t.push_back(p);
}
cin >> C.p.x >> C.p.y >> C.r;

int res=crossCP(t,C);
cout << ans[res] << endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int crossCS(point, point, circle)':
a.cc:90:18: error: expected ')' before 'else'
   90 | if(res>c.r || (ac else if(c.r-res=c.r)||(ac>=c.r && bc else return 2;
      |               ~  ^~~~~
      |                  )
a.cc:90:69: error: expected ')' before ';' token
   90 | if(res>c.r || (ac else if(c.r-res=c.r)||(ac>=c.r && bc else return 2;
      |   ~                                                                 ^
      |                                                                     )
a.cc:91:1: warning: no return statement in function returning non-void [-Wreturn-type]
   91 | }
      | ^
a.cc: At global scope:
a.cc:93:21: error: missing template argument list after 'std::vector'; template placeholder not permitted in parameter
   93 | int inside(point p, vector ps, int n){
      |                     ^~~~~~
      |                           <>
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'template<class _Tp, class _Alloc> class std::vector' declared here
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc: In function 'int inside(...)':
a.cc:97:1: error: 'ps' was not declared in this scope; did you mean 'p'?
   97 | ps.push_back(ps[0]);
      | ^~
      | p
a.cc:99:14: error: expected ';' before 'ymx'
   99 | for(int i=0;i ymx=max(ymx,ps[i].y);
      |              ^~~~
      |              ;
a.cc:99:35: error: expected ')' before ';' token
   99 | for(int i=0;i ymx=max(ymx,ps[i].y);
      |    ~                              ^
      |                                   )
a.cc:100:16: error: 'i' was not declared in this scope
  100 | ymn=min(ymn,ps[i].y);
      |                ^
a.cc:101:1: warning: no return statement in function returning non-void [-Wreturn-type]
  101 | }
      | ^
a.cc: At global scope:
a.cc:102:1: error: expected unqualified-id before 'if'
  102 | if(a.y<=ymn||a.y>=ymx)return 0;
      | ^~
a.cc:104:1: error: expected unqualified-id before 'for'
  104 | for(int i=0;i if(is_point_on_line(ps[i],ps[i+1],p))return 1;
      | ^~~
a.cc:104:13: error: 'i' does not name a type
  104 | for(int i=0;i if(is_point_on_line(ps[i],ps[i+1],p))return 1;
      |             ^
a.cc:105:1: error: expected declaration before '}' token
  105 | }
      | ^
a.cc:108:1: error: expected unqualified-id before 'for'
  108 | for(int i=0;i if(is_point_on_line(a,b,ps[i]))cnt1++;
      | ^~~
a.cc:108:13: error: 'i' does not name a type
  108 | for(int i=0;i if(is_point_on_line(a,b,ps[i]))cnt1++;
      |             ^
a.cc:111:1: error: expected unqualified-id before 'for'
  111 | for(int i=0;i if(is_intersected_ls(ps[i],ps[i+1],a,b))cnt++;
      | ^~~
a.cc:111:13: error: 'i' does not name a type
  111 | for(int i=0;i if(is_intersected_ls(ps[i],ps[i+1],a,b))cnt++;
      |             ^
a.cc:113:1: error: expected unqualified-id before 'return'
  113 | return (cnt-cnt1)%2;
      | ^~~~~~
a.cc:114:1: error: expected declaration before '}' token
  114 | }
      | ^
a.cc:116:13: error: missing template argument list after 'std::vector'; template placeholder not permitted in parameter
  116 | int crossCP(vector t, circle C){
      |             ^~~~~~
      |                   <>
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'template<class _Tp, class _Alloc> class std::vector' declared here
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc: In function 'int crossCP(...)':
a.cc:119:9: error: 't' was not declared in this scope
  119 | int tsz=t.size();
      |         ^
a.cc:121:14: error: expected ';' before 'double'
  121 | for(int i=0;i double tmp=dist(t[i],C.p);
      |              ^~~~~~~
      |              ;
a.cc:121:15: error: expected primary-expression before 'double'
  121 | for(int i=0;i double tmp=dist(t[i],C.p);
      |               ^~~~~~
a.cc:121:14: error: expected ')' before 'double'
  121 | for(int i=0;i double tmp=dist(t[i],C.p);
      |    ~         ^~~~~~~
      |              )
a.cc:122:4: error: 'tmp' was not declared in this scope; did you mean 'tm'?
  122 | if(tmp>ans)ans=tmp;
      |    ^~~
      |    tm
a.cc:123:1: warning: no return statement in function returning non-void [-Wreturn-type]
  123 | }
      | ^
a.cc: At global scope:
a.cc:125:1: error: expected unqualified-id before 'if'
  125 | if(C.r>=ans)return 2;
      | ^~
a.cc:127:17: error: 'C' was not declared in this scope
  127 | int res1=inside(C.p,t,tsz);
      |                 ^
a.cc:127:21: error: 't' was not declared in this scope; did you mean 'tm'?
  127 | int res1=inside(C.p,t,tsz);
      |                     ^
      |                     tm
a.cc:127:23: error: 'tsz' was not declared in this scope
  127 | int res1=inside(C.p,t,tsz);
      |                       ^~~
a.cc:130:1: error: 't' does not name a type; did you mean 'tm'?
  130 | t.push_back(t[0]);
      | ^
      | tm
a.cc:132:1: error: expected unqualified-id before 'for'
  132 | for(int i=0;i res2=min(res2,distance_ls_p(t[i],t[i+1],C.p));
      | ^~~
a.cc:132:13: error: 'i' does not name a type
  132 | for(int i=0;i res2=min(res2,distance_ls_p(t[i],t[i+1],C.p));
      |             ^
a.cc:134:1: error: expected unqualified-id before 'if'
  134 | if(res1 && C.r<=res2)return 1;
      | ^~
a.cc:135:1: error: expected unqualified-id before 'else'
  135 | else if(!res1 && C.r else return 3;
      | ^~~~
a.cc:136:1: error: expected declaration before '}' token
  136 | }
      | ^
a.cc: In function 'int main()':
a.cc:140:8: error: class template argument deduction failed:
  140 | vector t;
      |        ^
a.cc:140:8: error: no matching function for call to 'vector()'
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>'
  707 |         vector(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const _Alloc&)-> std::vector<_Tp, _Alloc>'
  678 |       vector(initializer_list<value_type> __l,
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
  659 |       vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::vector<_Tp, _Alloc>'
  640 |       vector(vector&& __rv, const allocator_type& __m, false_type)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::vector<_Tp, _Alloc>'
  635 |       vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
  624 |       vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:7: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&)-> std::vector<_Tp, _Alloc>'
  620 |       vector(vector&&) noexcept = default;
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&)-> std::vector<_Tp, _Alloc>'
  601 |       vector(const vector& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Tp&, const _Alloc&)-> std::vector<_Tp, _Alloc>'
  569 |       vector(size_type __n, const value_type& __value,
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:7: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Alloc&)-> std::vector<_Tp, _Alloc>'
  556 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const _Alloc&)-> std::vector<_Tp, _Alloc>'
  542 |       vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'template<class _Tp, class _Alloc> vector()-> std::vector<_Tp, _Alloc>'
  531 |       vector() = default;
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note:   template argument deduction/substitution failed:
a.cc:140:8: note:   couldn't deduce template parameter '_Tp'
  140 | vector t;
      |        ^
/usr/include/c++/14/bits/stl_vector.h:428:11: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>)-> std::vector<_Tp, _