#K79987. Pixel Frequency Counter
Pixel Frequency Counter
Pixel Frequency Counter
Given a grayscale image represented as a matrix of pixel values, your task is to compute the frequency of each pixel value. The image is given as a 2D array where each element is an integer between 0 and 255. Formally, if the image is represented by a matrix \(A\) of size \(n \times m\), for every pixel value \(p\) you need to calculate the count of occurrences of \(p\) in the matrix.
The input is read from standard input (stdin) and the output should be printed to standard output (stdout).
inputFormat
The first line of input contains two integers \(n\) and \(m\) (where \(1 \le n,m \le 1000\)), representing the number of rows and columns respectively. Each of the following \(n\) lines contains \(m\) integers, denoting the pixel values of the image.
outputFormat
Output each unique pixel value and its frequency, one per line. The pixel values must be printed in ascending order, and for each line, the pixel value and its frequency should be separated by a single space.
## sample1 1
0
0 1