#C11106. Find Missing IDs in a Sequence

    ID: 40386 Type: Default 1000ms 256MiB

Find Missing IDs in a Sequence

Find Missing IDs in a Sequence

You are given a range of consecutive IDs from \(start\) to \(end\) (both inclusive) and a list of IDs that are available. Your task is to find all the missing IDs in the sequence. The missing IDs are the ones that are present in the full range but not in the given available list.

Input: The first line contains two integers, \(start\) and \(end\). The second line contains an integer \(n\) representing the number of available IDs. If \(n > 0\), the third line contains \(n\) space-separated integers representing the available IDs.

Output: Print the missing IDs in sorted order separated by a space. If there are no missing IDs, output an empty line.

Example:

Input:
1000 1005
4
1000 1002 1003 1005

Output: 1001 1004

</p>

inputFormat

The input is read from standard input (stdin) with the following format:

  • First line: Two integers \(start\) and \(end\), separated by a space.
  • Second line: An integer \(n\) denoting the count of available IDs.
  • Third line (only if \(n > 0\)): \(n\) space-separated integers representing the available IDs.

outputFormat

Output the missing IDs separated by a single space in ascending order on one line. If there are no missing IDs, output an empty line.

## sample
1000 1005
4
1000 1002 1003 1005
1001 1004