/* Problem URL: https://codeforces.com/gym/102361/problem/A */ #include #include #include using namespace std; using namespace __gnu_pbds; template > using ordered_set = tree; #define V vector #define rmin(a, b) a = min(a, b) #define rmax(a, b) a = max(a, b) #define rep(i, lim) for (int i = 0; i < (lim); i++) #define nrep(i, s, lim) for (int i = s; i < (lim); i++) #define repv(i, v) for (auto &i : (v)) #define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; } #define sortv(v) sort(v.begin(), v.end()) #define all(v) (v).begin(), (v).end() using vi = vector; using vvi = vector; using vvvi = vector; using vvvvi = vector; using ll = long long; using vl = vector; using vvl = vector; using vvvl = vector; using vvvvl = vector; template auto operator<<(ostream &os, const vector &vec)->ostream& { os << vec[0]; for (size_t i = 1; i < vec.size(); i++) { os << ' ' << vec[i]; } os << '\n'; return os; } template auto operator>>(istream &is, vector &vec)->istream& { for (auto &i : vec) { is >> i; } return is; } template auto operator<<(ostream &os, const vector> &vec)->ostream& { for (auto &i : vec) { os << i[0]; for (size_t j = 1; j < i.size(); j++) { os << ' ' << i[j]; } os << '\n'; } return os; } template auto operator>>(istream &is, vector> &vec)->istream& { for (auto &i : vec) { for (auto &j : i) { is >> j; } } return is; } const int oo = INT32_MAX >> 1; const ll OO = INT64_MAX >> 1; struct pt { ll x, y; pt() = default; pt(ll x, ll y): x(x), y(y) {} friend istream &operator >> (istream &is, pt &a) { is >> a.x >> a.y; return is; } pt operator - (pt b) { return pt(x - b.x, y - b.y); } ll operator ^ (pt b) { return x * b.y - y * b.x; } ll operator * (pt b) { return x * b.x + y * b.y; } bool operator < (pt b) const { if (x == b.x) { return y < b.y; } return x < b.x; } }; int quad(pt a) { static const int q[][2] = {{0, 1}, {3, 2}}; return q[a.x < 0][a.y < 0]; } int ccw(pt a, pt b, pt c) { ll r = (b - a) ^ (c - b); return (r > 0) - (r < 0); } bool polar_cmp(pt a, pt b) { if (quad(a) != quad(b)) { return quad(a) < quad(b); } return ccw(pt(0, 0), a, b) < 0; } ll dot(pt a, pt b, pt c) { return (b - a) * (c - a); } void pre() { } #define TEST 0 void solve() { int n, q; cin >> n >> q; V a(n + q); cin >> a; vl ans(q); vi p(n + q); iota(all(p), 0); rep(i, n + q) { sort(all(p), [&](int j, int k){ return polar_cmp(a[j] - a[i], a[k] - a[i]); }); int j = 0; int now = 1; while (j < n + q) { int p1 = p[j]; int p2 = p[now]; if (p1 == i) { j++; continue; } if (now == j || p2 == i) { now = (now + 1) % (q + n); continue; } if (ccw(a[i], a[p1], a[p2]) >= 0) { j++; continue; } ll d = dot(a[i], a[p1], a[p2]); if (d < 0) { j++; continue; } if (d > 0) { now = (now + 1) % (q + n); continue; } if (i >= n && p1 < n && p2 < n) { ans[i - n]++; } else if (i < n && p1 >= n && p2 < n) { ans[p1 - n]++; } else if (i < n && p1 < n && p2 >= n) { ans[p2 - n]++; } j++; } } repv(i, ans) { cout << i << '\n'; } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); pre(); int t; (TEST && cin >> t) || (t = 1); while (t--) { solve(); } }