import sys

def main():

    s = sys.stdin.readlines()

    N, M, Q = list(map(int, s[0].split()))

    x = [[0] * N for _ in [0] * N]

    for e in s[1:M + 1]:

        L, R = list(map(int, e.split()))

        x[L - 1][R - 1] += 1

    for k in range(1, N):

        for i in range(N - k):

            j = i + k

            x[i][j] += x[i][j - 1] + x[i + 1][j] - x[i + 1][j - 1]

    res = []

    for e in s[M + 1:]:

        p, q = list(map(int, e.split()))

        res.append(x[p - 1][q - 1])

    print(('\n'.join(map(str, res))))

if __name__ == '__main__':

    main()
import sys

from itertools import accumulate as acc

def main():

    s = sys.stdin.readlines()

    N, M, _ = list(map(int, s[0].split()))

    X = [[0] * N for _ in [0] * N]

    for L, R in (list(map(int, e.split())) for e in s[1:M + 1]): X[L - 1][R - 1] += 1

    S = [tuple(acc(reversed(s))) for s in zip(*(acc(x) for x in X))]

    print(('\n'.join(map(str, (S[q - 1][N - p] for p, q in (list(map(int, e.split())) for e in s[M + 1:]))))))

if __name__ == '__main__':

    main()
import sys


def main():
    s = sys.stdin.readlines()
    N, M, Q = list(map(int, s[0].split()))
    x = [[0] * N for _ in [0] * N]
    for e in s[1 : M + 1]:
        L, R = list(map(int, e.split()))
        x[L - 1][R - 1] += 1
    for k in range(1, N):
        for i in range(N - k):
            j = i + k
            x[i][j] += x[i][j - 1] + x[i + 1][j] - x[i + 1][j - 1]
    res = []
    for e in s[M + 1 :]:
        p, q = list(map(int, e.split()))
        res.append(x[p - 1][q - 1])
    print(("\n".join(map(str, res))))


if __name__ == "__main__":
    main()

import sys
from itertools import accumulate as acc


def main():
    s = sys.stdin.readlines()
    N, M, _ = list(map(int, s[0].split()))
    X = [[0] * N for _ in [0] * N]
    for L, R in (list(map(int, e.split())) for e in s[1 : M + 1]):
        X[L - 1][R - 1] += 1
    S = [tuple(acc(reversed(s))) for s in zip(*(acc(x) for x in X))]
    print(
        (
            "\n".join(
                map(
                    str,
                    (
                        S[q - 1][N - p]
                        for p, q in (list(map(int, e.split())) for e in s[M + 1 :])
                    ),
                )
            )
        )
    )


if __name__ == "__main__":
    main()

+from itertools import accumulate as acc -    N, M, Q = list(map(int, s[0].split())) -    x = [[0] * N for _ in [0] * N] -    for e in s[1 : M + 1]: -        L, R = list(map(int, e.split())) -        x[L - 1][R - 1] += 1 -    for k in range(1, N): -        for i in range(N - k): -            j = i + k -            x[i][j] += x[i][j - 1] + x[i + 1][j] - x[i + 1][j - 1] -    res = [] -    for e in s[M + 1 :]: -        p, q = list(map(int, e.split())) -        res.append(x[p - 1][q - 1]) -    print(("\n".join(map(str, res)))) +    N, M, _ = list(map(int, s[0].split())) +    X = [[0] * N for _ in [0] * N] +    for L, R in (list(map(int, e.split())) for e in s[1 : M + 1]): +        X[L - 1][R - 1] += 1 +    S = [tuple(acc(reversed(s))) for s in zip(*(acc(x) for x in X))] +    print( +        ( +            "\n".join( +                map( +                    str, +                    ( +                        S[q - 1][N - p] +                        for p, q in (list(map(int, e.split())) for e in s[M + 1 :]) +                    ), +                ) +            ) +        ) +    )