Buggy python submission (verdict: Time Limit Exceeded):
n, m, q = map(int, input().split())

table = [[0]*n for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    table[a-1][b-1] += 1

s = [[0] for i in range(n)]

for i in range(n):
    for j in range(n):
        s[i].append(s[i][-1]+table[i][j])

for _ in range(q):
    i, j = map(int, input().split())
    tmp = 0
    if i == 1:
        for k in range(i-1, j):
            tmp += s[k][j]
    else:
        for k in range(i-1, j):
            tmp += s[k][j] - s[k][i-1]
    print(tmp)



Fixed submission:
n, m, q = map(int, input().split())
x = [tuple(map(int, input().split())) for _ in range(m)]
y = [tuple(map(int, input().split())) for _ in range(q)]

table = [[0]*n for _ in range(n)]

for i, j in x:
    table[i-1][j-1] += 1

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

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

for i, j in y:
    print(table[i-1][j-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, m, q = map(int, input().split())

table = [[0]*n for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    table[a-1][b-1] += 1

s = [[table[i][0]] for i in range(n)]

for i in range(n):
    for j in range(1, n):
        s[i].append(s[i][-1]+table[i][j])

for _ in range(q):
    i, j = map(int, input().split())
    tmp = 0
    if i == 1:
        for k in range(i-1, j):
            tmp += s[k][j-1]
    else:
        for k in range(i-1, j):
            tmp += s[k][j-1] - s[k][i-2]
    print(tmp)



'''
for i in range(n):
    for j in range(1, n):
        table[i][j] += table[i][j-1]

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

for i, j in y:
    print(table[i-1][j-1])
'''


Fixed submission:
n, m, q = map(int, input().split())
x = [tuple(map(int, input().split())) for _ in range(m)]
y = [tuple(map(int, input().split())) for _ in range(q)]

table = [[0]*n for _ in range(n)]

for i, j in x:
    table[i-1][j-1] += 1

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

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

for i, j in y:
    print(table[i-1][j-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, m, q = map(int, input().split())
x = [tuple(map(int, input().split())) for _ in range(m)]
y = [tuple(map(int, input().split())) for _ in range(q)]

table = [[0]*n for _ in range(n)]

for i, j in x:
    table[i-1][j-1] += 1

s = [[table[i][0]] for i in range(n)]

for i in range(n):
    for j in range(1, n):
        s[i].append(s[i][-1]+table[i][j])

for i, j in y:
    tmp = 0
    if i == 1:
        for k in range(i-1, j):
            tmp += s[k][j-1]
    else:
        for k in range(i-1, j):
            tmp += s[k][j-1] - s[k][i-2]
    print(tmp)



'''
for i in range(n):
    for j in range(1, n):
        table[i][j] += table[i][j-1]

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

for i, j in y:
    print(table[i-1][j-1])
'''


Fixed submission:
n, m, q = map(int, input().split())
x = [tuple(map(int, input().split())) for _ in range(m)]
y = [tuple(map(int, input().split())) for _ in range(q)]

table = [[0]*n for _ in range(n)]

for i, j in x:
    table[i-1][j-1] += 1

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

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

for i, j in y:
    print(table[i-1][j-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, m, q = map(int, input().split())
x = [tuple(map(int, input().split())) for _ in range(m)]
y = [tuple(map(int, input().split())) for _ in range(q)]

table = [[0]*n for _ in range(n)]

for i, j in x:
    table[i-1][j-1] += 1

for i, j in y:
    ans = 0
    for s in range(i-1, j):
        for t in range(i-1, j):
            ans += table[s][t]
    print(ans)

'''
for i in range(n):
    for j in range(1, n):
        table[i][j] += table[i][j-1]

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

for i, j in y:
    print(table[i-1][j-1])
'''


Fixed submission:
n, m, q = map(int, input().split())
x = [tuple(map(int, input().split())) for _ in range(m)]
y = [tuple(map(int, input().split())) for _ in range(q)]

table = [[0]*n for _ in range(n)]

for i, j in x:
    table[i-1][j-1] += 1

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

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

for i, j in y:
    print(table[i-1][j-1])