Buggy python submission (verdict: Time Limit Exceeded):
# setting
import numpy as np
from collections import deque

#------------------
# input part
n, m, q = map(int, input().split())

LR = np.array([[0 for _ in range(n)] for i in range(n)])
for i in range(m):
    l, r = map(int, input().split())
    LR[l-1][r-1] += 1

res = list()
for i in range(q):
    p,q = list(map(int, input().split()))
    res.append(np.sum(LR[p-1:q, p-1:q]))
#------------------

#------------------
# print part
for r in res:
    print(r)
#------------------

Fixed submission:
# setting
from itertools import accumulate

#------------------
n, m, q = map(int, input().split())

LR = [[0 for _ in range(n-i)] for i in range(n)]
for i in range(m):
    l, r = map(int, input().split())
    LR[l-1][r-l] += 1

for i in range(n-2, -1, -1):
    for j, acc in enumerate(accumulate(LR[i])):
        LR[i][j] = acc  + (0 if j == 0 else LR[i+1][j-1])

res = list()
for i in range(q):
    p,q = map(int, input().split())
    res.append(LR[p-1][q-p])

for r in res:
    print(r)

Buggy python submission (verdict: Time Limit Exceeded):
# setting
import numpy as np
from collections import deque

#------------------
# input part
n, m, q = map(int, input().split())

LR = np.array([[0 for _ in range(n)] for i in range(n)])
for i in range(m):
    l, r = map(int, input().split())
    LR[(l-1,r-1)] += 1

res = deque()
for i in range(q):
    p,q = list(map(int, input().split()))
    res.append(np.sum(LR[p-1:q, p-1:q]))
#------------------

#------------------
# print part
for r in res:
    print(r)
#------------------

Fixed submission:
# setting
from itertools import accumulate

#------------------
n, m, q = map(int, input().split())

LR = [[0 for _ in range(n-i)] for i in range(n)]
for i in range(m):
    l, r = map(int, input().split())
    LR[l-1][r-l] += 1

for i in range(n-2, -1, -1):
    for j, acc in enumerate(accumulate(LR[i])):
        LR[i][j] = acc  + (0 if j == 0 else LR[i+1][j-1])

res = list()
for i in range(q):
    p,q = map(int, input().split())
    res.append(LR[p-1][q-p])

for r in res:
    print(r)

Buggy python submission (verdict: Time Limit Exceeded):
# setting
from collections import deque

#------------------
# input part
n, m, q = map(int, input().split())

LR = deque()
for i in range(m):
    LR.append(list(map(int, input().split())))

pq = deque()
for i in range(q):
    pq.append(list(map(int, input().split())))
#------------------

#------------------
# proccess part
res = [sum([1 for l,r in LR if l >= p and r <= q]) for p, q in pq]
#------------------

#------------------
# print part
for r in res:
    print(r)
#------------------

Fixed submission:
# setting
from itertools import accumulate

#------------------
n, m, q = map(int, input().split())

LR = [[0 for _ in range(n-i)] for i in range(n)]
for i in range(m):
    l, r = map(int, input().split())
    LR[l-1][r-l] += 1

for i in range(n-2, -1, -1):
    for j, acc in enumerate(accumulate(LR[i])):
        LR[i][j] = acc  + (0 if j == 0 else LR[i+1][j-1])

res = list()
for i in range(q):
    p,q = map(int, input().split())
    res.append(LR[p-1][q-p])

for r in res:
    print(r)

Buggy python submission (verdict: Time Limit Exceeded):
# setting
from collections import deque

#------------------
# input part
n, m, q = map(int, input().split())

LM = deque()
for i in range(m):
    LM.append(list(map(int, input().split())))

pq = deque()
for i in range(q):
    pq.append(list(map(int, input().split())))
#------------------

#------------------
# proccess part
res = deque()
for p,q in pq:
    count = 0
    for l,m in LM:
        if l >= p and m <= q:
            count += 1
    res.append(count)
#------------------

#------------------
# print part
for r in res:
    print(r)
#------------------

Fixed submission:
# setting
from itertools import accumulate

#------------------
n, m, q = map(int, input().split())

LR = [[0 for _ in range(n-i)] for i in range(n)]
for i in range(m):
    l, r = map(int, input().split())
    LR[l-1][r-l] += 1

for i in range(n-2, -1, -1):
    for j, acc in enumerate(accumulate(LR[i])):
        LR[i][j] = acc  + (0 if j == 0 else LR[i+1][j-1])

res = list()
for i in range(q):
    p,q = map(int, input().split())
    res.append(LR[p-1][q-p])

for r in res:
    print(r)