Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, M, Q = map(int, input().split())
X = np.zeros((N, N), dtype=int)
ends = np.zeros((M, 2), dtype=int)
queries = np.zeros((Q, 2), dtype=int)
for i in range(M):
    ends[i] = [int(item) for item in input().split()]
for i in range(Q):
    queries[i] = [int(item) for item in input().split()]
np.add.at(X, [ends[:,0] - 1, ends[:, 1] - 1], 1)
for items in queries:
    print(np.sum(X[items[0] - 1:items[1], items[0] - 1:items[1]]))


Fixed submission:
import numpy as np
N, M, Q = map(int, input().split())
X = np.zeros((N, N), dtype=int)
ends = np.zeros((M, 2), dtype=int)
queries = np.zeros((Q, 2), dtype=int)
for i in range(M):
    ends[i] = [int(item) for item in input().split()]
for i in range(Q):
    queries[i] = [int(item) for item in input().split()]
np.add.at(X, [ends[:,0] - 1, ends[:, 1] - 1], 1)
B = np.cumsum(X[::-1,:], axis = 0)[::-1,:]
C = np.cumsum(B, axis = 1)
for item in queries:
    print(C[item[0] - 1, item[1] - 1])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, M, Q = list(map(int, input().split()))
p_q = np.zeros([Q, 2], dtype = int)
MAP = np.zeros([500, 500], dtype = int)

for _ in range(M):
    L, R = list(map(int, input().split()))
    MAP[L - 1][R - 1] += 1
for i in range(Q):
    p, q = list(map(int, input().split()))
    p_q[i][0] = p
    p_q[i][1] = q

for i in p_q:
    print(np.sum(MAP[i[0] - 1:i[1], i[0] - 1:i[1]]))


Fixed submission:
import numpy as np
N, M, Q = map(int, input().split())
X = np.zeros((N, N), dtype=int)
ends = np.zeros((M, 2), dtype=int)
queries = np.zeros((Q, 2), dtype=int)
for i in range(M):
    ends[i] = [int(item) for item in input().split()]
for i in range(Q):
    queries[i] = [int(item) for item in input().split()]
np.add.at(X, [ends[:,0] - 1, ends[:, 1] - 1], 1)
B = np.cumsum(X[::-1,:], axis = 0)[::-1,:]
C = np.cumsum(B, axis = 1)
for item in queries:
    print(C[item[0] - 1, item[1] - 1])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, M, Q = list(map(int, input().split()))
p_q = []
MAP = np.zeros([500, 500], dtype = int)

for _ in range(M):
    L, R = list(map(int, input().split()))
    MAP[L - 1][R - 1] += 1
for _ in range(Q):
    p, q = list(map(int, input().split()))
    p_q.append((p, q))

for i in p_q:
    print(np.sum(MAP[i[0] - 1:i[1], i[0] - 1:i[1]]))


Fixed submission:
import numpy as np
N, M, Q = map(int, input().split())
X = np.zeros((N, N), dtype=int)
ends = np.zeros((M, 2), dtype=int)
queries = np.zeros((Q, 2), dtype=int)
for i in range(M):
    ends[i] = [int(item) for item in input().split()]
for i in range(Q):
    queries[i] = [int(item) for item in input().split()]
np.add.at(X, [ends[:,0] - 1, ends[:, 1] - 1], 1)
B = np.cumsum(X[::-1,:], axis = 0)[::-1,:]
C = np.cumsum(B, axis = 1)
for item in queries:
    print(C[item[0] - 1, item[1] - 1])

Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = list(map(int, input().split()))
L_R = []
p_q = []

for _ in range(M):
    L, R = list(map(int, input().split()))
    L_R.append((L, R))
for _ in range(Q):
    p, q = list(map(int, input().split()))
    p_q.append((p, q))

for i in p_q:
    count = 0
    for j in L_R:
        if(i[0] <= j[0] and j[1] <= i[1]):
            count += 1
    print(count)


Fixed submission:
import numpy as np
N, M, Q = map(int, input().split())
X = np.zeros((N, N), dtype=int)
ends = np.zeros((M, 2), dtype=int)
queries = np.zeros((Q, 2), dtype=int)
for i in range(M):
    ends[i] = [int(item) for item in input().split()]
for i in range(Q):
    queries[i] = [int(item) for item in input().split()]
np.add.at(X, [ends[:,0] - 1, ends[:, 1] - 1], 1)
B = np.cumsum(X[::-1,:], axis = 0)[::-1,:]
C = np.cumsum(B, axis = 1)
for item in queries:
    print(C[item[0] - 1, item[1] - 1])