Language: C++

#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:

// Description: ????????????
// Verifyed: various problem 
const R INF = 1E40L;
const R PI = acos(-1.0L);
using P=complex<R>;
const P O=0.0L;
using L=struct{P s,t;};
using VP=vector<P>;
using C=struct{P p;R c;};

istream& operator >> (istream& is,P& p){ R x,y;is >> x >> y; p=P(x,y); return is;}
ostream& operator << (ostream& os,P& p){ os << real(p) << " " << imag(p); return os;}

inline R dot(P o,P a,P b){return real(conj(a-o)*(b-o));}
inline R det(P o,P a,P b){return imag(conj(a-o)*(b-o));}
inline int sdot(P o,P a,P b){return sgn(dot(o,a,b));}
inline int sdet(P o,P a,P b){return sgn(det(o,a,b));}

//projection verify AOJ CGL_1_A
P proj(L l,P p){ R u=real((p-l.s)/(l.t-l.s)); return (1-u)*l.s+u*l.t;}

// vertical parallel
// verified: AOJ CGL_2_A
bool vertical(L a,L b) {return sdot(O,a.t-a.s,b.t-b.s)==0;}
bool parallel(L a,L b) {return sdet(O,a.t-a.s,b.t-b.s)==0;}
bool eql(L a,L b){ return parallel(a,b) and sdet(a.s,a.t,b.s)==0;}

// crossing determination
// verified: AOJ CGL_2_B 
bool iss(L a,L b){
	int sa=sdet(a.s,a.t,b.s)*sdet(a.s,a.t,b.t);
	int sb=sdet(b.s,b.t,a.s)*sdet(b.s,b.t,a.t);
	return max(sa,sb)<0;
}

// crossing point 
// verified: AOJ CGL_2_C
P cross(L a,L b){
	R u=det(a.s,b.s,b.t)/det(O,a.t-a.s,b.t-b.s);
	return (1-u)*a.s+u*a.t;
}
	
// distance 
// verified: AOJ CGL_2_D
R dsp(L l,P p){
	P h=proj(l,p);
	if(sdot(l.s,l.t,p)<=0) h=l.s;
	if(sdot(l.t,l.s,p)<=0) h=l.t;
	return abs(p-h);
}

R dss(L a,L b){return iss(a,b)?0:min({dsp(a,b.s),dsp(a,b.t),dsp(b,a.s),dsp(b,a.t)});}

// Polygon

// area 
// verified: AOJ 1100 CGL_3_A
R area(const VP& pol){
	int n=pol.size();
	R sum=0.0;
	rep(i,n) sum+=det(O,pol[i],pol[(i+1)%n]);
	return abs(sum/2.0L);
}


// convex_polygon determination
// verified: CGL_3_B
bool is_convex(const VP& pol){
	int n=pol.size();
	rep(i,n)if(sdet(pol[i],pol[(i+1)%n],pol[(i+2)%n])<0) return false;
	return true;
}


// polygon realation determination  in  2 on 1 out 0???(possible non-convex) verify AOJ CGL_3-C
int in_polygon(const VP& pol, const P& p){
	int n=pol.size(),res=0;
	rep(i,n){
		if(ccw(pol[i],pol[(i+1)%n],p)==ON) return 1;
		bool f=sgn(imag(p-pol[i]))>=0;
		bool s=sgn(imag(p-pol[(i+1)%n]))<0;
		int sign=sgn(imag(pol[(i+1)%n]-pol[i]));
		bool can=sgn(sign*det(pol[i],pol[(i+1)%n],p))>0; // (a*d-b*c)*b
		if(can&&f==s) res+=(2*f-1);
	}
	return res?2:0;
}
/*
// polygon realation determination  in  2 on 1 out 0???(possible non-convex) 
// verified: AOJ CGL_3-C
int in_polygon(const VP& pol, const P& p){
	int n=pol.size(),res=0;
	rep(i,n){
		P a=pol[i],b=pol[(i+1)%n];
		if(sdot(p,a,b)<0) return 1;
		bool f=sgn(imag(p-a))>=0,s=sgn(imag(p-b))<0;
		if(sgn(imag(b-a)*sdet(a,b,p))==1 and f==s) res+=(2*f-1);
	}
	return res?2:0;
}
*/

/*
// polygon realation determination???(possible non-convex) 
// verified: AOJ 2514
bool in_polygon(const VP& pol, const L& l){
	VP check{l.s,l.t};
	int n=pol.size();
	rep(i,n){
		L edge={pol[i],pol[(i+1)%n]};
		if(iss(l,edge)) check.emplace_back(cross(l,edge));
	}
	sort(begin(check),end(check),[](P a,P b)->bool{return sgn(real(a)-real(b))?:sgn(imag(a)-imag(b));});
	n=check.size();
	rep(i,n-1){
		P m=(check[i]+check[i+1])/2.0L;
		if(in_polygon(pol,m)==false) return false;
	}
	return true;
}

// convex_cut 
// verified: AOJ CGL_4_C
VP convex_cut(const VP& pol,const L& l) {
	VP res;
	int n=pol.size();
	rep(i,n){
		P a = pol[i],b=pol[(i+1)%n];
		int da=sdet(l.s,l.t,a),db=sdet(l.s,l.t,b);
		if(da>=0) res.emplace_back(a);
		if(da*db<0) res.emplace_back(cross({a,b},l));
	}
	return res;
}
*/

int main(void){
	int n,q;
	cin >> n;
	VP pol;
	rep(i,n){
		P p;
		cin >> p;
		pol.push_back(p); 
	}
	cin >> q;
	rep(loop,q){
		P p;
		cin >> p;
		cout << in_polygon(pol,p) << endl;	
	}
	return 0;
}

Compiler output:
a.cc: In function 'int in_polygon(const VP&, const P&)':
a.cc:113:20: error: 'ccw' was not declared in this scope
  113 |                 if(ccw(pol[i],pol[(i+1)%n],p)==ON) return 1;
      |                    ^~~
a.cc:113:48: error: 'ON' was not declared in this scope; did you mean 'O'?
  113 |                 if(ccw(pol[i],pol[(i+1)%n],p)==ON) return 1;
      |                                                ^~
      |                                                O