Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

def solve(N, M, Q, L, R, p, q):
    A = np.zeros((N+2, N+2), dtype=int)
    S = np.zeros((N+2, N+2), dtype=int)
    for i in range(M):
        A[L[i], R[i]] += 1
    S[0,0] = A[0,0]
    for i in range(1, N+1):
        S[i,:] = S[i-1,:] + A[i,:]
    res = []
    D = {}
    for i in range(Q):
        x1, x2 = p[i], q[i]
        if not (x1, x2) in D:
            a = sum(S[p[i]-1,p[i]:q[i]+1])
            b = sum(S[q[i],  p[i]:q[i]+1])
            D[x1, x2] = b - a
        res.append(D[x1, x2])
    return "\n".join(map(str, res))

N, M, Q = map(int, input().split())
L, R = [0]*M, [0]*M
for i in range(M):
    L[i], R[i] = map(int, input().split())
p, q = [0]*Q, [0]*Q
for i in range(Q):
    p[i], q[i] = map(int, input().split())
print(solve(N, M, Q, L, R, p, q))

Fixed submission:
import numpy as np

def solve(N, M, Q, L, R, p, q):
    A = np.zeros((N+1, N+1), dtype=int)
    for i in range(M):
        A[L[i], R[i]] += 1
    S = np.zeros((N+1, N+1), dtype=int)
    S[0,0] = A[0,0]
    for i in range(1, N+1):
        S[i,:] = S[i-1,:] + A[i,:]
    for j in range(1, N+1):
        S[:,j] += S[:,j-1]
    res = []
    for i in range(Q):
        x1, x2 = p[i]-1, q[i]
        a = S[x2,x2]
        b = S[x1,x2]
        c = S[x2,x1]
        d = S[x1,x1]
        res.append(a - b - c + d)
    return "\n".join(map(str, res))

N, M, Q = map(int, input().split())
L, R = [0]*M, [0]*M
for i in range(M):
    L[i], R[i] = map(int, input().split())
p, q = [0]*Q, [0]*Q
for i in range(Q):
    p[i], q[i] = map(int, input().split())
print(solve(N, M, Q, L, R, p, q))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

def solve(N, M, Q, L, R, p, q):
    A = np.zeros((N+2, N+2), dtype=int)
    S = np.zeros((N+2, N+2), dtype=int)
    for i in range(M):
        A[L[i], R[i]] += 1
    S[0,0] = A[0,0]
    for i in range(1, N+1):
        for j in range(1, N+1):
            S[i,:] = S[i-1,:] + A[i,:]
    res = []
    D = {}
    for i in range(Q):
        x1, x2 = p[i], q[i]
        if not (x1, x2) in D:
            a = sum(S[p[i]-1,p[i]:q[i]+1])
            b = sum(S[q[i],p[i]:q[i]+1])
            D[x1, x2] = b - a
        res.append(D[x1, x2])
    return "\n".join(map(str, res))

N, M, Q = map(int, input().split())
L, R = [0]*M, [0]*M
for i in range(M):
    L[i], R[i] = map(int, input().split())
p, q = [0]*Q, [0]*Q
for i in range(Q):
    p[i], q[i] = map(int, input().split())
print(solve(N, M, Q, L, R, p, q))

Fixed submission:
import numpy as np

def solve(N, M, Q, L, R, p, q):
    A = np.zeros((N+1, N+1), dtype=int)
    for i in range(M):
        A[L[i], R[i]] += 1
    S = np.zeros((N+1, N+1), dtype=int)
    S[0,0] = A[0,0]
    for i in range(1, N+1):
        S[i,:] = S[i-1,:] + A[i,:]
    for j in range(1, N+1):
        S[:,j] += S[:,j-1]
    res = []
    for i in range(Q):
        x1, x2 = p[i]-1, q[i]
        a = S[x2,x2]
        b = S[x1,x2]
        c = S[x2,x1]
        d = S[x1,x1]
        res.append(a - b - c + d)
    return "\n".join(map(str, res))

N, M, Q = map(int, input().split())
L, R = [0]*M, [0]*M
for i in range(M):
    L[i], R[i] = map(int, input().split())
p, q = [0]*Q, [0]*Q
for i in range(Q):
    p[i], q[i] = map(int, input().split())
print(solve(N, M, Q, L, R, p, q))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

def solve(N, M, Q, L, R, p, q):
    A = np.zeros((N+2, N+2), dtype=int)
    S = np.zeros((N+2, N+2), dtype=int)
    for i in range(M):
        A[L[i], R[i]] += 1
    S[0,0] = A[0,0]
    for i in range(1, N+1):
        for j in range(1, N+1):
            S[i,:] = S[i-1,:] + A[i,:]
    res = []
    for i in range(Q):
        a = sum(S[p[i]-1,p[i]:q[i]+1])
        b = sum(S[q[i],p[i]:q[i]+1])
        c = b - a
        res.append(c)
    return "\n".join(map(str, res))

N, M, Q = map(int, input().split())
L, R = [0]*M, [0]*M
for i in range(M):
    L[i], R[i] = map(int, input().split())
p, q = [0]*Q, [0]*Q
for i in range(Q):
    p[i], q[i] = map(int, input().split())
print(solve(N, M, Q, L, R, p, q))

Fixed submission:
import numpy as np

def solve(N, M, Q, L, R, p, q):
    A = np.zeros((N+1, N+1), dtype=int)
    for i in range(M):
        A[L[i], R[i]] += 1
    S = np.zeros((N+1, N+1), dtype=int)
    S[0,0] = A[0,0]
    for i in range(1, N+1):
        S[i,:] = S[i-1,:] + A[i,:]
    for j in range(1, N+1):
        S[:,j] += S[:,j-1]
    res = []
    for i in range(Q):
        x1, x2 = p[i]-1, q[i]
        a = S[x2,x2]
        b = S[x1,x2]
        c = S[x2,x1]
        d = S[x1,x1]
        res.append(a - b - c + d)
    return "\n".join(map(str, res))

N, M, Q = map(int, input().split())
L, R = [0]*M, [0]*M
for i in range(M):
    L[i], R[i] = map(int, input().split())
p, q = [0]*Q, [0]*Q
for i in range(Q):
    p[i], q[i] = map(int, input().split())
print(solve(N, M, Q, L, R, p, q))