Company: Grow_2july
Difficulty: medium
Variable Market Problem Description There is a rush for crypto stocks in the variable market, and every purchase goes through a single pipeline. The requested amounts of N persons are placed in the pipeline in order: the 1st person's amount first, then the 2nd person's amount, and so on. Stock purchases are taxed at a fixed, growing rate. The 1st transaction is taxed K , the 2nd is taxed K + Y , the 3rd is taxed K + 2Y , and in general the t -th transaction is taxed K + (t - 1) * Y . The amount at the front of the pipeline is always the one being bought. While that purchase is being processed, the amounts behind it shuffle: Number the amounts currently in the pipeline 1, 2, ..., m from front to back. Position 1 is the amount being bought. Going from front to back, compare the pair at positions (2, 3) , then the pair at positions (3, 4) , and so on up to the pair at positions (m - 1, m) . For each such pair, if the right amount is strictly greater than the left amount, swap the two amou