Buggy python submission (verdict: Runtime Error):
N,M,Q = map(int,input().split())
T = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(M):
  L,R = map(int, input().split())
  T[L][R] += 1
pprint(T)
for l in range(1,N+1):
  for r in range(1,N+1):
    T[l][r] += T[l-1][r]+T[l][r-1]-T[l-1][r-1]
ans = []
pprint(T)
for i in range(Q):
  p,q = map(int, input().split())
  ans.append(T[p-1][p-1]+T[q][q]-T[p-1][q]-T[q][p-1])
print('\n'.join(map(str,ans)))
quit()


Fixed submission:
N,M,Q = map(int,input().split())
T = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(M):
  L,R = map(int, input().split())
  T[L][R] += 1
for l in range(1,N+1):
  for r in range(1,N+1):
    T[l][r] += T[l-1][r]+T[l][r-1]-T[l-1][r-1]
ans = []
for i in range(Q):
  p,q = map(int, input().split())
  ans.append(T[p-1][p-1]+T[q][q]-T[p-1][q]-T[q][p-1])
print('\n'.join(map(str,ans)))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N,M,Q = map(int,input().split())
T = [[0 for _ in range(N)] for _ in range(N)]
LR = []
for i in range(M):
  L,R = map(int, input().split())
  LR.append(L*1000+R)
LRD = Counter(LR)
for key in LRD:
  L,R=key//1000,key%1000
  v = LRD[key]
  for r in range(R-1,N):
    for l in range(L):
      T[l][r] += v
ans = []
for i in range(Q):
  p,q = map(int, input().split())
  ans.append(T[p-1][q-1])
print('\n'.join(map(str,ans)))


Fixed submission:
N,M,Q = map(int,input().split())
T = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(M):
  L,R = map(int, input().split())
  T[L][R] += 1
for l in range(1,N+1):
  for r in range(1,N+1):
    T[l][r] += T[l-1][r]+T[l][r-1]-T[l-1][r-1]
ans = []
for i in range(Q):
  p,q = map(int, input().split())
  ans.append(T[p-1][p-1]+T[q][q]-T[p-1][q]-T[q][p-1])
print('\n'.join(map(str,ans)))

Buggy python submission (verdict: Time Limit Exceeded):
N,M,Q = map(int,input().split())
T = [[0 for _ in range(N)] for _ in range(N)]
for i in range(M):
  L,R = map(int, input().split())
  for r in range(R-1,N):
    T[L-1][r] += 1
ans = []
for i in range(Q):
  p,q = map(int, input().split())
  n = 0
  for l in range(p-1,q):
    n += T[l][q-1]
  ans.append(n)
print('\n'.join(map(str,ans)))


Fixed submission:
N,M,Q = map(int,input().split())
T = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(M):
  L,R = map(int, input().split())
  T[L][R] += 1
for l in range(1,N+1):
  for r in range(1,N+1):
    T[l][r] += T[l-1][r]+T[l][r-1]-T[l-1][r-1]
ans = []
for i in range(Q):
  p,q = map(int, input().split())
  ans.append(T[p-1][p-1]+T[q][q]-T[p-1][q]-T[q][p-1])
print('\n'.join(map(str,ans)))

Buggy python submission (verdict: Time Limit Exceeded):
N,M,Q = map(int,input().split())
T = [[0 for _ in range(N)] for _ in range(N)]
for i in range(M):
  L,R = map(int, input().split())
  for r in range(R-1,N):
    for l in range(L):
      T[l][r] += 1
ans = []
for i in range(Q):
  p,q = map(int, input().split())
  ans.append(T[p-1][q-1])
print('\n'.join(map(str,ans)))


Fixed submission:
N,M,Q = map(int,input().split())
T = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(M):
  L,R = map(int, input().split())
  T[L][R] += 1
for l in range(1,N+1):
  for r in range(1,N+1):
    T[l][r] += T[l-1][r]+T[l][r-1]-T[l-1][r-1]
ans = []
for i in range(Q):
  p,q = map(int, input().split())
  ans.append(T[p-1][p-1]+T[q][q]-T[p-1][q]-T[q][p-1])
print('\n'.join(map(str,ans)))