CodeEff/ECCO huggingface dataset:
# Original solution
def main():
    import sys
    input = sys.stdin.readline
    n,m,q = list(map(int,input().split()))
    l = [[0]*(n) for i in range(n)]
    for i in range(m):
        a,b = list(map(int,input().split()))
        l[a-1][b-1] += 1

    for i in range(q):
        a,b = list(map(int,input().split()))
        count = 0
        for i in range(a-1,b):
            for j in range(a-1,b):
                count += l[i][j]
        print(count)
if __name__ == "__main__":
    main()

# Optimized solution
n,m,q = list(map(int,input().split()))
l = [[0]*(n) for i in range(n)]
for i in range(m):
    a,b = list(map(int,input().split()))
    l[a-1][b-1] += 1


for i in range(n):
    for j in range(n):
        if i != 0:
            l[i][j] += l[i-1][j]
        if j != 0:
            l[i][j] += l[i][j-1]
        if i!= 0 and j != 0:
            l[i][j] -= l[i-1][j-1]
    

for i in range(q):
    a,b = list(map(int,input().split()))
    ans = l[b-1][b-1]
    if a >= 2:
        ans -= l[a-2][b-1]
    print(ans)
# Original solution
N, M, Q  = list(map(int, input().split()))
count = [[0] * N for i in range(N)]

for _ in range(M):
  L,R = list(map(int, input().split()))
  for i in range(0,L):
    for j in range(R-1,N):
      count[i][j] += 1

for _ in range(Q):
  p,q = list(map(int, input().split()))
  print((count[p-1][q-1]))


# Optimized solution
N, M, Q  = list(map(int, input().split()))
count = [[0] * (N+1) for i in range(N)]

for _ in range(M):
  L,R = list(map(int, input().split()))
  count[L-1][R] += 1

for i in range(N):
  for j in range(1,N+1):
    count[i][j] += count[i][j-1]




for _ in range(Q):
  p,q = list(map(int, input().split()))
  ans = 0

  for i in range(p-1,q):
    ans += count[i][q] - count[i][p-1]
  print(ans)
# Original solution
N,M,Q=list(map(int,input().split()))
cumsum = [[0] * (N+1) for _ in range(N+1)]
for _ in range(M):
    L,R=list(map(int,input().split()))
    cumsum[L][R] += 1
for i in range(1,N+1):
    for j in range(1,N+1):
        cumsum[i][j] += cumsum[i-1][j] + cumsum[i][j-1] - cumsum[i-1][j-1]
for _ in range(Q):
    p,q = list(map(int,input().split()))
    ans = cumsum[q][q]-cumsum[p-1][q]-cumsum[q][p-1]+cumsum[p-1][p-1]
    print(ans)

# Optimized solution
N,M,Q=list(map(int,input().split()))
table = [[0 for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M):
    L,R=list(map(int,input().split()))
    table[L][R] += 1
for i in range(1,N+1):
    for j in range(1,N+1):
        table[i][j] += table[i-1][j] + table[i][j-1] - table[i-1][j-1]
for _ in range(Q):
    p,q = list(map(int,input().split()))
    print((table[q][q] - table[q][p-1] - table[p-1][q] + table[p-1][p-1]))
# Original solution
from itertools import accumulate

N,M,Q=list(map(int,input().split()))

Station=[[0 for x in range(N+2)] for y in range(N+2)]

for i in range(M):
  s,t=list(map(int,input().split()))
  Station[1][t]+=1
  Station[s+1][t]-=1
  Station[1][N+1]+=1
  Station[s+1][N+1]-=1
  ST1 = [list(accumulate(l)) for l in zip(*Station)]
  ST2 = [list(accumulate(l)) for l in zip(*ST1)]
  
for i in range(Q):
  l,r=list(map(int,input().split()))
  print((ST2[l][r]))


# Optimized solution
from itertools import accumulate

N,M,Q=list(map(int,input().split()))

Station=[[0 for x in range(N+2)] for y in range(N+2)]

for i in range(M):
  s,t=list(map(int,input().split()))
  Station[1][t]+=1
  Station[s+1][t]-=1
  Station[1][N+1]+=1
  Station[s+1][N+1]-=1

ST1 = [list(accumulate(l)) for l in zip(*Station)]
ST2 = [list(accumulate(l)) for l in zip(*ST1)]
  
for i in range(Q):
  l,r=list(map(int,input().split()))
  print((ST2[l][r]))
# Original solution
n, m, Q = list(map(int, input().split()))

ts = [[0] * (n+1) for _ in range(n+1)]
for _ in range(m):
    l, r = tuple(map(int, input().split()))
    ts[l][r] += 1

from itertools import accumulate
tsa = [list(accumulate(t)) for t in ts]

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

# Optimized solution
n, m, Q = list(map(int, input().split()))

ts = [[0] * (n+1) for _ in range(n+1)]
for _ in range(m):
    l, r = tuple(map(int, input().split()))
    ts[l][r] += 1
# 二次元累積和
for i in range(1, n+1):
    for j in range(1, n+1):
        ts[i][j] += ts[i][j-1]

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

for _ in range(Q):
    p, q = tuple(map(int, input().split()))
    print((ts[q][q] - ts[p-1][q] - ts[q][p-1] + ts[p-1][p-1]))
# Original solution
N, M, Q = list(map(int, input().split()))

train = [[0 for _ in range(N+1)] for _ in range(N+1)]

for _ in range(M) :
    L, R = list(map(int, input().split()))
    train[L][R] += 1

que = []
for _ in range(Q) :
    p, q = list(map(int, input().split()))
    que.append((p, q))

# 累積和
S = [[0 for _ in range(N+1)] for _ in range(N+1)]  # ゼロパディング

for l in range(1, N+1) :
    for r in range(1, N+1) :
        S[l][r] = S[l-1][r] + S[l][r-1] - S[l-1][r-1] + train[l][r]

for p, q in que :
    ans = S[q][q] - S[p-1][q] - S[q][p-1] + S[p-1][p-1]
    print(ans)

# Optimized solution
N, M, Q = map(int, input().split())

LR = [[0] * (N + 1) for _ in range(N + 1)]

for _ in range(M):
    L, R = map(int, input().split())
    LR[L][R] += 1

for l in range(1, N + 1):
    for r in range(1, N + 1):
        LR[l][r] = LR[l - 1][r] + LR[l][r - 1] - LR[l - 1][r - 1] + LR[l][r]

ans = []
for _ in range(Q):
    p, q = map(int, input().split())
    cnt = LR[q][q] - LR[q][p - 1] - LR[p - 1][q] + LR[p - 1][p - 1]
    ans.append(cnt)

print(*ans, sep='\n')
# Original solution
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
ips = lambda:input().split()
import collections
import math
import itertools
import heapq as hq
n,m,q = ma()
L_rs=[[] for i in range(n)]
for i in range(m):
    l,r=ma()
    L_rs[l-1].append(r-1)
for i in range(n):
    L_rs[i].sort()
# print(L_rs)
def isok(num,val):##適宜変更
    return num<=val
def bisect(ls,val): ##valの関数isok(x,val)がTrueとなる一番右のindex を返す 全部Falseなら-1,Trueならlen(ls)-1
    ok = -1
    ng = len(ls)
    x = (ok+ng)//2
    while ng-ok>1:
        num = ls[x]
        if isok(num,val):
            ok = x
        else:
            ng = x
        x = (ok+ng)//2
    return ok ##一番右のTrueのindex  Trueの個数はok+1こ

def solve(L,R):##0idx
    ret=0
    for l in range(L,R+1):
        ret+=bisect(L_rs[l],R)+1
    return ret
ans = [[0]*n for i in range(n)]
for l in range(n):
    for r in range(n):
        ans[l][r]=solve(l,r)

for i in range(q):
    l,r=ma()
    print(ans[l-1][r-1])


# Optimized solution
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
ips = lambda:input().split()
import collections
import math
import itertools
import heapq as hq
n,m,q = ma()
L_rs=[[] for i in range(n)]
for i in range(m):
    l,r=ma()
    L_rs[l-1].append(r-1)
for i in range(n):
    L_rs[i].sort()
# print(L_rs)
def isok(num,val):##適宜変更
    return num<=val
def bisect(ls,val): ##valの関数isok(x,val)がTrueとなる一番右のindex を返す 全部Falseなら-1,Trueならlen(ls)-1
    ok = -1
    ng = len(ls)
    x = (ok+ng)//2
    while ng-ok>1:
        num = ls[x]
        if isok(num,val):
            ok = x
        else:
            ng = x
        x = (ok+ng)//2
    return ok ##一番右のTrueのindex  Trueの個数はok+1こ

ans = [[0]*(n+1) for i in range(n+1)]
for r in range(n):
    for l in range(r,-1,-1):
        ans[l][r]=ans[l+1][r] + bisect(L_rs[l],r)+1

for i in range(q):
    l,r=ma()
    print(ans[l-1][r-1])
# Original solution
N, M, Q = list(map(int, input().split()))

LR = [list(map(int, input().split())) for _ in range(M)]
PQ = [list(map(int, input().split())) for _ in range(Q)]


def rectangle_sum(n):
    table = [[0 for _ in range(n)] for _ in range(n)]

    for l, r in LR:
        table[l - 1][r - 1] += 1

    for y in range(N):
        for x in range(1, N):
            table[y][x] += table[y][x - 1]

    for y in range(1, N):
        for x in range(N):
            table[y][x] += table[y - 1][x]
    return table


t = rectangle_sum(N)
for p, q in PQ:
    if p - 2 >= 0:
        tmp = t[q - 1][q - 1] - t[q - 1][p - 2] - t[p - 2][q - 1] + t[p - 2][p - 2]
    else:
        tmp = t[q - 1][q - 1]

    print(tmp)

# Optimized solution
N, M, Q = list(map(int, input().split()))

LR = [list(map(int, input().split())) for _ in range(M)]
PQ = [list(map(int, input().split())) for _ in range(Q)]


def rectangle_sum(n):
    table = [[0 for _ in range(n + 1)] for _ in range(n + 1)]

    for l, r in LR:
        table[l][r] += 1

    for y in range(n + 1):
        for x in range(1, n + 1):
            table[y][x] += table[y][x - 1]

    for y in range(1, n + 1):
        for x in range(n + 1):
            table[y][x] += table[y - 1][x]
    return table


t = rectangle_sum(N)
for p, q in PQ:
    tmp = t[q][q] - t[q][p - 1] - t[p - 1][q] + t[p - 1][p - 1]
    print(tmp)
# Original solution
n,m,q = list(map(int,input().split()))

table = []
res = []
for i in range(n+1):
    table.append([0]*(i+1))
    res.append([0]*(i+1))
for i in range(m):
    a,b = list(map(int,input().split()))
    table[b][a] += 1

for begin in range(1,n+1):
    s = 0
    for ending in range(begin,n+1):
        for k in range(begin,ending+1):
            s += table[ending][k]
        res[ending][begin] = s
for _ in range(q):
    start,end = list(map(int,input().split()))
    print((res[end][start]))


# Optimized solution
n,m,q = list(map(int,input().split()))

table = []
for i in range(n+1):
    table.append([0]*(n+1))
for i in range(m):
    a,b = list(map(int,input().split()))
    table[b][a] += 1

#2...n
for i in range(2,n+1):

    #1...n-1
    for j in range(1,n+2-i):
        table[i+j-1][j] += table[i+j-1][j+1]+table[i+j-2][j]-table[i+j-2][j+1]

for _ in range(q):
    start,end = list(map(int,input().split()))
    print((table[end][start]))
# Original solution
N, M , Q = list(map(int, input().split()))

LR = [[0 for _ in range(N+2-i)] for i in range(N+2)]
for i in range(M):
  L, R = list(map(int, input().split()))
  LR[L][R-L+1] += 1

  
for i in range(2,N+2):
  for j in range(1,N-i+2):
    LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
    
for i in range(Q):
  p, q = list(map(int, input().split()))
  print((LR[p][q-p+1]-LR[q+1][0]))


# Optimized solution
N, M , Q = list(map(int, input().split()))

LR = [[0 for _ in range(N+2-i)] for i in range(N+2)]
for i in range(M):
  L, R = list(map(int, input().split()))
  LR[L][R-L+1] += 1

  
for i in range(2,N+2):
  for j in range(1,N-i+2):
    LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
 
A = []
for i in range(Q):
  p, q = list(map(int, input().split()))
  A.append(LR[p][q-p+1]-LR[q+1][0])

print(("\n".join(map(str,A))))
# Original solution
N, M , Q = list(map(int, input().split()))

LR = [[0 for _ in range(N+2-i)] for i in range(N+2)]
for i in range(M):
  L, R = list(map(int, input().split()))
  LR[L][R-L+1] += 1

  
for i in range(2,N+2):
  for j in range(1,N-i+2):
    LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
 
A = []
for i in range(Q):
  p, q = list(map(int, input().split()))
  A.append(LR[p][q-p+1])

print(("\n".join(map(str,A))))


# Optimized solution
import sys
sin = sys.stdin.readlines()
N, M, Q = list(map(int, sin[0].split()))

LR = [[0 for _ in range(N+2-i)] for i in range(N+2)]
for line in sin[1:M+1]:
  L, R = list(map(int, line.split()))
  LR[L][R-L+1] += 1

for i in range(2,N+2):
  for j in range(1,N-i+2):
    LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
 
A = []
for line in sin[M+1:]:
  p, q = list(map(int, line.split()))
  A.append(LR[p][q-p+1])

print(("\n".join(map(str,A))))
# Original solution
import sys
N, M, Q = list(map(int, sys.stdin.readline().split()))
 
LR = [[0 for _ in range(N+2-i)] for i in range(N+2)]
for i in range(M):
  L, R = list(map(int, sys.stdin.readline().split()))
  LR[L][R-L+1] += 1
 
for i in range(2,N+2):
  for j in range(1,N-i+2):
    LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
 
for i in range(Q):
  p, q = list(map(int, sys.stdin.readline().split()))
  sys.stdout.write("{}\n".format(LR[p][q-p+1]))

# Optimized solution
import sys
N, M, Q = list(map(int, sys.stdin.readline().split()))
 
LR = [[0 for _ in range(N+2-i)] for i in range(N+2)]
for i in range(M):
  L, R = list(map(int, sys.stdin.readline().split()))
  LR[L][R-L+1] += 1
 
for i in range(2,N+2):
  for j in range(1,N-i+2):
    LR[j][i] += LR[j][i-1] + LR[j+1][i-1] - LR[j+1][i-2]
 
for i in range(Q):
  p, q = list(map(int, sys.stdin.readline().split()))
  sys.stdout.write(str(LR[p][q-p+1])+"\n")
# Original solution
import sys
from itertools import accumulate
N, M, Q = list(map(int, sys.stdin.readline().split()))
 
LR = [[0]* (N-i) for i in range(N)]
for i in range(M):
  L, R = list(map(int, sys.stdin.readline().split()))
  LR[L-1][R-L] += 1
 
for i in range(N-2,-1,-1):
  for j, acc in enumerate(accumulate(LR[i])):
    LR[i][j] = acc + (0 if j==0 else LR[i+1][j-1])
 
for i in range(Q):
  p, q = list(map(int, sys.stdin.readline().split()))
  sys.stdout.write(str(LR[p-1][q-p])+"\n")

# Optimized solution
import sys
from itertools import accumulate
N, M, Q = list(map(int, sys.stdin.readline().split()))
 
LR = [[0 for _ in range(N-i)] for i in range(N)]
for i in range(M):
  L, R = list(map(int, sys.stdin.readline().split()))
  LR[L-1][R-L] += 1
 
for i in range(N-2,-1,-1):
  for j, acc in enumerate(accumulate(LR[i])):
    LR[i][j] = acc + (0 if j==0 else LR[i+1][j-1])
 
for i in range(Q):
  p, q = list(map(int, sys.stdin.readline().split()))
  sys.stdout.write(str(LR[p-1][q-p])+"\n")
# Original solution
import sys
from itertools import accumulate
N, M, Q = list(map(int, sys.stdin.readline().split()))

LR = [[0 for _ in range(N-i)] for i in range(N)]
for i in range(M):
  L, R = list(map(int, sys.stdin.readline().split()))
  LR[L-1][R-L] += 1

for i in range(N-2,-1,-1):
  for j, (acc, pre) in enumerate(zip(accumulate(LR[i]), [0]+LR[i+1])):
    LR[i][j] = acc + pre

for i in range(Q):
  p, q = list(map(int, sys.stdin.readline().split()))
  sys.stdout.write(str(LR[p-1][q-p])+"\n")

# Optimized solution
import sys
from itertools import accumulate
N, M, Q = list(map(int, sys.stdin.readline().split()))
 
LR = [[0 for _ in range(N-i)] for i in range(N)]
for i in range(M):
  L, R = list(map(int, sys.stdin.readline().split()))
  LR[L-1][R-L] += 1
 
for i in range(N-2,-1,-1):
  acc = accumulate(LR[i])
  next(acc)
  for j in range(1, N-i):
    LR[i][j] = next(acc) + LR[i+1][j-1]
 
for i in range(Q):
  p, q = list(map(int, sys.stdin.readline().split()))
  sys.stdout.write(str(LR[p-1][q-p])+"\n")
# Original solution
def m():
    n, M, Q = list(map(int, input().split()))
    a = [[0 for _ in range(n+1)] for _ in range(n+1)]
    for i in range(M):
        l, r = list(map(int, input().split()))
        a[l][r] += 1

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

m()

# Optimized solution
def m():
    n, M, Q = list(map(int, input().split()))
    a = [[0 for _ in range(n+1)] for _ in range(n+1)]
    b = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
    for i in range(M):
        l, r = list(map(int, input().split()))
        a[l][r] += 1

    for i in range(1, n+1):
        b[1][i] += a[1][i] + b[1][i-1]
    for i in range(2, n+1):
        b[i][1] += a[i][1] + b[i-1][1]

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

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

m()
# Original solution
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(eval(input()))
def II(): return list(map(int, input().split()))
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return list(map(list,list(zip(*read_all))))

#################

from bisect import bisect_right

N,M,Q = II()
x = []
for i in range(M):
    L,R = II()
    x.append([L-1, R-1])
p,q = Line(Q)


x.sort(key = lambda x:x[1])

y = [[float('inf')]*M for _ in range(N)]
c = [0]*N
for i in range(M):
    for j in range(x[i][0]+1):
        y[j][c[j]] = x[i][1]
        c[j] += 1

ans = 0
for i in range(Q):
    print((bisect_right(y[p[i]-1], q[i]-1)))

# Optimized solution
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(eval(input()))
def II(): return list(map(int, input().split()))
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return list(map(list,list(zip(*read_all))))

#################

N,M,Q = II()
x = []
for i in range(M):
    L,R = II()
    x.append([L-1, R-1])

p = [0]*Q
q = [0]*Q
for i in range(Q):
    p0,q0 = II()
    p[i] = p0-1
    q[i] = q0-1

a = [[0]*N for _ in range(N)]
for i in range(M):
    a[x[i][0]][x[i][1]] += 1

c = [[0]*N for _ in range(N)]
for i in range(N):
    for j in range(N):
        if j==0:
            temp = 0
        else:
            temp = c[i][j-1]
        c[i][j] = temp + a[i][j]

for i in range(Q):
    ans = 0
    for j in range(p[i],q[i]+1):
        ans += c[j][q[i]]
    print(ans)
# Original solution
n,m,q=list(map(int,input().split()))
S=[[0 for i in range(n+1)] for j in range(n+1)]
for i in range(m):
    l,r=list(map(int,input().split()))
    S[l][r]+=1

for i in range(q):
    a,b=list(map(int,input().split()))
    ans=0
    for y in range(a,b+1):
        for x in range(a,b+1):
            ans+=S[x][y]
    print(ans)


# Optimized solution
n,m,q=list(map(int,input().split()))
S=[[0 for i in range(n+1)] for j in range(n+1)]
for i in range(m):
    l,r=list(map(int,input().split()))
    S[l][r]+=1

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

for i in range(q):
    a,b=list(map(int,input().split()))
    ans=0
    for y in range(a,b+1):
        ans+=S[y][b]-S[y][a-1]
    print(ans)
# Original solution
N, M, Q = [int(_) for _ in input().split()]

nl = [[0 for i in range(N)] for j in range(N)]
for t in [input().split() for _ in range(M)]:
    i = int(t[0]) - 1
    j = int(t[1]) - 1
    nl[i][j] += 1

l = [[0 for i in range(N)] for j in range(N)]
for i in range(N):
    s = 0
    for j in range(N):
        l[i][j] = s + nl[i][j]
        s = l[i][j]

for k in [input().split() for _ in range(Q)]:
    p = int(k[0])
    q = int(k[1])
    ans = 0
    for i in range(p-1, q):
        if p == 1:
            d = l[i][q-1]
        else:
            d = l[i][q-1] - l[i][p-2]
        ans += d
    print(ans)

# Optimized solution
N, M, Q = [int(_) for _ in input().split()]

l = [[0 for i in range(N+1)] for j in range(N+2)]
for t in [input().split() for _ in range(M)]:
    i = int(t[0])
    j = int(t[1])
    l[i][j] += 1

for k in range(N):
    for i in range(1, N-k+1):
        j = i + k
        l[i][j] += l[i][j-1] + l[i+1][j] - l[i+1][j-1]

for k in [input().split() for _ in range(Q)]:
    p = int(k[0])
    q = int(k[1])
    print((l[p][q]))
# Original solution
N,M,Q = list(map(int,input().split()))
LR = []
num = [[0 for i in range(N)] for j in range(N)]
for i in range(M):
    l,r = list(map(int,input().split()))
    l -= 1
    r -= 1
    num[l][r] += 1
    LR.append([l,r])
LR.sort()
pq = []
for i in range(Q):
    p,q=list(map(int,input().split()))
    p -= 1
    q -= 1
    ans = 0
    for i in range(N-1,p-1,-1):
        ans += sum(num[i][:q+1])
    print(ans)
    


# Optimized solution
N,M,Q = list(map(int,input().split()))
num = [[0 for i in range(N)] for j in range(N)]
for i in range(M):
    l,r = list(map(int,input().split()))
    l -= 1
    r -= 1
    num[l][r] += 1
for i in range(N):
    for j in range(N-1):
        num[i][j+1] += num[i][j]
for i in range(N-1,0,-1):
    for j in range(N):
        num[i-1][j] += num[i][j]
for i in range(Q):
    p,q = list(map(int,input().split()))
    print((num[p-1][q-1]))
# Original solution
N,M,Q = list(map(int,input().split()))
num = [[0 for i in range(N)] for j in range(N)]
for i in range(M):
    l,r = list(map(int,input().split()))
    l -= 1
    r -= 1
    num[l][r] += 1
for i in range(N):
    for j in range(N-1):
        num[i][j+1] += num[i][j]
for i in range(N-1,0,-1):
    for j in range(N):
        num[i-1][j] += num[i][j]
for i in range(Q):
    p,q = list(map(int,input().split()))
    print((num[p-1][q-1]))


# Optimized solution
N,M,Q = list(map(int,input().split()))
num = [[0 for i in range(N)] for j in range(N)]
for i in range(M):
    l,r = list(map(int,input().split()))
    l -= 1
    r -= 1
    num[l][r] += 1

for i in range(N-1,0,-1):
    for j in range(N):
        num[i-1][j] += num[i][j]
for i in range(N):
    for j in range(N-1):
        num[i][j+1] += num[i][j]
for i in range(Q):
    p,q = list(map(int,input().split()))
    print((num[p-1][q-1]))
# Original solution
N,M,Q = list(map(int,input().split()))
num = [[0 for i in range(N)] for j in range(N)]
lr = [list(map(int,input().split())) for i in range(M)]
for l,r in lr:
    num[l-1][r-1] += 1

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

# Optimized solution
N,M,Q = list(map(int,input().split()))
num = [[0 for i in range(N)] for j in range(N)]
lr = [list(map(int,input().split())) for i in range(M)]
for l,r in lr:
    num[l-1][r-1] += 1

for j in range(N):
    for i in range(N-1,0,-1):
        num[i-1][j] += num[i][j]
for i in range(N):
    for j in range(N-1):
        num[i][j+1] += num[i][j]
pq = [list(map(int,input().split())) for i in range(Q)]
for p,q in pq:
    print((num[p-1][q-1]))
# Original solution
N,M,Q = map(int,input().split())
num = [[0 for i in range(N)] for j in range(N)]
lr = [list(map(int,input().split())) for i in range(M)]
for l,r in lr:
    num[l-1][r-1] += 1

for j in range(N):
    for i in range(N-1,0,-1):
        num[i-1][j] += num[i][j]
for i in range(N):
    for j in range(N-1):
        num[i][j+1] += num[i][j]
pq = [list(map(int,input().split())) for i in range(Q)]
ans = []
for p,q in pq:
    ans.append(num[p-1][q-1])
print(*ans,sep='\n')


# Optimized solution
import sys
def input(): return sys.stdin.readline().strip()
N,M,Q = map(int,input().split())
num = [[0 for i in range(N)] for j in range(N)]
lr = [list(map(int,input().split())) for i in range(M)]
for l,r in lr:
    num[l-1][r-1] += 1

for j in range(N):
    for i in range(N-1,0,-1):
        num[i-1][j] += num[i][j]
for i in range(N):
    for j in range(N-1):
        num[i][j+1] += num[i][j]
pq = [list(map(int,input().split())) for i in range(Q)]
ans = []
for p,q in pq:
    ans.append(num[p-1][q-1])
print(*ans,sep='\n')
# Original solution
N,M,Q = list(map(int,input().split()))
A = [[0 for i in range(N+1)] for j in range(N+1)]
Acum = [[0 for i in range(N+1)] for j in range(N+1)]

for _ in range(M):
    L,R = list(map(int,input().split()))
    A[L-1][R-1] += 1

#2次元累積和
for i in range(N):
    for j in range(N):
        Acum[i+1][j+1] = Acum[i][j+1] + Acum[i+1][j] - Acum[i][j] + A[i][j]

# print(Acum)
for _ in range(Q):
    p,q= list(map(int,input().split()))
    A = Acum[q][q]-Acum[p-1][q]-Acum[q][p-1]+Acum[p-1][p-1]
    print(A)


# Optimized solution
"""
22:40:00

"""
N, M, Q = list(map(int, input().split()))

fields = [[0] * (N+1) for i in range(N+1)]
accs = [[0] * (N+1) for i in range(N+1)]

for i in range(M):
    L,R = list(map(int, input().split()))
    fields[L][R] += 1

for i in range(1,N+1):
    for j in range(1,N+1):
        accs[i][j] = fields[i][j] + accs[i-1][j] + accs[i][j-1] - accs[i-1][j-1]
# print(accs)
ans = []
for i in range(Q):
    p,q = list(map(int, input().split()))
    ans.append(accs[q][q] - accs[p-1][q])
    print((accs[q][q] - accs[p-1][q]))
# print(*ans)