2 cases are correct but third giving WA

https://www.codechef.com/viewsolution/72114669

@im_dj318 - fyi

if you give multiple test cases - your code is failing.

2
3
3 3 4
5
1 1 1 1 1

Earlier the map was declared globaly.
This time I corrected it and declare inside int main()

Then also the result is WA
Please give the failed test cases

https://www.codechef.com/viewsolution/72122562