/**
* Author: Simon Lindholm
* Date: 2015-01-31
* License: CC0
* Source: me
* Description: A class for ordering angles (as represented by int points and
* a number of rotations around the origin). Useful for rotational sweeping.
* Sometimes also represents points or vectors.
* Usage:
* vector<Angle> v = {w[0], w[0].t360() ...}; // sorted
* int j = 0; rep(i,0,n) { while (v[j] < v[i].t180()) ++j; }
* // sweeps j such that (j-i) represents the number of positively oriented triangles with vertices at 0 and i
* Status: Used, works well
*/#pragma once
structAngle{intx,y;intt;Angle(intx,inty,intt=0):x(x),y(y),t(t){}Angleoperator-(Angleb)const{return{x-b.x,y-b.y,t};}inthalf()const{assert(x||y);returny<0||(y==0&&x<0);}Anglet90()const{return{-y,x,t+(half()&&x>=0)};}Anglet180()const{return{-x,-y,t+half()};}Anglet360()const{return{x,y,t+1};}};booloperator<(Anglea,Angleb){// add a.dist2() and b.dist2() to also compare distancesreturnmake_tuple(a.t,a.half(),a.y*(ll)b.x)<make_tuple(b.t,b.half(),a.x*(ll)b.y);}// Given two points, this calculates the smallest angle between// them, i.e., the angle that covers the defined line segment.pair<Angle,Angle>segmentAngles(Anglea,Angleb){if(b<a)swap(a,b);return(b<a.t180()?make_pair(a,b):make_pair(b,a.t360()));}Angleoperator+(Anglea,Angleb){// point a + vector bAngler(a.x+b.x,a.y+b.y,a.t);if(a.t180()<r)r.t--;returnr.t180()<a?r.t360():r;}AngleangleDiff(Anglea,Angleb){// angle b - angle ainttu=b.t-a.t;a.t=b.t;return{a.x*b.x+a.y*b.y,a.x*b.y-a.y*b.x,tu-(b<a)};}
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/Angle.h:line15:#pragmaoncefoundinanon-firstline