Problem:
Score: 400 points

Problem Statement

In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.
A company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).
Takahashi the king is interested in the following Q matters:

The number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \leq L_j and R_j \leq q_i.

Although he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.

Constraints

N is an integer between 1 and 500 (inclusive).

M is an integer between 1 and 200 \ 000 (inclusive).

Q is an integer between 1 and 100 \ 000 (inclusive).

1 \leq L_i \leq R_i \leq N (1 \leq i \leq M)

1 \leq p_i \leq q_i \leq N (1 \leq i \leq Q)

Input

Input is given from Standard Input in the following format:

N M Q
L_1 R_1
L_2 R_2
:
L_M R_M
p_1 q_1
p_2 q_2
:
p_Q q_Q

Output

Print Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.

Sample Input 1

2 3 1
1 1
1 2
2 2
1 2

Sample Output 1

3

As all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.

Sample Input 2

10 3 2
1 5
2 8
7 10
1 7
3 10

Sample Output 2

1
1

The first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.
The second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.

Sample Input 3

10 10 10
1 6
2 9
4 5
4 7
4 7
5 8
6 6
6 7
7 9
10 10
1 8
1 9
1 10
2 8
2 9
2 10
3 8
3 9
3 10
1 10

Sample Output 3

7
9
10
6
8
9
6
7
8
10

Solution in C# (Mono 4.6.2.0) (judge verdict: Runtime Error)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using static System.Console;
using static PB10004.Algorithm.Util;

namespace PB10004.Algorithm
{
    class Template
    {
        static void Main(string[] args)
        {
            new D().Solve();
        }
    }
    class A
    {
        public void Solve()
        {
            var array = ReadIntArray();
            WriteLine((array[0] - 1) * (array[1] - 1));
        }
    }
    class B
    {
        public void Solve()
        {
            var N = ReadLong();
            if(N < 105)
            {
                WriteLine(0);
            }
            else if(N < 135)
            {
                WriteLine(1);
            }
            else if(N < 165)
            {
                WriteLine(2);
            }
            else if(N < 189)
            {
                WriteLine(3);
            }
            else if(N < 195)
            {
                WriteLine(4);
            }
            else
            {
                WriteLine(5);
            }
            //int[] array = new int[1000];
            //for (int i = 1; i <= 199; i+=2)
            //{
            //    for (int j = 1; j <= i/2; j++)
            //    {
            //        if (i % j == 0) array[i]++;
            //    }
            //    if (array[i] == 7) WriteLine(i);
            //    //WriteLine("{0},{1}", i, array[i]+1);
            //}
        }
    }
    class C
    {
        public void Solve()
        {
            var line = ReadLine();
            var K = ulong.Parse(ReadLine());
            int i=0;
            while (line[i] == '1')
            {
                i++;
                if((ulong)i == K)
                {
                    WriteLine(1);
                    return;
                }
            }
            WriteLine(line[i]);
        }
    }
    class D
    {
        List<Kukan> trains = new List<Kukan>();
        public void Solve()
        {
            var array = ReadLongArray();
            var N = array[0];
            var M = array[1];
            var Q = array[2];
            for (int i = 0; i < M; i++)
            {
                var line = ReadIntArray();
                var L = line[0];
                var R = line[1];
                trains.Add(new Kukan(L, R));
            }
            trains.OrderBy(x=>x.L);
            for (int i = 0; i < Q; i++)
            {
                var lineq = ReadIntArray();
                var p = lineq[0];
                var q = lineq[1];
                long count = 0;
                var left = 0;
                while(trains[left].L < p)
                {
                    left++;
                }
                for (int j = left; j<M && trains[j].L <= q; j++)
                {
                    if (trains[j].R <= q) count++;
                }
                WriteLine(count);
            }
        }
    }
    struct Kukan
    {
        public Kukan(int l, int r)
        {
            L = l;
            R = r;
        }
        public int L,R;
    }
    public static class Util
    {
        /// <summary>
        /// 標準入力をint型にパースする
        /// </summary>
        /// <returns></returns>
        public static int ReadInt()
        {
            return int.Parse(ReadLine());
        }
        /// <summary>
        /// 標準入力をint型の配列にする
        /// </summary>
        /// <returns></returns>
        public static int[] ReadIntArray()
        {
            return ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        }
        /// <summary>
        /// 標準入力をlong型にパースする
        /// </summary>
        /// <returns></returns>
        public static long ReadLong()
        {
            return long.Parse(ReadLine());
        }
        /// <summary>
        /// 標準入力をlong型の配列にする
        /// </summary>
        /// <returns></returns>
        public static long[] ReadLongArray()
        {
            return ReadLine().Split(' ').Select(long.Parse).ToArray();
        }
        /// <summary>
        /// 一定値の数列を生成する
        /// </summary>
        /// <param name="value"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        public static IEnumerable<long> ConstSeq(long value, long length)
        {
            for (int i = 0; i < length; i++)
            {
                yield return value;
            }
        }
        /// <summary>
        /// int配列の累積和を求める
        /// </summary>
        /// <param name="array"></param>
        /// <returns></returns>
        public static IEnumerable<int> CumulativeSum(IEnumerable<int> array)
        {
            int tmp = 0;
            foreach (var num in array)
                yield return tmp += num;
        }
        /// <summary>
        /// long配列の累積和を求める
        /// </summary>
        /// <param name="array"></param>
        /// <returns></returns>
        public static IEnumerable<long> CumulativeSum(IEnumerable<long> array)
        {
            long tmp = 0;
            yield return tmp;
            foreach (var num in array)
                yield return tmp += num;
        }
        /// <summary>
        /// 最大公約数をユークリッドの互除法で求める
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static long Gcd(long a, long b)
        {
            return b == 0 ? a : Gcd(b, a % b);
        }
        /// <summary>
        /// 最小公倍数を求める
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static long Lcm(long a, long b)
        {
            return a * b / Gcd(a, b);
        }
    }
}