#K76747. Calculate Total Plant Growth
Calculate Total Plant Growth
Calculate Total Plant Growth
You are given (P) plants. For each plant, you are provided with its initial height (H_i) and a series of daily growth changes. The final height for a plant is computed as (H_i + \sum_{j=1}^{D} dh_j), where (D) is the number of growth records and (dh_j) is the change in height on the j-th day. Your task is to compute the final height for each plant.
inputFormat
The input is given via standard input (stdin). The first line contains an integer (P) denoting the number of plants. For each plant, the following lines are provided: (D) (H_i) (two integers on one line, where (D) is the number of daily records and (H_i) is the initial height), followed by (D) lines, each with a date (string, which is not used in calculations) and an integer (dh) (the change in height for that day).
outputFormat
Output to standard output (stdout) a single line with (P) integers separated by a space, each representing the final height of the corresponding plant.## sample
2
3 10
2023-01-01 5
2023-01-02 -3
2023-01-03 7
2 20
2023-01-01 2
2023-01-02 -5
19 17