To stay woke and attentive during classes, Karen needs some coffee! [Image] 

Karen, a coffee aficionado, wants to know the optimal temperature for brewing the perfect cup of coffee. Indeed, she has spent some time reading several recipe books, including the universally acclaimed "The Art of the Covfefe".

She knows n coffee recipes. The i-th recipe suggests that coffee should be brewed between l_{i} and r_{i} degrees, inclusive, to achieve the optimal taste.

Karen thinks that a temperature is admissible if at least k recipes recommend it.

Karen has a rather fickle mind, and so she asks q questions. In each question, given that she only wants to prepare coffee with a temperature between a and b, inclusive, can you tell her how many admissible integer temperatures fall within the range?


-----Input-----

The first line of input contains three integers, n, k (1 ≤ k ≤ n ≤ 200000), and q (1 ≤ q ≤ 200000), the number of recipes, the minimum number of recipes a certain temperature must be recommended by to be admissible, and the number of questions Karen has, respectively.

The next n lines describe the recipes. Specifically, the i-th line among these contains two integers l_{i} and r_{i} (1 ≤ l_{i} ≤ r_{i} ≤ 200000), describing that the i-th recipe suggests that the coffee be brewed between l_{i} and r_{i} degrees, inclusive.

The next q lines describe the questions. Each of these lines contains a and b, (1 ≤ a ≤ b ≤ 200000), describing that she wants to know the number of admissible integer temperatures between a and b degrees, inclusive.


-----Output-----

For each question, output a single integer on a line by itself, the number of admissible integer temperatures between a and b degrees, inclusive.


-----Examples-----
Input
3 2 4
91 94
92 97
97 99
92 94
93 97
95 96
90 100

Output
3
3
0
4

Input
2 1 1
1 1
200000 200000
90 100

Output
0



-----Note-----

In the first test case, Karen knows 3 recipes.  The first one recommends brewing the coffee between 91 and 94 degrees, inclusive.  The second one recommends brewing the coffee between 92 and 97 degrees, inclusive.  The third one recommends brewing the coffee between 97 and 99 degrees, inclusive. 

A temperature is admissible if at least 2 recipes recommend it.

She asks 4 questions.

In her first question, she wants to know the number of admissible integer temperatures between 92 and 94 degrees, inclusive. There are 3: 92, 93 and 94 degrees are all admissible.

In her second question, she wants to know the number of admissible integer temperatures between 93 and 97 degrees, inclusive. There are 3: 93, 94 and 97 degrees are all admissible.

In her third question, she wants to know the number of admissible integer temperatures between 95 and 96 degrees, inclusive. There are none.

In her final question, she wants to know the number of admissible integer temperatures between 90 and 100 degrees, inclusive. There are 4: 92, 93, 94 and 97 degrees are all admissible.

In the second test case, Karen knows 2 recipes.  The first one, "wikiHow to make Cold Brew Coffee", recommends brewing the coffee at exactly 1 degree.  The second one, "What good is coffee that isn't brewed at at least 36.3306 times the temperature of the surface of the sun?", recommends brewing the coffee at exactly 200000 degrees. 

A temperature is admissible if at least 1 recipe recommends it.

In her first and only question, she wants to know the number of admissible integer temperatures that are actually reasonable. There are none.

Difficulty: MEDIUM

Solutions:
(n, k, q) = map(int, input().split())
c = [0] * 200002
p = [0] * 200002
for i in range(n):
	(a, b) = map(int, input().split())
	p[a] += 1
	p[b + 1] -= 1
for i in range(1, 200002):
	p[i] += p[i - 1]
	c[i] = c[i - 1] + (p[i] >= k)
l = []
for i in range(q):
	(a, b) = map(int, input().split())
	print(c[b] - c[a - 1])


import sys
(n, k, q) = map(int, sys.stdin.readline().strip().split(' '))
(minR, maxR) = (10 ** 9, -10 ** 9)
tmp = 0
re = []
for i in range(n):
	(l, r) = map(int, sys.stdin.readline().strip().split(' '))
	minR = min(minR, l)
	maxR = max(maxR, r)
	re.append((l, r))
interval = [0 for _ in range(maxR - minR + 2)]
for r in re:
	interval[r[0] - minR] += 1
	interval[r[1] - minR + 1] -= 1
L = len(interval)
for i in range(1, L):
	interval[i] += interval[i - 1]
res = [0 for _ in range(L + 1)]
for i in range(L):
	if interval[i] >= k:
		res[i + 1] = 1
for i in range(1, L + 1):
	res[i] += res[i - 1]
for i in range(q):
	(l, r) = map(int, sys.stdin.readline().strip().split(' '))
	if r < minR or l > maxR:
		print(0)
		continue
	print(res[min(r + 1 - minR, L)] - res[max(0, l - minR)])


(n, k, q) = map(int, input().split())
c = [0] * 200003
p = [0] * 200003
for i in range(n):
	(a, b) = map(int, input().split())
	p[a] += 1
	p[b + 1] -= 1
for i in range(200003):
	p[i] += p[i - 1]
	c[i] = c[i - 1] + (p[i] >= k)
l = []
for i in range(q):
	(a, b) = map(int, input().split())
	l.append(c[b] - c[a - 1])
print(*l, sep='\n')


(n, k, q) = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(n)]
qs = [list(map(int, input().split())) for i in range(q)]

def answer(q):
	(a, b) = q
	if a == 1:
		print(l3[b - 1])
	else:
		print(l3[b - 1] - l3[a - 2])
l2 = [0] * 200000
l3 = [0] * 200000
adds = [0] * 200000
mins = [0] * 200000
for r in l:
	adds[r[0] - 1] += 1
	mins[r[1] - 1] += 1
l2[0] = adds[0] - mins[0]
if adds[0] >= k:
	l3[0] = 1
for i in range(1, 200000):
	l2[i] = l2[i - 1] + adds[i]
	if l2[i] >= k:
		l3[i] = 1
	l2[i] -= mins[i]
for i in range(1, 200000):
	l3[i] = l3[i - 1] + l3[i]
for q in qs:
	answer(q)


(n, k, q) = list(map(int, input().split()))
MAX_TEMP = 200000 + 10
temps = [0 for x in range(MAX_TEMP)]
for i in range(n):
	(l, r) = list(map(int, input().split()))
	temps[l] += 1
	temps[r + 1] -= 1
sums = [0 for x in range(MAX_TEMP)]
count = 0
for i in range(1, MAX_TEMP):
	count += temps[i]
	if count >= k:
		sums[i] = 1
	sums[i] += sums[i - 1]
answers = []
for i in range(q):
	(a, b) = list(map(int, input().split()))
	answers.append(sums[b] - sums[a - 1])
for ans in answers:
	print(ans)


from fractions import Fraction
import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007

def inp():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def solve():
	(n, k, q) = sep()
	pre = [0] * 200002
	for i in range(0, n):
		(l, r) = sep()
		pre[l] += 1
		pre[r + 1] -= 1
	for i in range(1, 200002):
		pre[i] = pre[i] + pre[i - 1]
	cnt = [0] * 200002
	for i in range(0, 200002):
		if i == 0:
			if pre[i] >= k:
				cnt[0] = 1
		elif pre[i] >= k:
			cnt[i] = cnt[i - 1] + 1
		else:
			cnt[i] = cnt[i - 1]
	for i in range(0, q):
		(l, r) = sep()
		print(cnt[r] - cnt[l - 1])
testcase(1)


from sys import stdin

def main():
	test = stdin.readlines()
	(n, k, q) = map(int, test[0].split())
	recipes = [0] * 200003
	for i in range(1, n + 1):
		(li, ri) = map(int, test[i].split())
		recipes[li] += 1
		recipes[ri + 1] -= 1
	rec = [0]
	for e in recipes:
		rec.append(rec[-1] + e)
	for (i, e) in enumerate(rec):
		if e < k:
			rec[i] = 0
		else:
			rec[i] = 1
	sugg = [0]
	for e in rec:
		sugg.append(sugg[-1] + e)
	ans = 0
	out = []
	for i in range(1 + n, n + q + 1):
		(li, ri) = map(int, test[i].split())
		ans = sugg[ri + 2] - sugg[li + 1]
		out.append(ans)
	print('\n'.join(map(str, out)))
main()


from sys import stdin, stdout

def read_ints():
	return list(map(int, stdin.readline().split()))
(n, k, q) = read_ints()
MAX_TEMP = 200000 + 10
temps = [0 for x in range(MAX_TEMP)]
for i in range(n):
	(l, r) = read_ints()
	temps[l] += 1
	temps[r + 1] -= 1
sums = [0 for x in range(MAX_TEMP)]
count = 0
for i in range(1, MAX_TEMP):
	count += temps[i]
	if count >= k:
		sums[i] = 1
	sums[i] += sums[i - 1]
for i in range(q):
	(a, b) = read_ints()
	print(sums[b] - sums[a - 1])


input = __import__('sys').stdin.readline
(n, k, q) = map(int, input().split())
arr = [0] * 200003
for i in range(n):
	(l, r) = map(int, input().split())
	arr[l] += 1
	arr[r + 1] -= 1
ans = [0] * 200003
for i in range(1, len(arr)):
	arr[i] += arr[i - 1]
	ans[i] = ans[i - 1] + (1 if arr[i] >= k else 0)
for i in range(q):
	(l, r) = map(int, input().split())
	print(ans[r] - ans[l - 1])


import sys

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
(n, k, q) = read_int_line()
c = [0] * 200010
for i in range(n):
	(li, ri) = read_int_line()
	c[li] += 1
	c[ri + 1] -= 1
summ = 0
for i in range(len(c)):
	summ += c[i]
	c[i] = summ
for i in range(len(c)):
	if c[i] >= k:
		c[i] = 1
	else:
		c[i] = 0
summ = 0
for i in range(len(c)):
	summ += c[i]
	c[i] = summ
for i in range(q):
	(a, b) = read_int_line()
	print(c[b] - c[a - 1])


MAX_BOUNDRY = 200002
interval = [0] * MAX_BOUNDRY
optimal = [0] * MAX_BOUNDRY
(num_of_recipes, admision, num_of_question) = map(int, input().split())
recipes = []
questions = []
for i in range(num_of_recipes):
	recipes.append(list(map(int, input().split())))
for i in range(num_of_question):
	questions.append(list(map(int, input().split())))
for i in range(num_of_recipes):
	interval[recipes[i][0]] += 1
	interval[recipes[i][1] + 1] -= 1
optimal[0] = interval[0]
for i in range(1, MAX_BOUNDRY):
	optimal[i] = interval[i] + optimal[i - 1]
for i in range(MAX_BOUNDRY):
	if optimal[i] >= admision:
		optimal[i] = 1
	else:
		optimal[i] = 0
for i in range(1, MAX_BOUNDRY):
	optimal[i] += optimal[i - 1]
for question in questions:
	res = optimal[question[1]] - optimal[question[0] - 1]
	print(res)


(n, k, q) = map(int, input().split())
recipe_in = []
for i in range(n):
	(l, r) = map(int, input().split())
	recipe_in.append((l, r))
query_in = []
for i in range(q):
	(l, r) = map(int, input().split())
	query_in.append((l, r))
MAX = 200000 + 10
recipes = [0 for i in range(MAX)]
for recipe in recipe_in:
	(l, r) = recipe
	recipes[l] += 1
	recipes[r + 1] -= 1
for i in range(1, MAX):
	recipes[i] += recipes[i - 1]
cnts = [0 for i in range(MAX)]
for i in range(MAX):
	if recipes[i] >= k:
		cnts[i] += 1
for i in range(1, MAX):
	cnts[i] += cnts[i - 1]
for query in query_in:
	(l, r) = query
	ans = cnts[r] - cnts[l - 1]
	print(ans)


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
(n, k, q) = mapi()
diff = [0] * 200002
mn = 200002
mx = 0
for i in range(n):
	(a, b) = mapi()
	diff[a] += 1
	diff[b + 1] -= 1
	mn = min(mn, a)
	mx = max(mx, b)
for i in range(1, 200002):
	diff[i] += diff[i - 1]
for i in range(200002):
	diff[i] = 1 * (diff[i] >= k)
for i in range(1, 200002):
	diff[i] += diff[i - 1]
for i in range(q):
	(a, b) = mapi()
	print(diff[b] - diff[a - 1])


import sys
input = sys.stdin.readline
(n, k, q) = map(int, input().split())
t = [0] * 200002
b = [0] * 200002
for j in range(n):
	(x, y) = map(int, input().split())
	t[x] += 1
	t[y + 1] -= 1
for j in range(1, 200002):
	t[j] += t[j - 1]
	if t[j] >= k:
		b[j] = 1
	b[j] += b[j - 1]
while q > 0:
	(a, r) = map(int, input().split())
	print(b[r] - b[a - 1])
	q -= 1


import sys
import math
input = sys.stdin.readline
(n, k, q) = map(int, input().split())
arr = [0] * 200005
for i in range(n):
	(l, r) = map(int, input().split())
	arr[l] += 1
	arr[r + 1] -= 1
for i in range(1, 200005):
	arr[i] = arr[i - 1] + arr[i]
for i in range(1, 200005):
	if arr[i] >= k:
		arr[i] = 1
	else:
		arr[i] = 0
for i in range(1, 200005):
	arr[i] = arr[i - 1] + arr[i]
for i in range(q):
	(l, r) = map(int, input().split())
	print(arr[r] - arr[l - 1])


import sys
input = sys.stdin.readline
(n, k, q) = list(map(int, input().split()))
a = [0] * 200007
c = [0] * 200007
for i in range(0, n):
	(l, r) = list(map(int, input().split()))
	a[r + 1] -= 1
	a[l] += 1
for i in range(1, 200007):
	a[i] += a[i - 1]
	if a[i] >= k:
		c[i] = 1
	c[i] += c[i - 1]
while q > 0:
	(l, r) = list(map(int, input().split()))
	print(c[r] - c[l - 1])
	q -= 1


(n, k, q) = map(int, input().split())
x = 200005
li = [0] * x
for _ in range(n):
	(l, r) = map(int, input().split())
	li[l] += 1
	li[r + 1] -= 1
for i in range(1, x):
	li[i] += li[i - 1]
for i in range(x):
	li[i] = li[i] >= k
for i in range(1, x):
	li[i] += li[i - 1]
for __ in range(q):
	(a, b) = map(int, input().split())
	print(li[b] - li[a - 1])


import sys
input = lambda : sys.stdin.readline()
MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : list(map(int, input().split()))
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
(n, k, q) = f()
lsf = [0] * 200009
ldp = [0] * 200009
for _ in range(n):
	(a, b) = f()
	lsf[a] += 1
	lsf[b + 1] -= 1
for i in range(1, 200007):
	lsf[i] += lsf[i - 1]
	ldp[i] = ldp[i - 1] + (lsf[i] >= k) * 1
for _ in range(q):
	(a, b) = f()
	sys.stdout.write(str(ldp[b] - ldp[a - 1]) + '\n')


from sys import stdin, stdout
(n, k, q) = map(int, stdin.readline().rstrip().split())
c = [0] * 200002
for i in range(n):
	(a, b) = map(int, input().split(' '))
	c[a] += 1
	c[b + 1] -= 1
for i in range(1, len(c)):
	c[i] = c[i] + c[i - 1]
for i in range(0, len(c)):
	c[i] = 1 if c[i] >= k else 0
for i in range(1, len(c)):
	c[i] = c[i] + c[i - 1]
for i in range(q):
	(a, b) = map(int, stdin.readline().rstrip().split())
	stdout.write(str(c[b] - c[a - 1]) + '\n')


import sys
from itertools import accumulate

def main():
	itr = iter(sys.stdin)
	(n, s, q) = map(int, next(itr).split())
	prefix_ranges = [0] * 200002
	for i in range(n):
		(x, y) = map(int, next(itr).split())
		prefix_ranges[x] += 1
		prefix_ranges[y + 1] -= 1
	prefix_ranges = list(accumulate(prefix_ranges))
	prefix_ranges = list(accumulate([prefix_ranges[i] >= s for i in range(len(prefix_ranges))]))
	ans = [0] * q
	for i in range(q):
		(x, y) = map(int, next(itr).split())
		ans[i] = str(prefix_ranges[y] - prefix_ranges[x - 1])
	print('\n'.join(ans))
main()


(n, k, q) = map(int, input().split())
pref = [0] * 200002
for _ in range(n):
	(l, r) = map(int, input().split())
	pref[l] += 1
	pref[r + 1] -= 1
cnt = 0
s = 0
for i in range(200002):
	cnt += pref[i]
	if cnt >= k:
		s += 1
	pref[i] = s
for _ in range(q):
	(a, b) = map(int, input().split())
	print(pref[b] - pref[a - 1])


import sys
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
(n, k, q) = Ri()
arr = [0] * (200000 + 2)
for i in range(n):
	(a, b) = Ri()
	arr[a] += 1
	arr[b + 1] -= 1
for i in range(1, len(arr)):
	arr[i] = arr[i - 1] + arr[i]
for i in range(1, len(arr)):
	arr[i] = 1 if arr[i] >= k else 0
for i in range(1, len(arr)):
	arr[i] = arr[i - 1] + arr[i]
for _ in range(q):
	(a, b) = Ri()
	print(arr[b] - arr[a - 1])


import sys
input = sys.stdin.readline
l = list(map(int, input().split()))
r = l[0]
k = l[1]
q = l[2]
count = [0] * 200002
for i in range(r):
	l1 = list(map(int, input().split()))
	count[l1[0]] += 1
	count[l1[1] + 1] -= 1
check = [0] * 200002
for i in range(1, 200002):
	count[i] += count[i - 1]
for i in range(200001):
	if count[i] >= k:
		check[i] = 1
for i in range(1, 200002):
	check[i] += check[i - 1]
for i in range(q):
	l1 = list(map(int, input().split()))
	print(check[l1[1]] - check[l1[0] - 1])


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest
INF = 99999999999999999999999999999999

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		(n, k, q) = ria()
		temprang = [0] * 200005
		prefsum = [0] * 200005
		z = []
		for i in range(n):
			(l, r) = ria()
			z.append([l, r])
			temprang[l] += 1
			temprang[r + 1] -= 1
		for i in range(1, len(temprang)):
			temprang[i] += temprang[i - 1]
			if temprang[i] >= k:
				prefsum[i] += 1
			prefsum[i] += prefsum[i - 1]
		for i in range(q):
			(a, b) = ria()
			print(prefsum[b] - prefsum[a - 1])
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


import sys
import math
import collections
import heapq
import decimal
input = sys.stdin.readline
(n, k, q) = (int(i) for i in input().split())
temp = [0] * 200001
for i in range(n):
	(l, r) = (int(i) for i in input().split())
	temp[l - 1] += 1
	temp[r] -= 1
pref = [temp[0]]
for i in range(1, 200001):
	pref.append(pref[i - 1] + temp[i])
if pref[0] >= k:
	pref2 = [1]
else:
	pref2 = [0]
for i in range(1, 200001):
	if pref[i] >= k:
		pref2.append(pref2[i - 1] + 1)
	else:
		pref2.append(pref2[i - 1])
for i in range(q):
	(a, b) = (int(i) for i in input().split())
	if a == 1:
		print(pref2[b - 1])
	else:
		print(pref2[b - 1] - pref2[a - 2])


(n, k, q) = map(int, input().split())
c = [0] * 200003
for i in range(n):
	(a, b) = map(int, input().split())
	c[a] += 1
	c[b + 1] -= 1
for i in range(1, len(c)):
	c[i] += c[i - 1]
c[0] = 1 if c[0] >= k else 0
for i in range(1, len(c)):
	c[i] = 1 if c[i] >= k else 0
	c[i] += c[i - 1]
ans = ''
for i in range(q):
	(a, b) = map(int, input().split())
	ans += str(c[b] - c[a - 1]) + '\n'
print(ans, end='')


(n, k, q) = map(int, input().split())
ps = [0] * 200002
for _ in range(n):
	(a, b) = map(int, input().split())
	ps[a] += 1
	ps[b + 1] -= 1
for i in range(1, 200002):
	ps[i] += ps[i - 1]
psum = []
for i in range(200002):
	if ps[i] >= k:
		psum.append(1)
	else:
		psum.append(0)
for i in range(1, 200002):
	psum[i] += psum[i - 1]
ans = []
for _ in range(q):
	(a, b) = map(int, input().split())
	ans.append(psum[b] - psum[a - 1])
for i in ans:
	print(i)


(n, k, q) = map(int, input().split())
rec = [0 for i in range(200005)]
ques = []
for i in range(n):
	(l, r) = map(int, input().split())
	rec[l] += 1
	rec[r + 1] -= 1
for i in range(1, len(rec)):
	rec[i] += rec[i - 1]
for i in range(1, len(rec)):
	if rec[i] >= k:
		rec[i] = 1
	else:
		rec[i] = 0
	rec[i] += rec[i - 1]
for i in range(q):
	(l, r) = map(int, input().split())
	ques.append(rec[r] - rec[l - 1])
ques = map(str, ques)
print('\n'.join(ques))


from sys import stdin, stdout
MAX = 200000
a = [0] * (MAX + 1)
(n, mn, nQ) = map(int, stdin.readline().split())
for _ in range(n):
	(l, r) = map(lambda x: int(x) - 1, stdin.readline().split())
	a[l] += 1
	a[r + 1] -= 1
psums = [0]
d = 0
for i in range(MAX):
	d += a[i]
	a[i] = d
	a[i] = 0 if a[i] < mn else 1
	psums.append(psums[-1] + a[i])
sumRange = lambda l, r: psums[r + 1] - psums[l]
for _ in range(nQ):
	(l, r) = map(lambda x: int(x) - 1, stdin.readline().split())
	stdout.write('%d\n' % sumRange(l, r))


(n, k, q) = [int(x) for x in input().split()]
seg = [0] * 200010
par = [0] * 200010
for i in range(n):
	(li, ri) = [int(x) for x in input().split()]
	seg[li] += 1
	seg[ri + 1] -= 1
s = 0
for i in range(1, 200001):
	s += seg[i]
	seg[i] = s
	par[i] = par[i - 1] + (1 if s >= k else 0)
for i in range(q):
	(ai, bi) = [int(x) for x in input().split()]
	print(par[bi] - par[ai - 1])


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(n, k, q) = map(int, input().split())
lim = 2 * 10 ** 5 + 1
pas = []
dif_arr = [0] * lim
for i in range(n):
	(s, e) = map(int, input().split())
	dif_arr[s] += 1
	if e + 1 < len(dif_arr):
		dif_arr[e + 1] -= 1
t = 0
for i in range(lim):
	t += dif_arr[i]
	pas.append(t)
pas2 = []
t = 0
for i in pas:
	if i >= k:
		t += 1
	pas2.append(t)
for i in range(q):
	(s, e) = map(int, input().split())
	if s - 1 > -1:
		print(pas2[e] - pas2[s - 1])
	else:
		print(pas2[e])


from array import array
from itertools import repeat, accumulate
(n, k, q) = map(int, input().split(' '))
c = array('i', repeat(0, 200000 + 10))
temp_map = array('i', repeat(0, 200000 + 10))
for _ in range(n):
	(l, r) = map(int, input().split(' '))
	c[l] += 1
	c[r + 1] -= 1
v = 0
for (i, e) in enumerate(c):
	if v >= k:
		temp_map[i - 1] = 1
	v += e
temp_acc = list(accumulate(temp_map))
res = []
for _ in range(q):
	(l, r) = map(int, input().split(' '))
	res.append(temp_acc[r] - temp_acc[l - 1])
res = map(str, res)
print('\n'.join(res))


import sys
input = sys.stdin.readline
(n, k, q) = list(map(int, input().split()))
P = [0] * 200002
for _ in range(n):
	(a, b) = map(int, input().split())
	P[a] += 1
	P[b + 1] -= 1
for i in range(1, len(P)):
	P[i] = P[i] + P[i - 1]
for i in range(1, len(P)):
	P[i] = 1 if P[i] >= k else 0
for i in range(1, len(P)):
	P[i] += P[i - 1]
for _ in range(q):
	(a, b) = map(int, input().split())
	print(P[b] - P[a - 1])


from collections import *
from sys import stdin

def arr_inp(n):
	if n == 1:
		return [int(x) for x in stdin.readline().split()]
	elif n == 2:
		return [float(x) for x in stdin.readline().split()]
	else:
		return list(stdin.readline()[:-1])

class segmenttree:

	def __init__(self, arr, n):
		(self.tree, self.n) = ([0] * (2 * n), n)
		if arr:
			for i in range(2 * n - 1, 0, -1):
				if i >= n:
					self.tree[i] = arr[i - n]
				else:
					self.tree[i] = self.tree[i << 1] + self.tree[(i << 1) + 1]

	def query(self, l, r):
		res = 0
		l += self.n
		r += self.n
		while l < r:
			if l & 1:
				res += self.tree[l]
				l += 1
			if r & 1:
				r -= 1
				res += self.tree[r]
			l >>= 1
			r >>= 1
		return res

	def update(self, ix, val):
		ix += self.n
		self.tree[ix] = val
		while ix > 1:
			self.tree[ix >> 1] = self.tree[ix] + self.tree[ix ^ 1]
			ix >>= 1
(cum, all) = (defaultdict(int), [])
(n, k, q) = arr_inp(1)
for i in range(n):
	(l, r) = arr_inp(1)
	cum[l] += 1
	cum[r + 1] -= 1
for i in range(1, 200001):
	cum[i] += cum[i - 1]
	all.append(1 if cum[i] >= k else 0)
tree = segmenttree(all, len(all))
for i in range(q):
	(l, r) = arr_inp(1)
	print(tree.query(l - 1, r))


N = 200002
f = [0] * N
ans = [0] * N
res = []
(n, k, q) = map(int, input().split(' '))
while n:
	(l, r) = map(int, input().split(' '))
	f[l] += 1
	f[r + 1] -= 1
	n -= 1
for i in range(1, N):
	f[i] += f[i - 1]
	ans[i] += ans[i - 1] + (f[i] >= k)
while q:
	(l, r) = map(int, input().split(' '))
	res.append(ans[r] - ans[l - 1])
	q -= 1
print(*res, sep='\n')


a = [int(x) for x in input().split()]
receptek = []
kerdesek = []
for x in range(a[0]):
	receptek.append([int(y) for y in input().split()])
for x in range(a[2]):
	kerdesek.append([int(y) for y in input().split()])
nagy = 200002
jo = [0] * nagy
for x in range(len(receptek)):
	b = receptek[x][0]
	c = receptek[x][1]
	jo[b] += 1
	jo[c + 1] -= 1
for x in range(1, len(jo)):
	jo[x] += jo[x - 1]
adm = [0] * nagy
for x in range(1, len(jo)):
	if jo[x] >= a[1]:
		adm[x] += 1
	adm[x] += adm[x - 1]
mo = []
for x in range(len(kerdesek)):
	mo.append(adm[kerdesek[x][1]] - adm[kerdesek[x][0] - 1])
for m in mo:
	print(m)


import os
import sys
from io import BytesIO, IOBase
import math
import itertools
import bisect
import heapq

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	for i in range(2, n + 1):
		if primes[i]:
			for j in range(i + i, n + 1, i):
				primes[j] = False
	p = []
	for i in range(0, n + 1):
		if primes[i]:
			p.append(i)
	return p

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac

def chk(n, d):
	if str(d) in str(n):
		return True
	return False
(n, k, q) = map(int, input().split())
cnt = [0] * 200001
for i in range(0, n):
	(l, r) = map(int, input().split())
	cnt[l - 1] += 1
	cnt[r] -= 1
for i in range(1, 200001):
	cnt[i] += cnt[i - 1]
pref = [0] * 200001
for i in range(0, 200001):
	if cnt[i] >= k:
		pref[i] = 1
for i in range(1, 200001):
	pref[i] += pref[i - 1]
pref.insert(0, 0)
for i in range(0, q):
	(l, r) = map(int, input().split())
	print(pref[r] - pref[l - 1])


import sys
(n, k, q) = map(int, sys.stdin.readline().split())
check = [0] * 200012
for i in range(n):
	(l, r) = map(int, sys.stdin.readline().split())
	check[l] += 1
	check[r + 1] -= 1
for i in range(200001):
	check[i + 1] += check[i]
	if check[i] >= k:
		check[i] = 1
	else:
		check[i] = 0
for i in range(200000):
	check[i + 1] += check[i]
for i in range(q):
	count = 0
	(a, b) = map(int, sys.stdin.readline().split())
	sys.stdout.write(str(check[b] - check[a - 1]) + '\n')


import sys
input = sys.stdin.readline
(n, k, q) = map(int, input().split())
start = {}
end = {}
for i in range(n):
	(x, y) = map(int, input().split())
	if x not in start:
		start[x] = 1
	else:
		start[x] += 1
	if y not in end:
		end[y] = 1
	else:
		end[y] += 1
c = [0] * 200002
if 0 in start:
	c[0] += start[0]
if 0 in end:
	c[1] -= end[0]
for i in range(1, 200001):
	c[i] += c[i - 1]
	if i in start:
		c[i] += start[i]
	if i in end:
		c[i + 1] -= end[i]
for i in range(200001):
	if c[i] >= k:
		c[i] = 1
	else:
		c[i] = 0
for i in range(1, 200001):
	c[i] += c[i - 1]
for i in range(q):
	(a, b) = map(int, input().split())
	if a == 0:
		print(c[b])
	else:
		print(c[b] - c[a - 1])


(n, k, q) = map(int, input().split())
l = [0] * (2 * 10 ** 5 + 2)
for _ in range(n):
	(a, b) = map(int, input().split())
	l[a] += 1
	l[b + 1] -= 1
prefix = []
temp = 0
for i in l:
	temp += i
	prefix.append(temp)
ar = [0] * (2 * 10 ** 5 + 2)
for i in range(2 * 10 ** 5 + 2):
	if prefix[i] >= k:
		ar[i] = 1
prefixarray = []
temp = 0
for i in ar:
	temp += i
	prefixarray.append(temp)
for i in range(q):
	(a, b) = map(int, input().split())
	print(prefixarray[b] - prefixarray[a - 1])


def main():
	(n, k, q) = list(map(int, input().split()))
	(l, res) = ([0] * 200002, [])
	for _ in range(n):
		(a, b) = list(map(int, input().split()))
		l[a] += 1
		l[b + 1] -= 1
	a = 0
	for (i, b) in enumerate(l):
		a += b
		l[i] = a >= k
	a = 0
	for (i, b) in enumerate(l):
		if b:
			a += 1
		l[i] = a
	for _ in range(q):
		(a, b) = list(map(int, input().split()))
		res.append(l[b] - l[a - 1])
	print('\n'.join(map(str, res)))

def __starting_point():
	main()
__starting_point()


(n, k, q) = list(map(int, input().split()))
recipes = [0] * (200000 + 2)
res = []
for _ in range(n):
	(l, r) = list(map(int, input().split()))
	recipes[l] += 1
	recipes[r + 1] -= 1
for i in range(1, len(recipes)):
	recipes[i] += recipes[i - 1]
for i in range(1, len(recipes)):
	recipes[i] = 1 if recipes[i] >= k else 0
	recipes[i] += recipes[i - 1]
for _ in range(q):
	(a, b) = list(map(int, input().split()))
	res.append(recipes[b] - recipes[a - 1])
print('\n'.join(map(str, res)))


from sys import stdin, stdout

def ii():
	return int(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline()
(n, k, q) = mi()
l1 = [0] * 200002
pf = [0] * 200002
for _ in range(n):
	(a, b) = mi()
	l1[a] += 1
	l1[b + 1] -= 1
pf[0] = l1[0]
for i in range(1, 200002):
	pf[i] = pf[i - 1] + l1[i]
for i in range(200002):
	if pf[i] >= k:
		pf[i] = 1
	else:
		pf[i] = 0
for i in range(1, 200002):
	pf[i] += pf[i - 1]
for _ in range(q):
	(a, b) = mi()
	print(pf[b] - pf[a - 1])


(n, m, k1) = map(int, input().split())
l1 = [0] * 200003
for i in range(n):
	(a, b) = map(int, input().split())
	l1[a] += 1
	l1[b + 1] -= 1
for i in range(1, 200003):
	l1[i] = l1[i - 1] + l1[i]
l1[0] = 0
for i in range(1, len(l1)):
	if l1[i] >= m:
		l1[i] = l1[i - 1] + 1
	else:
		l1[i] = l1[i - 1]
V = ''
for i in range(k1):
	(a, b) = map(int, input().split())
	V += str(l1[b] - l1[a - 1]) + '\n'
print(V, end='')


from sys import stdin
inp = stdin.readline
(n, k, q) = map(int, inp().split())
temps = [0] * 200005
for i in range(n):
	(l, r) = map(int, inp().split())
	temps[l] += 1
	temps[r + 1] -= 1
cur_sum = 0
cur_max = 0
for i in range(200005):
	cur_sum += temps[i]
	if cur_sum >= k:
		cur_max += 1
	temps[i] = cur_max
for i in range(q):
	(a, b) = map(int, inp().split())
	print(temps[b] - temps[a - 1])


import sys

class FastInput:

	def __init__(self, file=sys.stdin):
		self._lines = file.read().strip().split('\n')
		self._index = 0

	def next_line(self):
		ret = self._lines[self._index]
		self._index += 1
		return ret

	def line_of_ints(self):
		return list(map(int, self.next_line().split()))

def prefix_sums(array):
	res = [array[0]]
	for v in array[1:]:
		res.append(res[-1] + v)
	return res

class FastIntervalSummer:

	def __init__(self, array):
		self._prefix_sums = [0] + prefix_sums(array)

	def interval_sum(self, l, r):
		return self._prefix_sums[r + 1] - self._prefix_sums[l]
data = FastInput()
(n, k, q) = data.line_of_ints()
recipies = [data.line_of_ints() for _ in range(n)]
queries = [data.line_of_ints() for _ in range(q)]
max_t = max(map(max, recipies))
diff_recipies = [0] * (max_t + 2)
for (l, r) in recipies:
	diff_recipies[l] += 1
	diff_recipies[r + 1] -= 1
t_to_num_recipies = prefix_sums(diff_recipies)
t_to_admissible = [1 if n_recipies >= k else 0 for n_recipies in t_to_num_recipies]
t_to_admissible_ps = FastIntervalSummer(t_to_admissible)
for (l, r) in queries:
	l = min(l, len(t_to_admissible) - 1)
	r = min(r, len(t_to_admissible) - 1)
	print(t_to_admissible_ps.interval_sum(l, r))


(recipesNum, recipesMin, questionsNum) = map(int, input().split())
recipes = [0] * 200003
pref = [0] * 200003
for i in range(recipesNum):
	(l, r) = map(int, input().split())
	recipes[l] += 1
	recipes[r + 1] -= 1
for i in range(1, len(recipes)):
	recipes[i] += recipes[i - 1]
	pref[i] = pref[i - 1] + (recipes[i] >= recipesMin)
for i in range(questionsNum):
	(a, b) = map(int, input().split())
	print(pref[b] - pref[a - 1])


(n, k, q) = map(int, input().split())
nums = [0] * (200000 + 9)
for _ in range(n):
	(l, r) = map(int, input().split())
	nums[l] += 1
	nums[r + 1] -= 1
for i in range(1, len(nums)):
	nums[i] = nums[i] + nums[i - 1]
if nums[0] >= k:
	nums[0] = 1
else:
	nums[0] = 0
for i in range(1, len(nums)):
	if nums[i] >= k:
		nums[i] = nums[i - 1] + 1
	else:
		nums[i] = nums[i - 1]
for _ in range(q):
	count = 0
	(l, r) = map(int, input().split())
	count = nums[r] - nums[l - 1]
	print(count)


def prefix_sum(a):
	b = [a[0]]
	n = len(a)
	for i in range(1, n, 1):
		b.append(b[i - 1] + a[i])
	return b

def pre_process(a, k):
	n = len(a)
	for i in range(1, n, 1):
		if a[i] >= k:
			a[i] = 1
		else:
			a[i] = 0
	return a

def main():
	(n, k, q) = input().split(' ')
	(n, k, q) = [int(x) for x in [n, k, q]]
	c = [0 for i in range(200002)]
	for i in range(n):
		temp = [int(j) for j in input().split(' ')]
		c[temp[0]] += 1
		c[temp[1] + 1] -= 1
	c = prefix_sum(c)[:]
	sol = pre_process(c, k)
	sol = prefix_sum(sol)[:]
	res = []
	for i in range(q):
		temp = [int(j) for j in input().split(' ')]
		a = temp[0]
		b = temp[1]
		res.append(sol[b] - sol[a - 1])
	for i in res:
		print(i)
main()


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k, q) = map(int, input().split())
arr = [0] * 200009
for i in range(n):
	(l, r) = map(int, input().split())
	arr[l] += 1
	arr[r + 1] -= 1
for i in range(1, len(arr)):
	arr[i] += arr[i - 1]
for i in range(len(arr)):
	if arr[i] >= k:
		arr[i] = 1
	else:
		arr[i] = 0
for i in range(1, len(arr)):
	arr[i] += arr[i - 1]
for i in range(q):
	(a, b) = map(int, input().split())
	print(arr[b] - arr[a - 1])


(n, k, q) = map(int, input().split())
numRec_temp_i = [0 for i in range(200001)]
for i in range(n):
	(l, r) = map(int, input().split())
	numRec_temp_i[l] += 1
	if r < 200000:
		numRec_temp_i[r + 1] -= 1
for i in range(1, 200001):
	numRec_temp_i[i] += numRec_temp_i[i - 1]
for i in range(1, 200001):
	if numRec_temp_i[i] >= k:
		numRec_temp_i[i] = 1 + numRec_temp_i[i - 1]
	else:
		numRec_temp_i[i] = numRec_temp_i[i - 1]
z = []
for i in range(q):
	(a, b) = map(int, input().split())
	z.append(str(numRec_temp_i[b] - numRec_temp_i[a - 1]))
print('\n'.join(z))


(n, k, q) = map(int, input().split())
l = [0] * 200001
for i in range(n):
	(li, ri) = map(int, input().split())
	l[li - 1] += 1
	l[ri] -= 1
l1 = []
if l[0] >= k:
	l1.append(1)
else:
	l1.append(0)
la = []
lb = []
for i in range(q):
	(a, b) = map(int, input().split())
	la.append(a)
	lb.append(b)
d = max(lb)
for i in range(1, d + 1):
	l[i] = l[i] + l[i - 1]
	if l[i] >= k:
		l1.append(l1[len(l1) - 1] + 1)
	else:
		l1.append(l1[len(l1) - 1])
for j in range(q):
	(a, b) = (la[j], lb[j])
	if a == 1:
		print(l1[b - 1])
	else:
		print(l1[b - 1] - l1[a - 2])


(n, k, q) = map(int, input().split())
m = [0] * 200001
a = 0
for i in range(n):
	(a, b) = map(int, input().split())
	m[a - 1] += 1
	m[b] -= 1
mk = []
for i in range(q):
	mk.append(list(map(int, input().split())))
a = 0
pre = []
for i in range(200001):
	a = a + m[i]
	if a >= k:
		pre.append(1)
	else:
		pre.append(0)
pre2 = []
a = 0
pre2.append(0)
for i in range(200001):
	a = a + pre[i]
	pre2.append(a)
for i in range(q):
	out = pre2[mk[i][1]] - pre2[mk[i][0] - 1]
	print(out)


import math as mt
import sys, string
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
(n, k, q) = M()

def update(D, l, r, x):
	D[l] += x
	D[r + 1] -= x

def printArray(A, D):
	for i in range(0, len(A)):
		if i == 0:
			A[i] = D[i]
		else:
			A[i] = D[i] + A[i - 1]
A = [0] * 200100
D = [0] * 200101
for i in range(n):
	(a, b) = M()
	update(D, a, b, 1)
printArray(A, D)
x = [0]
for i in range(len(A)):
	if A[i] >= k:
		x.append(x[-1] + 1)
	else:
		x.append(x[-1])
x.append(x[-1])
for i in range(q):
	(a, b) = M()
	print(x[b + 1] - x[a])


(recipes, admisionNums, questions) = list(map(int, input().split()))
recipeList = []
questionList = []
partialSum = [0] * 200002
preSum = [0] * 200002
partialSum2 = [0] * 200002
preSum2 = [0] * 200002
counter = 0
for i in range(recipes):
	recipeList.append(list(map(int, input().split())))
for i in range(questions):
	questionList.append(list(map(int, input().split())))
for i in range(recipes):
	partialSum[recipeList[i][0]] += 1
	partialSum[recipeList[i][1] + 1] -= 1
preSum[0] = partialSum[0]
for i in range(1, 200002):
	preSum[i] = preSum[i - 1] + partialSum[i]
for i in range(200002):
	if preSum[i] >= admisionNums:
		partialSum2[i] = 1
	else:
		partialSum2[i] = 0
preSum2[0] = partialSum2[0]
for i in range(1, 200002):
	preSum2[i] = preSum2[i - 1] + partialSum2[i]
for question in questionList:
	print(preSum2[question[1]] - preSum2[question[0] - 1])


import itertools as it
import sys
c = [0] * 200002
(n, k, q) = map(int, input().split())
itr = iter(sys.stdin)
for i in range(n):
	(l, r) = map(int, next(itr).split())
	c[l] += 1
	c[r + 1] -= 1
c = list(it.accumulate(c))
c = list(it.accumulate([int(c[i] >= k) for i in range(len(c))]))
ans = []
for i in range(q):
	(l, r) = map(int, input().split())
	ans.append(str(c[r] - c[l - 1]))
print('\n'.join(ans))


(n, k, q) = [int(x) for x in input().split()]
(mainL, x, c) = ([0] * 200002, 0, 0)
for i in range(n):
	(left, right) = [int(x) for x in input().split()]
	mainL[left] += 1
	mainL[right + 1] -= 1
for i in range(200002):
	x += mainL[i]
	if x >= k:
		c += 1
		mainL[i] = c
	else:
		mainL[i] = c
for i in range(q):
	(start, end) = [int(x) for x in input().split()]
	print(mainL[end] - mainL[start - 1])


import math
from sys import stdin, stdout
input = stdin.readline

class N:

	def __init__(self, il, ir, val, l, r):
		self.il = il
		self.ir = ir
		self.val = val
		self.l = l
		self.r = r

	def __str__(self):
		return ' il = ' + str(self.il) + ' ir = ' + str(self.ir) + ' val = ' + str(self.val)

	def get_amount(self, left, right, func):
		if self.il == left and self.ir == right:
			return self.val
		elif self.l.il <= left and self.l.ir >= right:
			return self.l.get_amount(left, right, func)
		elif self.r.il <= left and self.r.ir >= right:
			return self.r.get_amount(left, right, func)
		else:
			return func(self.l.get_amount(left, self.l.ir, func), self.r.get_amount(self.r.il, right, func))

class ST:

	def __init__(self, arr, threshold):
		t1 = []
		t2 = []
		for (i, val) in enumerate(arr):
			t1.append(N(i, i, int(val >= threshold), None, None))
		while len(t1) + len(t2) > 1:
			while len(t1) >= 2:
				a = t1.pop()
				b = t1.pop()
				t2.append(self.__get_next(a, b))
			if len(t1) > 0:
				t2.append(t1.pop())
			(t1, t2) = (t2, t1)
		self.r = t1[0]

	def __get_next(self, a, b):
		if a.il > b.il:
			(a, b) = (b, a)
		n = N(a.il, b.ir, self.__func(a.val, b.val), a, b)
		return n

	def __func(self, a, b):
		return a + b

	def request(self, l, r):
		root = self.r
		answ = 0
		if l == r:
			while not (root.il == l and root.ir == r):
				if l >= root.l.il and r <= root.l.ir:
					root = root.l
				else:
					root = root.r
			answ = self.__func(answ, root.val)
			return answ
		if root.il == l and root.ir == r:
			return root.val
		f = True
		while f:
			if root.l.il <= l and root.l.ir >= r:
				root = root.l
			elif root.r.il <= l and root.r.ir >= r:
				root = root.r
			else:
				f = False
		left = root.l
		right = root.r
		while not left.il == l:
			if l < left.r.il:
				answ = self.__func(answ, left.r.val)
				left = left.l
			else:
				left = left.r
		answ = self.__func(answ, left.val)
		while not right.ir == r:
			if r > right.l.ir:
				answ = self.__func(answ, right.l.val)
				right = right.r
			else:
				right = right.l
		answ = self.__func(answ, right.val)
		return answ

	def req(self, l, r):
		return self.r.get_amount(l, r, self.__func)
gradus = [0 for i in range(200002)]
(recipes, min_r, questions) = list(map(int, input().split()))
adds = []
for i in range(recipes):
	(l, r) = list(map(int, input().split()))
	if l == r:
		adds.append(l)
	else:
		gradus[l] -= 1
		gradus[r + 1] += 1
counter = 0
for i in range(0, len(gradus)):
	if gradus[i] < 0:
		counter += abs(gradus[i])
	elif gradus[i] > 0:
		counter -= gradus[i]
	gradus[i] = counter
for i in adds:
	gradus[i] += 1
tree = ST(gradus, min_r)
res = []
for i in range(questions):
	(l, r) = list(map(int, input().split()))
	res.append(str(tree.request(l, r)))
print('\n'.join(res))


(numberofRecipes, min_numberofRecipes, numberofQuestions) = map(int, input().split())
recipes = [0] * 200009
for i in range(numberofRecipes):
	(low, high) = map(int, input().split())
	recipes[low] += 1
	recipes[high + 1] -= 1
for i in range(1, len(recipes)):
	recipes[i] += recipes[i - 1]
for i in range(1, len(recipes)):
	if recipes[i] >= min_numberofRecipes:
		recipes[i] = 1 + recipes[i - 1]
	else:
		recipes[i] = recipes[i - 1]
for i in range(numberofQuestions):
	(a, b) = map(int, input().split())
	print(recipes[b] - recipes[a - 1])


(n, k, q) = map(int, input().split())
d = [0] * 200002
for i in range(n):
	(x, y) = map(int, input().split())
	d[x] += 1
	d[y + 1] -= 1
t = [0] * 200002
for i in range(1, 200002):
	d[i] += d[i - 1]
	if d[i] >= k:
		t[i] = t[i - 1] + 1
	else:
		t[i] = t[i - 1]
for i in range(q):
	(x, y) = map(int, input().split())
	print(t[y] - t[x - 1])


(noOfrecipes, minrecipes, quest) = map(int, input().split())
lst = [0] * 200005
count = 0
for i in range(noOfrecipes):
	(l, r) = map(int, input().split())
	lst[l] += 1
	lst[r + 1] -= 1
for j in range(1, len(lst)):
	lst[j] = lst[j - 1] + lst[j]
for i in range(len(lst)):
	if lst[i] >= minrecipes:
		count += 1
	lst[i] = count
for i in range(quest):
	(a, b) = map(int, input().split())
	print(lst[b] - lst[a - 1])


import sys
input = sys.stdin.readline
(n, k, q) = map(int, input().split())
recommended = [0] * 200002
for _ in range(n):
	(a, b) = map(int, input().split())
	recommended[a] += 1
	recommended[b + 1] -= 1
cum = 0
for i in range(200002):
	cum += recommended[i]
	recommended[i] = cum
prefix_sum = [0]
for i in range(1, 200002):
	if recommended[i] >= k:
		prefix_sum.append(prefix_sum[-1] + 1)
	else:
		prefix_sum.append(prefix_sum[-1])
for _ in range(q):
	(a, b) = map(int, input().split())
	print(prefix_sum[b] - prefix_sum[a - 1])