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

import numpy as np
matrix = np.array([[0 for _ in range(N+1)] for _ in range(N+1)], dtype=np.int16)

pairs = [[0 for _ in range(N+1)] for _ in range(N+1)]
for L, R in (map(int, input().split()) for _ in range(M)):
    pairs[L][R] += 1

for i in range(1, N+1):
    for j in range(i, N+1):
        w = pairs[i][j]
        if w > 0:
            matrix[:i+1,j:] += w

for p, q in (map(int, input().split()) for _ in range(Q)):
    print(matrix[p,q])


Fixed submission:
N, M, Q = map(int, input().split())

class Cell:
    def __init__(self):
        self.value = 0
        self.L = 0
    def __repr__(self):
        return str((self.value, self.L))

pairs = [[Cell() for _ in range(N+1)] for _ in range(N+1)]
for L, R in (map(int, input().split()) for _ in range(M)):
    cell = pairs[L][R]
    cell.value += 1
    cell.L = cell.value

for i in range(N-1, 0, -1):
    for j in range(i+1, N+1):
        cell = pairs[i][j]
        cell.L += pairs[i][j-1].L
        cell.value = cell.L + pairs[i+1][j].value
for p, q in (map(int, input().split()) for _ in range(Q)):
    print(pairs[p][q].value)

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

import numpy as np
matrix = np.array([[0 for _ in range(N+1)] for _ in range(N+1)], dtype=np.int16)

for L, R in (map(int, input().split()) for _ in range(M)):
    matrix[:L+1,R:] += 1

for p, q in (map(int, input().split()) for _ in range(Q)):
    print(matrix[p,q])


Fixed submission:
N, M, Q = map(int, input().split())

class Cell:
    def __init__(self):
        self.value = 0
        self.L = 0
    def __repr__(self):
        return str((self.value, self.L))

pairs = [[Cell() for _ in range(N+1)] for _ in range(N+1)]
for L, R in (map(int, input().split()) for _ in range(M)):
    cell = pairs[L][R]
    cell.value += 1
    cell.L = cell.value

for i in range(N-1, 0, -1):
    for j in range(i+1, N+1):
        cell = pairs[i][j]
        cell.L += pairs[i][j-1].L
        cell.value = cell.L + pairs[i+1][j].value
for p, q in (map(int, input().split()) for _ in range(Q)):
    print(pairs[p][q].value)

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

import numpy as np
matrix = np.array([[0 for _ in range(N+1)] for _ in range(N+1)])

for L, R in (map(int, input().split()) for _ in range(M)):
    matrix[:L+1,R:] += 1

for p, q in (map(int, input().split()) for _ in range(Q)):
    print(matrix[p,q])


Fixed submission:
N, M, Q = map(int, input().split())

class Cell:
    def __init__(self):
        self.value = 0
        self.L = 0
    def __repr__(self):
        return str((self.value, self.L))

pairs = [[Cell() for _ in range(N+1)] for _ in range(N+1)]
for L, R in (map(int, input().split()) for _ in range(M)):
    cell = pairs[L][R]
    cell.value += 1
    cell.L = cell.value

for i in range(N-1, 0, -1):
    for j in range(i+1, N+1):
        cell = pairs[i][j]
        cell.L += pairs[i][j-1].L
        cell.value = cell.L + pairs[i+1][j].value
for p, q in (map(int, input().split()) for _ in range(Q)):
    print(pairs[p][q].value)

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

matrix = [[0 for _ in range(N+1)] for _ in range(N+1)]

for L, R in (map(int, input().split()) for _ in range(M)):
    for i in range(L, -1, -1):
        for j in range(R, N+1):
            matrix[i][j] += 1

for p, q in (map(int, input().split()) for _ in range(Q)):
    print(matrix[p][q])


Fixed submission:
N, M, Q = map(int, input().split())

class Cell:
    def __init__(self):
        self.value = 0
        self.L = 0
    def __repr__(self):
        return str((self.value, self.L))

pairs = [[Cell() for _ in range(N+1)] for _ in range(N+1)]
for L, R in (map(int, input().split()) for _ in range(M)):
    cell = pairs[L][R]
    cell.value += 1
    cell.L = cell.value

for i in range(N-1, 0, -1):
    for j in range(i+1, N+1):
        cell = pairs[i][j]
        cell.L += pairs[i][j-1].L
        cell.value = cell.L + pairs[i+1][j].value
for p, q in (map(int, input().split()) for _ in range(Q)):
    print(pairs[p][q].value)

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

matrix = [[0 for _ in range(N+1)] for _ in range(N+1)]

for L, R in (map(int, input().split()) for _ in range(M)):
    for i in range(L, -1, -1):
        for j in range(R, N+1):
            matrix[i][j] += 1

for p, q in (map(int, input().split()) for _ in range(Q)):
    print(matrix[p][q])


Fixed submission:
N, M, Q = map(int, input().split())

class Cell:
    def __init__(self):
        self.value = 0
        self.L = 0
    def __repr__(self):
        return str((self.value, self.L))

pairs = [[Cell() for _ in range(N+1)] for _ in range(N+1)]
for L, R in (map(int, input().split()) for _ in range(M)):
    cell = pairs[L][R]
    cell.value += 1
    cell.L = cell.value

for i in range(N-1, 0, -1):
    for j in range(i+1, N+1):
        cell = pairs[i][j]
        cell.L += pairs[i][j-1].L
        cell.value = cell.L + pairs[i+1][j].value
for p, q in (map(int, input().split()) for _ in range(Q)):
    print(pairs[p][q].value)