Buggy python submission (verdict: Time Limit Exceeded):
n, m, q = map(int, input().split())
Arr = []
for i in range(n+1):
  Arr.append([0] * (n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

for i in range(q):
  left, right = map(int, input().split())
  train_num = 0
  for j in range(left, right+1):
    for k in range(left, right+1):
      train_num += Arr[j][k]
  print(train_num)

Fixed submission:
n, m, q = map(int, input().split())
Arr = []
for i in range(n+1):
  Arr.append([0] * (n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

B = []
for i in range(n+1):
  B_line = [0]
  for j in range(1, n+1):
    B_line.append(B_line[-1] + Arr[i][j])
  B.append(B_line)
#print(B)
  
for x in range(q):
  left, right = map(int, input().split())
  train_num = 0
  for i in range(left, right+1):
    train_num += B[i][right] - B[i][left-1]
  print(train_num)

Buggy python submission (verdict: Time Limit Exceeded):
n, m, q = map(int, input().split())
import numpy as np
Arr = np.zeros((n+1)**2, dtype=np.int).reshape((n+1, n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

for i in range(q):
  left, right = map(int, input().split())
  train_num = np.sum(Arr[left:right+1, left:right+1], axis=None, dtype=np.int)
  print(train_num)


Fixed submission:
n, m, q = map(int, input().split())
Arr = []
for i in range(n+1):
  Arr.append([0] * (n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

B = []
for i in range(n+1):
  B_line = [0]
  for j in range(1, n+1):
    B_line.append(B_line[-1] + Arr[i][j])
  B.append(B_line)
#print(B)
  
for x in range(q):
  left, right = map(int, input().split())
  train_num = 0
  for i in range(left, right+1):
    train_num += B[i][right] - B[i][left-1]
  print(train_num)

Buggy python submission (verdict: Time Limit Exceeded):
n, m, q = map(int, input().split())
import numpy as np
Arr = np.zeros((n+1)**2, dtype=np.int).reshape((n+1, n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

A = np.array(Arr)
for i in range(q):
  left, right = map(int, input().split())
  train_num = np.sum(A[left:right+1, left:right+1], axis=None, dtype=np.int)
  print(train_num)

Fixed submission:
n, m, q = map(int, input().split())
Arr = []
for i in range(n+1):
  Arr.append([0] * (n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

B = []
for i in range(n+1):
  B_line = [0]
  for j in range(1, n+1):
    B_line.append(B_line[-1] + Arr[i][j])
  B.append(B_line)
#print(B)
  
for x in range(q):
  left, right = map(int, input().split())
  train_num = 0
  for i in range(left, right+1):
    train_num += B[i][right] - B[i][left-1]
  print(train_num)

Buggy python submission (verdict: Time Limit Exceeded):
n, m, q = map(int, input().split())
import numpy as np
Arr = np.zeros((n+1)**2, dtype=np.int).reshape((n+1, n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

A = np.array(Arr)
for i in range(q):
  left, right = map(int, input().split())
  train_num = np.sum(A[left:right+1, left:right+1], axis=None, dtype=np.int)
  print(train_num)

Fixed submission:
n, m, q = map(int, input().split())
Arr = []
for i in range(n+1):
  Arr.append([0] * (n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

B = []
for i in range(n+1):
  B_line = [0]
  for j in range(1, n+1):
    B_line.append(B_line[-1] + Arr[i][j])
  B.append(B_line)
#print(B)
  
for x in range(q):
  left, right = map(int, input().split())
  train_num = 0
  for i in range(left, right+1):
    train_num += B[i][right] - B[i][left-1]
  print(train_num)

Buggy python submission (verdict: Runtime Error):
n, m, q = map(int, input().split())
import numpy as np
Arr = np.zeros((n+1)**2, dtype=np.int).reshape((n+1, n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

A = np.array(Arr)
for i in range(q):
  left, right = map(int, input().split())
  train_num = np.sum(A[left:right+1, left:right+1], axis=None, dtype=np.int)
  print(train_num)

Fixed submission:
n, m, q = map(int, input().split())
Arr = []
for i in range(n+1):
  Arr.append([0] * (n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

B = []
for i in range(n+1):
  B_line = [0]
  for j in range(1, n+1):
    B_line.append(B_line[-1] + Arr[i][j])
  B.append(B_line)
#print(B)
  
for x in range(q):
  left, right = map(int, input().split())
  train_num = 0
  for i in range(left, right+1):
    train_num += B[i][right] - B[i][left-1]
  print(train_num)

Buggy python submission (verdict: Runtime Error):
n, m, q = map(int, input().split())
import numpy as np
Arr = np.zeros((n+1)**2, dtype=np.int).reshape((n+1, n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

A = np.array(Arr)
for i in range(q):
  left, right = map(int, input().split())
  train_num = np.sum(A[left:right+1, left:right+1], axis=None, dtype=np.int)
  print(train_num)

Fixed submission:
n, m, q = map(int, input().split())
Arr = []
for i in range(n+1):
  Arr.append([0] * (n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

B = []
for i in range(n+1):
  B_line = [0]
  for j in range(1, n+1):
    B_line.append(B_line[-1] + Arr[i][j])
  B.append(B_line)
#print(B)
  
for x in range(q):
  left, right = map(int, input().split())
  train_num = 0
  for i in range(left, right+1):
    train_num += B[i][right] - B[i][left-1]
  print(train_num)

Buggy python submission (verdict: Runtime Error):
n, m, q = map(int, input().split())
import numpy as np
Arr = np.zeros((n+1)**2, dtype=np.int).reshape((n+1, n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

A = np.array(Arr)
for i in range(q):
  left, right = map(int, input().split())
  train_num = np.sum(A[left:right+1, left:right+1], axis=None, dtype=np.int)
  print(train_num)

Fixed submission:
n, m, q = map(int, input().split())
Arr = []
for i in range(n+1):
  Arr.append([0] * (n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

B = []
for i in range(n+1):
  B_line = [0]
  for j in range(1, n+1):
    B_line.append(B_line[-1] + Arr[i][j])
  B.append(B_line)
#print(B)
  
for x in range(q):
  left, right = map(int, input().split())
  train_num = 0
  for i in range(left, right+1):
    train_num += B[i][right] - B[i][left-1]
  print(train_num)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
from collections import defaultdict as dd
n, m, q = map(int, input().split())
Tr = []
L2Rs = dd(lambda: [])
for i in range(m):
  l, r = map(int, input().split())
  Tr.append([l, r])
  L2Rs[l] += [r]
Tr.sort(key=lambda x: x[0])
for i in L2Rs.keys():
  L2Rs[i] = sorted(L2Rs[i])
L = sorted(L2Rs.keys())

Sc = []
for i in range(q):
  Sc.append(list(map(int, input().split())))
#Sc.sort(key=lambda x: x[0])
#print(Sc)

for i in range(q):
  left, right = Sc[i]
  l_ok_index = bisect.bisect_left(L, left)
  counter = 0
  for j in range(l_ok_index, len(L)):
    #print(j, L2Rs[j], left, right)
    r_ok = bisect.bisect_right(L2Rs[L[j]], right)
    #print(r_ok)
    counter += r_ok
  print(counter)

Fixed submission:
n, m, q = map(int, input().split())
Arr = []
for i in range(n+1):
  Arr.append([0] * (n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

B = []
for i in range(n+1):
  B_line = [0]
  for j in range(1, n+1):
    B_line.append(B_line[-1] + Arr[i][j])
  B.append(B_line)
#print(B)
  
for x in range(q):
  left, right = map(int, input().split())
  train_num = 0
  for i in range(left, right+1):
    train_num += B[i][right] - B[i][left-1]
  print(train_num)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
from collections import defaultdict as dd
n, m, q = map(int, input().split())
Tr = []
L2Rs = dd(lambda: [])
for i in range(m):
  l, r = map(int, input().split())
  Tr.append([l, r])
  L2Rs[l] += [r]
Tr.sort(key=lambda x: x[0])
for i in L2Rs.keys():
  L2Rs[i] = sorted(L2Rs[i])
L = L2Rs.keys()
  
Sc = []
for i in range(q):
  Sc.append(list(map(int, input().split())))
#Sc.sort(key=lambda x: x[0])
#print(Sc)

for i in range(q):
  left, right = Sc[i]
  counter = 0
  for j in range(left, 500):
    #print(j, L2Rs[j], left, right)
    r_ok = bisect.bisect_right(L2Rs[j], right)
    #print(r_ok)
    counter += r_ok
  print(counter)

Fixed submission:
n, m, q = map(int, input().split())
Arr = []
for i in range(n+1):
  Arr.append([0] * (n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

B = []
for i in range(n+1):
  B_line = [0]
  for j in range(1, n+1):
    B_line.append(B_line[-1] + Arr[i][j])
  B.append(B_line)
#print(B)
  
for x in range(q):
  left, right = map(int, input().split())
  train_num = 0
  for i in range(left, right+1):
    train_num += B[i][right] - B[i][left-1]
  print(train_num)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n, m, q = map(int, input().split())
Tr = []
for i in range(m):
  Tr.append(list(map(int, input().split())))
Tr.sort(key=lambda x: x[0])
Sc = []
L = [x[0] for x in Tr]
R = [x[1] for x in Tr]
for i in range(q):
  Sc.append(list(map(int, input().split())))
#Sc.sort(key=lambda x: x[0])
#print(Sc)

for i in range(q):
  left, right = Sc[i]
  train_l_ok_id = bisect.bisect_left(L, left)
  counter = 0
  for j in range(train_l_ok_id, m):
    if R[j] <= right:
      counter += 1
  print(counter)

Fixed submission:
n, m, q = map(int, input().split())
Arr = []
for i in range(n+1):
  Arr.append([0] * (n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

B = []
for i in range(n+1):
  B_line = [0]
  for j in range(1, n+1):
    B_line.append(B_line[-1] + Arr[i][j])
  B.append(B_line)
#print(B)
  
for x in range(q):
  left, right = map(int, input().split())
  train_num = 0
  for i in range(left, right+1):
    train_num += B[i][right] - B[i][left-1]
  print(train_num)