Problem:
 Score : 300 points    Problem Statement There are 3N participants in AtCoder Group Contest .
The strength of the i -th participant is represented by an integer a_i .
They will form N teams, each consisting of three participants.
No participant may belong to multiple teams.  The strength of a team is defined as the second largest strength among its members.
For example, a team of participants of strength 1 , 5 , 2 has a strength 2 , and a team of three participants of strength 3 , 2 , 3 has a strength 3 .  Find the maximum possible sum of the strengths of N teams.      Constraints  1 ≤ N ≤ 10^5  1 ≤ a_i ≤ 10^{9}  a_i are integers.         Input Input is given from Standard Input in the following format:  N  a_1  a_2  ...  a_{3N}       Output Print the answer.        Sample Input 1 2
5 2 8 5 1 5      Sample Output 1 10  The following is one formation of teams that maximizes the sum of the strengths of teams:   Team 1 : consists of the first, fourth and fifth participants.  Team 2 : consists of the second, third and sixth participants.        Sample Input 2 10
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000      Sample Output 2 10000000000  The sum of the strengths can be quite large.

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
ans = 0
for i in range(n):
    ans += a[2*i+1]
print(ans)

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

from collections import Counter
def resolve():
    N,=pin()
    A=lispin()
    A.sort()
    
    temp=0
    for i in range(N*2):
        t=A.pop()
        if i%2:temp+=t
    print(temp)

resolve()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0

ans = sum(A[1:2*N:2])
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

print(sum(a[1:2*n:2]))

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    l.sort(reverse=True)
    ans=0
    print(sum(l[1:2*n:2]))
resolve()

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a.sort()
maxsum = 0
for i in range(1,n+1):
  maxsum += a[len(a)-2*i]
print(maxsum)

Solution (Python):
n = int(input())
l = sorted(list(map(int, input().split())), reverse=True)
print(sum(l[1:2*n:2]))

Solution (Python):
n=int(input())
a=sorted(list(map(int, input().split())), reverse=True)
print(sum(a[1:2*n:2]))

Solution (Python):
n=int(input())
a=list(map(int, input().split()))
a.sort(reverse=True)
print(sum(a[1:2*n:2]))

Solution (Python):
n=int(input())
a=list(map(lambda x: int(x), input().split()))
a.sort(reverse=True)
print(sum(a[1:2*n:2]))

Solution (Python):
def main():
    N=int(input())
    a=sorted([int(_) for _ in input().split()])[::-1]
    print(sum(a[1:2*N+1:2]))
main()

Solution (Python):


n = int(input())
nums = [int(i) for i in input().split()]
nums.sort()
nums = nums[n:]

ans = 0
for i in range(0, len(nums), 2):
    ans += nums[i]
print(ans)

Solution (Python):
n = int(input())

s = list(map(int,input().split()))

s.sort(reverse = True)

ans = 0

for i in range(1,2*n+1,2):
    ans += s[i]
    
print(ans)

Solution (Python):
from collections import deque

n = int(input())
A = deque(sorted(map(int, input().split())))

def I_forgot_my_friends_birthday_sorry():
    for _ in range(n):
        A.popleft()
        A.pop()
        yield A.pop()

print(sum(I_forgot_my_friends_birthday_sorry()))

Solution (Python):
n = int(input())
a = sorted(map(int,input().split()),reverse=True)
ans = 0
t = (n*3)//3
cnt = 0
i = 1 
while cnt<t:
    cnt += 1
    ans += a[i]
    i += 2
print(ans)

Solution (Python):

def datain(num):

    data = []
    iscnt = True

    while iscnt:
        for val in map(int,input().split()):
            data.append(val)
            if len(data) == num:
                iscnt = False
                break
        
    return data

num = int(input())
data = datain(num*3)
data.sort()
ans = 0

for i in range(num*3-2,num-1,-2):
    
    ans += data[i]


print(ans)

Solution (Python):
N = int(input())
a = sorted(list(map(int, input().split())))

print(sum(a[-2 * (i+1)] for i in range(N)))

Solution (Python):



import sys





def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(eachPoints):
    result = 0
    menbers = len(eachPoints)
    group = menbers // 3
    eachPoints.sort(reverse=False)

    useSkillList = []
    
    for ui in range(group, menbers, +1):
        useSkillList.append(eachPoints[ui])

    
    
    
    
    
    for sum2pos in range(0, len(useSkillList), +2):
        result = useSkillList[sum2pos] + result
    return result


if __name__ == "__main__":
    _ = II()
    AI = LI()
    print("{}".format(solver(AI)))

Solution (Python):
n,*a=map(int,open(0).read().split())
print(sum(sorted(a)[n:-1:2]))

Solution (Python):


def main():
    N, *a = map(int, open(0).read().split())

    a.sort(reverse = True)
    s = 0
    for i in range(N):
        s = s + a[2*i + 1]
    print(s)


main()

Solution (Python):
n = int(input())
a = list(map(int,input().split()))

a = sorted(a,reverse=True)
ans = 0
for i in range(n):
    ans += a[2*i+1]
print(ans)

Solution (Python):
import collections
n = int(input())
*a, = map(int, input().split())
a.sort()
a = collections.deque(a)
ans = 0
while n:
    a.popleft()
    a.pop()
    ans += a.pop()
    n -= 1
print(ans)

Solution (Python):
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  
    a_arr = list(map(int,_in[1].split(' ')))
    
    a_arr.sort(reverse=True)
    cnt = sum(a_arr[1:2*N:2])
    
    print(cnt)

Solution (Python):
n = int(input())
a = sorted(list(map(int, input().split())), )
sum = 0
for i in range(n, 3*n, 2):
    sum += a[i]
print(sum)

Solution (Python):
def resolve():
    
    n = int(input())
    
    
    
    
    
    A = list(map(int, input().split()))
    
    

    Asort = sorted(A)

    sumMed = 0
    for i in range(n):
        sumMed += Asort[n + i * 2]

    print(sumMed)

resolve()

Solution (Python):
n = int(input())
a = sorted(list(map(int,input().split())), reverse=True)
ans = 0
for i in range(n):
    ans += a[1+2*i]
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n = int(input())
a = list( map(int, input().split()))

a.sort(reverse=True)

ans = 0
for i in range(n*2):
    if i%2==1: ans += a[i]
print(ans)

Solution (Python):
n = int(input())
l = map(int,input().split())

l = sorted(l,reverse=True)

l2 = []

for i in range(1,2*n+1,2):
    l2.append(l[i])
    

print(sum(l2))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
for i in range(1, 2*N, 2):
  ans += A[i]
print(ans)

Solution (Python):
n = int(input())
A = list(map(int,input().split()))
A.sort()
B = A[n:n*2]
C = A[-2:-2-n*2:-2]
D = A[1:n*3+1:3]

ans = max(sum(B), sum(C), sum(D))
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = 0
a.sort(reverse=True)
for i in range(1, 2*n, 2):
    ans += a[i]
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
print(sum(a[1:n*2:2]))

Solution (Python):
import sys

input = sys.stdin.readline
MOD = 1000000007

N = int(input())

a = list(map(int,input().split()))

a.sort(reverse=True)


res = 0

cnt = 0
i = 1
while (cnt < len(a)//3)  :
    res += a[i]
    i += 2
    cnt+=1

print(res)

Solution (Python):
n = int(input())
a_inputs = sorted([int(i) for i in input().split()])

k_num = len(a_inputs)



print(sum([a_inputs[i] for i in range(n,k_num,2)]))

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)

ans = sum(a[2*i-1] for i in range(1,N+1))
print(ans)

Solution (Python):
import sys

def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))

def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]

def to_bin(x: int) -> str: return format(x, 'b') 
def to_oct(x: int) -> str: return format(x, 'o') 
def to_hex(x: int) -> str: return format(x, 'x') 
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]

from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left


def main():
    n = II()
    aa = MII()
    aa.sort(reverse=True)
    print(sum(aa[1:2*n:2]))
    

if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
A=[int(a) for a in input().split()]
A.sort(reverse=True)
print(sum(A[2*i-1] for i in range(1,N+1)))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

a.sort()
ans = 0
for i in range(N, 3*N, 2):
    ans += a[i]
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(n):
    ans += a[-(i+1)*2]
print(ans)

Solution (Python):
N = int(input())
lis = list(map(int,input().split()))
lis.sort(reverse = True)
print(sum(lis[1:2*N:2]))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort()
ans, cnt = 0, 0
for i in range(3 * N - 2, -1, -2):
    cnt += 1
    ans += a[i]
    if(cnt == N): break
print(ans)

Solution (Python):
N=int(input())
a=input().split()
a=[int(x) for x in a]
a.sort(reverse=True)
s=0
for i in range(N):
    s+=a[2*i+1]

print(s)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a = sorted(a, reverse=True)

res = 0
for i in range(2*n):
	if i %2 == 1:
		res += a[i]

print(res)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(2, n * 2 + 1, 2):
    ans += a[-i]

print(ans)

Solution (Python):
def main():
    N = int(input())  
    a = list(map(int, input().split()))  

    answer = 0
    a.sort(reverse=True)

    for i in range(1, 2*N,2):
        answer += a[i]


    print(answer)

if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=1)
ans=sum(a[1:(n*2):2])
print(ans)

Solution (Python):
N = int(input())
a = input().split()
a_i = [int(s) for s in a]
a_i.sort(reverse=True)
result = 0
for i in range(1,2 * N,2):
    result += a_i[i]
print(result)

Solution (Python):
def main():
    N = int( input())
    A = list( map( int, input().split()))
    A.sort()
    print( sum(A[N::2]))
if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
A =list(map(int,input().split()))
A.sort(reverse = True)
print(sum(A[1:2*n:2]))

Solution (Python):

n = int(input())
s = list(map(int, input().split()))
score = sorted(s, reverse=True)
ans = 0

for i in range(n):
    ans += score[2 * i + 1]

print(ans)

Solution (Python):
n = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
ans = 0
for i in range(n):
    ans += A[2*i+1]
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)
print(sum(max(a[n:2*n], [a[2*i+1] for i in range(n)])))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
a_m = a[1::2]
ans = 0
for i in range(N):
    ans += a_m[i]
print(ans)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
print(sum(A[1:2*N:2]))

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
print(max(sum(A[N:2*N]),sum(A[1:2*N:2])))

Solution (Python):
import itertools
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
print(sum(a[1:2*n:2]))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort()
sumnum = 0
for i in range(N*3-1-1, N-1, -2):
    sumnum += a[i]

print(sumnum)

Solution (Python):
n=int(input())
l=sorted(list(map(int,input().split())),reverse=0)
print(sum(l[n::2]))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(N,3*N,2):
    ans += a[i] 
print(ans)

Solution (Python):
N=int(input())
A=sorted(list(map(int,input().split(' '))),reverse=True)
print(sum(A[1:2*N:2]))

Solution (Python):
n=int(input())
a = list(map(int, input().split()))
a.sort()
print(sum(a[n::2]))

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()
n = int(input())
a = list(map(int, input().split()))

a = sorted(a, reverse=True)

cnt = 0
ans = 0
for i in range(len(a)):
    if i % 2 == 1:
        ans += a[i]
        cnt += 1
    if cnt == n:
        break
print(ans)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 0
for i in range(N):
    ans += A[3*N-(i+1)*2]
print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A_tmp = sorted(A)
Cnt = 0
for i in range(1,N+1):
  Cnt +=A_tmp[3*N-2*i]
print(Cnt)

Solution (Python):
import sys
import time
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    A.sort(reverse=True)
    ans = 0
    for i in range(N):
        ans += A[2*i +1]
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
t=int(len(a)-(len(a)/3))
a.sort(reverse=True)
a_cutlist=a[:t+1]
a_cutlist_ans=a_cutlist[1::2]
print(sum(a_cutlist_ans))

Solution (Python):
n = int(input())
a = list(map(int, input().split())) 

a.sort(reverse=True)

ans = 0

for i in range(n*2):
    if i%2 == 1:
        ans += a[i]

print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = sorted(list(map(int, input().split())))
    res = 0
    for i in range(n):
        res += A[-(i + 1) * 2]

    print(res)


if __name__ == '__main__':
    resolve()

Solution (Python):
N=int(input())
mylist=list(map(int,input().split()))
point=0

mylist.sort(reverse=True)



for i in range(N):
    point+=mylist[2*i+1]
    
print(point)

Solution (Python):
from statistics import median


from fractions import gcd
from itertools import combinations 
from collections import deque
from collections import defaultdict
import bisect










import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    A = readInts()
    
    A = sorted(A)
    
    ans = 0
    
    for i in range(len(A)-2,len(A)-2*n-1,-2):
        
        ans += A[i]
    print(ans)
if __name__ == '__main__':
  main()

Solution (Python):
n = int(input())
a = sorted(list(map(int,input().split())),reverse=True)
ans = 0
for i in range(n):
    ans += a[i*2+1]
print(ans)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
a.sort(reverse= True)
ans =0
for n in range(1,N+1):
	ans = ans+a[2*n-1]
print(ans)

Solution (Python):
n = int(input())
a = sorted(map(int, input().split()))
ans = 0
l = 0
r = 3*n-1
while l < r:
    ans += a[r-1]
    l += 1
    r -= 2
    

print(ans)

Solution (Python):
N = int(input())
print(sum(sorted(list(map(int,input().split())))[::-1][1:2*N:2]))

Solution (Python):
N = int(input())
a = list(map(int,input().split()))

sort_a = sorted(a, reverse=True)

strong = 0
for i in range(N):
    strong += sort_a[2*i+1]

print(strong)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
print(sum(a[1:-n:2]))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
ans = 0
for i in a[1:-n:2]:
    ans += i
print(ans)

Solution (Python):
n=int(input())
a=list(map(int, input().split()))
a.sort()
print(sum(a[n::2]))

Solution (Python):
n, *a = map(int, open(0).read().split())
print(sum(sorted(a)[-2:n-1:-2]))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(1,N+1):
    ans += a[-2*i]
print(ans)

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]

a.sort(reverse=True)

print(sum(a[1:2*n:2]))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

A.sort()
ans = 0
for i in range(1,N+1):
    ans += A[-(2*i)]

print(ans)

Solution (Python):
from sys import stdin
import math

N = int(stdin.readline().rstrip())
a = list(map(int, stdin.readline().rstrip().split()))

a_sorted = sorted(a)
total = 0
for i in range(N*1, N*3, 2):
    total += a_sorted[i]

print(total)

Solution (Python):
import sys

n = int(sys.stdin.readline().rstrip())
a = list(map(int, sys.stdin.readline().rstrip().split()))
a.sort()


ans = 0
a = a[n:]
a.reverse()
print(sum(a[1::2]))

Solution (Python):

N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
ans = 0
for i in range(2*N):
    if i%2==1:
        ans+=A[i]
print(ans)

Solution (Python):

n = int(input())
a = [int(i) for i in input().split()]

ans = 0
a.sort(reverse = True)
for i in range(1, 2*n+1, 2):
    
    ans += a[i]
print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
sort_A = sorted(A, reverse=True)
sumA = 0

for x in range(N):
    sumA += sort_A[2 * x + 1]
print(sumA)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a.sort()

print(sum(a[n:3*n-1:2]))

Solution (Python):
N=int(input())
a=list(map(int, input().split()))
a.sort(reverse=True)
sum=0
for i in range(N):
  sum+=a[1+2*i]
print(sum)

Solution (Python):


from collections import deque,Counter













N = int(input())
arrA = list(map(int,input().split()))

arrA.sort()
A = arrA[N:]

ans = sum(A[::2])

print(ans)

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]
sorted_A = sorted(A, reverse=True)

print(sum(sorted_A[1:2*N:2]))

Solution (Python):
N = int(input())
a = sorted(list(map(int, input().split())), reverse=True)[:2 * N]
print(sum(a[1::2]))

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)

sm=[]
count=0
for i in range(3*N):
    if count==N:
        break
    if i%2==1:
        sm.append(A[i])
        count+=1

ans=sum(sm)
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
print(sum(a[n::2]))

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
a.sort(reverse = True)
cnt = n
ind = 0
res = 0
while cnt:
    if ind % 2:
        res += a[ind]
        cnt -= 1
    ind += 1
print(res)

Solution (Python):
n = int(input())
al = list(map(int,input().split()))
al = sorted(al, reverse=True)
ans = 0
for i in range(2*n):
    if i % 2 == 0:
        continue
    ans += al[i]

print(ans)

Solution (Python):
n=int(input())
a=list(map(int, input().split()))
a.sort(reverse=True)
print(sum(a[1:2*n:2]))

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
A = list(map(int,input().split()))
A.sort(reverse = True)
for i in range(n):
  ans += A[i*2 + 1]
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = sorted(list(map(int, input().split())), reverse=True)
    print(sum(A[1:2*N:2]))


if __name__ == '__main__':
    main()

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
a.sort(reverse=1)
ans = 0
cnt = 0
i = 1
while cnt < n:
    ans += a[i]
    i += 2
    cnt += 1
print(ans)

Solution (Python):
N=int(input())
A=list(map(int, input().split()))
A=sorted(A,reverse=True)
print(sum(A[1:][::2][:N]))

Solution (Python):



N = int(input())
a_list = list(map(int, input().split()))


a_list = sorted(a_list, reverse=True)
a_max = 0


for i in range(2*N): 
    if not i%2==0:
        a_max += a_list[i]

print(a_max)

Solution (Python):
n = int(input())
A = sorted(list(map(int, input().split())))[::-1]
print(sum(a for a in A[1:2*n:2]))

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A.sort()
A.reverse()
ans = 0
for i in range(1,2*N,2):
  ans += A[i]
print(ans)

Solution (Python):
N=int(input())
L=list(map(int,input().split()))
L=sorted(L)
K=0
for i in range(N):
	K+=L[i*2+N]
print(K)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a)[::-1]
ans = 0
for i in range(2*n):
    if (i+1)%2==0:
        ans += a[i]
print(ans)

Solution (Python):
n = int(input())
l = sorted(list(map(int,input().split())))
print(sum(l[n::2]))

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    N=int(input())
    A=sorted(list(map(int,input().split())))

    ans=0
    for i in range(N,3*N,2):
        ans+=A[i]
    print(ans)
resolve()

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
print(sum(a[1:2*N:2]))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

a.sort()

print(sum(a[N:][0::2]))

Solution (Python):
n = int(input())
A = list(map(int, input().split()))

A.sort(reverse=True)
ans = 0
for i in range(2*n):
    if i%2 == 1:
        ans += A[i]
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a = sorted(a, reverse=True)

ans = 0
for i in range(n):
    ans += a[2 * i + 1]
print(ans)

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    a = LI()
    a.sort(reverse=True)
    print(sum(a[1:2*n:2]))
    return


if __name__ == "__main__":
    solve()

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A.sort()
print(sum(A[N::2]))

Solution (Python):
n  = int(input())
li = list(map(int,input().split()))
li.sort()
new_li = li[n:]

all_sum = 0
for i,n in enumerate(new_li):
    if i%2 == 0:
        all_sum += n
print(all_sum)

Solution (Python):
from collections import deque
N = int(input())
a = list(map(int,input().split()))
pow = 0
a = deque(sorted(a,reverse = True))
for i in range(N):
  a.popleft()
  pow += a.popleft()
  a.pop()
print(pow)

Solution (Python):

def myAnswer(N:int,A:list) -> int:
   ans = 0
   A.sort(reverse= True)
   for i in range(1,N*2,2):
      ans += A[i]
   return ans


def modelAnswer():
   tmp=1
def main():
   N = int(input())
   A = list(map(int,input().split()))
   print(myAnswer(N,A[:]))
if __name__ == '__main__':
   main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = sum(a[1:2*n+1:2])
print(ans)

Solution (Python):
N = int(input())
a = map(int, input().split())

a = sorted(a)[::-1]
b = a[1::2]

result = 0

for i in range(N):
    result += b[i]

print(result)

Solution (Python):
N = int(input())
INT_LIST_SORETED = sorted([int(s) for s in input().split()], reverse=True)
SECOND_INT_LIST_MAX = [val for idx, val in enumerate(INT_LIST_SORETED)
                       if idx <= 2 * N and idx % 2 == 1]
print(sum(SECOND_INT_LIST_MAX))

Solution (Python):
n = int(input())
data = list(map(int,input().split()))
data = sorted(data, reverse=True)
sum = 0
for i in range(n):
    sum += data[1+2*i]
print(sum)

Solution (Python):
N = int(input())
a = sorted([int(i) for i in input().rstrip().split(' ')])
print(sum(a[N::2]))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
for i in range(1, 2 * n, 2):
    ans += a[i]
print(ans)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 0
count = 0
for i in range(3*n-2,0,-2):
    ans += a[i]
    count += 1
    if count == n:
        print(ans)
        exit()

Solution (Python):
N=int(input())
a=sorted(map(int,input().split()))
ans=0
left=0;right=3*N-1
for i in range(N):
    mid=right-1
    ans+=a[mid]
    right=mid-1
    left+=1
print(ans)

Solution (Python):
n=int(input())
a=[0]*(3*n)
a=list(map(int,input().split()))
a=sorted(a,reverse=True)
ans=0

for i in range(n):
  ans+=a[2*i+1]
print(ans)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))

a.sort(reverse=True)
s = 0

for i in [n*2-1 for n in range(1,N +1)]:
    s += a[i]

print(s)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(n):
 ans+=a[3*n-2-i*2]
 
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a = sorted(a)
a = a[n:]

print(sum(a[0::2]))

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]

a.sort()
a.reverse()
cnt = 0
for i in range(n):
    cnt += a[2*i+1]
print(cnt)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)

ans = sum(a[1:2*n+1:2])
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)
print(sum(a[1:2*n+1:2]))

Solution (Python):
n = int(input())
a = sorted(map(int,input().split()),reverse=True)
ans = 0
t = (n*3)//3
cnt = 0
i = 1 
while cnt<t:
    cnt += 1
    ans += a[i]
    i += 2
print(ans)

Solution (Python):



import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    print(sum(A[N::2]))

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
A.sort()
A.reverse()
ans = 0
for i in range(n):
    ans += A[1 + 2*i]
print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=[int(_) for _ in input().split()]
    A.sort(reverse=True)
    sum_a=0
    for i in range(n):
        sum_a+=A[2*i+1]
    print(sum_a)

if __name__=='__main__':
    main()

Solution (Python):
n = int(input())
a = sorted(list(map(int,input().split())))
print(sum(a[n::2]))

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]

a.sort()
ans=0
for i in a[n::2]:
    ans+=i
print(ans)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
total = 0
for i in range(N):
    total += a[i*2 + 1]
print(total)

Solution (Python):
n=int(input())*3
a=list(map(int,input().split()))
a=sorted(a,reverse=True)
print(sum(a[1:n//3*2:2]))

Solution (Python):
tms=int(input())
strlist=sorted(list(map(int,input().split())))
ans=sum(strlist[tms::][::2])
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a = list(reversed(sorted(a)))
print(sum(a[1::2][:n]))

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
A.sort(reverse=True)

ans = 0

print(sum(A[1::2][:N]))

Solution (Python):
n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)
ans=sum(a[1::2][:n])
print(ans)

Solution (Python):
N=int(input())
A=list(map(int, input().split()))
A=sorted(A, reverse=True)
ans=sum(A[1::2][:N])
print(ans)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)

ans = 0
for i in range(N):
    print
    ans += a[i * 2 + 1]
print(ans)

Solution (Python):
tms=int(input())

strong_list=list(map(int,input().split()))

strong_list.sort()

ans=sum(strong_list[tms::][::2])
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    N=int(input())
    A=sorted(list(map(int,input().split())))
    i=0
    cnt=0
    while True:
        try:
            cnt+=A[N+2*i]
            i+=1
        except:
            break
    print(cnt)




resolve()

Solution (Python):
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    A.sort()
    print(sum(A[-2:-2*N-1:-2]))


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a,reverse=True)
ans = 0
for i in range(0,2*n):
    if i%2==1:
        ans += a[i]
print(ans)

Solution (Python):
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
ans = 0
for a in A[1:2*N:2]:
    ans += a
print(ans)

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    A.sort(reverse = True)
    ans = 0
    for i in range(N):
        ans += A[2 * i + 1]
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
n = int(input())
List = sorted(list(map(int,input().split())))[::-1]
print(sum([List[2*x+1] for x in range(n)]))