Buggy python submission (verdict: Time Limit Exceeded):
a = input().split()
n = int(a[0])
m = int(a[1])
qq = int(a[2])
ll = list()
rr = list()

for _ in range(m):
    a = input().split()
    ll.append(int(a[0]))
    rr.append(int(a[1]))

p = list()
q = list()

for _ in range(qq):
    a = input().split()
    p.append(int(a[0]))
    q.append(int(a[1]))

c = [[0 for _ in range(n)] for _ in range(n)]

for i in range(m):
    c[ll[i] - 1][rr[i] - 1] += 1

for i in range(n):
    for j in range(1, n):
        c[i][j] += c[i][j - 1]

for i in range(qq):
    r = 0

    for j in range(p[i] - 1, q[i]):
        r += c[j][q[i] - 1]
        if 1 < p[i]:
            r -= c[j][p[i] - 2]

    print(r)


Fixed submission:
a = input().split()
n = int(a[0])
m = int(a[1])
qq = int(a[2])

x = [[0] * n for _ in range(n)]

for _ in range(m):
    a = input().split()
    x[int(a[0]) - 1][int(a[1]) - 1] += 1

c = list()

for i in range(n):
    c.append(list())
    for j in range(n):
        a = x[i][j]

        if 0 < j:
            a += c[i][j - 1]

        c[i].append(a)

z = list()

for i in range(n):
    z.append(list())
    for j in range(n):
        a = c[i][j]

        if 0 < i:
            a += z[i - 1][j]

        z[i].append(a)

for _ in range(qq):
    r = 0
    a = input().split()
    p = int(a[0])
    q = int(a[1])

    if 0 < q:
        r += z[q - 1][q - 1]

    if 0 < q and 1 < p:
        r -= z[q - 1][p - 2] + z[p - 2][q - 1]

    if 1 < p:
        r += z[p - 2][p - 2]

    print(r)

Buggy python submission (verdict: Time Limit Exceeded):
a = input().split()
n = int(a[0])
m = int(a[1])
qq = int(a[2])

x = [[0] * n for _ in range(n)]

for _ in range(m):
    a = input().split()
    x[int(a[0]) - 1][int(a[1]) - 1] += 1

c = list()

for i in range(n):
    c.append(list())
    for j in range(n):
        a = x[i][j]

        if 0 < j:
            a += c[i][j - 1]

        c[i].append(a)

for _ in range(qq):
    r = 0
    a = input().split()
    p = int(a[0])
    q = int(a[1])
    for j in range(p - 1, q):
        r += c[j][q - 1]
        if 1 < p:
            r -= c[j][p - 2]

    print(r)


Fixed submission:
a = input().split()
n = int(a[0])
m = int(a[1])
qq = int(a[2])

x = [[0] * n for _ in range(n)]

for _ in range(m):
    a = input().split()
    x[int(a[0]) - 1][int(a[1]) - 1] += 1

c = list()

for i in range(n):
    c.append(list())
    for j in range(n):
        a = x[i][j]

        if 0 < j:
            a += c[i][j - 1]

        c[i].append(a)

z = list()

for i in range(n):
    z.append(list())
    for j in range(n):
        a = c[i][j]

        if 0 < i:
            a += z[i - 1][j]

        z[i].append(a)

for _ in range(qq):
    r = 0
    a = input().split()
    p = int(a[0])
    q = int(a[1])

    if 0 < q:
        r += z[q - 1][q - 1]

    if 0 < q and 1 < p:
        r -= z[q - 1][p - 2] + z[p - 2][q - 1]

    if 1 < p:
        r += z[p - 2][p - 2]

    print(r)

Buggy python submission (verdict: Time Limit Exceeded):
a = input().split()
n = int(a[0])
m = int(a[1])
qq = int(a[2])
ll = list()
r = list()

for _ in range(m):
    a = input().split()
    ll.append(int(a[0]))
    r.append(int(a[1]))

p = list()
q = list()

for _ in range(qq):
    a = input().split()
    p.append(int(a[0]))
    q.append(int(a[1]))

x = [[0] * n for _ in range(n)]

for i in range(m):
    x[ll[i] - 1][r[i] - 1] += 1

c = list()

for i in range(n):
    c.append(list())
    for j in range(n):
        a = x[i][j]

        if 0 < j:
            a += c[i][j - 1]

        c[i].append(a)

for i in range(qq):
    r = 0

    for j in range(p[i] - 1, q[i]):
        r += c[j][q[i] - 1]
        if 1 < p[i]:
            r -= c[j][p[i] - 2]

    print(r)


Fixed submission:
a = input().split()
n = int(a[0])
m = int(a[1])
qq = int(a[2])

x = [[0] * n for _ in range(n)]

for _ in range(m):
    a = input().split()
    x[int(a[0]) - 1][int(a[1]) - 1] += 1

c = list()

for i in range(n):
    c.append(list())
    for j in range(n):
        a = x[i][j]

        if 0 < j:
            a += c[i][j - 1]

        c[i].append(a)

z = list()

for i in range(n):
    z.append(list())
    for j in range(n):
        a = c[i][j]

        if 0 < i:
            a += z[i - 1][j]

        z[i].append(a)

for _ in range(qq):
    r = 0
    a = input().split()
    p = int(a[0])
    q = int(a[1])

    if 0 < q:
        r += z[q - 1][q - 1]

    if 0 < q and 1 < p:
        r -= z[q - 1][p - 2] + z[p - 2][q - 1]

    if 1 < p:
        r += z[p - 2][p - 2]

    print(r)

Buggy python submission (verdict: Time Limit Exceeded):
a = input().split()
n = int(a[0])
m = int(a[1])
qq = int(a[2])
ll = list()
r = list()

for _ in range(m):
    a = input().split()
    ll.append(int(a[0]))
    r.append(int(a[1]))

p = list()
q = list()

for _ in range(qq):
    a = input().split()
    p.append(int(a[0]))
    q.append(int(a[1]))

x = [[0 for _ in range(n)] for _ in range(n)]

for i in range(m):
    x[ll[i] - 1][r[i] - 1] += 1

c = list()

for i in range(n):
    c.append(list())
    for j in range(n):
        a = x[i][j]

        if 0 < j:
            a += c[i][j - 1]

        c[i].append(a)

for i in range(qq):
    r = 0

    for j in range(p[i] - 1, q[i]):
        r += c[j][q[i] - 1]
        if 1 < p[i]:
            r -= c[j][p[i] - 2]

    print(r)


Fixed submission:
a = input().split()
n = int(a[0])
m = int(a[1])
qq = int(a[2])

x = [[0] * n for _ in range(n)]

for _ in range(m):
    a = input().split()
    x[int(a[0]) - 1][int(a[1]) - 1] += 1

c = list()

for i in range(n):
    c.append(list())
    for j in range(n):
        a = x[i][j]

        if 0 < j:
            a += c[i][j - 1]

        c[i].append(a)

z = list()

for i in range(n):
    z.append(list())
    for j in range(n):
        a = c[i][j]

        if 0 < i:
            a += z[i - 1][j]

        z[i].append(a)

for _ in range(qq):
    r = 0
    a = input().split()
    p = int(a[0])
    q = int(a[1])

    if 0 < q:
        r += z[q - 1][q - 1]

    if 0 < q and 1 < p:
        r -= z[q - 1][p - 2] + z[p - 2][q - 1]

    if 1 < p:
        r += z[p - 2][p - 2]

    print(r)

Buggy python submission (verdict: Time Limit Exceeded):
a = input().split()
n = int(a[0])
m = int(a[1])
qq = int(a[2])
ll = list()
r = list()

for _ in range(m):
    a = input().split()
    ll.append(int(a[0]))
    r.append(int(a[1]))

p = list()
q = list()

for _ in range(qq):
    a = input().split()
    p.append(int(a[0]))
    q.append(int(a[1]))

x = [[0 for _ in range(n)] for _ in range(n)]

for i in range(m):
    x[ll[i] - 1][r[i] - 1] += 1

c = [[0 for _ in range(n)] for _ in range(n)]

for i in range(n):
    for j in range(n):
        c[i][j] = x[i][j]
        if 0 < j:
            c[i][j] += c[i][j - 1]

for i in range(qq):
    r = 0

    for j in range(p[i] - 1, q[i]):
        r += c[j][q[i] - 1]
        if 1 < p[i]:
            r -= c[j][p[i] - 2]

    print(r)


Fixed submission:
a = input().split()
n = int(a[0])
m = int(a[1])
qq = int(a[2])

x = [[0] * n for _ in range(n)]

for _ in range(m):
    a = input().split()
    x[int(a[0]) - 1][int(a[1]) - 1] += 1

c = list()

for i in range(n):
    c.append(list())
    for j in range(n):
        a = x[i][j]

        if 0 < j:
            a += c[i][j - 1]

        c[i].append(a)

z = list()

for i in range(n):
    z.append(list())
    for j in range(n):
        a = c[i][j]

        if 0 < i:
            a += z[i - 1][j]

        z[i].append(a)

for _ in range(qq):
    r = 0
    a = input().split()
    p = int(a[0])
    q = int(a[1])

    if 0 < q:
        r += z[q - 1][q - 1]

    if 0 < q and 1 < p:
        r -= z[q - 1][p - 2] + z[p - 2][q - 1]

    if 1 < p:
        r += z[p - 2][p - 2]

    print(r)