Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,M,Q = IL()
cnt = np.zeros((N+1,N+1))

l = [IL() for i in range(M)]
for i in range(M):
    cnt[:l[i][0]+1,l[i][1]:] += 1

ans = [IL() for i in range(Q)]
for i in range(Q):
    print(int(cnt[ans[i][0]][ans[i][1]]))

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def imos():
  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[j][i]
      l[j][i] += cnt
      cnt += tmp

  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[i][j]
      l[i][j] += cnt
      cnt += tmp

N,M,Q = IL()
l = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
  a,b = IL()
  l[1][b] += 1
  if a+1 <= N:
    l[a+1][b] += -1

imos()

ans = [IL() for i in range(Q)]
for i in range(Q):
    print(l[ans[i][0]][ans[i][1]])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,M,Q = IL()
cnt = np.zeros((N+1,N+1))

for i in range(M):
    a,b = IL()
    cnt[:a+1,b:] += 1

for i in range(Q):
    c,d = IL()
    print(int(cnt[c][d]))

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def imos():
  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[j][i]
      l[j][i] += cnt
      cnt += tmp

  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[i][j]
      l[i][j] += cnt
      cnt += tmp

N,M,Q = IL()
l = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
  a,b = IL()
  l[1][b] += 1
  if a+1 <= N:
    l[a+1][b] += -1

imos()

ans = [IL() for i in range(Q)]
for i in range(Q):
    print(l[ans[i][0]][ans[i][1]])

Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,M,Q = IL()
cnt = np.zeros((N+1,N+1))

for i in range(M):
    a,b = IL()
    cnt[:a+1,b:] += 1

for i in range(Q):
    c,d = IL()
    print(int(cnt[c][d]))

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def imos():
  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[j][i]
      l[j][i] += cnt
      cnt += tmp

  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[i][j]
      l[i][j] += cnt
      cnt += tmp

N,M,Q = IL()
l = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
  a,b = IL()
  l[1][b] += 1
  if a+1 <= N:
    l[a+1][b] += -1

imos()

ans = [IL() for i in range(Q)]
for i in range(Q):
    print(l[ans[i][0]][ans[i][1]])

Buggy python submission (verdict: Time Limit Exceeded):
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def nibutan(n,list):
    left = 0
    right = len(list)
    while left+1 != right:
        middle = (left+right)//2
        if list[middle] <= n:
            left = middle
        else:
            right = middle
    return left+1

N,M,Q = IL()

l = [[] for i in range(N+1)]

for i in range(M):
    a,b = IL()
    l[a].append(b)

for i in l:
    i.sort()

for i in range(Q):
    cnt = 0
    start, end = IL()
    for j in range(start,end+1):
        if len(l[j]) == 0 or l[j][0] > end:
            continue
        elif l[j][-1] <= end:
            cnt += len(l[j])
        else:
            cnt += nibutan(end,l[j])
    print(cnt)

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def imos():
  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[j][i]
      l[j][i] += cnt
      cnt += tmp

  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[i][j]
      l[i][j] += cnt
      cnt += tmp

N,M,Q = IL()
l = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
  a,b = IL()
  l[1][b] += 1
  if a+1 <= N:
    l[a+1][b] += -1

imos()

ans = [IL() for i in range(Q)]
for i in range(Q):
    print(l[ans[i][0]][ans[i][1]])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def nibutan(n,list):
    left = 0
    right = len(list)
    while left+1 != right:
        middle = (left+right)//2
        if list[middle] <= n:
            left = middle
        else:
            right = middle
    return left+1

N,M,Q = IL()

l = [[] for i in range(N+1)]

for i in range(M):
    a,b = IL()
    l[a].append(b)

for i in l:
    i.sort()

for i in range(Q):
    cnt = 0
    start, end = IL()
    for j in range(start,end+1):
        if len(l[j]) == 0 or l[j][0] > end:
            continue
        elif l[j][-1] <= end:
            cnt += len(l[j])
        else:
            cnt += nibutan(end,l[j])
    print(cnt)

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def imos():
  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[j][i]
      l[j][i] += cnt
      cnt += tmp

  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[i][j]
      l[i][j] += cnt
      cnt += tmp

N,M,Q = IL()
l = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
  a,b = IL()
  l[1][b] += 1
  if a+1 <= N:
    l[a+1][b] += -1

imos()

ans = [IL() for i in range(Q)]
for i in range(Q):
    print(l[ans[i][0]][ans[i][1]])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def nibutan(n,list):
    left = 0
    right = len(list)
    while left+1 != right:
        middle = (left+right)//2
        if list[middle] <= n:
            left = middle
        else:
            right = middle
    return left+1

N,M,Q = IL()

l = [[] for i in range(N+1)]

for i in range(M):
    a,b = IL()
    l[a].append(b)

for i in l:
    i.sort()

Ql = [IL() for i in range(Q)]

for i in range(Q):
    cnt = 0
    start, end = Ql[i]
    for j in range(start,end+1):
        if len(l[j]) == 0:
            continue
        if l[j][0] > end:
            continue
        elif l[j][-1] <= end:
            cnt += len(l[j])
        else:
            cnt += nibutan(end,l[j])
    print(cnt)

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def imos():
  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[j][i]
      l[j][i] += cnt
      cnt += tmp

  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[i][j]
      l[i][j] += cnt
      cnt += tmp

N,M,Q = IL()
l = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
  a,b = IL()
  l[1][b] += 1
  if a+1 <= N:
    l[a+1][b] += -1

imos()

ans = [IL() for i in range(Q)]
for i in range(Q):
    print(l[ans[i][0]][ans[i][1]])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,M,Q = IL()

l = [[] for i in range(N+1)]

for i in range(M):
    a,b = IL()
    l[a].append(b)

for i in l:
    i.sort()

Ql = [IL() for i in range(Q)]

for i in range(Q):
    cnt = 0
    start, end = Ql[i]
    for j in range(start,end+1):
        for k in range(len(l[j])):
            if l[j][k] <= end:
                cnt += 1
    print(cnt)

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def imos():
  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[j][i]
      l[j][i] += cnt
      cnt += tmp

  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[i][j]
      l[i][j] += cnt
      cnt += tmp

N,M,Q = IL()
l = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
  a,b = IL()
  l[1][b] += 1
  if a+1 <= N:
    l[a+1][b] += -1

imos()

ans = [IL() for i in range(Q)]
for i in range(Q):
    print(l[ans[i][0]][ans[i][1]])