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)
k = 0
for i in range(1, len(A)-N, 2):
  k += A[i]
print(k)

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

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

    return
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, a = int(input()), list(map(int, input().split()))
a.sort(reverse = True)
s = 0
for i in range(n):
  s += a[i * 2 + 1]
print(s)

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

print(sum([a[i] for i in range(len(a)) if i%2==1 and i<n*2]))

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, *A = map(int, read().split())
A.sort()
x = sum(A[N::2])
print(x)

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, *A = map(int, read().split())
A.sort()
x = sum(A[N::2])
print(x)

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(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)
point_sum = 0

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

print(point_sum)

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

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

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

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

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

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

A.sort()
print(sum(A[N::2]))

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

a = [0] + list(map(int, input().split()))
a = sorted(a)


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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a=sorted(a,reverse=True)
ans=0
for i in range(n*2):
    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 = a[1: 1+2*n:2]

print(sum(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):
N = int(input())
A = list(map(int, input().split()))
A.sort()
A.reverse()
print(sum(A[1:N*2:2]))

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

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

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

Solution (Python):
n, *lst = map(int, open(0).read().split())
lst.sort(reverse=1)
print(sum(lst[1:1+2*n:2]))

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

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

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

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

a.sort(reverse=True)
ans = 0

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

print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N = INT()
a = LIST()
a.sort()
print(sum(a[N::2]))

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N = INT()
a = LIST()

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

Solution (Python):

N = int(input())
A = sorted(map(int, input().split()), reverse=True)
val = 0
for n in range(N):
    val += A[ 2*n + 1 ]
print(val)

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

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

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

print(out)

Solution (Python):


import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, *A = map(int, read().split())

A = sorted(A)[::-1]
A = A[1:-N:2]

print(sum(A))

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
li.sort(reverse=True)
print(sum(li[1:2*n: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 != 0:
        ans += A[i]
print(ans)

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

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

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

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




N = I()
L = IL()
L.sort(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 = [int(i) for i in 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_list=list(map(int,input().split()))
a_list.sort(reverse=True)
power=[]
for i in range(N):
    power.append(a_list[2*i+1])
print(sum(power))

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

sorted_a = sorted(a_list)

print(sum(sorted_a[n:3*n:2]))

Solution (Python):

N = int(input())


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

A_list = list(reversed(sorted(A_list)))




ans  = 0
for i in range(1,2*N,2):
  ans = ans + A_list[i]
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):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort(reverse=True)
    ans = 0
    for i in range(N):
        ans += A[i*2 + 1]
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import collections,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
a = sorted(LI())
deque = collections.deque()
for x in a:
    deque.append(x)
ans = 0
for _ in range(N):
    deque.popleft()
    deque.pop()
    ans += deque.pop()
print(ans)

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

a_list.sort(reverse=True)

sum = 0
for i in range(1, 2*N, 2):
    sum += a_list[i]

print(sum)

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

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

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

    print(ans)


    

if __name__ == '__main__':
    main()

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)-1]
print(ans)

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 i in range(n):
  ans=ans+a[2*i+1]
print(ans)

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

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

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

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

Solution (Python):
import sys

input = sys.stdin.readline


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

    a.sort(reverse=True)
    ans = sum(a[:2 * N][1::2])

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
from collections import deque


def main():
    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)


if __name__ == "__main__":
    main()

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

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

Solution (Python):
N=int(input())
als=input().split()
al=[ int(v) for v in als ]
al.sort(reverse=True)

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

print(s)

Solution (Python):
N = int(input())
print(sum(sorted([int(x) for x in input().strip().split()], reverse=True)[1:2*N:2]))

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

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

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

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

Solution (Python):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a_s = sorted(a, reverse=True)
    res = 0
    num = 0
    for i in range(n*3):
        if i % 2 == 1 and num < n:
            res = res + a_s[i]
            num += 1
    print(res)
if __name__ == '__main__':
    main()

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

a_list = map(int, input().split())
a_list = sorted(a_list)

print(sum(a_list[N::2]))

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

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

print(c)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
c = 0
t = 1
while t < 2*n:
  c += a[t]
  t += 2
print(c)

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

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 = sorted(list(map(int, input().split())))[::-1]
print(sum(A[1:2*n:2]))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
r = 2 * N
ans = 0
a.sort(reverse=True)
if a[0] > 10**9:
    exit()
a_choiced = a[0:r][1::2]
for i in a_choiced:
    ans += i
print(ans)

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

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

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

Solution (Python):
import math

N = int(input()) * 3
a = list(map(int, input().split()))
ans = 0

a = sorted(a, reverse = True)

for i in range(1, int(2.0 / 3.0 * float(N)), 2):
    
    ans += a[i]

print(ans)

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

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque

from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
import math




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

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

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

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 = list(map(int,input().split()))
a.sort()
print(sum(a[n::2]))

Solution (Python):






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





a_s = sorted(a, reverse=True)
print(sum(a_s[1:N*2:2]))

Solution (Python):

def inp():
    return(int(input()))



def inlist():
    return(list(map(int, input().split())))



def instr():
    s = input()
    return(list(s[:len(s)]))



def invr():
    return(map(int, input().split()))


N = inp()

a = inlist()
a = sorted(a)
st = 3*N - 1
wk = 0
res = 0
for i in range(N):
    chosen = st - 1
    res += a[chosen]

    wk += 1
    st -= 2

print(res)

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

Solution (Python):

import sys
sys.setrecursionlimit(10**7)

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

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

print(sum([x for i,x in enumerate(sorted(a,reverse=True)[:(n*2)]) if i%2==1]))

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

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

Solution (Python):
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt, ceil
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True




def warshall_floyd(d, n):
    
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d



def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def gcd_list(numbers):
    return reduce(gcd, numbers)






def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P


def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret



n = int(input())
a = sorted(list(map(int, input().split())))
now = -2
ans = 0
for i in range(n):
    ans += a[now]
    now -= 2
print(ans)

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

print(ans)

Solution (Python):
from collections import deque
n = int(input())

a = tuple(map(int,input().split()))
que = deque(sorted(a))

ans = 0
for i in range(n):
  que.popleft()
  que.pop()
  ans+=que.pop()
  
print(ans)

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    A=LI()
    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()))
A.sort(reverse=True)

print(sum(A[i] for i in range(1, 2 * N + 1, 2)))

Solution (Python):
N = int(input())
A = sorted(list(map(int,input().split())),key=lambda x: -x)[:2*N]
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=sorted(a)
print(sum(a[-n*3+n:-1:2]))

Solution (Python):
n = int(input())
a = list(sorted(list(map(int,input().split())),reverse = True))
print(sum(a[1:n*2: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, *a_l = map(int, open(0).read().split())
a_l.sort(reverse = True)
ans = 0
for a in a_l[1:2*n:2]:
    ans += a
print(ans)

Solution (Python):
N = int(input())
member = sorted(map(int, input().split()))
ans = sum(member[N::2])
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):
n = int(input())
a = list(map(int, input().split()))

a.sort()
print(sum(a[n::2]))

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

print(ans)

Solution (Python):
n = int(input())
as_ = list(map(int, input().strip().split()))
as_ = sorted(as_, reverse=True)
total = sum([as_[i] for i in range(n * 2) if i % 2 == 1])
print(total)

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

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

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(groups, eachScore):
    result = 0
    sortEachScore= sorted(eachScore)
    for userNo in range(groups, groups*3, +2):
        result = result + sortEachScore[userNo]
    return result
if __name__ == "__main__":
    N = II()
    AI = LI()
    print("{}".format(solver(N, AI)))

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 = sorted(a,reverse=True)

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

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

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

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

a.sort(reverse=True)

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

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

    A_sorted = sorted(A)[::-1]
    teams = list([] for _ in range(n))
    idx = 0
    count = 0

    for score in A_sorted:
        teams[idx].append(score)
        
        count += 1

        if count == 2:
            if idx == n -1:
                idx = 0
            else:
                idx += 1
            
            count = 0
    
    res = 0

    for team in teams:
        res += team[1]
    
    print(res)

if __name__ == '__main__':
    main()

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

A.sort(reverse=True)

ans = 0

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

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

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

Solution (Python):
n = int(input())
a = sorted(map(int, input().split()))
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(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()

print(sum(A[n:3*n:2]))

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


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
ans = 0

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

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

a.sort(reverse=True)

s = 0
for x in range(1, 2*n+1, 2):
    s += a[x]

print(s)

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

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

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

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

la = sorted(la, reverse=True)


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

print(ans)

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(groupNumber, scoreList):
    allMenbar = 3 * groupNumber
    scoreList.sort()

    secondPositioner = scoreList[groupNumber:allMenbar:+2]

    result = sum(secondPositioner)
    
    return result


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