OIG XI - skr

// https://szkopul.edu.pl/problemset/problem/skrzyzowanie/site/?key=statement
// XI OIG — Zawody indywidualne, etap III.

#include <algorithm>
#include <iostream>
#include <vector>

int main() {
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.tie(0);

    int n, m, p, t;
    std::cin >> n >> m >> p >> t;

    std::vector<int> poz;

    for (int i = 0; i < p; i++) {
        int a, b;
        std::cin >> a >> b;

        int local = -a + 1 + b + 1;

        poz.push_back(local);
    }

    std::sort(poz.begin(), poz.end());

    int ans = t;

    for (int i = 0; i < t; i++) {
        int a, b;
        std::cin >> a >> b;

        int local = -a + 1 + b + 1;

        auto res = std::lower_bound(poz.begin(), poz.end(), local);

        if (res == poz.end()) {
            continue;
        }

        if (*res != local) {
            continue;
        }

        ans--;
    }

    std::cout << ans << '\n';

    return 0;
}