TikTok Reel Impact (TikTok AMS)
In the dynamic landscape of TikTok, creators are in a constant race to boost their videos' engagement by leveraging new features that enhance their content.
Each creator starts with a set of m videos, represented by initialReelImpacts, which indicates the baseline popularity of each reel. For the next n days, TikTok releases new trending features, represented by newReelImpacts, with each feature offering an additional boost to the creator's existing reels.
PROCESS FOR EACH DAY:
newReelImpacts[i] (where 0 ≤ i < n) to their current reels.k-th most impactful reel is selected based on its popularity.
NOTE:
The initial impact score of the creator is the k-th highest impact value from the initial set of initialReelImpacts.
Complete the function getTotalImpact in the editor below.
PARAMETERS:
int initialReelImpacts[m]: The impact of initialmreels.int newReelImpacts[n]: The impact of the newnreels that appear one by one.int k: The fixed choice made by the creator, representing the position of the most impactful reel selected.
RETURNS:
long: The total impact achieved by the creator after incorporating all elements from newReelImpacts.
1Example 1

Impact score = 2
Over the next n days:
Day 1: Append 4. Current reels: [2, 3, 4]. The 2nd highest impact is 3.
Impact score = 2 + 3 = 5
Day 2: Append 5. Current reels: [2, 3, 4, 5]. The 2nd highest impact is 4.
Impact score = 5 + 4 = 9
Day 3: Append 1. Current reels: [1, 2, 3, 4, 5]. The 2nd highest impact is 4.
Impact score = 9 + 4 = 13
Constraints
Limits and guarantees your solution can rely on.