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((len(A)//3)*2):
    if i%2==1:
        ans+=A[i]
print(ans)

Submission status: Accepted

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

l = sorted(a, reverse=True)

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

print(ans)

Submission status: Accepted

Solution code:
import heapq

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

ans = 0
b = list(map(lambda x: x * (-1), a))
heapq.heapify(b)
for _ in range(N):
    heapq.heappop(b)
    ans -= heapq.heappop(b)
print(ans)

Submission status: Accepted

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

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

print(p)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
fact = math.factorial
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    a = list(map(int, readline().split()))

    a.sort()

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

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, 2 * n, 2):
    sum += a[i]

print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
arr = arr[n:]
arr2 = [arr[i] for i in range(len(arr)) if i % 2 == 0]
ans = sum(arr2)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def linput(ty=int, cvt=list):
	return cvt(map(ty,input().split()))

def vinput(rep=1, ty=int, cvt=list):
	return cvt(ty(input().rstrip()) for _ in "*"*rep)

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

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

def main():
	N = int(input())
	vA = linput()
	vA.sort()
	vA.reverse()
	
	res = 0
	res = sum(vA[1:2*N+1:2])
	#sT = "No Yes".split()
	#print(sT[res])
	print(res)

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
N = int(input())
A = sorted(map(int, input().split()))[::-1]
I = [1+2*i for i in range(N)]
print(sum(A[i] for i in I))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
la = [int(w) for w in input().split()]
la.sort()
ans = 0
for i in range(1, n+1):
    ans += la[-2 * i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
a.sort()
print(sum(a[i] for i in range(n, 3 * n, 2)))

Submission status: Accepted

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

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)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
from queue import deque
q = deque(a)
ans = 0
for i in range(n):
    v1,v2,v3 = q.popleft(), q.popleft(), q.pop()
    ans += v2
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
ai=list(map(int,input().split()))
l1=sorted(ai,reverse=True)

l2=l1[1::2]
ans=l2[:N]
print(sum(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
from collections import deque

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

A.sort()
B=deque(A)

U=0
while B:
    _=B.popleft()
    _=B.pop()
    x=B.pop()
    U+=x

print(U)

Submission status: Accepted

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

sum_value = 0
for n in range(1,N+1):
    num = a[2*n-1]
    sum_value += num

print(sum_value)

Submission status: Accepted

Solution code:
n=int(input())

a_list=[int(i) for i in input().split()]
a_list.sort(reverse=True)
#print(a_list)
b_list=a_list[1:2*n:2]
#print(b_list)
print(sum(b_list))

Submission status: Accepted

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

Submission status: Accepted

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

print(S)

Submission status: Accepted

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

num = len(a)//3
ans = sum([a[2*x+1] for x in range(num)])
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,*a=map(int, open(0).read().split())
print(sum(sorted(a)[n:][::2]))
'''
why do people think there is a purpose in life'''

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

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

print(ans)

Submission status: Accepted

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

total = 0
for i, num in enumerate(a[N:]):
    if i % 2 == 0:
        total += num

print(total)

Submission status: Accepted

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

Submission status: Accepted

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

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:
def resolve():
    N = int(input())
    A = list(reversed(sorted([int(i) for i in input().split()])))
    sumA = 0
    for i in range(N):
        sumA += A[(2 * i) + 1]
    print(sumA)


resolve()

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy


if __name__ == "__main__":
    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_rev = sorted(a)[::-1]
a_rev = a_rev[1::2]
print(sum(a_rev[:N]))

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
c = 0
x = []
for i in range(2*(n+1)):
    if c%2==0:
        c+=1
        continue
    val = l[c]
    x.append(val)
    c+=1
x=x[:-1]
print(sum(x))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    N = int(input())
    A = sorted(list(map(int, input().split())), reverse=True)

    # print(A)

    ans = 0

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

    # for i in range(N):
    #     ans += A[i + N]

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

ans = 0

for i in range(N):
    ans += lis[i]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = sorted(list(map(int, input().split())),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(reverse=True)
point_sum = 0

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

print(point_sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

# print(f"N:{N} a:{a}", file=sys.stderr)
max_power = 0
for i in range(N):
    max_power += a[(N + 1) + 2 * i]
print(max_power)

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
ans = a[1: 1+2*n:2]
#print(ans)
print(sum(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%2 == 1:
        ans += A[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 += int(a[2*i+1])

print(ans)

Submission status: Accepted

Solution code:
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#, log2, log
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]))

Submission status: Accepted

Solution code:
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#, log2, log
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]))

Submission status: Accepted

Solution code:
## A - AtCoder Group Contest
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#! /usr/bin/env python3

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache


#############
# Constants #
#############

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

#############
# Functions #
#############

######INPUT######
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)]

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

#####Shorten#####
def DD(arg): return defaultdict(arg)


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

######Combination######
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

######Factorization######
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

#####MakeDivisors######
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

#####MakePrimes######
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

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

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

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

#####ChangeBase#####
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))))

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

#############
# Main Code #
#############
N = I()
L = IL()
L.sort(reverse=True)

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

sorted_a = sorted(a_list)

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

Submission status: Accepted

Solution code:
#整数の入力
N = int(input())

#スペース区切りの整数の入力リスト
A_list = list(map(int, input().split()))

A_list = list(reversed(sorted(A_list)))
#print(A_list)



ans  = 0
for i in range(1,2*N,2):
  ans = ans + A_list[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:
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()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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