Buggy python submission (verdict: Time Limit Exceeded):
import sys

input = sys.stdin.readline
N, M, Q = [int(_) for _ in input().split()]

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

for _ in range(M):
    l, r = [int(_) for _ in input().split()]
    lr[l][r] += 1
for i in range(1, N + 1):
    for j in range(1, N + 1):
        lr[i][j] += lr[i][j - 1]

# for i in range(1, N + 1):
#     print(lr[i][1:])
for _ in range(Q):
    p, q = [int(_) for _ in input().split()]
    ans = 0
    for i in range(p, q + 1):
        ans += lr[i][q] - lr[i][p - 1]
    print(ans)


Fixed submission:
import sys

input = sys.stdin.readline
N, M, Q = [int(_) for _ in input().split()]

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

for _ in range(M):
    l, r = [int(_) for _ in input().split()]
    lr[l][r] += 1
for i in range(1, N + 1):
    for j in range(1, N + 1):
        lr[i][j] += lr[i][j - 1]

# for i in range(1, N + 1):
#     print(lr[i][1:])
for _ in range(Q):
    p, q = [int(_) for _ in input().split()]
    ans = 0
    for i in range(p, q + 1):
        ans += lr[i][q] - lr[i][p - 1]
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N, M, Q = [int(_) for _ in input().split()]

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

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

# for i in range(1, N + 1):
#     print(lr[i][1:])
for _ in range(Q):
    p, q = [int(_) for _ in input().split()]
    ans = 0
    for i in range(p, q + 1):
        for j in range(i, q + 1):
            ans += lr[i][j]
    print(ans)


Fixed submission:
import sys

input = sys.stdin.readline
N, M, Q = [int(_) for _ in input().split()]

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

for _ in range(M):
    l, r = [int(_) for _ in input().split()]
    lr[l][r] += 1
for i in range(1, N + 1):
    for j in range(1, N + 1):
        lr[i][j] += lr[i][j - 1]

# for i in range(1, N + 1):
#     print(lr[i][1:])
for _ in range(Q):
    p, q = [int(_) for _ in input().split()]
    ans = 0
    for i in range(p, q + 1):
        ans += lr[i][q] - lr[i][p - 1]
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = [int(_) for _ in input().split()]

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

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

# for i in range(1, N + 1):
#     print(lr[i][1:])
for _ in range(Q):
    p, q = [int(_) for _ in input().split()]
    ans = 0
    for i in range(p, q + 1):
        for j in range(i, q + 1):
            ans += lr[i][j]
    print(ans)


Fixed submission:
import sys

input = sys.stdin.readline
N, M, Q = [int(_) for _ in input().split()]

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

for _ in range(M):
    l, r = [int(_) for _ in input().split()]
    lr[l][r] += 1
for i in range(1, N + 1):
    for j in range(1, N + 1):
        lr[i][j] += lr[i][j - 1]

# for i in range(1, N + 1):
#     print(lr[i][1:])
for _ in range(Q):
    p, q = [int(_) for _ in input().split()]
    ans = 0
    for i in range(p, q + 1):
        ans += lr[i][q] - lr[i][p - 1]
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = [int(_) for _ in input().split()]

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

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

# for i in range(1, N + 1):
#     print(lr[i][1:])
for _ in range(Q):
    p, q = [int(_) for _ in input().split()]
    ans = 0
    for i in range(p, q + 1):
        for j in range(p, q + 1):
            ans += lr[i][j]
    print(ans)


Fixed submission:
import sys

input = sys.stdin.readline
N, M, Q = [int(_) for _ in input().split()]

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

for _ in range(M):
    l, r = [int(_) for _ in input().split()]
    lr[l][r] += 1
for i in range(1, N + 1):
    for j in range(1, N + 1):
        lr[i][j] += lr[i][j - 1]

# for i in range(1, N + 1):
#     print(lr[i][1:])
for _ in range(Q):
    p, q = [int(_) for _ in input().split()]
    ans = 0
    for i in range(p, q + 1):
        ans += lr[i][q] - lr[i][p - 1]
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = [int(_) for _ in input().split()]

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

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

# for i in range(1, N + 1):
#     print(lr[i][1:])
for _ in range(Q):
    p, q = [int(_) for _ in input().split()]
    ans = 0
    for i in range(p, q + 1):
        for j in range(p, q + 1):
            ans += lr[i][j]
    print(ans)


Fixed submission:
import sys

input = sys.stdin.readline
N, M, Q = [int(_) for _ in input().split()]

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

for _ in range(M):
    l, r = [int(_) for _ in input().split()]
    lr[l][r] += 1
for i in range(1, N + 1):
    for j in range(1, N + 1):
        lr[i][j] += lr[i][j - 1]

# for i in range(1, N + 1):
#     print(lr[i][1:])
for _ in range(Q):
    p, q = [int(_) for _ in input().split()]
    ans = 0
    for i in range(p, q + 1):
        ans += lr[i][q] - lr[i][p - 1]
    print(ans)