SP21347 TULIPNUM - Tulip And Numbers

Description

Little Tulip recently learnt about how to write numbers. So she wrote some numbers in a paper in a line. But she never wrote a number which is less than the prevous one. Now she want to know how many different numbers are in a given range. In short, you are given an array of N integers indexed from 1 to N, and q queries, each in the form i j, you have to find the number of distinct integers from index i to j (inclusive).

Input Format

Input starts with an integer T ( The first line of a case is a blank line. The next line contains two integers N (1

Output Format

For each test case, print the case number in a single line. Then for each query you have to print a line containing number of distinct integers from index i to j.