Given vector Z and an index vector I (which may contain repeats), add 1
to Z at each index in I for every time that index occurs (so an index repeated
3 times adds 3). Return the result.
Input
Z = [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]
I = [1 1 2 3 3 3 9]
Output
[1. 3. 2. 4. 1. 1. 1. 1. 1. 2.]