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.



Sample input:
2
5 2 8 5 1 5


Sample output:
10

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a1, a2, a3 = [], [], []
for i in range(N):
    a1.append(a[i])
    a3.append(a[-(2*i+1)])
    a2.append(a[-(2*i+2)])

print(sum(a2))

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = onem()

a = l()

a.sort(reverse = True)

po = 0

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

Submission status: Accepted

Solution code:
#template
from collections import Counter
def inputlist(): return [int(j) for j in input().split()]
#template
N = int(input())
a = inputlist()
a.sort()
a.reverse()
ans = 0
for i in range(N):
    j = 2*i+1
    ans += a[j]
print(ans)

Submission status: Accepted

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

li.sort()


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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a.sort()
del a[:n]

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

print(total)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
arr = sorted(list(map(int, input().split())))
ans = 0
count =  0
for i in range(N,3*N):
    if count % 2 == 0:
        ans += arr[i]
    count += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())


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

sum = 0
cnt = 0
a.sort(reverse=True)

for i in range(1,len(a),2):
    sum += a[i]
    cnt += 1
    if cnt == n:
        break

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

num = 0
a.sort(reverse=True)
i = 1
j = 0
while j < n:
    num += a[i]
    i += 2
    j += 1
print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:
N=int(input())
L=list(map(int,input().split()))
#print(L)
L.sort()
L=L[N:]
ans=sum(L[::2])
print(ans)

Submission status: Accepted

Solution code:
#coding utf-8

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)

Submission status: Accepted

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

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

Submission status: Accepted

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

cA = 0
for j in range(2, 2 * N + 1, 2):
    cA += A[-j]
print(cA)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
# input = sys.stdin.r/eadline
def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    N = INT()
    A = LI()
    A.sort()
    answer = 0
    for i in range(N):
        answer += A[N+2*i]
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    groups = int(input())
    strength = list(map(int, input().split()))
    strength.sort()
    answer = 0
    for i in range(-2, -2 * groups - 2, -2):
        answer += strength[i]
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

n = int(input())

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

a.sort()

max_sum = 0
for i in range(n):
    max_sum += a[3*n - 2*(i+1)]

print("{}".format(max_sum))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
A.sort()

ans = 0
for _ in range(N):
    MAX = A.pop()
    MID = A.pop()
    ans += MID

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

n = int(input().rstrip())

numbers = list(reversed(sorted(map(int, input().rstrip().split(" ")))))

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

a.sort(reverse=True)
ans = 0
for i in range(1, len(a)-N):
    if i % 2 == 1:
        # print(a[i])
        ans += a[i]
print(ans)

Submission status: Accepted

Solution code:
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
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
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 = sys.maxsize
mod = 10 ** 9 + 7

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

a.sort(reverse=True)
ans=[]
for i in range(1,N+1):
    ans.append(a[i*2-1])
print(sum(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
li_a = list(map(int, input().split()))

print(sum(sorted(li_a)[n::2]))

Submission status: Accepted

Solution code:
N = int(input())
A_list = list(map(int, input().split()))
A_list = sorted(A_list, reverse = True)
A_list1 = A_list[0:2*N]
A_list2 = A_list[2*N:3*N]
print(sum(A_list1[1:2*N:2]))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

A.sort()
total = 0
for i in range(N):
  #print(N + 1 + 2*i)
  total += A[N + 2*i]

print(total)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
elem = list(map(int, input().split()))
elem.sort()
ans = sum(elem[n::2])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,*A=map(int, open(0).read().split())
print(sum(sorted(A)[N::2]))

Submission status: Accepted

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

sa = sorted(a,reverse=True)[0:2 * n]

cs = sa[1::2]

print(sum(cs))

Submission status: Accepted

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

Submission status: Accepted

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

A.sort(reverse=True)
# print('--', A)

ans = 0
for i, ai in enumerate(A):
    if i % 2 == 1 and i < 2 * N:
        # print(ai)
        ans += ai
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A=input().split()
A=[int(a) for a in A]

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

Submission status: Accepted

Solution code:
N = int(input())
list = [int(i) for i in input().split()]

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

print(temp)

Submission status: Accepted

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

Submission status: Accepted

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



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
a = sorted(list(map(int,input().split())))
A = [a[i] for i in range(N,3 * N)]

ans = 0

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


#----------
n = int(input().strip())
a_list = list(map(int, input().rstrip().split()))
#----------
a_list.sort()
a2_list = a_list[n:]

sum=0
for i in range( 0,len(a2_list),2 ):
    sum += a2_list[i]

print(sum)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

Submission status: Accepted

Solution code:
N = int(input())
list_a = [int(x) for x in input().split()]

list_a.sort(reverse = True)
ans = 0

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def examA():
    N = I()
    A = LI()
    A.sort()
    ans = 0
    for i in range(N):
        ans += A[-i*2-2]
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examA()

"""

"""

Submission status: Accepted

Solution code:
N = int(input())
lst = [int(i) for i in input().split(" ")]

lst.sort(reverse = True)
temp = 0

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

print(temp)

Submission status: Accepted

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

a.sort(reverse=True)

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

Submission status: Accepted

Solution code:
n = int(input())
aList = list(map(int, input().split()))
aList.sort()
aList = aList[n:]
sums = 0
for i in range(2 * n):
    if i % 2 == 0:
        sums += aList[i]
print(sums)

Submission status: Accepted

Solution code:
N = input()
print sum(sorted(map(int, raw_input().split()))[N::2])

Submission status: Accepted

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

A.sort(reverse = True)
ans = []
for i in range(int(len(A)/3)): # whileは遅い
    ans.append(A[1+2*i])
print(sum(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(_) for _ in input().split()]
a.sort()
print(sum(a[n:3*n:2]))

Submission status: Accepted

Solution code:
try:
  N = int(input())
  a = list(map(int, input().split()))
  a_ = sorted(a)
  __ = a_[N:]
  b = sorted(__, reverse=True)
  c = [b[i] for i in range(len(b)) if i%2!=0]
  print(sum(c))
except EOFError:
  pass

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
a_ls.sort(reverse=True)
print(sum(a_ls[1::2][:n]))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,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 operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
arr=limii()

arr.sort(reverse=True)
#print(arr)
#print(arr[n//3],arr[(2*n)//3])
ans=0
for i in range(1,n+1):
    ans+=arr[2*i -1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a_lst = [int(x) for x in input().split()]

a_lst.sort(reverse=True)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    # sys.stdin = open("sample.txt")
    N = Scanner.int()
    A = Scanner.map_int()
    A.sort(reverse=True)
    print(sum(A[1:N * 2:2]))
    return


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
a.sort()
#print(a)
# @0~N-1, !N,N+1,!N+2,N+3,!N+4, ... ,!N+N=2N
a = a[N::2]
print(sum(a))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.buffer.readline

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

# ヨコ

# タテ
# m = [int(input()) for _ in range(N)]
a = list(map(int, input().split()))

a.sort()


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

Submission status: Accepted

Solution code:
# coding utf-8

N = int(input())

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

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

Submission status: Accepted

Solution code:
N = int(input())
list3 = list(map(int, input().split()))
list4 = sorted(list3, reverse=True)
res = 0
for i in range(1,N*2,2): # 1 3 5
    res = res + sum(list4[i:i+1])
print(res)

Submission status: Accepted

Solution code:
n = int(input())

l = sorted([int(i) for i in input().split()],reverse = True)

ans = 0

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

Submission status: Accepted

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

A = sorted(a, reverse=True)
B = []
ans = 0
B = A[:2*N]
for i in range(int(len(B)/2)):
    ans += B[2*i+1]

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
print(sum(a[n::2]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
ans = sum(a[n::2])
print(ans)

Submission status: Accepted

Solution code:
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数

N = iin()
a = iln_r()

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

Submission status: Accepted

Solution code:
n = int(input())
al = list(map(int, input().split()))

a_s = sorted(al, reverse=True)
strength = 0

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

print(strength)

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
A = sorted([int(_) for _ in stdin.readline().rstrip().split()])
ans = 0
for i in range(0, N*2, 2):
    ans += A[N+i]
print(ans)

Submission status: Accepted

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

A=sorted(A)

t=0
for i in range(N):
    a=A[3*N-i*2-2]
    t+=a
print(t)

Submission status: Accepted

Solution code:
n = int(input())
lista = list(map(int, input().split()))

lista.sort()

print(sum(lista[-2:(-2 - 2 * n):-2]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
li.sort()
point = 0
for i in range(n):
    point += li[-2*(i+1)]
print(point)

Submission status: Accepted

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

a = sorted(a, reverse=True)
maxScoreArray = []
for i in range(N):
  maxScoreArray.append(a[i*2+1])

print(sum(maxScoreArray))

Submission status: Accepted

Solution code:
N=int(input())
t = list(map(int,input().split()))

newLi = sorted(t, reverse=True)
ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ls = list(map(int, input().split()))

ls.sort(reverse=True)

ans = 0

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

print(ans)

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

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

a.sort()

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

print(ans)

Submission status: Accepted

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

count=0
a.sort(reverse=True)

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

print(count)