Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
if __name__ == "__main__":
    N,M,Q = map(int,input().split())
    acc = [[0]*(N+1) for _ in range(N+1)]
    for _ in range(M):
        l,r = map(int,input().split())
        acc[l][r] += 1
    pqs = [tuple(map(int,input().split())) for _ in range(Q)]
    for i in range(N):
        for j in range(1, N+1):
            acc[i][j] += acc[i][j-1]
    for p,q in pqs:
        ans = 0
        for i in range(p,q+1):
            ans += acc[i][q]-acc[i][p-1]
        print(ans)

Fixed submission:
N,M,Q = map(int,input().split())
plane = [[0]*N for _ in range(N)]
for i in range(M):
    l,r = map(int,input().split())
    plane[l-1][r-1] += 1
acc = [[0]*(N+1) for _ in range(N)]

for i in range(N):
    for j in range(N):
        acc[i][j+1] = acc[i][j]+plane[i][j]

for i in range(Q):
    p,q = map(int,input().split())
    tmp = 0
    for j in range(p,q+1):
        tmp += acc[j-1][q]-acc[j-1][p-1]
    print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
if __name__ == "__main__":
    N,M,Q = map(int,input().split())
    acc = [[0]*(N+1) for _ in range(N+1)]
    for _ in range(M):
        l,r = map(int,input().split())
        acc[l][r] += 1
    pqs = []
    for _ in range(Q): 
        p,q = map(int,input().split())
        pqs.append((p,q))
    for i in range(N):
        for j in range(1, N+1):
            acc[i][j] += acc[i][j-1]
    for p,q in pqs:
        ans = 0
        for i in range(p,q+1):
            ans += acc[i][q]-acc[i][p-1]
        print(ans)

Fixed submission:
N,M,Q = map(int,input().split())
plane = [[0]*N for _ in range(N)]
for i in range(M):
    l,r = map(int,input().split())
    plane[l-1][r-1] += 1
acc = [[0]*(N+1) for _ in range(N)]

for i in range(N):
    for j in range(N):
        acc[i][j+1] = acc[i][j]+plane[i][j]

for i in range(Q):
    p,q = map(int,input().split())
    tmp = 0
    for j in range(p,q+1):
        tmp += acc[j-1][q]-acc[j-1][p-1]
    print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
if __name__ == "__main__":
    N,M,Q = map(int,input().split())
    acc = [[0]*(N+1) for _ in range(N+1)]
    for _ in range(M):
        l,r = map(int,input().split())
        acc[l][r] += 1
    for i in range(N):
        for j in range(1, N+1):
            acc[i][j] += acc[i][j-1]
    for _ in range(Q):
        p,q = map(int,input().split())
        ans = 0
        for i in range(p,q+1):
            ans += acc[i][q]-acc[i][p-1]
        print(ans)

Fixed submission:
N,M,Q = map(int,input().split())
plane = [[0]*N for _ in range(N)]
for i in range(M):
    l,r = map(int,input().split())
    plane[l-1][r-1] += 1
acc = [[0]*(N+1) for _ in range(N)]

for i in range(N):
    for j in range(N):
        acc[i][j+1] = acc[i][j]+plane[i][j]

for i in range(Q):
    p,q = map(int,input().split())
    tmp = 0
    for j in range(p,q+1):
        tmp += acc[j-1][q]-acc[j-1][p-1]
    print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
N,M,Q = map(int,input().split())
acc = [[0]*(N+1) for _ in range(N+1)]
for _ in range(M):
    l,r = map(int,input().split())
    acc[l][r] += 1
for i in range(N):
    for j in range(1, N+1):
        acc[i][j] += acc[i][j-1]
for _ in range(Q):
    p,q = map(int,input().split())
    ans = 0
    for i in range(p,q+1):
        ans += acc[i][q]-acc[i][p-1]
    print(ans)

Fixed submission:
N,M,Q = map(int,input().split())
plane = [[0]*N for _ in range(N)]
for i in range(M):
    l,r = map(int,input().split())
    plane[l-1][r-1] += 1
acc = [[0]*(N+1) for _ in range(N)]

for i in range(N):
    for j in range(N):
        acc[i][j+1] = acc[i][j]+plane[i][j]

for i in range(Q):
    p,q = map(int,input().split())
    tmp = 0
    for j in range(p,q+1):
        tmp += acc[j-1][q]-acc[j-1][p-1]
    print(tmp)

Buggy python submission (verdict: Time Limit Exceeded):
N,M,Q = map(int,input().split())
plane = [[0]*N for _ in range(N)]
for i in range(M):
    l,r = map(int,input().split())
    plane[l-1][r-1] += 1
acc = [[0]*(N+1) for _ in range(N)]

for i in range(N):
    for j in range(N):
        acc[i][j+1] = acc[i][j]+plane[i][j]

for i in range(Q):
    p,q = map(int,input().split())
    tmp = 0
    for j in range(p,q+1):
        tmp += acc[j-1][q]-acc[j-1][p-1]
    print(tmp)

Fixed submission:
N,M,Q = map(int,input().split())
plane = [[0]*N for _ in range(N)]
for i in range(M):
    l,r = map(int,input().split())
    plane[l-1][r-1] += 1
acc = [[0]*(N+1) for _ in range(N)]

for i in range(N):
    for j in range(N):
        acc[i][j+1] = acc[i][j]+plane[i][j]

for i in range(Q):
    p,q = map(int,input().split())
    tmp = 0
    for j in range(p,q+1):
        tmp += acc[j-1][q]-acc[j-1][p-1]
    print(tmp)