Language: C++

#include <bits/stdc++.h>
using namespace std;

#define EPS (1e-8)
#define equals(a, b) (fabs((a) - (b)) < EPS )
#define dle(a, b) (equals(a, b) || a < b )
#define LIM 0.001

static const double PI = acos(-1);

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;
    }
};

typedef Point Vector;

class Segment{
    public:
    Point p1, p2;
    Segment(Point s = Point(), Point t = Point()): p1(s), p2(t){}
};

typedef Segment Line;

double norm( Vector a ){ return a.x*a.x + a.y*a.y; }
double abs( Vector a ){ return sqrt(norm(a)); }
Point polar( double a, double r ){ return Point(cos(r)*a, sin(r)*a);}
double getDistance( Vector a, Vector b ){ return abs(a - b); }
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; }

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

// EPS can be 0
// need to check for 920, 833, 866
int ccw( Point p0, Point p1, Point p2 ){
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    if ( cross(a, b) > EPS ) return COUNTER_CLOCKWISE;
    if ( cross(a, b) < -EPS ) return CLOCKWISE;
    if ( dot(a, b) < -EPS ) return ONLINE_BACK;
    if ( norm(a) < norm(b) ) return ONLINE_FRONT;
    return ON_SEGMENT;
}

double getDistance(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 abs(cross(s.p2 - s.p1, p - s.p1)/abs(s.p2 - s.p1));
}
double getDistance(Segment s1, Segment s2){
    if ( isIntersect(s1, s2) ) return 0.0;
    return min( min(getDistance(s1, s2.p1), getDistance(s1, s2.p2)),
        min(getDistance(s2, s1.p1), getDistance(s2, s1.p2)));
}

double arg(Vector p){
    return atan2(p.y, p.x);
}

bool isInSector(Point c, double a, double d, double r, Point p ){
  double dist = abs(c - p);
  if ( dist <= 0.001 ){
    cout << p.x << ", " << p.y << endl;
  }

  if ( dist > a ) return false;
  Vector v1 = Vector(a*cos((r + d/2)*PI/180), a*sin((r + d/2)*PI/180));
  Vector v2 = Vector(a*cos((r - d/2)*PI/180), a*sin((r - d/2)*PI/180));

  double ldist1 = getDistance(Segment(c, c+v1), p);
  double ldist2 = getDistance(Segment(c, c+v2), p);

  if ( ccw(c, c+v1, p) == CLOCKWISE &&
       ccw(c, c+v2, p) == COUNTER_CLOCKWISE ) return true;
  return false;
}

int main(){
  int h, r, C[3];
  double D[3], x, y, w, a;
  Point O[3][100];
  Point H[100];
  int P[100];

  while(1){
    cin >> h >> r;
    if ( h == 0 && r == 0 ) break;

    for ( int i = 0; i < h; i++ ) P[i] = 0;
    for ( int i = 0; i < h; i++ ) cin >> H[i].x >> H[i].y;
    cin >> C[0] >> C[1] >> C[2] >> D[0] >> D[1] >> D[2];

    for ( int i = 0; i < 3; i++ ){
      for ( int j = 0; j < C[i]; j++ ){
    cin >> O[i][j].x >> O[i][j].y ;
      }
    }

    for ( int i = 0; i < r; i++ ){
      cin >> w >> a;
      for ( int b = 0; b < h; b++ ){
    Point target = H[b];
    bool coveredByOther = false;
    bool coveredByMe = isInSector(Point(0, 0), a, D[0], w, target);
    for ( int k = 0; k < 3; k++ ){
      for ( int l = 0; l < C[k]; l++ ){
        if ( isInSector(O[k][l], a, D[k], w, target)) coveredByOther = true;
      }
    }
    if (!coveredByOther && coveredByMe ) P[b]++;
      }
    }
    int maxv = 0;
    for ( int i = 0; i < h; i++ ) {
      maxv = max(maxv, P[i]);
    }
    if ( maxv == 0 ) cout << "NA" << endl;
    else {
      bool f = true;
      for ( int i = 0; i < h; i++ ){
    if ( maxv == P[i] ) {
      if ( !f) cout << " ";
      cout << i+1;
      f = false;
    }
      }
      cout << endl;
    }


  }
}

Compiler output:
a.cc: In function 'double getDistance(Segment, Segment)':
a.cc:75:10: error: 'isIntersect' was not declared in this scope
   75 |     if ( isIntersect(s1, s2) ) return 0.0;
      |          ^~~~~~~~~~~