Buggy python submission (verdict: Time Limit Exceeded):
n, m, qqq = map(int, input().split())
LR = [[0 for _ in range(n)]for __ in range(n)]

for i in range(m):
    l, r = map(int, input().split())
    LR[l-1][r-1]+=1


for i in range(qqq):
    p, q = map(int, input().split())
    ans = 0
    for i in range(p-1, n):
        for j in range(q):
            ans += LR[i][j]
    print(ans)
# print(LR)


Fixed submission:
n, m, qqq = map(int, input().split())
DP = [[0 for _ in range(n)]for __ in range(n)]

for i in range(m):
    l, r = map(int, input().split())
    DP[l-1][r-1]+=1


#DP = [[0 for _ in range(n)]for __ in range(n)]
for i in range(n-1)[::-1]:
    for j in range(1,n):
        DP[i][j] += DP[i+1][j]+DP[i][j-1]-DP[i+1][j-1]

for i in range(qqq):
    p, q = map(int, input().split())
    print(DP[p-1][q-1])
# print(DP)

Buggy python submission (verdict: Time Limit Exceeded):
n, m, qqq = map(int, input().split())
LR1 = [[] for _ in range(n)]
LR2 = [[] for _ in range(n)]

for i in range(m):
    l, r = map(int, input().split())
    if l < n-r:
        for j in range(l):
            LR1[j].append(r)
    else:
        for j in range(r-1, n):
            LR2[j].append(l)


for i in range(qqq):
    p, q = map(int, input().split())
    ans = 0
    for j in LR1[p-1]:
        if j <= q:
            ans+=1
    for j in LR2[q-1]:
        if j >= p:
            ans+=1
    print(ans)
# print(LR1, LR2)

Fixed submission:
n, m, qqq = map(int, input().split())
DP = [[0 for _ in range(n)]for __ in range(n)]

for i in range(m):
    l, r = map(int, input().split())
    DP[l-1][r-1]+=1


#DP = [[0 for _ in range(n)]for __ in range(n)]
for i in range(n-1)[::-1]:
    for j in range(1,n):
        DP[i][j] += DP[i+1][j]+DP[i][j-1]-DP[i+1][j-1]

for i in range(qqq):
    p, q = map(int, input().split())
    print(DP[p-1][q-1])
# print(DP)

Buggy python submission (verdict: Time Limit Exceeded):
n, m, qqq = map(int, input().split())
LR = [[0 for _ in range(n)]for __ in range(n)]

for i in range(m):
    l, r = map(int, input().split())
    for j in range(l):
        for k in range(r-1, n):
            LR[j][k]+=1


for i in range(qqq):
    p, q = map(int, input().split())
    ans = 0
    print(LR[p-1][q-1])
# print(LR)

Fixed submission:
n, m, qqq = map(int, input().split())
DP = [[0 for _ in range(n)]for __ in range(n)]

for i in range(m):
    l, r = map(int, input().split())
    DP[l-1][r-1]+=1


#DP = [[0 for _ in range(n)]for __ in range(n)]
for i in range(n-1)[::-1]:
    for j in range(1,n):
        DP[i][j] += DP[i+1][j]+DP[i][j-1]-DP[i+1][j-1]

for i in range(qqq):
    p, q = map(int, input().split())
    print(DP[p-1][q-1])
# print(DP)

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

for i in range(m):
    l, r = map(int, input().split())
    for j in range(l):
        LR[j].append(r)


for i in range(qqq):
    p, q = map(int, input().split())
    ans = 0
    for j in LR[p-1]:
        if j <= q:
            ans+=1
    print(ans)


Fixed submission:
n, m, qqq = map(int, input().split())
DP = [[0 for _ in range(n)]for __ in range(n)]

for i in range(m):
    l, r = map(int, input().split())
    DP[l-1][r-1]+=1


#DP = [[0 for _ in range(n)]for __ in range(n)]
for i in range(n-1)[::-1]:
    for j in range(1,n):
        DP[i][j] += DP[i+1][j]+DP[i][j-1]-DP[i+1][j-1]

for i in range(qqq):
    p, q = map(int, input().split())
    print(DP[p-1][q-1])
# print(DP)

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

for i in range(m):
    l, r = map(int, input().split())
    for j in range(l):
        LR[j].append(r)


for i in range(qqq):
    p, q = map(int, input().split())
    ans = 0
    for j in LR[p-1]:
        if j <= q:
            ans+=1
    print(ans)


Fixed submission:
n, m, qqq = map(int, input().split())
DP = [[0 for _ in range(n)]for __ in range(n)]

for i in range(m):
    l, r = map(int, input().split())
    DP[l-1][r-1]+=1


#DP = [[0 for _ in range(n)]for __ in range(n)]
for i in range(n-1)[::-1]:
    for j in range(1,n):
        DP[i][j] += DP[i+1][j]+DP[i][j-1]-DP[i+1][j-1]

for i in range(qqq):
    p, q = map(int, input().split())
    print(DP[p-1][q-1])
# print(DP)