Bird Watching

AtCoder
IDabc434_b
Time2000ms
Memory256MB
Difficulty
There are $N$ birds of $M$ types flying in the sky. The bird types are numbered $1,2,\dots,M$. The $N$ birds are numbered $1,2,\dots,N$, and bird $i$ is of type $A_i$ and has size $B_i$. For every $k=1,2,\dots,M$, find the average size of the flying birds of type $k$. It is guaranteed that for every $k=1,2,\dots,M$, there is at least one bird of type $k$ flying. ## Constraints * $1 \le M \le N \le 100$ * $1 \le A_i \le M$ * $1 \le B_i \le 100$ * There exists at least one bird of type $k$ ( $1 \le k \le M$ ). * All input values are integers. ## Input The input is given from Standard Input in the following format: $N$ $M$ $A_1$ $B_1$ $A_2$ $B_2$ $\vdots$ $A_N$ $B_N$ [samples]
Samples
Input #1
10 5
4 92
1 16
3 77
4 99
2 89
3 8
1 40
5 56
1 40
4 77
Output #1
32.00000000000000000000
89.00000000000000000000
42.50000000000000000000
89.33333333333333333333
56.00000000000000000000

*   The average size of birds of type $1$ is $(16+40+40)/3 = 32$.
*   The average size of birds of type $2$ is $89$.
*   The average size of birds of type $3$ is $(77+8)/2 = 42.5$.
*   The average size of birds of type $4$ is $(92+99+77)/3 \approx 89.3333$.
*   The average size of birds of type $5$ is $56$.
API Response (JSON)
{
  "problem": {
    "name": "Bird Watching",
    "description": {
      "content": "There are $N$ birds of $M$ types flying in the sky.   The bird types are numbered $1,2,\\dots,M$.   The $N$ birds are numbered $1,2,\\dots,N$, and bird $i$ is of type $A_i$ and has size $B_i$. For every",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc434_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "There are $N$ birds of $M$ types flying in the sky.  \nThe bird types are numbered $1,2,\\dots,M$.  \nThe $N$ birds are numbered $1,2,\\dots,N$, and bird $i$ is of type $A_i$ and has size $B_i$.\nFor every...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments