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

def main():
    N, M, Q = map(int, input().split())

    check = np.array([[0] * (N+1) for i in range(N+1)])

    for i in range(M):
        l, r = map(int, input().split())
        check[r][l] += 1

    # print(check)
    for i in range(1, N+1):
        check[i] += check[i-1]
    for i in range(1, N+1):
        check[:,i] += check[:,i-1]
    # print(check)

    for i in range(Q):
        p, q = map(int, input().split())
        print(check[q][q] - check[q][p-1] - check[p-1][q] + check[p-1][p-1])

if __name__ == "__main__":
    main()


Fixed submission:
# import sys
import numpy as np
# input = sys.stdin.readline

def main():
    N, M, Q = map(int, input().split())

    check = np.zeros((N+1, N+1))

    for i in range(M):
        l, r = map(int, input().split())
        check[r][l] += 1

    # print(check)
    for i in range(1, N+1):
        check[i] += check[i-1]
    for i in range(1, N+1):
        check[:,i] += check[:,i-1]
    # print(check)

    for i in range(Q):
        p, q = map(int, input().split())
        print(int(check[q][q] - check[q][p-1] - check[p-1][q] + check[p-1][p-1]))

if __name__ == "__main__":
    main()

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

check = np.array([[0] * (N+1) for i in range(N+1)])

for i in range(M):
    l, r = map(int, input().split())
    check[r][l] += 1

# print(check)
for i in range(1, N+1):
    check[i] += check[i-1]
for i in range(1, N+1):
    check[:,i] += check[:,i-1]
# print(check)

for i in range(Q):
    p, q = map(int, input().split())
    print(check[q][q] - check[q][p-1] - check[p-1][q] + check[p-1][p-1])


Fixed submission:
# import sys
import numpy as np
# input = sys.stdin.readline

def main():
    N, M, Q = map(int, input().split())

    check = np.zeros((N+1, N+1))

    for i in range(M):
        l, r = map(int, input().split())
        check[r][l] += 1

    # print(check)
    for i in range(1, N+1):
        check[i] += check[i-1]
    for i in range(1, N+1):
        check[:,i] += check[:,i-1]
    # print(check)

    for i in range(Q):
        p, q = map(int, input().split())
        print(int(check[q][q] - check[q][p-1] - check[p-1][q] + check[p-1][p-1]))

if __name__ == "__main__":
    main()

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

check = np.array([[0] * (N+1) for i in range(N+1)])

for i in range(M):
    l, r = map(int, input().split())
    check[r][l] += 1

# print(check)
for i in range(1, N+1):
    check[i] += check[i-1]
# print(check)

for i in range(Q):
    p, q = map(int, input().split())
    ans = 0
    for i in range(p, q+1):
        ans += check[q][i] - check[p-1][i]
    print(ans)


Fixed submission:
# import sys
import numpy as np
# input = sys.stdin.readline

def main():
    N, M, Q = map(int, input().split())

    check = np.zeros((N+1, N+1))

    for i in range(M):
        l, r = map(int, input().split())
        check[r][l] += 1

    # print(check)
    for i in range(1, N+1):
        check[i] += check[i-1]
    for i in range(1, N+1):
        check[:,i] += check[:,i-1]
    # print(check)

    for i in range(Q):
        p, q = map(int, input().split())
        print(int(check[q][q] - check[q][p-1] - check[p-1][q] + check[p-1][p-1]))

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = map(int, input().split())
start = [list() for i in range(N+1)]

for i in range(M):
    l, r = map(int, input().split())
    start[l].append(r)

for i in range(Q):
    p, q = map(int, input().split())
    ans = 0
    for s in range(p, q+1):
        for end in start[s]:
            if end <= q:
                ans += 1
    print(ans)


Fixed submission:
# import sys
import numpy as np
# input = sys.stdin.readline

def main():
    N, M, Q = map(int, input().split())

    check = np.zeros((N+1, N+1))

    for i in range(M):
        l, r = map(int, input().split())
        check[r][l] += 1

    # print(check)
    for i in range(1, N+1):
        check[i] += check[i-1]
    for i in range(1, N+1):
        check[:,i] += check[:,i-1]
    # print(check)

    for i in range(Q):
        p, q = map(int, input().split())
        print(int(check[q][q] - check[q][p-1] - check[p-1][q] + check[p-1][p-1]))

if __name__ == "__main__":
    main()