CodeEff/ECCO huggingface dataset:
# Original solution
from itertools import accumulate
import sys
sdin = sys.stdin.readline

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

lr = []
for i in range(m):
    l,r = list(map(int, sdin().split()))
    lr.append(tuple([l-1, r-1]))
        
pq = []
for _ in range(q):
    p,q = list(map(int, sdin().split()))
    pq.append(tuple([p-1, q-1]))


# n×nフィールドを用意して各列車のl,r点をプロット
field = [[0 for _ in range(n)] for _ in range(n)]
for l, r in lr:
    field[l][r] += 1
    
# fieldのx方向の累積和を取る
field_cum = [list(accumulate(field[i])) for i in range(n)]    

# 各クエリに対し、rがpからqの間に入っているものを足し合わせる
for p,q in pq:
    ans = 0
    for i in range(p,q+1):
        ans += field_cum[i][q]
    print(ans)

# Optimized solution
from itertools import accumulate
import sys
sdin = sys.stdin.readline

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

lr = []
for i in range(m):
    l,r = list(map(int, sdin().split()))
    lr.append(tuple([l-1, r-1]))
        
pq = []
for _ in range(q):
    p,q = list(map(int, sdin().split()))
    pq.append(tuple([p-1, q-1]))

    
# n×nフィールドを用意して各列車のl,r点をプロット
field = [[0 for _ in range(n)] for _ in range(n)]
for l, r in lr:
    field[l][r] += 1
    
# fieldのx方向の累積和を取る
field_cum = [list(accumulate(field[i])) for i in range(n)]    

# field_cumのy方向の累積和をとる
for r in range(1,n):
    for l in range(n):
        field_cum[r][l] += field_cum[r-1][l]

        
# 各クエリに対し、長方形内部にあるものの個数を求める
for p,q in pq:
    if p > 0:
        print((field_cum[q][q] - field_cum[p-1][q] - field_cum[q][p-1] + field_cum[p-1][p-1]))
    else:
        print((field_cum[q][q]))
# Original solution
from itertools import accumulate
import sys
sdin = sys.stdin.readline

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

lr = []
for i in range(m):
    l,r = list(map(int, sdin().split()))
    lr.append(tuple([l-1, r-1]))
        
pq = []
for _ in range(q):
    p,q = list(map(int, sdin().split()))
    pq.append(tuple([p-1, q-1]))

    
# n×nフィールドを用意して各列車のl,r点をプロット
field = [[0 for _ in range(n)] for _ in range(n)]
for l, r in lr:
    field[l][r] += 1
    
# fieldのx方向の累積和を取る
field_cum = [list(accumulate(field[i])) for i in range(n)]    

# field_cumのy方向の累積和をとる
for r in range(1,n):
    for l in range(n):
        field_cum[r][l] += field_cum[r-1][l]

        
# 各クエリに対し、長方形内部にあるものの個数を求める
for p,q in pq:
    if p > 0:
        print((field_cum[q][q] - field_cum[p-1][q] - field_cum[q][p-1] + field_cum[p-1][p-1]))
    else:
        print((field_cum[q][q]))

# Optimized solution
from itertools import accumulate
import sys
sdin = sys.stdin.readline

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

lr = []
for i in range(m):
    l,r = list(map(int, sdin().split()))
    lr.append(tuple([l, r]))
        
pq = []
for _ in range(q):
    p,q = list(map(int, sdin().split()))
    pq.append(tuple([p, q]))
    
# n×nフィールドを用意して各列車のl,r点をプロット
field = [[0 for _ in range(n+1)] for _ in range(n+1)]
for l, r in lr:
    field[l][r] += 1
    
# fieldのx方向の累積和を取る
field_cum = [list(accumulate(field[i])) for i in range(n+1)]    

# field_cumのy方向の累積和をとる
for r in range(1,n+1):
    for l in range(n+1):
        field_cum[r][l] += field_cum[r-1][l]

        
# 各クエリに対し、長方形内部にあるものの個数を求める
for p,q in pq:
    print((field_cum[q][q] - field_cum[p-1][q] - field_cum[q][p-1] + field_cum[p-1][p-1]))
# Original solution
from itertools import accumulate
import sys
sdin = sys.stdin.readline

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

lr = []
for i in range(m):
    l,r = list(map(int, sdin().split()))
    lr.append(tuple([l, r]))
        
pq = []
for _ in range(q):
    p,q = list(map(int, sdin().split()))
    pq.append(tuple([p, q]))
    
# n×nフィールドを用意して各列車のl,r点をプロット
field = [[0 for _ in range(n+1)] for _ in range(n+1)]
for l, r in lr:
    field[l][r] += 1
    
# fieldのx方向の累積和を取る
field_cum = [list(accumulate(field[i])) for i in range(n+1)]    

# field_cumのy方向の累積和をとる
for r in range(1,n+1):
    for l in range(n+1):
        field_cum[r][l] += field_cum[r-1][l]

        
# 各クエリに対し、長方形内部にあるものの個数を求める
for p,q in pq:
    print((field_cum[q][q] - field_cum[p-1][q] - field_cum[q][p-1] + field_cum[p-1][p-1]))


# Optimized solution
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

from itertools import accumulate

n,m,q = li()
grid = [[0 for _ in range(n+1)] for _ in range(n+1)]

for _ in range(m):
    l,r = li()
    grid[l][r] += 1
    
grid_cum = [list(accumulate(grid[row])) for row in range(n+1)]
for row in range(n):
    for col in range(n+1):
        grid_cum[row+1][col] += grid_cum[row][col]
        
for _ in range(q):
    p,q = li()
    print((grid_cum[q][q] - grid_cum[p-1][q] - grid_cum[q][p-1] + grid_cum[p-1][p-1]))
# Original solution
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,m,q = li()
train = []
query = []

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

for _ in range(m):
    train.append(tuple(li()))
    
for _ in range(q):
    query.append(tuple(li()))
    
for ts, tt in train:
    field[ts][tt] += 1
    
for r in range(n+1):
    for c in range(n):
        field[r][c+1] += field[r][c]
        
for c in range(n+1):
    for r in range(n):
        field[r+1][c] += field[r][c]
        
for qs,qt in query:
    print((field[qt][qt] - field[qt][qs-1] - field[qs-1][qt] + field[qs-1][qs-1]))
    

# Optimized solution
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

def cum_2d(field:list):
    row = len(field)
    col = len(field[0])
    
    # 横方向に累積和
    for r in range(row):
        for c in range(col-1):
            field[r][c+1] += field[r][c]
    
    # 縦方向に累積和
    for c in range(col):
        for r in range(row-1):
            field[r+1][c] += field[r][c]
            
    return field
            

n,m,q = li()
train = []
query = []

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

for _ in range(m):
    train.append(tuple(li()))
    
for _ in range(q):
    query.append(tuple(li()))
    
for ts, tt in train:
    field[ts][tt] += 1
    
field = cum_2d(field)
        
for qs,qt in query:
    print((field[qt][qt] - field[qt][qs-1] - field[qs-1][qt] + field[qs-1][qs-1]))
# Original solution
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

def cum_2d(field:list):
    row = len(field)
    col = len(field[0])
    
    # 横方向に累積和
    for r in range(row):
        for c in range(col-1):
            field[r][c+1] += field[r][c]
    
    # 縦方向に累積和
    for c in range(col):
        for r in range(row-1):
            field[r+1][c] += field[r][c]
            
    return field
            

n,m,q = li()
train = []
query = []

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

for _ in range(m):
    train.append(tuple(li()))
    
for _ in range(q):
    query.append(tuple(li()))
    
for ts, tt in train:
    field[ts][tt] += 1
    
field = cum_2d(field)
        
for qs,qt in query:
    print((field[qt][qt] - field[qt][qs-1] - field[qs-1][qt] + field[qs-1][qs-1]))
    

# Optimized solution
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

def cum_2d(field:list):
    row = len(field)
    col = len(field[0])
    
    # 横方向に累積和
    for r in range(row):
        for c in range(col-1):
            field[r][c+1] += field[r][c]
    
    # 縦方向に累積和
    for c in range(col):
        for r in range(row-1):
            field[r+1][c] += field[r][c]
            
    return field

n,m,q = li()
grid = [[0 for _ in range(n+1)] for _ in range(n+1)]

for _ in range(m):
    l,r = li()
    grid[l][r] += 1
    
grid = cum_2d(grid)

for _ in range(q):
    p,q = li()
    print((grid[q][q] + grid[p-1][p-1] - grid[q][p-1] - grid[p-1][q]))
# Original solution
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

def cum_2d(field:list):
    row = len(field)
    col = len(field[0])
    
    # 横方向に累積和
    for r in range(row):
        for c in range(col-1):
            field[r][c+1] += field[r][c]
    
    # 縦方向に累積和
    for c in range(col):
        for r in range(row-1):
            field[r+1][c] += field[r][c]
            
    return field


n,m,q = li()
grid = [[0 for _ in range(n+1)] for _ in range(n+1)]

for _ in range(m):
    l,r = li()
    grid[l][r] += 1
    
grid = cum_2d(grid)


for _ in range(q):
    p,q = li()
    print((grid[q][q] - grid[q][p-1] - grid[p-1][q] + grid[p-1][p-1]))


# Optimized solution
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x) - 1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


def cum_2d(field: list):
    row = len(field)
    col = len(field[0])

    # 横方向に累積和
    for r in range(row):
        for c in range(col - 1):
            field[r][c + 1] += field[r][c]

    # 縦方向に累積和
    for c in range(col):
        for r in range(row - 1):
            field[r + 1][c] += field[r][c]

    return field

n,m,q = li()
field = [[0]*(n+1) for _ in range(n+1)]

for _ in range(m):
    l, r = li()
    field[l][r] += 1

field = cum_2d(field)

for _ in range(q):
    pi, qi = li()
    print((field[qi][qi] - field[qi][pi-1] - field[pi-1][qi] + field[pi-1][pi-1]))
# Original solution
def LI(): return list(map(int, input().split()))
def LI_(): return list([int(x) - 1 for x in input().split()])


if __name__ == "__main__":
    N, M, Q = LI()
    LR = [[0]*(N+1) for _ in range(N+1)]
    for i in range(M):
        l, r = LI()
        LR[l][r] += 1

    # 二次元累積和
    for i in range(1, N+1):
        for j in range(1, N+1):
            LR[i][j] += LR[i][j-1]
            LR[i][j] += LR[i-1][j]
            LR[i][j] -= LR[i-1][j-1]

    for _ in range(Q):
        p, q = LI()
        p -= 1
        result = LR[q][q] - LR[p][q] - LR[q][p] + LR[p][p]
        print(result)


# Optimized solution
from itertools import accumulate as acc

def LI(): return list(map(int, input().split()))
def LI_(): return list([int(x) - 1 for x in input().split()])


if __name__ == "__main__":
    N, M, Q = LI()
    LR = [[0]*N for _ in range(N)]
    for i in range(M):
        l, r = LI_()
        LR[l][r] += 1

    # 二次元累積和
    S = [[0] * N for _ in range(N)]
    for i, row in enumerate(LR):
        LR[i] = list(acc(row))
    for i, col in enumerate(zip(*LR)):
        S[i] = list(acc(reversed(col)))

    for _ in range(Q):
        p, q = LI()
        # 必ず正方形だから、
        print((S[q-1][N-p]))
# Original solution
from itertools import accumulate as acc
import sys

if __name__ == "__main__":
    s = sys.stdin.readlines()
    N, M, Q = list(map(int, s[0].split()))
    LR = [[0]*N for _ in range(N)]
    for l, r in (list(map(int, e.split())) for e in s[1:M + 1]):
        LR[l - 1][r - 1] += 1

    S = [tuple(acc(reversed(s))) for s in zip(*(acc(x) for x in LR))]
    print(('\n'.join(map(str, (S[q - 1][N - p] for p, q in (list(map(int, e.split())) for e in s[M + 1:]))))))

# Optimized solution
from itertools import accumulate as acc
import sys

if __name__ == "__main__":
    s = sys.stdin.readlines()
    N, M, Q = list(map(int, s[0].split()))
    LR = [[0]*N for _ in [0]*N]
    for l, r in (list(map(int, e.split())) for e in s[1:M + 1]):
        LR[l - 1][r - 1] += 1

    S = [tuple(acc(reversed(s))) for s in zip(*(acc(x) for x in LR))]
    print(('\n'.join(map(str, (S[q - 1][N - p] for p, q in (list(map(int, e.split())) for e in s[M + 1:]))))))
# Original solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,m,q = LI()
    lr = [LI_() for _ in range(m)]
    pq = [LI_() for _ in range(q)]
    ls = [set() for _ in range(n)]
    rs = [set() for _ in range(n)]
    for i in range(m):
        l,r = lr[i]
        ls[l].add(i)
        rs[r].add(i)
    for i in range(n-2,-1,-1):
        ls[i] |= ls[i+1]
    for i in range(1,n):
        rs[i] |= rs[i-1]
    rr = []
    for p,q in pq:
        rr.append(len(ls[p] & rs[q]))

    return '\n'.join(map(str, rr))




print(main())


# Optimized solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

class Ruiwa():
    def __init__(self, a):
        self.H = h = len(a)
        self.W = w = len(a[0])
        self.R = r = a
        for i in range(h):
            for j in range(1,w):
                r[i][j] += r[i][j-1]

        for i in range(1,h):
            for j in range(w):
                r[i][j] += r[i-1][j]

    def search(self, x1, y1, x2, y2):
        if x1 > x2 or y1 > y2:
            return 0

        r = self.R
        rr = r[y2][x2]
        if x1 > 0 and y1 > 0:
            return rr - r[y1-1][x2] - r[y2][x1-1] + r[y1-1][x1-1]
        if x1 > 0:
            rr -= r[y2][x1-1]
        if y1 > 0:
            rr -= r[y1-1][x2]

        return rr

def main():
    n,m,q = LI()
    lr = [LI_() for _ in range(m)]
    pq = [LI_() for _ in range(q)]

    a = [[0]*n for _ in range(n)]

    for l,r in lr:
        a[l][r] += 1

    rui = Ruiwa(a)
    rr = []
    for p,q in pq:
        rr.append(rui.search(p,p,q,q))

    return '\n'.join(map(str, rr))




print(main())
# Original solution
N,M,Q = list(map(int,input().split()))
C = {i:{} for i in range(1,N+1)}
for _ in range(M):
    L,R = list(map(int,input().split()))
    if L not in C[R]:
        C[R][L] = 0
    C[R][L] += 1
for _ in range(Q):
    p,q = list(map(int,input().split()))
    A = {i:0 for i in range(1,N+1)}
    for i in range(1,q+1):
        for a in C[i]:
            A[a] += C[i][a]
    cnt = 0
    for a in range(p,N+1):
        cnt += A[a]
    print(cnt)

# Optimized solution
N,M,Q = list(map(int,input().split()))
A = [[0 for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M):
    L,R = list(map(int,input().split()))
    A[L][R] += 1
B = [[0 for _ in range(N+2)] for _ in range(N+2)]
for i in range(N,0,-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 _ in range(Q):
    p,q = list(map(int,input().split()))
    print((B[p][q]))
# Original solution
N,M,Q = list(map(int,input().split()))
A = [[0 for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M):
    l,r = list(map(int,input().split()))
    A[l][r] += 1
dp = [[0 for _ in range(N+1)] for _ in range(N+1)]
dp[N][1] = A[N][1]
for j in range(2,N+1):
    dp[N][j] = dp[N][j-1]+A[N][j]
for i in range(N-1,0,-1):
    dp[i][1] = dp[i+1][1]+A[i][1]
for i in range(N-1,0,-1):
    for j in range(2,N+1):
        dp[i][j] = A[i][j]+dp[i][j-1]+dp[i+1][j]-dp[i+1][j-1]
for _ in range(Q):
    p,q = list(map(int,input().split()))
    print((dp[p][q]))

# Optimized solution
N,M,Q = list(map(int,input().split()))
A = [[0 for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M):
    L,R = list(map(int,input().split()))
    A[L][R] += 1
dp = [[0 for _ in range(N+1)] for _ in range(N+1)]
dp[N][N] = A[N][N]
for i in range(N-1,0,-1):
    for j in range(i,N+1):
        dp[i][j] = A[i][j]
        if j>i:
            dp[i][j] += dp[i+1][j]+dp[i][j-1]-dp[i+1][j-1]
for _ in range(Q):
    p,q = list(map(int,input().split()))
    print((dp[p][q]))
# Original solution
import sys
input = sys.stdin.readline

def main():
    N,M,Q = list(map(int,input().split()))
    go = [[0 for _ in range(N)] for i in range(N)]
    for _ in range(M):
        L,R = list(map(int,input().split()))
        go[L-1][R-1] += 1
        
    qu = []
    for _ in range(Q):
        p,q = list(map(int,input().split()))
        qu.append((p-1,q-1))
        
    num = [[0 for _ in range(N)] for _ in range(N)]
    for i in range(N):
        num[i][0] = go[i][0]
    for i in range(N):
        for j in range(N-1):
            num[i][j+1] = num[i][j] + go[i][j+1]
            
    for i in range(Q):
        ans = 0
        p,q = qu[i]
        for j in range(p,q+1):
            ans += num[j][q]
        print(ans)
    
if __name__ == "__main__":
    main()


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

def main():
    N,M,Q = list(map(int,input().split()))
    go = [[0 for _ in range(N)] for i in range(N)]
    for _ in range(M):
        L,R = list(map(int,input().split()))
        go[L-1][R-1] += 1
        
    qu = []
    for _ in range(Q):
        p,q = list(map(int,input().split()))
        qu.append((p,q))
        
    num = [[0 for _ in range(N)] for _ in range(N)]
    _num = [[0 for _ in range(N)] for _ in range(N+1)]
    for i in range(N):
        num[i][0] = go[i][0]
    for i in range(N):
        for j in range(N-1):
            num[i][j+1] = num[i][j] + go[i][j+1]

    for i in range(N):
        for j in range(N):
            _num[j+1][i] = _num[j][i] + num[j][i]
            
    for i in range(Q):
        p,q = qu[i]
        ans = _num[q][q-1] - _num[p-1][q-1]
        print(ans)
    
if __name__ == "__main__":
    main()
# Original solution
N,M,Q = [ int(it) for it in input().split()]

grid = [ [0]*N for i in range(N) ]
gridsml = [ [0]*N for i in range(N) ]

for i in range(M):
  s,g = [ int(it)-1 for it in input().split()]
  grid[s][g]+=1

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


for i in range(Q):
  s,g = [ int(it)-1 for it in input().split()]
  m = 0
  for i in range(s,N):
    m += gridsml[i][g]
  print (m)

# Optimized solution
N,M,Q = [ int(it) for it in input().split() ]
lit = [ [ int(it)-1 for it in input().split() ] for i in range(M) ]
liq = [ [ int(it)-1 for it in input().split() ] for i in range(Q) ]

li = [[0]*(N+1) for i in range(N+1)]
for p,q in lit:
  li[p+1][q+1]+=1

for i in range(N+1):
  for j in range(N):
    li[i][j+1] += li[i][j]

for p,q in liq:
  s = 0
  for i in range(p+1,N+1):
    s += li[i][q+1]
  print  (s)
# Original solution
from bisect import bisect_left

def main():
	n, m, q = list(map(int, input().split()))
	trains = [list(map(int, input().split())) for _ in range(m)]
	queries = [list(map(int, input().split())) for _ in range(q)]
	
	xmt = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
	cmt = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
	
	for train in trains:
		xmt[train[0]][train[1]] += 1

	for i in range(1, n + 1):
		for j in range(1, n + 1):
			cmt[i][j] = cmt[i][j - 1] + xmt[i][j]
	
	#for i in range(n + 1):
	#	print(cmt[i])

	for query in queries:
		ans = 0
		for j in range(query[0], query[1] + 1):
			ans += cmt[j][query[1]] - cmt[j][query[0] - 1] 
		print(ans)

if __name__ == '__main__':
	main()

# Optimized solution
from bisect import bisect_left

def main():
	n, m, q = list(map(int, input().split()))
	trains = [list(map(int, input().split())) for _ in range(m)]
	queries = [list(map(int, input().split())) for _ in range(q)]
	
	xmt = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
	cmt = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
	
	for train in trains:
		xmt[train[0]][train[1]] += 1

	for i in range(1, n + 1):
		for j in range(1, n + 1):
			cmt[i][j] = cmt[i][j - 1] + (cmt[i - 1][j] - cmt[i - 1][j - 1]) + xmt[i][j] 
	
	for query in queries:
		i, j = query
		ans = cmt[j][j] - cmt[i - 1][j] - cmt[j][i - 1] + cmt[i - 1][i - 1]
		print(ans)

if __name__ == '__main__':
	main()
# Original solution
from collections import Counter
N,M,Q = list(map(int,input().split()))
T = [[0 for _ in range(N)] for _ in range(N)]
LR = []
for i in range(M):
  L,R = list(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 = list(map(int, input().split()))
  ans.append(T[p-1][q-1])
print(('\n'.join(map(str,ans))))


# Optimized solution
N,M,Q = list(map(int,input().split()))
T = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(M):
  L,R = list(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 = list(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))))
# Original solution
N, M, Q = list(map(int, input().split()))
coordinate = [[0 for _ in range(N+1)] for i in range(N+1)]
for m in range(M):
    l, r = list(map(int, input().split()))
    coordinate[l-1][r-1] += 1

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


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

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

coordinate = [[0] * N for _ in range(N)]
for _ in range(M):
    l, r = list(map(int, input().split()))
    l, r = l - 1, r - 1
    coordinate[l][r] += 1

acc = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(N):
    for j in range(N):
        acc[i + 1][j + 1] = acc[i][j + 1] + acc[i + 1][j] - acc[i][j] + coordinate[i][j]

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