#K50857. Processing Account Transactions
Processing Account Transactions
Processing Account Transactions
You are given (N) accounts, each starting with a balance of 0. Then, you will process (M) transactions. Each transaction consists of two integers: a 1-indexed account number and an amount to add (which may be negative). After processing all transactions, output the final balance of each account on separate lines.
For example, consider (N=6) and (M=4) with the following transactions:
- Account 1: +100
- Account 2: -50
- Account 3: +75
- Account 1: -25
inputFormat
The first line contains two integers (N) and (M) separated by a space, representing the number of accounts and the number of transactions respectively. The next (M) lines each contain two integers: the account number (1-indexed) and the transaction amount.
outputFormat
Output (N) lines. Each line should contain the final balance of the corresponding account after processing all transactions.## sample
6 4
1 100
2 -50
3 75
1 -25
75
-50
75
0
0
0
</p>