CodeEff/ECCO huggingface dataset:
# Original solution
n,m,q=list(map(int,input().split()))
line=[[0]*(n+1) for _ in range(n+1)]
for i in range(m):
  l,r=list(map(int,input().split()))
  for j in range(0,l):
    for k in range(r-1,n):
      line[j][k]+=1
for _ in range(q):
  x,y=list(map(int,input().split()))
  print((line[x-1][y-1]))

# Optimized solution
n,m,q=list(map(int,input().split()))
line=[[0]*(n+1) for _ in range(n+1)]
for i in range(m):
  l,r=list(map(int,input().split()))
  line[l][r]+=1
for i in range(n+1):
  for j in range(n):
    line[i][j+1]+=line[i][j]
for i in range(n+1):
  for j in range(n):
    line[j+1][i]+=line[j][i]
for i in range(q):
  x,y=list(map(int,input().split()))
  print((line[y][y]-line[x-1][y]-line[y][x-1]+line[x-1][x-1]))
# Original solution
n,m,q=list(map(int,input().split()))
d=[[0 for j in range(n)] for i in range(n)]
for i in range(m):
	l,r=[int(x)-1 for x in input().split()]
	d[l][r]+=1
for l in range(n):
	for r in range(1,n):
		d[l][r]+=d[l][r-1]
for l in range(n-1,0,-1):
	for r in range(n):
		d[l-1][r]+=d[l][r]
for i in range(q):
	l,r=[int(x)-1 for x in input().split()]
	print((d[l][r]))

# Optimized solution
n,m,q=list(map(int,input().split()))
d=[[0 for j in range(n)] for i in range(n)]
for i in range(m):
	l,r=list(map(int,input().split()))
	d[n-l][r-1]+=1
for l in range(n):
	for r in range(1,n):
		d[l][r]+=d[l][r-1]
for l in range(1,n):
	for r in range(n):
		d[l][r]+=d[l-1][r]
for i in range(q):
	l,r=list(map(int,input().split()))
	print((d[n-l][r-1]))
# Original solution
n,m,q = list(map(int, input().split()))
List1 = [[0 for i in range(n)] for j in range(n)]
List2 = [[0 for i in range(n)] for j in range(n)]

for i in range(m):
  l,r = list(map(int, input().split()))
  List1[l - 1][r - 1] += 1

for i in range(n):
  for j in range(i, n):
    for k in range(i, j + 1):
      for l in range(k, j + 1):
        List2[i][j] += List1[k][l]


for i in range(q):
  a, b = list(map(int, input().split()))
  print((List2[a - 1][b - 1]))

# Optimized solution
n,m,q = list(map(int, input().split()))
List1 = [[0 for i in range(n+1)] for j in range(n+1)]
List2 = [[0 for i in range(n+1)] for j in range(n+1)]

for i in range(m):
  l,r = list(map(int, input().split()))
  List1[l - 1][r - 1] += 1


for i in range(n):
  for j in range(n - i):
    List2[j][j + i] = List2[j + 1][j + i] + List2[j][j + i - 1] - List2[j + 1][j + i - 1] + List1[j][j + i]


for i in range(q):
  a, b = list(map(int, input().split()))
  print((List2[a - 1][b - 1]))
# Original solution
n, m, q = [int(i) for i in input().split()]
m_list = [[0 for i in range(n+1)] for j in range(n+1)]
dynamic = [[0 for i in range(n+1)] for j in range(n+1)]

for i in range(m):
    l, r = [int(i) for i in input().split()]
    m_list[l][r] += 1

for i in range(1, n+1):
    for j in range(i, n+1):
        dynamic[i][j] = dynamic[i][j-1]
        for k in range(i, j+1):
            dynamic[i][j] += m_list[k][j]

for i in range(q):
    l, r = [int(i) for i in input().split()]
    print((dynamic[l][r]))


# Optimized solution
n, m, q = [int(i) for i in input().split()]
imos = [[0 for r in range(n+1)] for l in range(n+1)]
for i in range(m):
    l, r = [int(i) - 1 for i in input().split()]
    imos[0][r] += 1
    imos[l+1][r] -= 1
#imos法
for l in range(n):
    for r in range(1, n):
        imos[l][r] += imos[l][r-1]
for r in range(n):
    for l in range(1, n):
        imos[l][r] += imos[l-1][r]
for i in range(q):
    l, r = [int(i) - 1 for i in input().split()]
    print((imos[l][r]))
# Original solution
n, m, qn = list(map(int, input().split()))
t = [list(map(int, input().split())) for _ in range(m)]
qs = [list(map(int, input().split())) for _ in range(qn)]

r = dict()
for i in range(1, n + 1):
    r[i] = set()
    
l = dict()
for i in range(1, n + 1):
    l[i] = set()

for x in range(len(t)):
    L, R = t[x]
    for i in range(R, n + 1):
        l[i].add(x)
    for i in range(1, L + 1):
        r[i].add(x)

for p, q in qs:
    print((len(r[p] & l[q])))

# Optimized solution
def arr(row, column, value): return [[value for _ in range(column)] for _ in range(row)]

n, m, q = list(map(int, input().split()))

sum_range = arr(n + 1, n + 1, 0)
#sum_range[0][0] - sum_range[n][n]まで
#初期値0
#行列値は1からnを取るが、累積和を加算する過程で行列を1引いたものを参照するので、[0][0]がエラーにならないと便利？

for _ in range(m):
    L, R = list(map(int, input().split()))
    sum_range[L][R] += 1#(L, R)間を運行す列車の数を代入
    
for L in range(1, n + 1):
    for R in range(1, n + 1):
        #累積和を取る（53:44あたり）
        #https://www.youtube.com/watch?v=OdJH-io-sVw
        sum_range[L][R] += sum_range[L - 1][R]
        sum_range[L][R] += sum_range[L][R - 1]
        sum_range[L][R] -= sum_range[L - 1][R - 1]

#print(sum_range)
for _ in range(q):
    p, q = list(map(int, input().split()))
    ans = sum_range[q][q] - sum_range[p - 1][q] - sum_range[q][p - 1] + sum_range[p - 1][p - 1]
    print(ans)
# Original solution
def ary(r, c, val=False): return [[val for _ in range(c)] for _ in range(r)]
def nl(): return list(map(int, input().split()))

n, m, q = nl()
M = ary(n + 1, n + 1, 0)
for _ in range(m):
    l, r = nl()
    M[l][r] += 1

for L in range(1, n + 1):
    for R in range(1, n + 1):
        M[L][R] += M[L - 1][R]
        M[L][R] += M[L][R - 1]
        M[L][R] -= M[L - 1][R - 1]

for _ in range(q):
    p, q = list(map(int, input().split()))
    ans = M[q][q] - M[p - 1][q] - M[q][p - 1] + M[p - 1][p - 1]
    print(ans)

# Optimized solution
N, M, Q = list(map(int, input().split()))

T = [[0 for _ in range(N + 1)] for _ in range(N + 1)]

for _ in range(M):
    L, R = list(map(int, input().split()))
    T[L][R] += 1

for L in range(1, N + 1):
    for R in range(1, N + 1):
        T[L][R] += T[L - 1][R]
        T[L][R] += T[L][R - 1]
        T[L][R] -= T[L - 1][R - 1]

for _ in range(Q):
    P, Q = list(map(int, input().split()))
    ans = 0
    ans += T[Q][Q]
    ans -= T[P - 1][Q]
    ans -= T[Q][P - 1]
    ans += T[P - 1][P - 1]
    print(ans)
# Original solution
N, M, Q = list(map(int, input().split()))

x = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
for _ in range(M):
    L, R = list(map(int, input().split()))
    x[L][R] += 1

c = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
for i in range(1, N + 1):
    for j in range(1, N + 1):
        c[i][j] += c[i][j - 1] + x[i][j]

for _ in range(Q):
    P, Q = list(map(int, input().split()))
    ans = 0
    for i in range(P, Q + 1):
        ans += c[i][Q] - c[i][P - 1]
    print(ans)


# Optimized solution
import sys

input = sys.stdin.readline

N, M, Q = list(map(int, input().split()))
t = [[0] * (N + 1) for _ in range(N + 1)]
# es[L][R]:=区間[L,R]を走る列車の本数

for _ in range(M):
    l, r = list(map(int, input().split()))
    t[l][r] += 1

for L in range(1, N + 1):
    for R in range(1, N + 1):
        t[L][R] += t[L - 1][R]
        t[L][R] += t[L][R - 1]
        t[L][R] -= t[L - 1][R - 1]
        # 累積和のテーブルを作る
        # 最終的には
        # t[L][R]には区間が[L,R]に含まれる本数を入れるが、
        # 現時点では区間が[L,R]に一致する本数しか入っていない
        # ここに区間が[L-1,R]に含まれる本数と
        # 区間が[L,R-1]に含まれる本数を足すと
        # 区間が[L,R]に含まれる範囲をカバーできるが、
        # 区間が[L-1][R-1]の範囲が重複して足されている

for _ in range(Q):
    p, q = list(map(int, input().split()))
    print((t[q][q] - t[p - 1][q] - t[q][p - 1] + t[p - 1][p - 1]))
    # 2次元累積和
# Original solution
class Acc2D:
    def __init__(self, src):
        self.acc2d = self._build(src)

    def _build(self, src):
        h, w = len(src), len(src[0])
        ret = [[0] * w for _ in range(h)]
        for r in range(h):
            for c in range(w):
                ret[r][c] = src[r][c]
                if r > 0:
                    ret[r][c] += ret[r - 1][c]
                if c > 0:
                    ret[r][c] += ret[r][c - 1]
                if r > 0 and c > 0:
                    ret[r][c] -= ret[r - 1][c - 1]
        return ret

    def get(self, r1, c1, r2, c2):
        """[(r1,c1),(r2,c2)]"""
        acc2d = self.acc2d
        ret = acc2d[r2][c2]
        if r1 > 0:
            ret -= acc2d[r1 - 1][c2]
        if c1 > 0:
            ret -= acc2d[r2][c1 - 1]
        if r1 > 0 and c1 > 0:
            ret += acc2d[r1 - 1][c1 - 1]

        return ret


def main():
    import sys

    input = sys.stdin.readline

    N, M, Q = list(map(int, input().split()))

    table = [[0] * (N + 1) for _ in range(N + 1)]

    for _ in range(M):
        L, R = list(map(int, input().split()))
        table[L][R] += 1

    acc2d = Acc2D(table)

    for _ in range(Q):
        p, q = list(map(int, input().split()))
        res = acc2d.get(p, p, q, q)
        print(res)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    import sys
    input = sys.stdin.readline

    N, M, Q = map(int, input().split())

    tb = [[0] * (N + 1) for _ in range(N + 1)]
    # tb[L][R]:=区間LR内を走る列車総数
    for _ in range(M):
        L, R = map(int, input().split())
        tb[L][R] += 1

    for L in range(1, N + 1):
        for R in range(1, N + 1):
            tb[L][R] += tb[L - 1][R]
            tb[L][R] += tb[L][R - 1]
            tb[L][R] -= tb[L - 1][R - 1]

    ans = []
    for _ in range(Q):
        p, q = map(int, input().split())
        ans.append(tb[q][q] - tb[p - 1][q] - tb[q][p - 1] + tb[p - 1][p - 1])

    print(*ans, sep='\n')


if __name__ == '__main__':
    main()
# Original solution
# coding: utf-8

n,m,q = list(map(int,input().split()))
M = [ list(map(int,input().split())) for i in range(m) ]
Q = [ list(map(int,input().split())) for i in range(q) ]

count = [0]*q

for i in range(q):
    for j in range(m):
        if Q[i][0] <= M[j][0] and M[j][1] <= Q[i][1]:
            count[i] += 1

for i in range(q):
    print((count[i]))

# Optimized solution
# coding: utf-8

n,m,q = list(map(int,input().split()))
M = [ list(map(int,input().split())) for i in range(m) ]
Q = [ list(map(int,input().split())) for i in range(q) ]

LR = [[0]*(n+1) for _ in range(n+1)]

for m in M:
    LR[m[0]-1][m[1]] += 1 

for l in range(n,-1,-1):
    for r in range(0,n,1):
        LR[l-1][r+1] = LR[l-1][r+1] + LR[l-1][r] + LR[l][r+1] - LR[l][r]

for q in Q:
    print((LR[q[0]-1][q[1]]))
# Original solution
# -*- coding: utf-8 -*-

"""
参考：https://img.atcoder.jp/abc106/editorial.pdf
　　　https://www.hamayanhamayan.com/entry/2018/08/18/234325
・累積和
"""

N, M, Q = list(map(int, input().split()))
lM, rM = [0] * M, [0] * M
pQ, qQ = [0] * Q, [0] * Q
LR = [[0] * N for i in range(N)]
# 都市番号を0-indexed
for i in range(M):
    l, r = list(map(int, input().split()))
    lM[i], rM[i] = l-1, r-1
    LR[l-1][r-1] += 1
for i in range(Q):
    p, q = list(map(int, input().split()))
    pQ[i], qQ[i] = p-1, q-1

# 始点固定で終点を動かした累積和を出す
cnt = [[0] * N for i in range(N)]
for i in range(N):
    cnt[i][i] = LR[i][i]
    for j in range(1, N):
        cnt[i][j] = cnt[i][j-1] + LR[i][j]

for i in range(Q):
    ans = 0
    for j in range(pQ[i], qQ[i]+1):
        # ある終点についてもう和が出てるので、
        # ここでは始点を動かして最終的な合計にする
        ans += cnt[j][qQ[i]]
    print(ans)


# Optimized solution
# -*- coding: utf-8 -*-

"""
参考：https://img.atcoder.jp/abc106/editorial.pdf
　　　https://atcoder.jp/contests/abc106/submissions/3024983
　　　https://imoz.jp/algorithms/imos_method.html
・二次元累積和
・最後にどこを足し引きするかは上記参考の二次元いもすと同じ話だと思う。
"""

N, M, Q = list(map(int, input().split()))
LR = [[0] * (N+1) for i in range(N+1)]
for i in range(M):
    l, r = list(map(int, input().split()))
    LR[l][r] += 1

# 縦横両方について累積和を出す
# 先頭1行1列は0のままにしておく
for i in range(1, N+1):
    for j in range(2, N+1):
        LR[i][j] += LR[i][j-1]
for i in range(1, N+1):
    for j in range(2, N+1):
        LR[j][i] += LR[j-1][i]

for i in range(Q):
    p, q = list(map(int, input().split()))
    # +左上 -右上 -左下 +右下
    ans = LR[p-1][p-1] - LR[p-1][q] - LR[q][p-1] + LR[q][q]
    print(ans)
# Original solution
# -*- coding: utf-8 -*-

"""
参考：https://img.atcoder.jp/abc106/editorial.pdf
　　　https://atcoder.jp/contests/abc106/submissions/3024983
　　　https://imoz.jp/algorithms/imos_method.html
・二次元累積和
・最後にどこを足し引きするかは上記参考の二次元いもすと同じ話だと思う。
"""

N, M, Q = list(map(int, input().split()))
LR = [[0] * (N+1) for i in range(N+1)]
for i in range(M):
    l, r = list(map(int, input().split()))
    LR[l][r] += 1

# 縦横両方について累積和を出す
# 先頭1行1列は0のままにしておく
for i in range(1, N+1):
    for j in range(2, N+1):
        LR[i][j] += LR[i][j-1]
for i in range(1, N+1):
    for j in range(2, N+1):
        LR[j][i] += LR[j-1][i]

for i in range(Q):
    p, q = list(map(int, input().split()))
    # +左上 -右上 -左下 +右下
    ans = LR[p-1][p-1] - LR[p-1][q] - LR[q][p-1] + LR[q][q]
    print(ans)


# Optimized solution
# -*- coding: utf-8 -*-

"""
参考：https://betrue12.hateblo.jp/entry/2018/08/18/224408
・二次元累積和
・こっちの方針のが分かりやすいかも。
"""

N, M, Q = list(map(int, input().split()))
LR = [[0] * (N) for i in range(N)]
for i in range(M):
    l, r = list(map(int, input().split()))
    # 左端=L、右端=Rの表
    LR[l-1][r-1] += 1

# 二次元の縦横両方について累積和を出す
# 縦方向の足し方を逆からにすることで、今回の条件と合致できる
for i in range(N):
    for j in range(1, N):
        # 左端=L、右端<=Rになる
        LR[i][j] += LR[i][j-1]
for i in range(N):
    for j in range(N-2, -1, -1):
        # 左端>=L、右端<=Rになる
        LR[j][i] += LR[j+1][i]

for i in range(Q):
    p, q = list(map(int, input().split()))
    # ここでは添字指定だけで加減不要
    ans = LR[p-1][q-1]
    print(ans)
# Original solution
n, m, q = list(map(int, input().split()))
ans = [[0] * (n+2) for _ in range(n+2)]
lr = [list(map(int, input().split())) for _ in range(m)]
for l, r in lr:
    ans[0][r] += 1
    ans[0][-1] -= 1
    ans[l+1][-1] -= 1
    ans[l+1][r] -= 1

for i in range(n+2):
    for j in range(n+1):
        ans[i][j+1] += ans[i][j]

for i in range(n+1):
    for j in range(n+2):
        ans[i+1][j] += ans[i][j]

for _ in range(q):
    p, q = list(map(int, input().split()))
    print((ans[p][q]))

# Optimized solution
n, m, q = list(map(int, input().split()))
ans = [[0] * (n+2) for _ in range(n+2)]
for _ in range(m):
    l, r = list(map(int, input().split()))
    ans[0][r] += 1
    ans[0][-1] -= 1
    ans[l+1][-1] -= 1
    ans[l+1][r] -= 1

for i in range(n+2):
    for j in range(n+1):
        ans[i][j+1] += ans[i][j]

for i in range(n+1):
    for j in range(n+2):
        ans[i+1][j] += ans[i][j]

for _ in range(q):
    p, q = list(map(int, input().split()))
    print((ans[p][q]))
# Original solution
N, M, Q = list(map(int, input().split()))

# cum_sum[L][R]
cum_sum = [[0 for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M):
    L, R = list(map(int, input().split()))
    cum_sum[L][R] += 1

for l in range(1, N+1):
    for r in range(1, N+1):
        cum_sum[l][r] += cum_sum[l][r-1]

for _ in range(Q):
    p, q = list(map(int, input().split()))
    ans = 0
    for l in range(p, q+1):
        ans += cum_sum[l][q] - cum_sum[l][p-1]
    print(ans)


# Optimized solution
N, M, Q = list(map(int, input().split()))

# cum_sum[L][R]
cum_sum = [[0 for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M):
    L, R = list(map(int, input().split()))
    cum_sum[L][R] += 1

for l in range(1, N+1):
    for r in range(1, N+1):
        cum_sum[l][r] += cum_sum[l][r-1] + cum_sum[l-1][r] - cum_sum[l-1][r-1]

for _ in range(Q):
    p, q = list(map(int, input().split()))
    print((cum_sum[q][q]-cum_sum[q][p-1]-cum_sum[p-1][q]+cum_sum[p-1][p-1]))
# Original solution
N, M, QN = [int(x) for x in input().split()]

MAT0 = [[0] * (N + 1) for _ in range(N + 1)]

for i in range(M):
    l, r = [int(x) for x in input().split()]
    MAT0[l][r] += 1

MAT = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
    for j in range(0, N + 1):
        MAT[i][j] = MAT[i][j - 1] + MAT0[i][j]

for i in range(QN):
    p, q = [int(x) for x in input().split()]
    ret = 0
    for j in range(p, q + 1):
        ret = ret + MAT[j][q] - MAT[j][p - 1]
    print(ret)


# Optimized solution
N, M, QN = [int(x) for x in input().split()]

MAT0 = [[0] * (N + 1) for _ in range(N + 1)]

for i in range(M):
    l, r = [int(x) for x in input().split()]
    MAT0[l][r] += 1

MAT = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
    for j in range(1, N + 1):
        MAT[i][j] = MAT[i][j - 1] + MAT0[i][j]

MM = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
    for j in range(1, N + 1):
        MM[i][j] = MM[i - 1][j] + MAT[i][j]

for i in range(QN):
    p, q = [int(x) for x in input().split()]
    ret = 0
    ret = ret + MM[q][q] - MM[q][p - 1] - MM[p - 1][q] + MM[p - 1][p - 1]
    print(ret)
# Original solution
n,m,q = list(map(int,input().split(" ")))
LR_2d = [[0 for i in range(n)] for i in range(n)]
for i in range(m):
    L,R = list(map(int,input().split(" ")))
    LR_2d[L-1][R-1] += 1
LR_2dsum = [[0 for i in range(n)] for i in range(n)]
for i in range(n):
    LR_2dsum[i][0] = LR_2d[i][0]
    for j in range(1,n):
        LR_2dsum[i][j] = LR_2dsum[i][j-1] + LR_2d[i][j]
for i in range(q):
    ans = 0
    p_i,q_i = list(map(int,input().split(" ")))
    for j in range(p_i-1,q_i):
        if p_i == 1:
            ans_j = LR_2dsum[j][q_i-1]
        else:
            ans_j = LR_2dsum[j][q_i-1] - LR_2dsum[j][p_i-2]
        ans += ans_j
    print(ans)

# Optimized solution
n,m,q = list(map(int,input().split(" ")))
LR_2d = [[0 for i in range(n+1)] for i in range(n+1)]
for i in range(m):
    L,R = list(map(int,input().split(" ")))
    LR_2d[L][R] += 1

LR_2dsum = [[0 for i in range(n+1)] for i in range(n+1)]
for j in range(1,n):
    LR_2dsum[0][j] = LR_2dsum[0][j-1] + LR_2d[0][j]
for i in range(1,n+1):
    for j in range(1,n+1):
        LR_2dsum[i][j] = LR_2dsum[i-1][j] + LR_2dsum[i][j-1] - LR_2dsum[i-1][j-1] + LR_2d[i][j]

for i in range(q):
    p_i,q_i = list(map(int,input().split(" ")))
    ans = LR_2dsum[p_i-1][p_i-1] - LR_2dsum[p_i-1][q_i] - LR_2dsum[q_i][p_i-1] + LR_2dsum[q_i][q_i]
    print(ans)
# Original solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import bisect
import array


def solve():
    n, m, q = list(map(int, input().split()))
    nl = [[] for j in range(n + 1)]
    for e in (input().split() for _ in [0] * m):
        l, r = int(e[0]), int(e[1])
        bisect.insort_left(nl[l], r)
    table = [array.array("i", [0] * (n + 1)) for j in range(n + 1)]
    ran = array.array("i", list(range(n + 1)))
    for i in ran:
        table[i] = [bisect.bisect_right(nl[i], j) for j in ran]

    a = [0] * q
    s = array.array("i", a)
    for i, e in enumerate(input().split() for _ in a):
        l, r = int(e[0]), int(e[1])
        s[i] = sum(table[j][r] - table[j][l - 1] for j in range(l, r + 1))
    print(("\n".join(str(e) for e in s)))


if __name__ == "__main__":
    solve()


# Optimized solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import bisect
import array


def solve():
    n, m, q = list(map(int, input().split()))
    nl = [[0 for i in range(n + 1)] for j in range(n + 1)]
    for e in [input().split() for _ in range(m)]:
        l, r = int(e[0]), int(e[1])
        nl[l][r] += 1
    table = [array.array("i", [0] * (n + 2)) for j in range(n + 2)]
    ran = array.array("i", list(range(n + 1)))
    for i in ran:
        for j in ran:
            table[i][j + 1] = table[i][j] + nl[i][j]

    for i, e in enumerate([input().split() for _ in range(q)]):
        l, r = int(e[0]), int(e[1])
        ans = 0
        for j in range(l, r + 1):
            ans += table[j][r + 1] - table[j][l]
        print(ans)


if __name__ == "__main__":
    solve()
# Original solution
import sys

def main():
  input = sys.stdin.readline
  N, M, Q  = list(map(int, input().split()))
  
  DP = [[0 for _ in range(N+1)] for _ in range(N+1)] 
  for _ in range(M):
    l, r = list(map(int, input().split()))
    for i in range(l+1):
      for j in range(r, N+1):
        DP[i][j] += 1

  for _ in range(Q):
    p, q = list(map(int, input().split()))
    print((DP[p][q]))


if __name__ == '__main__':
  main()

# Optimized solution
import sys

def main():
  input = sys.stdin.readline
  N, M, Q  = list(map(int, input().split()))
  
  DP = [[0 for _ in range(N+1)] for _ in range(N+1)] 
  for _ in range(M):
    l, r = list(map(int, input().split()))
    DP[l][r] += 1

  cum = [[0 for _ in range(N+1)] for _ in range(N+1)]
  for i in range(1, N+1):
    for j in range(1, N+1):
      cum[i][j] = DP[i][j] + cum[i-1][j] + cum[i][j-1] - cum[i-1][j-1]

  for _ in range(Q):
    p, q = list(map(int, input().split()))
    print((cum[q][q] - cum[p-1][q] - cum[q][p-1] + cum[p-1][p-1]))


if __name__ == '__main__':
  main()
# Original solution
import sys

def main():
  input = sys.stdin.readline
  N, M, Q  = list(map(int, input().split()))
  
  DP = [[0 for _ in range(N+1)] for _ in range(N+1)] 
  for _ in range(M):
    l, r = list(map(int, input().split()))
    DP[l][r] += 1

  cum = [[0 for _ in range(N+1)] for _ in range(N+1)]
  for i in range(1, N+1):
    for j in range(1, N+1):
      cum[i][j] = DP[i][j] + cum[i-1][j] + cum[i][j-1] - cum[i-1][j-1]

  for _ in range(Q):
    p, q = list(map(int, input().split()))
    print((cum[q][q] - cum[p-1][q] - cum[q][p-1] + cum[p-1][p-1]))


if __name__ == '__main__':
  main()

# Optimized solution
import sys

def main():
  input = sys.stdin.readline
  N, M, Q  = list(map(int, input().split()))
  
  Pos = [[0 for _ in range(N+1)] for _ in range(N+1)] 
  for _ in range(M):
    l, r = list(map(int, input().split()))
    Pos[l][r] += 1

  cum = [[0 for _ in range(N+1)] for _ in range(N+1)]
  for i in range(1, N+1):
    for j in range(1, N+1):
      cum[i][j] = Pos[i][j] + cum[i-1][j] + cum[i][j-1] - cum[i-1][j-1]

  for _ in range(Q):
    p, q = list(map(int, input().split()))
    print((cum[q][q] - cum[p-1][q] - cum[q][p-1] + cum[p-1][p-1]))


if __name__ == '__main__':
  main()
# Original solution
# -*- coding: utf-8 -*-
line = input().split(" ")
N = int(line[0])
M = int(line[1])
Q = int(line[2])

memo = [[0 for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M):
    line = input().split(" ")
    l = int(line[0])
    r = int(line[1])
    memo[l][r] += 1

for _ in range(Q):
    line = input().split(" ")
    p = int(line[0])
    q = int(line[1])

    ret = 0
    for i in range(p,q+1):
        for j in range(i,q+1):
            ret += memo[i][j]
    print(ret)


# Optimized solution
# -*- coding: utf-8 -*-
n,m,q = list(map(int, input().split()))

d = [[0 for _ in range(n+1)] for _ in range(n+1)]

for _ in range(m):
    l,r = list(map(int, input().split()))
    d[l][r] += 1
for i in range(n,0,-1):
    for j in range(n):
        d[i][j+1] += d[i][j]
for j in range(n,0,-1):
    for i in range(n,0,-1):
        d[i-1][j] += d[i][j]

pq = []
for _ in range(q):
    p,q = list(map(int, input().split()))
    pq.append([p,q])

# print(d)
for o in pq:
    print((d[o[0]][o[1]]))
# Original solution
n,m,q= list(map(int,input().split()))
lrList=[list(map(int,input().split()))for i in range(m)]
pqList=[list(map(int,input().split()))for i in range(q)]
for pq in pqList:
    ans = 0
    for lr in lrList:
        ans +=(pq[0] <= lr[0] and pq[1] >= lr[1])
    print(ans)

# Optimized solution
n,m,q= list(map(int,input().split()))
dataList = [[0 for xIndex in range(n+1)]for yIndex in range(n+1)]

for i in range(m):
    xTemp,yTemp = list(map(int,input().split()))
    dataList[yTemp][xTemp]+=1
pqList=[list([int(x) for x in input().split()])for i in range(q)]
for yIndex in range(1,n+1):
    for xIndex in range(1,n+1):
        dataList[yIndex][xIndex]+=dataList[yIndex][xIndex-1]
for yIndex in range(1,n+1):
    for xIndex in range(1,n+1):
        dataList[yIndex][xIndex]+=dataList[yIndex-1][xIndex]

for pq in pqList:
    p = pq[0]-1
    q = pq[1]
    print((dataList[q][q]+dataList[p][p]-dataList[p][q]-dataList[q][p]))