#C13246. Count Even Occurrences
Count Even Occurrences
Count Even Occurrences
You are given a list of integers. Your task is to count the occurrences of each integer and output a dictionary (or map) that only includes those integers whose frequency is even. In other words, for each integer x appearing in the list, if its count satisfies \(count(x) \mod 2 = 0\), then include it in the output.
Input Format: The first line contains a single integer \(N\) representing the number of elements in the list. The second line contains \(N\) space-separated integers.
Output Format: Print a dictionary (or map) in the format {key: value, ...}
where each key
is an integer that appears an even number of times and its corresponding value
is the frequency count. The keys should be output in increasing order.
Example:
Input: 9 10 20 20 10 10 30 50 10 20</p>Output: {10: 4}
inputFormat
The input begins with an integer \(N\) (\(0 \leq N \leq 10^5\)), followed by a line containing \(N\) space-separated integers. Each integer can be positive, negative, or zero.
outputFormat
Output a dictionary (or map) that contains only those integers whose occurrence frequency is even. The dictionary should be printed in the format {key: value, ...}
with the keys sorted in increasing order. If no integer has an even frequency, output an empty dictionary: {}
.
0
{}