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

nl = [[0 for i in range(N)] for j in range(N)]
for t in [input().split() for _ in range(M)]:
    i = int(t[0]) - 1
    j = int(t[1]) - 1
    nl[i][j] += 1

l = [[0 for i in range(N)] for j in range(N)]
for i in range(N):
    s = 0
    for j in range(N):
        l[i][j] = s + nl[i][j]
        s = l[i][j]

for k in [input().split() for _ in range(Q)]:
    p = int(k[0])
    q = int(k[1])
    ans = 0
    for i in range(p-1, q):
        if p == 1:
            d = l[i][q-1]
        else:
            d = l[i][q-1] - l[i][p-2]
        ans += d
    print(ans)

Fixed submission:
N, M, Q = [int(_) for _ in input().split()]

l = [[0 for i in range(N+1)] for j in range(N+2)]
for t in [input().split() for _ in range(M)]:
    i = int(t[0])
    j = int(t[1])
    l[i][j] += 1

for k in range(N):
    for i in range(1, N-k+1):
        j = i + k
        l[i][j] += l[i][j-1] + l[i+1][j] - l[i+1][j-1]

for k in [input().split() for _ in range(Q)]:
    p = int(k[0])
    q = int(k[1])
    print(l[p][q])

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

nl = [[0 for i in range(N)] for j in range(N)]
for t in train:
    i = t[0] - 1
    j = t[1] - 1
    nl[i][j] += 1

l = [[0 for i in range(N)] for j in range(N)]
for i in range(N):
    s = 0
    for j in range(N):
        l[i][j] = s + nl[i][j]
        s = l[i][j]

for k in range(Q):
    p = question[k][0]
    q = question[k][1]
    ans = 0
    for i in range(p-1, q):
        if p == 1:
            d = l[i][q-1]
        else:
            d = l[i][q-1] - l[i][p-2]
        ans += d
    print(ans)


Fixed submission:
N, M, Q = [int(_) for _ in input().split()]

l = [[0 for i in range(N+1)] for j in range(N+2)]
for t in [input().split() for _ in range(M)]:
    i = int(t[0])
    j = int(t[1])
    l[i][j] += 1

for k in range(N):
    for i in range(1, N-k+1):
        j = i + k
        l[i][j] += l[i][j-1] + l[i+1][j] - l[i+1][j-1]

for k in [input().split() for _ in range(Q)]:
    p = int(k[0])
    q = int(k[1])
    print(l[p][q])

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

l = [[0 for i in range(N)] for j in range(N)]
for i in range(N):
    s = 0
    for j in range(N):
        if i >= j:
            a = train.count([j+1, i+1])
        else:
            a = train.count([i+1, j+1])
        l[i][j] = s + a
        s += a

for k in range(Q):
    p = question[k][0]
    q = question[k][1]
    ans = 0
    for i in range(p-1, q):
        if i == 0:
            d = l[i][q-1]
        else:
            d = l[i][q-1] - l[i][i-1]
        ans += d
    print(ans)


Fixed submission:
N, M, Q = [int(_) for _ in input().split()]

l = [[0 for i in range(N+1)] for j in range(N+2)]
for t in [input().split() for _ in range(M)]:
    i = int(t[0])
    j = int(t[1])
    l[i][j] += 1

for k in range(N):
    for i in range(1, N-k+1):
        j = i + k
        l[i][j] += l[i][j-1] + l[i+1][j] - l[i+1][j-1]

for k in [input().split() for _ in range(Q)]:
    p = int(k[0])
    q = int(k[1])
    print(l[p][q])

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

l = [[0 for i in range(N)] for j in range(N)]
for i in range(N):
    s = 0
    for j in range(N):
        if i >= j:
            a = train.count([j+1, i+1])
        else:
            a = train.count([i+1, j+1])
        l[i][j] = s + a
        s += a

for k in range(Q):
    p = question[k][0]
    q = question[k][1]
    ans = 0
    for i in range(p-1, q):
        if i == 0:
            d = l[i][q-1]
        else:
            d = l[i][q-1] - l[i][i-1]
        ans += d
    print(ans)



Fixed submission:
N, M, Q = [int(_) for _ in input().split()]

l = [[0 for i in range(N+1)] for j in range(N+2)]
for t in [input().split() for _ in range(M)]:
    i = int(t[0])
    j = int(t[1])
    l[i][j] += 1

for k in range(N):
    for i in range(1, N-k+1):
        j = i + k
        l[i][j] += l[i][j-1] + l[i+1][j] - l[i+1][j-1]

for k in [input().split() for _ in range(Q)]:
    p = int(k[0])
    q = int(k[1])
    print(l[p][q])

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

l = []
for i in range(N):
    s = 0
    l2 = []
    for j in range(N):
        if i >= j:
            a = train.count([j+1, i+1])
        else:
            a = train.count([i+1, j+1])
        l2.append(s + a)
        s += a
    l.append(l2)

for k in range(Q):
    p = question[k][0]
    q = question[k][1]
    ans = 0
    for i in range(p-1, q):
        if i == 0:
            d = l[i][q-1]
        else:
            d = l[i][q-1] - l[i][i-1]
        ans += d
    print(ans)



Fixed submission:
N, M, Q = [int(_) for _ in input().split()]

l = [[0 for i in range(N+1)] for j in range(N+2)]
for t in [input().split() for _ in range(M)]:
    i = int(t[0])
    j = int(t[1])
    l[i][j] += 1

for k in range(N):
    for i in range(1, N-k+1):
        j = i + k
        l[i][j] += l[i][j-1] + l[i+1][j] - l[i+1][j-1]

for k in [input().split() for _ in range(Q)]:
    p = int(k[0])
    q = int(k[1])
    print(l[p][q])

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

l = []
for i in range(Q):
    counter = 0
    p = question[i][0]
    q = question[i][1]
    for j in range(M):
        if p <= train[j][0] and train[j][1] <= q:
            counter += 1
    l.append(counter)

for i in range(Q):
    print(l[i])

Fixed submission:
N, M, Q = [int(_) for _ in input().split()]

l = [[0 for i in range(N+1)] for j in range(N+2)]
for t in [input().split() for _ in range(M)]:
    i = int(t[0])
    j = int(t[1])
    l[i][j] += 1

for k in range(N):
    for i in range(1, N-k+1):
        j = i + k
        l[i][j] += l[i][j-1] + l[i+1][j] - l[i+1][j-1]

for k in [input().split() for _ in range(Q)]:
    p = int(k[0])
    q = int(k[1])
    print(l[p][q])