class Solution: def pickGifts(self, gifts: List[int], k: int) -> int: for _ in range(k): m = max(gifts) gifts[gifts.index(m)] = int(m**(1/2)) return sum(gifts)