Language: C++

#include<iostream>
#include<complex>
#include<vector>

using namespace std;

typedef complex<long double> P;
typedef vector<P> Polygon;

double cross(P a,P b){
  return (conj(a)*b).imag();
}

double area(const Polygon &p){
  double a=0;
  for(int i=0;i<p.size();i++){
    a+=cross(p[(i+1)%p.size()],p[i]);
  }
  return fabs(a)/2;
}

int main(){
  for(int N;cin>>N,N;){
    P p[20];
    for(int i=0;i<N;i++){
      double x,y;
      cin>>x>>y;
      p[i]=P(x,y);
    }
    P c[18];
    long double w[18];
    for(int i=0;i+2<N;i++){
      w[i]=area({p[0],p[i+1],p[i+2]});
      c[i]=(p[0]+p[i+1]+p[i+2])/2.;
    }
    P a;
    for(int i=0;i+2<N;i++){
      a+=c[i]*w[i];
    }
    a/=area(vector<P>(p,p+N));
    if(abs(a)==0){
      a=P(1,1);
    }else{
      a=a/abs(a)*2.;
    }
    cout.precision(15);
    cout<<fixed<<a.real()<<' '<<a.imag()<<endl;
  }
}

    

Compiler output:
a.cc: In function 'int main()':
a.cc:34:32: error: no match for 'operator/' (operand types are 'std::complex<long double>' and 'double')
   34 |       c[i]=(p[0]+p[i+1]+p[i+2])/2.;
      |            ~~~~~~~~~~~~~~~~~~~~^~~
      |                        |        |
      |                        |        double
      |                        std::complex<long double>
In file included from a.cc:2:
/usr/include/c++/14/complex:430:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator/(const complex<_Tp>&, const complex<_Tp>&)'
  430 |     operator/(const complex<_Tp>& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:430:5: note:   template argument deduction/substitution failed:
a.cc:34:33: note:   mismatched types 'const std::complex<_Tp>' and 'double'
   34 |       c[i]=(p[0]+p[i+1]+p[i+2])/2.;
      |                                 ^~
/usr/include/c++/14/complex:439:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator/(const complex<_Tp>&, const _Tp&)'
  439 |     operator/(const complex<_Tp>& __x, const _Tp& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:439:5: note:   template argument deduction/substitution failed:
a.cc:34:33: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'double')
   34 |       c[i]=(p[0]+p[i+1]+p[i+2])/2.;
      |                                 ^~
/usr/include/c++/14/complex:448:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator/(const _Tp&, const complex<_Tp>&)'
  448 |     operator/(const _Tp& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:448:5: note:   template argument deduction/substitution failed:
a.cc:34:33: note:   mismatched types 'const std::complex<_Tp>' and 'double'
   34 |       c[i]=(p[0]+p[i+1]+p[i+2])/2.;
      |                                 ^~
a.cc:44:17: error: no match for 'operator*' (operand types are 'std::complex<long double>' and 'double')
   44 |       a=a/abs(a)*2.;
      |         ~~~~~~~~^~~
      |          |       |
      |          |       double
      |          std::complex<long double>
/usr/include/c++/14/complex:400:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const complex<_Tp>&, const complex<_Tp>&)'
  400 |     operator*(const complex<_Tp>& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:400:5: note:   template argument deduction/substitution failed:
a.cc:44:18: note:   mismatched types 'const std::complex<_Tp>' and 'double'
   44 |       a=a/abs(a)*2.;
      |                  ^~
/usr/include/c++/14/complex:409:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const complex<_Tp>&, const _Tp&)'
  409 |     operator*(const complex<_Tp>& __x, const _Tp& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:409:5: note:   template argument deduction/substitution failed:
a.cc:44:18: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'double')
   44 |       a=a/abs(a)*2.;
      |                  ^~
/usr/include/c++/14/complex:418:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const _Tp&, const complex<_Tp>&)'
  418 |     operator*(const _Tp& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:418:5: note:   template argument deduction/substitution failed:
a.cc:44:18: note:   mismatched types 'const std::complex<_Tp>' and 'double'
   44 |       a=a/abs(a)*2.;
      |                  ^~