You've been asked to program a bot for a popular bank that will automate the management of incoming requests. Every request has its own timestamp in seconds, and it is guaranteed that all requests come sequentially, i.e. the timestamp is strictly increasing.
There are two types of incoming requests:
Your system should also handle invalid requests. There are two types of invalid requests:
For the given list of initial balances and requests, return the state of balances straight after the last request has been processed, or an array of a single element [-<request_id>], where <request_id> is the 1-based index of the first invalid request (please note the minus sign), where <request_id> is the 1-based index of the first invalid request. Note that cashback requests which haven't happened before the last request should be ignored.