Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = map(int, input().split())

range_array = [[0 for _ in range(N)] for _ in range(N)]
ans = [[0 for _ in range(N)] for _ in range(N)]

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

for i in range(N):
    sum = 0
    for j in range(N):
        sum += range_array[i][j]
        range_array[i][j] = sum
'''
for i in range(N):
    for j in range(i, N):
        sum = 0
        for k in range(i, j + 1):
            sum += range_array[k][j]
        ans[i][j] = sum
'''
for _ in range(Q):
    p, q = map(int, input().split())
    p -= 1
    q -= 1
    sum = 0
    for k in range(p, q + 1):
        sum += range_array[k][q]
    print(sum)


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

range_array = [[0 for _ in range(N)] for _ in range(N)]
ans = [[0 for _ in range(N)] for _ in range(N)]

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

for i in range(N):
    sum = 0
    for j in range(N):
        sum += range_array[i][j]
        range_array[i][j] = sum
'''
for i in range(N):
    for j in range(i, N):
        sum = 0
        for k in range(i, j + 1):
            sum += range_array[k][j]
        ans[i][j] = sum
'''
for _ in range(Q):
    p, q = map(int, input().split())
    p -= 1
    q -= 1
    sum = 0
    for k in range(p, q + 1):
        sum += range_array[k][q]
    print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = map(int, input().split())

range_array = [[0 for _ in range(N)] for _ in range(N)]
ans = [[0 for _ in range(N)] for _ in range(N)]

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

for i in range(N):
    sum = 0
    for j in range(N):
        sum += range_array[i][j]
        range_array[i][j] = sum

for i in range(N):
    for j in range(i, N):
        sum = 0
        for k in range(i, j + 1):
            sum += range_array[k][j]
        ans[i][j] = sum

for _ in range(Q):
    p, q = map(int, input().split())
    p -= 1
    q -= 1
    sum = 0
    for k in range(p, q + 1):
        sum += range_array[k][q]
    print(sum)


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

range_array = [[0 for _ in range(N)] for _ in range(N)]
ans = [[0 for _ in range(N)] for _ in range(N)]

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

for i in range(N):
    sum = 0
    for j in range(N):
        sum += range_array[i][j]
        range_array[i][j] = sum
'''
for i in range(N):
    for j in range(i, N):
        sum = 0
        for k in range(i, j + 1):
            sum += range_array[k][j]
        ans[i][j] = sum
'''
for _ in range(Q):
    p, q = map(int, input().split())
    p -= 1
    q -= 1
    sum = 0
    for k in range(p, q + 1):
        sum += range_array[k][q]
    print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = map(int, input().split())

range_array = [[0 for _ in range(N)] for _ in range(N)]
ans = [[0 for _ in range(N)] for _ in range(N)]

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

for i in range(N):
    sum = 0
    for j in range(N):
        sum += range_array[i][j]
        range_array[i][j] = sum

for i in range(N):
    for j in range(i, N):
        sum = 0
        for k in range(i, j + 1):
            sum += range_array[k][j]
        ans[i][j] = sum

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


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

range_array = [[0 for _ in range(N)] for _ in range(N)]
ans = [[0 for _ in range(N)] for _ in range(N)]

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

for i in range(N):
    sum = 0
    for j in range(N):
        sum += range_array[i][j]
        range_array[i][j] = sum
'''
for i in range(N):
    for j in range(i, N):
        sum = 0
        for k in range(i, j + 1):
            sum += range_array[k][j]
        ans[i][j] = sum
'''
for _ in range(Q):
    p, q = map(int, input().split())
    p -= 1
    q -= 1
    sum = 0
    for k in range(p, q + 1):
        sum += range_array[k][q]
    print(sum)