Problem in set approach?

i am solving this problem using sets, but I am getting error in tc 1 , please help
code ide - https://ide.codingblocks.com/s/205402

@debyian
hello divyansh,
use multiset in place of set