#C305. Queue Implementation

    ID: 46434 Type: Default 1000ms 256MiB

Queue Implementation

Queue Implementation

Implement a fixed-size queue supporting the operations enqueue, dequeue, front, is_empty, is_full, and size. When the queue is full, an attempt to add an element (via enqueue) should output an error message: Queue is full. Similarly, if the queue is empty, any attempt to remove an element (via dequeue) or to view the front element (via front) should output Queue is empty.

The queue has a limited capacity \( limit \) and its current size is \( size \). An error occurs when \( size \geq limit \) during an enqueue, and when \( size = 0 \) during a dequeue or front access.

inputFormat

The first line contains an integer representing the capacity of the queue. The second line contains an integer Q, the number of commands to process. Each of the following Q lines contains a command. Commands are in one of the following forms:

- enqueue x: Add integer x to the queue. If the queue is full, print Queue is full.
- dequeue: Remove and print the element at the front of the queue. If the queue is empty, print Queue is empty.
- front: Print the front element of the queue without removing it. If the queue is empty, print Queue is empty.
- is_empty: Print True if the queue is empty, otherwise print False.
- is_full: Print True if the queue is full, otherwise print False.
- size: Print the number of elements currently in the queue.

outputFormat

For commands that produce an output (dequeue, front, is_empty, is_full, and size), print the result on a separate line. The enqueue command produces an output only if it results in an error (Queue is full).

## sample
3
5
enqueue 1
enqueue 2
enqueue 3
enqueue 4
size
Queue is full

3

</p>