intcheck_in_pol(vector<P> poly, P p){ int ret = 0, k = poly.size(); for(int i = 0 ; i < k ; ++ i) { P u = poly[i], v = poly[(i + 1) % k]; if (inSeg(u, v, p)) return1; if (sign(u.y - v.y) <= 0) swap(u, v); if (sign(p.y - u.y) > 0 || sign(p.y - v.y) <= 0) continue; ret += sign((v - p).det(u - p)) > 0; } return ret & 1; }