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

A=[]
for i in range(m):
    b,c=map(int,input().split())
    A.append([b,c])
B=[]
for i in range(q):
    b,c=map(int,input().split())
    B.append([b,c,i])

C=[[0 for i in range(n+3)] for j in range(n+3)]
#print(C)
for i in range(m):
    C[A[i][0]][A[i][1]]+=1


A.sort(key=lambda x:x[1])
A.sort(key=lambda x:x[0])

B.sort(key=lambda x:x[1])
B.sort(key=lambda x:x[0])

D=[]

E=[[[0 for i in range(n+3)] for j in range(n+3)] for k in range(n+3)]
for l in range(n+2):
    for mrp1 in range(l,n+2):
        for rp1 in range(mrp1,n+2):

            for j in range(mrp1,rp1):
                for k in range(l,rp1):
                    E[l][mrp1][rp1]+=C[k][j]

co=0
ml=0
mr=0
for i in range(q):
    l=B[i][0]
    r=B[i][1]
    nu=B[i][2]
    if ml<l :
        co=0
        for j in range(l,r+1):
            for k in range(j,r+1):
                co+=C[j][k]
        D.append([co,nu])
    else:
        #for j in range(mr+1,r+1):
        #    for k in range(l,r+1):
        #        co+=C[k][j]
        co+=E[l][mr+1][r+1]
        D.append([co,nu])
    ml=l
    mr=r

D.sort(key=lambda x:x[1])
for i in range(q):
    print(D[i][0])


Fixed submission:
import numpy

n,m,q=map(int,input().split())
M=[]
Q=[]
for i in range(m):
    M.append(list(map(int,input().split())))
for i in range(q):
    Q.append(list(map(int,input().split())))

#print(M)
#print(Q)

A=[[0 for i in range(n+1)] for j in range(n+1)]

for i in range(m):
    A[M[i][0]][M[i][1]]+=1

B=[[0 for i in range(n+1)] for j in range(n+1)] #Aの累積和のリスト

#B[0][0]=A[0][0]
#for i in range(1,n+1):
#    B[i][0]=A[i][0]+B[i-1][0]
#    B[0][i]=A[0][i]+B[0][i-1]

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

#print(A)
#print(B)

B = numpy.cumsum(A,axis=0)
C = numpy.cumsum(B,axis=1)

#print(C)

for i in range(q):
    le=Q[i][0]
    ri=Q[i][1]
    print(C[ri][ri]-C[ri][le-1]-C[le-1][ri]+C[le-1][le-1])

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

A=[]
for i in range(m):
    b,c=map(int,input().split())
    A.append([b,c])
B=[]
for i in range(q):
    b,c=map(int,input().split())
    B.append([b,c,i])

C=[[0 for i in range(n+3)] for j in range(n+3)]
#print(C)
for i in range(m):
    C[A[i][0]][A[i][1]]+=1


A.sort(key=lambda x:x[1])
A.sort(key=lambda x:x[0])

B.sort(key=lambda x:x[1])
B.sort(key=lambda x:x[0])

D=[]

co=0
ml=0
mr=0
for i in range(q):
    l=B[i][0]
    r=B[i][1]
    nu=B[i][2]
    if ml<l :
        co=0
        for j in range(l,r+1):
            for k in range(j,r+1):
                co+=C[j][k]
        D.append([co,nu])
    else:
        for j in range(mr+1,r+1):
            for k in range(l,r+1):
                co+=C[k][j]
        D.append([co,nu])
    ml=l
    mr=r

D.sort(key=lambda x:x[1])
for i in range(q):
    print(D[i][0])


Fixed submission:
import numpy

n,m,q=map(int,input().split())
M=[]
Q=[]
for i in range(m):
    M.append(list(map(int,input().split())))
for i in range(q):
    Q.append(list(map(int,input().split())))

#print(M)
#print(Q)

A=[[0 for i in range(n+1)] for j in range(n+1)]

for i in range(m):
    A[M[i][0]][M[i][1]]+=1

B=[[0 for i in range(n+1)] for j in range(n+1)] #Aの累積和のリスト

#B[0][0]=A[0][0]
#for i in range(1,n+1):
#    B[i][0]=A[i][0]+B[i-1][0]
#    B[0][i]=A[0][i]+B[0][i-1]

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

#print(A)
#print(B)

B = numpy.cumsum(A,axis=0)
C = numpy.cumsum(B,axis=1)

#print(C)

for i in range(q):
    le=Q[i][0]
    ri=Q[i][1]
    print(C[ri][ri]-C[ri][le-1]-C[le-1][ri]+C[le-1][le-1])