Implement `SnapshotArray`, an array-like structure that can take snapshots.
- `SnapshotArray(int length)` creates an array of the given length where every element starts as 0.
- `void set(index, val)` sets the element at `index` to `val`.
- `int snap()` takes a snapshot and returns its `snap_id`, which is the total number of times `snap()` has been called minus 1.
- `int get(index, snap_id)` returns the value that `index` held when the snapshot `snap_id` was taken.