Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import numpy as np

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

Xi = np.zeros((N+1,N+1),dtype=np.int32)
for i in range(M):
    L, R = map(int, input().split())
    Xi[L][R] += 1

Ci = np.zeros((N+1,N+1),dtype=np.int32)
tmp = 0
for l in range(N+1):
    for r in range(N+1):
        tmp += Xi[l][r]
        Ci[l][r] = tmp

# print(Ci)

for r in range(N+1):
    tmp = 0
    for l in range(N+1):
        tmp += Ci[l][r]
        Ci[l][r] = tmp

# print(Ci)

# pqi = []
ans = []
for i in range(Q):
    p, q = map(int, input().split())
    # pqi.append((p,q))
    tmp = Ci[q][q] - Ci[q][p-1]  - Ci[p-1][q] + Ci[p-1][p-1]
    ans.append(tmp)

# print(Ci)

for a in ans:
    print(a)
#
# for (p, q) in pqi:
#     tmp = 0
#     for l in range(p,q+1):
#         tmp += Ci[l][q] - Ci[l][p-1]
#
#     print(tmp)


Fixed submission:
# -*- coding: utf-8 -*-
# import numpy as np

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

# Xi = np.zeros((N+1,N+1),dtype=np.int32)
Xi = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
    L, R = map(int, input().split())
    Xi[L][R] += 1

# Ci = np.zeros((N+1,N+1),dtype=np.int32)
Ci = [[0]*(N+1) for i in range(N+1)]
tmp = 0
for l in range(N+1):
    for r in range(N+1):
        tmp += Xi[l][r]
        Ci[l][r] = tmp

# print(Ci)

for r in range(N+1):
    tmp = 0
    for l in range(N+1):
        tmp += Ci[l][r]
        Ci[l][r] = tmp

# print(Ci)

pqi = []
for i in range(Q):
    p, q = map(int, input().split())
    pqi.append((p,q))

for (p, q) in pqi:
    tmp = Ci[q][q] - Ci[q][p-1]  - Ci[p-1][q] + Ci[p-1][p-1]
    print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import numpy as np

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

Xi = np.zeros((N+1,N+1),dtype=np.int32)
for i in range(M):
    L, R = map(int, input().split())
    Xi[L][R] += 1

Ci = np.zeros((N+1,N+1),dtype=np.int32)
tmp = 0
for l in range(N+1):
    for r in range(N+1):
        tmp += Xi[l][r]
        Ci[l][r] = tmp

# pqi = []
ans = []
for i in range(Q):
    tmp = 0
    p, q = map(int, input().split())
    # pqi.append((p,q))
    for l in range(p,q+1):
        tmp += Ci[l][q] - Ci[l][p-1]
    ans.append(tmp)

for a in ans:
    print(a)
#
# for (p, q) in pqi:
#     tmp = 0
#     for l in range(p,q+1):
#         tmp += Ci[l][q] - Ci[l][p-1]
#
#     print(tmp)


Fixed submission:
# -*- coding: utf-8 -*-
# import numpy as np

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

# Xi = np.zeros((N+1,N+1),dtype=np.int32)
Xi = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
    L, R = map(int, input().split())
    Xi[L][R] += 1

# Ci = np.zeros((N+1,N+1),dtype=np.int32)
Ci = [[0]*(N+1) for i in range(N+1)]
tmp = 0
for l in range(N+1):
    for r in range(N+1):
        tmp += Xi[l][r]
        Ci[l][r] = tmp

# print(Ci)

for r in range(N+1):
    tmp = 0
    for l in range(N+1):
        tmp += Ci[l][r]
        Ci[l][r] = tmp

# print(Ci)

pqi = []
for i in range(Q):
    p, q = map(int, input().split())
    pqi.append((p,q))

for (p, q) in pqi:
    tmp = Ci[q][q] - Ci[q][p-1]  - Ci[p-1][q] + Ci[p-1][p-1]
    print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import numpy as np

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

# LRi = []
Xi = np.zeros((N+1,N+1),dtype=np.int32)
for i in range(M):
    L, R = map(int, input().split())
    # LRi.append((L,R))
    Xi[L][R] += 1

pqi = []
for i in range(Q):
    p, q = map(int, input().split())
    pqi.append((p,q))

# for (L,R) in LRi:
#     Xi[L][R] += 1

# print(Xi)

Ci = np.zeros((N+1,N+1),dtype=np.int32)
tmp = 0
for l in range(N+1):
    for r in range(N+1):
        tmp += Xi[l][r]
        Ci[l][r] = tmp

# print(Ci)

for (p, q) in pqi:
    tmp = 0
    for l in range(p,q+1):
        tmp += Ci[l][q] - Ci[l][p-1]

    print(tmp)


Fixed submission:
# -*- coding: utf-8 -*-
# import numpy as np

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

# Xi = np.zeros((N+1,N+1),dtype=np.int32)
Xi = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
    L, R = map(int, input().split())
    Xi[L][R] += 1

# Ci = np.zeros((N+1,N+1),dtype=np.int32)
Ci = [[0]*(N+1) for i in range(N+1)]
tmp = 0
for l in range(N+1):
    for r in range(N+1):
        tmp += Xi[l][r]
        Ci[l][r] = tmp

# print(Ci)

for r in range(N+1):
    tmp = 0
    for l in range(N+1):
        tmp += Ci[l][r]
        Ci[l][r] = tmp

# print(Ci)

pqi = []
for i in range(Q):
    p, q = map(int, input().split())
    pqi.append((p,q))

for (p, q) in pqi:
    tmp = Ci[q][q] - Ci[q][p-1]  - Ci[p-1][q] + Ci[p-1][p-1]
    print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
from operator import itemgetter
import numpy as np

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

LRi = []
for i in range(M):
    L, R = map(int, input().split())
    LRi.append((L,R))

#
# LRi.sort(key=itemgetter(1))
#
pqi = []
for i in range(Q):
    p, q = map(int, input().split())
    pqi.append((p,q))

Xi = np.zeros((N+1,N+1),dtype=np.int32)
for (L,R) in LRi:
    Xi[L][R] += 1

# print(Xi)

Ci = np.zeros((N+1,N+1),dtype=np.int32)
tmp = 0
for l in range(N+1):
    for r in range(N+1):
        tmp += Xi[l][r]
        Ci[l][r] = tmp

# print(Ci)

for (p, q) in pqi:
    tmp = 0
    for l in range(p,q+1):
        tmp += Ci[l][q] - Ci[l][p-1]

    print(tmp)


Fixed submission:
# -*- coding: utf-8 -*-
# import numpy as np

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

# Xi = np.zeros((N+1,N+1),dtype=np.int32)
Xi = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
    L, R = map(int, input().split())
    Xi[L][R] += 1

# Ci = np.zeros((N+1,N+1),dtype=np.int32)
Ci = [[0]*(N+1) for i in range(N+1)]
tmp = 0
for l in range(N+1):
    for r in range(N+1):
        tmp += Xi[l][r]
        Ci[l][r] = tmp

# print(Ci)

for r in range(N+1):
    tmp = 0
    for l in range(N+1):
        tmp += Ci[l][r]
        Ci[l][r] = tmp

# print(Ci)

pqi = []
for i in range(Q):
    p, q = map(int, input().split())
    pqi.append((p,q))

for (p, q) in pqi:
    tmp = Ci[q][q] - Ci[q][p-1]  - Ci[p-1][q] + Ci[p-1][p-1]
    print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
from operator import itemgetter

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

LRi = []
for i in range(M):
    L, R = map(int, input().split())
    LRi.append((L,R))


LRi.sort(key=itemgetter(1))

pqi = []
for i in range(Q):
    p, q = map(int, input().split())
    pqi.append((p,q))


for (p, q) in pqi:
    cnt = 0
    for (L,R) in LRi:
        if p <= L and R <= q:
            cnt += 1
        elif q < R:
            break
        elif L < p:
            continue
    print(cnt)


Fixed submission:
# -*- coding: utf-8 -*-
# import numpy as np

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

# Xi = np.zeros((N+1,N+1),dtype=np.int32)
Xi = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
    L, R = map(int, input().split())
    Xi[L][R] += 1

# Ci = np.zeros((N+1,N+1),dtype=np.int32)
Ci = [[0]*(N+1) for i in range(N+1)]
tmp = 0
for l in range(N+1):
    for r in range(N+1):
        tmp += Xi[l][r]
        Ci[l][r] = tmp

# print(Ci)

for r in range(N+1):
    tmp = 0
    for l in range(N+1):
        tmp += Ci[l][r]
        Ci[l][r] = tmp

# print(Ci)

pqi = []
for i in range(Q):
    p, q = map(int, input().split())
    pqi.append((p,q))

for (p, q) in pqi:
    tmp = Ci[q][q] - Ci[q][p-1]  - Ci[p-1][q] + Ci[p-1][p-1]
    print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
from operator import itemgetter

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

LRi = []
for i in range(M):
    L, R = map(int, input().split())
    LRi.append((L,R))


LRi.sort(key=itemgetter(1))

pqi = []
for i in range(Q):
    p, q = map(int, input().split())
    pqi.append((p,q))

# pqi.sort(key=itemgetter(1))

#
# print(LRi)
# print(pqi)

for (p, q) in pqi:
    cnt = 0
    for (L,R) in LRi:
        if p <= L and R <= q:
            cnt += 1
        elif q < R:
            break
    print(cnt)


Fixed submission:
# -*- coding: utf-8 -*-
# import numpy as np

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

# Xi = np.zeros((N+1,N+1),dtype=np.int32)
Xi = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
    L, R = map(int, input().split())
    Xi[L][R] += 1

# Ci = np.zeros((N+1,N+1),dtype=np.int32)
Ci = [[0]*(N+1) for i in range(N+1)]
tmp = 0
for l in range(N+1):
    for r in range(N+1):
        tmp += Xi[l][r]
        Ci[l][r] = tmp

# print(Ci)

for r in range(N+1):
    tmp = 0
    for l in range(N+1):
        tmp += Ci[l][r]
        Ci[l][r] = tmp

# print(Ci)

pqi = []
for i in range(Q):
    p, q = map(int, input().split())
    pqi.append((p,q))

for (p, q) in pqi:
    tmp = Ci[q][q] - Ci[q][p-1]  - Ci[p-1][q] + Ci[p-1][p-1]
    print(tmp)