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):



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

a.sort()
a = a[n:]
ans = 0
for i, ai in enumerate(a):
    if i % 2 == 0:
        ans += ai

print(ans)

Solution (Python):
n = int(input())
alist = list(sorted(map(int, input().split()), key=lambda x: -x))

suma = 0
for i, a in enumerate(alist):
  if i >= 2*n:
    break
  if i % 2 == 1:
    suma += a
print(suma)

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = list(li())

a.sort()
print(sum(a[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(int,input().split()))
a = sorted(a)
ans = 0
for i in range(1,N*3+1,2):
    if i >= N*2+1:
        break
    ans += min(a[-i],a[-i-1])
print(ans)

Solution (Python):
n = int(input())
a = [int(i) for i in 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(reverse=True)
print(sum(a[1:2*n:2]))

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

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

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

Solution (Python):
def solve(N, As):
    As.sort()
    return sum([n for n in As[N::2]])

if __name__ == "__main__":
    N = int(input())
    As = list(map(int, input().split(" ")))
    print(solve(N, As))

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)

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

Solution (Python):


import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
aN = LIST()

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

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

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

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

li.sort()
v = sum(li[n::2])
print(v)

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

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

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

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

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()
a.reverse()

ans = 0

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

Solution (Python):
import sys

input = sys.stdin.readline


def ii():
    return int(input())


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


N = ii()
A = sorted(il())
s = sum(A[N::2])
print(s)

Solution (Python):
N=int(input())
X=sorted([int(a) for a in input().split()])[::-1]

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

Solution (Python):
N = int(input())
inputs = [int(i) for i in input().split()]

inputs.sort()

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

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

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

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

print(ans)

Solution (Python):





def  maxLevel(memberNumber,orgMemberLevelList):
	maxLevelSortedList = sorted(orgMemberLevelList,reverse=True)
	maxLevelScore = 0
	checkMemberCountRange = range(0,memberNumber,+1)
	for i in checkMemberCountRange:
		maxLevelScore = maxLevelScore+maxLevelSortedList[2*i+1]
	answer = maxLevelScore
	return answer


if __name__ == '__main__':
	N = int(input().strip())
	levelNoSortList = list(map(int,input().strip().split(' ')))
	solution=maxLevel(N,levelNoSortList)
	print("{}".format(solution))

Solution (Python):




import time
from contextlib import contextmanager

@contextmanager
def timer(title):
	t0 = time.time()
	yield
	print("{} - done in {:.0f}s".format(title,time.time()-t0) )

def  maxLevel(memberNumber,orgMemberLevelList):
	maxLevelSortedList = sorted(orgMemberLevelList,reverse=True)
	maxLevelScore = 0
	checkMemberCountRange = range(0,memberNumber,+1)
	for i in checkMemberCountRange:
		maxLevelScore = maxLevelScore+maxLevelSortedList[2*i+1]
	answer = maxLevelScore
	return answer


if __name__ == '__main__':
	N = int(input().strip())
	levelNoSortList = list(map(int,input().strip().split(' ')))
	solution=maxLevel(N,levelNoSortList)
	print("{}".format(solution))

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A.sort()
A.reverse()
ans  = 0
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()))

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

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

Member=list(map(int,input().split()))
Member.sort(reverse=True)

ANS=0
for i in range(2*N):
    if i%2==1:
        ANS+=Member[i]
        
print(ANS)

Solution (Python):



def main():
    """Function."""
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()

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

    print(total)


if __name__ == "__main__":
    main()

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

s = [ai for ai in a[N::2]]
print(sum(s))

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




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

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

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

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

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

Solution (Python):
def inpl(): return [int(i) for i in input().split()]
N = int(input())
a = list(reversed(sorted(inpl())))
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()
a = a[::-1]

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

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-2*i]
print(Ans)

Solution (Python):
def main() -> None:
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()

    i = 0
    j = 3 * n - 1

    ans = 0
    while True:
        j -= 1
        i += 1

        if i <= j:
            ans += a[j]
            j -= 1
        else:
            break

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

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

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

Solution (Python):
from collections import deque
n = int(input())
a = list(map(int,input().split()))
a.sort()
a = deque(a)
ans = 0
for i in range(n):
  a.popleft()
  a.pop()
  ans += a.pop()
print(ans)

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

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

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

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

Solution (Python):
N = int(input())
A = sorted(list(map(int,input().split())))
A = A[::-1]

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

print(ans)

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

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

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

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

a.sort()
a.reverse()

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

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

a.sort()
a.reverse()

A = a[1:2*N:2]
B = a[N:2*N]

print(max(sum(A),sum(B)))

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

a_list.sort()
a_list.reverse()
sum_num = 0
count = 0
for i in range(3*N):
    if (i+1) % 2 == 0:
        sum_num += a_list[i]
        count += 1
    if count == N:
        break
print(sum_num)

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

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

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

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

As.sort()

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

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

sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = sorted(list(li()))

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

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

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

Solution (Python):


def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    a_list.sort(reverse=True)

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

    
if __name__ == '__main__':
    main()

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

print(ans)

Solution (Python):
N = int(input())
l = list(map(int, input().split()))
l = sorted(l, reverse = True)
ans = 0
i = 1
while N:
    ans += l[i]
    i += 2
    N -= 1
print(ans)

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

a = sorted(a, reverse=True)

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

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

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

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

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

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

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

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

a.sort()

total = 0

for i in range(N):
    total += a[N+2*i]

print(total)

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.sort()
ans = 0
for i in range(n, len(a), 2):
    ans += a[i]
print(ans)

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

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

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

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

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = list(li())

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(sum(a[1:2*n:2]))

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

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 = sorted(a, reverse = True)
print(sum(a[1:2 * n:2]))

Solution (Python):
n = input()
v = map(int, raw_input().split(' '))

v.sort()

taken = 0
sum = 0

for i in range(len(v) - 2, -1, -2):
	sum += v[i]
	taken += 1

	if taken == n:
		break

print sum

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

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

arr = map(int,raw_input().split())

arr.sort()

ans = 0 
for i in range(3*n-2,n-1,-2):
	ans += arr[i]

print ans

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

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

a.sort()
a.reverse()

ans = 0

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

Solution (Python):
from collections import deque


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

B = deque(A)

ans = 0
for _ in range(N):
    B.pop()
    B.popleft()
    ans += B.pop()
print(ans)

Solution (Python):
N = int(input())
A = [int(_) for _ in input().split()]

r = sum(sorted(A, reverse=True)[1:N*2:2])

print(r)

Solution (Python):
N=int(input())
A=[int(x) for x in 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())
t = sorted(list(map(int, input().split())))
ans = 0
for i in range(n, 3 * n, 2):
	ans += t[i]
print(ans)

Solution (Python):
n = int(input())
array = [int(x) for x in input().split()]
array.sort(reverse=True)
array = array[:(n*2)]
print(sum(array[1::2]))

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

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

inp.sort()
inp.reverse()

i=1
count=0
ans = 0
while(count<N):
    ans += inp[i]
    i += 2
    count += 1

print(ans)

Solution (Python):




if __name__ == '__main__':
    n = int(input())
    a = sorted(list(map(int, input().split())), reverse=True)
    print(sum(a[1:2 * n:2]))

Solution (Python):

import sys
def debug(*args): print(*args, file=sys.stderr)
def exit(): sys.exit(0)

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

a.sort()

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

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

print(ans)

Solution (Python):
def a_atCoder_group_contest(N, A):
    A.sort(reverse=True)
    ans = sum(A[1:2 * N:2])  
    return ans

N = int(input())
A = [int(i) for i in input().split()]
print(a_atCoder_group_contest(N, A))

Solution (Python):
def a_atCoder_group_contest(N, A):
    A.sort()
    ans = 0
    for k in range(N):
        group = [A[k], A[3 * N - (2 * k + 2)], A[3 * N - (2 * k + 1)]]
        ans += group[1]
    return ans

N = int(input())
A = [int(i) for i in input().split()]
print(a_atCoder_group_contest(N, A))

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

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

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

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

    print(s)


if __name__ == '__main__':
    main()

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

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

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

print(sum(A))

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

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

Solution (Python):
import sys

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    A = []
    input_raw = read_func().strip().split()
    for i in range(N * 3):
        A.append(int(input_raw[i]))
    A.sort(reverse = True)
    s = 0L
    for i in range(N):
        s += A[2*i + 1]
    print s


if __name__ == '__main__':
    main()

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

ans = 0
p = 0
i = len(nums) -2

while p < n:
    ans += nums[i]
    i -= 2
    p += 1
print(ans)

Solution (Python):


import sys, math, copy




HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

def main():
    n = int(input())
    ai = list(map(int, input().split()))
    ai = sorted(ai, reverse=True)
    assert len(ai) == n * 3
    res = 0
    for i in range(n):
        res += ai[i * 2 + 1]
    print(res)

main()

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

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

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

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

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

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):
def maximumSum(a):
    foo = 0
    n = len(a)/3
    a = sorted(a)
    for i in xrange(n):
        foo += a[n*3-(i+1)*2]
    return foo

def main():
    n = int(raw_input().strip())
    a = [int(x) for x in raw_input().strip().split()]
    print maximumSum(a)

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
l.sort()
cnt=0
for i in range(n,3*n):
    if((i-n)%2==0):
        cnt+=l[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 += A[2 * i + 1]
print(ans)

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

Solution (Python):


N = int(input())
a = input()
x = 0
b = []

a = a.split()
for i in a:
	b.append(int(i))
b.sort()
for i in range(N):
	c = b[-(2*(i+1))]
	x += int(c)
print(x)

Solution (Python):


N = int(input())
data = input().split(" ")
a = [int(i) for i in data]
sum = 0
a.sort(reverse=True)

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

print(sum)

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

a_s.sort(reverse=True)

total = 0
for i in range(n):
    total += a_s[i*2 + 1]

print(total)

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

ans = 0
for i in range(n):
    ans += xs[3*n-2-i*2]
print(ans)

Solution (Python):

N = int(input())
d = list(map(int,input().split(" ")))
d.sort(reverse = True)
_ans = []
for i in range(N):
    _ans.append(d[2*i+1])
print(sum(_ans))

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def main():
    N = int(input())
    a_list = list(sorted(list(map(int, input().split()))))
    print(sum([a_list[-i * 2 - 2] for i in range(0, N)]))


if __name__ == '__main__':
    main()

Solution (Python):
def group_contest():
	n = int(raw_input())
	a = map(int, raw_input().split(" "))
	a.sort(reverse=True)
	candidates = a[1::2]
	print sum(candidates[:n])

if __name__ == "__main__":
	group_contest()

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

Solution (Python):

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

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





total = 0
cnt = 0
for i in range(3 * N - 2, 0, -2):
    cnt += 1
    total += A[i]

    if cnt == N:
        break
print(total)

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

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

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

Solution (Python):
import sys

stdin = sys.stdin

ns = lambda: stdin.readline()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

N = ni()
a = na()

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

print (sum)

Solution (Python):

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

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

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

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

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

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

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

Solution (Python):
n = int(input())
aa = sorted(map(int, input().split()))
print(sum(x for x, y in zip(*[iter(aa[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 + 1, 2):
    ans += a[i]

print(ans)

Solution (Python):
n = int(raw_input())
ls = map(int, raw_input().split())
ls.sort()
sum = 0
for i in range(n):
    sum += ls[n+i*2]
print sum

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

Solution (Python):

def main():
    N = int(input())
    a_list = get_a_list()

    a_list.sort(reverse=True)

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

    print(sum_second_a)

def get_a_list():
    a_list = []
    strs = input().split()

    for a in strs:
        a_list.append(int(a))

    return a_list


if __name__ == '__main__':
    main()

Solution (Python):

N = int(input())
list_s = input().split(' ')
players = [int(d) for d in list_s]




players.sort()
players = players[::-1]


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

print(sum)

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

P.sort()
P2 = P[N:]

print(str(sum(P2[::2])))

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

    a.sort()
    p = 0
    i = N
    while i < N*3:
        p += a[i]
        i += 2
    print(p)

main()

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

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

a.sort()
res = 0

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

print(res)

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(raw_input())
a = sorted(map(int, raw_input().split()))
print sum([a[i] for i in xrange(3*N-2, N-1, -2)])

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

ans3=0
for i in range(N):
    ans3 += b[i*2+N]

print(ans3)

Solution (Python):


n=int(raw_input())
a=map(int,raw_input().split())
a=sorted(a)
b=a[n::2]
print sum(b)

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

Solution (Python):
n = int(raw_input())
arr = sorted(map(int, raw_input().split()))

print sum(map(lambda i: arr[n + 2 * i], range(n)))

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

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

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