# 50073. Wealth Histogram

## I'm a slow walker, but I never walk backwards.

Read a set of $N$ records from a binary file and make a histogram. The name of the file will be given as a command line argument. Each record has a name and an integer $W$ indicating his/her wealth. Now divide these records into a set of B buckets, where the first bucket has the records of wealth from $1$ to $999$, and the second bucket has the wealth from $1000$ to $1999$, and so on. Now output the number of people in non-empty buckets in increasing bucket index order. Note that you cannot declare an array to store the number of people in buckets because the distribution of wealth might be very uneven and most of the buckets may not have records.

Also you need to report the following statistics. First, report the poorest person in the file. If there are multiple of them, report the one with his/her name in the earliest dictionary order. Similarly report the wealthiest person in the file. If there are multiple of them, report the one with his/her name in earliest dictionary order. Finally report the median of the wealth. The median $m$ of a sequence of $N$ wealth (where $N$ is an odd number) is that both the numbers of wealth greater/smaller than m are the same. If $N$ is even, then the medium is the average (Integer Division) of the middle two wealth in sorted order.

## Hint

An easy way is to sort the numbers so that you can scan through them in increasing order.
Note that you need to use long long int to prevent overflow when the medium is the average of the middle two wealth.

## Input Format

1./a.out [file_name]


The name of the binary file is given as a command line argument (You can reference the textbook chapter 21) , The file contains a set of $N$ records, you need to read the records till EOF.
Each record contains a 12-byte string ('\0' included), and a 4-byte integer.
0 $\lt$ N $\leqslant$ $1024.$
Length of a person's name $= 12.$ (null terminator '\0' included)
The name of a person are all lowercase letters without whitespace.
0 $\lt$ W $\leqslant$ $2,147,483,647.$

## Output Format

Print the number of people in non-empty buckets in increasing bucket index order, the poorest person's name, the wealthiest person's name, and the median of the wealth on separate lines.

## Sample Input

./a.out p10163-0.bin


The content of the binary file p10163-0.bin

laurawaneda 9584178brookholden 276087jamescorwin 91536tonywinslow 7582louisdarell 115862kerstentami 7151callistalex 605497brettmarion 712997marcibrande 91412skylardella 605965aurakendall 91786lavernjenae 9584178lycakrysten 340673emiyamickey 605256keliaraylen 7151


## Sample Output

33111312keliaraylenlaurawaneda276087