inline LL triarea(plane::iterator x){ LL res=0; if (x!=t.begin()) res+=traparea(pre(x),x); if (next(x)!=t.end()) res+=traparea(x,next(x)); if (x!=t.begin() && next(x)!=t.end()) res+=traparea(next(x),pre(x)); return res; }
inline int contain(int x,int y){ plane :: iterator S=t.begin() , T=pre(t.end()) ; if (x<S->first || x>T->first) return 0; if (x==S->first) return y<=S->second; if (x==T->first) return y<=T->second; plane::iterator it=t.lower_bound(x) , p=pre(it); int x1=p->first , y1=p->second , x2=it->first , y2=it->second; return (LL)(y-y1)*(x2-x1) <= (LL)(y2-y1)*(x-x1); }
inline plane::iterator pre( plane::iterator x){ return x==t.begin() ? x : --x; }
inline int check(plane::iterator x){ if (t.size()<3 || x==t.begin() || next(x)==t.end()) return 0; return triarea(x)<=0; }