Account
Draft saved on this device
▤ DescriptionOriginal CppValley problem
ConcurrencyEasy

Detect Duplicate Task Completion Events

An execution log records completed task IDs.

An execution log records completed task IDs. Each task should be completed once. Print the number of repeated completion events (the second and every later occurrence of the same ID).

Input format

First line N; next N integers are completed task IDs.

Output format

Print the number of duplicate completion events.

Examples

Example 1
Input
6
1 2 1 3 2 1
Expected output
3

Constraints

  • 0 ≤ N ≤ 100000
  • 1 ≤ id ≤ 10^9

Related concepts

Task Lifecycle

This early-access exercise uses standard input/output. More advanced concurrency challenges will use specialized class interfaces, instrumentation, and stress tests once the judging infrastructure is ready.

⌘ CodeC++17
GNU C++17 · main.cpp

Loading Monaco C++ editor…

Checking judge...

Checking whether the external C++ judge is available.

⌁ Test cases & resultsPublic samples: 1
Input
6
1 2 1 3 2 1
Expected output
3
Execution requires a secure external judge.