/**
* Author: Philippe Legault
* Date: 2016
* License: MIT
* Source: https://github.com/Bathlamos/delaunay-triangulation/
* Description: Fast Delaunay triangulation.
* Each circumcircle contains none of the input points.
* There must be no duplicate points.
* If all points are on a line, no triangles will be returned.
* Should work for doubles as well, though there may be precision issues in 'circ'.
* Returns triangles in order \{t[0][0], t[0][1], t[0][2], t[1][0], \dots\}, all counter-clockwise.
* Time: O(n \log n)
* Status: stress-tested
*/#pragma once
#include"src/geometry/Point.h"typedefPoint<ll>P;typedefstructQuad*Q;typedef__int128_tlll;// (can be ll if coords are < 2e4)Parb(LLONG_MAX,LLONG_MAX);// not equal to any other pointstructQuad{Qrot,o;Pp=arb;boolmark;P&F(){returnr()->p;}Q&r(){returnrot->rot;}Qprev(){returnrot->o->rot;}Qnext(){returnr()->prev();}}*H;boolcirc(Pp,Pa,Pb,Pc){// is p in the circumcircle?lllp2=p.dist2(),A=a.dist2()-p2,B=b.dist2()-p2,C=c.dist2()-p2;returnp.cross(a,b)*C+p.cross(b,c)*A+p.cross(c,a)*B>0;}QmakeEdge(Porig,Pdest){Qr=H?H:newQuad{newQuad{newQuad{newQuad{0}}}};H=r->o;r->r()->r()=r;rep(i,0,4)r=r->rot,r->p=arb,r->o=i&1?r:r->r();r->p=orig;r->F()=dest;returnr;}voidsplice(Qa,Qb){swap(a->o->rot->o,b->o->rot->o);swap(a->o,b->o);}Qconnect(Qa,Qb){Qq=makeEdge(a->F(),b->p);splice(q,a->next());splice(q->r(),b);returnq;}pair<Q,Q>rec(constvector<P>&s){if(sz(s)<=3){Qa=makeEdge(s[0],s[1]),b=makeEdge(s[1],s.back());if(sz(s)==2)return{a,a->r()};splice(a->r(),b);autoside=s[0].cross(s[1],s[2]);Qc=side?connect(b,a):0;return{side<0?c->r():a,side<0?c:b->r()};}#define H(e) e->F(), e->p
#define valid(e) (e->F().cross(H(base)) > 0)
QA,B,ra,rb;inthalf=sz(s)/2;tie(ra,A)=rec({all(s)-half});tie(B,rb)=rec({sz(s)-half+all(s)});while((B->p.cross(H(A))<0&&(A=A->next()))||(A->p.cross(H(B))>0&&(B=B->r()->o)));Qbase=connect(B->r(),A);if(A->p==ra->p)ra=base->r();if(B->p==rb->p)rb=base;#define DEL(e, init, dir) Q e = init->dir; if (valid(e)) \
while (circ(e->dir->F(), H(base), e->F())) { \
Q t = e->dir; \
splice(e, e->prev()); \
splice(e->r(), e->r()->prev()); \
e->o = H; H = e; e = t; \
}
for(;;){DEL(LC,base->r(),o);DEL(RC,base,prev());if(!valid(LC)&&!valid(RC))break;if(!valid(LC)||(valid(RC)&&circ(H(RC),H(LC))))base=connect(RC,base->r());elsebase=connect(base->r(),LC->r());}return{ra,rb};}vector<P>triangulate(vector<P>pts){sort(all(pts));assert(unique(all(pts))==pts.end());if(sz(pts)<2)return{};Qe=rec(pts).first;vector<Q>q={e};intqi=0;while(e->o->F().cross(e->F(),e->p)<0)e=e->o;#define ADD { Q c = e; do { c->mark = 1; pts.push_back(c->p); \
q.push_back(c->r()); c = c->next(); } while (c != e); }
ADD;pts.clear();while(qi<sz(q))if(!(e=q[qi++])->mark)ADD;returnpts;}
Traceback(mostrecentcalllast):File"/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/site-packages/onlinejudge_verify/documentation/build.py",line71,in_render_source_code_statbundled_code=language.bundle(stat.path,basedir=basedir,options={'include_paths':[basedir]}).decode()~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/site-packages/onlinejudge_verify/languages/cplusplus.py",line187,inbundlebundler.update(path)~~~~~~~~~~~~~~^^^^^^File"/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py",line312,inupdateraiseBundleErrorAt(path,i+1,"#pragma once found in a non-first line")onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt:src/geometry/FastDelaunay.h:line15:#pragmaoncefoundinanon-firstline