GO || without priority_queue
\n\nfunc max64(a, b int64) int64 {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}\nfunc findMaximumElegance(items [][]int, k int) int64 {\n    sort.Slice(items
\n```\nfunc max64(a, b int64) int64 {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}\nfunc findMaximumElegance(items [][]int, k int) int64 {\n    sort.Slice(items, func (i,j int) bool{\n        return items[i][0]>items[j][0]\n    })\n\n    mp := make(map[int]int)\n\n    sum := int64(0)\n    for i:=0; i<k; i++{\n        sum += int64(items[i][0])\n        mp[items[i][1]]++\n    }\n\n    different := len(mp)\n    ans := sum + (int64(different)*int64(different))\n\n\n    ItemsLeft := k-1 \n    for i:= k; i<len(items); i++{\n        if mp[items[i][1]] > 0 {\n            continue\n        }\n\n        for ItemsLeft>=0 {\n            smallestItem , smallestItemCat := items[ItemsLeft][0], items[ItemsLeft][1]\n            ItemsLeft--;\n            if mp[smallestItemCat] > 1{\n                sum -= int64(smallestItem)\n                sum += int64(items[i][0])\n\n                mp[smallestItemCat]--\n                mp[items[i][1]]++\n\n                d := len(mp)\n                ans = max64(ans, sum + (int64(d)*int64(d)))\n                break\n            }\n        }\n    }\n    return ans\n}\n\n```
['Go']