#K49492. Taco Dock Management

    ID: 28654 Type: Default 1000ms 256MiB

Taco Dock Management

Taco Dock Management

This problem involves managing docking operations at a port with multiple docks. There are \( M \) docks available. You will be given \( P \) queries, and each query is an operation on a dock.

The operations are as follows:

  • 1 x: A ship docks at dock \( x \).
  • 2 x: A ship departs from dock \( x \).
  • 3 x: Query the number of ships currently docked at dock \( x \).

The docks are 1-indexed. For each query of type 3, output the current number of ships at the specified dock. Mathematically, let \( c_x \) represent the number of ships at dock \( x \). Then for a query of type 1, update \( c_x = c_x + 1 \); for type 2, update \( c_x = c_x - 1 \); and for type 3, output \( c_x \>.

inputFormat

The first line contains two integers ( M ) and ( P ), where ( M ) is the number of docks and ( P ) is the number of queries. Each of the following ( P ) lines contains two integers: ( op ) and ( x ), representing the operation type and the dock number respectively.

outputFormat

For each query of type 3, output the number of ships currently docked at dock ( x ) on a new line.## sample

5 7
1 2
1 3
1 3
3 3
2 3
3 3
3 2
2

1 1

</p>