#C10652. Total City Package Weights

    ID: 39881 Type: Default 1000ms 256MiB

Total City Package Weights

Total City Package Weights

In this problem, you are given (M) cities and (C) packages. Each package is associated with a specific city and has a weight. Your task is to compute the total weight delivered to each city. Formally, for a city (i) (where (1 \le i \le M)), the total weight is given by: (\text{weight}i = \sum{(i, w) \in packages} w). Note that if a city does not receive any package, its total weight is (0).

inputFormat

The input is provided via stdin. The first line contains two integers (M) and (C), representing the number of cities and the number of packages respectively. Each of the following (C) lines contains two space-separated integers: the first integer is the city index (1-indexed) and the second integer is the weight of the package.

outputFormat

Output a single line to stdout containing (M) integers. The (i)-th integer represents the total weight delivered to city (i). The weights should be separated by a single space.## sample

5 4
3 500
2 300
4 700
1 200
200 300 500 700 0

</p>