CodeEff/ECCO huggingface dataset:
# Original solution
#かいせつ

import itertools

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

lr = [[0 for i in range(n)] for j in range(n)]
for _ in range(m):
    l,r = list(map(int,input().split()))
    lr[l-1][r-1] += 1

acc_lr = []
for l in lr:
    acc_lr.append([0] + list(itertools.accumulate(l)))

for _ in range(q):
    l,r = list(map(int,input().split()))
    ans = 0
    for ls in acc_lr[l-1:r]:
        ans += ls[r] - ls[l-1]
        #print(ls,r,l-1)
    print(ans)


# Optimized solution
import itertools

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

lr = [[0 for i in range(n)] for j in range(n)]
for _ in range(m):
    l,r = list(map(int,input().split()))
    lr[l-1][r-1] += 1

acc_lr = []
for l in lr:
    acc_lr.append([0] + list(itertools.accumulate(l)))

for _ in range(q):
    l,r = list(map(int,input().split()))
    ans = 0
    for ls in acc_lr[l-1:r]:
        ans += ls[r] - ls[l-1]
    print(ans)
# Original solution
N, M, Q = list(map(int, input().split()))		# 5 7 2

A=[]
for i in range(M):
	l, r = list(map(int, input().split()))		# 5 7
	A.append( (l,r) )

#print(A)

for i in range(Q):
	p, q = list(map(int, input().split()))		# 5 7
	
	ans=0
	for a in A:
		if (p<=a[0])and(a[1]<=q): ans+=1
	else:
		print(ans)



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

A=[]	# (l,r)をそのまま保持
B=[]	# (l,r,n) lからrまでの本数nを保持, B[l][r]=n

for i in range(N+1):
	a=[0]*(N+1)
	B.append(a)

for i in range(M):
	l, r = list(map(int, input().split()))		# 5 7
	A.append( (l,r) )
	B[l][r]+=1

#print("A", A)
#print("B", B)

for iR in range(1,N+1):
	for iC in range(1,N+1):
		B[iR][iC] += B[iR][iC-1]

for iC in range(1,N+1):
	for iR in range(iC, 1, -1):
		B[iR-1][iC] += B[iR][iC]


#print("B", B)


for i in range(Q):
	p, q = list(map(int, input().split()))		# 5 7
	
	print(( B[p][q] ))
# Original solution
N, M, Q = [int(_) for _ in input().split()]
LR = [[int(_) for _ in input().split()] for _ in range(M)]
PQ = [[int(_) for _ in input().split()] for _ in range(Q)]

dp = [[0] * N for _ in range(N)]
for lr in LR:
    dp[lr[0] - 1][lr[1] - 1] += 1
for pq in PQ:
    print((sum([sum(dp[i][i:pq[1]]) for i in range(pq[0] - 1, pq[1])])))


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

cumsum = [[0] * (N+2) for _ in range(N+1)]
for lr in LR:
    cumsum[lr[0]][lr[0]] += 1
    if lr[1] < N:
        cumsum[lr[0]][lr[1]+1] -= 1
for i in range(N+1):
    for j in range(i, N):
        cumsum[i][j+1] += cumsum[i][j]
for pq in PQ:
    print((sum([cumsum[i][i]-cumsum[i][pq[1]+1]
               for i in range(pq[0], pq[1]+1)])))
# Original solution
N, M, Q = list(map(int, input().split()))

x = [[0 for j in range(N + 1)] for i in range(N + 1)]

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

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

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

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


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

x = [[0 for j in range(N + 1)] for i in range(N + 1)]

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

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

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

for _ in range(Q):
    p, q = list(map(int, input().split()))
    print((x[p][q]))
# Original solution
from bisect import bisect_left,bisect_right

N,M,Q=list(map(int,input().split()))
t=[list(map(int,input().split())) for _ in range(M)]
query=[list(map(int,input().split())) for _ in range(Q)]

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

for l,r in t:
    train[l][r]+=1

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

for p,q in query:
    tmp=0
    for l in range(p,q+1):
        tmp+=c[l][q]-c[l][p-1]
    
    print(tmp)

# Optimized solution
N,M,Q=list(map(int,input().split()))
t=[list(map(int,input().split())) for _ in range(M)]
query=[list(map(int,input().split())) for _ in range(Q)]

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

for l,r in t:
    train[l][r]+=1

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

for p,q in query:
    tmp=0
    for l in range(p,q+1):
        tmp+=c[l][q]-c[l][p-1]
    
    print(tmp)
# Original solution
N,M,Q=list(map(int,input().split()))
L,R=0,0
A=[[0]*(N+1) for i in range(N+1)]
for i in range(M):
  L,R=list(map(int,input().split()))
  A[L][R]+=1
B=[[0]*(N+1) for i in range(N+1)]
for i in range(N):
  for j in range(N):
    B[i+1][j+1]=B[i+1][j]+B[i][j+1]-B[i][j]+A[i+1][j+1]
for i in range(Q):
  L,R=list(map(int,input().split()))
  print((B[N][R]-B[L-1][R]))

# Optimized solution
N,M,Q=list(map(int,input().split()))
L,R=0,0
A=[[0]*(N+1) for i in range(N+1)]
for i in range(M):
  L,R=list(map(int,input().split()))
  A[L][R]+=1
C=[[0]*(N+1) for i in range(N+1)]
for i in range(1,N+1):
  for j in range(1,N+1):
    C[i][j]=C[i][j-1]+C[i-1][j]-C[i-1][j-1]+A[i][j]
for i in range(Q):
  L,R=list(map(int,input().split()))
  print((C[N][R]-C[L-1][R]))
# Original solution
from bisect import bisect_left


n, m, q = list(map(int, input().split()))
lrlist = [[int(x) for x in input().split()] for _ in range(m)]
pqlist = [[int(x) for x in input().split()] for _ in range(q)]

lrlist.sort(key=lambda lr: lr[1])
lrlist.sort(key=lambda lr: lr[0])
llist = [lr[0] for lr in lrlist]
rlist = [lr[1] for lr in lrlist]

pqilist = [[pqlist[i][0], pqlist[i][1], i] for i in range(q)]
pqilist.sort(key=lambda pqi: pqi[1])
pqilist.sort(key=lambda pqi: pqi[0])

cntlist = []
j = 0
for p, q, i in pqilist:
    cnt = 0
    j = bisect_left(llist, p, j)
    for r in rlist[j:]:
        if r <= q:
            cnt += 1
    cntlist.append((cnt, i))

cntlist.sort(key=lambda cnti: cnti[1])
for cnt, _ in cntlist:
    print(cnt)

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

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

sumlr = [[0 for _ in range(n+1)] for _ in range(n+1)]
for l, r in ((l, r) for l in range(1, n+1) for r in range(1, n+1)):
    sumlr[l][r] = lr[l][r] + sumlr[l-1][r] + sumlr[l][r-1] - sumlr[l-1][r-1]

for _ in range(q):
    p, q = list(map(int, input().split()))
    print((sumlr[q][q] - sumlr[p-1][q] - sumlr[q][p-1] + sumlr[p-1][p-1]))
# Original solution
import itertools
from collections import defaultdict
N,M,Q=list(map(int,input().split()))
d=defaultdict(int)
for i in range(M):
  a,b=list(map(int,input().split()))
  d[(a,b)]+=1
c={}
for x in range(0,N+1):
  for y in range(0,x):
    c[(x,y)]=0
  c[(x,x)]=d[(x,x)]
  for y in range(x+1,N+1):
    c[(x,y)]=c[(x,y-1)]+d[(x,y)]
for i in range(Q):
  x,y=list(map(int,input().split()))
  print((sum(c[(j,y)]-c[(j,x-1)] for j in range(x,y+1))))

# Optimized solution
N,M,Q=list(map(int,input().split()))
c=[[0 for i in range(N+1)] for j in range(N+1)]
for i in range(M):
  a,b=list(map(int,input().split()))
  c[a][b]+=1
for i in range(1,N):
  for j in range(1,N+1-i):
    c[j][i+j]+=c[j+1][i+j]+c[j][i+j-1]-c[j+1][i+j-1]
for i in range(Q):
  a,b=list(map(int,input().split()))
  print((c[a][b]))
# 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

ans = [[0 for _ in range(n+1)] for __ in range(n+1)]

for i in range(n):
    for j in range(n+1):
        ans[i+1][j] = ans[i][j] + train[i+1][j]

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

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

# Optimized solution
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

train = [[0 for _ in range(n)] for __ in range(n)]

for _ in range(m):
    l, r = list(map(int, input().split()))
    train[l-1][r-1] += 1

ans = [[0 for _ in range(n+1)] for __ in range(n+1)]

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

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

for __ in range(q):
    p, q = list(map(int, input().split()))
    print((ans[q][q] - ans[q][p-1] - ans[p-1][q] + ans[p-1][p-1]))
# Original solution
n, m, Q = list(map(int,input().split()))
lr = [[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()))
    lr[l][r] += 1

# 二次元累積和(indexに注意)
s = [[0 for i in range(n+1)] for j in range(n+1)]
# s[x][y]:=[0,x-1]×[0,y-1]の長方形区間の総和
for i in range(n):
    for j in range(n):
        s[i+1][j+1] = s[i+1][j] + s[i][j+1] -s[i][j] + lr[i+1][j+1]

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

# 72

# Optimized solution
import sys 
input = sys.stdin.readline

n, m, Q = list(map(int,input().split()))
lr = [[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()))
    lr[l][r] += 1

# 二次元累積和(indexに注意)
s = [[0 for i in range(n+1)] for j in range(n+1)]
# s[x][y]:=[0,x-1]×[0,y-1]の長方形区間の総和
for i in range(n):
    for j in range(n):
        s[i+1][j+1] = s[i+1][j] + s[i][j+1] -s[i][j] + lr[i+1][j+1]

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

# 72
# Original solution
from sys import stdin
from bisect import bisect_left

def getval():
    n,m,q = list(map(int,stdin.readline().split()))
    r = [list(map(int,stdin.readline().split())) for i in range(m)]
    qu = [list(map(int,stdin.readline().split())) for i in range(q)]
    return n,m,q,r,qu

def main(n,m,q,r,qu):
    #Keep all railways sorted by their right index
    rw = [[] for i in range(n)]
    for i in r:
        rw[i[1]-1].append(i[0]-1)
    for i in range(n):
        rw[i].sort()

    #For each queries, iterate from rw[p-1] to rw[q-1] and bs for p-1
    #print(rw)
    for i in qu:
        ans = 0
        key = i[0]-1
        for j in range(key,i[1]):
            temp = rw[j]
            ans += len(temp) - bisect_left(temp,key)
            #print(mybs(rw[j],key),i)
        print(ans)
    

if __name__=="__main__":
    n,m,q,r,qu = getval()
    main(n,m,q,r,qu)

# Optimized solution
from sys import stdin
from sys import stdout

def getval():
    n,m,q = list(map(int,stdin.readline().split()))
    r = [list(map(int,stdin.readline().split())) for i in range(m)]
    qu = [list(map(int,stdin.readline().split())) for i in range(q)]
    return n,m,q,r,qu

def main(n,m,q,r,qu):
    #Keep all railways sorted by their right index
    rw = [[] for i in range(n)]
    for i in r:
        rw[i[1]-1].append(i[0]-1)
    for i in range(n):
        rw[i].sort()

    def mybs(arr,key):
        lo = 0
        hi = len(arr)-1
        while lo<=hi:
            idx = (lo+hi)//2
            if arr[idx]<key:
                lo = idx + 1
            else:
                hi = idx - 1
        return lo

    #For each queries, iterate from rw[p-1] to rw[q-1] and bs for p-1
    #print(rw)
    for i in qu:
        ans = 0
        key = i[0]-1
        for j in range(key,i[1]):
            ans += len(rw[j]) - mybs(rw[j],key)
            #print(mybs(rw[j],key),i)
        ans = "".join([str(ans),'\n'])
        stdout.write(ans)
    

if __name__=="__main__":
    n,m,q,r,qu = getval()
    main(n,m,q,r,qu)
# Original solution
from sys import stdin
from sys import stdout

def getval():
    n,m,q = list(map(int,stdin.readline().split()))
    r = [list(map(int,stdin.readline().split())) for i in range(m)]
    qu = [list(map(int,stdin.readline().split())) for i in range(q)]
    return n,m,q,r,qu

def main(n,m,q,r,qu):
    #Keep all railways sorted by their right index
    rw = [[] for i in range(n)]
    for i in range(m):
        temp = r[i]
        rw[temp[1]-1].append(temp[0]-1)
    for i in range(n):
        rw[i].sort()

    def mybs(arr,key):
        lo = 0
        hi = len(arr)-1
        while lo<=hi:
            idx = (lo+hi)//2
            if arr[idx]<key:
                lo = idx + 1
            else:
                hi = idx - 1
        return lo

    #For each queries, iterate from rw[p-1] to rw[q-1] and bs for p-1
    #print(rw)
    for i in qu:
        ans = 0
        key = i[0]-1
        for j in range(key,i[1]):
            ans += len(rw[j]) - mybs(rw[j],key)
            #print(mybs(rw[j],key),i)
        ans = "".join([str(ans),'\n'])
        stdout.write(ans)
    

if __name__=="__main__":
    n,m,q,r,qu = getval()
    main(n,m,q,r,qu)

# Optimized solution
from sys import stdin
from sys import stdout

def getval():
    n,m,q = list(map(int,stdin.readline().split()))
    rw = [[] for i in range(n)]
    for i in range(m):
        l,r = list(map(int,stdin.readline().split()))
        rw[r-1].append(l-1)
    for i in range(n):
        rw[i].sort()
    qu = [list(map(int,stdin.readline().split())) for i in range(q)]
    return n,m,q,rw,qu

def main(n,m,q,rw,qu):

    def mybs(arr,key):
        lo = 0
        hi = len(arr)-1
        while lo<=hi:
            idx = (lo+hi)//2
            if arr[idx]<key:
                lo = idx + 1
            else:
                hi = idx - 1
        return lo

    #For each queries, iterate from rw[p-1] to rw[q-1] and bs for p-1
    #print(rw)
    for i in qu:
        ans = 0
        key = i[0]-1
        for j in range(key,i[1]):
            ans += len(rw[j]) - mybs(rw[j],key)
            #print(mybs(rw[j],key),i)
        ans = "".join([str(ans),'\n'])
        stdout.write(ans)
    

if __name__=="__main__":
    n,m,q,rw,qu = getval()
    main(n,m,q,rw,qu)
# Original solution
from sys import stdin
from sys import stdout

def getval():
    n,m,q = list(map(int,stdin.readline().split()))
    rw = [[] for i in range(n)]
    for i in range(m):
        l,r = list(map(int,stdin.readline().split()))
        rw[r-1].append(l-1)
    for i in range(n):
        rw[i].sort()
    return n,m,q,rw

def main(n,m,q,rw):

    def mybs(arr,key):
        lo = 0
        hi = len(arr)-1
        while lo<=hi:
            idx = (lo+hi)//2
            if arr[idx]<key:
                lo = idx + 1
            else:
                hi = idx - 1
        return lo

    #For each queries, iterate from rw[p-1] to rw[q-1] and bs for p-1
    #print(rw)
    for i in range(q):
        key,r = list(map(int,stdin.readline().split()))
        key -= 1
        ans = 0
        for j in range(key,r):
            temp = rw[j]
            ans += len(temp) - mybs(temp,key)
        ans = "".join([str(ans),'\n'])
        stdout.write(ans)
    

if __name__=="__main__":
    n,m,q,rw = getval()
    main(n,m,q,rw)

# Optimized solution
from sys import stdin
from sys import stdout

def getval():
    n,m,q = list(map(int,stdin.readline().split()))
    rw = [[] for i in range(n)]
    for i in range(m):
        l,r = list(map(int,stdin.readline().split()))
        rw[r-1].append(l-1)
    for i in range(n):
        rw[i].sort()
    return n,m,q,rw

def main(n,m,q,rw):

    def mybs(arr,key):
        lo = 0
        hi = len(arr)-1
        while lo<=hi:
            idx = (lo+hi)//2
            if arr[idx]<key:
                lo = idx + 1
            else:
                hi = idx - 1
        return lo

    #For each queries, iterate from rw[p-1] to rw[q-1] and bs for p-1
    #print(rw)
    for i in [0]*q:
        key,r = list(map(int,stdin.readline().split()))
        ans = 0
        key -= 1
        for j in range(key,r):
            ans += len(rw[j]) - mybs(rw[j],key)
        ans = "".join([str(ans),'\n'])
        stdout.write(ans)
    

if __name__=="__main__":
    n,m,q,rw = getval()
    main(n,m,q,rw)
# Original solution
n,m,q=list(map(int,input().split()))

mylist=[[0]*(n+1) for _ in range(n+1)]

for i in range(m):
    l,r=list(map(int,input().split()))
    mylist[l][r]+=1

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

memo=[[-1]*(n+1) for _ in range(n+1)]

for i in range(q):
    P,Q=list(map(int,input().split()))
    if(memo[P][Q]!=-1):
        print((memo[P][Q]))
        continue
    tmp=0
    for j in range(P,Q+1):
        tmp+=mylist[j][Q]
    memo[P][Q]=tmp
    print(tmp)

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

mylist=[[0]*(n+1) for _ in range(n+1)]

for i in range(m):
    l,r=list(map(int,input().split()))
    mylist[l][r]+=1

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

memo=[[-1]*(n+1) for _ in range(n+1)]

for i in range(q):
    P,Q=list(map(int,input().split()))
    if(memo[P][Q]!=-1):
        print((memo[P][Q]))
        continue
    tmp=0
    for j in range(Q,P-1,-1):
        tmp+=mylist[j][Q]
        memo[j][Q]=tmp
    print(tmp)
# Original solution
N, M, Q = list(map(int, input().split()))
# LR = [list(map(int, input().split())) for i in range(M)]
Ls = [set() for i in range(N)]
Rs = [set() for i in range(N)]
for i in range(M):
  L, R = list(map(int, input().split()))
  Ls[L-1].add(i)
  Rs[R-1].add(i)

for i in range(N-1):
  j = N - 1 - i
  Rs[i+1] |= Rs[i]
  Ls[j-1] |= Ls[j]

for i in range(Q):
  p, q = list(map(int, input().split()))
  print((len(Ls[p-1] & Rs[q-1])))

# Optimized solution
N, M, Q = list(map(int, input().split()))
Ls = [0] * N
Rs = [0] * N
for i in range(M):
  L, R = list(map(int, input().split()))
  Ls[L-1] |= 1 << i
  Rs[R-1] |= 1 << i

for i in range(N-1):
  j = N - 1 - i
  Rs[i+1] |= Rs[i]
  Ls[j-1] |= Ls[j]

for i in range(Q):
  p, q = list(map(int, input().split()))
  print((bin(Ls[p-1] & Rs[q-1]).count('1')))
# Original solution
N, M, Q = list(map(int, input().split()))
Ls = [0] * N
Rs = [0] * N
for i in range(M):
  L, R = list(map(int, input().split()))
  Ls[L-1] |= 1 << i
  Rs[R-1] |= 1 << i

for i in range(N-1):
  j = N - 1 - i
  Rs[i+1] |= Rs[i]
  Ls[j-1] |= Ls[j]

for i in range(Q):
  p, q = list(map(int, input().split()))
  print((bin(Ls[p-1] & Rs[q-1]).count('1')))

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

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

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

for i in range(Q):
  p, q = list(map(int, input().split()))
  print((MAP[p-1][q-1]))
# Original solution
import sys
sys.setrecursionlimit(1000000)

N,M,Q = [int(x) for x in input().split()]
lr = [[int(x) for x in input().split()]for _ in range(M)]
pq = [[int(x) for x in input().split()]for _ in range(Q)]

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

for i in lr:
    for j in range(i[0]+1):
        dp[j][i[1]]+=1

for i in range(N,0,-1):
    for j in range(i,N+1):
        if(j!=i):
            dp[i][j] += dp[i][j-1]

for i in pq:
    print((dp[i[0]][i[1]]))

# Optimized solution
import sys
sys.setrecursionlimit(1000000)

N,M,Q = [int(x) for x in input().split()]
lr = [[int(x) for x in input().split()]for _ in range(M)]
pq = [[int(x) for x in input().split()]for _ in range(Q)]

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

for i in lr:
    dp[i[0]][i[1]]+=1

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

for i in range(N,0,-1):
    for j in range(i,N+1):
        if(j!=i):
            dp[i][j] += dp[i][j-1]

for i in pq:
    print((dp[i[0]][i[1]]))
# Original solution
# あらかじめ全ての区間における答えを求めておく
# 累積和が使える。
# p,qの値に関しての2次元座標系で考えると、値が存在するマスは限られてる
#
#
n, m, q = list(map(int, input().split()))
ll = [[0, 0] for i in range(m)]
p = [[0, 0] for i in range(q)]
for i in range(m):
    ll[i][0], ll[i][1] = list(map(int, input().split()))
for i in range(q):
    p[i][0], p[i][1] = list(map(int, input().split()))
# for i in range(m):
#     print(ll[i])
# for i in range(q):
#     print(p[i])
sum = [[0 for i in range(n)] for i in range(n)]
# sum上でlをy成分＝行、rをx成分=列とする。
for j in range(m):
    y = ll[j][0]-1
    x = ll[j][1]-1
    sum[y][x] += 1
ans = [[0 for i in range(n)] for i in range(n)]
for i in range(n):
    for j in range(i, n):
        for i2 in range(i, j+1):
            for j2 in range(i, j+1):
                ans[i][j] += sum[j2][i2]

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


# Optimized solution
# あらかじめ全ての区間における答えを求めておく
# 累積和が使える。
# 2次元累積和に関しては、下記のサイトを参照。
# https://paiza.hatenablog.com/entry/2014/05/28/もし女子大生プログラマに『アルゴリズム』を図
# p,qの値に関しての2次元座標系で考えると、値が存在するマスは限られてる
#
#
n, m, q = list(map(int, input().split()))
ll = [[0, 0] for i in range(m)]
p = [[0, 0] for i in range(q)]
for i in range(m):
    ll[i][0], ll[i][1] = list(map(int, input().split()))
for i in range(q):
    p[i][0], p[i][1] = list(map(int, input().split()))
# for i in range(m):
#     print(ll[i])
# for i in range(q):
#     print(p[i])
sum = [[0 for i in range(n)] for i in range(n)]
# sum上でlをy成分＝行、rをx成分=列とする。
# 各区間の値を取り込み
for j in range(m):
    x = ll[j][0]-1
    y = ll[j][1]-1
    sum[y][x] += 1
# 2次元累積和の計算
# for j in range(n):
#     print(sum[j])
# print('-'*30)
for i in range(n):
    for j in range(1, n):
        sum[i][j] += sum[i][j-1]
for i in range(n):
    for j in range(1, n):
        sum[j][i] += sum[j-1][i]
# ans = [[0 for i in range(n)] for i in range(n)]
# for i in range(n):
#    for j in range(i, n):
#        for i2 in range(i, j+1):
#            for j2 in range(i, j+1):
#                ans[i][j] += sum[j2][i2]
# for j in range(n):
#     print(sum[j])


for i in range(q):
    x = p[i][0]-1
    y = p[i][1]-1
    if x != 0:
        print((sum[y][y] - sum[y][x-1] - sum[x-1][y]+sum[x-1][x-1]))
    else:
        print((sum[y][y]))
# Original solution
N, M, Q = list(map(int, input().split(' ')))
st_ed = {}
for i in range(M):
    l, r = list(map(int, input().split(' ')))
    st_ed[(l, r)] = st_ed.get((l, r), 0) + 1

memo_s = {}
# memo[(p, q)] = memo[(p, q-1)] + sum([st_ed.get((i, q), 0) for i in [1,2,3...p]])
def f(p, q):
    if p == q:
        return st_ed.get((p, q), 0)
    if not (p, q) in memo_s:
        temp = f(p, q - 1)
        for i in range(p, q + 1):
            temp += st_ed.get((i, q), 0)
        memo_s[(p, q)] = temp
    return memo_s[(p, q)]

memo = {}
for i in range(Q):  # 1e5
    p, q = list(map(int, input().split(' ')))
    if not (p, q) in memo:
        temp = f(p, q)
        memo[(p, q)] = temp
    print((memo[(p, q)]))



# Optimized solution
N, M, Q = list(map(int, input().split(' ')))
st_ed = {}
for i in range(M):
    l, r = list(map(int, input().split(' ')))
    st_ed[(l, r)] = st_ed.get((l, r), 0) + 1

memo_g = {}
def g(p, q):
    if p == q:
        return st_ed.get((p, q), 0)
    if not (p, q) in memo_g:
        memo_g[(p, q)] = st_ed.get((p, q), 0) + g(p + 1, q)
    return memo_g[(p, q)]

memo_f = {}
# memo[(p, q)] = memo[(p, q-1)] + sum([st_ed.get((i, q), 0) for i in [1,2,3...p]])
def f(p, q):
    if p == q:
        return st_ed.get((p, q), 0)
    if not (p, q) in memo_f:
        temp = f(p, q - 1) + g(p, q)
        memo_f[(p, q)] = temp
    return memo_f[(p, q)]

memo = {}
for i in range(Q):  # 1e5
    p, q = list(map(int, input().split(' ')))
    if not (p, q) in memo:
        temp = f(p, q)
        memo[(p, q)] = temp
    print((memo[(p, q)]))