HOW TO SOLVE THIS?

n is always the multiple of 4. You have to select 4 numbers out of n and choose the second minimum number from the four numbers ,like that you have to add all the chosen numbers and find maximum out of it.

consider an example:
n=8
1 4 5 6 8 2 1 4
ans=7.
How?
first i will select 1 5 6 8 second minimum is 5
second i will select 1 4 2 4 second minimum is 2
maximum sum=5+2=7

next example-
n=8
1 3 3 4 2 3 4 3
ans=6
How?
first i will select 1 4 3 3 second minimum is 3
second i will select 2 3 4 3 second minimum is 3
maximum sum=3+3=6.

Source

hackwithinfy 2020 round 2

my approach was to sort it first and find the second minimum by changing ranges and in that way find the maximum( a kind of brute force in a greedy way)–
consider the sorted elements like
1 2 3 4 5 6 7 8 9 10 11 12
first i selected first four elements
second i selected first four elements starting from second and finally merge the left out elements like 1 10 11 12
than from 3rd

but i am not sure if it gives AC or not .
so need some help from you guys.